@tom2012/cc-web 2026.4.26-b → 2026.4.26-d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +1 -1
  2. package/backend/dist/approval-manager.d.ts.map +1 -1
  3. package/backend/dist/approval-manager.js +19 -1
  4. package/backend/dist/approval-manager.js.map +1 -1
  5. package/backend/dist/hooks-manager.d.ts.map +1 -1
  6. package/backend/dist/hooks-manager.js +10 -1
  7. package/backend/dist/hooks-manager.js.map +1 -1
  8. package/backend/dist/index.d.ts.map +1 -1
  9. package/backend/dist/index.js +99 -120
  10. package/backend/dist/index.js.map +1 -1
  11. package/backend/dist/notify-service.d.ts.map +1 -1
  12. package/backend/dist/notify-service.js +55 -18
  13. package/backend/dist/notify-service.js.map +1 -1
  14. package/backend/dist/plugin-manager.d.ts +3 -1
  15. package/backend/dist/plugin-manager.d.ts.map +1 -1
  16. package/backend/dist/plugin-manager.js +6 -1
  17. package/backend/dist/plugin-manager.js.map +1 -1
  18. package/backend/dist/routes/claude.d.ts.map +1 -1
  19. package/backend/dist/routes/claude.js +2 -1
  20. package/backend/dist/routes/claude.js.map +1 -1
  21. package/backend/dist/routes/filesystem.d.ts.map +1 -1
  22. package/backend/dist/routes/filesystem.js +88 -25
  23. package/backend/dist/routes/filesystem.js.map +1 -1
  24. package/backend/dist/routes/git.d.ts.map +1 -1
  25. package/backend/dist/routes/git.js +15 -1
  26. package/backend/dist/routes/git.js.map +1 -1
  27. package/backend/dist/routes/notify.d.ts.map +1 -1
  28. package/backend/dist/routes/notify.js +3 -7
  29. package/backend/dist/routes/notify.js.map +1 -1
  30. package/backend/dist/routes/plugin-bridge.d.ts.map +1 -1
  31. package/backend/dist/routes/plugin-bridge.js +53 -3
  32. package/backend/dist/routes/plugin-bridge.js.map +1 -1
  33. package/backend/dist/routes/projects.d.ts.map +1 -1
  34. package/backend/dist/routes/projects.js +22 -1
  35. package/backend/dist/routes/projects.js.map +1 -1
  36. package/frontend/dist/assets/{AssistantMessageContent-BBXSX58q.js → AssistantMessageContent-DqHct3Ck.js} +2 -2
  37. package/frontend/dist/assets/{GraphPreview-BAnpFmtm.js → GraphPreview-DDzwYb3w.js} +2 -2
  38. package/frontend/dist/assets/MobilePage-5nKL4ztD.js +14 -0
  39. package/frontend/dist/assets/{OfficePreview-C6EJB80i.js → OfficePreview-BUzkkas_.js} +2 -2
  40. package/frontend/dist/assets/{ProjectPage-fWJrKu-y.js → ProjectPage-CNFXiRv-.js} +5 -5
  41. package/frontend/dist/assets/SettingsPage-Dhmz6Kys.js +13 -0
  42. package/frontend/dist/assets/{SkillHubPage-DJzYMG0j.js → SkillHubPage-DRLSM0ND.js} +3 -3
  43. package/frontend/dist/assets/{chevron-down-CxmD4ySz.js → chevron-down-CtzzxYuu.js} +1 -1
  44. package/frontend/dist/assets/{chevron-up-BznxDhNi.js → chevron-up-CBkngNQ6.js} +1 -1
  45. package/frontend/dist/assets/index-BrpW1kym.js +75 -0
  46. package/frontend/dist/assets/index-CR3beFmz.css +1 -0
  47. package/frontend/dist/assets/{index-BptnURrX.js → index-UPu5taSd.js} +1 -1
  48. package/frontend/dist/assets/index-YAu_Jeuq.js +13 -0
  49. package/frontend/dist/assets/{jszip.min-CfribT02.js → jszip.min-CIqhAS2U.js} +1 -1
  50. package/frontend/dist/assets/{search-BPzU-LtZ.js → search-W7udjbkr.js} +1 -1
  51. package/frontend/dist/index.html +2 -2
  52. package/package.json +1 -1
  53. package/frontend/dist/assets/MobilePage-BR1R_xht.js +0 -14
  54. package/frontend/dist/assets/SettingsPage-BxT6q4Fq.js +0 -13
  55. package/frontend/dist/assets/index-Big9FXD0.css +0 -1
  56. package/frontend/dist/assets/index-CxHOCf_s.js +0 -75
  57. package/frontend/dist/assets/index-DwNsYVM3.js +0 -1
@@ -0,0 +1,13 @@
1
+ import{c as e,r as s,$ as t,b4 as n,j as a,a1 as r,a0 as o,W as l,d as i,U as c,b5 as d,aS as u,Z as h,b6 as m,V as p,a2 as x,a4 as f,a5 as g,a6 as v,a7 as y,x as b,aE as j,aG as w,b7 as _,t as N,al as k,I as S,B as C,aL as R,X as P,D as T,b8 as E,b9 as I,ba as M,bb as D,u as H,bc as L,T as O,bd as A,be as V,bf as F,bg as B,bh as z,aF as W,bi as q,bj as K,h as U,S as G,bk as $,aH as Z,K as X,s as Q,bl as Y}from"./index-BrpW1kym.js";import{j as J,u as ee,R as se,d as te,f as ne,A as ae,C as re,i as oe,h as le,S as ie,U as ce,T as de,a as ue,b as he,c as me}from"./index-YAu_Jeuq.js";import{C as pe}from"./chevron-down-CtzzxYuu.js";import{C as xe,a as fe}from"./chevron-up-CBkngNQ6.js";
2
+ /**
3
+ * @license lucide-react v0.309.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const ge=e("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]),ve=e("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),ye=e("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]),be=e("ExternalLink",[["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}],["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["line",{x1:"10",x2:"21",y1:"14",y2:"3",key:"18c3s4"}]]),je=e("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),we=e("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]),_e=e("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]),Ne=e("UploadCloud",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M12 12v9",key:"192myk"}],["path",{d:"m16 16-4-4-4 4",key:"119tzi"}]]);
8
+ /**
9
+ * @license lucide-react v0.309.0 - ISC
10
+ *
11
+ * This source code is licensed under the ISC license.
12
+ * See the LICENSE file in the root directory of this source tree.
13
+ */function ke(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 Se="Switch",[Ce]=l(Se),[Re,Pe]=Ce(Se),Te=s.forwardRef((e,l)=>{const{__scopeSwitch:i,name:c,checked:d,defaultChecked:u,required:h,disabled:m,value:p="on",onCheckedChange:x,form:f,...g}=e,[v,y]=s.useState(null),b=t(l,e=>y(e)),j=s.useRef(!1),w=!v||(f||!!v.closest("form")),[_,N]=n({prop:d,defaultProp:u??!1,onChange:x,caller:Se});return a.jsxs(Re,{scope:i,checked:_,disabled:m,children:[a.jsx(r.button,{type:"button",role:"switch","aria-checked":_,"aria-required":h,"data-state":De(_),"data-disabled":m?"":void 0,disabled:m,value:p,...g,ref:b,onClick:o(e.onClick,e=>{N(e=>!e),w&&(j.current=e.isPropagationStopped(),j.current||e.stopPropagation())})}),w&&a.jsx(Me,{control:v,bubbles:!j.current,name:c,value:p,checked:_,required:h,disabled:m,form:f,style:{transform:"translateX(-100%)"}})]})});Te.displayName=Se;var Ee="SwitchThumb",Ie=s.forwardRef((e,s)=>{const{__scopeSwitch:t,...n}=e,o=Pe(Ee,t);return a.jsx(r.span,{"data-state":De(o.checked),"data-disabled":o.disabled?"":void 0,...n,ref:s})});Ie.displayName=Ee;var Me=s.forwardRef(({__scopeSwitch:e,control:n,checked:r,bubbles:o=!0,...l},i)=>{const c=s.useRef(null),d=t(c,i),u=ke(r),h=J(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:o});t.call(e,r),e.dispatchEvent(s)}},[u,r,o]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...l,tabIndex:-1,ref:d,style:{...l.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function De(e){return e?"checked":"unchecked"}Me.displayName="SwitchBubbleInput";var He=Te,Le=Ie;const Oe=s.forwardRef(({className:e,...s},t)=>a.jsx(He,{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(Le,{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 Ae(e){const t=Ve(e),n=s.forwardRef((e,n)=>{const{children:r,...o}=e,l=s.Children.toArray(r),i=l.find(Be);if(i){const e=i.props.children,r=l.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,{...o,ref:n,children:s.isValidElement(e)?s.cloneElement(e,void 0,r):null})}return a.jsx(t,{...o,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=He.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"],qe=[" ","Enter"],Ke="Select",[Ue,Ge,$e]=ne(Ke),[Ze]=l(Ke,[$e,te]),Xe=te(),[Qe,Ye]=Ze(Ke),[Je,es]=Ze(Ke),ss=e=>{const{__scopeSelect:t,children:r,open:o,defaultOpen:l,onOpenChange:i,value:c,defaultValue:u,onValueChange:h,dir:m,name:p,autoComplete:x,disabled:f,required:g,form:v}=e,y=Xe(t),[b,j]=s.useState(null),[w,_]=s.useState(null),[N,k]=s.useState(!1),S=ee(m),[C,R]=n({prop:o,defaultProp:l??!1,onChange:i,caller:Ke}),[P,T]=n({prop:c,defaultProp:u,onChange:h,caller:Ke}),E=s.useRef(null),I=!b||(v||!!b.closest("form")),[M,D]=s.useState(new Set),H=Array.from(M).map(e=>e.props.value).join(";");return a.jsx(se,{...y,children:a.jsxs(Qe,{required:g,scope:t,trigger:b,onTriggerChange:j,valueNode:w,onValueNodeChange:_,valueNodeHasChildren:N,onValueNodeHasChildrenChange:k,contentId:d(),value:P,onValueChange:T,open:C,onOpenChange:R,dir:S,triggerPointerDownPosRef:E,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})}),I?a.jsxs(Bs,{"aria-hidden":!0,required:g,tabIndex:-1,name:p,autoComplete:x,value:P,onChange:e=>T(e.target.value),disabled:f,form:v,children:[void 0===P?a.jsx("option",{value:""}):null,Array.from(M)]},H):null]})})};ss.displayName=Ke;var ts="SelectTrigger",ns=s.forwardRef((e,n)=>{const{__scopeSelect:l,disabled:i=!1,...c}=e,d=Xe(l),u=Ye(ts,l),h=u.disabled||i,m=t(n,u.onTriggerChange),p=Ge(l),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=qs(s,e,t);void 0!==n&&u.onValueChange(n.value)}),y=e=>{h||(u.onOpenChange(!0),v()),e&&(u.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return a.jsx(ae,{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:o(c.onClick,e=>{e.currentTarget.focus(),"mouse"!==x.current&&y(e)}),onPointerDown:o(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&&(y(e),e.preventDefault())}),onKeyDown:o(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)&&(y(),e.preventDefault())})})})});ns.displayName=ts;var as="SelectValue",rs=s.forwardRef((e,s)=>{const{__scopeSelect:n,className:o,style:l,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 os=s.forwardRef((e,s)=>{const{__scopeSelect:t,children:n,...o}=e;return a.jsx(r.span,{"aria-hidden":!0,...o,ref:s,children:n||"▼"})});os.displayName="SelectIcon";var ls=e=>a.jsx(h,{asChild:!0,...e});ls.displayName="SelectPortal";var is="SelectContent",cs=s.forwardRef((e,t)=>{const n=Ye(is,e.__scopeSelect),[r,o]=s.useState();if(u(()=>{o(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=Ae("SelectContent.RemoveScroll"),ps=s.forwardRef((e,n)=>{const{__scopeSelect:r,position:l="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:c,onPointerDownOutside:d,side:u,sideOffset:h,align:m,alignOffset:p,arrowPadding:b,collisionBoundary:j,collisionPadding:w,sticky:_,hideWhenDetached:N,avoidCollisions:k,...S}=e,C=Ye(is,r),[R,P]=s.useState(null),[T,E]=s.useState(null),I=t(n,e=>P(e)),[M,D]=s.useState(null),[H,L]=s.useState(null),O=Ge(r),[A,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&&T&&(T.scrollTop=0),r===n&&T&&(T.scrollTop=T.scrollHeight),null==r||r.focus(),document.activeElement!==a)return}},[O,T]),z=s.useCallback(()=>B([M,R]),[B,M,R]);s.useEffect(()=>{A&&z()},[A,z]);const{onOpenChange:W,triggerPointerDownPosRef:q}=C;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=q.current)?void 0:t.x)??0)),y:Math.abs(Math.round(s.pageY)-((null==(n=q.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),q.current=null};return null!==q.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,q]),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=qs(s,e,t);n&&setTimeout(()=>n.ref.current.focus())}),G=s.useCallback((e,s,t)=>{const n=!F.current&&!t;(void 0!==C.value&&C.value===s||n)&&(D(e),n&&(F.current=!0))},[C.value]),$=s.useCallback(()=>null==R?void 0:R.focus(),[R]),Z=s.useCallback((e,s,t)=>{const n=!F.current&&!t;(void 0!==C.value&&C.value===s||n)&&L(e)},[C.value]),X="popper"===l?fs:xs,Q=X===fs?{side:u,sideOffset:h,align:m,alignOffset:p,arrowPadding:b,collisionBoundary:j,collisionPadding:w,sticky:_,hideWhenDetached:N,avoidCollisions:k}:{};return a.jsx(us,{scope:r,content:R,viewport:T,onViewportChange:E,itemRefCallback:G,selectedItem:M,onItemLeave:$,itemTextRefCallback:Z,focusSelectedItem:z,selectedItemText:H,position:l,isPositioned:A,searchRef:K,children:a.jsx(g,{as:ms,allowPinchZoom:!0,children:a.jsx(v,{asChild:!0,trapped:C.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:o(i,e=>{var s;null==(s=C.trigger)||s.focus({preventScroll:!0}),e.preventDefault()}),children:a.jsx(y,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:a.jsx(X,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:e=>e.preventDefault(),...S,...Q,onPlaced:()=>V(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:o(S.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:o,onPlaced:l,...i}=e,c=Ye(is,o),d=hs(is,o),[h,m]=s.useState(null),[p,x]=s.useState(null),f=t(n,e=>x(e)),g=Ge(o),v=s.useRef(!1),y=s.useRef(!0),{viewport:b,selectedItem:j,selectedItemText:w,focusSelectedItem:_}=d,N=s.useCallback(()=>{if(c.trigger&&c.valueNode&&h&&p&&b&&j&&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,o=e.left-r,l=e.width+o,i=Math.max(l,s.width),c=window.innerWidth-ds,d=oe(r,[ds,Math.max(ds,c-i)]);h.style.minWidth=l+"px",h.style.left=d+"px"}else{const a=s.right-n.right,r=window.innerWidth-t.right-a,o=window.innerWidth-e.right-r,l=e.width+o,i=Math.max(l,s.width),c=window.innerWidth-ds,d=oe(r,[ds,Math.max(ds,c-i)]);h.style.minWidth=l+"px",h.style.right=d+"px"}const a=g(),r=window.innerHeight-2*ds,o=b.scrollHeight,i=window.getComputedStyle(p),d=parseInt(i.borderTopWidth,10),u=parseInt(i.paddingTop,10),m=parseInt(i.borderBottomWidth,10),x=d+u+o+parseInt(i.paddingBottom,10)+m,f=Math.min(5*j.offsetHeight,x),y=window.getComputedStyle(b),_=parseInt(y.paddingTop,10),N=parseInt(y.paddingBottom,10),k=e.top+e.height/2-ds,S=r-k,C=j.offsetHeight/2,R=d+u+(j.offsetTop+C),P=x-R;if(R<=k){const e=a.length>0&&j===a[a.length-1].ref.current;h.style.bottom="0px";const s=p.clientHeight-b.offsetTop-b.offsetHeight,t=R+Math.max(S,C+(e?N:0)+s+m);h.style.height=t+"px"}else{const e=a.length>0&&j===a[0].ref.current;h.style.top="0px";const s=Math.max(k,d+b.offsetTop+(e?_:0)+C)+P;h.style.height=s+"px",b.scrollTop=R-k+b.offsetTop}h.style.margin=`${ds}px 0`,h.style.minHeight=f+"px",h.style.maxHeight=r+"px",null==l||l(),requestAnimationFrame(()=>v.current=!0)}},[g,c.trigger,c.valueNode,h,p,b,j,w,c.dir,l]);u(()=>N(),[N]);const[k,S]=s.useState();u(()=>{p&&S(window.getComputedStyle(p).zIndex)},[p]);const C=s.useCallback(e=>{e&&!0===y.current&&(N(),null==_||_(),y.current=!1)},[N,_]);return a.jsx(gs,{scope:o,contentWrapper:h,shouldExpandOnScrollRef:v,onScrollButtonChange:C,children:a.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},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,...o}=e,l=Xe(t);return a.jsx(re,{...l,...o,ref:s,align:n,collisionPadding:r,style:{boxSizing:"border-box",...o.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,{}),ys="SelectViewport",bs=s.forwardRef((e,n)=>{const{__scopeSelect:l,nonce:i,...c}=e,d=hs(ys,l),u=vs(ys,l),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:l,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:o(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),o=Math.max(a,r);if(o<n){const a=o+e,r=Math.min(n,a),l=a-r;t.style.height=r+"px","0px"===t.style.bottom&&(s.scrollTop=l>0?l:0,t.style.justifyContent="flex-end")}}}m.current=s.scrollTop})})})]})});bs.displayName=ys;var js="SelectGroup",[ws,_s]=Ze(js);s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e,o=d();return a.jsx(ws,{scope:t,id:o,children:a.jsx(r.div,{role:"group","aria-labelledby":o,...n,ref:s})})}).displayName=js;var Ns="SelectLabel",ks=s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e,o=_s(Ns,t);return a.jsx(r.div,{id:o.id,...n,ref:s})});ks.displayName=Ns;var Ss="SelectItem",[Cs,Rs]=Ze(Ss),Ps=s.forwardRef((e,n)=>{const{__scopeSelect:l,value:i,disabled:c=!1,textValue:u,...h}=e,m=Ye(Ss,l),p=hs(Ss,l),x=m.value===i,[f,g]=s.useState(u??""),[v,y]=s.useState(!1),b=t(n,e=>{var s;return null==(s=p.itemRefCallback)?void 0:s.call(p,e,i,c)}),j=d(),w=s.useRef("touch"),_=()=>{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(Cs,{scope:l,value:i,disabled:c,textId:j,isSelected:x,onItemTextChange:s.useCallback(e=>{g(s=>s||((null==e?void 0:e.textContent)??"").trim())},[]),children:a.jsx(Ue.ItemSlot,{scope:l,value:i,disabled:c,textValue:f,children:a.jsx(r.div,{role:"option","aria-labelledby":j,"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:o(h.onFocus,()=>y(!0)),onBlur:o(h.onBlur,()=>y(!1)),onClick:o(h.onClick,()=>{"mouse"!==w.current&&_()}),onPointerUp:o(h.onPointerUp,()=>{"mouse"===w.current&&_()}),onPointerDown:o(h.onPointerDown,e=>{w.current=e.pointerType}),onPointerMove:o(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:o(h.onPointerLeave,e=>{var s;e.currentTarget===document.activeElement&&(null==(s=p.onItemLeave)||s.call(p))}),onKeyDown:o(h.onKeyDown,e=>{var s;""!==(null==(s=p.searchRef)?void 0:s.current)&&" "===e.key||(qe.includes(e.key)&&_()," "===e.key&&e.preventDefault())})})})})});Ps.displayName=Ss;var Ts="SelectItemText",Es=s.forwardRef((e,n)=>{const{__scopeSelect:o,className:l,style:i,...c}=e,d=Ye(Ts,o),h=hs(Ts,o),p=Rs(Ts,o),x=es(Ts,o),[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)}),y=null==f?void 0:f.textContent,b=s.useMemo(()=>a.jsx("option",{value:p.value,disabled:p.disabled,children:y},p.value),[p.disabled,p.value,y]),{onNativeOptionAdd:j,onNativeOptionRemove:w}=x;return u(()=>(j(b),()=>w(b)),[j,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]})});Es.displayName=Ts;var Is="SelectItemIndicator",Ms=s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e;return Rs(Is,t).isSelected?a.jsx(r.span,{"aria-hidden":!0,...n,ref:s}):null});Ms.displayName=Is;var Ds="SelectScrollUpButton",Hs=s.forwardRef((e,n)=>{const r=hs(Ds,e.__scopeSelect),o=vs(Ds,e.__scopeSelect),[l,i]=s.useState(!1),c=t(n,o.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]),l?a.jsx(As,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:s}=r;e&&s&&(e.scrollTop=e.scrollTop-s.offsetHeight)}}):null});Hs.displayName=Ds;var Ls="SelectScrollDownButton",Os=s.forwardRef((e,n)=>{const r=hs(Ls,e.__scopeSelect),o=vs(Ls,e.__scopeSelect),[l,i]=s.useState(!1),c=t(n,o.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]),l?a.jsx(As,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:s}=r;e&&s&&(e.scrollTop=e.scrollTop+s.offsetHeight)}}):null});Os.displayName=Ls;var As=s.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:l,...i}=e,c=hs("SelectScrollButton",n),d=s.useRef(null),h=Ge(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:o(i.onPointerDown,()=>{null===d.current&&(d.current=window.setInterval(l,50))}),onPointerMove:o(i.onPointerMove,()=>{var e;null==(e=c.onItemLeave)||e.call(c),null===d.current&&(d.current=window.setInterval(l,50))}),onPointerLeave:o(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),o=Ye(Fs,t),l=hs(Fs,t);return o.open&&"popper"===l.position?a.jsx(le,{...r,...n,ref:s}):null}).displayName=Fs;var Bs=s.forwardRef(({__scopeSelect:e,value:n,...o},l)=>{const i=s.useRef(null),c=t(l,i),d=ke(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,{...o,style:{...ze,...o.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]),o=s.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return s.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,r,o]}function qs(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=(o=e,l=Math.max(a,0),o.map((e,s)=>o[(l+s)%o.length]));var o,l;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=os,Gs=ls,$s=cs,Zs=bs,Xs=ks,Qs=Ps,Ys=Es,Js=Ms,et=Hs,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 ot=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"})}));ot.displayName=et.displayName;const lt=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"})}));lt.displayName=st.displayName;const it=s.forwardRef(({className:e,children:s,position:t="popper",...n},r)=>a.jsx(Gs,{children:a.jsxs($s,{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(ot,{}),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(lt,{})]})}));it.displayName=$s.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{t:e}=j(),[t,n]=s.useState(null),[r,o]=s.useState(!0),[l,i]=s.useState(!1),[c,d]=s.useState(!1),[u,h]=s.useState(!1),[m,p]=s.useState(!1),[x,f]=s.useState(null),[g,v]=s.useState(0),[y,b]=s.useState(""),[H,L]=s.useState("");w({onStart:e=>{f(e.projectId),v(0)},onProgress:e=>{f(e.projectId),v(e.filesTransferred)},onDone:()=>{f(null),v(0)}}),s.useEffect(()=>{let s=!1;return _().then(e=>{s||(n(e),L(e.defaultExcludes.join("\n")))}).catch(s=>N.error(e("sync_section.load_failed",{message:s.message}))).finally(()=>{s||o(!1)}),()=>{s=!0}},[e]);const O=(e,s)=>{n(t=>t?{...t,[e]:s}:t)};return r||!t?a.jsx("div",{className:"text-sm text-muted-foreground",children:e("sync_section.loading")}):a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.server_section")}),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:e("sync_section.host")}),a.jsx(S,{id:"sync-host",value:t.host,onChange:e=>O("host",e.target.value),placeholder:"example.com"})]}),a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-port",children:e("sync_section.port")}),a.jsx(S,{id:"sync-port",type:"number",value:t.port,onChange:e=>O("port",Number(e.target.value)||22)})]}),a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-user",children:e("sync_section.user")}),a.jsx(S,{id:"sync-user",value:t.user,onChange:e=>O("user",e.target.value),placeholder:"tom"})]}),a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-remote",children:e("sync_section.remote_root")}),a.jsx(S,{id:"sync-remote",value:t.remoteRoot,onChange:e=>O("remoteRoot",e.target.value),placeholder:"/data/projects"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.remote_root_hint")}})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.auth_section")}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(k,{children:e("sync_section.auth_method")}),a.jsxs(nt,{value:t.authMethod,onValueChange:e=>O("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:e("sync_section.auth_password")})]})]})]}),"key"===t.authMethod?a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-key",children:e("sync_section.key_path")}),a.jsx(S,{id:"sync-key",value:t.keyPath??"",onChange:e=>O("keyPath",e.target.value),placeholder:"~/.ssh/id_rsa"})]}):a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-pw",children:e("sync_section.password")}),a.jsx(S,{id:"sync-pw",type:"password",value:y,onChange:e=>b(e.target.value),placeholder:t.passwordSet?e("sync_section.password_set_placeholder"):e("sync_section.password_unset_placeholder")}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.sshpass_hint")}})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.strategy_section")}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(k,{children:e("sync_section.direction")}),a.jsxs(nt,{value:t.direction,onValueChange:e=>O("direction",e),children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(it,{children:[a.jsx(ct,{value:"push",children:e("sync_section.push_label")}),a.jsx(ct,{value:"pull",children:e("sync_section.pull_label")}),a.jsx(ct,{value:"bidirectional",children:e("sync_section.bidirectional_label")})]})]})]}),a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(k,{htmlFor:"sync-cron",children:e("sync_section.cron_label")}),a.jsx(S,{id:"sync-cron",value:t.schedule.cron,onChange:e=>O("schedule",{...t.schedule,cron:e.target.value}),placeholder:"0 3 * * *"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.cron_hint")}})]}),a.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[a.jsx(Oe,{checked:t.schedule.enabled,onCheckedChange:e=>O("schedule",{...t.schedule,enabled:e})}),a.jsx("span",{className:"text-xs text-muted-foreground",children:e("sync_section.enable_label")})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.exclude_section")}),a.jsx("textarea",{value:H,onChange:e=>L(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.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.exclude_hint")}})]}),a.jsxs("div",{className:"flex flex-wrap gap-2 pt-2 border-t",children:[a.jsxs(C,{onClick:()=>{(async()=>{if(t){i(!0);try{const s=H.split("\n").map(e=>e.trim()).filter(Boolean),a={host:t.host,port:t.port,user:t.user,authMethod:t.authMethod,keyPath:t.keyPath,remoteRoot:t.remoteRoot,direction:t.direction,defaultExcludes:s,schedule:t.schedule};y&&"__keep__"!==y&&(a.password=y);const r=await E(a);n(r),L(r.defaultExcludes.join("\n")),b(""),N.success(e("sync_section.saved"))}catch(s){N.error(e("sync_section.save_failed",{message:s.message}))}finally{i(!1)}}})()},disabled:l,children:[l?a.jsx(R,{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"}),e("sync_section.save_button")]}),a.jsxs(C,{variant:"outline",onClick:()=>{(async()=>{d(!0);try{const s=await I();s.ok?N.success(s.message||e("sync_section.test_ok")):N.error(s.message||e("sync_section.test_failed"))}catch(s){N.error(e("sync_section.test_failed_with_reason",{message:s.message}))}finally{d(!1)}})()},disabled:c,children:[c?a.jsx(R,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(_e,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.test_button")]}),a.jsx("div",{className:"flex-1"}),u&&x&&a.jsx("span",{className:"text-xs text-muted-foreground self-center mr-1 tabular-nums",children:g>0?e("sync_section.syncing_with_files",{project:x,files:g}):e("sync_section.syncing_no_files",{project:x})}),a.jsxs(C,{variant:"outline",onClick:()=>{(async()=>{h(!0);try{const s=await M(),t=s.results.filter(e=>e.ok).length,n=s.results.filter(e=>e.skipped).length,a=s.results.filter(e=>"cancelled"===e.reason).length,r=s.total-t-n-a;a>0?N.info(e("sync_section.bulk_cancelled_toast",{ok:t,skipped:n,cancelled:a,failed:r})):N.success(e("sync_section.bulk_done_toast",{ok:t,skipped:n,failed:r}))}catch(s){N.error(e("sync_section.bulk_failed_toast",{message:s.message}))}finally{h(!1),p(!1),f(null),v(0)}})()},disabled:u,title:e("sync_section.sync_all_title"),children:[u?a.jsx(R,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(ce,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.sync_all_button")]}),u&&a.jsxs(C,{variant:"outline",onClick:()=>{(async()=>{if(u&&!m){p(!0);try{await D(),N.info(e("sync_section.cancel_requested"))}catch(s){N.error(e("sync_section.cancel_failed",{message:s.message})),p(!1)}}})()},disabled:m,title:e("sync_section.cancel_button_title"),children:[m?a.jsx(R,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(P,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.cancel_button")]})]}),a.jsxs("div",{className:"border-t pt-4 text-xs text-muted-foreground",children:["Per-project push/pull: from inside a project, click the ",a.jsx(ce,{className:"inline h-3 w-3"})," / ",a.jsx(T,{className:"inline h-3 w-3"})," buttons in the header. Or call ",a.jsx("code",{children:"POST /api/sync/project/:id"})," with body ",a.jsx("code",{children:'{ "direction": "push" }'}),"."]})]})}function ut(){const e=H(),[t,n]=s.useState(null),[r,o]=s.useState(!0),[l,i]=s.useState(""),[c,d]=s.useState(!1);s.useEffect(()=>{let e=!1;return L().then(s=>{e||n(s)}).catch(()=>{e||n({configured:!1,needsReset:!1})}).finally(()=>{e||o(!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(R,{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 A(),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:l,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=l.trim();if(e){d(!0);try{const s=await V(e);n(s),i(""),N.success("已保存")}catch(s){N.error(`保存失败: ${s.message}`)}finally{d(!1)}}else N.error("请输入 token")})()},disabled:c||!l.trim(),children:[c?a.jsx(R,{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"}),"保存"]})})]})]})}function ht(){const{t:e,i18n:s}=j();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(F.includes(t)){try{localStorage.setItem(B,t)}catch{}await s.changeLanguage(t);try{await z(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}=j(),t=W(),[n]=q(),r=n.get("tab")||"sync",[o,l]=s.useState(()=>K()),[i,c]=s.useState(!1),[d,u]=s.useState({webhookEnabled:!1}),[h,m]=s.useState(""),[p,x]=s.useState(!1),[f,g]=s.useState(()=>U(G.usageMonitorTool,"claude"));s.useEffect(()=>{$().then(e=>{u(e),m(e.webhookUrl??"")}).catch(()=>{})},[]);const v=(e,s)=>{const t=parseInt(s,10);isNaN(t)||t<1||(l(s=>({...s,[e]:t})),c(!0))};return a.jsx("div",{className:"min-h-screen bg-background",children:a.jsxs("div",{className:"max-w-3xl 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(Z,{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(Ne,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_sync")]}),a.jsxs(he,{value:"hub",children:[a.jsx(je,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_hub")]}),a.jsxs(he,{value:"notifications",children:[a.jsx(ye,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_notifications")]}),a.jsxs(he,{value:"pomodoro",children:[a.jsx(X,{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 Y({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:o.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:o.breakMinutes,onChange:e=>v("breakMinutes",e.target.value),className:"w-full"})]})]}),i&&a.jsxs(C,{size:"sm",onClick:()=>{Q(G.pomodoroConfig,o,!0),c(!1),N.success(e("settings.pomodoro.saved"))},children:[a.jsx(ie,{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(X,{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(G.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,aE as s,r as t,bn as a,bo as r,t as n,bp as l,bq as i,br as c,ab as d,bs 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-CxHOCf_s.js";import{S as w}from"./search-BPzU-LtZ.js";import{C}from"./chevron-down-CxmD4ySz.js";
1
+ import{c as e,aF 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,aH 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-BrpW1kym.js";import{S as w}from"./search-W7udjbkr.js";import{C}from"./chevron-down-CtzzxYuu.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"}]]),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"}]]);
7
+ */const S=e("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),P=e("Puzzle",[["path",{d:"M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z",key:"i0oyt7"}]]),q=e("Tag",[["path",{d:"M12 2H2v10l9.29 9.29c.94.94 2.48.94 3.42 0l6.58-6.58c.94-.94.94-2.48 0-3.42L12 2Z",key:"14b2ls"}],["path",{d:"M7 7h.01",key:"7u93v4"}]]),E=e("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);
8
8
  /**
9
9
  * @license lucide-react v0.309.0 - ISC
10
10
  *
11
11
  * This source code is licensed under the ISC license.
12
12
  * See the LICENSE file in the root directory of this source tree.
13
- */function z(){const e=s(),[z,M]=t.useState("prompts"),[H,_]=t.useState(""),[F,Q]=t.useState([]),[W,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};
13
+ */function z(){const e=s(),[z,M]=t.useState("prompts"),[H,F]=t.useState(""),[_,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:"卸载失败")}},[]),$=t.useCallback(async(e,s)=>{try{await i(e,s),Q(t=>t.map(t=>t.id===e?{...t,enabled:s}:t))}catch(t){n.error(t instanceof Error?t.message:"操作失败")}},[]),[G,J]=t.useState([]),[K,R]=t.useState(!0),[V,X]=t.useState(null),[Y,ee]=t.useState("all"),[se,te]=t.useState(null),[ae,re]=t.useState(null),[ne,le]=t.useState(new Set),[ie,ce]=t.useState(null);t.useEffect(()=>{Promise.all([c(),d().catch(()=>[]),o().catch(()=>[])]).then(([e,s,t])=>{J(e);const a=new Set;for(const r of e)"quick-prompt"===r.kind?s.some(e=>e.label===r.label&&e.command===r.body)&&a.add(r.id):t.some(e=>e.label===r.label&&e.command===r.body)&&a.add(r.id);le(a)}).catch(e=>X(e instanceof Error?e.message:"Failed to load CCWeb Hub")).finally(()=>R(!1))},[]);const de=t.useMemo(()=>{const e=new Set;return G.forEach(s=>{var t;return null==(t=s.tags)?void 0:t.forEach(s=>e.add(s))}),[...e].sort()},[G]),oe=t.useMemo(()=>{let e=G;"all"!==Y&&(e=e.filter(e=>e.kind===Y)),"__untagged__"===se?e=e.filter(e=>!e.tags||0===e.tags.length):se&&(e=e.filter(e=>{var s;return null==(s=e.tags)?void 0:s.includes(se)}));const s=H.trim().toLowerCase();return s&&(e=e.filter(e=>e.label.toLowerCase().includes(s)||e.body.toLowerCase().includes(s)||(e.description??"").toLowerCase().includes(s)||(e.author??"").toLowerCase().includes(s)||(e.tags??[]).some(e=>e.toLowerCase().includes(s)))),e},[G,Y,se,H]);return m.jsxs("div",{className:"min-h-screen bg-background",children:[m.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:m.jsxs("div",{className:"max-w-4xl mx-auto px-4 h-14 flex items-center gap-4",children:[m.jsxs(x,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[m.jsx(u,{className:"h-4 w-4 mr-1"}),"返回"]}),m.jsx("h1",{className:"font-semibold text-lg",children:"CCWeb Hub"}),m.jsxs("div",{className:"flex items-center gap-1 ml-4",children:[m.jsx("button",{onClick:()=>M("prompts"),className:p("px-3 py-1 rounded-md text-sm transition-colors","prompts"===z?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:"Prompts"}),m.jsxs("button",{onClick:()=>M("plugins"),className:p("px-3 py-1 rounded-md text-sm transition-colors flex items-center gap-1","plugins"===z?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:[m.jsx(P,{className:"h-3.5 w-3.5"}),"插件"]})]}),m.jsx("div",{className:"flex-1"}),m.jsxs("div",{className:"relative w-64",children:[m.jsx(w,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),m.jsx(h,{placeholder:"prompts"===z?"搜索 prompt...":"搜索插件...",value:H,onChange:e=>F(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:[_.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:_.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:_.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=>!_.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===G.length&&m.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[m.jsx("p",{className:"text-lg mb-2",children:"CCWeb Hub 还没有 prompt"}),m.jsx("p",{className:"text-sm",children:'在 Quick Prompts 或 Agent Prompts 卡片上右键选择"共享"来提交第一个吧!'})]}),!K&&!V&&G.length>0&&0===oe.length&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的 prompt"}),m.jsx("div",{className:"space-y-3",children:oe.map((e,s)=>{var t;const a=ae===e.id,r=ne.has(e.id),l=ie===e.id;return m.jsxs(f.div,{layout:!0,initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:.03*s,ease:"easeOut"},className:"rounded-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(q,{className:"h-2.5 w-2.5"}),e]},e))]}),e.description&&m.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:e.description}),m.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[e.author&&m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx(E,{className:"h-3 w-3"}),e.author]}),m.jsx("code",{className:"text-[10px] opacity-60",children:e.file})]})]}),m.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxs(x,{size:"sm",variant:r?"ghost":"outline",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};
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-CxHOCf_s.js";
1
+ import{c as o}from"./index-BrpW1kym.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-CxHOCf_s.js";
1
+ import{c as e}from"./index-BrpW1kym.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *