@tom2012/cc-web 1.5.63 → 1.5.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{c as Pe,r as l,ah as re,ai as Y,aj as He,j as r,ak as K,al as z,am as _e,e as Q,an,R as Ce,ao as We,ap as jt,aq as Zo,ar as Rt,as as Jo,at as Qo,au as er,av as tr,aw as nr,ax as or,q as rr,ay as sr,K as ir,L as ar,N as cr,O as lr,Q as dr,B as ee,T as ue,I as je,U as ur,az as $t,aA as mt,aB as fr,aC as pr,aD as mr,a5 as cn,aE as hr,l as ln,aF as xr,a3 as gr,aG as vr,a4 as yr,v as wr,A as br,o as Sr,X as Cr,aH as Nr,aI as jr,aJ as Rr,aK as Ar,aL as Tr,aM as Pr,aN as Ht,aO as Er,t as lt,s as Ir,S as Or}from"./index-Ce-Kt5WI.js";import{C as dn}from"./chevron-down-BZ0Z28_W.js";import{a as kr,C as _r,g as Dr,T as Vt,S as Wt}from"./PomodoroTimer-Cbu79gCk.js";/**
1
+ import{c as Pe,r as l,ai as re,aj as Y,ak as He,j as r,al as K,am as z,an as _e,e as J,ao as an,R as Ce,ap as We,aq as jt,ar as Zo,as as Rt,at as Qo,au as Jo,av as er,aw as tr,ax as nr,ay as or,q as rr,az as sr,K as ir,L as ar,N as cr,O as lr,Q as dr,B as ee,T as ue,I as je,U as ur,aA as $t,aB as mt,aC as fr,aD as pr,aE as mr,a5 as cn,aF as hr,l as ln,aG as xr,a3 as gr,aH as vr,aI as yr,a4 as wr,aJ as Ht,v as br,A as Sr,o as Cr,X as Nr,aK as jr,aL as Rr,aM as Ar,aN as Tr,aO as Pr,aP as Er,aQ as Vt,aR as Ir,t as lt,s as Or,S as kr}from"./index-DMpawgXi.js";import{C as dn}from"./chevron-down-BvLcxBa7.js";import{a as _r,C as Dr,S as Wt}from"./save-CBWPIysf.js";/**
2
2
  * @license lucide-react v0.309.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -33,4 +33,4 @@ import{c as Pe,r as l,ah as re,ai as Y,aj as He,j as r,ak as K,al as z,am as _e,
33
33
  *
34
34
  * This source code is licensed under the ISC license.
35
35
  * See the LICENSE file in the root directory of this source tree.
36
- */const $r=Pe("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);function un(e){const t=l.useRef({value:e,previous:e});return l.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function fn(e){const[t,n]=l.useState(void 0);return re(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let i,c;if("borderBoxSize"in a){const d=a.borderBoxSize,u=Array.isArray(d)?d[0]:d;i=u.inlineSize,c=u.blockSize}else i=e.offsetWidth,c=e.offsetHeight;n({width:i,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var et="Switch",[Hr]=_e(et),[Vr,Wr]=Hr(et),pn=l.forwardRef((e,t)=>{const{__scopeSwitch:n,name:o,checked:s,defaultChecked:a,required:i,disabled:c,value:d="on",onCheckedChange:u,form:f,...p}=e,[v,h]=l.useState(null),w=Y(t,g=>h(g)),m=l.useRef(!1),x=v?f||!!v.closest("form"):!0,[b,y]=He({prop:s,defaultProp:a??!1,onChange:u,caller:et});return r.jsxs(Vr,{scope:n,checked:b,disabled:c,children:[r.jsx(K.button,{type:"button",role:"switch","aria-checked":b,"aria-required":i,"data-state":gn(b),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:w,onClick:z(e.onClick,g=>{y(S=>!S),x&&(m.current=g.isPropagationStopped(),m.current||g.stopPropagation())})}),x&&r.jsx(xn,{control:v,bubbles:!m.current,name:o,value:d,checked:b,required:i,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});pn.displayName=et;var mn="SwitchThumb",hn=l.forwardRef((e,t)=>{const{__scopeSwitch:n,...o}=e,s=Wr(mn,n);return r.jsx(K.span,{"data-state":gn(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t})});hn.displayName=mn;var zr="SwitchBubbleInput",xn=l.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:o=!0,...s},a)=>{const i=l.useRef(null),c=Y(i,a),d=un(n),u=fn(t);return l.useEffect(()=>{const f=i.current;if(!f)return;const p=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&h){const w=new Event("click",{bubbles:o});h.call(f,n),f.dispatchEvent(w)}},[d,n,o]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});xn.displayName=zr;function gn(e){return e?"checked":"unchecked"}var vn=pn,Ur=hn;const yn=l.forwardRef(({className:e,...t},n)=>r.jsx(vn,{className:Q("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:r.jsx(Ur,{className:Q("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));yn.displayName=vn.displayName;function Ut(e){const t=Kr(e),n=l.forwardRef((o,s)=>{const{children:a,...i}=o,c=l.Children.toArray(a),d=c.find(Yr);if(d){const u=d.props.children,f=c.map(p=>p===d?l.Children.count(u)>1?l.Children.only(null):l.isValidElement(u)?u.props.children:null:p);return r.jsx(t,{...i,ref:s,children:l.isValidElement(u)?l.cloneElement(u,void 0,f):null})}return r.jsx(t,{...i,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function Kr(e){const t=l.forwardRef((n,o)=>{const{children:s,...a}=n;if(l.isValidElement(s)){const i=qr(s),c=Xr(a,s.props);return s.type!==l.Fragment&&(c.ref=o?an(o,i):i),l.cloneElement(s,c)}return l.Children.count(s)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Gr=Symbol("radix.slottable");function Yr(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Gr}function Xr(e,t){const n={...t};for(const o in t){const s=e[o],a=t[o];/^on[A-Z]/.test(o)?s&&a?n[o]=(...c)=>{const d=a(...c);return s(...c),d}:s&&(n[o]=s):o==="style"?n[o]={...s,...a}:o==="className"&&(n[o]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function qr(e){var o,s;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function wn(e){const t=e+"CollectionProvider",[n,o]=_e(t),[s,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:x,children:b}=m,y=Ce.useRef(null),g=Ce.useRef(new Map).current;return r.jsx(s,{scope:x,itemMap:g,collectionRef:y,children:b})};i.displayName=t;const c=e+"CollectionSlot",d=Ut(c),u=Ce.forwardRef((m,x)=>{const{scope:b,children:y}=m,g=a(c,b),S=Y(x,g.collectionRef);return r.jsx(d,{ref:S,children:y})});u.displayName=c;const f=e+"CollectionItemSlot",p="data-radix-collection-item",v=Ut(f),h=Ce.forwardRef((m,x)=>{const{scope:b,children:y,...g}=m,S=Ce.useRef(null),N=Y(x,S),R=a(f,b);return Ce.useEffect(()=>(R.itemMap.set(S,{ref:S,...g}),()=>void R.itemMap.delete(S))),r.jsx(v,{[p]:"",ref:N,children:y})});h.displayName=f;function w(m){const x=a(e+"CollectionConsumer",m);return Ce.useCallback(()=>{const y=x.collectionRef.current;if(!y)return[];const g=Array.from(y.querySelectorAll(`[${p}]`));return Array.from(x.itemMap.values()).sort((R,A)=>g.indexOf(R.ref.current)-g.indexOf(A.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:h},w,o]}var Zr=l.createContext(void 0);function At(e){const t=l.useContext(Zr);return e||t||"ltr"}var dt="rovingFocusGroup.onEntryFocus",Jr={bubbles:!1,cancelable:!0},ze="RovingFocusGroup",[xt,bn,Qr]=wn(ze),[es,Sn]=_e(ze,[Qr]),[ts,ns]=es(ze),Cn=l.forwardRef((e,t)=>r.jsx(xt.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(xt.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(os,{...e,ref:t})})}));Cn.displayName=ze;var os=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:s=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=e,v=l.useRef(null),h=Y(t,v),w=At(a),[m,x]=He({prop:i,defaultProp:c??null,onChange:d,caller:ze}),[b,y]=l.useState(!1),g=jt(u),S=bn(n),N=l.useRef(!1),[R,A]=l.useState(0);return l.useEffect(()=>{const T=v.current;if(T)return T.addEventListener(dt,g),()=>T.removeEventListener(dt,g)},[g]),r.jsx(ts,{scope:n,orientation:o,dir:w,loop:s,currentTabStopId:m,onItemFocus:l.useCallback(T=>x(T),[x]),onItemShiftTab:l.useCallback(()=>y(!0),[]),onFocusableItemAdd:l.useCallback(()=>A(T=>T+1),[]),onFocusableItemRemove:l.useCallback(()=>A(T=>T-1),[]),children:r.jsx(K.div,{tabIndex:b||R===0?-1:0,"data-orientation":o,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:z(e.onMouseDown,()=>{N.current=!0}),onFocus:z(e.onFocus,T=>{const j=!N.current;if(T.target===T.currentTarget&&j&&!b){const O=new CustomEvent(dt,Jr);if(T.currentTarget.dispatchEvent(O),!O.defaultPrevented){const D=S().filter(I=>I.focusable),L=D.find(I=>I.active),_=D.find(I=>I.id===m),$=[L,_,...D].filter(Boolean).map(I=>I.ref.current);Rn($,f)}}N.current=!1}),onBlur:z(e.onBlur,()=>y(!1))})})}),Nn="RovingFocusGroupItem",jn=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:s=!1,tabStopId:a,children:i,...c}=e,d=We(),u=a||d,f=ns(Nn,n),p=f.currentTabStopId===u,v=bn(n),{onFocusableItemAdd:h,onFocusableItemRemove:w,currentTabStopId:m}=f;return l.useEffect(()=>{if(o)return h(),()=>w()},[o,h,w]),r.jsx(xt.ItemSlot,{scope:n,id:u,focusable:o,active:s,children:r.jsx(K.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...c,ref:t,onMouseDown:z(e.onMouseDown,x=>{o?f.onItemFocus(u):x.preventDefault()}),onFocus:z(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:z(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const b=is(x,f.orientation,f.dir);if(b!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let g=v().filter(S=>S.focusable).map(S=>S.ref.current);if(b==="last")g.reverse();else if(b==="prev"||b==="next"){b==="prev"&&g.reverse();const S=g.indexOf(x.currentTarget);g=f.loop?as(g,S+1):g.slice(S+1)}setTimeout(()=>Rn(g))}}),children:typeof i=="function"?i({isCurrentTabStop:p,hasTabStop:m!=null}):i})})});jn.displayName=Nn;var rs={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ss(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function is(e,t,n){const o=ss(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return rs[o]}function Rn(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function as(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var cs=Cn,ls=jn,tt="Tabs",[ds]=_e(tt,[Sn]),An=Sn(),[us,Tt]=ds(tt),Tn=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:s,defaultValue:a,orientation:i="horizontal",dir:c,activationMode:d="automatic",...u}=e,f=At(c),[p,v]=He({prop:o,onChange:s,defaultProp:a??"",caller:tt});return r.jsx(us,{scope:n,baseId:We(),value:p,onValueChange:v,orientation:i,dir:f,activationMode:d,children:r.jsx(K.div,{dir:f,"data-orientation":i,...u,ref:t})})});Tn.displayName=tt;var Pn="TabsList",En=l.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...s}=e,a=Tt(Pn,n),i=An(n);return r.jsx(cs,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:o,children:r.jsx(K.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:t})})});En.displayName=Pn;var In="TabsTrigger",On=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:s=!1,...a}=e,i=Tt(In,n),c=An(n),d=Dn(i.baseId,o),u=Mn(i.baseId,o),f=o===i.value;return r.jsx(ls,{asChild:!0,...c,focusable:!s,active:f,children:r.jsx(K.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...a,ref:t,onMouseDown:z(e.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?i.onValueChange(o):p.preventDefault()}),onKeyDown:z(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(o)}),onFocus:z(e.onFocus,()=>{const p=i.activationMode!=="manual";!f&&!s&&p&&i.onValueChange(o)})})})});On.displayName=In;var kn="TabsContent",_n=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:s,children:a,...i}=e,c=Tt(kn,n),d=Dn(c.baseId,o),u=Mn(c.baseId,o),f=o===c.value,p=l.useRef(f);return l.useEffect(()=>{const v=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(v)},[]),r.jsx(Zo,{present:s||f,children:({present:v})=>r.jsx(K.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!v,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:v&&a})})});_n.displayName=kn;function Dn(e,t){return`${e}-trigger-${t}`}function Mn(e,t){return`${e}-content-${t}`}var fs=Tn,Ln=En,Fn=On,Bn=_n;const ps=fs,$n=l.forwardRef(({className:e,...t},n)=>r.jsx(Ln,{ref:n,className:Q("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));$n.displayName=Ln.displayName;const Ee=l.forwardRef(({className:e,...t},n)=>r.jsx(Fn,{ref:n,className:Q("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Ee.displayName=Fn.displayName;const Ie=l.forwardRef(({className:e,...t},n)=>r.jsx(Bn,{ref:n,className:Q("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Ie.displayName=Bn.displayName;function Kt(e,[t,n]){return Math.min(n,Math.max(t,e))}const ms=["top","right","bottom","left"],ge=Math.min,Z=Math.max,Xe=Math.round,Ge=Math.floor,ce=e=>({x:e,y:e}),hs={left:"right",right:"left",bottom:"top",top:"bottom"};function gt(e,t,n){return Z(e,ge(t,n))}function fe(e,t){return typeof e=="function"?e(t):e}function pe(e){return e.split("-")[0]}function De(e){return e.split("-")[1]}function Pt(e){return e==="x"?"y":"x"}function Et(e){return e==="y"?"height":"width"}function ae(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function It(e){return Pt(ae(e))}function xs(e,t,n){n===void 0&&(n=!1);const o=De(e),s=It(e),a=Et(s);let i=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=qe(i)),[i,qe(i)]}function gs(e){const t=qe(e);return[vt(e),t,vt(t)]}function vt(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Gt=["left","right"],Yt=["right","left"],vs=["top","bottom"],ys=["bottom","top"];function ws(e,t,n){switch(e){case"top":case"bottom":return n?t?Yt:Gt:t?Gt:Yt;case"left":case"right":return t?vs:ys;default:return[]}}function bs(e,t,n,o){const s=De(e);let a=ws(pe(e),n==="start",o);return s&&(a=a.map(i=>i+"-"+s),t&&(a=a.concat(a.map(vt)))),a}function qe(e){const t=pe(e);return hs[t]+e.slice(t.length)}function Ss(e){return{top:0,right:0,bottom:0,left:0,...e}}function Hn(e){return typeof e!="number"?Ss(e):{top:e,right:e,bottom:e,left:e}}function Ze(e){const{x:t,y:n,width:o,height:s}=e;return{width:o,height:s,top:n,left:t,right:t+o,bottom:n+s,x:t,y:n}}function Xt(e,t,n){let{reference:o,floating:s}=e;const a=ae(t),i=It(t),c=Et(i),d=pe(t),u=a==="y",f=o.x+o.width/2-s.width/2,p=o.y+o.height/2-s.height/2,v=o[c]/2-s[c]/2;let h;switch(d){case"top":h={x:f,y:o.y-s.height};break;case"bottom":h={x:f,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:p};break;case"left":h={x:o.x-s.width,y:p};break;default:h={x:o.x,y:o.y}}switch(De(t)){case"start":h[i]-=v*(n&&u?-1:1);break;case"end":h[i]+=v*(n&&u?-1:1);break}return h}async function Cs(e,t){var n;t===void 0&&(t={});const{x:o,y:s,platform:a,rects:i,elements:c,strategy:d}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:v=!1,padding:h=0}=fe(t,e),w=Hn(h),x=c[v?p==="floating"?"reference":"floating":p],b=Ze(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(x)))==null||n?x:x.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:u,rootBoundary:f,strategy:d})),y=p==="floating"?{x:o,y:s,width:i.floating.width,height:i.floating.height}:i.reference,g=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),S=await(a.isElement==null?void 0:a.isElement(g))?await(a.getScale==null?void 0:a.getScale(g))||{x:1,y:1}:{x:1,y:1},N=Ze(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:g,strategy:d}):y);return{top:(b.top-N.top+w.top)/S.y,bottom:(N.bottom-b.bottom+w.bottom)/S.y,left:(b.left-N.left+w.left)/S.x,right:(N.right-b.right+w.right)/S.x}}const Ns=50,js=async(e,t,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:a=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Cs},d=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:p}=Xt(u,o,d),v=o,h=0;const w={};for(let m=0;m<a.length;m++){const x=a[m];if(!x)continue;const{name:b,fn:y}=x,{x:g,y:S,data:N,reset:R}=await y({x:f,y:p,initialPlacement:o,placement:v,strategy:s,middlewareData:w,rects:u,platform:c,elements:{reference:e,floating:t}});f=g??f,p=S??p,w[b]={...w[b],...N},R&&h<Ns&&(h++,typeof R=="object"&&(R.placement&&(v=R.placement),R.rects&&(u=R.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):R.rects),{x:f,y:p}=Xt(u,v,d)),m=-1)}return{x:f,y:p,placement:v,strategy:s,middlewareData:w}},Rs=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:s,rects:a,platform:i,elements:c,middlewareData:d}=t,{element:u,padding:f=0}=fe(e,t)||{};if(u==null)return{};const p=Hn(f),v={x:n,y:o},h=It(s),w=Et(h),m=await i.getDimensions(u),x=h==="y",b=x?"top":"left",y=x?"bottom":"right",g=x?"clientHeight":"clientWidth",S=a.reference[w]+a.reference[h]-v[h]-a.floating[w],N=v[h]-a.reference[h],R=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let A=R?R[g]:0;(!A||!await(i.isElement==null?void 0:i.isElement(R)))&&(A=c.floating[g]||a.floating[w]);const T=S/2-N/2,j=A/2-m[w]/2-1,O=ge(p[b],j),D=ge(p[y],j),L=O,_=A-m[w]-D,k=A/2-m[w]/2+T,$=gt(L,k,_),I=!d.arrow&&De(s)!=null&&k!==$&&a.reference[w]/2-(k<L?O:D)-m[w]/2<0,M=I?k<L?k-L:k-_:0;return{[h]:v[h]+M,data:{[h]:$,centerOffset:k-$-M,...I&&{alignmentOffset:M}},reset:I}}}),As=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:s,middlewareData:a,rects:i,initialPlacement:c,platform:d,elements:u}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:v,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:m=!0,...x}=fe(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const b=pe(s),y=ae(c),g=pe(c)===c,S=await(d.isRTL==null?void 0:d.isRTL(u.floating)),N=v||(g||!m?[qe(c)]:gs(c)),R=w!=="none";!v&&R&&N.push(...bs(c,m,w,S));const A=[c,...N],T=await d.detectOverflow(t,x),j=[];let O=((o=a.flip)==null?void 0:o.overflows)||[];if(f&&j.push(T[b]),p){const k=xs(s,i,S);j.push(T[k[0]],T[k[1]])}if(O=[...O,{placement:s,overflows:j}],!j.every(k=>k<=0)){var D,L;const k=(((D=a.flip)==null?void 0:D.index)||0)+1,$=A[k];if($&&(!(p==="alignment"?y!==ae($):!1)||O.every(P=>ae(P.placement)===y?P.overflows[0]>0:!0)))return{data:{index:k,overflows:O},reset:{placement:$}};let I=(L=O.filter(M=>M.overflows[0]<=0).sort((M,P)=>M.overflows[1]-P.overflows[1])[0])==null?void 0:L.placement;if(!I)switch(h){case"bestFit":{var _;const M=(_=O.filter(P=>{if(R){const V=ae(P.placement);return V===y||V==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(V=>V>0).reduce((V,X)=>V+X,0)]).sort((P,V)=>P[1]-V[1])[0])==null?void 0:_[0];M&&(I=M);break}case"initialPlacement":I=c;break}if(s!==I)return{reset:{placement:I}}}return{}}}};function qt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Zt(e){return ms.some(t=>e[t]>=0)}const Ts=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:s="referenceHidden",...a}=fe(e,t);switch(s){case"referenceHidden":{const i=await o.detectOverflow(t,{...a,elementContext:"reference"}),c=qt(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Zt(c)}}}case"escaped":{const i=await o.detectOverflow(t,{...a,altBoundary:!0}),c=qt(i,n.floating);return{data:{escapedOffsets:c,escaped:Zt(c)}}}default:return{}}}}},Vn=new Set(["left","top"]);async function Ps(e,t){const{placement:n,platform:o,elements:s}=e,a=await(o.isRTL==null?void 0:o.isRTL(s.floating)),i=pe(n),c=De(n),d=ae(n)==="y",u=Vn.has(i)?-1:1,f=a&&d?-1:1,p=fe(t,e);let{mainAxis:v,crossAxis:h,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof w=="number"&&(h=c==="end"?w*-1:w),d?{x:h*f,y:v*u}:{x:v*u,y:h*f}}const Es=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:s,y:a,placement:i,middlewareData:c}=t,d=await Ps(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:s+d.x,y:a+d.y,data:{...d,placement:i}}}}},Is=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:s,platform:a}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:d={fn:b=>{let{x:y,y:g}=b;return{x:y,y:g}}},...u}=fe(e,t),f={x:n,y:o},p=await a.detectOverflow(t,u),v=ae(pe(s)),h=Pt(v);let w=f[h],m=f[v];if(i){const b=h==="y"?"top":"left",y=h==="y"?"bottom":"right",g=w+p[b],S=w-p[y];w=gt(g,w,S)}if(c){const b=v==="y"?"top":"left",y=v==="y"?"bottom":"right",g=m+p[b],S=m-p[y];m=gt(g,m,S)}const x=d.fn({...t,[h]:w,[v]:m});return{...x,data:{x:x.x-n,y:x.y-o,enabled:{[h]:i,[v]:c}}}}}},Os=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:s,rects:a,middlewareData:i}=t,{offset:c=0,mainAxis:d=!0,crossAxis:u=!0}=fe(e,t),f={x:n,y:o},p=ae(s),v=Pt(p);let h=f[v],w=f[p];const m=fe(c,t),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(d){const g=v==="y"?"height":"width",S=a.reference[v]-a.floating[g]+x.mainAxis,N=a.reference[v]+a.reference[g]-x.mainAxis;h<S?h=S:h>N&&(h=N)}if(u){var b,y;const g=v==="y"?"width":"height",S=Vn.has(pe(s)),N=a.reference[p]-a.floating[g]+(S&&((b=i.offset)==null?void 0:b[p])||0)+(S?0:x.crossAxis),R=a.reference[p]+a.reference[g]+(S?0:((y=i.offset)==null?void 0:y[p])||0)-(S?x.crossAxis:0);w<N?w=N:w>R&&(w=R)}return{[v]:h,[p]:w}}}},ks=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:s,rects:a,platform:i,elements:c}=t,{apply:d=()=>{},...u}=fe(e,t),f=await i.detectOverflow(t,u),p=pe(s),v=De(s),h=ae(s)==="y",{width:w,height:m}=a.floating;let x,b;p==="top"||p==="bottom"?(x=p,b=v===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(b=p,x=v==="end"?"top":"bottom");const y=m-f.top-f.bottom,g=w-f.left-f.right,S=ge(m-f[x],y),N=ge(w-f[b],g),R=!t.middlewareData.shift;let A=S,T=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=g),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(A=y),R&&!v){const O=Z(f.left,0),D=Z(f.right,0),L=Z(f.top,0),_=Z(f.bottom,0);h?T=w-2*(O!==0||D!==0?O+D:Z(f.left,f.right)):A=m-2*(L!==0||_!==0?L+_:Z(f.top,f.bottom))}await d({...t,availableWidth:T,availableHeight:A});const j=await i.getDimensions(c.floating);return w!==j.width||m!==j.height?{reset:{rects:!0}}:{}}}};function nt(){return typeof window<"u"}function Me(e){return Wn(e)?(e.nodeName||"").toLowerCase():"#document"}function J(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function le(e){var t;return(t=(Wn(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Wn(e){return nt()?e instanceof Node||e instanceof J(e).Node:!1}function se(e){return nt()?e instanceof Element||e instanceof J(e).Element:!1}function me(e){return nt()?e instanceof HTMLElement||e instanceof J(e).HTMLElement:!1}function Jt(e){return!nt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof J(e).ShadowRoot}function Ue(e){const{overflow:t,overflowX:n,overflowY:o,display:s}=ie(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&s!=="inline"&&s!=="contents"}function _s(e){return/^(table|td|th)$/.test(Me(e))}function ot(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Ds=/transform|translate|scale|rotate|perspective|filter/,Ms=/paint|layout|strict|content/,Ne=e=>!!e&&e!=="none";let ut;function Ot(e){const t=se(e)?ie(e):e;return Ne(t.transform)||Ne(t.translate)||Ne(t.scale)||Ne(t.rotate)||Ne(t.perspective)||!kt()&&(Ne(t.backdropFilter)||Ne(t.filter))||Ds.test(t.willChange||"")||Ms.test(t.contain||"")}function Ls(e){let t=ve(e);for(;me(t)&&!ke(t);){if(Ot(t))return t;if(ot(t))return null;t=ve(t)}return null}function kt(){return ut==null&&(ut=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ut}function ke(e){return/^(html|body|#document)$/.test(Me(e))}function ie(e){return J(e).getComputedStyle(e)}function rt(e){return se(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ve(e){if(Me(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Jt(e)&&e.host||le(e);return Jt(t)?t.host:t}function zn(e){const t=ve(e);return ke(t)?e.ownerDocument?e.ownerDocument.body:e.body:me(t)&&Ue(t)?t:zn(t)}function Ve(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=zn(e),a=s===((o=e.ownerDocument)==null?void 0:o.body),i=J(s);if(a){const c=yt(i);return t.concat(i,i.visualViewport||[],Ue(s)?s:[],c&&n?Ve(c):[])}else return t.concat(s,Ve(s,[],n))}function yt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Un(e){const t=ie(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const s=me(e),a=s?e.offsetWidth:n,i=s?e.offsetHeight:o,c=Xe(n)!==a||Xe(o)!==i;return c&&(n=a,o=i),{width:n,height:o,$:c}}function _t(e){return se(e)?e:e.contextElement}function Oe(e){const t=_t(e);if(!me(t))return ce(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:a}=Un(t);let i=(a?Xe(n.width):n.width)/o,c=(a?Xe(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Fs=ce(0);function Kn(e){const t=J(e);return!kt()||!t.visualViewport?Fs:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Bs(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==J(e)?!1:t}function Re(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=_t(e);let i=ce(1);t&&(o?se(o)&&(i=Oe(o)):i=Oe(e));const c=Bs(a,n,o)?Kn(a):ce(0);let d=(s.left+c.x)/i.x,u=(s.top+c.y)/i.y,f=s.width/i.x,p=s.height/i.y;if(a){const v=J(a),h=o&&se(o)?J(o):o;let w=v,m=yt(w);for(;m&&o&&h!==w;){const x=Oe(m),b=m.getBoundingClientRect(),y=ie(m),g=b.left+(m.clientLeft+parseFloat(y.paddingLeft))*x.x,S=b.top+(m.clientTop+parseFloat(y.paddingTop))*x.y;d*=x.x,u*=x.y,f*=x.x,p*=x.y,d+=g,u+=S,w=J(m),m=yt(w)}}return Ze({width:f,height:p,x:d,y:u})}function st(e,t){const n=rt(e).scrollLeft;return t?t.left+n:Re(le(e)).left+n}function Gn(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-st(e,n),s=n.top+t.scrollTop;return{x:o,y:s}}function $s(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const a=s==="fixed",i=le(o),c=t?ot(t.floating):!1;if(o===i||c&&a)return n;let d={scrollLeft:0,scrollTop:0},u=ce(1);const f=ce(0),p=me(o);if((p||!p&&!a)&&((Me(o)!=="body"||Ue(i))&&(d=rt(o)),p)){const h=Re(o);u=Oe(o),f.x=h.x+o.clientLeft,f.y=h.y+o.clientTop}const v=i&&!p&&!a?Gn(i,d):ce(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-d.scrollLeft*u.x+f.x+v.x,y:n.y*u.y-d.scrollTop*u.y+f.y+v.y}}function Hs(e){return Array.from(e.getClientRects())}function Vs(e){const t=le(e),n=rt(e),o=e.ownerDocument.body,s=Z(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),a=Z(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+st(e);const c=-n.scrollTop;return ie(o).direction==="rtl"&&(i+=Z(t.clientWidth,o.clientWidth)-s),{width:s,height:a,x:i,y:c}}const Qt=25;function Ws(e,t){const n=J(e),o=le(e),s=n.visualViewport;let a=o.clientWidth,i=o.clientHeight,c=0,d=0;if(s){a=s.width,i=s.height;const f=kt();(!f||f&&t==="fixed")&&(c=s.offsetLeft,d=s.offsetTop)}const u=st(o);if(u<=0){const f=o.ownerDocument,p=f.body,v=getComputedStyle(p),h=f.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,w=Math.abs(o.clientWidth-p.clientWidth-h);w<=Qt&&(a-=w)}else u<=Qt&&(a+=u);return{width:a,height:i,x:c,y:d}}function zs(e,t){const n=Re(e,!0,t==="fixed"),o=n.top+e.clientTop,s=n.left+e.clientLeft,a=me(e)?Oe(e):ce(1),i=e.clientWidth*a.x,c=e.clientHeight*a.y,d=s*a.x,u=o*a.y;return{width:i,height:c,x:d,y:u}}function en(e,t,n){let o;if(t==="viewport")o=Ws(e,n);else if(t==="document")o=Vs(le(e));else if(se(t))o=zs(t,n);else{const s=Kn(e);o={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Ze(o)}function Yn(e,t){const n=ve(e);return n===t||!se(n)||ke(n)?!1:ie(n).position==="fixed"||Yn(n,t)}function Us(e,t){const n=t.get(e);if(n)return n;let o=Ve(e,[],!1).filter(c=>se(c)&&Me(c)!=="body"),s=null;const a=ie(e).position==="fixed";let i=a?ve(e):e;for(;se(i)&&!ke(i);){const c=ie(i),d=Ot(i);!d&&c.position==="fixed"&&(s=null),(a?!d&&!s:!d&&c.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Ue(i)&&!d&&Yn(e,i))?o=o.filter(f=>f!==i):s=c,i=ve(i)}return t.set(e,o),o}function Ks(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const i=[...n==="clippingAncestors"?ot(t)?[]:Us(t,this._c):[].concat(n),o],c=en(t,i[0],s);let d=c.top,u=c.right,f=c.bottom,p=c.left;for(let v=1;v<i.length;v++){const h=en(t,i[v],s);d=Z(h.top,d),u=ge(h.right,u),f=ge(h.bottom,f),p=Z(h.left,p)}return{width:u-p,height:f-d,x:p,y:d}}function Gs(e){const{width:t,height:n}=Un(e);return{width:t,height:n}}function Ys(e,t,n){const o=me(t),s=le(t),a=n==="fixed",i=Re(e,!0,a,t);let c={scrollLeft:0,scrollTop:0};const d=ce(0);function u(){d.x=st(s)}if(o||!o&&!a)if((Me(t)!=="body"||Ue(s))&&(c=rt(t)),o){const h=Re(t,!0,a,t);d.x=h.x+t.clientLeft,d.y=h.y+t.clientTop}else s&&u();a&&!o&&s&&u();const f=s&&!o&&!a?Gn(s,c):ce(0),p=i.left+c.scrollLeft-d.x-f.x,v=i.top+c.scrollTop-d.y-f.y;return{x:p,y:v,width:i.width,height:i.height}}function ft(e){return ie(e).position==="static"}function tn(e,t){if(!me(e)||ie(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return le(e)===n&&(n=n.ownerDocument.body),n}function Xn(e,t){const n=J(e);if(ot(e))return n;if(!me(e)){let s=ve(e);for(;s&&!ke(s);){if(se(s)&&!ft(s))return s;s=ve(s)}return n}let o=tn(e,t);for(;o&&_s(o)&&ft(o);)o=tn(o,t);return o&&ke(o)&&ft(o)&&!Ot(o)?n:o||Ls(e)||n}const Xs=async function(e){const t=this.getOffsetParent||Xn,n=this.getDimensions,o=await n(e.floating);return{reference:Ys(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function qs(e){return ie(e).direction==="rtl"}const Zs={convertOffsetParentRelativeRectToViewportRelativeRect:$s,getDocumentElement:le,getClippingRect:Ks,getOffsetParent:Xn,getElementRects:Xs,getClientRects:Hs,getDimensions:Gs,getScale:Oe,isElement:se,isRTL:qs};function qn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Js(e,t){let n=null,o;const s=le(e);function a(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function i(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),a();const u=e.getBoundingClientRect(),{left:f,top:p,width:v,height:h}=u;if(c||t(),!v||!h)return;const w=Ge(p),m=Ge(s.clientWidth-(f+v)),x=Ge(s.clientHeight-(p+h)),b=Ge(f),g={rootMargin:-w+"px "+-m+"px "+-x+"px "+-b+"px",threshold:Z(0,ge(1,d))||1};let S=!0;function N(R){const A=R[0].intersectionRatio;if(A!==d){if(!S)return i();A?i(!1,A):o=setTimeout(()=>{i(!1,1e-7)},1e3)}A===1&&!qn(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(N,{...g,root:s.ownerDocument})}catch{n=new IntersectionObserver(N,g)}n.observe(e)}return i(!0),a}function Qs(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=o,u=_t(e),f=s||a?[...u?Ve(u):[],...t?Ve(t):[]]:[];f.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),a&&b.addEventListener("resize",n)});const p=u&&c?Js(u,n):null;let v=-1,h=null;i&&(h=new ResizeObserver(b=>{let[y]=b;y&&y.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var g;(g=h)==null||g.observe(t)})),n()}),u&&!d&&h.observe(u),t&&h.observe(t));let w,m=d?Re(e):null;d&&x();function x(){const b=Re(e);m&&!qn(m,b)&&n(),m=b,w=requestAnimationFrame(x)}return n(),()=>{var b;f.forEach(y=>{s&&y.removeEventListener("scroll",n),a&&y.removeEventListener("resize",n)}),p==null||p(),(b=h)==null||b.disconnect(),h=null,d&&cancelAnimationFrame(w)}}const ei=Es,ti=Is,ni=As,oi=ks,ri=Ts,nn=Rs,si=Os,ii=(e,t,n)=>{const o=new Map,s={platform:Zs,...n},a={...s.platform,_c:o};return js(e,t,{...s,platform:a})};var ai=typeof document<"u",ci=function(){},Ye=ai?l.useLayoutEffect:ci;function Je(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Je(e[o],t[o]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,s[o]))return!1;for(o=n;o--!==0;){const a=s[o];if(!(a==="_owner"&&e.$$typeof)&&!Je(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function Zn(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function on(e,t){const n=Zn(e);return Math.round(t*n)/n}function pt(e){const t=l.useRef(e);return Ye(()=>{t.current=e}),t}function li(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:s,elements:{reference:a,floating:i}={},transform:c=!0,whileElementsMounted:d,open:u}=e,[f,p]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,h]=l.useState(o);Je(v,o)||h(o);const[w,m]=l.useState(null),[x,b]=l.useState(null),y=l.useCallback(P=>{P!==R.current&&(R.current=P,m(P))},[]),g=l.useCallback(P=>{P!==A.current&&(A.current=P,b(P))},[]),S=a||w,N=i||x,R=l.useRef(null),A=l.useRef(null),T=l.useRef(f),j=d!=null,O=pt(d),D=pt(s),L=pt(u),_=l.useCallback(()=>{if(!R.current||!A.current)return;const P={placement:t,strategy:n,middleware:v};D.current&&(P.platform=D.current),ii(R.current,A.current,P).then(V=>{const X={...V,isPositioned:L.current!==!1};k.current&&!Je(T.current,X)&&(T.current=X,Rt.flushSync(()=>{p(X)}))})},[v,t,n,D,L]);Ye(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,p(P=>({...P,isPositioned:!1})))},[u]);const k=l.useRef(!1);Ye(()=>(k.current=!0,()=>{k.current=!1}),[]),Ye(()=>{if(S&&(R.current=S),N&&(A.current=N),S&&N){if(O.current)return O.current(S,N,_);_()}},[S,N,_,O,j]);const $=l.useMemo(()=>({reference:R,floating:A,setReference:y,setFloating:g}),[y,g]),I=l.useMemo(()=>({reference:S,floating:N}),[S,N]),M=l.useMemo(()=>{const P={position:n,left:0,top:0};if(!I.floating)return P;const V=on(I.floating,f.x),X=on(I.floating,f.y);return c?{...P,transform:"translate("+V+"px, "+X+"px)",...Zn(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:X}},[n,c,I.floating,f.x,f.y]);return l.useMemo(()=>({...f,update:_,refs:$,elements:I,floatingStyles:M}),[f,_,$,I,M])}const di=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:s}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?nn({element:o.current,padding:s}).fn(n):{}:o?nn({element:o,padding:s}).fn(n):{}}}},ui=(e,t)=>{const n=ei(e);return{name:n.name,fn:n.fn,options:[e,t]}},fi=(e,t)=>{const n=ti(e);return{name:n.name,fn:n.fn,options:[e,t]}},pi=(e,t)=>({fn:si(e).fn,options:[e,t]}),mi=(e,t)=>{const n=ni(e);return{name:n.name,fn:n.fn,options:[e,t]}},hi=(e,t)=>{const n=oi(e);return{name:n.name,fn:n.fn,options:[e,t]}},xi=(e,t)=>{const n=ri(e);return{name:n.name,fn:n.fn,options:[e,t]}},gi=(e,t)=>{const n=di(e);return{name:n.name,fn:n.fn,options:[e,t]}};var vi="Arrow",Jn=l.forwardRef((e,t)=>{const{children:n,width:o=10,height:s=5,...a}=e;return r.jsx(K.svg,{...a,ref:t,width:o,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});Jn.displayName=vi;var yi=Jn,Dt="Popper",[Qn,eo]=_e(Dt),[wi,to]=Qn(Dt),no=e=>{const{__scopePopper:t,children:n}=e,[o,s]=l.useState(null);return r.jsx(wi,{scope:t,anchor:o,onAnchorChange:s,children:n})};no.displayName=Dt;var oo="PopperAnchor",ro=l.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...s}=e,a=to(oo,n),i=l.useRef(null),c=Y(t,i),d=l.useRef(null);return l.useEffect(()=>{const u=d.current;d.current=(o==null?void 0:o.current)||i.current,u!==d.current&&a.onAnchorChange(d.current)}),o?null:r.jsx(K.div,{...s,ref:c})});ro.displayName=oo;var Mt="PopperContent",[bi,Si]=Qn(Mt),so=l.forwardRef((e,t)=>{var E,W,G,H,F,B;const{__scopePopper:n,side:o="bottom",sideOffset:s=0,align:a="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:v=!1,updatePositionStrategy:h="optimized",onPlaced:w,...m}=e,x=to(Mt,n),[b,y]=l.useState(null),g=Y(t,C=>y(C)),[S,N]=l.useState(null),R=fn(S),A=(R==null?void 0:R.width)??0,T=(R==null?void 0:R.height)??0,j=o+(a!=="center"?"-"+a:""),O=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},D=Array.isArray(u)?u:[u],L=D.length>0,_={padding:O,boundary:D.filter(Ni),altBoundary:L},{refs:k,floatingStyles:$,placement:I,isPositioned:M,middlewareData:P}=li({strategy:"fixed",placement:j,whileElementsMounted:(...C)=>Qs(...C,{animationFrame:h==="always"}),elements:{reference:x.anchor},middleware:[ui({mainAxis:s+T,alignmentAxis:i}),d&&fi({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?pi():void 0,..._}),d&&mi({..._}),hi({..._,apply:({elements:C,rects:U,availableWidth:q,availableHeight:Se})=>{const{width:Fe,height:qo}=U.reference,Ke=C.floating.style;Ke.setProperty("--radix-popper-available-width",`${q}px`),Ke.setProperty("--radix-popper-available-height",`${Se}px`),Ke.setProperty("--radix-popper-anchor-width",`${Fe}px`),Ke.setProperty("--radix-popper-anchor-height",`${qo}px`)}}),S&&gi({element:S,padding:c}),ji({arrowWidth:A,arrowHeight:T}),v&&xi({strategy:"referenceHidden",..._})]}),[V,X]=co(I),te=jt(w);re(()=>{M&&(te==null||te())},[M,te]);const he=(E=P.arrow)==null?void 0:E.x,be=(W=P.arrow)==null?void 0:W.y,ne=((G=P.arrow)==null?void 0:G.centerOffset)!==0,[xe,de]=l.useState();return re(()=>{b&&de(window.getComputedStyle(b).zIndex)},[b]),r.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:M?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:xe,"--radix-popper-transform-origin":[(H=P.transformOrigin)==null?void 0:H.x,(F=P.transformOrigin)==null?void 0:F.y].join(" "),...((B=P.hide)==null?void 0:B.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(bi,{scope:n,placedSide:V,onArrowChange:N,arrowX:he,arrowY:be,shouldHideArrow:ne,children:r.jsx(K.div,{"data-side":V,"data-align":X,...m,ref:g,style:{...m.style,animation:M?void 0:"none"}})})})});so.displayName=Mt;var io="PopperArrow",Ci={top:"bottom",right:"left",bottom:"top",left:"right"},ao=l.forwardRef(function(t,n){const{__scopePopper:o,...s}=t,a=Si(io,o),i=Ci[a.placedSide];return r.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:r.jsx(yi,{...s,ref:n,style:{...s.style,display:"block"}})})});ao.displayName=io;function Ni(e){return e!==null}var ji=e=>({name:"transformOrigin",options:e,fn(t){var x,b,y;const{placement:n,rects:o,middlewareData:s}=t,i=((x=s.arrow)==null?void 0:x.centerOffset)!==0,c=i?0:e.arrowWidth,d=i?0:e.arrowHeight,[u,f]=co(n),p={start:"0%",center:"50%",end:"100%"}[f],v=(((b=s.arrow)==null?void 0:b.x)??0)+c/2,h=(((y=s.arrow)==null?void 0:y.y)??0)+d/2;let w="",m="";return u==="bottom"?(w=i?p:`${v}px`,m=`${-d}px`):u==="top"?(w=i?p:`${v}px`,m=`${o.floating.height+d}px`):u==="right"?(w=`${-d}px`,m=i?p:`${h}px`):u==="left"&&(w=`${o.floating.width+d}px`,m=i?p:`${h}px`),{data:{x:w,y:m}}}});function co(e){const[t,n="center"]=e.split("-");return[t,n]}var Ri=no,Ai=ro,Ti=so,Pi=ao;function Ei(e){const t=Ii(e),n=l.forwardRef((o,s)=>{const{children:a,...i}=o,c=l.Children.toArray(a),d=c.find(ki);if(d){const u=d.props.children,f=c.map(p=>p===d?l.Children.count(u)>1?l.Children.only(null):l.isValidElement(u)?u.props.children:null:p);return r.jsx(t,{...i,ref:s,children:l.isValidElement(u)?l.cloneElement(u,void 0,f):null})}return r.jsx(t,{...i,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function Ii(e){const t=l.forwardRef((n,o)=>{const{children:s,...a}=n;if(l.isValidElement(s)){const i=Di(s),c=_i(a,s.props);return s.type!==l.Fragment&&(c.ref=o?an(o,i):i),l.cloneElement(s,c)}return l.Children.count(s)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Oi=Symbol("radix.slottable");function ki(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Oi}function _i(e,t){const n={...t};for(const o in t){const s=e[o],a=t[o];/^on[A-Z]/.test(o)?s&&a?n[o]=(...c)=>{const d=a(...c);return s(...c),d}:s&&(n[o]=s):o==="style"?n[o]={...s,...a}:o==="className"&&(n[o]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function Di(e){var o,s;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var lo=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Mi="VisuallyHidden",Li=l.forwardRef((e,t)=>r.jsx(K.span,{...e,ref:t,style:{...lo,...e.style}}));Li.displayName=Mi;var Fi=[" ","Enter","ArrowUp","ArrowDown"],Bi=[" ","Enter"],Ae="Select",[it,at,$i]=wn(Ae),[Le]=_e(Ae,[$i,eo]),ct=eo(),[Hi,ye]=Le(Ae),[Vi,Wi]=Le(Ae),uo=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:s,onOpenChange:a,value:i,defaultValue:c,onValueChange:d,dir:u,name:f,autoComplete:p,disabled:v,required:h,form:w}=e,m=ct(t),[x,b]=l.useState(null),[y,g]=l.useState(null),[S,N]=l.useState(!1),R=At(u),[A,T]=He({prop:o,defaultProp:s??!1,onChange:a,caller:Ae}),[j,O]=He({prop:i,defaultProp:c,onChange:d,caller:Ae}),D=l.useRef(null),L=x?w||!!x.closest("form"):!0,[_,k]=l.useState(new Set),$=Array.from(_).map(I=>I.props.value).join(";");return r.jsx(Ri,{...m,children:r.jsxs(Hi,{required:h,scope:t,trigger:x,onTriggerChange:b,valueNode:y,onValueNodeChange:g,valueNodeHasChildren:S,onValueNodeHasChildrenChange:N,contentId:We(),value:j,onValueChange:O,open:A,onOpenChange:T,dir:R,triggerPointerDownPosRef:D,disabled:v,children:[r.jsx(it.Provider,{scope:t,children:r.jsx(Vi,{scope:e.__scopeSelect,onNativeOptionAdd:l.useCallback(I=>{k(M=>new Set(M).add(I))},[]),onNativeOptionRemove:l.useCallback(I=>{k(M=>{const P=new Set(M);return P.delete(I),P})},[]),children:n})}),L?r.jsxs(Do,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:j,onChange:I=>O(I.target.value),disabled:v,form:w,children:[j===void 0?r.jsx("option",{value:""}):null,Array.from(_)]},$):null]})})};uo.displayName=Ae;var fo="SelectTrigger",po=l.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...s}=e,a=ct(n),i=ye(fo,n),c=i.disabled||o,d=Y(t,i.onTriggerChange),u=at(n),f=l.useRef("touch"),[p,v,h]=Lo(m=>{const x=u().filter(g=>!g.disabled),b=x.find(g=>g.value===i.value),y=Fo(x,m,b);y!==void 0&&i.onValueChange(y.value)}),w=m=>{c||(i.onOpenChange(!0),h()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return r.jsx(Ai,{asChild:!0,...a,children:r.jsx(K.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Mo(i.value)?"":void 0,...s,ref:d,onClick:z(s.onClick,m=>{m.currentTarget.focus(),f.current!=="mouse"&&w(m)}),onPointerDown:z(s.onPointerDown,m=>{f.current=m.pointerType;const x=m.target;x.hasPointerCapture(m.pointerId)&&x.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(w(m),m.preventDefault())}),onKeyDown:z(s.onKeyDown,m=>{const x=p.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&v(m.key),!(x&&m.key===" ")&&Fi.includes(m.key)&&(w(),m.preventDefault())})})})});po.displayName=fo;var mo="SelectValue",ho=l.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:s,children:a,placeholder:i="",...c}=e,d=ye(mo,n),{onValueNodeHasChildrenChange:u}=d,f=a!==void 0,p=Y(t,d.onValueNodeChange);return re(()=>{u(f)},[u,f]),r.jsx(K.span,{...c,ref:p,style:{pointerEvents:"none"},children:Mo(d.value)?r.jsx(r.Fragment,{children:i}):a})});ho.displayName=mo;var zi="SelectIcon",xo=l.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...s}=e;return r.jsx(K.span,{"aria-hidden":!0,...s,ref:t,children:o||"▼"})});xo.displayName=zi;var Ui="SelectPortal",go=e=>r.jsx(Jo,{asChild:!0,...e});go.displayName=Ui;var Te="SelectContent",vo=l.forwardRef((e,t)=>{const n=ye(Te,e.__scopeSelect),[o,s]=l.useState();if(re(()=>{s(new DocumentFragment)},[]),!n.open){const a=o;return a?Rt.createPortal(r.jsx(yo,{scope:e.__scopeSelect,children:r.jsx(it.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),a):null}return r.jsx(wo,{...e,ref:t})});vo.displayName=Te;var oe=10,[yo,we]=Le(Te),Ki="SelectContentImpl",Gi=Ei("SelectContent.RemoveScroll"),wo=l.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:i,side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:v,collisionPadding:h,sticky:w,hideWhenDetached:m,avoidCollisions:x,...b}=e,y=ye(Te,n),[g,S]=l.useState(null),[N,R]=l.useState(null),A=Y(t,E=>S(E)),[T,j]=l.useState(null),[O,D]=l.useState(null),L=at(n),[_,k]=l.useState(!1),$=l.useRef(!1);l.useEffect(()=>{if(g)return Qo(g)},[g]),er();const I=l.useCallback(E=>{const[W,...G]=L().map(B=>B.ref.current),[H]=G.slice(-1),F=document.activeElement;for(const B of E)if(B===F||(B==null||B.scrollIntoView({block:"nearest"}),B===W&&N&&(N.scrollTop=0),B===H&&N&&(N.scrollTop=N.scrollHeight),B==null||B.focus(),document.activeElement!==F))return},[L,N]),M=l.useCallback(()=>I([T,g]),[I,T,g]);l.useEffect(()=>{_&&M()},[_,M]);const{onOpenChange:P,triggerPointerDownPosRef:V}=y;l.useEffect(()=>{if(g){let E={x:0,y:0};const W=H=>{var F,B;E={x:Math.abs(Math.round(H.pageX)-(((F=V.current)==null?void 0:F.x)??0)),y:Math.abs(Math.round(H.pageY)-(((B=V.current)==null?void 0:B.y)??0))}},G=H=>{E.x<=10&&E.y<=10?H.preventDefault():g.contains(H.target)||P(!1),document.removeEventListener("pointermove",W),V.current=null};return V.current!==null&&(document.addEventListener("pointermove",W),document.addEventListener("pointerup",G,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",W),document.removeEventListener("pointerup",G,{capture:!0})}}},[g,P,V]),l.useEffect(()=>{const E=()=>P(!1);return window.addEventListener("blur",E),window.addEventListener("resize",E),()=>{window.removeEventListener("blur",E),window.removeEventListener("resize",E)}},[P]);const[X,te]=Lo(E=>{const W=L().filter(F=>!F.disabled),G=W.find(F=>F.ref.current===document.activeElement),H=Fo(W,E,G);H&&setTimeout(()=>H.ref.current.focus())}),he=l.useCallback((E,W,G)=>{const H=!$.current&&!G;(y.value!==void 0&&y.value===W||H)&&(j(E),H&&($.current=!0))},[y.value]),be=l.useCallback(()=>g==null?void 0:g.focus(),[g]),ne=l.useCallback((E,W,G)=>{const H=!$.current&&!G;(y.value!==void 0&&y.value===W||H)&&D(E)},[y.value]),xe=o==="popper"?wt:bo,de=xe===wt?{side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:v,collisionPadding:h,sticky:w,hideWhenDetached:m,avoidCollisions:x}:{};return r.jsx(yo,{scope:n,content:g,viewport:N,onViewportChange:R,itemRefCallback:he,selectedItem:T,onItemLeave:be,itemTextRefCallback:ne,focusSelectedItem:M,selectedItemText:O,position:o,isPositioned:_,searchRef:X,children:r.jsx(tr,{as:Gi,allowPinchZoom:!0,children:r.jsx(nr,{asChild:!0,trapped:y.open,onMountAutoFocus:E=>{E.preventDefault()},onUnmountAutoFocus:z(s,E=>{var W;(W=y.trigger)==null||W.focus({preventScroll:!0}),E.preventDefault()}),children:r.jsx(or,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:E=>E.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:r.jsx(xe,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:E=>E.preventDefault(),...b,...de,onPlaced:()=>k(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:z(b.onKeyDown,E=>{const W=E.ctrlKey||E.altKey||E.metaKey;if(E.key==="Tab"&&E.preventDefault(),!W&&E.key.length===1&&te(E.key),["ArrowUp","ArrowDown","Home","End"].includes(E.key)){let H=L().filter(F=>!F.disabled).map(F=>F.ref.current);if(["ArrowUp","End"].includes(E.key)&&(H=H.slice().reverse()),["ArrowUp","ArrowDown"].includes(E.key)){const F=E.target,B=H.indexOf(F);H=H.slice(B+1)}setTimeout(()=>I(H)),E.preventDefault()}})})})})})})});wo.displayName=Ki;var Yi="SelectItemAlignedPosition",bo=l.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...s}=e,a=ye(Te,n),i=we(Te,n),[c,d]=l.useState(null),[u,f]=l.useState(null),p=Y(t,A=>f(A)),v=at(n),h=l.useRef(!1),w=l.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:b,focusSelectedItem:y}=i,g=l.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&u&&m&&x&&b){const A=a.trigger.getBoundingClientRect(),T=u.getBoundingClientRect(),j=a.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(a.dir!=="rtl"){const F=O.left-T.left,B=j.left-F,C=A.left-B,U=A.width+C,q=Math.max(U,T.width),Se=window.innerWidth-oe,Fe=Kt(B,[oe,Math.max(oe,Se-q)]);c.style.minWidth=U+"px",c.style.left=Fe+"px"}else{const F=T.right-O.right,B=window.innerWidth-j.right-F,C=window.innerWidth-A.right-B,U=A.width+C,q=Math.max(U,T.width),Se=window.innerWidth-oe,Fe=Kt(B,[oe,Math.max(oe,Se-q)]);c.style.minWidth=U+"px",c.style.right=Fe+"px"}const D=v(),L=window.innerHeight-oe*2,_=m.scrollHeight,k=window.getComputedStyle(u),$=parseInt(k.borderTopWidth,10),I=parseInt(k.paddingTop,10),M=parseInt(k.borderBottomWidth,10),P=parseInt(k.paddingBottom,10),V=$+I+_+P+M,X=Math.min(x.offsetHeight*5,V),te=window.getComputedStyle(m),he=parseInt(te.paddingTop,10),be=parseInt(te.paddingBottom,10),ne=A.top+A.height/2-oe,xe=L-ne,de=x.offsetHeight/2,E=x.offsetTop+de,W=$+I+E,G=V-W;if(W<=ne){const F=D.length>0&&x===D[D.length-1].ref.current;c.style.bottom="0px";const B=u.clientHeight-m.offsetTop-m.offsetHeight,C=Math.max(xe,de+(F?be:0)+B+M),U=W+C;c.style.height=U+"px"}else{const F=D.length>0&&x===D[0].ref.current;c.style.top="0px";const C=Math.max(ne,$+m.offsetTop+(F?he:0)+de)+G;c.style.height=C+"px",m.scrollTop=W-ne+m.offsetTop}c.style.margin=`${oe}px 0`,c.style.minHeight=X+"px",c.style.maxHeight=L+"px",o==null||o(),requestAnimationFrame(()=>h.current=!0)}},[v,a.trigger,a.valueNode,c,u,m,x,b,a.dir,o]);re(()=>g(),[g]);const[S,N]=l.useState();re(()=>{u&&N(window.getComputedStyle(u).zIndex)},[u]);const R=l.useCallback(A=>{A&&w.current===!0&&(g(),y==null||y(),w.current=!1)},[g,y]);return r.jsx(qi,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:R,children:r.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:r.jsx(K.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});bo.displayName=Yi;var Xi="SelectPopperPosition",wt=l.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:s=oe,...a}=e,i=ct(n);return r.jsx(Ti,{...i,...a,ref:t,align:o,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});wt.displayName=Xi;var[qi,Lt]=Le(Te,{}),bt="SelectViewport",So=l.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...s}=e,a=we(bt,n),i=Lt(bt,n),c=Y(t,a.onViewportChange),d=l.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),r.jsx(it.Slot,{scope:n,children:r.jsx(K.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:z(s.onScroll,u=>{const f=u.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:v}=i;if(v!=null&&v.current&&p){const h=Math.abs(d.current-f.scrollTop);if(h>0){const w=window.innerHeight-oe*2,m=parseFloat(p.style.minHeight),x=parseFloat(p.style.height),b=Math.max(m,x);if(b<w){const y=b+h,g=Math.min(w,y),S=y-g;p.style.height=g+"px",p.style.bottom==="0px"&&(f.scrollTop=S>0?S:0,p.style.justifyContent="flex-end")}}}d.current=f.scrollTop})})})]})});So.displayName=bt;var Co="SelectGroup",[Zi,Ji]=Le(Co),Qi=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,s=We();return r.jsx(Zi,{scope:n,id:s,children:r.jsx(K.div,{role:"group","aria-labelledby":s,...o,ref:t})})});Qi.displayName=Co;var No="SelectLabel",jo=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,s=Ji(No,n);return r.jsx(K.div,{id:s.id,...o,ref:t})});jo.displayName=No;var Qe="SelectItem",[ea,Ro]=Le(Qe),Ao=l.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:s=!1,textValue:a,...i}=e,c=ye(Qe,n),d=we(Qe,n),u=c.value===o,[f,p]=l.useState(a??""),[v,h]=l.useState(!1),w=Y(t,y=>{var g;return(g=d.itemRefCallback)==null?void 0:g.call(d,y,o,s)}),m=We(),x=l.useRef("touch"),b=()=>{s||(c.onValueChange(o),c.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(ea,{scope:n,value:o,disabled:s,textId:m,isSelected:u,onItemTextChange:l.useCallback(y=>{p(g=>g||((y==null?void 0:y.textContent)??"").trim())},[]),children:r.jsx(it.ItemSlot,{scope:n,value:o,disabled:s,textValue:f,children:r.jsx(K.div,{role:"option","aria-labelledby":m,"data-highlighted":v?"":void 0,"aria-selected":u&&v,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:w,onFocus:z(i.onFocus,()=>h(!0)),onBlur:z(i.onBlur,()=>h(!1)),onClick:z(i.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:z(i.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:z(i.onPointerDown,y=>{x.current=y.pointerType}),onPointerMove:z(i.onPointerMove,y=>{var g;x.current=y.pointerType,s?(g=d.onItemLeave)==null||g.call(d):x.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:z(i.onPointerLeave,y=>{var g;y.currentTarget===document.activeElement&&((g=d.onItemLeave)==null||g.call(d))}),onKeyDown:z(i.onKeyDown,y=>{var S;((S=d.searchRef)==null?void 0:S.current)!==""&&y.key===" "||(Bi.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});Ao.displayName=Qe;var Be="SelectItemText",To=l.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:s,...a}=e,i=ye(Be,n),c=we(Be,n),d=Ro(Be,n),u=Wi(Be,n),[f,p]=l.useState(null),v=Y(t,b=>p(b),d.onItemTextChange,b=>{var y;return(y=c.itemTextRefCallback)==null?void 0:y.call(c,b,d.value,d.disabled)}),h=f==null?void 0:f.textContent,w=l.useMemo(()=>r.jsx("option",{value:d.value,disabled:d.disabled,children:h},d.value),[d.disabled,d.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return re(()=>(m(w),()=>x(w)),[m,x,w]),r.jsxs(r.Fragment,{children:[r.jsx(K.span,{id:d.textId,...a,ref:v}),d.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Rt.createPortal(a.children,i.valueNode):null]})});To.displayName=Be;var Po="SelectItemIndicator",Eo=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return Ro(Po,n).isSelected?r.jsx(K.span,{"aria-hidden":!0,...o,ref:t}):null});Eo.displayName=Po;var St="SelectScrollUpButton",Io=l.forwardRef((e,t)=>{const n=we(St,e.__scopeSelect),o=Lt(St,e.__scopeSelect),[s,a]=l.useState(!1),i=Y(t,o.onScrollButtonChange);return re(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=d.scrollTop>0;a(u)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?r.jsx(ko,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null});Io.displayName=St;var Ct="SelectScrollDownButton",Oo=l.forwardRef((e,t)=>{const n=we(Ct,e.__scopeSelect),o=Lt(Ct,e.__scopeSelect),[s,a]=l.useState(!1),i=Y(t,o.onScrollButtonChange);return re(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=d.scrollHeight-d.clientHeight,f=Math.ceil(d.scrollTop)<u;a(f)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?r.jsx(ko,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null});Oo.displayName=Ct;var ko=l.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...s}=e,a=we("SelectScrollButton",n),i=l.useRef(null),c=at(n),d=l.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return l.useEffect(()=>()=>d(),[d]),re(()=>{var f;const u=c().find(p=>p.ref.current===document.activeElement);(f=u==null?void 0:u.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),r.jsx(K.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:z(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(o,50))}),onPointerMove:z(s.onPointerMove,()=>{var u;(u=a.onItemLeave)==null||u.call(a),i.current===null&&(i.current=window.setInterval(o,50))}),onPointerLeave:z(s.onPointerLeave,()=>{d()})})}),ta="SelectSeparator",_o=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return r.jsx(K.div,{"aria-hidden":!0,...o,ref:t})});_o.displayName=ta;var Nt="SelectArrow",na=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,s=ct(n),a=ye(Nt,n),i=we(Nt,n);return a.open&&i.position==="popper"?r.jsx(Pi,{...s,...o,ref:t}):null});na.displayName=Nt;var oa="SelectBubbleInput",Do=l.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const s=l.useRef(null),a=Y(o,s),i=un(t);return l.useEffect(()=>{const c=s.current;if(!c)return;const d=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(d,"value").set;if(i!==t&&f){const p=new Event("change",{bubbles:!0});f.call(c,t),c.dispatchEvent(p)}},[i,t]),r.jsx(K.select,{...n,style:{...lo,...n.style},ref:a,defaultValue:t})});Do.displayName=oa;function Mo(e){return e===""||e===void 0}function Lo(e){const t=jt(e),n=l.useRef(""),o=l.useRef(0),s=l.useCallback(i=>{const c=n.current+i;t(c),function d(u){n.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>d(""),1e3))}(c)},[t]),a=l.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return l.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,s,a]}function Fo(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let i=ra(e,Math.max(a,0));s.length===1&&(i=i.filter(u=>u!==n));const d=i.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function ra(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var sa=uo,Bo=po,ia=ho,aa=xo,ca=go,$o=vo,la=So,Ho=jo,Vo=Ao,da=To,ua=Eo,Wo=Io,zo=Oo,Uo=_o;const Ko=sa,Go=ia,Ft=l.forwardRef(({className:e,children:t,...n},o)=>r.jsxs(Bo,{ref:o,className:Q("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,r.jsx(aa,{asChild:!0,children:r.jsx(dn,{className:"h-4 w-4 opacity-50"})})]}));Ft.displayName=Bo.displayName;const Yo=l.forwardRef(({className:e,...t},n)=>r.jsx(Wo,{ref:n,className:Q("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(kr,{className:"h-4 w-4"})}));Yo.displayName=Wo.displayName;const Xo=l.forwardRef(({className:e,...t},n)=>r.jsx(zo,{ref:n,className:Q("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(dn,{className:"h-4 w-4"})}));Xo.displayName=zo.displayName;const Bt=l.forwardRef(({className:e,children:t,position:n="popper",...o},s)=>r.jsx(ca,{children:r.jsxs($o,{ref:s,className:Q("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:[r.jsx(Yo,{}),r.jsx(la,{className:Q("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(Xo,{})]})}));Bt.displayName=$o.displayName;const fa=l.forwardRef(({className:e,...t},n)=>r.jsx(Ho,{ref:n,className:Q("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));fa.displayName=Ho.displayName;const $e=l.forwardRef(({className:e,children:t,...n},o)=>r.jsxs(Vo,{ref:o,className:Q("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(ua,{children:r.jsx(rr,{className:"h-4 w-4"})})}),r.jsx(da,{children:t})]}));$e.displayName=Vo.displayName;const pa=l.forwardRef(({className:e,...t},n)=>r.jsx(Uo,{ref:n,className:Q("-mx-1 my-1 h-px bg-muted",e),...t}));pa.displayName=Uo.displayName;const rn={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function ma({open:e,onOpenChange:t,onAdded:n}){const[o,s]=l.useState([]),[a,i]=l.useState(!1),[c,d]=l.useState(null),[u,f]=l.useState(""),[p,v]=l.useState(""),[h,w]=l.useState(""),[m,x]=l.useState(""),[b,y]=l.useState(!1),[g,S]=l.useState(null);l.useEffect(()=>{e&&sr().then(j=>s(j.available)).catch(()=>s([]))},[e]);const N=()=>{i(!1),d(null),f(""),v(""),w(""),x(""),y(!1),S(null)},R=async j=>{d(j),S(null);try{const{id:O}=await $t({type:j,label:rn[j]||j}),{url:D}=await mt(O);window.open(D,"_blank"),N(),t(!1),n()}catch(O){S(O instanceof Error?O.message:"添加失败"),d(null)}},A=async()=>{if(!u||!p||!h||!m){S("请填写所有字段");return}y(!0),S(null);try{const{id:j}=await $t({type:u,label:p,clientId:h,clientSecret:m}),{url:O}=await mt(j);window.open(O,"_blank"),N(),t(!1),n()}catch(j){S(j instanceof Error?j.message:"添加失败")}finally{y(!1)}},T=o.length>0;return r.jsx(ir,{open:e,onOpenChange:j=>{t(j),j||N()},children:r.jsxs(ar,{className:"sm:max-w-md",children:[r.jsxs(cr,{children:[r.jsxs(lr,{className:"flex items-center gap-2",children:[r.jsx(ht,{className:"h-5 w-5"}),"添加云盘账号"]}),r.jsx(dr,{children:a?"手动填写 OAuth 凭据连接云盘":"选择云盘类型,点击后跳转登录授权"})]}),a?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ue,{children:"云盘类型"}),r.jsxs(Ko,{value:u,onValueChange:f,children:[r.jsx(Ft,{children:r.jsx(Go,{placeholder:"选择云盘类型"})}),r.jsxs(Bt,{children:[r.jsx($e,{value:"google-drive",children:"Google Drive"}),r.jsx($e,{value:"onedrive",children:"OneDrive"}),r.jsx($e,{value:"dropbox",children:"Dropbox"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ue,{children:"显示名称"}),r.jsx(je,{placeholder:"例如:我的 Google Drive",value:p,onChange:j=>v(j.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ue,{children:"Client ID"}),r.jsx(je,{placeholder:"OAuth Client ID",value:h,onChange:j=>w(j.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ue,{children:"Client Secret"}),r.jsx(je,{type:"password",placeholder:"OAuth Client Secret",value:m,onChange:j=>x(j.target.value)})]}),g&&r.jsx("p",{className:"text-sm text-destructive",children:g})]}),r.jsxs(ur,{children:[r.jsx(ee,{variant:"outline",onClick:()=>{i(!1),S(null)},children:"返回"}),r.jsx(ee,{onClick:A,disabled:b,children:b?"添加中...":"添加并授权"})]})]}):r.jsxs("div",{className:"space-y-3 py-2",children:[T?r.jsx(r.Fragment,{children:o.map(j=>r.jsx(ee,{variant:"outline",className:"w-full justify-start gap-3 h-12 text-base",onClick:()=>void R(j),disabled:c!==null,children:c===j?"连接中...":`连接 ${rn[j]||j}`},j))}):r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"暂无内置 OAuth 凭据,请使用手动模式添加"}),g&&r.jsx("p",{className:"text-sm text-destructive",children:g}),r.jsx("div",{className:"pt-2 border-t border-border",children:r.jsxs("button",{onClick:()=>{i(!0),S(null)},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx(Br,{className:"h-3.5 w-3.5"}),"手动填写 OAuth 凭据"]})})]})]})})}const ha={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function xa({type:e}){switch(e){case"google-drive":return r.jsx(zt,{className:"h-5 w-5 text-blue-500"});case"onedrive":return r.jsx(ht,{className:"h-5 w-5 text-sky-500"});case"dropbox":return r.jsx(zt,{className:"h-5 w-5 text-indigo-500"});default:return r.jsx(ht,{className:"h-5 w-5"})}}function ga({provider:e,onDelete:t,onReauth:n}){var i;const[o,s]=l.useState(!1),a=()=>{o?(t(e.id),s(!1)):(s(!0),setTimeout(()=>s(!1),3e3))};return r.jsxs(fr,{children:[r.jsx(pr,{className:"pb-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(xa,{type:e.type}),r.jsxs("div",{children:[r.jsx(mr,{className:"text-base",children:e.label}),r.jsx("p",{className:"text-sm text-muted-foreground",children:ha[e.type]||e.type})]})]}),r.jsx(cn,{variant:e.authorized?"default":"destructive",className:e.authorized?"bg-green-600 hover:bg-green-700":"",children:e.authorized?"已授权":"未授权"})]})}),r.jsxs(hr,{children:[e.authorized&&((i=e.tokens)==null?void 0:i.expiry)&&r.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["授权到期:",new Date(e.tokens.expiry).toLocaleDateString("zh-CN")]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>n(e.id),children:[r.jsx(ln,{className:"h-3.5 w-3.5 mr-1"}),"重新授权"]}),r.jsxs(ee,{variant:o?"destructive":"outline",size:"sm",onClick:a,children:[r.jsx(xr,{className:"h-3.5 w-3.5 mr-1"}),o?"确认删除?":"删除"]})]})]})]})}const va={success:{label:"成功",icon:Fr,className:"bg-green-600 hover:bg-green-700"},failed:{label:"失败",icon:$r,className:"bg-red-600 hover:bg-red-700"},partial:{label:"部分完成",icon:Mr,className:"bg-yellow-600 hover:bg-yellow-700"}};function ya(e,t){const n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return`${n}ms`;const o=Math.floor(n/1e3);if(o<60)return`${o}秒`;const s=Math.floor(o/60),a=o%60;return`${s}分${a}秒`}function wa(e){return new Date(e).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function ba({history:e}){const t=e.slice(0,20);return t.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[r.jsx(_r,{className:"h-10 w-10 mb-3 opacity-50"}),r.jsx("p",{className:"text-sm",children:"暂无备份记录"})]}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b",children:[r.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"时间"}),r.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"项目"}),r.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"云盘"}),r.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"状态"}),r.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"文件数"}),r.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"耗时"})]})}),r.jsx("tbody",{children:t.map(n=>{const o=va[n.status],s=o.icon;return r.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/50",children:[r.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:wa(n.startTime)}),r.jsx("td",{className:"py-2.5 px-2",children:n.projectName}),r.jsx("td",{className:"py-2.5 px-2",children:n.providerLabel}),r.jsxs("td",{className:"py-2.5 px-2",children:[r.jsxs(cn,{className:o.className,children:[r.jsx(s,{className:"h-3 w-3 mr-1"}),o.label]}),n.error&&r.jsx("p",{className:"text-xs text-destructive mt-1",children:n.error})]}),r.jsxs("td",{className:"py-2.5 px-2 whitespace-nowrap",children:[n.filesUploaded,"/",n.filesTotal]}),r.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:ya(n.startTime,n.endTime)})]},n.id)})})]})})}const sn=["node_modules",".git","dist","build","*.log",".DS_Store","*.tmp",".venv","__pycache__",".env"],Sa=[{value:"30",label:"30分钟"},{value:"60",label:"1小时"},{value:"360",label:"6小时"},{value:"720",label:"12小时"},{value:"1440",label:"24小时"}];function Ra(){const e=gr(),[t,n]=l.useState([]),[o,s]=l.useState(!0),[a,i]=l.useState(!1),[c,d]=l.useState({enabled:!1,intervalMinutes:60}),[u,f]=l.useState(!0),[p,v]=l.useState([]),[h,w]=l.useState(!0),[m,x]=l.useState(""),[b,y]=l.useState(!1),[g,S]=l.useState(!1),[N,R]=l.useState([]),[A,T]=l.useState(!0),[j,O]=l.useState(()=>Dr()),[D,L]=l.useState(!1),[_,k]=l.useState({webhookEnabled:!1}),[$,I]=l.useState(""),[M,P]=l.useState(!1),V=async()=>{try{const C=await Nr();n(C)}catch{}finally{s(!1)}},X=async()=>{try{const C=await jr();d(C)}catch{}finally{f(!1)}},te=async()=>{try{const C=await Rr();v(C.length>0?C:sn)}catch{v(sn)}finally{w(!1)}},he=async()=>{try{const C=await Ar();R(C)}catch{}finally{T(!1)}};l.useEffect(()=>{V(),X(),te(),he(),vr().then(C=>{k(C),I(C.webhookUrl??"")}).catch(()=>{})},[]);const be=()=>{Ir(Or.pomodoroConfig,j,!0),L(!1),lt.success("番茄钟设置已保存")},ne=(C,U)=>{const q=parseInt(U,10);isNaN(q)||q<1||(O(Se=>({...Se,[C]:q})),L(!0))},xe=async()=>{P(!0);try{const C=await Er({webhookEnabled:$.trim().length>0,webhookUrl:$.trim()||void 0});k(C),lt.success("Webhook 配置已保存")}catch{lt.error("保存失败")}finally{P(!1)}},de=async C=>{try{await Tr(C),n(U=>U.filter(q=>q.id!==C))}catch{}},E=async C=>{try{const{url:U}=await mt(C);window.open(U,"_blank")}catch{}},W=async C=>{const U={...c,enabled:C};d(U);try{await Ht({enabled:C})}catch{d(c)}},G=async C=>{const U=parseInt(C,10),q={...c,intervalMinutes:U};d(q);try{await Ht({intervalMinutes:U})}catch{d(c)}},H=()=>{const C=m.trim();!C||p.includes(C)||(v(U=>[...U,C]),x(""),y(!0))},F=C=>{v(U=>U.filter(q=>q!==C)),y(!0)},B=async()=>{S(!0);try{await Pr(p),y(!1)}catch{}finally{S(!1)}};return r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[r.jsx(yr,{className:"h-4 w-4 mr-1"}),"返回"]}),r.jsx("h1",{className:"text-2xl font-bold",children:"设置"})]}),r.jsxs(ps,{defaultValue:"providers",children:[r.jsxs($n,{className:"mb-4",children:[r.jsx(Ee,{value:"providers",children:"云盘账号"}),r.jsx(Ee,{value:"strategy",children:"备份策略"}),r.jsx(Ee,{value:"history",children:"备份记录"}),r.jsxs(Ee,{value:"notifications",children:[r.jsx(Lr,{className:"h-3.5 w-3.5 mr-1.5"}),"通知"]}),r.jsxs(Ee,{value:"pomodoro",children:[r.jsx(Vt,{className:"h-3.5 w-3.5 mr-1.5"}),"番茄钟"]})]}),r.jsxs(Ie,{value:"providers",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs(ee,{onClick:()=>i(!0),children:[r.jsx(wr,{className:"h-4 w-4 mr-1"}),"添加云盘"]})}),o?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):t.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-12",children:"暂无云盘账号,点击上方按钮添加"}):r.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:t.map(C=>r.jsx(ga,{provider:C,onDelete:de,onReauth:E},C.id))})]}),r.jsx(ma,{open:a,onOpenChange:i,onAdded:()=>void V()})]}),r.jsx(Ie,{value:"strategy",children:r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-medium",children:"排除规则"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"匹配这些模式的文件和目录将不会被备份"}),h?r.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:r.jsx(br,{children:p.map(C=>r.jsxs(Sr.span,{layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2},className:"inline-flex items-center gap-1 rounded-md bg-muted px-2.5 py-1 text-sm",children:[C,r.jsx("button",{onClick:()=>F(C),className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20 p-0.5",children:r.jsx(Cr,{className:"h-3 w-3"})})]},C))})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(je,{placeholder:"输入排除模式,例如 *.log",value:m,onChange:C=>x(C.target.value),onKeyDown:C=>{C.key==="Enter"&&H()},className:"max-w-xs"}),r.jsx(ee,{variant:"outline",size:"sm",onClick:H,children:"添加"})]}),b&&r.jsxs(ee,{onClick:B,disabled:g,children:[r.jsx(Wt,{className:"h-4 w-4 mr-1"}),g?"保存中...":"保存"]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-medium",children:"定时备份"}),u?r.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(yn,{checked:c.enabled,onCheckedChange:W}),r.jsx(ue,{children:c.enabled?"已开启":"已关闭"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ue,{children:"备份间隔"}),r.jsxs(Ko,{value:String(c.intervalMinutes),onValueChange:G,children:[r.jsx(Ft,{className:"w-48",children:r.jsx(Go,{})}),r.jsx(Bt,{children:Sa.map(C=>r.jsx($e,{value:C.value,children:C.label},C.value))})]})]})]})]})]})}),r.jsx(Ie,{value:"history",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>{T(!0),he()},children:[r.jsx(ln,{className:"h-4 w-4 mr-1"}),"刷新"]})}),A?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):r.jsx(ba,{history:N})]})}),r.jsx(Ie,{value:"notifications",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[r.jsx("h3",{className:"text-sm font-medium",children:"浏览器通知"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"当 Claude 完成任务时,浏览器将自动弹出通知。首次打开 Dashboard 时会请求通知权限。"})]}),r.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium",children:"Webhook 通知"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Claude 完成任务时向指定 URL 发送 POST 请求(JSON: event, projectId, projectName, timestamp)"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ue,{className:"text-xs",children:"Webhook URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(je,{placeholder:"https://hooks.slack.com/...",value:$,onChange:C=>I(C.target.value),className:"font-mono text-xs"}),r.jsx(ee,{size:"sm",onClick:()=>void xe(),disabled:M,children:M?"保存中…":"保存"})]}),_.webhookEnabled&&_.webhookUrl&&r.jsxs("p",{className:"text-xs text-green-500",children:["已启用 → ",_.webhookUrl]})]})]})]})}),r.jsx(Ie,{value:"pomodoro",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium",children:"番茄钟时间设置"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"修改后重新启动番茄钟生效"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-6 max-w-xs",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ue,{className:"text-xs",children:"工作时长(分钟)"}),r.jsx(je,{type:"number",min:1,max:120,value:j.workMinutes,onChange:C=>ne("workMinutes",C.target.value),className:"w-full"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ue,{className:"text-xs",children:"休息时长(分钟)"}),r.jsx(je,{type:"number",min:1,max:60,value:j.breakMinutes,onChange:C=>ne("breakMinutes",C.target.value),className:"w-full"})]})]}),D&&r.jsxs(ee,{size:"sm",onClick:be,children:[r.jsx(Wt,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})]}),r.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[r.jsx("h3",{className:"text-sm font-medium",children:"使用说明"}),r.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[r.jsxs("li",{children:["在项目页面 Header 点击 ",r.jsx(Vt,{className:"h-3 w-3 inline-block mx-0.5"})," 图标启动番茄钟"]}),r.jsx("li",{children:"倒计时以大字体悬浮在屏幕上,不影响操作"}),r.jsx("li",{children:"工作阶段结束后自动切换为休息,并弹出通知"}),r.jsx("li",{children:"休息结束后自动切换回工作阶段"}),r.jsx("li",{children:"再次点击图标可停止并重置"})]})]})]})})]})]})})}export{Ra as SettingsPage};
36
+ */const $r=Pe("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);function un(e){const t=l.useRef({value:e,previous:e});return l.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function fn(e){const[t,n]=l.useState(void 0);return re(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let i,c;if("borderBoxSize"in a){const d=a.borderBoxSize,u=Array.isArray(d)?d[0]:d;i=u.inlineSize,c=u.blockSize}else i=e.offsetWidth,c=e.offsetHeight;n({width:i,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var et="Switch",[Hr]=_e(et),[Vr,Wr]=Hr(et),pn=l.forwardRef((e,t)=>{const{__scopeSwitch:n,name:o,checked:s,defaultChecked:a,required:i,disabled:c,value:d="on",onCheckedChange:u,form:f,...p}=e,[v,h]=l.useState(null),w=Y(t,g=>h(g)),m=l.useRef(!1),x=v?f||!!v.closest("form"):!0,[b,y]=He({prop:s,defaultProp:a??!1,onChange:u,caller:et});return r.jsxs(Vr,{scope:n,checked:b,disabled:c,children:[r.jsx(K.button,{type:"button",role:"switch","aria-checked":b,"aria-required":i,"data-state":gn(b),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:w,onClick:z(e.onClick,g=>{y(S=>!S),x&&(m.current=g.isPropagationStopped(),m.current||g.stopPropagation())})}),x&&r.jsx(xn,{control:v,bubbles:!m.current,name:o,value:d,checked:b,required:i,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});pn.displayName=et;var mn="SwitchThumb",hn=l.forwardRef((e,t)=>{const{__scopeSwitch:n,...o}=e,s=Wr(mn,n);return r.jsx(K.span,{"data-state":gn(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t})});hn.displayName=mn;var zr="SwitchBubbleInput",xn=l.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:o=!0,...s},a)=>{const i=l.useRef(null),c=Y(i,a),d=un(n),u=fn(t);return l.useEffect(()=>{const f=i.current;if(!f)return;const p=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&h){const w=new Event("click",{bubbles:o});h.call(f,n),f.dispatchEvent(w)}},[d,n,o]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});xn.displayName=zr;function gn(e){return e?"checked":"unchecked"}var vn=pn,Ur=hn;const yn=l.forwardRef(({className:e,...t},n)=>r.jsx(vn,{className:J("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:r.jsx(Ur,{className:J("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));yn.displayName=vn.displayName;function Ut(e){const t=Kr(e),n=l.forwardRef((o,s)=>{const{children:a,...i}=o,c=l.Children.toArray(a),d=c.find(Yr);if(d){const u=d.props.children,f=c.map(p=>p===d?l.Children.count(u)>1?l.Children.only(null):l.isValidElement(u)?u.props.children:null:p);return r.jsx(t,{...i,ref:s,children:l.isValidElement(u)?l.cloneElement(u,void 0,f):null})}return r.jsx(t,{...i,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function Kr(e){const t=l.forwardRef((n,o)=>{const{children:s,...a}=n;if(l.isValidElement(s)){const i=qr(s),c=Xr(a,s.props);return s.type!==l.Fragment&&(c.ref=o?an(o,i):i),l.cloneElement(s,c)}return l.Children.count(s)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Gr=Symbol("radix.slottable");function Yr(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Gr}function Xr(e,t){const n={...t};for(const o in t){const s=e[o],a=t[o];/^on[A-Z]/.test(o)?s&&a?n[o]=(...c)=>{const d=a(...c);return s(...c),d}:s&&(n[o]=s):o==="style"?n[o]={...s,...a}:o==="className"&&(n[o]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function qr(e){var o,s;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function wn(e){const t=e+"CollectionProvider",[n,o]=_e(t),[s,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:x,children:b}=m,y=Ce.useRef(null),g=Ce.useRef(new Map).current;return r.jsx(s,{scope:x,itemMap:g,collectionRef:y,children:b})};i.displayName=t;const c=e+"CollectionSlot",d=Ut(c),u=Ce.forwardRef((m,x)=>{const{scope:b,children:y}=m,g=a(c,b),S=Y(x,g.collectionRef);return r.jsx(d,{ref:S,children:y})});u.displayName=c;const f=e+"CollectionItemSlot",p="data-radix-collection-item",v=Ut(f),h=Ce.forwardRef((m,x)=>{const{scope:b,children:y,...g}=m,S=Ce.useRef(null),N=Y(x,S),R=a(f,b);return Ce.useEffect(()=>(R.itemMap.set(S,{ref:S,...g}),()=>void R.itemMap.delete(S))),r.jsx(v,{[p]:"",ref:N,children:y})});h.displayName=f;function w(m){const x=a(e+"CollectionConsumer",m);return Ce.useCallback(()=>{const y=x.collectionRef.current;if(!y)return[];const g=Array.from(y.querySelectorAll(`[${p}]`));return Array.from(x.itemMap.values()).sort((R,A)=>g.indexOf(R.ref.current)-g.indexOf(A.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:h},w,o]}var Zr=l.createContext(void 0);function At(e){const t=l.useContext(Zr);return e||t||"ltr"}var dt="rovingFocusGroup.onEntryFocus",Qr={bubbles:!1,cancelable:!0},ze="RovingFocusGroup",[xt,bn,Jr]=wn(ze),[es,Sn]=_e(ze,[Jr]),[ts,ns]=es(ze),Cn=l.forwardRef((e,t)=>r.jsx(xt.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(xt.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(os,{...e,ref:t})})}));Cn.displayName=ze;var os=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:s=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=e,v=l.useRef(null),h=Y(t,v),w=At(a),[m,x]=He({prop:i,defaultProp:c??null,onChange:d,caller:ze}),[b,y]=l.useState(!1),g=jt(u),S=bn(n),N=l.useRef(!1),[R,A]=l.useState(0);return l.useEffect(()=>{const T=v.current;if(T)return T.addEventListener(dt,g),()=>T.removeEventListener(dt,g)},[g]),r.jsx(ts,{scope:n,orientation:o,dir:w,loop:s,currentTabStopId:m,onItemFocus:l.useCallback(T=>x(T),[x]),onItemShiftTab:l.useCallback(()=>y(!0),[]),onFocusableItemAdd:l.useCallback(()=>A(T=>T+1),[]),onFocusableItemRemove:l.useCallback(()=>A(T=>T-1),[]),children:r.jsx(K.div,{tabIndex:b||R===0?-1:0,"data-orientation":o,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:z(e.onMouseDown,()=>{N.current=!0}),onFocus:z(e.onFocus,T=>{const j=!N.current;if(T.target===T.currentTarget&&j&&!b){const O=new CustomEvent(dt,Qr);if(T.currentTarget.dispatchEvent(O),!O.defaultPrevented){const D=S().filter(I=>I.focusable),L=D.find(I=>I.active),_=D.find(I=>I.id===m),$=[L,_,...D].filter(Boolean).map(I=>I.ref.current);Rn($,f)}}N.current=!1}),onBlur:z(e.onBlur,()=>y(!1))})})}),Nn="RovingFocusGroupItem",jn=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:s=!1,tabStopId:a,children:i,...c}=e,d=We(),u=a||d,f=ns(Nn,n),p=f.currentTabStopId===u,v=bn(n),{onFocusableItemAdd:h,onFocusableItemRemove:w,currentTabStopId:m}=f;return l.useEffect(()=>{if(o)return h(),()=>w()},[o,h,w]),r.jsx(xt.ItemSlot,{scope:n,id:u,focusable:o,active:s,children:r.jsx(K.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...c,ref:t,onMouseDown:z(e.onMouseDown,x=>{o?f.onItemFocus(u):x.preventDefault()}),onFocus:z(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:z(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const b=is(x,f.orientation,f.dir);if(b!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let g=v().filter(S=>S.focusable).map(S=>S.ref.current);if(b==="last")g.reverse();else if(b==="prev"||b==="next"){b==="prev"&&g.reverse();const S=g.indexOf(x.currentTarget);g=f.loop?as(g,S+1):g.slice(S+1)}setTimeout(()=>Rn(g))}}),children:typeof i=="function"?i({isCurrentTabStop:p,hasTabStop:m!=null}):i})})});jn.displayName=Nn;var rs={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ss(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function is(e,t,n){const o=ss(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return rs[o]}function Rn(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function as(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var cs=Cn,ls=jn,tt="Tabs",[ds]=_e(tt,[Sn]),An=Sn(),[us,Tt]=ds(tt),Tn=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:s,defaultValue:a,orientation:i="horizontal",dir:c,activationMode:d="automatic",...u}=e,f=At(c),[p,v]=He({prop:o,onChange:s,defaultProp:a??"",caller:tt});return r.jsx(us,{scope:n,baseId:We(),value:p,onValueChange:v,orientation:i,dir:f,activationMode:d,children:r.jsx(K.div,{dir:f,"data-orientation":i,...u,ref:t})})});Tn.displayName=tt;var Pn="TabsList",En=l.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...s}=e,a=Tt(Pn,n),i=An(n);return r.jsx(cs,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:o,children:r.jsx(K.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:t})})});En.displayName=Pn;var In="TabsTrigger",On=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:s=!1,...a}=e,i=Tt(In,n),c=An(n),d=Dn(i.baseId,o),u=Mn(i.baseId,o),f=o===i.value;return r.jsx(ls,{asChild:!0,...c,focusable:!s,active:f,children:r.jsx(K.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...a,ref:t,onMouseDown:z(e.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?i.onValueChange(o):p.preventDefault()}),onKeyDown:z(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(o)}),onFocus:z(e.onFocus,()=>{const p=i.activationMode!=="manual";!f&&!s&&p&&i.onValueChange(o)})})})});On.displayName=In;var kn="TabsContent",_n=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:s,children:a,...i}=e,c=Tt(kn,n),d=Dn(c.baseId,o),u=Mn(c.baseId,o),f=o===c.value,p=l.useRef(f);return l.useEffect(()=>{const v=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(v)},[]),r.jsx(Zo,{present:s||f,children:({present:v})=>r.jsx(K.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!v,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:v&&a})})});_n.displayName=kn;function Dn(e,t){return`${e}-trigger-${t}`}function Mn(e,t){return`${e}-content-${t}`}var fs=Tn,Ln=En,Fn=On,Bn=_n;const ps=fs,$n=l.forwardRef(({className:e,...t},n)=>r.jsx(Ln,{ref:n,className:J("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));$n.displayName=Ln.displayName;const Ee=l.forwardRef(({className:e,...t},n)=>r.jsx(Fn,{ref:n,className:J("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Ee.displayName=Fn.displayName;const Ie=l.forwardRef(({className:e,...t},n)=>r.jsx(Bn,{ref:n,className:J("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Ie.displayName=Bn.displayName;function Kt(e,[t,n]){return Math.min(n,Math.max(t,e))}const ms=["top","right","bottom","left"],ge=Math.min,Z=Math.max,Xe=Math.round,Ge=Math.floor,ce=e=>({x:e,y:e}),hs={left:"right",right:"left",bottom:"top",top:"bottom"};function gt(e,t,n){return Z(e,ge(t,n))}function fe(e,t){return typeof e=="function"?e(t):e}function pe(e){return e.split("-")[0]}function De(e){return e.split("-")[1]}function Pt(e){return e==="x"?"y":"x"}function Et(e){return e==="y"?"height":"width"}function ae(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function It(e){return Pt(ae(e))}function xs(e,t,n){n===void 0&&(n=!1);const o=De(e),s=It(e),a=Et(s);let i=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=qe(i)),[i,qe(i)]}function gs(e){const t=qe(e);return[vt(e),t,vt(t)]}function vt(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Gt=["left","right"],Yt=["right","left"],vs=["top","bottom"],ys=["bottom","top"];function ws(e,t,n){switch(e){case"top":case"bottom":return n?t?Yt:Gt:t?Gt:Yt;case"left":case"right":return t?vs:ys;default:return[]}}function bs(e,t,n,o){const s=De(e);let a=ws(pe(e),n==="start",o);return s&&(a=a.map(i=>i+"-"+s),t&&(a=a.concat(a.map(vt)))),a}function qe(e){const t=pe(e);return hs[t]+e.slice(t.length)}function Ss(e){return{top:0,right:0,bottom:0,left:0,...e}}function Hn(e){return typeof e!="number"?Ss(e):{top:e,right:e,bottom:e,left:e}}function Ze(e){const{x:t,y:n,width:o,height:s}=e;return{width:o,height:s,top:n,left:t,right:t+o,bottom:n+s,x:t,y:n}}function Xt(e,t,n){let{reference:o,floating:s}=e;const a=ae(t),i=It(t),c=Et(i),d=pe(t),u=a==="y",f=o.x+o.width/2-s.width/2,p=o.y+o.height/2-s.height/2,v=o[c]/2-s[c]/2;let h;switch(d){case"top":h={x:f,y:o.y-s.height};break;case"bottom":h={x:f,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:p};break;case"left":h={x:o.x-s.width,y:p};break;default:h={x:o.x,y:o.y}}switch(De(t)){case"start":h[i]-=v*(n&&u?-1:1);break;case"end":h[i]+=v*(n&&u?-1:1);break}return h}async function Cs(e,t){var n;t===void 0&&(t={});const{x:o,y:s,platform:a,rects:i,elements:c,strategy:d}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:v=!1,padding:h=0}=fe(t,e),w=Hn(h),x=c[v?p==="floating"?"reference":"floating":p],b=Ze(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(x)))==null||n?x:x.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:u,rootBoundary:f,strategy:d})),y=p==="floating"?{x:o,y:s,width:i.floating.width,height:i.floating.height}:i.reference,g=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),S=await(a.isElement==null?void 0:a.isElement(g))?await(a.getScale==null?void 0:a.getScale(g))||{x:1,y:1}:{x:1,y:1},N=Ze(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:g,strategy:d}):y);return{top:(b.top-N.top+w.top)/S.y,bottom:(N.bottom-b.bottom+w.bottom)/S.y,left:(b.left-N.left+w.left)/S.x,right:(N.right-b.right+w.right)/S.x}}const Ns=50,js=async(e,t,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:a=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Cs},d=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:p}=Xt(u,o,d),v=o,h=0;const w={};for(let m=0;m<a.length;m++){const x=a[m];if(!x)continue;const{name:b,fn:y}=x,{x:g,y:S,data:N,reset:R}=await y({x:f,y:p,initialPlacement:o,placement:v,strategy:s,middlewareData:w,rects:u,platform:c,elements:{reference:e,floating:t}});f=g??f,p=S??p,w[b]={...w[b],...N},R&&h<Ns&&(h++,typeof R=="object"&&(R.placement&&(v=R.placement),R.rects&&(u=R.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):R.rects),{x:f,y:p}=Xt(u,v,d)),m=-1)}return{x:f,y:p,placement:v,strategy:s,middlewareData:w}},Rs=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:s,rects:a,platform:i,elements:c,middlewareData:d}=t,{element:u,padding:f=0}=fe(e,t)||{};if(u==null)return{};const p=Hn(f),v={x:n,y:o},h=It(s),w=Et(h),m=await i.getDimensions(u),x=h==="y",b=x?"top":"left",y=x?"bottom":"right",g=x?"clientHeight":"clientWidth",S=a.reference[w]+a.reference[h]-v[h]-a.floating[w],N=v[h]-a.reference[h],R=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let A=R?R[g]:0;(!A||!await(i.isElement==null?void 0:i.isElement(R)))&&(A=c.floating[g]||a.floating[w]);const T=S/2-N/2,j=A/2-m[w]/2-1,O=ge(p[b],j),D=ge(p[y],j),L=O,_=A-m[w]-D,k=A/2-m[w]/2+T,$=gt(L,k,_),I=!d.arrow&&De(s)!=null&&k!==$&&a.reference[w]/2-(k<L?O:D)-m[w]/2<0,M=I?k<L?k-L:k-_:0;return{[h]:v[h]+M,data:{[h]:$,centerOffset:k-$-M,...I&&{alignmentOffset:M}},reset:I}}}),As=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:s,middlewareData:a,rects:i,initialPlacement:c,platform:d,elements:u}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:v,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:m=!0,...x}=fe(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const b=pe(s),y=ae(c),g=pe(c)===c,S=await(d.isRTL==null?void 0:d.isRTL(u.floating)),N=v||(g||!m?[qe(c)]:gs(c)),R=w!=="none";!v&&R&&N.push(...bs(c,m,w,S));const A=[c,...N],T=await d.detectOverflow(t,x),j=[];let O=((o=a.flip)==null?void 0:o.overflows)||[];if(f&&j.push(T[b]),p){const k=xs(s,i,S);j.push(T[k[0]],T[k[1]])}if(O=[...O,{placement:s,overflows:j}],!j.every(k=>k<=0)){var D,L;const k=(((D=a.flip)==null?void 0:D.index)||0)+1,$=A[k];if($&&(!(p==="alignment"?y!==ae($):!1)||O.every(P=>ae(P.placement)===y?P.overflows[0]>0:!0)))return{data:{index:k,overflows:O},reset:{placement:$}};let I=(L=O.filter(M=>M.overflows[0]<=0).sort((M,P)=>M.overflows[1]-P.overflows[1])[0])==null?void 0:L.placement;if(!I)switch(h){case"bestFit":{var _;const M=(_=O.filter(P=>{if(R){const V=ae(P.placement);return V===y||V==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(V=>V>0).reduce((V,X)=>V+X,0)]).sort((P,V)=>P[1]-V[1])[0])==null?void 0:_[0];M&&(I=M);break}case"initialPlacement":I=c;break}if(s!==I)return{reset:{placement:I}}}return{}}}};function qt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Zt(e){return ms.some(t=>e[t]>=0)}const Ts=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:s="referenceHidden",...a}=fe(e,t);switch(s){case"referenceHidden":{const i=await o.detectOverflow(t,{...a,elementContext:"reference"}),c=qt(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Zt(c)}}}case"escaped":{const i=await o.detectOverflow(t,{...a,altBoundary:!0}),c=qt(i,n.floating);return{data:{escapedOffsets:c,escaped:Zt(c)}}}default:return{}}}}},Vn=new Set(["left","top"]);async function Ps(e,t){const{placement:n,platform:o,elements:s}=e,a=await(o.isRTL==null?void 0:o.isRTL(s.floating)),i=pe(n),c=De(n),d=ae(n)==="y",u=Vn.has(i)?-1:1,f=a&&d?-1:1,p=fe(t,e);let{mainAxis:v,crossAxis:h,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof w=="number"&&(h=c==="end"?w*-1:w),d?{x:h*f,y:v*u}:{x:v*u,y:h*f}}const Es=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:s,y:a,placement:i,middlewareData:c}=t,d=await Ps(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:s+d.x,y:a+d.y,data:{...d,placement:i}}}}},Is=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:s,platform:a}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:d={fn:b=>{let{x:y,y:g}=b;return{x:y,y:g}}},...u}=fe(e,t),f={x:n,y:o},p=await a.detectOverflow(t,u),v=ae(pe(s)),h=Pt(v);let w=f[h],m=f[v];if(i){const b=h==="y"?"top":"left",y=h==="y"?"bottom":"right",g=w+p[b],S=w-p[y];w=gt(g,w,S)}if(c){const b=v==="y"?"top":"left",y=v==="y"?"bottom":"right",g=m+p[b],S=m-p[y];m=gt(g,m,S)}const x=d.fn({...t,[h]:w,[v]:m});return{...x,data:{x:x.x-n,y:x.y-o,enabled:{[h]:i,[v]:c}}}}}},Os=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:s,rects:a,middlewareData:i}=t,{offset:c=0,mainAxis:d=!0,crossAxis:u=!0}=fe(e,t),f={x:n,y:o},p=ae(s),v=Pt(p);let h=f[v],w=f[p];const m=fe(c,t),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(d){const g=v==="y"?"height":"width",S=a.reference[v]-a.floating[g]+x.mainAxis,N=a.reference[v]+a.reference[g]-x.mainAxis;h<S?h=S:h>N&&(h=N)}if(u){var b,y;const g=v==="y"?"width":"height",S=Vn.has(pe(s)),N=a.reference[p]-a.floating[g]+(S&&((b=i.offset)==null?void 0:b[p])||0)+(S?0:x.crossAxis),R=a.reference[p]+a.reference[g]+(S?0:((y=i.offset)==null?void 0:y[p])||0)-(S?x.crossAxis:0);w<N?w=N:w>R&&(w=R)}return{[v]:h,[p]:w}}}},ks=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:s,rects:a,platform:i,elements:c}=t,{apply:d=()=>{},...u}=fe(e,t),f=await i.detectOverflow(t,u),p=pe(s),v=De(s),h=ae(s)==="y",{width:w,height:m}=a.floating;let x,b;p==="top"||p==="bottom"?(x=p,b=v===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(b=p,x=v==="end"?"top":"bottom");const y=m-f.top-f.bottom,g=w-f.left-f.right,S=ge(m-f[x],y),N=ge(w-f[b],g),R=!t.middlewareData.shift;let A=S,T=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=g),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(A=y),R&&!v){const O=Z(f.left,0),D=Z(f.right,0),L=Z(f.top,0),_=Z(f.bottom,0);h?T=w-2*(O!==0||D!==0?O+D:Z(f.left,f.right)):A=m-2*(L!==0||_!==0?L+_:Z(f.top,f.bottom))}await d({...t,availableWidth:T,availableHeight:A});const j=await i.getDimensions(c.floating);return w!==j.width||m!==j.height?{reset:{rects:!0}}:{}}}};function nt(){return typeof window<"u"}function Me(e){return Wn(e)?(e.nodeName||"").toLowerCase():"#document"}function Q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function le(e){var t;return(t=(Wn(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Wn(e){return nt()?e instanceof Node||e instanceof Q(e).Node:!1}function se(e){return nt()?e instanceof Element||e instanceof Q(e).Element:!1}function me(e){return nt()?e instanceof HTMLElement||e instanceof Q(e).HTMLElement:!1}function Qt(e){return!nt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Q(e).ShadowRoot}function Ue(e){const{overflow:t,overflowX:n,overflowY:o,display:s}=ie(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&s!=="inline"&&s!=="contents"}function _s(e){return/^(table|td|th)$/.test(Me(e))}function ot(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Ds=/transform|translate|scale|rotate|perspective|filter/,Ms=/paint|layout|strict|content/,Ne=e=>!!e&&e!=="none";let ut;function Ot(e){const t=se(e)?ie(e):e;return Ne(t.transform)||Ne(t.translate)||Ne(t.scale)||Ne(t.rotate)||Ne(t.perspective)||!kt()&&(Ne(t.backdropFilter)||Ne(t.filter))||Ds.test(t.willChange||"")||Ms.test(t.contain||"")}function Ls(e){let t=ve(e);for(;me(t)&&!ke(t);){if(Ot(t))return t;if(ot(t))return null;t=ve(t)}return null}function kt(){return ut==null&&(ut=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ut}function ke(e){return/^(html|body|#document)$/.test(Me(e))}function ie(e){return Q(e).getComputedStyle(e)}function rt(e){return se(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ve(e){if(Me(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Qt(e)&&e.host||le(e);return Qt(t)?t.host:t}function zn(e){const t=ve(e);return ke(t)?e.ownerDocument?e.ownerDocument.body:e.body:me(t)&&Ue(t)?t:zn(t)}function Ve(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=zn(e),a=s===((o=e.ownerDocument)==null?void 0:o.body),i=Q(s);if(a){const c=yt(i);return t.concat(i,i.visualViewport||[],Ue(s)?s:[],c&&n?Ve(c):[])}else return t.concat(s,Ve(s,[],n))}function yt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Un(e){const t=ie(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const s=me(e),a=s?e.offsetWidth:n,i=s?e.offsetHeight:o,c=Xe(n)!==a||Xe(o)!==i;return c&&(n=a,o=i),{width:n,height:o,$:c}}function _t(e){return se(e)?e:e.contextElement}function Oe(e){const t=_t(e);if(!me(t))return ce(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:a}=Un(t);let i=(a?Xe(n.width):n.width)/o,c=(a?Xe(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Fs=ce(0);function Kn(e){const t=Q(e);return!kt()||!t.visualViewport?Fs:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Bs(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Q(e)?!1:t}function Re(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=_t(e);let i=ce(1);t&&(o?se(o)&&(i=Oe(o)):i=Oe(e));const c=Bs(a,n,o)?Kn(a):ce(0);let d=(s.left+c.x)/i.x,u=(s.top+c.y)/i.y,f=s.width/i.x,p=s.height/i.y;if(a){const v=Q(a),h=o&&se(o)?Q(o):o;let w=v,m=yt(w);for(;m&&o&&h!==w;){const x=Oe(m),b=m.getBoundingClientRect(),y=ie(m),g=b.left+(m.clientLeft+parseFloat(y.paddingLeft))*x.x,S=b.top+(m.clientTop+parseFloat(y.paddingTop))*x.y;d*=x.x,u*=x.y,f*=x.x,p*=x.y,d+=g,u+=S,w=Q(m),m=yt(w)}}return Ze({width:f,height:p,x:d,y:u})}function st(e,t){const n=rt(e).scrollLeft;return t?t.left+n:Re(le(e)).left+n}function Gn(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-st(e,n),s=n.top+t.scrollTop;return{x:o,y:s}}function $s(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const a=s==="fixed",i=le(o),c=t?ot(t.floating):!1;if(o===i||c&&a)return n;let d={scrollLeft:0,scrollTop:0},u=ce(1);const f=ce(0),p=me(o);if((p||!p&&!a)&&((Me(o)!=="body"||Ue(i))&&(d=rt(o)),p)){const h=Re(o);u=Oe(o),f.x=h.x+o.clientLeft,f.y=h.y+o.clientTop}const v=i&&!p&&!a?Gn(i,d):ce(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-d.scrollLeft*u.x+f.x+v.x,y:n.y*u.y-d.scrollTop*u.y+f.y+v.y}}function Hs(e){return Array.from(e.getClientRects())}function Vs(e){const t=le(e),n=rt(e),o=e.ownerDocument.body,s=Z(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),a=Z(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+st(e);const c=-n.scrollTop;return ie(o).direction==="rtl"&&(i+=Z(t.clientWidth,o.clientWidth)-s),{width:s,height:a,x:i,y:c}}const Jt=25;function Ws(e,t){const n=Q(e),o=le(e),s=n.visualViewport;let a=o.clientWidth,i=o.clientHeight,c=0,d=0;if(s){a=s.width,i=s.height;const f=kt();(!f||f&&t==="fixed")&&(c=s.offsetLeft,d=s.offsetTop)}const u=st(o);if(u<=0){const f=o.ownerDocument,p=f.body,v=getComputedStyle(p),h=f.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,w=Math.abs(o.clientWidth-p.clientWidth-h);w<=Jt&&(a-=w)}else u<=Jt&&(a+=u);return{width:a,height:i,x:c,y:d}}function zs(e,t){const n=Re(e,!0,t==="fixed"),o=n.top+e.clientTop,s=n.left+e.clientLeft,a=me(e)?Oe(e):ce(1),i=e.clientWidth*a.x,c=e.clientHeight*a.y,d=s*a.x,u=o*a.y;return{width:i,height:c,x:d,y:u}}function en(e,t,n){let o;if(t==="viewport")o=Ws(e,n);else if(t==="document")o=Vs(le(e));else if(se(t))o=zs(t,n);else{const s=Kn(e);o={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Ze(o)}function Yn(e,t){const n=ve(e);return n===t||!se(n)||ke(n)?!1:ie(n).position==="fixed"||Yn(n,t)}function Us(e,t){const n=t.get(e);if(n)return n;let o=Ve(e,[],!1).filter(c=>se(c)&&Me(c)!=="body"),s=null;const a=ie(e).position==="fixed";let i=a?ve(e):e;for(;se(i)&&!ke(i);){const c=ie(i),d=Ot(i);!d&&c.position==="fixed"&&(s=null),(a?!d&&!s:!d&&c.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Ue(i)&&!d&&Yn(e,i))?o=o.filter(f=>f!==i):s=c,i=ve(i)}return t.set(e,o),o}function Ks(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const i=[...n==="clippingAncestors"?ot(t)?[]:Us(t,this._c):[].concat(n),o],c=en(t,i[0],s);let d=c.top,u=c.right,f=c.bottom,p=c.left;for(let v=1;v<i.length;v++){const h=en(t,i[v],s);d=Z(h.top,d),u=ge(h.right,u),f=ge(h.bottom,f),p=Z(h.left,p)}return{width:u-p,height:f-d,x:p,y:d}}function Gs(e){const{width:t,height:n}=Un(e);return{width:t,height:n}}function Ys(e,t,n){const o=me(t),s=le(t),a=n==="fixed",i=Re(e,!0,a,t);let c={scrollLeft:0,scrollTop:0};const d=ce(0);function u(){d.x=st(s)}if(o||!o&&!a)if((Me(t)!=="body"||Ue(s))&&(c=rt(t)),o){const h=Re(t,!0,a,t);d.x=h.x+t.clientLeft,d.y=h.y+t.clientTop}else s&&u();a&&!o&&s&&u();const f=s&&!o&&!a?Gn(s,c):ce(0),p=i.left+c.scrollLeft-d.x-f.x,v=i.top+c.scrollTop-d.y-f.y;return{x:p,y:v,width:i.width,height:i.height}}function ft(e){return ie(e).position==="static"}function tn(e,t){if(!me(e)||ie(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return le(e)===n&&(n=n.ownerDocument.body),n}function Xn(e,t){const n=Q(e);if(ot(e))return n;if(!me(e)){let s=ve(e);for(;s&&!ke(s);){if(se(s)&&!ft(s))return s;s=ve(s)}return n}let o=tn(e,t);for(;o&&_s(o)&&ft(o);)o=tn(o,t);return o&&ke(o)&&ft(o)&&!Ot(o)?n:o||Ls(e)||n}const Xs=async function(e){const t=this.getOffsetParent||Xn,n=this.getDimensions,o=await n(e.floating);return{reference:Ys(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function qs(e){return ie(e).direction==="rtl"}const Zs={convertOffsetParentRelativeRectToViewportRelativeRect:$s,getDocumentElement:le,getClippingRect:Ks,getOffsetParent:Xn,getElementRects:Xs,getClientRects:Hs,getDimensions:Gs,getScale:Oe,isElement:se,isRTL:qs};function qn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qs(e,t){let n=null,o;const s=le(e);function a(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function i(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),a();const u=e.getBoundingClientRect(),{left:f,top:p,width:v,height:h}=u;if(c||t(),!v||!h)return;const w=Ge(p),m=Ge(s.clientWidth-(f+v)),x=Ge(s.clientHeight-(p+h)),b=Ge(f),g={rootMargin:-w+"px "+-m+"px "+-x+"px "+-b+"px",threshold:Z(0,ge(1,d))||1};let S=!0;function N(R){const A=R[0].intersectionRatio;if(A!==d){if(!S)return i();A?i(!1,A):o=setTimeout(()=>{i(!1,1e-7)},1e3)}A===1&&!qn(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(N,{...g,root:s.ownerDocument})}catch{n=new IntersectionObserver(N,g)}n.observe(e)}return i(!0),a}function Js(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=o,u=_t(e),f=s||a?[...u?Ve(u):[],...t?Ve(t):[]]:[];f.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),a&&b.addEventListener("resize",n)});const p=u&&c?Qs(u,n):null;let v=-1,h=null;i&&(h=new ResizeObserver(b=>{let[y]=b;y&&y.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var g;(g=h)==null||g.observe(t)})),n()}),u&&!d&&h.observe(u),t&&h.observe(t));let w,m=d?Re(e):null;d&&x();function x(){const b=Re(e);m&&!qn(m,b)&&n(),m=b,w=requestAnimationFrame(x)}return n(),()=>{var b;f.forEach(y=>{s&&y.removeEventListener("scroll",n),a&&y.removeEventListener("resize",n)}),p==null||p(),(b=h)==null||b.disconnect(),h=null,d&&cancelAnimationFrame(w)}}const ei=Es,ti=Is,ni=As,oi=ks,ri=Ts,nn=Rs,si=Os,ii=(e,t,n)=>{const o=new Map,s={platform:Zs,...n},a={...s.platform,_c:o};return js(e,t,{...s,platform:a})};var ai=typeof document<"u",ci=function(){},Ye=ai?l.useLayoutEffect:ci;function Qe(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Qe(e[o],t[o]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,s[o]))return!1;for(o=n;o--!==0;){const a=s[o];if(!(a==="_owner"&&e.$$typeof)&&!Qe(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function Zn(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function on(e,t){const n=Zn(e);return Math.round(t*n)/n}function pt(e){const t=l.useRef(e);return Ye(()=>{t.current=e}),t}function li(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:s,elements:{reference:a,floating:i}={},transform:c=!0,whileElementsMounted:d,open:u}=e,[f,p]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,h]=l.useState(o);Qe(v,o)||h(o);const[w,m]=l.useState(null),[x,b]=l.useState(null),y=l.useCallback(P=>{P!==R.current&&(R.current=P,m(P))},[]),g=l.useCallback(P=>{P!==A.current&&(A.current=P,b(P))},[]),S=a||w,N=i||x,R=l.useRef(null),A=l.useRef(null),T=l.useRef(f),j=d!=null,O=pt(d),D=pt(s),L=pt(u),_=l.useCallback(()=>{if(!R.current||!A.current)return;const P={placement:t,strategy:n,middleware:v};D.current&&(P.platform=D.current),ii(R.current,A.current,P).then(V=>{const X={...V,isPositioned:L.current!==!1};k.current&&!Qe(T.current,X)&&(T.current=X,Rt.flushSync(()=>{p(X)}))})},[v,t,n,D,L]);Ye(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,p(P=>({...P,isPositioned:!1})))},[u]);const k=l.useRef(!1);Ye(()=>(k.current=!0,()=>{k.current=!1}),[]),Ye(()=>{if(S&&(R.current=S),N&&(A.current=N),S&&N){if(O.current)return O.current(S,N,_);_()}},[S,N,_,O,j]);const $=l.useMemo(()=>({reference:R,floating:A,setReference:y,setFloating:g}),[y,g]),I=l.useMemo(()=>({reference:S,floating:N}),[S,N]),M=l.useMemo(()=>{const P={position:n,left:0,top:0};if(!I.floating)return P;const V=on(I.floating,f.x),X=on(I.floating,f.y);return c?{...P,transform:"translate("+V+"px, "+X+"px)",...Zn(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:X}},[n,c,I.floating,f.x,f.y]);return l.useMemo(()=>({...f,update:_,refs:$,elements:I,floatingStyles:M}),[f,_,$,I,M])}const di=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:s}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?nn({element:o.current,padding:s}).fn(n):{}:o?nn({element:o,padding:s}).fn(n):{}}}},ui=(e,t)=>{const n=ei(e);return{name:n.name,fn:n.fn,options:[e,t]}},fi=(e,t)=>{const n=ti(e);return{name:n.name,fn:n.fn,options:[e,t]}},pi=(e,t)=>({fn:si(e).fn,options:[e,t]}),mi=(e,t)=>{const n=ni(e);return{name:n.name,fn:n.fn,options:[e,t]}},hi=(e,t)=>{const n=oi(e);return{name:n.name,fn:n.fn,options:[e,t]}},xi=(e,t)=>{const n=ri(e);return{name:n.name,fn:n.fn,options:[e,t]}},gi=(e,t)=>{const n=di(e);return{name:n.name,fn:n.fn,options:[e,t]}};var vi="Arrow",Qn=l.forwardRef((e,t)=>{const{children:n,width:o=10,height:s=5,...a}=e;return r.jsx(K.svg,{...a,ref:t,width:o,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});Qn.displayName=vi;var yi=Qn,Dt="Popper",[Jn,eo]=_e(Dt),[wi,to]=Jn(Dt),no=e=>{const{__scopePopper:t,children:n}=e,[o,s]=l.useState(null);return r.jsx(wi,{scope:t,anchor:o,onAnchorChange:s,children:n})};no.displayName=Dt;var oo="PopperAnchor",ro=l.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...s}=e,a=to(oo,n),i=l.useRef(null),c=Y(t,i),d=l.useRef(null);return l.useEffect(()=>{const u=d.current;d.current=(o==null?void 0:o.current)||i.current,u!==d.current&&a.onAnchorChange(d.current)}),o?null:r.jsx(K.div,{...s,ref:c})});ro.displayName=oo;var Mt="PopperContent",[bi,Si]=Jn(Mt),so=l.forwardRef((e,t)=>{var E,W,G,H,F,B;const{__scopePopper:n,side:o="bottom",sideOffset:s=0,align:a="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:v=!1,updatePositionStrategy:h="optimized",onPlaced:w,...m}=e,x=to(Mt,n),[b,y]=l.useState(null),g=Y(t,C=>y(C)),[S,N]=l.useState(null),R=fn(S),A=(R==null?void 0:R.width)??0,T=(R==null?void 0:R.height)??0,j=o+(a!=="center"?"-"+a:""),O=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},D=Array.isArray(u)?u:[u],L=D.length>0,_={padding:O,boundary:D.filter(Ni),altBoundary:L},{refs:k,floatingStyles:$,placement:I,isPositioned:M,middlewareData:P}=li({strategy:"fixed",placement:j,whileElementsMounted:(...C)=>Js(...C,{animationFrame:h==="always"}),elements:{reference:x.anchor},middleware:[ui({mainAxis:s+T,alignmentAxis:i}),d&&fi({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?pi():void 0,..._}),d&&mi({..._}),hi({..._,apply:({elements:C,rects:U,availableWidth:q,availableHeight:Se})=>{const{width:Fe,height:qo}=U.reference,Ke=C.floating.style;Ke.setProperty("--radix-popper-available-width",`${q}px`),Ke.setProperty("--radix-popper-available-height",`${Se}px`),Ke.setProperty("--radix-popper-anchor-width",`${Fe}px`),Ke.setProperty("--radix-popper-anchor-height",`${qo}px`)}}),S&&gi({element:S,padding:c}),ji({arrowWidth:A,arrowHeight:T}),v&&xi({strategy:"referenceHidden",..._})]}),[V,X]=co(I),te=jt(w);re(()=>{M&&(te==null||te())},[M,te]);const he=(E=P.arrow)==null?void 0:E.x,be=(W=P.arrow)==null?void 0:W.y,ne=((G=P.arrow)==null?void 0:G.centerOffset)!==0,[xe,de]=l.useState();return re(()=>{b&&de(window.getComputedStyle(b).zIndex)},[b]),r.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:M?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:xe,"--radix-popper-transform-origin":[(H=P.transformOrigin)==null?void 0:H.x,(F=P.transformOrigin)==null?void 0:F.y].join(" "),...((B=P.hide)==null?void 0:B.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(bi,{scope:n,placedSide:V,onArrowChange:N,arrowX:he,arrowY:be,shouldHideArrow:ne,children:r.jsx(K.div,{"data-side":V,"data-align":X,...m,ref:g,style:{...m.style,animation:M?void 0:"none"}})})})});so.displayName=Mt;var io="PopperArrow",Ci={top:"bottom",right:"left",bottom:"top",left:"right"},ao=l.forwardRef(function(t,n){const{__scopePopper:o,...s}=t,a=Si(io,o),i=Ci[a.placedSide];return r.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:r.jsx(yi,{...s,ref:n,style:{...s.style,display:"block"}})})});ao.displayName=io;function Ni(e){return e!==null}var ji=e=>({name:"transformOrigin",options:e,fn(t){var x,b,y;const{placement:n,rects:o,middlewareData:s}=t,i=((x=s.arrow)==null?void 0:x.centerOffset)!==0,c=i?0:e.arrowWidth,d=i?0:e.arrowHeight,[u,f]=co(n),p={start:"0%",center:"50%",end:"100%"}[f],v=(((b=s.arrow)==null?void 0:b.x)??0)+c/2,h=(((y=s.arrow)==null?void 0:y.y)??0)+d/2;let w="",m="";return u==="bottom"?(w=i?p:`${v}px`,m=`${-d}px`):u==="top"?(w=i?p:`${v}px`,m=`${o.floating.height+d}px`):u==="right"?(w=`${-d}px`,m=i?p:`${h}px`):u==="left"&&(w=`${o.floating.width+d}px`,m=i?p:`${h}px`),{data:{x:w,y:m}}}});function co(e){const[t,n="center"]=e.split("-");return[t,n]}var Ri=no,Ai=ro,Ti=so,Pi=ao;function Ei(e){const t=Ii(e),n=l.forwardRef((o,s)=>{const{children:a,...i}=o,c=l.Children.toArray(a),d=c.find(ki);if(d){const u=d.props.children,f=c.map(p=>p===d?l.Children.count(u)>1?l.Children.only(null):l.isValidElement(u)?u.props.children:null:p);return r.jsx(t,{...i,ref:s,children:l.isValidElement(u)?l.cloneElement(u,void 0,f):null})}return r.jsx(t,{...i,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function Ii(e){const t=l.forwardRef((n,o)=>{const{children:s,...a}=n;if(l.isValidElement(s)){const i=Di(s),c=_i(a,s.props);return s.type!==l.Fragment&&(c.ref=o?an(o,i):i),l.cloneElement(s,c)}return l.Children.count(s)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Oi=Symbol("radix.slottable");function ki(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Oi}function _i(e,t){const n={...t};for(const o in t){const s=e[o],a=t[o];/^on[A-Z]/.test(o)?s&&a?n[o]=(...c)=>{const d=a(...c);return s(...c),d}:s&&(n[o]=s):o==="style"?n[o]={...s,...a}:o==="className"&&(n[o]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function Di(e){var o,s;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var lo=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Mi="VisuallyHidden",Li=l.forwardRef((e,t)=>r.jsx(K.span,{...e,ref:t,style:{...lo,...e.style}}));Li.displayName=Mi;var Fi=[" ","Enter","ArrowUp","ArrowDown"],Bi=[" ","Enter"],Ae="Select",[it,at,$i]=wn(Ae),[Le]=_e(Ae,[$i,eo]),ct=eo(),[Hi,ye]=Le(Ae),[Vi,Wi]=Le(Ae),uo=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:s,onOpenChange:a,value:i,defaultValue:c,onValueChange:d,dir:u,name:f,autoComplete:p,disabled:v,required:h,form:w}=e,m=ct(t),[x,b]=l.useState(null),[y,g]=l.useState(null),[S,N]=l.useState(!1),R=At(u),[A,T]=He({prop:o,defaultProp:s??!1,onChange:a,caller:Ae}),[j,O]=He({prop:i,defaultProp:c,onChange:d,caller:Ae}),D=l.useRef(null),L=x?w||!!x.closest("form"):!0,[_,k]=l.useState(new Set),$=Array.from(_).map(I=>I.props.value).join(";");return r.jsx(Ri,{...m,children:r.jsxs(Hi,{required:h,scope:t,trigger:x,onTriggerChange:b,valueNode:y,onValueNodeChange:g,valueNodeHasChildren:S,onValueNodeHasChildrenChange:N,contentId:We(),value:j,onValueChange:O,open:A,onOpenChange:T,dir:R,triggerPointerDownPosRef:D,disabled:v,children:[r.jsx(it.Provider,{scope:t,children:r.jsx(Vi,{scope:e.__scopeSelect,onNativeOptionAdd:l.useCallback(I=>{k(M=>new Set(M).add(I))},[]),onNativeOptionRemove:l.useCallback(I=>{k(M=>{const P=new Set(M);return P.delete(I),P})},[]),children:n})}),L?r.jsxs(Do,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:j,onChange:I=>O(I.target.value),disabled:v,form:w,children:[j===void 0?r.jsx("option",{value:""}):null,Array.from(_)]},$):null]})})};uo.displayName=Ae;var fo="SelectTrigger",po=l.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...s}=e,a=ct(n),i=ye(fo,n),c=i.disabled||o,d=Y(t,i.onTriggerChange),u=at(n),f=l.useRef("touch"),[p,v,h]=Lo(m=>{const x=u().filter(g=>!g.disabled),b=x.find(g=>g.value===i.value),y=Fo(x,m,b);y!==void 0&&i.onValueChange(y.value)}),w=m=>{c||(i.onOpenChange(!0),h()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return r.jsx(Ai,{asChild:!0,...a,children:r.jsx(K.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Mo(i.value)?"":void 0,...s,ref:d,onClick:z(s.onClick,m=>{m.currentTarget.focus(),f.current!=="mouse"&&w(m)}),onPointerDown:z(s.onPointerDown,m=>{f.current=m.pointerType;const x=m.target;x.hasPointerCapture(m.pointerId)&&x.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(w(m),m.preventDefault())}),onKeyDown:z(s.onKeyDown,m=>{const x=p.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&v(m.key),!(x&&m.key===" ")&&Fi.includes(m.key)&&(w(),m.preventDefault())})})})});po.displayName=fo;var mo="SelectValue",ho=l.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:s,children:a,placeholder:i="",...c}=e,d=ye(mo,n),{onValueNodeHasChildrenChange:u}=d,f=a!==void 0,p=Y(t,d.onValueNodeChange);return re(()=>{u(f)},[u,f]),r.jsx(K.span,{...c,ref:p,style:{pointerEvents:"none"},children:Mo(d.value)?r.jsx(r.Fragment,{children:i}):a})});ho.displayName=mo;var zi="SelectIcon",xo=l.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...s}=e;return r.jsx(K.span,{"aria-hidden":!0,...s,ref:t,children:o||"▼"})});xo.displayName=zi;var Ui="SelectPortal",go=e=>r.jsx(Qo,{asChild:!0,...e});go.displayName=Ui;var Te="SelectContent",vo=l.forwardRef((e,t)=>{const n=ye(Te,e.__scopeSelect),[o,s]=l.useState();if(re(()=>{s(new DocumentFragment)},[]),!n.open){const a=o;return a?Rt.createPortal(r.jsx(yo,{scope:e.__scopeSelect,children:r.jsx(it.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),a):null}return r.jsx(wo,{...e,ref:t})});vo.displayName=Te;var oe=10,[yo,we]=Le(Te),Ki="SelectContentImpl",Gi=Ei("SelectContent.RemoveScroll"),wo=l.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:i,side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:v,collisionPadding:h,sticky:w,hideWhenDetached:m,avoidCollisions:x,...b}=e,y=ye(Te,n),[g,S]=l.useState(null),[N,R]=l.useState(null),A=Y(t,E=>S(E)),[T,j]=l.useState(null),[O,D]=l.useState(null),L=at(n),[_,k]=l.useState(!1),$=l.useRef(!1);l.useEffect(()=>{if(g)return Jo(g)},[g]),er();const I=l.useCallback(E=>{const[W,...G]=L().map(B=>B.ref.current),[H]=G.slice(-1),F=document.activeElement;for(const B of E)if(B===F||(B==null||B.scrollIntoView({block:"nearest"}),B===W&&N&&(N.scrollTop=0),B===H&&N&&(N.scrollTop=N.scrollHeight),B==null||B.focus(),document.activeElement!==F))return},[L,N]),M=l.useCallback(()=>I([T,g]),[I,T,g]);l.useEffect(()=>{_&&M()},[_,M]);const{onOpenChange:P,triggerPointerDownPosRef:V}=y;l.useEffect(()=>{if(g){let E={x:0,y:0};const W=H=>{var F,B;E={x:Math.abs(Math.round(H.pageX)-(((F=V.current)==null?void 0:F.x)??0)),y:Math.abs(Math.round(H.pageY)-(((B=V.current)==null?void 0:B.y)??0))}},G=H=>{E.x<=10&&E.y<=10?H.preventDefault():g.contains(H.target)||P(!1),document.removeEventListener("pointermove",W),V.current=null};return V.current!==null&&(document.addEventListener("pointermove",W),document.addEventListener("pointerup",G,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",W),document.removeEventListener("pointerup",G,{capture:!0})}}},[g,P,V]),l.useEffect(()=>{const E=()=>P(!1);return window.addEventListener("blur",E),window.addEventListener("resize",E),()=>{window.removeEventListener("blur",E),window.removeEventListener("resize",E)}},[P]);const[X,te]=Lo(E=>{const W=L().filter(F=>!F.disabled),G=W.find(F=>F.ref.current===document.activeElement),H=Fo(W,E,G);H&&setTimeout(()=>H.ref.current.focus())}),he=l.useCallback((E,W,G)=>{const H=!$.current&&!G;(y.value!==void 0&&y.value===W||H)&&(j(E),H&&($.current=!0))},[y.value]),be=l.useCallback(()=>g==null?void 0:g.focus(),[g]),ne=l.useCallback((E,W,G)=>{const H=!$.current&&!G;(y.value!==void 0&&y.value===W||H)&&D(E)},[y.value]),xe=o==="popper"?wt:bo,de=xe===wt?{side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:v,collisionPadding:h,sticky:w,hideWhenDetached:m,avoidCollisions:x}:{};return r.jsx(yo,{scope:n,content:g,viewport:N,onViewportChange:R,itemRefCallback:he,selectedItem:T,onItemLeave:be,itemTextRefCallback:ne,focusSelectedItem:M,selectedItemText:O,position:o,isPositioned:_,searchRef:X,children:r.jsx(tr,{as:Gi,allowPinchZoom:!0,children:r.jsx(nr,{asChild:!0,trapped:y.open,onMountAutoFocus:E=>{E.preventDefault()},onUnmountAutoFocus:z(s,E=>{var W;(W=y.trigger)==null||W.focus({preventScroll:!0}),E.preventDefault()}),children:r.jsx(or,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:E=>E.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:r.jsx(xe,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:E=>E.preventDefault(),...b,...de,onPlaced:()=>k(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:z(b.onKeyDown,E=>{const W=E.ctrlKey||E.altKey||E.metaKey;if(E.key==="Tab"&&E.preventDefault(),!W&&E.key.length===1&&te(E.key),["ArrowUp","ArrowDown","Home","End"].includes(E.key)){let H=L().filter(F=>!F.disabled).map(F=>F.ref.current);if(["ArrowUp","End"].includes(E.key)&&(H=H.slice().reverse()),["ArrowUp","ArrowDown"].includes(E.key)){const F=E.target,B=H.indexOf(F);H=H.slice(B+1)}setTimeout(()=>I(H)),E.preventDefault()}})})})})})})});wo.displayName=Ki;var Yi="SelectItemAlignedPosition",bo=l.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...s}=e,a=ye(Te,n),i=we(Te,n),[c,d]=l.useState(null),[u,f]=l.useState(null),p=Y(t,A=>f(A)),v=at(n),h=l.useRef(!1),w=l.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:b,focusSelectedItem:y}=i,g=l.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&u&&m&&x&&b){const A=a.trigger.getBoundingClientRect(),T=u.getBoundingClientRect(),j=a.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(a.dir!=="rtl"){const F=O.left-T.left,B=j.left-F,C=A.left-B,U=A.width+C,q=Math.max(U,T.width),Se=window.innerWidth-oe,Fe=Kt(B,[oe,Math.max(oe,Se-q)]);c.style.minWidth=U+"px",c.style.left=Fe+"px"}else{const F=T.right-O.right,B=window.innerWidth-j.right-F,C=window.innerWidth-A.right-B,U=A.width+C,q=Math.max(U,T.width),Se=window.innerWidth-oe,Fe=Kt(B,[oe,Math.max(oe,Se-q)]);c.style.minWidth=U+"px",c.style.right=Fe+"px"}const D=v(),L=window.innerHeight-oe*2,_=m.scrollHeight,k=window.getComputedStyle(u),$=parseInt(k.borderTopWidth,10),I=parseInt(k.paddingTop,10),M=parseInt(k.borderBottomWidth,10),P=parseInt(k.paddingBottom,10),V=$+I+_+P+M,X=Math.min(x.offsetHeight*5,V),te=window.getComputedStyle(m),he=parseInt(te.paddingTop,10),be=parseInt(te.paddingBottom,10),ne=A.top+A.height/2-oe,xe=L-ne,de=x.offsetHeight/2,E=x.offsetTop+de,W=$+I+E,G=V-W;if(W<=ne){const F=D.length>0&&x===D[D.length-1].ref.current;c.style.bottom="0px";const B=u.clientHeight-m.offsetTop-m.offsetHeight,C=Math.max(xe,de+(F?be:0)+B+M),U=W+C;c.style.height=U+"px"}else{const F=D.length>0&&x===D[0].ref.current;c.style.top="0px";const C=Math.max(ne,$+m.offsetTop+(F?he:0)+de)+G;c.style.height=C+"px",m.scrollTop=W-ne+m.offsetTop}c.style.margin=`${oe}px 0`,c.style.minHeight=X+"px",c.style.maxHeight=L+"px",o==null||o(),requestAnimationFrame(()=>h.current=!0)}},[v,a.trigger,a.valueNode,c,u,m,x,b,a.dir,o]);re(()=>g(),[g]);const[S,N]=l.useState();re(()=>{u&&N(window.getComputedStyle(u).zIndex)},[u]);const R=l.useCallback(A=>{A&&w.current===!0&&(g(),y==null||y(),w.current=!1)},[g,y]);return r.jsx(qi,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:R,children:r.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:r.jsx(K.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});bo.displayName=Yi;var Xi="SelectPopperPosition",wt=l.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:s=oe,...a}=e,i=ct(n);return r.jsx(Ti,{...i,...a,ref:t,align:o,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});wt.displayName=Xi;var[qi,Lt]=Le(Te,{}),bt="SelectViewport",So=l.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...s}=e,a=we(bt,n),i=Lt(bt,n),c=Y(t,a.onViewportChange),d=l.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),r.jsx(it.Slot,{scope:n,children:r.jsx(K.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:z(s.onScroll,u=>{const f=u.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:v}=i;if(v!=null&&v.current&&p){const h=Math.abs(d.current-f.scrollTop);if(h>0){const w=window.innerHeight-oe*2,m=parseFloat(p.style.minHeight),x=parseFloat(p.style.height),b=Math.max(m,x);if(b<w){const y=b+h,g=Math.min(w,y),S=y-g;p.style.height=g+"px",p.style.bottom==="0px"&&(f.scrollTop=S>0?S:0,p.style.justifyContent="flex-end")}}}d.current=f.scrollTop})})})]})});So.displayName=bt;var Co="SelectGroup",[Zi,Qi]=Le(Co),Ji=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,s=We();return r.jsx(Zi,{scope:n,id:s,children:r.jsx(K.div,{role:"group","aria-labelledby":s,...o,ref:t})})});Ji.displayName=Co;var No="SelectLabel",jo=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,s=Qi(No,n);return r.jsx(K.div,{id:s.id,...o,ref:t})});jo.displayName=No;var Je="SelectItem",[ea,Ro]=Le(Je),Ao=l.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:s=!1,textValue:a,...i}=e,c=ye(Je,n),d=we(Je,n),u=c.value===o,[f,p]=l.useState(a??""),[v,h]=l.useState(!1),w=Y(t,y=>{var g;return(g=d.itemRefCallback)==null?void 0:g.call(d,y,o,s)}),m=We(),x=l.useRef("touch"),b=()=>{s||(c.onValueChange(o),c.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(ea,{scope:n,value:o,disabled:s,textId:m,isSelected:u,onItemTextChange:l.useCallback(y=>{p(g=>g||((y==null?void 0:y.textContent)??"").trim())},[]),children:r.jsx(it.ItemSlot,{scope:n,value:o,disabled:s,textValue:f,children:r.jsx(K.div,{role:"option","aria-labelledby":m,"data-highlighted":v?"":void 0,"aria-selected":u&&v,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:w,onFocus:z(i.onFocus,()=>h(!0)),onBlur:z(i.onBlur,()=>h(!1)),onClick:z(i.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:z(i.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:z(i.onPointerDown,y=>{x.current=y.pointerType}),onPointerMove:z(i.onPointerMove,y=>{var g;x.current=y.pointerType,s?(g=d.onItemLeave)==null||g.call(d):x.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:z(i.onPointerLeave,y=>{var g;y.currentTarget===document.activeElement&&((g=d.onItemLeave)==null||g.call(d))}),onKeyDown:z(i.onKeyDown,y=>{var S;((S=d.searchRef)==null?void 0:S.current)!==""&&y.key===" "||(Bi.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});Ao.displayName=Je;var Be="SelectItemText",To=l.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:s,...a}=e,i=ye(Be,n),c=we(Be,n),d=Ro(Be,n),u=Wi(Be,n),[f,p]=l.useState(null),v=Y(t,b=>p(b),d.onItemTextChange,b=>{var y;return(y=c.itemTextRefCallback)==null?void 0:y.call(c,b,d.value,d.disabled)}),h=f==null?void 0:f.textContent,w=l.useMemo(()=>r.jsx("option",{value:d.value,disabled:d.disabled,children:h},d.value),[d.disabled,d.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return re(()=>(m(w),()=>x(w)),[m,x,w]),r.jsxs(r.Fragment,{children:[r.jsx(K.span,{id:d.textId,...a,ref:v}),d.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Rt.createPortal(a.children,i.valueNode):null]})});To.displayName=Be;var Po="SelectItemIndicator",Eo=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return Ro(Po,n).isSelected?r.jsx(K.span,{"aria-hidden":!0,...o,ref:t}):null});Eo.displayName=Po;var St="SelectScrollUpButton",Io=l.forwardRef((e,t)=>{const n=we(St,e.__scopeSelect),o=Lt(St,e.__scopeSelect),[s,a]=l.useState(!1),i=Y(t,o.onScrollButtonChange);return re(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=d.scrollTop>0;a(u)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?r.jsx(ko,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null});Io.displayName=St;var Ct="SelectScrollDownButton",Oo=l.forwardRef((e,t)=>{const n=we(Ct,e.__scopeSelect),o=Lt(Ct,e.__scopeSelect),[s,a]=l.useState(!1),i=Y(t,o.onScrollButtonChange);return re(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=d.scrollHeight-d.clientHeight,f=Math.ceil(d.scrollTop)<u;a(f)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?r.jsx(ko,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null});Oo.displayName=Ct;var ko=l.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...s}=e,a=we("SelectScrollButton",n),i=l.useRef(null),c=at(n),d=l.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return l.useEffect(()=>()=>d(),[d]),re(()=>{var f;const u=c().find(p=>p.ref.current===document.activeElement);(f=u==null?void 0:u.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),r.jsx(K.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:z(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(o,50))}),onPointerMove:z(s.onPointerMove,()=>{var u;(u=a.onItemLeave)==null||u.call(a),i.current===null&&(i.current=window.setInterval(o,50))}),onPointerLeave:z(s.onPointerLeave,()=>{d()})})}),ta="SelectSeparator",_o=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return r.jsx(K.div,{"aria-hidden":!0,...o,ref:t})});_o.displayName=ta;var Nt="SelectArrow",na=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,s=ct(n),a=ye(Nt,n),i=we(Nt,n);return a.open&&i.position==="popper"?r.jsx(Pi,{...s,...o,ref:t}):null});na.displayName=Nt;var oa="SelectBubbleInput",Do=l.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const s=l.useRef(null),a=Y(o,s),i=un(t);return l.useEffect(()=>{const c=s.current;if(!c)return;const d=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(d,"value").set;if(i!==t&&f){const p=new Event("change",{bubbles:!0});f.call(c,t),c.dispatchEvent(p)}},[i,t]),r.jsx(K.select,{...n,style:{...lo,...n.style},ref:a,defaultValue:t})});Do.displayName=oa;function Mo(e){return e===""||e===void 0}function Lo(e){const t=jt(e),n=l.useRef(""),o=l.useRef(0),s=l.useCallback(i=>{const c=n.current+i;t(c),function d(u){n.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>d(""),1e3))}(c)},[t]),a=l.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return l.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,s,a]}function Fo(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let i=ra(e,Math.max(a,0));s.length===1&&(i=i.filter(u=>u!==n));const d=i.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function ra(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var sa=uo,Bo=po,ia=ho,aa=xo,ca=go,$o=vo,la=So,Ho=jo,Vo=Ao,da=To,ua=Eo,Wo=Io,zo=Oo,Uo=_o;const Ko=sa,Go=ia,Ft=l.forwardRef(({className:e,children:t,...n},o)=>r.jsxs(Bo,{ref:o,className:J("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,r.jsx(aa,{asChild:!0,children:r.jsx(dn,{className:"h-4 w-4 opacity-50"})})]}));Ft.displayName=Bo.displayName;const Yo=l.forwardRef(({className:e,...t},n)=>r.jsx(Wo,{ref:n,className:J("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(_r,{className:"h-4 w-4"})}));Yo.displayName=Wo.displayName;const Xo=l.forwardRef(({className:e,...t},n)=>r.jsx(zo,{ref:n,className:J("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(dn,{className:"h-4 w-4"})}));Xo.displayName=zo.displayName;const Bt=l.forwardRef(({className:e,children:t,position:n="popper",...o},s)=>r.jsx(ca,{children:r.jsxs($o,{ref:s,className:J("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:[r.jsx(Yo,{}),r.jsx(la,{className:J("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(Xo,{})]})}));Bt.displayName=$o.displayName;const fa=l.forwardRef(({className:e,...t},n)=>r.jsx(Ho,{ref:n,className:J("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));fa.displayName=Ho.displayName;const $e=l.forwardRef(({className:e,children:t,...n},o)=>r.jsxs(Vo,{ref:o,className:J("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(ua,{children:r.jsx(rr,{className:"h-4 w-4"})})}),r.jsx(da,{children:t})]}));$e.displayName=Vo.displayName;const pa=l.forwardRef(({className:e,...t},n)=>r.jsx(Uo,{ref:n,className:J("-mx-1 my-1 h-px bg-muted",e),...t}));pa.displayName=Uo.displayName;const rn={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function ma({open:e,onOpenChange:t,onAdded:n}){const[o,s]=l.useState([]),[a,i]=l.useState(!1),[c,d]=l.useState(null),[u,f]=l.useState(""),[p,v]=l.useState(""),[h,w]=l.useState(""),[m,x]=l.useState(""),[b,y]=l.useState(!1),[g,S]=l.useState(null);l.useEffect(()=>{e&&sr().then(j=>s(j.available)).catch(()=>s([]))},[e]);const N=()=>{i(!1),d(null),f(""),v(""),w(""),x(""),y(!1),S(null)},R=async j=>{d(j),S(null);try{const{id:O}=await $t({type:j,label:rn[j]||j}),{url:D}=await mt(O);window.open(D,"_blank"),N(),t(!1),n()}catch(O){S(O instanceof Error?O.message:"添加失败"),d(null)}},A=async()=>{if(!u||!p||!h||!m){S("请填写所有字段");return}y(!0),S(null);try{const{id:j}=await $t({type:u,label:p,clientId:h,clientSecret:m}),{url:O}=await mt(j);window.open(O,"_blank"),N(),t(!1),n()}catch(j){S(j instanceof Error?j.message:"添加失败")}finally{y(!1)}},T=o.length>0;return r.jsx(ir,{open:e,onOpenChange:j=>{t(j),j||N()},children:r.jsxs(ar,{className:"sm:max-w-md",children:[r.jsxs(cr,{children:[r.jsxs(lr,{className:"flex items-center gap-2",children:[r.jsx(ht,{className:"h-5 w-5"}),"添加云盘账号"]}),r.jsx(dr,{children:a?"手动填写 OAuth 凭据连接云盘":"选择云盘类型,点击后跳转登录授权"})]}),a?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ue,{children:"云盘类型"}),r.jsxs(Ko,{value:u,onValueChange:f,children:[r.jsx(Ft,{children:r.jsx(Go,{placeholder:"选择云盘类型"})}),r.jsxs(Bt,{children:[r.jsx($e,{value:"google-drive",children:"Google Drive"}),r.jsx($e,{value:"onedrive",children:"OneDrive"}),r.jsx($e,{value:"dropbox",children:"Dropbox"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ue,{children:"显示名称"}),r.jsx(je,{placeholder:"例如:我的 Google Drive",value:p,onChange:j=>v(j.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ue,{children:"Client ID"}),r.jsx(je,{placeholder:"OAuth Client ID",value:h,onChange:j=>w(j.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ue,{children:"Client Secret"}),r.jsx(je,{type:"password",placeholder:"OAuth Client Secret",value:m,onChange:j=>x(j.target.value)})]}),g&&r.jsx("p",{className:"text-sm text-destructive",children:g})]}),r.jsxs(ur,{children:[r.jsx(ee,{variant:"outline",onClick:()=>{i(!1),S(null)},children:"返回"}),r.jsx(ee,{onClick:A,disabled:b,children:b?"添加中...":"添加并授权"})]})]}):r.jsxs("div",{className:"space-y-3 py-2",children:[T?r.jsx(r.Fragment,{children:o.map(j=>r.jsx(ee,{variant:"outline",className:"w-full justify-start gap-3 h-12 text-base",onClick:()=>void R(j),disabled:c!==null,children:c===j?"连接中...":`连接 ${rn[j]||j}`},j))}):r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"暂无内置 OAuth 凭据,请使用手动模式添加"}),g&&r.jsx("p",{className:"text-sm text-destructive",children:g}),r.jsx("div",{className:"pt-2 border-t border-border",children:r.jsxs("button",{onClick:()=>{i(!0),S(null)},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx(Br,{className:"h-3.5 w-3.5"}),"手动填写 OAuth 凭据"]})})]})]})})}const ha={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function xa({type:e}){switch(e){case"google-drive":return r.jsx(zt,{className:"h-5 w-5 text-blue-500"});case"onedrive":return r.jsx(ht,{className:"h-5 w-5 text-sky-500"});case"dropbox":return r.jsx(zt,{className:"h-5 w-5 text-indigo-500"});default:return r.jsx(ht,{className:"h-5 w-5"})}}function ga({provider:e,onDelete:t,onReauth:n}){var i;const[o,s]=l.useState(!1),a=()=>{o?(t(e.id),s(!1)):(s(!0),setTimeout(()=>s(!1),3e3))};return r.jsxs(fr,{children:[r.jsx(pr,{className:"pb-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(xa,{type:e.type}),r.jsxs("div",{children:[r.jsx(mr,{className:"text-base",children:e.label}),r.jsx("p",{className:"text-sm text-muted-foreground",children:ha[e.type]||e.type})]})]}),r.jsx(cn,{variant:e.authorized?"default":"destructive",className:e.authorized?"bg-green-600 hover:bg-green-700":"",children:e.authorized?"已授权":"未授权"})]})}),r.jsxs(hr,{children:[e.authorized&&((i=e.tokens)==null?void 0:i.expiry)&&r.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["授权到期:",new Date(e.tokens.expiry).toLocaleDateString("zh-CN")]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>n(e.id),children:[r.jsx(ln,{className:"h-3.5 w-3.5 mr-1"}),"重新授权"]}),r.jsxs(ee,{variant:o?"destructive":"outline",size:"sm",onClick:a,children:[r.jsx(xr,{className:"h-3.5 w-3.5 mr-1"}),o?"确认删除?":"删除"]})]})]})]})}const va={success:{label:"成功",icon:Fr,className:"bg-green-600 hover:bg-green-700"},failed:{label:"失败",icon:$r,className:"bg-red-600 hover:bg-red-700"},partial:{label:"部分完成",icon:Mr,className:"bg-yellow-600 hover:bg-yellow-700"}};function ya(e,t){const n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return`${n}ms`;const o=Math.floor(n/1e3);if(o<60)return`${o}秒`;const s=Math.floor(o/60),a=o%60;return`${s}分${a}秒`}function wa(e){return new Date(e).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function ba({history:e}){const t=e.slice(0,20);return t.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[r.jsx(Dr,{className:"h-10 w-10 mb-3 opacity-50"}),r.jsx("p",{className:"text-sm",children:"暂无备份记录"})]}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b",children:[r.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"时间"}),r.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"项目"}),r.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"云盘"}),r.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"状态"}),r.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"文件数"}),r.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"耗时"})]})}),r.jsx("tbody",{children:t.map(n=>{const o=va[n.status],s=o.icon;return r.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/50",children:[r.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:wa(n.startTime)}),r.jsx("td",{className:"py-2.5 px-2",children:n.projectName}),r.jsx("td",{className:"py-2.5 px-2",children:n.providerLabel}),r.jsxs("td",{className:"py-2.5 px-2",children:[r.jsxs(cn,{className:o.className,children:[r.jsx(s,{className:"h-3 w-3 mr-1"}),o.label]}),n.error&&r.jsx("p",{className:"text-xs text-destructive mt-1",children:n.error})]}),r.jsxs("td",{className:"py-2.5 px-2 whitespace-nowrap",children:[n.filesUploaded,"/",n.filesTotal]}),r.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:ya(n.startTime,n.endTime)})]},n.id)})})]})})}const sn=["node_modules",".git","dist","build","*.log",".DS_Store","*.tmp",".venv","__pycache__",".env"],Sa=[{value:"30",label:"30分钟"},{value:"60",label:"1小时"},{value:"360",label:"6小时"},{value:"720",label:"12小时"},{value:"1440",label:"24小时"}];function Ra(){const e=gr(),[t,n]=l.useState([]),[o,s]=l.useState(!0),[a,i]=l.useState(!1),[c,d]=l.useState({enabled:!1,intervalMinutes:60}),[u,f]=l.useState(!0),[p,v]=l.useState([]),[h,w]=l.useState(!0),[m,x]=l.useState(""),[b,y]=l.useState(!1),[g,S]=l.useState(!1),[N,R]=l.useState([]),[A,T]=l.useState(!0),[j,O]=l.useState(()=>vr()),[D,L]=l.useState(!1),[_,k]=l.useState({webhookEnabled:!1}),[$,I]=l.useState(""),[M,P]=l.useState(!1),V=async()=>{try{const C=await jr();n(C)}catch{}finally{s(!1)}},X=async()=>{try{const C=await Rr();d(C)}catch{}finally{f(!1)}},te=async()=>{try{const C=await Ar();v(C.length>0?C:sn)}catch{v(sn)}finally{w(!1)}},he=async()=>{try{const C=await Tr();R(C)}catch{}finally{T(!1)}};l.useEffect(()=>{V(),X(),te(),he(),yr().then(C=>{k(C),I(C.webhookUrl??"")}).catch(()=>{})},[]);const be=()=>{Or(kr.pomodoroConfig,j,!0),L(!1),lt.success("番茄钟设置已保存")},ne=(C,U)=>{const q=parseInt(U,10);isNaN(q)||q<1||(O(Se=>({...Se,[C]:q})),L(!0))},xe=async()=>{P(!0);try{const C=await Ir({webhookEnabled:$.trim().length>0,webhookUrl:$.trim()||void 0});k(C),lt.success("Webhook 配置已保存")}catch{lt.error("保存失败")}finally{P(!1)}},de=async C=>{try{await Pr(C),n(U=>U.filter(q=>q.id!==C))}catch{}},E=async C=>{try{const{url:U}=await mt(C);window.open(U,"_blank")}catch{}},W=async C=>{const U={...c,enabled:C};d(U);try{await Vt({enabled:C})}catch{d(c)}},G=async C=>{const U=parseInt(C,10),q={...c,intervalMinutes:U};d(q);try{await Vt({intervalMinutes:U})}catch{d(c)}},H=()=>{const C=m.trim();!C||p.includes(C)||(v(U=>[...U,C]),x(""),y(!0))},F=C=>{v(U=>U.filter(q=>q!==C)),y(!0)},B=async()=>{S(!0);try{await Er(p),y(!1)}catch{}finally{S(!1)}};return r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[r.jsx(wr,{className:"h-4 w-4 mr-1"}),"返回"]}),r.jsx("h1",{className:"text-2xl font-bold",children:"设置"})]}),r.jsxs(ps,{defaultValue:"providers",children:[r.jsxs($n,{className:"mb-4",children:[r.jsx(Ee,{value:"providers",children:"云盘账号"}),r.jsx(Ee,{value:"strategy",children:"备份策略"}),r.jsx(Ee,{value:"history",children:"备份记录"}),r.jsxs(Ee,{value:"notifications",children:[r.jsx(Lr,{className:"h-3.5 w-3.5 mr-1.5"}),"通知"]}),r.jsxs(Ee,{value:"pomodoro",children:[r.jsx(Ht,{className:"h-3.5 w-3.5 mr-1.5"}),"番茄钟"]})]}),r.jsxs(Ie,{value:"providers",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs(ee,{onClick:()=>i(!0),children:[r.jsx(br,{className:"h-4 w-4 mr-1"}),"添加云盘"]})}),o?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):t.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-12",children:"暂无云盘账号,点击上方按钮添加"}):r.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:t.map(C=>r.jsx(ga,{provider:C,onDelete:de,onReauth:E},C.id))})]}),r.jsx(ma,{open:a,onOpenChange:i,onAdded:()=>void V()})]}),r.jsx(Ie,{value:"strategy",children:r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-medium",children:"排除规则"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"匹配这些模式的文件和目录将不会被备份"}),h?r.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:r.jsx(Sr,{children:p.map(C=>r.jsxs(Cr.span,{layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2},className:"inline-flex items-center gap-1 rounded-md bg-muted px-2.5 py-1 text-sm",children:[C,r.jsx("button",{onClick:()=>F(C),className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20 p-0.5",children:r.jsx(Nr,{className:"h-3 w-3"})})]},C))})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(je,{placeholder:"输入排除模式,例如 *.log",value:m,onChange:C=>x(C.target.value),onKeyDown:C=>{C.key==="Enter"&&H()},className:"max-w-xs"}),r.jsx(ee,{variant:"outline",size:"sm",onClick:H,children:"添加"})]}),b&&r.jsxs(ee,{onClick:B,disabled:g,children:[r.jsx(Wt,{className:"h-4 w-4 mr-1"}),g?"保存中...":"保存"]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-medium",children:"定时备份"}),u?r.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(yn,{checked:c.enabled,onCheckedChange:W}),r.jsx(ue,{children:c.enabled?"已开启":"已关闭"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ue,{children:"备份间隔"}),r.jsxs(Ko,{value:String(c.intervalMinutes),onValueChange:G,children:[r.jsx(Ft,{className:"w-48",children:r.jsx(Go,{})}),r.jsx(Bt,{children:Sa.map(C=>r.jsx($e,{value:C.value,children:C.label},C.value))})]})]})]})]})]})}),r.jsx(Ie,{value:"history",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>{T(!0),he()},children:[r.jsx(ln,{className:"h-4 w-4 mr-1"}),"刷新"]})}),A?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):r.jsx(ba,{history:N})]})}),r.jsx(Ie,{value:"notifications",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[r.jsx("h3",{className:"text-sm font-medium",children:"浏览器通知"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"当 Claude 完成任务时,浏览器将自动弹出通知。首次打开 Dashboard 时会请求通知权限。"})]}),r.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium",children:"Webhook 通知"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Claude 完成任务时向指定 URL 发送 POST 请求(JSON: event, projectId, projectName, timestamp)"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ue,{className:"text-xs",children:"Webhook URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(je,{placeholder:"https://hooks.slack.com/...",value:$,onChange:C=>I(C.target.value),className:"font-mono text-xs"}),r.jsx(ee,{size:"sm",onClick:()=>void xe(),disabled:M,children:M?"保存中…":"保存"})]}),_.webhookEnabled&&_.webhookUrl&&r.jsxs("p",{className:"text-xs text-green-500",children:["已启用 → ",_.webhookUrl]})]})]})]})}),r.jsx(Ie,{value:"pomodoro",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium",children:"番茄钟时间设置"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"修改后重新启动番茄钟生效"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-6 max-w-xs",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ue,{className:"text-xs",children:"工作时长(分钟)"}),r.jsx(je,{type:"number",min:1,max:120,value:j.workMinutes,onChange:C=>ne("workMinutes",C.target.value),className:"w-full"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ue,{className:"text-xs",children:"休息时长(分钟)"}),r.jsx(je,{type:"number",min:1,max:60,value:j.breakMinutes,onChange:C=>ne("breakMinutes",C.target.value),className:"w-full"})]})]}),D&&r.jsxs(ee,{size:"sm",onClick:be,children:[r.jsx(Wt,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})]}),r.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[r.jsx("h3",{className:"text-sm font-medium",children:"使用说明"}),r.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[r.jsxs("li",{children:["在项目页面 Header 点击 ",r.jsx(Ht,{className:"h-3 w-3 inline-block mx-0.5"})," 图标启动番茄钟"]}),r.jsx("li",{children:"倒计时以大字体悬浮在屏幕上,不影响操作"}),r.jsx("li",{children:"工作阶段结束后自动切换为休息,并弹出通知"}),r.jsx("li",{children:"休息结束后自动切换回工作阶段"}),r.jsx("li",{children:"再次点击图标可停止并重置"})]})]})]})})]})]})})}export{Ra as SettingsPage};
@@ -1 +1 @@
1
- import{ad as f,r,aR as g,j as e,e as a}from"./index-Ce-Kt5WI.js";import{U as j}from"./user-I7Phge1b.js";import{B as p}from"./bot-BoFP5zD_.js";function v(){const{token:n}=f(),[o,c]=r.useState(!0),[i,l]=r.useState(null),[t,d]=r.useState(null),[m,x]=r.useState("");if(r.useEffect(()=>{n&&(c(!0),g(n).then(s=>{document.title=s.projectName+" — cc-web",d(s.session),x(s.projectName)}).catch(s=>l(s.message||"链接无效或已过期")).finally(()=>c(!1)))},[n]),o)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx("span",{className:"text-muted-foreground text-sm",children:"加载中…"})});if(i||!t)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-foreground font-medium",children:"无法加载会话"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:i??"链接无效或已过期"})]})});const u=new Date(t.startedAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return e.jsx("div",{className:"min-h-screen bg-background text-foreground",children:e.jsxs("div",{className:"max-w-2xl mx-auto px-4 py-8",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:m}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-sm text-muted-foreground",children:[e.jsx("span",{children:u}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[t.messageCount," 条消息"]})]})]}),e.jsxs("div",{className:"space-y-4",children:[t.messages.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"本次会话暂无记录"}),t.messages.map((s,h)=>e.jsxs("div",{className:a("flex gap-2.5",s.role==="user"?"flex-row-reverse":"flex-row"),children:[e.jsx("div",{className:a("flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center mt-0.5",s.role==="user"?"bg-blue-500/10":"bg-muted"),children:s.role==="user"?e.jsx(j,{className:"h-3.5 w-3.5 text-blue-400"}):e.jsx(p,{className:"h-3.5 w-3.5 text-muted-foreground"})}),e.jsx("div",{className:a("max-w-[85%] text-sm rounded-lg px-3 py-2 whitespace-pre-wrap break-words",s.role==="user"?"bg-blue-500/10 text-blue-400":"bg-muted text-foreground"),children:s.content})]},h))]})]})})}export{v as ShareViewPage};
1
+ import{ae as f,r,aU as g,j as e,e as a}from"./index-DMpawgXi.js";import{U as j}from"./user-D0tlvr_E.js";import{B as p}from"./bot-f6j4fC_h.js";function v(){const{token:n}=f(),[o,c]=r.useState(!0),[i,l]=r.useState(null),[t,d]=r.useState(null),[m,x]=r.useState("");if(r.useEffect(()=>{n&&(c(!0),g(n).then(s=>{document.title=s.projectName+" — cc-web",d(s.session),x(s.projectName)}).catch(s=>l(s.message||"链接无效或已过期")).finally(()=>c(!1)))},[n]),o)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx("span",{className:"text-muted-foreground text-sm",children:"加载中…"})});if(i||!t)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-foreground font-medium",children:"无法加载会话"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:i??"链接无效或已过期"})]})});const u=new Date(t.startedAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return e.jsx("div",{className:"min-h-screen bg-background text-foreground",children:e.jsxs("div",{className:"max-w-2xl mx-auto px-4 py-8",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:m}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-sm text-muted-foreground",children:[e.jsx("span",{children:u}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[t.messageCount," 条消息"]})]})]}),e.jsxs("div",{className:"space-y-4",children:[t.messages.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"本次会话暂无记录"}),t.messages.map((s,h)=>e.jsxs("div",{className:a("flex gap-2.5",s.role==="user"?"flex-row-reverse":"flex-row"),children:[e.jsx("div",{className:a("flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center mt-0.5",s.role==="user"?"bg-blue-500/10":"bg-muted"),children:s.role==="user"?e.jsx(j,{className:"h-3.5 w-3.5 text-blue-400"}):e.jsx(p,{className:"h-3.5 w-3.5 text-muted-foreground"})}),e.jsx("div",{className:a("max-w-[85%] text-sm rounded-lg px-3 py-2 whitespace-pre-wrap break-words",s.role==="user"?"bg-blue-500/10 text-blue-400":"bg-muted text-foreground"),children:s.content})]},h))]})]})})}export{v as ShareViewPage};
@@ -1,6 +1,6 @@
1
- import{c as k,a3 as P,r,aP as z,j as e,B as S,a4 as U,a9 as B,I as F,e as g,o as p,H as O,A as q,aQ as G,t as Q}from"./index-Ce-Kt5WI.js";import{U as R}from"./user-I7Phge1b.js";import{D as _}from"./download-D0XeiD4U.js";import{C as Z}from"./chevron-down-BZ0Z28_W.js";/**
1
+ import{c as k,a3 as z,r,aS as P,j as e,B as S,a4 as U,aa as B,I as F,e as g,o as p,H as O,A as q,aT as G,t as R}from"./index-DMpawgXi.js";import{U as Z}from"./user-D0tlvr_E.js";import{D as _}from"./download-Hey--B5N.js";import{C as $}from"./chevron-down-BvLcxBa7.js";/**
2
2
  * @license lucide-react v0.309.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const $=k("Tag",[["path",{d:"M12 2H2v10l9.29 9.29c.94.94 2.48.94 3.42 0l6.58-6.58c.94-.94.94-2.48 0-3.42L12 2Z",key:"14b2ls"}],["path",{d:"M7 7h.01",key:"7u93v4"}]]);function X(){const C=P(),[o,f]=r.useState([]),[x,I]=r.useState(!0),[i,E]=r.useState(null),[c,L]=r.useState(""),[d,h]=r.useState(null),[D,H]=r.useState(null),[j,w]=r.useState(null),[N,M]=r.useState(new Set);r.useEffect(()=>{z().then(f).catch(t=>E(t instanceof Error?t.message:"Failed to load SkillHub")).finally(()=>I(!1))},[]);const b=r.useMemo(()=>{const t=new Set;return o.forEach(a=>{var s;return(s=a.tags)==null?void 0:s.forEach(n=>t.add(n))}),Array.from(t).sort()},[o]),A=r.useMemo(()=>o.some(t=>!t.tags||t.tags.length===0),[o]),v=r.useMemo(()=>{let t=o;if(d==="__untagged__"?t=t.filter(a=>!a.tags||a.tags.length===0):d&&(t=t.filter(a=>{var s;return(s=a.tags)==null?void 0:s.includes(d)})),c.trim()){const a=c.toLowerCase();t=t.filter(s=>{var n;return s.label.toLowerCase().includes(a)||s.description.toLowerCase().includes(a)||s.command.toLowerCase().includes(a)||s.author.toLowerCase().includes(a)||((n=s.tags)==null?void 0:n.some(m=>m.toLowerCase().includes(a)))})}return t},[o,c,d]),T=async(t,a)=>{if(a.stopPropagation(),!(j||N.has(t.id))){w(t.id);try{await G(t.id),M(s=>new Set(s).add(t.id)),f(s=>s.map(n=>n.id===t.id?{...n,downloads:(n.downloads||0)+1}:n))}catch(s){Q.error(s instanceof Error?s.message:"Download failed")}finally{w(null)}}};return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 h-14 flex items-center gap-4",children:[e.jsxs(S,{variant:"ghost",size:"sm",onClick:()=>C("/"),children:[e.jsx(U,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsx("h1",{className:"font-semibold text-lg",children:"SkillHub"}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"relative w-64",children:[e.jsx(B,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(F,{placeholder:"搜索命令...",value:c,onChange:t=>L(t.target.value),className:"pl-8 h-9"})]})]})}),e.jsxs("main",{className:"max-w-4xl mx-auto px-4 py-6",children:[b.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[e.jsx("button",{className:g("px-3 py-1 rounded-full text-xs font-medium transition-colors",d===null?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>h(null),children:"全部"}),b.map(t=>e.jsx("button",{className:g("px-3 py-1 rounded-full text-xs font-medium transition-colors",d===t?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>h(d===t?null:t),children:t},t)),A&&e.jsx("button",{className:g("px-3 py-1 rounded-full text-xs font-medium transition-colors",d==="__untagged__"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>h(d==="__untagged__"?null:"__untagged__"),children:"无标签"})]}),x&&e.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),i&&e.jsx("div",{className:"text-center text-destructive py-20",children:i}),!x&&!i&&o.length===0&&e.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[e.jsx("p",{className:"text-lg mb-2",children:"SkillHub 还没有命令"}),e.jsx("p",{className:"text-sm",children:"在快捷命令面板中点击分享按钮来提交第一个命令吧!"})]}),!x&&!i&&o.length>0&&v.length===0&&e.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的命令"}),e.jsx("div",{className:"space-y-3",children:v.map((t,a)=>{var y;const s=D===t.id,n=N.has(t.id),m=j===t.id,u=t.parentId?o.find(l=>l.id===t.parentId):void 0;return e.jsxs(p.div,{layout:!0,initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:a*.03,ease:"easeOut"},className:"rounded-lg border bg-card p-4 cursor-pointer hover:border-muted-foreground/30 transition-colors",onClick:()=>H(s?null:t.id),children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-medium text-sm truncate",children:t.label}),(y=t.tags)==null?void 0:y.map(l=>e.jsxs("span",{className:"inline-flex items-center gap-0.5 px-2 py-0.5 rounded-full text-xs bg-muted text-muted-foreground",children:[e.jsx($,{className:"h-2.5 w-2.5"}),l]},l))]}),u&&e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[e.jsx(O,{className:"h-3 w-3 text-muted-foreground"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["继承: ",u.label]})]}),t.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:t.description}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(R,{className:"h-3 w-3"}),t.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(_,{className:"h-3 w-3"}),t.downloads||0]}),e.jsx("span",{children:t.createdAt})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs(S,{size:"sm",variant:n?"outline":"default",disabled:m||n,onClick:l=>T(t,l),title:u?`将同时下载继承的「${u.label}」`:void 0,children:[e.jsx(_,{className:"h-3.5 w-3.5 mr-1"}),n?"已下载":m?"下载中...":"下载"]}),e.jsx(p.span,{animate:{rotate:s?180:0},transition:{duration:.2},children:e.jsx(Z,{className:"h-4 w-4 text-muted-foreground"})})]})]}),e.jsx(q,{children:s&&e.jsx(p.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:e.jsx("div",{className:"mt-3 pt-3 border-t",children:e.jsx("pre",{className:"text-xs font-mono bg-muted rounded p-3 whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:t.command})})})})]},t.id)})})]})]})}export{X as SkillHubPage};
6
+ */const J=k("Tag",[["path",{d:"M12 2H2v10l9.29 9.29c.94.94 2.48.94 3.42 0l6.58-6.58c.94-.94.94-2.48 0-3.42L12 2Z",key:"14b2ls"}],["path",{d:"M7 7h.01",key:"7u93v4"}]]);function X(){const C=z(),[o,f]=r.useState([]),[x,I]=r.useState(!0),[i,E]=r.useState(null),[c,L]=r.useState(""),[d,h]=r.useState(null),[D,H]=r.useState(null),[j,w]=r.useState(null),[N,M]=r.useState(new Set);r.useEffect(()=>{P().then(f).catch(t=>E(t instanceof Error?t.message:"Failed to load SkillHub")).finally(()=>I(!1))},[]);const b=r.useMemo(()=>{const t=new Set;return o.forEach(a=>{var s;return(s=a.tags)==null?void 0:s.forEach(n=>t.add(n))}),Array.from(t).sort()},[o]),T=r.useMemo(()=>o.some(t=>!t.tags||t.tags.length===0),[o]),v=r.useMemo(()=>{let t=o;if(d==="__untagged__"?t=t.filter(a=>!a.tags||a.tags.length===0):d&&(t=t.filter(a=>{var s;return(s=a.tags)==null?void 0:s.includes(d)})),c.trim()){const a=c.toLowerCase();t=t.filter(s=>{var n;return s.label.toLowerCase().includes(a)||s.description.toLowerCase().includes(a)||s.command.toLowerCase().includes(a)||s.author.toLowerCase().includes(a)||((n=s.tags)==null?void 0:n.some(m=>m.toLowerCase().includes(a)))})}return t},[o,c,d]),A=async(t,a)=>{if(a.stopPropagation(),!(j||N.has(t.id))){w(t.id);try{await G(t.id),M(s=>new Set(s).add(t.id)),f(s=>s.map(n=>n.id===t.id?{...n,downloads:(n.downloads||0)+1}:n))}catch(s){R.error(s instanceof Error?s.message:"Download failed")}finally{w(null)}}};return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 h-14 flex items-center gap-4",children:[e.jsxs(S,{variant:"ghost",size:"sm",onClick:()=>C("/"),children:[e.jsx(U,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsx("h1",{className:"font-semibold text-lg",children:"SkillHub"}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"relative w-64",children:[e.jsx(B,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(F,{placeholder:"搜索命令...",value:c,onChange:t=>L(t.target.value),className:"pl-8 h-9"})]})]})}),e.jsxs("main",{className:"max-w-4xl mx-auto px-4 py-6",children:[b.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[e.jsx("button",{className:g("px-3 py-1 rounded-full text-xs font-medium transition-colors",d===null?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>h(null),children:"全部"}),b.map(t=>e.jsx("button",{className:g("px-3 py-1 rounded-full text-xs font-medium transition-colors",d===t?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>h(d===t?null:t),children:t},t)),T&&e.jsx("button",{className:g("px-3 py-1 rounded-full text-xs font-medium transition-colors",d==="__untagged__"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>h(d==="__untagged__"?null:"__untagged__"),children:"无标签"})]}),x&&e.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),i&&e.jsx("div",{className:"text-center text-destructive py-20",children:i}),!x&&!i&&o.length===0&&e.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[e.jsx("p",{className:"text-lg mb-2",children:"SkillHub 还没有命令"}),e.jsx("p",{className:"text-sm",children:"在快捷命令面板中点击分享按钮来提交第一个命令吧!"})]}),!x&&!i&&o.length>0&&v.length===0&&e.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的命令"}),e.jsx("div",{className:"space-y-3",children:v.map((t,a)=>{var y;const s=D===t.id,n=N.has(t.id),m=j===t.id,u=t.parentId?o.find(l=>l.id===t.parentId):void 0;return e.jsxs(p.div,{layout:!0,initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:a*.03,ease:"easeOut"},className:"rounded-lg border bg-card p-4 cursor-pointer hover:border-muted-foreground/30 transition-colors",onClick:()=>H(s?null:t.id),children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-medium text-sm truncate",children:t.label}),(y=t.tags)==null?void 0:y.map(l=>e.jsxs("span",{className:"inline-flex items-center gap-0.5 px-2 py-0.5 rounded-full text-xs bg-muted text-muted-foreground",children:[e.jsx(J,{className:"h-2.5 w-2.5"}),l]},l))]}),u&&e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[e.jsx(O,{className:"h-3 w-3 text-muted-foreground"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["继承: ",u.label]})]}),t.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:t.description}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Z,{className:"h-3 w-3"}),t.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(_,{className:"h-3 w-3"}),t.downloads||0]}),e.jsx("span",{children:t.createdAt})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs(S,{size:"sm",variant:n?"outline":"default",disabled:m||n,onClick:l=>A(t,l),title:u?`将同时下载继承的「${u.label}」`:void 0,children:[e.jsx(_,{className:"h-3.5 w-3.5 mr-1"}),n?"已下载":m?"下载中...":"下载"]}),e.jsx(p.span,{animate:{rotate:s?180:0},transition:{duration:.2},children:e.jsx($,{className:"h-4 w-4 text-muted-foreground"})})]})]}),e.jsx(q,{children:s&&e.jsx(p.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:e.jsx("div",{className:"mt-3 pt-3 border-t",children:e.jsx("pre",{className:"text-xs font-mono bg-muted rounded p-3 whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:t.command})})})})]},t.id)})})]})]})}export{X as SkillHubPage};
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-Ce-Kt5WI.js";/**
1
+ import{c as t}from"./index-DMpawgXi.js";/**
2
2
  * @license lucide-react v0.309.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-Ce-Kt5WI.js";/**
1
+ import{c as o}from"./index-DMpawgXi.js";/**
2
2
  * @license lucide-react v0.309.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-Ce-Kt5WI.js";/**
1
+ import{c as o}from"./index-DMpawgXi.js";/**
2
2
  * @license lucide-react v0.309.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.