@tom2012/cc-web 1.5.80 → 1.5.82

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.
Files changed (33) hide show
  1. package/README.md +1 -1
  2. package/backend/dist/adapters/opencode-adapter.d.ts +1 -1
  3. package/backend/dist/adapters/opencode-adapter.d.ts.map +1 -1
  4. package/backend/dist/adapters/opencode-adapter.js +4 -3
  5. package/backend/dist/adapters/opencode-adapter.js.map +1 -1
  6. package/frontend/dist/assets/GraphPreview-DeUOTqGU.js +8 -0
  7. package/frontend/dist/assets/OfficePreview-CGE86imK.js +2 -0
  8. package/frontend/dist/assets/ProjectPage-LZuxFngN.js +26 -0
  9. package/frontend/dist/assets/SettingsPage-DcE9vyAO.js +13 -0
  10. package/frontend/dist/assets/ShareViewPage-RQfo-sAE.js +1 -0
  11. package/frontend/dist/assets/SkillHubPage-BuQCOzTY.js +13 -0
  12. package/frontend/dist/assets/{bot-cQ6ylHLl.js → bot-BTPL5fMo.js} +3 -2
  13. package/frontend/dist/assets/{chevron-down-DfucCRyS.js → chevron-down-B5QB8OvI.js} +2 -1
  14. package/frontend/dist/assets/{download-CpyCetNu.js → download-CRCiN6lp.js} +3 -2
  15. package/frontend/dist/assets/index-Cq7E361N.js +1 -0
  16. package/frontend/dist/assets/index-DxdTRVVE.js +75 -0
  17. package/frontend/dist/assets/jszip.min-86jXs0Jp.js +12 -0
  18. package/frontend/dist/assets/save-VwSCjXJc.js +13 -0
  19. package/frontend/dist/assets/{user-VhIL8flc.js → user-B-E27M2h.js} +3 -2
  20. package/frontend/dist/assets/xlsx-DfDjAMCE.js +3 -0
  21. package/frontend/dist/index.html +1 -1
  22. package/package.json +1 -1
  23. package/frontend/dist/assets/GraphPreview-JMSXCAY0.js +0 -22
  24. package/frontend/dist/assets/OfficePreview-VMbN_YAd.js +0 -13
  25. package/frontend/dist/assets/ProjectPage-8eZB6Sqp.js +0 -197
  26. package/frontend/dist/assets/SettingsPage-B6TD4_qR.js +0 -41
  27. package/frontend/dist/assets/ShareViewPage-DXNrRo14.js +0 -1
  28. package/frontend/dist/assets/SkillHubPage-BrsQhX4b.js +0 -11
  29. package/frontend/dist/assets/index-BbNO7GpK.js +0 -295
  30. package/frontend/dist/assets/index-T8hQluRV.js +0 -220
  31. package/frontend/dist/assets/jszip.min-BmFEhwm7.js +0 -12
  32. package/frontend/dist/assets/save-B8LaQpAB.js +0 -16
  33. package/frontend/dist/assets/xlsx-D_0l8YDs.js +0 -105
@@ -1,41 +0,0 @@
1
- import{c as we,r as l,ao as ie,ap as Y,aq as He,j as s,ar as U,as as z,at as De,e as ee,au as dn,R as je,av as We,aw as At,ax as Jo,ay as Tt,az as es,aA as ts,aB as ns,aC as os,aD as ss,aE as rs,v as is,aF as as,L as cs,N as ls,O as ds,Q as us,T as fs,B as oe,U as pe,I as Pe,V as ps,aG as Vt,aH as xt,aI as ms,aJ as hs,aK as xs,a6 as un,aL as gs,m as fn,aM as vs,a4 as ys,aN as ws,i as bs,S as ut,aO as Ss,a5 as Cs,aP as Wt,x as Ns,A as js,p as Rs,X as As,s as zt,t as Ge,aQ as Ts,aR as Ps,aS as Es,aT as Is,aU as Os,aV as ks,aW as Ut,aX as _s}from"./index-BbNO7GpK.js";import{C as pn}from"./chevron-down-DfucCRyS.js";import{a as Ds,C as Ms,S as Kt}from"./save-B8LaQpAB.js";/**
2
- * @license lucide-react v0.309.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Ls=we("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);/**
7
- * @license lucide-react v0.309.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Fs=we("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
12
- * @license lucide-react v0.309.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const Bs=we("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
17
- * @license lucide-react v0.309.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const $s=we("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
22
- * @license lucide-react v0.309.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const gt=we("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
27
- * @license lucide-react v0.309.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const Gt=we("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/**
32
- * @license lucide-react v0.309.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */const Hs=we("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
37
- * @license lucide-react v0.309.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */const Vs=we("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 mn(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 hn(e){const[t,n]=l.useState(void 0);return ie(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const a=r[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 tt="Switch",[Ws]=De(tt),[zs,Us]=Ws(tt),xn=l.forwardRef((e,t)=>{const{__scopeSwitch:n,name:o,checked:r,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:r,defaultProp:a??!1,onChange:u,caller:tt});return s.jsxs(zs,{scope:n,checked:b,disabled:c,children:[s.jsx(U.button,{type:"button",role:"switch","aria-checked":b,"aria-required":i,"data-state":wn(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&&s.jsx(yn,{control:v,bubbles:!m.current,name:o,value:d,checked:b,required:i,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});xn.displayName=tt;var gn="SwitchThumb",vn=l.forwardRef((e,t)=>{const{__scopeSwitch:n,...o}=e,r=Us(gn,n);return s.jsx(U.span,{"data-state":wn(r.checked),"data-disabled":r.disabled?"":void 0,...o,ref:t})});vn.displayName=gn;var Ks="SwitchBubbleInput",yn=l.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:o=!0,...r},a)=>{const i=l.useRef(null),c=Y(i,a),d=mn(n),u=hn(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]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...r,tabIndex:-1,ref:c,style:{...r.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});yn.displayName=Ks;function wn(e){return e?"checked":"unchecked"}var bn=xn,Gs=vn;const Sn=l.forwardRef(({className:e,...t},n)=>s.jsx(bn,{className:ee("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:s.jsx(Gs,{className:ee("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")})}));Sn.displayName=bn.displayName;function Yt(e){const t=Ys(e),n=l.forwardRef((o,r)=>{const{children:a,...i}=o,c=l.Children.toArray(a),d=c.find(qs);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 s.jsx(t,{...i,ref:r,children:l.isValidElement(u)?l.cloneElement(u,void 0,f):null})}return s.jsx(t,{...i,ref:r,children:a})});return n.displayName=`${e}.Slot`,n}function Ys(e){const t=l.forwardRef((n,o)=>{const{children:r,...a}=n;if(l.isValidElement(r)){const i=Qs(r),c=Zs(a,r.props);return r.type!==l.Fragment&&(c.ref=o?dn(o,i):i),l.cloneElement(r,c)}return l.Children.count(r)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Xs=Symbol("radix.slottable");function qs(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Xs}function Zs(e,t){const n={...t};for(const o in t){const r=e[o],a=t[o];/^on[A-Z]/.test(o)?r&&a?n[o]=(...c)=>{const d=a(...c);return r(...c),d}:r&&(n[o]=r):o==="style"?n[o]={...r,...a}:o==="className"&&(n[o]=[r,a].filter(Boolean).join(" "))}return{...e,...n}}function Qs(e){var o,r;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=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Cn(e){const t=e+"CollectionProvider",[n,o]=De(t),[r,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:x,children:b}=m,y=je.useRef(null),g=je.useRef(new Map).current;return s.jsx(r,{scope:x,itemMap:g,collectionRef:y,children:b})};i.displayName=t;const c=e+"CollectionSlot",d=Yt(c),u=je.forwardRef((m,x)=>{const{scope:b,children:y}=m,g=a(c,b),S=Y(x,g.collectionRef);return s.jsx(d,{ref:S,children:y})});u.displayName=c;const f=e+"CollectionItemSlot",p="data-radix-collection-item",v=Yt(f),h=je.forwardRef((m,x)=>{const{scope:b,children:y,...g}=m,S=je.useRef(null),N=Y(x,S),R=a(f,b);return je.useEffect(()=>(R.itemMap.set(S,{ref:S,...g}),()=>void R.itemMap.delete(S))),s.jsx(v,{[p]:"",ref:N,children:y})});h.displayName=f;function w(m){const x=a(e+"CollectionConsumer",m);return je.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 Js=l.createContext(void 0);function Pt(e){const t=l.useContext(Js);return e||t||"ltr"}var ft="rovingFocusGroup.onEntryFocus",er={bubbles:!1,cancelable:!0},ze="RovingFocusGroup",[vt,Nn,tr]=Cn(ze),[nr,jn]=De(ze,[tr]),[or,sr]=nr(ze),Rn=l.forwardRef((e,t)=>s.jsx(vt.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(vt.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(rr,{...e,ref:t})})}));Rn.displayName=ze;var rr=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!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=Pt(a),[m,x]=He({prop:i,defaultProp:c??null,onChange:d,caller:ze}),[b,y]=l.useState(!1),g=At(u),S=Nn(n),N=l.useRef(!1),[R,A]=l.useState(0);return l.useEffect(()=>{const T=v.current;if(T)return T.addEventListener(ft,g),()=>T.removeEventListener(ft,g)},[g]),s.jsx(or,{scope:n,orientation:o,dir:w,loop:r,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:s.jsx(U.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(ft,er);if(T.currentTarget.dispatchEvent(O),!O.defaultPrevented){const D=S().filter(I=>I.focusable),F=D.find(I=>I.active),_=D.find(I=>I.id===m),$=[F,_,...D].filter(Boolean).map(I=>I.ref.current);Pn($,f)}}N.current=!1}),onBlur:z(e.onBlur,()=>y(!1))})})}),An="RovingFocusGroupItem",Tn=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:a,children:i,...c}=e,d=We(),u=a||d,f=sr(An,n),p=f.currentTabStopId===u,v=Nn(n),{onFocusableItemAdd:h,onFocusableItemRemove:w,currentTabStopId:m}=f;return l.useEffect(()=>{if(o)return h(),()=>w()},[o,h,w]),s.jsx(vt.ItemSlot,{scope:n,id:u,focusable:o,active:r,children:s.jsx(U.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=cr(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?lr(g,S+1):g.slice(S+1)}setTimeout(()=>Pn(g))}}),children:typeof i=="function"?i({isCurrentTabStop:p,hasTabStop:m!=null}):i})})});Tn.displayName=An;var ir={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ar(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function cr(e,t,n){const o=ar(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return ir[o]}function Pn(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function lr(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var dr=Rn,ur=Tn,nt="Tabs",[fr]=De(nt,[jn]),En=jn(),[pr,Et]=fr(nt),In=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:r,defaultValue:a,orientation:i="horizontal",dir:c,activationMode:d="automatic",...u}=e,f=Pt(c),[p,v]=He({prop:o,onChange:r,defaultProp:a??"",caller:nt});return s.jsx(pr,{scope:n,baseId:We(),value:p,onValueChange:v,orientation:i,dir:f,activationMode:d,children:s.jsx(U.div,{dir:f,"data-orientation":i,...u,ref:t})})});In.displayName=nt;var On="TabsList",kn=l.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...r}=e,a=Et(On,n),i=En(n);return s.jsx(dr,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:o,children:s.jsx(U.div,{role:"tablist","aria-orientation":a.orientation,...r,ref:t})})});kn.displayName=On;var _n="TabsTrigger",Dn=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:r=!1,...a}=e,i=Et(_n,n),c=En(n),d=Fn(i.baseId,o),u=Bn(i.baseId,o),f=o===i.value;return s.jsx(ur,{asChild:!0,...c,focusable:!r,active:f,children:s.jsx(U.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:d,...a,ref:t,onMouseDown:z(e.onMouseDown,p=>{!r&&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&&!r&&p&&i.onValueChange(o)})})})});Dn.displayName=_n;var Mn="TabsContent",Ln=l.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:r,children:a,...i}=e,c=Et(Mn,n),d=Fn(c.baseId,o),u=Bn(c.baseId,o),f=o===c.value,p=l.useRef(f);return l.useEffect(()=>{const v=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(v)},[]),s.jsx(Jo,{present:r||f,children:({present:v})=>s.jsx(U.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})})});Ln.displayName=Mn;function Fn(e,t){return`${e}-trigger-${t}`}function Bn(e,t){return`${e}-content-${t}`}var mr=In,$n=kn,Hn=Dn,Vn=Ln;const hr=mr,Wn=l.forwardRef(({className:e,...t},n)=>s.jsx($n,{ref:n,className:ee("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Wn.displayName=$n.displayName;const Ae=l.forwardRef(({className:e,...t},n)=>s.jsx(Hn,{ref:n,className:ee("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}));Ae.displayName=Hn.displayName;const Te=l.forwardRef(({className:e,...t},n)=>s.jsx(Vn,{ref:n,className:ee("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Te.displayName=Vn.displayName;function Xt(e,[t,n]){return Math.min(n,Math.max(t,e))}const xr=["top","right","bottom","left"],ve=Math.min,Q=Math.max,qe=Math.round,Ye=Math.floor,ue=e=>({x:e,y:e}),gr={left:"right",right:"left",bottom:"top",top:"bottom"};function yt(e,t,n){return Q(e,ve(t,n))}function me(e,t){return typeof e=="function"?e(t):e}function he(e){return e.split("-")[0]}function Me(e){return e.split("-")[1]}function It(e){return e==="x"?"y":"x"}function Ot(e){return e==="y"?"height":"width"}function de(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function kt(e){return It(de(e))}function vr(e,t,n){n===void 0&&(n=!1);const o=Me(e),r=kt(e),a=Ot(r);let i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=Ze(i)),[i,Ze(i)]}function yr(e){const t=Ze(e);return[wt(e),t,wt(t)]}function wt(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const qt=["left","right"],Zt=["right","left"],wr=["top","bottom"],br=["bottom","top"];function Sr(e,t,n){switch(e){case"top":case"bottom":return n?t?Zt:qt:t?qt:Zt;case"left":case"right":return t?wr:br;default:return[]}}function Cr(e,t,n,o){const r=Me(e);let a=Sr(he(e),n==="start",o);return r&&(a=a.map(i=>i+"-"+r),t&&(a=a.concat(a.map(wt)))),a}function Ze(e){const t=he(e);return gr[t]+e.slice(t.length)}function Nr(e){return{top:0,right:0,bottom:0,left:0,...e}}function zn(e){return typeof e!="number"?Nr(e):{top:e,right:e,bottom:e,left:e}}function Qe(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Qt(e,t,n){let{reference:o,floating:r}=e;const a=de(t),i=kt(t),c=Ot(i),d=he(t),u=a==="y",f=o.x+o.width/2-r.width/2,p=o.y+o.height/2-r.height/2,v=o[c]/2-r[c]/2;let h;switch(d){case"top":h={x:f,y:o.y-r.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-r.width,y:p};break;default:h={x:o.x,y:o.y}}switch(Me(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 jr(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:a,rects:i,elements:c,strategy:d}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:v=!1,padding:h=0}=me(t,e),w=zn(h),x=c[v?p==="floating"?"reference":"floating":p],b=Qe(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:r,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=Qe(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 Rr=50,Ar=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:a=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:jr},d=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:p}=Qt(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:r,middlewareData:w,rects:u,platform:c,elements:{reference:e,floating:t}});f=g??f,p=S??p,w[b]={...w[b],...N},R&&h<Rr&&(h++,typeof R=="object"&&(R.placement&&(v=R.placement),R.rects&&(u=R.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):R.rects),{x:f,y:p}=Qt(u,v,d)),m=-1)}return{x:f,y:p,placement:v,strategy:r,middlewareData:w}},Tr=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:a,platform:i,elements:c,middlewareData:d}=t,{element:u,padding:f=0}=me(e,t)||{};if(u==null)return{};const p=zn(f),v={x:n,y:o},h=kt(r),w=Ot(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=ve(p[b],j),D=ve(p[y],j),F=O,_=A-m[w]-D,k=A/2-m[w]/2+T,$=yt(F,k,_),I=!d.arrow&&Me(r)!=null&&k!==$&&a.reference[w]/2-(k<F?O:D)-m[w]/2<0,M=I?k<F?k-F:k-_:0;return{[h]:v[h]+M,data:{[h]:$,centerOffset:k-$-M,...I&&{alignmentOffset:M}},reset:I}}}),Pr=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,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}=me(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const b=he(r),y=de(c),g=he(c)===c,S=await(d.isRTL==null?void 0:d.isRTL(u.floating)),N=v||(g||!m?[Ze(c)]:yr(c)),R=w!=="none";!v&&R&&N.push(...Cr(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=vr(r,i,S);j.push(T[k[0]],T[k[1]])}if(O=[...O,{placement:r,overflows:j}],!j.every(k=>k<=0)){var D,F;const k=(((D=a.flip)==null?void 0:D.index)||0)+1,$=A[k];if($&&(!(p==="alignment"?y!==de($):!1)||O.every(P=>de(P.placement)===y?P.overflows[0]>0:!0)))return{data:{index:k,overflows:O},reset:{placement:$}};let I=(F=O.filter(M=>M.overflows[0]<=0).sort((M,P)=>M.overflows[1]-P.overflows[1])[0])==null?void 0:F.placement;if(!I)switch(h){case"bestFit":{var _;const M=(_=O.filter(P=>{if(R){const H=de(P.placement);return H===y||H==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(H=>H>0).reduce((H,X)=>H+X,0)]).sort((P,H)=>P[1]-H[1])[0])==null?void 0:_[0];M&&(I=M);break}case"initialPlacement":I=c;break}if(r!==I)return{reset:{placement:I}}}return{}}}};function Jt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function en(e){return xr.some(t=>e[t]>=0)}const Er=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...a}=me(e,t);switch(r){case"referenceHidden":{const i=await o.detectOverflow(t,{...a,elementContext:"reference"}),c=Jt(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:en(c)}}}case"escaped":{const i=await o.detectOverflow(t,{...a,altBoundary:!0}),c=Jt(i,n.floating);return{data:{escapedOffsets:c,escaped:en(c)}}}default:return{}}}}},Un=new Set(["left","top"]);async function Ir(e,t){const{placement:n,platform:o,elements:r}=e,a=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=he(n),c=Me(n),d=de(n)==="y",u=Un.has(i)?-1:1,f=a&&d?-1:1,p=me(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 Or=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:a,placement:i,middlewareData:c}=t,d=await Ir(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+d.x,y:a+d.y,data:{...d,placement:i}}}}},kr=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,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}=me(e,t),f={x:n,y:o},p=await a.detectOverflow(t,u),v=de(he(r)),h=It(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=yt(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=yt(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}}}}}},_r=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:a,middlewareData:i}=t,{offset:c=0,mainAxis:d=!0,crossAxis:u=!0}=me(e,t),f={x:n,y:o},p=de(r),v=It(p);let h=f[v],w=f[p];const m=me(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=Un.has(he(r)),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}}}},Dr=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:a,platform:i,elements:c}=t,{apply:d=()=>{},...u}=me(e,t),f=await i.detectOverflow(t,u),p=he(r),v=Me(r),h=de(r)==="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=ve(m-f[x],y),N=ve(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=Q(f.left,0),D=Q(f.right,0),F=Q(f.top,0),_=Q(f.bottom,0);h?T=w-2*(O!==0||D!==0?O+D:Q(f.left,f.right)):A=m-2*(F!==0||_!==0?F+_:Q(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 ot(){return typeof window<"u"}function Le(e){return Kn(e)?(e.nodeName||"").toLowerCase():"#document"}function J(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function fe(e){var t;return(t=(Kn(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Kn(e){return ot()?e instanceof Node||e instanceof J(e).Node:!1}function ae(e){return ot()?e instanceof Element||e instanceof J(e).Element:!1}function xe(e){return ot()?e instanceof HTMLElement||e instanceof J(e).HTMLElement:!1}function tn(e){return!ot()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof J(e).ShadowRoot}function Ue(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=ce(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function Mr(e){return/^(table|td|th)$/.test(Le(e))}function st(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Lr=/transform|translate|scale|rotate|perspective|filter/,Fr=/paint|layout|strict|content/,Re=e=>!!e&&e!=="none";let pt;function _t(e){const t=ae(e)?ce(e):e;return Re(t.transform)||Re(t.translate)||Re(t.scale)||Re(t.rotate)||Re(t.perspective)||!Dt()&&(Re(t.backdropFilter)||Re(t.filter))||Lr.test(t.willChange||"")||Fr.test(t.contain||"")}function Br(e){let t=ye(e);for(;xe(t)&&!_e(t);){if(_t(t))return t;if(st(t))return null;t=ye(t)}return null}function Dt(){return pt==null&&(pt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),pt}function _e(e){return/^(html|body|#document)$/.test(Le(e))}function ce(e){return J(e).getComputedStyle(e)}function rt(e){return ae(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ye(e){if(Le(e)==="html")return e;const t=e.assignedSlot||e.parentNode||tn(e)&&e.host||fe(e);return tn(t)?t.host:t}function Gn(e){const t=ye(e);return _e(t)?e.ownerDocument?e.ownerDocument.body:e.body:xe(t)&&Ue(t)?t:Gn(t)}function Ve(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Gn(e),a=r===((o=e.ownerDocument)==null?void 0:o.body),i=J(r);if(a){const c=bt(i);return t.concat(i,i.visualViewport||[],Ue(r)?r:[],c&&n?Ve(c):[])}else return t.concat(r,Ve(r,[],n))}function bt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yn(e){const t=ce(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=xe(e),a=r?e.offsetWidth:n,i=r?e.offsetHeight:o,c=qe(n)!==a||qe(o)!==i;return c&&(n=a,o=i),{width:n,height:o,$:c}}function Mt(e){return ae(e)?e:e.contextElement}function ke(e){const t=Mt(e);if(!xe(t))return ue(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:a}=Yn(t);let i=(a?qe(n.width):n.width)/o,c=(a?qe(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const $r=ue(0);function Xn(e){const t=J(e);return!Dt()||!t.visualViewport?$r:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Hr(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==J(e)?!1:t}function Ee(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),a=Mt(e);let i=ue(1);t&&(o?ae(o)&&(i=ke(o)):i=ke(e));const c=Hr(a,n,o)?Xn(a):ue(0);let d=(r.left+c.x)/i.x,u=(r.top+c.y)/i.y,f=r.width/i.x,p=r.height/i.y;if(a){const v=J(a),h=o&&ae(o)?J(o):o;let w=v,m=bt(w);for(;m&&o&&h!==w;){const x=ke(m),b=m.getBoundingClientRect(),y=ce(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=bt(w)}}return Qe({width:f,height:p,x:d,y:u})}function it(e,t){const n=rt(e).scrollLeft;return t?t.left+n:Ee(fe(e)).left+n}function qn(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-it(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Vr(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const a=r==="fixed",i=fe(o),c=t?st(t.floating):!1;if(o===i||c&&a)return n;let d={scrollLeft:0,scrollTop:0},u=ue(1);const f=ue(0),p=xe(o);if((p||!p&&!a)&&((Le(o)!=="body"||Ue(i))&&(d=rt(o)),p)){const h=Ee(o);u=ke(o),f.x=h.x+o.clientLeft,f.y=h.y+o.clientTop}const v=i&&!p&&!a?qn(i,d):ue(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 Wr(e){return Array.from(e.getClientRects())}function zr(e){const t=fe(e),n=rt(e),o=e.ownerDocument.body,r=Q(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),a=Q(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+it(e);const c=-n.scrollTop;return ce(o).direction==="rtl"&&(i+=Q(t.clientWidth,o.clientWidth)-r),{width:r,height:a,x:i,y:c}}const nn=25;function Ur(e,t){const n=J(e),o=fe(e),r=n.visualViewport;let a=o.clientWidth,i=o.clientHeight,c=0,d=0;if(r){a=r.width,i=r.height;const f=Dt();(!f||f&&t==="fixed")&&(c=r.offsetLeft,d=r.offsetTop)}const u=it(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<=nn&&(a-=w)}else u<=nn&&(a+=u);return{width:a,height:i,x:c,y:d}}function Kr(e,t){const n=Ee(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,a=xe(e)?ke(e):ue(1),i=e.clientWidth*a.x,c=e.clientHeight*a.y,d=r*a.x,u=o*a.y;return{width:i,height:c,x:d,y:u}}function on(e,t,n){let o;if(t==="viewport")o=Ur(e,n);else if(t==="document")o=zr(fe(e));else if(ae(t))o=Kr(t,n);else{const r=Xn(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Qe(o)}function Zn(e,t){const n=ye(e);return n===t||!ae(n)||_e(n)?!1:ce(n).position==="fixed"||Zn(n,t)}function Gr(e,t){const n=t.get(e);if(n)return n;let o=Ve(e,[],!1).filter(c=>ae(c)&&Le(c)!=="body"),r=null;const a=ce(e).position==="fixed";let i=a?ye(e):e;for(;ae(i)&&!_e(i);){const c=ce(i),d=_t(i);!d&&c.position==="fixed"&&(r=null),(a?!d&&!r:!d&&c.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||Ue(i)&&!d&&Zn(e,i))?o=o.filter(f=>f!==i):r=c,i=ye(i)}return t.set(e,o),o}function Yr(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[...n==="clippingAncestors"?st(t)?[]:Gr(t,this._c):[].concat(n),o],c=on(t,i[0],r);let d=c.top,u=c.right,f=c.bottom,p=c.left;for(let v=1;v<i.length;v++){const h=on(t,i[v],r);d=Q(h.top,d),u=ve(h.right,u),f=ve(h.bottom,f),p=Q(h.left,p)}return{width:u-p,height:f-d,x:p,y:d}}function Xr(e){const{width:t,height:n}=Yn(e);return{width:t,height:n}}function qr(e,t,n){const o=xe(t),r=fe(t),a=n==="fixed",i=Ee(e,!0,a,t);let c={scrollLeft:0,scrollTop:0};const d=ue(0);function u(){d.x=it(r)}if(o||!o&&!a)if((Le(t)!=="body"||Ue(r))&&(c=rt(t)),o){const h=Ee(t,!0,a,t);d.x=h.x+t.clientLeft,d.y=h.y+t.clientTop}else r&&u();a&&!o&&r&&u();const f=r&&!o&&!a?qn(r,c):ue(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 mt(e){return ce(e).position==="static"}function sn(e,t){if(!xe(e)||ce(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return fe(e)===n&&(n=n.ownerDocument.body),n}function Qn(e,t){const n=J(e);if(st(e))return n;if(!xe(e)){let r=ye(e);for(;r&&!_e(r);){if(ae(r)&&!mt(r))return r;r=ye(r)}return n}let o=sn(e,t);for(;o&&Mr(o)&&mt(o);)o=sn(o,t);return o&&_e(o)&&mt(o)&&!_t(o)?n:o||Br(e)||n}const Zr=async function(e){const t=this.getOffsetParent||Qn,n=this.getDimensions,o=await n(e.floating);return{reference:qr(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Qr(e){return ce(e).direction==="rtl"}const Jr={convertOffsetParentRelativeRectToViewportRelativeRect:Vr,getDocumentElement:fe,getClippingRect:Yr,getOffsetParent:Qn,getElementRects:Zr,getClientRects:Wr,getDimensions:Xr,getScale:ke,isElement:ae,isRTL:Qr};function Jn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ei(e,t){let n=null,o;const r=fe(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=Ye(p),m=Ye(r.clientWidth-(f+v)),x=Ye(r.clientHeight-(p+h)),b=Ye(f),g={rootMargin:-w+"px "+-m+"px "+-x+"px "+-b+"px",threshold:Q(0,ve(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&&!Jn(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(N,{...g,root:r.ownerDocument})}catch{n=new IntersectionObserver(N,g)}n.observe(e)}return i(!0),a}function ti(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=o,u=Mt(e),f=r||a?[...u?Ve(u):[],...t?Ve(t):[]]:[];f.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),a&&b.addEventListener("resize",n)});const p=u&&c?ei(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?Ee(e):null;d&&x();function x(){const b=Ee(e);m&&!Jn(m,b)&&n(),m=b,w=requestAnimationFrame(x)}return n(),()=>{var b;f.forEach(y=>{r&&y.removeEventListener("scroll",n),a&&y.removeEventListener("resize",n)}),p==null||p(),(b=h)==null||b.disconnect(),h=null,d&&cancelAnimationFrame(w)}}const ni=Or,oi=kr,si=Pr,ri=Dr,ii=Er,rn=Tr,ai=_r,ci=(e,t,n)=>{const o=new Map,r={platform:Jr,...n},a={...r.platform,_c:o};return Ar(e,t,{...r,platform:a})};var li=typeof document<"u",di=function(){},Xe=li?l.useLayoutEffect:di;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,r;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(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const a=r[o];if(!(a==="_owner"&&e.$$typeof)&&!Je(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function eo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function an(e,t){const n=eo(e);return Math.round(t*n)/n}function ht(e){const t=l.useRef(e);return Xe(()=>{t.current=e}),t}function ui(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,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=ht(d),D=ht(r),F=ht(u),_=l.useCallback(()=>{if(!R.current||!A.current)return;const P={placement:t,strategy:n,middleware:v};D.current&&(P.platform=D.current),ci(R.current,A.current,P).then(H=>{const X={...H,isPositioned:F.current!==!1};k.current&&!Je(T.current,X)&&(T.current=X,Tt.flushSync(()=>{p(X)}))})},[v,t,n,D,F]);Xe(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,p(P=>({...P,isPositioned:!1})))},[u]);const k=l.useRef(!1);Xe(()=>(k.current=!0,()=>{k.current=!1}),[]),Xe(()=>{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 H=an(I.floating,f.x),X=an(I.floating,f.y);return c?{...P,transform:"translate("+H+"px, "+X+"px)",...eo(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:X}},[n,c,I.floating,f.x,f.y]);return l.useMemo(()=>({...f,update:_,refs:$,elements:I,floatingStyles:M}),[f,_,$,I,M])}const fi=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?rn({element:o.current,padding:r}).fn(n):{}:o?rn({element:o,padding:r}).fn(n):{}}}},pi=(e,t)=>{const n=ni(e);return{name:n.name,fn:n.fn,options:[e,t]}},mi=(e,t)=>{const n=oi(e);return{name:n.name,fn:n.fn,options:[e,t]}},hi=(e,t)=>({fn:ai(e).fn,options:[e,t]}),xi=(e,t)=>{const n=si(e);return{name:n.name,fn:n.fn,options:[e,t]}},gi=(e,t)=>{const n=ri(e);return{name:n.name,fn:n.fn,options:[e,t]}},vi=(e,t)=>{const n=ii(e);return{name:n.name,fn:n.fn,options:[e,t]}},yi=(e,t)=>{const n=fi(e);return{name:n.name,fn:n.fn,options:[e,t]}};var wi="Arrow",to=l.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...a}=e;return s.jsx(U.svg,{...a,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});to.displayName=wi;var bi=to,Lt="Popper",[no,oo]=De(Lt),[Si,so]=no(Lt),ro=e=>{const{__scopePopper:t,children:n}=e,[o,r]=l.useState(null);return s.jsx(Si,{scope:t,anchor:o,onAnchorChange:r,children:n})};ro.displayName=Lt;var io="PopperAnchor",ao=l.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,a=so(io,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:s.jsx(U.div,{...r,ref:c})});ao.displayName=io;var Ft="PopperContent",[Ci,Ni]=no(Ft),co=l.forwardRef((e,t)=>{var E,W,G,V,B,L;const{__scopePopper:n,side:o="bottom",sideOffset:r=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=so(Ft,n),[b,y]=l.useState(null),g=Y(t,q=>y(q)),[S,N]=l.useState(null),R=hn(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],F=D.length>0,_={padding:O,boundary:D.filter(Ri),altBoundary:F},{refs:k,floatingStyles:$,placement:I,isPositioned:M,middlewareData:P}=ui({strategy:"fixed",placement:j,whileElementsMounted:(...q)=>ti(...q,{animationFrame:h==="always"}),elements:{reference:x.anchor},middleware:[pi({mainAxis:r+T,alignmentAxis:i}),d&&mi({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?hi():void 0,..._}),d&&xi({..._}),gi({..._,apply:({elements:q,rects:ne,availableWidth:C,availableHeight:K})=>{const{width:Z,height:dt}=ne.reference,Ke=q.floating.style;Ke.setProperty("--radix-popper-available-width",`${C}px`),Ke.setProperty("--radix-popper-available-height",`${K}px`),Ke.setProperty("--radix-popper-anchor-width",`${Z}px`),Ke.setProperty("--radix-popper-anchor-height",`${dt}px`)}}),S&&yi({element:S,padding:c}),Ai({arrowWidth:A,arrowHeight:T}),v&&vi({strategy:"referenceHidden",..._})]}),[H,X]=fo(I),te=At(w);ie(()=>{M&&(te==null||te())},[M,te]);const Ce=(E=P.arrow)==null?void 0:E.x,Ne=(W=P.arrow)==null?void 0:W.y,se=((G=P.arrow)==null?void 0:G.centerOffset)!==0,[ge,le]=l.useState();return ie(()=>{b&&le(window.getComputedStyle(b).zIndex)},[b]),s.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:M?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[(V=P.transformOrigin)==null?void 0:V.x,(B=P.transformOrigin)==null?void 0:B.y].join(" "),...((L=P.hide)==null?void 0:L.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(Ci,{scope:n,placedSide:H,onArrowChange:N,arrowX:Ce,arrowY:Ne,shouldHideArrow:se,children:s.jsx(U.div,{"data-side":H,"data-align":X,...m,ref:g,style:{...m.style,animation:M?void 0:"none"}})})})});co.displayName=Ft;var lo="PopperArrow",ji={top:"bottom",right:"left",bottom:"top",left:"right"},uo=l.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,a=Ni(lo,o),i=ji[a.placedSide];return s.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:s.jsx(bi,{...r,ref:n,style:{...r.style,display:"block"}})})});uo.displayName=lo;function Ri(e){return e!==null}var Ai=e=>({name:"transformOrigin",options:e,fn(t){var x,b,y;const{placement:n,rects:o,middlewareData:r}=t,i=((x=r.arrow)==null?void 0:x.centerOffset)!==0,c=i?0:e.arrowWidth,d=i?0:e.arrowHeight,[u,f]=fo(n),p={start:"0%",center:"50%",end:"100%"}[f],v=(((b=r.arrow)==null?void 0:b.x)??0)+c/2,h=(((y=r.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 fo(e){const[t,n="center"]=e.split("-");return[t,n]}var Ti=ro,Pi=ao,Ei=co,Ii=uo;function Oi(e){const t=ki(e),n=l.forwardRef((o,r)=>{const{children:a,...i}=o,c=l.Children.toArray(a),d=c.find(Di);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 s.jsx(t,{...i,ref:r,children:l.isValidElement(u)?l.cloneElement(u,void 0,f):null})}return s.jsx(t,{...i,ref:r,children:a})});return n.displayName=`${e}.Slot`,n}function ki(e){const t=l.forwardRef((n,o)=>{const{children:r,...a}=n;if(l.isValidElement(r)){const i=Li(r),c=Mi(a,r.props);return r.type!==l.Fragment&&(c.ref=o?dn(o,i):i),l.cloneElement(r,c)}return l.Children.count(r)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _i=Symbol("radix.slottable");function Di(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_i}function Mi(e,t){const n={...t};for(const o in t){const r=e[o],a=t[o];/^on[A-Z]/.test(o)?r&&a?n[o]=(...c)=>{const d=a(...c);return r(...c),d}:r&&(n[o]=r):o==="style"?n[o]={...r,...a}:o==="className"&&(n[o]=[r,a].filter(Boolean).join(" "))}return{...e,...n}}function Li(e){var o,r;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=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var po=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"}),Fi="VisuallyHidden",Bi=l.forwardRef((e,t)=>s.jsx(U.span,{...e,ref:t,style:{...po,...e.style}}));Bi.displayName=Fi;var $i=[" ","Enter","ArrowUp","ArrowDown"],Hi=[" ","Enter"],Ie="Select",[at,ct,Vi]=Cn(Ie),[Fe]=De(Ie,[Vi,oo]),lt=oo(),[Wi,be]=Fe(Ie),[zi,Ui]=Fe(Ie),mo=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:r,onOpenChange:a,value:i,defaultValue:c,onValueChange:d,dir:u,name:f,autoComplete:p,disabled:v,required:h,form:w}=e,m=lt(t),[x,b]=l.useState(null),[y,g]=l.useState(null),[S,N]=l.useState(!1),R=Pt(u),[A,T]=He({prop:o,defaultProp:r??!1,onChange:a,caller:Ie}),[j,O]=He({prop:i,defaultProp:c,onChange:d,caller:Ie}),D=l.useRef(null),F=x?w||!!x.closest("form"):!0,[_,k]=l.useState(new Set),$=Array.from(_).map(I=>I.props.value).join(";");return s.jsx(Ti,{...m,children:s.jsxs(Wi,{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:[s.jsx(at.Provider,{scope:t,children:s.jsx(zi,{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})}),F?s.jsxs(Fo,{"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?s.jsx("option",{value:""}):null,Array.from(_)]},$):null]})})};mo.displayName=Ie;var ho="SelectTrigger",xo=l.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...r}=e,a=lt(n),i=be(ho,n),c=i.disabled||o,d=Y(t,i.onTriggerChange),u=ct(n),f=l.useRef("touch"),[p,v,h]=$o(m=>{const x=u().filter(g=>!g.disabled),b=x.find(g=>g.value===i.value),y=Ho(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 s.jsx(Pi,{asChild:!0,...a,children:s.jsx(U.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":Bo(i.value)?"":void 0,...r,ref:d,onClick:z(r.onClick,m=>{m.currentTarget.focus(),f.current!=="mouse"&&w(m)}),onPointerDown:z(r.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(r.onKeyDown,m=>{const x=p.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&v(m.key),!(x&&m.key===" ")&&$i.includes(m.key)&&(w(),m.preventDefault())})})})});xo.displayName=ho;var go="SelectValue",vo=l.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,children:a,placeholder:i="",...c}=e,d=be(go,n),{onValueNodeHasChildrenChange:u}=d,f=a!==void 0,p=Y(t,d.onValueNodeChange);return ie(()=>{u(f)},[u,f]),s.jsx(U.span,{...c,ref:p,style:{pointerEvents:"none"},children:Bo(d.value)?s.jsx(s.Fragment,{children:i}):a})});vo.displayName=go;var Ki="SelectIcon",yo=l.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...r}=e;return s.jsx(U.span,{"aria-hidden":!0,...r,ref:t,children:o||"▼"})});yo.displayName=Ki;var Gi="SelectPortal",wo=e=>s.jsx(es,{asChild:!0,...e});wo.displayName=Gi;var Oe="SelectContent",bo=l.forwardRef((e,t)=>{const n=be(Oe,e.__scopeSelect),[o,r]=l.useState();if(ie(()=>{r(new DocumentFragment)},[]),!n.open){const a=o;return a?Tt.createPortal(s.jsx(So,{scope:e.__scopeSelect,children:s.jsx(at.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),a):null}return s.jsx(Co,{...e,ref:t})});bo.displayName=Oe;var re=10,[So,Se]=Fe(Oe),Yi="SelectContentImpl",Xi=Oi("SelectContent.RemoveScroll"),Co=l.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:r,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=be(Oe,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),F=ct(n),[_,k]=l.useState(!1),$=l.useRef(!1);l.useEffect(()=>{if(g)return ts(g)},[g]),ns();const I=l.useCallback(E=>{const[W,...G]=F().map(L=>L.ref.current),[V]=G.slice(-1),B=document.activeElement;for(const L of E)if(L===B||(L==null||L.scrollIntoView({block:"nearest"}),L===W&&N&&(N.scrollTop=0),L===V&&N&&(N.scrollTop=N.scrollHeight),L==null||L.focus(),document.activeElement!==B))return},[F,N]),M=l.useCallback(()=>I([T,g]),[I,T,g]);l.useEffect(()=>{_&&M()},[_,M]);const{onOpenChange:P,triggerPointerDownPosRef:H}=y;l.useEffect(()=>{if(g){let E={x:0,y:0};const W=V=>{var B,L;E={x:Math.abs(Math.round(V.pageX)-(((B=H.current)==null?void 0:B.x)??0)),y:Math.abs(Math.round(V.pageY)-(((L=H.current)==null?void 0:L.y)??0))}},G=V=>{E.x<=10&&E.y<=10?V.preventDefault():g.contains(V.target)||P(!1),document.removeEventListener("pointermove",W),H.current=null};return H.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,H]),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]=$o(E=>{const W=F().filter(B=>!B.disabled),G=W.find(B=>B.ref.current===document.activeElement),V=Ho(W,E,G);V&&setTimeout(()=>V.ref.current.focus())}),Ce=l.useCallback((E,W,G)=>{const V=!$.current&&!G;(y.value!==void 0&&y.value===W||V)&&(j(E),V&&($.current=!0))},[y.value]),Ne=l.useCallback(()=>g==null?void 0:g.focus(),[g]),se=l.useCallback((E,W,G)=>{const V=!$.current&&!G;(y.value!==void 0&&y.value===W||V)&&D(E)},[y.value]),ge=o==="popper"?St:No,le=ge===St?{side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:v,collisionPadding:h,sticky:w,hideWhenDetached:m,avoidCollisions:x}:{};return s.jsx(So,{scope:n,content:g,viewport:N,onViewportChange:R,itemRefCallback:Ce,selectedItem:T,onItemLeave:Ne,itemTextRefCallback:se,focusSelectedItem:M,selectedItemText:O,position:o,isPositioned:_,searchRef:X,children:s.jsx(os,{as:Xi,allowPinchZoom:!0,children:s.jsx(ss,{asChild:!0,trapped:y.open,onMountAutoFocus:E=>{E.preventDefault()},onUnmountAutoFocus:z(r,E=>{var W;(W=y.trigger)==null||W.focus({preventScroll:!0}),E.preventDefault()}),children:s.jsx(rs,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:E=>E.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:s.jsx(ge,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:E=>E.preventDefault(),...b,...le,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 V=F().filter(B=>!B.disabled).map(B=>B.ref.current);if(["ArrowUp","End"].includes(E.key)&&(V=V.slice().reverse()),["ArrowUp","ArrowDown"].includes(E.key)){const B=E.target,L=V.indexOf(B);V=V.slice(L+1)}setTimeout(()=>I(V)),E.preventDefault()}})})})})})})});Co.displayName=Yi;var qi="SelectItemAlignedPosition",No=l.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...r}=e,a=be(Oe,n),i=Se(Oe,n),[c,d]=l.useState(null),[u,f]=l.useState(null),p=Y(t,A=>f(A)),v=ct(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 B=O.left-T.left,L=j.left-B,q=A.left-L,ne=A.width+q,C=Math.max(ne,T.width),K=window.innerWidth-re,Z=Xt(L,[re,Math.max(re,K-C)]);c.style.minWidth=ne+"px",c.style.left=Z+"px"}else{const B=T.right-O.right,L=window.innerWidth-j.right-B,q=window.innerWidth-A.right-L,ne=A.width+q,C=Math.max(ne,T.width),K=window.innerWidth-re,Z=Xt(L,[re,Math.max(re,K-C)]);c.style.minWidth=ne+"px",c.style.right=Z+"px"}const D=v(),F=window.innerHeight-re*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),H=$+I+_+P+M,X=Math.min(x.offsetHeight*5,H),te=window.getComputedStyle(m),Ce=parseInt(te.paddingTop,10),Ne=parseInt(te.paddingBottom,10),se=A.top+A.height/2-re,ge=F-se,le=x.offsetHeight/2,E=x.offsetTop+le,W=$+I+E,G=H-W;if(W<=se){const B=D.length>0&&x===D[D.length-1].ref.current;c.style.bottom="0px";const L=u.clientHeight-m.offsetTop-m.offsetHeight,q=Math.max(ge,le+(B?Ne:0)+L+M),ne=W+q;c.style.height=ne+"px"}else{const B=D.length>0&&x===D[0].ref.current;c.style.top="0px";const q=Math.max(se,$+m.offsetTop+(B?Ce:0)+le)+G;c.style.height=q+"px",m.scrollTop=W-se+m.offsetTop}c.style.margin=`${re}px 0`,c.style.minHeight=X+"px",c.style.maxHeight=F+"px",o==null||o(),requestAnimationFrame(()=>h.current=!0)}},[v,a.trigger,a.valueNode,c,u,m,x,b,a.dir,o]);ie(()=>g(),[g]);const[S,N]=l.useState();ie(()=>{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 s.jsx(Qi,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:R,children:s.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:s.jsx(U.div,{...r,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});No.displayName=qi;var Zi="SelectPopperPosition",St=l.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:r=re,...a}=e,i=lt(n);return s.jsx(Ei,{...i,...a,ref:t,align:o,collisionPadding:r,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)"}})});St.displayName=Zi;var[Qi,Bt]=Fe(Oe,{}),Ct="SelectViewport",jo=l.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...r}=e,a=Se(Ct,n),i=Bt(Ct,n),c=Y(t,a.onViewportChange),d=l.useRef(0);return s.jsxs(s.Fragment,{children:[s.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}),s.jsx(at.Slot,{scope:n,children:s.jsx(U.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:z(r.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-re*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})})})]})});jo.displayName=Ct;var Ro="SelectGroup",[Ji,ea]=Fe(Ro),ta=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=We();return s.jsx(Ji,{scope:n,id:r,children:s.jsx(U.div,{role:"group","aria-labelledby":r,...o,ref:t})})});ta.displayName=Ro;var Ao="SelectLabel",To=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=ea(Ao,n);return s.jsx(U.div,{id:r.id,...o,ref:t})});To.displayName=Ao;var et="SelectItem",[na,Po]=Fe(et),Eo=l.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:r=!1,textValue:a,...i}=e,c=be(et,n),d=Se(et,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,r)}),m=We(),x=l.useRef("touch"),b=()=>{r||(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 s.jsx(na,{scope:n,value:o,disabled:r,textId:m,isSelected:u,onItemTextChange:l.useCallback(y=>{p(g=>g||((y==null?void 0:y.textContent)??"").trim())},[]),children:s.jsx(at.ItemSlot,{scope:n,value:o,disabled:r,textValue:f,children:s.jsx(U.div,{role:"option","aria-labelledby":m,"data-highlighted":v?"":void 0,"aria-selected":u&&v,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?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,r?(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===" "||(Hi.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});Eo.displayName=et;var Be="SelectItemText",Io=l.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,...a}=e,i=be(Be,n),c=Se(Be,n),d=Po(Be,n),u=Ui(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(()=>s.jsx("option",{value:d.value,disabled:d.disabled,children:h},d.value),[d.disabled,d.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return ie(()=>(m(w),()=>x(w)),[m,x,w]),s.jsxs(s.Fragment,{children:[s.jsx(U.span,{id:d.textId,...a,ref:v}),d.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Tt.createPortal(a.children,i.valueNode):null]})});Io.displayName=Be;var Oo="SelectItemIndicator",ko=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return Po(Oo,n).isSelected?s.jsx(U.span,{"aria-hidden":!0,...o,ref:t}):null});ko.displayName=Oo;var Nt="SelectScrollUpButton",_o=l.forwardRef((e,t)=>{const n=Se(Nt,e.__scopeSelect),o=Bt(Nt,e.__scopeSelect),[r,a]=l.useState(!1),i=Y(t,o.onScrollButtonChange);return ie(()=>{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]),r?s.jsx(Mo,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null});_o.displayName=Nt;var jt="SelectScrollDownButton",Do=l.forwardRef((e,t)=>{const n=Se(jt,e.__scopeSelect),o=Bt(jt,e.__scopeSelect),[r,a]=l.useState(!1),i=Y(t,o.onScrollButtonChange);return ie(()=>{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]),r?s.jsx(Mo,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null});Do.displayName=jt;var Mo=l.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...r}=e,a=Se("SelectScrollButton",n),i=l.useRef(null),c=ct(n),d=l.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return l.useEffect(()=>()=>d(),[d]),ie(()=>{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]),s.jsx(U.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:z(r.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(o,50))}),onPointerMove:z(r.onPointerMove,()=>{var u;(u=a.onItemLeave)==null||u.call(a),i.current===null&&(i.current=window.setInterval(o,50))}),onPointerLeave:z(r.onPointerLeave,()=>{d()})})}),oa="SelectSeparator",Lo=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return s.jsx(U.div,{"aria-hidden":!0,...o,ref:t})});Lo.displayName=oa;var Rt="SelectArrow",sa=l.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=lt(n),a=be(Rt,n),i=Se(Rt,n);return a.open&&i.position==="popper"?s.jsx(Ii,{...r,...o,ref:t}):null});sa.displayName=Rt;var ra="SelectBubbleInput",Fo=l.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const r=l.useRef(null),a=Y(o,r),i=mn(t);return l.useEffect(()=>{const c=r.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]),s.jsx(U.select,{...n,style:{...po,...n.style},ref:a,defaultValue:t})});Fo.displayName=ra;function Bo(e){return e===""||e===void 0}function $o(e){const t=At(e),n=l.useRef(""),o=l.useRef(0),r=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,r,a]}function Ho(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let i=ia(e,Math.max(a,0));r.length===1&&(i=i.filter(u=>u!==n));const d=i.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return d!==n?d:void 0}function ia(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var aa=mo,Vo=xo,ca=vo,la=yo,da=wo,Wo=bo,ua=jo,zo=To,Uo=Eo,fa=Io,pa=ko,Ko=_o,Go=Do,Yo=Lo;const Xo=aa,qo=ca,$t=l.forwardRef(({className:e,children:t,...n},o)=>s.jsxs(Vo,{ref:o,className:ee("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,s.jsx(la,{asChild:!0,children:s.jsx(pn,{className:"h-4 w-4 opacity-50"})})]}));$t.displayName=Vo.displayName;const Zo=l.forwardRef(({className:e,...t},n)=>s.jsx(Ko,{ref:n,className:ee("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Ds,{className:"h-4 w-4"})}));Zo.displayName=Ko.displayName;const Qo=l.forwardRef(({className:e,...t},n)=>s.jsx(Go,{ref:n,className:ee("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(pn,{className:"h-4 w-4"})}));Qo.displayName=Go.displayName;const Ht=l.forwardRef(({className:e,children:t,position:n="popper",...o},r)=>s.jsx(da,{children:s.jsxs(Wo,{ref:r,className:ee("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:[s.jsx(Zo,{}),s.jsx(ua,{className:ee("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(Qo,{})]})}));Ht.displayName=Wo.displayName;const ma=l.forwardRef(({className:e,...t},n)=>s.jsx(zo,{ref:n,className:ee("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));ma.displayName=zo.displayName;const $e=l.forwardRef(({className:e,children:t,...n},o)=>s.jsxs(Uo,{ref:o,className:ee("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:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(pa,{children:s.jsx(is,{className:"h-4 w-4"})})}),s.jsx(fa,{children:t})]}));$e.displayName=Uo.displayName;const ha=l.forwardRef(({className:e,...t},n)=>s.jsx(Yo,{ref:n,className:ee("-mx-1 my-1 h-px bg-muted",e),...t}));ha.displayName=Yo.displayName;const cn={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function xa({open:e,onOpenChange:t,onAdded:n}){const[o,r]=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&&as().then(j=>r(j.available)).catch(()=>r([]))},[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 Vt({type:j,label:cn[j]||j}),{url:D}=await xt(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 Vt({type:u,label:p,clientId:h,clientSecret:m}),{url:O}=await xt(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 s.jsx(cs,{open:e,onOpenChange:j=>{t(j),j||N()},children:s.jsxs(ls,{className:"sm:max-w-md",children:[s.jsxs(ds,{children:[s.jsxs(us,{className:"flex items-center gap-2",children:[s.jsx(gt,{className:"h-5 w-5"}),"添加云盘账号"]}),s.jsx(fs,{children:a?"手动填写 OAuth 凭据连接云盘":"选择云盘类型,点击后跳转登录授权"})]}),a?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(pe,{children:"云盘类型"}),s.jsxs(Xo,{value:u,onValueChange:f,children:[s.jsx($t,{children:s.jsx(qo,{placeholder:"选择云盘类型"})}),s.jsxs(Ht,{children:[s.jsx($e,{value:"google-drive",children:"Google Drive"}),s.jsx($e,{value:"onedrive",children:"OneDrive"}),s.jsx($e,{value:"dropbox",children:"Dropbox"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(pe,{children:"显示名称"}),s.jsx(Pe,{placeholder:"例如:我的 Google Drive",value:p,onChange:j=>v(j.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(pe,{children:"Client ID"}),s.jsx(Pe,{placeholder:"OAuth Client ID",value:h,onChange:j=>w(j.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(pe,{children:"Client Secret"}),s.jsx(Pe,{type:"password",placeholder:"OAuth Client Secret",value:m,onChange:j=>x(j.target.value)})]}),g&&s.jsx("p",{className:"text-sm text-destructive",children:g})]}),s.jsxs(ps,{children:[s.jsx(oe,{variant:"outline",onClick:()=>{i(!1),S(null)},children:"返回"}),s.jsx(oe,{onClick:A,disabled:b,children:b?"添加中...":"添加并授权"})]})]}):s.jsxs("div",{className:"space-y-3 py-2",children:[T?s.jsx(s.Fragment,{children:o.map(j=>s.jsx(oe,{variant:"outline",className:"w-full justify-start gap-3 h-12 text-base",onClick:()=>void R(j),disabled:c!==null,children:c===j?"连接中...":`连接 ${cn[j]||j}`},j))}):s.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"暂无内置 OAuth 凭据,请使用手动模式添加"}),g&&s.jsx("p",{className:"text-sm text-destructive",children:g}),s.jsx("div",{className:"pt-2 border-t border-border",children:s.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:[s.jsx(Hs,{className:"h-3.5 w-3.5"}),"手动填写 OAuth 凭据"]})})]})]})})}const ga={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function va({type:e}){switch(e){case"google-drive":return s.jsx(Gt,{className:"h-5 w-5 text-blue-500"});case"onedrive":return s.jsx(gt,{className:"h-5 w-5 text-sky-500"});case"dropbox":return s.jsx(Gt,{className:"h-5 w-5 text-indigo-500"});default:return s.jsx(gt,{className:"h-5 w-5"})}}function ya({provider:e,onDelete:t,onReauth:n}){var i;const[o,r]=l.useState(!1),a=()=>{o?(t(e.id),r(!1)):(r(!0),setTimeout(()=>r(!1),3e3))};return s.jsxs(ms,{children:[s.jsx(hs,{className:"pb-3",children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(va,{type:e.type}),s.jsxs("div",{children:[s.jsx(xs,{className:"text-base",children:e.label}),s.jsx("p",{className:"text-sm text-muted-foreground",children:ga[e.type]||e.type})]})]}),s.jsx(un,{variant:e.authorized?"default":"destructive",className:e.authorized?"bg-green-600 hover:bg-green-700":"",children:e.authorized?"已授权":"未授权"})]})}),s.jsxs(gs,{children:[e.authorized&&((i=e.tokens)==null?void 0:i.expiry)&&s.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["授权到期:",new Date(e.tokens.expiry).toLocaleDateString("zh-CN")]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>n(e.id),children:[s.jsx(fn,{className:"h-3.5 w-3.5 mr-1"}),"重新授权"]}),s.jsxs(oe,{variant:o?"destructive":"outline",size:"sm",onClick:a,children:[s.jsx(vs,{className:"h-3.5 w-3.5 mr-1"}),o?"确认删除?":"删除"]})]})]})]})}const wa={success:{label:"成功",icon:$s,className:"bg-green-600 hover:bg-green-700"},failed:{label:"失败",icon:Vs,className:"bg-red-600 hover:bg-red-700"},partial:{label:"部分完成",icon:Fs,className:"bg-yellow-600 hover:bg-yellow-700"}};function ba(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 r=Math.floor(o/60),a=o%60;return`${r}分${a}秒`}function Sa(e){return new Date(e).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function Ca({history:e}){const t=e.slice(0,20);return t.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[s.jsx(Ms,{className:"h-10 w-10 mb-3 opacity-50"}),s.jsx("p",{className:"text-sm",children:"暂无备份记录"})]}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"时间"}),s.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"项目"}),s.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"云盘"}),s.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"状态"}),s.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"文件数"}),s.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"耗时"})]})}),s.jsx("tbody",{children:t.map(n=>{const o=wa[n.status],r=o.icon;return s.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/50",children:[s.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:Sa(n.startTime)}),s.jsx("td",{className:"py-2.5 px-2",children:n.projectName}),s.jsx("td",{className:"py-2.5 px-2",children:n.providerLabel}),s.jsxs("td",{className:"py-2.5 px-2",children:[s.jsxs(un,{className:o.className,children:[s.jsx(r,{className:"h-3 w-3 mr-1"}),o.label]}),n.error&&s.jsx("p",{className:"text-xs text-destructive mt-1",children:n.error})]}),s.jsxs("td",{className:"py-2.5 px-2 whitespace-nowrap",children:[n.filesUploaded,"/",n.filesTotal]}),s.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:ba(n.startTime,n.endTime)})]},n.id)})})]})})}const ln=["node_modules",".git","dist","build","*.log",".DS_Store","*.tmp",".venv","__pycache__",".env"],Na=[{value:"30",label:"30分钟"},{value:"60",label:"1小时"},{value:"360",label:"6小时"},{value:"720",label:"12小时"},{value:"1440",label:"24小时"}];function Ta(){const e=ys(),[t,n]=l.useState([]),[o,r]=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(()=>ws()),[D,F]=l.useState(!1),[_,k]=l.useState({webhookEnabled:!1}),[$,I]=l.useState(""),[M,P]=l.useState(!1),[H,X]=l.useState(()=>bs(ut.usageMonitorTool,"claude")),te=async()=>{try{const C=await Ts();n(C)}catch{}finally{r(!1)}},Ce=async()=>{try{const C=await Ps();d(C)}catch{}finally{f(!1)}},Ne=async()=>{try{const C=await Es();v(C.length>0?C:ln)}catch{v(ln)}finally{w(!1)}},se=async()=>{try{const C=await Is();R(C)}catch{}finally{T(!1)}};l.useEffect(()=>{te(),Ce(),Ne(),se(),Ss().then(C=>{k(C),I(C.webhookUrl??"")}).catch(()=>{})},[]);const ge=()=>{zt(ut.pomodoroConfig,j,!0),F(!1),Ge.success("番茄钟设置已保存")},le=(C,K)=>{const Z=parseInt(K,10);isNaN(Z)||Z<1||(O(dt=>({...dt,[C]:Z})),F(!0))},E=async()=>{P(!0);try{const C=await _s({webhookEnabled:$.trim().length>0,webhookUrl:$.trim()||void 0});k(C),Ge.success("Webhook 配置已保存")}catch{Ge.error("保存失败")}finally{P(!1)}},W=async C=>{try{await Os(C),n(K=>K.filter(Z=>Z.id!==C))}catch{}},G=async C=>{try{const{url:K}=await xt(C);window.open(K,"_blank")}catch{}},V=async C=>{const K={...c,enabled:C};d(K);try{await Ut({enabled:C})}catch{d(c)}},B=async C=>{const K=parseInt(C,10),Z={...c,intervalMinutes:K};d(Z);try{await Ut({intervalMinutes:K})}catch{d(c)}},L=()=>{const C=m.trim();!C||p.includes(C)||(v(K=>[...K,C]),x(""),y(!0))},q=C=>{v(K=>K.filter(Z=>Z!==C)),y(!0)},ne=async()=>{S(!0);try{await ks(p),y(!1)}catch{}finally{S(!1)}};return s.jsx("div",{className:"min-h-screen bg-background",children:s.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[s.jsxs(oe,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[s.jsx(Cs,{className:"h-4 w-4 mr-1"}),"返回"]}),s.jsx("h1",{className:"text-2xl font-bold",children:"设置"})]}),s.jsxs(hr,{defaultValue:"providers",children:[s.jsxs(Wn,{className:"mb-4",children:[s.jsx(Ae,{value:"providers",children:"云盘账号"}),s.jsx(Ae,{value:"strategy",children:"备份策略"}),s.jsx(Ae,{value:"history",children:"备份记录"}),s.jsxs(Ae,{value:"notifications",children:[s.jsx(Bs,{className:"h-3.5 w-3.5 mr-1.5"}),"通知"]}),s.jsxs(Ae,{value:"pomodoro",children:[s.jsx(Wt,{className:"h-3.5 w-3.5 mr-1.5"}),"番茄钟"]}),s.jsxs(Ae,{value:"usage",children:[s.jsx(Ls,{className:"h-3.5 w-3.5 mr-1.5"}),"用量监控"]})]}),s.jsxs(Te,{value:"providers",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex justify-end",children:s.jsxs(oe,{onClick:()=>i(!0),children:[s.jsx(Ns,{className:"h-4 w-4 mr-1"}),"添加云盘"]})}),o?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):t.length===0?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-12",children:"暂无云盘账号,点击上方按钮添加"}):s.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:t.map(C=>s.jsx(ya,{provider:C,onDelete:W,onReauth:G},C.id))})]}),s.jsx(xa,{open:a,onOpenChange:i,onAdded:()=>void te()})]}),s.jsx(Te,{value:"strategy",children:s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-medium",children:"排除规则"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"匹配这些模式的文件和目录将不会被备份"}),h?s.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-wrap gap-2",children:s.jsx(js,{children:p.map(C=>s.jsxs(Rs.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,s.jsx("button",{onClick:()=>q(C),className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20 p-0.5",children:s.jsx(As,{className:"h-3 w-3"})})]},C))})}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Pe,{placeholder:"输入排除模式,例如 *.log",value:m,onChange:C=>x(C.target.value),onKeyDown:C=>{C.key==="Enter"&&L()},className:"max-w-xs"}),s.jsx(oe,{variant:"outline",size:"sm",onClick:L,children:"添加"})]}),b&&s.jsxs(oe,{onClick:ne,disabled:g,children:[s.jsx(Kt,{className:"h-4 w-4 mr-1"}),g?"保存中...":"保存"]})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-medium",children:"定时备份"}),u?s.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Sn,{checked:c.enabled,onCheckedChange:V}),s.jsx(pe,{children:c.enabled?"已开启":"已关闭"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(pe,{children:"备份间隔"}),s.jsxs(Xo,{value:String(c.intervalMinutes),onValueChange:B,children:[s.jsx($t,{className:"w-48",children:s.jsx(qo,{})}),s.jsx(Ht,{children:Na.map(C=>s.jsx($e,{value:C.value,children:C.label},C.value))})]})]})]})]})]})}),s.jsx(Te,{value:"history",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex justify-end",children:s.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>{T(!0),se()},children:[s.jsx(fn,{className:"h-4 w-4 mr-1"}),"刷新"]})}),A?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):s.jsx(Ca,{history:N})]})}),s.jsx(Te,{value:"notifications",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[s.jsx("h3",{className:"text-sm font-medium",children:"浏览器通知"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"当 Claude 完成任务时,浏览器将自动弹出通知。首次打开 Dashboard 时会请求通知权限。"})]}),s.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-3",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium",children:"Webhook 通知"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Claude 完成任务时向指定 URL 发送 POST 请求(JSON: event, projectId, projectName, timestamp)"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(pe,{className:"text-xs",children:"Webhook URL"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Pe,{placeholder:"https://hooks.slack.com/...",value:$,onChange:C=>I(C.target.value),className:"font-mono text-xs"}),s.jsx(oe,{size:"sm",onClick:()=>void E(),disabled:M,children:M?"保存中…":"保存"})]}),_.webhookEnabled&&_.webhookUrl&&s.jsxs("p",{className:"text-xs text-green-500",children:["已启用 → ",_.webhookUrl]})]})]})]})}),s.jsx(Te,{value:"pomodoro",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium",children:"番茄钟时间设置"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"修改后重新启动番茄钟生效"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-6 max-w-xs",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(pe,{className:"text-xs",children:"工作时长(分钟)"}),s.jsx(Pe,{type:"number",min:1,max:120,value:j.workMinutes,onChange:C=>le("workMinutes",C.target.value),className:"w-full"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(pe,{className:"text-xs",children:"休息时长(分钟)"}),s.jsx(Pe,{type:"number",min:1,max:60,value:j.breakMinutes,onChange:C=>le("breakMinutes",C.target.value),className:"w-full"})]})]}),D&&s.jsxs(oe,{size:"sm",onClick:ge,children:[s.jsx(Kt,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})]}),s.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[s.jsx("h3",{className:"text-sm font-medium",children:"使用说明"}),s.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[s.jsxs("li",{children:["在项目页面 Header 点击 ",s.jsx(Wt,{className:"h-3 w-3 inline-block mx-0.5"})," 图标启动番茄钟"]}),s.jsx("li",{children:"倒计时以大字体悬浮在屏幕上,不影响操作"}),s.jsx("li",{children:"工作阶段结束后自动切换为休息,并弹出通知"}),s.jsx("li",{children:"休息结束后自动切换回工作阶段"}),s.jsx("li",{children:"再次点击图标可停止并重置"})]})]})]})}),s.jsx(Te,{value:"usage",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium",children:"监控工具"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"选择要监控用量的 CLI 工具,首页和项目页会显示对应的实时用量"})]}),s.jsx("div",{className:"grid gap-3 max-w-md",children:[{key:"claude",label:"Claude Code",desc:"Anthropic API — 5h/7d 用量窗口"},{key:"codex",label:"Codex",desc:"OpenAI — 用量查询暂未实现"},{key:"opencode",label:"OpenCode",desc:"OpenCode — 用量查询暂未实现"},{key:"qwen",label:"Qwen Code",desc:"Qwen — 用量查询暂未实现"}].map(C=>s.jsxs("label",{className:`flex items-start gap-3 rounded-lg border p-3 cursor-pointer transition-colors ${H===C.key?"border-blue-500/50 bg-blue-500/5":"border-border hover:bg-muted/30"}`,children:[s.jsx("input",{type:"radio",name:"usageTool",value:C.key,checked:H===C.key,onChange:()=>{X(C.key),zt(ut.usageMonitorTool,C.key),window.dispatchEvent(new Event("ccweb:usage-tool-change")),Ge.success(`用量监控已切换为 ${C.label}`)},className:"mt-0.5"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium",children:C.label}),s.jsx("div",{className:"text-xs text-muted-foreground",children:C.desc})]})]},C.key))})]}),s.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[s.jsx("h3",{className:"text-sm font-medium",children:"说明"}),s.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[s.jsx("li",{children:"用量数据显示在首页 Header 和项目页底部状态栏"}),s.jsx("li",{children:"Claude Code 通过 OAuth API 实时查询,每 5 分钟自动刷新"}),s.jsx("li",{children:"其他工具的用量查询将在后续版本中支持"}),s.jsx("li",{children:"切换后无需刷新页面,用量会自动更新"})]})]})]})})]})]})})}export{Ta as SettingsPage};
@@ -1 +0,0 @@
1
- import{ak as f,r,b3 as g,j as e,e as a}from"./index-BbNO7GpK.js";import{U as j}from"./user-VhIL8flc.js";import{B as p}from"./bot-cQ6ylHLl.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,11 +0,0 @@
1
- import{c as U,a4 as W,r as n,aY as H,aZ as X,t as m,a_ as ee,a$ as se,b0 as te,j as e,B as x,a5 as ae,e as i,b1 as A,ab as ne,I as re,aM as le,p as b,J as de,A as ie,b2 as oe}from"./index-BbNO7GpK.js";import{D as w}from"./download-CpyCetNu.js";import{U as ce}from"./user-VhIL8flc.js";import{C as me}from"./chevron-down-DfucCRyS.js";/**
2
- * @license lucide-react v0.309.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const xe=U("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
7
- * @license lucide-react v0.309.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const ue=U("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 je(){const F=W(),[o,S]=n.useState("skills"),[u,g]=n.useState([]),[C,$]=n.useState([]),[k,I]=n.useState(!1),[N,P]=n.useState(null);n.useEffect(()=>{o==="plugins"&&(I(!0),Promise.all([H().catch(()=>[]),fetch("/api/skillhub/plugins").then(s=>s.ok?s.json():[]).catch(()=>[])]).then(([s,t])=>{g(s),$(t)}).finally(()=>I(!1)))},[o]);const B=n.useCallback(async s=>{if(!N){P(s.id);try{await X(s.downloadUrl),m.success(`已安装 ${s.name}`);const t=await H().catch(()=>[]);g(t)}catch(t){m.error(t instanceof Error?t.message:"安装失败")}finally{P(null)}}},[N]),O=n.useCallback(async s=>{try{await ee(s),g(t=>t.filter(a=>a.id!==s)),m.success("已卸载")}catch(t){m.error(t instanceof Error?t.message:"卸载失败")}},[]),Z=n.useCallback(async(s,t)=>{try{await se(s,t),g(a=>a.map(r=>r.id===s?{...r,enabled:t}:r))}catch(a){m.error(a instanceof Error?a.message:"操作失败")}},[]),[l,_]=n.useState([]),[y,q]=n.useState(!0),[h,G]=n.useState(null),[p,J]=n.useState(""),[d,v]=n.useState(null),[R,Y]=n.useState(null),[E,L]=n.useState(null),[D,K]=n.useState(new Set);n.useEffect(()=>{te().then(_).catch(s=>G(s instanceof Error?s.message:"Failed to load SkillHub")).finally(()=>q(!1))},[]);const M=n.useMemo(()=>{const s=new Set;return l.forEach(t=>{var a;return(a=t.tags)==null?void 0:a.forEach(r=>s.add(r))}),Array.from(s).sort()},[l]),Q=n.useMemo(()=>l.some(s=>!s.tags||s.tags.length===0),[l]),T=n.useMemo(()=>{let s=l;if(d==="__untagged__"?s=s.filter(t=>!t.tags||t.tags.length===0):d&&(s=s.filter(t=>{var a;return(a=t.tags)==null?void 0:a.includes(d)})),p.trim()){const t=p.toLowerCase();s=s.filter(a=>{var r;return a.label.toLowerCase().includes(t)||a.description.toLowerCase().includes(t)||a.command.toLowerCase().includes(t)||a.author.toLowerCase().includes(t)||((r=a.tags)==null?void 0:r.some(f=>f.toLowerCase().includes(t)))})}return s},[l,p,d]),V=async(s,t)=>{if(t.stopPropagation(),!(E||D.has(s.id))){L(s.id);try{await oe(s.id),K(a=>new Set(a).add(s.id)),_(a=>a.map(r=>r.id===s.id?{...r,downloads:(r.downloads||0)+1}:r))}catch(a){m.error(a instanceof Error?a.message:"Download failed")}finally{L(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(x,{variant:"ghost",size:"sm",onClick:()=>F("/"),children:[e.jsx(ae,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsx("h1",{className:"font-semibold text-lg",children:"SkillHub"}),e.jsxs("div",{className:"flex items-center gap-1 ml-4",children:[e.jsx("button",{onClick:()=>S("skills"),className:i("px-3 py-1 rounded-md text-sm transition-colors",o==="skills"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:"技能"}),e.jsxs("button",{onClick:()=>S("plugins"),className:i("px-3 py-1 rounded-md text-sm transition-colors flex items-center gap-1",o==="plugins"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:[e.jsx(A,{className:"h-3.5 w-3.5"}),"插件"]})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"relative w-64",children:[e.jsx(ne,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索命令...",value:p,onChange:s=>J(s.target.value),className:"pl-8 h-9"})]})]})}),e.jsxs("main",{className:"max-w-4xl mx-auto px-4 py-6",children:[o==="plugins"&&e.jsxs("div",{children:[k&&e.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),!k&&e.jsxs(e.Fragment,{children:[u.length>0&&e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:"已安装"}),e.jsx("div",{className:"space-y-2",children:u.map(s=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 flex items-center 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("span",{className:"font-medium text-sm",children:s.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",s.version]}),e.jsx("span",{className:i("text-xs px-1.5 py-0.5 rounded",s.enabled?"bg-green-500/10 text-green-500":"bg-muted text-muted-foreground"),children:s.enabled?"启用":"禁用"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:s.description}),s.permissions.length>0&&e.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:s.permissions.map(t=>e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:t},t))})]}),e.jsx(x,{size:"sm",variant:"ghost",onClick:()=>Z(s.id,!s.enabled),title:s.enabled?"禁用":"启用",children:e.jsx(xe,{className:i("h-4 w-4",s.enabled?"text-green-500":"text-muted-foreground")})}),e.jsx(x,{size:"sm",variant:"ghost",onClick:()=>O(s.id),title:"卸载",children:e.jsx(le,{className:"h-4 w-4 text-red-400"})})]},s.id))})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:u.length>0?"更多插件":"可用插件"}),C.length===0&&e.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[e.jsx(A,{className:"h-10 w-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{className:"text-sm",children:"插件中心暂无可用插件"})]}),e.jsx("div",{className:"space-y-2",children:C.filter(s=>!u.some(t=>t.id===s.id)).map((s,t)=>{const a=N===s.id;return e.jsxs(b.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:t*.03},className:"rounded-lg border bg-card p-4 flex items-center 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("span",{className:"font-medium text-sm",children:s.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",s.version]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["by ",s.author]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.description}),s.permissions.length>0&&e.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:s.permissions.map(r=>e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:r},r))})]}),e.jsxs(x,{size:"sm",disabled:a,onClick:()=>B(s),children:[e.jsx(w,{className:"h-3.5 w-3.5 mr-1"}),a?"安装中...":"安装"]})]},s.id)})})]})]})]}),o==="skills"&&e.jsxs(e.Fragment,{children:[M.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[e.jsx("button",{className:i("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:()=>v(null),children:"全部"}),M.map(s=>e.jsx("button",{className:i("px-3 py-1 rounded-full text-xs font-medium transition-colors",d===s?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>v(d===s?null:s),children:s},s)),Q&&e.jsx("button",{className:i("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:()=>v(d==="__untagged__"?null:"__untagged__"),children:"无标签"})]}),y&&e.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),h&&e.jsx("div",{className:"text-center text-destructive py-20",children:h}),!y&&!h&&l.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:"在快捷命令面板中点击分享按钮来提交第一个命令吧!"})]}),!y&&!h&&l.length>0&&T.length===0&&e.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的命令"}),e.jsx("div",{className:"space-y-3",children:T.map((s,t)=>{var z;const a=R===s.id,r=D.has(s.id),f=E===s.id,j=s.parentId?l.find(c=>c.id===s.parentId):void 0;return e.jsxs(b.div,{layout:!0,initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:t*.03,ease:"easeOut"},className:"rounded-lg border bg-card p-4 cursor-pointer hover:border-muted-foreground/30 transition-colors",onClick:()=>Y(a?null:s.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:s.label}),(z=s.tags)==null?void 0:z.map(c=>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(ue,{className:"h-2.5 w-2.5"}),c]},c))]}),j&&e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[e.jsx(de,{className:"h-3 w-3 text-muted-foreground"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["继承: ",j.label]})]}),s.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:s.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(ce,{className:"h-3 w-3"}),s.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(w,{className:"h-3 w-3"}),s.downloads||0]}),e.jsx("span",{children:s.createdAt})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs(x,{size:"sm",variant:r?"outline":"default",disabled:f||r,onClick:c=>V(s,c),title:j?`将同时下载继承的「${j.label}」`:void 0,children:[e.jsx(w,{className:"h-3.5 w-3.5 mr-1"}),r?"已下载":f?"下载中...":"下载"]}),e.jsx(b.span,{animate:{rotate:a?180:0},transition:{duration:.2},children:e.jsx(me,{className:"h-4 w-4 text-muted-foreground"})})]})]}),e.jsx(ie,{children:a&&e.jsx(b.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:s.command})})})})]},s.id)})})]})]})]})}export{je as SkillHubPage};