Files
2026-11-12 06:29:38 +08:00

2 lines
18 KiB
JavaScript

import{t as ye,V as k,f as Pe,ac as Ce,a$ as Ie,au as Ne,aP as Ae,E as q,ai as Re,ak as $e,a5 as ce,v as Se,x as ke}from"./index-DiaaLdUu.js";import{r as l,j as p}from"./react-vendor-jWT2yUdV.js";import{f as je}from"./chunk-RJKRL3AU-CjtrMR1U.js";import{$ as Ee}from"./useHover-DC1o5-bm.js";import{$ as Te}from"./usePress-BrNwsdVw.js";import{t as Fe}from"./index-BV9-YCKp.js";var te=ye({slots:{base:["p-2.5","-m-2.5","overflow-x-scroll","scrollbar-hide"],wrapper:["flex","flex-nowrap","h-fit","max-w-fit","relative","gap-1","items-center","overflow-visible"],item:["tap-highlight-transparent","select-none","touch-none"],prev:"",next:"",cursor:["absolute","flex","overflow-visible","items-center","justify-center","origin-center","left-0","select-none","touch-none","pointer-events-none","z-20"],forwardIcon:["hidden","group-hover:block","group-data-[focus-visible=true]:block","data-[before=true]:rotate-180"],ellipsis:"group-hover:hidden group-data-[focus-visible=true]:hidden",chevronNext:"rotate-180"},variants:{variant:{bordered:{item:["border-medium","border-default","bg-transparent","data-[hover=true]:bg-default-100"]},light:{item:"bg-transparent"},flat:{},faded:{item:["border-medium","border-default"]}},color:{default:{cursor:k.solid.default},primary:{cursor:k.solid.primary},secondary:{cursor:k.solid.secondary},success:{cursor:k.solid.success},warning:{cursor:k.solid.warning},danger:{cursor:k.solid.danger}},size:{sm:{},md:{},lg:{}},radius:{none:{},sm:{},md:{},lg:{},full:{}},isCompact:{true:{wrapper:"gap-0 shadow-sm",item:["shadow-none","first-of-type:rounded-e-none","last-of-type:rounded-s-none","[&:not(:first-of-type):not(:last-of-type)]:rounded-none"],prev:"!rounded-e-none",next:"!rounded-s-none"}},isDisabled:{true:{base:"opacity-disabled pointer-events-none"}},showShadow:{true:{}},disableCursorAnimation:{true:{cursor:"hidden"}},disableAnimation:{true:{item:"transition-none",cursor:"transition-none"},false:{item:["data-[pressed=true]:scale-[0.97]","transition-transform-background"],cursor:["data-[moving=true]:transition-transform","!data-[moving=true]:duration-300","opacity-0","data-[moving]:opacity-100"]}}},defaultVariants:{variant:"flat",color:"primary",size:"md",radius:"md",isCompact:!1,isDisabled:!1,showShadow:!1,disableCursorAnimation:!1},compoundVariants:[{showShadow:!0,color:"default",class:{cursor:[k.shadow.default,"shadow-md"]}},{showShadow:!0,color:"primary",class:{cursor:[k.shadow.primary,"shadow-md"]}},{showShadow:!0,color:"secondary",class:{cursor:[k.shadow.secondary,"shadow-md"]}},{showShadow:!0,color:"success",class:{cursor:[k.shadow.success,"shadow-md"]}},{showShadow:!0,color:"warning",class:{cursor:[k.shadow.warning,"shadow-md"]}},{showShadow:!0,color:"danger",class:{cursor:[k.shadow.danger,"shadow-md"]}},{isCompact:!0,variant:"bordered",class:{item:"[&:not(:first-of-type)]:ms-[calc(theme(borderWidth.2)*-1)]"}},{disableCursorAnimation:!0,color:"default",class:{item:["data-[active=true]:bg-default-400","data-[active=true]:border-default-400","data-[active=true]:text-default-foreground"]}},{disableCursorAnimation:!0,color:"primary",class:{item:["data-[active=true]:bg-primary","data-[active=true]:border-primary","data-[active=true]:text-primary-foreground"]}},{disableCursorAnimation:!0,color:"secondary",class:{item:["data-[active=true]:bg-secondary","data-[active=true]:border-secondary","data-[active=true]:text-secondary-foreground"]}},{disableCursorAnimation:!0,color:"success",class:{item:["data-[active=true]:bg-success","data-[active=true]:border-success","data-[active=true]:text-success-foreground"]}},{disableCursorAnimation:!0,color:"warning",class:{item:["data-[active=true]:bg-warning","data-[active=true]:border-warning","data-[active=true]:text-warning-foreground"]}},{disableCursorAnimation:!0,color:"danger",class:{item:["data-[active=true]:bg-danger","data-[active=true]:border-danger","data-[active=true]:text-danger-foreground"]}},{disableCursorAnimation:!0,showShadow:!0,color:"default",class:{item:["data-[active=true]:shadow-md","data-[active=true]:shadow-default/50"]}},{disableCursorAnimation:!0,showShadow:!0,color:"primary",class:{item:["data-[active=true]:shadow-md","data-[active=true]:shadow-primary/40"]}},{disableCursorAnimation:!0,showShadow:!0,color:"secondary",class:{item:["data-[active=true]:shadow-md","data-[active=true]:shadow-secondary/40"]}},{disableCursorAnimation:!0,showShadow:!0,color:"success",class:{item:["data-[active=true]:shadow-md","data-[active=true]:shadow-success/40"]}},{disableCursorAnimation:!0,showShadow:!0,color:"warning",class:{item:["data-[active=true]:shadow-md","data-[active=true]:shadow-warning/40"]}},{disableCursorAnimation:!0,showShadow:!0,color:"danger",class:{item:["data-[active=true]:shadow-md","data-[active=true]:shadow-danger/40"]}}],compoundSlots:[{slots:["item","prev","next"],class:["flex","flex-wrap","truncate","box-border","outline-none","items-center","justify-center","text-default-foreground",...Pe,"data-[disabled=true]:text-default-300","data-[disabled=true]:pointer-events-none"]},{slots:["item","prev","next"],variant:["flat","bordered","faded"],class:["shadow-sm"]},{slots:["item","prev","next"],variant:"flat",class:["bg-default-100","[&[data-hover=true]:not([data-active=true])]:bg-default-200","active:bg-default-300"]},{slots:["item","prev","next"],variant:"faded",class:["bg-default-50","[&[data-hover=true]:not([data-active=true])]:bg-default-100","active:bg-default-200"]},{slots:["item","prev","next"],variant:"light",class:["[&[data-hover=true]:not([data-active=true])]:bg-default-100","active:bg-default-200"]},{slots:["item","cursor","prev","next"],size:"sm",class:"min-w-8 w-8 h-8 text-tiny"},{slots:["item","cursor","prev","next"],size:"md",class:"min-w-9 w-9 h-9 text-small"},{slots:["item","cursor","prev","next"],size:"lg",class:"min-w-10 w-10 h-10 text-medium"},{slots:["wrapper","item","cursor","prev","next"],radius:"none",class:"rounded-none"},{slots:["wrapper","item","cursor","prev","next"],radius:"sm",class:"rounded-small"},{slots:["wrapper","item","cursor","prev","next"],radius:"md",class:"rounded-medium"},{slots:["wrapper","item","cursor","prev","next"],radius:"lg",class:"rounded-large"},{slots:["wrapper","item","cursor","prev","next"],radius:"full",class:"rounded-full"}]});function Le(e={}){let{autoFocus:r=!1,isTextInput:s,within:a}=e,t=l.useRef({isFocused:!1,isFocusVisible:r||Ce()}),[o,i]=l.useState(!1),[y,f]=l.useState(()=>t.current.isFocused&&t.current.isFocusVisible),c=l.useCallback(()=>f(t.current.isFocused&&t.current.isFocusVisible),[]),m=l.useCallback(d=>{t.current.isFocused=d,i(d),c()},[c]);Ie(d=>{t.current.isFocusVisible=d,c()},[],{isTextInput:s});let{focusProps:I}=Ne({isDisabled:a,onFocusChange:m}),{focusWithinProps:g}=Ae({isDisabled:!a,onFocusWithinChange:m});return{isFocused:o,isFocusVisible:y,focusProps:a?g:I}}function G(e){const r=l.useRef(null);return l.useImperativeHandle(e,()=>r.current),r}function st(e){return typeof e=="function"}var j=e=>e?"true":void 0;function le(e){var r,s,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e))for(r=0;r<e.length;r++)e[r]&&(s=le(e[r]))&&(a&&(a+=" "),a+=s);else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function D(...e){for(var r=0,s,a,t="";r<e.length;)(s=e[r++])&&(a=le(s))&&(t&&(t+=" "),t+=a);return t}var at=(...e)=>{let r=" ";for(const s of e)if(typeof s=="string"&&s.length>0){r=s;break}return r};function Ve(e){if(!e||typeof e!="object")return"";try{return JSON.stringify(e)}catch{return""}}function _(e,r){const s=r-e+1;return Array.from({length:s},(a,t)=>t+e)}function ue(...e){return(...r)=>{for(let s of e)typeof s=="function"&&s(...r)}}var re=new Map;function De(e,r){if(e===r)return e;let s=re.get(e);if(s)return s.forEach(t=>t.current=r),r;let a=re.get(r);return a?(a.forEach(t=>t.current=e),e):r}function Me(...e){let r={...e[0]};for(let s=1;s<e.length;s++){let a=e[s];for(let t in a){let o=r[t],i=a[t];typeof o=="function"&&typeof i=="function"&&t[0]==="o"&&t[1]==="n"&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90?r[t]=ue(o,i):(t==="className"||t==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?r[t]=D(o,i):t==="id"&&o&&i?r.id=De(o,i):r[t]=i!==void 0?i:o}}return r}function ot(...e){return e.length===1&&e[0]?e[0]:r=>{let s=!1;const a=e.map(t=>{const o=se(t,r);return s||(s=typeof o=="function"),o});if(s)return()=>{a.forEach((t,o)=>{typeof t=="function"?t==null||t():se(e[o],null)})}}}function se(e,r){if(typeof e=="function")return()=>e(r);e!=null&&"current"in e&&(e.current=r)}var de=q((e,r)=>{const{as:s,activePage:a,...t}=e,o=s||"span",i=G(r);return p.jsx(o,{ref:i,"aria-hidden":!0,...t,children:a})});de.displayName="HeroUI.PaginationCursor";var Oe=de;function _e(e){const{as:r,ref:s,value:a,children:t,isActive:o,isDisabled:i,onPress:y,onClick:f,getAriaLabel:c,className:m,...I}=e,g=!!(e!=null&&e.href),d=r||g?"a":"li",P=typeof d=="string",w=G(s),b=Re(),L=l.useMemo(()=>o?`${c==null?void 0:c(a)} active`:c==null?void 0:c(a),[a,o]),{isPressed:N,pressProps:A}=Te({isDisabled:i,onPress:y}),{focusProps:v,isFocused:E,isFocusVisible:V}=Le({}),{isHovered:C,hoverProps:T}=Ee({isDisabled:i});return{Component:d,children:t,ariaLabel:L,isFocused:E,isFocusVisible:V,getItemProps:(x={})=>({ref:w,role:"button",tabIndex:i?-1:0,"aria-label":L,"aria-current":j(o),"aria-disabled":j(i),"data-disabled":j(i),"data-active":j(o),"data-focus":j(E),"data-hover":j(C),"data-pressed":j(N),"data-focus-visible":j(V),...Me(x,A,v,T,je(I,{enabled:P})),className:D(m,x.className),onClick:M=>{ue(A==null?void 0:A.onClick,f)(M),$e(M,b,x.href,x.routerOptions)}})}}var fe=q((e,r)=>{const{Component:s,children:a,getItemProps:t}=_e({...e,ref:r});return p.jsx(s,{...t(),children:a})});fe.displayName="HeroUI.PaginationItem";var H=fe,h=(e=>(e.DOTS="dots",e.PREV="prev",e.NEXT="next",e))(h||{});function Xe(e){const{page:r,total:s,siblings:a=1,boundaries:t=1,initialPage:o=1,showControls:i=!1,onChange:y}=e,[f,c]=l.useState(r||o),{direction:m}=ce(),I=m==="rtl",g=v=>{c(v),y&&y(v)};l.useEffect(()=>{r&&r!==f&&c(r)},[r]);const d=l.useCallback(v=>{v<=0?g(1):v>s?g(s):g(v)},[s,f,g]),P=()=>d(f+1),w=()=>d(f-1),b=()=>d(1),L=()=>d(s),N=l.useCallback(v=>i?["prev",...v,"next"]:v,[I,i]);return{range:l.useMemo(()=>{if(a*2+3+t*2>=s)return N(_(1,s));const E=Math.max(f-a,t),V=Math.min(f+a,s-t),C=E>t+2,T=V<s-(t+1);if(!C&&T){const R=a*2+t+2;return N([..._(1,R),"dots",..._(s-(t-1),s)])}if(C&&!T){const R=t+1+2*a;return N([..._(1,t),"dots",..._(s-R,s)])}return N([..._(1,t),"dots",..._(E,V),"dots",..._(s-t+1,s)])},[s,f,a,t,N]),activePage:f,setPage:d,next:P,previous:w,first:b,last:L}}function We({threshold:e=0,root:r=null,rootMargin:s="0%",isEnabled:a=!0,freezeOnceVisible:t=!1,initialIsIntersecting:o=!1,onChange:i}={}){var y;const[f,c]=l.useState(null),[m,I]=l.useState(()=>({isIntersecting:o,entry:void 0})),g=l.useRef();g.current=i;const d=((y=m.entry)==null?void 0:y.isIntersecting)&&t;l.useEffect(()=>{if(!a||!f||!("IntersectionObserver"in window)||d)return;const b=new IntersectionObserver(L=>{const N=Array.isArray(b.thresholds)?b.thresholds:[b.thresholds];L.forEach(A=>{const v=A.isIntersecting&&N.some(E=>A.intersectionRatio>=E);I({isIntersecting:v,entry:A}),g.current&&g.current(v,A)})},{threshold:e,root:r,rootMargin:s});return b.observe(f),()=>{b.disconnect()}},[f,a,JSON.stringify(e),r,s,d,t]);const P=l.useRef(null);l.useEffect(()=>{var b;!f&&((b=m.entry)!=null&&b.target)&&!t&&!d&&P.current!==m.entry.target&&(P.current=m.entry.target,I({isIntersecting:o,entry:void 0}))},[f,m.entry,t,d,o]);const w=[c,!!m.isIntersecting,m.entry];return w.ref=w[0],w.isIntersecting=w[1],w.entry=w[2],w}var ae=300;function Ue(e){var r,s,a,t;const o=Se(),[i,y]=ke(e,te.variantKeys),{as:f,ref:c,classNames:m,dotsJump:I=5,loop:g=!1,showControls:d=!1,total:P=1,initialPage:w=1,page:b,siblings:L,boundaries:N,onChange:A,className:v,renderItem:E,getItemAriaLabel:V,...C}=i,T=f||"nav",R=G(c),x=l.useRef(null),M=l.useRef(),n=l.useRef(),F=(s=(r=e==null?void 0:e.disableAnimation)!=null?r:o==null?void 0:o.disableAnimation)!=null?s:!1,S=(t=(a=e==null?void 0:e.disableCursorAnimation)!=null?a:F)!=null?t:!1;function O(){return M.current||(M.current=new Map),M.current}function U(u,X){const z=O();u?z.set(X,u):z.delete(X)}function J(u,X){const B=O().get(u);if(!B||!x.current)return;n.current&&clearTimeout(n.current),Fe(B,{scrollMode:"always",behavior:"smooth",block:"start",inline:"start",boundary:R.current});const{offsetLeft:K}=B;if(X){x.current.setAttribute("data-moving","false"),x.current.style.transform=`translateX(${K}px) scale(1)`;return}x.current.setAttribute("data-moving","true"),x.current.style.transform=`translateX(${K}px) scale(1.1)`,n.current=setTimeout(()=>{x.current&&(x.current.style.transform=`translateX(${K}px) scale(1)`),n.current=setTimeout(()=>{var ee;(ee=x.current)==null||ee.setAttribute("data-moving","false"),n.current&&clearTimeout(n.current)},ae)},ae)}const{range:pe,activePage:$,setPage:Q,previous:be,next:ge,first:he,last:ve}=Xe({page:b,total:P,initialPage:w,siblings:L,boundaries:N,showControls:d,onChange:A}),[we,Y]=We();l.useEffect(()=>{R.current&&we(R.current)},[R.current]);const Z=l.useRef($);l.useEffect(()=>{$&&!F&&Y&&J($,$===Z.current),Z.current=$},[b,$,F,S,Y,e.dotsJump,e.isCompact,e.showControls]);const W=l.useMemo(()=>te({...y,disableAnimation:F,disableCursorAnimation:S}),[Ve(y),S,F]),xe=D(m==null?void 0:m.base,v);return{Component:T,showControls:d,dotsJump:I,slots:W,classNames:m,loop:g,total:P,range:pe,activePage:$,getItemRef:U,disableAnimation:F,disableCursorAnimation:S,setPage:Q,onPrevious:()=>g&&$===1?ve():be(),onNext:()=>g&&$===P?he():ge(),renderItem:E,getBaseProps:(u={})=>({...u,ref:R,role:"navigation","aria-label":u["aria-label"]||"pagination navigation","data-slot":"base","data-controls":j(d),"data-loop":j(g),"data-dots-jump":I,"data-total":P,"data-active-page":$,className:W.base({class:D(xe,u==null?void 0:u.className)}),...C}),getWrapperProps:(u={})=>({...u,"data-slot":"wrapper",className:W.wrapper({class:D(m==null?void 0:m.wrapper,u==null?void 0:u.className)})}),getItemProps:(u={})=>({...u,ref:X=>U(X,u.value),"data-slot":"item",isActive:u.value===$,className:W.item({class:D(m==null?void 0:m.item,u==null?void 0:u.className)}),onPress:()=>{u.value!==$&&Q(u.value)}}),getCursorProps:(u={})=>({...u,ref:x,activePage:$,"data-slot":"cursor",className:W.cursor({class:D(m==null?void 0:m.cursor,u==null?void 0:u.className)})}),getItemAriaLabel:u=>{if(u){if(V)return V(u);switch(u){case h.DOTS:return"dots element";case h.PREV:return"previous page button";case h.NEXT:return"next page button";case"first":return"first page button";case"last":return"last page button";default:return`pagination item ${u}`}}}}}var oe=e=>p.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"1em",shapeRendering:"geometricPrecision",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",viewBox:"0 0 24 24",width:"1em",...e,children:[p.jsx("circle",{cx:"12",cy:"12",fill:"currentColor",r:"1"}),p.jsx("circle",{cx:"19",cy:"12",fill:"currentColor",r:"1"}),p.jsx("circle",{cx:"5",cy:"12",fill:"currentColor",r:"1"})]}),ne=e=>p.jsxs("svg",{"aria-hidden":"true",fill:"none",focusable:"false",height:"1em",role:"presentation",shapeRendering:"geometricPrecision",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",viewBox:"0 0 24 24",width:"1em",...e,children:[p.jsx("path",{d:"M13 17l5-5-5-5"}),p.jsx("path",{d:"M6 17l5-5-5-5"})]}),ie=e=>p.jsx("svg",{"aria-hidden":"true",fill:"none",focusable:"false",height:"1em",role:"presentation",viewBox:"0 0 24 24",width:"1em",...e,children:p.jsx("path",{d:"M15.5 19l-7-7 7-7",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})}),me=q((e,r)=>{const{Component:s,dotsJump:a,slots:t,classNames:o,total:i,range:y,loop:f,activePage:c,disableCursorAnimation:m,disableAnimation:I,renderItem:g,onNext:d,onPrevious:P,setPage:w,getItemAriaLabel:b,getItemRef:L,getBaseProps:N,getWrapperProps:A,getItemProps:v,getCursorProps:E}=Ue({...e,ref:r}),{direction:V}=ce(),C=V==="rtl",T=l.useCallback(n=>n===h.PREV&&!C||n===h.NEXT&&C?p.jsx(ie,{}):p.jsx(ie,{className:t.chevronNext({class:o==null?void 0:o.chevronNext})}),[t,C]),R=l.useCallback(n=>p.jsx(H,{className:t.prev({class:o==null?void 0:o.prev}),"data-slot":"prev",getAriaLabel:b,isDisabled:!f&&c===1,value:n,onPress:P,children:T(h.PREV)},h.PREV),[t,o,f,c,C,i,b,P]),x=l.useCallback(n=>p.jsx(H,{className:t.next({class:D(o==null?void 0:o.next)}),"data-slot":"next",getAriaLabel:b,isDisabled:!f&&c===i,value:n,onPress:d,children:T(h.NEXT)},h.NEXT),[t,o,f,c,C,i,b,d]),M=l.useCallback((n,F)=>{const S=F<y.indexOf(c);if(g&&typeof g=="function"){let O=typeof n=="number"?n:F;n===h.NEXT&&(O=c+1),n===h.PREV&&(O=c-1),n===h.DOTS&&(O=S?c-a>=1?c-a:1:c+a<=i?c+a:i);const U={[h.PREV]:T(h.PREV),[h.NEXT]:T(h.NEXT),[h.DOTS]:p.jsxs(p.Fragment,{children:[p.jsx(oe,{className:t==null?void 0:t.ellipsis({class:o==null?void 0:o.ellipsis})}),p.jsx(ne,{className:t==null?void 0:t.forwardIcon({class:o==null?void 0:o.forwardIcon}),"data-before":j(S)})]})};return g({value:n,index:F,key:`${n}-${F}`,page:O,total:i,children:typeof n=="number"?n:U[n],activePage:c,dotsJump:a,isBefore:S,isActive:n===c,isPrevious:n===c-1,isNext:n===c+1,isFirst:n===1,isLast:n===i,onNext:d,onPrevious:P,setPage:w,onPress:()=>w(O),ref:typeof n=="number"?J=>L(J,n):void 0,className:t.item({class:o==null?void 0:o.item}),getAriaLabel:b})}return n===h.PREV?R(n):n===h.NEXT?x(n):n===h.DOTS?p.jsxs(H,{className:t.item({class:D(o==null?void 0:o.item,"group")}),"data-slot":"item",getAriaLabel:b,value:n,onPress:()=>w(S?c-a>=1?c-a:1:c+a<=i?c+a:i),children:[p.jsx(oe,{className:t==null?void 0:t.ellipsis({class:o==null?void 0:o.ellipsis})}),p.jsx(ne,{className:t==null?void 0:t.forwardIcon({class:o==null?void 0:o.forwardIcon}),"data-before":j(C?!S:S)})]},h.DOTS+S):l.createElement(H,{...v({value:n}),key:n,getAriaLabel:b},n)},[C,c,a,v,f,y,g,t,o,i,b,d,P,w,R,x]);return p.jsx(s,{...N(),children:p.jsxs("ul",{...A(),children:[!m&&!I&&p.jsx(Oe,{...E()}),y.map(M)]})})});me.displayName="HeroUI.Pagination";var nt=me;export{Le as $,Me as a,D as b,ue as c,j as d,st as i,ot as m,Ve as o,nt as p,at as s,G as u};