@tom2012/cc-web 2026.4.23-g → 2026.4.23-h

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 (20) hide show
  1. package/README.md +1 -1
  2. package/backend/dist/routes/filesystem.d.ts.map +1 -1
  3. package/backend/dist/routes/filesystem.js +55 -10
  4. package/backend/dist/routes/filesystem.js.map +1 -1
  5. package/frontend/dist/assets/{AssistantMessageContent-cp44M5-N.js → AssistantMessageContent-DnVqSquL.js} +1 -1
  6. package/frontend/dist/assets/{GraphPreview-BdDwOttu.js → GraphPreview-Pk1mwaUx.js} +1 -1
  7. package/frontend/dist/assets/{MobilePage-D9fNYlVW.js → MobilePage-BZTHZcoN.js} +3 -3
  8. package/frontend/dist/assets/{OfficePreview-BkvETBGR.js → OfficePreview-w9UCmjcC.js} +2 -2
  9. package/frontend/dist/assets/{ProjectPage-DVSS4L5-.js → ProjectPage-zD6vObwd.js} +4 -4
  10. package/frontend/dist/assets/{SettingsPage-CCGrCJ8H.js → SettingsPage-CtAlTMC0.js} +1 -1
  11. package/frontend/dist/assets/{SkillHubPage-5lb1bV5N.js → SkillHubPage-CfF3SPUE.js} +1 -1
  12. package/frontend/dist/assets/{chevron-down-9vAKETIc.js → chevron-down-DDsKpWGy.js} +1 -1
  13. package/frontend/dist/assets/{chevron-up-DetzMyPo.js → chevron-up-DBW0g8sF.js} +1 -1
  14. package/frontend/dist/assets/{index-C3br4lV-.js → index-BprQxUQs.js} +1 -1
  15. package/frontend/dist/assets/{index-BOod62M1.js → index-DIXpAmRD.js} +2 -2
  16. package/frontend/dist/assets/{index-A1ow-4Ih.js → index-DhLWQREd.js} +1 -1
  17. package/frontend/dist/assets/{jszip.min-H1vMAeM8.js → jszip.min-7BwG3j23.js} +1 -1
  18. package/frontend/dist/assets/{search-CewI57f1.js → search-B5sN2qrh.js} +1 -1
  19. package/frontend/dist/index.html +1 -1
  20. package/package.json +1 -1
@@ -1,17 +1,17 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GraphPreview-BdDwOttu.js","assets/index-BOod62M1.js","assets/index-ChWqp_e7.css","assets/purify.es-CgRAQgUo.js","assets/AssistantMessageContent-cp44M5-N.js","assets/chevron-down-9vAKETIc.js","assets/chevron-up-DetzMyPo.js","assets/AssistantMessageContent-wklAmtGL.css","assets/index-C3br4lV-.js","assets/search-CewI57f1.js","assets/OfficePreview-BkvETBGR.js"])))=>i.map(i=>d[i]);
2
- var e,t,i,s,r,n;import{c as o,u as a,r as l,a as h,g as c,b as d,w as u,t as f,j as _,d as p,E as m,P as g,M as v,e as b,X as S,f as w,h as x,S as y,R as C,_ as k,s as E,i as N,k as R,D as M,T as D,l as L,F as P,m as T,n as j,C as B,o as A,A as O,p as I,q as z,v as W,B as H,x as F,y as $,I as U,z as K,G as q,H as V,J as Y,K as X,L as G,N as J,O as Z,Q,U as ee,V as te,W as ie,Y as se,Z as re,$ as ne,a0 as oe,a1 as ae,a2 as le,a3 as he,a4 as ce,a5 as de,a6 as ue,a7 as fe,a8 as _e,a9 as pe,aa as me,ab as ge,ac as ve,ad as be,ae as Se,af as we,ag as xe,ah as ye,ai as Ce,aj as ke,ak as Ee,al as Ne,am as Re,an as Me,ao as De,ap as Le,aq as Pe,ar as Te,as as je,at as Be,au as Ae,av as Oe,aw as Ie,ax as ze,ay as We,az as He,aA as Fe,aB as $e,aC as Ue,aD as Ke,aE as qe,aF as Ve,aG as Ye,aH as Xe,aI as Ge,aJ as Je,aK as Ze,aL as Qe,aM as et,aN as tt,aO as it,aP as st,aQ as rt,aR as nt,aS as ot,aT as at,aU as lt,aV as ht,aW as ct,aX as dt,aY as ut,aZ as ft,a_ as _t,a$ as pt,b0 as mt,b1 as gt}from"./index-BOod62M1.js";import{p as vt}from"./purify.es-CgRAQgUo.js";import{F as bt,M as St,r as wt,a as xt,b as yt,h as Ct,o as kt,c as Et,I as Nt,C as Rt,u as Mt,A as Dt,T as Lt,d as Pt}from"./AssistantMessageContent-cp44M5-N.js";import{S as Tt,U as jt,T as Bt,a as At,b as Ot,c as It,u as zt,R as Wt,A as Ht,d as Ft,e as $t,f as Ut,I as Kt,g as qt,C as Vt,h as Yt,i as Xt,j as Gt}from"./index-C3br4lV-.js";import{C as Jt}from"./chevron-down-9vAKETIc.js";import{S as Zt}from"./search-CewI57f1.js";import{C as Qt}from"./chevron-up-DetzMyPo.js";
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GraphPreview-Pk1mwaUx.js","assets/index-DIXpAmRD.js","assets/index-ChWqp_e7.css","assets/purify.es-CgRAQgUo.js","assets/AssistantMessageContent-DnVqSquL.js","assets/chevron-down-DDsKpWGy.js","assets/chevron-up-DBW0g8sF.js","assets/AssistantMessageContent-wklAmtGL.css","assets/index-BprQxUQs.js","assets/search-B5sN2qrh.js","assets/OfficePreview-w9UCmjcC.js"])))=>i.map(i=>d[i]);
2
+ var e,t,i,s,r,n;import{c as o,u as a,r as l,a as h,g as c,b as d,w as u,t as f,j as _,d as p,E as m,P as g,M as v,e as b,X as S,f as w,h as x,S as y,R as C,_ as k,s as E,i as N,k as R,D as M,T as D,l as L,F as P,m as T,n as j,C as B,o as A,A as O,p as I,q as z,v as W,B as H,x as F,y as $,I as U,z as K,G as q,H as V,J as Y,K as X,L as G,N as J,O as Z,Q,U as ee,V as te,W as ie,Y as se,Z as re,$ as ne,a0 as oe,a1 as ae,a2 as le,a3 as he,a4 as ce,a5 as de,a6 as ue,a7 as fe,a8 as _e,a9 as pe,aa as me,ab as ge,ac as ve,ad as be,ae as Se,af as we,ag as xe,ah as ye,ai as Ce,aj as ke,ak as Ee,al as Ne,am as Re,an as Me,ao as De,ap as Le,aq as Pe,ar as Te,as as je,at as Be,au as Ae,av as Oe,aw as Ie,ax as ze,ay as We,az as He,aA as Fe,aB as $e,aC as Ue,aD as Ke,aE as qe,aF as Ve,aG as Ye,aH as Xe,aI as Ge,aJ as Je,aK as Ze,aL as Qe,aM as et,aN as tt,aO as it,aP as st,aQ as rt,aR as nt,aS as ot,aT as at,aU as lt,aV as ht,aW as ct,aX as dt,aY as ut,aZ as ft,a_ as _t,a$ as pt,b0 as mt,b1 as gt}from"./index-DIXpAmRD.js";import{p as vt}from"./purify.es-CgRAQgUo.js";import{F as bt,M as St,r as wt,a as xt,b as yt,h as Ct,o as kt,c as Et,I as Nt,C as Rt,u as Mt,A as Dt,T as Lt,d as Pt}from"./AssistantMessageContent-DnVqSquL.js";import{S as Tt,U as jt,T as Bt,a as At,b as Ot,c as It,u as zt,R as Wt,A as Ht,d as Ft,e as $t,f as Ut,I as Kt,g as qt,C as Vt,h as Yt,i as Xt,j as Gt}from"./index-BprQxUQs.js";import{C as Jt}from"./chevron-down-DDsKpWGy.js";import{S as Zt}from"./search-B5sN2qrh.js";import{C as Qt}from"./chevron-up-DBW0g8sF.js";
3
3
  /**
4
4
  * @license lucide-react v0.309.0 - ISC
5
5
  *
6
6
  * This source code is licensed under the ISC license.
7
7
  * See the LICENSE file in the root directory of this source tree.
8
- */const ei=o("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),ti=o("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),ii=o("ClipboardCopy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),si=o("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),ri=o("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),ni=o("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),oi=o("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),ai=o("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]),li=o("ListRestart",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M7 12H3",key:"13ou7f"}],["path",{d:"M7 18H3",key:"1sijw9"}],["path",{d:"M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14",key:"qth677"}],["path",{d:"M11 10v4h4",key:"172dkj"}]]),hi=o("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]),ci=o("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]),di=o("MoreVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),ui=o("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),fi=o("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),_i=o("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),pi=o("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]),mi=o("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]),gi=o("StopCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{width:"6",height:"6",x:"9",y:"9",key:"1wrtvo"}]]),vi=o("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),bi=o("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),Si=C.lazy(()=>k(()=>import("./GraphPreview-BdDwOttu.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(e=>({default:e.GraphPreview}))),wi=C.lazy(()=>k(()=>import("./OfficePreview-BkvETBGR.js"),__vite__mapDeps([10,1,2,3])).then(e=>({default:e.OfficePreview}))),xi=new Set(["docx","xlsx","xls","pptx"]),yi={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};
8
+ */const ei=o("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),ti=o("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),ii=o("ClipboardCopy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),si=o("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]),ri=o("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),ni=o("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),oi=o("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),ai=o("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]),li=o("ListRestart",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M7 12H3",key:"13ou7f"}],["path",{d:"M7 18H3",key:"1sijw9"}],["path",{d:"M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14",key:"qth677"}],["path",{d:"M11 10v4h4",key:"172dkj"}]]),hi=o("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]),ci=o("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]),di=o("MoreVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),ui=o("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),fi=o("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),_i=o("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),pi=o("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]),mi=o("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]),gi=o("StopCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{width:"6",height:"6",x:"9",y:"9",key:"1wrtvo"}]]),vi=o("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),bi=o("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),Si=C.lazy(()=>k(()=>import("./GraphPreview-Pk1mwaUx.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(e=>({default:e.GraphPreview}))),wi=C.lazy(()=>k(()=>import("./OfficePreview-w9UCmjcC.js"),__vite__mapDeps([10,1,2,3])).then(e=>({default:e.OfficePreview}))),xi=new Set(["docx","xlsx","xls","pptx"]),yi={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};
9
9
  /**
10
10
  * @license lucide-react v0.309.0 - ISC
11
11
  *
12
12
  * This source code is licensed under the ISC license.
13
13
  * See the LICENSE file in the root directory of this source tree.
14
- */const Ci=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","tiff","tif"]);function ki(e){return"md"===e?"Markdown":"html"===e||"htm"===e?"HTML":"高亮"}const Ei=[50,75,100,125,150,200,250,300],Ni=100;function Ri({filePath:e,onClose:t}){const i=a(),s=e.endsWith("/.notebook/graph.yaml"),r=s?e.replace(/\/.notebook\/graph\.yaml$/,""):"",[n,o]=l.useState(null),[C,k]=l.useState(null),[N,R]=l.useState(()=>s?"graph":"rendered"),[M,D]=l.useState(!1),[L,P]=l.useState(Ni),[T,j]=l.useState(""),[B,A]=l.useState(!1),[O,I]=l.useState(!1),z=l.useRef(null),[W,H]=l.useState(!0),{resolved:F}=h(),$=e.split("/").pop()??e,U=l.useMemo(()=>function(e){const t=e.split("/").pop()??"",i=t.toLowerCase();if("dockerfile"===i)return"dockerfile";if("makefile"===i)return"makefile";const s=t.lastIndexOf(".");return s>=0?t.slice(s+1).toLowerCase():""}(e),[e]),K=Ci.has(U),q=xi.has(U),V=function(e){return"md"===e||"html"===e||"htm"===e||e in yi}(U),Y=yi[U]||U,X=l.useMemo(()=>{if(!K)return"";const t=w(e),i=c(),s=`${t}&t=${Date.now()}`;return i?`${s}&token=${encodeURIComponent(i)}`:s},[e,K]);l.useEffect(()=>{if(H(!0),o(null),k(null),P(function(e){const t=x(y.fileZoom,{},!0)[e];return Ei.includes(t)?t:Ni}(e)),I(!1),K||q)return o({path:e,binary:!1,tooLarge:!1,size:0,content:null}),void R("rendered");R(e.endsWith("/.notebook/graph.yaml")?"graph":"rendered"),d(e).then(e=>{o(e),j(e.content??"")}).catch(e=>k(e instanceof Error?e.message:"Failed to load file"))},[e,K,q]);const G=l.useCallback(async()=>{A(!0);try{await u(e,T),o(e=>e?{...e,content:T,size:new Blob([T]).size}:e),I(!1)}catch(t){f.error(t instanceof Error?t.message:"保存失败")}finally{A(!1)}},[e,T]);l.useEffect(()=>{const e=e=>{(e.metaKey||e.ctrlKey)&&"s"===e.key&&"edit"===N&&(e.preventDefault(),G())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[N,G]),l.useEffect(()=>{const e=async e=>{if("Escape"===e.key&&W){if(O){if(!(await i({description:"有未保存的修改,确定关闭?",confirmLabel:"放弃修改",destructive:!0})))return}t()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[W,t,O,i]);const J=async()=>{if(O){if(!(await i({description:"有未保存的修改,确定退出编辑?",confirmLabel:"放弃修改",destructive:!0})))return}R(s?"graph":V?"rendered":"plain"),I(!1)},Z=t=>{P(t),function(e,t){const i=x(y.fileZoom,{},!0);t===Ni?delete i[e]:i[e]=t,E(y.fileZoom,i,!0)}(e,t)},Q=(null==n?void 0:n.content)??"",ee="dark"===F?kt:Et,te=L/100*12,ie=n&&!n.binary&&!n.tooLarge,se=l.useDeferredValue(T),re=l.useMemo(()=>{var e,t;if(!n||n.binary||n.tooLarge)return null;if(K||q)return null;const i="edit"===N?se:Q;if(null==i)return null;return{bytes:new Blob([i]).size,words:((null==(e=i.match(/[\u4e00-\u9fff\u3400-\u4dbf]/g))?void 0:e.length)??0)+((null==(t=i.replace(/[\u4e00-\u9fff\u3400-\u4dbf]/g," ").match(/[a-zA-Z0-9]+/g))?void 0:t.length)??0),lines:""===i?0:i.split("\n").length}},[n,K,q,N,se,Q]);return _.jsx("div",{className:p("fixed inset-0 z-50 flex items-center justify-center transition-all duration-200",W?"bg-black/60 backdrop-blur-sm pointer-events-auto":"bg-transparent pointer-events-none"),onClick:e=>{e.target===e.currentTarget&&H(!1)},children:_.jsxs("div",{className:p("relative flex flex-col bg-background border border-border shadow-sm transition-all duration-200 pointer-events-auto",M?"w-screen h-screen rounded-none":"w-[72vw] max-w-4xl h-[80vh] rounded-xl",!W&&!M&&"opacity-50"),onClick:()=>H(!0),onFocus:e=>{e.stopPropagation(),H(!0)},children:[_.jsxs("div",{className:"flex items-center gap-2 px-4 h-10 border-b border-border flex-shrink-0",children:[_.jsx(bt,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),_.jsxs("span",{className:"flex-1 text-sm text-foreground font-medium truncate",title:e,children:[$,O&&_.jsx("span",{className:"text-muted-foreground ml-1",children:"*"}),re&&_.jsxs("span",{className:"text-muted-foreground font-normal ml-2 text-xs tabular-nums",children:[(ne=re.bytes,ne<1024?`${ne} B`:ne<1048576?`${(ne/1024).toFixed(1)} KB`:`${(ne/1024/1024).toFixed(2)} MB`)," · ",re.words.toLocaleString()," 词 · ",re.lines.toLocaleString()," 行"]})]}),ie&&!K&&!q&&_.jsxs("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:[V&&_.jsxs(_.Fragment,{children:[_.jsxs("button",{onClick:()=>"edit"===N?J():R("plain"),className:p("p-1 rounded-md transition-colors flex items-center gap-1 text-xs","plain"===N?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"纯文本",children:[_.jsx(si,{className:"h-3 w-3"}),_.jsx("span",{className:"hidden sm:inline",children:"源码"})]}),_.jsxs("button",{onClick:()=>"edit"===N?J():R("rendered"),className:p("p-1 rounded-md transition-colors flex items-center gap-1 text-xs","rendered"===N?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:ki(U),children:[_.jsx(m,{className:"h-3 w-3"}),_.jsx("span",{className:"hidden sm:inline",children:ki(U)})]})]}),s&&_.jsxs("button",{onClick:()=>"edit"===N?J():R("graph"),className:p("p-1 rounded-md transition-colors flex items-center gap-1 text-xs","graph"===N?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"图谱",children:[_.jsx(ui,{className:"h-3 w-3"}),_.jsx("span",{className:"hidden sm:inline",children:"图谱"})]}),_.jsxs("button",{onClick:()=>"edit"===N?J():(j((null==n?void 0:n.content)??""),I(!1),R("edit"),void setTimeout(()=>{var e;return null==(e=z.current)?void 0:e.focus()},0)),className:p("p-1 rounded-md transition-colors flex items-center gap-1 text-xs","edit"===N?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"编辑",children:[_.jsx(g,{className:"h-3 w-3"}),_.jsx("span",{className:"hidden sm:inline",children:"编辑"})]})]}),"edit"===N&&_.jsxs("button",{onClick:()=>{G()},disabled:B||!O,className:p("flex items-center gap-1 text-xs px-2 py-1 rounded transition-colors",O?"bg-blue-600 hover:bg-blue-500 text-white":"bg-muted text-muted-foreground"),title:"保存 (⌘S)",children:[_.jsx(Tt,{className:"h-3 w-3"}),B?"保存中...":"保存"]}),(ie||K)&&"edit"!==N&&"graph"!==N&&_.jsxs("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5 gap-0.5",children:[_.jsx("button",{onClick:()=>{const e=[...Ei].reverse().find(e=>e<L);e&&Z(e)},disabled:L<=Ei[0],className:"p-1 rounded-md text-muted-foreground hover:text-foreground transition-colors disabled:opacity-30",title:"缩小",children:_.jsx(bi,{className:"h-3 w-3"})}),_.jsxs("button",{onClick:()=>Z(Ni),className:"px-1 text-xs text-muted-foreground hover:text-foreground transition-colors min-w-[36px] text-center",title:"重置缩放",children:[L,"%"]}),_.jsx("button",{onClick:()=>{const e=Ei.find(e=>e>L);e&&Z(e)},disabled:L>=Ei[Ei.length-1],className:"p-1 rounded-md text-muted-foreground hover:text-foreground transition-colors disabled:opacity-30",title:"放大",children:_.jsx(vi,{className:"h-3 w-3"})})]}),_.jsx("button",{className:"p-1 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:()=>D(e=>!e),title:M?"退出全屏":"全屏",children:M?_.jsx(v,{className:"h-3.5 w-3.5"}):_.jsx(b,{className:"h-3.5 w-3.5"})}),_.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:async()=>{if(O){if(!(await i({description:"有未保存的修改,确定关闭?",confirmLabel:"放弃修改",destructive:!0})))return}t()},children:_.jsx(S,{className:"h-4 w-4"})})]}),_.jsxs("div",{className:p("flex-1 min-h-0","graph"===N?"overflow-hidden":"overflow-auto"),children:["graph"===N&&_.jsx(l.Suspense,{fallback:_.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"Loading…"}),children:_.jsx(Si,{folderPath:r})}),"graph"!==N&&!n&&!C&&_.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"Loading…"}),"graph"!==N&&C&&_.jsx("p",{className:"text-sm text-red-400 p-4",children:C}),"graph"!==N&&K&&n&&_.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:_.jsx("img",{src:X,alt:$,className:"max-w-full max-h-full object-contain rounded",style:{transform:`scale(${L/100})`,transformOrigin:"center center"},draggable:!1})}),"graph"!==N&&q&&n&&_.jsx(l.Suspense,{fallback:_.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"Loading…"}),children:_.jsx(wi,{filePath:e,ext:U,zoom:L})}),"graph"!==N&&!K&&!q&&n&&n.binary&&_.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-muted-foreground p-4",children:[_.jsx(bt,{className:"h-8 w-8"}),_.jsx("p",{className:"text-sm",children:"Binary file — cannot preview"}),_.jsxs("p",{className:"text-xs text-muted-foreground",children:[(n.size/1024).toFixed(1)," KB"]})]}),"graph"!==N&&!q&&n&&n.tooLarge&&_.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-muted-foreground p-4",children:[_.jsx(bt,{className:"h-8 w-8"}),_.jsx("p",{className:"text-sm",children:"File too large to preview"}),_.jsxs("p",{className:"text-xs text-muted-foreground",children:[(n.size/1024/1024).toFixed(2)," MB (limit 5 MB)"]})]}),"graph"!==N&&ie&&null!==Q&&_.jsxs(_.Fragment,{children:["edit"===N&&_.jsx("textarea",{ref:z,value:T,onChange:e=>{j(e.target.value),I(!0)},className:"w-full h-full bg-transparent text-foreground font-mono outline-none resize-none p-4 leading-relaxed",style:{fontSize:`${te}px`,minHeight:"100%"},spellCheck:!1}),"edit"!==N&&_.jsxs("div",{className:"p-4",style:{fontSize:`${te}px`},children:["plain"===N&&_.jsx("pre",{className:"font-mono text-foreground whitespace-pre-wrap break-words leading-relaxed",style:{fontSize:"inherit"},children:Q}),"rendered"===N&&"md"===U&&_.jsx("div",{className:"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-pre:border-border prose-code:text-foreground",style:{fontSize:"inherit"},children:_.jsx(St,{remarkPlugins:[xt,yt],rehypePlugins:[wt],components:{code({className:e,children:t,...i}){const s=/language-(\w+)/.exec(e||"");return!s&&!e?_.jsx("code",{className:e,...i,children:t}):_.jsx(Ct,{style:ee,language:(null==s?void 0:s[1])||"text",PreTag:"div",customStyle:{fontSize:"inherit",borderRadius:"6px",margin:0},children:String(t).replace(/\n$/,"")})}},children:Q})}),"rendered"===N&&("html"===U||"htm"===U)&&_.jsx("iframe",{srcDoc:vt.sanitize(Q,{WHOLE_DOCUMENT:!0,ADD_TAGS:["style","link"]}),className:"w-full h-full border-0 rounded bg-white",sandbox:"",title:$,style:{minHeight:"60vh",transform:`scale(${L/100})`,transformOrigin:"top left",width:1e4/L+"%",height:1e4/L+"%"}}),"rendered"===N&&"md"!==U&&"html"!==U&&"htm"!==U&&Y&&_.jsx(Ct,{style:ee,language:Y,showLineNumbers:!0,lineNumberStyle:{color:"dark"===F?"#555":"#aaa",fontSize:"inherit"},customStyle:{fontSize:"inherit",borderRadius:"6px",margin:0,background:"transparent"},children:Q}),"rendered"===N&&!V&&_.jsx("pre",{className:"font-mono text-foreground whitespace-pre-wrap break-words leading-relaxed",style:{fontSize:"inherit"},children:Q})]})]})]})]})});var ne}const Mi=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","tiff","tif"]);function Di(e){const t=e.lastIndexOf(".");return t>=0&&Mi.has(e.slice(t+1).toLowerCase())}function Li({projectPath:e,projectId:t}){const[i,s]=l.useState(new Map),[r,n]=l.useState(new Set([e])),[o,h]=l.useState(new Set),d=N(e=>e.get(t).filePreviewPath),u=N(e=>e.setFilePreviewPath),m=e=>u(t,e),[g,v]=l.useState(null),[b,S]=l.useState(!1),[x,y]=l.useState(!1),C=a(),k=l.useRef(null),E=l.useRef(null);l.useEffect(()=>{if(!g)return;const e=()=>v(null);return window.addEventListener("click",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("click",e),window.removeEventListener("scroll",e,!0)}},[g]);const z=async t=>{if(0!==t.length){S(!0);try{await j(e,t),W(e)}catch(i){console.error("[FileTree] Upload failed:",i)}finally{S(!1)}}},W=l.useCallback(async e=>{h(t=>{if(t.has(e))return t;const i=new Set(t);return i.add(e),i});try{const t=await R(e);s(i=>new Map(i).set(e,t.entries))}catch(t){console.error("[FileTree] Failed to load:",e,t),s(t=>new Map(t).set(e,[]))}finally{h(t=>{const i=new Set(t);return i.delete(e),i})}},[]);l.useEffect(()=>{s(new Map),n(new Set([e])),h(new Set),W(e)},[e,W]);const H=l.useCallback(e=>{n(t=>{const s=new Set(t);return s.has(e)?s.delete(e):(s.add(e),i.has(e)||W(e)),s})},[i,W]),F=l.useCallback(()=>{s(new Map),n(new Set([e])),h(new Set),W(e)},[e,W]),$=(e,t)=>e.map(e=>{const s=r.has(e.path),n=o.has(e.path),a=i.get(e.path),l=e.name.startsWith(".");return _.jsxs("div",{children:[_.jsxs("div",{className:p("flex items-center gap-1 py-[3px] rounded cursor-pointer","hover:bg-muted-foreground/10",l&&"opacity-50"),style:{paddingLeft:14*t+6+"px",paddingRight:"6px"},onClick:()=>"dir"===e.type?H(e.path):m(e.path),onContextMenu:t=>{t.preventDefault(),v({x:t.clientX,y:t.clientY,filePath:e.path,fileName:e.name,type:e.type})},children:[_.jsx("span",{className:"w-3 flex-shrink-0 text-muted-foreground",children:"dir"===e.type&&(n?_.jsx(L,{className:"h-2.5 w-2.5 animate-spin"}):s?_.jsx(Jt,{className:"h-2.5 w-2.5"}):_.jsx(B,{className:"h-2.5 w-2.5"}))}),"dir"===e.type?s?_.jsx(P,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}):_.jsx(A,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}):Di(e.name)?_.jsx(Nt,{className:"h-3.5 w-3.5 text-green-400 flex-shrink-0"}):_.jsx(bt,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),_.jsx("span",{className:p("text-xs truncate leading-none","dir"===e.type?"text-foreground":"text-muted-foreground"),title:e.path,children:e.name})]}),_.jsx(O,{initial:!1,children:"dir"===e.type&&s&&_.jsxs(I.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15,ease:"easeInOut"},className:"overflow-hidden",children:[!a&&!n&&_.jsx("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:14*(t+1)+6+16+"px"},children:"—"}),0===(null==a?void 0:a.length)&&_.jsx("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:14*(t+1)+6+16+"px"},children:"empty"}),a&&a.length>0&&$(a,t+1)]})})]},e.path)}),U=i.get(e),K=o.has(e),q=e.split("/").filter(Boolean).pop()??e;return _.jsxs(_.Fragment,{children:[d&&_.jsx(Ri,{filePath:d,onClose:()=>m(null)}),g&&_.jsxs("div",{ref:k,className:"fixed z-50 min-w-[140px] bg-popover border border-border rounded-md shadow-md py-1",style:{left:g.x,top:g.y},onClick:e=>e.stopPropagation(),children:[_.jsxs("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground text-left",onClick:()=>{const t=g.filePath.startsWith(e+"/")?g.filePath.slice(e.length+1):g.filePath;navigator.clipboard.writeText(t),f.success("已复制相对路径"),v(null)},children:[_.jsx(ri,{className:"h-3.5 w-3.5"}),"复制相对路径"]}),_.jsxs("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground text-left",onClick:()=>{navigator.clipboard.writeText(g.filePath),f.success("已复制绝对路径"),v(null)},children:[_.jsx(ii,{className:"h-3.5 w-3.5"}),"复制绝对路径"]}),"file"===g.type&&_.jsxs(_.Fragment,{children:[_.jsx("div",{className:"my-1 border-t border-border"}),_.jsxs("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground text-left",onClick:()=>{(async(e,t)=>{let i=w(e);const s=c();s&&(i+=`${i.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`),i+=(i.includes("?")?"&":"?")+"dl=1";try{const e=await fetch(i);if(!e.ok){const t=await e.text().catch(()=>"");let i=`下载失败 (${e.status})`;try{i=JSON.parse(t).error||i}catch{}return void f.error(i)}const s=await e.blob(),r=URL.createObjectURL(s),n=document.createElement("a");n.href=r,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}catch{f.error("下载失败:网络错误")}})(g.filePath,g.fileName),v(null)},children:[_.jsx(M,{className:"h-3.5 w-3.5"}),"下载"]})]}),_.jsx("div",{className:"my-1 border-t border-border"}),_.jsxs("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-destructive/80 hover:text-destructive-foreground text-left",onClick:()=>{(async(t,s,r)=>{const n="dir"===r?`文件夹 "${s}" 及其所有内容`:`文件 "${s}"`;if(await C({title:"确认删除",description:`确认删除${n}?此操作不可撤销。`,destructive:!0,confirmLabel:"删除"}))try{await T(t),f.success(`已删除: ${s}`);const r=t.substring(0,t.lastIndexOf("/"));r&&i.has(r)?W(r):W(e)}catch(o){f.error(`删除失败: ${o.message}`)}})(g.filePath,g.fileName,g.type),v(null)},children:[_.jsx(D,{className:"h-3.5 w-3.5"}),"删除"]})]}),_.jsxs("div",{className:"h-full flex flex-col text-foreground select-none",children:[_.jsxs("div",{className:"flex items-center justify-between px-3 h-9 border-b border-border flex-shrink-0",children:[_.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Files"}),_.jsxs("div",{className:"flex items-center gap-0.5",children:[_.jsx("input",{ref:E,type:"file",multiple:!0,className:"hidden",onChange:e=>{const t=Array.from(e.target.files??[]);t.length>0&&z(t),e.target.value=""}}),_.jsx("button",{className:"text-muted-foreground hover:text-foreground p-0.5 rounded transition-colors",onClick:()=>{var e;return null==(e=E.current)?void 0:e.click()},disabled:b,title:"上传文件",children:_.jsx(jt,{className:p("h-3 w-3",b&&"animate-pulse")})}),_.jsx("button",{className:"text-muted-foreground hover:text-foreground p-0.5 rounded transition-colors",onClick:F,title:"Refresh file tree",children:_.jsx(L,{className:p("h-3 w-3",K&&"animate-spin")})})]})]}),_.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b border-border flex-shrink-0",children:[_.jsx(P,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}),_.jsx("span",{className:"text-xs text-foreground font-medium truncate",title:e,children:q})]}),_.jsxs("div",{className:p("flex-1 overflow-y-auto py-1 min-h-0 transition-colors",x&&"bg-accent/30 ring-1 ring-inset ring-accent"),onDragOver:e=>{e.preventDefault(),y(!0)},onDragEnter:e=>{e.preventDefault(),y(!0)},onDragLeave:()=>y(!1),onDrop:e=>{e.preventDefault(),y(!1);const t=Array.from(e.dataTransfer.files);t.length>0&&z(t)},children:[b&&_.jsx("div",{className:"text-xs text-muted-foreground px-4 py-1",children:"上传中..."}),x&&!b&&_.jsx("div",{className:"text-xs text-muted-foreground px-4 py-1",children:"松开以上传文件"}),K&&!U?_.jsx("div",{className:"text-xs text-muted-foreground px-4 py-3",children:"Loading…"}):U&&0!==U.length?$(U,0):_.jsx("div",{className:"text-xs text-muted-foreground px-4 py-3",children:"Empty folder"})]})]})]})}function Pi(e){const t=new Date(e),i=Date.now()-t.getTime();return i<36e5?`${Math.floor(i/6e4)}分钟前`:i<864e5?`${Math.floor(i/36e5)}小时前`:i<6048e5?`${Math.floor(i/864e5)}天前`:t.toLocaleDateString()}function Ti({projectId:e}){const[t,i]=l.useState(null),[s,r]=l.useState(!0),[n,o]=l.useState(null),[a,h]=l.useState(null),[c,d]=l.useState(""),[u,m]=l.useState(!1),[g,v]=l.useState([]),[b,S]=l.useState(0),[w,x]=l.useState(!0),[y,C]=l.useState(!1),k=l.useCallback(async()=>{r(!0);try{i(await z(e))}catch{i(null)}finally{r(!1)}},[e]),E=l.useCallback(async(t=!1)=>{C(!0);try{const i=t?g.length:0,s=await W(e,30,i);v(e=>t?[...e,...s.commits]:s.commits),S(s.total)}catch{}finally{C(!1)}},[e,g.length]);l.useEffect(()=>{k(),E()},[e]);const N=async t=>{try{const{diff:i}=await K(e,t);o(i||"(no diff)"),h(t??"all changes")}catch{f.error("获取 diff 失败")}},R=async t=>{try{await q(e,[t]),f.success(`已暂存 ${t}`),await k()}catch{f.error("git add 失败")}},M=async()=>{if(c.trim()){m(!0);try{await V(e,c),f.success("提交成功"),d(""),await k()}catch(t){f.error(t instanceof Error?t.message:"提交失败")}finally{m(!1)}}};if(!t&&s)return _.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-muted-foreground/50 text-xs",children:[_.jsx(oi,{className:"h-5 w-5"}),_.jsx("p",{children:"加载中…"})]});if(!t||!t.isRepo)return _.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-muted-foreground/50 text-xs",children:[_.jsx(oi,{className:"h-5 w-5"}),_.jsx("p",{children:t?"非 Git 仓库":"加载失败"}),_.jsx(H,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>{k()},children:"重试"})]});const D=[...t.modified??[],...t.deleted??[]],P=t.staged??[],T=t.untracked??[];return _.jsxs("div",{className:"flex flex-col h-full overflow-y-auto p-2 space-y-2 text-xs",children:[_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground font-medium",children:[_.jsx(oi,{className:"h-3 w-3"}),_.jsx("span",{children:t.branch}),(t.ahead??0)>0&&_.jsxs("span",{className:"text-blue-400",children:["↑",t.ahead]}),(t.behind??0)>0&&_.jsxs("span",{className:"text-yellow-400",children:["↓",t.behind]})]}),_.jsx(H,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>{k()},disabled:s,children:_.jsx(L,{className:p("h-3 w-3",s&&"animate-spin")})})]}),P.length>0&&_.jsxs("div",{children:[_.jsxs("div",{className:"text-muted-foreground mb-1 font-medium",children:["已暂存 (",P.length,")"]}),P.map(e=>_.jsxs("div",{className:"flex items-center gap-1 py-0.5 px-1 rounded hover:bg-muted-foreground/10",children:[_.jsx(F,{className:"h-2.5 w-2.5 text-green-500 flex-shrink-0"}),_.jsx("button",{className:"flex-1 text-left truncate text-green-400",onClick:()=>{N(e)},children:e})]},e))]}),D.length>0&&_.jsxs("div",{children:[_.jsxs("div",{className:"text-muted-foreground mb-1 font-medium",children:["未暂存 (",D.length,")"]}),D.map(e=>_.jsxs("div",{className:"flex items-center gap-1 py-0.5 px-1 rounded hover:bg-muted-foreground/10",children:[_.jsx("button",{className:"flex-shrink-0 h-4 w-4 flex items-center justify-center rounded hover:bg-green-500/20 text-muted-foreground hover:text-green-400",title:"git add",onClick:()=>{R(e)},children:_.jsx($,{className:"h-2.5 w-2.5"})}),_.jsx("button",{className:"flex-1 text-left truncate text-yellow-400",onClick:()=>{N(e)},children:e})]},e))]}),T.length>0&&_.jsxs("div",{children:[_.jsxs("div",{className:"text-muted-foreground mb-1 font-medium",children:["未跟踪 (",T.length,")"]}),T.map(e=>_.jsxs("div",{className:"flex items-center gap-1 py-0.5 px-1 rounded hover:bg-muted-foreground/10",children:[_.jsx("button",{className:"flex-shrink-0 h-4 w-4 flex items-center justify-center rounded hover:bg-green-500/20 text-muted-foreground hover:text-green-400",title:"git add",onClick:()=>{R(e)},children:_.jsx($,{className:"h-2.5 w-2.5"})}),_.jsx("span",{className:"flex-1 truncate text-muted-foreground",children:e})]},e))]}),0===D.length&&0===P.length&&0===T.length&&_.jsx("p",{className:"text-muted-foreground/50 text-center py-4",children:"工作区干净"}),P.length>0&&_.jsxs("div",{className:"space-y-1.5 pt-1 border-t border-border",children:[_.jsx(U,{placeholder:"提交消息…",value:c,onChange:e=>d(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||M()},className:"h-7 text-xs"}),_.jsx(H,{size:"sm",className:"w-full h-7 text-xs",onClick:()=>{M()},disabled:!c.trim()||u,children:u?"提交中…":`提交 (${P.length} 文件)`})]}),(null==t?void 0:t.isRepo)&&_.jsxs("div",{className:"border-t border-border pt-2",children:[_.jsxs("button",{className:"flex items-center gap-1 text-muted-foreground font-medium mb-1 w-full text-left",onClick:()=>x(e=>!e),children:[_.jsx(Jt,{className:p("h-3 w-3 transition-transform",!w&&"-rotate-90")}),_.jsx(ai,{className:"h-3 w-3"}),_.jsxs("span",{children:["提交历史 (",b,")"]})]}),w&&_.jsxs("div",{className:"space-y-0.5",children:[g.map((e,t)=>{const i=e.parents.length>1;return _.jsxs("div",{className:"flex gap-1.5 items-start group",children:[_.jsxs("div",{className:"flex flex-col items-center flex-shrink-0 w-3",children:[_.jsx("div",{className:p("w-2 h-2 rounded-full flex-shrink-0 mt-1",0===t?"bg-blue-400":i?"bg-purple-400":"bg-muted-foreground/40")}),t<g.length-1&&_.jsx("div",{className:"w-px flex-1 bg-border min-h-[12px]"})]}),_.jsxs("div",{className:"flex-1 min-w-0 pb-1",children:[_.jsxs("div",{className:"flex items-baseline gap-1",children:[_.jsx("span",{className:"font-mono text-muted-foreground/60 text-[10px] flex-shrink-0",children:e.hashShort}),_.jsx("span",{className:"truncate leading-tight",children:e.message.split("\n")[0]})]}),_.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/50 mt-0.5",children:[_.jsx("span",{children:e.author}),_.jsx("span",{children:Pi(e.date)}),e.branches.length>0&&e.branches.slice(0,2).map(e=>_.jsx("span",{className:"px-1 py-px rounded bg-blue-500/10 text-blue-400 text-[9px]",children:e.replace("remotes/origin/","↑")},e))]})]})]},e.hash)}),g.length<b&&_.jsx("button",{className:"w-full text-center text-[10px] text-muted-foreground hover:text-foreground py-1",onClick:()=>{E(!0)},disabled:y,children:y?"加载中...":`加载更多 (${g.length}/${b})`})]})]}),null!==n&&_.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",onClick:()=>o(null),children:[_.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),_.jsxs("div",{className:"relative z-10 w-[700px] max-w-[95vw] max-h-[80vh] flex flex-col bg-background border border-border rounded-xl shadow-sm",onClick:e=>e.stopPropagation(),children:[_.jsxs("div",{className:"flex items-center justify-between px-4 h-10 border-b border-border text-sm font-medium flex-shrink-0",children:[_.jsx("span",{className:"truncate text-muted-foreground",children:a}),_.jsx("button",{className:"text-muted-foreground hover:text-foreground",onClick:()=>o(null),children:"✕"})]}),_.jsx("pre",{className:"flex-1 overflow-auto p-3 text-[11px] font-mono whitespace-pre leading-relaxed",children:n.split("\n").map((e,t)=>_.jsx("span",{className:p("block",e.startsWith("+")&&!e.startsWith("+++")&&"text-green-400 bg-green-400/5",e.startsWith("-")&&!e.startsWith("---")&&"text-red-400 bg-red-400/5",e.startsWith("@@")&&"text-blue-400"),children:e},t))})]})]})]})}function ji(e){if(!e)return"-";const t=e-Date.now(),i=Math.abs(t),s=t<0,r=Math.round(i/1e3);if(r<60)return s?`${r} 秒前`:`${r} 秒后`;const n=Math.round(r/60);if(n<60)return s?`${n} 分钟前`:`${n} 分钟后`;const o=Math.round(n/60);if(o<24)return s?`${o} 小时前`:`${o} 小时后`;const a=Math.round(o/24);return s?`${a} 天前`:`${a} 天后`}function Bi(e){if(!e)return"";return new Date(e).toLocaleString(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function Ai({projectId:e}){const[t,i]=l.useState(null),[s,r]=l.useState(!0),[n,o]=l.useState(null),[,a]=l.useState(0),h=l.useRef(!0),c=l.useCallback(async()=>{r(!0),o(null);try{const{tasks:t}=await Y(e);if(!h.current)return;i(t)}catch(xa){if(!h.current)return;o(xa.message),i([])}finally{h.current&&r(!1)}},[e]);return l.useEffect(()=>{h.current=!0,c();const e=setInterval(()=>{c()},3e4),t=setInterval(()=>a(e=>e+1),1e3);return()=>{h.current=!1,clearInterval(e),clearInterval(t)}},[c]),_.jsxs("div",{className:"h-full flex flex-col bg-muted text-foreground overflow-hidden",children:[_.jsxs("div",{className:"flex-shrink-0 px-3 py-2 flex items-center justify-between border-b border-border",children:[_.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[_.jsx(Rt,{className:"size-4"}),_.jsx("span",{children:"已排程任务"})]}),_.jsx(H,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{c()},title:"刷新","aria-label":"刷新",children:_.jsx(L,{className:p("size-3.5",s&&"animate-spin")})})]}),_.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-2 space-y-1.5",children:[n&&_.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 text-destructive p-2 text-xs",children:n}),!n&&t&&0===t.length&&!s&&_.jsxs("div",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:[_.jsx("p",{children:"本项目暂无已排程任务"}),_.jsxs("p",{className:"mt-2 leading-relaxed",children:["仅显示 ",_.jsx("code",{className:"text-[10px] bg-muted-foreground/10 px-1 rounded",children:"durable"})," 任务 (Claude 通过 ",_.jsx("code",{className:"text-[10px] bg-muted-foreground/10 px-1 rounded",children:"/loop"})," 或"," ",_.jsx("code",{className:"text-[10px] bg-muted-foreground/10 px-1 rounded",children:"CronCreate durable:true"})," 创建的)。"]}),_.jsx("p",{className:"mt-1 text-muted-foreground/70",children:"session-only 任务在 CLI 内存中,此处不可见。"})]}),t&&t.map(e=>{const t=e.nextFireAt?Date.parse(e.nextFireAt):null,i=e.lastFiredAt??null;return _.jsx("div",{className:"rounded-md border border-border bg-background px-2.5 py-2 text-xs",children:_.jsxs("div",{className:"flex items-start gap-2",children:[_.jsx("div",{className:"shrink-0 mt-0.5 text-muted-foreground",children:e.recurring?_.jsx(mi,{className:"size-3.5"}):_.jsx(X,{className:"size-3.5"})}),_.jsxs("div",{className:"flex-1 min-w-0",children:[_.jsx("div",{className:"font-medium text-foreground line-clamp-2 leading-snug",children:e.prompt.trim()||"(无 prompt)"}),_.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-muted-foreground",children:[_.jsx("code",{className:"text-[10px] bg-muted-foreground/10 px-1 rounded font-mono",children:e.cron}),_.jsx("span",{className:"text-muted-foreground/50",children:"·"}),_.jsx("span",{children:e.id.slice(0,8)}),e.recurring&&_.jsxs(_.Fragment,{children:[_.jsx("span",{className:"text-muted-foreground/50",children:"·"}),_.jsx("span",{children:"循环"})]})]}),_.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-muted-foreground",children:[null!==t&&_.jsxs("span",{title:Bi(t),children:["下次: ",_.jsx("span",{className:"text-foreground/90",children:ji(t)})]}),null!==i&&_.jsxs("span",{title:Bi(i),children:["上次: ",_.jsx("span",{className:"text-foreground/90",children:ji(i)})]})]})]})]})},e.id)}),s&&!t&&_.jsx("div",{className:"space-y-1.5",children:[0,1].map(e=>_.jsx("div",{className:"rounded-md border border-border bg-background px-2.5 py-2 h-16 animate-pulse"},e))})]})]})}function Oi(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(2)} GB`}function Ii(e){if(!e)return"-";const t=e-Date.now(),i=Math.abs(t),s=t<0,r=Math.round(i/1e3);if(r<60)return s?`${r} 秒前`:`${r} 秒后`;const n=Math.round(r/60);if(n<60)return s?`${n} 分钟前`:`${n} 分钟后`;const o=Math.round(n/60);if(o<24)return s?`${o} 小时前`:`${o} 小时后`;const a=Math.round(o/24);return s?`${a} 天前`:`${a} 天后`}function zi(e){return new Date(e).toLocaleString(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function Wi({projectId:e}){const[t,i]=l.useState(null),[s,r]=l.useState(!0),[n,o]=l.useState(!1),[a,h]=l.useState(null),[,c]=l.useState(0),d=l.useRef(!0),u=l.useCallback(async()=>{h(null);try{const t=await G(e);if(!d.current)return;i(t)}catch(xa){if(!d.current)return;h(xa.message)}finally{d.current&&r(!1)}},[e]),m=l.useCallback(async()=>{o(!0);try{const t=await J(e);if(!d.current)return;const i=[];t.copied>0&&i.push(`新增/更新 ${t.copied}`),t.deleted>0&&i.push(`删除 ${t.deleted}`),t.skipped>0&&i.push(`跳过 ${t.skipped}`),f.success(`同步完成:${i.join("·")||"无变化"}`),await u()}catch(xa){f.error(`同步失败:${xa.message}`)}finally{d.current&&o(!1)}},[e,u]);l.useEffect(()=>{d.current=!0,u();const e=setInterval(()=>{u()},3e4),t=setInterval(()=>c(e=>e+1),5e3);return()=>{d.current=!1,clearInterval(e),clearInterval(t)}},[u]);const g=(null==t?void 0:t.files.reduce((e,t)=>e+t.bytes,0))??0;return _.jsxs("div",{className:"h-full flex flex-col bg-muted text-foreground overflow-hidden",children:[_.jsxs("div",{className:"flex-shrink-0 px-3 py-2 flex items-center justify-between border-b border-border",children:[_.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[_.jsx(Z,{className:"size-4"}),_.jsx("span",{children:"聊天记录备份"})]}),_.jsx(H,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{u()},title:"刷新","aria-label":"刷新",disabled:s,children:_.jsx(L,{className:p("size-3.5",s&&"animate-spin")})})]}),_.jsx("div",{className:"flex-shrink-0 px-3 py-2 border-b border-border bg-background/40",children:_.jsxs("div",{className:"flex items-center justify-between gap-2",children:[_.jsxs("div",{className:"text-[11px] text-muted-foreground min-w-0",children:[_.jsxs("div",{children:["最后同步:"," ",_.jsx("span",{className:"text-foreground/90",title:(null==t?void 0:t.meta)?zi(t.meta.lastBackupAt):void 0,children:(null==t?void 0:t.meta)?Ii(t.meta.lastBackupAt):"从未同步"})]}),t&&_.jsxs("div",{className:"mt-0.5 text-muted-foreground/80",children:[t.files.length," 个文件 · ",Oi(g)]})]}),_.jsx(H,{size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{m()},disabled:n||!(null==t?void 0:t.supported),children:n?"同步中…":"立即同步"})]})}),_.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-2 space-y-1",children:[a&&_.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 text-destructive p-2 text-xs flex items-start gap-2",children:[_.jsx(ei,{className:"size-3.5 shrink-0 mt-0.5"}),_.jsx("span",{children:a})]}),t&&!t.supported&&_.jsx("div",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:_.jsxs("p",{children:["此项目使用 ",_.jsx("code",{className:"text-[10px] bg-muted-foreground/10 px-1 rounded",children:"terminal"})," 模式,无聊天记录需备份。"]})}),(null==t?void 0:t.supported)&&0===t.files.length&&!s&&!a&&_.jsxs("div",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:[_.jsx("p",{children:"暂无已备份的聊天记录"}),_.jsx("p",{className:"mt-2 leading-relaxed text-muted-foreground/80",children:'定时每 5 分钟同步一次,也可点击右上方"立即同步"手动触发。'}),_.jsxs("p",{className:"mt-1 text-muted-foreground/70",children:["备份路径: ",_.jsx("code",{className:"text-[10px] bg-muted-foreground/10 px-1 rounded break-all",children:t.backupDir})]})]}),null==t?void 0:t.files.map(e=>_.jsxs("div",{className:"rounded-md border border-border bg-background px-2.5 py-1.5 text-xs flex items-center gap-2 hover:bg-accent/50 transition-colors",children:[_.jsx(bt,{className:"size-3.5 shrink-0 text-muted-foreground"}),_.jsxs("div",{className:"flex-1 min-w-0",children:[_.jsx("div",{className:"font-mono text-[11px] text-foreground truncate",title:e.name,children:e.name}),_.jsxs("div",{className:"text-muted-foreground/80 text-[10px] flex items-center gap-2",children:[_.jsx("span",{title:zi(e.mtime),children:Ii(e.mtime)}),_.jsx("span",{className:"text-muted-foreground/40",children:"·"}),_.jsx("span",{children:Oi(e.bytes)})]})]})]},e.name)),s&&!t&&_.jsx("div",{className:"space-y-1",children:[0,1].map(e=>_.jsx("div",{className:"rounded-md border border-border bg-background h-10 animate-pulse"},e))})]})]})}function Hi({projectPath:e,projectId:t,cliTool:i}){const[s,r]=Q(y.leftPanelTab,"files"),n="claude"===i,o="terminal"!==i;let a;return a="git"===s?"git":"scheduled"===s&&n?"scheduled":"backup"===s&&o?"backup":"files",_.jsxs(Bt,{value:a,onValueChange:e=>r(e),orientation:"vertical",className:"h-full flex bg-muted text-foreground overflow-hidden",children:[_.jsxs(At,{className:p("flex flex-col items-center justify-start shrink-0","h-full w-9 border-r border-border rounded-none p-1 gap-1"),children:[_.jsx(Ot,{value:"files",title:"Files","aria-label":"Files",className:p("h-7 w-7 p-0 rounded-md flex items-center justify-center"),children:_.jsx(P,{className:"h-3.5 w-3.5"})}),_.jsx(Ot,{value:"git",title:"Git","aria-label":"Git",className:p("h-7 w-7 p-0 rounded-md flex items-center justify-center"),children:_.jsx(oi,{className:"h-3.5 w-3.5"})}),n&&_.jsx(Ot,{value:"scheduled",title:"已排程任务","aria-label":"Scheduled tasks",className:p("h-7 w-7 p-0 rounded-md flex items-center justify-center"),children:_.jsx(Rt,{className:"h-3.5 w-3.5"})}),o&&_.jsx(Ot,{value:"backup",title:"聊天记录备份","aria-label":"Sessions backup",className:p("h-7 w-7 p-0 rounded-md flex items-center justify-center"),children:_.jsx(Z,{className:"h-3.5 w-3.5"})})]}),_.jsxs("div",{className:"flex-1 min-w-0 flex flex-col border-l border-border",children:[_.jsx(It,{value:"files",className:"flex-1 min-h-0 mt-0 data-[state=inactive]:hidden",children:_.jsx(Li,{projectPath:e,projectId:t})}),_.jsx(It,{value:"git",className:"flex-1 min-h-0 mt-0 data-[state=inactive]:hidden",children:_.jsx(Ti,{projectId:t})}),n&&_.jsx(It,{value:"scheduled",className:"flex-1 min-h-0 mt-0 data-[state=inactive]:hidden",children:_.jsx(Ai,{projectId:t})}),o&&_.jsx(It,{value:"backup",className:"flex-1 min-h-0 mt-0 data-[state=inactive]:hidden",children:_.jsx(Wi,{projectId:t})})]})]})}function Fi(e){const t=$i(e),i=l.forwardRef((e,i)=>{const{children:s,...r}=e,n=l.Children.toArray(s),o=n.find(Ki);if(o){const e=o.props.children,s=n.map(t=>t===o?l.Children.count(e)>1?l.Children.only(null):l.isValidElement(e)?e.props.children:null:t);return _.jsx(t,{...r,ref:i,children:l.isValidElement(e)?l.cloneElement(e,void 0,s):null})}return _.jsx(t,{...r,ref:i,children:s})});return i.displayName=`${e}.Slot`,i}function $i(e){const t=l.forwardRef((e,t)=>{const{children:i,...s}=e;if(l.isValidElement(i)){const e=function(e){var t,i;let s=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,r=s&&"isReactWarning"in s&&s.isReactWarning;if(r)return e.ref;if(s=null==(i=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:i.get,r=s&&"isReactWarning"in s&&s.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(i),r=function(e,t){const i={...t};for(const s in t){const r=e[s],n=t[s];/^on[A-Z]/.test(s)?r&&n?i[s]=(...e)=>{const t=n(...e);return r(...e),t}:r&&(i[s]=r):"style"===s?i[s]={...r,...n}:"className"===s&&(i[s]=[r,n].filter(Boolean).join(" "))}return{...e,...i}}(s,i.props);return i.type!==l.Fragment&&(r.ref=t?ee(t,e):e),l.cloneElement(i,r)}return l.Children.count(i)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ui=Symbol("radix.slottable");function Ki(e){return l.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Ui}var qi=["Enter"," "],Vi=["ArrowUp","PageDown","End"],Yi=["ArrowDown","PageUp","Home",...Vi],Xi={ltr:[...qi,"ArrowRight"],rtl:[...qi,"ArrowLeft"]},Gi={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ji="Menu",[Zi,Qi,es]=Ut(Ji),[ts,is]=ie(Ji,[es,Ft,$t]),ss=Ft(),rs=$t(),[ns,os]=ts(Ji),[as,ls]=ts(Ji),hs=e=>{const{__scopeMenu:t,open:i=!1,children:s,dir:r,onOpenChange:n,modal:o=!0}=e,a=ss(t),[h,c]=l.useState(null),d=l.useRef(!1),u=te(n),f=zt(r);return l.useEffect(()=>{const e=()=>{d.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),_.jsx(Wt,{...a,children:_.jsx(ns,{scope:t,open:i,onOpenChange:u,content:h,onContentChange:c,children:_.jsx(as,{scope:t,onClose:l.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:d,dir:f,modal:o,children:s})})})};hs.displayName=Ji;var cs=l.forwardRef((e,t)=>{const{__scopeMenu:i,...s}=e,r=ss(i);return _.jsx(Ht,{...r,...s,ref:t})});cs.displayName="MenuAnchor";var ds="MenuPortal",[us,fs]=ts(ds,{forceMount:void 0}),_s=e=>{const{__scopeMenu:t,forceMount:i,children:s,container:r}=e,n=os(ds,t);return _.jsx(us,{scope:t,forceMount:i,children:_.jsx(se,{present:i||n.open,children:_.jsx(re,{asChild:!0,container:r,children:s})})})};_s.displayName=ds;var ps="MenuContent",[ms,gs]=ts(ps),vs=l.forwardRef((e,t)=>{const i=fs(ps,e.__scopeMenu),{forceMount:s=i.forceMount,...r}=e,n=os(ps,e.__scopeMenu),o=ls(ps,e.__scopeMenu);return _.jsx(Zi.Provider,{scope:e.__scopeMenu,children:_.jsx(se,{present:s||n.open,children:_.jsx(Zi.Slot,{scope:e.__scopeMenu,children:o.modal?_.jsx(bs,{...r,ref:t}):_.jsx(Ss,{...r,ref:t})})})})}),bs=l.forwardRef((e,t)=>{const i=os(ps,e.__scopeMenu),s=l.useRef(null),r=ne(t,s);return l.useEffect(()=>{const e=s.current;if(e)return le(e)},[]),_.jsx(xs,{...e,ref:r,trapFocus:i.open,disableOutsidePointerEvents:i.open,disableOutsideScroll:!0,onFocusOutside:oe(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>i.onOpenChange(!1)})}),Ss=l.forwardRef((e,t)=>{const i=os(ps,e.__scopeMenu);return _.jsx(xs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>i.onOpenChange(!1)})}),ws=Fi("MenuContent.ScrollLock"),xs=l.forwardRef((e,t)=>{const{__scopeMenu:i,loop:s=!1,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:h,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...g}=e,v=os(ps,i),b=ls(ps,i),S=ss(i),w=rs(i),x=Qi(i),[y,C]=l.useState(null),k=l.useRef(null),E=ne(t,k,v.onContentChange),N=l.useRef(0),R=l.useRef(""),M=l.useRef(0),D=l.useRef(null),L=l.useRef("right"),P=l.useRef(0),T=m?de:l.Fragment,j=m?{as:ws,allowPinchZoom:!0}:void 0,B=e=>{var t,i;const s=R.current+e,r=x().filter(e=>!e.disabled),n=document.activeElement,o=null==(t=r.find(e=>e.ref.current===n))?void 0:t.textValue,a=function(e,t,i){const s=t.length>1&&Array.from(t).every(e=>e===t[0]),r=s?t[0]:t,n=i?e.indexOf(i):-1;let o=(a=e,l=Math.max(n,0),a.map((e,t)=>a[(l+t)%a.length]));var a,l;1===r.length&&(o=o.filter(e=>e!==i));const h=o.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return h!==i?h:void 0}(r.map(e=>e.textValue),s,o),l=null==(i=r.find(e=>e.textValue===a))?void 0:i.ref.current;!function e(t){R.current=t,window.clearTimeout(N.current),""!==t&&(N.current=window.setTimeout(()=>e(""),1e3))}(s),l&&setTimeout(()=>l.focus())};l.useEffect(()=>()=>window.clearTimeout(N.current),[]),ce();const A=l.useCallback(e=>{var t,i;return L.current===(null==(t=D.current)?void 0:t.side)&&function(e,t){if(!t)return!1;const i={x:e.clientX,y:e.clientY};return function(e,t){const{x:i,y:s}=e;let r=!1;for(let n=0,o=t.length-1;n<t.length;o=n++){const e=t[n],a=t[o],l=e.x,h=e.y,c=a.x,d=a.y;h>s!=d>s&&i<(c-l)*(s-h)/(d-h)+l&&(r=!r)}return r}(i,t)}(e,null==(i=D.current)?void 0:i.area)},[]);return _.jsx(ms,{scope:i,searchRef:R,onItemEnter:l.useCallback(e=>{A(e)&&e.preventDefault()},[A]),onItemLeave:l.useCallback(e=>{var t;A(e)||(null==(t=k.current)||t.focus(),C(null))},[A]),onTriggerLeave:l.useCallback(e=>{A(e)&&e.preventDefault()},[A]),pointerGraceTimerRef:M,onPointerGraceIntentChange:l.useCallback(e=>{D.current=e},[]),children:_.jsx(T,{...j,children:_.jsx(ue,{asChild:!0,trapped:r,onMountAutoFocus:oe(n,e=>{var t;e.preventDefault(),null==(t=k.current)||t.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:_.jsx(fe,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:f,onDismiss:p,children:_.jsx(qt,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:s,currentTabStopId:y,onCurrentTabStopIdChange:C,onEntryFocus:oe(h,e=>{b.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(Vt,{role:"menu","aria-orientation":"vertical","data-state":Ys(v.open),"data-radix-menu-content":"",dir:b.dir,...S,...g,ref:E,style:{outline:"none",...g.style},onKeyDown:oe(g.onKeyDown,e=>{const t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,i=e.ctrlKey||e.altKey||e.metaKey,s=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!i&&s&&B(e.key));const r=k.current;if(e.target!==r)return;if(!Yi.includes(e.key))return;e.preventDefault();const n=x().filter(e=>!e.disabled).map(e=>e.ref.current);Vi.includes(e.key)&&n.reverse(),function(e){const t=document.activeElement;for(const i of e){if(i===t)return;if(i.focus(),document.activeElement!==t)return}}(n)}),onBlur:oe(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(N.current),R.current="")}),onPointerMove:oe(e.onPointerMove,Js(e=>{const t=e.target,i=P.current!==e.clientX;if(e.currentTarget.contains(t)&&i){const t=e.clientX>P.current?"right":"left";L.current=t,P.current=e.clientX}}))})})})})})})});vs.displayName=ps;var ys=l.forwardRef((e,t)=>{const{__scopeMenu:i,...s}=e;return _.jsx(ae.div,{role:"group",...s,ref:t})});ys.displayName="MenuGroup";var Cs=l.forwardRef((e,t)=>{const{__scopeMenu:i,...s}=e;return _.jsx(ae.div,{...s,ref:t})});Cs.displayName="MenuLabel";var ks="MenuItem",Es="menu.itemSelect",Ns=l.forwardRef((e,t)=>{const{disabled:i=!1,onSelect:s,...r}=e,n=l.useRef(null),o=ls(ks,e.__scopeMenu),a=gs(ks,e.__scopeMenu),h=ne(t,n),c=l.useRef(!1);return _.jsx(Rs,{...r,ref:h,disabled:i,onClick:oe(e.onClick,()=>{const e=n.current;if(!i&&e){const t=new CustomEvent(Es,{bubbles:!0,cancelable:!0});e.addEventListener(Es,e=>null==s?void 0:s(e),{once:!0}),he(e,t),t.defaultPrevented?c.current=!1:o.onClose()}}),onPointerDown:t=>{var i;null==(i=e.onPointerDown)||i.call(e,t),c.current=!0},onPointerUp:oe(e.onPointerUp,e=>{var t;c.current||null==(t=e.currentTarget)||t.click()}),onKeyDown:oe(e.onKeyDown,e=>{const t=""!==a.searchRef.current;i||t&&" "===e.key||qi.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Ns.displayName=ks;var Rs=l.forwardRef((e,t)=>{const{__scopeMenu:i,disabled:s=!1,textValue:r,...n}=e,o=gs(ks,i),a=rs(i),h=l.useRef(null),c=ne(t,h),[d,u]=l.useState(!1),[f,p]=l.useState("");return l.useEffect(()=>{const e=h.current;e&&p((e.textContent??"").trim())},[n.children]),_.jsx(Zi.ItemSlot,{scope:i,disabled:s,textValue:r??f,children:_.jsx(Kt,{asChild:!0,...a,focusable:!s,children:_.jsx(ae.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...n,ref:c,onPointerMove:oe(e.onPointerMove,Js(e=>{if(s)o.onItemLeave(e);else if(o.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus({preventScroll:!0})}})),onPointerLeave:oe(e.onPointerLeave,Js(e=>o.onItemLeave(e))),onFocus:oe(e.onFocus,()=>u(!0)),onBlur:oe(e.onBlur,()=>u(!1))})})})}),Ms=l.forwardRef((e,t)=>{const{checked:i=!1,onCheckedChange:s,...r}=e;return _.jsx(Os,{scope:e.__scopeMenu,checked:i,children:_.jsx(Ns,{role:"menuitemcheckbox","aria-checked":Xs(i)?"mixed":i,...r,ref:t,"data-state":Gs(i),onSelect:oe(r.onSelect,()=>null==s?void 0:s(!!Xs(i)||!i),{checkForDefaultPrevented:!1})})})});Ms.displayName="MenuCheckboxItem";var Ds="MenuRadioGroup",[Ls,Ps]=ts(Ds,{value:void 0,onValueChange:()=>{}}),Ts=l.forwardRef((e,t)=>{const{value:i,onValueChange:s,...r}=e,n=te(s);return _.jsx(Ls,{scope:e.__scopeMenu,value:i,onValueChange:n,children:_.jsx(ys,{...r,ref:t})})});Ts.displayName=Ds;var js="MenuRadioItem",Bs=l.forwardRef((e,t)=>{const{value:i,...s}=e,r=Ps(js,e.__scopeMenu),n=i===r.value;return _.jsx(Os,{scope:e.__scopeMenu,checked:n,children:_.jsx(Ns,{role:"menuitemradio","aria-checked":n,...s,ref:t,"data-state":Gs(n),onSelect:oe(s.onSelect,()=>{var e;return null==(e=r.onValueChange)?void 0:e.call(r,i)},{checkForDefaultPrevented:!1})})})});Bs.displayName=js;var As="MenuItemIndicator",[Os,Is]=ts(As,{checked:!1}),zs=l.forwardRef((e,t)=>{const{__scopeMenu:i,forceMount:s,...r}=e,n=Is(As,i);return _.jsx(se,{present:s||Xs(n.checked)||!0===n.checked,children:_.jsx(ae.span,{...r,ref:t,"data-state":Gs(n.checked)})})});zs.displayName=As;var Ws=l.forwardRef((e,t)=>{const{__scopeMenu:i,...s}=e;return _.jsx(ae.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});Ws.displayName="MenuSeparator";var Hs=l.forwardRef((e,t)=>{const{__scopeMenu:i,...s}=e,r=ss(i);return _.jsx(Yt,{...r,...s,ref:t})});Hs.displayName="MenuArrow";var[Fs,$s]=ts("MenuSub"),Us="MenuSubTrigger",Ks=l.forwardRef((e,t)=>{const i=os(Us,e.__scopeMenu),s=ls(Us,e.__scopeMenu),r=$s(Us,e.__scopeMenu),n=gs(Us,e.__scopeMenu),o=l.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:h}=n,c={__scopeMenu:e.__scopeMenu},d=l.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return l.useEffect(()=>d,[d]),l.useEffect(()=>{const e=a.current;return()=>{window.clearTimeout(e),h(null)}},[a,h]),_.jsx(cs,{asChild:!0,...c,children:_.jsx(Rs,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":r.contentId,"data-state":Ys(i.open),...e,ref:ee(t,r.onTriggerChange),onClick:t=>{var s;null==(s=e.onClick)||s.call(e,t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),i.open||i.onOpenChange(!0))},onPointerMove:oe(e.onPointerMove,Js(t=>{n.onItemEnter(t),t.defaultPrevented||e.disabled||i.open||o.current||(n.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{i.onOpenChange(!0),d()},100))})),onPointerLeave:oe(e.onPointerLeave,Js(e=>{var t,s;d();const r=null==(t=i.content)?void 0:t.getBoundingClientRect();if(r){const t=null==(s=i.content)?void 0:s.dataset.side,o="right"===t,l=o?-5:5,h=r[o?"left":"right"],c=r[o?"right":"left"];n.onPointerGraceIntentChange({area:[{x:e.clientX+l,y:e.clientY},{x:h,y:r.top},{x:c,y:r.top},{x:c,y:r.bottom},{x:h,y:r.bottom}],side:t}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>n.onPointerGraceIntentChange(null),300)}else{if(n.onTriggerLeave(e),e.defaultPrevented)return;n.onPointerGraceIntentChange(null)}})),onKeyDown:oe(e.onKeyDown,t=>{var r;const o=""!==n.searchRef.current;e.disabled||o&&" "===t.key||Xi[s.dir].includes(t.key)&&(i.onOpenChange(!0),null==(r=i.content)||r.focus(),t.preventDefault())})})})});Ks.displayName=Us;var qs="MenuSubContent",Vs=l.forwardRef((e,t)=>{const i=fs(ps,e.__scopeMenu),{forceMount:s=i.forceMount,...r}=e,n=os(ps,e.__scopeMenu),o=ls(ps,e.__scopeMenu),a=$s(qs,e.__scopeMenu),h=l.useRef(null),c=ne(t,h);return _.jsx(Zi.Provider,{scope:e.__scopeMenu,children:_.jsx(se,{present:s||n.open,children:_.jsx(Zi.Slot,{scope:e.__scopeMenu,children:_.jsx(xs,{id:a.contentId,"aria-labelledby":a.triggerId,...r,ref:c,align:"start",side:"rtl"===o.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{var t;o.isUsingKeyboardRef.current&&(null==(t=h.current)||t.focus()),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:oe(e.onFocusOutside,e=>{e.target!==a.trigger&&n.onOpenChange(!1)}),onEscapeKeyDown:oe(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:oe(e.onKeyDown,e=>{var t;const i=e.currentTarget.contains(e.target),s=Gi[o.dir].includes(e.key);i&&s&&(n.onOpenChange(!1),null==(t=a.trigger)||t.focus(),e.preventDefault())})})})})})});function Ys(e){return e?"open":"closed"}function Xs(e){return"indeterminate"===e}function Gs(e){return Xs(e)?"indeterminate":e?"checked":"unchecked"}function Js(e){return t=>"mouse"===t.pointerType?e(t):void 0}Vs.displayName=qs;var Zs=hs,Qs=cs,er=_s,tr=vs,ir=ys,sr=Cs,rr=Ns,nr=Ms,or=Ts,ar=Bs,lr=zs,hr=Ws,cr=Hs,dr=Ks,ur=Vs,fr="ContextMenu",[_r]=ie(fr,[is]),pr=is(),[mr,gr]=_r(fr),vr=e=>{const{__scopeContextMenu:t,children:i,onOpenChange:s,dir:r,modal:n=!0}=e,[o,a]=l.useState(!1),h=pr(t),c=te(s),d=l.useCallback(e=>{a(e),c(e)},[c]);return _.jsx(mr,{scope:t,open:o,onOpenChange:d,modal:n,children:_.jsx(Zs,{...h,dir:r,open:o,onOpenChange:d,modal:n,children:i})})};vr.displayName=fr;var br="ContextMenuTrigger",Sr=l.forwardRef((e,t)=>{const{__scopeContextMenu:i,disabled:s=!1,...r}=e,n=gr(br,i),o=pr(i),a=l.useRef({x:0,y:0}),h=l.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),c=l.useRef(0),d=l.useCallback(()=>window.clearTimeout(c.current),[]),u=e=>{a.current={x:e.clientX,y:e.clientY},n.onOpenChange(!0)};return l.useEffect(()=>d,[d]),l.useEffect(()=>{s&&d()},[s,d]),_.jsxs(_.Fragment,{children:[_.jsx(Qs,{...o,virtualRef:h}),_.jsx(ae.span,{"data-state":n.open?"open":"closed","data-disabled":s?"":void 0,...r,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:s?e.onContextMenu:oe(e.onContextMenu,e=>{d(),u(e),e.preventDefault()}),onPointerDown:s?e.onPointerDown:oe(e.onPointerDown,Er(e=>{d(),c.current=window.setTimeout(()=>u(e),700)})),onPointerMove:s?e.onPointerMove:oe(e.onPointerMove,Er(d)),onPointerCancel:s?e.onPointerCancel:oe(e.onPointerCancel,Er(d)),onPointerUp:s?e.onPointerUp:oe(e.onPointerUp,Er(d))})]})});Sr.displayName=br;var wr=e=>{const{__scopeContextMenu:t,...i}=e,s=pr(t);return _.jsx(er,{...s,...i})};wr.displayName="ContextMenuPortal";var xr="ContextMenuContent",yr=l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=gr(xr,i),n=pr(i),o=l.useRef(!1);return _.jsx(tr,{...n,...s,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:t=>{var i;null==(i=e.onCloseAutoFocus)||i.call(e,t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{var i;null==(i=e.onInteractOutside)||i.call(e,t),t.defaultPrevented||r.modal||(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});yr.displayName=xr;l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(ir,{...r,...s,ref:t})}).displayName="ContextMenuGroup";l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(sr,{...r,...s,ref:t})}).displayName="ContextMenuLabel";var Cr=l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(rr,{...r,...s,ref:t})});Cr.displayName="ContextMenuItem";l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(nr,{...r,...s,ref:t})}).displayName="ContextMenuCheckboxItem";l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(or,{...r,...s,ref:t})}).displayName="ContextMenuRadioGroup";l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(ar,{...r,...s,ref:t})}).displayName="ContextMenuRadioItem";l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(lr,{...r,...s,ref:t})}).displayName="ContextMenuItemIndicator";var kr=l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(hr,{...r,...s,ref:t})});kr.displayName="ContextMenuSeparator";l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(cr,{...r,...s,ref:t})}).displayName="ContextMenuArrow";l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(dr,{...r,...s,ref:t})}).displayName="ContextMenuSubTrigger";function Er(e){return t=>"mouse"!==t.pointerType?e(t):void 0}l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(ur,{...r,...s,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})}).displayName="ContextMenuSubContent";var Nr=wr,Rr=yr,Mr=Cr,Dr=kr;const Lr=vr,Pr=Sr,Tr=l.forwardRef(({className:e,...t},i)=>_.jsx(Nr,{children:_.jsx(Rr,{ref:i,className:p("z-50 min-w-[10rem] overflow-hidden rounded-md border bg-popover p-1 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",e),...t})}));Tr.displayName=Rr.displayName;const jr=l.forwardRef(({className:e,destructive:t,...i},s)=>_.jsx(Mr,{ref:s,className:p("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"text-red-500 focus:text-red-500 focus:bg-red-500/10",e),...i}));jr.displayName=Mr.displayName;const Br=l.forwardRef(({className:e,...t},i)=>_.jsx(Dr,{ref:i,className:p("-mx-1 my-1 h-px bg-border",e),...t}));function Ar({kind:e,label:t,preview:i,inserted:s,unclicked:r,onLeftClick:n,onEdit:o,onDelete:a,onShare:h,onRefresh:c,footer:d,readOnly:u,noContextMenu:f,cornerHint:m,instructionsFile:v="CLAUDE.md"}){const b=l.useRef(null),S=p("agent-prompt"===e?s?"border-green-500/50 bg-green-500/10 hover:bg-green-500/15":"border-dashed border-border hover:border-border/80 hover:bg-muted-foreground/10 dark:hover:bg-muted-foreground/20":r?"border-blue-500/30 bg-blue-500/15 hover:bg-blue-500/20 dark:bg-blue-500/15 dark:hover:bg-blue-500/25":"border-transparent bg-background dark:bg-muted-foreground/10 hover:bg-muted-foreground/10 dark:hover:bg-muted-foreground/20 hover:border-muted-foreground/30"),w="agent-prompt"===e,x=!f||c?" · 右键更多":"",y="quick-prompt"===e?`点击发送${x}`:(s?`点击从 ${v} 移除`:`点击插入 ${v}`)+x,C=_.jsxs("div",{ref:b,className:p("group relative rounded-md border text-xs transition-colors cursor-pointer select-none",S),onClick:n,title:y,children:[w&&_.jsx("span",{"aria-hidden":!0,className:p("absolute top-1.5 left-1.5 h-2 w-2 rounded-full transition-colors",s?"bg-green-500 ring-1 ring-green-500/40":"border border-muted-foreground/40 bg-transparent")}),_.jsxs("div",{className:p("py-1.5",f&&m?"pr-10":f?"pr-2":"pr-7",w?"pl-5":"pl-3"),children:[_.jsx("div",{className:"font-medium truncate",children:t}),i&&i!==t&&_.jsx("div",{className:"mt-0.5 text-muted-foreground/80 truncate font-mono",children:i}),d]}),f&&m&&_.jsx("span",{"aria-hidden":!0,className:"absolute top-1.5 right-2 text-[10px] leading-none font-mono tabular-nums text-muted-foreground/60 pointer-events-none",children:m}),!f&&_.jsx("button",{onClick:e=>{e.stopPropagation(),e.preventDefault();const t=b.current;if(!t)return;const i=t.getBoundingClientRect(),s=new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:i.right-8,clientY:i.top+i.height/2,button:2});t.dispatchEvent(s)},className:p("absolute top-1 right-1 p-0.5 rounded transition-opacity","md:opacity-0 md:group-hover:opacity-100 md:focus-visible:opacity-100","hover:bg-muted-foreground/10 focus-visible:bg-muted-foreground/10","text-muted-foreground hover:text-foreground"),title:"更多","aria-label":"更多操作",children:_.jsx(di,{className:"h-3.5 w-3.5"})})]});return!(!c&&(f||!o&&!a&&!h))?_.jsxs(Lr,{children:[_.jsx(Pr,{asChild:!0,children:C}),_.jsxs(Tr,{children:[c&&_.jsxs(jr,{onSelect:c,children:[_.jsx(L,{className:"h-3.5 w-3.5"}),"更新"]}),!f&&!u&&o&&a&&_.jsxs(_.Fragment,{children:[c&&_.jsx(Br,{}),_.jsxs(jr,{onSelect:o,children:[_.jsx(g,{className:"h-3.5 w-3.5"}),"编辑"]}),_.jsxs(jr,{destructive:!0,onSelect:a,children:[_.jsx(D,{className:"h-3.5 w-3.5"}),"删除"]}),h&&_.jsx(Br,{})]}),!f&&h&&_.jsxs(jr,{onSelect:h,children:[_.jsx(_e,{className:"h-3.5 w-3.5"}),"共享到 ccweb-hub"]})]})]}):_.jsx("div",{onContextMenu:e=>e.preventDefault(),children:C})}function Or({open:e,onOpenChange:t,initialLabel:i,initialCommand:s,title:r,onSave:n}){const[o,a]=l.useState(i),[h,c]=l.useState(s),[d,u]=l.useState(!0);l.useEffect(()=>{e&&u(!0)},[e]),l.useEffect(()=>{e&&(a(i),c(s))},[e,i,s]);const f=()=>{const e=h.trim();e&&(n(o.trim()||e,e),t(!1))};return _.jsx(xe,{open:e,onOpenChange:t,modal:!1,children:_.jsxs(ye,{noOverlay:!0,className:p("sm:max-w-2xl max-h-[85vh] flex flex-col transition-opacity",!d&&"opacity-50"),onInteractOutside:e=>{e.preventDefault(),u(!1)},onClick:()=>u(!0),children:[_.jsxs(Ce,{children:[_.jsx(ke,{children:r}),_.jsx(Ee,{children:"左键点击卡片会把此命令发送到 CLI。"})]}),_.jsxs("div",{className:"space-y-4 flex-1 min-h-0 flex flex-col",children:[_.jsxs("div",{className:"space-y-2",children:[_.jsx(Ne,{htmlFor:"qp-label",children:"标签"}),_.jsx(U,{id:"qp-label",placeholder:"显示名(可选,默认用命令文本)",value:o,onChange:e=>a(e.target.value),className:"text-base",autoFocus:!0})]}),_.jsxs("div",{className:"space-y-2 flex-1 flex flex-col min-h-0",children:[_.jsx(Ne,{htmlFor:"qp-command",children:"命令"}),_.jsx("textarea",{id:"qp-command",placeholder:"输入要发送的命令...",value:h,onChange:e=>c(e.target.value),className:p("flex-1 min-h-[200px] w-full rounded-md border border-input bg-background px-4 py-3","text-base leading-relaxed font-mono","ring-offset-background placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","resize-none"),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())}})]})]}),_.jsxs(Re,{className:"flex items-center justify-between sm:justify-between",children:[_.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ 保存"}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx(H,{variant:"outline",onClick:()=>t(!1),children:"取消"}),_.jsx(H,{onClick:f,disabled:!h.trim(),children:"保存"})]})]})]})})}function Ir({title:e,count:t,onAdd:i,children:s}){return _.jsxs("div",{className:"px-2 py-2",children:[_.jsxs("div",{className:"flex items-center justify-between mb-1.5 px-1",children:[_.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:[_.jsx("span",{children:e}),_.jsxs("span",{className:"text-muted-foreground/60 normal-case tracking-normal",children:["(",t,")"]})]}),_.jsx("button",{onClick:i,className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted-foreground/10 transition-colors",title:"新建","aria-label":"新建",children:_.jsx($,{className:"h-3 w-3"})})]}),s]})}function zr({projectId:e,onSend:t}){const i=a(),[s,r]=l.useState([]),[n,o]=l.useState([]),h=N(),c=h.get(e),[d,u]=l.useState({open:!1}),[f,p]=l.useState(c.shareHubOpen),[m,g]=l.useState(c.shareHubLabel),[v,b]=l.useState(c.shareHubCommand),S=l.useCallback(t=>{r(e=>{const i=e.findIndex(e=>e.id===t);if(i<0||e[i].used)return e;const s=[...e];return s[i]={...s[i],used:!0},s}),pe(e,t,!0).catch(e=>{console.error("Failed to mark shortcut used:",e)})},[e]);l.useEffect(()=>{me(e).then(r).catch(()=>r([]))},[e]),l.useEffect(()=>{ge().then(o).catch(()=>o([]))},[]);const w=l.useCallback(e=>{const t=[],i=new Set;let s=e;const r=[];for(;s&&!i.has(s.id);)i.add(s.id),r.unshift(s),s=s.parentId?n.find(e=>e.id===s.parentId):void 0;for(const n of r)t.push(n.command);return t},[n]),x=l.useCallback(e=>{w(e).forEach((e,i)=>{setTimeout(()=>t(e+"\r"),500*i)})},[w,t]),y=e=>u({open:!0,mode:"create",scope:e}),C=(t,i)=>{g(t),b(i),p(!0),h.setShareHub(e,!0,t,i)};return _.jsxs("div",{className:"h-full flex flex-col text-foreground overflow-hidden",children:[_.jsxs("div",{className:"px-3 pt-2.5 pb-2 border-b border-border/50 shrink-0",children:[_.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Quick Prompts"}),_.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground/70 leading-snug",children:"点击卡片发送命令到 CLI;新建的命令在首次点击前以浅蓝色标识"})]}),_.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[_.jsx(Ir,{title:"项目",count:s.length,onAdd:()=>y("project"),children:0===s.length?_.jsx("div",{className:"px-1 py-3 text-xs text-muted-foreground/60",children:"暂无项目命令"}):_.jsx("div",{className:"space-y-1.5",children:s.map(s=>_.jsx(Ar,{kind:"quick-prompt",label:s.label,preview:s.label!==s.command?s.command:"",unclicked:!s.used,onLeftClick:()=>(e=>{t(e.command+"\r"),S(e.id)})(s),onEdit:()=>(e=>u({open:!0,mode:"edit",scope:"project",id:e.id,label:e.label,command:e.command}))(s),onDelete:()=>{(async t=>{if(await i({title:"删除项目快捷 Prompt",description:`确认删除「${t.label}」?此操作不可撤销。`,destructive:!0,confirmLabel:"删除"}))try{await Se(e,t.id),r(e=>e.filter(e=>e.id!==t.id))}catch(s){console.error("Failed to delete shortcut:",s)}})(s)},onShare:()=>C(s.label,s.command)},s.id))})}),_.jsx("div",{className:"h-px bg-border mx-2"}),_.jsx(Ir,{title:"全局",count:n.length,onAdd:()=>y("global"),children:0===n.length?_.jsx("div",{className:"px-1 py-3 text-xs text-muted-foreground/60",children:"暂无全局命令"}):_.jsx("div",{className:"space-y-1.5",children:n.map(e=>{var t;const s=e.parentId?null==(t=n.find(t=>t.id===e.parentId))?void 0:t.label:void 0;return _.jsx(Ar,{kind:"quick-prompt",label:e.label,preview:s?"":e.label!==e.command?e.command:"",onLeftClick:()=>x(e),onEdit:()=>(e=>u({open:!0,mode:"edit",scope:"global",id:e.id,label:e.label,command:e.command}))(e),onDelete:()=>{(async e=>{const t=n.filter(t=>t.parentId===e.id);if(await i({title:"删除全局快捷 Prompt",description:t.length>0?`「${e.label}」被 ${t.length} 个其他全局命令继承。删除后这些命令的继承会断链。确认删除?`:`确认删除「${e.label}」?此操作不可撤销。`,destructive:!0,confirmLabel:"删除"}))try{await we(e.id),o(t=>t.filter(t=>t.id!==e.id))}catch(s){console.error("Failed to delete global shortcut:",s)}})(e)},onShare:()=>C(e.label,e.command),footer:s?_.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[_.jsx(ve,{className:"h-2.5 w-2.5 text-muted-foreground"}),_.jsxs("span",{className:"text-muted-foreground truncate",children:["继承: ",s,"(继承链仅可在 Dashboard 编辑)"]})]}):null},e.id)})})})]}),_.jsx(Or,{open:d.open,onOpenChange:e=>{e||u({open:!1})},initialLabel:d.open&&"edit"===d.mode?d.label:"",initialCommand:d.open&&"edit"===d.mode?d.command:"",title:d.open?"create"===d.mode?`新建${"global"===d.scope?"全局":"项目"}命令`:"编辑命令":"",onSave:(t,i)=>{(async(t,i)=>{if(d.open)try{if("create"===d.mode)if("global"===d.scope){const e=await Me({label:t,command:i});o(t=>[...t,e])}else{const s=await De(e,{label:t,command:i});r(e=>[...e,s])}else if("global"===d.scope){const e=n.find(e=>e.id===d.id),s=await Le(d.id,{label:t,command:i,parentId:(null==e?void 0:e.parentId)??null});o(e=>e.map(e=>e.id===s.id?s:e))}else{const s=await Pe(e,d.id,{label:t,command:i});r(e=>e.map(e=>e.id===s.id?s:e))}}catch(s){console.error("Failed to save shortcut:",s)}})(t,i)}}),_.jsx(be,{open:f,onOpenChange:t=>{p(t),t||h.setShareHub(e,!1)},kind:"quick-prompt",label:m,content:v})]})}Br.displayName=Dr.displayName;function Wr({open:e,onOpenChange:t,title:i,initialLabel:s,initialCommand:r,onSave:n,instructionsFile:o="CLAUDE.md"}){const[a,h]=l.useState(s),[c,d]=l.useState(r),[u,f]=l.useState(!0);l.useEffect(()=>{e&&(h(s),d(r),f(!0))},[e,s,r]);const m=a.trim(),g=c.trim(),v=m.length>100,b=g.length>8e3,S=g.length>0&&m.length>0&&!v&&!b,w=()=>{S&&(n(m,c),t(!1))};return _.jsx(xe,{open:e,onOpenChange:t,modal:!1,children:_.jsxs(ye,{noOverlay:!0,className:p("sm:max-w-2xl max-h-[85vh] flex flex-col transition-opacity",!u&&"opacity-50"),onInteractOutside:e=>{e.preventDefault(),f(!1)},onClick:()=>f(!0),children:[_.jsxs(Ce,{children:[_.jsx(ke,{children:i}),_.jsxs(Ee,{children:["This prompt can be clicked once in the sidebar to insert into ",o,", and clicked again to remove (by exact text match)."]})]}),_.jsxs("div",{className:"space-y-4 flex-1 min-h-0 flex flex-col",children:[_.jsxs("div",{className:"space-y-2",children:[_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsx(Ne,{htmlFor:"prompt-label",children:"Label"}),_.jsxs("span",{className:p("text-xs text-muted-foreground",v&&"text-red-500"),children:[m.length," / ",100]})]}),_.jsx(U,{id:"prompt-label",placeholder:"A short name for this prompt",value:a,onChange:e=>h(e.target.value),className:"text-base",autoFocus:!0})]}),_.jsxs("div",{className:"space-y-2 flex-1 flex flex-col min-h-0",children:[_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsx(Ne,{htmlFor:"prompt-command",children:"Prompt"}),_.jsxs("span",{className:p("text-xs text-muted-foreground",b&&"text-red-500"),children:[g.length," / ",8e3]})]}),_.jsx("textarea",{id:"prompt-command",placeholder:`The exact text that will be appended to ${o}...`,value:c,onChange:e=>d(e.target.value),className:p("flex-1 min-h-[200px] w-full rounded-md border border-input bg-background px-4 py-3","text-sm leading-relaxed font-mono","ring-offset-background placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","resize-none"),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),w())}})]})]}),_.jsxs(Re,{className:"flex items-center justify-between sm:justify-between",children:[_.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ to save"}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx(H,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),_.jsx(H,{onClick:w,disabled:!S,children:"Save"})]})]})]})})}function Hr({projectId:e}){const t=a(),[i,s]=l.useState([]),[r,n]=l.useState([]),[o,h]=l.useState("CLAUDE.md"),[c,d]=l.useState(!0),[u,p]=l.useState({open:!1}),[m,g]=l.useState({open:!1,label:"",content:""}),v=l.useCallback(async()=>{try{const t=await Te(e);s(t.global),n(t.project),t.instructionsFilename&&h(t.instructionsFilename)}catch(t){f.error(`加载提示词失败: ${t.message}`)}finally{d(!1)}},[e]);l.useEffect(()=>{d(!0),v()},[v]);const b=l.useRef(new Set),S=l.useCallback(async(t,i)=>{if(b.current.has(i.id))return;b.current.add(i.id);const r=i.inserted?"remove":"insert",a=e=>e.map(e=>e.id===i.id?{...e,inserted:!e.inserted}:e);"global"===t?s(a):n(a);try{const t=await je(e,i.command,r);if("remove"===r&&!1===t.changed)return"not-found"===t.reason?f.error(`${o} 中找不到该提示词的精确文本,请自行编辑 ${o} 移除。`):f.warning(`该提示词当前不在 ${o} 中(可能被手动编辑过),已重新同步状态。`),void v();v()}catch(l){f.error(`操作失败: ${l.message}`),"global"===t?s(a):n(a)}finally{b.current.delete(i.id)}},[e,v,o]),w=l.useCallback(async(t,i,s,r,n)=>{try{if("create"===t)"global"===i?await Be({label:r,command:n}):await Ae(e,{label:r,command:n}),f.success("已添加");else{if(!s)return;"global"===i?await Oe(s,{label:r,command:n}):await Ie(e,s,{label:r,command:n}),f.success("已更新")}v()}catch(o){f.error(`保存失败: ${o.message}`)}},[e,v]),x=l.useCallback(async(i,s)=>{const r=s.inserted?`此提示词目前已插入当前项目的 ${o}。\n\n删除后它会在 ${o} 中成为"孤儿文本"——仅删除提示词记录,不会自动从 ${o} 移除。\n\n确认删除?`:"确认删除此提示词?此操作不可撤销。";if(await t({title:"删除提示词",description:r,destructive:!0,confirmLabel:"删除"}))try{"global"===i?await ze(s.id):await We(e,s.id),f.success("已删除"),v()}catch(n){f.error(`删除失败: ${n.message}`)}},[e,v,t,o]),y=l.useCallback(e=>{g({open:!0,label:e.label,content:e.command})},[]);return _.jsxs("div",{className:"flex flex-col h-full overflow-y-auto",children:[_.jsxs("div",{className:"px-3 pt-2.5 pb-2 border-b border-border/50 shrink-0",children:[_.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Agent Prompts"}),_.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground/70 leading-snug",children:["点击卡片插入 / 移出当前项目的 ",o,";左上角绿点表示已插入"]})]}),_.jsx(Fr,{title:"项目",count:r.length,loading:c,prompts:r,emptyText:"暂无项目提示词",instructionsFile:o,onAdd:()=>p({open:!0,mode:"create",scope:"project"}),onToggle:e=>{S("project",e)},onEdit:e=>p({open:!0,mode:"edit",scope:"project",id:e.id,label:e.label,command:e.command}),onDelete:e=>{x("project",e)},onShare:y}),_.jsx("div",{className:"h-px bg-border mx-2"}),_.jsx(Fr,{title:"全局",count:i.length,loading:c,prompts:i,emptyText:"暂无全局提示词",instructionsFile:o,onAdd:()=>p({open:!0,mode:"create",scope:"global"}),onToggle:e=>{S("global",e)},onEdit:e=>p({open:!0,mode:"edit",scope:"global",id:e.id,label:e.label,command:e.command}),onDelete:e=>{x("global",e)},onShare:y}),_.jsx(Wr,{open:u.open,onOpenChange:e=>{e||p({open:!1})},title:!1===u.open?"":"create"===u.mode?`新建${"global"===u.scope?"全局":"项目"}提示词`:`编辑${"global"===u.scope?"全局":"项目"}提示词`,initialLabel:u.open&&"edit"===u.mode?u.label:"",initialCommand:u.open&&"edit"===u.mode?u.command:"",instructionsFile:o,onSave:(e,t)=>{if(!u.open)return;const i="edit"===u.mode?u.id:null;w(u.mode,u.scope,i,e,t)}}),_.jsx(be,{open:m.open,onOpenChange:e=>g(t=>({...t,open:e})),kind:"agent-prompt",label:m.label,content:m.content})]})}function Fr({title:e,count:t,loading:i,prompts:s,emptyText:r,onAdd:n,onToggle:o,onEdit:a,onDelete:l,onShare:h,instructionsFile:c}){return _.jsxs("div",{className:"px-2 py-2",children:[_.jsxs("div",{className:"flex items-center justify-between mb-1.5 px-1",children:[_.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:[_.jsx("span",{children:e}),_.jsxs("span",{className:"text-muted-foreground/60 normal-case tracking-normal",children:["(",t,")"]})]}),_.jsx("button",{onClick:n,className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted-foreground/10 transition-colors",title:"新建","aria-label":"新建",children:_.jsx($,{className:"h-3 w-3"})})]}),i?_.jsx("div",{className:"px-1 py-3 text-xs text-muted-foreground/60",children:"加载中…"}):0===s.length?_.jsx("div",{className:"px-1 py-3 text-xs text-muted-foreground/60",children:r}):_.jsx("div",{className:"space-y-1.5",children:s.map(e=>{const t=e.command.split("\n").find(e=>e.trim())??e.command.trim();return _.jsx(Ar,{kind:"agent-prompt",label:e.label,preview:t,inserted:e.inserted,instructionsFile:c,onLeftClick:()=>o(e),onEdit:()=>a(e),onDelete:()=>l(e),onShare:()=>h(e)},e.id)})})]})}function $r({projectId:e}){const[t,i]=l.useState([]),[s,r]=l.useState(null),[n,o]=l.useState("CLAUDE.md"),[a,h]=l.useState(!0),[c,d]=l.useState(!1),u=l.useRef(new Set),m=l.useCallback(async()=>{h(!0);try{const t=await He(e);i(t.items),r(t.claudeMdLineCount),t.instructionsFilename&&o(t.instructionsFilename)}catch(t){f.error(`加载失败: ${t.message}`)}finally{h(!1)}},[e]);l.useEffect(()=>{m()},[m]);const g=l.useCallback(async t=>{if(u.current.has(t.filename))return;u.current.add(t.filename),i(e=>e.map(e=>e.filename===t.filename?{...e,inserted:!e.inserted}:e));const s=t.inserted?"remove":"insert";try{const n=await Fe(e,t.filename,s);if(!n.ok)return f.error("操作失败"+(n.reason?`(${n.reason})`:"")),void m();i(e=>e.map(e=>e.filename===t.filename?{...e,inserted:n.inserted}:e)),"number"==typeof n.claudeMdLineCount&&r(n.claudeMdLineCount),"insert"===s&&"refreshed"===n.reason&&f.info(`${t.name} 已更新(文件内容有变化)`)}catch(n){f.error(`操作失败: ${n.message}`),i(e=>e.map(e=>e.filename===t.filename?{...e,inserted:t.inserted}:e))}finally{u.current.delete(t.filename)}},[e,m]),v=l.useCallback(async()=>{if(c)return;const s=t.filter(e=>e.inserted);if(0===s.length)return void f.info("没有已插入的 memory 卡片");d(!0);let n=0,o=0;for(const t of s)if(u.current.has(t.filename))o++;else{u.current.add(t.filename);try{const s=await Fe(e,t.filename,"insert");s.ok?(i(e=>e.map(e=>e.filename===t.filename?{...e,inserted:s.inserted}:e)),"number"==typeof s.claudeMdLineCount&&r(s.claudeMdLineCount),n++):o++}catch{o++}finally{u.current.delete(t.filename)}}d(!1),0===o?f.success(`已从磁盘更新 ${n} 个 memory 卡片`):f.error(`${n} 个更新成功,${o} 个失败`)},[e,t,c]),b=l.useCallback(async t=>{if(!u.current.has(t.filename))if(t.inserted){u.current.add(t.filename);try{const s=await Fe(e,t.filename,"insert");if(!s.ok)return f.error("更新失败"+(s.reason?`(${s.reason})`:"")),void m();i(e=>e.map(e=>e.filename===t.filename?{...e,inserted:s.inserted}:e)),"number"==typeof s.claudeMdLineCount&&r(s.claudeMdLineCount),f.success(`${t.name} 已从磁盘重新加载`)}catch(s){f.error(`更新失败: ${s.message}`)}finally{u.current.delete(t.filename)}}else f.info("卡片未插入,无需更新")},[e,m]);return _.jsxs("div",{className:"flex flex-col h-full overflow-y-auto",children:[_.jsxs("div",{className:"px-3 pt-2.5 pb-2 border-b border-border/50 shrink-0",children:[_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Memory Prompts"}),_.jsxs("div",{className:"flex items-center gap-0.5",children:[_.jsx("button",{onClick:()=>{v()},disabled:c||!t.some(e=>e.inserted),className:p("p-0.5 rounded text-muted-foreground transition-colors","hover:text-foreground hover:bg-muted-foreground/10","disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-muted-foreground"),title:`把所有已插入卡片的内容从磁盘重新加载到 ${n}`,children:_.jsx(li,{className:p("h-3.5 w-3.5",c&&"animate-spin")})}),_.jsx("button",{onClick:()=>{m()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted-foreground/10 transition-colors",title:"刷新(重新扫描 .ccweb/memory/)",children:_.jsx(L,{className:p("h-3.5 w-3.5",a&&"animate-spin")})})]})]}),_.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground/70 leading-snug",children:["来自 ",_.jsx("code",{className:"text-[11px]",children:".ccweb/memory/*.md"})," 的文件,点击插入 / 移除 ",n,"(以",_.jsx("code",{className:"text-[11px]",children:" START 名 / END 名 "}),"包裹)"]}),null!==s&&_.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground/60 font-mono tabular-nums",children:[n,": ",s," 行"]})]}),_.jsx("div",{className:"px-2 py-2 flex-1 min-h-0",children:a&&0===t.length?_.jsx("div",{className:"px-1 py-6 text-xs text-muted-foreground/60 text-center",children:"加载中…"}):0===t.length?_.jsxs("div",{className:"px-1 py-8 text-xs text-muted-foreground/60 flex flex-col items-center gap-2",children:[_.jsx(ni,{className:"h-5 w-5"}),_.jsxs("div",{className:"text-center leading-relaxed",children:["暂无 memory 文件",_.jsx("br",{}),"新建 ",_.jsx("code",{className:"text-[11px]",children:".ccweb/memory/*.md"})," 文件后点刷新"]})]}):_.jsx("div",{className:"space-y-1.5",children:t.map(e=>_.jsx(Ar,{kind:"agent-prompt",noContextMenu:!0,label:e.name,preview:e.preview,inserted:e.inserted,instructionsFile:n,cornerHint:`${e.lineCount} 行`,onLeftClick:()=>{g(e)},onRefresh:e.inserted?()=>{b(e)}:void 0},e.filename))})})]})}function Ur({projectId:e,onSend:t}){const[i,s]=Q(y.rightPanelTab,"shortcuts"),r="prompts"===i?"prompts":"memory"===i?"memory":"shortcuts";return _.jsxs(Bt,{value:r,onValueChange:e=>s(e),orientation:"vertical",className:"h-full flex bg-muted text-foreground overflow-hidden",children:[_.jsxs("div",{className:"flex-1 min-w-0 flex flex-col border-r border-border",children:[_.jsx(It,{value:"shortcuts",className:"flex-1 min-h-0 mt-0 data-[state=inactive]:hidden",children:_.jsx(zr,{projectId:e,onSend:t})}),_.jsx(It,{value:"prompts",className:"flex-1 min-h-0 mt-0 data-[state=inactive]:hidden",children:_.jsx(Hr,{projectId:e})}),_.jsx(It,{value:"memory",className:"flex-1 min-h-0 mt-0 data-[state=inactive]:hidden",children:_.jsx($r,{projectId:e})})]}),_.jsxs(At,{className:p("flex flex-col items-center justify-start shrink-0","h-full w-9 border-l border-border rounded-none p-1 gap-1"),children:[_.jsx(Ot,{value:"shortcuts",title:"Quick Prompts (快捷 Prompts)","aria-label":"Quick Prompts",className:p("h-7 w-7 p-0 rounded-md flex items-center justify-center"),children:_.jsx($e,{className:"h-3.5 w-3.5"})}),_.jsx(Ot,{value:"prompts",title:"Agent Prompts","aria-label":"Agent Prompts",className:p("h-7 w-7 p-0 rounded-md flex items-center justify-center"),children:_.jsx(Ue,{className:"h-3.5 w-3.5"})}),_.jsx(Ot,{value:"memory",title:"Memory Prompts (.ccweb/memory/*.md)","aria-label":"Memory Prompts",className:p("h-7 w-7 p-0 rounded-md flex items-center justify-center"),children:_.jsx(ni,{className:"h-3.5 w-3.5"})})]})]})}var Kr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const i=Ke(`Primitive.${t}`),s=l.forwardRef((e,s)=>{const{asChild:r,...n}=e,o=r?i:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),_.jsx(o,{...n,ref:s})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),qr="horizontal",Vr=["horizontal","vertical"],Yr=l.forwardRef((e,t)=>{const{decorative:i,orientation:s=qr,...r}=e,n=function(e){return Vr.includes(e)}(s)?s:qr,o=i?{role:"none"}:{"aria-orientation":"vertical"===n?n:void 0,role:"separator"};return _.jsx(Kr.div,{"data-orientation":n,...o,...r,ref:t})});Yr.displayName="Separator";var Xr=Yr;const Gr=l.forwardRef(({className:e,orientation:t="horizontal",decorative:i=!0,...s},r)=>_.jsx(Xr,{ref:r,decorative:i,orientation:t,className:p("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...s}));function Jr({status:e}){return _.jsxs("span",{className:p("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",{running:"bg-green-500/10 text-green-600 border-green-500/20",stopped:"bg-muted text-muted-foreground border-border",restarting:"bg-yellow-500/10 text-yellow-600 border-yellow-500/20"}[e]),children:[_.jsx("span",{className:p("w-1.5 h-1.5 rounded-full",{"bg-green-500":"running"===e,"bg-muted-foreground":"stopped"===e,"bg-yellow-400 animate-pulse":"restarting"===e})}),e.charAt(0).toUpperCase()+e.slice(1)]})}function Zr({project:e,projectId:t,showFileTree:i,showShortcuts:s,showChatOverlay:r,onToggleFileTree:n,onToggleShortcuts:o,onToggleChatOverlay:a,onProjectUpdate:h}){const{t:c}=Xt(),d=qe(),[u,m]=l.useState(!1),[g,w]=l.useState(!1),[x,y]=l.useState(0),[C,k]=l.useState(!1),[E,N]=l.useState(!1);Ve({onStart:e=>{e.projectId===t&&y(0)},onProgress:e=>{e.projectId===t&&y(e.filesTransferred)},onDone:e=>{e.projectId===t&&y(0)}}),l.useEffect(()=>{const e=()=>N(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]);return _.jsx("header",{className:"border-b border-border flex-shrink-0 bg-muted/50",children:_.jsxs("div",{className:"px-3 h-12 flex items-center gap-2",children:[_.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>d("/"),children:_.jsx(Ye,{className:"h-4 w-4"})}),_.jsx(Gr,{orientation:"vertical",className:"h-5 mx-0.5"}),_.jsx(H,{variant:"ghost",size:"icon",className:p("h-7 w-7",i&&"bg-accent"),onClick:n,title:c("project_header.toggle_file_tree"),children:_.jsx(fi,{className:"h-4 w-4"})}),_.jsx(H,{variant:"ghost",size:"icon",className:p("h-7 w-7",s&&"bg-accent"),onClick:o,title:c("project_header.toggle_right_panel"),children:_.jsx(_i,{className:"h-4 w-4"})}),"terminal"!==e.cliTool&&_.jsx(H,{variant:"ghost",size:"icon",className:p("h-7 w-7",r&&"bg-accent"),onClick:a,title:c("project_header.toggle_chat_overlay"),children:_.jsx(hi,{className:"h-4 w-4"})}),_.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2 ml-2",children:[_.jsx("h1",{className:"font-semibold text-foreground truncate text-sm",children:e.name}),_.jsx(Jr,{status:e.status}),_.jsx(Xe,{variant:"outline",className:"text-xs",children:"unlimited"===e.permissionMode?"Unlimited":"Limited"}),_.jsx("span",{className:"text-xs text-muted-foreground font-mono truncate hidden lg:block",children:e.folderPath})]}),_.jsx(Ge,{}),_.jsx(Je,{}),_.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()},title:c(E?"project_header.fullscreen_exit":"project_header.fullscreen_enter"),children:E?_.jsx(v,{className:"h-3.5 w-3.5"}):_.jsx(b,{className:"h-3.5 w-3.5"})}),_.jsx(Gr,{orientation:"vertical",className:"h-5 mx-0.5"}),g?_.jsxs(H,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>{(async()=>{if(g&&!C){k(!0);try{(await et(t)).cancelled?f.info(c("project_header.sync_cancelled")):f.error(c("project_header.sync_cancel_failed"))}catch(e){f.error(e instanceof Error?e.message:c("project_header.sync_cancel_failed")),k(!1)}}})()},disabled:C,title:c("project_header.sync_cancel_title"),children:[C?_.jsx(Ze,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):_.jsx(S,{className:"h-3.5 w-3.5 mr-1.5"}),_.jsx("span",{className:"tabular-nums",children:x>0?c("project_header.sync_progress_label",{files:x}):c("project_header.sync_progress_label_empty")})]}):_.jsxs(H,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>{(async()=>{if(!g){w(!0),y(0);try{const e=await tt(t);e.skipped?f.info(c("project_header.sync_skipped")):e.ok?f.success(c("project_header.sync_success",{files:e.filesTransferred,seconds:Math.round(e.durationMs/1e3)})):"cancelled"===e.reason||f.error(e.reason?c("project_header.sync_failed_with_reason",{reason:e.reason}):c("project_header.sync_failed"))}catch(e){f.error(e instanceof Error?e.message:c("project_header.sync_failed"))}finally{w(!1),y(0),k(!1)}}})()},title:c("project_header.sync_button_title"),children:[_.jsx(Qe,{className:"h-3.5 w-3.5 mr-1.5"}),c("project_header.sync")]}),"stopped"===e.status&&_.jsxs(H,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>{(async()=>{m(!0);try{h(await it(e.id))}catch(t){console.error(t)}finally{m(!1)}})()},disabled:u,children:[_.jsx(pi,{className:"h-3.5 w-3.5 mr-1.5"}),"Start"]})]})})}
14
+ */const Ci=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","tiff","tif"]);function ki(e){return"md"===e?"Markdown":"html"===e||"htm"===e?"HTML":"高亮"}const Ei=[50,75,100,125,150,200,250,300],Ni=100;function Ri({filePath:e,onClose:t}){const i=a(),s=e.endsWith("/.notebook/graph.yaml"),r=s?e.replace(/\/.notebook\/graph\.yaml$/,""):"",[n,o]=l.useState(null),[C,k]=l.useState(null),[N,R]=l.useState(()=>s?"graph":"rendered"),[M,D]=l.useState(!1),[L,P]=l.useState(Ni),[T,j]=l.useState(""),[B,A]=l.useState(!1),[O,I]=l.useState(!1),z=l.useRef(null),[W,H]=l.useState(!0),{resolved:F}=h(),$=e.split("/").pop()??e,U=l.useMemo(()=>function(e){const t=e.split("/").pop()??"",i=t.toLowerCase();if("dockerfile"===i)return"dockerfile";if("makefile"===i)return"makefile";const s=t.lastIndexOf(".");return s>=0?t.slice(s+1).toLowerCase():""}(e),[e]),K=Ci.has(U),q=xi.has(U),V=function(e){return"md"===e||"html"===e||"htm"===e||e in yi}(U),Y=yi[U]||U,X=l.useMemo(()=>{if(!K)return"";const t=w(e),i=c(),s=`${t}&t=${Date.now()}`;return i?`${s}&token=${encodeURIComponent(i)}`:s},[e,K]);l.useEffect(()=>{if(H(!0),o(null),k(null),P(function(e){const t=x(y.fileZoom,{},!0)[e];return Ei.includes(t)?t:Ni}(e)),I(!1),K||q)return o({path:e,binary:!1,tooLarge:!1,size:0,content:null}),void R("rendered");R(e.endsWith("/.notebook/graph.yaml")?"graph":"rendered"),d(e).then(e=>{o(e),j(e.content??"")}).catch(e=>k(e instanceof Error?e.message:"Failed to load file"))},[e,K,q]);const G=l.useCallback(async()=>{A(!0);try{await u(e,T),o(e=>e?{...e,content:T,size:new Blob([T]).size}:e),I(!1)}catch(t){f.error(t instanceof Error?t.message:"保存失败")}finally{A(!1)}},[e,T]);l.useEffect(()=>{const e=e=>{(e.metaKey||e.ctrlKey)&&"s"===e.key&&"edit"===N&&(e.preventDefault(),G())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[N,G]),l.useEffect(()=>{const e=async e=>{if("Escape"===e.key&&W){if(O){if(!(await i({description:"有未保存的修改,确定关闭?",confirmLabel:"放弃修改",destructive:!0})))return}t()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[W,t,O,i]);const J=async()=>{if(O){if(!(await i({description:"有未保存的修改,确定退出编辑?",confirmLabel:"放弃修改",destructive:!0})))return}R(s?"graph":V?"rendered":"plain"),I(!1)},Z=t=>{P(t),function(e,t){const i=x(y.fileZoom,{},!0);t===Ni?delete i[e]:i[e]=t,E(y.fileZoom,i,!0)}(e,t)},Q=(null==n?void 0:n.content)??"",ee="dark"===F?kt:Et,te=L/100*12,ie=n&&!n.binary&&!n.tooLarge,se=l.useDeferredValue(T),re=l.useMemo(()=>{var e,t;if(!n||n.binary||n.tooLarge)return null;if(K||q)return null;const i="edit"===N?se:Q;if(null==i)return null;return{bytes:new Blob([i]).size,words:((null==(e=i.match(/[\u4e00-\u9fff\u3400-\u4dbf]/g))?void 0:e.length)??0)+((null==(t=i.replace(/[\u4e00-\u9fff\u3400-\u4dbf]/g," ").match(/[a-zA-Z0-9]+/g))?void 0:t.length)??0),lines:""===i?0:i.split("\n").length}},[n,K,q,N,se,Q]);return _.jsx("div",{className:p("fixed inset-0 z-50 flex items-center justify-center transition-all duration-200",W?"bg-black/60 backdrop-blur-sm pointer-events-auto":"bg-transparent pointer-events-none"),onClick:e=>{e.target===e.currentTarget&&H(!1)},children:_.jsxs("div",{className:p("relative flex flex-col bg-background border border-border shadow-sm transition-all duration-200 pointer-events-auto",M?"w-screen h-screen rounded-none":"w-[72vw] max-w-4xl h-[80vh] rounded-xl",!W&&!M&&"opacity-50"),onClick:()=>H(!0),onFocus:e=>{e.stopPropagation(),H(!0)},children:[_.jsxs("div",{className:"flex items-center gap-2 px-4 h-10 border-b border-border flex-shrink-0",children:[_.jsx(bt,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),_.jsxs("span",{className:"flex-1 text-sm text-foreground font-medium truncate",title:e,children:[$,O&&_.jsx("span",{className:"text-muted-foreground ml-1",children:"*"}),re&&_.jsxs("span",{className:"text-muted-foreground font-normal ml-2 text-xs tabular-nums",children:[(ne=re.bytes,ne<1024?`${ne} B`:ne<1048576?`${(ne/1024).toFixed(1)} KB`:`${(ne/1024/1024).toFixed(2)} MB`)," · ",re.words.toLocaleString()," 词 · ",re.lines.toLocaleString()," 行"]})]}),ie&&!K&&!q&&_.jsxs("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:[V&&_.jsxs(_.Fragment,{children:[_.jsxs("button",{onClick:()=>"edit"===N?J():R("plain"),className:p("p-1 rounded-md transition-colors flex items-center gap-1 text-xs","plain"===N?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"纯文本",children:[_.jsx(si,{className:"h-3 w-3"}),_.jsx("span",{className:"hidden sm:inline",children:"源码"})]}),_.jsxs("button",{onClick:()=>"edit"===N?J():R("rendered"),className:p("p-1 rounded-md transition-colors flex items-center gap-1 text-xs","rendered"===N?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:ki(U),children:[_.jsx(m,{className:"h-3 w-3"}),_.jsx("span",{className:"hidden sm:inline",children:ki(U)})]})]}),s&&_.jsxs("button",{onClick:()=>"edit"===N?J():R("graph"),className:p("p-1 rounded-md transition-colors flex items-center gap-1 text-xs","graph"===N?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"图谱",children:[_.jsx(ui,{className:"h-3 w-3"}),_.jsx("span",{className:"hidden sm:inline",children:"图谱"})]}),_.jsxs("button",{onClick:()=>"edit"===N?J():(j((null==n?void 0:n.content)??""),I(!1),R("edit"),void setTimeout(()=>{var e;return null==(e=z.current)?void 0:e.focus()},0)),className:p("p-1 rounded-md transition-colors flex items-center gap-1 text-xs","edit"===N?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"编辑",children:[_.jsx(g,{className:"h-3 w-3"}),_.jsx("span",{className:"hidden sm:inline",children:"编辑"})]})]}),"edit"===N&&_.jsxs("button",{onClick:()=>{G()},disabled:B||!O,className:p("flex items-center gap-1 text-xs px-2 py-1 rounded transition-colors",O?"bg-blue-600 hover:bg-blue-500 text-white":"bg-muted text-muted-foreground"),title:"保存 (⌘S)",children:[_.jsx(Tt,{className:"h-3 w-3"}),B?"保存中...":"保存"]}),(ie||K)&&"edit"!==N&&"graph"!==N&&_.jsxs("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5 gap-0.5",children:[_.jsx("button",{onClick:()=>{const e=[...Ei].reverse().find(e=>e<L);e&&Z(e)},disabled:L<=Ei[0],className:"p-1 rounded-md text-muted-foreground hover:text-foreground transition-colors disabled:opacity-30",title:"缩小",children:_.jsx(bi,{className:"h-3 w-3"})}),_.jsxs("button",{onClick:()=>Z(Ni),className:"px-1 text-xs text-muted-foreground hover:text-foreground transition-colors min-w-[36px] text-center",title:"重置缩放",children:[L,"%"]}),_.jsx("button",{onClick:()=>{const e=Ei.find(e=>e>L);e&&Z(e)},disabled:L>=Ei[Ei.length-1],className:"p-1 rounded-md text-muted-foreground hover:text-foreground transition-colors disabled:opacity-30",title:"放大",children:_.jsx(vi,{className:"h-3 w-3"})})]}),_.jsx("button",{className:"p-1 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:()=>D(e=>!e),title:M?"退出全屏":"全屏",children:M?_.jsx(v,{className:"h-3.5 w-3.5"}):_.jsx(b,{className:"h-3.5 w-3.5"})}),_.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:async()=>{if(O){if(!(await i({description:"有未保存的修改,确定关闭?",confirmLabel:"放弃修改",destructive:!0})))return}t()},children:_.jsx(S,{className:"h-4 w-4"})})]}),_.jsxs("div",{className:p("flex-1 min-h-0","graph"===N?"overflow-hidden":"overflow-auto"),children:["graph"===N&&_.jsx(l.Suspense,{fallback:_.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"Loading…"}),children:_.jsx(Si,{folderPath:r})}),"graph"!==N&&!n&&!C&&_.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"Loading…"}),"graph"!==N&&C&&_.jsx("p",{className:"text-sm text-red-400 p-4",children:C}),"graph"!==N&&K&&n&&_.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:_.jsx("img",{src:X,alt:$,className:"max-w-full max-h-full object-contain rounded",style:{transform:`scale(${L/100})`,transformOrigin:"center center"},draggable:!1})}),"graph"!==N&&q&&n&&_.jsx(l.Suspense,{fallback:_.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"Loading…"}),children:_.jsx(wi,{filePath:e,ext:U,zoom:L})}),"graph"!==N&&!K&&!q&&n&&n.binary&&_.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-muted-foreground p-4",children:[_.jsx(bt,{className:"h-8 w-8"}),_.jsx("p",{className:"text-sm",children:"Binary file — cannot preview"}),_.jsxs("p",{className:"text-xs text-muted-foreground",children:[(n.size/1024).toFixed(1)," KB"]})]}),"graph"!==N&&!q&&n&&n.tooLarge&&_.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-muted-foreground p-4",children:[_.jsx(bt,{className:"h-8 w-8"}),_.jsx("p",{className:"text-sm",children:"File too large to preview"}),_.jsxs("p",{className:"text-xs text-muted-foreground",children:[(n.size/1024/1024).toFixed(2)," MB (limit 5 MB)"]})]}),"graph"!==N&&ie&&null!==Q&&_.jsxs(_.Fragment,{children:["edit"===N&&_.jsx("textarea",{ref:z,value:T,onChange:e=>{j(e.target.value),I(!0)},className:"w-full h-full bg-transparent text-foreground font-mono outline-none resize-none p-4 leading-relaxed",style:{fontSize:`${te}px`,minHeight:"100%"},spellCheck:!1}),"edit"!==N&&_.jsxs("div",{className:"p-4",style:{fontSize:`${te}px`},children:["plain"===N&&_.jsx("pre",{className:"font-mono text-foreground whitespace-pre-wrap break-words leading-relaxed",style:{fontSize:"inherit"},children:Q}),"rendered"===N&&"md"===U&&_.jsx("div",{className:"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-pre:border-border prose-code:text-foreground",style:{fontSize:"inherit"},children:_.jsx(St,{remarkPlugins:[xt,yt],rehypePlugins:[wt],components:{code({className:e,children:t,...i}){const s=/language-(\w+)/.exec(e||"");return!s&&!e?_.jsx("code",{className:e,...i,children:t}):_.jsx(Ct,{style:ee,language:(null==s?void 0:s[1])||"text",PreTag:"div",customStyle:{fontSize:"inherit",borderRadius:"6px",margin:0},children:String(t).replace(/\n$/,"")})}},children:Q})}),"rendered"===N&&("html"===U||"htm"===U)&&_.jsx("iframe",{srcDoc:vt.sanitize(Q,{WHOLE_DOCUMENT:!0,ADD_TAGS:["style","link"]}),className:"w-full h-full border-0 rounded bg-white",sandbox:"",title:$,style:{minHeight:"60vh",transform:`scale(${L/100})`,transformOrigin:"top left",width:1e4/L+"%",height:1e4/L+"%"}}),"rendered"===N&&"md"!==U&&"html"!==U&&"htm"!==U&&Y&&_.jsx(Ct,{style:ee,language:Y,showLineNumbers:!0,lineNumberStyle:{color:"dark"===F?"#555":"#aaa",fontSize:"inherit"},customStyle:{fontSize:"inherit",borderRadius:"6px",margin:0,background:"transparent"},children:Q}),"rendered"===N&&!V&&_.jsx("pre",{className:"font-mono text-foreground whitespace-pre-wrap break-words leading-relaxed",style:{fontSize:"inherit"},children:Q})]})]})]})]})});var ne}const Mi=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","tiff","tif"]);function Di(e){const t=e.lastIndexOf(".");return t>=0&&Mi.has(e.slice(t+1).toLowerCase())}function Li({projectPath:e,projectId:t}){const[i,s]=l.useState(new Map),[r,n]=l.useState(new Set([e])),[o,h]=l.useState(new Set),d=N(e=>e.get(t).filePreviewPath),u=N(e=>e.setFilePreviewPath),m=e=>u(t,e),[g,v]=l.useState(null),[b,S]=l.useState(!1),[x,y]=l.useState(!1),C=a(),k=l.useRef(null),E=l.useRef(null);l.useEffect(()=>{if(!g)return;const e=()=>v(null);return window.addEventListener("click",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("click",e),window.removeEventListener("scroll",e,!0)}},[g]);const z=async t=>{if(0!==t.length){S(!0);try{await j(e,t),W(e)}catch(i){console.error("[FileTree] Upload failed:",i)}finally{S(!1)}}},W=l.useCallback(async e=>{h(t=>{if(t.has(e))return t;const i=new Set(t);return i.add(e),i});try{const t=await R(e);s(i=>new Map(i).set(e,t.entries))}catch(t){console.error("[FileTree] Failed to load:",e,t),s(t=>new Map(t).set(e,[]))}finally{h(t=>{const i=new Set(t);return i.delete(e),i})}},[]);l.useEffect(()=>{s(new Map),n(new Set([e])),h(new Set),W(e)},[e,W]);const H=l.useCallback(e=>{n(t=>{const s=new Set(t);return s.has(e)?s.delete(e):(s.add(e),i.has(e)||W(e)),s})},[i,W]),F=l.useCallback(()=>{s(new Map),n(new Set([e])),h(new Set),W(e)},[e,W]),$=(e,t)=>e.map(e=>{const s=r.has(e.path),n=o.has(e.path),a=i.get(e.path),l=e.name.startsWith(".");return _.jsxs("div",{children:[_.jsxs("div",{className:p("flex items-center gap-1 py-[3px] rounded cursor-pointer","hover:bg-muted-foreground/10",l&&"opacity-50"),style:{paddingLeft:14*t+6+"px",paddingRight:"6px"},onClick:()=>"dir"===e.type?H(e.path):m(e.path),onContextMenu:t=>{t.preventDefault(),v({x:t.clientX,y:t.clientY,filePath:e.path,fileName:e.name,type:e.type})},children:[_.jsx("span",{className:"w-3 flex-shrink-0 text-muted-foreground",children:"dir"===e.type&&(n?_.jsx(L,{className:"h-2.5 w-2.5 animate-spin"}):s?_.jsx(Jt,{className:"h-2.5 w-2.5"}):_.jsx(B,{className:"h-2.5 w-2.5"}))}),"dir"===e.type?s?_.jsx(P,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}):_.jsx(A,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}):Di(e.name)?_.jsx(Nt,{className:"h-3.5 w-3.5 text-green-400 flex-shrink-0"}):_.jsx(bt,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),_.jsx("span",{className:p("text-xs truncate leading-none","dir"===e.type?"text-foreground":"text-muted-foreground"),title:e.path,children:e.name})]}),_.jsx(O,{initial:!1,children:"dir"===e.type&&s&&_.jsxs(I.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15,ease:"easeInOut"},className:"overflow-hidden",children:[!a&&!n&&_.jsx("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:14*(t+1)+6+16+"px"},children:"—"}),0===(null==a?void 0:a.length)&&_.jsx("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:14*(t+1)+6+16+"px"},children:"empty"}),a&&a.length>0&&$(a,t+1)]})})]},e.path)}),U=i.get(e),K=o.has(e),q=e.split("/").filter(Boolean).pop()??e;return _.jsxs(_.Fragment,{children:[d&&_.jsx(Ri,{filePath:d,onClose:()=>m(null)}),g&&_.jsxs("div",{ref:k,className:"fixed z-50 min-w-[140px] bg-popover border border-border rounded-md shadow-md py-1",style:{left:g.x,top:g.y},onClick:e=>e.stopPropagation(),children:[_.jsxs("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground text-left",onClick:()=>{const t=g.filePath.startsWith(e+"/")?g.filePath.slice(e.length+1):g.filePath;navigator.clipboard.writeText(t),f.success("已复制相对路径"),v(null)},children:[_.jsx(ri,{className:"h-3.5 w-3.5"}),"复制相对路径"]}),_.jsxs("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground text-left",onClick:()=>{navigator.clipboard.writeText(g.filePath),f.success("已复制绝对路径"),v(null)},children:[_.jsx(ii,{className:"h-3.5 w-3.5"}),"复制绝对路径"]}),"file"===g.type&&_.jsxs(_.Fragment,{children:[_.jsx("div",{className:"my-1 border-t border-border"}),_.jsxs("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground text-left",onClick:()=>{(async(e,t)=>{let i=w(e);const s=c();s&&(i+=`${i.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`);const r=`${i}${i.includes("?")?"&":"?"}dl=1`;try{const e=await fetch(r,{method:"HEAD"});if(!e.ok)return void f.error(`下载失败 (${e.status})`)}catch{return void f.error("下载失败:网络错误")}const n=document.createElement("a");n.href=r,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n)})(g.filePath,g.fileName),v(null)},children:[_.jsx(M,{className:"h-3.5 w-3.5"}),"下载"]})]}),_.jsx("div",{className:"my-1 border-t border-border"}),_.jsxs("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-destructive/80 hover:text-destructive-foreground text-left",onClick:()=>{(async(t,s,r)=>{const n="dir"===r?`文件夹 "${s}" 及其所有内容`:`文件 "${s}"`;if(await C({title:"确认删除",description:`确认删除${n}?此操作不可撤销。`,destructive:!0,confirmLabel:"删除"}))try{await T(t),f.success(`已删除: ${s}`);const r=t.substring(0,t.lastIndexOf("/"));r&&i.has(r)?W(r):W(e)}catch(o){f.error(`删除失败: ${o.message}`)}})(g.filePath,g.fileName,g.type),v(null)},children:[_.jsx(D,{className:"h-3.5 w-3.5"}),"删除"]})]}),_.jsxs("div",{className:"h-full flex flex-col text-foreground select-none",children:[_.jsxs("div",{className:"flex items-center justify-between px-3 h-9 border-b border-border flex-shrink-0",children:[_.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Files"}),_.jsxs("div",{className:"flex items-center gap-0.5",children:[_.jsx("input",{ref:E,type:"file",multiple:!0,className:"hidden",onChange:e=>{const t=Array.from(e.target.files??[]);t.length>0&&z(t),e.target.value=""}}),_.jsx("button",{className:"text-muted-foreground hover:text-foreground p-0.5 rounded transition-colors",onClick:()=>{var e;return null==(e=E.current)?void 0:e.click()},disabled:b,title:"上传文件",children:_.jsx(jt,{className:p("h-3 w-3",b&&"animate-pulse")})}),_.jsx("button",{className:"text-muted-foreground hover:text-foreground p-0.5 rounded transition-colors",onClick:F,title:"Refresh file tree",children:_.jsx(L,{className:p("h-3 w-3",K&&"animate-spin")})})]})]}),_.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b border-border flex-shrink-0",children:[_.jsx(P,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}),_.jsx("span",{className:"text-xs text-foreground font-medium truncate",title:e,children:q})]}),_.jsxs("div",{className:p("flex-1 overflow-y-auto py-1 min-h-0 transition-colors",x&&"bg-accent/30 ring-1 ring-inset ring-accent"),onDragOver:e=>{e.preventDefault(),y(!0)},onDragEnter:e=>{e.preventDefault(),y(!0)},onDragLeave:()=>y(!1),onDrop:e=>{e.preventDefault(),y(!1);const t=Array.from(e.dataTransfer.files);t.length>0&&z(t)},children:[b&&_.jsx("div",{className:"text-xs text-muted-foreground px-4 py-1",children:"上传中..."}),x&&!b&&_.jsx("div",{className:"text-xs text-muted-foreground px-4 py-1",children:"松开以上传文件"}),K&&!U?_.jsx("div",{className:"text-xs text-muted-foreground px-4 py-3",children:"Loading…"}):U&&0!==U.length?$(U,0):_.jsx("div",{className:"text-xs text-muted-foreground px-4 py-3",children:"Empty folder"})]})]})]})}function Pi(e){const t=new Date(e),i=Date.now()-t.getTime();return i<36e5?`${Math.floor(i/6e4)}分钟前`:i<864e5?`${Math.floor(i/36e5)}小时前`:i<6048e5?`${Math.floor(i/864e5)}天前`:t.toLocaleDateString()}function Ti({projectId:e}){const[t,i]=l.useState(null),[s,r]=l.useState(!0),[n,o]=l.useState(null),[a,h]=l.useState(null),[c,d]=l.useState(""),[u,m]=l.useState(!1),[g,v]=l.useState([]),[b,S]=l.useState(0),[w,x]=l.useState(!0),[y,C]=l.useState(!1),k=l.useCallback(async()=>{r(!0);try{i(await z(e))}catch{i(null)}finally{r(!1)}},[e]),E=l.useCallback(async(t=!1)=>{C(!0);try{const i=t?g.length:0,s=await W(e,30,i);v(e=>t?[...e,...s.commits]:s.commits),S(s.total)}catch{}finally{C(!1)}},[e,g.length]);l.useEffect(()=>{k(),E()},[e]);const N=async t=>{try{const{diff:i}=await K(e,t);o(i||"(no diff)"),h(t??"all changes")}catch{f.error("获取 diff 失败")}},R=async t=>{try{await q(e,[t]),f.success(`已暂存 ${t}`),await k()}catch{f.error("git add 失败")}},M=async()=>{if(c.trim()){m(!0);try{await V(e,c),f.success("提交成功"),d(""),await k()}catch(t){f.error(t instanceof Error?t.message:"提交失败")}finally{m(!1)}}};if(!t&&s)return _.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-muted-foreground/50 text-xs",children:[_.jsx(oi,{className:"h-5 w-5"}),_.jsx("p",{children:"加载中…"})]});if(!t||!t.isRepo)return _.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-muted-foreground/50 text-xs",children:[_.jsx(oi,{className:"h-5 w-5"}),_.jsx("p",{children:t?"非 Git 仓库":"加载失败"}),_.jsx(H,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>{k()},children:"重试"})]});const D=[...t.modified??[],...t.deleted??[]],P=t.staged??[],T=t.untracked??[];return _.jsxs("div",{className:"flex flex-col h-full overflow-y-auto p-2 space-y-2 text-xs",children:[_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground font-medium",children:[_.jsx(oi,{className:"h-3 w-3"}),_.jsx("span",{children:t.branch}),(t.ahead??0)>0&&_.jsxs("span",{className:"text-blue-400",children:["↑",t.ahead]}),(t.behind??0)>0&&_.jsxs("span",{className:"text-yellow-400",children:["↓",t.behind]})]}),_.jsx(H,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>{k()},disabled:s,children:_.jsx(L,{className:p("h-3 w-3",s&&"animate-spin")})})]}),P.length>0&&_.jsxs("div",{children:[_.jsxs("div",{className:"text-muted-foreground mb-1 font-medium",children:["已暂存 (",P.length,")"]}),P.map(e=>_.jsxs("div",{className:"flex items-center gap-1 py-0.5 px-1 rounded hover:bg-muted-foreground/10",children:[_.jsx(F,{className:"h-2.5 w-2.5 text-green-500 flex-shrink-0"}),_.jsx("button",{className:"flex-1 text-left truncate text-green-400",onClick:()=>{N(e)},children:e})]},e))]}),D.length>0&&_.jsxs("div",{children:[_.jsxs("div",{className:"text-muted-foreground mb-1 font-medium",children:["未暂存 (",D.length,")"]}),D.map(e=>_.jsxs("div",{className:"flex items-center gap-1 py-0.5 px-1 rounded hover:bg-muted-foreground/10",children:[_.jsx("button",{className:"flex-shrink-0 h-4 w-4 flex items-center justify-center rounded hover:bg-green-500/20 text-muted-foreground hover:text-green-400",title:"git add",onClick:()=>{R(e)},children:_.jsx($,{className:"h-2.5 w-2.5"})}),_.jsx("button",{className:"flex-1 text-left truncate text-yellow-400",onClick:()=>{N(e)},children:e})]},e))]}),T.length>0&&_.jsxs("div",{children:[_.jsxs("div",{className:"text-muted-foreground mb-1 font-medium",children:["未跟踪 (",T.length,")"]}),T.map(e=>_.jsxs("div",{className:"flex items-center gap-1 py-0.5 px-1 rounded hover:bg-muted-foreground/10",children:[_.jsx("button",{className:"flex-shrink-0 h-4 w-4 flex items-center justify-center rounded hover:bg-green-500/20 text-muted-foreground hover:text-green-400",title:"git add",onClick:()=>{R(e)},children:_.jsx($,{className:"h-2.5 w-2.5"})}),_.jsx("span",{className:"flex-1 truncate text-muted-foreground",children:e})]},e))]}),0===D.length&&0===P.length&&0===T.length&&_.jsx("p",{className:"text-muted-foreground/50 text-center py-4",children:"工作区干净"}),P.length>0&&_.jsxs("div",{className:"space-y-1.5 pt-1 border-t border-border",children:[_.jsx(U,{placeholder:"提交消息…",value:c,onChange:e=>d(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||M()},className:"h-7 text-xs"}),_.jsx(H,{size:"sm",className:"w-full h-7 text-xs",onClick:()=>{M()},disabled:!c.trim()||u,children:u?"提交中…":`提交 (${P.length} 文件)`})]}),(null==t?void 0:t.isRepo)&&_.jsxs("div",{className:"border-t border-border pt-2",children:[_.jsxs("button",{className:"flex items-center gap-1 text-muted-foreground font-medium mb-1 w-full text-left",onClick:()=>x(e=>!e),children:[_.jsx(Jt,{className:p("h-3 w-3 transition-transform",!w&&"-rotate-90")}),_.jsx(ai,{className:"h-3 w-3"}),_.jsxs("span",{children:["提交历史 (",b,")"]})]}),w&&_.jsxs("div",{className:"space-y-0.5",children:[g.map((e,t)=>{const i=e.parents.length>1;return _.jsxs("div",{className:"flex gap-1.5 items-start group",children:[_.jsxs("div",{className:"flex flex-col items-center flex-shrink-0 w-3",children:[_.jsx("div",{className:p("w-2 h-2 rounded-full flex-shrink-0 mt-1",0===t?"bg-blue-400":i?"bg-purple-400":"bg-muted-foreground/40")}),t<g.length-1&&_.jsx("div",{className:"w-px flex-1 bg-border min-h-[12px]"})]}),_.jsxs("div",{className:"flex-1 min-w-0 pb-1",children:[_.jsxs("div",{className:"flex items-baseline gap-1",children:[_.jsx("span",{className:"font-mono text-muted-foreground/60 text-[10px] flex-shrink-0",children:e.hashShort}),_.jsx("span",{className:"truncate leading-tight",children:e.message.split("\n")[0]})]}),_.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/50 mt-0.5",children:[_.jsx("span",{children:e.author}),_.jsx("span",{children:Pi(e.date)}),e.branches.length>0&&e.branches.slice(0,2).map(e=>_.jsx("span",{className:"px-1 py-px rounded bg-blue-500/10 text-blue-400 text-[9px]",children:e.replace("remotes/origin/","↑")},e))]})]})]},e.hash)}),g.length<b&&_.jsx("button",{className:"w-full text-center text-[10px] text-muted-foreground hover:text-foreground py-1",onClick:()=>{E(!0)},disabled:y,children:y?"加载中...":`加载更多 (${g.length}/${b})`})]})]}),null!==n&&_.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",onClick:()=>o(null),children:[_.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),_.jsxs("div",{className:"relative z-10 w-[700px] max-w-[95vw] max-h-[80vh] flex flex-col bg-background border border-border rounded-xl shadow-sm",onClick:e=>e.stopPropagation(),children:[_.jsxs("div",{className:"flex items-center justify-between px-4 h-10 border-b border-border text-sm font-medium flex-shrink-0",children:[_.jsx("span",{className:"truncate text-muted-foreground",children:a}),_.jsx("button",{className:"text-muted-foreground hover:text-foreground",onClick:()=>o(null),children:"✕"})]}),_.jsx("pre",{className:"flex-1 overflow-auto p-3 text-[11px] font-mono whitespace-pre leading-relaxed",children:n.split("\n").map((e,t)=>_.jsx("span",{className:p("block",e.startsWith("+")&&!e.startsWith("+++")&&"text-green-400 bg-green-400/5",e.startsWith("-")&&!e.startsWith("---")&&"text-red-400 bg-red-400/5",e.startsWith("@@")&&"text-blue-400"),children:e},t))})]})]})]})}function ji(e){if(!e)return"-";const t=e-Date.now(),i=Math.abs(t),s=t<0,r=Math.round(i/1e3);if(r<60)return s?`${r} 秒前`:`${r} 秒后`;const n=Math.round(r/60);if(n<60)return s?`${n} 分钟前`:`${n} 分钟后`;const o=Math.round(n/60);if(o<24)return s?`${o} 小时前`:`${o} 小时后`;const a=Math.round(o/24);return s?`${a} 天前`:`${a} 天后`}function Bi(e){if(!e)return"";return new Date(e).toLocaleString(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function Ai({projectId:e}){const[t,i]=l.useState(null),[s,r]=l.useState(!0),[n,o]=l.useState(null),[,a]=l.useState(0),h=l.useRef(!0),c=l.useCallback(async()=>{r(!0),o(null);try{const{tasks:t}=await Y(e);if(!h.current)return;i(t)}catch(xa){if(!h.current)return;o(xa.message),i([])}finally{h.current&&r(!1)}},[e]);return l.useEffect(()=>{h.current=!0,c();const e=setInterval(()=>{c()},3e4),t=setInterval(()=>a(e=>e+1),1e3);return()=>{h.current=!1,clearInterval(e),clearInterval(t)}},[c]),_.jsxs("div",{className:"h-full flex flex-col bg-muted text-foreground overflow-hidden",children:[_.jsxs("div",{className:"flex-shrink-0 px-3 py-2 flex items-center justify-between border-b border-border",children:[_.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[_.jsx(Rt,{className:"size-4"}),_.jsx("span",{children:"已排程任务"})]}),_.jsx(H,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{c()},title:"刷新","aria-label":"刷新",children:_.jsx(L,{className:p("size-3.5",s&&"animate-spin")})})]}),_.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-2 space-y-1.5",children:[n&&_.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 text-destructive p-2 text-xs",children:n}),!n&&t&&0===t.length&&!s&&_.jsxs("div",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:[_.jsx("p",{children:"本项目暂无已排程任务"}),_.jsxs("p",{className:"mt-2 leading-relaxed",children:["仅显示 ",_.jsx("code",{className:"text-[10px] bg-muted-foreground/10 px-1 rounded",children:"durable"})," 任务 (Claude 通过 ",_.jsx("code",{className:"text-[10px] bg-muted-foreground/10 px-1 rounded",children:"/loop"})," 或"," ",_.jsx("code",{className:"text-[10px] bg-muted-foreground/10 px-1 rounded",children:"CronCreate durable:true"})," 创建的)。"]}),_.jsx("p",{className:"mt-1 text-muted-foreground/70",children:"session-only 任务在 CLI 内存中,此处不可见。"})]}),t&&t.map(e=>{const t=e.nextFireAt?Date.parse(e.nextFireAt):null,i=e.lastFiredAt??null;return _.jsx("div",{className:"rounded-md border border-border bg-background px-2.5 py-2 text-xs",children:_.jsxs("div",{className:"flex items-start gap-2",children:[_.jsx("div",{className:"shrink-0 mt-0.5 text-muted-foreground",children:e.recurring?_.jsx(mi,{className:"size-3.5"}):_.jsx(X,{className:"size-3.5"})}),_.jsxs("div",{className:"flex-1 min-w-0",children:[_.jsx("div",{className:"font-medium text-foreground line-clamp-2 leading-snug",children:e.prompt.trim()||"(无 prompt)"}),_.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-muted-foreground",children:[_.jsx("code",{className:"text-[10px] bg-muted-foreground/10 px-1 rounded font-mono",children:e.cron}),_.jsx("span",{className:"text-muted-foreground/50",children:"·"}),_.jsx("span",{children:e.id.slice(0,8)}),e.recurring&&_.jsxs(_.Fragment,{children:[_.jsx("span",{className:"text-muted-foreground/50",children:"·"}),_.jsx("span",{children:"循环"})]})]}),_.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-muted-foreground",children:[null!==t&&_.jsxs("span",{title:Bi(t),children:["下次: ",_.jsx("span",{className:"text-foreground/90",children:ji(t)})]}),null!==i&&_.jsxs("span",{title:Bi(i),children:["上次: ",_.jsx("span",{className:"text-foreground/90",children:ji(i)})]})]})]})]})},e.id)}),s&&!t&&_.jsx("div",{className:"space-y-1.5",children:[0,1].map(e=>_.jsx("div",{className:"rounded-md border border-border bg-background px-2.5 py-2 h-16 animate-pulse"},e))})]})]})}function Oi(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(2)} GB`}function Ii(e){if(!e)return"-";const t=e-Date.now(),i=Math.abs(t),s=t<0,r=Math.round(i/1e3);if(r<60)return s?`${r} 秒前`:`${r} 秒后`;const n=Math.round(r/60);if(n<60)return s?`${n} 分钟前`:`${n} 分钟后`;const o=Math.round(n/60);if(o<24)return s?`${o} 小时前`:`${o} 小时后`;const a=Math.round(o/24);return s?`${a} 天前`:`${a} 天后`}function zi(e){return new Date(e).toLocaleString(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function Wi({projectId:e}){const[t,i]=l.useState(null),[s,r]=l.useState(!0),[n,o]=l.useState(!1),[a,h]=l.useState(null),[,c]=l.useState(0),d=l.useRef(!0),u=l.useCallback(async()=>{h(null);try{const t=await G(e);if(!d.current)return;i(t)}catch(xa){if(!d.current)return;h(xa.message)}finally{d.current&&r(!1)}},[e]),m=l.useCallback(async()=>{o(!0);try{const t=await J(e);if(!d.current)return;const i=[];t.copied>0&&i.push(`新增/更新 ${t.copied}`),t.deleted>0&&i.push(`删除 ${t.deleted}`),t.skipped>0&&i.push(`跳过 ${t.skipped}`),f.success(`同步完成:${i.join("·")||"无变化"}`),await u()}catch(xa){f.error(`同步失败:${xa.message}`)}finally{d.current&&o(!1)}},[e,u]);l.useEffect(()=>{d.current=!0,u();const e=setInterval(()=>{u()},3e4),t=setInterval(()=>c(e=>e+1),5e3);return()=>{d.current=!1,clearInterval(e),clearInterval(t)}},[u]);const g=(null==t?void 0:t.files.reduce((e,t)=>e+t.bytes,0))??0;return _.jsxs("div",{className:"h-full flex flex-col bg-muted text-foreground overflow-hidden",children:[_.jsxs("div",{className:"flex-shrink-0 px-3 py-2 flex items-center justify-between border-b border-border",children:[_.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[_.jsx(Z,{className:"size-4"}),_.jsx("span",{children:"聊天记录备份"})]}),_.jsx(H,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{u()},title:"刷新","aria-label":"刷新",disabled:s,children:_.jsx(L,{className:p("size-3.5",s&&"animate-spin")})})]}),_.jsx("div",{className:"flex-shrink-0 px-3 py-2 border-b border-border bg-background/40",children:_.jsxs("div",{className:"flex items-center justify-between gap-2",children:[_.jsxs("div",{className:"text-[11px] text-muted-foreground min-w-0",children:[_.jsxs("div",{children:["最后同步:"," ",_.jsx("span",{className:"text-foreground/90",title:(null==t?void 0:t.meta)?zi(t.meta.lastBackupAt):void 0,children:(null==t?void 0:t.meta)?Ii(t.meta.lastBackupAt):"从未同步"})]}),t&&_.jsxs("div",{className:"mt-0.5 text-muted-foreground/80",children:[t.files.length," 个文件 · ",Oi(g)]})]}),_.jsx(H,{size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{m()},disabled:n||!(null==t?void 0:t.supported),children:n?"同步中…":"立即同步"})]})}),_.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-2 space-y-1",children:[a&&_.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 text-destructive p-2 text-xs flex items-start gap-2",children:[_.jsx(ei,{className:"size-3.5 shrink-0 mt-0.5"}),_.jsx("span",{children:a})]}),t&&!t.supported&&_.jsx("div",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:_.jsxs("p",{children:["此项目使用 ",_.jsx("code",{className:"text-[10px] bg-muted-foreground/10 px-1 rounded",children:"terminal"})," 模式,无聊天记录需备份。"]})}),(null==t?void 0:t.supported)&&0===t.files.length&&!s&&!a&&_.jsxs("div",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:[_.jsx("p",{children:"暂无已备份的聊天记录"}),_.jsx("p",{className:"mt-2 leading-relaxed text-muted-foreground/80",children:'定时每 5 分钟同步一次,也可点击右上方"立即同步"手动触发。'}),_.jsxs("p",{className:"mt-1 text-muted-foreground/70",children:["备份路径: ",_.jsx("code",{className:"text-[10px] bg-muted-foreground/10 px-1 rounded break-all",children:t.backupDir})]})]}),null==t?void 0:t.files.map(e=>_.jsxs("div",{className:"rounded-md border border-border bg-background px-2.5 py-1.5 text-xs flex items-center gap-2 hover:bg-accent/50 transition-colors",children:[_.jsx(bt,{className:"size-3.5 shrink-0 text-muted-foreground"}),_.jsxs("div",{className:"flex-1 min-w-0",children:[_.jsx("div",{className:"font-mono text-[11px] text-foreground truncate",title:e.name,children:e.name}),_.jsxs("div",{className:"text-muted-foreground/80 text-[10px] flex items-center gap-2",children:[_.jsx("span",{title:zi(e.mtime),children:Ii(e.mtime)}),_.jsx("span",{className:"text-muted-foreground/40",children:"·"}),_.jsx("span",{children:Oi(e.bytes)})]})]})]},e.name)),s&&!t&&_.jsx("div",{className:"space-y-1",children:[0,1].map(e=>_.jsx("div",{className:"rounded-md border border-border bg-background h-10 animate-pulse"},e))})]})]})}function Hi({projectPath:e,projectId:t,cliTool:i}){const[s,r]=Q(y.leftPanelTab,"files"),n="claude"===i,o="terminal"!==i;let a;return a="git"===s?"git":"scheduled"===s&&n?"scheduled":"backup"===s&&o?"backup":"files",_.jsxs(Bt,{value:a,onValueChange:e=>r(e),orientation:"vertical",className:"h-full flex bg-muted text-foreground overflow-hidden",children:[_.jsxs(At,{className:p("flex flex-col items-center justify-start shrink-0","h-full w-9 border-r border-border rounded-none p-1 gap-1"),children:[_.jsx(Ot,{value:"files",title:"Files","aria-label":"Files",className:p("h-7 w-7 p-0 rounded-md flex items-center justify-center"),children:_.jsx(P,{className:"h-3.5 w-3.5"})}),_.jsx(Ot,{value:"git",title:"Git","aria-label":"Git",className:p("h-7 w-7 p-0 rounded-md flex items-center justify-center"),children:_.jsx(oi,{className:"h-3.5 w-3.5"})}),n&&_.jsx(Ot,{value:"scheduled",title:"已排程任务","aria-label":"Scheduled tasks",className:p("h-7 w-7 p-0 rounded-md flex items-center justify-center"),children:_.jsx(Rt,{className:"h-3.5 w-3.5"})}),o&&_.jsx(Ot,{value:"backup",title:"聊天记录备份","aria-label":"Sessions backup",className:p("h-7 w-7 p-0 rounded-md flex items-center justify-center"),children:_.jsx(Z,{className:"h-3.5 w-3.5"})})]}),_.jsxs("div",{className:"flex-1 min-w-0 flex flex-col border-l border-border",children:[_.jsx(It,{value:"files",className:"flex-1 min-h-0 mt-0 data-[state=inactive]:hidden",children:_.jsx(Li,{projectPath:e,projectId:t})}),_.jsx(It,{value:"git",className:"flex-1 min-h-0 mt-0 data-[state=inactive]:hidden",children:_.jsx(Ti,{projectId:t})}),n&&_.jsx(It,{value:"scheduled",className:"flex-1 min-h-0 mt-0 data-[state=inactive]:hidden",children:_.jsx(Ai,{projectId:t})}),o&&_.jsx(It,{value:"backup",className:"flex-1 min-h-0 mt-0 data-[state=inactive]:hidden",children:_.jsx(Wi,{projectId:t})})]})]})}function Fi(e){const t=$i(e),i=l.forwardRef((e,i)=>{const{children:s,...r}=e,n=l.Children.toArray(s),o=n.find(Ki);if(o){const e=o.props.children,s=n.map(t=>t===o?l.Children.count(e)>1?l.Children.only(null):l.isValidElement(e)?e.props.children:null:t);return _.jsx(t,{...r,ref:i,children:l.isValidElement(e)?l.cloneElement(e,void 0,s):null})}return _.jsx(t,{...r,ref:i,children:s})});return i.displayName=`${e}.Slot`,i}function $i(e){const t=l.forwardRef((e,t)=>{const{children:i,...s}=e;if(l.isValidElement(i)){const e=function(e){var t,i;let s=null==(t=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:t.get,r=s&&"isReactWarning"in s&&s.isReactWarning;if(r)return e.ref;if(s=null==(i=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:i.get,r=s&&"isReactWarning"in s&&s.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(i),r=function(e,t){const i={...t};for(const s in t){const r=e[s],n=t[s];/^on[A-Z]/.test(s)?r&&n?i[s]=(...e)=>{const t=n(...e);return r(...e),t}:r&&(i[s]=r):"style"===s?i[s]={...r,...n}:"className"===s&&(i[s]=[r,n].filter(Boolean).join(" "))}return{...e,...i}}(s,i.props);return i.type!==l.Fragment&&(r.ref=t?ee(t,e):e),l.cloneElement(i,r)}return l.Children.count(i)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ui=Symbol("radix.slottable");function Ki(e){return l.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Ui}var qi=["Enter"," "],Vi=["ArrowUp","PageDown","End"],Yi=["ArrowDown","PageUp","Home",...Vi],Xi={ltr:[...qi,"ArrowRight"],rtl:[...qi,"ArrowLeft"]},Gi={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ji="Menu",[Zi,Qi,es]=Ut(Ji),[ts,is]=ie(Ji,[es,Ft,$t]),ss=Ft(),rs=$t(),[ns,os]=ts(Ji),[as,ls]=ts(Ji),hs=e=>{const{__scopeMenu:t,open:i=!1,children:s,dir:r,onOpenChange:n,modal:o=!0}=e,a=ss(t),[h,c]=l.useState(null),d=l.useRef(!1),u=te(n),f=zt(r);return l.useEffect(()=>{const e=()=>{d.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),_.jsx(Wt,{...a,children:_.jsx(ns,{scope:t,open:i,onOpenChange:u,content:h,onContentChange:c,children:_.jsx(as,{scope:t,onClose:l.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:d,dir:f,modal:o,children:s})})})};hs.displayName=Ji;var cs=l.forwardRef((e,t)=>{const{__scopeMenu:i,...s}=e,r=ss(i);return _.jsx(Ht,{...r,...s,ref:t})});cs.displayName="MenuAnchor";var ds="MenuPortal",[us,fs]=ts(ds,{forceMount:void 0}),_s=e=>{const{__scopeMenu:t,forceMount:i,children:s,container:r}=e,n=os(ds,t);return _.jsx(us,{scope:t,forceMount:i,children:_.jsx(se,{present:i||n.open,children:_.jsx(re,{asChild:!0,container:r,children:s})})})};_s.displayName=ds;var ps="MenuContent",[ms,gs]=ts(ps),vs=l.forwardRef((e,t)=>{const i=fs(ps,e.__scopeMenu),{forceMount:s=i.forceMount,...r}=e,n=os(ps,e.__scopeMenu),o=ls(ps,e.__scopeMenu);return _.jsx(Zi.Provider,{scope:e.__scopeMenu,children:_.jsx(se,{present:s||n.open,children:_.jsx(Zi.Slot,{scope:e.__scopeMenu,children:o.modal?_.jsx(bs,{...r,ref:t}):_.jsx(Ss,{...r,ref:t})})})})}),bs=l.forwardRef((e,t)=>{const i=os(ps,e.__scopeMenu),s=l.useRef(null),r=ne(t,s);return l.useEffect(()=>{const e=s.current;if(e)return le(e)},[]),_.jsx(xs,{...e,ref:r,trapFocus:i.open,disableOutsidePointerEvents:i.open,disableOutsideScroll:!0,onFocusOutside:oe(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>i.onOpenChange(!1)})}),Ss=l.forwardRef((e,t)=>{const i=os(ps,e.__scopeMenu);return _.jsx(xs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>i.onOpenChange(!1)})}),ws=Fi("MenuContent.ScrollLock"),xs=l.forwardRef((e,t)=>{const{__scopeMenu:i,loop:s=!1,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:h,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...g}=e,v=os(ps,i),b=ls(ps,i),S=ss(i),w=rs(i),x=Qi(i),[y,C]=l.useState(null),k=l.useRef(null),E=ne(t,k,v.onContentChange),N=l.useRef(0),R=l.useRef(""),M=l.useRef(0),D=l.useRef(null),L=l.useRef("right"),P=l.useRef(0),T=m?de:l.Fragment,j=m?{as:ws,allowPinchZoom:!0}:void 0,B=e=>{var t,i;const s=R.current+e,r=x().filter(e=>!e.disabled),n=document.activeElement,o=null==(t=r.find(e=>e.ref.current===n))?void 0:t.textValue,a=function(e,t,i){const s=t.length>1&&Array.from(t).every(e=>e===t[0]),r=s?t[0]:t,n=i?e.indexOf(i):-1;let o=(a=e,l=Math.max(n,0),a.map((e,t)=>a[(l+t)%a.length]));var a,l;1===r.length&&(o=o.filter(e=>e!==i));const h=o.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return h!==i?h:void 0}(r.map(e=>e.textValue),s,o),l=null==(i=r.find(e=>e.textValue===a))?void 0:i.ref.current;!function e(t){R.current=t,window.clearTimeout(N.current),""!==t&&(N.current=window.setTimeout(()=>e(""),1e3))}(s),l&&setTimeout(()=>l.focus())};l.useEffect(()=>()=>window.clearTimeout(N.current),[]),ce();const A=l.useCallback(e=>{var t,i;return L.current===(null==(t=D.current)?void 0:t.side)&&function(e,t){if(!t)return!1;const i={x:e.clientX,y:e.clientY};return function(e,t){const{x:i,y:s}=e;let r=!1;for(let n=0,o=t.length-1;n<t.length;o=n++){const e=t[n],a=t[o],l=e.x,h=e.y,c=a.x,d=a.y;h>s!=d>s&&i<(c-l)*(s-h)/(d-h)+l&&(r=!r)}return r}(i,t)}(e,null==(i=D.current)?void 0:i.area)},[]);return _.jsx(ms,{scope:i,searchRef:R,onItemEnter:l.useCallback(e=>{A(e)&&e.preventDefault()},[A]),onItemLeave:l.useCallback(e=>{var t;A(e)||(null==(t=k.current)||t.focus(),C(null))},[A]),onTriggerLeave:l.useCallback(e=>{A(e)&&e.preventDefault()},[A]),pointerGraceTimerRef:M,onPointerGraceIntentChange:l.useCallback(e=>{D.current=e},[]),children:_.jsx(T,{...j,children:_.jsx(ue,{asChild:!0,trapped:r,onMountAutoFocus:oe(n,e=>{var t;e.preventDefault(),null==(t=k.current)||t.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:_.jsx(fe,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:f,onDismiss:p,children:_.jsx(qt,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:s,currentTabStopId:y,onCurrentTabStopIdChange:C,onEntryFocus:oe(h,e=>{b.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(Vt,{role:"menu","aria-orientation":"vertical","data-state":Ys(v.open),"data-radix-menu-content":"",dir:b.dir,...S,...g,ref:E,style:{outline:"none",...g.style},onKeyDown:oe(g.onKeyDown,e=>{const t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,i=e.ctrlKey||e.altKey||e.metaKey,s=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!i&&s&&B(e.key));const r=k.current;if(e.target!==r)return;if(!Yi.includes(e.key))return;e.preventDefault();const n=x().filter(e=>!e.disabled).map(e=>e.ref.current);Vi.includes(e.key)&&n.reverse(),function(e){const t=document.activeElement;for(const i of e){if(i===t)return;if(i.focus(),document.activeElement!==t)return}}(n)}),onBlur:oe(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(N.current),R.current="")}),onPointerMove:oe(e.onPointerMove,Js(e=>{const t=e.target,i=P.current!==e.clientX;if(e.currentTarget.contains(t)&&i){const t=e.clientX>P.current?"right":"left";L.current=t,P.current=e.clientX}}))})})})})})})});vs.displayName=ps;var ys=l.forwardRef((e,t)=>{const{__scopeMenu:i,...s}=e;return _.jsx(ae.div,{role:"group",...s,ref:t})});ys.displayName="MenuGroup";var Cs=l.forwardRef((e,t)=>{const{__scopeMenu:i,...s}=e;return _.jsx(ae.div,{...s,ref:t})});Cs.displayName="MenuLabel";var ks="MenuItem",Es="menu.itemSelect",Ns=l.forwardRef((e,t)=>{const{disabled:i=!1,onSelect:s,...r}=e,n=l.useRef(null),o=ls(ks,e.__scopeMenu),a=gs(ks,e.__scopeMenu),h=ne(t,n),c=l.useRef(!1);return _.jsx(Rs,{...r,ref:h,disabled:i,onClick:oe(e.onClick,()=>{const e=n.current;if(!i&&e){const t=new CustomEvent(Es,{bubbles:!0,cancelable:!0});e.addEventListener(Es,e=>null==s?void 0:s(e),{once:!0}),he(e,t),t.defaultPrevented?c.current=!1:o.onClose()}}),onPointerDown:t=>{var i;null==(i=e.onPointerDown)||i.call(e,t),c.current=!0},onPointerUp:oe(e.onPointerUp,e=>{var t;c.current||null==(t=e.currentTarget)||t.click()}),onKeyDown:oe(e.onKeyDown,e=>{const t=""!==a.searchRef.current;i||t&&" "===e.key||qi.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Ns.displayName=ks;var Rs=l.forwardRef((e,t)=>{const{__scopeMenu:i,disabled:s=!1,textValue:r,...n}=e,o=gs(ks,i),a=rs(i),h=l.useRef(null),c=ne(t,h),[d,u]=l.useState(!1),[f,p]=l.useState("");return l.useEffect(()=>{const e=h.current;e&&p((e.textContent??"").trim())},[n.children]),_.jsx(Zi.ItemSlot,{scope:i,disabled:s,textValue:r??f,children:_.jsx(Kt,{asChild:!0,...a,focusable:!s,children:_.jsx(ae.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...n,ref:c,onPointerMove:oe(e.onPointerMove,Js(e=>{if(s)o.onItemLeave(e);else if(o.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus({preventScroll:!0})}})),onPointerLeave:oe(e.onPointerLeave,Js(e=>o.onItemLeave(e))),onFocus:oe(e.onFocus,()=>u(!0)),onBlur:oe(e.onBlur,()=>u(!1))})})})}),Ms=l.forwardRef((e,t)=>{const{checked:i=!1,onCheckedChange:s,...r}=e;return _.jsx(Os,{scope:e.__scopeMenu,checked:i,children:_.jsx(Ns,{role:"menuitemcheckbox","aria-checked":Xs(i)?"mixed":i,...r,ref:t,"data-state":Gs(i),onSelect:oe(r.onSelect,()=>null==s?void 0:s(!!Xs(i)||!i),{checkForDefaultPrevented:!1})})})});Ms.displayName="MenuCheckboxItem";var Ds="MenuRadioGroup",[Ls,Ps]=ts(Ds,{value:void 0,onValueChange:()=>{}}),Ts=l.forwardRef((e,t)=>{const{value:i,onValueChange:s,...r}=e,n=te(s);return _.jsx(Ls,{scope:e.__scopeMenu,value:i,onValueChange:n,children:_.jsx(ys,{...r,ref:t})})});Ts.displayName=Ds;var js="MenuRadioItem",Bs=l.forwardRef((e,t)=>{const{value:i,...s}=e,r=Ps(js,e.__scopeMenu),n=i===r.value;return _.jsx(Os,{scope:e.__scopeMenu,checked:n,children:_.jsx(Ns,{role:"menuitemradio","aria-checked":n,...s,ref:t,"data-state":Gs(n),onSelect:oe(s.onSelect,()=>{var e;return null==(e=r.onValueChange)?void 0:e.call(r,i)},{checkForDefaultPrevented:!1})})})});Bs.displayName=js;var As="MenuItemIndicator",[Os,Is]=ts(As,{checked:!1}),zs=l.forwardRef((e,t)=>{const{__scopeMenu:i,forceMount:s,...r}=e,n=Is(As,i);return _.jsx(se,{present:s||Xs(n.checked)||!0===n.checked,children:_.jsx(ae.span,{...r,ref:t,"data-state":Gs(n.checked)})})});zs.displayName=As;var Ws=l.forwardRef((e,t)=>{const{__scopeMenu:i,...s}=e;return _.jsx(ae.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});Ws.displayName="MenuSeparator";var Hs=l.forwardRef((e,t)=>{const{__scopeMenu:i,...s}=e,r=ss(i);return _.jsx(Yt,{...r,...s,ref:t})});Hs.displayName="MenuArrow";var[Fs,$s]=ts("MenuSub"),Us="MenuSubTrigger",Ks=l.forwardRef((e,t)=>{const i=os(Us,e.__scopeMenu),s=ls(Us,e.__scopeMenu),r=$s(Us,e.__scopeMenu),n=gs(Us,e.__scopeMenu),o=l.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:h}=n,c={__scopeMenu:e.__scopeMenu},d=l.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return l.useEffect(()=>d,[d]),l.useEffect(()=>{const e=a.current;return()=>{window.clearTimeout(e),h(null)}},[a,h]),_.jsx(cs,{asChild:!0,...c,children:_.jsx(Rs,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":r.contentId,"data-state":Ys(i.open),...e,ref:ee(t,r.onTriggerChange),onClick:t=>{var s;null==(s=e.onClick)||s.call(e,t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),i.open||i.onOpenChange(!0))},onPointerMove:oe(e.onPointerMove,Js(t=>{n.onItemEnter(t),t.defaultPrevented||e.disabled||i.open||o.current||(n.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{i.onOpenChange(!0),d()},100))})),onPointerLeave:oe(e.onPointerLeave,Js(e=>{var t,s;d();const r=null==(t=i.content)?void 0:t.getBoundingClientRect();if(r){const t=null==(s=i.content)?void 0:s.dataset.side,o="right"===t,l=o?-5:5,h=r[o?"left":"right"],c=r[o?"right":"left"];n.onPointerGraceIntentChange({area:[{x:e.clientX+l,y:e.clientY},{x:h,y:r.top},{x:c,y:r.top},{x:c,y:r.bottom},{x:h,y:r.bottom}],side:t}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>n.onPointerGraceIntentChange(null),300)}else{if(n.onTriggerLeave(e),e.defaultPrevented)return;n.onPointerGraceIntentChange(null)}})),onKeyDown:oe(e.onKeyDown,t=>{var r;const o=""!==n.searchRef.current;e.disabled||o&&" "===t.key||Xi[s.dir].includes(t.key)&&(i.onOpenChange(!0),null==(r=i.content)||r.focus(),t.preventDefault())})})})});Ks.displayName=Us;var qs="MenuSubContent",Vs=l.forwardRef((e,t)=>{const i=fs(ps,e.__scopeMenu),{forceMount:s=i.forceMount,...r}=e,n=os(ps,e.__scopeMenu),o=ls(ps,e.__scopeMenu),a=$s(qs,e.__scopeMenu),h=l.useRef(null),c=ne(t,h);return _.jsx(Zi.Provider,{scope:e.__scopeMenu,children:_.jsx(se,{present:s||n.open,children:_.jsx(Zi.Slot,{scope:e.__scopeMenu,children:_.jsx(xs,{id:a.contentId,"aria-labelledby":a.triggerId,...r,ref:c,align:"start",side:"rtl"===o.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{var t;o.isUsingKeyboardRef.current&&(null==(t=h.current)||t.focus()),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:oe(e.onFocusOutside,e=>{e.target!==a.trigger&&n.onOpenChange(!1)}),onEscapeKeyDown:oe(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:oe(e.onKeyDown,e=>{var t;const i=e.currentTarget.contains(e.target),s=Gi[o.dir].includes(e.key);i&&s&&(n.onOpenChange(!1),null==(t=a.trigger)||t.focus(),e.preventDefault())})})})})})});function Ys(e){return e?"open":"closed"}function Xs(e){return"indeterminate"===e}function Gs(e){return Xs(e)?"indeterminate":e?"checked":"unchecked"}function Js(e){return t=>"mouse"===t.pointerType?e(t):void 0}Vs.displayName=qs;var Zs=hs,Qs=cs,er=_s,tr=vs,ir=ys,sr=Cs,rr=Ns,nr=Ms,or=Ts,ar=Bs,lr=zs,hr=Ws,cr=Hs,dr=Ks,ur=Vs,fr="ContextMenu",[_r]=ie(fr,[is]),pr=is(),[mr,gr]=_r(fr),vr=e=>{const{__scopeContextMenu:t,children:i,onOpenChange:s,dir:r,modal:n=!0}=e,[o,a]=l.useState(!1),h=pr(t),c=te(s),d=l.useCallback(e=>{a(e),c(e)},[c]);return _.jsx(mr,{scope:t,open:o,onOpenChange:d,modal:n,children:_.jsx(Zs,{...h,dir:r,open:o,onOpenChange:d,modal:n,children:i})})};vr.displayName=fr;var br="ContextMenuTrigger",Sr=l.forwardRef((e,t)=>{const{__scopeContextMenu:i,disabled:s=!1,...r}=e,n=gr(br,i),o=pr(i),a=l.useRef({x:0,y:0}),h=l.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),c=l.useRef(0),d=l.useCallback(()=>window.clearTimeout(c.current),[]),u=e=>{a.current={x:e.clientX,y:e.clientY},n.onOpenChange(!0)};return l.useEffect(()=>d,[d]),l.useEffect(()=>{s&&d()},[s,d]),_.jsxs(_.Fragment,{children:[_.jsx(Qs,{...o,virtualRef:h}),_.jsx(ae.span,{"data-state":n.open?"open":"closed","data-disabled":s?"":void 0,...r,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:s?e.onContextMenu:oe(e.onContextMenu,e=>{d(),u(e),e.preventDefault()}),onPointerDown:s?e.onPointerDown:oe(e.onPointerDown,Er(e=>{d(),c.current=window.setTimeout(()=>u(e),700)})),onPointerMove:s?e.onPointerMove:oe(e.onPointerMove,Er(d)),onPointerCancel:s?e.onPointerCancel:oe(e.onPointerCancel,Er(d)),onPointerUp:s?e.onPointerUp:oe(e.onPointerUp,Er(d))})]})});Sr.displayName=br;var wr=e=>{const{__scopeContextMenu:t,...i}=e,s=pr(t);return _.jsx(er,{...s,...i})};wr.displayName="ContextMenuPortal";var xr="ContextMenuContent",yr=l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=gr(xr,i),n=pr(i),o=l.useRef(!1);return _.jsx(tr,{...n,...s,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:t=>{var i;null==(i=e.onCloseAutoFocus)||i.call(e,t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{var i;null==(i=e.onInteractOutside)||i.call(e,t),t.defaultPrevented||r.modal||(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});yr.displayName=xr;l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(ir,{...r,...s,ref:t})}).displayName="ContextMenuGroup";l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(sr,{...r,...s,ref:t})}).displayName="ContextMenuLabel";var Cr=l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(rr,{...r,...s,ref:t})});Cr.displayName="ContextMenuItem";l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(nr,{...r,...s,ref:t})}).displayName="ContextMenuCheckboxItem";l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(or,{...r,...s,ref:t})}).displayName="ContextMenuRadioGroup";l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(ar,{...r,...s,ref:t})}).displayName="ContextMenuRadioItem";l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(lr,{...r,...s,ref:t})}).displayName="ContextMenuItemIndicator";var kr=l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(hr,{...r,...s,ref:t})});kr.displayName="ContextMenuSeparator";l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(cr,{...r,...s,ref:t})}).displayName="ContextMenuArrow";l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(dr,{...r,...s,ref:t})}).displayName="ContextMenuSubTrigger";function Er(e){return t=>"mouse"!==t.pointerType?e(t):void 0}l.forwardRef((e,t)=>{const{__scopeContextMenu:i,...s}=e,r=pr(i);return _.jsx(ur,{...r,...s,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})}).displayName="ContextMenuSubContent";var Nr=wr,Rr=yr,Mr=Cr,Dr=kr;const Lr=vr,Pr=Sr,Tr=l.forwardRef(({className:e,...t},i)=>_.jsx(Nr,{children:_.jsx(Rr,{ref:i,className:p("z-50 min-w-[10rem] overflow-hidden rounded-md border bg-popover p-1 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",e),...t})}));Tr.displayName=Rr.displayName;const jr=l.forwardRef(({className:e,destructive:t,...i},s)=>_.jsx(Mr,{ref:s,className:p("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"text-red-500 focus:text-red-500 focus:bg-red-500/10",e),...i}));jr.displayName=Mr.displayName;const Br=l.forwardRef(({className:e,...t},i)=>_.jsx(Dr,{ref:i,className:p("-mx-1 my-1 h-px bg-border",e),...t}));function Ar({kind:e,label:t,preview:i,inserted:s,unclicked:r,onLeftClick:n,onEdit:o,onDelete:a,onShare:h,onRefresh:c,footer:d,readOnly:u,noContextMenu:f,cornerHint:m,instructionsFile:v="CLAUDE.md"}){const b=l.useRef(null),S=p("agent-prompt"===e?s?"border-green-500/50 bg-green-500/10 hover:bg-green-500/15":"border-dashed border-border hover:border-border/80 hover:bg-muted-foreground/10 dark:hover:bg-muted-foreground/20":r?"border-blue-500/30 bg-blue-500/15 hover:bg-blue-500/20 dark:bg-blue-500/15 dark:hover:bg-blue-500/25":"border-transparent bg-background dark:bg-muted-foreground/10 hover:bg-muted-foreground/10 dark:hover:bg-muted-foreground/20 hover:border-muted-foreground/30"),w="agent-prompt"===e,x=!f||c?" · 右键更多":"",y="quick-prompt"===e?`点击发送${x}`:(s?`点击从 ${v} 移除`:`点击插入 ${v}`)+x,C=_.jsxs("div",{ref:b,className:p("group relative rounded-md border text-xs transition-colors cursor-pointer select-none",S),onClick:n,title:y,children:[w&&_.jsx("span",{"aria-hidden":!0,className:p("absolute top-1.5 left-1.5 h-2 w-2 rounded-full transition-colors",s?"bg-green-500 ring-1 ring-green-500/40":"border border-muted-foreground/40 bg-transparent")}),_.jsxs("div",{className:p("py-1.5",f&&m?"pr-10":f?"pr-2":"pr-7",w?"pl-5":"pl-3"),children:[_.jsx("div",{className:"font-medium truncate",children:t}),i&&i!==t&&_.jsx("div",{className:"mt-0.5 text-muted-foreground/80 truncate font-mono",children:i}),d]}),f&&m&&_.jsx("span",{"aria-hidden":!0,className:"absolute top-1.5 right-2 text-[10px] leading-none font-mono tabular-nums text-muted-foreground/60 pointer-events-none",children:m}),!f&&_.jsx("button",{onClick:e=>{e.stopPropagation(),e.preventDefault();const t=b.current;if(!t)return;const i=t.getBoundingClientRect(),s=new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:i.right-8,clientY:i.top+i.height/2,button:2});t.dispatchEvent(s)},className:p("absolute top-1 right-1 p-0.5 rounded transition-opacity","md:opacity-0 md:group-hover:opacity-100 md:focus-visible:opacity-100","hover:bg-muted-foreground/10 focus-visible:bg-muted-foreground/10","text-muted-foreground hover:text-foreground"),title:"更多","aria-label":"更多操作",children:_.jsx(di,{className:"h-3.5 w-3.5"})})]});return!(!c&&(f||!o&&!a&&!h))?_.jsxs(Lr,{children:[_.jsx(Pr,{asChild:!0,children:C}),_.jsxs(Tr,{children:[c&&_.jsxs(jr,{onSelect:c,children:[_.jsx(L,{className:"h-3.5 w-3.5"}),"更新"]}),!f&&!u&&o&&a&&_.jsxs(_.Fragment,{children:[c&&_.jsx(Br,{}),_.jsxs(jr,{onSelect:o,children:[_.jsx(g,{className:"h-3.5 w-3.5"}),"编辑"]}),_.jsxs(jr,{destructive:!0,onSelect:a,children:[_.jsx(D,{className:"h-3.5 w-3.5"}),"删除"]}),h&&_.jsx(Br,{})]}),!f&&h&&_.jsxs(jr,{onSelect:h,children:[_.jsx(_e,{className:"h-3.5 w-3.5"}),"共享到 ccweb-hub"]})]})]}):_.jsx("div",{onContextMenu:e=>e.preventDefault(),children:C})}function Or({open:e,onOpenChange:t,initialLabel:i,initialCommand:s,title:r,onSave:n}){const[o,a]=l.useState(i),[h,c]=l.useState(s),[d,u]=l.useState(!0);l.useEffect(()=>{e&&u(!0)},[e]),l.useEffect(()=>{e&&(a(i),c(s))},[e,i,s]);const f=()=>{const e=h.trim();e&&(n(o.trim()||e,e),t(!1))};return _.jsx(xe,{open:e,onOpenChange:t,modal:!1,children:_.jsxs(ye,{noOverlay:!0,className:p("sm:max-w-2xl max-h-[85vh] flex flex-col transition-opacity",!d&&"opacity-50"),onInteractOutside:e=>{e.preventDefault(),u(!1)},onClick:()=>u(!0),children:[_.jsxs(Ce,{children:[_.jsx(ke,{children:r}),_.jsx(Ee,{children:"左键点击卡片会把此命令发送到 CLI。"})]}),_.jsxs("div",{className:"space-y-4 flex-1 min-h-0 flex flex-col",children:[_.jsxs("div",{className:"space-y-2",children:[_.jsx(Ne,{htmlFor:"qp-label",children:"标签"}),_.jsx(U,{id:"qp-label",placeholder:"显示名(可选,默认用命令文本)",value:o,onChange:e=>a(e.target.value),className:"text-base",autoFocus:!0})]}),_.jsxs("div",{className:"space-y-2 flex-1 flex flex-col min-h-0",children:[_.jsx(Ne,{htmlFor:"qp-command",children:"命令"}),_.jsx("textarea",{id:"qp-command",placeholder:"输入要发送的命令...",value:h,onChange:e=>c(e.target.value),className:p("flex-1 min-h-[200px] w-full rounded-md border border-input bg-background px-4 py-3","text-base leading-relaxed font-mono","ring-offset-background placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","resize-none"),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())}})]})]}),_.jsxs(Re,{className:"flex items-center justify-between sm:justify-between",children:[_.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ 保存"}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx(H,{variant:"outline",onClick:()=>t(!1),children:"取消"}),_.jsx(H,{onClick:f,disabled:!h.trim(),children:"保存"})]})]})]})})}function Ir({title:e,count:t,onAdd:i,children:s}){return _.jsxs("div",{className:"px-2 py-2",children:[_.jsxs("div",{className:"flex items-center justify-between mb-1.5 px-1",children:[_.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:[_.jsx("span",{children:e}),_.jsxs("span",{className:"text-muted-foreground/60 normal-case tracking-normal",children:["(",t,")"]})]}),_.jsx("button",{onClick:i,className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted-foreground/10 transition-colors",title:"新建","aria-label":"新建",children:_.jsx($,{className:"h-3 w-3"})})]}),s]})}function zr({projectId:e,onSend:t}){const i=a(),[s,r]=l.useState([]),[n,o]=l.useState([]),h=N(),c=h.get(e),[d,u]=l.useState({open:!1}),[f,p]=l.useState(c.shareHubOpen),[m,g]=l.useState(c.shareHubLabel),[v,b]=l.useState(c.shareHubCommand),S=l.useCallback(t=>{r(e=>{const i=e.findIndex(e=>e.id===t);if(i<0||e[i].used)return e;const s=[...e];return s[i]={...s[i],used:!0},s}),pe(e,t,!0).catch(e=>{console.error("Failed to mark shortcut used:",e)})},[e]);l.useEffect(()=>{me(e).then(r).catch(()=>r([]))},[e]),l.useEffect(()=>{ge().then(o).catch(()=>o([]))},[]);const w=l.useCallback(e=>{const t=[],i=new Set;let s=e;const r=[];for(;s&&!i.has(s.id);)i.add(s.id),r.unshift(s),s=s.parentId?n.find(e=>e.id===s.parentId):void 0;for(const n of r)t.push(n.command);return t},[n]),x=l.useCallback(e=>{w(e).forEach((e,i)=>{setTimeout(()=>t(e+"\r"),500*i)})},[w,t]),y=e=>u({open:!0,mode:"create",scope:e}),C=(t,i)=>{g(t),b(i),p(!0),h.setShareHub(e,!0,t,i)};return _.jsxs("div",{className:"h-full flex flex-col text-foreground overflow-hidden",children:[_.jsxs("div",{className:"px-3 pt-2.5 pb-2 border-b border-border/50 shrink-0",children:[_.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Quick Prompts"}),_.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground/70 leading-snug",children:"点击卡片发送命令到 CLI;新建的命令在首次点击前以浅蓝色标识"})]}),_.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[_.jsx(Ir,{title:"项目",count:s.length,onAdd:()=>y("project"),children:0===s.length?_.jsx("div",{className:"px-1 py-3 text-xs text-muted-foreground/60",children:"暂无项目命令"}):_.jsx("div",{className:"space-y-1.5",children:s.map(s=>_.jsx(Ar,{kind:"quick-prompt",label:s.label,preview:s.label!==s.command?s.command:"",unclicked:!s.used,onLeftClick:()=>(e=>{t(e.command+"\r"),S(e.id)})(s),onEdit:()=>(e=>u({open:!0,mode:"edit",scope:"project",id:e.id,label:e.label,command:e.command}))(s),onDelete:()=>{(async t=>{if(await i({title:"删除项目快捷 Prompt",description:`确认删除「${t.label}」?此操作不可撤销。`,destructive:!0,confirmLabel:"删除"}))try{await Se(e,t.id),r(e=>e.filter(e=>e.id!==t.id))}catch(s){console.error("Failed to delete shortcut:",s)}})(s)},onShare:()=>C(s.label,s.command)},s.id))})}),_.jsx("div",{className:"h-px bg-border mx-2"}),_.jsx(Ir,{title:"全局",count:n.length,onAdd:()=>y("global"),children:0===n.length?_.jsx("div",{className:"px-1 py-3 text-xs text-muted-foreground/60",children:"暂无全局命令"}):_.jsx("div",{className:"space-y-1.5",children:n.map(e=>{var t;const s=e.parentId?null==(t=n.find(t=>t.id===e.parentId))?void 0:t.label:void 0;return _.jsx(Ar,{kind:"quick-prompt",label:e.label,preview:s?"":e.label!==e.command?e.command:"",onLeftClick:()=>x(e),onEdit:()=>(e=>u({open:!0,mode:"edit",scope:"global",id:e.id,label:e.label,command:e.command}))(e),onDelete:()=>{(async e=>{const t=n.filter(t=>t.parentId===e.id);if(await i({title:"删除全局快捷 Prompt",description:t.length>0?`「${e.label}」被 ${t.length} 个其他全局命令继承。删除后这些命令的继承会断链。确认删除?`:`确认删除「${e.label}」?此操作不可撤销。`,destructive:!0,confirmLabel:"删除"}))try{await we(e.id),o(t=>t.filter(t=>t.id!==e.id))}catch(s){console.error("Failed to delete global shortcut:",s)}})(e)},onShare:()=>C(e.label,e.command),footer:s?_.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[_.jsx(ve,{className:"h-2.5 w-2.5 text-muted-foreground"}),_.jsxs("span",{className:"text-muted-foreground truncate",children:["继承: ",s,"(继承链仅可在 Dashboard 编辑)"]})]}):null},e.id)})})})]}),_.jsx(Or,{open:d.open,onOpenChange:e=>{e||u({open:!1})},initialLabel:d.open&&"edit"===d.mode?d.label:"",initialCommand:d.open&&"edit"===d.mode?d.command:"",title:d.open?"create"===d.mode?`新建${"global"===d.scope?"全局":"项目"}命令`:"编辑命令":"",onSave:(t,i)=>{(async(t,i)=>{if(d.open)try{if("create"===d.mode)if("global"===d.scope){const e=await Me({label:t,command:i});o(t=>[...t,e])}else{const s=await De(e,{label:t,command:i});r(e=>[...e,s])}else if("global"===d.scope){const e=n.find(e=>e.id===d.id),s=await Le(d.id,{label:t,command:i,parentId:(null==e?void 0:e.parentId)??null});o(e=>e.map(e=>e.id===s.id?s:e))}else{const s=await Pe(e,d.id,{label:t,command:i});r(e=>e.map(e=>e.id===s.id?s:e))}}catch(s){console.error("Failed to save shortcut:",s)}})(t,i)}}),_.jsx(be,{open:f,onOpenChange:t=>{p(t),t||h.setShareHub(e,!1)},kind:"quick-prompt",label:m,content:v})]})}Br.displayName=Dr.displayName;function Wr({open:e,onOpenChange:t,title:i,initialLabel:s,initialCommand:r,onSave:n,instructionsFile:o="CLAUDE.md"}){const[a,h]=l.useState(s),[c,d]=l.useState(r),[u,f]=l.useState(!0);l.useEffect(()=>{e&&(h(s),d(r),f(!0))},[e,s,r]);const m=a.trim(),g=c.trim(),v=m.length>100,b=g.length>8e3,S=g.length>0&&m.length>0&&!v&&!b,w=()=>{S&&(n(m,c),t(!1))};return _.jsx(xe,{open:e,onOpenChange:t,modal:!1,children:_.jsxs(ye,{noOverlay:!0,className:p("sm:max-w-2xl max-h-[85vh] flex flex-col transition-opacity",!u&&"opacity-50"),onInteractOutside:e=>{e.preventDefault(),f(!1)},onClick:()=>f(!0),children:[_.jsxs(Ce,{children:[_.jsx(ke,{children:i}),_.jsxs(Ee,{children:["This prompt can be clicked once in the sidebar to insert into ",o,", and clicked again to remove (by exact text match)."]})]}),_.jsxs("div",{className:"space-y-4 flex-1 min-h-0 flex flex-col",children:[_.jsxs("div",{className:"space-y-2",children:[_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsx(Ne,{htmlFor:"prompt-label",children:"Label"}),_.jsxs("span",{className:p("text-xs text-muted-foreground",v&&"text-red-500"),children:[m.length," / ",100]})]}),_.jsx(U,{id:"prompt-label",placeholder:"A short name for this prompt",value:a,onChange:e=>h(e.target.value),className:"text-base",autoFocus:!0})]}),_.jsxs("div",{className:"space-y-2 flex-1 flex flex-col min-h-0",children:[_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsx(Ne,{htmlFor:"prompt-command",children:"Prompt"}),_.jsxs("span",{className:p("text-xs text-muted-foreground",b&&"text-red-500"),children:[g.length," / ",8e3]})]}),_.jsx("textarea",{id:"prompt-command",placeholder:`The exact text that will be appended to ${o}...`,value:c,onChange:e=>d(e.target.value),className:p("flex-1 min-h-[200px] w-full rounded-md border border-input bg-background px-4 py-3","text-sm leading-relaxed font-mono","ring-offset-background placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","resize-none"),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),w())}})]})]}),_.jsxs(Re,{className:"flex items-center justify-between sm:justify-between",children:[_.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ to save"}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx(H,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),_.jsx(H,{onClick:w,disabled:!S,children:"Save"})]})]})]})})}function Hr({projectId:e}){const t=a(),[i,s]=l.useState([]),[r,n]=l.useState([]),[o,h]=l.useState("CLAUDE.md"),[c,d]=l.useState(!0),[u,p]=l.useState({open:!1}),[m,g]=l.useState({open:!1,label:"",content:""}),v=l.useCallback(async()=>{try{const t=await Te(e);s(t.global),n(t.project),t.instructionsFilename&&h(t.instructionsFilename)}catch(t){f.error(`加载提示词失败: ${t.message}`)}finally{d(!1)}},[e]);l.useEffect(()=>{d(!0),v()},[v]);const b=l.useRef(new Set),S=l.useCallback(async(t,i)=>{if(b.current.has(i.id))return;b.current.add(i.id);const r=i.inserted?"remove":"insert",a=e=>e.map(e=>e.id===i.id?{...e,inserted:!e.inserted}:e);"global"===t?s(a):n(a);try{const t=await je(e,i.command,r);if("remove"===r&&!1===t.changed)return"not-found"===t.reason?f.error(`${o} 中找不到该提示词的精确文本,请自行编辑 ${o} 移除。`):f.warning(`该提示词当前不在 ${o} 中(可能被手动编辑过),已重新同步状态。`),void v();v()}catch(l){f.error(`操作失败: ${l.message}`),"global"===t?s(a):n(a)}finally{b.current.delete(i.id)}},[e,v,o]),w=l.useCallback(async(t,i,s,r,n)=>{try{if("create"===t)"global"===i?await Be({label:r,command:n}):await Ae(e,{label:r,command:n}),f.success("已添加");else{if(!s)return;"global"===i?await Oe(s,{label:r,command:n}):await Ie(e,s,{label:r,command:n}),f.success("已更新")}v()}catch(o){f.error(`保存失败: ${o.message}`)}},[e,v]),x=l.useCallback(async(i,s)=>{const r=s.inserted?`此提示词目前已插入当前项目的 ${o}。\n\n删除后它会在 ${o} 中成为"孤儿文本"——仅删除提示词记录,不会自动从 ${o} 移除。\n\n确认删除?`:"确认删除此提示词?此操作不可撤销。";if(await t({title:"删除提示词",description:r,destructive:!0,confirmLabel:"删除"}))try{"global"===i?await ze(s.id):await We(e,s.id),f.success("已删除"),v()}catch(n){f.error(`删除失败: ${n.message}`)}},[e,v,t,o]),y=l.useCallback(e=>{g({open:!0,label:e.label,content:e.command})},[]);return _.jsxs("div",{className:"flex flex-col h-full overflow-y-auto",children:[_.jsxs("div",{className:"px-3 pt-2.5 pb-2 border-b border-border/50 shrink-0",children:[_.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Agent Prompts"}),_.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground/70 leading-snug",children:["点击卡片插入 / 移出当前项目的 ",o,";左上角绿点表示已插入"]})]}),_.jsx(Fr,{title:"项目",count:r.length,loading:c,prompts:r,emptyText:"暂无项目提示词",instructionsFile:o,onAdd:()=>p({open:!0,mode:"create",scope:"project"}),onToggle:e=>{S("project",e)},onEdit:e=>p({open:!0,mode:"edit",scope:"project",id:e.id,label:e.label,command:e.command}),onDelete:e=>{x("project",e)},onShare:y}),_.jsx("div",{className:"h-px bg-border mx-2"}),_.jsx(Fr,{title:"全局",count:i.length,loading:c,prompts:i,emptyText:"暂无全局提示词",instructionsFile:o,onAdd:()=>p({open:!0,mode:"create",scope:"global"}),onToggle:e=>{S("global",e)},onEdit:e=>p({open:!0,mode:"edit",scope:"global",id:e.id,label:e.label,command:e.command}),onDelete:e=>{x("global",e)},onShare:y}),_.jsx(Wr,{open:u.open,onOpenChange:e=>{e||p({open:!1})},title:!1===u.open?"":"create"===u.mode?`新建${"global"===u.scope?"全局":"项目"}提示词`:`编辑${"global"===u.scope?"全局":"项目"}提示词`,initialLabel:u.open&&"edit"===u.mode?u.label:"",initialCommand:u.open&&"edit"===u.mode?u.command:"",instructionsFile:o,onSave:(e,t)=>{if(!u.open)return;const i="edit"===u.mode?u.id:null;w(u.mode,u.scope,i,e,t)}}),_.jsx(be,{open:m.open,onOpenChange:e=>g(t=>({...t,open:e})),kind:"agent-prompt",label:m.label,content:m.content})]})}function Fr({title:e,count:t,loading:i,prompts:s,emptyText:r,onAdd:n,onToggle:o,onEdit:a,onDelete:l,onShare:h,instructionsFile:c}){return _.jsxs("div",{className:"px-2 py-2",children:[_.jsxs("div",{className:"flex items-center justify-between mb-1.5 px-1",children:[_.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:[_.jsx("span",{children:e}),_.jsxs("span",{className:"text-muted-foreground/60 normal-case tracking-normal",children:["(",t,")"]})]}),_.jsx("button",{onClick:n,className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted-foreground/10 transition-colors",title:"新建","aria-label":"新建",children:_.jsx($,{className:"h-3 w-3"})})]}),i?_.jsx("div",{className:"px-1 py-3 text-xs text-muted-foreground/60",children:"加载中…"}):0===s.length?_.jsx("div",{className:"px-1 py-3 text-xs text-muted-foreground/60",children:r}):_.jsx("div",{className:"space-y-1.5",children:s.map(e=>{const t=e.command.split("\n").find(e=>e.trim())??e.command.trim();return _.jsx(Ar,{kind:"agent-prompt",label:e.label,preview:t,inserted:e.inserted,instructionsFile:c,onLeftClick:()=>o(e),onEdit:()=>a(e),onDelete:()=>l(e),onShare:()=>h(e)},e.id)})})]})}function $r({projectId:e}){const[t,i]=l.useState([]),[s,r]=l.useState(null),[n,o]=l.useState("CLAUDE.md"),[a,h]=l.useState(!0),[c,d]=l.useState(!1),u=l.useRef(new Set),m=l.useCallback(async()=>{h(!0);try{const t=await He(e);i(t.items),r(t.claudeMdLineCount),t.instructionsFilename&&o(t.instructionsFilename)}catch(t){f.error(`加载失败: ${t.message}`)}finally{h(!1)}},[e]);l.useEffect(()=>{m()},[m]);const g=l.useCallback(async t=>{if(u.current.has(t.filename))return;u.current.add(t.filename),i(e=>e.map(e=>e.filename===t.filename?{...e,inserted:!e.inserted}:e));const s=t.inserted?"remove":"insert";try{const n=await Fe(e,t.filename,s);if(!n.ok)return f.error("操作失败"+(n.reason?`(${n.reason})`:"")),void m();i(e=>e.map(e=>e.filename===t.filename?{...e,inserted:n.inserted}:e)),"number"==typeof n.claudeMdLineCount&&r(n.claudeMdLineCount),"insert"===s&&"refreshed"===n.reason&&f.info(`${t.name} 已更新(文件内容有变化)`)}catch(n){f.error(`操作失败: ${n.message}`),i(e=>e.map(e=>e.filename===t.filename?{...e,inserted:t.inserted}:e))}finally{u.current.delete(t.filename)}},[e,m]),v=l.useCallback(async()=>{if(c)return;const s=t.filter(e=>e.inserted);if(0===s.length)return void f.info("没有已插入的 memory 卡片");d(!0);let n=0,o=0;for(const t of s)if(u.current.has(t.filename))o++;else{u.current.add(t.filename);try{const s=await Fe(e,t.filename,"insert");s.ok?(i(e=>e.map(e=>e.filename===t.filename?{...e,inserted:s.inserted}:e)),"number"==typeof s.claudeMdLineCount&&r(s.claudeMdLineCount),n++):o++}catch{o++}finally{u.current.delete(t.filename)}}d(!1),0===o?f.success(`已从磁盘更新 ${n} 个 memory 卡片`):f.error(`${n} 个更新成功,${o} 个失败`)},[e,t,c]),b=l.useCallback(async t=>{if(!u.current.has(t.filename))if(t.inserted){u.current.add(t.filename);try{const s=await Fe(e,t.filename,"insert");if(!s.ok)return f.error("更新失败"+(s.reason?`(${s.reason})`:"")),void m();i(e=>e.map(e=>e.filename===t.filename?{...e,inserted:s.inserted}:e)),"number"==typeof s.claudeMdLineCount&&r(s.claudeMdLineCount),f.success(`${t.name} 已从磁盘重新加载`)}catch(s){f.error(`更新失败: ${s.message}`)}finally{u.current.delete(t.filename)}}else f.info("卡片未插入,无需更新")},[e,m]);return _.jsxs("div",{className:"flex flex-col h-full overflow-y-auto",children:[_.jsxs("div",{className:"px-3 pt-2.5 pb-2 border-b border-border/50 shrink-0",children:[_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Memory Prompts"}),_.jsxs("div",{className:"flex items-center gap-0.5",children:[_.jsx("button",{onClick:()=>{v()},disabled:c||!t.some(e=>e.inserted),className:p("p-0.5 rounded text-muted-foreground transition-colors","hover:text-foreground hover:bg-muted-foreground/10","disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-muted-foreground"),title:`把所有已插入卡片的内容从磁盘重新加载到 ${n}`,children:_.jsx(li,{className:p("h-3.5 w-3.5",c&&"animate-spin")})}),_.jsx("button",{onClick:()=>{m()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted-foreground/10 transition-colors",title:"刷新(重新扫描 .ccweb/memory/)",children:_.jsx(L,{className:p("h-3.5 w-3.5",a&&"animate-spin")})})]})]}),_.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground/70 leading-snug",children:["来自 ",_.jsx("code",{className:"text-[11px]",children:".ccweb/memory/*.md"})," 的文件,点击插入 / 移除 ",n,"(以",_.jsx("code",{className:"text-[11px]",children:" START 名 / END 名 "}),"包裹)"]}),null!==s&&_.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground/60 font-mono tabular-nums",children:[n,": ",s," 行"]})]}),_.jsx("div",{className:"px-2 py-2 flex-1 min-h-0",children:a&&0===t.length?_.jsx("div",{className:"px-1 py-6 text-xs text-muted-foreground/60 text-center",children:"加载中…"}):0===t.length?_.jsxs("div",{className:"px-1 py-8 text-xs text-muted-foreground/60 flex flex-col items-center gap-2",children:[_.jsx(ni,{className:"h-5 w-5"}),_.jsxs("div",{className:"text-center leading-relaxed",children:["暂无 memory 文件",_.jsx("br",{}),"新建 ",_.jsx("code",{className:"text-[11px]",children:".ccweb/memory/*.md"})," 文件后点刷新"]})]}):_.jsx("div",{className:"space-y-1.5",children:t.map(e=>_.jsx(Ar,{kind:"agent-prompt",noContextMenu:!0,label:e.name,preview:e.preview,inserted:e.inserted,instructionsFile:n,cornerHint:`${e.lineCount} 行`,onLeftClick:()=>{g(e)},onRefresh:e.inserted?()=>{b(e)}:void 0},e.filename))})})]})}function Ur({projectId:e,onSend:t}){const[i,s]=Q(y.rightPanelTab,"shortcuts"),r="prompts"===i?"prompts":"memory"===i?"memory":"shortcuts";return _.jsxs(Bt,{value:r,onValueChange:e=>s(e),orientation:"vertical",className:"h-full flex bg-muted text-foreground overflow-hidden",children:[_.jsxs("div",{className:"flex-1 min-w-0 flex flex-col border-r border-border",children:[_.jsx(It,{value:"shortcuts",className:"flex-1 min-h-0 mt-0 data-[state=inactive]:hidden",children:_.jsx(zr,{projectId:e,onSend:t})}),_.jsx(It,{value:"prompts",className:"flex-1 min-h-0 mt-0 data-[state=inactive]:hidden",children:_.jsx(Hr,{projectId:e})}),_.jsx(It,{value:"memory",className:"flex-1 min-h-0 mt-0 data-[state=inactive]:hidden",children:_.jsx($r,{projectId:e})})]}),_.jsxs(At,{className:p("flex flex-col items-center justify-start shrink-0","h-full w-9 border-l border-border rounded-none p-1 gap-1"),children:[_.jsx(Ot,{value:"shortcuts",title:"Quick Prompts (快捷 Prompts)","aria-label":"Quick Prompts",className:p("h-7 w-7 p-0 rounded-md flex items-center justify-center"),children:_.jsx($e,{className:"h-3.5 w-3.5"})}),_.jsx(Ot,{value:"prompts",title:"Agent Prompts","aria-label":"Agent Prompts",className:p("h-7 w-7 p-0 rounded-md flex items-center justify-center"),children:_.jsx(Ue,{className:"h-3.5 w-3.5"})}),_.jsx(Ot,{value:"memory",title:"Memory Prompts (.ccweb/memory/*.md)","aria-label":"Memory Prompts",className:p("h-7 w-7 p-0 rounded-md flex items-center justify-center"),children:_.jsx(ni,{className:"h-3.5 w-3.5"})})]})]})}var Kr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const i=Ke(`Primitive.${t}`),s=l.forwardRef((e,s)=>{const{asChild:r,...n}=e,o=r?i:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),_.jsx(o,{...n,ref:s})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),qr="horizontal",Vr=["horizontal","vertical"],Yr=l.forwardRef((e,t)=>{const{decorative:i,orientation:s=qr,...r}=e,n=function(e){return Vr.includes(e)}(s)?s:qr,o=i?{role:"none"}:{"aria-orientation":"vertical"===n?n:void 0,role:"separator"};return _.jsx(Kr.div,{"data-orientation":n,...o,...r,ref:t})});Yr.displayName="Separator";var Xr=Yr;const Gr=l.forwardRef(({className:e,orientation:t="horizontal",decorative:i=!0,...s},r)=>_.jsx(Xr,{ref:r,decorative:i,orientation:t,className:p("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...s}));function Jr({status:e}){return _.jsxs("span",{className:p("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",{running:"bg-green-500/10 text-green-600 border-green-500/20",stopped:"bg-muted text-muted-foreground border-border",restarting:"bg-yellow-500/10 text-yellow-600 border-yellow-500/20"}[e]),children:[_.jsx("span",{className:p("w-1.5 h-1.5 rounded-full",{"bg-green-500":"running"===e,"bg-muted-foreground":"stopped"===e,"bg-yellow-400 animate-pulse":"restarting"===e})}),e.charAt(0).toUpperCase()+e.slice(1)]})}function Zr({project:e,projectId:t,showFileTree:i,showShortcuts:s,showChatOverlay:r,onToggleFileTree:n,onToggleShortcuts:o,onToggleChatOverlay:a,onProjectUpdate:h}){const{t:c}=Xt(),d=qe(),[u,m]=l.useState(!1),[g,w]=l.useState(!1),[x,y]=l.useState(0),[C,k]=l.useState(!1),[E,N]=l.useState(!1);Ve({onStart:e=>{e.projectId===t&&y(0)},onProgress:e=>{e.projectId===t&&y(e.filesTransferred)},onDone:e=>{e.projectId===t&&y(0)}}),l.useEffect(()=>{const e=()=>N(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]);return _.jsx("header",{className:"border-b border-border flex-shrink-0 bg-muted/50",children:_.jsxs("div",{className:"px-3 h-12 flex items-center gap-2",children:[_.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>d("/"),children:_.jsx(Ye,{className:"h-4 w-4"})}),_.jsx(Gr,{orientation:"vertical",className:"h-5 mx-0.5"}),_.jsx(H,{variant:"ghost",size:"icon",className:p("h-7 w-7",i&&"bg-accent"),onClick:n,title:c("project_header.toggle_file_tree"),children:_.jsx(fi,{className:"h-4 w-4"})}),_.jsx(H,{variant:"ghost",size:"icon",className:p("h-7 w-7",s&&"bg-accent"),onClick:o,title:c("project_header.toggle_right_panel"),children:_.jsx(_i,{className:"h-4 w-4"})}),"terminal"!==e.cliTool&&_.jsx(H,{variant:"ghost",size:"icon",className:p("h-7 w-7",r&&"bg-accent"),onClick:a,title:c("project_header.toggle_chat_overlay"),children:_.jsx(hi,{className:"h-4 w-4"})}),_.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2 ml-2",children:[_.jsx("h1",{className:"font-semibold text-foreground truncate text-sm",children:e.name}),_.jsx(Jr,{status:e.status}),_.jsx(Xe,{variant:"outline",className:"text-xs",children:"unlimited"===e.permissionMode?"Unlimited":"Limited"}),_.jsx("span",{className:"text-xs text-muted-foreground font-mono truncate hidden lg:block",children:e.folderPath})]}),_.jsx(Ge,{}),_.jsx(Je,{}),_.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()},title:c(E?"project_header.fullscreen_exit":"project_header.fullscreen_enter"),children:E?_.jsx(v,{className:"h-3.5 w-3.5"}):_.jsx(b,{className:"h-3.5 w-3.5"})}),_.jsx(Gr,{orientation:"vertical",className:"h-5 mx-0.5"}),g?_.jsxs(H,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>{(async()=>{if(g&&!C){k(!0);try{(await et(t)).cancelled?f.info(c("project_header.sync_cancelled")):f.error(c("project_header.sync_cancel_failed"))}catch(e){f.error(e instanceof Error?e.message:c("project_header.sync_cancel_failed")),k(!1)}}})()},disabled:C,title:c("project_header.sync_cancel_title"),children:[C?_.jsx(Ze,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):_.jsx(S,{className:"h-3.5 w-3.5 mr-1.5"}),_.jsx("span",{className:"tabular-nums",children:x>0?c("project_header.sync_progress_label",{files:x}):c("project_header.sync_progress_label_empty")})]}):_.jsxs(H,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>{(async()=>{if(!g){w(!0),y(0);try{const e=await tt(t);e.skipped?f.info(c("project_header.sync_skipped")):e.ok?f.success(c("project_header.sync_success",{files:e.filesTransferred,seconds:Math.round(e.durationMs/1e3)})):"cancelled"===e.reason||f.error(e.reason?c("project_header.sync_failed_with_reason",{reason:e.reason}):c("project_header.sync_failed"))}catch(e){f.error(e instanceof Error?e.message:c("project_header.sync_failed"))}finally{w(!1),y(0),k(!1)}}})()},title:c("project_header.sync_button_title"),children:[_.jsx(Qe,{className:"h-3.5 w-3.5 mr-1.5"}),c("project_header.sync")]}),"stopped"===e.status&&_.jsxs(H,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>{(async()=>{m(!0);try{h(await it(e.id))}catch(t){console.error(t)}finally{m(!1)}})()},disabled:u,children:[_.jsx(pi,{className:"h-3.5 w-3.5 mr-1.5"}),"Start"]})]})})}
15
15
  /**
16
16
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
17
17
  * @license MIT
@@ -1,4 +1,4 @@
1
- import{c as e,r as s,$ as t,b2 as n,j as a,a1 as r,a0 as l,W as o,d as i,U as c,b3 as d,aR as u,Z as h,b4 as m,V as p,a2 as x,a4 as f,a5 as g,a6 as v,a7 as j,x as b,aF as y,b5 as w,t as N,al as k,I as S,B as C,aK as _,X as R,D as P,b6 as E,b7 as I,b8 as T,b9 as M,u as D,ba as A,T as H,bb as O,bc as L,bd as V,be as F,bf as B,aE as z,bg as W,bh as $,h as K,S as U,bi as q,aG as G,K as Z,s as X,bj as Q}from"./index-BOod62M1.js";import{k as Y,u as J,R as ee,d as se,f as te,A as ne,C as ae,j as re,h as le,S as oe,U as ie,i as ce,T as de,a as ue,b as he,c as me}from"./index-C3br4lV-.js";import{C as pe}from"./chevron-down-9vAKETIc.js";import{C as xe,a as fe}from"./chevron-up-DetzMyPo.js";
1
+ import{c as e,r as s,$ as t,b2 as n,j as a,a1 as r,a0 as l,W as o,d as i,U as c,b3 as d,aR as u,Z as h,b4 as m,V as p,a2 as x,a4 as f,a5 as g,a6 as v,a7 as j,x as b,aF as y,b5 as w,t as N,al as k,I as S,B as C,aK as _,X as R,D as P,b6 as E,b7 as I,b8 as T,b9 as M,u as D,ba as A,T as H,bb as O,bc as L,bd as V,be as F,bf as B,aE as z,bg as W,bh as $,h as K,S as U,bi as q,aG as G,K as Z,s as X,bj as Q}from"./index-DIXpAmRD.js";import{k as Y,u as J,R as ee,d as se,f as te,A as ne,C as ae,j as re,h as le,S as oe,U as ie,i as ce,T as de,a as ue,b as he,c as me}from"./index-BprQxUQs.js";import{C as pe}from"./chevron-down-DDsKpWGy.js";import{C as xe,a as fe}from"./chevron-up-DBW0g8sF.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- import{c as e,aE as s,r as t,bm as a,bn as r,t as n,bo as l,bp as i,bq as c,ab as d,br as o,j as m,B as x,aG as u,d as p,I as h,T as g,p as f,D as b,aB as j,aC as N,A as y,an as v,at as k}from"./index-BOod62M1.js";import{S as w}from"./search-CewI57f1.js";import{C}from"./chevron-down-9vAKETIc.js";
1
+ import{c as e,aE as s,r as t,bm as a,bn as r,t as n,bo as l,bp as i,bq as c,ab as d,br as o,j as m,B as x,aG as u,d as p,I as h,T as g,p as f,D as b,aB as j,aC as N,A as y,an as v,at as k}from"./index-DIXpAmRD.js";import{S as w}from"./search-B5sN2qrh.js";import{C}from"./chevron-down-DDsKpWGy.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-BOod62M1.js";
1
+ import{c as o}from"./index-DIXpAmRD.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-BOod62M1.js";
1
+ import{c as e}from"./index-DIXpAmRD.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *