@tom2012/cc-web 2026.5.18-b → 2026.5.18-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.
Files changed (186) hide show
  1. package/README.md +1 -1
  2. package/backend/dist/index.d.ts.map +1 -1
  3. package/backend/dist/index.js +2 -21
  4. package/backend/dist/index.js.map +1 -1
  5. package/backend/dist/routes/global-tracks.d.ts +2 -5
  6. package/backend/dist/routes/global-tracks.d.ts.map +1 -1
  7. package/backend/dist/routes/global-tracks.js +2 -28
  8. package/backend/dist/routes/global-tracks.js.map +1 -1
  9. package/backend/dist/routes/tracks.d.ts +3 -9
  10. package/backend/dist/routes/tracks.d.ts.map +1 -1
  11. package/backend/dist/routes/tracks.js +3 -153
  12. package/backend/dist/routes/tracks.js.map +1 -1
  13. package/backend/dist/tracks/ask-user-bridge.d.ts +1 -6
  14. package/backend/dist/tracks/ask-user-bridge.d.ts.map +1 -1
  15. package/backend/dist/tracks/ask-user-bridge.js +0 -22
  16. package/backend/dist/tracks/ask-user-bridge.js.map +1 -1
  17. package/backend/dist/tracks/index.d.ts +1 -5
  18. package/backend/dist/tracks/index.d.ts.map +1 -1
  19. package/backend/dist/tracks/index.js +1 -10
  20. package/backend/dist/tracks/index.js.map +1 -1
  21. package/backend/package-lock.json +1 -64
  22. package/backend/package.json +1 -5
  23. package/frontend/dist/assets/{ChatOverlay-DPM_F615.js → ChatOverlay-i8gy2y-T.js} +1 -1
  24. package/frontend/dist/assets/{GraphPreview-CJhh33L8.js → GraphPreview-CoOHeDk0.js} +2 -2
  25. package/frontend/dist/assets/{MobilePage-Cx9v8Udp.js → MobilePage-ZYuVSqIu.js} +3 -3
  26. package/frontend/dist/assets/{OfficePreview-h6zYBZFQ.js → OfficePreview-BP_FVyDv.js} +2 -2
  27. package/frontend/dist/assets/{PdfPreview-DbYFye7c.js → PdfPreview-B_Is_82c.js} +1 -1
  28. package/frontend/dist/assets/{ProjectPage-DaPmvQ-H.js → ProjectPage-Bi7P0xvD.js} +5 -5
  29. package/frontend/dist/assets/{SettingsPage-BkApTPbw.js → SettingsPage-DlqnuIy1.js} +2 -2
  30. package/frontend/dist/assets/{SkillHubPage-BwfU-hel.js → SkillHubPage-FFefLcmN.js} +3 -3
  31. package/frontend/dist/assets/{chevron-down-D4Vj-5wB.js → chevron-down-DqAoFpmS.js} +1 -1
  32. package/frontend/dist/assets/{index-DUIOrPha.js → index-B5mDtgD1.js} +2 -2
  33. package/frontend/dist/assets/{index-CKxFfdqR.js → index-Bj-uhUZY.js} +1 -1
  34. package/frontend/dist/assets/{index-C-2GBtXy.js → index-DzYZJMgp.js} +1 -1
  35. package/frontend/dist/assets/index-mxYmpvtf.css +1 -0
  36. package/frontend/dist/assets/{jszip.min-Bn769Ot7.js → jszip.min-DW73pE0J.js} +1 -1
  37. package/frontend/dist/assets/{select-CXSNG3yW.js → select-HgZm25ew.js} +1 -1
  38. package/frontend/dist/assets/{user-Chl3LWFq.js → user-BOTyiGCj.js} +1 -1
  39. package/frontend/dist/index.html +2 -2
  40. package/package.json +1 -1
  41. package/backend/vendor/@tom2012/train-core/dist/ast-cache.d.ts +0 -74
  42. package/backend/vendor/@tom2012/train-core/dist/ast-cache.d.ts.map +0 -1
  43. package/backend/vendor/@tom2012/train-core/dist/ast-cache.js +0 -157
  44. package/backend/vendor/@tom2012/train-core/dist/ast-cache.js.map +0 -1
  45. package/backend/vendor/@tom2012/train-core/dist/ast.d.ts +0 -350
  46. package/backend/vendor/@tom2012/train-core/dist/ast.d.ts.map +0 -1
  47. package/backend/vendor/@tom2012/train-core/dist/ast.js +0 -15
  48. package/backend/vendor/@tom2012/train-core/dist/ast.js.map +0 -1
  49. package/backend/vendor/@tom2012/train-core/dist/builder.d.ts +0 -21
  50. package/backend/vendor/@tom2012/train-core/dist/builder.d.ts.map +0 -1
  51. package/backend/vendor/@tom2012/train-core/dist/builder.js +0 -1254
  52. package/backend/vendor/@tom2012/train-core/dist/builder.js.map +0 -1
  53. package/backend/vendor/@tom2012/train-core/dist/builtins.d.ts +0 -17
  54. package/backend/vendor/@tom2012/train-core/dist/builtins.d.ts.map +0 -1
  55. package/backend/vendor/@tom2012/train-core/dist/builtins.js +0 -500
  56. package/backend/vendor/@tom2012/train-core/dist/builtins.js.map +0 -1
  57. package/backend/vendor/@tom2012/train-core/dist/index.d.ts +0 -54
  58. package/backend/vendor/@tom2012/train-core/dist/index.d.ts.map +0 -1
  59. package/backend/vendor/@tom2012/train-core/dist/index.js +0 -66
  60. package/backend/vendor/@tom2012/train-core/dist/index.js.map +0 -1
  61. package/backend/vendor/@tom2012/train-core/dist/interpreter.d.ts +0 -110
  62. package/backend/vendor/@tom2012/train-core/dist/interpreter.d.ts.map +0 -1
  63. package/backend/vendor/@tom2012/train-core/dist/interpreter.js +0 -943
  64. package/backend/vendor/@tom2012/train-core/dist/interpreter.js.map +0 -1
  65. package/backend/vendor/@tom2012/train-core/dist/lexer.d.ts +0 -88
  66. package/backend/vendor/@tom2012/train-core/dist/lexer.d.ts.map +0 -1
  67. package/backend/vendor/@tom2012/train-core/dist/lexer.js +0 -243
  68. package/backend/vendor/@tom2012/train-core/dist/lexer.js.map +0 -1
  69. package/backend/vendor/@tom2012/train-core/dist/module-loader.d.ts +0 -74
  70. package/backend/vendor/@tom2012/train-core/dist/module-loader.d.ts.map +0 -1
  71. package/backend/vendor/@tom2012/train-core/dist/module-loader.js +0 -149
  72. package/backend/vendor/@tom2012/train-core/dist/module-loader.js.map +0 -1
  73. package/backend/vendor/@tom2012/train-core/dist/parser.d.ts +0 -138
  74. package/backend/vendor/@tom2012/train-core/dist/parser.d.ts.map +0 -1
  75. package/backend/vendor/@tom2012/train-core/dist/parser.js +0 -861
  76. package/backend/vendor/@tom2012/train-core/dist/parser.js.map +0 -1
  77. package/backend/vendor/@tom2012/train-core/dist/prompt-composer.d.ts +0 -49
  78. package/backend/vendor/@tom2012/train-core/dist/prompt-composer.d.ts.map +0 -1
  79. package/backend/vendor/@tom2012/train-core/dist/prompt-composer.js +0 -159
  80. package/backend/vendor/@tom2012/train-core/dist/prompt-composer.js.map +0 -1
  81. package/backend/vendor/@tom2012/train-core/dist/runtime.d.ts +0 -146
  82. package/backend/vendor/@tom2012/train-core/dist/runtime.d.ts.map +0 -1
  83. package/backend/vendor/@tom2012/train-core/dist/runtime.js +0 -156
  84. package/backend/vendor/@tom2012/train-core/dist/runtime.js.map +0 -1
  85. package/backend/vendor/@tom2012/train-core/dist/type-descriptor.d.ts +0 -18
  86. package/backend/vendor/@tom2012/train-core/dist/type-descriptor.d.ts.map +0 -1
  87. package/backend/vendor/@tom2012/train-core/dist/type-descriptor.js +0 -94
  88. package/backend/vendor/@tom2012/train-core/dist/type-descriptor.js.map +0 -1
  89. package/backend/vendor/@tom2012/train-core/dist/validation.d.ts +0 -44
  90. package/backend/vendor/@tom2012/train-core/dist/validation.d.ts.map +0 -1
  91. package/backend/vendor/@tom2012/train-core/dist/validation.js +0 -271
  92. package/backend/vendor/@tom2012/train-core/dist/validation.js.map +0 -1
  93. package/backend/vendor/@tom2012/train-core/package.json +0 -35
  94. package/frontend/dist/assets/TrackEditor-BbM0eHTD.js +0 -14
  95. package/frontend/dist/assets/TrackGraphEditor-DzEqAGFN.js +0 -2
  96. package/frontend/dist/assets/TrackGraphEditor-Fd0xVSp_.css +0 -1
  97. package/frontend/dist/assets/abap-LPLW346S.js +0 -7
  98. package/frontend/dist/assets/apex-Dk-jUCUV.js +0 -7
  99. package/frontend/dist/assets/azcli-DPUMmPlX.js +0 -7
  100. package/frontend/dist/assets/bat-C1Qbg1bV.js +0 -7
  101. package/frontend/dist/assets/bicep-D-e-VSJi.js +0 -7
  102. package/frontend/dist/assets/cameligo-CjUqTgqL.js +0 -7
  103. package/frontend/dist/assets/clojure-BWsu6Kju.js +0 -7
  104. package/frontend/dist/assets/codicon-DCmgc-ay.ttf +0 -0
  105. package/frontend/dist/assets/coffee-DeC36AK3.js +0 -7
  106. package/frontend/dist/assets/cpp-DcZnmBWT.js +0 -7
  107. package/frontend/dist/assets/csharp-DqBXBMf0.js +0 -7
  108. package/frontend/dist/assets/csp-CkO7y8ul.js +0 -7
  109. package/frontend/dist/assets/css-OAcfVtED.js +0 -7
  110. package/frontend/dist/assets/cssMode-5whH06Yl.js +0 -7
  111. package/frontend/dist/assets/cypher-40UGrUjD.js +0 -7
  112. package/frontend/dist/assets/dart-DmixyLor.js +0 -7
  113. package/frontend/dist/assets/dockerfile-CayO4nTA.js +0 -7
  114. package/frontend/dist/assets/ecl-DRrKCuVc.js +0 -7
  115. package/frontend/dist/assets/editor-B5EY1bb8.css +0 -1
  116. package/frontend/dist/assets/editor.main-CnjJg6pv.js +0 -37
  117. package/frontend/dist/assets/elixir-J3qpp9mX.js +0 -7
  118. package/frontend/dist/assets/flow9-DzW2c4Im.js +0 -7
  119. package/frontend/dist/assets/freemarker2-CUgILTtX.js +0 -7
  120. package/frontend/dist/assets/fsharp-D00tn_6c.js +0 -7
  121. package/frontend/dist/assets/go-NnNmgWK_.js +0 -7
  122. package/frontend/dist/assets/graphql-C9_--VLF.js +0 -7
  123. package/frontend/dist/assets/handlebars-C2avKkbK.js +0 -7
  124. package/frontend/dist/assets/hcl-BhbOULbp.js +0 -7
  125. package/frontend/dist/assets/html-ZYUiGgvr.js +0 -7
  126. package/frontend/dist/assets/htmlMode-CeliqUBd.js +0 -7
  127. package/frontend/dist/assets/index-COjNnvQB.css +0 -1
  128. package/frontend/dist/assets/index-DjmvYdMM.js +0 -1
  129. package/frontend/dist/assets/ini-zR-_X5iG.js +0 -7
  130. package/frontend/dist/assets/java-CSTjsyoZ.js +0 -7
  131. package/frontend/dist/assets/javascript-0VRCllAK.js +0 -7
  132. package/frontend/dist/assets/jsonMode-Dwqu43-Y.js +0 -7
  133. package/frontend/dist/assets/julia-DioMOKVu.js +0 -7
  134. package/frontend/dist/assets/kotlin-Dsb0PKmW.js +0 -7
  135. package/frontend/dist/assets/less-CZYLoAVD.js +0 -7
  136. package/frontend/dist/assets/lexon-d5JUiwNk.js +0 -7
  137. package/frontend/dist/assets/liquid-E2ejTVvo.js +0 -7
  138. package/frontend/dist/assets/lua-1Al72GG8.js +0 -7
  139. package/frontend/dist/assets/m3-hx1xCPC3.js +0 -7
  140. package/frontend/dist/assets/markdown-DPGrH1xZ.js +0 -7
  141. package/frontend/dist/assets/mdx-CqJmnu86.js +0 -7
  142. package/frontend/dist/assets/mips-CYbZjkIm.js +0 -7
  143. package/frontend/dist/assets/msdax-DAioKM5A.js +0 -7
  144. package/frontend/dist/assets/mysql-7e9GUebS.js +0 -7
  145. package/frontend/dist/assets/objective-c-BGf8QNjz.js +0 -7
  146. package/frontend/dist/assets/pascal-hEDRz3un.js +0 -7
  147. package/frontend/dist/assets/pascaligo-gqEhN6pG.js +0 -7
  148. package/frontend/dist/assets/perl-CN8Ht9Vk.js +0 -7
  149. package/frontend/dist/assets/pgsql-CRCqHQBx.js +0 -7
  150. package/frontend/dist/assets/php-DTZrlAwe.js +0 -7
  151. package/frontend/dist/assets/pla-CRmh4UcC.js +0 -7
  152. package/frontend/dist/assets/postiats-Car2G7g8.js +0 -7
  153. package/frontend/dist/assets/powerquery-BJKl8V3o.js +0 -7
  154. package/frontend/dist/assets/powershell-Du7a_J7r.js +0 -7
  155. package/frontend/dist/assets/protobuf-ChneWI0H.js +0 -7
  156. package/frontend/dist/assets/pug-BH6LSJaf.js +0 -7
  157. package/frontend/dist/assets/python-BYNiBUNZ.js +0 -7
  158. package/frontend/dist/assets/qsharp-CU-Hxpxi.js +0 -7
  159. package/frontend/dist/assets/r-Bw-W15zh.js +0 -7
  160. package/frontend/dist/assets/razor-2YR0XVnP.js +0 -7
  161. package/frontend/dist/assets/redis-bY-X9-ol.js +0 -7
  162. package/frontend/dist/assets/redshift-CMu3ubbS.js +0 -7
  163. package/frontend/dist/assets/restructuredtext-KNkiWGNN.js +0 -7
  164. package/frontend/dist/assets/ruby-dQWMhU86.js +0 -7
  165. package/frontend/dist/assets/rust-BAcHhnEU.js +0 -7
  166. package/frontend/dist/assets/sb-Bidr5w2z.js +0 -7
  167. package/frontend/dist/assets/scala-imTtxsGY.js +0 -7
  168. package/frontend/dist/assets/scheme-BY-WHKiB.js +0 -7
  169. package/frontend/dist/assets/scss-NDoRP52C.js +0 -7
  170. package/frontend/dist/assets/shell-DrIjotnh.js +0 -7
  171. package/frontend/dist/assets/solidity-DTahNycF.js +0 -7
  172. package/frontend/dist/assets/sophia-DtyrjGkZ.js +0 -7
  173. package/frontend/dist/assets/sparql-CFuS5E3z.js +0 -7
  174. package/frontend/dist/assets/sql-BRxcnbRv.js +0 -7
  175. package/frontend/dist/assets/st-Dz4uh7MK.js +0 -7
  176. package/frontend/dist/assets/swift-Digsrw1G.js +0 -11
  177. package/frontend/dist/assets/systemverilog-7TDrkMau.js +0 -7
  178. package/frontend/dist/assets/tcl-BtaFcnDi.js +0 -7
  179. package/frontend/dist/assets/tsMode-DrjOLXjA.js +0 -7
  180. package/frontend/dist/assets/twig-Deid_oBs.js +0 -7
  181. package/frontend/dist/assets/typescript--8YtfOFf.js +0 -7
  182. package/frontend/dist/assets/typespec-zUaxhbG8.js +0 -7
  183. package/frontend/dist/assets/vb-DK0rKJzo.js +0 -7
  184. package/frontend/dist/assets/wgsl-B8fNVlOQ.js +0 -7
  185. package/frontend/dist/assets/xml-CGj_sBRG.js +0 -7
  186. package/frontend/dist/assets/yaml-of0AgMN8.js +0 -7
@@ -1,4 +1,4 @@
1
- import{c as e,r as s,a0 as t,aZ as a,j as n,a2 as c,a1 as l,Y as i,d as r,aG as o,aI as d,a_ as h,t as m,am as x,I as u,B as p,aE as g,X as j,D as b,a$ as y,b0 as f,b1 as _,b2 as v,u as k,b3 as N,T as w,b4 as C,b5 as S,b6 as M,b7 as E,b8 as T,aH as R,b9 as I,ba as P,i as H,S as F,bb as L,aK as z,K as q,s as V,bc as A}from"./index-DUIOrPha.js";import{u as G,o as U,i as O,j as B,k as D,l as $,m as K,S as Q,U as W,n as Z,T as X,a as Y,b as J,c as ee}from"./select-CXSNG3yW.js";import{C as se}from"./index-CKxFfdqR.js";import"./chevron-down-D4Vj-5wB.js";
1
+ import{c as e,r as s,a0 as t,b3 as a,j as n,a2 as c,a1 as l,Y as i,d as r,aM as o,aO as d,b4 as h,t as m,am as x,I as u,B as p,aK as g,X as j,D as b,b5 as y,b6 as f,b7 as _,b8 as v,u as k,b9 as N,T as w,ba as C,bb as S,bc as M,bd as E,be as T,aN as R,bf as P,bg as I,i as H,S as L,bh as F,aQ as z,L as q,s as V,bi as A}from"./index-B5mDtgD1.js";import{u as O,o as U,i as G,j as B,k as D,l as Q,m as W,S as $,U as K,n as X,T as Y,a as Z,b as J,c as ee}from"./select-HgZm25ew.js";import{C as se}from"./index-Bj-uhUZY.js";import"./chevron-down-DqAoFpmS.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,a0 as t,aZ as a,j as n,a2 as c,a1 as l,Y as i,d as r,aG as
10
10
  *
11
11
  * This source code is licensed under the ISC license.
12
12
  * See the LICENSE file in the root directory of this source tree.
13
- */var oe="Switch",[de]=i(oe),[he,me]=de(oe),xe=s.forwardRef((e,i)=>{const{__scopeSwitch:r,name:o,checked:d,defaultChecked:h,required:m,disabled:x,value:u="on",onCheckedChange:p,form:g,...j}=e,[b,y]=s.useState(null),f=t(i,e=>y(e)),_=s.useRef(!1),v=!b||(g||!!b.closest("form")),[k,N]=a({prop:d,defaultProp:h??!1,onChange:p,caller:oe});return n.jsxs(he,{scope:r,checked:k,disabled:x,children:[n.jsx(c.button,{type:"button",role:"switch","aria-checked":k,"aria-required":m,"data-state":je(k),"data-disabled":x?"":void 0,disabled:x,value:u,...j,ref:f,onClick:l(e.onClick,e=>{N(e=>!e),v&&(_.current=e.isPropagationStopped(),_.current||e.stopPropagation())})}),v&&n.jsx(ge,{control:b,bubbles:!_.current,name:o,value:u,checked:k,required:m,disabled:x,form:g,style:{transform:"translateX(-100%)"}})]})});xe.displayName=oe;var ue="SwitchThumb",pe=s.forwardRef((e,s)=>{const{__scopeSwitch:t,...a}=e,l=me(ue,t);return n.jsx(c.span,{"data-state":je(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:s})});pe.displayName=ue;var ge=s.forwardRef(({__scopeSwitch:e,control:a,checked:c,bubbles:l=!0,...i},r)=>{const o=s.useRef(null),d=t(o,r),h=G(c),m=U(a);return s.useEffect(()=>{const e=o.current;if(!e)return;const s=window.HTMLInputElement.prototype,t=Object.getOwnPropertyDescriptor(s,"checked").set;if(h!==c&&t){const s=new Event("click",{bubbles:l});t.call(e,c),e.dispatchEvent(s)}},[h,c,l]),n.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:c,...i,tabIndex:-1,ref:d,style:{...i.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function je(e){return e?"checked":"unchecked"}ge.displayName="SwitchBubbleInput";var be=xe,ye=pe;const fe=s.forwardRef(({className:e,...s},t)=>n.jsx(be,{className:r("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...s,ref:t,children:n.jsx(ye,{className:r("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")})}));fe.displayName=be.displayName;function _e(){const{t:e}=o(),[t,a]=s.useState(null),[c,l]=s.useState(!0),[i,r]=s.useState(!1),[k,N]=s.useState(!1),[w,C]=s.useState(!1),[S,M]=s.useState(!1),[E,T]=s.useState(null),[R,I]=s.useState(0),[P,H]=s.useState(""),[F,L]=s.useState("");d({onStart:e=>{T(e.projectId),I(0)},onProgress:e=>{T(e.projectId),I(e.filesTransferred)},onDone:()=>{T(null),I(0)}}),s.useEffect(()=>{let s=!1;return h().then(e=>{s||(a(e),L(e.defaultExcludes.join("\n")))}).catch(s=>m.error(e("sync_section.load_failed",{message:s.message}))).finally(()=>{s||l(!1)}),()=>{s=!0}},[e]);const z=(e,s)=>{a(t=>t?{...t,[e]:s}:t)};return c||!t?n.jsx("div",{className:"text-sm text-muted-foreground",children:e("sync_section.loading")}):n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.server_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-host",children:e("sync_section.host")}),n.jsx(u,{id:"sync-host",value:t.host,onChange:e=>z("host",e.target.value),placeholder:"example.com"})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-port",children:e("sync_section.port")}),n.jsx(u,{id:"sync-port",type:"number",value:t.port,onChange:e=>z("port",Number(e.target.value)||22)})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-user",children:e("sync_section.user")}),n.jsx(u,{id:"sync-user",value:t.user,onChange:e=>z("user",e.target.value),placeholder:"tom"})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-remote",children:e("sync_section.remote_root")}),n.jsx(u,{id:"sync-remote",value:t.remoteRoot,onChange:e=>z("remoteRoot",e.target.value),placeholder:"/data/projects"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.remote_root_hint")}})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.auth_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{children:e("sync_section.auth_method")}),n.jsxs(O,{value:t.authMethod,onValueChange:e=>z("authMethod",e),children:[n.jsx(B,{children:n.jsx(D,{})}),n.jsxs($,{children:[n.jsx(K,{value:"key",children:"SSH key"}),n.jsx(K,{value:"password",children:e("sync_section.auth_password")})]})]})]}),"key"===t.authMethod?n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-key",children:e("sync_section.key_path")}),n.jsx(u,{id:"sync-key",value:t.keyPath??"",onChange:e=>z("keyPath",e.target.value),placeholder:"~/.ssh/id_rsa"})]}):n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-pw",children:e("sync_section.password")}),n.jsx(u,{id:"sync-pw",type:"password",value:P,onChange:e=>H(e.target.value),placeholder:t.passwordSet?e("sync_section.password_set_placeholder"):e("sync_section.password_unset_placeholder")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.sshpass_hint")}})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.strategy_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{children:e("sync_section.direction")}),n.jsxs(O,{value:t.direction,onValueChange:e=>z("direction",e),children:[n.jsx(B,{children:n.jsx(D,{})}),n.jsxs($,{children:[n.jsx(K,{value:"push",children:e("sync_section.push_label")}),n.jsx(K,{value:"pull",children:e("sync_section.pull_label")}),n.jsx(K,{value:"bidirectional",children:e("sync_section.bidirectional_label")})]})]})]}),n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx(x,{htmlFor:"sync-cron",children:e("sync_section.cron_label")}),n.jsx(u,{id:"sync-cron",value:t.schedule.cron,onChange:e=>z("schedule",{...t.schedule,cron:e.target.value}),placeholder:"0 3 * * *"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.cron_hint")}})]}),n.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[n.jsx(fe,{checked:t.schedule.enabled,onCheckedChange:e=>z("schedule",{...t.schedule,enabled:e})}),n.jsx("span",{className:"text-xs text-muted-foreground",children:e("sync_section.enable_label")})]})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.exclude_section")}),n.jsx("textarea",{value:F,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"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.exclude_hint")}})]}),n.jsxs("div",{className:"flex flex-wrap gap-2 pt-2 border-t",children:[n.jsxs(p,{onClick:()=>{(async()=>{if(t){r(!0);try{const s=F.split("\n").map(e=>e.trim()).filter(Boolean),n={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};P&&"__keep__"!==P&&(n.password=P);const c=await y(n);a(c),L(c.defaultExcludes.join("\n")),H(""),m.success(e("sync_section.saved"))}catch(s){m.error(e("sync_section.save_failed",{message:s.message}))}finally{r(!1)}}})()},disabled:i,children:[i?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(Q,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.save_button")]}),n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{N(!0);try{const s=await f();s.ok?m.success(s.message||e("sync_section.test_ok")):m.error(s.message||e("sync_section.test_failed"))}catch(s){m.error(e("sync_section.test_failed_with_reason",{message:s.message}))}finally{N(!1)}})()},disabled:k,children:[k?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(ie,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.test_button")]}),n.jsx("div",{className:"flex-1"}),w&&E&&n.jsx("span",{className:"text-xs text-muted-foreground self-center mr-1 tabular-nums",children:R>0?e("sync_section.syncing_with_files",{project:E,files:R}):e("sync_section.syncing_no_files",{project:E})}),n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{C(!0);try{const s=await _(),t=s.results.filter(e=>e.ok).length,a=s.results.filter(e=>e.skipped).length,n=s.results.filter(e=>"cancelled"===e.reason).length,c=s.total-t-a-n;n>0?m.info(e("sync_section.bulk_cancelled_toast",{ok:t,skipped:a,cancelled:n,failed:c})):m.success(e("sync_section.bulk_done_toast",{ok:t,skipped:a,failed:c}))}catch(s){m.error(e("sync_section.bulk_failed_toast",{message:s.message}))}finally{C(!1),M(!1),T(null),I(0)}})()},disabled:w,title:e("sync_section.sync_all_title"),children:[w?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(W,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.sync_all_button")]}),w&&n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{if(w&&!S){M(!0);try{await v(),m.info(e("sync_section.cancel_requested"))}catch(s){m.error(e("sync_section.cancel_failed",{message:s.message})),M(!1)}}})()},disabled:S,title:e("sync_section.cancel_button_title"),children:[S?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(j,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.cancel_button")]})]}),n.jsxs("div",{className:"border-t pt-4 text-xs text-muted-foreground",children:["Per-project push/pull: from inside a project, click the ",n.jsx(W,{className:"inline h-3 w-3"})," / ",n.jsx(b,{className:"inline h-3 w-3"})," buttons in the header. Or call ",n.jsx("code",{children:"POST /api/sync/project/:id"})," with body ",n.jsx("code",{children:'{ "direction": "push" }'}),"."]})]})}function ve(){const e=k(),[t,a]=s.useState(null),[c,l]=s.useState(!0),[i,r]=s.useState(""),[o,d]=s.useState(!1);s.useEffect(()=>{let e=!1;return N().then(s=>{e||a(s)}).catch(()=>{e||a({configured:!1,needsReset:!1})}).finally(()=>{e||l(!1)}),()=>{e=!0}},[]);return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-1",children:"CCWeb Hub 直接提交"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:['配置你的 GitHub PAT 后,在 Quick Prompts / Agent Prompts 卡片右键选择"共享"时可一键直接提交 Issue 到 ',n.jsx("code",{children:"zbc0315/ccweb-hub"}),"。 ccweb 本身不自带 token —— 使用你自己的账号身份提交,归属清晰,互不影响。"]})]}),c?n.jsxs("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[n.jsx(g,{className:"h-4 w-4 animate-spin"}),"加载中…"]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"rounded-md border px-3 py-2.5 text-xs flex items-center gap-2",children:(null==t?void 0:t.configured)?n.jsxs(n.Fragment,{children:[n.jsx(se,{className:"h-4 w-4 text-green-500 shrink-0"}),n.jsx("span",{children:"已配置 token,可直接提交"}),n.jsx("div",{className:"flex-1"}),n.jsxs(p,{size:"sm",variant:"outline",onClick:()=>{(async()=>{if(await e({title:"清除 Hub Token",description:"清除后将无法直接提交到 ccweb-hub,需要重新配置 token。确认?",destructive:!0,confirmLabel:"清除"}))try{await C(),a({configured:!1,needsReset:!1}),m.success("已清除")}catch(s){m.error(`清除失败: ${s.message}`)}})()},children:[n.jsx(w,{className:"h-3.5 w-3.5 mr-1"}),"清除"]})]}):(null==t?void 0:t.needsReset)?n.jsxs(n.Fragment,{children:[n.jsx(Z,{className:"h-4 w-4 text-amber-500 shrink-0"}),n.jsx("span",{children:"之前的 token 已失效(服务端密钥可能已轮换),请重新设置"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Z,{className:"h-4 w-4 text-muted-foreground shrink-0"}),n.jsx("span",{children:"尚未配置 token"})]})}),n.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2.5 text-xs space-y-2",children:[n.jsx("div",{className:"font-medium text-foreground",children:"如何获取 token"}),n.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-muted-foreground",children:[n.jsxs("li",{children:["打开"," ",n.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new",target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline inline-flex items-center gap-0.5",children:["GitHub fine-grained PAT",n.jsx(ne,{className:"h-3 w-3"})]})," ","创建页"]}),n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:"Repository access"}),':选 "Only select repositories",添加 ',n.jsx("code",{children:"zbc0315/ccweb-hub"})]}),n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:"Repository permissions → Issues"}),':设置为 "Read and write"']}),n.jsx("li",{children:"其余权限保持默认(全部无访问)"}),n.jsx("li",{children:"生成后复制 token 粘贴到下方"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs(x,{htmlFor:"hub-token",className:"text-xs",children:["GitHub Token ",(null==t?void 0:t.configured)&&n.jsx("span",{className:"text-muted-foreground",children:"(填写会覆盖现有 token)"})]}),n.jsx(u,{id:"hub-token",type:"password",placeholder:"github_pat_...",value:i,onChange:e=>r(e.target.value),autoComplete:"off",spellCheck:!1}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Token 以 AES-256-GCM 加密存储于 ",n.jsx("code",{children:"~/.ccweb/hub-auth/"}),";per-user 独立,不会被其他用户读到。"]})]}),n.jsx("div",{className:"flex gap-2 pt-2 border-t",children:n.jsxs(p,{onClick:()=>{(async()=>{const e=i.trim();if(e){d(!0);try{const s=await S(e);a(s),r(""),m.success("已保存")}catch(s){m.error(`保存失败: ${s.message}`)}finally{d(!1)}}else m.error("请输入 token")})()},disabled:o||!i.trim(),children:[o?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(Q,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})})]})]})}function ke(){const{t:e,i18n:s}=o();return n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(le,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs(O,{value:s.language,onValueChange:async t=>{if(M.includes(t)){try{localStorage.setItem(E,t)}catch{}await s.changeLanguage(t);try{await T(t)}catch{m.error(e("language.switch_failed"))}}},children:[n.jsx(B,{className:"w-40",children:n.jsx(D,{})}),n.jsxs($,{children:[n.jsx(K,{value:"zh",children:e("language.zh")}),n.jsx(K,{value:"en",children:e("language.en")})]})]})]})}function Ne(){const{t:e}=o(),t=R(),[a]=I(),c=a.get("tab")||"sync",[l,i]=s.useState(()=>P()),[r,d]=s.useState(!1),[h,g]=s.useState({webhookEnabled:!1}),[j,b]=s.useState(""),[y,f]=s.useState(!1),[_,v]=s.useState(()=>H(F.usageMonitorTool,"claude"));s.useEffect(()=>{L().then(e=>{g(e),b(e.webhookUrl??"")}).catch(()=>{})},[]);const k=(e,s)=>{const t=parseInt(s,10);isNaN(t)||t<1||(i(s=>({...s,[e]:t})),d(!0))};return n.jsx("div",{className:"min-h-screen bg-background",children:n.jsxs("div",{className:"max-w-3xl mx-auto p-6",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsxs(p,{variant:"ghost",size:"sm",onClick:()=>t("/"),children:[n.jsx(z,{className:"h-4 w-4 mr-1"}),e("common.back")]}),n.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:e("settings.title")})]}),n.jsxs(X,{defaultValue:c,children:[n.jsxs(Y,{className:"mb-4",children:[n.jsxs(J,{value:"sync",children:[n.jsx(re,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_sync")]}),n.jsxs(J,{value:"hub",children:[n.jsx(ce,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_hub")]}),n.jsxs(J,{value:"notifications",children:[n.jsx(ae,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_notifications")]}),n.jsxs(J,{value:"pomodoro",children:[n.jsx(q,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_pomodoro")]}),n.jsxs(J,{value:"usage",children:[n.jsx(te,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_usage")]}),n.jsxs(J,{value:"language",children:[n.jsx(le,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_language")]})]}),n.jsx(ee,{value:"sync",children:n.jsx(_e,{})}),n.jsx(ee,{value:"hub",children:n.jsx(ve,{})}),n.jsx(ee,{value:"notifications",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.browser_notify.title")}),n.jsx("p",{className:"text-xs text-muted-foreground",children:e("settings.browser_notify.description")})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.webhook.title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.webhook.description")})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(x,{className:"text-xs",children:"Webhook URL"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(u,{placeholder:"https://hooks.slack.com/...",value:j,onChange:e=>b(e.target.value),className:"font-mono text-xs"}),n.jsx(p,{size:"sm",onClick:()=>{(async()=>{f(!0);try{const s=await A({webhookEnabled:j.trim().length>0,webhookUrl:j.trim()||void 0});g(s),m.success(e("settings.webhook.saved"))}catch{m.error(e("settings.webhook.save_failed"))}finally{f(!1)}})()},disabled:y,children:e(y?"common.saving":"common.save")})]}),h.webhookEnabled&&h.webhookUrl&&n.jsxs("p",{className:"text-xs text-green-500",children:[e("settings.webhook.enabled_prefix")," ",h.webhookUrl]})]})]})]})}),n.jsx(ee,{value:"pomodoro",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.section_title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.pomodoro.section_desc")})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-6 max-w-xs",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(x,{className:"text-xs",children:e("settings.pomodoro.work_minutes")}),n.jsx(u,{type:"number",min:1,max:120,value:l.workMinutes,onChange:e=>k("workMinutes",e.target.value),className:"w-full"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(x,{className:"text-xs",children:e("settings.pomodoro.break_minutes")}),n.jsx(u,{type:"number",min:1,max:60,value:l.breakMinutes,onChange:e=>k("breakMinutes",e.target.value),className:"w-full"})]})]}),r&&n.jsxs(p,{size:"sm",onClick:()=>{V(F.pomodoroConfig,l,!0),d(!1),m.success(e("settings.pomodoro.saved"))},children:[n.jsx(Q,{className:"h-3.5 w-3.5 mr-1.5"}),e("common.save")]})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.howto_title")}),n.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[n.jsxs("li",{children:[n.jsx(q,{className:"h-3 w-3 inline-block mx-0.5"})," ",e("settings.pomodoro.howto_item_1")]}),n.jsx("li",{children:e("settings.pomodoro.howto_item_2")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_3")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_4")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_5")})]})]})]})}),n.jsx(ee,{value:"usage",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.section_title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.usage.section_desc")})]}),n.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=>n.jsxs("label",{className:"flex items-start gap-3 rounded-md border p-3 cursor-pointer transition-colors "+(_===s.key?"border-blue-500/50 bg-blue-500/5":"border-border hover:bg-muted/30"),children:[n.jsx("input",{type:"radio",name:"usageTool",value:s.key,checked:_===s.key,onChange:()=>{v(s.key),V(F.usageMonitorTool,s.key),window.dispatchEvent(new Event("ccweb:usage-tool-change")),m.success(e("settings.usage.switched_toast",{tool:s.label}))},className:"mt-0.5"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:s.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:s.desc})]})]},s.key))})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.info_title")}),n.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[n.jsx("li",{children:e("settings.usage.info_item_1")}),n.jsx("li",{children:e("settings.usage.info_item_2")}),n.jsx("li",{children:e("settings.usage.info_item_3")}),n.jsx("li",{children:e("settings.usage.info_item_4")})]})]})]})}),n.jsx(ee,{value:"language",children:n.jsx("div",{className:"space-y-6",children:n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[n.jsx("div",{children:n.jsx("h3",{className:"text-sm font-medium",children:e("language.label")})}),n.jsx(ke,{})]})})})]})]})})}export{Ne as SettingsPage};
13
+ */var oe="Switch",[de]=i(oe),[he,me]=de(oe),xe=s.forwardRef((e,i)=>{const{__scopeSwitch:r,name:o,checked:d,defaultChecked:h,required:m,disabled:x,value:u="on",onCheckedChange:p,form:g,...j}=e,[b,y]=s.useState(null),f=t(i,e=>y(e)),_=s.useRef(!1),v=!b||(g||!!b.closest("form")),[k,N]=a({prop:d,defaultProp:h??!1,onChange:p,caller:oe});return n.jsxs(he,{scope:r,checked:k,disabled:x,children:[n.jsx(c.button,{type:"button",role:"switch","aria-checked":k,"aria-required":m,"data-state":je(k),"data-disabled":x?"":void 0,disabled:x,value:u,...j,ref:f,onClick:l(e.onClick,e=>{N(e=>!e),v&&(_.current=e.isPropagationStopped(),_.current||e.stopPropagation())})}),v&&n.jsx(ge,{control:b,bubbles:!_.current,name:o,value:u,checked:k,required:m,disabled:x,form:g,style:{transform:"translateX(-100%)"}})]})});xe.displayName=oe;var ue="SwitchThumb",pe=s.forwardRef((e,s)=>{const{__scopeSwitch:t,...a}=e,l=me(ue,t);return n.jsx(c.span,{"data-state":je(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:s})});pe.displayName=ue;var ge=s.forwardRef(({__scopeSwitch:e,control:a,checked:c,bubbles:l=!0,...i},r)=>{const o=s.useRef(null),d=t(o,r),h=O(c),m=U(a);return s.useEffect(()=>{const e=o.current;if(!e)return;const s=window.HTMLInputElement.prototype,t=Object.getOwnPropertyDescriptor(s,"checked").set;if(h!==c&&t){const s=new Event("click",{bubbles:l});t.call(e,c),e.dispatchEvent(s)}},[h,c,l]),n.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:c,...i,tabIndex:-1,ref:d,style:{...i.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function je(e){return e?"checked":"unchecked"}ge.displayName="SwitchBubbleInput";var be=xe,ye=pe;const fe=s.forwardRef(({className:e,...s},t)=>n.jsx(be,{className:r("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...s,ref:t,children:n.jsx(ye,{className:r("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")})}));fe.displayName=be.displayName;function _e(){const{t:e}=o(),[t,a]=s.useState(null),[c,l]=s.useState(!0),[i,r]=s.useState(!1),[k,N]=s.useState(!1),[w,C]=s.useState(!1),[S,M]=s.useState(!1),[E,T]=s.useState(null),[R,P]=s.useState(0),[I,H]=s.useState(""),[L,F]=s.useState("");d({onStart:e=>{T(e.projectId),P(0)},onProgress:e=>{T(e.projectId),P(e.filesTransferred)},onDone:()=>{T(null),P(0)}}),s.useEffect(()=>{let s=!1;return h().then(e=>{s||(a(e),F(e.defaultExcludes.join("\n")))}).catch(s=>m.error(e("sync_section.load_failed",{message:s.message}))).finally(()=>{s||l(!1)}),()=>{s=!0}},[e]);const z=(e,s)=>{a(t=>t?{...t,[e]:s}:t)};return c||!t?n.jsx("div",{className:"text-sm text-muted-foreground",children:e("sync_section.loading")}):n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.server_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-host",children:e("sync_section.host")}),n.jsx(u,{id:"sync-host",value:t.host,onChange:e=>z("host",e.target.value),placeholder:"example.com"})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-port",children:e("sync_section.port")}),n.jsx(u,{id:"sync-port",type:"number",value:t.port,onChange:e=>z("port",Number(e.target.value)||22)})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-user",children:e("sync_section.user")}),n.jsx(u,{id:"sync-user",value:t.user,onChange:e=>z("user",e.target.value),placeholder:"tom"})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-remote",children:e("sync_section.remote_root")}),n.jsx(u,{id:"sync-remote",value:t.remoteRoot,onChange:e=>z("remoteRoot",e.target.value),placeholder:"/data/projects"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.remote_root_hint")}})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.auth_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{children:e("sync_section.auth_method")}),n.jsxs(G,{value:t.authMethod,onValueChange:e=>z("authMethod",e),children:[n.jsx(B,{children:n.jsx(D,{})}),n.jsxs(Q,{children:[n.jsx(W,{value:"key",children:"SSH key"}),n.jsx(W,{value:"password",children:e("sync_section.auth_password")})]})]})]}),"key"===t.authMethod?n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-key",children:e("sync_section.key_path")}),n.jsx(u,{id:"sync-key",value:t.keyPath??"",onChange:e=>z("keyPath",e.target.value),placeholder:"~/.ssh/id_rsa"})]}):n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-pw",children:e("sync_section.password")}),n.jsx(u,{id:"sync-pw",type:"password",value:I,onChange:e=>H(e.target.value),placeholder:t.passwordSet?e("sync_section.password_set_placeholder"):e("sync_section.password_unset_placeholder")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.sshpass_hint")}})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.strategy_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{children:e("sync_section.direction")}),n.jsxs(G,{value:t.direction,onValueChange:e=>z("direction",e),children:[n.jsx(B,{children:n.jsx(D,{})}),n.jsxs(Q,{children:[n.jsx(W,{value:"push",children:e("sync_section.push_label")}),n.jsx(W,{value:"pull",children:e("sync_section.pull_label")}),n.jsx(W,{value:"bidirectional",children:e("sync_section.bidirectional_label")})]})]})]}),n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx(x,{htmlFor:"sync-cron",children:e("sync_section.cron_label")}),n.jsx(u,{id:"sync-cron",value:t.schedule.cron,onChange:e=>z("schedule",{...t.schedule,cron:e.target.value}),placeholder:"0 3 * * *"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.cron_hint")}})]}),n.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[n.jsx(fe,{checked:t.schedule.enabled,onCheckedChange:e=>z("schedule",{...t.schedule,enabled:e})}),n.jsx("span",{className:"text-xs text-muted-foreground",children:e("sync_section.enable_label")})]})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.exclude_section")}),n.jsx("textarea",{value:L,onChange:e=>F(e.target.value),rows:6,className:"w-full font-mono text-xs p-2 rounded border border-input bg-background resize-y",placeholder:"node_modules/\n.git/objects/\n*.log"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.exclude_hint")}})]}),n.jsxs("div",{className:"flex flex-wrap gap-2 pt-2 border-t",children:[n.jsxs(p,{onClick:()=>{(async()=>{if(t){r(!0);try{const s=L.split("\n").map(e=>e.trim()).filter(Boolean),n={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};I&&"__keep__"!==I&&(n.password=I);const c=await y(n);a(c),F(c.defaultExcludes.join("\n")),H(""),m.success(e("sync_section.saved"))}catch(s){m.error(e("sync_section.save_failed",{message:s.message}))}finally{r(!1)}}})()},disabled:i,children:[i?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx($,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.save_button")]}),n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{N(!0);try{const s=await f();s.ok?m.success(s.message||e("sync_section.test_ok")):m.error(s.message||e("sync_section.test_failed"))}catch(s){m.error(e("sync_section.test_failed_with_reason",{message:s.message}))}finally{N(!1)}})()},disabled:k,children:[k?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(ie,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.test_button")]}),n.jsx("div",{className:"flex-1"}),w&&E&&n.jsx("span",{className:"text-xs text-muted-foreground self-center mr-1 tabular-nums",children:R>0?e("sync_section.syncing_with_files",{project:E,files:R}):e("sync_section.syncing_no_files",{project:E})}),n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{C(!0);try{const s=await _(),t=s.results.filter(e=>e.ok).length,a=s.results.filter(e=>e.skipped).length,n=s.results.filter(e=>"cancelled"===e.reason).length,c=s.total-t-a-n;n>0?m.info(e("sync_section.bulk_cancelled_toast",{ok:t,skipped:a,cancelled:n,failed:c})):m.success(e("sync_section.bulk_done_toast",{ok:t,skipped:a,failed:c}))}catch(s){m.error(e("sync_section.bulk_failed_toast",{message:s.message}))}finally{C(!1),M(!1),T(null),P(0)}})()},disabled:w,title:e("sync_section.sync_all_title"),children:[w?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(K,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.sync_all_button")]}),w&&n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{if(w&&!S){M(!0);try{await v(),m.info(e("sync_section.cancel_requested"))}catch(s){m.error(e("sync_section.cancel_failed",{message:s.message})),M(!1)}}})()},disabled:S,title:e("sync_section.cancel_button_title"),children:[S?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(j,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.cancel_button")]})]}),n.jsxs("div",{className:"border-t pt-4 text-xs text-muted-foreground",children:["Per-project push/pull: from inside a project, click the ",n.jsx(K,{className:"inline h-3 w-3"})," / ",n.jsx(b,{className:"inline h-3 w-3"})," buttons in the header. Or call ",n.jsx("code",{children:"POST /api/sync/project/:id"})," with body ",n.jsx("code",{children:'{ "direction": "push" }'}),"."]})]})}function ve(){const e=k(),[t,a]=s.useState(null),[c,l]=s.useState(!0),[i,r]=s.useState(""),[o,d]=s.useState(!1);s.useEffect(()=>{let e=!1;return N().then(s=>{e||a(s)}).catch(()=>{e||a({configured:!1,needsReset:!1})}).finally(()=>{e||l(!1)}),()=>{e=!0}},[]);return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-1",children:"CCWeb Hub 直接提交"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:['配置你的 GitHub PAT 后,在 Quick Prompts / Agent Prompts 卡片右键选择"共享"时可一键直接提交 Issue 到 ',n.jsx("code",{children:"zbc0315/ccweb-hub"}),"。 ccweb 本身不自带 token —— 使用你自己的账号身份提交,归属清晰,互不影响。"]})]}),c?n.jsxs("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[n.jsx(g,{className:"h-4 w-4 animate-spin"}),"加载中…"]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"rounded-md border px-3 py-2.5 text-xs flex items-center gap-2",children:(null==t?void 0:t.configured)?n.jsxs(n.Fragment,{children:[n.jsx(se,{className:"h-4 w-4 text-green-500 shrink-0"}),n.jsx("span",{children:"已配置 token,可直接提交"}),n.jsx("div",{className:"flex-1"}),n.jsxs(p,{size:"sm",variant:"outline",onClick:()=>{(async()=>{if(await e({title:"清除 Hub Token",description:"清除后将无法直接提交到 ccweb-hub,需要重新配置 token。确认?",destructive:!0,confirmLabel:"清除"}))try{await C(),a({configured:!1,needsReset:!1}),m.success("已清除")}catch(s){m.error(`清除失败: ${s.message}`)}})()},children:[n.jsx(w,{className:"h-3.5 w-3.5 mr-1"}),"清除"]})]}):(null==t?void 0:t.needsReset)?n.jsxs(n.Fragment,{children:[n.jsx(X,{className:"h-4 w-4 text-amber-500 shrink-0"}),n.jsx("span",{children:"之前的 token 已失效(服务端密钥可能已轮换),请重新设置"})]}):n.jsxs(n.Fragment,{children:[n.jsx(X,{className:"h-4 w-4 text-muted-foreground shrink-0"}),n.jsx("span",{children:"尚未配置 token"})]})}),n.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2.5 text-xs space-y-2",children:[n.jsx("div",{className:"font-medium text-foreground",children:"如何获取 token"}),n.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-muted-foreground",children:[n.jsxs("li",{children:["打开"," ",n.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new",target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline inline-flex items-center gap-0.5",children:["GitHub fine-grained PAT",n.jsx(ne,{className:"h-3 w-3"})]})," ","创建页"]}),n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:"Repository access"}),':选 "Only select repositories",添加 ',n.jsx("code",{children:"zbc0315/ccweb-hub"})]}),n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:"Repository permissions → Issues"}),':设置为 "Read and write"']}),n.jsx("li",{children:"其余权限保持默认(全部无访问)"}),n.jsx("li",{children:"生成后复制 token 粘贴到下方"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs(x,{htmlFor:"hub-token",className:"text-xs",children:["GitHub Token ",(null==t?void 0:t.configured)&&n.jsx("span",{className:"text-muted-foreground",children:"(填写会覆盖现有 token)"})]}),n.jsx(u,{id:"hub-token",type:"password",placeholder:"github_pat_...",value:i,onChange:e=>r(e.target.value),autoComplete:"off",spellCheck:!1}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Token 以 AES-256-GCM 加密存储于 ",n.jsx("code",{children:"~/.ccweb/hub-auth/"}),";per-user 独立,不会被其他用户读到。"]})]}),n.jsx("div",{className:"flex gap-2 pt-2 border-t",children:n.jsxs(p,{onClick:()=>{(async()=>{const e=i.trim();if(e){d(!0);try{const s=await S(e);a(s),r(""),m.success("已保存")}catch(s){m.error(`保存失败: ${s.message}`)}finally{d(!1)}}else m.error("请输入 token")})()},disabled:o||!i.trim(),children:[o?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx($,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})})]})]})}function ke(){const{t:e,i18n:s}=o();return n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(le,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs(G,{value:s.language,onValueChange:async t=>{if(M.includes(t)){try{localStorage.setItem(E,t)}catch{}await s.changeLanguage(t);try{await T(t)}catch{m.error(e("language.switch_failed"))}}},children:[n.jsx(B,{className:"w-40",children:n.jsx(D,{})}),n.jsxs(Q,{children:[n.jsx(W,{value:"zh",children:e("language.zh")}),n.jsx(W,{value:"en",children:e("language.en")})]})]})]})}function Ne(){const{t:e}=o(),t=R(),[a]=P(),c=a.get("tab")||"sync",[l,i]=s.useState(()=>I()),[r,d]=s.useState(!1),[h,g]=s.useState({webhookEnabled:!1}),[j,b]=s.useState(""),[y,f]=s.useState(!1),[_,v]=s.useState(()=>H(L.usageMonitorTool,"claude"));s.useEffect(()=>{F().then(e=>{g(e),b(e.webhookUrl??"")}).catch(()=>{})},[]);const k=(e,s)=>{const t=parseInt(s,10);isNaN(t)||t<1||(i(s=>({...s,[e]:t})),d(!0))};return n.jsx("div",{className:"min-h-screen bg-background",children:n.jsxs("div",{className:"max-w-3xl mx-auto p-6",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsxs(p,{variant:"ghost",size:"sm",onClick:()=>t("/"),children:[n.jsx(z,{className:"h-4 w-4 mr-1"}),e("common.back")]}),n.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:e("settings.title")})]}),n.jsxs(Y,{defaultValue:c,children:[n.jsxs(Z,{className:"mb-4",children:[n.jsxs(J,{value:"sync",children:[n.jsx(re,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_sync")]}),n.jsxs(J,{value:"hub",children:[n.jsx(ce,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_hub")]}),n.jsxs(J,{value:"notifications",children:[n.jsx(ae,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_notifications")]}),n.jsxs(J,{value:"pomodoro",children:[n.jsx(q,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_pomodoro")]}),n.jsxs(J,{value:"usage",children:[n.jsx(te,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_usage")]}),n.jsxs(J,{value:"language",children:[n.jsx(le,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_language")]})]}),n.jsx(ee,{value:"sync",children:n.jsx(_e,{})}),n.jsx(ee,{value:"hub",children:n.jsx(ve,{})}),n.jsx(ee,{value:"notifications",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.browser_notify.title")}),n.jsx("p",{className:"text-xs text-muted-foreground",children:e("settings.browser_notify.description")})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.webhook.title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.webhook.description")})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(x,{className:"text-xs",children:"Webhook URL"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(u,{placeholder:"https://hooks.slack.com/...",value:j,onChange:e=>b(e.target.value),className:"font-mono text-xs"}),n.jsx(p,{size:"sm",onClick:()=>{(async()=>{f(!0);try{const s=await A({webhookEnabled:j.trim().length>0,webhookUrl:j.trim()||void 0});g(s),m.success(e("settings.webhook.saved"))}catch{m.error(e("settings.webhook.save_failed"))}finally{f(!1)}})()},disabled:y,children:e(y?"common.saving":"common.save")})]}),h.webhookEnabled&&h.webhookUrl&&n.jsxs("p",{className:"text-xs text-green-500",children:[e("settings.webhook.enabled_prefix")," ",h.webhookUrl]})]})]})]})}),n.jsx(ee,{value:"pomodoro",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.section_title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.pomodoro.section_desc")})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-6 max-w-xs",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(x,{className:"text-xs",children:e("settings.pomodoro.work_minutes")}),n.jsx(u,{type:"number",min:1,max:120,value:l.workMinutes,onChange:e=>k("workMinutes",e.target.value),className:"w-full"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(x,{className:"text-xs",children:e("settings.pomodoro.break_minutes")}),n.jsx(u,{type:"number",min:1,max:60,value:l.breakMinutes,onChange:e=>k("breakMinutes",e.target.value),className:"w-full"})]})]}),r&&n.jsxs(p,{size:"sm",onClick:()=>{V(L.pomodoroConfig,l,!0),d(!1),m.success(e("settings.pomodoro.saved"))},children:[n.jsx($,{className:"h-3.5 w-3.5 mr-1.5"}),e("common.save")]})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.howto_title")}),n.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[n.jsxs("li",{children:[n.jsx(q,{className:"h-3 w-3 inline-block mx-0.5"})," ",e("settings.pomodoro.howto_item_1")]}),n.jsx("li",{children:e("settings.pomodoro.howto_item_2")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_3")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_4")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_5")})]})]})]})}),n.jsx(ee,{value:"usage",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.section_title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.usage.section_desc")})]}),n.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=>n.jsxs("label",{className:"flex items-start gap-3 rounded-md border p-3 cursor-pointer transition-colors "+(_===s.key?"border-blue-500/50 bg-blue-500/5":"border-border hover:bg-muted/30"),children:[n.jsx("input",{type:"radio",name:"usageTool",value:s.key,checked:_===s.key,onChange:()=>{v(s.key),V(L.usageMonitorTool,s.key),window.dispatchEvent(new Event("ccweb:usage-tool-change")),m.success(e("settings.usage.switched_toast",{tool:s.label}))},className:"mt-0.5"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:s.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:s.desc})]})]},s.key))})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.info_title")}),n.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[n.jsx("li",{children:e("settings.usage.info_item_1")}),n.jsx("li",{children:e("settings.usage.info_item_2")}),n.jsx("li",{children:e("settings.usage.info_item_3")}),n.jsx("li",{children:e("settings.usage.info_item_4")})]})]})]})}),n.jsx(ee,{value:"language",children:n.jsx("div",{className:"space-y-6",children:n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[n.jsx("div",{children:n.jsx("h3",{className:"text-sm font-medium",children:e("language.label")})}),n.jsx(ke,{})]})})})]})]})})}export{Ne as SettingsPage};
@@ -1,13 +1,13 @@
1
- import{c as e,aH as s,r as t,bg as a,bh as r,t as n,bi as l,bj as i,bk as c,ac as d,bl as o,j as m,B as x,aK as u,d as p,I as h,T as g,p as f,D as j,aC as b,aD as N,A as y,ao as v,au as k}from"./index-DUIOrPha.js";import{S as w,U as C}from"./user-Chl3LWFq.js";import{C as S}from"./chevron-down-D4Vj-5wB.js";
1
+ import{c as e,aN as s,r as t,bm as a,bn as r,t as n,bo as l,bp as i,bq as c,ac as d,br as o,j as m,B as x,aQ as u,d as p,I as h,T as g,q as f,D as j,aC as b,aD as N,A as y,ao as v,au as w}from"./index-B5mDtgD1.js";import{S as k,U as C}from"./user-BOTyiGCj.js";import{C as S}from"./chevron-down-DqAoFpmS.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 P=e("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),E=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"}]]);
7
+ */const P=e("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),q=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"}]]);
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,D]=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),D(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]),B=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:"卸载失败")}},[]),K=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]=t.useState([]),[J,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])=>{G(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(E,{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:()=>K(e.id,!e.enabled),title:e.enabled?"禁用":"启用",children:m.jsx(P,{className:p("h-4 w-4",e.enabled?"text-green-500":"text-muted-foreground")})}),m.jsx(x,{size:"sm",variant:"ghost",onClick:()=>B(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(E,{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(j,{className:"h-3.5 w-3.5 mr-1"}),t?"安装中...":"安装"]})]},e.id)})})]})]})]}),"prompts"===z&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[m.jsx(A,{active:"all"===Y,onClick:()=>ee("all"),children:"全部"}),m.jsxs(A,{active:"quick-prompt"===Y,onClick:()=>ee("quick-prompt"),children:[m.jsx(b,{className:"h-3 w-3"}),"Quick Prompts"]}),m.jsxs(A,{active:"agent-prompt"===Y,onClick:()=>ee("agent-prompt"),children:[m.jsx(N,{className:"h-3 w-3"}),"Agent Prompts"]})]}),de.length>0&&m.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[m.jsx(L,{active:null===se,onClick:()=>te(null),children:"全部标签"}),de.map(e=>m.jsx(L,{active:se===e,onClick:()=>te(se===e?null:e),children:e},e))]}),J&&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}),!J&&!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 卡片上右键选择"共享"来提交第一个吧!'})]}),!J&&!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(b,{className:"h-2.5 w-2.5"}):m.jsx(N,{className:"h-2.5 w-2.5"}),"quick-prompt"===e.kind?"Quick":"Agent"]}),m.jsx("h3",{className:"font-medium text-sm truncate",children:e.label}),null==(t=e.tags)?void 0:t.map(e=>m.jsxs("span",{className:"inline-flex items-center gap-0.5 px-2 py-0.5 rounded-full text-xs bg-muted text-muted-foreground",children:[m.jsx(q,{className:"h-2.5 w-2.5"}),e]},e))]}),e.description&&m.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:e.description}),m.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[e.author&&m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx(C,{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(j,{className:"h-3.5 w-3.5 mr-1"}),r?"已导入":l?"导入中...":"导入"]}),m.jsx(f.span,{animate:{rotate:a?180:0},transition:{duration:.2},children:m.jsx(S,{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,Q]=t.useState(""),[_,F]=t.useState([]),[W,D]=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])=>{F(e),D(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(()=>[]);F(s)}catch(s){n.error(s instanceof Error?s.message:"安装失败")}finally{U(null)}}},[T]),B=t.useCallback(async e=>{try{await l(e),F(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),F(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(q,{className:"h-3.5 w-3.5"}),"插件"]})]}),m.jsx("div",{className:"flex-1"}),m.jsxs("div",{className:"relative w-64",children:[m.jsx(k,{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=>Q(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(P,{className:p("h-4 w-4",e.enabled?"text-green-500":"text-muted-foreground")})}),m.jsx(x,{size:"sm",variant:"ghost",onClick:()=>B(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(q,{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(j,{className:"h-3.5 w-3.5 mr-1"}),t?"安装中...":"安装"]})]},e.id)})})]})]})]}),"prompts"===z&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[m.jsx(A,{active:"all"===Y,onClick:()=>ee("all"),children:"全部"}),m.jsxs(A,{active:"quick-prompt"===Y,onClick:()=>ee("quick-prompt"),children:[m.jsx(b,{className:"h-3 w-3"}),"Quick Prompts"]}),m.jsxs(A,{active:"agent-prompt"===Y,onClick:()=>ee("agent-prompt"),children:[m.jsx(N,{className:"h-3 w-3"}),"Agent Prompts"]})]}),de.length>0&&m.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[m.jsx(L,{active:null===se,onClick:()=>te(null),children:"全部标签"}),de.map(e=>m.jsx(L,{active:se===e,onClick:()=>te(se===e?null:e),children:e},e))]}),K&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),V&&m.jsx("div",{className:"text-center text-destructive py-20",children:V}),!K&&!V&&0===G.length&&m.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[m.jsx("p",{className:"text-lg mb-2",children:"CCWeb Hub 还没有 prompt"}),m.jsx("p",{className:"text-sm",children:'在 Quick Prompts 或 Agent Prompts 卡片上右键选择"共享"来提交第一个吧!'})]}),!K&&!V&&G.length>0&&0===oe.length&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的 prompt"}),m.jsx("div",{className:"space-y-3",children:oe.map((e,s)=>{var t;const a=ae===e.id,r=ne.has(e.id),l=ie===e.id;return m.jsxs(f.div,{layout:!0,initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:.03*s,ease:"easeOut"},className:"rounded-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(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(C,{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 w({label:e.label,command:e.body}),n.success("已导入到全局 Agent Prompts")),le(s=>new Set(s).add(e.id))}catch(t){n.error(t instanceof Error?t.message:"导入失败")}finally{ce(null)}}})(e,s)},title:"quick-prompt"===e.kind?"导入到全局快捷 Prompts":"导入到全局 Agent Prompts",children:[m.jsx(j,{className:"h-3.5 w-3.5 mr-1"}),r?"已导入":l?"导入中...":"导入"]}),m.jsx(f.span,{animate:{rotate:a?180:0},transition:{duration:.2},children:m.jsx(S,{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-DUIOrPha.js";
1
+ import{c as o}from"./index-B5mDtgD1.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *