@tom2012/cc-web 1.5.105 → 1.5.107

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 (48) hide show
  1. package/README.md +1 -1
  2. package/backend/dist/adapters/codex-adapter.d.ts +12 -3
  3. package/backend/dist/adapters/codex-adapter.d.ts.map +1 -1
  4. package/backend/dist/adapters/codex-adapter.js +178 -4
  5. package/backend/dist/adapters/codex-adapter.js.map +1 -1
  6. package/backend/dist/adapters/types.d.ts +2 -0
  7. package/backend/dist/adapters/types.d.ts.map +1 -1
  8. package/backend/dist/index.d.ts.map +1 -1
  9. package/backend/dist/index.js +9 -3
  10. package/backend/dist/index.js.map +1 -1
  11. package/backend/dist/information/conversation-sync.d.ts +8 -5
  12. package/backend/dist/information/conversation-sync.d.ts.map +1 -1
  13. package/backend/dist/information/conversation-sync.js +116 -125
  14. package/backend/dist/information/conversation-sync.js.map +1 -1
  15. package/backend/dist/information/types.d.ts +1 -5
  16. package/backend/dist/information/types.d.ts.map +1 -1
  17. package/backend/dist/routes/hooks.d.ts.map +1 -1
  18. package/backend/dist/routes/hooks.js +4 -4
  19. package/backend/dist/routes/hooks.js.map +1 -1
  20. package/backend/dist/routes/information.d.ts.map +1 -1
  21. package/backend/dist/routes/information.js +29 -82
  22. package/backend/dist/routes/information.js.map +1 -1
  23. package/backend/dist/session-manager.d.ts +2 -0
  24. package/backend/dist/session-manager.d.ts.map +1 -1
  25. package/backend/dist/session-manager.js +4 -0
  26. package/backend/dist/session-manager.js.map +1 -1
  27. package/frontend/dist/assets/{GraphPreview-D_iGUE66.js → GraphPreview-DHocrL8I.js} +1 -1
  28. package/frontend/dist/assets/OfficePreview-C68laqEB.js +2 -0
  29. package/frontend/dist/assets/{PlanPanel-BDSqinyd.js → PlanPanel-B17MZQJw.js} +1 -1
  30. package/frontend/dist/assets/{ProjectPage-PSjHSio4.js → ProjectPage-eQeEbxwZ.js} +4 -4
  31. package/frontend/dist/assets/{SettingsPage-BVdS_khH.js → SettingsPage-I5V0J7Hk.js} +2 -2
  32. package/frontend/dist/assets/{ShareViewPage-BeefS017.js → ShareViewPage-UGPqwYiA.js} +1 -1
  33. package/frontend/dist/assets/{SkillHubPage-yCfmAijC.js → SkillHubPage-CtqwvxSe.js} +2 -2
  34. package/frontend/dist/assets/{bot-C1tzwDVf.js → bot-DouqVXGt.js} +1 -1
  35. package/frontend/dist/assets/{chevron-down-D7wjv7kr.js → chevron-down-Dc9wET1O.js} +1 -1
  36. package/frontend/dist/assets/{index-7Z-hEJrM.js → index-D5jVb_Hp.js} +1 -1
  37. package/frontend/dist/assets/{index-CCg_jxVN.js → index-DUFBsYmE.js} +4 -4
  38. package/frontend/dist/assets/{index-DQ95Benr.css → index-aEd0kOAX.css} +1 -1
  39. package/frontend/dist/assets/{jszip.min-NIEppaDO.js → jszip.min-CvpMHNhV.js} +1 -1
  40. package/frontend/dist/assets/{matter-B-Si71cg.js → matter-DRcEqGZh.js} +1 -1
  41. package/frontend/dist/assets/{maximize-2-DnjlwBTo.js → maximize-2-DAwRM3M1.js} +1 -1
  42. package/frontend/dist/assets/{save-DqNB0YT5.js → save-e41I2mNl.js} +1 -1
  43. package/frontend/dist/assets/search-DvT55wyf.js +13 -0
  44. package/frontend/dist/assets/{user-CeCemcDe.js → user-IGpXOo32.js} +1 -1
  45. package/frontend/dist/index.html +2 -2
  46. package/package.json +1 -1
  47. package/frontend/dist/assets/OfficePreview-B9xC3G1W.js +0 -2
  48. package/frontend/dist/assets/download-9FIGdbRW.js +0 -7
@@ -1,4 +1,4 @@
1
- import{c as e,r as t,aB as n,aC as r,aD as o,j as s,aE as a,aF as i,aG as l,e as c,aH as d,R as u,aI as f,aJ as p,aK as h,aL as m,aM as x,aN as g,aO as v,aP as y,aQ as w,aR as b,x as j,aS as N,a3 as S,a4 as C,a5 as k,a6 as R,a7 as T,B as A,a8 as D,I as E,a9 as P,aT as _,aU as O,aV as I,aW as M,aX as L,aj as F,aY as H,m as V,V as W,ah as z,aZ as B,i as $,S as K,a_ as U,ai as q,a$ as G,y as X,A as Y,p as Z,X as Q,s as J,t as ee,b0 as te,b1 as ne,b2 as re,b3 as oe,b4 as se,b5 as ae,b6 as ie,b7 as le}from"./index-CCg_jxVN.js";import{C as ce}from"./chevron-down-D7wjv7kr.js";import{C as de,S as ue}from"./save-DqNB0YT5.js";
1
+ import{c as e,r as t,aA as n,aB as r,aC as o,j as s,aD as a,aE as i,aF as l,e as c,aG as d,R as u,aH as f,aI as p,aJ as h,aK as m,aL as x,aM as g,aN as v,aO as y,aP as w,aQ as b,x as j,aR as N,a3 as S,a4 as C,a5 as k,a6 as R,a7 as A,B as T,a8 as D,I as E,a9 as P,aS as _,aT as O,aU as I,aV as M,aW as L,aj as F,aX as H,m as V,V as W,ah as z,aY as B,i as $,S as K,aZ as U,ai as q,a_ as G,y as X,A as Y,p as Z,X as Q,s as J,t as ee,a$ as te,b0 as ne,b1 as re,b2 as oe,b3 as se,b4 as ae,b5 as ie,b6 as le}from"./index-DUFBsYmE.js";import{C as ce}from"./chevron-down-Dc9wET1O.js";import{C as de,S as ue}from"./save-e41I2mNl.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -10,4 +10,4 @@ import{c as e,r as t,aB as n,aC as r,aD as o,j as s,aE as a,aF as i,aG as l,e as
10
10
  *
11
11
  * This source code is licensed under the ISC license.
12
12
  * See the LICENSE file in the root directory of this source tree.
13
- */function be(e){const n=t.useRef({value:e,previous:e});return t.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}function je(e){const[r,o]=t.useState(void 0);return n(()=>{if(e){o({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let r,s;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,s=t.blockSize}else r=e.offsetWidth,s=e.offsetHeight;o({width:r,height:s})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}o(void 0)},[e]),r}var Ne="Switch",[Se]=l(Ne),[Ce,ke]=Se(Ne),Re=t.forwardRef((e,n)=>{const{__scopeSwitch:l,name:c,checked:d,defaultChecked:u,required:f,disabled:p,value:h="on",onCheckedChange:m,form:x,...g}=e,[v,y]=t.useState(null),w=r(n,e=>y(e)),b=t.useRef(!1),j=!v||(x||!!v.closest("form")),[N,S]=o({prop:d,defaultProp:u??!1,onChange:m,caller:Ne});return s.jsxs(Ce,{scope:l,checked:N,disabled:p,children:[s.jsx(a.button,{type:"button",role:"switch","aria-checked":N,"aria-required":f,"data-state":Ee(N),"data-disabled":p?"":void 0,disabled:p,value:h,...g,ref:w,onClick:i(e.onClick,e=>{S(e=>!e),j&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),j&&s.jsx(De,{control:v,bubbles:!b.current,name:c,value:h,checked:N,required:f,disabled:p,form:x,style:{transform:"translateX(-100%)"}})]})});Re.displayName=Ne;var Te="SwitchThumb",Ae=t.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=ke(Te,n);return s.jsx(a.span,{"data-state":Ee(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});Ae.displayName=Te;var De=t.forwardRef(({__scopeSwitch:e,control:n,checked:o,bubbles:a=!0,...i},l)=>{const c=t.useRef(null),d=r(c,l),u=be(o),f=je(n);return t.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(u!==o&&n){const t=new Event("click",{bubbles:a});n.call(e,o),e.dispatchEvent(t)}},[u,o,a]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o,...i,tabIndex:-1,ref:d,style:{...i.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Ee(e){return e?"checked":"unchecked"}De.displayName="SwitchBubbleInput";var Pe=Re,_e=Ae;const Oe=t.forwardRef(({className:e,...t},n)=>s.jsx(Pe,{className:c("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(_e,{className:c("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")})}));function Ie(e){const n=Me(e),r=t.forwardRef((e,r)=>{const{children:o,...a}=e,i=t.Children.toArray(o),l=i.find(Fe);if(l){const e=l.props.children,o=i.map(n=>n===l?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:n);return s.jsx(n,{...a,ref:r,children:t.isValidElement(e)?t.cloneElement(e,void 0,o):null})}return s.jsx(n,{...a,ref:r,children:o})});return r.displayName=`${e}.Slot`,r}function Me(e){const n=t.forwardRef((e,n)=>{const{children:r,...o}=e;if(t.isValidElement(r)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{const t=s(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...s}:"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}(o,r.props);return r.type!==t.Fragment&&(s.ref=n?d(n,e):e),t.cloneElement(r,s)}return t.Children.count(r)>1?t.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}Oe.displayName=Pe.displayName;var Le=Symbol("radix.slottable");function Fe(e){return t.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Le}function He(e){const t=e+"CollectionProvider",[n,o]=l(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=e=>{const{scope:t,children:n}=e,r=u.useRef(null),o=u.useRef(new Map).current;return s.jsx(a,{scope:t,itemMap:o,collectionRef:r,children:n})};c.displayName=t;const d=e+"CollectionSlot",f=Ie(d),p=u.forwardRef((e,t)=>{const{scope:n,children:o}=e,a=i(d,n),l=r(t,a.collectionRef);return s.jsx(f,{ref:l,children:o})});p.displayName=d;const h=e+"CollectionItemSlot",m="data-radix-collection-item",x=Ie(h),g=u.forwardRef((e,t)=>{const{scope:n,children:o,...a}=e,l=u.useRef(null),c=r(t,l),d=i(h,n);return u.useEffect(()=>(d.itemMap.set(l,{ref:l,...a}),()=>{d.itemMap.delete(l)})),s.jsx(x,{[m]:"",ref:c,children:o})});return g.displayName=h,[{Provider:c,Slot:p,ItemSlot:g},function(t){const n=i(e+"CollectionConsumer",t);return u.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${m}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])},o]}var Ve=t.createContext(void 0);function We(e){const n=t.useContext(Ve);return e||n||"ltr"}var ze="rovingFocusGroup.onEntryFocus",Be={bubbles:!1,cancelable:!0},$e="RovingFocusGroup",[Ke,Ue,qe]=He($e),[Ge,Xe]=l($e,[qe]),[Ye,Ze]=Ge($e),Qe=t.forwardRef((e,t)=>s.jsx(Ke.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Ke.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Je,{...e,ref:t})})}));Qe.displayName=$e;var Je=t.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:l,orientation:c,loop:d=!1,dir:u,currentTabStopId:f,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:m,onEntryFocus:x,preventScrollOnEntryFocus:g=!1,...v}=e,y=t.useRef(null),w=r(n,y),b=We(u),[j,N]=o({prop:f,defaultProp:h??null,onChange:m,caller:$e}),[S,C]=t.useState(!1),k=p(x),R=Ue(l),T=t.useRef(!1),[A,D]=t.useState(0);return t.useEffect(()=>{const e=y.current;if(e)return e.addEventListener(ze,k),()=>e.removeEventListener(ze,k)},[k]),s.jsx(Ye,{scope:l,orientation:c,dir:b,loop:d,currentTabStopId:j,onItemFocus:t.useCallback(e=>N(e),[N]),onItemShiftTab:t.useCallback(()=>C(!0),[]),onFocusableItemAdd:t.useCallback(()=>D(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>D(e=>e-1),[]),children:s.jsx(a.div,{tabIndex:S||0===A?-1:0,"data-orientation":c,...v,ref:w,style:{outline:"none",...e.style},onMouseDown:i(e.onMouseDown,()=>{T.current=!0}),onFocus:i(e.onFocus,e=>{const t=!T.current;if(e.target===e.currentTarget&&t&&!S){const t=new CustomEvent(ze,Be);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=R().filter(e=>e.focusable);rt([e.find(e=>e.active),e.find(e=>e.id===j),...e].filter(Boolean).map(e=>e.ref.current),g)}}T.current=!1}),onBlur:i(e.onBlur,()=>C(!1))})})}),et="RovingFocusGroupItem",tt=t.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:l=!1,tabStopId:c,children:d,...u}=e,p=f(),h=c||p,m=Ze(et,r),x=m.currentTabStopId===h,g=Ue(r),{onFocusableItemAdd:v,onFocusableItemRemove:y,currentTabStopId:w}=m;return t.useEffect(()=>{if(o)return v(),()=>y()},[o,v,y]),s.jsx(Ke.ItemSlot,{scope:r,id:h,focusable:o,active:l,children:s.jsx(a.span,{tabIndex:x?0:-1,"data-orientation":m.orientation,...u,ref:n,onMouseDown:i(e.onMouseDown,e=>{o?m.onItemFocus(h):e.preventDefault()}),onFocus:i(e.onFocus,()=>m.onItemFocus(h)),onKeyDown:i(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void m.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const r=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)?void 0:nt[r]}(e,m.orientation,m.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let o=g().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)o.reverse();else if("prev"===t||"next"===t){"prev"===t&&o.reverse();const s=o.indexOf(e.currentTarget);o=m.loop?(r=s+1,(n=o).map((e,t)=>n[(r+t)%n.length])):o.slice(s+1)}setTimeout(()=>rt(o))}var n,r}),children:"function"==typeof d?d({isCurrentTabStop:x,hasTabStop:null!=w}):d})})});tt.displayName=et;var nt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function rt(e,t=!1){const n=document.activeElement;for(const r of e){if(r===n)return;if(r.focus({preventScroll:t}),document.activeElement!==n)return}}var ot=Qe,st=tt,at="Tabs",[it]=l(at,[Xe]),lt=Xe(),[ct,dt]=it(at),ut=t.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:l,orientation:c="horizontal",dir:d,activationMode:u="automatic",...p}=e,h=We(d),[m,x]=o({prop:r,onChange:i,defaultProp:l??"",caller:at});return s.jsx(ct,{scope:n,baseId:f(),value:m,onValueChange:x,orientation:c,dir:h,activationMode:u,children:s.jsx(a.div,{dir:h,"data-orientation":c,...p,ref:t})})});ut.displayName=at;var ft="TabsList",pt=t.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=dt(ft,n),l=lt(n);return s.jsx(ot,{asChild:!0,...l,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(a.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});pt.displayName=ft;var ht="TabsTrigger",mt=t.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...l}=e,c=dt(ht,n),d=lt(n),u=vt(c.baseId,r),f=yt(c.baseId,r),p=r===c.value;return s.jsx(st,{asChild:!0,...d,focusable:!o,active:p,children:s.jsx(a.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...l,ref:t,onMouseDown:i(e.onMouseDown,e=>{o||0!==e.button||!1!==e.ctrlKey?e.preventDefault():c.onValueChange(r)}),onKeyDown:i(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&c.onValueChange(r)}),onFocus:i(e.onFocus,()=>{const e="manual"!==c.activationMode;p||o||!e||c.onValueChange(r)})})})});mt.displayName=ht;var xt="TabsContent",gt=t.forwardRef((e,n)=>{const{__scopeTabs:r,value:o,forceMount:i,children:l,...c}=e,d=dt(xt,r),u=vt(d.baseId,o),f=yt(d.baseId,o),p=o===d.value,m=t.useRef(p);return t.useEffect(()=>{const e=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(e)},[]),s.jsx(h,{present:i||p,children:({present:t})=>s.jsx(a.div,{"data-state":p?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":u,hidden:!t,id:f,tabIndex:0,...c,ref:n,style:{...e.style,animationDuration:m.current?"0s":void 0},children:t&&l})})});function vt(e,t){return`${e}-trigger-${t}`}function yt(e,t){return`${e}-content-${t}`}gt.displayName=xt;var wt=pt,bt=mt,jt=gt;const Nt=ut,St=t.forwardRef(({className:e,...t},n)=>s.jsx(wt,{ref:n,className:c("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));St.displayName=wt.displayName;const Ct=t.forwardRef(({className:e,...t},n)=>s.jsx(bt,{ref:n,className:c("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}));Ct.displayName=bt.displayName;const kt=t.forwardRef(({className:e,...t},n)=>s.jsx(jt,{ref:n,className:c("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));function Rt(e,[t,n]){return Math.min(n,Math.max(t,e))}kt.displayName=jt.displayName;const Tt=["top","right","bottom","left"],At=Math.min,Dt=Math.max,Et=Math.round,Pt=Math.floor,_t=e=>({x:e,y:e}),Ot={left:"right",right:"left",bottom:"top",top:"bottom"};function It(e,t,n){return Dt(e,At(t,n))}function Mt(e,t){return"function"==typeof e?e(t):e}function Lt(e){return e.split("-")[0]}function Ft(e){return e.split("-")[1]}function Ht(e){return"x"===e?"y":"x"}function Vt(e){return"y"===e?"height":"width"}function Wt(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function zt(e){return Ht(Wt(e))}function Bt(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const $t=["left","right"],Kt=["right","left"],Ut=["top","bottom"],qt=["bottom","top"];function Gt(e,t,n,r){const o=Ft(e);let s=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Kt:$t:t?$t:Kt;case"left":case"right":return t?Ut:qt;default:return[]}}(Lt(e),"start"===n,r);return o&&(s=s.map(e=>e+"-"+o),t&&(s=s.concat(s.map(Bt)))),s}function Xt(e){const t=Lt(e);return Ot[t]+e.slice(t.length)}function Yt(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Zt(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Qt(e,t,n){let{reference:r,floating:o}=e;const s=Wt(t),a=zt(t),i=Vt(a),l=Lt(t),c="y"===s,d=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,f=r[i]/2-o[i]/2;let p;switch(l){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(Ft(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1)}return p}async function Jt(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:s,rects:a,elements:i,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Mt(t,e),h=Yt(p),m=i[f?"floating"===u?"reference":"floating":u],x=Zt(await s.getClippingRect({element:null==(n=await(null==s.isElement?void 0:s.isElement(m)))||n?m:m.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(i.floating)),boundary:c,rootBoundary:d,strategy:l})),g="floating"===u?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,v=await(null==s.getOffsetParent?void 0:s.getOffsetParent(i.floating)),y=await(null==s.isElement?void 0:s.isElement(v))&&await(null==s.getScale?void 0:s.getScale(v))||{x:1,y:1},w=Zt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:g,offsetParent:v,strategy:l}):g);return{top:(x.top-w.top+h.top)/y.y,bottom:(w.bottom-x.bottom+h.bottom)/y.y,left:(x.left-w.left+h.left)/y.x,right:(w.right-x.right+h.right)/y.x}}function en(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function tn(e){return Tt.some(t=>e[t]>=0)}const nn=new Set(["left","top"]);function rn(){return"undefined"!=typeof window}function on(e){return ln(e)?(e.nodeName||"").toLowerCase():"#document"}function sn(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function an(e){var t;return null==(t=(ln(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function ln(e){return!!rn()&&(e instanceof Node||e instanceof sn(e).Node)}function cn(e){return!!rn()&&(e instanceof Element||e instanceof sn(e).Element)}function dn(e){return!!rn()&&(e instanceof HTMLElement||e instanceof sn(e).HTMLElement)}function un(e){return!(!rn()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof sn(e).ShadowRoot)}function fn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=jn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==o&&"contents"!==o}function pn(e){return/^(table|td|th)$/.test(on(e))}function hn(e){try{if(e.matches(":popover-open"))return!0}catch(t){}try{return e.matches(":modal")}catch(t){return!1}}const mn=/transform|translate|scale|rotate|perspective|filter/,xn=/paint|layout|strict|content/,gn=e=>!!e&&"none"!==e;let vn;function yn(e){const t=cn(e)?jn(e):e;return gn(t.transform)||gn(t.translate)||gn(t.scale)||gn(t.rotate)||gn(t.perspective)||!wn()&&(gn(t.backdropFilter)||gn(t.filter))||mn.test(t.willChange||"")||xn.test(t.contain||"")}function wn(){return null==vn&&(vn="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),vn}function bn(e){return/^(html|body|#document)$/.test(on(e))}function jn(e){return sn(e).getComputedStyle(e)}function Nn(e){return cn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Sn(e){if("html"===on(e))return e;const t=e.assignedSlot||e.parentNode||un(e)&&e.host||an(e);return un(t)?t.host:t}function Cn(e){const t=Sn(e);return bn(t)?e.ownerDocument?e.ownerDocument.body:e.body:dn(t)&&fn(t)?t:Cn(t)}function kn(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Cn(e),s=o===(null==(r=e.ownerDocument)?void 0:r.body),a=sn(o);if(s){const e=Rn(a);return t.concat(a,a.visualViewport||[],fn(o)?o:[],e&&n?kn(e):[])}return t.concat(o,kn(o,[],n))}function Rn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Tn(e){const t=jn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=dn(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,i=Et(n)!==s||Et(r)!==a;return i&&(n=s,r=a),{width:n,height:r,$:i}}function An(e){return cn(e)?e:e.contextElement}function Dn(e){const t=An(e);if(!dn(t))return _t(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Tn(t);let a=(s?Et(n.width):n.width)/r,i=(s?Et(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),i&&Number.isFinite(i)||(i=1),{x:a,y:i}}const En=_t(0);function Pn(e){const t=sn(e);return wn()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:En}function _n(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),s=An(e);let a=_t(1);t&&(r?cn(r)&&(a=Dn(r)):a=Dn(e));const i=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==sn(e))&&t}(s,n,r)?Pn(s):_t(0);let l=(o.left+i.x)/a.x,c=(o.top+i.y)/a.y,d=o.width/a.x,u=o.height/a.y;if(s){const e=sn(s),t=r&&cn(r)?sn(r):r;let n=e,o=Rn(n);for(;o&&r&&t!==n;){const e=Dn(o),t=o.getBoundingClientRect(),r=jn(o),s=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=s,c+=a,n=sn(o),o=Rn(n)}}return Zt({width:d,height:u,x:l,y:c})}function On(e,t){const n=Nn(e).scrollLeft;return t?t.left+n:_n(an(e)).left+n}function In(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-On(e,n),y:n.top+t.scrollTop}}function Mn(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=sn(e),r=an(e),o=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,i=0,l=0;if(o){s=o.width,a=o.height;const e=wn();(!e||e&&"fixed"===t)&&(i=o.offsetLeft,l=o.offsetTop)}const c=On(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,a=Math.abs(r.clientWidth-t.clientWidth-o);a<=25&&(s-=a)}else c<=25&&(s+=c);return{width:s,height:a,x:i,y:l}}(e,n);else if("document"===t)r=function(e){const t=an(e),n=Nn(e),r=e.ownerDocument.body,o=Dt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Dt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+On(e);const i=-n.scrollTop;return"rtl"===jn(r).direction&&(a+=Dt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:a,y:i}}(an(e));else if(cn(t))r=function(e,t){const n=_n(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=dn(e)?Dn(e):_t(1);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:o*s.x,y:r*s.y}}(t,n);else{const n=Pn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Zt(r)}function Ln(e,t){const n=Sn(e);return!(n===t||!cn(n)||bn(n))&&("fixed"===jn(n).position||Ln(n,t))}function Fn(e,t,n){const r=dn(t),o=an(t),s="fixed"===n,a=_n(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const l=_t(0);function c(){l.x=On(o)}if(r||!r&&!s)if(("body"!==on(t)||fn(o))&&(i=Nn(t)),r){const e=_n(t,!0,s,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&c();s&&!r&&o&&c();const d=!o||r||s?_t(0):In(o,i);return{x:a.left+i.scrollLeft-l.x-d.x,y:a.top+i.scrollTop-l.y-d.y,width:a.width,height:a.height}}function Hn(e){return"static"===jn(e).position}function Vn(e,t){if(!dn(e)||"fixed"===jn(e).position)return null;if(t)return t(e);let n=e.offsetParent;return an(e)===n&&(n=n.ownerDocument.body),n}function Wn(e,t){const n=sn(e);if(hn(e))return n;if(!dn(e)){let t=Sn(e);for(;t&&!bn(t);){if(cn(t)&&!Hn(t))return t;t=Sn(t)}return n}let r=Vn(e,t);for(;r&&pn(r)&&Hn(r);)r=Vn(r,t);return r&&bn(r)&&Hn(r)&&!yn(r)?n:r||function(e){let t=Sn(e);for(;dn(t)&&!bn(t);){if(yn(t))return t;if(hn(t))return null;t=Sn(t)}return null}(e)||n}const zn={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s="fixed"===o,a=an(r),i=!!t&&hn(t.floating);if(r===a||i&&s)return n;let l={scrollLeft:0,scrollTop:0},c=_t(1);const d=_t(0),u=dn(r);if((u||!u&&!s)&&(("body"!==on(r)||fn(a))&&(l=Nn(r)),u)){const e=_n(r);c=Dn(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}const f=!a||u||s?_t(0):In(a,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:n.y*c.y-l.scrollTop*c.y+d.y+f.y}},getDocumentElement:an,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[..."clippingAncestors"===n?hn(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=kn(e,[],!1).filter(e=>cn(e)&&"body"!==on(e)),o=null;const s="fixed"===jn(e).position;let a=s?Sn(e):e;for(;cn(a)&&!bn(a);){const t=jn(a),n=yn(a);n||"fixed"!==t.position||(o=null),(s?!n&&!o:!n&&"static"===t.position&&o&&("absolute"===o.position||"fixed"===o.position)||fn(a)&&!n&&Ln(e,a))?r=r.filter(e=>e!==a):o=t,a=Sn(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=Mn(t,s[0],o);let i=a.top,l=a.right,c=a.bottom,d=a.left;for(let u=1;u<s.length;u++){const e=Mn(t,s[u],o);i=Dt(e.top,i),l=At(e.right,l),c=At(e.bottom,c),d=Dt(e.left,d)}return{width:l-d,height:c-i,x:d,y:i}},getOffsetParent:Wn,getElementRects:async function(e){const t=this.getOffsetParent||Wn,n=this.getDimensions,r=await n(e.floating);return{reference:Fn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Tn(e);return{width:t,height:n}},getScale:Dn,isElement:cn,isRTL:function(e){return"rtl"===jn(e).direction}};function Bn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $n(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=An(e),d=o||s?[...c?kn(c):[],...t?kn(t):[]]:[];d.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),s&&e.addEventListener("resize",n)});const u=c&&i?function(e,t){let n,r=null;const o=an(e);function s(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(i,l){void 0===i&&(i=!1),void 0===l&&(l=1),s();const c=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=c;if(i||t(),!f||!p)return;const h={rootMargin:-Pt(u)+"px "+-Pt(o.clientWidth-(d+f))+"px "+-Pt(o.clientHeight-(u+p))+"px "+-Pt(d)+"px",threshold:Dt(0,At(1,l))||1};let m=!0;function x(t){const r=t[0].intersectionRatio;if(r!==l){if(!m)return a();r?a(!1,r):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==r||Bn(c,e.getBoundingClientRect())||a(),m=!1}try{r=new IntersectionObserver(x,{...h,root:o.ownerDocument})}catch(g){r=new IntersectionObserver(x,h)}r.observe(e)}(!0),s}(c,n):null;let f,p=-1,h=null;a&&(h=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),c&&!l&&h.observe(c),t&&h.observe(t));let m=l?_n(e):null;return l&&function t(){const r=_n(e);m&&!Bn(m,r)&&n();m=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach(e=>{o&&e.removeEventListener("scroll",n),s&&e.removeEventListener("resize",n)}),null==u||u(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(f)}}const Kn=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:a,middlewareData:i}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,s=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=Lt(n),i=Ft(n),l="y"===Wt(n),c=nn.has(a)?-1:1,d=s&&l?-1:1,u=Mt(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&"number"==typeof h&&(p="end"===i?-1*h:h),l?{x:p*d,y:f*c}:{x:f*c,y:p*d}}(t,e);return a===(null==(n=i.offset)?void 0:n.placement)&&null!=(r=i.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:a}}}}},Un=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=Mt(e,t),d={x:n,y:r},u=await s.detectOverflow(t,c),f=Wt(Lt(o)),p=Ht(f);let h=d[p],m=d[f];if(a){const e="y"===p?"bottom":"right";h=It(h+u["y"===p?"top":"left"],h,h-u[e])}if(i){const e="y"===f?"bottom":"right";m=It(m+u["y"===f?"top":"left"],m,m-u[e])}const x=l.fn({...t,[p]:h,[f]:m});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[p]:a,[f]:i}}}}}},qn=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:a,initialPlacement:i,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...x}=Mt(e,t);if(null!=(n=s.arrow)&&n.alignmentOffset)return{};const g=Lt(o),v=Wt(i),y=Lt(i)===i,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),b=f||(y||!m?[Xt(i)]:function(e){const t=Xt(e);return[Bt(e),t,Bt(t)]}(i)),j="none"!==h;!f&&j&&b.push(...Gt(i,m,h,w));const N=[i,...b],S=await l.detectOverflow(t,x),C=[];let k=(null==(r=s.flip)?void 0:r.overflows)||[];if(d&&C.push(S[g]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=Ft(e),o=zt(e),s=Vt(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Xt(a)),[a,Xt(a)]}(o,a,w);C.push(S[e[0]],S[e[1]])}if(k=[...k,{placement:o,overflows:C}],!C.every(e=>e<=0)){var R,T;const e=((null==(R=s.flip)?void 0:R.index)||0)+1,t=N[e];if(t){if(!("alignment"===u&&v!==Wt(t))||k.every(e=>Wt(e.placement)!==v||e.overflows[0]>0))return{data:{index:e,overflows:k},reset:{placement:t}}}let n=null==(T=k.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:T.placement;if(!n)switch(p){case"bestFit":{var A;const e=null==(A=k.filter(e=>{if(j){const t=Wt(e.placement);return t===v||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:A[0];e&&(n=e);break}case"initialPlacement":n=i}if(o!==n)return{reset:{placement:n}}}return{}}}},Gn=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:a,elements:i}=t,{apply:l=()=>{},...c}=Mt(e,t),d=await a.detectOverflow(t,c),u=Lt(o),f=Ft(o),p="y"===Wt(o),{width:h,height:m}=s.floating;let x,g;"top"===u||"bottom"===u?(x=u,g=f===(await(null==a.isRTL?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(g=u,x="end"===f?"top":"bottom");const v=m-d.top-d.bottom,y=h-d.left-d.right,w=At(m-d[x],v),b=At(h-d[g],y),j=!t.middlewareData.shift;let N=w,S=b;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(S=y),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(N=v),j&&!f){const e=Dt(d.left,0),t=Dt(d.right,0),n=Dt(d.top,0),r=Dt(d.bottom,0);p?S=h-2*(0!==e||0!==t?e+t:Dt(d.left,d.right)):N=m-2*(0!==n||0!==r?n+r:Dt(d.top,d.bottom))}await l({...t,availableWidth:S,availableHeight:N});const C=await a.getDimensions(i.floating);return h!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}},Xn=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Mt(e,t);switch(o){case"referenceHidden":{const e=en(await r.detectOverflow(t,{...s,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:tn(e)}}}case"escaped":{const e=en(await r.detectOverflow(t,{...s,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:tn(e)}}}default:return{}}}}},Yn=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:a,elements:i,middlewareData:l}=t,{element:c,padding:d=0}=Mt(e,t)||{};if(null==c)return{};const u=Yt(d),f={x:n,y:r},p=zt(o),h=Vt(p),m=await a.getDimensions(c),x="y"===p,g=x?"top":"left",v=x?"bottom":"right",y=x?"clientHeight":"clientWidth",w=s.reference[h]+s.reference[p]-f[p]-s.floating[h],b=f[p]-s.reference[p],j=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let N=j?j[y]:0;N&&await(null==a.isElement?void 0:a.isElement(j))||(N=i.floating[y]||s.floating[h]);const S=w/2-b/2,C=N/2-m[h]/2-1,k=At(u[g],C),R=At(u[v],C),T=k,A=N-m[h]-R,D=N/2-m[h]/2+S,E=It(T,D,A),P=!l.arrow&&null!=Ft(o)&&D!==E&&s.reference[h]/2-(D<T?k:R)-m[h]/2<0,_=P?D<T?D-T:D-A:0;return{[p]:f[p]+_,data:{[p]:E,centerOffset:D-E-_,...P&&{alignmentOffset:_}},reset:P}}}),Zn=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:l=!0,crossAxis:c=!0}=Mt(e,t),d={x:n,y:r},u=Wt(o),f=Ht(u);let p=d[f],h=d[u];const m=Mt(i,t),x="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const e="y"===f?"height":"width",t=s.reference[f]-s.floating[e]+x.mainAxis,n=s.reference[f]+s.reference[e]-x.mainAxis;p<t?p=t:p>n&&(p=n)}if(c){var g,v;const e="y"===f?"width":"height",t=nn.has(Lt(o)),n=s.reference[u]-s.floating[e]+(t&&(null==(g=a.offset)?void 0:g[u])||0)+(t?0:x.crossAxis),r=s.reference[u]+s.reference[e]+(t?0:(null==(v=a.offset)?void 0:v[u])||0)-(t?x.crossAxis:0);h<n?h=n:h>r&&(h=r)}return{[f]:p,[u]:h}}}},Qn=(e,t,n)=>{const r=new Map,o={platform:zn,...n},s={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:Jt},l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=Qt(c,r,l),f=r,p=0;const h={};for(let m=0;m<s.length;m++){const n=s[m];if(!n)continue;const{name:x,fn:g}=n,{x:v,y:y,data:w,reset:b}=await g({x:d,y:u,initialPlacement:r,placement:f,strategy:o,middlewareData:h,rects:c,platform:i,elements:{reference:e,floating:t}});d=null!=v?v:d,u=null!=y?y:u,h[x]={...h[x],...w},b&&p<50&&(p++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:d,y:u}=Qt(c,f,l))),m=-1)}return{x:d,y:u,placement:f,strategy:o,middlewareData:h}})(e,t,{...o,platform:s})};var Jn="undefined"!=typeof document?t.useLayoutEffect:function(){};function er(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!er(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!er(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function tr(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function nr(e,t){const n=tr(e);return Math.round(t*n)/n}function rr(e){const n=t.useRef(e);return Jn(()=>{n.current=e}),n}const or=(e,t)=>{const n=Kn(e);return{name:n.name,fn:n.fn,options:[e,t]}},sr=(e,t)=>{const n=Un(e);return{name:n.name,fn:n.fn,options:[e,t]}},ar=(e,t)=>{const n=qn(e);return{name:n.name,fn:n.fn,options:[e,t]}},ir=(e,t)=>{const n=Gn(e);return{name:n.name,fn:n.fn,options:[e,t]}},lr=(e,t)=>{const n=Xn(e);return{name:n.name,fn:n.fn,options:[e,t]}},cr=(e,t)=>{const n=(e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?Yn({element:n.current,padding:r}).fn(t):{}:n?Yn({element:n,padding:r}).fn(t):{};var o}}))(e);return{name:n.name,fn:n.fn,options:[e,t]}};var dr=t.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return s.jsx(a.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});dr.displayName="Arrow";var ur=dr,fr="Popper",[pr,hr]=l(fr),[mr,xr]=pr(fr),gr=e=>{const{__scopePopper:n,children:r}=e,[o,a]=t.useState(null);return s.jsx(mr,{scope:n,anchor:o,onAnchorChange:a,children:r})};gr.displayName=fr;var vr="PopperAnchor",yr=t.forwardRef((e,n)=>{const{__scopePopper:o,virtualRef:i,...l}=e,c=xr(vr,o),d=t.useRef(null),u=r(n,d),f=t.useRef(null);return t.useEffect(()=>{const e=f.current;f.current=(null==i?void 0:i.current)||d.current,e!==f.current&&c.onAnchorChange(f.current)}),i?null:s.jsx(a.div,{...l,ref:u})});yr.displayName=vr;var wr="PopperContent",[br,jr]=pr(wr),Nr=t.forwardRef((e,o)=>{var i,l,c,d,u,f;const{__scopePopper:h,side:x="bottom",sideOffset:g=0,align:v="center",alignOffset:y=0,arrowPadding:w=0,avoidCollisions:b=!0,collisionBoundary:j=[],collisionPadding:N=0,sticky:S="partial",hideWhenDetached:C=!1,updatePositionStrategy:k="optimized",onPlaced:R,...T}=e,A=xr(wr,h),[D,E]=t.useState(null),P=r(o,e=>E(e)),[_,O]=t.useState(null),I=je(_),M=(null==I?void 0:I.width)??0,L=(null==I?void 0:I.height)??0,F=x+("center"!==v?"-"+v:""),H="number"==typeof N?N:{top:0,right:0,bottom:0,left:0,...N},V=Array.isArray(j)?j:[j],W=V.length>0,z={padding:H,boundary:V.filter(Rr),altBoundary:W},{refs:B,floatingStyles:$,placement:K,isPositioned:U,middlewareData:q}=function(e){void 0===e&&(e={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:s,elements:{reference:a,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,f]=t.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[p,h]=t.useState(o);er(p,o)||h(o);const[x,g]=t.useState(null),[v,y]=t.useState(null),w=t.useCallback(e=>{e!==S.current&&(S.current=e,g(e))},[]),b=t.useCallback(e=>{e!==C.current&&(C.current=e,y(e))},[]),j=a||x,N=i||v,S=t.useRef(null),C=t.useRef(null),k=t.useRef(u),R=null!=c,T=rr(c),A=rr(s),D=rr(d),E=t.useCallback(()=>{if(!S.current||!C.current)return;const e={placement:n,strategy:r,middleware:p};A.current&&(e.platform=A.current),Qn(S.current,C.current,e).then(e=>{const t={...e,isPositioned:!1!==D.current};P.current&&!er(k.current,t)&&(k.current=t,m.flushSync(()=>{f(t)}))})},[p,n,r,A,D]);Jn(()=>{!1===d&&k.current.isPositioned&&(k.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[d]);const P=t.useRef(!1);Jn(()=>(P.current=!0,()=>{P.current=!1}),[]),Jn(()=>{if(j&&(S.current=j),N&&(C.current=N),j&&N){if(T.current)return T.current(j,N,E);E()}},[j,N,E,T,R]);const _=t.useMemo(()=>({reference:S,floating:C,setReference:w,setFloating:b}),[w,b]),O=t.useMemo(()=>({reference:j,floating:N}),[j,N]),I=t.useMemo(()=>{const e={position:r,left:0,top:0};if(!O.floating)return e;const t=nr(O.floating,u.x),n=nr(O.floating,u.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...tr(O.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,O.floating,u.x,u.y]);return t.useMemo(()=>({...u,update:E,refs:_,elements:O,floatingStyles:I}),[u,E,_,O,I])}({strategy:"fixed",placement:F,whileElementsMounted:(...e)=>$n(...e,{animationFrame:"always"===k}),elements:{reference:A.anchor},middleware:[or({mainAxis:g+L,alignmentAxis:y}),b&&sr({mainAxis:!0,crossAxis:!1,limiter:"partial"===S?{fn:Zn(G).fn,options:[G,X]}:void 0,...z}),b&&ar({...z}),ir({...z,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:s}=t.reference,a=e.floating.style;a.setProperty("--radix-popper-available-width",`${n}px`),a.setProperty("--radix-popper-available-height",`${r}px`),a.setProperty("--radix-popper-anchor-width",`${o}px`),a.setProperty("--radix-popper-anchor-height",`${s}px`)}}),_&&cr({element:_,padding:w}),Tr({arrowWidth:M,arrowHeight:L}),C&&lr({strategy:"referenceHidden",...z})]});var G,X;const[Y,Z]=Ar(K),Q=p(R);n(()=>{U&&(null==Q||Q())},[U,Q]);const J=null==(i=q.arrow)?void 0:i.x,ee=null==(l=q.arrow)?void 0:l.y,te=0!==(null==(c=q.arrow)?void 0:c.centerOffset),[ne,re]=t.useState();return n(()=>{D&&re(window.getComputedStyle(D).zIndex)},[D]),s.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:U?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[null==(d=q.transformOrigin)?void 0:d.x,null==(u=q.transformOrigin)?void 0:u.y].join(" "),...(null==(f=q.hide)?void 0:f.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(br,{scope:h,placedSide:Y,onArrowChange:O,arrowX:J,arrowY:ee,shouldHideArrow:te,children:s.jsx(a.div,{"data-side":Y,"data-align":Z,...T,ref:P,style:{...T.style,animation:U?void 0:"none"}})})})});Nr.displayName=wr;var Sr="PopperArrow",Cr={top:"bottom",right:"left",bottom:"top",left:"right"},kr=t.forwardRef(function(e,t){const{__scopePopper:n,...r}=e,o=jr(Sr,n),a=Cr[o.placedSide];return s.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:s.jsx(ur,{...r,ref:t,style:{...r.style,display:"block"}})})});function Rr(e){return null!==e}kr.displayName=Sr;var Tr=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o;const{placement:s,rects:a,middlewareData:i}=t,l=0!==(null==(n=i.arrow)?void 0:n.centerOffset),c=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[u,f]=Ar(s),p={start:"0%",center:"50%",end:"100%"}[f],h=((null==(r=i.arrow)?void 0:r.x)??0)+c/2,m=((null==(o=i.arrow)?void 0:o.y)??0)+d/2;let x="",g="";return"bottom"===u?(x=l?p:`${h}px`,g=-d+"px"):"top"===u?(x=l?p:`${h}px`,g=`${a.floating.height+d}px`):"right"===u?(x=-d+"px",g=l?p:`${m}px`):"left"===u&&(x=`${a.floating.width+d}px`,g=l?p:`${m}px`),{data:{x:x,y:g}}}});function Ar(e){const[t,n="center"]=e.split("-");return[t,n]}var Dr=gr,Er=yr,Pr=Nr,_r=kr;function Or(e){const n=Ir(e),r=t.forwardRef((e,r)=>{const{children:o,...a}=e,i=t.Children.toArray(o),l=i.find(Lr);if(l){const e=l.props.children,o=i.map(n=>n===l?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:n);return s.jsx(n,{...a,ref:r,children:t.isValidElement(e)?t.cloneElement(e,void 0,o):null})}return s.jsx(n,{...a,ref:r,children:o})});return r.displayName=`${e}.Slot`,r}function Ir(e){const n=t.forwardRef((e,n)=>{const{children:r,...o}=e;if(t.isValidElement(r)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{const t=s(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...s}:"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}(o,r.props);return r.type!==t.Fragment&&(s.ref=n?d(n,e):e),t.cloneElement(r,s)}return t.Children.count(r)>1?t.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var Mr=Symbol("radix.slottable");function Lr(e){return t.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Mr}var Fr=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"});t.forwardRef((e,t)=>s.jsx(a.span,{...e,ref:t,style:{...Fr,...e.style}})).displayName="VisuallyHidden";var Hr=[" ","Enter","ArrowUp","ArrowDown"],Vr=[" ","Enter"],Wr="Select",[zr,Br,$r]=He(Wr),[Kr]=l(Wr,[$r,hr]),Ur=hr(),[qr,Gr]=Kr(Wr),[Xr,Yr]=Kr(Wr),Zr=e=>{const{__scopeSelect:n,children:r,open:a,defaultOpen:i,onOpenChange:l,value:c,defaultValue:d,onValueChange:u,dir:p,name:h,autoComplete:m,disabled:x,required:g,form:v}=e,y=Ur(n),[w,b]=t.useState(null),[j,N]=t.useState(null),[S,C]=t.useState(!1),k=We(p),[R,T]=o({prop:a,defaultProp:i??!1,onChange:l,caller:Wr}),[A,D]=o({prop:c,defaultProp:d,onChange:u,caller:Wr}),E=t.useRef(null),P=!w||(v||!!w.closest("form")),[_,O]=t.useState(new Set),I=Array.from(_).map(e=>e.props.value).join(";");return s.jsx(Dr,{...y,children:s.jsxs(qr,{required:g,scope:n,trigger:w,onTriggerChange:b,valueNode:j,onValueNodeChange:N,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:f(),value:A,onValueChange:D,open:R,onOpenChange:T,dir:k,triggerPointerDownPosRef:E,disabled:x,children:[s.jsx(zr.Provider,{scope:n,children:s.jsx(Xr,{scope:e.__scopeSelect,onNativeOptionAdd:t.useCallback(e=>{O(t=>new Set(t).add(e))},[]),onNativeOptionRemove:t.useCallback(e=>{O(t=>{const n=new Set(t);return n.delete(e),n})},[]),children:r})}),P?s.jsxs(Fo,{"aria-hidden":!0,required:g,tabIndex:-1,name:h,autoComplete:m,value:A,onChange:e=>D(e.target.value),disabled:x,form:v,children:[void 0===A?s.jsx("option",{value:""}):null,Array.from(_)]},I):null]})})};Zr.displayName=Wr;var Qr="SelectTrigger",Jr=t.forwardRef((e,n)=>{const{__scopeSelect:o,disabled:l=!1,...c}=e,d=Ur(o),u=Gr(Qr,o),f=u.disabled||l,p=r(n,u.onTriggerChange),h=Br(o),m=t.useRef("touch"),[x,g,v]=Vo(e=>{const t=h().filter(e=>!e.disabled),n=t.find(e=>e.value===u.value),r=Wo(t,e,n);void 0!==r&&u.onValueChange(r.value)}),y=e=>{f||(u.onOpenChange(!0),v()),e&&(u.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return s.jsx(Er,{asChild:!0,...d,children:s.jsx(a.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:f,"data-disabled":f?"":void 0,"data-placeholder":Ho(u.value)?"":void 0,...c,ref:p,onClick:i(c.onClick,e=>{e.currentTarget.focus(),"mouse"!==m.current&&y(e)}),onPointerDown:i(c.onPointerDown,e=>{m.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(y(e),e.preventDefault())}),onKeyDown:i(c.onKeyDown,e=>{const t=""!==x.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||g(e.key),t&&" "===e.key||Hr.includes(e.key)&&(y(),e.preventDefault())})})})});Jr.displayName=Qr;var eo="SelectValue",to=t.forwardRef((e,t)=>{const{__scopeSelect:o,className:i,style:l,children:c,placeholder:d="",...u}=e,f=Gr(eo,o),{onValueNodeHasChildrenChange:p}=f,h=void 0!==c,m=r(t,f.onValueNodeChange);return n(()=>{p(h)},[p,h]),s.jsx(a.span,{...u,ref:m,style:{pointerEvents:"none"},children:Ho(f.value)?s.jsx(s.Fragment,{children:d}):c})});to.displayName=eo;var no=t.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return s.jsx(a.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});no.displayName="SelectIcon";var ro=e=>s.jsx(x,{asChild:!0,...e});ro.displayName="SelectPortal";var oo="SelectContent",so=t.forwardRef((e,r)=>{const o=Gr(oo,e.__scopeSelect),[a,i]=t.useState();if(n(()=>{i(new DocumentFragment)},[]),!o.open){const t=a;return t?m.createPortal(s.jsx(io,{scope:e.__scopeSelect,children:s.jsx(zr.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),t):null}return s.jsx(uo,{...e,ref:r})});so.displayName=oo;var ao=10,[io,lo]=Kr(oo),co=Or("SelectContent.RemoveScroll"),uo=t.forwardRef((e,n)=>{const{__scopeSelect:o,position:a="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,side:u,sideOffset:f,align:p,alignOffset:h,arrowPadding:m,collisionBoundary:x,collisionPadding:j,sticky:N,hideWhenDetached:S,avoidCollisions:C,...k}=e,R=Gr(oo,o),[T,A]=t.useState(null),[D,E]=t.useState(null),P=r(n,e=>A(e)),[_,O]=t.useState(null),[I,M]=t.useState(null),L=Br(o),[F,H]=t.useState(!1),V=t.useRef(!1);t.useEffect(()=>{if(T)return g(T)},[T]),v();const W=t.useCallback(e=>{const[t,...n]=L().map(e=>e.ref.current),[r]=n.slice(-1),o=document.activeElement;for(const s of e){if(s===o)return;if(null==s||s.scrollIntoView({block:"nearest"}),s===t&&D&&(D.scrollTop=0),s===r&&D&&(D.scrollTop=D.scrollHeight),null==s||s.focus(),document.activeElement!==o)return}},[L,D]),z=t.useCallback(()=>W([_,T]),[W,_,T]);t.useEffect(()=>{F&&z()},[F,z]);const{onOpenChange:B,triggerPointerDownPosRef:$}=R;t.useEffect(()=>{if(T){let e={x:0,y:0};const t=t=>{var n,r;e={x:Math.abs(Math.round(t.pageX)-((null==(n=$.current)?void 0:n.x)??0)),y:Math.abs(Math.round(t.pageY)-((null==(r=$.current)?void 0:r.y)??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():T.contains(n.target)||B(!1),document.removeEventListener("pointermove",t),$.current=null};return null!==$.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[T,B,$]),t.useEffect(()=>{const e=()=>B(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[B]);const[K,U]=Vo(e=>{const t=L().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=Wo(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),q=t.useCallback((e,t,n)=>{const r=!V.current&&!n;(void 0!==R.value&&R.value===t||r)&&(O(e),r&&(V.current=!0))},[R.value]),G=t.useCallback(()=>null==T?void 0:T.focus(),[T]),X=t.useCallback((e,t,n)=>{const r=!V.current&&!n;(void 0!==R.value&&R.value===t||r)&&M(e)},[R.value]),Y="popper"===a?po:fo,Z=Y===po?{side:u,sideOffset:f,align:p,alignOffset:h,arrowPadding:m,collisionBoundary:x,collisionPadding:j,sticky:N,hideWhenDetached:S,avoidCollisions:C}:{};return s.jsx(io,{scope:o,content:T,viewport:D,onViewportChange:E,itemRefCallback:q,selectedItem:_,onItemLeave:G,itemTextRefCallback:X,focusSelectedItem:z,selectedItemText:I,position:a,isPositioned:F,searchRef:K,children:s.jsx(y,{as:co,allowPinchZoom:!0,children:s.jsx(w,{asChild:!0,trapped:R.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:i(l,e=>{var t;null==(t=R.trigger)||t.focus({preventScroll:!0}),e.preventDefault()}),children:s.jsx(b,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:s.jsx(Y,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:e=>e.preventDefault(),...k,...Z,onPlaced:()=>H(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:i(k.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||U(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=L().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>W(t)),e.preventDefault()}})})})})})})});uo.displayName="SelectContentImpl";var fo=t.forwardRef((e,o)=>{const{__scopeSelect:i,onPlaced:l,...c}=e,d=Gr(oo,i),u=lo(oo,i),[f,p]=t.useState(null),[h,m]=t.useState(null),x=r(o,e=>m(e)),g=Br(i),v=t.useRef(!1),y=t.useRef(!0),{viewport:w,selectedItem:b,selectedItemText:j,focusSelectedItem:N}=u,S=t.useCallback(()=>{if(d.trigger&&d.valueNode&&f&&h&&w&&b&&j){const e=d.trigger.getBoundingClientRect(),t=h.getBoundingClientRect(),n=d.valueNode.getBoundingClientRect(),r=j.getBoundingClientRect();if("rtl"!==d.dir){const o=r.left-t.left,s=n.left-o,a=e.left-s,i=e.width+a,l=Math.max(i,t.width),c=window.innerWidth-ao,d=Rt(s,[ao,Math.max(ao,c-l)]);f.style.minWidth=i+"px",f.style.left=d+"px"}else{const o=t.right-r.right,s=window.innerWidth-n.right-o,a=window.innerWidth-e.right-s,i=e.width+a,l=Math.max(i,t.width),c=window.innerWidth-ao,d=Rt(s,[ao,Math.max(ao,c-l)]);f.style.minWidth=i+"px",f.style.right=d+"px"}const o=g(),s=window.innerHeight-2*ao,a=w.scrollHeight,i=window.getComputedStyle(h),c=parseInt(i.borderTopWidth,10),u=parseInt(i.paddingTop,10),p=parseInt(i.borderBottomWidth,10),m=c+u+a+parseInt(i.paddingBottom,10)+p,x=Math.min(5*b.offsetHeight,m),y=window.getComputedStyle(w),N=parseInt(y.paddingTop,10),S=parseInt(y.paddingBottom,10),C=e.top+e.height/2-ao,k=s-C,R=b.offsetHeight/2,T=c+u+(b.offsetTop+R),A=m-T;if(T<=C){const e=o.length>0&&b===o[o.length-1].ref.current;f.style.bottom="0px";const t=h.clientHeight-w.offsetTop-w.offsetHeight,n=T+Math.max(k,R+(e?S:0)+t+p);f.style.height=n+"px"}else{const e=o.length>0&&b===o[0].ref.current;f.style.top="0px";const t=Math.max(C,c+w.offsetTop+(e?N:0)+R)+A;f.style.height=t+"px",w.scrollTop=T-C+w.offsetTop}f.style.margin=`${ao}px 0`,f.style.minHeight=x+"px",f.style.maxHeight=s+"px",null==l||l(),requestAnimationFrame(()=>v.current=!0)}},[g,d.trigger,d.valueNode,f,h,w,b,j,d.dir,l]);n(()=>S(),[S]);const[C,k]=t.useState();n(()=>{h&&k(window.getComputedStyle(h).zIndex)},[h]);const R=t.useCallback(e=>{e&&!0===y.current&&(S(),null==N||N(),y.current=!1)},[S,N]);return s.jsx(ho,{scope:i,contentWrapper:f,shouldExpandOnScrollRef:v,onScrollButtonChange:R,children:s.jsx("div",{ref:p,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:s.jsx(a.div,{...c,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...c.style}})})})});fo.displayName="SelectItemAlignedPosition";var po=t.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=ao,...a}=e,i=Ur(n);return s.jsx(Pr,{...i,...a,ref:t,align:r,collisionPadding:o,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)"}})});po.displayName="SelectPopperPosition";var[ho,mo]=Kr(oo,{}),xo="SelectViewport",go=t.forwardRef((e,n)=>{const{__scopeSelect:o,nonce:l,...c}=e,d=lo(xo,o),u=mo(xo,o),f=r(n,d.onViewportChange),p=t.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:l}),s.jsx(zr.Slot,{scope:o,children:s.jsx(a.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:i(c.onScroll,e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=u;if((null==r?void 0:r.current)&&n){const e=Math.abs(p.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*ao,o=parseFloat(n.style.minHeight),s=parseFloat(n.style.height),a=Math.max(o,s);if(a<r){const o=a+e,s=Math.min(r,o),i=o-s;n.style.height=s+"px","0px"===n.style.bottom&&(t.scrollTop=i>0?i:0,n.style.justifyContent="flex-end")}}}p.current=t.scrollTop})})})]})});go.displayName=xo;var vo="SelectGroup",[yo,wo]=Kr(vo);t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=f();return s.jsx(yo,{scope:n,id:o,children:s.jsx(a.div,{role:"group","aria-labelledby":o,...r,ref:t})})}).displayName=vo;var bo="SelectLabel",jo=t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=wo(bo,n);return s.jsx(a.div,{id:o.id,...r,ref:t})});jo.displayName=bo;var No="SelectItem",[So,Co]=Kr(No),ko=t.forwardRef((e,n)=>{const{__scopeSelect:o,value:l,disabled:c=!1,textValue:d,...u}=e,p=Gr(No,o),h=lo(No,o),m=p.value===l,[x,g]=t.useState(d??""),[v,y]=t.useState(!1),w=r(n,e=>{var t;return null==(t=h.itemRefCallback)?void 0:t.call(h,e,l,c)}),b=f(),j=t.useRef("touch"),N=()=>{c||(p.onValueChange(l),p.onOpenChange(!1))};if(""===l)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(So,{scope:o,value:l,disabled:c,textId:b,isSelected:m,onItemTextChange:t.useCallback(e=>{g(t=>t||((null==e?void 0:e.textContent)??"").trim())},[]),children:s.jsx(zr.ItemSlot,{scope:o,value:l,disabled:c,textValue:x,children:s.jsx(a.div,{role:"option","aria-labelledby":b,"data-highlighted":v?"":void 0,"aria-selected":m&&v,"data-state":m?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...u,ref:w,onFocus:i(u.onFocus,()=>y(!0)),onBlur:i(u.onBlur,()=>y(!1)),onClick:i(u.onClick,()=>{"mouse"!==j.current&&N()}),onPointerUp:i(u.onPointerUp,()=>{"mouse"===j.current&&N()}),onPointerDown:i(u.onPointerDown,e=>{j.current=e.pointerType}),onPointerMove:i(u.onPointerMove,e=>{var t;j.current=e.pointerType,c?null==(t=h.onItemLeave)||t.call(h):"mouse"===j.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:i(u.onPointerLeave,e=>{var t;e.currentTarget===document.activeElement&&(null==(t=h.onItemLeave)||t.call(h))}),onKeyDown:i(u.onKeyDown,e=>{var t;""!==(null==(t=h.searchRef)?void 0:t.current)&&" "===e.key||(Vr.includes(e.key)&&N()," "===e.key&&e.preventDefault())})})})})});ko.displayName=No;var Ro="SelectItemText",To=t.forwardRef((e,o)=>{const{__scopeSelect:i,className:l,style:c,...d}=e,u=Gr(Ro,i),f=lo(Ro,i),p=Co(Ro,i),h=Yr(Ro,i),[x,g]=t.useState(null),v=r(o,e=>g(e),p.onItemTextChange,e=>{var t;return null==(t=f.itemTextRefCallback)?void 0:t.call(f,e,p.value,p.disabled)}),y=null==x?void 0:x.textContent,w=t.useMemo(()=>s.jsx("option",{value:p.value,disabled:p.disabled,children:y},p.value),[p.disabled,p.value,y]),{onNativeOptionAdd:b,onNativeOptionRemove:j}=h;return n(()=>(b(w),()=>j(w)),[b,j,w]),s.jsxs(s.Fragment,{children:[s.jsx(a.span,{id:p.textId,...d,ref:v}),p.isSelected&&u.valueNode&&!u.valueNodeHasChildren?m.createPortal(d.children,u.valueNode):null]})});To.displayName=Ro;var Ao="SelectItemIndicator",Do=t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Co(Ao,n).isSelected?s.jsx(a.span,{"aria-hidden":!0,...r,ref:t}):null});Do.displayName=Ao;var Eo="SelectScrollUpButton",Po=t.forwardRef((e,o)=>{const a=lo(Eo,e.__scopeSelect),i=mo(Eo,e.__scopeSelect),[l,c]=t.useState(!1),d=r(o,i.onScrollButtonChange);return n(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollTop>0;c(e)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),l?s.jsx(Io,{...e,ref:d,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});Po.displayName=Eo;var _o="SelectScrollDownButton",Oo=t.forwardRef((e,o)=>{const a=lo(_o,e.__scopeSelect),i=mo(_o,e.__scopeSelect),[l,c]=t.useState(!1),d=r(o,i.onScrollButtonChange);return n(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;c(n)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),l?s.jsx(Io,{...e,ref:d,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});Oo.displayName=_o;var Io=t.forwardRef((e,r)=>{const{__scopeSelect:o,onAutoScroll:l,...c}=e,d=lo("SelectScrollButton",o),u=t.useRef(null),f=Br(o),p=t.useCallback(()=>{null!==u.current&&(window.clearInterval(u.current),u.current=null)},[]);return t.useEffect(()=>()=>p(),[p]),n(()=>{var e;const t=f().find(e=>e.ref.current===document.activeElement);null==(e=null==t?void 0:t.ref.current)||e.scrollIntoView({block:"nearest"})},[f]),s.jsx(a.div,{"aria-hidden":!0,...c,ref:r,style:{flexShrink:0,...c.style},onPointerDown:i(c.onPointerDown,()=>{null===u.current&&(u.current=window.setInterval(l,50))}),onPointerMove:i(c.onPointerMove,()=>{var e;null==(e=d.onItemLeave)||e.call(d),null===u.current&&(u.current=window.setInterval(l,50))}),onPointerLeave:i(c.onPointerLeave,()=>{p()})})}),Mo=t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return s.jsx(a.div,{"aria-hidden":!0,...r,ref:t})});Mo.displayName="SelectSeparator";var Lo="SelectArrow";t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ur(n),a=Gr(Lo,n),i=lo(Lo,n);return a.open&&"popper"===i.position?s.jsx(_r,{...o,...r,ref:t}):null}).displayName=Lo;var Fo=t.forwardRef(({__scopeSelect:e,value:n,...o},i)=>{const l=t.useRef(null),c=r(i,l),d=be(n);return t.useEffect(()=>{const e=l.current;if(!e)return;const t=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(t,"value").set;if(d!==n&&r){const t=new Event("change",{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}},[d,n]),s.jsx(a.select,{...o,style:{...Fr,...o.style},ref:c,defaultValue:n})});function Ho(e){return""===e||void 0===e}function Vo(e){const n=p(e),r=t.useRef(""),o=t.useRef(0),s=t.useCallback(e=>{const t=r.current+e;n(t),function e(t){r.current=t,window.clearTimeout(o.current),""!==t&&(o.current=window.setTimeout(()=>e(""),1e3))}(t)},[n]),a=t.useCallback(()=>{r.current="",window.clearTimeout(o.current)},[]);return t.useEffect(()=>()=>window.clearTimeout(o.current),[]),[r,s,a]}function Wo(e,t,n){const r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let s=(a=e,i=Math.max(o,0),a.map((e,t)=>a[(i+t)%a.length]));var a,i;1===r.length&&(s=s.filter(e=>e!==n));const l=s.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}Fo.displayName="SelectBubbleInput";var zo=Jr,Bo=no,$o=ro,Ko=so,Uo=go,qo=jo,Go=ko,Xo=To,Yo=Do,Zo=Po,Qo=Oo,Jo=Mo;const es=Zr,ts=to,ns=t.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(zo,{ref:r,className:c("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(Bo,{asChild:!0,children:s.jsx(ce,{className:"h-4 w-4 opacity-50"})})]}));ns.displayName=zo.displayName;const rs=t.forwardRef(({className:e,...t},n)=>s.jsx(Zo,{ref:n,className:c("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(de,{className:"h-4 w-4"})}));rs.displayName=Zo.displayName;const os=t.forwardRef(({className:e,...t},n)=>s.jsx(Qo,{ref:n,className:c("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(ce,{className:"h-4 w-4"})}));os.displayName=Qo.displayName;const ss=t.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>s.jsx($o,{children:s.jsxs(Ko,{ref:o,className:c("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","popper"===n&&"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,...r,children:[s.jsx(rs,{}),s.jsx(Uo,{className:c("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(os,{})]})}));ss.displayName=Ko.displayName;t.forwardRef(({className:e,...t},n)=>s.jsx(qo,{ref:n,className:c("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t})).displayName=qo.displayName;const as=t.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(Go,{ref:r,className:c("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(Yo,{children:s.jsx(j,{className:"h-4 w-4"})})}),s.jsx(Xo,{children:t})]}));as.displayName=Go.displayName;t.forwardRef(({className:e,...t},n)=>s.jsx(Jo,{ref:n,className:c("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=Jo.displayName;const is={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function ls({open:e,onOpenChange:n,onAdded:r}){const[o,a]=t.useState([]),[i,l]=t.useState(!1),[c,d]=t.useState(null),[u,f]=t.useState(""),[p,h]=t.useState(""),[m,x]=t.useState(""),[g,v]=t.useState(""),[y,w]=t.useState(!1),[b,j]=t.useState(null);t.useEffect(()=>{e&&N().then(e=>a(e.available)).catch(()=>a([]))},[e]);const I=()=>{l(!1),d(null),f(""),h(""),x(""),v(""),w(!1),j(null)},M=o.length>0;return s.jsx(S,{open:e,onOpenChange:e=>{n(e),e||I()},children:s.jsxs(C,{className:"sm:max-w-md",children:[s.jsxs(k,{children:[s.jsxs(R,{className:"flex items-center gap-2",children:[s.jsx(ge,{className:"h-5 w-5"}),"添加云盘账号"]}),s.jsx(T,{children:i?"手动填写 OAuth 凭据连接云盘":"选择云盘类型,点击后跳转登录授权"})]}),i?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(D,{children:"云盘类型"}),s.jsxs(es,{value:u,onValueChange:f,children:[s.jsx(ns,{children:s.jsx(ts,{placeholder:"选择云盘类型"})}),s.jsxs(ss,{children:[s.jsx(as,{value:"google-drive",children:"Google Drive"}),s.jsx(as,{value:"onedrive",children:"OneDrive"}),s.jsx(as,{value:"dropbox",children:"Dropbox"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(D,{children:"显示名称"}),s.jsx(E,{placeholder:"例如:我的 Google Drive",value:p,onChange:e=>h(e.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(D,{children:"Client ID"}),s.jsx(E,{placeholder:"OAuth Client ID",value:m,onChange:e=>x(e.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(D,{children:"Client Secret"}),s.jsx(E,{type:"password",placeholder:"OAuth Client Secret",value:g,onChange:e=>v(e.target.value)})]}),b&&s.jsx("p",{className:"text-sm text-destructive",children:b})]}),s.jsxs(P,{children:[s.jsx(A,{variant:"outline",onClick:()=>{l(!1),j(null)},children:"返回"}),s.jsx(A,{onClick:async()=>{if(u&&p&&m&&g){w(!0),j(null);try{const{id:e}=await _({type:u,label:p,clientId:m,clientSecret:g}),{url:t}=await O(e);window.open(t,"_blank"),I(),n(!1),r()}catch(e){j(e instanceof Error?e.message:"添加失败")}finally{w(!1)}}else j("请填写所有字段")},disabled:y,children:y?"添加中...":"添加并授权"})]})]}):s.jsxs("div",{className:"space-y-3 py-2",children:[M?s.jsx(s.Fragment,{children:o.map(e=>s.jsx(A,{variant:"outline",className:"w-full justify-start gap-3 h-12 text-base",onClick:()=>{(async e=>{d(e),j(null);try{const{id:t}=await _({type:e,label:is[e]||e}),{url:o}=await O(t);window.open(o,"_blank"),I(),n(!1),r()}catch(t){j(t instanceof Error?t.message:"添加失败"),d(null)}})(e)},disabled:null!==c,children:c===e?"连接中...":`连接 ${is[e]||e}`},e))}):s.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"暂无内置 OAuth 凭据,请使用手动模式添加"}),b&&s.jsx("p",{className:"text-sm text-destructive",children:b}),s.jsx("div",{className:"pt-2 border-t border-border",children:s.jsxs("button",{onClick:()=>{l(!0),j(null)},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(ye,{className:"h-3.5 w-3.5"}),"手动填写 OAuth 凭据"]})})]})]})})}const cs={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function ds({type:e}){switch(e){case"google-drive":return s.jsx(ve,{className:"h-5 w-5 text-blue-500"});case"onedrive":return s.jsx(ge,{className:"h-5 w-5 text-sky-500"});case"dropbox":return s.jsx(ve,{className:"h-5 w-5 text-indigo-500"});default:return s.jsx(ge,{className:"h-5 w-5"})}}function us({provider:e,onDelete:n,onReauth:r}){var o;const[a,i]=t.useState(!1),l=t.useRef(null);t.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]);return s.jsxs(I,{children:[s.jsx(M,{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(ds,{type:e.type}),s.jsxs("div",{children:[s.jsx(L,{className:"text-base",children:e.label}),s.jsx("p",{className:"text-sm text-muted-foreground",children:cs[e.type]||e.type})]})]}),s.jsx(F,{variant:e.authorized?"default":"destructive",className:e.authorized?"bg-green-600 hover:bg-green-700":"",children:e.authorized?"已授权":"未授权"})]})}),s.jsxs(H,{children:[e.authorized&&(null==(o=e.tokens)?void 0:o.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(A,{variant:"outline",size:"sm",onClick:()=>r(e.id),children:[s.jsx(V,{className:"h-3.5 w-3.5 mr-1"}),"重新授权"]}),s.jsxs(A,{variant:a?"destructive":"outline",size:"sm",onClick:()=>{a?(n(e.id),i(!1)):(i(!0),l.current=setTimeout(()=>i(!1),3e3))},children:[s.jsx(W,{className:"h-3.5 w-3.5 mr-1"}),a?"确认删除?":"删除"]})]})]})]})}const fs={success:{label:"成功",icon:me,className:"bg-green-600 hover:bg-green-700"},failed:{label:"失败",icon:we,className:"bg-red-600 hover:bg-red-700"},partial:{label:"部分完成",icon:pe,className:"bg-yellow-600 hover:bg-yellow-700"}};function ps(e,t){const n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return`${n}ms`;const r=Math.floor(n/1e3);if(r<60)return`${r}秒`;return`${Math.floor(r/60)}分${r%60}秒`}function hs({history:e}){const t=e.slice(0,20);return 0===t.length?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[s.jsx(xe,{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(e=>{const t=fs[e.status],n=t.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:(r=e.startTime,new Date(r).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}))}),s.jsx("td",{className:"py-2.5 px-2",children:e.projectName}),s.jsx("td",{className:"py-2.5 px-2",children:e.providerLabel}),s.jsxs("td",{className:"py-2.5 px-2",children:[s.jsxs(F,{className:t.className,children:[s.jsx(n,{className:"h-3 w-3 mr-1"}),t.label]}),e.error&&s.jsx("p",{className:"text-xs text-destructive mt-1",children:e.error})]}),s.jsxs("td",{className:"py-2.5 px-2 whitespace-nowrap",children:[e.filesUploaded,"/",e.filesTotal]}),s.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:ps(e.startTime,e.endTime)})]},e.id);var r})})]})})}const ms=["node_modules",".git","dist","build","*.log",".DS_Store","*.tmp",".venv","__pycache__",".env"],xs=[{value:"30",label:"30分钟"},{value:"60",label:"1小时"},{value:"360",label:"6小时"},{value:"720",label:"12小时"},{value:"1440",label:"24小时"}];function gs(){const e=z(),[n,r]=t.useState([]),[o,a]=t.useState(!0),[i,l]=t.useState(!1),[c,d]=t.useState({enabled:!1,intervalMinutes:60}),[u,f]=t.useState(!0),[p,h]=t.useState([]),[m,x]=t.useState(!0),[g,v]=t.useState(""),[y,w]=t.useState(!1),[b,j]=t.useState(!1),[N,S]=t.useState([]),[C,k]=t.useState(!0),[R,T]=t.useState(()=>B()),[P,_]=t.useState(!1),[I,M]=t.useState({webhookEnabled:!1}),[L,F]=t.useState(""),[H,W]=t.useState(!1),[ce,de]=t.useState(()=>$(K.usageMonitorTool,"claude")),pe=async()=>{try{const e=await te();r(e)}catch{}finally{a(!1)}},me=async()=>{try{const e=await oe();S(e)}catch{}finally{k(!1)}};t.useEffect(()=>{pe(),(async()=>{try{const e=await ne();d(e)}catch{}finally{f(!1)}})(),(async()=>{try{const e=await re();h(e.length>0?e:ms)}catch{h(ms)}finally{x(!1)}})(),me(),U().then(e=>{M(e),F(e.webhookUrl??"")}).catch(()=>{})},[]);const xe=(e,t)=>{const n=parseInt(t,10);isNaN(n)||n<1||(T(t=>({...t,[e]:n})),_(!0))},ge=async e=>{try{await se(e),r(t=>t.filter(t=>t.id!==e))}catch{}},ve=async e=>{try{const{url:t}=await O(e);window.open(t,"_blank")}catch{}},ye=()=>{const e=g.trim();e&&!p.includes(e)&&(h(t=>[...t,e]),v(""),w(!0))};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(A,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[s.jsx(q,{className:"h-4 w-4 mr-1"}),"返回"]}),s.jsx("h1",{className:"text-2xl font-bold",children:"设置"})]}),s.jsxs(Nt,{defaultValue:"providers",children:[s.jsxs(St,{className:"mb-4",children:[s.jsx(Ct,{value:"providers",children:"云盘账号"}),s.jsx(Ct,{value:"strategy",children:"备份策略"}),s.jsx(Ct,{value:"history",children:"备份记录"}),s.jsxs(Ct,{value:"notifications",children:[s.jsx(he,{className:"h-3.5 w-3.5 mr-1.5"}),"通知"]}),s.jsxs(Ct,{value:"pomodoro",children:[s.jsx(G,{className:"h-3.5 w-3.5 mr-1.5"}),"番茄钟"]}),s.jsxs(Ct,{value:"usage",children:[s.jsx(fe,{className:"h-3.5 w-3.5 mr-1.5"}),"用量监控"]})]}),s.jsxs(kt,{value:"providers",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex justify-end",children:s.jsxs(A,{onClick:()=>l(!0),children:[s.jsx(X,{className:"h-4 w-4 mr-1"}),"添加云盘"]})}),o?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):0===n.length?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:n.map(e=>s.jsx(us,{provider:e,onDelete:ge,onReauth:ve},e.id))})]}),s.jsx(ls,{open:i,onOpenChange:l,onAdded:()=>{pe()}})]}),s.jsx(kt,{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:"匹配这些模式的文件和目录将不会被备份"}),m?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(Y,{children:p.map(e=>s.jsxs(Z.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:[e,s.jsx("button",{onClick:()=>(e=>{h(t=>t.filter(t=>t!==e)),w(!0)})(e),className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20 p-0.5",children:s.jsx(Q,{className:"h-3 w-3"})})]},e))})}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(E,{placeholder:"输入排除模式,例如 *.log",value:g,onChange:e=>v(e.target.value),onKeyDown:e=>{"Enter"===e.key&&ye()},className:"max-w-xs"}),s.jsx(A,{variant:"outline",size:"sm",onClick:ye,children:"添加"})]}),y&&s.jsxs(A,{onClick:async()=>{j(!0);try{await ae(p),w(!1)}catch{}finally{j(!1)}},disabled:b,children:[s.jsx(ue,{className:"h-4 w-4 mr-1"}),b?"保存中...":"保存"]})]})]}),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(Oe,{checked:c.enabled,onCheckedChange:async e=>{const t=c;d({...c,enabled:e});try{await ie({enabled:e})}catch{d(t)}}}),s.jsx(D,{children:c.enabled?"已开启":"已关闭"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(D,{children:"备份间隔"}),s.jsxs(es,{value:String(c.intervalMinutes),onValueChange:async e=>{const t=parseInt(e,10),n=c;d({...c,intervalMinutes:t});try{await ie({intervalMinutes:t})}catch{d(n)}},children:[s.jsx(ns,{className:"w-48",children:s.jsx(ts,{})}),s.jsx(ss,{children:xs.map(e=>s.jsx(as,{value:e.value,children:e.label},e.value))})]})]})]})]})]})}),s.jsx(kt,{value:"history",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex justify-end",children:s.jsxs(A,{variant:"outline",size:"sm",onClick:()=>{k(!0),me()},children:[s.jsx(V,{className:"h-4 w-4 mr-1"}),"刷新"]})}),C?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):s.jsx(hs,{history:N})]})}),s.jsx(kt,{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(D,{className:"text-xs",children:"Webhook URL"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(E,{placeholder:"https://hooks.slack.com/...",value:L,onChange:e=>F(e.target.value),className:"font-mono text-xs"}),s.jsx(A,{size:"sm",onClick:()=>{(async()=>{W(!0);try{const e=await le({webhookEnabled:L.trim().length>0,webhookUrl:L.trim()||void 0});M(e),ee.success("Webhook 配置已保存")}catch{ee.error("保存失败")}finally{W(!1)}})()},disabled:H,children:H?"保存中…":"保存"})]}),I.webhookEnabled&&I.webhookUrl&&s.jsxs("p",{className:"text-xs text-green-500",children:["已启用 → ",I.webhookUrl]})]})]})]})}),s.jsx(kt,{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(D,{className:"text-xs",children:"工作时长(分钟)"}),s.jsx(E,{type:"number",min:1,max:120,value:R.workMinutes,onChange:e=>xe("workMinutes",e.target.value),className:"w-full"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(D,{className:"text-xs",children:"休息时长(分钟)"}),s.jsx(E,{type:"number",min:1,max:60,value:R.breakMinutes,onChange:e=>xe("breakMinutes",e.target.value),className:"w-full"})]})]}),P&&s.jsxs(A,{size:"sm",onClick:()=>{J(K.pomodoroConfig,R,!0),_(!1),ee.success("番茄钟设置已保存")},children:[s.jsx(ue,{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(G,{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(kt,{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(e=>s.jsxs("label",{className:"flex items-start gap-3 rounded-lg border p-3 cursor-pointer transition-colors "+(ce===e.key?"border-blue-500/50 bg-blue-500/5":"border-border hover:bg-muted/30"),children:[s.jsx("input",{type:"radio",name:"usageTool",value:e.key,checked:ce===e.key,onChange:()=>{de(e.key),J(K.usageMonitorTool,e.key),window.dispatchEvent(new Event("ccweb:usage-tool-change")),ee.success(`用量监控已切换为 ${e.label}`)},className:"mt-0.5"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium",children:e.label}),s.jsx("div",{className:"text-xs text-muted-foreground",children:e.desc})]})]},e.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{gs as SettingsPage};
13
+ */function be(e){const n=t.useRef({value:e,previous:e});return t.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}function je(e){const[r,o]=t.useState(void 0);return n(()=>{if(e){o({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let r,s;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,s=t.blockSize}else r=e.offsetWidth,s=e.offsetHeight;o({width:r,height:s})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}o(void 0)},[e]),r}var Ne="Switch",[Se]=l(Ne),[Ce,ke]=Se(Ne),Re=t.forwardRef((e,n)=>{const{__scopeSwitch:l,name:c,checked:d,defaultChecked:u,required:f,disabled:p,value:h="on",onCheckedChange:m,form:x,...g}=e,[v,y]=t.useState(null),w=r(n,e=>y(e)),b=t.useRef(!1),j=!v||(x||!!v.closest("form")),[N,S]=o({prop:d,defaultProp:u??!1,onChange:m,caller:Ne});return s.jsxs(Ce,{scope:l,checked:N,disabled:p,children:[s.jsx(a.button,{type:"button",role:"switch","aria-checked":N,"aria-required":f,"data-state":Ee(N),"data-disabled":p?"":void 0,disabled:p,value:h,...g,ref:w,onClick:i(e.onClick,e=>{S(e=>!e),j&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),j&&s.jsx(De,{control:v,bubbles:!b.current,name:c,value:h,checked:N,required:f,disabled:p,form:x,style:{transform:"translateX(-100%)"}})]})});Re.displayName=Ne;var Ae="SwitchThumb",Te=t.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=ke(Ae,n);return s.jsx(a.span,{"data-state":Ee(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});Te.displayName=Ae;var De=t.forwardRef(({__scopeSwitch:e,control:n,checked:o,bubbles:a=!0,...i},l)=>{const c=t.useRef(null),d=r(c,l),u=be(o),f=je(n);return t.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(u!==o&&n){const t=new Event("click",{bubbles:a});n.call(e,o),e.dispatchEvent(t)}},[u,o,a]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o,...i,tabIndex:-1,ref:d,style:{...i.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Ee(e){return e?"checked":"unchecked"}De.displayName="SwitchBubbleInput";var Pe=Re,_e=Te;const Oe=t.forwardRef(({className:e,...t},n)=>s.jsx(Pe,{className:c("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(_e,{className:c("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")})}));function Ie(e){const n=Me(e),r=t.forwardRef((e,r)=>{const{children:o,...a}=e,i=t.Children.toArray(o),l=i.find(Fe);if(l){const e=l.props.children,o=i.map(n=>n===l?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:n);return s.jsx(n,{...a,ref:r,children:t.isValidElement(e)?t.cloneElement(e,void 0,o):null})}return s.jsx(n,{...a,ref:r,children:o})});return r.displayName=`${e}.Slot`,r}function Me(e){const n=t.forwardRef((e,n)=>{const{children:r,...o}=e;if(t.isValidElement(r)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{const t=s(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...s}:"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}(o,r.props);return r.type!==t.Fragment&&(s.ref=n?d(n,e):e),t.cloneElement(r,s)}return t.Children.count(r)>1?t.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}Oe.displayName=Pe.displayName;var Le=Symbol("radix.slottable");function Fe(e){return t.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Le}function He(e){const t=e+"CollectionProvider",[n,o]=l(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=e=>{const{scope:t,children:n}=e,r=u.useRef(null),o=u.useRef(new Map).current;return s.jsx(a,{scope:t,itemMap:o,collectionRef:r,children:n})};c.displayName=t;const d=e+"CollectionSlot",f=Ie(d),p=u.forwardRef((e,t)=>{const{scope:n,children:o}=e,a=i(d,n),l=r(t,a.collectionRef);return s.jsx(f,{ref:l,children:o})});p.displayName=d;const h=e+"CollectionItemSlot",m="data-radix-collection-item",x=Ie(h),g=u.forwardRef((e,t)=>{const{scope:n,children:o,...a}=e,l=u.useRef(null),c=r(t,l),d=i(h,n);return u.useEffect(()=>(d.itemMap.set(l,{ref:l,...a}),()=>{d.itemMap.delete(l)})),s.jsx(x,{[m]:"",ref:c,children:o})});return g.displayName=h,[{Provider:c,Slot:p,ItemSlot:g},function(t){const n=i(e+"CollectionConsumer",t);return u.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${m}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])},o]}var Ve=t.createContext(void 0);function We(e){const n=t.useContext(Ve);return e||n||"ltr"}var ze="rovingFocusGroup.onEntryFocus",Be={bubbles:!1,cancelable:!0},$e="RovingFocusGroup",[Ke,Ue,qe]=He($e),[Ge,Xe]=l($e,[qe]),[Ye,Ze]=Ge($e),Qe=t.forwardRef((e,t)=>s.jsx(Ke.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Ke.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Je,{...e,ref:t})})}));Qe.displayName=$e;var Je=t.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:l,orientation:c,loop:d=!1,dir:u,currentTabStopId:f,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:m,onEntryFocus:x,preventScrollOnEntryFocus:g=!1,...v}=e,y=t.useRef(null),w=r(n,y),b=We(u),[j,N]=o({prop:f,defaultProp:h??null,onChange:m,caller:$e}),[S,C]=t.useState(!1),k=p(x),R=Ue(l),A=t.useRef(!1),[T,D]=t.useState(0);return t.useEffect(()=>{const e=y.current;if(e)return e.addEventListener(ze,k),()=>e.removeEventListener(ze,k)},[k]),s.jsx(Ye,{scope:l,orientation:c,dir:b,loop:d,currentTabStopId:j,onItemFocus:t.useCallback(e=>N(e),[N]),onItemShiftTab:t.useCallback(()=>C(!0),[]),onFocusableItemAdd:t.useCallback(()=>D(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>D(e=>e-1),[]),children:s.jsx(a.div,{tabIndex:S||0===T?-1:0,"data-orientation":c,...v,ref:w,style:{outline:"none",...e.style},onMouseDown:i(e.onMouseDown,()=>{A.current=!0}),onFocus:i(e.onFocus,e=>{const t=!A.current;if(e.target===e.currentTarget&&t&&!S){const t=new CustomEvent(ze,Be);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=R().filter(e=>e.focusable);rt([e.find(e=>e.active),e.find(e=>e.id===j),...e].filter(Boolean).map(e=>e.ref.current),g)}}A.current=!1}),onBlur:i(e.onBlur,()=>C(!1))})})}),et="RovingFocusGroupItem",tt=t.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:l=!1,tabStopId:c,children:d,...u}=e,p=f(),h=c||p,m=Ze(et,r),x=m.currentTabStopId===h,g=Ue(r),{onFocusableItemAdd:v,onFocusableItemRemove:y,currentTabStopId:w}=m;return t.useEffect(()=>{if(o)return v(),()=>y()},[o,v,y]),s.jsx(Ke.ItemSlot,{scope:r,id:h,focusable:o,active:l,children:s.jsx(a.span,{tabIndex:x?0:-1,"data-orientation":m.orientation,...u,ref:n,onMouseDown:i(e.onMouseDown,e=>{o?m.onItemFocus(h):e.preventDefault()}),onFocus:i(e.onFocus,()=>m.onItemFocus(h)),onKeyDown:i(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void m.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const r=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)?void 0:nt[r]}(e,m.orientation,m.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let o=g().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)o.reverse();else if("prev"===t||"next"===t){"prev"===t&&o.reverse();const s=o.indexOf(e.currentTarget);o=m.loop?(r=s+1,(n=o).map((e,t)=>n[(r+t)%n.length])):o.slice(s+1)}setTimeout(()=>rt(o))}var n,r}),children:"function"==typeof d?d({isCurrentTabStop:x,hasTabStop:null!=w}):d})})});tt.displayName=et;var nt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function rt(e,t=!1){const n=document.activeElement;for(const r of e){if(r===n)return;if(r.focus({preventScroll:t}),document.activeElement!==n)return}}var ot=Qe,st=tt,at="Tabs",[it]=l(at,[Xe]),lt=Xe(),[ct,dt]=it(at),ut=t.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:l,orientation:c="horizontal",dir:d,activationMode:u="automatic",...p}=e,h=We(d),[m,x]=o({prop:r,onChange:i,defaultProp:l??"",caller:at});return s.jsx(ct,{scope:n,baseId:f(),value:m,onValueChange:x,orientation:c,dir:h,activationMode:u,children:s.jsx(a.div,{dir:h,"data-orientation":c,...p,ref:t})})});ut.displayName=at;var ft="TabsList",pt=t.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=dt(ft,n),l=lt(n);return s.jsx(ot,{asChild:!0,...l,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(a.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});pt.displayName=ft;var ht="TabsTrigger",mt=t.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...l}=e,c=dt(ht,n),d=lt(n),u=vt(c.baseId,r),f=yt(c.baseId,r),p=r===c.value;return s.jsx(st,{asChild:!0,...d,focusable:!o,active:p,children:s.jsx(a.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...l,ref:t,onMouseDown:i(e.onMouseDown,e=>{o||0!==e.button||!1!==e.ctrlKey?e.preventDefault():c.onValueChange(r)}),onKeyDown:i(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&c.onValueChange(r)}),onFocus:i(e.onFocus,()=>{const e="manual"!==c.activationMode;p||o||!e||c.onValueChange(r)})})})});mt.displayName=ht;var xt="TabsContent",gt=t.forwardRef((e,n)=>{const{__scopeTabs:r,value:o,forceMount:i,children:l,...c}=e,d=dt(xt,r),u=vt(d.baseId,o),f=yt(d.baseId,o),p=o===d.value,m=t.useRef(p);return t.useEffect(()=>{const e=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(e)},[]),s.jsx(h,{present:i||p,children:({present:t})=>s.jsx(a.div,{"data-state":p?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":u,hidden:!t,id:f,tabIndex:0,...c,ref:n,style:{...e.style,animationDuration:m.current?"0s":void 0},children:t&&l})})});function vt(e,t){return`${e}-trigger-${t}`}function yt(e,t){return`${e}-content-${t}`}gt.displayName=xt;var wt=pt,bt=mt,jt=gt;const Nt=ut,St=t.forwardRef(({className:e,...t},n)=>s.jsx(wt,{ref:n,className:c("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));St.displayName=wt.displayName;const Ct=t.forwardRef(({className:e,...t},n)=>s.jsx(bt,{ref:n,className:c("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}));Ct.displayName=bt.displayName;const kt=t.forwardRef(({className:e,...t},n)=>s.jsx(jt,{ref:n,className:c("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));function Rt(e,[t,n]){return Math.min(n,Math.max(t,e))}kt.displayName=jt.displayName;const At=["top","right","bottom","left"],Tt=Math.min,Dt=Math.max,Et=Math.round,Pt=Math.floor,_t=e=>({x:e,y:e}),Ot={left:"right",right:"left",bottom:"top",top:"bottom"};function It(e,t,n){return Dt(e,Tt(t,n))}function Mt(e,t){return"function"==typeof e?e(t):e}function Lt(e){return e.split("-")[0]}function Ft(e){return e.split("-")[1]}function Ht(e){return"x"===e?"y":"x"}function Vt(e){return"y"===e?"height":"width"}function Wt(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function zt(e){return Ht(Wt(e))}function Bt(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const $t=["left","right"],Kt=["right","left"],Ut=["top","bottom"],qt=["bottom","top"];function Gt(e,t,n,r){const o=Ft(e);let s=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Kt:$t:t?$t:Kt;case"left":case"right":return t?Ut:qt;default:return[]}}(Lt(e),"start"===n,r);return o&&(s=s.map(e=>e+"-"+o),t&&(s=s.concat(s.map(Bt)))),s}function Xt(e){const t=Lt(e);return Ot[t]+e.slice(t.length)}function Yt(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Zt(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Qt(e,t,n){let{reference:r,floating:o}=e;const s=Wt(t),a=zt(t),i=Vt(a),l=Lt(t),c="y"===s,d=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,f=r[i]/2-o[i]/2;let p;switch(l){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(Ft(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1)}return p}async function Jt(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:s,rects:a,elements:i,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Mt(t,e),h=Yt(p),m=i[f?"floating"===u?"reference":"floating":u],x=Zt(await s.getClippingRect({element:null==(n=await(null==s.isElement?void 0:s.isElement(m)))||n?m:m.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(i.floating)),boundary:c,rootBoundary:d,strategy:l})),g="floating"===u?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,v=await(null==s.getOffsetParent?void 0:s.getOffsetParent(i.floating)),y=await(null==s.isElement?void 0:s.isElement(v))&&await(null==s.getScale?void 0:s.getScale(v))||{x:1,y:1},w=Zt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:g,offsetParent:v,strategy:l}):g);return{top:(x.top-w.top+h.top)/y.y,bottom:(w.bottom-x.bottom+h.bottom)/y.y,left:(x.left-w.left+h.left)/y.x,right:(w.right-x.right+h.right)/y.x}}function en(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function tn(e){return At.some(t=>e[t]>=0)}const nn=new Set(["left","top"]);function rn(){return"undefined"!=typeof window}function on(e){return ln(e)?(e.nodeName||"").toLowerCase():"#document"}function sn(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function an(e){var t;return null==(t=(ln(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function ln(e){return!!rn()&&(e instanceof Node||e instanceof sn(e).Node)}function cn(e){return!!rn()&&(e instanceof Element||e instanceof sn(e).Element)}function dn(e){return!!rn()&&(e instanceof HTMLElement||e instanceof sn(e).HTMLElement)}function un(e){return!(!rn()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof sn(e).ShadowRoot)}function fn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=jn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==o&&"contents"!==o}function pn(e){return/^(table|td|th)$/.test(on(e))}function hn(e){try{if(e.matches(":popover-open"))return!0}catch(t){}try{return e.matches(":modal")}catch(t){return!1}}const mn=/transform|translate|scale|rotate|perspective|filter/,xn=/paint|layout|strict|content/,gn=e=>!!e&&"none"!==e;let vn;function yn(e){const t=cn(e)?jn(e):e;return gn(t.transform)||gn(t.translate)||gn(t.scale)||gn(t.rotate)||gn(t.perspective)||!wn()&&(gn(t.backdropFilter)||gn(t.filter))||mn.test(t.willChange||"")||xn.test(t.contain||"")}function wn(){return null==vn&&(vn="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),vn}function bn(e){return/^(html|body|#document)$/.test(on(e))}function jn(e){return sn(e).getComputedStyle(e)}function Nn(e){return cn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Sn(e){if("html"===on(e))return e;const t=e.assignedSlot||e.parentNode||un(e)&&e.host||an(e);return un(t)?t.host:t}function Cn(e){const t=Sn(e);return bn(t)?e.ownerDocument?e.ownerDocument.body:e.body:dn(t)&&fn(t)?t:Cn(t)}function kn(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Cn(e),s=o===(null==(r=e.ownerDocument)?void 0:r.body),a=sn(o);if(s){const e=Rn(a);return t.concat(a,a.visualViewport||[],fn(o)?o:[],e&&n?kn(e):[])}return t.concat(o,kn(o,[],n))}function Rn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function An(e){const t=jn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=dn(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,i=Et(n)!==s||Et(r)!==a;return i&&(n=s,r=a),{width:n,height:r,$:i}}function Tn(e){return cn(e)?e:e.contextElement}function Dn(e){const t=Tn(e);if(!dn(t))return _t(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=An(t);let a=(s?Et(n.width):n.width)/r,i=(s?Et(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),i&&Number.isFinite(i)||(i=1),{x:a,y:i}}const En=_t(0);function Pn(e){const t=sn(e);return wn()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:En}function _n(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),s=Tn(e);let a=_t(1);t&&(r?cn(r)&&(a=Dn(r)):a=Dn(e));const i=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==sn(e))&&t}(s,n,r)?Pn(s):_t(0);let l=(o.left+i.x)/a.x,c=(o.top+i.y)/a.y,d=o.width/a.x,u=o.height/a.y;if(s){const e=sn(s),t=r&&cn(r)?sn(r):r;let n=e,o=Rn(n);for(;o&&r&&t!==n;){const e=Dn(o),t=o.getBoundingClientRect(),r=jn(o),s=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=s,c+=a,n=sn(o),o=Rn(n)}}return Zt({width:d,height:u,x:l,y:c})}function On(e,t){const n=Nn(e).scrollLeft;return t?t.left+n:_n(an(e)).left+n}function In(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-On(e,n),y:n.top+t.scrollTop}}function Mn(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=sn(e),r=an(e),o=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,i=0,l=0;if(o){s=o.width,a=o.height;const e=wn();(!e||e&&"fixed"===t)&&(i=o.offsetLeft,l=o.offsetTop)}const c=On(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,a=Math.abs(r.clientWidth-t.clientWidth-o);a<=25&&(s-=a)}else c<=25&&(s+=c);return{width:s,height:a,x:i,y:l}}(e,n);else if("document"===t)r=function(e){const t=an(e),n=Nn(e),r=e.ownerDocument.body,o=Dt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Dt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+On(e);const i=-n.scrollTop;return"rtl"===jn(r).direction&&(a+=Dt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:a,y:i}}(an(e));else if(cn(t))r=function(e,t){const n=_n(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=dn(e)?Dn(e):_t(1);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:o*s.x,y:r*s.y}}(t,n);else{const n=Pn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Zt(r)}function Ln(e,t){const n=Sn(e);return!(n===t||!cn(n)||bn(n))&&("fixed"===jn(n).position||Ln(n,t))}function Fn(e,t,n){const r=dn(t),o=an(t),s="fixed"===n,a=_n(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const l=_t(0);function c(){l.x=On(o)}if(r||!r&&!s)if(("body"!==on(t)||fn(o))&&(i=Nn(t)),r){const e=_n(t,!0,s,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&c();s&&!r&&o&&c();const d=!o||r||s?_t(0):In(o,i);return{x:a.left+i.scrollLeft-l.x-d.x,y:a.top+i.scrollTop-l.y-d.y,width:a.width,height:a.height}}function Hn(e){return"static"===jn(e).position}function Vn(e,t){if(!dn(e)||"fixed"===jn(e).position)return null;if(t)return t(e);let n=e.offsetParent;return an(e)===n&&(n=n.ownerDocument.body),n}function Wn(e,t){const n=sn(e);if(hn(e))return n;if(!dn(e)){let t=Sn(e);for(;t&&!bn(t);){if(cn(t)&&!Hn(t))return t;t=Sn(t)}return n}let r=Vn(e,t);for(;r&&pn(r)&&Hn(r);)r=Vn(r,t);return r&&bn(r)&&Hn(r)&&!yn(r)?n:r||function(e){let t=Sn(e);for(;dn(t)&&!bn(t);){if(yn(t))return t;if(hn(t))return null;t=Sn(t)}return null}(e)||n}const zn={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s="fixed"===o,a=an(r),i=!!t&&hn(t.floating);if(r===a||i&&s)return n;let l={scrollLeft:0,scrollTop:0},c=_t(1);const d=_t(0),u=dn(r);if((u||!u&&!s)&&(("body"!==on(r)||fn(a))&&(l=Nn(r)),u)){const e=_n(r);c=Dn(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}const f=!a||u||s?_t(0):In(a,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:n.y*c.y-l.scrollTop*c.y+d.y+f.y}},getDocumentElement:an,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[..."clippingAncestors"===n?hn(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=kn(e,[],!1).filter(e=>cn(e)&&"body"!==on(e)),o=null;const s="fixed"===jn(e).position;let a=s?Sn(e):e;for(;cn(a)&&!bn(a);){const t=jn(a),n=yn(a);n||"fixed"!==t.position||(o=null),(s?!n&&!o:!n&&"static"===t.position&&o&&("absolute"===o.position||"fixed"===o.position)||fn(a)&&!n&&Ln(e,a))?r=r.filter(e=>e!==a):o=t,a=Sn(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=Mn(t,s[0],o);let i=a.top,l=a.right,c=a.bottom,d=a.left;for(let u=1;u<s.length;u++){const e=Mn(t,s[u],o);i=Dt(e.top,i),l=Tt(e.right,l),c=Tt(e.bottom,c),d=Dt(e.left,d)}return{width:l-d,height:c-i,x:d,y:i}},getOffsetParent:Wn,getElementRects:async function(e){const t=this.getOffsetParent||Wn,n=this.getDimensions,r=await n(e.floating);return{reference:Fn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=An(e);return{width:t,height:n}},getScale:Dn,isElement:cn,isRTL:function(e){return"rtl"===jn(e).direction}};function Bn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $n(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=Tn(e),d=o||s?[...c?kn(c):[],...t?kn(t):[]]:[];d.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),s&&e.addEventListener("resize",n)});const u=c&&i?function(e,t){let n,r=null;const o=an(e);function s(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(i,l){void 0===i&&(i=!1),void 0===l&&(l=1),s();const c=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=c;if(i||t(),!f||!p)return;const h={rootMargin:-Pt(u)+"px "+-Pt(o.clientWidth-(d+f))+"px "+-Pt(o.clientHeight-(u+p))+"px "+-Pt(d)+"px",threshold:Dt(0,Tt(1,l))||1};let m=!0;function x(t){const r=t[0].intersectionRatio;if(r!==l){if(!m)return a();r?a(!1,r):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==r||Bn(c,e.getBoundingClientRect())||a(),m=!1}try{r=new IntersectionObserver(x,{...h,root:o.ownerDocument})}catch(g){r=new IntersectionObserver(x,h)}r.observe(e)}(!0),s}(c,n):null;let f,p=-1,h=null;a&&(h=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),c&&!l&&h.observe(c),t&&h.observe(t));let m=l?_n(e):null;return l&&function t(){const r=_n(e);m&&!Bn(m,r)&&n();m=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach(e=>{o&&e.removeEventListener("scroll",n),s&&e.removeEventListener("resize",n)}),null==u||u(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(f)}}const Kn=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:a,middlewareData:i}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,s=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=Lt(n),i=Ft(n),l="y"===Wt(n),c=nn.has(a)?-1:1,d=s&&l?-1:1,u=Mt(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&"number"==typeof h&&(p="end"===i?-1*h:h),l?{x:p*d,y:f*c}:{x:f*c,y:p*d}}(t,e);return a===(null==(n=i.offset)?void 0:n.placement)&&null!=(r=i.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:a}}}}},Un=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=Mt(e,t),d={x:n,y:r},u=await s.detectOverflow(t,c),f=Wt(Lt(o)),p=Ht(f);let h=d[p],m=d[f];if(a){const e="y"===p?"bottom":"right";h=It(h+u["y"===p?"top":"left"],h,h-u[e])}if(i){const e="y"===f?"bottom":"right";m=It(m+u["y"===f?"top":"left"],m,m-u[e])}const x=l.fn({...t,[p]:h,[f]:m});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[p]:a,[f]:i}}}}}},qn=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:a,initialPlacement:i,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...x}=Mt(e,t);if(null!=(n=s.arrow)&&n.alignmentOffset)return{};const g=Lt(o),v=Wt(i),y=Lt(i)===i,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),b=f||(y||!m?[Xt(i)]:function(e){const t=Xt(e);return[Bt(e),t,Bt(t)]}(i)),j="none"!==h;!f&&j&&b.push(...Gt(i,m,h,w));const N=[i,...b],S=await l.detectOverflow(t,x),C=[];let k=(null==(r=s.flip)?void 0:r.overflows)||[];if(d&&C.push(S[g]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=Ft(e),o=zt(e),s=Vt(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Xt(a)),[a,Xt(a)]}(o,a,w);C.push(S[e[0]],S[e[1]])}if(k=[...k,{placement:o,overflows:C}],!C.every(e=>e<=0)){var R,A;const e=((null==(R=s.flip)?void 0:R.index)||0)+1,t=N[e];if(t){if(!("alignment"===u&&v!==Wt(t))||k.every(e=>Wt(e.placement)!==v||e.overflows[0]>0))return{data:{index:e,overflows:k},reset:{placement:t}}}let n=null==(A=k.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:A.placement;if(!n)switch(p){case"bestFit":{var T;const e=null==(T=k.filter(e=>{if(j){const t=Wt(e.placement);return t===v||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:T[0];e&&(n=e);break}case"initialPlacement":n=i}if(o!==n)return{reset:{placement:n}}}return{}}}},Gn=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:a,elements:i}=t,{apply:l=()=>{},...c}=Mt(e,t),d=await a.detectOverflow(t,c),u=Lt(o),f=Ft(o),p="y"===Wt(o),{width:h,height:m}=s.floating;let x,g;"top"===u||"bottom"===u?(x=u,g=f===(await(null==a.isRTL?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(g=u,x="end"===f?"top":"bottom");const v=m-d.top-d.bottom,y=h-d.left-d.right,w=Tt(m-d[x],v),b=Tt(h-d[g],y),j=!t.middlewareData.shift;let N=w,S=b;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(S=y),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(N=v),j&&!f){const e=Dt(d.left,0),t=Dt(d.right,0),n=Dt(d.top,0),r=Dt(d.bottom,0);p?S=h-2*(0!==e||0!==t?e+t:Dt(d.left,d.right)):N=m-2*(0!==n||0!==r?n+r:Dt(d.top,d.bottom))}await l({...t,availableWidth:S,availableHeight:N});const C=await a.getDimensions(i.floating);return h!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}},Xn=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Mt(e,t);switch(o){case"referenceHidden":{const e=en(await r.detectOverflow(t,{...s,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:tn(e)}}}case"escaped":{const e=en(await r.detectOverflow(t,{...s,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:tn(e)}}}default:return{}}}}},Yn=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:a,elements:i,middlewareData:l}=t,{element:c,padding:d=0}=Mt(e,t)||{};if(null==c)return{};const u=Yt(d),f={x:n,y:r},p=zt(o),h=Vt(p),m=await a.getDimensions(c),x="y"===p,g=x?"top":"left",v=x?"bottom":"right",y=x?"clientHeight":"clientWidth",w=s.reference[h]+s.reference[p]-f[p]-s.floating[h],b=f[p]-s.reference[p],j=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let N=j?j[y]:0;N&&await(null==a.isElement?void 0:a.isElement(j))||(N=i.floating[y]||s.floating[h]);const S=w/2-b/2,C=N/2-m[h]/2-1,k=Tt(u[g],C),R=Tt(u[v],C),A=k,T=N-m[h]-R,D=N/2-m[h]/2+S,E=It(A,D,T),P=!l.arrow&&null!=Ft(o)&&D!==E&&s.reference[h]/2-(D<A?k:R)-m[h]/2<0,_=P?D<A?D-A:D-T:0;return{[p]:f[p]+_,data:{[p]:E,centerOffset:D-E-_,...P&&{alignmentOffset:_}},reset:P}}}),Zn=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:l=!0,crossAxis:c=!0}=Mt(e,t),d={x:n,y:r},u=Wt(o),f=Ht(u);let p=d[f],h=d[u];const m=Mt(i,t),x="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const e="y"===f?"height":"width",t=s.reference[f]-s.floating[e]+x.mainAxis,n=s.reference[f]+s.reference[e]-x.mainAxis;p<t?p=t:p>n&&(p=n)}if(c){var g,v;const e="y"===f?"width":"height",t=nn.has(Lt(o)),n=s.reference[u]-s.floating[e]+(t&&(null==(g=a.offset)?void 0:g[u])||0)+(t?0:x.crossAxis),r=s.reference[u]+s.reference[e]+(t?0:(null==(v=a.offset)?void 0:v[u])||0)-(t?x.crossAxis:0);h<n?h=n:h>r&&(h=r)}return{[f]:p,[u]:h}}}},Qn=(e,t,n)=>{const r=new Map,o={platform:zn,...n},s={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:Jt},l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=Qt(c,r,l),f=r,p=0;const h={};for(let m=0;m<s.length;m++){const n=s[m];if(!n)continue;const{name:x,fn:g}=n,{x:v,y:y,data:w,reset:b}=await g({x:d,y:u,initialPlacement:r,placement:f,strategy:o,middlewareData:h,rects:c,platform:i,elements:{reference:e,floating:t}});d=null!=v?v:d,u=null!=y?y:u,h[x]={...h[x],...w},b&&p<50&&(p++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:d,y:u}=Qt(c,f,l))),m=-1)}return{x:d,y:u,placement:f,strategy:o,middlewareData:h}})(e,t,{...o,platform:s})};var Jn="undefined"!=typeof document?t.useLayoutEffect:function(){};function er(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!er(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!er(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function tr(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function nr(e,t){const n=tr(e);return Math.round(t*n)/n}function rr(e){const n=t.useRef(e);return Jn(()=>{n.current=e}),n}const or=(e,t)=>{const n=Kn(e);return{name:n.name,fn:n.fn,options:[e,t]}},sr=(e,t)=>{const n=Un(e);return{name:n.name,fn:n.fn,options:[e,t]}},ar=(e,t)=>{const n=qn(e);return{name:n.name,fn:n.fn,options:[e,t]}},ir=(e,t)=>{const n=Gn(e);return{name:n.name,fn:n.fn,options:[e,t]}},lr=(e,t)=>{const n=Xn(e);return{name:n.name,fn:n.fn,options:[e,t]}},cr=(e,t)=>{const n=(e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?Yn({element:n.current,padding:r}).fn(t):{}:n?Yn({element:n,padding:r}).fn(t):{};var o}}))(e);return{name:n.name,fn:n.fn,options:[e,t]}};var dr=t.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return s.jsx(a.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});dr.displayName="Arrow";var ur=dr,fr="Popper",[pr,hr]=l(fr),[mr,xr]=pr(fr),gr=e=>{const{__scopePopper:n,children:r}=e,[o,a]=t.useState(null);return s.jsx(mr,{scope:n,anchor:o,onAnchorChange:a,children:r})};gr.displayName=fr;var vr="PopperAnchor",yr=t.forwardRef((e,n)=>{const{__scopePopper:o,virtualRef:i,...l}=e,c=xr(vr,o),d=t.useRef(null),u=r(n,d),f=t.useRef(null);return t.useEffect(()=>{const e=f.current;f.current=(null==i?void 0:i.current)||d.current,e!==f.current&&c.onAnchorChange(f.current)}),i?null:s.jsx(a.div,{...l,ref:u})});yr.displayName=vr;var wr="PopperContent",[br,jr]=pr(wr),Nr=t.forwardRef((e,o)=>{var i,l,c,d,u,f;const{__scopePopper:h,side:x="bottom",sideOffset:g=0,align:v="center",alignOffset:y=0,arrowPadding:w=0,avoidCollisions:b=!0,collisionBoundary:j=[],collisionPadding:N=0,sticky:S="partial",hideWhenDetached:C=!1,updatePositionStrategy:k="optimized",onPlaced:R,...A}=e,T=xr(wr,h),[D,E]=t.useState(null),P=r(o,e=>E(e)),[_,O]=t.useState(null),I=je(_),M=(null==I?void 0:I.width)??0,L=(null==I?void 0:I.height)??0,F=x+("center"!==v?"-"+v:""),H="number"==typeof N?N:{top:0,right:0,bottom:0,left:0,...N},V=Array.isArray(j)?j:[j],W=V.length>0,z={padding:H,boundary:V.filter(Rr),altBoundary:W},{refs:B,floatingStyles:$,placement:K,isPositioned:U,middlewareData:q}=function(e){void 0===e&&(e={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:s,elements:{reference:a,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,f]=t.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[p,h]=t.useState(o);er(p,o)||h(o);const[x,g]=t.useState(null),[v,y]=t.useState(null),w=t.useCallback(e=>{e!==S.current&&(S.current=e,g(e))},[]),b=t.useCallback(e=>{e!==C.current&&(C.current=e,y(e))},[]),j=a||x,N=i||v,S=t.useRef(null),C=t.useRef(null),k=t.useRef(u),R=null!=c,A=rr(c),T=rr(s),D=rr(d),E=t.useCallback(()=>{if(!S.current||!C.current)return;const e={placement:n,strategy:r,middleware:p};T.current&&(e.platform=T.current),Qn(S.current,C.current,e).then(e=>{const t={...e,isPositioned:!1!==D.current};P.current&&!er(k.current,t)&&(k.current=t,m.flushSync(()=>{f(t)}))})},[p,n,r,T,D]);Jn(()=>{!1===d&&k.current.isPositioned&&(k.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[d]);const P=t.useRef(!1);Jn(()=>(P.current=!0,()=>{P.current=!1}),[]),Jn(()=>{if(j&&(S.current=j),N&&(C.current=N),j&&N){if(A.current)return A.current(j,N,E);E()}},[j,N,E,A,R]);const _=t.useMemo(()=>({reference:S,floating:C,setReference:w,setFloating:b}),[w,b]),O=t.useMemo(()=>({reference:j,floating:N}),[j,N]),I=t.useMemo(()=>{const e={position:r,left:0,top:0};if(!O.floating)return e;const t=nr(O.floating,u.x),n=nr(O.floating,u.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...tr(O.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,O.floating,u.x,u.y]);return t.useMemo(()=>({...u,update:E,refs:_,elements:O,floatingStyles:I}),[u,E,_,O,I])}({strategy:"fixed",placement:F,whileElementsMounted:(...e)=>$n(...e,{animationFrame:"always"===k}),elements:{reference:T.anchor},middleware:[or({mainAxis:g+L,alignmentAxis:y}),b&&sr({mainAxis:!0,crossAxis:!1,limiter:"partial"===S?{fn:Zn(G).fn,options:[G,X]}:void 0,...z}),b&&ar({...z}),ir({...z,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:s}=t.reference,a=e.floating.style;a.setProperty("--radix-popper-available-width",`${n}px`),a.setProperty("--radix-popper-available-height",`${r}px`),a.setProperty("--radix-popper-anchor-width",`${o}px`),a.setProperty("--radix-popper-anchor-height",`${s}px`)}}),_&&cr({element:_,padding:w}),Ar({arrowWidth:M,arrowHeight:L}),C&&lr({strategy:"referenceHidden",...z})]});var G,X;const[Y,Z]=Tr(K),Q=p(R);n(()=>{U&&(null==Q||Q())},[U,Q]);const J=null==(i=q.arrow)?void 0:i.x,ee=null==(l=q.arrow)?void 0:l.y,te=0!==(null==(c=q.arrow)?void 0:c.centerOffset),[ne,re]=t.useState();return n(()=>{D&&re(window.getComputedStyle(D).zIndex)},[D]),s.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:U?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[null==(d=q.transformOrigin)?void 0:d.x,null==(u=q.transformOrigin)?void 0:u.y].join(" "),...(null==(f=q.hide)?void 0:f.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(br,{scope:h,placedSide:Y,onArrowChange:O,arrowX:J,arrowY:ee,shouldHideArrow:te,children:s.jsx(a.div,{"data-side":Y,"data-align":Z,...A,ref:P,style:{...A.style,animation:U?void 0:"none"}})})})});Nr.displayName=wr;var Sr="PopperArrow",Cr={top:"bottom",right:"left",bottom:"top",left:"right"},kr=t.forwardRef(function(e,t){const{__scopePopper:n,...r}=e,o=jr(Sr,n),a=Cr[o.placedSide];return s.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:s.jsx(ur,{...r,ref:t,style:{...r.style,display:"block"}})})});function Rr(e){return null!==e}kr.displayName=Sr;var Ar=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o;const{placement:s,rects:a,middlewareData:i}=t,l=0!==(null==(n=i.arrow)?void 0:n.centerOffset),c=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[u,f]=Tr(s),p={start:"0%",center:"50%",end:"100%"}[f],h=((null==(r=i.arrow)?void 0:r.x)??0)+c/2,m=((null==(o=i.arrow)?void 0:o.y)??0)+d/2;let x="",g="";return"bottom"===u?(x=l?p:`${h}px`,g=-d+"px"):"top"===u?(x=l?p:`${h}px`,g=`${a.floating.height+d}px`):"right"===u?(x=-d+"px",g=l?p:`${m}px`):"left"===u&&(x=`${a.floating.width+d}px`,g=l?p:`${m}px`),{data:{x:x,y:g}}}});function Tr(e){const[t,n="center"]=e.split("-");return[t,n]}var Dr=gr,Er=yr,Pr=Nr,_r=kr;function Or(e){const n=Ir(e),r=t.forwardRef((e,r)=>{const{children:o,...a}=e,i=t.Children.toArray(o),l=i.find(Lr);if(l){const e=l.props.children,o=i.map(n=>n===l?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:n);return s.jsx(n,{...a,ref:r,children:t.isValidElement(e)?t.cloneElement(e,void 0,o):null})}return s.jsx(n,{...a,ref:r,children:o})});return r.displayName=`${e}.Slot`,r}function Ir(e){const n=t.forwardRef((e,n)=>{const{children:r,...o}=e;if(t.isValidElement(r)){const e=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{const t=s(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...s}:"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}(o,r.props);return r.type!==t.Fragment&&(s.ref=n?d(n,e):e),t.cloneElement(r,s)}return t.Children.count(r)>1?t.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var Mr=Symbol("radix.slottable");function Lr(e){return t.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Mr}var Fr=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"});t.forwardRef((e,t)=>s.jsx(a.span,{...e,ref:t,style:{...Fr,...e.style}})).displayName="VisuallyHidden";var Hr=[" ","Enter","ArrowUp","ArrowDown"],Vr=[" ","Enter"],Wr="Select",[zr,Br,$r]=He(Wr),[Kr]=l(Wr,[$r,hr]),Ur=hr(),[qr,Gr]=Kr(Wr),[Xr,Yr]=Kr(Wr),Zr=e=>{const{__scopeSelect:n,children:r,open:a,defaultOpen:i,onOpenChange:l,value:c,defaultValue:d,onValueChange:u,dir:p,name:h,autoComplete:m,disabled:x,required:g,form:v}=e,y=Ur(n),[w,b]=t.useState(null),[j,N]=t.useState(null),[S,C]=t.useState(!1),k=We(p),[R,A]=o({prop:a,defaultProp:i??!1,onChange:l,caller:Wr}),[T,D]=o({prop:c,defaultProp:d,onChange:u,caller:Wr}),E=t.useRef(null),P=!w||(v||!!w.closest("form")),[_,O]=t.useState(new Set),I=Array.from(_).map(e=>e.props.value).join(";");return s.jsx(Dr,{...y,children:s.jsxs(qr,{required:g,scope:n,trigger:w,onTriggerChange:b,valueNode:j,onValueNodeChange:N,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:f(),value:T,onValueChange:D,open:R,onOpenChange:A,dir:k,triggerPointerDownPosRef:E,disabled:x,children:[s.jsx(zr.Provider,{scope:n,children:s.jsx(Xr,{scope:e.__scopeSelect,onNativeOptionAdd:t.useCallback(e=>{O(t=>new Set(t).add(e))},[]),onNativeOptionRemove:t.useCallback(e=>{O(t=>{const n=new Set(t);return n.delete(e),n})},[]),children:r})}),P?s.jsxs(Fo,{"aria-hidden":!0,required:g,tabIndex:-1,name:h,autoComplete:m,value:T,onChange:e=>D(e.target.value),disabled:x,form:v,children:[void 0===T?s.jsx("option",{value:""}):null,Array.from(_)]},I):null]})})};Zr.displayName=Wr;var Qr="SelectTrigger",Jr=t.forwardRef((e,n)=>{const{__scopeSelect:o,disabled:l=!1,...c}=e,d=Ur(o),u=Gr(Qr,o),f=u.disabled||l,p=r(n,u.onTriggerChange),h=Br(o),m=t.useRef("touch"),[x,g,v]=Vo(e=>{const t=h().filter(e=>!e.disabled),n=t.find(e=>e.value===u.value),r=Wo(t,e,n);void 0!==r&&u.onValueChange(r.value)}),y=e=>{f||(u.onOpenChange(!0),v()),e&&(u.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return s.jsx(Er,{asChild:!0,...d,children:s.jsx(a.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:f,"data-disabled":f?"":void 0,"data-placeholder":Ho(u.value)?"":void 0,...c,ref:p,onClick:i(c.onClick,e=>{e.currentTarget.focus(),"mouse"!==m.current&&y(e)}),onPointerDown:i(c.onPointerDown,e=>{m.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(y(e),e.preventDefault())}),onKeyDown:i(c.onKeyDown,e=>{const t=""!==x.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||g(e.key),t&&" "===e.key||Hr.includes(e.key)&&(y(),e.preventDefault())})})})});Jr.displayName=Qr;var eo="SelectValue",to=t.forwardRef((e,t)=>{const{__scopeSelect:o,className:i,style:l,children:c,placeholder:d="",...u}=e,f=Gr(eo,o),{onValueNodeHasChildrenChange:p}=f,h=void 0!==c,m=r(t,f.onValueNodeChange);return n(()=>{p(h)},[p,h]),s.jsx(a.span,{...u,ref:m,style:{pointerEvents:"none"},children:Ho(f.value)?s.jsx(s.Fragment,{children:d}):c})});to.displayName=eo;var no=t.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return s.jsx(a.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});no.displayName="SelectIcon";var ro=e=>s.jsx(x,{asChild:!0,...e});ro.displayName="SelectPortal";var oo="SelectContent",so=t.forwardRef((e,r)=>{const o=Gr(oo,e.__scopeSelect),[a,i]=t.useState();if(n(()=>{i(new DocumentFragment)},[]),!o.open){const t=a;return t?m.createPortal(s.jsx(io,{scope:e.__scopeSelect,children:s.jsx(zr.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),t):null}return s.jsx(uo,{...e,ref:r})});so.displayName=oo;var ao=10,[io,lo]=Kr(oo),co=Or("SelectContent.RemoveScroll"),uo=t.forwardRef((e,n)=>{const{__scopeSelect:o,position:a="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,side:u,sideOffset:f,align:p,alignOffset:h,arrowPadding:m,collisionBoundary:x,collisionPadding:j,sticky:N,hideWhenDetached:S,avoidCollisions:C,...k}=e,R=Gr(oo,o),[A,T]=t.useState(null),[D,E]=t.useState(null),P=r(n,e=>T(e)),[_,O]=t.useState(null),[I,M]=t.useState(null),L=Br(o),[F,H]=t.useState(!1),V=t.useRef(!1);t.useEffect(()=>{if(A)return g(A)},[A]),v();const W=t.useCallback(e=>{const[t,...n]=L().map(e=>e.ref.current),[r]=n.slice(-1),o=document.activeElement;for(const s of e){if(s===o)return;if(null==s||s.scrollIntoView({block:"nearest"}),s===t&&D&&(D.scrollTop=0),s===r&&D&&(D.scrollTop=D.scrollHeight),null==s||s.focus(),document.activeElement!==o)return}},[L,D]),z=t.useCallback(()=>W([_,A]),[W,_,A]);t.useEffect(()=>{F&&z()},[F,z]);const{onOpenChange:B,triggerPointerDownPosRef:$}=R;t.useEffect(()=>{if(A){let e={x:0,y:0};const t=t=>{var n,r;e={x:Math.abs(Math.round(t.pageX)-((null==(n=$.current)?void 0:n.x)??0)),y:Math.abs(Math.round(t.pageY)-((null==(r=$.current)?void 0:r.y)??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():A.contains(n.target)||B(!1),document.removeEventListener("pointermove",t),$.current=null};return null!==$.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[A,B,$]),t.useEffect(()=>{const e=()=>B(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[B]);const[K,U]=Vo(e=>{const t=L().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=Wo(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),q=t.useCallback((e,t,n)=>{const r=!V.current&&!n;(void 0!==R.value&&R.value===t||r)&&(O(e),r&&(V.current=!0))},[R.value]),G=t.useCallback(()=>null==A?void 0:A.focus(),[A]),X=t.useCallback((e,t,n)=>{const r=!V.current&&!n;(void 0!==R.value&&R.value===t||r)&&M(e)},[R.value]),Y="popper"===a?po:fo,Z=Y===po?{side:u,sideOffset:f,align:p,alignOffset:h,arrowPadding:m,collisionBoundary:x,collisionPadding:j,sticky:N,hideWhenDetached:S,avoidCollisions:C}:{};return s.jsx(io,{scope:o,content:A,viewport:D,onViewportChange:E,itemRefCallback:q,selectedItem:_,onItemLeave:G,itemTextRefCallback:X,focusSelectedItem:z,selectedItemText:I,position:a,isPositioned:F,searchRef:K,children:s.jsx(y,{as:co,allowPinchZoom:!0,children:s.jsx(w,{asChild:!0,trapped:R.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:i(l,e=>{var t;null==(t=R.trigger)||t.focus({preventScroll:!0}),e.preventDefault()}),children:s.jsx(b,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:s.jsx(Y,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:e=>e.preventDefault(),...k,...Z,onPlaced:()=>H(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:i(k.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||U(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=L().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>W(t)),e.preventDefault()}})})})})})})});uo.displayName="SelectContentImpl";var fo=t.forwardRef((e,o)=>{const{__scopeSelect:i,onPlaced:l,...c}=e,d=Gr(oo,i),u=lo(oo,i),[f,p]=t.useState(null),[h,m]=t.useState(null),x=r(o,e=>m(e)),g=Br(i),v=t.useRef(!1),y=t.useRef(!0),{viewport:w,selectedItem:b,selectedItemText:j,focusSelectedItem:N}=u,S=t.useCallback(()=>{if(d.trigger&&d.valueNode&&f&&h&&w&&b&&j){const e=d.trigger.getBoundingClientRect(),t=h.getBoundingClientRect(),n=d.valueNode.getBoundingClientRect(),r=j.getBoundingClientRect();if("rtl"!==d.dir){const o=r.left-t.left,s=n.left-o,a=e.left-s,i=e.width+a,l=Math.max(i,t.width),c=window.innerWidth-ao,d=Rt(s,[ao,Math.max(ao,c-l)]);f.style.minWidth=i+"px",f.style.left=d+"px"}else{const o=t.right-r.right,s=window.innerWidth-n.right-o,a=window.innerWidth-e.right-s,i=e.width+a,l=Math.max(i,t.width),c=window.innerWidth-ao,d=Rt(s,[ao,Math.max(ao,c-l)]);f.style.minWidth=i+"px",f.style.right=d+"px"}const o=g(),s=window.innerHeight-2*ao,a=w.scrollHeight,i=window.getComputedStyle(h),c=parseInt(i.borderTopWidth,10),u=parseInt(i.paddingTop,10),p=parseInt(i.borderBottomWidth,10),m=c+u+a+parseInt(i.paddingBottom,10)+p,x=Math.min(5*b.offsetHeight,m),y=window.getComputedStyle(w),N=parseInt(y.paddingTop,10),S=parseInt(y.paddingBottom,10),C=e.top+e.height/2-ao,k=s-C,R=b.offsetHeight/2,A=c+u+(b.offsetTop+R),T=m-A;if(A<=C){const e=o.length>0&&b===o[o.length-1].ref.current;f.style.bottom="0px";const t=h.clientHeight-w.offsetTop-w.offsetHeight,n=A+Math.max(k,R+(e?S:0)+t+p);f.style.height=n+"px"}else{const e=o.length>0&&b===o[0].ref.current;f.style.top="0px";const t=Math.max(C,c+w.offsetTop+(e?N:0)+R)+T;f.style.height=t+"px",w.scrollTop=A-C+w.offsetTop}f.style.margin=`${ao}px 0`,f.style.minHeight=x+"px",f.style.maxHeight=s+"px",null==l||l(),requestAnimationFrame(()=>v.current=!0)}},[g,d.trigger,d.valueNode,f,h,w,b,j,d.dir,l]);n(()=>S(),[S]);const[C,k]=t.useState();n(()=>{h&&k(window.getComputedStyle(h).zIndex)},[h]);const R=t.useCallback(e=>{e&&!0===y.current&&(S(),null==N||N(),y.current=!1)},[S,N]);return s.jsx(ho,{scope:i,contentWrapper:f,shouldExpandOnScrollRef:v,onScrollButtonChange:R,children:s.jsx("div",{ref:p,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:s.jsx(a.div,{...c,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...c.style}})})})});fo.displayName="SelectItemAlignedPosition";var po=t.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=ao,...a}=e,i=Ur(n);return s.jsx(Pr,{...i,...a,ref:t,align:r,collisionPadding:o,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)"}})});po.displayName="SelectPopperPosition";var[ho,mo]=Kr(oo,{}),xo="SelectViewport",go=t.forwardRef((e,n)=>{const{__scopeSelect:o,nonce:l,...c}=e,d=lo(xo,o),u=mo(xo,o),f=r(n,d.onViewportChange),p=t.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:l}),s.jsx(zr.Slot,{scope:o,children:s.jsx(a.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:i(c.onScroll,e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=u;if((null==r?void 0:r.current)&&n){const e=Math.abs(p.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*ao,o=parseFloat(n.style.minHeight),s=parseFloat(n.style.height),a=Math.max(o,s);if(a<r){const o=a+e,s=Math.min(r,o),i=o-s;n.style.height=s+"px","0px"===n.style.bottom&&(t.scrollTop=i>0?i:0,n.style.justifyContent="flex-end")}}}p.current=t.scrollTop})})})]})});go.displayName=xo;var vo="SelectGroup",[yo,wo]=Kr(vo);t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=f();return s.jsx(yo,{scope:n,id:o,children:s.jsx(a.div,{role:"group","aria-labelledby":o,...r,ref:t})})}).displayName=vo;var bo="SelectLabel",jo=t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=wo(bo,n);return s.jsx(a.div,{id:o.id,...r,ref:t})});jo.displayName=bo;var No="SelectItem",[So,Co]=Kr(No),ko=t.forwardRef((e,n)=>{const{__scopeSelect:o,value:l,disabled:c=!1,textValue:d,...u}=e,p=Gr(No,o),h=lo(No,o),m=p.value===l,[x,g]=t.useState(d??""),[v,y]=t.useState(!1),w=r(n,e=>{var t;return null==(t=h.itemRefCallback)?void 0:t.call(h,e,l,c)}),b=f(),j=t.useRef("touch"),N=()=>{c||(p.onValueChange(l),p.onOpenChange(!1))};if(""===l)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(So,{scope:o,value:l,disabled:c,textId:b,isSelected:m,onItemTextChange:t.useCallback(e=>{g(t=>t||((null==e?void 0:e.textContent)??"").trim())},[]),children:s.jsx(zr.ItemSlot,{scope:o,value:l,disabled:c,textValue:x,children:s.jsx(a.div,{role:"option","aria-labelledby":b,"data-highlighted":v?"":void 0,"aria-selected":m&&v,"data-state":m?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...u,ref:w,onFocus:i(u.onFocus,()=>y(!0)),onBlur:i(u.onBlur,()=>y(!1)),onClick:i(u.onClick,()=>{"mouse"!==j.current&&N()}),onPointerUp:i(u.onPointerUp,()=>{"mouse"===j.current&&N()}),onPointerDown:i(u.onPointerDown,e=>{j.current=e.pointerType}),onPointerMove:i(u.onPointerMove,e=>{var t;j.current=e.pointerType,c?null==(t=h.onItemLeave)||t.call(h):"mouse"===j.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:i(u.onPointerLeave,e=>{var t;e.currentTarget===document.activeElement&&(null==(t=h.onItemLeave)||t.call(h))}),onKeyDown:i(u.onKeyDown,e=>{var t;""!==(null==(t=h.searchRef)?void 0:t.current)&&" "===e.key||(Vr.includes(e.key)&&N()," "===e.key&&e.preventDefault())})})})})});ko.displayName=No;var Ro="SelectItemText",Ao=t.forwardRef((e,o)=>{const{__scopeSelect:i,className:l,style:c,...d}=e,u=Gr(Ro,i),f=lo(Ro,i),p=Co(Ro,i),h=Yr(Ro,i),[x,g]=t.useState(null),v=r(o,e=>g(e),p.onItemTextChange,e=>{var t;return null==(t=f.itemTextRefCallback)?void 0:t.call(f,e,p.value,p.disabled)}),y=null==x?void 0:x.textContent,w=t.useMemo(()=>s.jsx("option",{value:p.value,disabled:p.disabled,children:y},p.value),[p.disabled,p.value,y]),{onNativeOptionAdd:b,onNativeOptionRemove:j}=h;return n(()=>(b(w),()=>j(w)),[b,j,w]),s.jsxs(s.Fragment,{children:[s.jsx(a.span,{id:p.textId,...d,ref:v}),p.isSelected&&u.valueNode&&!u.valueNodeHasChildren?m.createPortal(d.children,u.valueNode):null]})});Ao.displayName=Ro;var To="SelectItemIndicator",Do=t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Co(To,n).isSelected?s.jsx(a.span,{"aria-hidden":!0,...r,ref:t}):null});Do.displayName=To;var Eo="SelectScrollUpButton",Po=t.forwardRef((e,o)=>{const a=lo(Eo,e.__scopeSelect),i=mo(Eo,e.__scopeSelect),[l,c]=t.useState(!1),d=r(o,i.onScrollButtonChange);return n(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollTop>0;c(e)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),l?s.jsx(Io,{...e,ref:d,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});Po.displayName=Eo;var _o="SelectScrollDownButton",Oo=t.forwardRef((e,o)=>{const a=lo(_o,e.__scopeSelect),i=mo(_o,e.__scopeSelect),[l,c]=t.useState(!1),d=r(o,i.onScrollButtonChange);return n(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;c(n)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),l?s.jsx(Io,{...e,ref:d,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});Oo.displayName=_o;var Io=t.forwardRef((e,r)=>{const{__scopeSelect:o,onAutoScroll:l,...c}=e,d=lo("SelectScrollButton",o),u=t.useRef(null),f=Br(o),p=t.useCallback(()=>{null!==u.current&&(window.clearInterval(u.current),u.current=null)},[]);return t.useEffect(()=>()=>p(),[p]),n(()=>{var e;const t=f().find(e=>e.ref.current===document.activeElement);null==(e=null==t?void 0:t.ref.current)||e.scrollIntoView({block:"nearest"})},[f]),s.jsx(a.div,{"aria-hidden":!0,...c,ref:r,style:{flexShrink:0,...c.style},onPointerDown:i(c.onPointerDown,()=>{null===u.current&&(u.current=window.setInterval(l,50))}),onPointerMove:i(c.onPointerMove,()=>{var e;null==(e=d.onItemLeave)||e.call(d),null===u.current&&(u.current=window.setInterval(l,50))}),onPointerLeave:i(c.onPointerLeave,()=>{p()})})}),Mo=t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return s.jsx(a.div,{"aria-hidden":!0,...r,ref:t})});Mo.displayName="SelectSeparator";var Lo="SelectArrow";t.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ur(n),a=Gr(Lo,n),i=lo(Lo,n);return a.open&&"popper"===i.position?s.jsx(_r,{...o,...r,ref:t}):null}).displayName=Lo;var Fo=t.forwardRef(({__scopeSelect:e,value:n,...o},i)=>{const l=t.useRef(null),c=r(i,l),d=be(n);return t.useEffect(()=>{const e=l.current;if(!e)return;const t=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(t,"value").set;if(d!==n&&r){const t=new Event("change",{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}},[d,n]),s.jsx(a.select,{...o,style:{...Fr,...o.style},ref:c,defaultValue:n})});function Ho(e){return""===e||void 0===e}function Vo(e){const n=p(e),r=t.useRef(""),o=t.useRef(0),s=t.useCallback(e=>{const t=r.current+e;n(t),function e(t){r.current=t,window.clearTimeout(o.current),""!==t&&(o.current=window.setTimeout(()=>e(""),1e3))}(t)},[n]),a=t.useCallback(()=>{r.current="",window.clearTimeout(o.current)},[]);return t.useEffect(()=>()=>window.clearTimeout(o.current),[]),[r,s,a]}function Wo(e,t,n){const r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let s=(a=e,i=Math.max(o,0),a.map((e,t)=>a[(i+t)%a.length]));var a,i;1===r.length&&(s=s.filter(e=>e!==n));const l=s.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}Fo.displayName="SelectBubbleInput";var zo=Jr,Bo=no,$o=ro,Ko=so,Uo=go,qo=jo,Go=ko,Xo=Ao,Yo=Do,Zo=Po,Qo=Oo,Jo=Mo;const es=Zr,ts=to,ns=t.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(zo,{ref:r,className:c("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(Bo,{asChild:!0,children:s.jsx(ce,{className:"h-4 w-4 opacity-50"})})]}));ns.displayName=zo.displayName;const rs=t.forwardRef(({className:e,...t},n)=>s.jsx(Zo,{ref:n,className:c("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(de,{className:"h-4 w-4"})}));rs.displayName=Zo.displayName;const os=t.forwardRef(({className:e,...t},n)=>s.jsx(Qo,{ref:n,className:c("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(ce,{className:"h-4 w-4"})}));os.displayName=Qo.displayName;const ss=t.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>s.jsx($o,{children:s.jsxs(Ko,{ref:o,className:c("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","popper"===n&&"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,...r,children:[s.jsx(rs,{}),s.jsx(Uo,{className:c("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(os,{})]})}));ss.displayName=Ko.displayName;t.forwardRef(({className:e,...t},n)=>s.jsx(qo,{ref:n,className:c("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t})).displayName=qo.displayName;const as=t.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(Go,{ref:r,className:c("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(Yo,{children:s.jsx(j,{className:"h-4 w-4"})})}),s.jsx(Xo,{children:t})]}));as.displayName=Go.displayName;t.forwardRef(({className:e,...t},n)=>s.jsx(Jo,{ref:n,className:c("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=Jo.displayName;const is={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function ls({open:e,onOpenChange:n,onAdded:r}){const[o,a]=t.useState([]),[i,l]=t.useState(!1),[c,d]=t.useState(null),[u,f]=t.useState(""),[p,h]=t.useState(""),[m,x]=t.useState(""),[g,v]=t.useState(""),[y,w]=t.useState(!1),[b,j]=t.useState(null);t.useEffect(()=>{e&&N().then(e=>a(e.available)).catch(()=>a([]))},[e]);const I=()=>{l(!1),d(null),f(""),h(""),x(""),v(""),w(!1),j(null)},M=o.length>0;return s.jsx(S,{open:e,onOpenChange:e=>{n(e),e||I()},children:s.jsxs(C,{className:"sm:max-w-md",children:[s.jsxs(k,{children:[s.jsxs(R,{className:"flex items-center gap-2",children:[s.jsx(ge,{className:"h-5 w-5"}),"添加云盘账号"]}),s.jsx(A,{children:i?"手动填写 OAuth 凭据连接云盘":"选择云盘类型,点击后跳转登录授权"})]}),i?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(D,{children:"云盘类型"}),s.jsxs(es,{value:u,onValueChange:f,children:[s.jsx(ns,{children:s.jsx(ts,{placeholder:"选择云盘类型"})}),s.jsxs(ss,{children:[s.jsx(as,{value:"google-drive",children:"Google Drive"}),s.jsx(as,{value:"onedrive",children:"OneDrive"}),s.jsx(as,{value:"dropbox",children:"Dropbox"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(D,{children:"显示名称"}),s.jsx(E,{placeholder:"例如:我的 Google Drive",value:p,onChange:e=>h(e.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(D,{children:"Client ID"}),s.jsx(E,{placeholder:"OAuth Client ID",value:m,onChange:e=>x(e.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(D,{children:"Client Secret"}),s.jsx(E,{type:"password",placeholder:"OAuth Client Secret",value:g,onChange:e=>v(e.target.value)})]}),b&&s.jsx("p",{className:"text-sm text-destructive",children:b})]}),s.jsxs(P,{children:[s.jsx(T,{variant:"outline",onClick:()=>{l(!1),j(null)},children:"返回"}),s.jsx(T,{onClick:async()=>{if(u&&p&&m&&g){w(!0),j(null);try{const{id:e}=await _({type:u,label:p,clientId:m,clientSecret:g}),{url:t}=await O(e);window.open(t,"_blank"),I(),n(!1),r()}catch(e){j(e instanceof Error?e.message:"添加失败")}finally{w(!1)}}else j("请填写所有字段")},disabled:y,children:y?"添加中...":"添加并授权"})]})]}):s.jsxs("div",{className:"space-y-3 py-2",children:[M?s.jsx(s.Fragment,{children:o.map(e=>s.jsx(T,{variant:"outline",className:"w-full justify-start gap-3 h-12 text-base",onClick:()=>{(async e=>{d(e),j(null);try{const{id:t}=await _({type:e,label:is[e]||e}),{url:o}=await O(t);window.open(o,"_blank"),I(),n(!1),r()}catch(t){j(t instanceof Error?t.message:"添加失败"),d(null)}})(e)},disabled:null!==c,children:c===e?"连接中...":`连接 ${is[e]||e}`},e))}):s.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"暂无内置 OAuth 凭据,请使用手动模式添加"}),b&&s.jsx("p",{className:"text-sm text-destructive",children:b}),s.jsx("div",{className:"pt-2 border-t border-border",children:s.jsxs("button",{onClick:()=>{l(!0),j(null)},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(ye,{className:"h-3.5 w-3.5"}),"手动填写 OAuth 凭据"]})})]})]})})}const cs={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function ds({type:e}){switch(e){case"google-drive":return s.jsx(ve,{className:"h-5 w-5 text-blue-500"});case"onedrive":return s.jsx(ge,{className:"h-5 w-5 text-sky-500"});case"dropbox":return s.jsx(ve,{className:"h-5 w-5 text-indigo-500"});default:return s.jsx(ge,{className:"h-5 w-5"})}}function us({provider:e,onDelete:n,onReauth:r}){var o;const[a,i]=t.useState(!1),l=t.useRef(null);t.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]);return s.jsxs(I,{children:[s.jsx(M,{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(ds,{type:e.type}),s.jsxs("div",{children:[s.jsx(L,{className:"text-base",children:e.label}),s.jsx("p",{className:"text-sm text-muted-foreground",children:cs[e.type]||e.type})]})]}),s.jsx(F,{variant:e.authorized?"default":"destructive",className:e.authorized?"bg-green-600 hover:bg-green-700":"",children:e.authorized?"已授权":"未授权"})]})}),s.jsxs(H,{children:[e.authorized&&(null==(o=e.tokens)?void 0:o.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(T,{variant:"outline",size:"sm",onClick:()=>r(e.id),children:[s.jsx(V,{className:"h-3.5 w-3.5 mr-1"}),"重新授权"]}),s.jsxs(T,{variant:a?"destructive":"outline",size:"sm",onClick:()=>{a?(n(e.id),i(!1)):(i(!0),l.current=setTimeout(()=>i(!1),3e3))},children:[s.jsx(W,{className:"h-3.5 w-3.5 mr-1"}),a?"确认删除?":"删除"]})]})]})]})}const fs={success:{label:"成功",icon:me,className:"bg-green-600 hover:bg-green-700"},failed:{label:"失败",icon:we,className:"bg-red-600 hover:bg-red-700"},partial:{label:"部分完成",icon:pe,className:"bg-yellow-600 hover:bg-yellow-700"}};function ps(e,t){const n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return`${n}ms`;const r=Math.floor(n/1e3);if(r<60)return`${r}秒`;return`${Math.floor(r/60)}分${r%60}秒`}function hs({history:e}){const t=e.slice(0,20);return 0===t.length?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[s.jsx(xe,{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(e=>{const t=fs[e.status],n=t.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:(r=e.startTime,new Date(r).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}))}),s.jsx("td",{className:"py-2.5 px-2",children:e.projectName}),s.jsx("td",{className:"py-2.5 px-2",children:e.providerLabel}),s.jsxs("td",{className:"py-2.5 px-2",children:[s.jsxs(F,{className:t.className,children:[s.jsx(n,{className:"h-3 w-3 mr-1"}),t.label]}),e.error&&s.jsx("p",{className:"text-xs text-destructive mt-1",children:e.error})]}),s.jsxs("td",{className:"py-2.5 px-2 whitespace-nowrap",children:[e.filesUploaded,"/",e.filesTotal]}),s.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:ps(e.startTime,e.endTime)})]},e.id);var r})})]})})}const ms=["node_modules",".git","dist","build","*.log",".DS_Store","*.tmp",".venv","__pycache__",".env"],xs=[{value:"30",label:"30分钟"},{value:"60",label:"1小时"},{value:"360",label:"6小时"},{value:"720",label:"12小时"},{value:"1440",label:"24小时"}];function gs(){const e=z(),[n,r]=t.useState([]),[o,a]=t.useState(!0),[i,l]=t.useState(!1),[c,d]=t.useState({enabled:!1,intervalMinutes:60}),[u,f]=t.useState(!0),[p,h]=t.useState([]),[m,x]=t.useState(!0),[g,v]=t.useState(""),[y,w]=t.useState(!1),[b,j]=t.useState(!1),[N,S]=t.useState([]),[C,k]=t.useState(!0),[R,A]=t.useState(()=>B()),[P,_]=t.useState(!1),[I,M]=t.useState({webhookEnabled:!1}),[L,F]=t.useState(""),[H,W]=t.useState(!1),[ce,de]=t.useState(()=>$(K.usageMonitorTool,"claude")),pe=async()=>{try{const e=await te();r(e)}catch{}finally{a(!1)}},me=async()=>{try{const e=await oe();S(e)}catch{}finally{k(!1)}};t.useEffect(()=>{pe(),(async()=>{try{const e=await ne();d(e)}catch{}finally{f(!1)}})(),(async()=>{try{const e=await re();h(e.length>0?e:ms)}catch{h(ms)}finally{x(!1)}})(),me(),U().then(e=>{M(e),F(e.webhookUrl??"")}).catch(()=>{})},[]);const xe=(e,t)=>{const n=parseInt(t,10);isNaN(n)||n<1||(A(t=>({...t,[e]:n})),_(!0))},ge=async e=>{try{await se(e),r(t=>t.filter(t=>t.id!==e))}catch{}},ve=async e=>{try{const{url:t}=await O(e);window.open(t,"_blank")}catch{}},ye=()=>{const e=g.trim();e&&!p.includes(e)&&(h(t=>[...t,e]),v(""),w(!0))};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(T,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[s.jsx(q,{className:"h-4 w-4 mr-1"}),"返回"]}),s.jsx("h1",{className:"text-2xl font-bold",children:"设置"})]}),s.jsxs(Nt,{defaultValue:"providers",children:[s.jsxs(St,{className:"mb-4",children:[s.jsx(Ct,{value:"providers",children:"云盘账号"}),s.jsx(Ct,{value:"strategy",children:"备份策略"}),s.jsx(Ct,{value:"history",children:"备份记录"}),s.jsxs(Ct,{value:"notifications",children:[s.jsx(he,{className:"h-3.5 w-3.5 mr-1.5"}),"通知"]}),s.jsxs(Ct,{value:"pomodoro",children:[s.jsx(G,{className:"h-3.5 w-3.5 mr-1.5"}),"番茄钟"]}),s.jsxs(Ct,{value:"usage",children:[s.jsx(fe,{className:"h-3.5 w-3.5 mr-1.5"}),"用量监控"]})]}),s.jsxs(kt,{value:"providers",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex justify-end",children:s.jsxs(T,{onClick:()=>l(!0),children:[s.jsx(X,{className:"h-4 w-4 mr-1"}),"添加云盘"]})}),o?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):0===n.length?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:n.map(e=>s.jsx(us,{provider:e,onDelete:ge,onReauth:ve},e.id))})]}),s.jsx(ls,{open:i,onOpenChange:l,onAdded:()=>{pe()}})]}),s.jsx(kt,{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:"匹配这些模式的文件和目录将不会被备份"}),m?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(Y,{children:p.map(e=>s.jsxs(Z.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:[e,s.jsx("button",{onClick:()=>(e=>{h(t=>t.filter(t=>t!==e)),w(!0)})(e),className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20 p-0.5",children:s.jsx(Q,{className:"h-3 w-3"})})]},e))})}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(E,{placeholder:"输入排除模式,例如 *.log",value:g,onChange:e=>v(e.target.value),onKeyDown:e=>{"Enter"===e.key&&ye()},className:"max-w-xs"}),s.jsx(T,{variant:"outline",size:"sm",onClick:ye,children:"添加"})]}),y&&s.jsxs(T,{onClick:async()=>{j(!0);try{await ae(p),w(!1)}catch{}finally{j(!1)}},disabled:b,children:[s.jsx(ue,{className:"h-4 w-4 mr-1"}),b?"保存中...":"保存"]})]})]}),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(Oe,{checked:c.enabled,onCheckedChange:async e=>{const t=c;d({...c,enabled:e});try{await ie({enabled:e})}catch{d(t)}}}),s.jsx(D,{children:c.enabled?"已开启":"已关闭"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(D,{children:"备份间隔"}),s.jsxs(es,{value:String(c.intervalMinutes),onValueChange:async e=>{const t=parseInt(e,10),n=c;d({...c,intervalMinutes:t});try{await ie({intervalMinutes:t})}catch{d(n)}},children:[s.jsx(ns,{className:"w-48",children:s.jsx(ts,{})}),s.jsx(ss,{children:xs.map(e=>s.jsx(as,{value:e.value,children:e.label},e.value))})]})]})]})]})]})}),s.jsx(kt,{value:"history",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex justify-end",children:s.jsxs(T,{variant:"outline",size:"sm",onClick:()=>{k(!0),me()},children:[s.jsx(V,{className:"h-4 w-4 mr-1"}),"刷新"]})}),C?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):s.jsx(hs,{history:N})]})}),s.jsx(kt,{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(D,{className:"text-xs",children:"Webhook URL"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(E,{placeholder:"https://hooks.slack.com/...",value:L,onChange:e=>F(e.target.value),className:"font-mono text-xs"}),s.jsx(T,{size:"sm",onClick:()=>{(async()=>{W(!0);try{const e=await le({webhookEnabled:L.trim().length>0,webhookUrl:L.trim()||void 0});M(e),ee.success("Webhook 配置已保存")}catch{ee.error("保存失败")}finally{W(!1)}})()},disabled:H,children:H?"保存中…":"保存"})]}),I.webhookEnabled&&I.webhookUrl&&s.jsxs("p",{className:"text-xs text-green-500",children:["已启用 → ",I.webhookUrl]})]})]})]})}),s.jsx(kt,{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(D,{className:"text-xs",children:"工作时长(分钟)"}),s.jsx(E,{type:"number",min:1,max:120,value:R.workMinutes,onChange:e=>xe("workMinutes",e.target.value),className:"w-full"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(D,{className:"text-xs",children:"休息时长(分钟)"}),s.jsx(E,{type:"number",min:1,max:60,value:R.breakMinutes,onChange:e=>xe("breakMinutes",e.target.value),className:"w-full"})]})]}),P&&s.jsxs(T,{size:"sm",onClick:()=>{J(K.pomodoroConfig,R,!0),_(!1),ee.success("番茄钟设置已保存")},children:[s.jsx(ue,{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(G,{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(kt,{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(e=>s.jsxs("label",{className:"flex items-start gap-3 rounded-lg border p-3 cursor-pointer transition-colors "+(ce===e.key?"border-blue-500/50 bg-blue-500/5":"border-border hover:bg-muted/30"),children:[s.jsx("input",{type:"radio",name:"usageTool",value:e.key,checked:ce===e.key,onChange:()=>{de(e.key),J(K.usageMonitorTool,e.key),window.dispatchEvent(new Event("ccweb:usage-tool-change")),ee.success(`用量监控已切换为 ${e.label}`)},className:"mt-0.5"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium",children:e.label}),s.jsx("div",{className:"text-xs text-muted-foreground",children:e.desc})]})]},e.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{gs as SettingsPage};
@@ -1 +1 @@
1
- import{ax as e,r as s,be as t,j as r,e as a}from"./index-CCg_jxVN.js";import{U as n}from"./user-CeCemcDe.js";import{B as c}from"./bot-C1tzwDVf.js";function l(){const{token:l}=e(),[d,i]=s.useState(!0),[m,x]=s.useState(null),[o,u]=s.useState(null),[h,g]=s.useState("");if(s.useEffect(()=>{l&&(i(!0),t(l).then(e=>{document.title=e.projectName+" — cc-web",u(e.session),g(e.projectName)}).catch(e=>x(e.message||"链接无效或已过期")).finally(()=>i(!1)))},[l]),d)return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:r.jsx("span",{className:"text-muted-foreground text-sm",children:"加载中…"})});if(m||!o)return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:r.jsxs("div",{className:"text-center space-y-2",children:[r.jsx("p",{className:"text-foreground font-medium",children:"无法加载会话"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:m??"链接无效或已过期"})]})});const f=new Date(o.startedAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return r.jsx("div",{className:"min-h-screen bg-background text-foreground",children:r.jsxs("div",{className:"max-w-2xl mx-auto px-4 py-8",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:h}),r.jsxs("div",{className:"flex items-center gap-3 mt-1 text-sm text-muted-foreground",children:[r.jsx("span",{children:f}),r.jsx("span",{children:"·"}),r.jsxs("span",{children:[o.messageCount," 条消息"]})]})]}),r.jsxs("div",{className:"space-y-4",children:[0===o.messages.length&&r.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"本次会话暂无记录"}),o.messages.map((e,s)=>r.jsxs("div",{className:a("flex gap-2.5","user"===e.role?"flex-row-reverse":"flex-row"),children:[r.jsx("div",{className:a("flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center mt-0.5","user"===e.role?"bg-blue-500/10":"bg-muted"),children:"user"===e.role?r.jsx(n,{className:"h-3.5 w-3.5 text-blue-400"}):r.jsx(c,{className:"h-3.5 w-3.5 text-muted-foreground"})}),r.jsx("div",{className:a("max-w-[85%] text-sm rounded-lg px-3 py-2 whitespace-pre-wrap break-words","user"===e.role?"bg-blue-500/10 text-blue-400":"bg-muted text-foreground"),children:e.content})]},s))]})]})})}export{l as ShareViewPage};
1
+ import{aw as e,r as s,bd as t,j as r,e as a}from"./index-DUFBsYmE.js";import{U as n}from"./user-IGpXOo32.js";import{B as c}from"./bot-DouqVXGt.js";function l(){const{token:l}=e(),[d,i]=s.useState(!0),[m,x]=s.useState(null),[o,u]=s.useState(null),[h,g]=s.useState("");if(s.useEffect(()=>{l&&(i(!0),t(l).then(e=>{document.title=e.projectName+" — cc-web",u(e.session),g(e.projectName)}).catch(e=>x(e.message||"链接无效或已过期")).finally(()=>i(!1)))},[l]),d)return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:r.jsx("span",{className:"text-muted-foreground text-sm",children:"加载中…"})});if(m||!o)return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:r.jsxs("div",{className:"text-center space-y-2",children:[r.jsx("p",{className:"text-foreground font-medium",children:"无法加载会话"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:m??"链接无效或已过期"})]})});const f=new Date(o.startedAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return r.jsx("div",{className:"min-h-screen bg-background text-foreground",children:r.jsxs("div",{className:"max-w-2xl mx-auto px-4 py-8",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:h}),r.jsxs("div",{className:"flex items-center gap-3 mt-1 text-sm text-muted-foreground",children:[r.jsx("span",{children:f}),r.jsx("span",{children:"·"}),r.jsxs("span",{children:[o.messageCount," 条消息"]})]})]}),r.jsxs("div",{className:"space-y-4",children:[0===o.messages.length&&r.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"本次会话暂无记录"}),o.messages.map((e,s)=>r.jsxs("div",{className:a("flex gap-2.5","user"===e.role?"flex-row-reverse":"flex-row"),children:[r.jsx("div",{className:a("flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center mt-0.5","user"===e.role?"bg-blue-500/10":"bg-muted"),children:"user"===e.role?r.jsx(n,{className:"h-3.5 w-3.5 text-blue-400"}):r.jsx(c,{className:"h-3.5 w-3.5 text-muted-foreground"})}),r.jsx("div",{className:a("max-w-[85%] text-sm rounded-lg px-3 py-2 whitespace-pre-wrap break-words","user"===e.role?"bg-blue-500/10 text-blue-400":"bg-muted text-foreground"),children:e.content})]},s))]})]})})}export{l as ShareViewPage};
@@ -1,4 +1,4 @@
1
- import{c as e,ah as s,r as t,b8 as a,b9 as r,t as n,ba as l,bb as i,bc as d,j as c,B as o,ai as m,e as x,ao as u,I as h,V as p,p as g,a1 as f,A as j,bd as b}from"./index-CCg_jxVN.js";import{D as N}from"./download-9FIGdbRW.js";import{U as v}from"./user-CeCemcDe.js";import{C as y}from"./chevron-down-D7wjv7kr.js";
1
+ import{c as e,ah as s,r as t,b7 as a,b8 as r,t as n,b9 as l,ba as i,bb as d,j as c,B as o,ai as m,e as x,I as u,V as h,p,a1 as g,A as f,bc as j}from"./index-DUFBsYmE.js";import{S as b,D as N}from"./search-DvT55wyf.js";import{U as v}from"./user-IGpXOo32.js";import{C as y}from"./chevron-down-Dc9wET1O.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -10,4 +10,4 @@ import{c as e,ah as s,r as t,b8 as a,b9 as r,t as n,ba as l,bb as i,bc as d,j as
10
10
  *
11
11
  * This source code is licensed under the ISC license.
12
12
  * See the LICENSE file in the root directory of this source tree.
13
- */function S(){const e=s(),[S,_]=t.useState("skills"),[E,z]=t.useState([]),[L,M]=t.useState([]),[A,H]=t.useState(!1),[I,P]=t.useState(null);t.useEffect(()=>{"plugins"===S&&(H(!0),Promise.all([a().catch(()=>[]),fetch("/api/skillhub/plugins").then(e=>e.ok?e.json():[]).catch(()=>[])]).then(([e,s])=>{z(e),M(s)}).finally(()=>H(!1)))},[S]);const F=t.useCallback(async e=>{if(!I){P(e.id);try{await r(e.downloadUrl),n.success(`已安装 ${e.name}`);const s=await a().catch(()=>[]);z(s)}catch(s){n.error(s instanceof Error?s.message:"安装失败")}finally{P(null)}}},[I]),D=t.useCallback(async e=>{try{await l(e),z(s=>s.filter(s=>s.id!==e)),n.success("已卸载")}catch(s){n.error(s instanceof Error?s.message:"卸载失败")}},[]),O=t.useCallback(async(e,s)=>{try{await i(e,s),z(t=>t.map(t=>t.id===e?{...t,enabled:s}:t))}catch(t){n.error(t instanceof Error?t.message:"操作失败")}},[]),[U,Z]=t.useState([]),[$,B]=t.useState(!0),[T,V]=t.useState(null),[q,G]=t.useState(""),[J,K]=t.useState(null),[Q,R]=t.useState(null),[W,X]=t.useState(null),[Y,ee]=t.useState(new Set);t.useEffect(()=>{d().then(Z).catch(e=>V(e instanceof Error?e.message:"Failed to load SkillHub")).finally(()=>B(!1))},[]);const se=t.useMemo(()=>{const e=new Set;return U.forEach(s=>{var t;return null==(t=s.tags)?void 0:t.forEach(s=>e.add(s))}),Array.from(e).sort()},[U]),te=t.useMemo(()=>U.some(e=>!e.tags||0===e.tags.length),[U]),ae=t.useMemo(()=>{let e=U;if("__untagged__"===J?e=e.filter(e=>!e.tags||0===e.tags.length):J&&(e=e.filter(e=>{var s;return null==(s=e.tags)?void 0:s.includes(J)})),q.trim()){const s=q.toLowerCase();e=e.filter(e=>{var t;return e.label.toLowerCase().includes(s)||e.description.toLowerCase().includes(s)||e.command.toLowerCase().includes(s)||e.author.toLowerCase().includes(s)||(null==(t=e.tags)?void 0:t.some(e=>e.toLowerCase().includes(s)))})}return e},[U,q,J]);return c.jsxs("div",{className:"min-h-screen bg-background",children:[c.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:c.jsxs("div",{className:"max-w-4xl mx-auto px-4 h-14 flex items-center gap-4",children:[c.jsxs(o,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[c.jsx(m,{className:"h-4 w-4 mr-1"}),"返回"]}),c.jsx("h1",{className:"font-semibold text-lg",children:"SkillHub"}),c.jsxs("div",{className:"flex items-center gap-1 ml-4",children:[c.jsx("button",{onClick:()=>_("skills"),className:x("px-3 py-1 rounded-md text-sm transition-colors","skills"===S?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:"技能"}),c.jsxs("button",{onClick:()=>_("plugins"),className:x("px-3 py-1 rounded-md text-sm transition-colors flex items-center gap-1","plugins"===S?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:[c.jsx(k,{className:"h-3.5 w-3.5"}),"插件"]})]}),c.jsx("div",{className:"flex-1"}),c.jsxs("div",{className:"relative w-64",children:[c.jsx(u,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),c.jsx(h,{placeholder:"搜索命令...",value:q,onChange:e=>G(e.target.value),className:"pl-8 h-9"})]})]})}),c.jsxs("main",{className:"max-w-4xl mx-auto px-4 py-6",children:["plugins"===S&&c.jsxs("div",{children:[A&&c.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),!A&&c.jsxs(c.Fragment,{children:[E.length>0&&c.jsxs("div",{className:"mb-8",children:[c.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:"已安装"}),c.jsx("div",{className:"space-y-2",children:E.map(e=>c.jsxs("div",{className:"rounded-lg border bg-card p-4 flex items-center gap-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium text-sm",children:e.name}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",e.version]}),c.jsx("span",{className:x("text-xs px-1.5 py-0.5 rounded",e.enabled?"bg-green-500/10 text-green-500":"bg-muted text-muted-foreground"),children:e.enabled?"启用":"禁用"})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.description}),e.permissions.length>0&&c.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:e.permissions.map(e=>c.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:e},e))})]}),c.jsx(o,{size:"sm",variant:"ghost",onClick:()=>O(e.id,!e.enabled),title:e.enabled?"禁用":"启用",children:c.jsx(w,{className:x("h-4 w-4",e.enabled?"text-green-500":"text-muted-foreground")})}),c.jsx(o,{size:"sm",variant:"ghost",onClick:()=>D(e.id),title:"卸载",children:c.jsx(p,{className:"h-4 w-4 text-red-400"})})]},e.id))})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:E.length>0?"更多插件":"可用插件"}),0===L.length&&c.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[c.jsx(k,{className:"h-10 w-10 mx-auto mb-3 opacity-30"}),c.jsx("p",{className:"text-sm",children:"插件中心暂无可用插件"})]}),c.jsx("div",{className:"space-y-2",children:L.filter(e=>!E.some(s=>s.id===e.id)).map((e,s)=>{const t=I===e.id;return c.jsxs(g.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:.03*s},className:"rounded-lg border bg-card p-4 flex items-center gap-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium text-sm",children:e.name}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",e.version]}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:["by ",e.author]})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.description}),e.permissions.length>0&&c.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:e.permissions.map(e=>c.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:e},e))})]}),c.jsxs(o,{size:"sm",disabled:t,onClick:()=>F(e),children:[c.jsx(N,{className:"h-3.5 w-3.5 mr-1"}),t?"安装中...":"安装"]})]},e.id)})})]})]})]}),"skills"===S&&c.jsxs(c.Fragment,{children:[se.length>0&&c.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[c.jsx("button",{className:x("px-3 py-1 rounded-full text-xs font-medium transition-colors",null===J?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>K(null),children:"全部"}),se.map(e=>c.jsx("button",{className:x("px-3 py-1 rounded-full text-xs font-medium transition-colors",J===e?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>K(J===e?null:e),children:e},e)),te&&c.jsx("button",{className:x("px-3 py-1 rounded-full text-xs font-medium transition-colors","__untagged__"===J?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>K("__untagged__"===J?null:"__untagged__"),children:"无标签"})]}),$&&c.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),T&&c.jsx("div",{className:"text-center text-destructive py-20",children:T}),!$&&!T&&0===U.length&&c.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[c.jsx("p",{className:"text-lg mb-2",children:"SkillHub 还没有命令"}),c.jsx("p",{className:"text-sm",children:"在快捷命令面板中点击分享按钮来提交第一个命令吧!"})]}),!$&&!T&&U.length>0&&0===ae.length&&c.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的命令"}),c.jsx("div",{className:"space-y-3",children:ae.map((e,s)=>{var t;const a=Q===e.id,r=Y.has(e.id),l=W===e.id,i=e.parentId?U.find(s=>s.id===e.parentId):void 0;return c.jsxs(g.div,{layout:!0,initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:.03*s,ease:"easeOut"},className:"rounded-lg border bg-card p-4 cursor-pointer hover:border-muted-foreground/30 transition-colors",onClick:()=>R(a?null:e.id),children:[c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("h3",{className:"font-medium text-sm truncate",children:e.label}),null==(t=e.tags)?void 0:t.map(e=>c.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:[c.jsx(C,{className:"h-2.5 w-2.5"}),e]},e))]}),i&&c.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[c.jsx(f,{className:"h-3 w-3 text-muted-foreground"}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:["继承: ",i.label]})]}),e.description&&c.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:e.description}),c.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(v,{className:"h-3 w-3"}),e.author]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(N,{className:"h-3 w-3"}),e.downloads||0]}),c.jsx("span",{children:e.createdAt})]})]}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[c.jsxs(o,{size:"sm",variant:r?"outline":"default",disabled:l||r,onClick:s=>(async(e,s)=>{if(s.stopPropagation(),!W&&!Y.has(e.id)){X(e.id);try{await b(e.id),ee(s=>new Set(s).add(e.id)),Z(s=>s.map(s=>s.id===e.id?{...s,downloads:(s.downloads||0)+1}:s))}catch(t){n.error(t instanceof Error?t.message:"Download failed")}finally{X(null)}}})(e,s),title:i?`将同时下载继承的「${i.label}」`:void 0,children:[c.jsx(N,{className:"h-3.5 w-3.5 mr-1"}),r?"已下载":l?"下载中...":"下载"]}),c.jsx(g.span,{animate:{rotate:a?180:0},transition:{duration:.2},children:c.jsx(y,{className:"h-4 w-4 text-muted-foreground"})})]})]}),c.jsx(j,{children:a&&c.jsx(g.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:c.jsx("div",{className:"mt-3 pt-3 border-t",children:c.jsx("pre",{className:"text-xs font-mono bg-muted rounded p-3 whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:e.command})})})})]},e.id)})})]})]})]})}export{S as SkillHubPage};
13
+ */function S(){const e=s(),[S,_]=t.useState("skills"),[E,z]=t.useState([]),[L,M]=t.useState([]),[A,H]=t.useState(!1),[I,P]=t.useState(null);t.useEffect(()=>{"plugins"===S&&(H(!0),Promise.all([a().catch(()=>[]),fetch("/api/skillhub/plugins").then(e=>e.ok?e.json():[]).catch(()=>[])]).then(([e,s])=>{z(e),M(s)}).finally(()=>H(!1)))},[S]);const F=t.useCallback(async e=>{if(!I){P(e.id);try{await r(e.downloadUrl),n.success(`已安装 ${e.name}`);const s=await a().catch(()=>[]);z(s)}catch(s){n.error(s instanceof Error?s.message:"安装失败")}finally{P(null)}}},[I]),D=t.useCallback(async e=>{try{await l(e),z(s=>s.filter(s=>s.id!==e)),n.success("已卸载")}catch(s){n.error(s instanceof Error?s.message:"卸载失败")}},[]),O=t.useCallback(async(e,s)=>{try{await i(e,s),z(t=>t.map(t=>t.id===e?{...t,enabled:s}:t))}catch(t){n.error(t instanceof Error?t.message:"操作失败")}},[]),[U,Z]=t.useState([]),[$,B]=t.useState(!0),[T,V]=t.useState(null),[q,G]=t.useState(""),[J,K]=t.useState(null),[Q,R]=t.useState(null),[W,X]=t.useState(null),[Y,ee]=t.useState(new Set);t.useEffect(()=>{d().then(Z).catch(e=>V(e instanceof Error?e.message:"Failed to load SkillHub")).finally(()=>B(!1))},[]);const se=t.useMemo(()=>{const e=new Set;return U.forEach(s=>{var t;return null==(t=s.tags)?void 0:t.forEach(s=>e.add(s))}),Array.from(e).sort()},[U]),te=t.useMemo(()=>U.some(e=>!e.tags||0===e.tags.length),[U]),ae=t.useMemo(()=>{let e=U;if("__untagged__"===J?e=e.filter(e=>!e.tags||0===e.tags.length):J&&(e=e.filter(e=>{var s;return null==(s=e.tags)?void 0:s.includes(J)})),q.trim()){const s=q.toLowerCase();e=e.filter(e=>{var t;return e.label.toLowerCase().includes(s)||e.description.toLowerCase().includes(s)||e.command.toLowerCase().includes(s)||e.author.toLowerCase().includes(s)||(null==(t=e.tags)?void 0:t.some(e=>e.toLowerCase().includes(s)))})}return e},[U,q,J]);return c.jsxs("div",{className:"min-h-screen bg-background",children:[c.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:c.jsxs("div",{className:"max-w-4xl mx-auto px-4 h-14 flex items-center gap-4",children:[c.jsxs(o,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[c.jsx(m,{className:"h-4 w-4 mr-1"}),"返回"]}),c.jsx("h1",{className:"font-semibold text-lg",children:"SkillHub"}),c.jsxs("div",{className:"flex items-center gap-1 ml-4",children:[c.jsx("button",{onClick:()=>_("skills"),className:x("px-3 py-1 rounded-md text-sm transition-colors","skills"===S?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:"技能"}),c.jsxs("button",{onClick:()=>_("plugins"),className:x("px-3 py-1 rounded-md text-sm transition-colors flex items-center gap-1","plugins"===S?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:[c.jsx(k,{className:"h-3.5 w-3.5"}),"插件"]})]}),c.jsx("div",{className:"flex-1"}),c.jsxs("div",{className:"relative w-64",children:[c.jsx(b,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),c.jsx(u,{placeholder:"搜索命令...",value:q,onChange:e=>G(e.target.value),className:"pl-8 h-9"})]})]})}),c.jsxs("main",{className:"max-w-4xl mx-auto px-4 py-6",children:["plugins"===S&&c.jsxs("div",{children:[A&&c.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),!A&&c.jsxs(c.Fragment,{children:[E.length>0&&c.jsxs("div",{className:"mb-8",children:[c.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:"已安装"}),c.jsx("div",{className:"space-y-2",children:E.map(e=>c.jsxs("div",{className:"rounded-lg border bg-card p-4 flex items-center gap-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium text-sm",children:e.name}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",e.version]}),c.jsx("span",{className:x("text-xs px-1.5 py-0.5 rounded",e.enabled?"bg-green-500/10 text-green-500":"bg-muted text-muted-foreground"),children:e.enabled?"启用":"禁用"})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.description}),e.permissions.length>0&&c.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:e.permissions.map(e=>c.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:e},e))})]}),c.jsx(o,{size:"sm",variant:"ghost",onClick:()=>O(e.id,!e.enabled),title:e.enabled?"禁用":"启用",children:c.jsx(w,{className:x("h-4 w-4",e.enabled?"text-green-500":"text-muted-foreground")})}),c.jsx(o,{size:"sm",variant:"ghost",onClick:()=>D(e.id),title:"卸载",children:c.jsx(h,{className:"h-4 w-4 text-red-400"})})]},e.id))})]}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:E.length>0?"更多插件":"可用插件"}),0===L.length&&c.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[c.jsx(k,{className:"h-10 w-10 mx-auto mb-3 opacity-30"}),c.jsx("p",{className:"text-sm",children:"插件中心暂无可用插件"})]}),c.jsx("div",{className:"space-y-2",children:L.filter(e=>!E.some(s=>s.id===e.id)).map((e,s)=>{const t=I===e.id;return c.jsxs(p.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:.03*s},className:"rounded-lg border bg-card p-4 flex items-center gap-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium text-sm",children:e.name}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",e.version]}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:["by ",e.author]})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.description}),e.permissions.length>0&&c.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:e.permissions.map(e=>c.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:e},e))})]}),c.jsxs(o,{size:"sm",disabled:t,onClick:()=>F(e),children:[c.jsx(N,{className:"h-3.5 w-3.5 mr-1"}),t?"安装中...":"安装"]})]},e.id)})})]})]})]}),"skills"===S&&c.jsxs(c.Fragment,{children:[se.length>0&&c.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[c.jsx("button",{className:x("px-3 py-1 rounded-full text-xs font-medium transition-colors",null===J?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>K(null),children:"全部"}),se.map(e=>c.jsx("button",{className:x("px-3 py-1 rounded-full text-xs font-medium transition-colors",J===e?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>K(J===e?null:e),children:e},e)),te&&c.jsx("button",{className:x("px-3 py-1 rounded-full text-xs font-medium transition-colors","__untagged__"===J?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>K("__untagged__"===J?null:"__untagged__"),children:"无标签"})]}),$&&c.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),T&&c.jsx("div",{className:"text-center text-destructive py-20",children:T}),!$&&!T&&0===U.length&&c.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[c.jsx("p",{className:"text-lg mb-2",children:"SkillHub 还没有命令"}),c.jsx("p",{className:"text-sm",children:"在快捷命令面板中点击分享按钮来提交第一个命令吧!"})]}),!$&&!T&&U.length>0&&0===ae.length&&c.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的命令"}),c.jsx("div",{className:"space-y-3",children:ae.map((e,s)=>{var t;const a=Q===e.id,r=Y.has(e.id),l=W===e.id,i=e.parentId?U.find(s=>s.id===e.parentId):void 0;return c.jsxs(p.div,{layout:!0,initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:.03*s,ease:"easeOut"},className:"rounded-lg border bg-card p-4 cursor-pointer hover:border-muted-foreground/30 transition-colors",onClick:()=>R(a?null:e.id),children:[c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("h3",{className:"font-medium text-sm truncate",children:e.label}),null==(t=e.tags)?void 0:t.map(e=>c.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:[c.jsx(C,{className:"h-2.5 w-2.5"}),e]},e))]}),i&&c.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[c.jsx(g,{className:"h-3 w-3 text-muted-foreground"}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:["继承: ",i.label]})]}),e.description&&c.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:e.description}),c.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(v,{className:"h-3 w-3"}),e.author]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(N,{className:"h-3 w-3"}),e.downloads||0]}),c.jsx("span",{children:e.createdAt})]})]}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[c.jsxs(o,{size:"sm",variant:r?"outline":"default",disabled:l||r,onClick:s=>(async(e,s)=>{if(s.stopPropagation(),!W&&!Y.has(e.id)){X(e.id);try{await j(e.id),ee(s=>new Set(s).add(e.id)),Z(s=>s.map(s=>s.id===e.id?{...s,downloads:(s.downloads||0)+1}:s))}catch(t){n.error(t instanceof Error?t.message:"Download failed")}finally{X(null)}}})(e,s),title:i?`将同时下载继承的「${i.label}」`:void 0,children:[c.jsx(N,{className:"h-3.5 w-3.5 mr-1"}),r?"已下载":l?"下载中...":"下载"]}),c.jsx(p.span,{animate:{rotate:a?180:0},transition:{duration:.2},children:c.jsx(y,{className:"h-4 w-4 text-muted-foreground"})})]})]}),c.jsx(f,{children:a&&c.jsx(p.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:c.jsx("div",{className:"mt-3 pt-3 border-t",children:c.jsx("pre",{className:"text-xs font-mono bg-muted rounded p-3 whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:e.command})})})})]},e.id)})})]})]})]})}export{S as SkillHubPage};
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-CCg_jxVN.js";
1
+ import{c as t}from"./index-DUFBsYmE.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-CCg_jxVN.js";
1
+ import{c as o}from"./index-DUFBsYmE.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *