@tom2012/cc-web 2026.4.19-u → 2026.4.19-w
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.
- package/README.md +1 -1
- package/backend/dist/adapters/claude-adapter.d.ts.map +1 -1
- package/backend/dist/adapters/claude-adapter.js +48 -5
- package/backend/dist/adapters/claude-adapter.js.map +1 -1
- package/backend/dist/crypto-at-rest.d.ts +8 -0
- package/backend/dist/crypto-at-rest.d.ts.map +1 -0
- package/backend/dist/crypto-at-rest.js +96 -0
- package/backend/dist/crypto-at-rest.js.map +1 -0
- package/backend/dist/hub-auth.d.ts +12 -0
- package/backend/dist/hub-auth.d.ts.map +1 -0
- package/backend/dist/hub-auth.js +123 -0
- package/backend/dist/hub-auth.js.map +1 -0
- package/backend/dist/index.d.ts.map +1 -1
- package/backend/dist/index.js +2 -0
- package/backend/dist/index.js.map +1 -1
- package/backend/dist/memory-prompts.d.ts +30 -0
- package/backend/dist/memory-prompts.d.ts.map +1 -0
- package/backend/dist/memory-prompts.js +163 -0
- package/backend/dist/memory-prompts.js.map +1 -0
- package/backend/dist/routes/claude.d.ts.map +1 -1
- package/backend/dist/routes/claude.js +98 -0
- package/backend/dist/routes/claude.js.map +1 -1
- package/backend/dist/routes/memory-prompts.d.ts +3 -0
- package/backend/dist/routes/memory-prompts.d.ts.map +1 -0
- package/backend/dist/routes/memory-prompts.js +49 -0
- package/backend/dist/routes/memory-prompts.js.map +1 -0
- package/backend/dist/routes/skillhub.d.ts.map +1 -1
- package/backend/dist/routes/skillhub.js +170 -0
- package/backend/dist/routes/skillhub.js.map +1 -1
- package/backend/dist/session-manager.d.ts +12 -0
- package/backend/dist/session-manager.d.ts.map +1 -1
- package/backend/dist/session-manager.js.map +1 -1
- package/backend/dist/sync-service.d.ts.map +1 -1
- package/backend/dist/sync-service.js +7 -2
- package/backend/dist/sync-service.js.map +1 -1
- package/frontend/dist/assets/AssistantMessageContent-ZKbU1jlC.js +13 -0
- package/frontend/dist/assets/{GraphPreview-UVA4ODDv.js → GraphPreview-FNlubgv_.js} +1 -1
- package/frontend/dist/assets/{MobilePage-8bMFdgD9.js → MobilePage-C0xGtLMa.js} +3 -3
- package/frontend/dist/assets/{OfficePreview-DFa568OD.js → OfficePreview-THZQ5px4.js} +2 -2
- package/frontend/dist/assets/{ProjectPage-D23Cx4LX.js → ProjectPage-CTEe2Tdp.js} +5 -5
- package/frontend/dist/assets/SettingsPage-DAflwmGB.js +13 -0
- package/frontend/dist/assets/{SkillHubPage-BBWaNxzY.js → SkillHubPage-PxI0FGcw.js} +3 -3
- package/frontend/dist/assets/{chevron-down-XjVVezAn.js → chevron-down-DtcZkqFf.js} +1 -1
- package/frontend/dist/assets/chevron-up-CUW9T6yb.js +13 -0
- package/frontend/dist/assets/{index-Qowsi3Ey.js → index-D1P-udhw.js} +2 -2
- package/frontend/dist/assets/index-DCiTw3F5.css +1 -0
- package/frontend/dist/assets/index-fJX6wxPU.js +75 -0
- package/frontend/dist/assets/{index-Cz7UGH1l.js → index-rGoP4nhR.js} +1 -1
- package/frontend/dist/assets/{jszip.min-BvfmA-CV.js → jszip.min-Dz4RfJJo.js} +1 -1
- package/frontend/dist/assets/{search-CdJtkP3F.js → search-28CWGQwO.js} +1 -1
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/AssistantMessageContent-DuOuKxgH.js +0 -13
- package/frontend/dist/assets/SettingsPage-CTTCafJA.js +0 -13
- package/frontend/dist/assets/chevron-up-BD4j4icv.js +0 -7
- package/frontend/dist/assets/index-BL3iZx_u.css +0 -1
- package/frontend/dist/assets/index-hLxTQaCY.js +0 -75
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{c as e,r as s,U as t,aW as a,j as n,W as r,V as l,N as o,d as i,K as c,aX as d,aJ as u,Q as h,aY as x,L as m,Y as p,$ as f,a0 as v,a1 as g,a2 as j,x as y,aZ as b,aa as w,ab as N,ac as k,ad as S,ae as C,B as R,af as _,I as P,ag as T,a_ as E,a$ as I,b0 as D,b1 as M,b2 as O,az as A,b3 as H,l as L,T as V,b4 as z,t as F,aC as W,D as B,b5 as $,b6 as K,b7 as U,u as q,b8 as G,b9 as Z,ba as X,ax as Q,bb as Y,bc as J,h as ee,S as se,bd as te,ay as ae,be as ne,y as re,A as le,p as oe,X as ie,s as ce,bf as de,bg as ue,bh as he,bi as xe,bj as me,bk as pe,bl as fe,bm as ve}from"./index-fJX6wxPU.js";import{k as ge,u as je,R as ye,d as be,f as we,A as Ne,C as ke,j as Se,h as Ce,S as Re,U as _e,T as Pe,a as Te,b as Ee,i as Ie,c as De}from"./index-D1P-udhw.js";import{C as Me}from"./chevron-down-DtcZkqFf.js";import{C as Oe,a as Ae}from"./chevron-up-CUW9T6yb.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license lucide-react v0.309.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const He=e("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]),Le=e("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Ve=e("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]),ze=e("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]),Fe=e("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]),We=e("ExternalLink",[["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}],["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["line",{x1:"10",x2:"21",y1:"14",y2:"3",key:"18c3s4"}]]),Be=e("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),$e=e("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),Ke=e("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]),Ue=e("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),qe=e("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);
|
|
8
|
+
/**
|
|
9
|
+
* @license lucide-react v0.309.0 - ISC
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the ISC license.
|
|
12
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/function Ge(e){const t=s.useRef({value:e,previous:e});return s.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Ze="Switch",[Xe]=o(Ze),[Qe,Ye]=Xe(Ze),Je=s.forwardRef((e,o)=>{const{__scopeSwitch:i,name:c,checked:d,defaultChecked:u,required:h,disabled:x,value:m="on",onCheckedChange:p,form:f,...v}=e,[g,j]=s.useState(null),y=t(o,e=>j(e)),b=s.useRef(!1),w=!g||(f||!!g.closest("form")),[N,k]=a({prop:d,defaultProp:u??!1,onChange:p,caller:Ze});return n.jsxs(Qe,{scope:i,checked:N,disabled:x,children:[n.jsx(r.button,{type:"button",role:"switch","aria-checked":N,"aria-required":h,"data-state":as(N),"data-disabled":x?"":void 0,disabled:x,value:m,...v,ref:y,onClick:l(e.onClick,e=>{k(e=>!e),w&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),w&&n.jsx(ts,{control:g,bubbles:!b.current,name:c,value:m,checked:N,required:h,disabled:x,form:f,style:{transform:"translateX(-100%)"}})]})});Je.displayName=Ze;var es="SwitchThumb",ss=s.forwardRef((e,s)=>{const{__scopeSwitch:t,...a}=e,l=Ye(es,t);return n.jsx(r.span,{"data-state":as(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:s})});ss.displayName=es;var ts=s.forwardRef(({__scopeSwitch:e,control:a,checked:r,bubbles:l=!0,...o},i)=>{const c=s.useRef(null),d=t(c,i),u=Ge(r),h=ge(a);return s.useEffect(()=>{const e=c.current;if(!e)return;const s=window.HTMLInputElement.prototype,t=Object.getOwnPropertyDescriptor(s,"checked").set;if(u!==r&&t){const s=new Event("click",{bubbles:l});t.call(e,r),e.dispatchEvent(s)}},[u,r,l]),n.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...o,tabIndex:-1,ref:d,style:{...o.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function as(e){return e?"checked":"unchecked"}ts.displayName="SwitchBubbleInput";var ns=Je,rs=ss;const ls=s.forwardRef(({className:e,...s},t)=>n.jsx(ns,{className:i("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),...s,ref:t,children:n.jsx(rs,{className:i("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 os(e){const t=is(e),a=s.forwardRef((e,a)=>{const{children:r,...l}=e,o=s.Children.toArray(r),i=o.find(ds);if(i){const e=i.props.children,r=o.map(t=>t===i?s.Children.count(e)>1?s.Children.only(null):s.isValidElement(e)?e.props.children:null:t);return n.jsx(t,{...l,ref:a,children:s.isValidElement(e)?s.cloneElement(e,void 0,r):null})}return n.jsx(t,{...l,ref:a,children:r})});return a.displayName=`${e}.Slot`,a}function is(e){const t=s.forwardRef((e,t)=>{const{children:a,...n}=e;if(s.isValidElement(a)){const e=function(e){var s,t;let a=null==(s=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:s.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=null==(t=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(a),r=function(e,s){const t={...s};for(const a in s){const n=e[a],r=s[a];/^on[A-Z]/.test(a)?n&&r?t[a]=(...e)=>{const s=r(...e);return n(...e),s}:n&&(t[a]=n):"style"===a?t[a]={...n,...r}:"className"===a&&(t[a]=[n,r].filter(Boolean).join(" "))}return{...e,...t}}(n,a.props);return a.type!==s.Fragment&&(r.ref=t?c(t,e):e),s.cloneElement(a,r)}return s.Children.count(a)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}ls.displayName=ns.displayName;var cs=Symbol("radix.slottable");function ds(e){return s.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===cs}var us=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"});s.forwardRef((e,s)=>n.jsx(r.span,{...e,ref:s,style:{...us,...e.style}})).displayName="VisuallyHidden";var hs=[" ","Enter","ArrowUp","ArrowDown"],xs=[" ","Enter"],ms="Select",[ps,fs,vs]=we(ms),[gs]=o(ms,[vs,be]),js=be(),[ys,bs]=gs(ms),[ws,Ns]=gs(ms),ks=e=>{const{__scopeSelect:t,children:r,open:l,defaultOpen:o,onOpenChange:i,value:c,defaultValue:u,onValueChange:h,dir:x,name:m,autoComplete:p,disabled:f,required:v,form:g}=e,j=js(t),[y,b]=s.useState(null),[w,N]=s.useState(null),[k,S]=s.useState(!1),C=je(x),[R,_]=a({prop:l,defaultProp:o??!1,onChange:i,caller:ms}),[P,T]=a({prop:c,defaultProp:u,onChange:h,caller:ms}),E=s.useRef(null),I=!y||(g||!!y.closest("form")),[D,M]=s.useState(new Set),O=Array.from(D).map(e=>e.props.value).join(";");return n.jsx(ye,{...j,children:n.jsxs(ys,{required:v,scope:t,trigger:y,onTriggerChange:b,valueNode:w,onValueNodeChange:N,valueNodeHasChildren:k,onValueNodeHasChildrenChange:S,contentId:d(),value:P,onValueChange:T,open:R,onOpenChange:_,dir:C,triggerPointerDownPosRef:E,disabled:f,children:[n.jsx(ps.Provider,{scope:t,children:n.jsx(ws,{scope:e.__scopeSelect,onNativeOptionAdd:s.useCallback(e=>{M(s=>new Set(s).add(e))},[]),onNativeOptionRemove:s.useCallback(e=>{M(s=>{const t=new Set(s);return t.delete(e),t})},[]),children:r})}),I?n.jsxs(dt,{"aria-hidden":!0,required:v,tabIndex:-1,name:m,autoComplete:p,value:P,onChange:e=>T(e.target.value),disabled:f,form:g,children:[void 0===P?n.jsx("option",{value:""}):null,Array.from(D)]},O):null]})})};ks.displayName=ms;var Ss="SelectTrigger",Cs=s.forwardRef((e,a)=>{const{__scopeSelect:o,disabled:i=!1,...c}=e,d=js(o),u=bs(Ss,o),h=u.disabled||i,x=t(a,u.onTriggerChange),m=fs(o),p=s.useRef("touch"),[f,v,g]=ht(e=>{const s=m().filter(e=>!e.disabled),t=s.find(e=>e.value===u.value),a=xt(s,e,t);void 0!==a&&u.onValueChange(a.value)}),j=e=>{h||(u.onOpenChange(!0),g()),e&&(u.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return n.jsx(Ne,{asChild:!0,...d,children:n.jsx(r.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:h,"data-disabled":h?"":void 0,"data-placeholder":ut(u.value)?"":void 0,...c,ref:x,onClick:l(c.onClick,e=>{e.currentTarget.focus(),"mouse"!==p.current&&j(e)}),onPointerDown:l(c.onPointerDown,e=>{p.current=e.pointerType;const s=e.target;s.hasPointerCapture(e.pointerId)&&s.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(j(e),e.preventDefault())}),onKeyDown:l(c.onKeyDown,e=>{const s=""!==f.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||v(e.key),s&&" "===e.key||hs.includes(e.key)&&(j(),e.preventDefault())})})})});Cs.displayName=Ss;var Rs="SelectValue",_s=s.forwardRef((e,s)=>{const{__scopeSelect:a,className:l,style:o,children:i,placeholder:c="",...d}=e,h=bs(Rs,a),{onValueNodeHasChildrenChange:x}=h,m=void 0!==i,p=t(s,h.onValueNodeChange);return u(()=>{x(m)},[x,m]),n.jsx(r.span,{...d,ref:p,style:{pointerEvents:"none"},children:ut(h.value)?n.jsx(n.Fragment,{children:c}):i})});_s.displayName=Rs;var Ps=s.forwardRef((e,s)=>{const{__scopeSelect:t,children:a,...l}=e;return n.jsx(r.span,{"aria-hidden":!0,...l,ref:s,children:a||"▼"})});Ps.displayName="SelectIcon";var Ts=e=>n.jsx(h,{asChild:!0,...e});Ts.displayName="SelectPortal";var Es="SelectContent",Is=s.forwardRef((e,t)=>{const a=bs(Es,e.__scopeSelect),[r,l]=s.useState();if(u(()=>{l(new DocumentFragment)},[]),!a.open){const s=r;return s?x.createPortal(n.jsx(Ms,{scope:e.__scopeSelect,children:n.jsx(ps.Slot,{scope:e.__scopeSelect,children:n.jsx("div",{children:e.children})})}),s):null}return n.jsx(Hs,{...e,ref:t})});Is.displayName=Es;var Ds=10,[Ms,Os]=gs(Es),As=os("SelectContent.RemoveScroll"),Hs=s.forwardRef((e,a)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:c,onPointerDownOutside:d,side:u,sideOffset:h,align:x,alignOffset:m,arrowPadding:y,collisionBoundary:b,collisionPadding:w,sticky:N,hideWhenDetached:k,avoidCollisions:S,...C}=e,R=bs(Es,r),[_,P]=s.useState(null),[T,E]=s.useState(null),I=t(a,e=>P(e)),[D,M]=s.useState(null),[O,A]=s.useState(null),H=fs(r),[L,V]=s.useState(!1),z=s.useRef(!1);s.useEffect(()=>{if(_)return p(_)},[_]),f();const F=s.useCallback(e=>{const[s,...t]=H().map(e=>e.ref.current),[a]=t.slice(-1),n=document.activeElement;for(const r of e){if(r===n)return;if(null==r||r.scrollIntoView({block:"nearest"}),r===s&&T&&(T.scrollTop=0),r===a&&T&&(T.scrollTop=T.scrollHeight),null==r||r.focus(),document.activeElement!==n)return}},[H,T]),W=s.useCallback(()=>F([D,_]),[F,D,_]);s.useEffect(()=>{L&&W()},[L,W]);const{onOpenChange:B,triggerPointerDownPosRef:$}=R;s.useEffect(()=>{if(_){let e={x:0,y:0};const s=s=>{var t,a;e={x:Math.abs(Math.round(s.pageX)-((null==(t=$.current)?void 0:t.x)??0)),y:Math.abs(Math.round(s.pageY)-((null==(a=$.current)?void 0:a.y)??0))}},t=t=>{e.x<=10&&e.y<=10?t.preventDefault():_.contains(t.target)||B(!1),document.removeEventListener("pointermove",s),$.current=null};return null!==$.current&&(document.addEventListener("pointermove",s),document.addEventListener("pointerup",t,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",t,{capture:!0})}}},[_,B,$]),s.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]=ht(e=>{const s=H().filter(e=>!e.disabled),t=s.find(e=>e.ref.current===document.activeElement),a=xt(s,e,t);a&&setTimeout(()=>a.ref.current.focus())}),q=s.useCallback((e,s,t)=>{const a=!z.current&&!t;(void 0!==R.value&&R.value===s||a)&&(M(e),a&&(z.current=!0))},[R.value]),G=s.useCallback(()=>null==_?void 0:_.focus(),[_]),Z=s.useCallback((e,s,t)=>{const a=!z.current&&!t;(void 0!==R.value&&R.value===s||a)&&A(e)},[R.value]),X="popper"===o?Vs:Ls,Q=X===Vs?{side:u,sideOffset:h,align:x,alignOffset:m,arrowPadding:y,collisionBoundary:b,collisionPadding:w,sticky:N,hideWhenDetached:k,avoidCollisions:S}:{};return n.jsx(Ms,{scope:r,content:_,viewport:T,onViewportChange:E,itemRefCallback:q,selectedItem:D,onItemLeave:G,itemTextRefCallback:Z,focusSelectedItem:W,selectedItemText:O,position:o,isPositioned:L,searchRef:K,children:n.jsx(v,{as:As,allowPinchZoom:!0,children:n.jsx(g,{asChild:!0,trapped:R.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:l(i,e=>{var s;null==(s=R.trigger)||s.focus({preventScroll:!0}),e.preventDefault()}),children:n.jsx(j,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:n.jsx(X,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:e=>e.preventDefault(),...C,...Q,onPlaced:()=>V(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:l(C.onKeyDown,e=>{const s=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),s||1!==e.key.length||U(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let s=H().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(s=s.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const t=e.target,a=s.indexOf(t);s=s.slice(a+1)}setTimeout(()=>F(s)),e.preventDefault()}})})})})})})});Hs.displayName="SelectContentImpl";var Ls=s.forwardRef((e,a)=>{const{__scopeSelect:l,onPlaced:o,...i}=e,c=bs(Es,l),d=Os(Es,l),[h,x]=s.useState(null),[m,p]=s.useState(null),f=t(a,e=>p(e)),v=fs(l),g=s.useRef(!1),j=s.useRef(!0),{viewport:y,selectedItem:b,selectedItemText:w,focusSelectedItem:N}=d,k=s.useCallback(()=>{if(c.trigger&&c.valueNode&&h&&m&&y&&b&&w){const e=c.trigger.getBoundingClientRect(),s=m.getBoundingClientRect(),t=c.valueNode.getBoundingClientRect(),a=w.getBoundingClientRect();if("rtl"!==c.dir){const n=a.left-s.left,r=t.left-n,l=e.left-r,o=e.width+l,i=Math.max(o,s.width),c=window.innerWidth-Ds,d=Se(r,[Ds,Math.max(Ds,c-i)]);h.style.minWidth=o+"px",h.style.left=d+"px"}else{const n=s.right-a.right,r=window.innerWidth-t.right-n,l=window.innerWidth-e.right-r,o=e.width+l,i=Math.max(o,s.width),c=window.innerWidth-Ds,d=Se(r,[Ds,Math.max(Ds,c-i)]);h.style.minWidth=o+"px",h.style.right=d+"px"}const n=v(),r=window.innerHeight-2*Ds,l=y.scrollHeight,i=window.getComputedStyle(m),d=parseInt(i.borderTopWidth,10),u=parseInt(i.paddingTop,10),x=parseInt(i.borderBottomWidth,10),p=d+u+l+parseInt(i.paddingBottom,10)+x,f=Math.min(5*b.offsetHeight,p),j=window.getComputedStyle(y),N=parseInt(j.paddingTop,10),k=parseInt(j.paddingBottom,10),S=e.top+e.height/2-Ds,C=r-S,R=b.offsetHeight/2,_=d+u+(b.offsetTop+R),P=p-_;if(_<=S){const e=n.length>0&&b===n[n.length-1].ref.current;h.style.bottom="0px";const s=m.clientHeight-y.offsetTop-y.offsetHeight,t=_+Math.max(C,R+(e?k:0)+s+x);h.style.height=t+"px"}else{const e=n.length>0&&b===n[0].ref.current;h.style.top="0px";const s=Math.max(S,d+y.offsetTop+(e?N:0)+R)+P;h.style.height=s+"px",y.scrollTop=_-S+y.offsetTop}h.style.margin=`${Ds}px 0`,h.style.minHeight=f+"px",h.style.maxHeight=r+"px",null==o||o(),requestAnimationFrame(()=>g.current=!0)}},[v,c.trigger,c.valueNode,h,m,y,b,w,c.dir,o]);u(()=>k(),[k]);const[S,C]=s.useState();u(()=>{m&&C(window.getComputedStyle(m).zIndex)},[m]);const R=s.useCallback(e=>{e&&!0===j.current&&(k(),null==N||N(),j.current=!1)},[k,N]);return n.jsx(zs,{scope:l,contentWrapper:h,shouldExpandOnScrollRef:g,onScrollButtonChange:R,children:n.jsx("div",{ref:x,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:n.jsx(r.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Ls.displayName="SelectItemAlignedPosition";var Vs=s.forwardRef((e,s)=>{const{__scopeSelect:t,align:a="start",collisionPadding:r=Ds,...l}=e,o=js(t);return n.jsx(ke,{...o,...l,ref:s,align:a,collisionPadding:r,style:{boxSizing:"border-box",...l.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)"}})});Vs.displayName="SelectPopperPosition";var[zs,Fs]=gs(Es,{}),Ws="SelectViewport",Bs=s.forwardRef((e,a)=>{const{__scopeSelect:o,nonce:i,...c}=e,d=Os(Ws,o),u=Fs(Ws,o),h=t(a,d.onViewportChange),x=s.useRef(0);return n.jsxs(n.Fragment,{children:[n.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:i}),n.jsx(ps.Slot,{scope:o,children:n.jsx(r.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:h,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:l(c.onScroll,e=>{const s=e.currentTarget,{contentWrapper:t,shouldExpandOnScrollRef:a}=u;if((null==a?void 0:a.current)&&t){const e=Math.abs(x.current-s.scrollTop);if(e>0){const a=window.innerHeight-2*Ds,n=parseFloat(t.style.minHeight),r=parseFloat(t.style.height),l=Math.max(n,r);if(l<a){const n=l+e,r=Math.min(a,n),o=n-r;t.style.height=r+"px","0px"===t.style.bottom&&(s.scrollTop=o>0?o:0,t.style.justifyContent="flex-end")}}}x.current=s.scrollTop})})})]})});Bs.displayName=Ws;var $s="SelectGroup",[Ks,Us]=gs($s);s.forwardRef((e,s)=>{const{__scopeSelect:t,...a}=e,l=d();return n.jsx(Ks,{scope:t,id:l,children:n.jsx(r.div,{role:"group","aria-labelledby":l,...a,ref:s})})}).displayName=$s;var qs="SelectLabel",Gs=s.forwardRef((e,s)=>{const{__scopeSelect:t,...a}=e,l=Us(qs,t);return n.jsx(r.div,{id:l.id,...a,ref:s})});Gs.displayName=qs;var Zs="SelectItem",[Xs,Qs]=gs(Zs),Ys=s.forwardRef((e,a)=>{const{__scopeSelect:o,value:i,disabled:c=!1,textValue:u,...h}=e,x=bs(Zs,o),m=Os(Zs,o),p=x.value===i,[f,v]=s.useState(u??""),[g,j]=s.useState(!1),y=t(a,e=>{var s;return null==(s=m.itemRefCallback)?void 0:s.call(m,e,i,c)}),b=d(),w=s.useRef("touch"),N=()=>{c||(x.onValueChange(i),x.onOpenChange(!1))};if(""===i)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 n.jsx(Xs,{scope:o,value:i,disabled:c,textId:b,isSelected:p,onItemTextChange:s.useCallback(e=>{v(s=>s||((null==e?void 0:e.textContent)??"").trim())},[]),children:n.jsx(ps.ItemSlot,{scope:o,value:i,disabled:c,textValue:f,children:n.jsx(r.div,{role:"option","aria-labelledby":b,"data-highlighted":g?"":void 0,"aria-selected":p&&g,"data-state":p?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...h,ref:y,onFocus:l(h.onFocus,()=>j(!0)),onBlur:l(h.onBlur,()=>j(!1)),onClick:l(h.onClick,()=>{"mouse"!==w.current&&N()}),onPointerUp:l(h.onPointerUp,()=>{"mouse"===w.current&&N()}),onPointerDown:l(h.onPointerDown,e=>{w.current=e.pointerType}),onPointerMove:l(h.onPointerMove,e=>{var s;w.current=e.pointerType,c?null==(s=m.onItemLeave)||s.call(m):"mouse"===w.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:l(h.onPointerLeave,e=>{var s;e.currentTarget===document.activeElement&&(null==(s=m.onItemLeave)||s.call(m))}),onKeyDown:l(h.onKeyDown,e=>{var s;""!==(null==(s=m.searchRef)?void 0:s.current)&&" "===e.key||(xs.includes(e.key)&&N()," "===e.key&&e.preventDefault())})})})})});Ys.displayName=Zs;var Js="SelectItemText",et=s.forwardRef((e,a)=>{const{__scopeSelect:l,className:o,style:i,...c}=e,d=bs(Js,l),h=Os(Js,l),m=Qs(Js,l),p=Ns(Js,l),[f,v]=s.useState(null),g=t(a,e=>v(e),m.onItemTextChange,e=>{var s;return null==(s=h.itemTextRefCallback)?void 0:s.call(h,e,m.value,m.disabled)}),j=null==f?void 0:f.textContent,y=s.useMemo(()=>n.jsx("option",{value:m.value,disabled:m.disabled,children:j},m.value),[m.disabled,m.value,j]),{onNativeOptionAdd:b,onNativeOptionRemove:w}=p;return u(()=>(b(y),()=>w(y)),[b,w,y]),n.jsxs(n.Fragment,{children:[n.jsx(r.span,{id:m.textId,...c,ref:g}),m.isSelected&&d.valueNode&&!d.valueNodeHasChildren?x.createPortal(c.children,d.valueNode):null]})});et.displayName=Js;var st="SelectItemIndicator",tt=s.forwardRef((e,s)=>{const{__scopeSelect:t,...a}=e;return Qs(st,t).isSelected?n.jsx(r.span,{"aria-hidden":!0,...a,ref:s}):null});tt.displayName=st;var at="SelectScrollUpButton",nt=s.forwardRef((e,a)=>{const r=Os(at,e.__scopeSelect),l=Fs(at,e.__scopeSelect),[o,i]=s.useState(!1),c=t(a,l.onScrollButtonChange);return u(()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=s.scrollTop>0;i(e)};const s=r.viewport;return e(),s.addEventListener("scroll",e),()=>s.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),o?n.jsx(ot,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:s}=r;e&&s&&(e.scrollTop=e.scrollTop-s.offsetHeight)}}):null});nt.displayName=at;var rt="SelectScrollDownButton",lt=s.forwardRef((e,a)=>{const r=Os(rt,e.__scopeSelect),l=Fs(rt,e.__scopeSelect),[o,i]=s.useState(!1),c=t(a,l.onScrollButtonChange);return u(()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=s.scrollHeight-s.clientHeight,t=Math.ceil(s.scrollTop)<e;i(t)};const s=r.viewport;return e(),s.addEventListener("scroll",e),()=>s.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),o?n.jsx(ot,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:s}=r;e&&s&&(e.scrollTop=e.scrollTop+s.offsetHeight)}}):null});lt.displayName=rt;var ot=s.forwardRef((e,t)=>{const{__scopeSelect:a,onAutoScroll:o,...i}=e,c=Os("SelectScrollButton",a),d=s.useRef(null),h=fs(a),x=s.useCallback(()=>{null!==d.current&&(window.clearInterval(d.current),d.current=null)},[]);return s.useEffect(()=>()=>x(),[x]),u(()=>{var e;const s=h().find(e=>e.ref.current===document.activeElement);null==(e=null==s?void 0:s.ref.current)||e.scrollIntoView({block:"nearest"})},[h]),n.jsx(r.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:l(i.onPointerDown,()=>{null===d.current&&(d.current=window.setInterval(o,50))}),onPointerMove:l(i.onPointerMove,()=>{var e;null==(e=c.onItemLeave)||e.call(c),null===d.current&&(d.current=window.setInterval(o,50))}),onPointerLeave:l(i.onPointerLeave,()=>{x()})})}),it=s.forwardRef((e,s)=>{const{__scopeSelect:t,...a}=e;return n.jsx(r.div,{"aria-hidden":!0,...a,ref:s})});it.displayName="SelectSeparator";var ct="SelectArrow";s.forwardRef((e,s)=>{const{__scopeSelect:t,...a}=e,r=js(t),l=bs(ct,t),o=Os(ct,t);return l.open&&"popper"===o.position?n.jsx(Ce,{...r,...a,ref:s}):null}).displayName=ct;var dt=s.forwardRef(({__scopeSelect:e,value:a,...l},o)=>{const i=s.useRef(null),c=t(o,i),d=Ge(a);return s.useEffect(()=>{const e=i.current;if(!e)return;const s=window.HTMLSelectElement.prototype,t=Object.getOwnPropertyDescriptor(s,"value").set;if(d!==a&&t){const s=new Event("change",{bubbles:!0});t.call(e,a),e.dispatchEvent(s)}},[d,a]),n.jsx(r.select,{...l,style:{...us,...l.style},ref:c,defaultValue:a})});function ut(e){return""===e||void 0===e}function ht(e){const t=m(e),a=s.useRef(""),n=s.useRef(0),r=s.useCallback(e=>{const s=a.current+e;t(s),function e(s){a.current=s,window.clearTimeout(n.current),""!==s&&(n.current=window.setTimeout(()=>e(""),1e3))}(s)},[t]),l=s.useCallback(()=>{a.current="",window.clearTimeout(n.current)},[]);return s.useEffect(()=>()=>window.clearTimeout(n.current),[]),[a,r,l]}function xt(e,s,t){const a=s.length>1&&Array.from(s).every(e=>e===s[0])?s[0]:s,n=t?e.indexOf(t):-1;let r=(l=e,o=Math.max(n,0),l.map((e,s)=>l[(o+s)%l.length]));var l,o;1===a.length&&(r=r.filter(e=>e!==t));const i=r.find(e=>e.textValue.toLowerCase().startsWith(a.toLowerCase()));return i!==t?i:void 0}dt.displayName="SelectBubbleInput";var mt=Cs,pt=Ps,ft=Ts,vt=Is,gt=Bs,jt=Gs,yt=Ys,bt=et,wt=tt,Nt=nt,kt=lt,St=it;const Ct=ks,Rt=_s,_t=s.forwardRef(({className:e,children:s,...t},a)=>n.jsxs(mt,{ref:a,className:i("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),...t,children:[s,n.jsx(pt,{asChild:!0,children:n.jsx(Me,{className:"h-4 w-4 opacity-50"})})]}));_t.displayName=mt.displayName;const Pt=s.forwardRef(({className:e,...s},t)=>n.jsx(Nt,{ref:t,className:i("flex cursor-default items-center justify-center py-1",e),...s,children:n.jsx(Oe,{className:"h-4 w-4"})}));Pt.displayName=Nt.displayName;const Tt=s.forwardRef(({className:e,...s},t)=>n.jsx(kt,{ref:t,className:i("flex cursor-default items-center justify-center py-1",e),...s,children:n.jsx(Me,{className:"h-4 w-4"})}));Tt.displayName=kt.displayName;const Et=s.forwardRef(({className:e,children:s,position:t="popper",...a},r)=>n.jsx(ft,{children:n.jsxs(vt,{ref:r,className:i("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"===t&&"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:t,...a,children:[n.jsx(Pt,{}),n.jsx(gt,{className:i("p-1","popper"===t&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),n.jsx(Tt,{})]})}));Et.displayName=vt.displayName;s.forwardRef(({className:e,...s},t)=>n.jsx(jt,{ref:t,className:i("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...s})).displayName=jt.displayName;const It=s.forwardRef(({className:e,children:s,...t},a)=>n.jsxs(yt,{ref:a,className:i("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),...t,children:[n.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsx(wt,{children:n.jsx(y,{className:"h-4 w-4"})})}),n.jsx(bt,{children:s})]}));It.displayName=yt.displayName;s.forwardRef(({className:e,...s},t)=>n.jsx(St,{ref:t,className:i("-mx-1 my-1 h-px bg-muted",e),...s})).displayName=St.displayName;const Dt={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function Mt({open:e,onOpenChange:t,onAdded:a}){const[r,l]=s.useState([]),[o,i]=s.useState(!1),[c,d]=s.useState(null),[u,h]=s.useState(""),[x,m]=s.useState(""),[p,f]=s.useState(""),[v,g]=s.useState(""),[j,y]=s.useState(!1),[D,M]=s.useState(null);s.useEffect(()=>{e&&b().then(e=>l(e.available)).catch(()=>l([]))},[e]);const O=()=>{i(!1),d(null),h(""),m(""),f(""),g(""),y(!1),M(null)},A=r.length>0;return n.jsx(w,{open:e,onOpenChange:e=>{t(e),e||O()},children:n.jsxs(N,{className:"sm:max-w-md",children:[n.jsxs(k,{children:[n.jsxs(S,{className:"flex items-center gap-2",children:[n.jsx(Fe,{className:"h-5 w-5"}),"添加云盘账号"]}),n.jsx(C,{children:o?"手动填写 OAuth 凭据连接云盘":"选择云盘类型,点击后跳转登录授权"})]}),o?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-4 py-2",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(_,{children:"云盘类型"}),n.jsxs(Ct,{value:u,onValueChange:h,children:[n.jsx(_t,{children:n.jsx(Rt,{placeholder:"选择云盘类型"})}),n.jsxs(Et,{children:[n.jsx(It,{value:"google-drive",children:"Google Drive"}),n.jsx(It,{value:"onedrive",children:"OneDrive"}),n.jsx(It,{value:"dropbox",children:"Dropbox"})]})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(_,{children:"显示名称"}),n.jsx(P,{placeholder:"例如:我的 Google Drive",value:x,onChange:e=>m(e.target.value)})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(_,{children:"Client ID"}),n.jsx(P,{placeholder:"OAuth Client ID",value:p,onChange:e=>f(e.target.value)})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(_,{children:"Client Secret"}),n.jsx(P,{type:"password",placeholder:"OAuth Client Secret",value:v,onChange:e=>g(e.target.value)})]}),D&&n.jsx("p",{className:"text-sm text-destructive",children:D})]}),n.jsxs(T,{children:[n.jsx(R,{variant:"outline",onClick:()=>{i(!1),M(null)},children:"返回"}),n.jsx(R,{onClick:async()=>{if(u&&x&&p&&v){y(!0),M(null);try{const{id:e}=await E({type:u,label:x,clientId:p,clientSecret:v}),{url:s}=await I(e);window.open(s,"_blank"),O(),t(!1),a()}catch(e){M(e instanceof Error?e.message:"添加失败")}finally{y(!1)}}else M("请填写所有字段")},disabled:j,children:j?"添加中...":"添加并授权"})]})]}):n.jsxs("div",{className:"space-y-3 py-2",children:[A?n.jsx(n.Fragment,{children:r.map(e=>n.jsx(R,{variant:"outline",className:"w-full justify-start gap-3 h-12 text-base",onClick:()=>{(async e=>{d(e),M(null);try{const{id:s}=await E({type:e,label:Dt[e]||e}),{url:n}=await I(s);window.open(n,"_blank"),O(),t(!1),a()}catch(s){M(s instanceof Error?s.message:"添加失败"),d(null)}})(e)},disabled:null!==c,children:c===e?"连接中...":`连接 ${Dt[e]||e}`},e))}):n.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"暂无内置 OAuth 凭据,请使用手动模式添加"}),D&&n.jsx("p",{className:"text-sm text-destructive",children:D}),n.jsx("div",{className:"pt-2 border-t border-border",children:n.jsxs("button",{onClick:()=>{i(!0),M(null)},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[n.jsx(Ue,{className:"h-3.5 w-3.5"}),"手动填写 OAuth 凭据"]})})]})]})})}const Ot={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function At({type:e}){switch(e){case"google-drive":return n.jsx($e,{className:"h-5 w-5 text-blue-500"});case"onedrive":return n.jsx(Fe,{className:"h-5 w-5 text-sky-500"});case"dropbox":return n.jsx($e,{className:"h-5 w-5 text-indigo-500"});default:return n.jsx(Fe,{className:"h-5 w-5"})}}function Ht({provider:e,onDelete:t,onReauth:a}){var r;const[l,o]=s.useState(!1),i=s.useRef(null);s.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);return n.jsxs(D,{children:[n.jsx(M,{className:"pb-3",children:n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(At,{type:e.type}),n.jsxs("div",{children:[n.jsx(O,{className:"text-base",children:e.label}),n.jsx("p",{className:"text-sm text-muted-foreground",children:Ot[e.type]||e.type})]})]}),n.jsx(A,{variant:e.authorized?"default":"destructive",className:e.authorized?"bg-green-600 hover:bg-green-700":"",children:e.authorized?"已授权":"未授权"})]})}),n.jsxs(H,{children:[e.authorized&&(null==(r=e.tokens)?void 0:r.expiry)&&n.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["授权到期:",new Date(e.tokens.expiry).toLocaleDateString("zh-CN")]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(R,{variant:"outline",size:"sm",onClick:()=>a(e.id),children:[n.jsx(L,{className:"h-3.5 w-3.5 mr-1"}),"重新授权"]}),n.jsxs(R,{variant:l?"destructive":"outline",size:"sm",onClick:()=>{l?(t(e.id),o(!1)):(o(!0),i.current=setTimeout(()=>o(!1),3e3))},children:[n.jsx(V,{className:"h-3.5 w-3.5 mr-1"}),l?"确认删除?":"删除"]})]})]})]})}const Lt={success:{label:"成功",icon:Ae,className:"bg-green-600 hover:bg-green-700"},failed:{label:"失败",icon:qe,className:"bg-red-600 hover:bg-red-700"},partial:{label:"部分完成",icon:Le,className:"bg-yellow-600 hover:bg-yellow-700"}};function Vt(e,s){const t=new Date(s).getTime()-new Date(e).getTime();if(t<1e3)return`${t}ms`;const a=Math.floor(t/1e3);if(a<60)return`${a}秒`;return`${Math.floor(a/60)}分${a%60}秒`}function zt({history:e}){const s=e.slice(0,20);return 0===s.length?n.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[n.jsx(ze,{className:"h-10 w-10 mb-3 opacity-50"}),n.jsx("p",{className:"text-sm",children:"暂无备份记录"})]}):n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"border-b",children:[n.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"时间"}),n.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"项目"}),n.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"云盘"}),n.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"状态"}),n.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"文件数"}),n.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"耗时"})]})}),n.jsx("tbody",{children:s.map(e=>{const s=Lt[e.status],t=s.icon;return n.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/50",children:[n.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:(a=e.startTime,new Date(a).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}))}),n.jsx("td",{className:"py-2.5 px-2",children:e.projectName}),n.jsx("td",{className:"py-2.5 px-2",children:e.providerLabel}),n.jsxs("td",{className:"py-2.5 px-2",children:[n.jsxs(A,{className:s.className,children:[n.jsx(t,{className:"h-3 w-3 mr-1"}),s.label]}),e.error&&n.jsx("p",{className:"text-xs text-destructive mt-1",children:e.error})]}),n.jsxs("td",{className:"py-2.5 px-2 whitespace-nowrap",children:[e.filesUploaded,"/",e.filesTotal]}),n.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:Vt(e.startTime,e.endTime)})]},e.id);var a})})]})})}function Ft(){const[e,t]=s.useState(null),[a,r]=s.useState(!0),[l,o]=s.useState(!1),[i,c]=s.useState(!1),[d,u]=s.useState(!1),[h,x]=s.useState(""),[m,p]=s.useState("");s.useEffect(()=>{let e=!1;return z().then(s=>{e||(t(s),p(s.defaultExcludes.join("\n")))}).catch(e=>F.error(`加载同步配置失败: ${e.message}`)).finally(()=>{e||r(!1)}),()=>{e=!0}},[]);const f=(e,s)=>{t(t=>t?{...t,[e]:s}:t)};return a||!e?n.jsx("div",{className:"text-sm text-muted-foreground",children:"加载中…"}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:"服务器配置"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(_,{htmlFor:"sync-host",children:"主机 (host)"}),n.jsx(P,{id:"sync-host",value:e.host,onChange:e=>f("host",e.target.value),placeholder:"example.com"})]}),n.jsxs("div",{children:[n.jsx(_,{htmlFor:"sync-port",children:"端口"}),n.jsx(P,{id:"sync-port",type:"number",value:e.port,onChange:e=>f("port",Number(e.target.value)||22)})]}),n.jsxs("div",{children:[n.jsx(_,{htmlFor:"sync-user",children:"用户名"}),n.jsx(P,{id:"sync-user",value:e.user,onChange:e=>f("user",e.target.value),placeholder:"tom"})]}),n.jsxs("div",{children:[n.jsx(_,{htmlFor:"sync-remote",children:"远端根路径"}),n.jsx(P,{id:"sync-remote",value:e.remoteRoot,onChange:e=>f("remoteRoot",e.target.value),placeholder:"/data/projects"}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["每个项目会同步到 ",n.jsx("code",{children:"远端路径/项目文件夹"})]})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:"认证"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(_,{children:"方式"}),n.jsxs(Ct,{value:e.authMethod,onValueChange:e=>f("authMethod",e),children:[n.jsx(_t,{children:n.jsx(Rt,{})}),n.jsxs(Et,{children:[n.jsx(It,{value:"key",children:"SSH key"}),n.jsx(It,{value:"password",children:"密码"})]})]})]}),"key"===e.authMethod?n.jsxs("div",{children:[n.jsx(_,{htmlFor:"sync-key",children:"私钥路径"}),n.jsx(P,{id:"sync-key",value:e.keyPath??"",onChange:e=>f("keyPath",e.target.value),placeholder:"~/.ssh/id_rsa"})]}):n.jsxs("div",{children:[n.jsx(_,{htmlFor:"sync-pw",children:"密码"}),n.jsx(P,{id:"sync-pw",type:"password",value:h,onChange:e=>x(e.target.value),placeholder:e.passwordSet?"已设置,留空保持不变":"未设置"}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["需要系统安装 ",n.jsx("code",{children:"sshpass"}),"(密码通过 SSHPASS env 传递,不会出现在 argv 里)"]})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:"同步策略"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(_,{children:"方向"}),n.jsxs(Ct,{value:e.direction,onValueChange:e=>f("direction",e),children:[n.jsx(_t,{children:n.jsx(Rt,{})}),n.jsxs(Et,{children:[n.jsx(It,{value:"push",children:"单向:本地 → 远端(--delete)"}),n.jsx(It,{value:"pull",children:"单向:远端 → 本地"}),n.jsx(It,{value:"bidirectional",children:"双向(先 push 再 pull)"})]})]})]}),n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx(_,{htmlFor:"sync-cron",children:"定时 cron 表达式"}),n.jsx(P,{id:"sync-cron",value:e.schedule.cron,onChange:s=>f("schedule",{...e.schedule,cron:s.target.value}),placeholder:"0 3 * * *"}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["5 段:分 时 日 月 周。例:",n.jsx("code",{children:"0 3 * * *"})," 每天 03:00"]})]}),n.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[n.jsx(ls,{checked:e.schedule.enabled,onCheckedChange:s=>f("schedule",{...e.schedule,enabled:s})}),n.jsx("span",{className:"text-xs text-muted-foreground",children:"启用"})]})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:"默认排除(每行一个 glob)"}),n.jsx("textarea",{value:m,onChange:e=>p(e.target.value),rows:6,className:"w-full font-mono text-xs p-2 rounded border border-input bg-background resize-y",placeholder:"node_modules/\n.git/objects/\n*.log"}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["作为 ",n.jsx("code",{children:"rsync --exclude"})," 传入。项目级的额外排除暂通过 API 设置。"]})]}),n.jsxs("div",{className:"flex flex-wrap gap-2 pt-2 border-t",children:[n.jsxs(R,{onClick:()=>{(async()=>{if(e){o(!0);try{const s=m.split("\n").map(e=>e.trim()).filter(Boolean),a={host:e.host,port:e.port,user:e.user,authMethod:e.authMethod,keyPath:e.keyPath,remoteRoot:e.remoteRoot,direction:e.direction,defaultExcludes:s,schedule:e.schedule};h&&"__keep__"!==h&&(a.password=h);const n=await $(a);t(n),p(n.defaultExcludes.join("\n")),x(""),F.success("已保存")}catch(s){F.error(`保存失败: ${s.message}`)}finally{o(!1)}}})()},disabled:l,children:[l?n.jsx(W,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(Re,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]}),n.jsxs(R,{variant:"outline",onClick:()=>{(async()=>{c(!0);try{const e=await K();e.ok?F.success(e.message||"连接成功"):F.error(e.message||"连接失败")}catch(e){F.error(`测试失败: ${e.message}`)}finally{c(!1)}})()},disabled:i,children:[i?n.jsx(W,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(Ke,{className:"h-3.5 w-3.5 mr-1.5"}),"测试连接"]}),n.jsx("div",{className:"flex-1"}),n.jsxs(R,{variant:"outline",onClick:()=>{(async()=>{u(!0);try{const e=await U(),s=e.results.filter(e=>e.ok).length,t=e.results.filter(e=>e.skipped).length,a=e.total-s-t;F.success(`同步完成:${s} 成功 / ${t} 跳过 / ${a} 失败`)}catch(e){F.error(`同步失败: ${e.message}`)}finally{u(!1)}})()},disabled:d,title:"按当前方向同步所有项目",children:[d?n.jsx(W,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(_e,{className:"h-3.5 w-3.5 mr-1.5"}),"立即同步全部"]})]}),n.jsxs("div",{className:"border-t pt-4 text-xs text-muted-foreground",children:["一次性 push/pull 工具:进入项目内部,点击 header 的 ",n.jsx(_e,{className:"inline h-3 w-3"})," / ",n.jsx(B,{className:"inline h-3 w-3"})," 按钮。 或通过 API 调用 ",n.jsx("code",{children:"POST /api/sync/project/:id"})," with body ",n.jsx("code",{children:'{ "direction": "push" }'}),"。"]})]})}function Wt(){const e=q(),[t,a]=s.useState(null),[r,l]=s.useState(!0),[o,i]=s.useState(""),[c,d]=s.useState(!1);s.useEffect(()=>{let e=!1;return G().then(s=>{e||a(s)}).catch(()=>{e||a({configured:!1,needsReset:!1})}).finally(()=>{e||l(!1)}),()=>{e=!0}},[]);return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-1",children:"CCWeb Hub 直接提交"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:['配置你的 GitHub PAT 后,在 Quick Prompts / Agent Prompts 卡片右键选择"共享"时可一键直接提交 Issue 到 ',n.jsx("code",{children:"zbc0315/ccweb-hub"}),"。 ccweb 本身不自带 token —— 使用你自己的账号身份提交,归属清晰,互不影响。"]})]}),r?n.jsxs("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[n.jsx(W,{className:"h-4 w-4 animate-spin"}),"加载中…"]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"rounded-md border px-3 py-2.5 text-xs flex items-center gap-2",children:(null==t?void 0:t.configured)?n.jsxs(n.Fragment,{children:[n.jsx(Ae,{className:"h-4 w-4 text-green-500 shrink-0"}),n.jsx("span",{children:"已配置 token,可直接提交"}),n.jsx("div",{className:"flex-1"}),n.jsxs(R,{size:"sm",variant:"outline",onClick:()=>{(async()=>{if(await e({title:"清除 Hub Token",description:"清除后将无法直接提交到 ccweb-hub,需要重新配置 token。确认?",destructive:!0,confirmLabel:"清除"}))try{await Z(),a({configured:!1,needsReset:!1}),F.success("已清除")}catch(s){F.error(`清除失败: ${s.message}`)}})()},children:[n.jsx(V,{className:"h-3.5 w-3.5 mr-1"}),"清除"]})]}):(null==t?void 0:t.needsReset)?n.jsxs(n.Fragment,{children:[n.jsx(Le,{className:"h-4 w-4 text-amber-500 shrink-0"}),n.jsx("span",{children:"之前的 token 已失效(服务端密钥可能已轮换),请重新设置"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Le,{className:"h-4 w-4 text-muted-foreground shrink-0"}),n.jsx("span",{children:"尚未配置 token"})]})}),n.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2.5 text-xs space-y-2",children:[n.jsx("div",{className:"font-medium text-foreground",children:"如何获取 token"}),n.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-muted-foreground",children:[n.jsxs("li",{children:["打开"," ",n.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new",target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline inline-flex items-center gap-0.5",children:["GitHub fine-grained PAT",n.jsx(We,{className:"h-3 w-3"})]})," ","创建页"]}),n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:"Repository access"}),':选 "Only select repositories",添加 ',n.jsx("code",{children:"zbc0315/ccweb-hub"})]}),n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:"Repository permissions → Issues"}),':设置为 "Read and write"']}),n.jsx("li",{children:"其余权限保持默认(全部无访问)"}),n.jsx("li",{children:"生成后复制 token 粘贴到下方"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs(_,{htmlFor:"hub-token",className:"text-xs",children:["GitHub Token ",(null==t?void 0:t.configured)&&n.jsx("span",{className:"text-muted-foreground",children:"(填写会覆盖现有 token)"})]}),n.jsx(P,{id:"hub-token",type:"password",placeholder:"github_pat_...",value:o,onChange:e=>i(e.target.value),autoComplete:"off",spellCheck:!1}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Token 以 AES-256-GCM 加密存储于 ",n.jsx("code",{children:"~/.ccweb/hub-auth/"}),";per-user 独立,不会被其他用户读到。"]})]}),n.jsx("div",{className:"flex gap-2 pt-2 border-t",children:n.jsxs(R,{onClick:()=>{(async()=>{const e=o.trim();if(e){d(!0);try{const s=await X(e);a(s),i(""),F.success("已保存")}catch(s){F.error(`保存失败: ${s.message}`)}finally{d(!1)}}else F.error("请输入 token")})()},disabled:c||!o.trim(),children:[c?n.jsx(W,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(Re,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})})]})]})}const Bt=["node_modules",".git","dist","build","*.log",".DS_Store","*.tmp",".venv","__pycache__",".env"],$t=[{value:"30",label:"30分钟"},{value:"60",label:"1小时"},{value:"360",label:"6小时"},{value:"720",label:"12小时"},{value:"1440",label:"24小时"}];function Kt(){const e=Q(),[t]=Y(),a=t.get("tab")||"providers",[r,l]=s.useState([]),[o,i]=s.useState(!0),[c,d]=s.useState(!1),[u,h]=s.useState({enabled:!1,intervalMinutes:60}),[x,m]=s.useState(!0),[p,f]=s.useState([]),[v,g]=s.useState(!0),[j,y]=s.useState(""),[b,w]=s.useState(!1),[N,k]=s.useState(!1),[S,C]=s.useState([]),[T,E]=s.useState(!0),[D,M]=s.useState(()=>J()),[O,A]=s.useState(!1),[H,V]=s.useState({webhookEnabled:!1}),[z,W]=s.useState(""),[B,$]=s.useState(!1),[K,U]=s.useState(()=>ee(se.usageMonitorTool,"claude")),q=async()=>{try{const e=await de();l(e)}catch{}finally{i(!1)}},G=async()=>{try{const e=await xe();C(e)}catch{}finally{E(!1)}};s.useEffect(()=>{q(),(async()=>{try{const e=await ue();h(e)}catch{}finally{m(!1)}})(),(async()=>{try{const e=await he();f(e.length>0?e:Bt)}catch{f(Bt)}finally{g(!1)}})(),G(),te().then(e=>{V(e),W(e.webhookUrl??"")}).catch(()=>{})},[]);const Z=(e,s)=>{const t=parseInt(s,10);isNaN(t)||t<1||(M(s=>({...s,[e]:t})),A(!0))},X=async e=>{try{await me(e),l(s=>s.filter(s=>s.id!==e))}catch{}},ge=async e=>{try{const{url:s}=await I(e);window.open(s,"_blank")}catch{}},je=()=>{const e=j.trim();e&&!p.includes(e)&&(f(s=>[...s,e]),y(""),w(!0))};return n.jsx("div",{className:"min-h-screen bg-background",children:n.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsxs(R,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[n.jsx(ae,{className:"h-4 w-4 mr-1"}),"返回"]}),n.jsx("h1",{className:"text-2xl font-bold",children:"设置"})]}),n.jsxs(Pe,{defaultValue:a,children:[n.jsxs(Te,{className:"mb-4",children:[n.jsxs(Ee,{value:"sync",children:[n.jsx(Ie,{className:"h-3.5 w-3.5 mr-1.5"}),"同步 (rsync)"]}),n.jsxs(Ee,{value:"hub",children:[n.jsx(Be,{className:"h-3.5 w-3.5 mr-1.5"}),"CCWeb Hub"]}),n.jsx(Ee,{value:"providers",children:"云盘账号"}),n.jsx(Ee,{value:"strategy",children:"备份策略"}),n.jsx(Ee,{value:"history",children:"备份记录"}),n.jsxs(Ee,{value:"notifications",children:[n.jsx(Ve,{className:"h-3.5 w-3.5 mr-1.5"}),"通知"]}),n.jsxs(Ee,{value:"pomodoro",children:[n.jsx(ne,{className:"h-3.5 w-3.5 mr-1.5"}),"番茄钟"]}),n.jsxs(Ee,{value:"usage",children:[n.jsx(He,{className:"h-3.5 w-3.5 mr-1.5"}),"用量监控"]})]}),n.jsx(De,{value:"sync",children:n.jsx(Ft,{})}),n.jsx(De,{value:"hub",children:n.jsx(Wt,{})}),n.jsxs(De,{value:"providers",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"flex justify-end",children:n.jsxs(R,{onClick:()=>d(!0),children:[n.jsx(re,{className:"h-4 w-4 mr-1"}),"添加云盘"]})}),o?n.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):0===r.length?n.jsx("p",{className:"text-sm text-muted-foreground text-center py-12",children:"暂无云盘账号,点击上方按钮添加"}):n.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:r.map(e=>n.jsx(Ht,{provider:e,onDelete:X,onReauth:ge},e.id))})]}),n.jsx(Mt,{open:c,onOpenChange:d,onAdded:()=>{q()}})]}),n.jsx(De,{value:"strategy",children:n.jsxs("div",{className:"space-y-8",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"text-lg font-medium",children:"排除规则"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"匹配这些模式的文件和目录将不会被备份"}),v?n.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex flex-wrap gap-2",children:n.jsx(le,{children:p.map(e=>n.jsxs(oe.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,n.jsx("button",{onClick:()=>(e=>{f(s=>s.filter(s=>s!==e)),w(!0)})(e),className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20 p-0.5",children:n.jsx(ie,{className:"h-3 w-3"})})]},e))})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(P,{placeholder:"输入排除模式,例如 *.log",value:j,onChange:e=>y(e.target.value),onKeyDown:e=>{"Enter"===e.key&&je()},className:"max-w-xs"}),n.jsx(R,{variant:"outline",size:"sm",onClick:je,children:"添加"})]}),b&&n.jsxs(R,{onClick:async()=>{k(!0);try{await pe(p),w(!1)}catch{}finally{k(!1)}},disabled:N,children:[n.jsx(Re,{className:"h-4 w-4 mr-1"}),N?"保存中...":"保存"]})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"text-lg font-medium",children:"定时备份"}),x?n.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(ls,{checked:u.enabled,onCheckedChange:async e=>{const s=u;h({...u,enabled:e});try{await fe({enabled:e})}catch{h(s)}}}),n.jsx(_,{children:u.enabled?"已开启":"已关闭"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(_,{children:"备份间隔"}),n.jsxs(Ct,{value:String(u.intervalMinutes),onValueChange:async e=>{const s=parseInt(e,10),t=u;h({...u,intervalMinutes:s});try{await fe({intervalMinutes:s})}catch{h(t)}},children:[n.jsx(_t,{className:"w-48",children:n.jsx(Rt,{})}),n.jsx(Et,{children:$t.map(e=>n.jsx(It,{value:e.value,children:e.label},e.value))})]})]})]})]})]})}),n.jsx(De,{value:"history",children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"flex justify-end",children:n.jsxs(R,{variant:"outline",size:"sm",onClick:()=>{E(!0),G()},children:[n.jsx(L,{className:"h-4 w-4 mr-1"}),"刷新"]})}),T?n.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):n.jsx(zt,{history:S})]})}),n.jsx(De,{value:"notifications",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:"浏览器通知"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"当 Claude 完成任务时,浏览器将自动弹出通知。首次打开 Dashboard 时会请求通知权限。"})]}),n.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-3",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:"Webhook 通知"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Claude 完成任务时向指定 URL 发送 POST 请求(JSON: event, projectId, projectName, timestamp)"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{className:"text-xs",children:"Webhook URL"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(P,{placeholder:"https://hooks.slack.com/...",value:z,onChange:e=>W(e.target.value),className:"font-mono text-xs"}),n.jsx(R,{size:"sm",onClick:()=>{(async()=>{$(!0);try{const e=await ve({webhookEnabled:z.trim().length>0,webhookUrl:z.trim()||void 0});V(e),F.success("Webhook 配置已保存")}catch{F.error("保存失败")}finally{$(!1)}})()},disabled:B,children:B?"保存中…":"保存"})]}),H.webhookEnabled&&H.webhookUrl&&n.jsxs("p",{className:"text-xs text-green-500",children:["已启用 → ",H.webhookUrl]})]})]})]})}),n.jsx(De,{value:"pomodoro",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:"番茄钟时间设置"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"修改后重新启动番茄钟生效"})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-6 max-w-xs",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{className:"text-xs",children:"工作时长(分钟)"}),n.jsx(P,{type:"number",min:1,max:120,value:D.workMinutes,onChange:e=>Z("workMinutes",e.target.value),className:"w-full"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{className:"text-xs",children:"休息时长(分钟)"}),n.jsx(P,{type:"number",min:1,max:60,value:D.breakMinutes,onChange:e=>Z("breakMinutes",e.target.value),className:"w-full"})]})]}),O&&n.jsxs(R,{size:"sm",onClick:()=>{ce(se.pomodoroConfig,D,!0),A(!1),F.success("番茄钟设置已保存")},children:[n.jsx(Re,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})]}),n.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:"使用说明"}),n.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[n.jsxs("li",{children:["在项目页面 Header 点击 ",n.jsx(ne,{className:"h-3 w-3 inline-block mx-0.5"})," 图标启动番茄钟"]}),n.jsx("li",{children:"倒计时以大字体悬浮在屏幕上,不影响操作"}),n.jsx("li",{children:"工作阶段结束后自动切换为休息,并弹出通知"}),n.jsx("li",{children:"休息结束后自动切换回工作阶段"}),n.jsx("li",{children:"再次点击图标可停止并重置"})]})]})]})}),n.jsx(De,{value:"usage",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:"监控工具"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"选择要监控用量的 CLI 工具,首页和项目页会显示对应的实时用量"})]}),n.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 — 用量查询暂未实现"},{key:"gemini",label:"Gemini CLI",desc:"Google — 用量查询暂未实现"}].map(e=>n.jsxs("label",{className:"flex items-start gap-3 rounded-lg border p-3 cursor-pointer transition-colors "+(K===e.key?"border-blue-500/50 bg-blue-500/5":"border-border hover:bg-muted/30"),children:[n.jsx("input",{type:"radio",name:"usageTool",value:e.key,checked:K===e.key,onChange:()=>{U(e.key),ce(se.usageMonitorTool,e.key),window.dispatchEvent(new Event("ccweb:usage-tool-change")),F.success(`用量监控已切换为 ${e.label}`)},className:"mt-0.5"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:e.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:e.desc})]})]},e.key))})]}),n.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:"说明"}),n.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[n.jsx("li",{children:"用量数据显示在首页 Header 和项目页底部状态栏"}),n.jsx("li",{children:"Claude Code 通过 OAuth API 实时查询,每 5 分钟自动刷新"}),n.jsx("li",{children:"其他工具的用量查询将在后续版本中支持"}),n.jsx("li",{children:"切换后无需刷新页面,用量会自动更新"})]})]})]})})]})]})})}export{Kt as SettingsPage};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{c as e,
|
|
1
|
+
import{c as e,ax as s,r as t,bn as a,bo as r,t as n,bp as l,bq as i,br as c,a5 as d,bs as o,j as m,B as x,ay as u,d as p,I as h,T as g,p as f,D as j,av as b,aw as N,A as y,ah as v,an as k}from"./index-fJX6wxPU.js";import{S as w}from"./search-28CWGQwO.js";import{C}from"./chevron-down-DtcZkqFf.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license lucide-react v0.309.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
6
6
|
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const S=e("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),P=e("Puzzle",[["path",{d:"M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z",key:"i0oyt7"}]]),
|
|
7
|
+
*/const S=e("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),P=e("Puzzle",[["path",{d:"M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z",key:"i0oyt7"}]]),q=e("Tag",[["path",{d:"M12 2H2v10l9.29 9.29c.94.94 2.48.94 3.42 0l6.58-6.58c.94-.94.94-2.48 0-3.42L12 2Z",key:"14b2ls"}],["path",{d:"M7 7h.01",key:"7u93v4"}]]),E=e("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);
|
|
8
8
|
/**
|
|
9
9
|
* @license lucide-react v0.309.0 - ISC
|
|
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 z(){const e=s(),[z,M]=t.useState("prompts"),[H,_]=t.useState(""),[F,Q]=t.useState([]),[W,I]=t.useState([]),[O,T]=t.useState(!1),[U,Z]=t.useState(null);t.useEffect(()=>{"plugins"===z&&(T(!0),Promise.all([a().catch(()=>[]),fetch("/api/skillhub/plugins").then(e=>e.ok?e.json():[]).catch(()=>[])]).then(([e,s])=>{Q(e),I(s)}).finally(()=>T(!1)))},[z]);const B=t.useCallback(async e=>{if(!U){Z(e.id);try{await r(e.downloadUrl),l.success(`已安装 ${e.name}`);const s=await a().catch(()=>[]);Q(s)}catch(s){l.error(s instanceof Error?s.message:"安装失败")}finally{Z(null)}}},[U]),D=t.useCallback(async e=>{try{await n(e),Q(s=>s.filter(s=>s.id!==e)),l.success("已卸载")}catch(s){l.error(s instanceof Error?s.message:"卸载失败")}},[]),$=t.useCallback(async(e,s)=>{try{await i(e,s),Q(t=>t.map(t=>t.id===e?{...t,enabled:s}:t))}catch(t){l.error(t instanceof Error?t.message:"操作失败")}},[]),[G,J]=t.useState([]),[K,R]=t.useState(!0),[V,X]=t.useState(null),[Y,ee]=t.useState("all"),[se,te]=t.useState(null),[ae,re]=t.useState(null),[le,ne]=t.useState(new Set),[ie,ce]=t.useState(null);t.useEffect(()=>{Promise.all([c(),d().catch(()=>[]),o().catch(()=>[])]).then(([e,s,t])=>{J(e);const a=new Set;for(const r of e)"quick-prompt"===r.kind?s.some(e=>e.label===r.label&&e.command===r.body)&&a.add(r.id):t.some(e=>e.label===r.label&&e.command===r.body)&&a.add(r.id);ne(a)}).catch(e=>X(e instanceof Error?e.message:"Failed to load CCWeb Hub")).finally(()=>R(!1))},[]);const de=t.useMemo(()=>{const e=new Set;return G.forEach(s=>{var t;return null==(t=s.tags)?void 0:t.forEach(s=>e.add(s))}),[...e].sort()},[G]),oe=t.useMemo(()=>{let e=G;"all"!==Y&&(e=e.filter(e=>e.kind===Y)),"__untagged__"===se?e=e.filter(e=>!e.tags||0===e.tags.length):se&&(e=e.filter(e=>{var s;return null==(s=e.tags)?void 0:s.includes(se)}));const s=H.trim().toLowerCase();return s&&(e=e.filter(e=>e.label.toLowerCase().includes(s)||e.body.toLowerCase().includes(s)||(e.description??"").toLowerCase().includes(s)||(e.author??"").toLowerCase().includes(s)||(e.tags??[]).some(e=>e.toLowerCase().includes(s)))),e},[G,Y,se,H]);return m.jsxs("div",{className:"min-h-screen bg-background",children:[m.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:m.jsxs("div",{className:"max-w-4xl mx-auto px-4 h-14 flex items-center gap-4",children:[m.jsxs(x,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[m.jsx(u,{className:"h-4 w-4 mr-1"}),"返回"]}),m.jsx("h1",{className:"font-semibold text-lg",children:"CCWeb Hub"}),m.jsxs("div",{className:"flex items-center gap-1 ml-4",children:[m.jsx("button",{onClick:()=>M("prompts"),className:p("px-3 py-1 rounded-md text-sm transition-colors","prompts"===z?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:"Prompts"}),m.jsxs("button",{onClick:()=>M("plugins"),className:p("px-3 py-1 rounded-md text-sm transition-colors flex items-center gap-1","plugins"===z?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:[m.jsx(P,{className:"h-3.5 w-3.5"}),"插件"]})]}),m.jsx("div",{className:"flex-1"}),m.jsxs("div",{className:"relative w-64",children:[m.jsx(w,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),m.jsx(h,{placeholder:"prompts"===z?"搜索 prompt...":"搜索插件...",value:H,onChange:e=>_(e.target.value),className:"pl-8 h-9"})]})]})}),m.jsxs("main",{className:"max-w-4xl mx-auto px-4 py-6",children:["plugins"===z&&m.jsxs("div",{children:[O&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),!O&&m.jsxs(m.Fragment,{children:[F.length>0&&m.jsxs("div",{className:"mb-8",children:[m.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:"已安装"}),m.jsx("div",{className:"space-y-2",children:F.map(e=>m.jsxs("div",{className:"rounded-lg border bg-card p-4 flex items-center gap-4",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"font-medium text-sm",children:e.name}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",e.version]}),m.jsx("span",{className:p("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?"启用":"禁用"})]}),m.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.description}),e.permissions.length>0&&m.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:e.permissions.map(e=>m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:e},e))})]}),m.jsx(x,{size:"sm",variant:"ghost",onClick:()=>$(e.id,!e.enabled),title:e.enabled?"禁用":"启用",children:m.jsx(S,{className:p("h-4 w-4",e.enabled?"text-green-500":"text-muted-foreground")})}),m.jsx(x,{size:"sm",variant:"ghost",onClick:()=>D(e.id),title:"卸载",children:m.jsx(g,{className:"h-4 w-4 text-red-400"})})]},e.id))})]}),m.jsxs("div",{children:[m.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:F.length>0?"更多插件":"可用插件"}),0===W.length&&m.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[m.jsx(P,{className:"h-10 w-10 mx-auto mb-3 opacity-30"}),m.jsx("p",{className:"text-sm",children:"Hub 暂无可用插件"})]}),m.jsx("div",{className:"space-y-2",children:W.filter(e=>!F.some(s=>s.id===e.id)).map((e,s)=>{const t=U===e.id;return m.jsxs(f.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:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"font-medium text-sm",children:e.name}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",e.version]}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["by ",e.author]})]}),m.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.description}),e.permissions.length>0&&m.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:e.permissions.map(e=>m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:e},e))})]}),m.jsxs(x,{size:"sm",disabled:t,onClick:()=>B(e),children:[m.jsx(b,{className:"h-3.5 w-3.5 mr-1"}),t?"安装中...":"安装"]})]},e.id)})})]})]})]}),"prompts"===z&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[m.jsx(A,{active:"all"===Y,onClick:()=>ee("all"),children:"全部"}),m.jsxs(A,{active:"quick-prompt"===Y,onClick:()=>ee("quick-prompt"),children:[m.jsx(j,{className:"h-3 w-3"}),"Quick Prompts"]}),m.jsxs(A,{active:"agent-prompt"===Y,onClick:()=>ee("agent-prompt"),children:[m.jsx(N,{className:"h-3 w-3"}),"Agent Prompts"]})]}),de.length>0&&m.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[m.jsx(L,{active:null===se,onClick:()=>te(null),children:"全部标签"}),de.map(e=>m.jsx(L,{active:se===e,onClick:()=>te(se===e?null:e),children:e},e))]}),K&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),V&&m.jsx("div",{className:"text-center text-destructive py-20",children:V}),!K&&!V&&0===G.length&&m.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[m.jsx("p",{className:"text-lg mb-2",children:"CCWeb Hub 还没有 prompt"}),m.jsx("p",{className:"text-sm",children:'在 Quick Prompts 或 Agent Prompts 卡片上右键选择"共享"来提交第一个吧!'})]}),!K&&!V&&G.length>0&&0===oe.length&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的 prompt"}),m.jsx("div",{className:"space-y-3",children:oe.map((e,s)=>{var t;const a=ae===e.id,r=le.has(e.id),n=ie===e.id;return m.jsxs(f.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:()=>re(a?null:e.id),children:[m.jsxs("div",{className:"flex items-start justify-between gap-4",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsxs("span",{className:p("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium","quick-prompt"===e.kind?"bg-blue-500/15 text-blue-400":"bg-green-500/15 text-green-500"),children:["quick-prompt"===e.kind?m.jsx(j,{className:"h-2.5 w-2.5"}):m.jsx(N,{className:"h-2.5 w-2.5"}),"quick-prompt"===e.kind?"Quick":"Agent"]}),m.jsx("h3",{className:"font-medium text-sm truncate",children:e.label}),null==(t=e.tags)?void 0:t.map(e=>m.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:[m.jsx(E,{className:"h-2.5 w-2.5"}),e]},e))]}),e.description&&m.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:e.description}),m.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[e.author&&m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx(q,{className:"h-3 w-3"}),e.author]}),m.jsx("code",{className:"text-[10px] opacity-60",children:e.file})]})]}),m.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxs(x,{size:"sm",variant:r?"outline":"default",disabled:n||r,onClick:s=>{(async(e,s)=>{if(s.stopPropagation(),!ie&&!le.has(e.id)){ce(e.id);try{"quick-prompt"===e.kind?(await v({label:e.label,command:e.body}),l.success("已导入到全局快捷 Prompts")):(await k({label:e.label,command:e.body}),l.success("已导入到全局 Agent Prompts")),ne(s=>new Set(s).add(e.id))}catch(t){l.error(t instanceof Error?t.message:"导入失败")}finally{ce(null)}}})(e,s)},title:"quick-prompt"===e.kind?"导入到全局快捷 Prompts":"导入到全局 Agent Prompts",children:[m.jsx(b,{className:"h-3.5 w-3.5 mr-1"}),r?"已导入":n?"导入中...":"导入"]}),m.jsx(f.span,{animate:{rotate:a?180:0},transition:{duration:.2},children:m.jsx(C,{className:"h-4 w-4 text-muted-foreground"})})]})]}),m.jsx(y,{children:a&&m.jsx(f.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:m.jsx("div",{className:"mt-3 pt-3 border-t",children:m.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.body})})})})]},e.id)})})]})]})]})}function A({active:e,onClick:s,children:t}){return m.jsx("button",{onClick:s,className:p("flex items-center gap-1 px-3 py-1 rounded-full text-xs font-medium transition-colors",e?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),children:t})}function L({active:e,onClick:s,children:t}){return m.jsx("button",{onClick:s,className:p("px-3 py-1 rounded-full text-xs font-medium transition-colors",e?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),children:t})}export{z as SkillHubPage};
|
|
13
|
+
*/function z(){const e=s(),[z,M]=t.useState("prompts"),[H,_]=t.useState(""),[F,Q]=t.useState([]),[W,I]=t.useState([]),[O,T]=t.useState(!1),[U,Z]=t.useState(null);t.useEffect(()=>{"plugins"===z&&(T(!0),Promise.all([a().catch(()=>[]),fetch("/api/skillhub/plugins").then(e=>e.ok?e.json():[]).catch(()=>[])]).then(([e,s])=>{Q(e),I(s)}).finally(()=>T(!1)))},[z]);const B=t.useCallback(async e=>{if(!U){Z(e.id);try{await r(e.downloadUrl),n.success(`已安装 ${e.name}`);const s=await a().catch(()=>[]);Q(s)}catch(s){n.error(s instanceof Error?s.message:"安装失败")}finally{Z(null)}}},[U]),D=t.useCallback(async e=>{try{await l(e),Q(s=>s.filter(s=>s.id!==e)),n.success("已卸载")}catch(s){n.error(s instanceof Error?s.message:"卸载失败")}},[]),$=t.useCallback(async(e,s)=>{try{await i(e,s),Q(t=>t.map(t=>t.id===e?{...t,enabled:s}:t))}catch(t){n.error(t instanceof Error?t.message:"操作失败")}},[]),[G,J]=t.useState([]),[K,R]=t.useState(!0),[V,X]=t.useState(null),[Y,ee]=t.useState("all"),[se,te]=t.useState(null),[ae,re]=t.useState(null),[ne,le]=t.useState(new Set),[ie,ce]=t.useState(null);t.useEffect(()=>{Promise.all([c(),d().catch(()=>[]),o().catch(()=>[])]).then(([e,s,t])=>{J(e);const a=new Set;for(const r of e)"quick-prompt"===r.kind?s.some(e=>e.label===r.label&&e.command===r.body)&&a.add(r.id):t.some(e=>e.label===r.label&&e.command===r.body)&&a.add(r.id);le(a)}).catch(e=>X(e instanceof Error?e.message:"Failed to load CCWeb Hub")).finally(()=>R(!1))},[]);const de=t.useMemo(()=>{const e=new Set;return G.forEach(s=>{var t;return null==(t=s.tags)?void 0:t.forEach(s=>e.add(s))}),[...e].sort()},[G]),oe=t.useMemo(()=>{let e=G;"all"!==Y&&(e=e.filter(e=>e.kind===Y)),"__untagged__"===se?e=e.filter(e=>!e.tags||0===e.tags.length):se&&(e=e.filter(e=>{var s;return null==(s=e.tags)?void 0:s.includes(se)}));const s=H.trim().toLowerCase();return s&&(e=e.filter(e=>e.label.toLowerCase().includes(s)||e.body.toLowerCase().includes(s)||(e.description??"").toLowerCase().includes(s)||(e.author??"").toLowerCase().includes(s)||(e.tags??[]).some(e=>e.toLowerCase().includes(s)))),e},[G,Y,se,H]);return m.jsxs("div",{className:"min-h-screen bg-background",children:[m.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:m.jsxs("div",{className:"max-w-4xl mx-auto px-4 h-14 flex items-center gap-4",children:[m.jsxs(x,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[m.jsx(u,{className:"h-4 w-4 mr-1"}),"返回"]}),m.jsx("h1",{className:"font-semibold text-lg",children:"CCWeb Hub"}),m.jsxs("div",{className:"flex items-center gap-1 ml-4",children:[m.jsx("button",{onClick:()=>M("prompts"),className:p("px-3 py-1 rounded-md text-sm transition-colors","prompts"===z?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:"Prompts"}),m.jsxs("button",{onClick:()=>M("plugins"),className:p("px-3 py-1 rounded-md text-sm transition-colors flex items-center gap-1","plugins"===z?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:[m.jsx(P,{className:"h-3.5 w-3.5"}),"插件"]})]}),m.jsx("div",{className:"flex-1"}),m.jsxs("div",{className:"relative w-64",children:[m.jsx(w,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),m.jsx(h,{placeholder:"prompts"===z?"搜索 prompt...":"搜索插件...",value:H,onChange:e=>_(e.target.value),className:"pl-8 h-9"})]})]})}),m.jsxs("main",{className:"max-w-4xl mx-auto px-4 py-6",children:["plugins"===z&&m.jsxs("div",{children:[O&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),!O&&m.jsxs(m.Fragment,{children:[F.length>0&&m.jsxs("div",{className:"mb-8",children:[m.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:"已安装"}),m.jsx("div",{className:"space-y-2",children:F.map(e=>m.jsxs("div",{className:"rounded-lg border bg-card p-4 flex items-center gap-4",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"font-medium text-sm",children:e.name}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",e.version]}),m.jsx("span",{className:p("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?"启用":"禁用"})]}),m.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.description}),e.permissions.length>0&&m.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:e.permissions.map(e=>m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:e},e))})]}),m.jsx(x,{size:"sm",variant:"ghost",onClick:()=>$(e.id,!e.enabled),title:e.enabled?"禁用":"启用",children:m.jsx(S,{className:p("h-4 w-4",e.enabled?"text-green-500":"text-muted-foreground")})}),m.jsx(x,{size:"sm",variant:"ghost",onClick:()=>D(e.id),title:"卸载",children:m.jsx(g,{className:"h-4 w-4 text-red-400"})})]},e.id))})]}),m.jsxs("div",{children:[m.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:F.length>0?"更多插件":"可用插件"}),0===W.length&&m.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[m.jsx(P,{className:"h-10 w-10 mx-auto mb-3 opacity-30"}),m.jsx("p",{className:"text-sm",children:"Hub 暂无可用插件"})]}),m.jsx("div",{className:"space-y-2",children:W.filter(e=>!F.some(s=>s.id===e.id)).map((e,s)=>{const t=U===e.id;return m.jsxs(f.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:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"font-medium text-sm",children:e.name}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",e.version]}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["by ",e.author]})]}),m.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.description}),e.permissions.length>0&&m.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:e.permissions.map(e=>m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:e},e))})]}),m.jsxs(x,{size:"sm",disabled:t,onClick:()=>B(e),children:[m.jsx(j,{className:"h-3.5 w-3.5 mr-1"}),t?"安装中...":"安装"]})]},e.id)})})]})]})]}),"prompts"===z&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[m.jsx(A,{active:"all"===Y,onClick:()=>ee("all"),children:"全部"}),m.jsxs(A,{active:"quick-prompt"===Y,onClick:()=>ee("quick-prompt"),children:[m.jsx(b,{className:"h-3 w-3"}),"Quick Prompts"]}),m.jsxs(A,{active:"agent-prompt"===Y,onClick:()=>ee("agent-prompt"),children:[m.jsx(N,{className:"h-3 w-3"}),"Agent Prompts"]})]}),de.length>0&&m.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[m.jsx(L,{active:null===se,onClick:()=>te(null),children:"全部标签"}),de.map(e=>m.jsx(L,{active:se===e,onClick:()=>te(se===e?null:e),children:e},e))]}),K&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),V&&m.jsx("div",{className:"text-center text-destructive py-20",children:V}),!K&&!V&&0===G.length&&m.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[m.jsx("p",{className:"text-lg mb-2",children:"CCWeb Hub 还没有 prompt"}),m.jsx("p",{className:"text-sm",children:'在 Quick Prompts 或 Agent Prompts 卡片上右键选择"共享"来提交第一个吧!'})]}),!K&&!V&&G.length>0&&0===oe.length&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的 prompt"}),m.jsx("div",{className:"space-y-3",children:oe.map((e,s)=>{var t;const a=ae===e.id,r=ne.has(e.id),l=ie===e.id;return m.jsxs(f.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:()=>re(a?null:e.id),children:[m.jsxs("div",{className:"flex items-start justify-between gap-4",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsxs("span",{className:p("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium","quick-prompt"===e.kind?"bg-blue-500/15 text-blue-400":"bg-green-500/15 text-green-500"),children:["quick-prompt"===e.kind?m.jsx(b,{className:"h-2.5 w-2.5"}):m.jsx(N,{className:"h-2.5 w-2.5"}),"quick-prompt"===e.kind?"Quick":"Agent"]}),m.jsx("h3",{className:"font-medium text-sm truncate",children:e.label}),null==(t=e.tags)?void 0:t.map(e=>m.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:[m.jsx(q,{className:"h-2.5 w-2.5"}),e]},e))]}),e.description&&m.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:e.description}),m.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[e.author&&m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx(E,{className:"h-3 w-3"}),e.author]}),m.jsx("code",{className:"text-[10px] opacity-60",children:e.file})]})]}),m.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxs(x,{size:"sm",variant:r?"outline":"default",disabled:l||r,onClick:s=>{(async(e,s)=>{if(s.stopPropagation(),!ie&&!ne.has(e.id)){ce(e.id);try{"quick-prompt"===e.kind?(await v({label:e.label,command:e.body}),n.success("已导入到全局快捷 Prompts")):(await k({label:e.label,command:e.body}),n.success("已导入到全局 Agent Prompts")),le(s=>new Set(s).add(e.id))}catch(t){n.error(t instanceof Error?t.message:"导入失败")}finally{ce(null)}}})(e,s)},title:"quick-prompt"===e.kind?"导入到全局快捷 Prompts":"导入到全局 Agent Prompts",children:[m.jsx(j,{className:"h-3.5 w-3.5 mr-1"}),r?"已导入":l?"导入中...":"导入"]}),m.jsx(f.span,{animate:{rotate:a?180:0},transition:{duration:.2},children:m.jsx(C,{className:"h-4 w-4 text-muted-foreground"})})]})]}),m.jsx(y,{children:a&&m.jsx(f.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:m.jsx("div",{className:"mt-3 pt-3 border-t",children:m.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.body})})})})]},e.id)})})]})]})]})}function A({active:e,onClick:s,children:t}){return m.jsx("button",{onClick:s,className:p("flex items-center gap-1 px-3 py-1 rounded-full text-xs font-medium transition-colors",e?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),children:t})}function L({active:e,onClick:s,children:t}){return m.jsx("button",{onClick:s,className:p("px-3 py-1 rounded-full text-xs font-medium transition-colors",e?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),children:t})}export{z as SkillHubPage};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{c as e}from"./index-fJX6wxPU.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license lucide-react v0.309.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const c=e("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),a=e("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);
|
|
8
|
+
/**
|
|
9
|
+
* @license lucide-react v0.309.0 - ISC
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the ISC license.
|
|
12
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/export{a as C,c as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,r as t,j as n,K as r,N as o,R as i,U as a,
|
|
1
|
+
import{c as e,r as t,j as n,K as r,N as o,R as i,U as a,aX as l,W as s,V as c,aW as f,L as u,O as d,d as p,aY as m,aJ as h}from"./index-fJX6wxPU.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,j as n,K as r,N as o,R as i,U as a,aQ as l,W as s,V as c,aP
|
|
|
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 w(e){const r=x(e),o=t.forwardRef((e,o)=>{const{children:i,...a}=e,l=t.Children.toArray(i),s=l.find(R);if(s){const e=s.props.children,i=l.map(n=>n===s?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:n);return n.jsx(r,{...a,ref:o,children:t.isValidElement(e)?t.cloneElement(e,void 0,i):null})}return n.jsx(r,{...a,ref:o,children:i})});return o.displayName=`${e}.Slot`,o}function x(e){const n=t.forwardRef((e,n)=>{const{children:o,...i}=e;if(t.isValidElement(o)){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}(o),a=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{const t=i(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(i,o.props);return o.type!==t.Fragment&&(a.ref=n?r(n,e):e),t.cloneElement(o,a)}return t.Children.count(o)>1?t.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var b=Symbol("radix.slottable");function R(e){return t.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===b}function A(e){const t=e+"CollectionProvider",[r,l]=o(t),[s,c]=r(t,{collectionRef:{current:null},itemMap:new Map}),f=e=>{const{scope:t,children:r}=e,o=i.useRef(null),a=i.useRef(new Map).current;return n.jsx(s,{scope:t,itemMap:a,collectionRef:o,children:r})};f.displayName=t;const u=e+"CollectionSlot",d=w(u),p=i.forwardRef((e,t)=>{const{scope:r,children:o}=e,i=c(u,r),l=a(t,i.collectionRef);return n.jsx(d,{ref:l,children:o})});p.displayName=u;const m=e+"CollectionItemSlot",h="data-radix-collection-item",g=w(m),y=i.forwardRef((e,t)=>{const{scope:r,children:o,...l}=e,s=i.useRef(null),f=a(t,s),u=c(m,r);return i.useEffect(()=>(u.itemMap.set(s,{ref:s,...l}),()=>{u.itemMap.delete(s)})),n.jsx(g,{[h]:"",ref:f,children:o})});return y.displayName=m,[{Provider:f,Slot:p,ItemSlot:y},function(t){const n=c(e+"CollectionConsumer",t);return i.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${h}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])},l]}var S=t.createContext(void 0);function C(e){const n=t.useContext(S);return e||n||"ltr"}var T="rovingFocusGroup.onEntryFocus",E={bubbles:!1,cancelable:!0},P="RovingFocusGroup",[O,D,j]=A(P),[F,L]=o(P,[j]),[k,M]=F(P),I=t.forwardRef((e,t)=>n.jsx(O.Provider,{scope:e.__scopeRovingFocusGroup,children:n.jsx(O.Slot,{scope:e.__scopeRovingFocusGroup,children:n.jsx(N,{...e,ref:t})})}));I.displayName=P;var N=t.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:o,orientation:i,loop:l=!1,dir:d,currentTabStopId:p,defaultCurrentTabStopId:m,onCurrentTabStopIdChange:h,onEntryFocus:g,preventScrollOnEntryFocus:y=!1,...v}=e,w=t.useRef(null),x=a(r,w),b=C(d),[R,A]=f({prop:p,defaultProp:m??null,onChange:h,caller:P}),[S,O]=t.useState(!1),j=u(g),F=D(o),L=t.useRef(!1),[M,I]=t.useState(0);return t.useEffect(()=>{const e=w.current;if(e)return e.addEventListener(T,j),()=>e.removeEventListener(T,j)},[j]),n.jsx(k,{scope:o,orientation:i,dir:b,loop:l,currentTabStopId:R,onItemFocus:t.useCallback(e=>A(e),[A]),onItemShiftTab:t.useCallback(()=>O(!0),[]),onFocusableItemAdd:t.useCallback(()=>I(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>I(e=>e-1),[]),children:n.jsx(s.div,{tabIndex:S||0===M?-1:0,"data-orientation":i,...v,ref:x,style:{outline:"none",...e.style},onMouseDown:c(e.onMouseDown,()=>{L.current=!0}),onFocus:c(e.onFocus,e=>{const t=!L.current;if(e.target===e.currentTarget&&t&&!S){const t=new CustomEvent(T,E);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=F().filter(e=>e.focusable);W([e.find(e=>e.active),e.find(e=>e.id===R),...e].filter(Boolean).map(e=>e.ref.current),y)}}L.current=!1}),onBlur:c(e.onBlur,()=>O(!1))})})}),_="RovingFocusGroupItem",H=t.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:o,focusable:i=!0,active:a=!1,tabStopId:f,children:u,...d}=e,p=l(),m=f||p,h=M(_,o),g=h.currentTabStopId===m,y=D(o),{onFocusableItemAdd:v,onFocusableItemRemove:w,currentTabStopId:x}=h;return t.useEffect(()=>{if(i)return v(),()=>w()},[i,v,w]),n.jsx(O.ItemSlot,{scope:o,id:m,focusable:i,active:a,children:n.jsx(s.span,{tabIndex:g?0:-1,"data-orientation":h.orientation,...d,ref:r,onMouseDown:c(e.onMouseDown,e=>{i?h.onItemFocus(m):e.preventDefault()}),onFocus:c(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:c(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void h.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:z[r]}(e,h.orientation,h.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let o=y().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 i=o.indexOf(e.currentTarget);o=h.loop?(r=i+1,(n=o).map((e,t)=>n[(r+t)%n.length])):o.slice(i+1)}setTimeout(()=>W(o))}var n,r}),children:"function"==typeof u?u({isCurrentTabStop:g,hasTabStop:null!=x}):u})})});H.displayName=_;var z={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function W(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 $=I,V=H,B="Tabs",[K]=o(B,[L]),G=L(),[U,Y]=K(B),X=t.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,onValueChange:i,defaultValue:a,orientation:c="horizontal",dir:u,activationMode:d="automatic",...p}=e,m=C(u),[h,g]=f({prop:o,onChange:i,defaultProp:a??"",caller:B});return n.jsx(U,{scope:r,baseId:l(),value:h,onValueChange:g,orientation:c,dir:m,activationMode:d,children:n.jsx(s.div,{dir:m,"data-orientation":c,...p,ref:t})})});X.displayName=B;var q="TabsList",Q=t.forwardRef((e,t)=>{const{__scopeTabs:r,loop:o=!0,...i}=e,a=Y(q,r),l=G(r);return n.jsx($,{asChild:!0,...l,orientation:a.orientation,dir:a.dir,loop:o,children:n.jsx(s.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:t})})});Q.displayName=q;var Z="TabsTrigger",J=t.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,disabled:i=!1,...a}=e,l=Y(Z,r),f=G(r),u=ne(l.baseId,o),d=re(l.baseId,o),p=o===l.value;return n.jsx(V,{asChild:!0,...f,focusable:!i,active:p,children:n.jsx(s.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":d,"data-state":p?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:u,...a,ref:t,onMouseDown:c(e.onMouseDown,e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():l.onValueChange(o)}),onKeyDown:c(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&l.onValueChange(o)}),onFocus:c(e.onFocus,()=>{const e="manual"!==l.activationMode;p||i||!e||l.onValueChange(o)})})})});J.displayName=Z;var ee="TabsContent",te=t.forwardRef((e,r)=>{const{__scopeTabs:o,value:i,forceMount:a,children:l,...c}=e,f=Y(ee,o),u=ne(f.baseId,i),p=re(f.baseId,i),m=i===f.value,h=t.useRef(m);return t.useEffect(()=>{const e=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(e)},[]),n.jsx(d,{present:a||m,children:({present:t})=>n.jsx(s.div,{"data-state":m?"active":"inactive","data-orientation":f.orientation,role:"tabpanel","aria-labelledby":u,hidden:!t,id:p,tabIndex:0,...c,ref:r,style:{...e.style,animationDuration:h.current?"0s":void 0},children:t&&l})})});function ne(e,t){return`${e}-trigger-${t}`}function re(e,t){return`${e}-content-${t}`}te.displayName=ee;var oe=Q,ie=J,ae=te;const le=X,se=t.forwardRef(({className:e,...t},r)=>n.jsx(oe,{ref:r,className:p("flex rounded-md bg-muted p-1 text-muted-foreground data-[orientation=horizontal]:h-10 data-[orientation=horizontal]:items-center data-[orientation=horizontal]:justify-center data-[orientation=horizontal]:inline-flex data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-center data-[orientation=vertical]:justify-start",e),...t}));se.displayName=oe.displayName;const ce=t.forwardRef(({className:e,...t},r)=>n.jsx(ie,{ref:r,className:p("inline-flex items-center justify-center whitespace-nowrap rounded-sm 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 data-[orientation=horizontal]:px-3 data-[orientation=horizontal]:py-1.5",e),...t}));ce.displayName=ie.displayName;const fe=t.forwardRef(({className:e,...t},r)=>n.jsx(ae,{ref:r,className:p("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));fe.displayName=ae.displayName;const ue=["top","right","bottom","left"],de=Math.min,pe=Math.max,me=Math.round,he=Math.floor,ge=e=>({x:e,y:e}),ye={left:"right",right:"left",bottom:"top",top:"bottom"};function ve(e,t,n){return pe(e,de(t,n))}function we(e,t){return"function"==typeof e?e(t):e}function xe(e){return e.split("-")[0]}function be(e){return e.split("-")[1]}function Re(e){return"x"===e?"y":"x"}function Ae(e){return"y"===e?"height":"width"}function Se(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function Ce(e){return Re(Se(e))}function Te(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ee=["left","right"],Pe=["right","left"],Oe=["top","bottom"],De=["bottom","top"];function je(e,t,n,r){const o=be(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Pe:Ee:t?Ee:Pe;case"left":case"right":return t?Oe:De;default:return[]}}(xe(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(Te)))),i}function Fe(e){const t=xe(e);return ye[t]+e.slice(t.length)}function Le(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 ke(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 Me(e,t,n){let{reference:r,floating:o}=e;const i=Se(t),a=Ce(t),l=Ae(a),s=xe(t),c="y"===i,f=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,d=r[l]/2-o[l]/2;let p;switch(s){case"top":p={x:f,y:r.y-o.height};break;case"bottom":p={x:f,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(be(t)){case"start":p[a]-=d*(n&&c?-1:1);break;case"end":p[a]+=d*(n&&c?-1:1)}return p}async function Ie(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:d=!1,padding:p=0}=we(t,e),m=Le(p),h=l[d?"floating"===u?"reference":"floating":u],g=ke(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:f,strategy:s})),y="floating"===u?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,v=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),w=await(null==i.isElement?void 0:i.isElement(v))&&await(null==i.getScale?void 0:i.getScale(v))||{x:1,y:1},x=ke(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:v,strategy:s}):y);return{top:(g.top-x.top+m.top)/w.y,bottom:(x.bottom-g.bottom+m.bottom)/w.y,left:(g.left-x.left+m.left)/w.x,right:(x.right-g.right+m.right)/w.x}}function Ne(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function _e(e){return ue.some(t=>e[t]>=0)}const He=new Set(["left","top"]);function ze(){return"undefined"!=typeof window}function We(e){return Be(e)?(e.nodeName||"").toLowerCase():"#document"}function $e(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ve(e){var t;return null==(t=(Be(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Be(e){return!!ze()&&(e instanceof Node||e instanceof $e(e).Node)}function Ke(e){return!!ze()&&(e instanceof Element||e instanceof $e(e).Element)}function Ge(e){return!!ze()&&(e instanceof HTMLElement||e instanceof $e(e).HTMLElement)}function Ue(e){return!(!ze()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof $e(e).ShadowRoot)}function Ye(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ot(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==o&&"contents"!==o}function Xe(e){return/^(table|td|th)$/.test(We(e))}function qe(e){try{if(e.matches(":popover-open"))return!0}catch(t){}try{return e.matches(":modal")}catch(t){return!1}}const Qe=/transform|translate|scale|rotate|perspective|filter/,Ze=/paint|layout|strict|content/,Je=e=>!!e&&"none"!==e;let et;function tt(e){const t=Ke(e)?ot(e):e;return Je(t.transform)||Je(t.translate)||Je(t.scale)||Je(t.rotate)||Je(t.perspective)||!nt()&&(Je(t.backdropFilter)||Je(t.filter))||Qe.test(t.willChange||"")||Ze.test(t.contain||"")}function nt(){return null==et&&(et="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),et}function rt(e){return/^(html|body|#document)$/.test(We(e))}function ot(e){return $e(e).getComputedStyle(e)}function it(e){return Ke(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function at(e){if("html"===We(e))return e;const t=e.assignedSlot||e.parentNode||Ue(e)&&e.host||Ve(e);return Ue(t)?t.host:t}function lt(e){const t=at(e);return rt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ge(t)&&Ye(t)?t:lt(t)}function st(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=lt(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=$e(o);if(i){const e=ct(a);return t.concat(a,a.visualViewport||[],Ye(o)?o:[],e&&n?st(e):[])}return t.concat(o,st(o,[],n))}function ct(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ft(e){const t=ot(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ge(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=me(n)!==i||me(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function ut(e){return Ke(e)?e:e.contextElement}function dt(e){const t=ut(e);if(!Ge(t))return ge(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ft(t);let a=(i?me(n.width):n.width)/r,l=(i?me(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),l&&Number.isFinite(l)||(l=1),{x:a,y:l}}const pt=ge(0);function mt(e){const t=$e(e);return nt()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:pt}function ht(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=ut(e);let a=ge(1);t&&(r?Ke(r)&&(a=dt(r)):a=dt(e));const l=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==$e(e))&&t}(i,n,r)?mt(i):ge(0);let s=(o.left+l.x)/a.x,c=(o.top+l.y)/a.y,f=o.width/a.x,u=o.height/a.y;if(i){const e=$e(i),t=r&&Ke(r)?$e(r):r;let n=e,o=ct(n);for(;o&&r&&t!==n;){const e=dt(o),t=o.getBoundingClientRect(),r=ot(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,c*=e.y,f*=e.x,u*=e.y,s+=i,c+=a,n=$e(o),o=ct(n)}}return ke({width:f,height:u,x:s,y:c})}function gt(e,t){const n=it(e).scrollLeft;return t?t.left+n:ht(Ve(e)).left+n}function yt(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-gt(e,n),y:n.top+t.scrollTop}}function vt(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=$e(e),r=Ve(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,s=0;if(o){i=o.width,a=o.height;const e=nt();(!e||e&&"fixed"===t)&&(l=o.offsetLeft,s=o.offsetTop)}const c=gt(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&&(i-=a)}else c<=25&&(i+=c);return{width:i,height:a,x:l,y:s}}(e,n);else if("document"===t)r=function(e){const t=Ve(e),n=it(e),r=e.ownerDocument.body,o=pe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=pe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+gt(e);const l=-n.scrollTop;return"rtl"===ot(r).direction&&(a+=pe(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}(Ve(e));else if(Ke(t))r=function(e,t){const n=ht(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ge(e)?dt(e):ge(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=mt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ke(r)}function wt(e,t){const n=at(e);return!(n===t||!Ke(n)||rt(n))&&("fixed"===ot(n).position||wt(n,t))}function xt(e,t,n){const r=Ge(t),o=Ve(t),i="fixed"===n,a=ht(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const s=ge(0);function c(){s.x=gt(o)}if(r||!r&&!i)if(("body"!==We(t)||Ye(o))&&(l=it(t)),r){const e=ht(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&c();i&&!r&&o&&c();const f=!o||r||i?ge(0):yt(o,l);return{x:a.left+l.scrollLeft-s.x-f.x,y:a.top+l.scrollTop-s.y-f.y,width:a.width,height:a.height}}function bt(e){return"static"===ot(e).position}function Rt(e,t){if(!Ge(e)||"fixed"===ot(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Ve(e)===n&&(n=n.ownerDocument.body),n}function At(e,t){const n=$e(e);if(qe(e))return n;if(!Ge(e)){let t=at(e);for(;t&&!rt(t);){if(Ke(t)&&!bt(t))return t;t=at(t)}return n}let r=Rt(e,t);for(;r&&Xe(r)&&bt(r);)r=Rt(r,t);return r&&rt(r)&&bt(r)&&!tt(r)?n:r||function(e){let t=at(e);for(;Ge(t)&&!rt(t);){if(tt(t))return t;if(qe(t))return null;t=at(t)}return null}(e)||n}const St={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Ve(r),l=!!t&&qe(t.floating);if(r===a||l&&i)return n;let s={scrollLeft:0,scrollTop:0},c=ge(1);const f=ge(0),u=Ge(r);if((u||!u&&!i)&&(("body"!==We(r)||Ye(a))&&(s=it(r)),u)){const e=ht(r);c=dt(r),f.x=e.x+r.clientLeft,f.y=e.y+r.clientTop}const d=!a||u||i?ge(0):yt(a,s);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-s.scrollLeft*c.x+f.x+d.x,y:n.y*c.y-s.scrollTop*c.y+f.y+d.y}},getDocumentElement:Ve,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?qe(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=st(e,[],!1).filter(e=>Ke(e)&&"body"!==We(e)),o=null;const i="fixed"===ot(e).position;let a=i?at(e):e;for(;Ke(a)&&!rt(a);){const t=ot(a),n=tt(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&("absolute"===o.position||"fixed"===o.position)||Ye(a)&&!n&&wt(e,a))?r=r.filter(e=>e!==a):o=t,a=at(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=vt(t,i[0],o);let l=a.top,s=a.right,c=a.bottom,f=a.left;for(let u=1;u<i.length;u++){const e=vt(t,i[u],o);l=pe(e.top,l),s=de(e.right,s),c=de(e.bottom,c),f=pe(e.left,f)}return{width:s-f,height:c-l,x:f,y:l}},getOffsetParent:At,getElementRects:async function(e){const t=this.getOffsetParent||At,n=this.getDimensions,r=await n(e.floating);return{reference:xt(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}=ft(e);return{width:t,height:n}},getScale:dt,isElement:Ke,isRTL:function(e){return"rtl"===ot(e).direction}};function Ct(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Tt(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,c=ut(e),f=o||i?[...c?st(c):[],...t?st(t):[]]:[];f.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)});const u=c&&l?function(e,t){let n,r=null;const o=Ve(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(l,s){void 0===l&&(l=!1),void 0===s&&(s=1),i();const c=e.getBoundingClientRect(),{left:f,top:u,width:d,height:p}=c;if(l||t(),!d||!p)return;const m={rootMargin:-he(u)+"px "+-he(o.clientWidth-(f+d))+"px "+-he(o.clientHeight-(u+p))+"px "+-he(f)+"px",threshold:pe(0,de(1,s))||1};let h=!0;function g(t){const r=t[0].intersectionRatio;if(r!==s){if(!h)return a();r?a(!1,r):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==r||Ct(c,e.getBoundingClientRect())||a(),h=!1}try{r=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch(y){r=new IntersectionObserver(g,m)}r.observe(e)}(!0),i}(c,n):null;let d,p=-1,m=null;a&&(m=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),n()}),c&&!s&&m.observe(c),t&&m.observe(t));let h=s?ht(e):null;return s&&function t(){const r=ht(e);h&&!Ct(h,r)&&n();h=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach(e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==u||u(),null==(e=m)||e.disconnect(),m=null,s&&cancelAnimationFrame(d)}}const Et=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:l}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=xe(n),l=be(n),s="y"===Se(n),c=He.has(a)?-1:1,f=i&&s?-1:1,u=we(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&"number"==typeof m&&(p="end"===l?-1*m:m),s?{x:p*f,y:d*c}:{x:d*c,y:p*f}}(t,e);return a===(null==(n=l.offset)?void 0:n.placement)&&null!=(r=l.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:a}}}}},Pt=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=we(e,t),f={x:n,y:r},u=await i.detectOverflow(t,c),d=Se(xe(o)),p=Re(d);let m=f[p],h=f[d];if(a){const e="y"===p?"bottom":"right";m=ve(m+u["y"===p?"top":"left"],m,m-u[e])}if(l){const e="y"===d?"bottom":"right";h=ve(h+u["y"===d?"top":"left"],h,h-u[e])}const g=s.fn({...t,[p]:m,[d]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:a,[d]:l}}}}}},Ot=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:s,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=we(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=xe(o),v=Se(l),w=xe(l)===l,x=await(null==s.isRTL?void 0:s.isRTL(c.floating)),b=d||(w||!h?[Fe(l)]:function(e){const t=Fe(e);return[Te(e),t,Te(t)]}(l)),R="none"!==m;!d&&R&&b.push(...je(l,h,m,x));const A=[l,...b],S=await s.detectOverflow(t,g),C=[];let T=(null==(r=i.flip)?void 0:r.overflows)||[];if(f&&C.push(S[y]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=be(e),o=Ce(e),i=Ae(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Fe(a)),[a,Fe(a)]}(o,a,x);C.push(S[e[0]],S[e[1]])}if(T=[...T,{placement:o,overflows:C}],!C.every(e=>e<=0)){var E,P;const e=((null==(E=i.flip)?void 0:E.index)||0)+1,t=A[e];if(t){if(!("alignment"===u&&v!==Se(t))||T.every(e=>Se(e.placement)!==v||e.overflows[0]>0))return{data:{index:e,overflows:T},reset:{placement:t}}}let n=null==(P=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:P.placement;if(!n)switch(p){case"bestFit":{var O;const e=null==(O=T.filter(e=>{if(R){const t=Se(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:O[0];e&&(n=e);break}case"initialPlacement":n=l}if(o!==n)return{reset:{placement:n}}}return{}}}},Dt=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:a,elements:l}=t,{apply:s=()=>{},...c}=we(e,t),f=await a.detectOverflow(t,c),u=xe(o),d=be(o),p="y"===Se(o),{width:m,height:h}=i.floating;let g,y;"top"===u||"bottom"===u?(g=u,y=d===(await(null==a.isRTL?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(y=u,g="end"===d?"top":"bottom");const v=h-f.top-f.bottom,w=m-f.left-f.right,x=de(h-f[g],v),b=de(m-f[y],w),R=!t.middlewareData.shift;let A=x,S=b;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(S=w),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(A=v),R&&!d){const e=pe(f.left,0),t=pe(f.right,0),n=pe(f.top,0),r=pe(f.bottom,0);p?S=m-2*(0!==e||0!==t?e+t:pe(f.left,f.right)):A=h-2*(0!==n||0!==r?n+r:pe(f.top,f.bottom))}await s({...t,availableWidth:S,availableHeight:A});const C=await a.getDimensions(l.floating);return m!==C.width||h!==C.height?{reset:{rects:!0}}:{}}}},jt=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=we(e,t);switch(o){case"referenceHidden":{const e=Ne(await r.detectOverflow(t,{...i,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:_e(e)}}}case"escaped":{const e=Ne(await r.detectOverflow(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:_e(e)}}}default:return{}}}}},Ft=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:l,middlewareData:s}=t,{element:c,padding:f=0}=we(e,t)||{};if(null==c)return{};const u=Le(f),d={x:n,y:r},p=Ce(o),m=Ae(p),h=await a.getDimensions(c),g="y"===p,y=g?"top":"left",v=g?"bottom":"right",w=g?"clientHeight":"clientWidth",x=i.reference[m]+i.reference[p]-d[p]-i.floating[m],b=d[p]-i.reference[p],R=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let A=R?R[w]:0;A&&await(null==a.isElement?void 0:a.isElement(R))||(A=l.floating[w]||i.floating[m]);const S=x/2-b/2,C=A/2-h[m]/2-1,T=de(u[y],C),E=de(u[v],C),P=T,O=A-h[m]-E,D=A/2-h[m]/2+S,j=ve(P,D,O),F=!s.arrow&&null!=be(o)&&D!==j&&i.reference[m]/2-(D<P?T:E)-h[m]/2<0,L=F?D<P?D-P:D-O:0;return{[p]:d[p]+L,data:{[p]:j,centerOffset:D-j-L,...F&&{alignmentOffset:L}},reset:F}}}),Lt=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:a}=t,{offset:l=0,mainAxis:s=!0,crossAxis:c=!0}=we(e,t),f={x:n,y:r},u=Se(o),d=Re(u);let p=f[d],m=f[u];const h=we(l,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(s){const e="y"===d?"height":"width",t=i.reference[d]-i.floating[e]+g.mainAxis,n=i.reference[d]+i.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(c){var y,v;const e="y"===d?"width":"height",t=He.has(xe(o)),n=i.reference[u]-i.floating[e]+(t&&(null==(y=a.offset)?void 0:y[u])||0)+(t?0:g.crossAxis),r=i.reference[u]+i.reference[e]+(t?0:(null==(v=a.offset)?void 0:v[u])||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[d]:p,[u]:m}}}},kt=(e,t,n)=>{const r=new Map,o={platform:St,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:Ie},s=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:u}=Me(c,r,s),d=r,p=0;const m={};for(let h=0;h<i.length;h++){const n=i[h];if(!n)continue;const{name:g,fn:y}=n,{x:v,y:w,data:x,reset:b}=await y({x:f,y:u,initialPlacement:r,placement:d,strategy:o,middlewareData:m,rects:c,platform:l,elements:{reference:e,floating:t}});f=null!=v?v:f,u=null!=w?w:u,m[g]={...m[g],...x},b&&p<50&&(p++,"object"==typeof b&&(b.placement&&(d=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:f,y:u}=Me(c,d,s))),h=-1)}return{x:f,y:u,placement:d,strategy:o,middlewareData:m}})(e,t,{...o,platform:i})};var Mt="undefined"!=typeof document?t.useLayoutEffect:function(){};function It(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(!It(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)&&!It(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Nt(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _t(e,t){const n=Nt(e);return Math.round(t*n)/n}function Ht(e){const n=t.useRef(e);return Mt(()=>{n.current=e}),n}const zt=(e,t)=>{const n=Et(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wt=(e,t)=>{const n=Pt(e);return{name:n.name,fn:n.fn,options:[e,t]}},$t=(e,t)=>{const n=Ot(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vt=(e,t)=>{const n=Dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bt=(e,t)=>{const n=jt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kt=(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?Ft({element:n.current,padding:r}).fn(t):{}:n?Ft({element:n,padding:r}).fn(t):{};var o}}))(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Gt=t.forwardRef((e,t)=>{const{children:r,width:o=10,height:i=5,...a}=e;return n.jsx(s.svg,{...a,ref:t,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:n.jsx("polygon",{points:"0,0 30,0 15,10"})})});Gt.displayName="Arrow";var Ut=Gt;function Yt(e){const[n,r]=t.useState(void 0);return h(()=>{if(e){r({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 o,i;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,i=t.blockSize}else o=e.offsetWidth,i=e.offsetHeight;r({width:o,height:i})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),n}var Xt="Popper",[qt,Qt]=o(Xt),[Zt,Jt]=qt(Xt),en=e=>{const{__scopePopper:r,children:o}=e,[i,a]=t.useState(null);return n.jsx(Zt,{scope:r,anchor:i,onAnchorChange:a,children:o})};en.displayName=Xt;var tn="PopperAnchor",nn=t.forwardRef((e,r)=>{const{__scopePopper:o,virtualRef:i,...l}=e,c=Jt(tn,o),f=t.useRef(null),u=a(r,f),d=t.useRef(null);return t.useEffect(()=>{const e=d.current;d.current=(null==i?void 0:i.current)||f.current,e!==d.current&&c.onAnchorChange(d.current)}),i?null:n.jsx(s.div,{...l,ref:u})});nn.displayName=tn;var rn="PopperContent",[on,an]=qt(rn),ln=t.forwardRef((e,r)=>{var o,i,l,c,f,d;const{__scopePopper:p,side:g="bottom",sideOffset:y=0,align:v="center",alignOffset:w=0,arrowPadding:x=0,avoidCollisions:b=!0,collisionBoundary:R=[],collisionPadding:A=0,sticky:S="partial",hideWhenDetached:C=!1,updatePositionStrategy:T="optimized",onPlaced:E,...P}=e,O=Jt(rn,p),[D,j]=t.useState(null),F=a(r,e=>j(e)),[L,k]=t.useState(null),M=Yt(L),I=(null==M?void 0:M.width)??0,N=(null==M?void 0:M.height)??0,_=g+("center"!==v?"-"+v:""),H="number"==typeof A?A:{top:0,right:0,bottom:0,left:0,...A},z=Array.isArray(R)?R:[R],W=z.length>0,$={padding:H,boundary:z.filter(un),altBoundary:W},{refs:V,floatingStyles:B,placement:K,isPositioned:G,middlewareData:U}=function(e){void 0===e&&(e={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:a,floating:l}={},transform:s=!0,whileElementsMounted:c,open:f}=e,[u,d]=t.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[p,h]=t.useState(o);It(p,o)||h(o);const[g,y]=t.useState(null),[v,w]=t.useState(null),x=t.useCallback(e=>{e!==S.current&&(S.current=e,y(e))},[]),b=t.useCallback(e=>{e!==C.current&&(C.current=e,w(e))},[]),R=a||g,A=l||v,S=t.useRef(null),C=t.useRef(null),T=t.useRef(u),E=null!=c,P=Ht(c),O=Ht(i),D=Ht(f),j=t.useCallback(()=>{if(!S.current||!C.current)return;const e={placement:n,strategy:r,middleware:p};O.current&&(e.platform=O.current),kt(S.current,C.current,e).then(e=>{const t={...e,isPositioned:!1!==D.current};F.current&&!It(T.current,t)&&(T.current=t,m.flushSync(()=>{d(t)}))})},[p,n,r,O,D]);Mt(()=>{!1===f&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[f]);const F=t.useRef(!1);Mt(()=>(F.current=!0,()=>{F.current=!1}),[]),Mt(()=>{if(R&&(S.current=R),A&&(C.current=A),R&&A){if(P.current)return P.current(R,A,j);j()}},[R,A,j,P,E]);const L=t.useMemo(()=>({reference:S,floating:C,setReference:x,setFloating:b}),[x,b]),k=t.useMemo(()=>({reference:R,floating:A}),[R,A]),M=t.useMemo(()=>{const e={position:r,left:0,top:0};if(!k.floating)return e;const t=_t(k.floating,u.x),n=_t(k.floating,u.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...Nt(k.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,s,k.floating,u.x,u.y]);return t.useMemo(()=>({...u,update:j,refs:L,elements:k,floatingStyles:M}),[u,j,L,k,M])}({strategy:"fixed",placement:_,whileElementsMounted:(...e)=>Tt(...e,{animationFrame:"always"===T}),elements:{reference:O.anchor},middleware:[zt({mainAxis:y+N,alignmentAxis:w}),b&&Wt({mainAxis:!0,crossAxis:!1,limiter:"partial"===S?{fn:Lt(Y).fn,options:[Y,X]}:void 0,...$}),b&&$t({...$}),Vt({...$,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:i}=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",`${i}px`)}}),L&&Kt({element:L,padding:x}),dn({arrowWidth:I,arrowHeight:N}),C&&Bt({strategy:"referenceHidden",...$})]});var Y,X;const[q,Q]=pn(K),Z=u(E);h(()=>{G&&(null==Z||Z())},[G,Z]);const J=null==(o=U.arrow)?void 0:o.x,ee=null==(i=U.arrow)?void 0:i.y,te=0!==(null==(l=U.arrow)?void 0:l.centerOffset),[ne,re]=t.useState();return h(()=>{D&&re(window.getComputedStyle(D).zIndex)},[D]),n.jsx("div",{ref:V.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:G?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[null==(c=U.transformOrigin)?void 0:c.x,null==(f=U.transformOrigin)?void 0:f.y].join(" "),...(null==(d=U.hide)?void 0:d.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:n.jsx(on,{scope:p,placedSide:q,onArrowChange:k,arrowX:J,arrowY:ee,shouldHideArrow:te,children:n.jsx(s.div,{"data-side":q,"data-align":Q,...P,ref:F,style:{...P.style,animation:G?void 0:"none"}})})})});ln.displayName=rn;var sn="PopperArrow",cn={top:"bottom",right:"left",bottom:"top",left:"right"},fn=t.forwardRef(function(e,t){const{__scopePopper:r,...o}=e,i=an(sn,r),a=cn[i.placedSide];return n.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:n.jsx(Ut,{...o,ref:t,style:{...o.style,display:"block"}})})});function un(e){return null!==e}fn.displayName=sn;var dn=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o;const{placement:i,rects:a,middlewareData:l}=t,s=0!==(null==(n=l.arrow)?void 0:n.centerOffset),c=s?0:e.arrowWidth,f=s?0:e.arrowHeight,[u,d]=pn(i),p={start:"0%",center:"50%",end:"100%"}[d],m=((null==(r=l.arrow)?void 0:r.x)??0)+c/2,h=((null==(o=l.arrow)?void 0:o.y)??0)+f/2;let g="",y="";return"bottom"===u?(g=s?p:`${m}px`,y=-f+"px"):"top"===u?(g=s?p:`${m}px`,y=`${a.floating.height+f}px`):"right"===u?(g=-f+"px",y=s?p:`${h}px`):"left"===u&&(g=`${a.floating.width+f}px`,y=s?p:`${h}px`),{data:{x:g,y:y}}}});function pn(e){const[t,n="center"]=e.split("-");return[t,n]}var mn=en,hn=nn,gn=ln,yn=fn;function vn(e,[t,n]){return Math.min(n,Math.max(t,e))}export{hn as A,gn as C,V as I,mn as R,g as S,le as T,v as U,se as a,ce as b,fe as c,Qt as d,L as e,A as f,$ as g,yn as h,y as i,vn as j,Yt as k,C as u};
|
|
13
|
+
*/function w(e){const r=x(e),o=t.forwardRef((e,o)=>{const{children:i,...a}=e,l=t.Children.toArray(i),s=l.find(R);if(s){const e=s.props.children,i=l.map(n=>n===s?t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null:n);return n.jsx(r,{...a,ref:o,children:t.isValidElement(e)?t.cloneElement(e,void 0,i):null})}return n.jsx(r,{...a,ref:o,children:i})});return o.displayName=`${e}.Slot`,o}function x(e){const n=t.forwardRef((e,n)=>{const{children:o,...i}=e;if(t.isValidElement(o)){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}(o),a=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{const t=i(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(i,o.props);return o.type!==t.Fragment&&(a.ref=n?r(n,e):e),t.cloneElement(o,a)}return t.Children.count(o)>1?t.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var b=Symbol("radix.slottable");function R(e){return t.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===b}function A(e){const t=e+"CollectionProvider",[r,l]=o(t),[s,c]=r(t,{collectionRef:{current:null},itemMap:new Map}),f=e=>{const{scope:t,children:r}=e,o=i.useRef(null),a=i.useRef(new Map).current;return n.jsx(s,{scope:t,itemMap:a,collectionRef:o,children:r})};f.displayName=t;const u=e+"CollectionSlot",d=w(u),p=i.forwardRef((e,t)=>{const{scope:r,children:o}=e,i=c(u,r),l=a(t,i.collectionRef);return n.jsx(d,{ref:l,children:o})});p.displayName=u;const m=e+"CollectionItemSlot",h="data-radix-collection-item",g=w(m),y=i.forwardRef((e,t)=>{const{scope:r,children:o,...l}=e,s=i.useRef(null),f=a(t,s),u=c(m,r);return i.useEffect(()=>(u.itemMap.set(s,{ref:s,...l}),()=>{u.itemMap.delete(s)})),n.jsx(g,{[h]:"",ref:f,children:o})});return y.displayName=m,[{Provider:f,Slot:p,ItemSlot:y},function(t){const n=c(e+"CollectionConsumer",t);return i.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${h}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])},l]}var S=t.createContext(void 0);function C(e){const n=t.useContext(S);return e||n||"ltr"}var T="rovingFocusGroup.onEntryFocus",E={bubbles:!1,cancelable:!0},P="RovingFocusGroup",[O,D,j]=A(P),[F,L]=o(P,[j]),[k,M]=F(P),I=t.forwardRef((e,t)=>n.jsx(O.Provider,{scope:e.__scopeRovingFocusGroup,children:n.jsx(O.Slot,{scope:e.__scopeRovingFocusGroup,children:n.jsx(N,{...e,ref:t})})}));I.displayName=P;var N=t.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:o,orientation:i,loop:l=!1,dir:d,currentTabStopId:p,defaultCurrentTabStopId:m,onCurrentTabStopIdChange:h,onEntryFocus:g,preventScrollOnEntryFocus:y=!1,...v}=e,w=t.useRef(null),x=a(r,w),b=C(d),[R,A]=f({prop:p,defaultProp:m??null,onChange:h,caller:P}),[S,O]=t.useState(!1),j=u(g),F=D(o),L=t.useRef(!1),[M,I]=t.useState(0);return t.useEffect(()=>{const e=w.current;if(e)return e.addEventListener(T,j),()=>e.removeEventListener(T,j)},[j]),n.jsx(k,{scope:o,orientation:i,dir:b,loop:l,currentTabStopId:R,onItemFocus:t.useCallback(e=>A(e),[A]),onItemShiftTab:t.useCallback(()=>O(!0),[]),onFocusableItemAdd:t.useCallback(()=>I(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>I(e=>e-1),[]),children:n.jsx(s.div,{tabIndex:S||0===M?-1:0,"data-orientation":i,...v,ref:x,style:{outline:"none",...e.style},onMouseDown:c(e.onMouseDown,()=>{L.current=!0}),onFocus:c(e.onFocus,e=>{const t=!L.current;if(e.target===e.currentTarget&&t&&!S){const t=new CustomEvent(T,E);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=F().filter(e=>e.focusable);z([e.find(e=>e.active),e.find(e=>e.id===R),...e].filter(Boolean).map(e=>e.ref.current),y)}}L.current=!1}),onBlur:c(e.onBlur,()=>O(!1))})})}),_="RovingFocusGroupItem",H=t.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:o,focusable:i=!0,active:a=!1,tabStopId:f,children:u,...d}=e,p=l(),m=f||p,h=M(_,o),g=h.currentTabStopId===m,y=D(o),{onFocusableItemAdd:v,onFocusableItemRemove:w,currentTabStopId:x}=h;return t.useEffect(()=>{if(i)return v(),()=>w()},[i,v,w]),n.jsx(O.ItemSlot,{scope:o,id:m,focusable:i,active:a,children:n.jsx(s.span,{tabIndex:g?0:-1,"data-orientation":h.orientation,...d,ref:r,onMouseDown:c(e.onMouseDown,e=>{i?h.onItemFocus(m):e.preventDefault()}),onFocus:c(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:c(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void h.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:W[r]}(e,h.orientation,h.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let o=y().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 i=o.indexOf(e.currentTarget);o=h.loop?(r=i+1,(n=o).map((e,t)=>n[(r+t)%n.length])):o.slice(i+1)}setTimeout(()=>z(o))}var n,r}),children:"function"==typeof u?u({isCurrentTabStop:g,hasTabStop:null!=x}):u})})});H.displayName=_;var W={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function z(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 $=I,V=H,B="Tabs",[K]=o(B,[L]),Y=L(),[G,U]=K(B),X=t.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,onValueChange:i,defaultValue:a,orientation:c="horizontal",dir:u,activationMode:d="automatic",...p}=e,m=C(u),[h,g]=f({prop:o,onChange:i,defaultProp:a??"",caller:B});return n.jsx(G,{scope:r,baseId:l(),value:h,onValueChange:g,orientation:c,dir:m,activationMode:d,children:n.jsx(s.div,{dir:m,"data-orientation":c,...p,ref:t})})});X.displayName=B;var q="TabsList",J=t.forwardRef((e,t)=>{const{__scopeTabs:r,loop:o=!0,...i}=e,a=U(q,r),l=Y(r);return n.jsx($,{asChild:!0,...l,orientation:a.orientation,dir:a.dir,loop:o,children:n.jsx(s.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:t})})});J.displayName=q;var Z="TabsTrigger",Q=t.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,disabled:i=!1,...a}=e,l=U(Z,r),f=Y(r),u=ne(l.baseId,o),d=re(l.baseId,o),p=o===l.value;return n.jsx(V,{asChild:!0,...f,focusable:!i,active:p,children:n.jsx(s.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":d,"data-state":p?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:u,...a,ref:t,onMouseDown:c(e.onMouseDown,e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():l.onValueChange(o)}),onKeyDown:c(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&l.onValueChange(o)}),onFocus:c(e.onFocus,()=>{const e="manual"!==l.activationMode;p||i||!e||l.onValueChange(o)})})})});Q.displayName=Z;var ee="TabsContent",te=t.forwardRef((e,r)=>{const{__scopeTabs:o,value:i,forceMount:a,children:l,...c}=e,f=U(ee,o),u=ne(f.baseId,i),p=re(f.baseId,i),m=i===f.value,h=t.useRef(m);return t.useEffect(()=>{const e=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(e)},[]),n.jsx(d,{present:a||m,children:({present:t})=>n.jsx(s.div,{"data-state":m?"active":"inactive","data-orientation":f.orientation,role:"tabpanel","aria-labelledby":u,hidden:!t,id:p,tabIndex:0,...c,ref:r,style:{...e.style,animationDuration:h.current?"0s":void 0},children:t&&l})})});function ne(e,t){return`${e}-trigger-${t}`}function re(e,t){return`${e}-content-${t}`}te.displayName=ee;var oe=J,ie=Q,ae=te;const le=X,se=t.forwardRef(({className:e,...t},r)=>n.jsx(oe,{ref:r,className:p("flex rounded-md bg-muted p-1 text-muted-foreground data-[orientation=horizontal]:h-10 data-[orientation=horizontal]:items-center data-[orientation=horizontal]:justify-center data-[orientation=horizontal]:inline-flex data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-center data-[orientation=vertical]:justify-start",e),...t}));se.displayName=oe.displayName;const ce=t.forwardRef(({className:e,...t},r)=>n.jsx(ie,{ref:r,className:p("inline-flex items-center justify-center whitespace-nowrap rounded-sm 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 data-[orientation=horizontal]:px-3 data-[orientation=horizontal]:py-1.5",e),...t}));ce.displayName=ie.displayName;const fe=t.forwardRef(({className:e,...t},r)=>n.jsx(ae,{ref:r,className:p("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));fe.displayName=ae.displayName;const ue=["top","right","bottom","left"],de=Math.min,pe=Math.max,me=Math.round,he=Math.floor,ge=e=>({x:e,y:e}),ye={left:"right",right:"left",bottom:"top",top:"bottom"};function ve(e,t,n){return pe(e,de(t,n))}function we(e,t){return"function"==typeof e?e(t):e}function xe(e){return e.split("-")[0]}function be(e){return e.split("-")[1]}function Re(e){return"x"===e?"y":"x"}function Ae(e){return"y"===e?"height":"width"}function Se(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function Ce(e){return Re(Se(e))}function Te(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ee=["left","right"],Pe=["right","left"],Oe=["top","bottom"],De=["bottom","top"];function je(e,t,n,r){const o=be(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Pe:Ee:t?Ee:Pe;case"left":case"right":return t?Oe:De;default:return[]}}(xe(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(Te)))),i}function Fe(e){const t=xe(e);return ye[t]+e.slice(t.length)}function Le(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 ke(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 Me(e,t,n){let{reference:r,floating:o}=e;const i=Se(t),a=Ce(t),l=Ae(a),s=xe(t),c="y"===i,f=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,d=r[l]/2-o[l]/2;let p;switch(s){case"top":p={x:f,y:r.y-o.height};break;case"bottom":p={x:f,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(be(t)){case"start":p[a]-=d*(n&&c?-1:1);break;case"end":p[a]+=d*(n&&c?-1:1)}return p}async function Ie(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:d=!1,padding:p=0}=we(t,e),m=Le(p),h=l[d?"floating"===u?"reference":"floating":u],g=ke(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:f,strategy:s})),y="floating"===u?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,v=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),w=await(null==i.isElement?void 0:i.isElement(v))&&await(null==i.getScale?void 0:i.getScale(v))||{x:1,y:1},x=ke(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:v,strategy:s}):y);return{top:(g.top-x.top+m.top)/w.y,bottom:(x.bottom-g.bottom+m.bottom)/w.y,left:(g.left-x.left+m.left)/w.x,right:(x.right-g.right+m.right)/w.x}}function Ne(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function _e(e){return ue.some(t=>e[t]>=0)}const He=new Set(["left","top"]);function We(){return"undefined"!=typeof window}function ze(e){return Be(e)?(e.nodeName||"").toLowerCase():"#document"}function $e(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ve(e){var t;return null==(t=(Be(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Be(e){return!!We()&&(e instanceof Node||e instanceof $e(e).Node)}function Ke(e){return!!We()&&(e instanceof Element||e instanceof $e(e).Element)}function Ye(e){return!!We()&&(e instanceof HTMLElement||e instanceof $e(e).HTMLElement)}function Ge(e){return!(!We()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof $e(e).ShadowRoot)}function Ue(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ot(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==o&&"contents"!==o}function Xe(e){return/^(table|td|th)$/.test(ze(e))}function qe(e){try{if(e.matches(":popover-open"))return!0}catch(t){}try{return e.matches(":modal")}catch(t){return!1}}const Je=/transform|translate|scale|rotate|perspective|filter/,Ze=/paint|layout|strict|content/,Qe=e=>!!e&&"none"!==e;let et;function tt(e){const t=Ke(e)?ot(e):e;return Qe(t.transform)||Qe(t.translate)||Qe(t.scale)||Qe(t.rotate)||Qe(t.perspective)||!nt()&&(Qe(t.backdropFilter)||Qe(t.filter))||Je.test(t.willChange||"")||Ze.test(t.contain||"")}function nt(){return null==et&&(et="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),et}function rt(e){return/^(html|body|#document)$/.test(ze(e))}function ot(e){return $e(e).getComputedStyle(e)}function it(e){return Ke(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function at(e){if("html"===ze(e))return e;const t=e.assignedSlot||e.parentNode||Ge(e)&&e.host||Ve(e);return Ge(t)?t.host:t}function lt(e){const t=at(e);return rt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ye(t)&&Ue(t)?t:lt(t)}function st(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=lt(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=$e(o);if(i){const e=ct(a);return t.concat(a,a.visualViewport||[],Ue(o)?o:[],e&&n?st(e):[])}return t.concat(o,st(o,[],n))}function ct(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ft(e){const t=ot(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ye(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=me(n)!==i||me(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function ut(e){return Ke(e)?e:e.contextElement}function dt(e){const t=ut(e);if(!Ye(t))return ge(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ft(t);let a=(i?me(n.width):n.width)/r,l=(i?me(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),l&&Number.isFinite(l)||(l=1),{x:a,y:l}}const pt=ge(0);function mt(e){const t=$e(e);return nt()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:pt}function ht(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=ut(e);let a=ge(1);t&&(r?Ke(r)&&(a=dt(r)):a=dt(e));const l=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==$e(e))&&t}(i,n,r)?mt(i):ge(0);let s=(o.left+l.x)/a.x,c=(o.top+l.y)/a.y,f=o.width/a.x,u=o.height/a.y;if(i){const e=$e(i),t=r&&Ke(r)?$e(r):r;let n=e,o=ct(n);for(;o&&r&&t!==n;){const e=dt(o),t=o.getBoundingClientRect(),r=ot(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,c*=e.y,f*=e.x,u*=e.y,s+=i,c+=a,n=$e(o),o=ct(n)}}return ke({width:f,height:u,x:s,y:c})}function gt(e,t){const n=it(e).scrollLeft;return t?t.left+n:ht(Ve(e)).left+n}function yt(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-gt(e,n),y:n.top+t.scrollTop}}function vt(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=$e(e),r=Ve(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,s=0;if(o){i=o.width,a=o.height;const e=nt();(!e||e&&"fixed"===t)&&(l=o.offsetLeft,s=o.offsetTop)}const c=gt(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&&(i-=a)}else c<=25&&(i+=c);return{width:i,height:a,x:l,y:s}}(e,n);else if("document"===t)r=function(e){const t=Ve(e),n=it(e),r=e.ownerDocument.body,o=pe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=pe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+gt(e);const l=-n.scrollTop;return"rtl"===ot(r).direction&&(a+=pe(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}(Ve(e));else if(Ke(t))r=function(e,t){const n=ht(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ye(e)?dt(e):ge(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=mt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ke(r)}function wt(e,t){const n=at(e);return!(n===t||!Ke(n)||rt(n))&&("fixed"===ot(n).position||wt(n,t))}function xt(e,t,n){const r=Ye(t),o=Ve(t),i="fixed"===n,a=ht(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const s=ge(0);function c(){s.x=gt(o)}if(r||!r&&!i)if(("body"!==ze(t)||Ue(o))&&(l=it(t)),r){const e=ht(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&c();i&&!r&&o&&c();const f=!o||r||i?ge(0):yt(o,l);return{x:a.left+l.scrollLeft-s.x-f.x,y:a.top+l.scrollTop-s.y-f.y,width:a.width,height:a.height}}function bt(e){return"static"===ot(e).position}function Rt(e,t){if(!Ye(e)||"fixed"===ot(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Ve(e)===n&&(n=n.ownerDocument.body),n}function At(e,t){const n=$e(e);if(qe(e))return n;if(!Ye(e)){let t=at(e);for(;t&&!rt(t);){if(Ke(t)&&!bt(t))return t;t=at(t)}return n}let r=Rt(e,t);for(;r&&Xe(r)&&bt(r);)r=Rt(r,t);return r&&rt(r)&&bt(r)&&!tt(r)?n:r||function(e){let t=at(e);for(;Ye(t)&&!rt(t);){if(tt(t))return t;if(qe(t))return null;t=at(t)}return null}(e)||n}const St={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Ve(r),l=!!t&&qe(t.floating);if(r===a||l&&i)return n;let s={scrollLeft:0,scrollTop:0},c=ge(1);const f=ge(0),u=Ye(r);if((u||!u&&!i)&&(("body"!==ze(r)||Ue(a))&&(s=it(r)),u)){const e=ht(r);c=dt(r),f.x=e.x+r.clientLeft,f.y=e.y+r.clientTop}const d=!a||u||i?ge(0):yt(a,s);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-s.scrollLeft*c.x+f.x+d.x,y:n.y*c.y-s.scrollTop*c.y+f.y+d.y}},getDocumentElement:Ve,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?qe(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=st(e,[],!1).filter(e=>Ke(e)&&"body"!==ze(e)),o=null;const i="fixed"===ot(e).position;let a=i?at(e):e;for(;Ke(a)&&!rt(a);){const t=ot(a),n=tt(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&("absolute"===o.position||"fixed"===o.position)||Ue(a)&&!n&&wt(e,a))?r=r.filter(e=>e!==a):o=t,a=at(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=vt(t,i[0],o);let l=a.top,s=a.right,c=a.bottom,f=a.left;for(let u=1;u<i.length;u++){const e=vt(t,i[u],o);l=pe(e.top,l),s=de(e.right,s),c=de(e.bottom,c),f=pe(e.left,f)}return{width:s-f,height:c-l,x:f,y:l}},getOffsetParent:At,getElementRects:async function(e){const t=this.getOffsetParent||At,n=this.getDimensions,r=await n(e.floating);return{reference:xt(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}=ft(e);return{width:t,height:n}},getScale:dt,isElement:Ke,isRTL:function(e){return"rtl"===ot(e).direction}};function Ct(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Tt(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,c=ut(e),f=o||i?[...c?st(c):[],...t?st(t):[]]:[];f.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)});const u=c&&l?function(e,t){let n,r=null;const o=Ve(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(l,s){void 0===l&&(l=!1),void 0===s&&(s=1),i();const c=e.getBoundingClientRect(),{left:f,top:u,width:d,height:p}=c;if(l||t(),!d||!p)return;const m={rootMargin:-he(u)+"px "+-he(o.clientWidth-(f+d))+"px "+-he(o.clientHeight-(u+p))+"px "+-he(f)+"px",threshold:pe(0,de(1,s))||1};let h=!0;function g(t){const r=t[0].intersectionRatio;if(r!==s){if(!h)return a();r?a(!1,r):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==r||Ct(c,e.getBoundingClientRect())||a(),h=!1}try{r=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch(y){r=new IntersectionObserver(g,m)}r.observe(e)}(!0),i}(c,n):null;let d,p=-1,m=null;a&&(m=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),n()}),c&&!s&&m.observe(c),t&&m.observe(t));let h=s?ht(e):null;return s&&function t(){const r=ht(e);h&&!Ct(h,r)&&n();h=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach(e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==u||u(),null==(e=m)||e.disconnect(),m=null,s&&cancelAnimationFrame(d)}}const Et=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:l}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=xe(n),l=be(n),s="y"===Se(n),c=He.has(a)?-1:1,f=i&&s?-1:1,u=we(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&"number"==typeof m&&(p="end"===l?-1*m:m),s?{x:p*f,y:d*c}:{x:d*c,y:p*f}}(t,e);return a===(null==(n=l.offset)?void 0:n.placement)&&null!=(r=l.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:a}}}}},Pt=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=we(e,t),f={x:n,y:r},u=await i.detectOverflow(t,c),d=Se(xe(o)),p=Re(d);let m=f[p],h=f[d];if(a){const e="y"===p?"bottom":"right";m=ve(m+u["y"===p?"top":"left"],m,m-u[e])}if(l){const e="y"===d?"bottom":"right";h=ve(h+u["y"===d?"top":"left"],h,h-u[e])}const g=s.fn({...t,[p]:m,[d]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:a,[d]:l}}}}}},Ot=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:s,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=we(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=xe(o),v=Se(l),w=xe(l)===l,x=await(null==s.isRTL?void 0:s.isRTL(c.floating)),b=d||(w||!h?[Fe(l)]:function(e){const t=Fe(e);return[Te(e),t,Te(t)]}(l)),R="none"!==m;!d&&R&&b.push(...je(l,h,m,x));const A=[l,...b],S=await s.detectOverflow(t,g),C=[];let T=(null==(r=i.flip)?void 0:r.overflows)||[];if(f&&C.push(S[y]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=be(e),o=Ce(e),i=Ae(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Fe(a)),[a,Fe(a)]}(o,a,x);C.push(S[e[0]],S[e[1]])}if(T=[...T,{placement:o,overflows:C}],!C.every(e=>e<=0)){var E,P;const e=((null==(E=i.flip)?void 0:E.index)||0)+1,t=A[e];if(t){if(!("alignment"===u&&v!==Se(t))||T.every(e=>Se(e.placement)!==v||e.overflows[0]>0))return{data:{index:e,overflows:T},reset:{placement:t}}}let n=null==(P=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:P.placement;if(!n)switch(p){case"bestFit":{var O;const e=null==(O=T.filter(e=>{if(R){const t=Se(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:O[0];e&&(n=e);break}case"initialPlacement":n=l}if(o!==n)return{reset:{placement:n}}}return{}}}},Dt=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:a,elements:l}=t,{apply:s=()=>{},...c}=we(e,t),f=await a.detectOverflow(t,c),u=xe(o),d=be(o),p="y"===Se(o),{width:m,height:h}=i.floating;let g,y;"top"===u||"bottom"===u?(g=u,y=d===(await(null==a.isRTL?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(y=u,g="end"===d?"top":"bottom");const v=h-f.top-f.bottom,w=m-f.left-f.right,x=de(h-f[g],v),b=de(m-f[y],w),R=!t.middlewareData.shift;let A=x,S=b;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(S=w),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(A=v),R&&!d){const e=pe(f.left,0),t=pe(f.right,0),n=pe(f.top,0),r=pe(f.bottom,0);p?S=m-2*(0!==e||0!==t?e+t:pe(f.left,f.right)):A=h-2*(0!==n||0!==r?n+r:pe(f.top,f.bottom))}await s({...t,availableWidth:S,availableHeight:A});const C=await a.getDimensions(l.floating);return m!==C.width||h!==C.height?{reset:{rects:!0}}:{}}}},jt=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=we(e,t);switch(o){case"referenceHidden":{const e=Ne(await r.detectOverflow(t,{...i,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:_e(e)}}}case"escaped":{const e=Ne(await r.detectOverflow(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:_e(e)}}}default:return{}}}}},Ft=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:l,middlewareData:s}=t,{element:c,padding:f=0}=we(e,t)||{};if(null==c)return{};const u=Le(f),d={x:n,y:r},p=Ce(o),m=Ae(p),h=await a.getDimensions(c),g="y"===p,y=g?"top":"left",v=g?"bottom":"right",w=g?"clientHeight":"clientWidth",x=i.reference[m]+i.reference[p]-d[p]-i.floating[m],b=d[p]-i.reference[p],R=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let A=R?R[w]:0;A&&await(null==a.isElement?void 0:a.isElement(R))||(A=l.floating[w]||i.floating[m]);const S=x/2-b/2,C=A/2-h[m]/2-1,T=de(u[y],C),E=de(u[v],C),P=T,O=A-h[m]-E,D=A/2-h[m]/2+S,j=ve(P,D,O),F=!s.arrow&&null!=be(o)&&D!==j&&i.reference[m]/2-(D<P?T:E)-h[m]/2<0,L=F?D<P?D-P:D-O:0;return{[p]:d[p]+L,data:{[p]:j,centerOffset:D-j-L,...F&&{alignmentOffset:L}},reset:F}}}),Lt=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:a}=t,{offset:l=0,mainAxis:s=!0,crossAxis:c=!0}=we(e,t),f={x:n,y:r},u=Se(o),d=Re(u);let p=f[d],m=f[u];const h=we(l,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(s){const e="y"===d?"height":"width",t=i.reference[d]-i.floating[e]+g.mainAxis,n=i.reference[d]+i.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(c){var y,v;const e="y"===d?"width":"height",t=He.has(xe(o)),n=i.reference[u]-i.floating[e]+(t&&(null==(y=a.offset)?void 0:y[u])||0)+(t?0:g.crossAxis),r=i.reference[u]+i.reference[e]+(t?0:(null==(v=a.offset)?void 0:v[u])||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[d]:p,[u]:m}}}},kt=(e,t,n)=>{const r=new Map,o={platform:St,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:Ie},s=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:u}=Me(c,r,s),d=r,p=0;const m={};for(let h=0;h<i.length;h++){const n=i[h];if(!n)continue;const{name:g,fn:y}=n,{x:v,y:w,data:x,reset:b}=await y({x:f,y:u,initialPlacement:r,placement:d,strategy:o,middlewareData:m,rects:c,platform:l,elements:{reference:e,floating:t}});f=null!=v?v:f,u=null!=w?w:u,m[g]={...m[g],...x},b&&p<50&&(p++,"object"==typeof b&&(b.placement&&(d=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:f,y:u}=Me(c,d,s))),h=-1)}return{x:f,y:u,placement:d,strategy:o,middlewareData:m}})(e,t,{...o,platform:i})};var Mt="undefined"!=typeof document?t.useLayoutEffect:function(){};function It(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(!It(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)&&!It(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Nt(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _t(e,t){const n=Nt(e);return Math.round(t*n)/n}function Ht(e){const n=t.useRef(e);return Mt(()=>{n.current=e}),n}const Wt=(e,t)=>{const n=Et(e);return{name:n.name,fn:n.fn,options:[e,t]}},zt=(e,t)=>{const n=Pt(e);return{name:n.name,fn:n.fn,options:[e,t]}},$t=(e,t)=>{const n=Ot(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vt=(e,t)=>{const n=Dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bt=(e,t)=>{const n=jt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kt=(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?Ft({element:n.current,padding:r}).fn(t):{}:n?Ft({element:n,padding:r}).fn(t):{};var o}}))(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Yt=t.forwardRef((e,t)=>{const{children:r,width:o=10,height:i=5,...a}=e;return n.jsx(s.svg,{...a,ref:t,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:n.jsx("polygon",{points:"0,0 30,0 15,10"})})});Yt.displayName="Arrow";var Gt=Yt;function Ut(e){const[n,r]=t.useState(void 0);return h(()=>{if(e){r({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 o,i;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,i=t.blockSize}else o=e.offsetWidth,i=e.offsetHeight;r({width:o,height:i})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),n}var Xt="Popper",[qt,Jt]=o(Xt),[Zt,Qt]=qt(Xt),en=e=>{const{__scopePopper:r,children:o}=e,[i,a]=t.useState(null);return n.jsx(Zt,{scope:r,anchor:i,onAnchorChange:a,children:o})};en.displayName=Xt;var tn="PopperAnchor",nn=t.forwardRef((e,r)=>{const{__scopePopper:o,virtualRef:i,...l}=e,c=Qt(tn,o),f=t.useRef(null),u=a(r,f),d=t.useRef(null);return t.useEffect(()=>{const e=d.current;d.current=(null==i?void 0:i.current)||f.current,e!==d.current&&c.onAnchorChange(d.current)}),i?null:n.jsx(s.div,{...l,ref:u})});nn.displayName=tn;var rn="PopperContent",[on,an]=qt(rn),ln=t.forwardRef((e,r)=>{var o,i,l,c,f,d;const{__scopePopper:p,side:g="bottom",sideOffset:y=0,align:v="center",alignOffset:w=0,arrowPadding:x=0,avoidCollisions:b=!0,collisionBoundary:R=[],collisionPadding:A=0,sticky:S="partial",hideWhenDetached:C=!1,updatePositionStrategy:T="optimized",onPlaced:E,...P}=e,O=Qt(rn,p),[D,j]=t.useState(null),F=a(r,e=>j(e)),[L,k]=t.useState(null),M=Ut(L),I=(null==M?void 0:M.width)??0,N=(null==M?void 0:M.height)??0,_=g+("center"!==v?"-"+v:""),H="number"==typeof A?A:{top:0,right:0,bottom:0,left:0,...A},W=Array.isArray(R)?R:[R],z=W.length>0,$={padding:H,boundary:W.filter(un),altBoundary:z},{refs:V,floatingStyles:B,placement:K,isPositioned:Y,middlewareData:G}=function(e){void 0===e&&(e={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:a,floating:l}={},transform:s=!0,whileElementsMounted:c,open:f}=e,[u,d]=t.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[p,h]=t.useState(o);It(p,o)||h(o);const[g,y]=t.useState(null),[v,w]=t.useState(null),x=t.useCallback(e=>{e!==S.current&&(S.current=e,y(e))},[]),b=t.useCallback(e=>{e!==C.current&&(C.current=e,w(e))},[]),R=a||g,A=l||v,S=t.useRef(null),C=t.useRef(null),T=t.useRef(u),E=null!=c,P=Ht(c),O=Ht(i),D=Ht(f),j=t.useCallback(()=>{if(!S.current||!C.current)return;const e={placement:n,strategy:r,middleware:p};O.current&&(e.platform=O.current),kt(S.current,C.current,e).then(e=>{const t={...e,isPositioned:!1!==D.current};F.current&&!It(T.current,t)&&(T.current=t,m.flushSync(()=>{d(t)}))})},[p,n,r,O,D]);Mt(()=>{!1===f&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[f]);const F=t.useRef(!1);Mt(()=>(F.current=!0,()=>{F.current=!1}),[]),Mt(()=>{if(R&&(S.current=R),A&&(C.current=A),R&&A){if(P.current)return P.current(R,A,j);j()}},[R,A,j,P,E]);const L=t.useMemo(()=>({reference:S,floating:C,setReference:x,setFloating:b}),[x,b]),k=t.useMemo(()=>({reference:R,floating:A}),[R,A]),M=t.useMemo(()=>{const e={position:r,left:0,top:0};if(!k.floating)return e;const t=_t(k.floating,u.x),n=_t(k.floating,u.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...Nt(k.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,s,k.floating,u.x,u.y]);return t.useMemo(()=>({...u,update:j,refs:L,elements:k,floatingStyles:M}),[u,j,L,k,M])}({strategy:"fixed",placement:_,whileElementsMounted:(...e)=>Tt(...e,{animationFrame:"always"===T}),elements:{reference:O.anchor},middleware:[Wt({mainAxis:y+N,alignmentAxis:w}),b&&zt({mainAxis:!0,crossAxis:!1,limiter:"partial"===S?{fn:Lt(U).fn,options:[U,X]}:void 0,...$}),b&&$t({...$}),Vt({...$,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:i}=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",`${i}px`)}}),L&&Kt({element:L,padding:x}),dn({arrowWidth:I,arrowHeight:N}),C&&Bt({strategy:"referenceHidden",...$})]});var U,X;const[q,J]=pn(K),Z=u(E);h(()=>{Y&&(null==Z||Z())},[Y,Z]);const Q=null==(o=G.arrow)?void 0:o.x,ee=null==(i=G.arrow)?void 0:i.y,te=0!==(null==(l=G.arrow)?void 0:l.centerOffset),[ne,re]=t.useState();return h(()=>{D&&re(window.getComputedStyle(D).zIndex)},[D]),n.jsx("div",{ref:V.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:Y?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[null==(c=G.transformOrigin)?void 0:c.x,null==(f=G.transformOrigin)?void 0:f.y].join(" "),...(null==(d=G.hide)?void 0:d.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:n.jsx(on,{scope:p,placedSide:q,onArrowChange:k,arrowX:Q,arrowY:ee,shouldHideArrow:te,children:n.jsx(s.div,{"data-side":q,"data-align":J,...P,ref:F,style:{...P.style,animation:Y?void 0:"none"}})})})});ln.displayName=rn;var sn="PopperArrow",cn={top:"bottom",right:"left",bottom:"top",left:"right"},fn=t.forwardRef(function(e,t){const{__scopePopper:r,...o}=e,i=an(sn,r),a=cn[i.placedSide];return n.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:n.jsx(Gt,{...o,ref:t,style:{...o.style,display:"block"}})})});function un(e){return null!==e}fn.displayName=sn;var dn=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o;const{placement:i,rects:a,middlewareData:l}=t,s=0!==(null==(n=l.arrow)?void 0:n.centerOffset),c=s?0:e.arrowWidth,f=s?0:e.arrowHeight,[u,d]=pn(i),p={start:"0%",center:"50%",end:"100%"}[d],m=((null==(r=l.arrow)?void 0:r.x)??0)+c/2,h=((null==(o=l.arrow)?void 0:o.y)??0)+f/2;let g="",y="";return"bottom"===u?(g=s?p:`${m}px`,y=-f+"px"):"top"===u?(g=s?p:`${m}px`,y=`${a.floating.height+f}px`):"right"===u?(g=-f+"px",y=s?p:`${h}px`):"left"===u&&(g=`${a.floating.width+f}px`,y=s?p:`${h}px`),{data:{x:g,y:y}}}});function pn(e){const[t,n="center"]=e.split("-");return[t,n]}var mn=en,hn=nn,gn=ln,yn=fn;function vn(e,[t,n]){return Math.min(n,Math.max(t,e))}export{hn as A,gn as C,V as I,mn as R,g as S,le as T,v as U,se as a,ce as b,fe as c,Jt as d,L as e,A as f,$ as g,yn as h,y as i,vn as j,Ut as k,C as u};
|