@tom2012/cc-web 2026.4.23-a → 2026.4.23-c
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/chat-backup.d.ts +55 -0
- package/backend/dist/chat-backup.d.ts.map +1 -0
- package/backend/dist/chat-backup.js +310 -0
- package/backend/dist/chat-backup.js.map +1 -0
- package/backend/dist/config.d.ts +6 -0
- package/backend/dist/config.d.ts.map +1 -1
- package/backend/dist/config.js.map +1 -1
- 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/routes/projects.d.ts.map +1 -1
- package/backend/dist/routes/projects.js +48 -0
- package/backend/dist/routes/projects.js.map +1 -1
- package/backend/dist/routes/shortcuts.d.ts.map +1 -1
- package/backend/dist/routes/shortcuts.js +39 -1
- package/backend/dist/routes/shortcuts.js.map +1 -1
- package/frontend/dist/assets/{AssistantMessageContent-D2JNDs8w.js → AssistantMessageContent-cP-0LxRO.js} +1 -1
- package/frontend/dist/assets/{GraphPreview-DpuJEzth.js → GraphPreview-D6i8vX9i.js} +2 -2
- package/frontend/dist/assets/{MobilePage-B792gp0X.js → MobilePage-IaKJYE03.js} +4 -4
- package/frontend/dist/assets/{OfficePreview-C8HL3vEN.js → OfficePreview-DkiZ0JHh.js} +2 -2
- package/frontend/dist/assets/{ProjectPage-DlWKUSU3.js → ProjectPage-CivnMYVE.js} +5 -5
- package/frontend/dist/assets/{SettingsPage-TaS0tYXB.js → SettingsPage-qYa0MYJY.js} +2 -2
- package/frontend/dist/assets/{SkillHubPage-GoI2aP2e.js → SkillHubPage-BMihbyFa.js} +3 -3
- package/frontend/dist/assets/{chevron-down-URrZnLx2.js → chevron-down-CVKfuHrn.js} +1 -1
- package/frontend/dist/assets/{chevron-up-Ccf_C2EF.js → chevron-up-C14W82rg.js} +1 -1
- package/frontend/dist/assets/index-BJZhjpAL.js +1 -0
- package/frontend/dist/assets/{index-90r7D6Jk.css → index-C331kTug.css} +1 -1
- package/frontend/dist/assets/{index-DlOcfeB3.js → index-CucIiRNA.js} +9 -9
- package/frontend/dist/assets/{index-n3xnBH7Z.js → index-D-8P6J0f.js} +1 -1
- package/frontend/dist/assets/{jszip.min-C0v_rPX3.js → jszip.min-DTLClhqa.js} +1 -1
- package/frontend/dist/assets/{search-BDg9Ra4d.js → search-DliqHq7A.js} +1 -1
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/index-DM6GEXje.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,r as s
|
|
1
|
+
import{c as e,r as s,$ as t,b2 as n,j as a,a1 as r,a0 as l,W as o,d as i,U as c,b3 as d,aR as u,Z as h,b4 as m,V as p,a2 as x,a4 as f,a5 as g,a6 as v,a7 as j,x as b,aF as y,b5 as w,t as N,al as k,I as S,B as C,aK as _,X as R,D as P,b6 as E,b7 as I,b8 as T,b9 as M,u as D,ba as A,T as H,bb as O,bc as L,bd as V,be as F,bf as B,aE as z,bg as W,bh as $,h as K,S as U,bi as q,aG as G,K as Z,s as X,bj as Q}from"./index-CucIiRNA.js";import{k as Y,u as J,R as ee,d as se,f as te,A as ne,C as ae,j as re,h as le,S as oe,U as ie,i as ce,T as de,a as ue,b as he,c as me}from"./index-BJZhjpAL.js";import{C as pe}from"./chevron-down-CVKfuHrn.js";import{C as xe,a as fe}from"./chevron-up-C14W82rg.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license lucide-react v0.309.0 - ISC
|
|
4
4
|
*
|
|
@@ -10,4 +10,4 @@ import{c as e,r as s,W as t,a_ as n,j as a,Z as r,Y as l,Q as o,d as i,N as c,a$
|
|
|
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 Se(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 Ce="Switch",[_e]=o(Ce),[Re,Pe]=_e(Ce),Ee=s.forwardRef((e,o)=>{const{__scopeSwitch:i,name:c,checked:d,defaultChecked:u,required:h,disabled:m,value:p="on",onCheckedChange:x,form:f,...g}=e,[v,j]=s.useState(null),b=t(o,e=>j(e)),y=s.useRef(!1),w=!v||(f||!!v.closest("form")),[N,k]=n({prop:d,defaultProp:u??!1,onChange:x,caller:Ce});return a.jsxs(Re,{scope:i,checked:N,disabled:m,children:[a.jsx(r.button,{type:"button",role:"switch","aria-checked":N,"aria-required":h,"data-state":De(N),"data-disabled":m?"":void 0,disabled:m,value:p,...g,ref:b,onClick:l(e.onClick,e=>{k(e=>!e),w&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})}),w&&a.jsx(Me,{control:v,bubbles:!y.current,name:c,value:p,checked:N,required:h,disabled:m,form:f,style:{transform:"translateX(-100%)"}})]})});Ee.displayName=Ce;var Ie="SwitchThumb",Te=s.forwardRef((e,s)=>{const{__scopeSwitch:t,...n}=e,l=Pe(Ie,t);return a.jsx(r.span,{"data-state":De(l.checked),"data-disabled":l.disabled?"":void 0,...n,ref:s})});Te.displayName=Ie;var Me=s.forwardRef(({__scopeSwitch:e,control:n,checked:r,bubbles:l=!0,...o},i)=>{const c=s.useRef(null),d=t(c,i),u=Se(r),h=Y(n);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]),a.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 De(e){return e?"checked":"unchecked"}Me.displayName="SwitchBubbleInput";var Ae=Ee,Oe=Te;const He=s.forwardRef(({className:e,...s},t)=>a.jsx(Ae,{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:a.jsx(Oe,{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 Le(e){const t=Ve(e),n=s.forwardRef((e,n)=>{const{children:r,...l}=e,o=s.Children.toArray(r),i=o.find(Be);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 a.jsx(t,{...l,ref:n,children:s.isValidElement(e)?s.cloneElement(e,void 0,r):null})}return a.jsx(t,{...l,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Ve(e){const t=s.forwardRef((e,t)=>{const{children:n,...a}=e;if(s.isValidElement(n)){const e=function(e){var s,t;let n=null==(s=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:s.get,a=n&&"isReactWarning"in n&&n.isReactWarning;if(a)return e.ref;if(n=null==(t=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a)return e.props.ref;return e.props.ref||e.ref}(n),r=function(e,s){const t={...s};for(const n in s){const a=e[n],r=s[n];/^on[A-Z]/.test(n)?a&&r?t[n]=(...e)=>{const s=r(...e);return a(...e),s}:a&&(t[n]=a):"style"===n?t[n]={...a,...r}:"className"===n&&(t[n]=[a,r].filter(Boolean).join(" "))}return{...e,...t}}(a,n.props);return n.type!==s.Fragment&&(r.ref=t?c(t,e):e),s.cloneElement(n,r)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}He.displayName=Ae.displayName;var Fe=Symbol("radix.slottable");function Be(e){return s.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Fe}var ze=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)=>a.jsx(r.span,{...e,ref:s,style:{...ze,...e.style}})).displayName="VisuallyHidden";var $e=[" ","Enter","ArrowUp","ArrowDown"],We=[" ","Enter"],Ke="Select",[qe,Ue,Ge]=te(Ke),[Ze]=o(Ke,[Ge,se]),Qe=se(),[Xe,Ye]=Ze(Ke),[Je,es]=Ze(Ke),ss=e=>{const{__scopeSelect:t,children:r,open:l,defaultOpen:o,onOpenChange:i,value:c,defaultValue:u,onValueChange:h,dir:m,name:p,autoComplete:x,disabled:f,required:g,form:v}=e,j=Qe(t),[b,y]=s.useState(null),[w,N]=s.useState(null),[k,S]=s.useState(!1),C=J(m),[_,R]=n({prop:l,defaultProp:o??!1,onChange:i,caller:Ke}),[P,E]=n({prop:c,defaultProp:u,onChange:h,caller:Ke}),I=s.useRef(null),T=!b||(v||!!b.closest("form")),[M,D]=s.useState(new Set),A=Array.from(M).map(e=>e.props.value).join(";");return a.jsx(ee,{...j,children:a.jsxs(Xe,{required:g,scope:t,trigger:b,onTriggerChange:y,valueNode:w,onValueNodeChange:N,valueNodeHasChildren:k,onValueNodeHasChildrenChange:S,contentId:d(),value:P,onValueChange:E,open:_,onOpenChange:R,dir:C,triggerPointerDownPosRef:I,disabled:f,children:[a.jsx(qe.Provider,{scope:t,children:a.jsx(Je,{scope:e.__scopeSelect,onNativeOptionAdd:s.useCallback(e=>{D(s=>new Set(s).add(e))},[]),onNativeOptionRemove:s.useCallback(e=>{D(s=>{const t=new Set(s);return t.delete(e),t})},[]),children:r})}),T?a.jsxs(Bs,{"aria-hidden":!0,required:g,tabIndex:-1,name:p,autoComplete:x,value:P,onChange:e=>E(e.target.value),disabled:f,form:v,children:[void 0===P?a.jsx("option",{value:""}):null,Array.from(M)]},A):null]})})};ss.displayName=Ke;var ts="SelectTrigger",ns=s.forwardRef((e,n)=>{const{__scopeSelect:o,disabled:i=!1,...c}=e,d=Qe(o),u=Ye(ts,o),h=u.disabled||i,m=t(n,u.onTriggerChange),p=Ue(o),x=s.useRef("touch"),[f,g,v]=$s(e=>{const s=p().filter(e=>!e.disabled),t=s.find(e=>e.value===u.value),n=Ws(s,e,t);void 0!==n&&u.onValueChange(n.value)}),j=e=>{h||(u.onOpenChange(!0),v()),e&&(u.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return a.jsx(ne,{asChild:!0,...d,children:a.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":zs(u.value)?"":void 0,...c,ref:m,onClick:l(c.onClick,e=>{e.currentTarget.focus(),"mouse"!==x.current&&j(e)}),onPointerDown:l(c.onPointerDown,e=>{x.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||g(e.key),s&&" "===e.key||$e.includes(e.key)&&(j(),e.preventDefault())})})})});ns.displayName=ts;var as="SelectValue",rs=s.forwardRef((e,s)=>{const{__scopeSelect:n,className:l,style:o,children:i,placeholder:c="",...d}=e,h=Ye(as,n),{onValueNodeHasChildrenChange:m}=h,p=void 0!==i,x=t(s,h.onValueNodeChange);return u(()=>{m(p)},[m,p]),a.jsx(r.span,{...d,ref:x,style:{pointerEvents:"none"},children:zs(h.value)?a.jsx(a.Fragment,{children:c}):i})});rs.displayName=as;var ls=s.forwardRef((e,s)=>{const{__scopeSelect:t,children:n,...l}=e;return a.jsx(r.span,{"aria-hidden":!0,...l,ref:s,children:n||"▼"})});ls.displayName="SelectIcon";var os=e=>a.jsx(h,{asChild:!0,...e});os.displayName="SelectPortal";var is="SelectContent",cs=s.forwardRef((e,t)=>{const n=Ye(is,e.__scopeSelect),[r,l]=s.useState();if(u(()=>{l(new DocumentFragment)},[]),!n.open){const s=r;return s?m.createPortal(a.jsx(us,{scope:e.__scopeSelect,children:a.jsx(qe.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(ps,{...e,ref:t})});cs.displayName=is;var ds=10,[us,hs]=Ze(is),ms=Le("SelectContent.RemoveScroll"),ps=s.forwardRef((e,n)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:c,onPointerDownOutside:d,side:u,sideOffset:h,align:m,alignOffset:p,arrowPadding:b,collisionBoundary:y,collisionPadding:w,sticky:N,hideWhenDetached:k,avoidCollisions:S,...C}=e,_=Ye(is,r),[R,P]=s.useState(null),[E,I]=s.useState(null),T=t(n,e=>P(e)),[M,D]=s.useState(null),[A,O]=s.useState(null),H=Ue(r),[L,V]=s.useState(!1),F=s.useRef(!1);s.useEffect(()=>{if(R)return x(R)},[R]),f();const B=s.useCallback(e=>{const[s,...t]=H().map(e=>e.ref.current),[n]=t.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(null==r||r.scrollIntoView({block:"nearest"}),r===s&&E&&(E.scrollTop=0),r===n&&E&&(E.scrollTop=E.scrollHeight),null==r||r.focus(),document.activeElement!==a)return}},[H,E]),z=s.useCallback(()=>B([M,R]),[B,M,R]);s.useEffect(()=>{L&&z()},[L,z]);const{onOpenChange:$,triggerPointerDownPosRef:W}=_;s.useEffect(()=>{if(R){let e={x:0,y:0};const s=s=>{var t,n;e={x:Math.abs(Math.round(s.pageX)-((null==(t=W.current)?void 0:t.x)??0)),y:Math.abs(Math.round(s.pageY)-((null==(n=W.current)?void 0:n.y)??0))}},t=t=>{e.x<=10&&e.y<=10?t.preventDefault():R.contains(t.target)||$(!1),document.removeEventListener("pointermove",s),W.current=null};return null!==W.current&&(document.addEventListener("pointermove",s),document.addEventListener("pointerup",t,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",t,{capture:!0})}}},[R,$,W]),s.useEffect(()=>{const e=()=>$(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[$]);const[K,q]=$s(e=>{const s=H().filter(e=>!e.disabled),t=s.find(e=>e.ref.current===document.activeElement),n=Ws(s,e,t);n&&setTimeout(()=>n.ref.current.focus())}),U=s.useCallback((e,s,t)=>{const n=!F.current&&!t;(void 0!==_.value&&_.value===s||n)&&(D(e),n&&(F.current=!0))},[_.value]),G=s.useCallback(()=>null==R?void 0:R.focus(),[R]),Z=s.useCallback((e,s,t)=>{const n=!F.current&&!t;(void 0!==_.value&&_.value===s||n)&&O(e)},[_.value]),Q="popper"===o?fs:xs,X=Q===fs?{side:u,sideOffset:h,align:m,alignOffset:p,arrowPadding:b,collisionBoundary:y,collisionPadding:w,sticky:N,hideWhenDetached:k,avoidCollisions:S}:{};return a.jsx(us,{scope:r,content:R,viewport:E,onViewportChange:I,itemRefCallback:U,selectedItem:M,onItemLeave:G,itemTextRefCallback:Z,focusSelectedItem:z,selectedItemText:A,position:o,isPositioned:L,searchRef:K,children:a.jsx(g,{as:ms,allowPinchZoom:!0,children:a.jsx(v,{asChild:!0,trapped:_.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:l(i,e=>{var s;null==(s=_.trigger)||s.focus({preventScroll:!0}),e.preventDefault()}),children:a.jsx(j,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:a.jsx(Q,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:e=>e.preventDefault(),...C,...X,onPlaced:()=>V(!0),ref:T,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||q(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,n=s.indexOf(t);s=s.slice(n+1)}setTimeout(()=>B(s)),e.preventDefault()}})})})})})})});ps.displayName="SelectContentImpl";var xs=s.forwardRef((e,n)=>{const{__scopeSelect:l,onPlaced:o,...i}=e,c=Ye(is,l),d=hs(is,l),[h,m]=s.useState(null),[p,x]=s.useState(null),f=t(n,e=>x(e)),g=Ue(l),v=s.useRef(!1),j=s.useRef(!0),{viewport:b,selectedItem:y,selectedItemText:w,focusSelectedItem:N}=d,k=s.useCallback(()=>{if(c.trigger&&c.valueNode&&h&&p&&b&&y&&w){const e=c.trigger.getBoundingClientRect(),s=p.getBoundingClientRect(),t=c.valueNode.getBoundingClientRect(),n=w.getBoundingClientRect();if("rtl"!==c.dir){const a=n.left-s.left,r=t.left-a,l=e.left-r,o=e.width+l,i=Math.max(o,s.width),c=window.innerWidth-ds,d=re(r,[ds,Math.max(ds,c-i)]);h.style.minWidth=o+"px",h.style.left=d+"px"}else{const a=s.right-n.right,r=window.innerWidth-t.right-a,l=window.innerWidth-e.right-r,o=e.width+l,i=Math.max(o,s.width),c=window.innerWidth-ds,d=re(r,[ds,Math.max(ds,c-i)]);h.style.minWidth=o+"px",h.style.right=d+"px"}const a=g(),r=window.innerHeight-2*ds,l=b.scrollHeight,i=window.getComputedStyle(p),d=parseInt(i.borderTopWidth,10),u=parseInt(i.paddingTop,10),m=parseInt(i.borderBottomWidth,10),x=d+u+l+parseInt(i.paddingBottom,10)+m,f=Math.min(5*y.offsetHeight,x),j=window.getComputedStyle(b),N=parseInt(j.paddingTop,10),k=parseInt(j.paddingBottom,10),S=e.top+e.height/2-ds,C=r-S,_=y.offsetHeight/2,R=d+u+(y.offsetTop+_),P=x-R;if(R<=S){const e=a.length>0&&y===a[a.length-1].ref.current;h.style.bottom="0px";const s=p.clientHeight-b.offsetTop-b.offsetHeight,t=R+Math.max(C,_+(e?k:0)+s+m);h.style.height=t+"px"}else{const e=a.length>0&&y===a[0].ref.current;h.style.top="0px";const s=Math.max(S,d+b.offsetTop+(e?N:0)+_)+P;h.style.height=s+"px",b.scrollTop=R-S+b.offsetTop}h.style.margin=`${ds}px 0`,h.style.minHeight=f+"px",h.style.maxHeight=r+"px",null==o||o(),requestAnimationFrame(()=>v.current=!0)}},[g,c.trigger,c.valueNode,h,p,b,y,w,c.dir,o]);u(()=>k(),[k]);const[S,C]=s.useState();u(()=>{p&&C(window.getComputedStyle(p).zIndex)},[p]);const _=s.useCallback(e=>{e&&!0===j.current&&(k(),null==N||N(),j.current=!1)},[k,N]);return a.jsx(gs,{scope:l,contentWrapper:h,shouldExpandOnScrollRef:v,onScrollButtonChange:_,children:a.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:a.jsx(r.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});xs.displayName="SelectItemAlignedPosition";var fs=s.forwardRef((e,s)=>{const{__scopeSelect:t,align:n="start",collisionPadding:r=ds,...l}=e,o=Qe(t);return a.jsx(ae,{...o,...l,ref:s,align:n,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)"}})});fs.displayName="SelectPopperPosition";var[gs,vs]=Ze(is,{}),js="SelectViewport",bs=s.forwardRef((e,n)=>{const{__scopeSelect:o,nonce:i,...c}=e,d=hs(js,o),u=vs(js,o),h=t(n,d.onViewportChange),m=s.useRef(0);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(qe.Slot,{scope:o,children:a.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:n}=u;if((null==n?void 0:n.current)&&t){const e=Math.abs(m.current-s.scrollTop);if(e>0){const n=window.innerHeight-2*ds,a=parseFloat(t.style.minHeight),r=parseFloat(t.style.height),l=Math.max(a,r);if(l<n){const a=l+e,r=Math.min(n,a),o=a-r;t.style.height=r+"px","0px"===t.style.bottom&&(s.scrollTop=o>0?o:0,t.style.justifyContent="flex-end")}}}m.current=s.scrollTop})})})]})});bs.displayName=js;var ys="SelectGroup",[ws,Ns]=Ze(ys);s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e,l=d();return a.jsx(ws,{scope:t,id:l,children:a.jsx(r.div,{role:"group","aria-labelledby":l,...n,ref:s})})}).displayName=ys;var ks="SelectLabel",Ss=s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e,l=Ns(ks,t);return a.jsx(r.div,{id:l.id,...n,ref:s})});Ss.displayName=ks;var Cs="SelectItem",[_s,Rs]=Ze(Cs),Ps=s.forwardRef((e,n)=>{const{__scopeSelect:o,value:i,disabled:c=!1,textValue:u,...h}=e,m=Ye(Cs,o),p=hs(Cs,o),x=m.value===i,[f,g]=s.useState(u??""),[v,j]=s.useState(!1),b=t(n,e=>{var s;return null==(s=p.itemRefCallback)?void 0:s.call(p,e,i,c)}),y=d(),w=s.useRef("touch"),N=()=>{c||(m.onValueChange(i),m.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 a.jsx(_s,{scope:o,value:i,disabled:c,textId:y,isSelected:x,onItemTextChange:s.useCallback(e=>{g(s=>s||((null==e?void 0:e.textContent)??"").trim())},[]),children:a.jsx(qe.ItemSlot,{scope:o,value:i,disabled:c,textValue:f,children:a.jsx(r.div,{role:"option","aria-labelledby":y,"data-highlighted":v?"":void 0,"aria-selected":x&&v,"data-state":x?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...h,ref:b,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=p.onItemLeave)||s.call(p):"mouse"===w.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:l(h.onPointerLeave,e=>{var s;e.currentTarget===document.activeElement&&(null==(s=p.onItemLeave)||s.call(p))}),onKeyDown:l(h.onKeyDown,e=>{var s;""!==(null==(s=p.searchRef)?void 0:s.current)&&" "===e.key||(We.includes(e.key)&&N()," "===e.key&&e.preventDefault())})})})})});Ps.displayName=Cs;var Es="SelectItemText",Is=s.forwardRef((e,n)=>{const{__scopeSelect:l,className:o,style:i,...c}=e,d=Ye(Es,l),h=hs(Es,l),p=Rs(Es,l),x=es(Es,l),[f,g]=s.useState(null),v=t(n,e=>g(e),p.onItemTextChange,e=>{var s;return null==(s=h.itemTextRefCallback)?void 0:s.call(h,e,p.value,p.disabled)}),j=null==f?void 0:f.textContent,b=s.useMemo(()=>a.jsx("option",{value:p.value,disabled:p.disabled,children:j},p.value),[p.disabled,p.value,j]),{onNativeOptionAdd:y,onNativeOptionRemove:w}=x;return u(()=>(y(b),()=>w(b)),[y,w,b]),a.jsxs(a.Fragment,{children:[a.jsx(r.span,{id:p.textId,...c,ref:v}),p.isSelected&&d.valueNode&&!d.valueNodeHasChildren?m.createPortal(c.children,d.valueNode):null]})});Is.displayName=Es;var Ts="SelectItemIndicator",Ms=s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e;return Rs(Ts,t).isSelected?a.jsx(r.span,{"aria-hidden":!0,...n,ref:s}):null});Ms.displayName=Ts;var Ds="SelectScrollUpButton",As=s.forwardRef((e,n)=>{const r=hs(Ds,e.__scopeSelect),l=vs(Ds,e.__scopeSelect),[o,i]=s.useState(!1),c=t(n,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?a.jsx(Ls,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:s}=r;e&&s&&(e.scrollTop=e.scrollTop-s.offsetHeight)}}):null});As.displayName=Ds;var Os="SelectScrollDownButton",Hs=s.forwardRef((e,n)=>{const r=hs(Os,e.__scopeSelect),l=vs(Os,e.__scopeSelect),[o,i]=s.useState(!1),c=t(n,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?a.jsx(Ls,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:s}=r;e&&s&&(e.scrollTop=e.scrollTop+s.offsetHeight)}}):null});Hs.displayName=Os;var Ls=s.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...i}=e,c=hs("SelectScrollButton",n),d=s.useRef(null),h=Ue(n),m=s.useCallback(()=>{null!==d.current&&(window.clearInterval(d.current),d.current=null)},[]);return s.useEffect(()=>()=>m(),[m]),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]),a.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,()=>{m()})})}),Vs=s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e;return a.jsx(r.div,{"aria-hidden":!0,...n,ref:s})});Vs.displayName="SelectSeparator";var Fs="SelectArrow";s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e,r=Qe(t),l=Ye(Fs,t),o=hs(Fs,t);return l.open&&"popper"===o.position?a.jsx(le,{...r,...n,ref:s}):null}).displayName=Fs;var Bs=s.forwardRef(({__scopeSelect:e,value:n,...l},o)=>{const i=s.useRef(null),c=t(o,i),d=Se(n);return s.useEffect(()=>{const e=i.current;if(!e)return;const s=window.HTMLSelectElement.prototype,t=Object.getOwnPropertyDescriptor(s,"value").set;if(d!==n&&t){const s=new Event("change",{bubbles:!0});t.call(e,n),e.dispatchEvent(s)}},[d,n]),a.jsx(r.select,{...l,style:{...ze,...l.style},ref:c,defaultValue:n})});function zs(e){return""===e||void 0===e}function $s(e){const t=p(e),n=s.useRef(""),a=s.useRef(0),r=s.useCallback(e=>{const s=n.current+e;t(s),function e(s){n.current=s,window.clearTimeout(a.current),""!==s&&(a.current=window.setTimeout(()=>e(""),1e3))}(s)},[t]),l=s.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return s.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,r,l]}function Ws(e,s,t){const n=s.length>1&&Array.from(s).every(e=>e===s[0])?s[0]:s,a=t?e.indexOf(t):-1;let r=(l=e,o=Math.max(a,0),l.map((e,s)=>l[(o+s)%l.length]));var l,o;1===n.length&&(r=r.filter(e=>e!==t));const i=r.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==t?i:void 0}Bs.displayName="SelectBubbleInput";var Ks=ns,qs=ls,Us=os,Gs=cs,Zs=bs,Qs=Ss,Xs=Ps,Ys=Is,Js=Ms,et=As,st=Hs,tt=Vs;const nt=ss,at=rs,rt=s.forwardRef(({className:e,children:s,...t},n)=>a.jsxs(Ks,{ref:n,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,a.jsx(qs,{asChild:!0,children:a.jsx(pe,{className:"h-4 w-4 opacity-50"})})]}));rt.displayName=Ks.displayName;const lt=s.forwardRef(({className:e,...s},t)=>a.jsx(et,{ref:t,className:i("flex cursor-default items-center justify-center py-1",e),...s,children:a.jsx(xe,{className:"h-4 w-4"})}));lt.displayName=et.displayName;const ot=s.forwardRef(({className:e,...s},t)=>a.jsx(st,{ref:t,className:i("flex cursor-default items-center justify-center py-1",e),...s,children:a.jsx(pe,{className:"h-4 w-4"})}));ot.displayName=st.displayName;const it=s.forwardRef(({className:e,children:s,position:t="popper",...n},r)=>a.jsx(Us,{children:a.jsxs(Gs,{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,...n,children:[a.jsx(lt,{}),a.jsx(Zs,{className:i("p-1","popper"===t&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),a.jsx(ot,{})]})}));it.displayName=Gs.displayName;s.forwardRef(({className:e,...s},t)=>a.jsx(Qs,{ref:t,className:i("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...s})).displayName=Qs.displayName;const ct=s.forwardRef(({className:e,children:s,...t},n)=>a.jsxs(Xs,{ref:n,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:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Js,{children:a.jsx(b,{className:"h-4 w-4"})})}),a.jsx(Ys,{children:s})]}));ct.displayName=Xs.displayName;s.forwardRef(({className:e,...s},t)=>a.jsx(tt,{ref:t,className:i("-mx-1 my-1 h-px bg-muted",e),...s})).displayName=tt.displayName;function dt(){const[e,t]=s.useState(null),[n,r]=s.useState(!0),[l,o]=s.useState(!1),[i,c]=s.useState(!1),[d,u]=s.useState(!1),[h,m]=s.useState(!1),[p,x]=s.useState(null),[f,g]=s.useState(0),[v,j]=s.useState(""),[b,D]=s.useState("");y({onStart:e=>{x(e.projectId),g(0)},onProgress:e=>{x(e.projectId),g(e.filesTransferred)},onDone:()=>{x(null),g(0)}}),s.useEffect(()=>{let e=!1;return w().then(s=>{e||(t(s),D(s.defaultExcludes.join("\n")))}).catch(e=>N.error(`加载同步配置失败: ${e.message}`)).finally(()=>{e||r(!1)}),()=>{e=!0}},[]);const A=(e,s)=>{t(t=>t?{...t,[e]:s}:t)};return n||!e?a.jsx("div",{className:"text-sm text-muted-foreground",children:"加载中…"}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:"服务器配置"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-host",children:"主机 (host)"}),a.jsx(S,{id:"sync-host",value:e.host,onChange:e=>A("host",e.target.value),placeholder:"example.com"})]}),a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-port",children:"端口"}),a.jsx(S,{id:"sync-port",type:"number",value:e.port,onChange:e=>A("port",Number(e.target.value)||22)})]}),a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-user",children:"用户名"}),a.jsx(S,{id:"sync-user",value:e.user,onChange:e=>A("user",e.target.value),placeholder:"tom"})]}),a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-remote",children:"远端根路径"}),a.jsx(S,{id:"sync-remote",value:e.remoteRoot,onChange:e=>A("remoteRoot",e.target.value),placeholder:"/data/projects"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["每个项目会同步到 ",a.jsx("code",{children:"远端路径/项目文件夹"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:"认证"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(k,{children:"方式"}),a.jsxs(nt,{value:e.authMethod,onValueChange:e=>A("authMethod",e),children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(it,{children:[a.jsx(ct,{value:"key",children:"SSH key"}),a.jsx(ct,{value:"password",children:"密码"})]})]})]}),"key"===e.authMethod?a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-key",children:"私钥路径"}),a.jsx(S,{id:"sync-key",value:e.keyPath??"",onChange:e=>A("keyPath",e.target.value),placeholder:"~/.ssh/id_rsa"})]}):a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-pw",children:"密码"}),a.jsx(S,{id:"sync-pw",type:"password",value:v,onChange:e=>j(e.target.value),placeholder:e.passwordSet?"已设置,留空保持不变":"未设置"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["需要系统安装 ",a.jsx("code",{children:"sshpass"}),"(密码通过 SSHPASS env 传递,不会出现在 argv 里)"]})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:"同步策略"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(k,{children:"方向"}),a.jsxs(nt,{value:e.direction,onValueChange:e=>A("direction",e),children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(it,{children:[a.jsx(ct,{value:"push",children:"单向:本地 → 远端(--delete)"}),a.jsx(ct,{value:"pull",children:"单向:远端 → 本地"}),a.jsx(ct,{value:"bidirectional",children:"双向(先 push 再 pull)"})]})]})]}),a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(k,{htmlFor:"sync-cron",children:"定时 cron 表达式"}),a.jsx(S,{id:"sync-cron",value:e.schedule.cron,onChange:s=>A("schedule",{...e.schedule,cron:s.target.value}),placeholder:"0 3 * * *"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["5 段:分 时 日 月 周。例:",a.jsx("code",{children:"0 3 * * *"})," 每天 03:00"]})]}),a.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[a.jsx(He,{checked:e.schedule.enabled,onCheckedChange:s=>A("schedule",{...e.schedule,enabled:s})}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"启用"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:"默认排除(每行一个 glob)"}),a.jsx("textarea",{value:b,onChange:e=>D(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"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["作为 ",a.jsx("code",{children:"rsync --exclude"})," 传入。项目级的额外排除暂通过 API 设置。"]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2 pt-2 border-t",children:[a.jsxs(C,{onClick:()=>{(async()=>{if(e){o(!0);try{const s=b.split("\n").map(e=>e.trim()).filter(Boolean),n={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};v&&"__keep__"!==v&&(n.password=v);const a=await E(n);t(a),D(a.defaultExcludes.join("\n")),j(""),N.success("已保存")}catch(s){N.error(`保存失败: ${s.message}`)}finally{o(!1)}}})()},disabled:l,children:[l?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(oe,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]}),a.jsxs(C,{variant:"outline",onClick:()=>{(async()=>{c(!0);try{const e=await I();e.ok?N.success(e.message||"连接成功"):N.error(e.message||"连接失败")}catch(e){N.error(`测试失败: ${e.message}`)}finally{c(!1)}})()},disabled:i,children:[i?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(Ne,{className:"h-3.5 w-3.5 mr-1.5"}),"测试连接"]}),a.jsx("div",{className:"flex-1"}),d&&p&&a.jsx("span",{className:"text-xs text-muted-foreground self-center mr-1 tabular-nums",children:f>0?`同步中: ${p} (${f} 文件)`:`同步中: ${p}`}),a.jsxs(C,{variant:"outline",onClick:()=>{(async()=>{u(!0);try{const e=await T(),s=e.results.filter(e=>e.ok).length,t=e.results.filter(e=>e.skipped).length,n=e.results.filter(e=>"cancelled"===e.reason).length,a=e.total-s-t-n;n>0?N.info(`已取消:${s} 成功 / ${t} 跳过 / ${n} 取消 / ${a} 失败`):N.success(`同步完成:${s} 成功 / ${t} 跳过 / ${a} 失败`)}catch(e){N.error(`同步失败: ${e.message}`)}finally{u(!1),m(!1),x(null),g(0)}})()},disabled:d,title:"按当前方向同步所有项目",children:[d?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(ie,{className:"h-3.5 w-3.5 mr-1.5"}),"立即同步全部"]}),d&&a.jsxs(C,{variant:"outline",onClick:()=>{(async()=>{if(d&&!h){m(!0);try{await M(),N.info("已请求取消")}catch(e){N.error(`取消失败: ${e.message}`),m(!1)}}})()},disabled:h,title:"取消批量同步:SIGTERM 当前 rsync 并停止后续项目",children:[h?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(R,{className:"h-3.5 w-3.5 mr-1.5"}),"取消"]})]}),a.jsxs("div",{className:"border-t pt-4 text-xs text-muted-foreground",children:["一次性 push/pull 工具:进入项目内部,点击 header 的 ",a.jsx(ie,{className:"inline h-3 w-3"})," / ",a.jsx(P,{className:"inline h-3 w-3"})," 按钮。 或通过 API 调用 ",a.jsx("code",{children:"POST /api/sync/project/:id"})," with body ",a.jsx("code",{children:'{ "direction": "push" }'}),"。"]})]})}function ut(){const e=D(),[t,n]=s.useState(null),[r,l]=s.useState(!0),[o,i]=s.useState(""),[c,d]=s.useState(!1);s.useEffect(()=>{let e=!1;return A().then(s=>{e||n(s)}).catch(()=>{e||n({configured:!1,needsReset:!1})}).finally(()=>{e||l(!1)}),()=>{e=!0}},[]);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-1",children:"CCWeb Hub 直接提交"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:['配置你的 GitHub PAT 后,在 Quick Prompts / Agent Prompts 卡片右键选择"共享"时可一键直接提交 Issue 到 ',a.jsx("code",{children:"zbc0315/ccweb-hub"}),"。 ccweb 本身不自带 token —— 使用你自己的账号身份提交,归属清晰,互不影响。"]})]}),r?a.jsxs("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[a.jsx(_,{className:"h-4 w-4 animate-spin"}),"加载中…"]}):a.jsxs(a.Fragment,{children:[a.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)?a.jsxs(a.Fragment,{children:[a.jsx(fe,{className:"h-4 w-4 text-green-500 shrink-0"}),a.jsx("span",{children:"已配置 token,可直接提交"}),a.jsx("div",{className:"flex-1"}),a.jsxs(C,{size:"sm",variant:"outline",onClick:()=>{(async()=>{if(await e({title:"清除 Hub Token",description:"清除后将无法直接提交到 ccweb-hub,需要重新配置 token。确认?",destructive:!0,confirmLabel:"清除"}))try{await H(),n({configured:!1,needsReset:!1}),N.success("已清除")}catch(s){N.error(`清除失败: ${s.message}`)}})()},children:[a.jsx(O,{className:"h-3.5 w-3.5 mr-1"}),"清除"]})]}):(null==t?void 0:t.needsReset)?a.jsxs(a.Fragment,{children:[a.jsx(ve,{className:"h-4 w-4 text-amber-500 shrink-0"}),a.jsx("span",{children:"之前的 token 已失效(服务端密钥可能已轮换),请重新设置"})]}):a.jsxs(a.Fragment,{children:[a.jsx(ve,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a.jsx("span",{children:"尚未配置 token"})]})}),a.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2.5 text-xs space-y-2",children:[a.jsx("div",{className:"font-medium text-foreground",children:"如何获取 token"}),a.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-muted-foreground",children:[a.jsxs("li",{children:["打开"," ",a.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",a.jsx(be,{className:"h-3 w-3"})]})," ","创建页"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Repository access"}),':选 "Only select repositories",添加 ',a.jsx("code",{children:"zbc0315/ccweb-hub"})]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Repository permissions → Issues"}),':设置为 "Read and write"']}),a.jsx("li",{children:"其余权限保持默认(全部无访问)"}),a.jsx("li",{children:"生成后复制 token 粘贴到下方"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(k,{htmlFor:"hub-token",className:"text-xs",children:["GitHub Token ",(null==t?void 0:t.configured)&&a.jsx("span",{className:"text-muted-foreground",children:"(填写会覆盖现有 token)"})]}),a.jsx(S,{id:"hub-token",type:"password",placeholder:"github_pat_...",value:o,onChange:e=>i(e.target.value),autoComplete:"off",spellCheck:!1}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Token 以 AES-256-GCM 加密存储于 ",a.jsx("code",{children:"~/.ccweb/hub-auth/"}),";per-user 独立,不会被其他用户读到。"]})]}),a.jsx("div",{className:"flex gap-2 pt-2 border-t",children:a.jsxs(C,{onClick:()=>{(async()=>{const e=o.trim();if(e){d(!0);try{const s=await L(e);n(s),i(""),N.success("已保存")}catch(s){N.error(`保存失败: ${s.message}`)}finally{d(!1)}}else N.error("请输入 token")})()},disabled:c||!o.trim(),children:[c?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(oe,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})})]})]})}function ht(){const{t:e,i18n:s}=ce();return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(we,{className:"h-4 w-4 text-muted-foreground"}),a.jsxs(nt,{value:s.language,onValueChange:async t=>{if(V.includes(t)){try{localStorage.setItem(F,t)}catch{}await s.changeLanguage(t);try{await B(t)}catch{N.error(e("language.switch_failed"))}}},children:[a.jsx(rt,{className:"w-40",children:a.jsx(at,{})}),a.jsxs(it,{children:[a.jsx(ct,{value:"zh",children:e("language.zh")}),a.jsx(ct,{value:"en",children:e("language.en")})]})]})]})}function mt(){const{t:e}=ce(),t=z(),[n]=$(),r=n.get("tab")||"sync",[l,o]=s.useState(()=>W()),[i,c]=s.useState(!1),[d,u]=s.useState({webhookEnabled:!1}),[h,m]=s.useState(""),[p,x]=s.useState(!1),[f,g]=s.useState(()=>K(q.usageMonitorTool,"claude"));s.useEffect(()=>{U().then(e=>{u(e),m(e.webhookUrl??"")}).catch(()=>{})},[]);const v=(e,s)=>{const t=parseInt(s,10);isNaN(t)||t<1||(o(s=>({...s,[e]:t})),c(!0))};return a.jsx("div",{className:"min-h-screen bg-background",children:a.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[a.jsxs(C,{variant:"ghost",size:"sm",onClick:()=>t("/"),children:[a.jsx(G,{className:"h-4 w-4 mr-1"}),e("common.back")]}),a.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:e("settings.title")})]}),a.jsxs(de,{defaultValue:r,children:[a.jsxs(ue,{className:"mb-4",children:[a.jsxs(he,{value:"sync",children:[a.jsx(ke,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_sync")]}),a.jsxs(he,{value:"hub",children:[a.jsx(ye,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_hub")]}),a.jsxs(he,{value:"notifications",children:[a.jsx(je,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_notifications")]}),a.jsxs(he,{value:"pomodoro",children:[a.jsx(Z,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_pomodoro")]}),a.jsxs(he,{value:"usage",children:[a.jsx(ge,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_usage")]}),a.jsxs(he,{value:"language",children:[a.jsx(we,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_language")]})]}),a.jsx(me,{value:"sync",children:a.jsx(dt,{})}),a.jsx(me,{value:"hub",children:a.jsx(ut,{})}),a.jsx(me,{value:"notifications",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.browser_notify.title")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e("settings.browser_notify.description")})]}),a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.webhook.title")}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.webhook.description")})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(k,{className:"text-xs",children:"Webhook URL"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(S,{placeholder:"https://hooks.slack.com/...",value:h,onChange:e=>m(e.target.value),className:"font-mono text-xs"}),a.jsx(C,{size:"sm",onClick:()=>{(async()=>{x(!0);try{const s=await X({webhookEnabled:h.trim().length>0,webhookUrl:h.trim()||void 0});u(s),N.success(e("settings.webhook.saved"))}catch{N.error(e("settings.webhook.save_failed"))}finally{x(!1)}})()},disabled:p,children:e(p?"common.saving":"common.save")})]}),d.webhookEnabled&&d.webhookUrl&&a.jsxs("p",{className:"text-xs text-green-500",children:[e("settings.webhook.enabled_prefix")," ",d.webhookUrl]})]})]})]})}),a.jsx(me,{value:"pomodoro",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.section_title")}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.pomodoro.section_desc")})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-6 max-w-xs",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(k,{className:"text-xs",children:e("settings.pomodoro.work_minutes")}),a.jsx(S,{type:"number",min:1,max:120,value:l.workMinutes,onChange:e=>v("workMinutes",e.target.value),className:"w-full"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(k,{className:"text-xs",children:e("settings.pomodoro.break_minutes")}),a.jsx(S,{type:"number",min:1,max:60,value:l.breakMinutes,onChange:e=>v("breakMinutes",e.target.value),className:"w-full"})]})]}),i&&a.jsxs(C,{size:"sm",onClick:()=>{Q(q.pomodoroConfig,l,!0),c(!1),N.success(e("settings.pomodoro.saved"))},children:[a.jsx(oe,{className:"h-3.5 w-3.5 mr-1.5"}),e("common.save")]})]}),a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.howto_title")}),a.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[a.jsxs("li",{children:[a.jsx(Z,{className:"h-3 w-3 inline-block mx-0.5"})," ",e("settings.pomodoro.howto_item_1")]}),a.jsx("li",{children:e("settings.pomodoro.howto_item_2")}),a.jsx("li",{children:e("settings.pomodoro.howto_item_3")}),a.jsx("li",{children:e("settings.pomodoro.howto_item_4")}),a.jsx("li",{children:e("settings.pomodoro.howto_item_5")})]})]})]})}),a.jsx(me,{value:"usage",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.section_title")}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.usage.section_desc")})]}),a.jsx("div",{className:"grid gap-3 max-w-md",children:[{key:"claude",label:"Claude Code",desc:e("settings.usage.tool_claude_desc")},{key:"codex",label:"Codex",desc:e("settings.usage.tool_codex_desc")},{key:"opencode",label:"OpenCode",desc:e("settings.usage.tool_opencode_desc")},{key:"qwen",label:"Qwen Code",desc:e("settings.usage.tool_qwen_desc")},{key:"gemini",label:"Gemini CLI",desc:e("settings.usage.tool_gemini_desc")}].map(s=>a.jsxs("label",{className:"flex items-start gap-3 rounded-md border p-3 cursor-pointer transition-colors "+(f===s.key?"border-blue-500/50 bg-blue-500/5":"border-border hover:bg-muted/30"),children:[a.jsx("input",{type:"radio",name:"usageTool",value:s.key,checked:f===s.key,onChange:()=>{g(s.key),Q(q.usageMonitorTool,s.key),window.dispatchEvent(new Event("ccweb:usage-tool-change")),N.success(e("settings.usage.switched_toast",{tool:s.label}))},className:"mt-0.5"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium",children:s.label}),a.jsx("div",{className:"text-xs text-muted-foreground",children:s.desc})]})]},s.key))})]}),a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.info_title")}),a.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[a.jsx("li",{children:e("settings.usage.info_item_1")}),a.jsx("li",{children:e("settings.usage.info_item_2")}),a.jsx("li",{children:e("settings.usage.info_item_3")}),a.jsx("li",{children:e("settings.usage.info_item_4")})]})]})]})}),a.jsx(me,{value:"language",children:a.jsx("div",{className:"space-y-6",children:a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[a.jsx("div",{children:a.jsx("h3",{className:"text-sm font-medium",children:e("language.label")})}),a.jsx(ht,{})]})})})]})]})})}export{mt as SettingsPage};
|
|
13
|
+
*/function Se(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 Ce="Switch",[_e]=o(Ce),[Re,Pe]=_e(Ce),Ee=s.forwardRef((e,o)=>{const{__scopeSwitch:i,name:c,checked:d,defaultChecked:u,required:h,disabled:m,value:p="on",onCheckedChange:x,form:f,...g}=e,[v,j]=s.useState(null),b=t(o,e=>j(e)),y=s.useRef(!1),w=!v||(f||!!v.closest("form")),[N,k]=n({prop:d,defaultProp:u??!1,onChange:x,caller:Ce});return a.jsxs(Re,{scope:i,checked:N,disabled:m,children:[a.jsx(r.button,{type:"button",role:"switch","aria-checked":N,"aria-required":h,"data-state":De(N),"data-disabled":m?"":void 0,disabled:m,value:p,...g,ref:b,onClick:l(e.onClick,e=>{k(e=>!e),w&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})}),w&&a.jsx(Me,{control:v,bubbles:!y.current,name:c,value:p,checked:N,required:h,disabled:m,form:f,style:{transform:"translateX(-100%)"}})]})});Ee.displayName=Ce;var Ie="SwitchThumb",Te=s.forwardRef((e,s)=>{const{__scopeSwitch:t,...n}=e,l=Pe(Ie,t);return a.jsx(r.span,{"data-state":De(l.checked),"data-disabled":l.disabled?"":void 0,...n,ref:s})});Te.displayName=Ie;var Me=s.forwardRef(({__scopeSwitch:e,control:n,checked:r,bubbles:l=!0,...o},i)=>{const c=s.useRef(null),d=t(c,i),u=Se(r),h=Y(n);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]),a.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 De(e){return e?"checked":"unchecked"}Me.displayName="SwitchBubbleInput";var Ae=Ee,He=Te;const Oe=s.forwardRef(({className:e,...s},t)=>a.jsx(Ae,{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:a.jsx(He,{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 Le(e){const t=Ve(e),n=s.forwardRef((e,n)=>{const{children:r,...l}=e,o=s.Children.toArray(r),i=o.find(Be);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 a.jsx(t,{...l,ref:n,children:s.isValidElement(e)?s.cloneElement(e,void 0,r):null})}return a.jsx(t,{...l,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Ve(e){const t=s.forwardRef((e,t)=>{const{children:n,...a}=e;if(s.isValidElement(n)){const e=function(e){var s,t;let n=null==(s=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:s.get,a=n&&"isReactWarning"in n&&n.isReactWarning;if(a)return e.ref;if(n=null==(t=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a)return e.props.ref;return e.props.ref||e.ref}(n),r=function(e,s){const t={...s};for(const n in s){const a=e[n],r=s[n];/^on[A-Z]/.test(n)?a&&r?t[n]=(...e)=>{const s=r(...e);return a(...e),s}:a&&(t[n]=a):"style"===n?t[n]={...a,...r}:"className"===n&&(t[n]=[a,r].filter(Boolean).join(" "))}return{...e,...t}}(a,n.props);return n.type!==s.Fragment&&(r.ref=t?c(t,e):e),s.cloneElement(n,r)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}Oe.displayName=Ae.displayName;var Fe=Symbol("radix.slottable");function Be(e){return s.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Fe}var ze=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)=>a.jsx(r.span,{...e,ref:s,style:{...ze,...e.style}})).displayName="VisuallyHidden";var We=[" ","Enter","ArrowUp","ArrowDown"],$e=[" ","Enter"],Ke="Select",[Ue,qe,Ge]=te(Ke),[Ze]=o(Ke,[Ge,se]),Xe=se(),[Qe,Ye]=Ze(Ke),[Je,es]=Ze(Ke),ss=e=>{const{__scopeSelect:t,children:r,open:l,defaultOpen:o,onOpenChange:i,value:c,defaultValue:u,onValueChange:h,dir:m,name:p,autoComplete:x,disabled:f,required:g,form:v}=e,j=Xe(t),[b,y]=s.useState(null),[w,N]=s.useState(null),[k,S]=s.useState(!1),C=J(m),[_,R]=n({prop:l,defaultProp:o??!1,onChange:i,caller:Ke}),[P,E]=n({prop:c,defaultProp:u,onChange:h,caller:Ke}),I=s.useRef(null),T=!b||(v||!!b.closest("form")),[M,D]=s.useState(new Set),A=Array.from(M).map(e=>e.props.value).join(";");return a.jsx(ee,{...j,children:a.jsxs(Qe,{required:g,scope:t,trigger:b,onTriggerChange:y,valueNode:w,onValueNodeChange:N,valueNodeHasChildren:k,onValueNodeHasChildrenChange:S,contentId:d(),value:P,onValueChange:E,open:_,onOpenChange:R,dir:C,triggerPointerDownPosRef:I,disabled:f,children:[a.jsx(Ue.Provider,{scope:t,children:a.jsx(Je,{scope:e.__scopeSelect,onNativeOptionAdd:s.useCallback(e=>{D(s=>new Set(s).add(e))},[]),onNativeOptionRemove:s.useCallback(e=>{D(s=>{const t=new Set(s);return t.delete(e),t})},[]),children:r})}),T?a.jsxs(Bs,{"aria-hidden":!0,required:g,tabIndex:-1,name:p,autoComplete:x,value:P,onChange:e=>E(e.target.value),disabled:f,form:v,children:[void 0===P?a.jsx("option",{value:""}):null,Array.from(M)]},A):null]})})};ss.displayName=Ke;var ts="SelectTrigger",ns=s.forwardRef((e,n)=>{const{__scopeSelect:o,disabled:i=!1,...c}=e,d=Xe(o),u=Ye(ts,o),h=u.disabled||i,m=t(n,u.onTriggerChange),p=qe(o),x=s.useRef("touch"),[f,g,v]=Ws(e=>{const s=p().filter(e=>!e.disabled),t=s.find(e=>e.value===u.value),n=$s(s,e,t);void 0!==n&&u.onValueChange(n.value)}),j=e=>{h||(u.onOpenChange(!0),v()),e&&(u.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return a.jsx(ne,{asChild:!0,...d,children:a.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":zs(u.value)?"":void 0,...c,ref:m,onClick:l(c.onClick,e=>{e.currentTarget.focus(),"mouse"!==x.current&&j(e)}),onPointerDown:l(c.onPointerDown,e=>{x.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||g(e.key),s&&" "===e.key||We.includes(e.key)&&(j(),e.preventDefault())})})})});ns.displayName=ts;var as="SelectValue",rs=s.forwardRef((e,s)=>{const{__scopeSelect:n,className:l,style:o,children:i,placeholder:c="",...d}=e,h=Ye(as,n),{onValueNodeHasChildrenChange:m}=h,p=void 0!==i,x=t(s,h.onValueNodeChange);return u(()=>{m(p)},[m,p]),a.jsx(r.span,{...d,ref:x,style:{pointerEvents:"none"},children:zs(h.value)?a.jsx(a.Fragment,{children:c}):i})});rs.displayName=as;var ls=s.forwardRef((e,s)=>{const{__scopeSelect:t,children:n,...l}=e;return a.jsx(r.span,{"aria-hidden":!0,...l,ref:s,children:n||"▼"})});ls.displayName="SelectIcon";var os=e=>a.jsx(h,{asChild:!0,...e});os.displayName="SelectPortal";var is="SelectContent",cs=s.forwardRef((e,t)=>{const n=Ye(is,e.__scopeSelect),[r,l]=s.useState();if(u(()=>{l(new DocumentFragment)},[]),!n.open){const s=r;return s?m.createPortal(a.jsx(us,{scope:e.__scopeSelect,children:a.jsx(Ue.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(ps,{...e,ref:t})});cs.displayName=is;var ds=10,[us,hs]=Ze(is),ms=Le("SelectContent.RemoveScroll"),ps=s.forwardRef((e,n)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:c,onPointerDownOutside:d,side:u,sideOffset:h,align:m,alignOffset:p,arrowPadding:b,collisionBoundary:y,collisionPadding:w,sticky:N,hideWhenDetached:k,avoidCollisions:S,...C}=e,_=Ye(is,r),[R,P]=s.useState(null),[E,I]=s.useState(null),T=t(n,e=>P(e)),[M,D]=s.useState(null),[A,H]=s.useState(null),O=qe(r),[L,V]=s.useState(!1),F=s.useRef(!1);s.useEffect(()=>{if(R)return x(R)},[R]),f();const B=s.useCallback(e=>{const[s,...t]=O().map(e=>e.ref.current),[n]=t.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(null==r||r.scrollIntoView({block:"nearest"}),r===s&&E&&(E.scrollTop=0),r===n&&E&&(E.scrollTop=E.scrollHeight),null==r||r.focus(),document.activeElement!==a)return}},[O,E]),z=s.useCallback(()=>B([M,R]),[B,M,R]);s.useEffect(()=>{L&&z()},[L,z]);const{onOpenChange:W,triggerPointerDownPosRef:$}=_;s.useEffect(()=>{if(R){let e={x:0,y:0};const s=s=>{var t,n;e={x:Math.abs(Math.round(s.pageX)-((null==(t=$.current)?void 0:t.x)??0)),y:Math.abs(Math.round(s.pageY)-((null==(n=$.current)?void 0:n.y)??0))}},t=t=>{e.x<=10&&e.y<=10?t.preventDefault():R.contains(t.target)||W(!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})}}},[R,W,$]),s.useEffect(()=>{const e=()=>W(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[W]);const[K,U]=Ws(e=>{const s=O().filter(e=>!e.disabled),t=s.find(e=>e.ref.current===document.activeElement),n=$s(s,e,t);n&&setTimeout(()=>n.ref.current.focus())}),q=s.useCallback((e,s,t)=>{const n=!F.current&&!t;(void 0!==_.value&&_.value===s||n)&&(D(e),n&&(F.current=!0))},[_.value]),G=s.useCallback(()=>null==R?void 0:R.focus(),[R]),Z=s.useCallback((e,s,t)=>{const n=!F.current&&!t;(void 0!==_.value&&_.value===s||n)&&H(e)},[_.value]),X="popper"===o?fs:xs,Q=X===fs?{side:u,sideOffset:h,align:m,alignOffset:p,arrowPadding:b,collisionBoundary:y,collisionPadding:w,sticky:N,hideWhenDetached:k,avoidCollisions:S}:{};return a.jsx(us,{scope:r,content:R,viewport:E,onViewportChange:I,itemRefCallback:q,selectedItem:M,onItemLeave:G,itemTextRefCallback:Z,focusSelectedItem:z,selectedItemText:A,position:o,isPositioned:L,searchRef:K,children:a.jsx(g,{as:ms,allowPinchZoom:!0,children:a.jsx(v,{asChild:!0,trapped:_.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:l(i,e=>{var s;null==(s=_.trigger)||s.focus({preventScroll:!0}),e.preventDefault()}),children:a.jsx(j,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:a.jsx(X,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:e=>e.preventDefault(),...C,...Q,onPlaced:()=>V(!0),ref:T,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=O().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,n=s.indexOf(t);s=s.slice(n+1)}setTimeout(()=>B(s)),e.preventDefault()}})})})})})})});ps.displayName="SelectContentImpl";var xs=s.forwardRef((e,n)=>{const{__scopeSelect:l,onPlaced:o,...i}=e,c=Ye(is,l),d=hs(is,l),[h,m]=s.useState(null),[p,x]=s.useState(null),f=t(n,e=>x(e)),g=qe(l),v=s.useRef(!1),j=s.useRef(!0),{viewport:b,selectedItem:y,selectedItemText:w,focusSelectedItem:N}=d,k=s.useCallback(()=>{if(c.trigger&&c.valueNode&&h&&p&&b&&y&&w){const e=c.trigger.getBoundingClientRect(),s=p.getBoundingClientRect(),t=c.valueNode.getBoundingClientRect(),n=w.getBoundingClientRect();if("rtl"!==c.dir){const a=n.left-s.left,r=t.left-a,l=e.left-r,o=e.width+l,i=Math.max(o,s.width),c=window.innerWidth-ds,d=re(r,[ds,Math.max(ds,c-i)]);h.style.minWidth=o+"px",h.style.left=d+"px"}else{const a=s.right-n.right,r=window.innerWidth-t.right-a,l=window.innerWidth-e.right-r,o=e.width+l,i=Math.max(o,s.width),c=window.innerWidth-ds,d=re(r,[ds,Math.max(ds,c-i)]);h.style.minWidth=o+"px",h.style.right=d+"px"}const a=g(),r=window.innerHeight-2*ds,l=b.scrollHeight,i=window.getComputedStyle(p),d=parseInt(i.borderTopWidth,10),u=parseInt(i.paddingTop,10),m=parseInt(i.borderBottomWidth,10),x=d+u+l+parseInt(i.paddingBottom,10)+m,f=Math.min(5*y.offsetHeight,x),j=window.getComputedStyle(b),N=parseInt(j.paddingTop,10),k=parseInt(j.paddingBottom,10),S=e.top+e.height/2-ds,C=r-S,_=y.offsetHeight/2,R=d+u+(y.offsetTop+_),P=x-R;if(R<=S){const e=a.length>0&&y===a[a.length-1].ref.current;h.style.bottom="0px";const s=p.clientHeight-b.offsetTop-b.offsetHeight,t=R+Math.max(C,_+(e?k:0)+s+m);h.style.height=t+"px"}else{const e=a.length>0&&y===a[0].ref.current;h.style.top="0px";const s=Math.max(S,d+b.offsetTop+(e?N:0)+_)+P;h.style.height=s+"px",b.scrollTop=R-S+b.offsetTop}h.style.margin=`${ds}px 0`,h.style.minHeight=f+"px",h.style.maxHeight=r+"px",null==o||o(),requestAnimationFrame(()=>v.current=!0)}},[g,c.trigger,c.valueNode,h,p,b,y,w,c.dir,o]);u(()=>k(),[k]);const[S,C]=s.useState();u(()=>{p&&C(window.getComputedStyle(p).zIndex)},[p]);const _=s.useCallback(e=>{e&&!0===j.current&&(k(),null==N||N(),j.current=!1)},[k,N]);return a.jsx(gs,{scope:l,contentWrapper:h,shouldExpandOnScrollRef:v,onScrollButtonChange:_,children:a.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:a.jsx(r.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});xs.displayName="SelectItemAlignedPosition";var fs=s.forwardRef((e,s)=>{const{__scopeSelect:t,align:n="start",collisionPadding:r=ds,...l}=e,o=Xe(t);return a.jsx(ae,{...o,...l,ref:s,align:n,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)"}})});fs.displayName="SelectPopperPosition";var[gs,vs]=Ze(is,{}),js="SelectViewport",bs=s.forwardRef((e,n)=>{const{__scopeSelect:o,nonce:i,...c}=e,d=hs(js,o),u=vs(js,o),h=t(n,d.onViewportChange),m=s.useRef(0);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(Ue.Slot,{scope:o,children:a.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:n}=u;if((null==n?void 0:n.current)&&t){const e=Math.abs(m.current-s.scrollTop);if(e>0){const n=window.innerHeight-2*ds,a=parseFloat(t.style.minHeight),r=parseFloat(t.style.height),l=Math.max(a,r);if(l<n){const a=l+e,r=Math.min(n,a),o=a-r;t.style.height=r+"px","0px"===t.style.bottom&&(s.scrollTop=o>0?o:0,t.style.justifyContent="flex-end")}}}m.current=s.scrollTop})})})]})});bs.displayName=js;var ys="SelectGroup",[ws,Ns]=Ze(ys);s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e,l=d();return a.jsx(ws,{scope:t,id:l,children:a.jsx(r.div,{role:"group","aria-labelledby":l,...n,ref:s})})}).displayName=ys;var ks="SelectLabel",Ss=s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e,l=Ns(ks,t);return a.jsx(r.div,{id:l.id,...n,ref:s})});Ss.displayName=ks;var Cs="SelectItem",[_s,Rs]=Ze(Cs),Ps=s.forwardRef((e,n)=>{const{__scopeSelect:o,value:i,disabled:c=!1,textValue:u,...h}=e,m=Ye(Cs,o),p=hs(Cs,o),x=m.value===i,[f,g]=s.useState(u??""),[v,j]=s.useState(!1),b=t(n,e=>{var s;return null==(s=p.itemRefCallback)?void 0:s.call(p,e,i,c)}),y=d(),w=s.useRef("touch"),N=()=>{c||(m.onValueChange(i),m.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 a.jsx(_s,{scope:o,value:i,disabled:c,textId:y,isSelected:x,onItemTextChange:s.useCallback(e=>{g(s=>s||((null==e?void 0:e.textContent)??"").trim())},[]),children:a.jsx(Ue.ItemSlot,{scope:o,value:i,disabled:c,textValue:f,children:a.jsx(r.div,{role:"option","aria-labelledby":y,"data-highlighted":v?"":void 0,"aria-selected":x&&v,"data-state":x?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...h,ref:b,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=p.onItemLeave)||s.call(p):"mouse"===w.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:l(h.onPointerLeave,e=>{var s;e.currentTarget===document.activeElement&&(null==(s=p.onItemLeave)||s.call(p))}),onKeyDown:l(h.onKeyDown,e=>{var s;""!==(null==(s=p.searchRef)?void 0:s.current)&&" "===e.key||($e.includes(e.key)&&N()," "===e.key&&e.preventDefault())})})})})});Ps.displayName=Cs;var Es="SelectItemText",Is=s.forwardRef((e,n)=>{const{__scopeSelect:l,className:o,style:i,...c}=e,d=Ye(Es,l),h=hs(Es,l),p=Rs(Es,l),x=es(Es,l),[f,g]=s.useState(null),v=t(n,e=>g(e),p.onItemTextChange,e=>{var s;return null==(s=h.itemTextRefCallback)?void 0:s.call(h,e,p.value,p.disabled)}),j=null==f?void 0:f.textContent,b=s.useMemo(()=>a.jsx("option",{value:p.value,disabled:p.disabled,children:j},p.value),[p.disabled,p.value,j]),{onNativeOptionAdd:y,onNativeOptionRemove:w}=x;return u(()=>(y(b),()=>w(b)),[y,w,b]),a.jsxs(a.Fragment,{children:[a.jsx(r.span,{id:p.textId,...c,ref:v}),p.isSelected&&d.valueNode&&!d.valueNodeHasChildren?m.createPortal(c.children,d.valueNode):null]})});Is.displayName=Es;var Ts="SelectItemIndicator",Ms=s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e;return Rs(Ts,t).isSelected?a.jsx(r.span,{"aria-hidden":!0,...n,ref:s}):null});Ms.displayName=Ts;var Ds="SelectScrollUpButton",As=s.forwardRef((e,n)=>{const r=hs(Ds,e.__scopeSelect),l=vs(Ds,e.__scopeSelect),[o,i]=s.useState(!1),c=t(n,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?a.jsx(Ls,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:s}=r;e&&s&&(e.scrollTop=e.scrollTop-s.offsetHeight)}}):null});As.displayName=Ds;var Hs="SelectScrollDownButton",Os=s.forwardRef((e,n)=>{const r=hs(Hs,e.__scopeSelect),l=vs(Hs,e.__scopeSelect),[o,i]=s.useState(!1),c=t(n,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?a.jsx(Ls,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:s}=r;e&&s&&(e.scrollTop=e.scrollTop+s.offsetHeight)}}):null});Os.displayName=Hs;var Ls=s.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...i}=e,c=hs("SelectScrollButton",n),d=s.useRef(null),h=qe(n),m=s.useCallback(()=>{null!==d.current&&(window.clearInterval(d.current),d.current=null)},[]);return s.useEffect(()=>()=>m(),[m]),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]),a.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,()=>{m()})})}),Vs=s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e;return a.jsx(r.div,{"aria-hidden":!0,...n,ref:s})});Vs.displayName="SelectSeparator";var Fs="SelectArrow";s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e,r=Xe(t),l=Ye(Fs,t),o=hs(Fs,t);return l.open&&"popper"===o.position?a.jsx(le,{...r,...n,ref:s}):null}).displayName=Fs;var Bs=s.forwardRef(({__scopeSelect:e,value:n,...l},o)=>{const i=s.useRef(null),c=t(o,i),d=Se(n);return s.useEffect(()=>{const e=i.current;if(!e)return;const s=window.HTMLSelectElement.prototype,t=Object.getOwnPropertyDescriptor(s,"value").set;if(d!==n&&t){const s=new Event("change",{bubbles:!0});t.call(e,n),e.dispatchEvent(s)}},[d,n]),a.jsx(r.select,{...l,style:{...ze,...l.style},ref:c,defaultValue:n})});function zs(e){return""===e||void 0===e}function Ws(e){const t=p(e),n=s.useRef(""),a=s.useRef(0),r=s.useCallback(e=>{const s=n.current+e;t(s),function e(s){n.current=s,window.clearTimeout(a.current),""!==s&&(a.current=window.setTimeout(()=>e(""),1e3))}(s)},[t]),l=s.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return s.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,r,l]}function $s(e,s,t){const n=s.length>1&&Array.from(s).every(e=>e===s[0])?s[0]:s,a=t?e.indexOf(t):-1;let r=(l=e,o=Math.max(a,0),l.map((e,s)=>l[(o+s)%l.length]));var l,o;1===n.length&&(r=r.filter(e=>e!==t));const i=r.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==t?i:void 0}Bs.displayName="SelectBubbleInput";var Ks=ns,Us=ls,qs=os,Gs=cs,Zs=bs,Xs=Ss,Qs=Ps,Ys=Is,Js=Ms,et=As,st=Os,tt=Vs;const nt=ss,at=rs,rt=s.forwardRef(({className:e,children:s,...t},n)=>a.jsxs(Ks,{ref:n,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,a.jsx(Us,{asChild:!0,children:a.jsx(pe,{className:"h-4 w-4 opacity-50"})})]}));rt.displayName=Ks.displayName;const lt=s.forwardRef(({className:e,...s},t)=>a.jsx(et,{ref:t,className:i("flex cursor-default items-center justify-center py-1",e),...s,children:a.jsx(xe,{className:"h-4 w-4"})}));lt.displayName=et.displayName;const ot=s.forwardRef(({className:e,...s},t)=>a.jsx(st,{ref:t,className:i("flex cursor-default items-center justify-center py-1",e),...s,children:a.jsx(pe,{className:"h-4 w-4"})}));ot.displayName=st.displayName;const it=s.forwardRef(({className:e,children:s,position:t="popper",...n},r)=>a.jsx(qs,{children:a.jsxs(Gs,{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,...n,children:[a.jsx(lt,{}),a.jsx(Zs,{className:i("p-1","popper"===t&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),a.jsx(ot,{})]})}));it.displayName=Gs.displayName;s.forwardRef(({className:e,...s},t)=>a.jsx(Xs,{ref:t,className:i("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...s})).displayName=Xs.displayName;const ct=s.forwardRef(({className:e,children:s,...t},n)=>a.jsxs(Qs,{ref:n,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:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Js,{children:a.jsx(b,{className:"h-4 w-4"})})}),a.jsx(Ys,{children:s})]}));ct.displayName=Qs.displayName;s.forwardRef(({className:e,...s},t)=>a.jsx(tt,{ref:t,className:i("-mx-1 my-1 h-px bg-muted",e),...s})).displayName=tt.displayName;function dt(){const[e,t]=s.useState(null),[n,r]=s.useState(!0),[l,o]=s.useState(!1),[i,c]=s.useState(!1),[d,u]=s.useState(!1),[h,m]=s.useState(!1),[p,x]=s.useState(null),[f,g]=s.useState(0),[v,j]=s.useState(""),[b,D]=s.useState("");y({onStart:e=>{x(e.projectId),g(0)},onProgress:e=>{x(e.projectId),g(e.filesTransferred)},onDone:()=>{x(null),g(0)}}),s.useEffect(()=>{let e=!1;return w().then(s=>{e||(t(s),D(s.defaultExcludes.join("\n")))}).catch(e=>N.error(`加载同步配置失败: ${e.message}`)).finally(()=>{e||r(!1)}),()=>{e=!0}},[]);const A=(e,s)=>{t(t=>t?{...t,[e]:s}:t)};return n||!e?a.jsx("div",{className:"text-sm text-muted-foreground",children:"加载中…"}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:"服务器配置"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-host",children:"主机 (host)"}),a.jsx(S,{id:"sync-host",value:e.host,onChange:e=>A("host",e.target.value),placeholder:"example.com"})]}),a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-port",children:"端口"}),a.jsx(S,{id:"sync-port",type:"number",value:e.port,onChange:e=>A("port",Number(e.target.value)||22)})]}),a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-user",children:"用户名"}),a.jsx(S,{id:"sync-user",value:e.user,onChange:e=>A("user",e.target.value),placeholder:"tom"})]}),a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-remote",children:"远端根路径"}),a.jsx(S,{id:"sync-remote",value:e.remoteRoot,onChange:e=>A("remoteRoot",e.target.value),placeholder:"/data/projects"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["每个项目会同步到 ",a.jsx("code",{children:"远端路径/项目文件夹"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:"认证"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(k,{children:"方式"}),a.jsxs(nt,{value:e.authMethod,onValueChange:e=>A("authMethod",e),children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(it,{children:[a.jsx(ct,{value:"key",children:"SSH key"}),a.jsx(ct,{value:"password",children:"密码"})]})]})]}),"key"===e.authMethod?a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-key",children:"私钥路径"}),a.jsx(S,{id:"sync-key",value:e.keyPath??"",onChange:e=>A("keyPath",e.target.value),placeholder:"~/.ssh/id_rsa"})]}):a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-pw",children:"密码"}),a.jsx(S,{id:"sync-pw",type:"password",value:v,onChange:e=>j(e.target.value),placeholder:e.passwordSet?"已设置,留空保持不变":"未设置"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["需要系统安装 ",a.jsx("code",{children:"sshpass"}),"(密码通过 SSHPASS env 传递,不会出现在 argv 里)"]})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:"同步策略"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(k,{children:"方向"}),a.jsxs(nt,{value:e.direction,onValueChange:e=>A("direction",e),children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(it,{children:[a.jsx(ct,{value:"push",children:"单向:本地 → 远端(--delete)"}),a.jsx(ct,{value:"pull",children:"单向:远端 → 本地"}),a.jsx(ct,{value:"bidirectional",children:"双向(先 push 再 pull)"})]})]})]}),a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(k,{htmlFor:"sync-cron",children:"定时 cron 表达式"}),a.jsx(S,{id:"sync-cron",value:e.schedule.cron,onChange:s=>A("schedule",{...e.schedule,cron:s.target.value}),placeholder:"0 3 * * *"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["5 段:分 时 日 月 周。例:",a.jsx("code",{children:"0 3 * * *"})," 每天 03:00"]})]}),a.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[a.jsx(Oe,{checked:e.schedule.enabled,onCheckedChange:s=>A("schedule",{...e.schedule,enabled:s})}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"启用"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:"默认排除(每行一个 glob)"}),a.jsx("textarea",{value:b,onChange:e=>D(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"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["作为 ",a.jsx("code",{children:"rsync --exclude"})," 传入。项目级的额外排除暂通过 API 设置。"]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2 pt-2 border-t",children:[a.jsxs(C,{onClick:()=>{(async()=>{if(e){o(!0);try{const s=b.split("\n").map(e=>e.trim()).filter(Boolean),n={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};v&&"__keep__"!==v&&(n.password=v);const a=await E(n);t(a),D(a.defaultExcludes.join("\n")),j(""),N.success("已保存")}catch(s){N.error(`保存失败: ${s.message}`)}finally{o(!1)}}})()},disabled:l,children:[l?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(oe,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]}),a.jsxs(C,{variant:"outline",onClick:()=>{(async()=>{c(!0);try{const e=await I();e.ok?N.success(e.message||"连接成功"):N.error(e.message||"连接失败")}catch(e){N.error(`测试失败: ${e.message}`)}finally{c(!1)}})()},disabled:i,children:[i?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(Ne,{className:"h-3.5 w-3.5 mr-1.5"}),"测试连接"]}),a.jsx("div",{className:"flex-1"}),d&&p&&a.jsx("span",{className:"text-xs text-muted-foreground self-center mr-1 tabular-nums",children:f>0?`同步中: ${p} (${f} 文件)`:`同步中: ${p}`}),a.jsxs(C,{variant:"outline",onClick:()=>{(async()=>{u(!0);try{const e=await T(),s=e.results.filter(e=>e.ok).length,t=e.results.filter(e=>e.skipped).length,n=e.results.filter(e=>"cancelled"===e.reason).length,a=e.total-s-t-n;n>0?N.info(`已取消:${s} 成功 / ${t} 跳过 / ${n} 取消 / ${a} 失败`):N.success(`同步完成:${s} 成功 / ${t} 跳过 / ${a} 失败`)}catch(e){N.error(`同步失败: ${e.message}`)}finally{u(!1),m(!1),x(null),g(0)}})()},disabled:d,title:"按当前方向同步所有项目",children:[d?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(ie,{className:"h-3.5 w-3.5 mr-1.5"}),"立即同步全部"]}),d&&a.jsxs(C,{variant:"outline",onClick:()=>{(async()=>{if(d&&!h){m(!0);try{await M(),N.info("已请求取消")}catch(e){N.error(`取消失败: ${e.message}`),m(!1)}}})()},disabled:h,title:"取消批量同步:SIGTERM 当前 rsync 并停止后续项目",children:[h?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(R,{className:"h-3.5 w-3.5 mr-1.5"}),"取消"]})]}),a.jsxs("div",{className:"border-t pt-4 text-xs text-muted-foreground",children:["一次性 push/pull 工具:进入项目内部,点击 header 的 ",a.jsx(ie,{className:"inline h-3 w-3"})," / ",a.jsx(P,{className:"inline h-3 w-3"})," 按钮。 或通过 API 调用 ",a.jsx("code",{children:"POST /api/sync/project/:id"})," with body ",a.jsx("code",{children:'{ "direction": "push" }'}),"。"]})]})}function ut(){const e=D(),[t,n]=s.useState(null),[r,l]=s.useState(!0),[o,i]=s.useState(""),[c,d]=s.useState(!1);s.useEffect(()=>{let e=!1;return A().then(s=>{e||n(s)}).catch(()=>{e||n({configured:!1,needsReset:!1})}).finally(()=>{e||l(!1)}),()=>{e=!0}},[]);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-1",children:"CCWeb Hub 直接提交"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:['配置你的 GitHub PAT 后,在 Quick Prompts / Agent Prompts 卡片右键选择"共享"时可一键直接提交 Issue 到 ',a.jsx("code",{children:"zbc0315/ccweb-hub"}),"。 ccweb 本身不自带 token —— 使用你自己的账号身份提交,归属清晰,互不影响。"]})]}),r?a.jsxs("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[a.jsx(_,{className:"h-4 w-4 animate-spin"}),"加载中…"]}):a.jsxs(a.Fragment,{children:[a.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)?a.jsxs(a.Fragment,{children:[a.jsx(fe,{className:"h-4 w-4 text-green-500 shrink-0"}),a.jsx("span",{children:"已配置 token,可直接提交"}),a.jsx("div",{className:"flex-1"}),a.jsxs(C,{size:"sm",variant:"outline",onClick:()=>{(async()=>{if(await e({title:"清除 Hub Token",description:"清除后将无法直接提交到 ccweb-hub,需要重新配置 token。确认?",destructive:!0,confirmLabel:"清除"}))try{await O(),n({configured:!1,needsReset:!1}),N.success("已清除")}catch(s){N.error(`清除失败: ${s.message}`)}})()},children:[a.jsx(H,{className:"h-3.5 w-3.5 mr-1"}),"清除"]})]}):(null==t?void 0:t.needsReset)?a.jsxs(a.Fragment,{children:[a.jsx(ve,{className:"h-4 w-4 text-amber-500 shrink-0"}),a.jsx("span",{children:"之前的 token 已失效(服务端密钥可能已轮换),请重新设置"})]}):a.jsxs(a.Fragment,{children:[a.jsx(ve,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a.jsx("span",{children:"尚未配置 token"})]})}),a.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2.5 text-xs space-y-2",children:[a.jsx("div",{className:"font-medium text-foreground",children:"如何获取 token"}),a.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-muted-foreground",children:[a.jsxs("li",{children:["打开"," ",a.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",a.jsx(be,{className:"h-3 w-3"})]})," ","创建页"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Repository access"}),':选 "Only select repositories",添加 ',a.jsx("code",{children:"zbc0315/ccweb-hub"})]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Repository permissions → Issues"}),':设置为 "Read and write"']}),a.jsx("li",{children:"其余权限保持默认(全部无访问)"}),a.jsx("li",{children:"生成后复制 token 粘贴到下方"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(k,{htmlFor:"hub-token",className:"text-xs",children:["GitHub Token ",(null==t?void 0:t.configured)&&a.jsx("span",{className:"text-muted-foreground",children:"(填写会覆盖现有 token)"})]}),a.jsx(S,{id:"hub-token",type:"password",placeholder:"github_pat_...",value:o,onChange:e=>i(e.target.value),autoComplete:"off",spellCheck:!1}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Token 以 AES-256-GCM 加密存储于 ",a.jsx("code",{children:"~/.ccweb/hub-auth/"}),";per-user 独立,不会被其他用户读到。"]})]}),a.jsx("div",{className:"flex gap-2 pt-2 border-t",children:a.jsxs(C,{onClick:()=>{(async()=>{const e=o.trim();if(e){d(!0);try{const s=await L(e);n(s),i(""),N.success("已保存")}catch(s){N.error(`保存失败: ${s.message}`)}finally{d(!1)}}else N.error("请输入 token")})()},disabled:c||!o.trim(),children:[c?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(oe,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})})]})]})}function ht(){const{t:e,i18n:s}=ce();return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(we,{className:"h-4 w-4 text-muted-foreground"}),a.jsxs(nt,{value:s.language,onValueChange:async t=>{if(V.includes(t)){try{localStorage.setItem(F,t)}catch{}await s.changeLanguage(t);try{await B(t)}catch{N.error(e("language.switch_failed"))}}},children:[a.jsx(rt,{className:"w-40",children:a.jsx(at,{})}),a.jsxs(it,{children:[a.jsx(ct,{value:"zh",children:e("language.zh")}),a.jsx(ct,{value:"en",children:e("language.en")})]})]})]})}function mt(){const{t:e}=ce(),t=z(),[n]=W(),r=n.get("tab")||"sync",[l,o]=s.useState(()=>$()),[i,c]=s.useState(!1),[d,u]=s.useState({webhookEnabled:!1}),[h,m]=s.useState(""),[p,x]=s.useState(!1),[f,g]=s.useState(()=>K(U.usageMonitorTool,"claude"));s.useEffect(()=>{q().then(e=>{u(e),m(e.webhookUrl??"")}).catch(()=>{})},[]);const v=(e,s)=>{const t=parseInt(s,10);isNaN(t)||t<1||(o(s=>({...s,[e]:t})),c(!0))};return a.jsx("div",{className:"min-h-screen bg-background",children:a.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[a.jsxs(C,{variant:"ghost",size:"sm",onClick:()=>t("/"),children:[a.jsx(G,{className:"h-4 w-4 mr-1"}),e("common.back")]}),a.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:e("settings.title")})]}),a.jsxs(de,{defaultValue:r,children:[a.jsxs(ue,{className:"mb-4",children:[a.jsxs(he,{value:"sync",children:[a.jsx(ke,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_sync")]}),a.jsxs(he,{value:"hub",children:[a.jsx(ye,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_hub")]}),a.jsxs(he,{value:"notifications",children:[a.jsx(je,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_notifications")]}),a.jsxs(he,{value:"pomodoro",children:[a.jsx(Z,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_pomodoro")]}),a.jsxs(he,{value:"usage",children:[a.jsx(ge,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_usage")]}),a.jsxs(he,{value:"language",children:[a.jsx(we,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_language")]})]}),a.jsx(me,{value:"sync",children:a.jsx(dt,{})}),a.jsx(me,{value:"hub",children:a.jsx(ut,{})}),a.jsx(me,{value:"notifications",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.browser_notify.title")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e("settings.browser_notify.description")})]}),a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.webhook.title")}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.webhook.description")})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(k,{className:"text-xs",children:"Webhook URL"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(S,{placeholder:"https://hooks.slack.com/...",value:h,onChange:e=>m(e.target.value),className:"font-mono text-xs"}),a.jsx(C,{size:"sm",onClick:()=>{(async()=>{x(!0);try{const s=await Q({webhookEnabled:h.trim().length>0,webhookUrl:h.trim()||void 0});u(s),N.success(e("settings.webhook.saved"))}catch{N.error(e("settings.webhook.save_failed"))}finally{x(!1)}})()},disabled:p,children:e(p?"common.saving":"common.save")})]}),d.webhookEnabled&&d.webhookUrl&&a.jsxs("p",{className:"text-xs text-green-500",children:[e("settings.webhook.enabled_prefix")," ",d.webhookUrl]})]})]})]})}),a.jsx(me,{value:"pomodoro",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.section_title")}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.pomodoro.section_desc")})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-6 max-w-xs",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(k,{className:"text-xs",children:e("settings.pomodoro.work_minutes")}),a.jsx(S,{type:"number",min:1,max:120,value:l.workMinutes,onChange:e=>v("workMinutes",e.target.value),className:"w-full"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(k,{className:"text-xs",children:e("settings.pomodoro.break_minutes")}),a.jsx(S,{type:"number",min:1,max:60,value:l.breakMinutes,onChange:e=>v("breakMinutes",e.target.value),className:"w-full"})]})]}),i&&a.jsxs(C,{size:"sm",onClick:()=>{X(U.pomodoroConfig,l,!0),c(!1),N.success(e("settings.pomodoro.saved"))},children:[a.jsx(oe,{className:"h-3.5 w-3.5 mr-1.5"}),e("common.save")]})]}),a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.howto_title")}),a.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[a.jsxs("li",{children:[a.jsx(Z,{className:"h-3 w-3 inline-block mx-0.5"})," ",e("settings.pomodoro.howto_item_1")]}),a.jsx("li",{children:e("settings.pomodoro.howto_item_2")}),a.jsx("li",{children:e("settings.pomodoro.howto_item_3")}),a.jsx("li",{children:e("settings.pomodoro.howto_item_4")}),a.jsx("li",{children:e("settings.pomodoro.howto_item_5")})]})]})]})}),a.jsx(me,{value:"usage",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.section_title")}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.usage.section_desc")})]}),a.jsx("div",{className:"grid gap-3 max-w-md",children:[{key:"claude",label:"Claude Code",desc:e("settings.usage.tool_claude_desc")},{key:"codex",label:"Codex",desc:e("settings.usage.tool_codex_desc")},{key:"opencode",label:"OpenCode",desc:e("settings.usage.tool_opencode_desc")},{key:"qwen",label:"Qwen Code",desc:e("settings.usage.tool_qwen_desc")},{key:"gemini",label:"Gemini CLI",desc:e("settings.usage.tool_gemini_desc")}].map(s=>a.jsxs("label",{className:"flex items-start gap-3 rounded-md border p-3 cursor-pointer transition-colors "+(f===s.key?"border-blue-500/50 bg-blue-500/5":"border-border hover:bg-muted/30"),children:[a.jsx("input",{type:"radio",name:"usageTool",value:s.key,checked:f===s.key,onChange:()=>{g(s.key),X(U.usageMonitorTool,s.key),window.dispatchEvent(new Event("ccweb:usage-tool-change")),N.success(e("settings.usage.switched_toast",{tool:s.label}))},className:"mt-0.5"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium",children:s.label}),a.jsx("div",{className:"text-xs text-muted-foreground",children:s.desc})]})]},s.key))})]}),a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.info_title")}),a.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[a.jsx("li",{children:e("settings.usage.info_item_1")}),a.jsx("li",{children:e("settings.usage.info_item_2")}),a.jsx("li",{children:e("settings.usage.info_item_3")}),a.jsx("li",{children:e("settings.usage.info_item_4")})]})]})]})}),a.jsx(me,{value:"language",children:a.jsx("div",{className:"space-y-6",children:a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[a.jsx("div",{children:a.jsx("h3",{className:"text-sm font-medium",children:e("language.label")})}),a.jsx(ht,{})]})})})]})]})})}export{mt as SettingsPage};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{c as e,
|
|
1
|
+
import{c as e,aE as s,r as t,bm as a,bn as r,t as n,bo as l,bp as i,bq as c,ab as d,br as o,j as m,B as x,aG as u,d as p,I as h,T as g,p as f,D as b,aB as j,aC as N,A as y,an as v,at as k}from"./index-CucIiRNA.js";import{S as w}from"./search-DliqHq7A.js";import{C}from"./chevron-down-CVKfuHrn.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"}]]),E=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"}]]),q=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 q(){const e=s(),[q,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"===q&&(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)))},[q]);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"===q?"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"===q?"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"===q?"搜索 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"===q&&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-xl 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-xl 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"===q&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[m.jsx(z,{active:"all"===Y,onClick:()=>ee("all"),children:"全部"}),m.jsxs(z,{active:"quick-prompt"===Y,onClick:()=>ee("quick-prompt"),children:[m.jsx(b,{className:"h-3 w-3"}),"Quick Prompts"]}),m.jsxs(z,{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-xl 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(A,{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: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(j,{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 z({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{q as SkillHubPage};
|
|
13
|
+
*/function z(){const e=s(),[z,M]=t.useState("prompts"),[H,_]=t.useState(""),[F,Q]=t.useState([]),[W,B]=t.useState([]),[I,O]=t.useState(!1),[T,U]=t.useState(null);t.useEffect(()=>{"plugins"===z&&(O(!0),Promise.all([a().catch(()=>[]),fetch("/api/skillhub/plugins").then(e=>e.ok?e.json():[]).catch(()=>[])]).then(([e,s])=>{Q(e),B(s)}).finally(()=>O(!1)))},[z]);const Z=t.useCallback(async e=>{if(!T){U(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{U(null)}}},[T]),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:"卸载失败")}},[]),G=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:"操作失败")}},[]),[$,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 $.forEach(s=>{var t;return null==(t=s.tags)?void 0:t.forEach(s=>e.add(s))}),[...e].sort()},[$]),oe=t.useMemo(()=>{let e=$;"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},[$,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:[I&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),!I&&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-xl 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:()=>G(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=T===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-xl 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:()=>Z(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===$.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&&$.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-xl 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: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(b,{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 @@
|
|
|
1
|
+
import{r as e,bk as t,bl as n,c as r,j as o,U as i,W as a,R as s,$ as l,b3 as c,a1 as u,a0 as f,b2 as d,V as p,Y as h,d as m,b4 as g,aR as y}from"./index-CucIiRNA.js";const v={},w=(e,t,n,r)=>{S(n)&&v[n]||(S(n)&&(v[n]=new Date),((e,t,n,r)=>{var o,i,a,s;const l=[n,{code:t,...r||{}}];if(null==(i=null==(o=null==e?void 0:e.services)?void 0:o.logger)?void 0:i.forward)return e.services.logger.forward(l,"warn","react-i18next::",!0);S(l[0])&&(l[0]=`react-i18next:: ${l[0]}`),(null==(s=null==(a=null==e?void 0:e.services)?void 0:a.logger)?void 0:s.warn)?e.services.logger.warn(...l):(null==console?void 0:console.warn)&&console.warn(...l)})(e,t,n,r))},x=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},b=(e,t,n)=>{e.loadNamespaces(t,x(e,n))},R=(e,t,n,r)=>{if(S(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return b(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,x(e,r))},S=e=>"string"==typeof e,A=e.createContext();class C{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var E={exports:{}},O={},T=e;var P="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},j=T.useState,N=T.useEffect,D=T.useLayoutEffect,k=T.useDebugValue;function L(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!P(e,n)}catch(r){return!0}}var F="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=j({inst:{value:n,getSnapshot:t}}),o=r[0].inst,i=r[1];return D(function(){o.value=n,o.getSnapshot=t,L(o)&&i({inst:o})},[e,n,t]),N(function(){return L(o)&&i({inst:o}),e(function(){L(o)&&i({inst:o})})},[e]),k(n),n};O.useSyncExternalStore=void 0!==T.useSyncExternalStore?T.useSyncExternalStore:F,E.exports=O;var _=E.exports;const I={t:(e,t)=>{if(S(t))return t;if("object"==typeof(n=t)&&null!==n&&S(t.defaultValue))return t.defaultValue;var n;if("function"==typeof e)return"";if(Array.isArray(e)){const t=e[e.length-1];return"function"==typeof t?"":t}return e},ready:!1},M=()=>()=>{},z=(r,o={})=>{var i,a,s;const{i18n:l}=o,{i18n:c,defaultNS:u}=e.useContext(A)||{},f=l||c||n();f&&!f.reportNamespaces&&(f.reportNamespaces=new C),f||w(f,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const d=e.useMemo(()=>{var e;return{...t(),...null==(e=null==f?void 0:f.options)?void 0:e.react,...o}},[f,o]),{useSuspense:p,keyPrefix:h}=d,m=u||(null==(i=null==f?void 0:f.options)?void 0:i.defaultNS),g=S(m)?[m]:m||["translation"],y=e.useMemo(()=>g,g);null==(s=null==(a=null==f?void 0:f.reportNamespaces)?void 0:a.addUsedNamespaces)||s.call(a,y);const v=e.useRef(0),x=e.useCallback(e=>{if(!f)return M;const{bindI18n:t,bindI18nStore:n}=d,r=()=>{v.current+=1,e()};return t&&f.on(t,r),n&&f.store.on(n,r),()=>{t&&t.split(" ").forEach(e=>f.off(e,r)),n&&n.split(" ").forEach(e=>f.store.off(e,r))}},[f,d]),E=e.useRef(),O=e.useCallback(()=>{if(!f)return I;const e=!(!f.isInitialized&&!f.initializedStoreOnce)&&y.every(e=>((e,t,n={})=>t.languages&&t.languages.length?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}):(w(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0))(e,f,d)),t=o.lng||f.language,n=v.current,r=E.current;if(r&&r.ready===e&&r.lng===t&&r.keyPrefix===h&&r.revision===n)return r;const i={t:f.getFixedT(t,"fallback"===d.nsMode?y:y[0],h),ready:e,lng:t,keyPrefix:h,revision:n};return E.current=i,i},[f,y,h,d,o.lng]),[T,P]=e.useState(0),{t:j,ready:N}=_.useSyncExternalStore(x,O,O);e.useEffect(()=>{if(f&&!N&&!p){const e=()=>P(e=>e+1);o.lng?R(f,o.lng,y,e):b(f,y,e)}},[f,o.lng,y,N,p,T]);const D=f||{},k=e.useRef(null),L=e.useRef(),F=e=>{const t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;const n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,"__original"))try{Object.defineProperty(n,"__original",{value:e,writable:!1,enumerable:!1,configurable:!1})}catch(r){}return n},z=e.useMemo(()=>{const e=D,t=null==e?void 0:e.language;let n=e;e&&(k.current&&k.current.__original===e?L.current!==t?(n=F(e),k.current=n,L.current=t):n=k.current:(n=F(e),k.current=n,L.current=t));const r=N||p?j:(...e)=>(w(f,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),j(...e)),o=[r,n,N];return o.t=r,o.i18n=n,o.ready=N,o},[j,D,N,D.resolvedLanguage,D.language,D.languages]);if(f&&p&&!N)throw new Promise(e=>{const t=()=>e();o.lng?R(f,o.lng,y,t):b(f,y,t)});return z},H=r("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]),W=r("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);function V(t){const n=$(t),r=e.forwardRef((t,r)=>{const{children:i,...a}=t,s=e.Children.toArray(i),l=s.find(U);if(l){const t=l.props.children,i=s.map(n=>n===l?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return o.jsx(n,{...a,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,i):null})}return o.jsx(n,{...a,ref:r,children:i})});return r.displayName=`${t}.Slot`,r}function $(t){const n=e.forwardRef((t,n)=>{const{children:r,...o}=t;if(e.isValidElement(r)){const t=function(e){var t,n;let r=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;if(o)return e.ref;if(r=null==(n=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o)return e.props.ref;return e.props.ref||e.ref}(r),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}}(o,r.props);return r.type!==e.Fragment&&(a.ref=n?i(n,t):t),e.cloneElement(r,a)}return e.Children.count(r)>1?e.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var B=Symbol("radix.slottable");function U(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===B}function K(e){const t=e+"CollectionProvider",[n,r]=a(t),[i,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=e=>{const{scope:t,children:n}=e,r=s.useRef(null),a=s.useRef(new Map).current;return o.jsx(i,{scope:t,itemMap:a,collectionRef:r,children:n})};u.displayName=t;const f=e+"CollectionSlot",d=V(f),p=s.forwardRef((e,t)=>{const{scope:n,children:r}=e,i=c(f,n),a=l(t,i.collectionRef);return o.jsx(d,{ref:a,children:r})});p.displayName=f;const h=e+"CollectionItemSlot",m="data-radix-collection-item",g=V(h),y=s.forwardRef((e,t)=>{const{scope:n,children:r,...i}=e,a=s.useRef(null),u=l(t,a),f=c(h,n);return s.useEffect(()=>(f.itemMap.set(a,{ref:a,...i}),()=>{f.itemMap.delete(a)})),o.jsx(g,{[m]:"",ref:u,children:r})});return y.displayName=h,[{Provider:u,Slot:p,ItemSlot:y},function(t){const n=c(e+"CollectionConsumer",t);return s.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${m}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])},r]}var Y=e.createContext(void 0);function G(t){const n=e.useContext(Y);return t||n||"ltr"}var X="rovingFocusGroup.onEntryFocus",q={bubbles:!1,cancelable:!0},Z="RovingFocusGroup",[J,Q,ee]=K(Z),[te,ne]=a(Z,[ee]),[re,oe]=te(Z),ie=e.forwardRef((e,t)=>o.jsx(J.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(J.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(ae,{...e,ref:t})})}));ie.displayName=Z;var ae=e.forwardRef((t,n)=>{const{__scopeRovingFocusGroup:r,orientation:i,loop:a=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:m,onEntryFocus:g,preventScrollOnEntryFocus:y=!1,...v}=t,w=e.useRef(null),x=l(n,w),b=G(s),[R,S]=d({prop:c,defaultProp:h??null,onChange:m,caller:Z}),[A,C]=e.useState(!1),E=p(g),O=Q(r),T=e.useRef(!1),[P,j]=e.useState(0);return e.useEffect(()=>{const e=w.current;if(e)return e.addEventListener(X,E),()=>e.removeEventListener(X,E)},[E]),o.jsx(re,{scope:r,orientation:i,dir:b,loop:a,currentTabStopId:R,onItemFocus:e.useCallback(e=>S(e),[S]),onItemShiftTab:e.useCallback(()=>C(!0),[]),onFocusableItemAdd:e.useCallback(()=>j(e=>e+1),[]),onFocusableItemRemove:e.useCallback(()=>j(e=>e-1),[]),children:o.jsx(u.div,{tabIndex:A||0===P?-1:0,"data-orientation":i,...v,ref:x,style:{outline:"none",...t.style},onMouseDown:f(t.onMouseDown,()=>{T.current=!0}),onFocus:f(t.onFocus,e=>{const t=!T.current;if(e.target===e.currentTarget&&t&&!A){const t=new CustomEvent(X,q);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=O().filter(e=>e.focusable);ue([e.find(e=>e.active),e.find(e=>e.id===R),...e].filter(Boolean).map(e=>e.ref.current),y)}}T.current=!1}),onBlur:f(t.onBlur,()=>C(!1))})})}),se="RovingFocusGroupItem",le=e.forwardRef((t,n)=>{const{__scopeRovingFocusGroup:r,focusable:i=!0,active:a=!1,tabStopId:s,children:l,...d}=t,p=c(),h=s||p,m=oe(se,r),g=m.currentTabStopId===h,y=Q(r),{onFocusableItemAdd:v,onFocusableItemRemove:w,currentTabStopId:x}=m;return e.useEffect(()=>{if(i)return v(),()=>w()},[i,v,w]),o.jsx(J.ItemSlot,{scope:r,id:h,focusable:i,active:a,children:o.jsx(u.span,{tabIndex:g?0:-1,"data-orientation":m.orientation,...d,ref:n,onMouseDown:f(t.onMouseDown,e=>{i?m.onItemFocus(h):e.preventDefault()}),onFocus:f(t.onFocus,()=>m.onItemFocus(h)),onKeyDown:f(t.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void m.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const r=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)?void 0:ce[r]}(e,m.orientation,m.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=m.loop?(r=i+1,(n=o).map((e,t)=>n[(r+t)%n.length])):o.slice(i+1)}setTimeout(()=>ue(o))}var n,r}),children:"function"==typeof l?l({isCurrentTabStop:g,hasTabStop:null!=x}):l})})});le.displayName=se;var ce={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ue(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 fe=ie,de=le,pe="Tabs",[he]=a(pe,[ne]),me=ne(),[ge,ye]=he(pe),ve=e.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:s="horizontal",dir:l,activationMode:f="automatic",...p}=e,h=G(l),[m,g]=d({prop:r,onChange:i,defaultProp:a??"",caller:pe});return o.jsx(ge,{scope:n,baseId:c(),value:m,onValueChange:g,orientation:s,dir:h,activationMode:f,children:o.jsx(u.div,{dir:h,"data-orientation":s,...p,ref:t})})});ve.displayName=pe;var we="TabsList",xe=e.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,a=ye(we,n),s=me(n);return o.jsx(fe,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:r,children:o.jsx(u.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:t})})});xe.displayName=we;var be="TabsTrigger",Re=e.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,s=ye(be,n),l=me(n),c=Ce(s.baseId,r),d=Ee(s.baseId,r),p=r===s.value;return o.jsx(de,{asChild:!0,...l,focusable:!i,active:p,children:o.jsx(u.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":d,"data-state":p?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...a,ref:t,onMouseDown:f(e.onMouseDown,e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():s.onValueChange(r)}),onKeyDown:f(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&s.onValueChange(r)}),onFocus:f(e.onFocus,()=>{const e="manual"!==s.activationMode;p||i||!e||s.onValueChange(r)})})})});Re.displayName=be;var Se="TabsContent",Ae=e.forwardRef((t,n)=>{const{__scopeTabs:r,value:i,forceMount:a,children:s,...l}=t,c=ye(Se,r),f=Ce(c.baseId,i),d=Ee(c.baseId,i),p=i===c.value,m=e.useRef(p);return e.useEffect(()=>{const e=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(e)},[]),o.jsx(h,{present:a||p,children:({present:e})=>o.jsx(u.div,{"data-state":p?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":f,hidden:!e,id:d,tabIndex:0,...l,ref:n,style:{...t.style,animationDuration:m.current?"0s":void 0},children:e&&s})})});function Ce(e,t){return`${e}-trigger-${t}`}function Ee(e,t){return`${e}-content-${t}`}Ae.displayName=Se;var Oe=xe,Te=Re,Pe=Ae;const je=ve,Ne=e.forwardRef(({className:e,...t},n)=>o.jsx(Oe,{ref:n,className:m("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}));Ne.displayName=Oe.displayName;const De=e.forwardRef(({className:e,...t},n)=>o.jsx(Te,{ref:n,className:m("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}));De.displayName=Te.displayName;const ke=e.forwardRef(({className:e,...t},n)=>o.jsx(Pe,{ref:n,className:m("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));ke.displayName=Pe.displayName;const Le=["top","right","bottom","left"],Fe=Math.min,_e=Math.max,Ie=Math.round,Me=Math.floor,ze=e=>({x:e,y:e}),He={left:"right",right:"left",bottom:"top",top:"bottom"};function We(e,t,n){return _e(e,Fe(t,n))}function Ve(e,t){return"function"==typeof e?e(t):e}function $e(e){return e.split("-")[0]}function Be(e){return e.split("-")[1]}function Ue(e){return"x"===e?"y":"x"}function Ke(e){return"y"===e?"height":"width"}function Ye(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function Ge(e){return Ue(Ye(e))}function Xe(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const qe=["left","right"],Ze=["right","left"],Je=["top","bottom"],Qe=["bottom","top"];function et(e,t,n,r){const o=Be(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Ze:qe:t?qe:Ze;case"left":case"right":return t?Je:Qe;default:return[]}}($e(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(Xe)))),i}function tt(e){const t=$e(e);return He[t]+e.slice(t.length)}function nt(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 rt(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 ot(e,t,n){let{reference:r,floating:o}=e;const i=Ye(t),a=Ge(t),s=Ke(a),l=$e(t),c="y"===i,u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[s]/2-o[s]/2;let p;switch(l){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};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 it(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=Ve(t,e),h=nt(p),m=s[d?"floating"===f?"reference":"floating":f],g=rt(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),y="floating"===f?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,v=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.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=rt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:v,strategy:l}):y);return{top:(g.top-x.top+h.top)/w.y,bottom:(x.bottom-g.bottom+h.bottom)/w.y,left:(g.left-x.left+h.left)/w.x,right:(x.right-g.right+h.right)/w.x}}function at(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function st(e){return Le.some(t=>e[t]>=0)}const lt=new Set(["left","top"]);function ct(){return"undefined"!=typeof window}function ut(e){return pt(e)?(e.nodeName||"").toLowerCase():"#document"}function ft(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function dt(e){var t;return null==(t=(pt(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function pt(e){return!!ct()&&(e instanceof Node||e instanceof ft(e).Node)}function ht(e){return!!ct()&&(e instanceof Element||e instanceof ft(e).Element)}function mt(e){return!!ct()&&(e instanceof HTMLElement||e instanceof ft(e).HTMLElement)}function gt(e){return!(!ct()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof ft(e).ShadowRoot)}function yt(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 vt(e){return/^(table|td|th)$/.test(ut(e))}function wt(e){try{if(e.matches(":popover-open"))return!0}catch(t){}try{return e.matches(":modal")}catch(t){return!1}}const xt=/transform|translate|scale|rotate|perspective|filter/,bt=/paint|layout|strict|content/,Rt=e=>!!e&&"none"!==e;let St;function At(e){const t=ht(e)?Ot(e):e;return Rt(t.transform)||Rt(t.translate)||Rt(t.scale)||Rt(t.rotate)||Rt(t.perspective)||!Ct()&&(Rt(t.backdropFilter)||Rt(t.filter))||xt.test(t.willChange||"")||bt.test(t.contain||"")}function Ct(){return null==St&&(St="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),St}function Et(e){return/^(html|body|#document)$/.test(ut(e))}function Ot(e){return ft(e).getComputedStyle(e)}function Tt(e){return ht(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Pt(e){if("html"===ut(e))return e;const t=e.assignedSlot||e.parentNode||gt(e)&&e.host||dt(e);return gt(t)?t.host:t}function jt(e){const t=Pt(e);return Et(t)?e.ownerDocument?e.ownerDocument.body:e.body:mt(t)&&yt(t)?t:jt(t)}function Nt(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=jt(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=ft(o);if(i){const e=Dt(a);return t.concat(a,a.visualViewport||[],yt(o)?o:[],e&&n?Nt(e):[])}return t.concat(o,Nt(o,[],n))}function Dt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function kt(e){const t=Ot(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=mt(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Ie(n)!==i||Ie(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function Lt(e){return ht(e)?e:e.contextElement}function Ft(e){const t=Lt(e);if(!mt(t))return ze(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=kt(t);let a=(i?Ie(n.width):n.width)/r,s=(i?Ie(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const _t=ze(0);function It(e){const t=ft(e);return Ct()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:_t}function Mt(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Lt(e);let a=ze(1);t&&(r?ht(r)&&(a=Ft(r)):a=Ft(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==ft(e))&&t}(i,n,r)?It(i):ze(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,u=o.width/a.x,f=o.height/a.y;if(i){const e=ft(i),t=r&&ht(r)?ft(r):r;let n=e,o=Dt(n);for(;o&&r&&t!==n;){const e=Ft(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;l*=e.x,c*=e.y,u*=e.x,f*=e.y,l+=i,c+=a,n=ft(o),o=Dt(n)}}return rt({width:u,height:f,x:l,y:c})}function zt(e,t){const n=Tt(e).scrollLeft;return t?t.left+n:Mt(dt(e)).left+n}function Ht(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-zt(e,n),y:n.top+t.scrollTop}}function Wt(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=ft(e),r=dt(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=Ct();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}const c=zt(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:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=dt(e),n=Tt(e),r=e.ownerDocument.body,o=_e(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=_e(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+zt(e);const s=-n.scrollTop;return"rtl"===Ot(r).direction&&(a+=_e(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(dt(e));else if(ht(t))r=function(e,t){const n=Mt(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=mt(e)?Ft(e):ze(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=It(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return rt(r)}function Vt(e,t){const n=Pt(e);return!(n===t||!ht(n)||Et(n))&&("fixed"===Ot(n).position||Vt(n,t))}function $t(e,t,n){const r=mt(t),o=dt(t),i="fixed"===n,a=Mt(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=ze(0);function c(){l.x=zt(o)}if(r||!r&&!i)if(("body"!==ut(t)||yt(o))&&(s=Tt(t)),r){const e=Mt(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&c();i&&!r&&o&&c();const u=!o||r||i?ze(0):Ht(o,s);return{x:a.left+s.scrollLeft-l.x-u.x,y:a.top+s.scrollTop-l.y-u.y,width:a.width,height:a.height}}function Bt(e){return"static"===Ot(e).position}function Ut(e,t){if(!mt(e)||"fixed"===Ot(e).position)return null;if(t)return t(e);let n=e.offsetParent;return dt(e)===n&&(n=n.ownerDocument.body),n}function Kt(e,t){const n=ft(e);if(wt(e))return n;if(!mt(e)){let t=Pt(e);for(;t&&!Et(t);){if(ht(t)&&!Bt(t))return t;t=Pt(t)}return n}let r=Ut(e,t);for(;r&&vt(r)&&Bt(r);)r=Ut(r,t);return r&&Et(r)&&Bt(r)&&!At(r)?n:r||function(e){let t=Pt(e);for(;mt(t)&&!Et(t);){if(At(t))return t;if(wt(t))return null;t=Pt(t)}return null}(e)||n}const Yt={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=dt(r),s=!!t&&wt(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=ze(1);const u=ze(0),f=mt(r);if((f||!f&&!i)&&(("body"!==ut(r)||yt(a))&&(l=Tt(r)),f)){const e=Mt(r);c=Ft(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const d=!a||f||i?ze(0):Ht(a,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+d.x,y:n.y*c.y-l.scrollTop*c.y+u.y+d.y}},getDocumentElement:dt,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?wt(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=Nt(e,[],!1).filter(e=>ht(e)&&"body"!==ut(e)),o=null;const i="fixed"===Ot(e).position;let a=i?Pt(e):e;for(;ht(a)&&!Et(a);){const t=Ot(a),n=At(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&("absolute"===o.position||"fixed"===o.position)||yt(a)&&!n&&Vt(e,a))?r=r.filter(e=>e!==a):o=t,a=Pt(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=Wt(t,i[0],o);let s=a.top,l=a.right,c=a.bottom,u=a.left;for(let f=1;f<i.length;f++){const e=Wt(t,i[f],o);s=_e(e.top,s),l=Fe(e.right,l),c=Fe(e.bottom,c),u=_e(e.left,u)}return{width:l-u,height:c-s,x:u,y:s}},getOffsetParent:Kt,getElementRects:async function(e){const t=this.getOffsetParent||Kt,n=this.getDimensions,r=await n(e.floating);return{reference:$t(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}=kt(e);return{width:t,height:n}},getScale:Ft,isElement:ht,isRTL:function(e){return"rtl"===Ot(e).direction}};function Gt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xt(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=Lt(e),u=o||i?[...c?Nt(c):[],...t?Nt(t):[]]:[];u.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)});const f=c&&s?function(e,t){let n,r=null;const o=dt(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const c=e.getBoundingClientRect(),{left:u,top:f,width:d,height:p}=c;if(s||t(),!d||!p)return;const h={rootMargin:-Me(f)+"px "+-Me(o.clientWidth-(u+d))+"px "+-Me(o.clientHeight-(f+p))+"px "+-Me(u)+"px",threshold:_e(0,Fe(1,l))||1};let m=!0;function g(t){const r=t[0].intersectionRatio;if(r!==l){if(!m)return a();r?a(!1,r):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==r||Gt(c,e.getBoundingClientRect())||a(),m=!1}try{r=new IntersectionObserver(g,{...h,root:o.ownerDocument})}catch(y){r=new IntersectionObserver(g,h)}r.observe(e)}(!0),i}(c,n):null;let d,p=-1,h=null;a&&(h=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),c&&!l&&h.observe(c),t&&h.observe(t));let m=l?Mt(e):null;return l&&function t(){const r=Mt(e);m&&!Gt(m,r)&&n();m=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==f||f(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(d)}}const qt=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:s}=t,l=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=$e(n),s=Be(n),l="y"===Ye(n),c=lt.has(a)?-1:1,u=i&&l?-1:1,f=Ve(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:h}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&"number"==typeof h&&(p="end"===s?-1*h:h),l?{x:p*u,y:d*c}:{x:d*c,y:p*u}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}},Zt=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:s=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=Ve(e,t),u={x:n,y:r},f=await i.detectOverflow(t,c),d=Ye($e(o)),p=Ue(d);let h=u[p],m=u[d];if(a){const e="y"===p?"bottom":"right";h=We(h+f["y"===p?"top":"left"],h,h-f[e])}if(s){const e="y"===d?"bottom":"right";m=We(m+f["y"===d?"top":"left"],m,m-f[e])}const g=l.fn({...t,[p]:h,[d]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:a,[d]:s}}}}}},Jt=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:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=Ve(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=$e(o),v=Ye(s),w=$e(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),b=d||(w||!m?[tt(s)]:function(e){const t=tt(e);return[Xe(e),t,Xe(t)]}(s)),R="none"!==h;!d&&R&&b.push(...et(s,m,h,x));const S=[s,...b],A=await l.detectOverflow(t,g),C=[];let E=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&C.push(A[y]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=Be(e),o=Ge(e),i=Ke(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=tt(a)),[a,tt(a)]}(o,a,x);C.push(A[e[0]],A[e[1]])}if(E=[...E,{placement:o,overflows:C}],!C.every(e=>e<=0)){var O,T;const e=((null==(O=i.flip)?void 0:O.index)||0)+1,t=S[e];if(t){if(!("alignment"===f&&v!==Ye(t))||E.every(e=>Ye(e.placement)!==v||e.overflows[0]>0))return{data:{index:e,overflows:E},reset:{placement:t}}}let n=null==(T=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:T.placement;if(!n)switch(p){case"bestFit":{var P;const e=null==(P=E.filter(e=>{if(R){const t=Ye(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:P[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},Qt=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:s}=t,{apply:l=()=>{},...c}=Ve(e,t),u=await a.detectOverflow(t,c),f=$e(o),d=Be(o),p="y"===Ye(o),{width:h,height:m}=i.floating;let g,y;"top"===f||"bottom"===f?(g=f,y=d===(await(null==a.isRTL?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(y=f,g="end"===d?"top":"bottom");const v=m-u.top-u.bottom,w=h-u.left-u.right,x=Fe(m-u[g],v),b=Fe(h-u[y],w),R=!t.middlewareData.shift;let S=x,A=b;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(A=w),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(S=v),R&&!d){const e=_e(u.left,0),t=_e(u.right,0),n=_e(u.top,0),r=_e(u.bottom,0);p?A=h-2*(0!==e||0!==t?e+t:_e(u.left,u.right)):S=m-2*(0!==n||0!==r?n+r:_e(u.top,u.bottom))}await l({...t,availableWidth:A,availableHeight:S});const C=await a.getDimensions(s.floating);return h!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}},en=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=Ve(e,t);switch(o){case"referenceHidden":{const e=at(await r.detectOverflow(t,{...i,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:st(e)}}}case"escaped":{const e=at(await r.detectOverflow(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:st(e)}}}default:return{}}}}},tn=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=Ve(e,t)||{};if(null==c)return{};const f=nt(u),d={x:n,y:r},p=Ge(o),h=Ke(p),m=await a.getDimensions(c),g="y"===p,y=g?"top":"left",v=g?"bottom":"right",w=g?"clientHeight":"clientWidth",x=i.reference[h]+i.reference[p]-d[p]-i.floating[h],b=d[p]-i.reference[p],R=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let S=R?R[w]:0;S&&await(null==a.isElement?void 0:a.isElement(R))||(S=s.floating[w]||i.floating[h]);const A=x/2-b/2,C=S/2-m[h]/2-1,E=Fe(f[y],C),O=Fe(f[v],C),T=E,P=S-m[h]-O,j=S/2-m[h]/2+A,N=We(T,j,P),D=!l.arrow&&null!=Be(o)&&j!==N&&i.reference[h]/2-(j<T?E:O)-m[h]/2<0,k=D?j<T?j-T:j-P:0;return{[p]:d[p]+k,data:{[p]:N,centerOffset:j-N-k,...D&&{alignmentOffset:k}},reset:D}}}),nn=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=Ve(e,t),u={x:n,y:r},f=Ye(o),d=Ue(f);let p=u[d],h=u[f];const m=Ve(s,t),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){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=lt.has($e(o)),n=i.reference[f]-i.floating[e]+(t&&(null==(y=a.offset)?void 0:y[f])||0)+(t?0:g.crossAxis),r=i.reference[f]+i.reference[e]+(t?0:(null==(v=a.offset)?void 0:v[f])||0)-(t?g.crossAxis:0);h<n?h=n:h>r&&(h=r)}return{[d]:p,[f]:h}}}},rn=(e,t,n)=>{const r=new Map,o={platform:Yt,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=a.detectOverflow?a:{...a,detectOverflow:it},l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=ot(c,r,l),d=r,p=0;const h={};for(let m=0;m<i.length;m++){const n=i[m];if(!n)continue;const{name:g,fn:y}=n,{x:v,y:w,data:x,reset:b}=await y({x:u,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:h,rects:c,platform:s,elements:{reference:e,floating:t}});u=null!=v?v:u,f=null!=w?w:f,h[g]={...h[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:u,y:f}=ot(c,d,l))),m=-1)}return{x:u,y:f,placement:d,strategy:o,middlewareData:h}})(e,t,{...o,platform:i})};var on="undefined"!=typeof document?e.useLayoutEffect:function(){};function an(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(!an(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)&&!an(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function sn(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ln(e,t){const n=sn(e);return Math.round(t*n)/n}function cn(t){const n=e.useRef(t);return on(()=>{n.current=t}),n}const un=(e,t)=>{const n=qt(e);return{name:n.name,fn:n.fn,options:[e,t]}},fn=(e,t)=>{const n=Zt(e);return{name:n.name,fn:n.fn,options:[e,t]}},dn=(e,t)=>{const n=Jt(e);return{name:n.name,fn:n.fn,options:[e,t]}},pn=(e,t)=>{const n=Qt(e);return{name:n.name,fn:n.fn,options:[e,t]}},hn=(e,t)=>{const n=en(e);return{name:n.name,fn:n.fn,options:[e,t]}},mn=(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?tn({element:n.current,padding:r}).fn(t):{}:n?tn({element:n,padding:r}).fn(t):{};var o}}))(e);return{name:n.name,fn:n.fn,options:[e,t]}};var gn=e.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...a}=e;return o.jsx(u.svg,{...a,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});gn.displayName="Arrow";var yn=gn;function vn(t){const[n,r]=e.useState(void 0);return y(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const e=new ResizeObserver(e=>{if(!Array.isArray(e))return;if(!e.length)return;const n=e[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=t.offsetWidth,i=t.offsetHeight;r({width:o,height:i})});return e.observe(t,{box:"border-box"}),()=>e.unobserve(t)}r(void 0)},[t]),n}var wn="Popper",[xn,bn]=a(wn),[Rn,Sn]=xn(wn),An=t=>{const{__scopePopper:n,children:r}=t,[i,a]=e.useState(null);return o.jsx(Rn,{scope:n,anchor:i,onAnchorChange:a,children:r})};An.displayName=wn;var Cn="PopperAnchor",En=e.forwardRef((t,n)=>{const{__scopePopper:r,virtualRef:i,...a}=t,s=Sn(Cn,r),c=e.useRef(null),f=l(n,c),d=e.useRef(null);return e.useEffect(()=>{const e=d.current;d.current=(null==i?void 0:i.current)||c.current,e!==d.current&&s.onAnchorChange(d.current)}),i?null:o.jsx(u.div,{...a,ref:f})});En.displayName=Cn;var On="PopperContent",[Tn,Pn]=xn(On),jn=e.forwardRef((t,n)=>{var r,i,a,s,c,f;const{__scopePopper:d,side:h="bottom",sideOffset:m=0,align:v="center",alignOffset:w=0,arrowPadding:x=0,avoidCollisions:b=!0,collisionBoundary:R=[],collisionPadding:S=0,sticky:A="partial",hideWhenDetached:C=!1,updatePositionStrategy:E="optimized",onPlaced:O,...T}=t,P=Sn(On,d),[j,N]=e.useState(null),D=l(n,e=>N(e)),[k,L]=e.useState(null),F=vn(k),_=(null==F?void 0:F.width)??0,I=(null==F?void 0:F.height)??0,M=h+("center"!==v?"-"+v:""),z="number"==typeof S?S:{top:0,right:0,bottom:0,left:0,...S},H=Array.isArray(R)?R:[R],W=H.length>0,V={padding:z,boundary:H.filter(Ln),altBoundary:W},{refs:$,floatingStyles:B,placement:U,isPositioned:K,middlewareData:Y}=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:a,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=t,[f,d]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[p,h]=e.useState(o);an(p,o)||h(o);const[m,y]=e.useState(null),[v,w]=e.useState(null),x=e.useCallback(e=>{e!==A.current&&(A.current=e,y(e))},[]),b=e.useCallback(e=>{e!==C.current&&(C.current=e,w(e))},[]),R=a||m,S=s||v,A=e.useRef(null),C=e.useRef(null),E=e.useRef(f),O=null!=c,T=cn(c),P=cn(i),j=cn(u),N=e.useCallback(()=>{if(!A.current||!C.current)return;const e={placement:n,strategy:r,middleware:p};P.current&&(e.platform=P.current),rn(A.current,C.current,e).then(e=>{const t={...e,isPositioned:!1!==j.current};D.current&&!an(E.current,t)&&(E.current=t,g.flushSync(()=>{d(t)}))})},[p,n,r,P,j]);on(()=>{!1===u&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[u]);const D=e.useRef(!1);on(()=>(D.current=!0,()=>{D.current=!1}),[]),on(()=>{if(R&&(A.current=R),S&&(C.current=S),R&&S){if(T.current)return T.current(R,S,N);N()}},[R,S,N,T,O]);const k=e.useMemo(()=>({reference:A,floating:C,setReference:x,setFloating:b}),[x,b]),L=e.useMemo(()=>({reference:R,floating:S}),[R,S]),F=e.useMemo(()=>{const e={position:r,left:0,top:0};if(!L.floating)return e;const t=ln(L.floating,f.x),n=ln(L.floating,f.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...sn(L.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,L.floating,f.x,f.y]);return e.useMemo(()=>({...f,update:N,refs:k,elements:L,floatingStyles:F}),[f,N,k,L,F])}({strategy:"fixed",placement:M,whileElementsMounted:(...e)=>Xt(...e,{animationFrame:"always"===E}),elements:{reference:P.anchor},middleware:[un({mainAxis:m+I,alignmentAxis:w}),b&&fn({mainAxis:!0,crossAxis:!1,limiter:"partial"===A?{fn:nn(G).fn,options:[G,X]}:void 0,...V}),b&&dn({...V}),pn({...V,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`)}}),k&&mn({element:k,padding:x}),Fn({arrowWidth:_,arrowHeight:I}),C&&hn({strategy:"referenceHidden",...V})]});var G,X;const[q,Z]=_n(U),J=p(O);y(()=>{K&&(null==J||J())},[K,J]);const Q=null==(r=Y.arrow)?void 0:r.x,ee=null==(i=Y.arrow)?void 0:i.y,te=0!==(null==(a=Y.arrow)?void 0:a.centerOffset),[ne,re]=e.useState();return y(()=>{j&&re(window.getComputedStyle(j).zIndex)},[j]),o.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:K?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[null==(s=Y.transformOrigin)?void 0:s.x,null==(c=Y.transformOrigin)?void 0:c.y].join(" "),...(null==(f=Y.hide)?void 0:f.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx(Tn,{scope:d,placedSide:q,onArrowChange:L,arrowX:Q,arrowY:ee,shouldHideArrow:te,children:o.jsx(u.div,{"data-side":q,"data-align":Z,...T,ref:D,style:{...T.style,animation:K?void 0:"none"}})})})});jn.displayName=On;var Nn="PopperArrow",Dn={top:"bottom",right:"left",bottom:"top",left:"right"},kn=e.forwardRef(function(e,t){const{__scopePopper:n,...r}=e,i=Pn(Nn,n),a=Dn[i.placedSide];return o.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:o.jsx(yn,{...r,ref:t,style:{...r.style,display:"block"}})})});function Ln(e){return null!==e}kn.displayName=Nn;var Fn=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o;const{placement:i,rects:a,middlewareData:s}=t,l=0!==(null==(n=s.arrow)?void 0:n.centerOffset),c=l?0:e.arrowWidth,u=l?0:e.arrowHeight,[f,d]=_n(i),p={start:"0%",center:"50%",end:"100%"}[d],h=((null==(r=s.arrow)?void 0:r.x)??0)+c/2,m=((null==(o=s.arrow)?void 0:o.y)??0)+u/2;let g="",y="";return"bottom"===f?(g=l?p:`${h}px`,y=-u+"px"):"top"===f?(g=l?p:`${h}px`,y=`${a.floating.height+u}px`):"right"===f?(g=-u+"px",y=l?p:`${m}px`):"left"===f&&(g=`${a.floating.width+u}px`,y=l?p:`${m}px`),{data:{x:g,y:y}}}});function _n(e){const[t,n="center"]=e.split("-");return[t,n]}var In=An,Mn=En,zn=jn,Hn=kn;function Wn(e,[t,n]){return Math.min(n,Math.max(t,e))}export{Mn as A,zn as C,de as I,In as R,H as S,je as T,W as U,Ne as a,De as b,ke as c,bn as d,ne as e,K as f,fe as g,Hn as h,z as i,Wn as j,vn as k,G as u};
|