@kabmo-labs/kabmo 0.46.0 → 0.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/static/js/{CsvGrid-br4j001k.js → CsvGrid-qdkmv8bj.js} +1 -1
- package/dist/client/static/js/{DocxView-kmtkbmmw.js → DocxView-k84ns803.js} +1 -1
- package/dist/client/static/js/{DrawioView-3df0g3jr.js → DrawioView-r1n717f7.js} +1 -1
- package/dist/client/static/js/{ImageView-2r8p5z3y.js → ImageView-jkrdrq8v.js} +1 -1
- package/dist/client/static/js/{LayoutWrapper-rq3d2a4e.js → LayoutWrapper-sh634350.js} +2 -2
- package/dist/client/static/js/{Modal-tmxhxd6q.js → Modal-xe6h99jn.js} +1 -1
- package/dist/client/static/js/{PdfView-p5z7c7eg.js → PdfView-ffg4mccg.js} +1 -1
- package/dist/client/static/js/{SessionsView-t06h6zfx.js → SessionsView-cdcbsee9.js} +1 -1
- package/dist/client/static/js/{SheetView-agw459v2.js → SheetView-89sscpz6.js} +1 -1
- package/dist/client/static/js/{SvgPreview-b9rfy1h6.js → SvgPreview-68c0ccbv.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-wbnhzcnj.js → abnfDiagram-O67JEVCF-h3a5s259.js} +1 -1
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-t2sgevea.js → architectureDiagram-NJMV4G6O-983p0jgn.js} +1 -1
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-v2nzp54a.js → blockDiagram-BEXU5L5S-16pse5mh.js} +1 -1
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-7h03146b.js → c4Diagram-YGBWAQC7-mvnb00zt.js} +1 -1
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-m57e9kp1.js → classDiagram-v2-NBCMYWYE-kmpd91xb.js} +1 -1
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-c4tnh4mg.js → cose-bilkent-JH36ORCC-3ek5r5se.js} +1 -1
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-mjf6njey.js → cynefinDiagram-VND7K2PF-jkbh84zn.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-6yma9ch3.js → dagre-6A5THRUB-4fdc0sgn.js} +1 -1
- package/dist/client/static/js/{diagram-22UHCM2B-1q4ce2gb.js → diagram-22UHCM2B-hbk61nq9.js} +1 -1
- package/dist/client/static/js/{diagram-3UASUU5V-0ttps29p.js → diagram-3UASUU5V-hfpbr9qh.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-1mzexgv1.js → diagram-ATOU4E4O-fn0nt71a.js} +1 -1
- package/dist/client/static/js/{diagram-CDSNMT55-4ae89t23.js → diagram-CDSNMT55-ssswxjeb.js} +1 -1
- package/dist/client/static/js/{diagram-MLGK6HIB-057jaqvh.js → diagram-MLGK6HIB-whnzxv6f.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-p6yyq5sx.js → diagram-MPIPVDR6-hk1chzxk.js} +1 -1
- package/dist/client/static/js/{dockerfile-00hqsk9c.js → dockerfile-zmsj8r4g.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-bsk7dvm4.js → ebnfDiagram-ZINNZB2B-q1vkg5mr.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-dsq91er5.js → elk-276RUBZZ-kt98vg8j.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-p7p13mbh.js → erDiagram-OPXOYQCR-ey3avsn9.js} +1 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-7gvtpn3d.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-bwgnttyk.js → ganttDiagram-FUAMR5RP-a9k1at43.js} +1 -1
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-ca0gj5am.js → gitGraphDiagram-X574FWY7-gnekjfym.js} +1 -1
- package/dist/client/static/js/{index-jkay7aw7.js → index-1ax52p0q.js} +1 -1
- package/dist/client/static/js/{index-064vdkrs.js → index-2a6qp9y6.js} +1 -1
- package/dist/client/static/js/{index-j718pxb3.js → index-3x7h2eqj.js} +1 -1
- package/dist/client/static/js/{index-amys498v.js → index-4cag7w6k.js} +131 -131
- package/dist/client/static/js/{index-ta6gpcpw.js → index-5ka2tyf9.js} +2 -2
- package/dist/client/static/js/{index-x1fqhhpp.js → index-60v30k5h.js} +2 -2
- package/dist/client/static/js/{index-5gf52a6d.js → index-65afr75v.js} +1 -1
- package/dist/client/static/js/{index-4bqssvt6.js → index-83rkg916.js} +1 -1
- package/dist/client/static/js/{index-aagt3382.js → index-84fyq5a6.js} +1 -1
- package/dist/client/static/js/{index-dr5hca5b.js → index-8g7q8mz4.js} +1 -1
- package/dist/client/static/js/{index-bjv5ga2e.js → index-9vv7wr1n.js} +1 -1
- package/dist/client/static/js/{index-pwe6chtp.js → index-amsa0tfs.js} +1 -1
- package/dist/client/static/js/{index-red856x6.js → index-atq9q1s7.js} +1 -1
- package/dist/client/static/js/{index-f7te27n5.js → index-b2e5pwx7.js} +1 -1
- package/dist/client/static/js/{index-ex5dtdx2.js → index-b5dfvget.js} +1 -1
- package/dist/client/static/js/{index-zedt16w7.js → index-bsr7wmj2.js} +1 -1
- package/dist/client/static/js/{index-k5zfzgez.js → index-c9e417cs.js} +1 -1
- package/dist/client/static/js/{index-3bf7r7z4.js → index-dt6q3rws.js} +4 -4
- package/dist/client/static/js/{index-29npynva.js → index-e9cxje00.js} +1 -1
- package/dist/client/static/js/{index-zq0qxb17.js → index-fzngzhww.js} +1 -1
- package/dist/client/static/js/{index-16sd19f0.js → index-hgzntg2j.js} +1 -1
- package/dist/client/static/js/{index-bafe7hmd.js → index-kb14dhrx.js} +1 -1
- package/dist/client/static/js/{index-qn200x1b.js → index-kbhrvep8.js} +6 -6
- package/dist/client/static/js/{index-eqhjs1yv.js → index-m4k054wz.js} +3 -3
- package/dist/client/static/js/{index-8pksqzwq.js → index-pavvxrsz.js} +1 -1
- package/dist/client/static/js/{index-95kese1h.js → index-q9ytjey8.js} +1 -1
- package/dist/client/static/js/{index-3qnjdjg2.js → index-vkqb4dnt.js} +1 -1
- package/dist/client/static/js/{index-7055hdx1.js → index-wrcdc9vz.js} +1 -1
- package/dist/client/static/js/{index-ncpwteyt.js → index-x9r7zfp4.js} +1 -1
- package/dist/client/static/js/{index-y2z8nsvw.js → index-xq5f3nxa.js} +1 -1
- package/dist/client/static/js/{index-gq5w5w8x.js → index-xwjbq003.js} +1 -1
- package/dist/client/static/js/{index-twsbv1yn.js → index-yf93db65.js} +1 -1
- package/dist/client/static/js/{index-9d3n04vb.js → index-ykm7a3cp.js} +2 -2
- package/dist/client/static/js/{index-5h8y54t6.js → index-z25ss7xj.js} +1 -1
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-7q58qdf1.js → infoDiagram-VRGFBTTK-r1p25738.js} +1 -1
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-9jmeszag.js → ishikawaDiagram-OU5B5YK6-afgrqdrt.js} +1 -1
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-0d7xe845.js → journeyDiagram-ZHPQQLJL-hepa4wk7.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-7p83rwdn.js → kanban-definition-PNTS6WVX-jysft8ya.js} +1 -1
- package/dist/client/static/js/{mermaid.core-hwhzw0wv.js → mermaid.core-0m90b0s8.js} +2 -2
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-hy0rtr7t.js → mindmap-definition-NLK3R4M7-x2rrzpvr.js} +1 -1
- package/dist/client/static/js/one-dark-pro-09d8p5vy.js +1 -0
- package/dist/client/static/js/one-light-g3ednt6p.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-kd8t53tx.js → pegDiagram-GJSIUBJH-z7vb7f1z.js} +1 -1
- package/dist/client/static/js/{pieDiagram-5QR66LMP-h3x03f80.js → pieDiagram-5QR66LMP-jqv6v4e6.js} +1 -1
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-y2b1ncbg.js → quadrantDiagram-O4NWA36T-w2h8yxrv.js} +1 -1
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-x188rcxf.js → railroadDiagram-XR7U4H2S-nd09yac3.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-g5e9fk17.js → requirementDiagram-PLB6GJNP-t61zxh5v.js} +1 -1
- package/dist/client/static/js/{rust-1v8xbxn9.js → rust-avnkhh0p.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-y9ht91gf.js → sankeyDiagram-IPEJSGJF-2f7h2cmw.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-pp8s63rt.js → sequenceDiagram-PO4LG4MO-kfb5d7zd.js} +1 -1
- package/dist/client/static/js/{sizeCapture-INFHLROL-k6dhfxex.js → sizeCapture-INFHLROL-amfg19se.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-y3akpsm4.js → stateDiagram-v2-GCMORJYK-k5hx7btx.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-89081dr3.js → swimlanes-2SLR337P-wv3rp8kk.js} +1 -1
- package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-3q2a15wc.js → swimlanesDiagram-TC7HE7FX-6y8zdbm4.js} +1 -1
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-tz6r8g3q.js → timeline-definition-EJHVYXUP-0re95wtn.js} +1 -1
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-yq2y1b09.js → usecaseDiagram-POWQR4AR-yrje14qp.js} +1 -1
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-qdmjf6x3.js → vennDiagram-UO4OBE2U-jxkmrfy5.js} +1 -1
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-3n2sm7rj.js → wardleyDiagram-VNRHLVJA-d3v2m9b1.js} +1 -1
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-d7n2av2t.js → xychartDiagram-PMCCYNJV-9a1s1rjt.js} +1 -1
- package/package.json +1 -1
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +2 -1
- package/src/client/components/layout/desktop-layout/RightColumn.test.tsx +204 -0
- package/src/client/components/layout/desktop-layout/RightColumn.tsx +37 -16
- package/src/client/components/mobile/RightSidebar.tsx +10 -8
- package/src/client/components/mobile/mobile-session-sidebar/use-drawer-tabs.ts +2 -1
- package/src/client/components/workspace/chat-timeline/MessageList.test.ts +11 -0
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +29 -21
- package/src/client/hooks/chat/timeline/row-measure.ts +75 -0
- package/src/client/hooks/chat/timeline/row-window.test.ts +41 -21
- package/src/client/hooks/chat/timeline/row-window.ts +6 -24
- package/src/client/hooks/workspace/panel-tabs-reveal.test.tsx +20 -17
- package/src/client/hooks/workspace/panel-tabs-reveal.ts +29 -17
- package/src/client/hooks/workspace/panel-tabs.ts +3 -2
- package/src/client/hooks/workspace/session-state/index.test.tsx +145 -0
- package/src/client/hooks/workspace/session-state/index.ts +28 -16
- package/dist/client/static/js/flowDiagram-KWPJA3E3-7b4w6phx.js +0 -1
- package/dist/client/static/js/one-dark-pro-4b8er03c.js +0 -1
- package/dist/client/static/js/one-light-e6r3vsz4.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d,n,o,i,u,a,xr,je,oe,e,s,Pn,L,at,B,se,ko,re,Be,We,ii,pn,si,Yr,D,U,b,er,x,hA,Ie,el,S,gr,Ar,bt,st,ue,Ct,td,ct,ut,SA,TA,ns,rs,nd,He,os}from"./index-amys498v.js";import{Ku,Vu,ei,Yu,Ju}from"./index-dr5hca5b.js";import{kr}from"./index-k5zfzgez.js";var Qt={name:"pen",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],aliases:["edit-2"]},Ve=s(Qt);var Yt={name:"copy-plus",size:24,node:[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["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"}]]},Xe=s(Yt);var Jt={name:"package-open",size:24,node:[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]},qe=s(Jt);var Zt={name:"scissors",size:24,node:[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]},Re=s(Zt);function Qe({rootPath:t,activeRepo:r,repos:l,reposScanning:c,onRefreshRepos:p,onSelectRepo:f,searchQuery:v,onSearchChange:h,onRefresh:y,refreshing:g}){return e("div",{className:"border-b border-ink/10",children:[e(bt,{className:"border-b-0",left:e(kr,{rootPath:t,activeRepo:r,onSelectRepo:f,repos:l,scanning:c,onRefreshRepos:p}),right:e(st,{label:"Refresh",onClick:y,busy:g})}),e("div",{className:"px-3 pb-3",children:e("div",{className:"relative",children:[e(U,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/40"}),e("input",{type:"text",placeholder:"Search files...",value:v,onChange:(m)=>h(m.currentTarget.value),className:"w-full bg-canvas border border-ink/20 rounded pl-8 pr-3 py-1.5 text-xs focus:outline-none focus:border-ink transition-colors text-ink placeholder-ink/40"})]})})]})}function Ye({name:t,path:r,isFolder:l,isOpen:c,ignored:p,selected:f,gitStatus:v,folderStatus:h}){let y=f?"text-ink font-semibold":v?v.colorClass:h?h.colorClass:p?"text-ink/40":"";return e(d,{children:[l?c?e(B,{size:12,className:"flex-shrink-0 text-ink/40"}):e(se,{size:12,className:"flex-shrink-0 text-ink/40"}):e("span",{className:"w-3 flex-shrink-0"}),e(ct,{name:t,isFolder:l,isOpen:c,size:12,className:`flex-shrink-0${p?" opacity-40":""}`}),e("span",{className:`truncate min-w-0 flex-1 ${y}`,title:p?`${r} — git-ignored`:void 0,children:t}),v&&e("span",{className:`font-mono text-[10px] font-bold px-1 rounded flex-shrink-0 ${v.colorClass}`,title:`Git: ${v.label}`,children:v.charStatus}),h&&e("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${h.dotClass}`,title:`${h.count} changed file${h.count>1?"s":""}`})]})}var en=28,tn=9,nn=8;function rn(t){let{isFolder:r,hasGitStatus:l,pasteLabel:c,busy:p,chainLabel:f,foldable:v,selectionCount:h,isArchive:y}=t,g=[],m=h>1,C=h===1?"":` ${h} items`;if(m)return g.push({kind:"item",id:"cut",label:`Cut${C}`,icon:e(Re,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"item",id:"copy",label:`Copy${C}`,icon:e(re,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"separator"}),g.push({kind:"item",id:"compress",label:`Compress${C} to…`,icon:e(at,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"separator"}),g.push({kind:"item",id:"delete",label:`Delete${C}`,icon:e(L,{size:13,className:"text-error"}),tone:"text-error"}),g;if(r){if(g.push({kind:"item",id:"new_file",label:"New File",icon:e(ii,{size:13,className:"text-ink/60"})}),g.push({kind:"item",id:"new_folder",label:"New Folder",icon:e(pn,{size:13,className:"text-ink/60"})}),f)g.push({kind:"item",id:"unfold",label:"Unfold Folders",icon:e(B,{size:13,className:"text-ink/60"})});if(v)g.push({kind:"item",id:"fold",label:"Fold Folders",icon:e(se,{size:13,className:"text-ink/60"})});g.push({kind:"separator"})}else{if(g.push({kind:"item",id:"view",label:"View",icon:e(We,{size:13,className:"text-ink/60"})}),y)g.push({kind:"item",id:"extract",label:"Extract…",icon:e(qe,{size:13,className:"text-ink/60"}),disabled:p});if(l)g.push({kind:"item",id:"diff",label:"Open in Diff Panel",icon:e(si,{size:13,className:"text-warning"}),tone:"font-medium"});g.push({kind:"separator"})}if(g.push({kind:"item",id:"cut",label:"Cut",icon:e(Re,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"item",id:"copy",label:"Copy",icon:e(re,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"item",id:"compress",label:"Compress to…",icon:e(at,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"item",id:"duplicate",label:"Duplicate",icon:e(Xe,{size:13,className:"text-ink/60"}),disabled:p}),c)g.push({kind:"item",id:"paste",label:c,icon:e(ko,{size:13,className:"text-ink/60"}),disabled:p});return g.push({kind:"separator"}),g.push({kind:"item",id:"explorer",label:"Go to Explorer",icon:e(Be,{size:13,className:"text-ink/60"})}),g.push({kind:"item",id:"copy_path",label:"Copy Path",icon:e(re,{size:13,className:"text-ink/60"})}),g.push({kind:"item",id:"copy_relative",label:"Copy Relative Path",icon:e(re,{size:13,className:"text-ink/60"})}),g.push({kind:"separator"}),g.push({kind:"item",id:"history",label:"Show Git History",icon:e(Pn,{size:13,className:"text-ink/60"})}),g.push({kind:"separator"}),g.push({kind:"item",id:"rename",label:"Rename",icon:e(Ve,{size:13,className:"text-ink/60"})}),g.push({kind:"item",id:"delete",label:"Delete",icon:e(L,{size:13,className:"text-error"}),tone:"text-error"}),g}function on(t){let r=t.filter((c)=>c.kind==="item").length,l=t.length-r;return r*en+l*tn+nn}function Je({x:t,y:r,isFolder:l,hasGitStatus:c,pasteLabel:p,chainLabel:f,foldable:v,busy:h,selectionCount:y,isArchive:g,onAction:m,menuRef:C}){let N=rn({isFolder:l,hasGitStatus:c,pasteLabel:p,busy:h,chainLabel:f,foldable:v,selectionCount:y,isArchive:g}),A=on(N),F=typeof window<"u"?Math.max(10,Math.min(t,window.innerWidth-210-12)):t,E=typeof window<"u"?Math.max(10,Math.min(r,window.innerHeight-A-12)):r;return oe(e("div",{className:"fixed inset-0 z-50 bg-ink/20",onClick:()=>m("close"),onContextMenu:(R)=>{R.preventDefault(),m("close")},children:e("div",{ref:C,className:"glass-popover fixed z-50 bg-paper border border-ink/15 shadow-2xl rounded-lg py-1 min-w-[185px] text-xs text-ink font-sans",style:{top:E,left:F},onClick:(R)=>R.stopPropagation(),children:N.map((R,w)=>R.kind==="separator"?e("div",{className:"my-1 border-t border-ink/10"},`sep-${w}`):e("button",{type:"button",disabled:R.disabled,onClick:()=>m(R.id),className:`w-full text-left px-3 py-1.5 flex items-center space-x-2 transition-colors ${R.disabled?"opacity-40 cursor-default":"hover:bg-ink/5"} ${R.tone??""}`,children:[R.icon,e("span",{children:R.label})]},R.id))})}),document.body)}function Ce({folderPath:t,kind:r,value:l,error:c,isLoading:p,onChange:f,onCancel:v,onSubmit:h}){let y=r==="folder"?"Folder":"File";return oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("form",{onSubmit:h,className:"glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[e("h3",{className:"font-semibold text-ink mb-3 text-sm",children:["New ",y]}),e("div",{className:"flex items-center gap-1 mb-1 text-xs font-mono text-ink/50 min-w-0",children:e("span",{className:"truncate",title:t,children:[t||".","/"]})}),e("input",{autoFocus:!0,type:"text",value:l,onChange:(g)=>f(g.currentTarget.value),placeholder:r==="folder"?"folder name or nested/path":"file name or nested/path","aria-label":`New ${y.toLowerCase()} name`,className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none mb-1 ${c?"border-error":"border-ink/20 focus:border-ink"}`}),e("p",{className:"text-[10px] text-ink/40 mb-2",children:["Nested paths create the folders they need — ",e("span",{className:"font-mono",children:"lib/parse.ts"}),"."]}),c&&e("p",{className:"text-[11px] text-error mb-2",children:c}),e("div",{className:"flex justify-end space-x-2 mt-2",children:[e("button",{type:"button",onClick:v,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:p,children:"Cancel"}),e("button",{type:"submit",className:"px-3 py-1.5 text-xs bg-ink text-canvas rounded hover:bg-ink/90 transition-colors flex items-center",disabled:p||!l.trim(),children:p?"Creating...":"Create"})]})]})}),document.body)}function Ze({fileName:t,displayName:r,isFolder:l,count:c=1,isLoading:p,onCancel:f,onConfirm:v}){let h=c>1;return oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("div",{className:"glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[e("h3",{className:"font-semibold text-ink mb-2 text-sm",children:["Delete ",h?`${c} Items`:l?"Folder":"File"]}),e("p",{className:"text-xs text-ink/70 mb-4",children:["Are you sure you want to delete ",h?e(d,{children:["the ",c," selected entries"]}):e("span",{className:"font-mono bg-canvas px-1 rounded",children:t}),"? This action cannot be undone."]}),r&&r!==t&&e("p",{className:"text-[11px] text-ink/50 mb-4",children:["The row is ",e("span",{className:"font-mono",children:r}),"; this deletes"," ",e("span",{className:"font-mono",children:t})," only."]}),e("div",{className:"flex justify-end space-x-2",children:[e("button",{onClick:f,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:p,children:"Cancel"}),e("button",{onClick:v,className:"px-3 py-1.5 text-xs bg-error text-white rounded hover:bg-error/90 transition-colors flex items-center",disabled:p,children:p?"Deleting...":"Delete"})]})]})}),document.body)}function et({isFolder:t,renameValue:r,originalPath:l,displayName:c,error:p,isLoading:f,onChange:v,onCancel:h,onSubmit:y}){return oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("form",{onSubmit:y,className:"glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[e("h3",{className:"font-semibold text-ink mb-3 text-sm",children:["Rename ",t?"Folder":"File"]}),e("input",{autoFocus:!0,type:"text",value:r,onChange:(g)=>v(g.currentTarget.value),"aria-label":`Rename ${t?"folder":"file"} path`,className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none mb-1 ${p?"border-error":"border-ink/20 focus:border-ink"}`}),e("p",{className:"text-[10px] text-ink/40 mb-2",children:["Paths are relative to the tree — ",e("span",{className:"font-mono",children:"lib/deep/name.ts"})," moves it too."]}),c&&e("p",{className:"text-[11px] text-ink/50 mb-2",children:["The row is ",e("span",{className:"font-mono",children:c}),"; this renames"," ",e("span",{className:"font-mono",children:l}),". Use"," ",e("span",{className:"font-mono",children:"Unfold Folders"})," to rename a folder inside the chain."]}),p&&e("p",{className:"text-[11px] text-error mb-2",children:p}),e("div",{className:"flex justify-end space-x-2",children:[e("button",{type:"button",onClick:h,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:f,children:"Cancel"}),e("button",{type:"submit",className:"px-3 py-1.5 text-xs bg-ink text-canvas rounded hover:bg-ink/90 transition-colors flex items-center",disabled:f||!r.trim()||r===l,children:f?"Renaming...":"Rename"})]})]})}),document.body)}function tt({filePath:t,fetcherState:r,fetcherData:l,onClose:c}){let p=l?.type==="history"?l.data:void 0;return oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("div",{className:"glass-overlay bg-paper rounded-lg shadow-xl w-full max-w-4xl border border-ink/10 flex flex-col max-h-[85vh]",children:[e("div",{className:"flex items-center justify-between p-4 border-b border-ink/10",children:[e("h3",{className:"text-sm font-semibold text-ink flex items-center space-x-2",children:[e(Pn,{size:16,className:"text-ink/60"}),e("span",{children:["Git History: ",e("span",{className:"font-mono font-normal opacity-80",children:t})]})]}),e("button",{onClick:c,className:"p-1 hover:bg-ink/5 rounded text-ink/60 transition-colors",children:e(b,{size:14})})]}),e("div",{className:"flex-1 scrollbar-overlay-container p-2",children:r==="idle"?p?p.length>0?e("table",{className:"w-full text-left border-collapse text-[11px]",children:[e("thead",{className:"bg-canvas sticky top-0 z-10 border-b border-ink/10",children:e("tr",{children:[e("th",{className:"px-3 py-2 font-semibold text-ink/70 rounded-tl",children:"Description"}),e("th",{className:"px-3 py-2 font-semibold text-ink/70 w-32",children:"Date"}),e("th",{className:"px-3 py-2 font-semibold text-ink/70 w-32",children:"Author"}),e("th",{className:"px-3 py-2 font-semibold text-ink/70 w-24 text-right rounded-tr",children:"Commit"})]})}),e("tbody",{className:"divide-y divide-ink/5",children:p.map((f,v)=>e("tr",{className:"hover:bg-ink/[0.03] transition-colors group",children:[e("td",{className:"px-3 py-2 text-ink",children:f.message?e("span",{className:"font-medium text-ink/90 group-hover:text-ink",children:f.message}):null}),e("td",{className:"px-3 py-2 text-ink/60 whitespace-nowrap font-mono text-[10.5px]",children:f.time}),e("td",{className:"px-3 py-2 text-ink/70 whitespace-nowrap truncate max-w-[120px]",children:f.author}),e("td",{className:"px-3 py-2 text-right",children:f.hash?e("span",{className:"font-mono text-ink/50 group-hover:text-ink font-semibold transition-colors bg-canvas px-1.5 py-0.5 rounded border border-ink/10",children:f.hash}):null})]},v))})]}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs",children:"No commit history found for this file."}):l?.error?e("div",{className:"p-8 text-center text-error font-mono text-xs",children:l.error}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs",children:"Loading history..."}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs flex items-center justify-center space-x-2",children:[e(D,{size:14,className:"animate-spin"}),e("span",{children:"Loading history..."})]})})]})}),document.body)}function nt({actions:t,file:r,isFolder:l,chainLabel:c}){let p=t.selectionCount;return e(d,{children:[t.showCreateModal&&e(Ce,{folderPath:r.path,kind:t.createKind,value:t.createName,error:t.createError,isLoading:t.busy,onChange:t.setCreateName,onCancel:t.closeCreate,onSubmit:t.submitCreate}),t.showDeleteModal&&e(Ze,{fileName:r.path,displayName:p>1?void 0:c,isFolder:l,count:p,isLoading:t.busy,onCancel:t.closeDelete,onConfirm:t.submitDelete}),t.showRenameModal&&e(et,{isFolder:l,renameValue:t.renameValue,originalPath:r.path,displayName:l?c:void 0,error:t.renameError,isLoading:t.busy,onChange:t.setRenameValue,onCancel:t.closeRename,onSubmit:t.submitRename}),t.showHistoryModal&&e(tt,{filePath:r.path,fetcherState:t.fetcherState,fetcherData:t.fetcherData,onClose:t.closeHistory})]})}function Se(t){let r=t.map(sn);return r.some((l,c)=>l!==t[c])?r:t}function sn(t){if(t.type!=="folder"||!Array.isArray(t.children))return t;let r=Se(t.children),l=r===t.children?t:{...t,children:r};while(Array.isArray(l.children)&&l.children.length===1){let c=l.children[0];if(c.type!=="folder")break;l={...l,name:`${l.name}/${c.name}`,path:c.path,children:c.children,ignored:c.ignored??l.ignored}}return l}function Te(t){return t.type==="folder"&&t.name.includes("/")}function Ae(t,r){let l=r.split("/"),c=t.split("/");if(l.length<2||l.length>c.length||l.some((f)=>!f))return null;let p=c.slice(0,c.length-l.length);return l.map((f,v)=>[...p,...l.slice(0,v+1)].join("/"))}function rt(t,r){let l=new Map;if(r.size===0)return{nodes:t,roots:l};let c=!1,p=(v)=>v.flatMap((h)=>{if(h.type!=="folder")return[h];let y=Array.isArray(h.children)?p(h.children):h.children,g=y===h.children?h:{...h,children:y},m=r.has(h.path)?Ae(h.path,h.name):null;if(!m)return[g];c=!0,l.set(m[0],h.path);let C={...g,name:m[m.length-1].split("/").pop()};for(let k=m.length-1;k>0;k-=1){let N=m[k-1];C={name:N.split("/").pop(),path:N,type:"folder",ignored:g.ignored,children:[C]}}return[C]}),f=p(t);return{nodes:c?f:t,roots:l}}function ot(t,r){let l=new Set,c=(v)=>{for(let h of v){if(h.type!=="folder")continue;if(l.add(h.path),Array.isArray(h.children))c(h.children)}};c(t);let p=r.split("/").slice(0,-1),f=[];for(let v=0;v<p.length;v+=1){let h=p.slice(0,v+1).join("/");if(l.has(h))f.push(h)}return f}function Fe({folderPath:t,rootPath:r,repo:l,onCreated:c,onOpenCreated:p}){let f=ut(),[v,h]=n(!1),[y,g]=n("file"),[m,C]=n(""),[k,N]=n(null),A=i(null);return o(()=>{if(f.state!=="idle"||!f.data)return;let F=f.data;if(A.current===F)return;if(A.current=F,F.success&&F.path){let E=F.kind==="folder"?"folder":"file";h(!1),C(""),N(null);let R=F.path.split("/").pop()||F.path;if(c({path:F.path,name:R,kind:E}),E==="file")p?.({path:F.path,name:R})}else N(F.error||`Could not create the ${y}`)},[f.state,f.data]),{open:v,kind:y,name:m,setName:C,error:k,busy:f.state!=="idle",openDialog:(F="file")=>{g(F),C(""),N(null),h(!0)},closeDialog:()=>h(!1),submit:(F)=>{F.preventDefault();let E=m.trim();if(!E)return;N(null);let R=new FormData;if(R.append("actionType","create"),R.append("path",t),R.append("name",E),y==="folder")R.append("kind","folder");if(l&&l!==".")R.append("repo",l);if(r)R.append("root",r);f.submit(R,{method:"post",action:"/api/fs/action"})}}}function Ne(t){if(!t)return null;if(t.entries.length===1)return t.entries[0].name;return`${t.entries.length} items`}function it(t,r){return`${t??""}\x00${r}`}function Ee(t,r){if(r==="folder")return t;let l=t.lastIndexOf("/");return l===-1?".":t.slice(0,l)}function lt(t){let r=t.lastIndexOf("/");return r===-1?".":t.slice(0,r)}function dt(t,r){if(t.path===""||t.path===".")return"The workspace root cannot be moved or copied";if(t.kind==="folder"&&(r===t.path||r.startsWith(`${t.path}/`)))return"Cannot paste a folder into itself";return null}function pt(t,r){let l=dt(t,r);if(l)return l;if(r===lt(t.path))return"Already in this folder";return null}function ft(t,r,l){if(!t||t.entries.length===0)return"Nothing to paste";if(t.scope!==r)return"The clipboard holds an entry from another workspace";if(t.mode==="cut"&&t.entries.some((c)=>l===lt(c.path)))return"Already in this folder";for(let c of t.entries){let p=dt(c,l);if(p)return p}return null}function mt(t){if(typeof t!=="object"||t===null)return null;let r=t;if(typeof r.scope!=="string")return null;if(r.mode!=="copy"&&r.mode!=="cut")return null;let l=Array.isArray(r.entries)?r.entries:typeof r.path==="string"?[{path:r.path,name:r.name,kind:r.kind}]:[],c=[];for(let p of l){let f=an(p);if(!f)return null;c.push(f)}if(c.length===0)return null;return{scope:r.scope,entries:c,mode:r.mode}}function an(t){if(typeof t!=="object"||t===null)return null;let r=t;if(typeof r.path!=="string"||typeof r.name!=="string")return null;if(r.kind!=="file"&&r.kind!=="folder")return null;let l=r.path.split("/");if(r.path===""||r.path.startsWith("/")||l.some((c)=>c===""||c==="."||c===".."))return null;return{path:r.path,name:r.name,kind:r.kind}}var Me=[{id:"zip",label:"ZIP",extension:"zip"},{id:"7z",label:"7Z",extension:"7z"},{id:"rar",label:"RAR",extension:"rar"},{id:"tar",label:"TAR",extension:"tar"},{id:"tar.gz",label:"TAR.GZ",extension:"tar.gz"}],ht=[[".tar.gz","tar.gz"],[".tar.bz2","tar.bz2"],[".tar.xz","tar.xz"],[".tgz","tar.gz"],[".tbz2","tar.bz2"],[".txz","tar.xz"],[".tar","tar"],[".zip","zip"],[".7z","7z"],[".rar","rar"],[".gz","gz"],[".bz2","bz2"],[".xz","xz"]];function Le(t){let r=t.toLowerCase();for(let[l,c]of ht)if(r.endsWith(l))return c;return null}function gt(t){return Le(t)!==null}function ln(t){return Me.find((r)=>r.id===t)}function cn(t){return ln(t)?.extension??"zip"}function xt(t){let r=t.toLowerCase();for(let[l]of ht)if(r.endsWith(l))return t.slice(0,-l.length);return t}function vt(t){let r=t.lastIndexOf("/");return r===-1?".":t.slice(0,r)||"."}function yt(t){let r=t.lastIndexOf("/");return r===-1?t:t.slice(r+1)}function kt(t){if(t.length===0)return".";let r=t.map((c)=>vt(c).split("/").filter((p)=>p!==".")),l=r[0]??[];for(let c of r.slice(1)){let p=0;while(p<l.length&&p<c.length&&l[p]===c[p])p+=1;l=l.slice(0,p)}return l.length===0?".":l.join("/")}function we(t,r){let l=cn(r);if(t.length===1){let f=t[0],v=xt(f.name),h=v.lastIndexOf(".");return`${(f.kind==="folder"?f.name:h>0?v.slice(0,h):v)||"archive"}.${l}`}let c=kt(t.map((f)=>f.path)),p=yt(c);return`${p==="."||p===""?"archive":p}.${l}`}function Ft(t){return kt(t.map((r)=>r.path))}function Nt(t){let r=vt(t),l=xt(yt(t));if(!l)return r;return r==="."?l:`${r}/${l}`}function wt(t){return t.toUpperCase()}function Dt({file:t,diff:r,onOpenFile:l,onActionComplete:c,onCreated:p,onRenamed:f,onUnfold:v,onFold:h,clipboard:y,isFolder:g,selection:m,selected:C,archive:k}){let N=ut(),[A,F]=n(null),E=i(null),[R,w]=n(!1),[T,I]=n(!1),[_,ee]=n(!1),[te,ae]=n(t.path),[H,P]=n(null),{repo:z,rootPath:G}=t,K=Fe({folderPath:t.path,rootPath:G,repo:z,onCreated:(M)=>p?p(M):c(),onOpenCreated:(M)=>l?.({...M,root:G,repo:z||"."})}),ne=i(null);o(()=>{if(N.state!=="idle"||!N.data)return;let M=N.data;if(ne.current===M)return;if(ne.current=M,M.success&&!M.type)if(w(!1),I(!1),P(null),M.previousPath&&M.path&&f)f(M.previousPath,M.path);else c();else if(!M.success&&M.error&&R)P(M.error)},[N.state,N.data]);let q=(M)=>{if(z&&z!==".")M.append("repo",z);if(G)M.append("root",G);N.submit(M,{method:"post",action:"/api/fs/action"})},X=()=>{l?.({path:t.path,name:t.name,root:G,repo:z||"."})},J={path:t.path,name:t.name,kind:g?"folder":"file"},ie=C&&m.length>1?m:[J],he=gt(t.name),Q=y.clip&&!y.refusalFor(J)?`Paste ${Ne(y.clip)??"item"}`:null,fe=(M)=>{if(F(null),P(null),M==="view")X();else if(M==="diff")window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.path,staged:r?.staged,status:r?.status||"M",repo:z||".",root:G}}));else if(M==="explorer"){let j=new FormData;j.append("actionType","open_explorer"),j.append("path",t.path),q(j)}else if(M==="copy_path")Ct(td(t.basePath,t.path));else if(M==="copy_relative")Ct(t.path);else if(M==="history"){ee(!0);let j=new FormData;j.append("actionType","git_history"),j.append("path",t.path),q(j)}else if(M==="rename")ae(t.path),w(!0);else if(M==="unfold")v?.();else if(M==="fold")h?.();else if(M==="new_file")K.openDialog("file");else if(M==="new_folder")K.openDialog("folder");else if(M==="delete")I(!0);else if(M==="cut")y.cut(ie);else if(M==="copy")y.copy(ie);else if(M==="compress")k.openCompress(ie);else if(M==="extract")k.openExtract(J);else if(M==="duplicate")y.duplicate(J);else if(M==="paste")y.paste(J)},le=(M)=>{M.preventDefault(),P(null);let j=new FormData;j.append("actionType","rename"),j.append("path",t.path),j.append("newPath",te),q(j)},xe=()=>{let M=new FormData;if(M.append("actionType","delete"),ie.length>1)M.append("paths",JSON.stringify(ie.map((j)=>j.path)));else M.append("path",t.path);q(M)};return{contextMenu:A,contextMenuRef:E,openContextMenu:(M,j)=>F({x:M,y:j}),closeContextMenu:()=>F(null),showRenameModal:R,showDeleteModal:T,showHistoryModal:_,showCreateModal:K.open,createKind:K.kind,createError:K.error,createName:K.name,setCreateName:K.setName,renameValue:te,setRenameValue:ae,renameError:H,busy:N.state!=="idle"||K.busy||y.busy||k.busy,pasteLabel:Q,selectionCount:ie.length,isArchive:he,chainLabel:v!==void 0,foldable:h!==void 0,fetcherState:N.state,fetcherData:N.data,handleAction:fe,submitCreate:K.submit,submitRename:le,submitDelete:xe,closeCreate:K.closeDialog,closeDelete:()=>I(!1),closeRename:()=>w(!1),closeHistory:()=>ee(!1)}}function Rt({target:t,dragging:r,clipboard:l,onDragStart:c,onDragEnd:p,onDropOn:f,onHoverAccept:v}){let h=r?.path===t.path,y=Boolean(r)&&!h&&l.moveRefusalFor(r,t)===null,[g,m]=n(!1);return o(()=>{if(!r)m(!1)},[r]),{isDragging:h,acceptsDrop:y,isDropHovered:g&&y,onDragStart:(k)=>{if(k.dataTransfer?.setData("text/plain",t.path),k.dataTransfer)k.dataTransfer.effectAllowed="move";c(t)},onDragEnd:p,onDragOver:(k)=>{if(!r)return;if(k.stopPropagation(),m(y),!y)return;if(k.preventDefault(),k.dataTransfer)k.dataTransfer.dropEffect="move";v?.(t)},onDragLeave:()=>m(!1),onDrop:(k)=>{if(!r)return;if(k.stopPropagation(),!y)return;k.preventDefault(),f(t)}}}function dn(t,r,l){if(r||l)return!1;return!Array.isArray(t.children)}function $e({file:t,rootPath:r,basePath:l,repo:c,onLoadChildren:p,onOpenFile:f,onActionComplete:v,onCreated:h,onRenamed:y,expandedPaths:g,onToggleFolder:m,gitFileMap:C,gitFolderMap:k,clipboard:N,archive:A,selection:F,selectionTargets:E,dragging:R,onDragStart:w,onDragEnd:T,onDropOn:I,onUnfold:_,onFold:ee,foldRoots:te,touch:ae=!1}){let H=t.type==="folder",[P,z]=n(!1),[G,K]=n(!1),[ne,q]=n(!1),[X,J]=n(!1),ie=Array.isArray(t.children)?t.children:[],he=(t.path||"").replace(/^\/+/,""),Q=!H?C?.get(he)||C?.get(t.path):void 0,fe=Q?er(Q.status,Q.staged):null,le=H?k?.get(he)||k?.get(t.path):null,xe=Boolean(fe),M=t.ignored===!0,j=g?g.has(t.path):P,ce=t.forceExpanded!==void 0?t.forceExpanded:j;o(()=>{J(!0)},[]),o(()=>{if(H&&g)z(g.has(t.path))},[g,t.path,H]),o(()=>{if(H&&ce&&dn(t,G,ne)&&p)q(!0),K(!0),Promise.resolve(p(t.path)).finally(()=>K(!1))},[H,ce,t.children,t.path,p,G,ne]);let ye={path:t.path,name:t.name,kind:H?"folder":"file"},be=F.selected.has(t.path),W=Dt({file:{path:t.path,name:t.name,basePath:l,rootPath:r,repo:c},selection:E,selected:be,archive:A,diff:{staged:Q?.staged||(Q?.status?Q.status[0]!==" "&&Q.status[0]!=="?":!1),status:fe?.charStatus},onOpenFile:f,onActionComplete:v,onCreated:h,onRenamed:y,onUnfold:_&&Te({type:H?"folder":"file",name:t.name})?()=>_(ye):void 0,onFold:ee&&te?.has(t.path)?()=>ee(te.get(t.path)):void 0,clipboard:N,isFolder:H});ue(W.contextMenuRef,W.closeContextMenu);let Y=Ku({enabled:ae,onLongPress:(V,ge)=>W.openContextMenu(V,ge)}),ke=(V)=>{if(V.stopPropagation(),Y.consume())return;let ge=F.gestureOf(V);if(ge!=="plain"){F.applyGesture(ge,t.path);return}if(F.applyGesture("plain",t.path),H){let pe=!ce;if(z(pe),t.forceExpanded!==void 0)t.forceExpanded=void 0;if(m?.(t.path,pe),!pe)q(!1)}else if(f)f({...t,root:r,repo:c||"."})},ve=(V)=>{V.preventDefault(),V.stopPropagation(),F.ensureForContext(t.path),W.openContextMenu(V.clientX,V.clientY)},de=Rt({target:ye,dragging:R,clipboard:N,onDragStart:w,onDragEnd:T,onDropOn:I,onHoverAccept:_});return e("div",{children:[e("div",{className:`flex items-center space-x-1.5 py-1 px-2 cursor-pointer rounded group select-none ${de.isDragging?"opacity-40":""} ${de.isDropHovered?"bg-info/10 ring-1 ring-info/40 ring-inset":be?"bg-ink/[0.08] ring-1 ring-ink/20 ring-inset":"hover:bg-ink/5"}`,draggable:!ae,onClick:ke,onContextMenu:ve,onDragStart:de.onDragStart,onDragEnd:de.onDragEnd,onDragOver:de.onDragOver,onDragLeave:de.onDragLeave,onDrop:de.onDrop,onTouchStart:Y.onTouchStart,onTouchMove:Y.onTouchMove,onTouchEnd:Y.onTouchEnd,onTouchCancel:Y.onTouchCancel,children:e(Ye,{name:t.name,path:t.path,isFolder:H,isOpen:ce,ignored:M,selected:be,gitStatus:fe,folderStatus:le})}),ce&&G&&e("div",{className:"ml-3 border-l border-ink/10 pl-3 py-0.5 text-[10px] text-ink/30",children:"Loading…"}),ce&&!G&&ie.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:ie.map((V)=>e($e,{file:V,rootPath:r,basePath:l,repo:c,onLoadChildren:p,onOpenFile:f,onActionComplete:v,onCreated:h,onRenamed:y,expandedPaths:g,onToggleFolder:m,gitFileMap:C,gitFolderMap:k,clipboard:N,archive:A,selection:F,selectionTargets:E,dragging:R,onDragStart:w,onDragEnd:T,onDropOn:I,onUnfold:_,onFold:ee,foldRoots:te,touch:ae},V.path))}),X&&W.contextMenu&&e(Je,{x:W.contextMenu.x,y:W.contextMenu.y,isFolder:H,hasGitStatus:xe,pasteLabel:W.pasteLabel,chainLabel:W.chainLabel,foldable:W.foldable,busy:W.busy,selectionCount:W.selectionCount,isArchive:W.isArchive,onAction:W.handleAction}),X&&e(nt,{actions:W,file:t,isFolder:H,chainLabel:Te({type:H?"folder":"file",name:t.name})?t.name:void 0})]})}function St({x:t,y:r,pasteLabel:l,busy:c,onAction:p,menuRef:f}){let h=l?104:76,y=typeof window<"u"?Math.max(10,Math.min(t,window.innerWidth-190-12)):t,g=typeof window<"u"?Math.max(10,Math.min(r,window.innerHeight-h-12)):r;return oe(e("div",{className:"fixed inset-0 z-50 bg-ink/20",onClick:()=>p("close"),onContextMenu:(m)=>{m.preventDefault(),p("close")},children:e("div",{ref:f,className:"glass-popover fixed z-50 bg-paper border border-ink/15 shadow-2xl rounded-lg py-1 min-w-[185px] text-xs text-ink font-sans",style:{top:g,left:y},onClick:(m)=>m.stopPropagation(),children:[e("button",{type:"button",onClick:()=>p("new_file"),className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 flex items-center space-x-2 transition-colors",children:[e(ii,{size:13,className:"text-ink/60"}),e("span",{children:"New File"})]}),e("button",{type:"button",onClick:()=>p("new_folder"),className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 flex items-center space-x-2 transition-colors",children:[e(pn,{size:13,className:"text-ink/60"}),e("span",{children:"New Folder"})]}),l&&e("button",{type:"button",disabled:c,onClick:()=>p("paste"),className:`w-full text-left px-3 py-1.5 flex items-center space-x-2 transition-colors ${c?"opacity-40 cursor-default":"hover:bg-ink/5"}`,children:[e(ko,{size:13,className:"text-ink/60"}),e("span",{children:l})]})]})}),document.body)}function Tt({menu:t,menuRef:r,pasteLabel:l,busy:c,onAction:p,create:f}){return e(d,{children:[t&&e(St,{x:t.x,y:t.y,menuRef:r,pasteLabel:l,busy:c,onAction:p}),f.open&&e(Ce,{folderPath:".",kind:f.kind,value:f.name,error:f.error,isLoading:f.busy,onChange:f.setName,onCancel:f.closeDialog,onSubmit:f.submit})]})}function At({title:t,subject:r,error:l,busy:c,submitLabel:p,busyLabel:f,onSubmit:v,onCancel:h,children:y}){return oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("form",{onSubmit:v,className:"glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[e("h3",{className:"font-semibold text-ink mb-1 text-sm",children:t}),e("p",{className:"text-[11px] text-ink/50 mb-3 break-words",children:r}),y,l&&e("p",{className:"text-[11px] text-error mb-2",children:l}),e("div",{className:"flex justify-end space-x-2 mt-3",children:[e("button",{type:"button",onClick:h,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:c,children:"Cancel"}),e("button",{type:"submit",className:"px-3 py-1.5 text-xs bg-ink text-canvas rounded hover:bg-ink/90 transition-colors flex items-center",disabled:c,children:c?f:p})]})]})}),document.body)}function un({entries:t,format:r,name:l,destination:c,formats:p,error:f,busy:v,onFormatChange:h,onNameChange:y,onDestinationChange:g,onCancel:m,onSubmit:C}){let k=t.slice(0,4).map((A)=>A.name).join(", "),N=t.length>4?` +${t.length-4} more`:"";return e(At,{title:`Compress ${t.length===1?t[0].name:`${t.length} items`}`,subject:`${k}${N}`,error:f,busy:v,submitLabel:"Compress",busyLabel:"Compressing...",onCancel:m,onSubmit:(A)=>{A.preventDefault(),C()},children:[e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",htmlFor:"archive-format",children:"Format"}),e("select",{id:"archive-format",value:r,onChange:(A)=>h(A.currentTarget.value),className:"w-full bg-paper border border-ink/20 rounded px-2 py-1.5 text-xs font-mono focus:outline-none focus:border-ink mb-3",children:p.map((A)=>e("option",{value:A.id,disabled:!A.available,children:[A.label,A.available?"":` — ${A.tool} not installed`]},A.id))}),e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",htmlFor:"archive-name",children:"Archive name"}),e("input",{id:"archive-name",autoFocus:!0,type:"text",value:l,onChange:(A)=>y(A.currentTarget.value),"aria-label":"Archive name",className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none mb-3 ${f?"border-error":"border-ink/20 focus:border-ink"}`}),e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",htmlFor:"archive-destination",children:"Destination folder"}),e("input",{id:"archive-destination",type:"text",value:c,onChange:(A)=>g(A.currentTarget.value),"aria-label":"Archive destination",className:"w-full bg-paper border border-ink/20 rounded px-2 py-1.5 text-xs font-mono focus:outline-none focus:border-ink"})]})}function fn({archive:t,kindLabel:r,destination:l,error:c,busy:p,onDestinationChange:f,onCancel:v,onSubmit:h}){return e(At,{title:`Extract ${t.name}`,subject:`${r} archive · extracts into a folder`,error:c,busy:p,submitLabel:"Extract",busyLabel:"Extracting...",onCancel:v,onSubmit:(y)=>{y.preventDefault(),h()},children:[e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",htmlFor:"extract-destination",children:"Extract to folder"}),e("input",{id:"extract-destination",autoFocus:!0,type:"text",value:l,onChange:(y)=>f(y.currentTarget.value),"aria-label":"Extract destination",className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none ${c?"border-error":"border-ink/20 focus:border-ink"}`})]})}function Et({archive:t}){if(t.compress)return e(un,{entries:t.compress.entries,format:t.compress.format,name:t.compress.name,destination:t.compress.destination,formats:t.formats,error:t.error,busy:t.busy,onFormatChange:t.setFormat,onNameChange:t.setName,onDestinationChange:t.setCompressDestination,onCancel:t.cancel,onSubmit:t.submitCompress});if(t.extract)return e(fn,{archive:t.extract.archive,kindLabel:wt(Le(t.extract.archive.name)??"zip"),destination:t.extract.destination,error:t.error,busy:t.busy,onDestinationChange:t.setExtractDestination,onCancel:t.cancel,onSubmit:t.submitExtract});return null}function Mt(){let[t,r]=S("files.outlineExpanded",!1),l=xr(),c=je(TA,SA),{symbols:p,total:f,truncated:v,notice:h}=Ju({content:c.content,language:c.language,state:c.state,note:c.note,path:c.path});if(c.state==="diff")return null;let y=c.preview,g=(m,C)=>{if(!c.path)return;if(y){let k=nd(p,C);if(k)rs({path:c.path,...k});return}ns({path:c.path,line:m.line,column:m.column,length:m.name.length})};return e("div",{className:"border-t border-ink/10 bg-canvas/30 flex-shrink-0",children:[e("div",{className:"flex items-center hover:bg-ink/5 transition-colors",children:e("button",{type:"button",onClick:()=>r(!t),"aria-expanded":t,"aria-controls":l,"aria-label":"Outline",title:t?"Hide outline":"Show outline",className:"flex flex-1 min-w-0 items-center space-x-1 py-1.5 pl-3 pr-2 text-left font-semibold text-xs text-ink transition-colors cursor-pointer",children:[e("span",{className:"w-3 text-center font-mono","aria-hidden":"true",children:t?"▾":"▸"}),e(Yr,{size:12}),e("span",{children:"Outline"}),f>0&&e("span",{className:"font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] text-ink/50",children:v?`${p.length}/${f.toLocaleString()}`:f})]})}),e("div",{className:"section-reveal","data-expanded":t,id:l,inert:!t,children:e("div",{children:e("div",{className:"px-2 pb-2",children:p.length===0?e("div",{className:"px-1 text-[10px] text-ink/40 italic py-1",children:h}):e("div",{className:"max-h-48 overflow-y-auto scrollbar-overlay-container flex flex-col",children:[p.map((m,C)=>e("button",{type:"button",onClick:()=>g(m,C),"aria-label":y?`${ei(m.kind)} ${m.name}`:`${ei(m.kind)} ${m.name}, line ${m.line}`,title:y?`Jump to ${ei(m.kind).toLowerCase()}`:`${ei(m.kind)} · line ${m.line}`,className:"flex w-full min-w-0 items-center gap-1.5 rounded px-1 py-0.5 text-left transition-colors hover:bg-ink/5 active:bg-ink/10",style:{paddingLeft:`${4+m.depth*12}px`},children:[e(Vu,{kind:m.kind}),e("span",{className:"min-w-0 flex-1 truncate text-[11px] font-mono text-ink/80",children:m.name}),!y&&e("span",{className:"flex-shrink-0 font-mono text-[10px] text-ink/35",children:m.line})]},`${m.line}:${m.kind}:${m.name}`)),v&&e("div",{className:"px-1 py-1 text-[10px] italic text-ink/40",children:Yu(f)})]})})})})]})}function ze(t,r){return Se(t.map((l)=>mn(l,r)))}function mn(t,r){if(t.type!=="folder")return t;let l=r[t.path];if(!l)return t;return{...t,children:ze(l,r)}}function hn(t){let r=t.lastIndexOf("/");return r===-1?".":t.slice(0,r)}function $t(t){let r=t.lastIndexOf("/");return r===-1?t:t.slice(r+1)}function Lt(t){return[...t].sort((r,l)=>{if(r.type!==l.type)return r.type==="folder"?-1:1;return r.name.localeCompare(l.name)})}function Oe(t,r,l){let c=l.path.split("/"),p=c.slice(0,-1).join("/"),f=[...t],v={...r},h=f,y=null;for(let g=0;g<c.length-1;){let m=c.slice(0,g+1).join("/"),C=h.find((E)=>E.type==="folder"&&E.path===m),k=C?null:h.find((E)=>E.type==="folder"&&E.path.startsWith(`${m}/`)&&(p===E.path||p.startsWith(`${E.path}/`))),N=C??k,A=N?v[N.path]??N.children:null;if(N&&!Array.isArray(A))return{nodes:t,cache:r};if(!N){let E=gn(h,v,m);if(E){h=E;let R=h.find((T)=>T.path===m),w=Array.isArray(R?.children)?[...R.children]:[];v[m]=w,h=w,y=m,g+=1;continue}}let F=Array.isArray(A)?[...A]:[];if(N){v[N.path]=F,h=F,y=N.path,g=N.path.split("/").length;continue}h.push({name:c[g],path:m,type:"folder",ignored:!1}),v[m]=F,h=F,y=m,g+=1}if(h.push(l),y!==null)v[y]=Lt(h);return f=Lt(f),{nodes:f,cache:v}}function gn(t,r,l){let c=t.findIndex((y)=>y.type==="folder"&&y.path.startsWith(`${l}/`));if(c===-1)return null;let p=t[c],f=p.path.slice(l.length+1).split("/"),v=r[p.path]??p.children;if(Array.isArray(v))r[p.path]=v;let h={name:f[f.length-1],path:p.path,type:"folder",ignored:p.ignored,...Array.isArray(v)?{children:v}:{}};for(let y=f.length-2;y>=0;y-=1)h={name:f[y],path:`${l}/${f.slice(0,y+1).join("/")}`,type:"folder",ignored:!1,children:[h]};return t[c]={name:$t(l),path:l,type:"folder",ignored:!1,children:[h]},t}function zt(t,r,l){let c=t.find((m)=>m.path===l);if(c)return{entry:c,nodes:t.filter((m)=>m.path!==l),cache:r};let p=hn(l),f=r[p],v=f?.find((m)=>m.path===l);if(f&&v)return{entry:v,nodes:t,cache:{...r,[p]:f.filter((m)=>m.path!==l)}};let y=Object.keys(r).filter((m)=>l.startsWith(`${m}/`)&&r[m].some((C)=>C.path===l)).sort((m,C)=>C.length-m.length)[0];if(!y)return{entry:null,nodes:t,cache:r};let g=r[y];return{entry:g.find((m)=>m.path===l),nodes:t,cache:{...r,[y]:g.filter((m)=>m.path!==l)}}}function Ot(t,r,l){let c=!1,p=t.map((f)=>{let v=f.path===r||f.path.startsWith(`${r}/`),h=Array.isArray(f.children)?Ot(f.children,r,l):void 0;if(!v&&h===f.children)return f;c=!0;let y=v?f.path===r?l:`${l}${f.path.slice(r.length)}`:f.path,g=v?{...f,path:y,name:$t(y)}:{...f};if(h!==void 0)g.children=h;return g});return c?p:t}function Pt(t,r,l){let c={};for(let[p,f]of Object.entries(t)){let v=p===r?l:p.startsWith(`${r}/`)?`${l}${p.slice(r.length)}`:p;c[v]=v===p?f:Ot(f,r,l)}return c}function It(t,r,l){let c=new Set;for(let p of t)if(p===r)c.add(l);else if(p.startsWith(`${r}/`))c.add(`${l}${p.slice(r.length)}`);else c.add(p);return c}function Ht(t){if(!x(t))return{status:"missing"};if(typeof t.root!=="string"||t.root==="")return{status:"missing"};return{status:"ok",files:Array.isArray(t.files)?t.files.filter((r)=>x(r)):[],root:t.root}}async function Pe(t){try{return Ht(await(await fetch(t)).json())}catch{return{status:"failed"}}}function Gt({enabled:t,rootPath:r,activeRepo:l,expandedPaths:c,onExpansionPruned:p}){let f=`${r??""}\x00${l}`,[v,h]=n({scope:"",files:[],root:""}),[y,g]=n(!1),m=i({}),C=i([]),k=i(f);k.current=f;let N=i(""),A=i(""),F=i(c);F.current=c;let E=(P)=>{let z=new URLSearchParams;if(r)z.set("root",r);if(l&&l!==".")z.set("repo",l);if(P)z.set("path",P);return z.set("t",String(Date.now())),`/api/fs/dir?${z.toString()}`},R=(P,z)=>{N.current=P,A.current=z;let G=ze(C.current,m.current);return h({scope:P,files:G,root:z}),G},w=async(P)=>{let z=[...F.current];if(z.length===0)return;let G=await Promise.all(z.map(async(X)=>({path:X,read:await Pe(E(X))})));if(k.current!==P)return;let K=[];for(let{path:X,read:J}of G)if(J.status==="ok")m.current[X]=J.files;else if(J.status==="missing")K.push(X);if(K.length===0)return;let ne=new Set(K);for(let X of K)delete m.current[X];let q=new Set([...F.current].filter((X)=>!ne.has(X)));F.current=q,p(q)},T=async()=>{if(!t)return;let P=k.current;g(!0);try{let z=await Pe(E());if(k.current!==P)return;if(z.status!=="ok")return;if(N.current!==P)m.current={};if(C.current=z.files,R(P,z.root),await w(P),k.current!==P)return;R(P,z.root)}finally{if(k.current===P)g(!1)}},I=async(P)=>{let z=k.current,G=await Pe(E(P));if(k.current!==z||G.status!=="ok")return;if(m.current[P]=G.files,N.current===z)R(z,A.current)},_=(P)=>{let z=Ht(P);if(z.status!=="ok")return;let G=k.current;if(N.current!==G)m.current={};C.current=z.files,R(G,z.root),w(G).then(()=>{if(k.current===G)R(G,z.root)})},ee=()=>{m.current={},C.current=[],N.current="",A.current="",h({scope:"",files:[],root:""})},te=(P)=>{let z=k.current;if(N.current!==z)return null;let G={name:P.path.slice(P.path.lastIndexOf("/")+1),path:P.path,type:P.kind,ignored:!1},K=Oe(C.current,m.current,G);if(K.nodes===C.current)return null;return C.current=K.nodes,m.current=K.cache,R(z,A.current)},ae=(P,z)=>{let G=k.current;if(N.current!==G)return null;let K=zt(C.current,m.current,P);if(!K.entry)return null;m.current=Pt(K.cache,P,z);let ne={...K.entry,path:z,name:z.slice(z.lastIndexOf("/")+1)},q=Oe(K.nodes,m.current,ne);return C.current=q.nodes,m.current=q.cache,R(G,A.current)},H=v.scope===f;return{scope:f,files:H?v.files:[],root:H?v.root:"",isLoading:y,reload:T,loadChildren:I,adoptRoot:_,insertEntry:te,moveEntry:ae,reset:ee}}function Kt({rootPath:t,repo:r,onComplete:l,onError:c}){let p=ut(),[f,v]=S("files.clipboard",null),h=mt(f),y=it(t,r),g=i(!1),m=i(null);o(()=>{if(p.state!=="idle"||!p.data)return;let F=p.data;if(m.current===F)return;m.current=F;let E=g.current;if(g.current=!1,F.success){if(E)v(null);if(F.failures?.length)c(`${F.failures.length} item(s) could not be moved: ${F.failures[0].error}`);l()}else c(F.error||"The transfer did not complete")},[p.state,p.data]);let C=a((F,E)=>{g.current=E;let R=new FormData;for(let[w,T]of Object.entries(F))R.append(w,T);if(r&&r!==".")R.append("repo",r);if(t)R.append("root",t);p.submit(R,{method:"post",action:"/api/fs/action"})},[p,r,t]),k=a((F)=>ft(h,y,Ee(F.path,F.kind)),[h,y]),N=a((F,E)=>pt(F,Ee(E.path,E.kind)),[]),A=a((F,E,R,w)=>{let T=new FormData;T.append("actionType","paste"),T.append("mode",R),T.append("targetPath",E.path),T.append("targetKind",E.kind);for(let I of F)T.append("sourcePath",I.path);if(r&&r!==".")T.append("repo",r);if(t)T.append("root",t);g.current=w,p.submit(T,{method:"post",action:"/api/fs/action"})},[p,r,t]);return{clip:h,busy:p.state!=="idle",refusalFor:k,moveRefusalFor:N,copy:(F)=>{if(F.length===0)return;v({scope:y,entries:F.map(({path:E,name:R,kind:w})=>({path:E,name:R,kind:w})),mode:"copy"})},cut:(F)=>{if(F.length===0)return;v({scope:y,entries:F.map(({path:E,name:R,kind:w})=>({path:E,name:R,kind:w})),mode:"cut"})},duplicate:(F)=>{C({actionType:"duplicate",path:F.path},!1)},move:(F,E)=>{let R=N(F,E);if(R){c(R);return}A([F],E,"cut",Boolean(h?.mode==="cut"&&h.entries.some((w)=>w.path===F.path)))},paste:(F)=>{if(!h)return;let E=k(F);if(E){c(E);return}A(h.entries.map(({path:R,name:w,kind:T})=>({path:R,name:w,kind:T})),F,h.mode,h.mode==="cut")}}}var bn=Me.map((t)=>({...t,available:!0,tool:t.id}));function jt({rootPath:t,repo:r,onComplete:l}){let c=ut(),[p,f]=n(bn),[v,h]=n(null),[y,g]=n(null),[m,C]=n(null),k=i(null),N=i(null);o(()=>{let w=!1;return(async()=>{try{let I=await(await fetch("/api/fs/archive")).json();if(!w&&Array.isArray(I.formats)&&I.formats.length>0)f(I.formats)}catch{}})(),()=>{w=!0}},[]),o(()=>{if(c.state!=="idle"||!c.data)return;let w=c.data;if(N.current===w)return;N.current=w;let T=k.current;if(k.current=null,w.success){if(C(null),T==="compress")h(null);if(T==="extract")g(null);l()}else if(T)C(w.error||"The archive request failed")},[c.state,c.data]);let A=a((w)=>{let T=new FormData;for(let[I,_]of Object.entries(w))T.append(I,_);if(r&&r!==".")T.append("repo",r);if(t)T.append("root",t);c.submit(T,{method:"post",action:"/api/fs/action"})},[c,r,t]),F=a((w)=>{if(w.length===0)return;let T=p.find((I)=>I.id==="zip"&&I.available)?.id??p.find((I)=>I.available)?.id??"zip";C(null),g(null),h({entries:w.map(({path:I,name:_,kind:ee})=>({path:I,name:_,kind:ee})),format:T,name:we(w,T),destination:Ft(w)})},[p]),E=a((w)=>{C(null),h(null),g({archive:w,destination:Nt(w.path)})},[]),R=a((w)=>{h((T)=>{if(!T)return T;let I=we(T.entries,T.format),_=T.name===I?we(T.entries,w):T.name;return{...T,format:w,name:_}})},[]);return{formats:p,compress:v,extract:y,error:m,busy:c.state!=="idle",openCompress:F,openExtract:E,setFormat:R,setName:(w)=>h((T)=>T&&{...T,name:w}),setCompressDestination:(w)=>h((T)=>T&&{...T,destination:w}),setExtractDestination:(w)=>g((T)=>T&&{...T,destination:w}),cancel:()=>{h(null),g(null),C(null)},submitCompress:()=>{let w=v;if(!w)return;k.current="compress",C(null),A({actionType:"compress",format:w.format,name:w.name.trim(),destination:w.destination.trim()||".",paths:JSON.stringify(w.entries.map((T)=>T.path))})},submitExtract:()=>{let w=y;if(!w)return;k.current="extract",C(null),A({actionType:"extract",path:w.archive.path,destination:w.destination.trim()||"."})}}}function xn(t){if(t.shiftKey)return"range";if(t.metaKey||t.ctrlKey)return"toggle";return"plain"}function vn(t,r,l){if(!r)return[l];let c=t.indexOf(r),p=t.indexOf(l);if(c===-1||p===-1)return[l];let f=Math.min(c,p),v=Math.max(c,p);return t.slice(f,v+1)}function _t(t){let[r,l]=n(()=>new Set),[c,p]=n(null),f=a((g,m)=>{if(g==="range"){l(new Set(vn(t,c,m)));return}if(p(m),g==="toggle"){l((C)=>{let k=new Set(C);if(k.has(m))k.delete(m);else k.add(m);return k});return}l(new Set([m]))},[c,t]),v=a((g)=>{l((m)=>{if(m.has(g))return m;return new Set([g])}),p(g)},[]),h=a(()=>{l(new Set),p(null)},[]),y=a(xn,[]);return u(()=>({selected:r,count:r.size,anchor:c,gestureOf:y,applyGesture:f,ensureForContext:v,clear:h}),[r,c,y,f,v,h])}function Ge(t,r,l=0,c=[]){for(let p of t)if(c.push({path:p.path,name:p.name,kind:p.type==="folder"?"folder":"file",depth:l}),p.type==="folder"&&r(p)&&Array.isArray(p.children))Ge(p.children,r,l+1,c);return c}function Wt({listing:t,setExpandedPaths:r,setStoredExpandedPaths:l,reload:c,onMoved:p}){let f=a((y,g)=>{let m=ot(g,y);if(m.length===0)return;r((C)=>{if(m.every((N)=>C.has(N)))return C;let k=new Set(C);for(let N of m)k.add(N);return l(Array.from(k)),k})},[r,l]),v=a((y)=>{let g=t.insertEntry(y);if(!g){c();return}f(y.path,g)},[t,c,f]),h=a((y,g)=>{p?.(y,g),r((C)=>{let k=It(C,y,g);return l(Array.from(k)),k});let m=t.moveEntry(y,g);if(!m){c();return}f(g,m)},[t,c,f,r,l,p]);return{insertCreated:v,moveRenamed:h}}var yn=new Set;function Ut({scope:t,setExpandedPaths:r,setStoredExpandedPaths:l}){let[c,p]=n({scope:t,chains:new Map}),f=a((y)=>{let g=Ae(y.path,y.name);if(!g)return;p((C)=>{let k=C.scope===t?C.chains:new Map;if(k.get(y.path)?.length===g.length)return C;let A=new Map(k);return A.set(y.path,g),{scope:t,chains:A}});let m=g.slice(0,-1);r((C)=>{if(m.every((N)=>C.has(N)))return C;let k=new Set(C);for(let N of m)k.add(N);return l(Array.from(k)),k})},[t,r,l]),v=a((y)=>{let g=c.scope===t?c.chains.get(y):void 0;if(!g)return;let m=g.slice(0,-1);p((C)=>{if(C.scope!==t)return C;let k=new Map(C.chains);return k.delete(y),{scope:t,chains:k}}),r((C)=>{if(!m.some((N)=>C.has(N)))return C;let k=new Set(C);for(let N of m)k.delete(N);return l(Array.from(k)),k})},[t,c,r,l]),h=a((y,g)=>{let m=c.scope===t?c.chains:null;if(!m)return;let C=new Map,k=[],N=!1;for(let[A,F]of m){if(F.findIndex((T,I)=>T===y&&I>0&&I<F.length-1)!==-1){N=!0;continue}let R=F.map((T)=>T===y?g:T.startsWith(`${y}/`)?`${g}${T.slice(y.length)}`:T),w=R[R.length-1];if(w!==A||R.some((T,I)=>T!==F[I]))N=!0;C.set(w,R),k.push(...R.slice(0,-1))}if(!N)return;p({scope:t,chains:C}),r((A)=>{if(k.every((E)=>A.has(E)))return A;let F=new Set(A);for(let E of k)F.add(E);return l(Array.from(F)),F})},[t,c,r,l]);return{unfolded:c.scope===t&&c.chains.size>0?new Set(c.chains.keys()):yn,unfold:f,fold:v,rekey:h}}function Vt(t,r){let l=r.trim().toLowerCase();if(!l)return t;let c=(p)=>{let f=p.name.toLowerCase().includes(l);if(p.type==="folder"){let v=(p.children||[]).map(c).filter((h)=>h!==null);if(f||v.length>0)return{...p,children:f&&v.length===0?p.children:v,forceExpanded:!0};return null}return f?p:null};return t.map(c).filter((p)=>p!==null)}function Xt({dragging:t,clipboard:r,target:l}){let c=Boolean(t)&&r.moveRefusalFor(t,l)===null,[p,f]=n(!1);return o(()=>{if(!t)f(!1)},[t]),{accepts:c,highlighted:p&&c,onDragEnter:()=>{if(t)f(!0)},onDragLeave:(v)=>{if(!v.currentTarget.contains(v.relatedTarget))f(!1)},onDragOver:(v)=>{if(!c)return;if(v.preventDefault(),v.dataTransfer)v.dataTransfer.dropEffect="move"},onDrop:(v)=>{if(!c)return;v.preventDefault(),f(!1),r.move(t,l)}}}function ni({className:t="",enabled:r=!0,active:l=!0,rootPath:c,onOpenFile:p,refreshKey:f=0,onRefresh:v}){let[h,y]=S("files.searchQuery",""),[g,m,C]=S("files.expandedPaths",[]),[k,N]=n(()=>new Set(g)),{activeRepo:A,setActiveRepo:F}=gr(c),{repos:E,scanning:R,rescan:w}=Ar(c,r),{fileMap:T,folderMap:I,refreshGitStatus:_}=el(c,A,r),[ee,te]=n(null),ae=i(null);o(()=>{if(!C)return;N((O)=>{let Z=new Set(g);if(O.size===Z.size&&Array.from(Z).every((me)=>O.has(me)))return O;return Z})},[C,g]);let H=Gt({enabled:r,rootPath:c,activeRepo:A,expandedPaths:k,onExpansionPruned:(O)=>{N(O),m(Array.from(O))}});o(()=>{if(!C||!l)return;H.reload()},[f,c,r,A,C,l]);let P=r&&C?hA(H.scope):null,z=Ie(P);o(()=>{if(z.data)H.adoptRoot(z.data)},[z.data]);let G=(O)=>(_(),H.loadChildren(O)),K=(O,Z)=>{let me=new Set(k);if(Z)me.add(O);else me.delete(O);N(me),m(Array.from(me))},{unfolded:ne,unfold:q,fold:X,rekey:J}=Ut({scope:H.scope,setExpandedPaths:N,setStoredExpandedPaths:m}),ie=H.files,he=rt(ie,ne),Q=Vt(he.nodes,h),fe=Ge(Q,(O)=>O.forceExpanded!==void 0?O.forceExpanded:k.has(O.path)),le=_t(fe.map((O)=>O.path)),xe=fe.filter((O)=>le.selected.has(O.path)).map(({path:O,name:Z,kind:me})=>({path:O,name:Z,kind:me})),M=(O)=>{if(O===A)return;H.reset(),N(new Set),m([]),le.clear(),F(O)},j=()=>{if(_(),v)v();else H.reload()},{insertCreated:ce,moveRenamed:ye}=Wt({listing:H,setExpandedPaths:N,setStoredExpandedPaths:m,reload:j,onMoved:(O,Z)=>J(O,Z)}),be=os(),{pushToast:W}=He(),Y=Kt({rootPath:c,repo:A,onComplete:j,onError:(O)=>W(O,"error")}),ke=jt({rootPath:c,repo:A,onComplete:j}),ve={path:".",name:".",kind:"folder"},de=Y.clip&&!Y.refusalFor(ve)?`Paste ${Ne(Y.clip)??"item"}`:null,[V,ge]=n(null),pe=Xt({dragging:V,clipboard:Y,target:ve}),De=Fe({folderPath:".",rootPath:c,repo:A,onCreated:ce,onOpenCreated:(O)=>p?.({...O,root:c,repo:A})}),[Ke,qt]=n(!1);o(()=>qt(!0),[]);let{count:_e,clear:Ue}=le;if(o(()=>{if(!l)return;let O=(Z)=>{if(Z.key==="Escape"&&_e>0)Ue()};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[l,_e,Ue]),!r)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${t}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});let Bt=H.isLoading||z.refreshing;return e("div",{className:`flex flex-col h-full bg-paper ${t}`,children:[e(Qe,{rootPath:c,activeRepo:A,repos:E,reposScanning:R,onRefreshRepos:w,onSelectRepo:M,searchQuery:h,onSearchChange:y,onRefresh:j,refreshing:Bt}),e("div",{className:`flex-1 scrollbar-overlay-container p-2 font-mono text-[11px] text-ink/80 ${be?"file-tree-touch":""} ${pe.highlighted?"bg-info/[0.06]":""}`,onContextMenu:(O)=>{O.preventDefault(),te({x:O.clientX,y:O.clientY})},onDragEnter:pe.onDragEnter,onDragLeave:pe.onDragLeave,onDragOver:pe.onDragOver,onDrop:pe.onDrop,children:H.isLoading&&Q.length===0?e("div",{className:"p-4 text-center text-ink/40",children:"Loading files..."}):Q.length===0?e("div",{className:"p-4 text-center text-ink/40",children:"No files found"}):Q.map((O)=>e($e,{file:O,rootPath:c,basePath:H.root,repo:A,onLoadChildren:G,onOpenFile:p,onActionComplete:j,onCreated:ce,onRenamed:ye,expandedPaths:k,onToggleFolder:K,gitFileMap:T,gitFolderMap:I,clipboard:Y,archive:ke,selection:le,selectionTargets:xe,dragging:V,onDragStart:ge,onDragEnd:()=>ge(null),onDropOn:(Z)=>{if(!V)return;Y.move(V,Z)},onUnfold:q,onFold:X,foldRoots:he.roots,touch:be},O.path))}),e(Mt,{}),Ke&&e(Tt,{menu:ee,menuRef:ae,pasteLabel:de,busy:Y.busy,create:De,onAction:(O)=>{if(te(null),O==="new_file")De.openDialog("file");if(O==="new_folder")De.openDialog("folder");if(O==="paste")Y.paste(ve)}}),Ke&&e(Et,{archive:ke})]})}export{ni as FileExplorer};
|
|
1
|
+
import{d,n,o,i,u,a,xr,je,oe,e,s,Pn,L,at,B,se,ko,re,Be,We,ii,pn,si,Yr,D,U,b,er,x,hA,Ie,el,S,gr,Ar,bt,st,ue,Ct,td,ct,ut,SA,TA,ns,rs,nd,He,os}from"./index-4cag7w6k.js";import{Ku,Vu,ei,Yu,Ju}from"./index-8g7q8mz4.js";import{kr}from"./index-c9e417cs.js";var Qt={name:"pen",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],aliases:["edit-2"]},Ve=s(Qt);var Yt={name:"copy-plus",size:24,node:[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["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"}]]},Xe=s(Yt);var Jt={name:"package-open",size:24,node:[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]},qe=s(Jt);var Zt={name:"scissors",size:24,node:[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]},Re=s(Zt);function Qe({rootPath:t,activeRepo:r,repos:l,reposScanning:c,onRefreshRepos:p,onSelectRepo:f,searchQuery:v,onSearchChange:h,onRefresh:y,refreshing:g}){return e("div",{className:"border-b border-ink/10",children:[e(bt,{className:"border-b-0",left:e(kr,{rootPath:t,activeRepo:r,onSelectRepo:f,repos:l,scanning:c,onRefreshRepos:p}),right:e(st,{label:"Refresh",onClick:y,busy:g})}),e("div",{className:"px-3 pb-3",children:e("div",{className:"relative",children:[e(U,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/40"}),e("input",{type:"text",placeholder:"Search files...",value:v,onChange:(m)=>h(m.currentTarget.value),className:"w-full bg-canvas border border-ink/20 rounded pl-8 pr-3 py-1.5 text-xs focus:outline-none focus:border-ink transition-colors text-ink placeholder-ink/40"})]})})]})}function Ye({name:t,path:r,isFolder:l,isOpen:c,ignored:p,selected:f,gitStatus:v,folderStatus:h}){let y=f?"text-ink font-semibold":v?v.colorClass:h?h.colorClass:p?"text-ink/40":"";return e(d,{children:[l?c?e(B,{size:12,className:"flex-shrink-0 text-ink/40"}):e(se,{size:12,className:"flex-shrink-0 text-ink/40"}):e("span",{className:"w-3 flex-shrink-0"}),e(ct,{name:t,isFolder:l,isOpen:c,size:12,className:`flex-shrink-0${p?" opacity-40":""}`}),e("span",{className:`truncate min-w-0 flex-1 ${y}`,title:p?`${r} — git-ignored`:void 0,children:t}),v&&e("span",{className:`font-mono text-[10px] font-bold px-1 rounded flex-shrink-0 ${v.colorClass}`,title:`Git: ${v.label}`,children:v.charStatus}),h&&e("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${h.dotClass}`,title:`${h.count} changed file${h.count>1?"s":""}`})]})}var en=28,tn=9,nn=8;function rn(t){let{isFolder:r,hasGitStatus:l,pasteLabel:c,busy:p,chainLabel:f,foldable:v,selectionCount:h,isArchive:y}=t,g=[],m=h>1,C=h===1?"":` ${h} items`;if(m)return g.push({kind:"item",id:"cut",label:`Cut${C}`,icon:e(Re,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"item",id:"copy",label:`Copy${C}`,icon:e(re,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"separator"}),g.push({kind:"item",id:"compress",label:`Compress${C} to…`,icon:e(at,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"separator"}),g.push({kind:"item",id:"delete",label:`Delete${C}`,icon:e(L,{size:13,className:"text-error"}),tone:"text-error"}),g;if(r){if(g.push({kind:"item",id:"new_file",label:"New File",icon:e(ii,{size:13,className:"text-ink/60"})}),g.push({kind:"item",id:"new_folder",label:"New Folder",icon:e(pn,{size:13,className:"text-ink/60"})}),f)g.push({kind:"item",id:"unfold",label:"Unfold Folders",icon:e(B,{size:13,className:"text-ink/60"})});if(v)g.push({kind:"item",id:"fold",label:"Fold Folders",icon:e(se,{size:13,className:"text-ink/60"})});g.push({kind:"separator"})}else{if(g.push({kind:"item",id:"view",label:"View",icon:e(We,{size:13,className:"text-ink/60"})}),y)g.push({kind:"item",id:"extract",label:"Extract…",icon:e(qe,{size:13,className:"text-ink/60"}),disabled:p});if(l)g.push({kind:"item",id:"diff",label:"Open in Diff Panel",icon:e(si,{size:13,className:"text-warning"}),tone:"font-medium"});g.push({kind:"separator"})}if(g.push({kind:"item",id:"cut",label:"Cut",icon:e(Re,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"item",id:"copy",label:"Copy",icon:e(re,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"item",id:"compress",label:"Compress to…",icon:e(at,{size:13,className:"text-ink/60"}),disabled:p}),g.push({kind:"item",id:"duplicate",label:"Duplicate",icon:e(Xe,{size:13,className:"text-ink/60"}),disabled:p}),c)g.push({kind:"item",id:"paste",label:c,icon:e(ko,{size:13,className:"text-ink/60"}),disabled:p});return g.push({kind:"separator"}),g.push({kind:"item",id:"explorer",label:"Go to Explorer",icon:e(Be,{size:13,className:"text-ink/60"})}),g.push({kind:"item",id:"copy_path",label:"Copy Path",icon:e(re,{size:13,className:"text-ink/60"})}),g.push({kind:"item",id:"copy_relative",label:"Copy Relative Path",icon:e(re,{size:13,className:"text-ink/60"})}),g.push({kind:"separator"}),g.push({kind:"item",id:"history",label:"Show Git History",icon:e(Pn,{size:13,className:"text-ink/60"})}),g.push({kind:"separator"}),g.push({kind:"item",id:"rename",label:"Rename",icon:e(Ve,{size:13,className:"text-ink/60"})}),g.push({kind:"item",id:"delete",label:"Delete",icon:e(L,{size:13,className:"text-error"}),tone:"text-error"}),g}function on(t){let r=t.filter((c)=>c.kind==="item").length,l=t.length-r;return r*en+l*tn+nn}function Je({x:t,y:r,isFolder:l,hasGitStatus:c,pasteLabel:p,chainLabel:f,foldable:v,busy:h,selectionCount:y,isArchive:g,onAction:m,menuRef:C}){let N=rn({isFolder:l,hasGitStatus:c,pasteLabel:p,busy:h,chainLabel:f,foldable:v,selectionCount:y,isArchive:g}),A=on(N),F=typeof window<"u"?Math.max(10,Math.min(t,window.innerWidth-210-12)):t,E=typeof window<"u"?Math.max(10,Math.min(r,window.innerHeight-A-12)):r;return oe(e("div",{className:"fixed inset-0 z-50 bg-ink/20",onClick:()=>m("close"),onContextMenu:(R)=>{R.preventDefault(),m("close")},children:e("div",{ref:C,className:"glass-popover fixed z-50 bg-paper border border-ink/15 shadow-2xl rounded-lg py-1 min-w-[185px] text-xs text-ink font-sans",style:{top:E,left:F},onClick:(R)=>R.stopPropagation(),children:N.map((R,w)=>R.kind==="separator"?e("div",{className:"my-1 border-t border-ink/10"},`sep-${w}`):e("button",{type:"button",disabled:R.disabled,onClick:()=>m(R.id),className:`w-full text-left px-3 py-1.5 flex items-center space-x-2 transition-colors ${R.disabled?"opacity-40 cursor-default":"hover:bg-ink/5"} ${R.tone??""}`,children:[R.icon,e("span",{children:R.label})]},R.id))})}),document.body)}function Ce({folderPath:t,kind:r,value:l,error:c,isLoading:p,onChange:f,onCancel:v,onSubmit:h}){let y=r==="folder"?"Folder":"File";return oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("form",{onSubmit:h,className:"glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[e("h3",{className:"font-semibold text-ink mb-3 text-sm",children:["New ",y]}),e("div",{className:"flex items-center gap-1 mb-1 text-xs font-mono text-ink/50 min-w-0",children:e("span",{className:"truncate",title:t,children:[t||".","/"]})}),e("input",{autoFocus:!0,type:"text",value:l,onChange:(g)=>f(g.currentTarget.value),placeholder:r==="folder"?"folder name or nested/path":"file name or nested/path","aria-label":`New ${y.toLowerCase()} name`,className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none mb-1 ${c?"border-error":"border-ink/20 focus:border-ink"}`}),e("p",{className:"text-[10px] text-ink/40 mb-2",children:["Nested paths create the folders they need — ",e("span",{className:"font-mono",children:"lib/parse.ts"}),"."]}),c&&e("p",{className:"text-[11px] text-error mb-2",children:c}),e("div",{className:"flex justify-end space-x-2 mt-2",children:[e("button",{type:"button",onClick:v,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:p,children:"Cancel"}),e("button",{type:"submit",className:"px-3 py-1.5 text-xs bg-ink text-canvas rounded hover:bg-ink/90 transition-colors flex items-center",disabled:p||!l.trim(),children:p?"Creating...":"Create"})]})]})}),document.body)}function Ze({fileName:t,displayName:r,isFolder:l,count:c=1,isLoading:p,onCancel:f,onConfirm:v}){let h=c>1;return oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("div",{className:"glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[e("h3",{className:"font-semibold text-ink mb-2 text-sm",children:["Delete ",h?`${c} Items`:l?"Folder":"File"]}),e("p",{className:"text-xs text-ink/70 mb-4",children:["Are you sure you want to delete ",h?e(d,{children:["the ",c," selected entries"]}):e("span",{className:"font-mono bg-canvas px-1 rounded",children:t}),"? This action cannot be undone."]}),r&&r!==t&&e("p",{className:"text-[11px] text-ink/50 mb-4",children:["The row is ",e("span",{className:"font-mono",children:r}),"; this deletes"," ",e("span",{className:"font-mono",children:t})," only."]}),e("div",{className:"flex justify-end space-x-2",children:[e("button",{onClick:f,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:p,children:"Cancel"}),e("button",{onClick:v,className:"px-3 py-1.5 text-xs bg-error text-white rounded hover:bg-error/90 transition-colors flex items-center",disabled:p,children:p?"Deleting...":"Delete"})]})]})}),document.body)}function et({isFolder:t,renameValue:r,originalPath:l,displayName:c,error:p,isLoading:f,onChange:v,onCancel:h,onSubmit:y}){return oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("form",{onSubmit:y,className:"glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[e("h3",{className:"font-semibold text-ink mb-3 text-sm",children:["Rename ",t?"Folder":"File"]}),e("input",{autoFocus:!0,type:"text",value:r,onChange:(g)=>v(g.currentTarget.value),"aria-label":`Rename ${t?"folder":"file"} path`,className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none mb-1 ${p?"border-error":"border-ink/20 focus:border-ink"}`}),e("p",{className:"text-[10px] text-ink/40 mb-2",children:["Paths are relative to the tree — ",e("span",{className:"font-mono",children:"lib/deep/name.ts"})," moves it too."]}),c&&e("p",{className:"text-[11px] text-ink/50 mb-2",children:["The row is ",e("span",{className:"font-mono",children:c}),"; this renames"," ",e("span",{className:"font-mono",children:l}),". Use"," ",e("span",{className:"font-mono",children:"Unfold Folders"})," to rename a folder inside the chain."]}),p&&e("p",{className:"text-[11px] text-error mb-2",children:p}),e("div",{className:"flex justify-end space-x-2",children:[e("button",{type:"button",onClick:h,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:f,children:"Cancel"}),e("button",{type:"submit",className:"px-3 py-1.5 text-xs bg-ink text-canvas rounded hover:bg-ink/90 transition-colors flex items-center",disabled:f||!r.trim()||r===l,children:f?"Renaming...":"Rename"})]})]})}),document.body)}function tt({filePath:t,fetcherState:r,fetcherData:l,onClose:c}){let p=l?.type==="history"?l.data:void 0;return oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("div",{className:"glass-overlay bg-paper rounded-lg shadow-xl w-full max-w-4xl border border-ink/10 flex flex-col max-h-[85vh]",children:[e("div",{className:"flex items-center justify-between p-4 border-b border-ink/10",children:[e("h3",{className:"text-sm font-semibold text-ink flex items-center space-x-2",children:[e(Pn,{size:16,className:"text-ink/60"}),e("span",{children:["Git History: ",e("span",{className:"font-mono font-normal opacity-80",children:t})]})]}),e("button",{onClick:c,className:"p-1 hover:bg-ink/5 rounded text-ink/60 transition-colors",children:e(b,{size:14})})]}),e("div",{className:"flex-1 scrollbar-overlay-container p-2",children:r==="idle"?p?p.length>0?e("table",{className:"w-full text-left border-collapse text-[11px]",children:[e("thead",{className:"bg-canvas sticky top-0 z-10 border-b border-ink/10",children:e("tr",{children:[e("th",{className:"px-3 py-2 font-semibold text-ink/70 rounded-tl",children:"Description"}),e("th",{className:"px-3 py-2 font-semibold text-ink/70 w-32",children:"Date"}),e("th",{className:"px-3 py-2 font-semibold text-ink/70 w-32",children:"Author"}),e("th",{className:"px-3 py-2 font-semibold text-ink/70 w-24 text-right rounded-tr",children:"Commit"})]})}),e("tbody",{className:"divide-y divide-ink/5",children:p.map((f,v)=>e("tr",{className:"hover:bg-ink/[0.03] transition-colors group",children:[e("td",{className:"px-3 py-2 text-ink",children:f.message?e("span",{className:"font-medium text-ink/90 group-hover:text-ink",children:f.message}):null}),e("td",{className:"px-3 py-2 text-ink/60 whitespace-nowrap font-mono text-[10.5px]",children:f.time}),e("td",{className:"px-3 py-2 text-ink/70 whitespace-nowrap truncate max-w-[120px]",children:f.author}),e("td",{className:"px-3 py-2 text-right",children:f.hash?e("span",{className:"font-mono text-ink/50 group-hover:text-ink font-semibold transition-colors bg-canvas px-1.5 py-0.5 rounded border border-ink/10",children:f.hash}):null})]},v))})]}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs",children:"No commit history found for this file."}):l?.error?e("div",{className:"p-8 text-center text-error font-mono text-xs",children:l.error}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs",children:"Loading history..."}):e("div",{className:"p-8 text-center text-ink/40 font-mono text-xs flex items-center justify-center space-x-2",children:[e(D,{size:14,className:"animate-spin"}),e("span",{children:"Loading history..."})]})})]})}),document.body)}function nt({actions:t,file:r,isFolder:l,chainLabel:c}){let p=t.selectionCount;return e(d,{children:[t.showCreateModal&&e(Ce,{folderPath:r.path,kind:t.createKind,value:t.createName,error:t.createError,isLoading:t.busy,onChange:t.setCreateName,onCancel:t.closeCreate,onSubmit:t.submitCreate}),t.showDeleteModal&&e(Ze,{fileName:r.path,displayName:p>1?void 0:c,isFolder:l,count:p,isLoading:t.busy,onCancel:t.closeDelete,onConfirm:t.submitDelete}),t.showRenameModal&&e(et,{isFolder:l,renameValue:t.renameValue,originalPath:r.path,displayName:l?c:void 0,error:t.renameError,isLoading:t.busy,onChange:t.setRenameValue,onCancel:t.closeRename,onSubmit:t.submitRename}),t.showHistoryModal&&e(tt,{filePath:r.path,fetcherState:t.fetcherState,fetcherData:t.fetcherData,onClose:t.closeHistory})]})}function Se(t){let r=t.map(sn);return r.some((l,c)=>l!==t[c])?r:t}function sn(t){if(t.type!=="folder"||!Array.isArray(t.children))return t;let r=Se(t.children),l=r===t.children?t:{...t,children:r};while(Array.isArray(l.children)&&l.children.length===1){let c=l.children[0];if(c.type!=="folder")break;l={...l,name:`${l.name}/${c.name}`,path:c.path,children:c.children,ignored:c.ignored??l.ignored}}return l}function Te(t){return t.type==="folder"&&t.name.includes("/")}function Ae(t,r){let l=r.split("/"),c=t.split("/");if(l.length<2||l.length>c.length||l.some((f)=>!f))return null;let p=c.slice(0,c.length-l.length);return l.map((f,v)=>[...p,...l.slice(0,v+1)].join("/"))}function rt(t,r){let l=new Map;if(r.size===0)return{nodes:t,roots:l};let c=!1,p=(v)=>v.flatMap((h)=>{if(h.type!=="folder")return[h];let y=Array.isArray(h.children)?p(h.children):h.children,g=y===h.children?h:{...h,children:y},m=r.has(h.path)?Ae(h.path,h.name):null;if(!m)return[g];c=!0,l.set(m[0],h.path);let C={...g,name:m[m.length-1].split("/").pop()};for(let k=m.length-1;k>0;k-=1){let N=m[k-1];C={name:N.split("/").pop(),path:N,type:"folder",ignored:g.ignored,children:[C]}}return[C]}),f=p(t);return{nodes:c?f:t,roots:l}}function ot(t,r){let l=new Set,c=(v)=>{for(let h of v){if(h.type!=="folder")continue;if(l.add(h.path),Array.isArray(h.children))c(h.children)}};c(t);let p=r.split("/").slice(0,-1),f=[];for(let v=0;v<p.length;v+=1){let h=p.slice(0,v+1).join("/");if(l.has(h))f.push(h)}return f}function Fe({folderPath:t,rootPath:r,repo:l,onCreated:c,onOpenCreated:p}){let f=ut(),[v,h]=n(!1),[y,g]=n("file"),[m,C]=n(""),[k,N]=n(null),A=i(null);return o(()=>{if(f.state!=="idle"||!f.data)return;let F=f.data;if(A.current===F)return;if(A.current=F,F.success&&F.path){let E=F.kind==="folder"?"folder":"file";h(!1),C(""),N(null);let R=F.path.split("/").pop()||F.path;if(c({path:F.path,name:R,kind:E}),E==="file")p?.({path:F.path,name:R})}else N(F.error||`Could not create the ${y}`)},[f.state,f.data]),{open:v,kind:y,name:m,setName:C,error:k,busy:f.state!=="idle",openDialog:(F="file")=>{g(F),C(""),N(null),h(!0)},closeDialog:()=>h(!1),submit:(F)=>{F.preventDefault();let E=m.trim();if(!E)return;N(null);let R=new FormData;if(R.append("actionType","create"),R.append("path",t),R.append("name",E),y==="folder")R.append("kind","folder");if(l&&l!==".")R.append("repo",l);if(r)R.append("root",r);f.submit(R,{method:"post",action:"/api/fs/action"})}}}function Ne(t){if(!t)return null;if(t.entries.length===1)return t.entries[0].name;return`${t.entries.length} items`}function it(t,r){return`${t??""}\x00${r}`}function Ee(t,r){if(r==="folder")return t;let l=t.lastIndexOf("/");return l===-1?".":t.slice(0,l)}function lt(t){let r=t.lastIndexOf("/");return r===-1?".":t.slice(0,r)}function dt(t,r){if(t.path===""||t.path===".")return"The workspace root cannot be moved or copied";if(t.kind==="folder"&&(r===t.path||r.startsWith(`${t.path}/`)))return"Cannot paste a folder into itself";return null}function pt(t,r){let l=dt(t,r);if(l)return l;if(r===lt(t.path))return"Already in this folder";return null}function ft(t,r,l){if(!t||t.entries.length===0)return"Nothing to paste";if(t.scope!==r)return"The clipboard holds an entry from another workspace";if(t.mode==="cut"&&t.entries.some((c)=>l===lt(c.path)))return"Already in this folder";for(let c of t.entries){let p=dt(c,l);if(p)return p}return null}function mt(t){if(typeof t!=="object"||t===null)return null;let r=t;if(typeof r.scope!=="string")return null;if(r.mode!=="copy"&&r.mode!=="cut")return null;let l=Array.isArray(r.entries)?r.entries:typeof r.path==="string"?[{path:r.path,name:r.name,kind:r.kind}]:[],c=[];for(let p of l){let f=an(p);if(!f)return null;c.push(f)}if(c.length===0)return null;return{scope:r.scope,entries:c,mode:r.mode}}function an(t){if(typeof t!=="object"||t===null)return null;let r=t;if(typeof r.path!=="string"||typeof r.name!=="string")return null;if(r.kind!=="file"&&r.kind!=="folder")return null;let l=r.path.split("/");if(r.path===""||r.path.startsWith("/")||l.some((c)=>c===""||c==="."||c===".."))return null;return{path:r.path,name:r.name,kind:r.kind}}var Me=[{id:"zip",label:"ZIP",extension:"zip"},{id:"7z",label:"7Z",extension:"7z"},{id:"rar",label:"RAR",extension:"rar"},{id:"tar",label:"TAR",extension:"tar"},{id:"tar.gz",label:"TAR.GZ",extension:"tar.gz"}],ht=[[".tar.gz","tar.gz"],[".tar.bz2","tar.bz2"],[".tar.xz","tar.xz"],[".tgz","tar.gz"],[".tbz2","tar.bz2"],[".txz","tar.xz"],[".tar","tar"],[".zip","zip"],[".7z","7z"],[".rar","rar"],[".gz","gz"],[".bz2","bz2"],[".xz","xz"]];function Le(t){let r=t.toLowerCase();for(let[l,c]of ht)if(r.endsWith(l))return c;return null}function gt(t){return Le(t)!==null}function ln(t){return Me.find((r)=>r.id===t)}function cn(t){return ln(t)?.extension??"zip"}function xt(t){let r=t.toLowerCase();for(let[l]of ht)if(r.endsWith(l))return t.slice(0,-l.length);return t}function vt(t){let r=t.lastIndexOf("/");return r===-1?".":t.slice(0,r)||"."}function yt(t){let r=t.lastIndexOf("/");return r===-1?t:t.slice(r+1)}function kt(t){if(t.length===0)return".";let r=t.map((c)=>vt(c).split("/").filter((p)=>p!==".")),l=r[0]??[];for(let c of r.slice(1)){let p=0;while(p<l.length&&p<c.length&&l[p]===c[p])p+=1;l=l.slice(0,p)}return l.length===0?".":l.join("/")}function we(t,r){let l=cn(r);if(t.length===1){let f=t[0],v=xt(f.name),h=v.lastIndexOf(".");return`${(f.kind==="folder"?f.name:h>0?v.slice(0,h):v)||"archive"}.${l}`}let c=kt(t.map((f)=>f.path)),p=yt(c);return`${p==="."||p===""?"archive":p}.${l}`}function Ft(t){return kt(t.map((r)=>r.path))}function Nt(t){let r=vt(t),l=xt(yt(t));if(!l)return r;return r==="."?l:`${r}/${l}`}function wt(t){return t.toUpperCase()}function Dt({file:t,diff:r,onOpenFile:l,onActionComplete:c,onCreated:p,onRenamed:f,onUnfold:v,onFold:h,clipboard:y,isFolder:g,selection:m,selected:C,archive:k}){let N=ut(),[A,F]=n(null),E=i(null),[R,w]=n(!1),[T,I]=n(!1),[_,ee]=n(!1),[te,ae]=n(t.path),[H,P]=n(null),{repo:z,rootPath:G}=t,K=Fe({folderPath:t.path,rootPath:G,repo:z,onCreated:(M)=>p?p(M):c(),onOpenCreated:(M)=>l?.({...M,root:G,repo:z||"."})}),ne=i(null);o(()=>{if(N.state!=="idle"||!N.data)return;let M=N.data;if(ne.current===M)return;if(ne.current=M,M.success&&!M.type)if(w(!1),I(!1),P(null),M.previousPath&&M.path&&f)f(M.previousPath,M.path);else c();else if(!M.success&&M.error&&R)P(M.error)},[N.state,N.data]);let q=(M)=>{if(z&&z!==".")M.append("repo",z);if(G)M.append("root",G);N.submit(M,{method:"post",action:"/api/fs/action"})},X=()=>{l?.({path:t.path,name:t.name,root:G,repo:z||"."})},J={path:t.path,name:t.name,kind:g?"folder":"file"},ie=C&&m.length>1?m:[J],he=gt(t.name),Q=y.clip&&!y.refusalFor(J)?`Paste ${Ne(y.clip)??"item"}`:null,fe=(M)=>{if(F(null),P(null),M==="view")X();else if(M==="diff")window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.path,staged:r?.staged,status:r?.status||"M",repo:z||".",root:G}}));else if(M==="explorer"){let j=new FormData;j.append("actionType","open_explorer"),j.append("path",t.path),q(j)}else if(M==="copy_path")Ct(td(t.basePath,t.path));else if(M==="copy_relative")Ct(t.path);else if(M==="history"){ee(!0);let j=new FormData;j.append("actionType","git_history"),j.append("path",t.path),q(j)}else if(M==="rename")ae(t.path),w(!0);else if(M==="unfold")v?.();else if(M==="fold")h?.();else if(M==="new_file")K.openDialog("file");else if(M==="new_folder")K.openDialog("folder");else if(M==="delete")I(!0);else if(M==="cut")y.cut(ie);else if(M==="copy")y.copy(ie);else if(M==="compress")k.openCompress(ie);else if(M==="extract")k.openExtract(J);else if(M==="duplicate")y.duplicate(J);else if(M==="paste")y.paste(J)},le=(M)=>{M.preventDefault(),P(null);let j=new FormData;j.append("actionType","rename"),j.append("path",t.path),j.append("newPath",te),q(j)},xe=()=>{let M=new FormData;if(M.append("actionType","delete"),ie.length>1)M.append("paths",JSON.stringify(ie.map((j)=>j.path)));else M.append("path",t.path);q(M)};return{contextMenu:A,contextMenuRef:E,openContextMenu:(M,j)=>F({x:M,y:j}),closeContextMenu:()=>F(null),showRenameModal:R,showDeleteModal:T,showHistoryModal:_,showCreateModal:K.open,createKind:K.kind,createError:K.error,createName:K.name,setCreateName:K.setName,renameValue:te,setRenameValue:ae,renameError:H,busy:N.state!=="idle"||K.busy||y.busy||k.busy,pasteLabel:Q,selectionCount:ie.length,isArchive:he,chainLabel:v!==void 0,foldable:h!==void 0,fetcherState:N.state,fetcherData:N.data,handleAction:fe,submitCreate:K.submit,submitRename:le,submitDelete:xe,closeCreate:K.closeDialog,closeDelete:()=>I(!1),closeRename:()=>w(!1),closeHistory:()=>ee(!1)}}function Rt({target:t,dragging:r,clipboard:l,onDragStart:c,onDragEnd:p,onDropOn:f,onHoverAccept:v}){let h=r?.path===t.path,y=Boolean(r)&&!h&&l.moveRefusalFor(r,t)===null,[g,m]=n(!1);return o(()=>{if(!r)m(!1)},[r]),{isDragging:h,acceptsDrop:y,isDropHovered:g&&y,onDragStart:(k)=>{if(k.dataTransfer?.setData("text/plain",t.path),k.dataTransfer)k.dataTransfer.effectAllowed="move";c(t)},onDragEnd:p,onDragOver:(k)=>{if(!r)return;if(k.stopPropagation(),m(y),!y)return;if(k.preventDefault(),k.dataTransfer)k.dataTransfer.dropEffect="move";v?.(t)},onDragLeave:()=>m(!1),onDrop:(k)=>{if(!r)return;if(k.stopPropagation(),!y)return;k.preventDefault(),f(t)}}}function dn(t,r,l){if(r||l)return!1;return!Array.isArray(t.children)}function $e({file:t,rootPath:r,basePath:l,repo:c,onLoadChildren:p,onOpenFile:f,onActionComplete:v,onCreated:h,onRenamed:y,expandedPaths:g,onToggleFolder:m,gitFileMap:C,gitFolderMap:k,clipboard:N,archive:A,selection:F,selectionTargets:E,dragging:R,onDragStart:w,onDragEnd:T,onDropOn:I,onUnfold:_,onFold:ee,foldRoots:te,touch:ae=!1}){let H=t.type==="folder",[P,z]=n(!1),[G,K]=n(!1),[ne,q]=n(!1),[X,J]=n(!1),ie=Array.isArray(t.children)?t.children:[],he=(t.path||"").replace(/^\/+/,""),Q=!H?C?.get(he)||C?.get(t.path):void 0,fe=Q?er(Q.status,Q.staged):null,le=H?k?.get(he)||k?.get(t.path):null,xe=Boolean(fe),M=t.ignored===!0,j=g?g.has(t.path):P,ce=t.forceExpanded!==void 0?t.forceExpanded:j;o(()=>{J(!0)},[]),o(()=>{if(H&&g)z(g.has(t.path))},[g,t.path,H]),o(()=>{if(H&&ce&&dn(t,G,ne)&&p)q(!0),K(!0),Promise.resolve(p(t.path)).finally(()=>K(!1))},[H,ce,t.children,t.path,p,G,ne]);let ye={path:t.path,name:t.name,kind:H?"folder":"file"},be=F.selected.has(t.path),W=Dt({file:{path:t.path,name:t.name,basePath:l,rootPath:r,repo:c},selection:E,selected:be,archive:A,diff:{staged:Q?.staged||(Q?.status?Q.status[0]!==" "&&Q.status[0]!=="?":!1),status:fe?.charStatus},onOpenFile:f,onActionComplete:v,onCreated:h,onRenamed:y,onUnfold:_&&Te({type:H?"folder":"file",name:t.name})?()=>_(ye):void 0,onFold:ee&&te?.has(t.path)?()=>ee(te.get(t.path)):void 0,clipboard:N,isFolder:H});ue(W.contextMenuRef,W.closeContextMenu);let Y=Ku({enabled:ae,onLongPress:(V,ge)=>W.openContextMenu(V,ge)}),ke=(V)=>{if(V.stopPropagation(),Y.consume())return;let ge=F.gestureOf(V);if(ge!=="plain"){F.applyGesture(ge,t.path);return}if(F.applyGesture("plain",t.path),H){let pe=!ce;if(z(pe),t.forceExpanded!==void 0)t.forceExpanded=void 0;if(m?.(t.path,pe),!pe)q(!1)}else if(f)f({...t,root:r,repo:c||"."})},ve=(V)=>{V.preventDefault(),V.stopPropagation(),F.ensureForContext(t.path),W.openContextMenu(V.clientX,V.clientY)},de=Rt({target:ye,dragging:R,clipboard:N,onDragStart:w,onDragEnd:T,onDropOn:I,onHoverAccept:_});return e("div",{children:[e("div",{className:`flex items-center space-x-1.5 py-1 px-2 cursor-pointer rounded group select-none ${de.isDragging?"opacity-40":""} ${de.isDropHovered?"bg-info/10 ring-1 ring-info/40 ring-inset":be?"bg-ink/[0.08] ring-1 ring-ink/20 ring-inset":"hover:bg-ink/5"}`,draggable:!ae,onClick:ke,onContextMenu:ve,onDragStart:de.onDragStart,onDragEnd:de.onDragEnd,onDragOver:de.onDragOver,onDragLeave:de.onDragLeave,onDrop:de.onDrop,onTouchStart:Y.onTouchStart,onTouchMove:Y.onTouchMove,onTouchEnd:Y.onTouchEnd,onTouchCancel:Y.onTouchCancel,children:e(Ye,{name:t.name,path:t.path,isFolder:H,isOpen:ce,ignored:M,selected:be,gitStatus:fe,folderStatus:le})}),ce&&G&&e("div",{className:"ml-3 border-l border-ink/10 pl-3 py-0.5 text-[10px] text-ink/30",children:"Loading…"}),ce&&!G&&ie.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:ie.map((V)=>e($e,{file:V,rootPath:r,basePath:l,repo:c,onLoadChildren:p,onOpenFile:f,onActionComplete:v,onCreated:h,onRenamed:y,expandedPaths:g,onToggleFolder:m,gitFileMap:C,gitFolderMap:k,clipboard:N,archive:A,selection:F,selectionTargets:E,dragging:R,onDragStart:w,onDragEnd:T,onDropOn:I,onUnfold:_,onFold:ee,foldRoots:te,touch:ae},V.path))}),X&&W.contextMenu&&e(Je,{x:W.contextMenu.x,y:W.contextMenu.y,isFolder:H,hasGitStatus:xe,pasteLabel:W.pasteLabel,chainLabel:W.chainLabel,foldable:W.foldable,busy:W.busy,selectionCount:W.selectionCount,isArchive:W.isArchive,onAction:W.handleAction}),X&&e(nt,{actions:W,file:t,isFolder:H,chainLabel:Te({type:H?"folder":"file",name:t.name})?t.name:void 0})]})}function St({x:t,y:r,pasteLabel:l,busy:c,onAction:p,menuRef:f}){let h=l?104:76,y=typeof window<"u"?Math.max(10,Math.min(t,window.innerWidth-190-12)):t,g=typeof window<"u"?Math.max(10,Math.min(r,window.innerHeight-h-12)):r;return oe(e("div",{className:"fixed inset-0 z-50 bg-ink/20",onClick:()=>p("close"),onContextMenu:(m)=>{m.preventDefault(),p("close")},children:e("div",{ref:f,className:"glass-popover fixed z-50 bg-paper border border-ink/15 shadow-2xl rounded-lg py-1 min-w-[185px] text-xs text-ink font-sans",style:{top:g,left:y},onClick:(m)=>m.stopPropagation(),children:[e("button",{type:"button",onClick:()=>p("new_file"),className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 flex items-center space-x-2 transition-colors",children:[e(ii,{size:13,className:"text-ink/60"}),e("span",{children:"New File"})]}),e("button",{type:"button",onClick:()=>p("new_folder"),className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 flex items-center space-x-2 transition-colors",children:[e(pn,{size:13,className:"text-ink/60"}),e("span",{children:"New Folder"})]}),l&&e("button",{type:"button",disabled:c,onClick:()=>p("paste"),className:`w-full text-left px-3 py-1.5 flex items-center space-x-2 transition-colors ${c?"opacity-40 cursor-default":"hover:bg-ink/5"}`,children:[e(ko,{size:13,className:"text-ink/60"}),e("span",{children:l})]})]})}),document.body)}function Tt({menu:t,menuRef:r,pasteLabel:l,busy:c,onAction:p,create:f}){return e(d,{children:[t&&e(St,{x:t.x,y:t.y,menuRef:r,pasteLabel:l,busy:c,onAction:p}),f.open&&e(Ce,{folderPath:".",kind:f.kind,value:f.name,error:f.error,isLoading:f.busy,onChange:f.setName,onCancel:f.closeDialog,onSubmit:f.submit})]})}function At({title:t,subject:r,error:l,busy:c,submitLabel:p,busyLabel:f,onSubmit:v,onCancel:h,children:y}){return oe(e("div",{className:"fixed inset-0 modal-scrim z-[100] flex items-center justify-center modal-safe backdrop-blur-sm",children:e("form",{onSubmit:v,className:"glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[e("h3",{className:"font-semibold text-ink mb-1 text-sm",children:t}),e("p",{className:"text-[11px] text-ink/50 mb-3 break-words",children:r}),y,l&&e("p",{className:"text-[11px] text-error mb-2",children:l}),e("div",{className:"flex justify-end space-x-2 mt-3",children:[e("button",{type:"button",onClick:h,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:c,children:"Cancel"}),e("button",{type:"submit",className:"px-3 py-1.5 text-xs bg-ink text-canvas rounded hover:bg-ink/90 transition-colors flex items-center",disabled:c,children:c?f:p})]})]})}),document.body)}function un({entries:t,format:r,name:l,destination:c,formats:p,error:f,busy:v,onFormatChange:h,onNameChange:y,onDestinationChange:g,onCancel:m,onSubmit:C}){let k=t.slice(0,4).map((A)=>A.name).join(", "),N=t.length>4?` +${t.length-4} more`:"";return e(At,{title:`Compress ${t.length===1?t[0].name:`${t.length} items`}`,subject:`${k}${N}`,error:f,busy:v,submitLabel:"Compress",busyLabel:"Compressing...",onCancel:m,onSubmit:(A)=>{A.preventDefault(),C()},children:[e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",htmlFor:"archive-format",children:"Format"}),e("select",{id:"archive-format",value:r,onChange:(A)=>h(A.currentTarget.value),className:"w-full bg-paper border border-ink/20 rounded px-2 py-1.5 text-xs font-mono focus:outline-none focus:border-ink mb-3",children:p.map((A)=>e("option",{value:A.id,disabled:!A.available,children:[A.label,A.available?"":` — ${A.tool} not installed`]},A.id))}),e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",htmlFor:"archive-name",children:"Archive name"}),e("input",{id:"archive-name",autoFocus:!0,type:"text",value:l,onChange:(A)=>y(A.currentTarget.value),"aria-label":"Archive name",className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none mb-3 ${f?"border-error":"border-ink/20 focus:border-ink"}`}),e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",htmlFor:"archive-destination",children:"Destination folder"}),e("input",{id:"archive-destination",type:"text",value:c,onChange:(A)=>g(A.currentTarget.value),"aria-label":"Archive destination",className:"w-full bg-paper border border-ink/20 rounded px-2 py-1.5 text-xs font-mono focus:outline-none focus:border-ink"})]})}function fn({archive:t,kindLabel:r,destination:l,error:c,busy:p,onDestinationChange:f,onCancel:v,onSubmit:h}){return e(At,{title:`Extract ${t.name}`,subject:`${r} archive · extracts into a folder`,error:c,busy:p,submitLabel:"Extract",busyLabel:"Extracting...",onCancel:v,onSubmit:(y)=>{y.preventDefault(),h()},children:[e("label",{className:"block text-[10px] uppercase tracking-wide text-ink/40 mb-1",htmlFor:"extract-destination",children:"Extract to folder"}),e("input",{id:"extract-destination",autoFocus:!0,type:"text",value:l,onChange:(y)=>f(y.currentTarget.value),"aria-label":"Extract destination",className:`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none ${c?"border-error":"border-ink/20 focus:border-ink"}`})]})}function Et({archive:t}){if(t.compress)return e(un,{entries:t.compress.entries,format:t.compress.format,name:t.compress.name,destination:t.compress.destination,formats:t.formats,error:t.error,busy:t.busy,onFormatChange:t.setFormat,onNameChange:t.setName,onDestinationChange:t.setCompressDestination,onCancel:t.cancel,onSubmit:t.submitCompress});if(t.extract)return e(fn,{archive:t.extract.archive,kindLabel:wt(Le(t.extract.archive.name)??"zip"),destination:t.extract.destination,error:t.error,busy:t.busy,onDestinationChange:t.setExtractDestination,onCancel:t.cancel,onSubmit:t.submitExtract});return null}function Mt(){let[t,r]=S("files.outlineExpanded",!1),l=xr(),c=je(TA,SA),{symbols:p,total:f,truncated:v,notice:h}=Ju({content:c.content,language:c.language,state:c.state,note:c.note,path:c.path});if(c.state==="diff")return null;let y=c.preview,g=(m,C)=>{if(!c.path)return;if(y){let k=nd(p,C);if(k)rs({path:c.path,...k});return}ns({path:c.path,line:m.line,column:m.column,length:m.name.length})};return e("div",{className:"border-t border-ink/10 bg-canvas/30 flex-shrink-0",children:[e("div",{className:"flex items-center hover:bg-ink/5 transition-colors",children:e("button",{type:"button",onClick:()=>r(!t),"aria-expanded":t,"aria-controls":l,"aria-label":"Outline",title:t?"Hide outline":"Show outline",className:"flex flex-1 min-w-0 items-center space-x-1 py-1.5 pl-3 pr-2 text-left font-semibold text-xs text-ink transition-colors cursor-pointer",children:[e("span",{className:"w-3 text-center font-mono","aria-hidden":"true",children:t?"▾":"▸"}),e(Yr,{size:12}),e("span",{children:"Outline"}),f>0&&e("span",{className:"font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] text-ink/50",children:v?`${p.length}/${f.toLocaleString()}`:f})]})}),e("div",{className:"section-reveal","data-expanded":t,id:l,inert:!t,children:e("div",{children:e("div",{className:"px-2 pb-2",children:p.length===0?e("div",{className:"px-1 text-[10px] text-ink/40 italic py-1",children:h}):e("div",{className:"max-h-48 overflow-y-auto scrollbar-overlay-container flex flex-col",children:[p.map((m,C)=>e("button",{type:"button",onClick:()=>g(m,C),"aria-label":y?`${ei(m.kind)} ${m.name}`:`${ei(m.kind)} ${m.name}, line ${m.line}`,title:y?`Jump to ${ei(m.kind).toLowerCase()}`:`${ei(m.kind)} · line ${m.line}`,className:"flex w-full min-w-0 items-center gap-1.5 rounded px-1 py-0.5 text-left transition-colors hover:bg-ink/5 active:bg-ink/10",style:{paddingLeft:`${4+m.depth*12}px`},children:[e(Vu,{kind:m.kind}),e("span",{className:"min-w-0 flex-1 truncate text-[11px] font-mono text-ink/80",children:m.name}),!y&&e("span",{className:"flex-shrink-0 font-mono text-[10px] text-ink/35",children:m.line})]},`${m.line}:${m.kind}:${m.name}`)),v&&e("div",{className:"px-1 py-1 text-[10px] italic text-ink/40",children:Yu(f)})]})})})})]})}function ze(t,r){return Se(t.map((l)=>mn(l,r)))}function mn(t,r){if(t.type!=="folder")return t;let l=r[t.path];if(!l)return t;return{...t,children:ze(l,r)}}function hn(t){let r=t.lastIndexOf("/");return r===-1?".":t.slice(0,r)}function $t(t){let r=t.lastIndexOf("/");return r===-1?t:t.slice(r+1)}function Lt(t){return[...t].sort((r,l)=>{if(r.type!==l.type)return r.type==="folder"?-1:1;return r.name.localeCompare(l.name)})}function Oe(t,r,l){let c=l.path.split("/"),p=c.slice(0,-1).join("/"),f=[...t],v={...r},h=f,y=null;for(let g=0;g<c.length-1;){let m=c.slice(0,g+1).join("/"),C=h.find((E)=>E.type==="folder"&&E.path===m),k=C?null:h.find((E)=>E.type==="folder"&&E.path.startsWith(`${m}/`)&&(p===E.path||p.startsWith(`${E.path}/`))),N=C??k,A=N?v[N.path]??N.children:null;if(N&&!Array.isArray(A))return{nodes:t,cache:r};if(!N){let E=gn(h,v,m);if(E){h=E;let R=h.find((T)=>T.path===m),w=Array.isArray(R?.children)?[...R.children]:[];v[m]=w,h=w,y=m,g+=1;continue}}let F=Array.isArray(A)?[...A]:[];if(N){v[N.path]=F,h=F,y=N.path,g=N.path.split("/").length;continue}h.push({name:c[g],path:m,type:"folder",ignored:!1}),v[m]=F,h=F,y=m,g+=1}if(h.push(l),y!==null)v[y]=Lt(h);return f=Lt(f),{nodes:f,cache:v}}function gn(t,r,l){let c=t.findIndex((y)=>y.type==="folder"&&y.path.startsWith(`${l}/`));if(c===-1)return null;let p=t[c],f=p.path.slice(l.length+1).split("/"),v=r[p.path]??p.children;if(Array.isArray(v))r[p.path]=v;let h={name:f[f.length-1],path:p.path,type:"folder",ignored:p.ignored,...Array.isArray(v)?{children:v}:{}};for(let y=f.length-2;y>=0;y-=1)h={name:f[y],path:`${l}/${f.slice(0,y+1).join("/")}`,type:"folder",ignored:!1,children:[h]};return t[c]={name:$t(l),path:l,type:"folder",ignored:!1,children:[h]},t}function zt(t,r,l){let c=t.find((m)=>m.path===l);if(c)return{entry:c,nodes:t.filter((m)=>m.path!==l),cache:r};let p=hn(l),f=r[p],v=f?.find((m)=>m.path===l);if(f&&v)return{entry:v,nodes:t,cache:{...r,[p]:f.filter((m)=>m.path!==l)}};let y=Object.keys(r).filter((m)=>l.startsWith(`${m}/`)&&r[m].some((C)=>C.path===l)).sort((m,C)=>C.length-m.length)[0];if(!y)return{entry:null,nodes:t,cache:r};let g=r[y];return{entry:g.find((m)=>m.path===l),nodes:t,cache:{...r,[y]:g.filter((m)=>m.path!==l)}}}function Ot(t,r,l){let c=!1,p=t.map((f)=>{let v=f.path===r||f.path.startsWith(`${r}/`),h=Array.isArray(f.children)?Ot(f.children,r,l):void 0;if(!v&&h===f.children)return f;c=!0;let y=v?f.path===r?l:`${l}${f.path.slice(r.length)}`:f.path,g=v?{...f,path:y,name:$t(y)}:{...f};if(h!==void 0)g.children=h;return g});return c?p:t}function Pt(t,r,l){let c={};for(let[p,f]of Object.entries(t)){let v=p===r?l:p.startsWith(`${r}/`)?`${l}${p.slice(r.length)}`:p;c[v]=v===p?f:Ot(f,r,l)}return c}function It(t,r,l){let c=new Set;for(let p of t)if(p===r)c.add(l);else if(p.startsWith(`${r}/`))c.add(`${l}${p.slice(r.length)}`);else c.add(p);return c}function Ht(t){if(!x(t))return{status:"missing"};if(typeof t.root!=="string"||t.root==="")return{status:"missing"};return{status:"ok",files:Array.isArray(t.files)?t.files.filter((r)=>x(r)):[],root:t.root}}async function Pe(t){try{return Ht(await(await fetch(t)).json())}catch{return{status:"failed"}}}function Gt({enabled:t,rootPath:r,activeRepo:l,expandedPaths:c,onExpansionPruned:p}){let f=`${r??""}\x00${l}`,[v,h]=n({scope:"",files:[],root:""}),[y,g]=n(!1),m=i({}),C=i([]),k=i(f);k.current=f;let N=i(""),A=i(""),F=i(c);F.current=c;let E=(P)=>{let z=new URLSearchParams;if(r)z.set("root",r);if(l&&l!==".")z.set("repo",l);if(P)z.set("path",P);return z.set("t",String(Date.now())),`/api/fs/dir?${z.toString()}`},R=(P,z)=>{N.current=P,A.current=z;let G=ze(C.current,m.current);return h({scope:P,files:G,root:z}),G},w=async(P)=>{let z=[...F.current];if(z.length===0)return;let G=await Promise.all(z.map(async(X)=>({path:X,read:await Pe(E(X))})));if(k.current!==P)return;let K=[];for(let{path:X,read:J}of G)if(J.status==="ok")m.current[X]=J.files;else if(J.status==="missing")K.push(X);if(K.length===0)return;let ne=new Set(K);for(let X of K)delete m.current[X];let q=new Set([...F.current].filter((X)=>!ne.has(X)));F.current=q,p(q)},T=async()=>{if(!t)return;let P=k.current;g(!0);try{let z=await Pe(E());if(k.current!==P)return;if(z.status!=="ok")return;if(N.current!==P)m.current={};if(C.current=z.files,R(P,z.root),await w(P),k.current!==P)return;R(P,z.root)}finally{if(k.current===P)g(!1)}},I=async(P)=>{let z=k.current,G=await Pe(E(P));if(k.current!==z||G.status!=="ok")return;if(m.current[P]=G.files,N.current===z)R(z,A.current)},_=(P)=>{let z=Ht(P);if(z.status!=="ok")return;let G=k.current;if(N.current!==G)m.current={};C.current=z.files,R(G,z.root),w(G).then(()=>{if(k.current===G)R(G,z.root)})},ee=()=>{m.current={},C.current=[],N.current="",A.current="",h({scope:"",files:[],root:""})},te=(P)=>{let z=k.current;if(N.current!==z)return null;let G={name:P.path.slice(P.path.lastIndexOf("/")+1),path:P.path,type:P.kind,ignored:!1},K=Oe(C.current,m.current,G);if(K.nodes===C.current)return null;return C.current=K.nodes,m.current=K.cache,R(z,A.current)},ae=(P,z)=>{let G=k.current;if(N.current!==G)return null;let K=zt(C.current,m.current,P);if(!K.entry)return null;m.current=Pt(K.cache,P,z);let ne={...K.entry,path:z,name:z.slice(z.lastIndexOf("/")+1)},q=Oe(K.nodes,m.current,ne);return C.current=q.nodes,m.current=q.cache,R(G,A.current)},H=v.scope===f;return{scope:f,files:H?v.files:[],root:H?v.root:"",isLoading:y,reload:T,loadChildren:I,adoptRoot:_,insertEntry:te,moveEntry:ae,reset:ee}}function Kt({rootPath:t,repo:r,onComplete:l,onError:c}){let p=ut(),[f,v]=S("files.clipboard",null),h=mt(f),y=it(t,r),g=i(!1),m=i(null);o(()=>{if(p.state!=="idle"||!p.data)return;let F=p.data;if(m.current===F)return;m.current=F;let E=g.current;if(g.current=!1,F.success){if(E)v(null);if(F.failures?.length)c(`${F.failures.length} item(s) could not be moved: ${F.failures[0].error}`);l()}else c(F.error||"The transfer did not complete")},[p.state,p.data]);let C=a((F,E)=>{g.current=E;let R=new FormData;for(let[w,T]of Object.entries(F))R.append(w,T);if(r&&r!==".")R.append("repo",r);if(t)R.append("root",t);p.submit(R,{method:"post",action:"/api/fs/action"})},[p,r,t]),k=a((F)=>ft(h,y,Ee(F.path,F.kind)),[h,y]),N=a((F,E)=>pt(F,Ee(E.path,E.kind)),[]),A=a((F,E,R,w)=>{let T=new FormData;T.append("actionType","paste"),T.append("mode",R),T.append("targetPath",E.path),T.append("targetKind",E.kind);for(let I of F)T.append("sourcePath",I.path);if(r&&r!==".")T.append("repo",r);if(t)T.append("root",t);g.current=w,p.submit(T,{method:"post",action:"/api/fs/action"})},[p,r,t]);return{clip:h,busy:p.state!=="idle",refusalFor:k,moveRefusalFor:N,copy:(F)=>{if(F.length===0)return;v({scope:y,entries:F.map(({path:E,name:R,kind:w})=>({path:E,name:R,kind:w})),mode:"copy"})},cut:(F)=>{if(F.length===0)return;v({scope:y,entries:F.map(({path:E,name:R,kind:w})=>({path:E,name:R,kind:w})),mode:"cut"})},duplicate:(F)=>{C({actionType:"duplicate",path:F.path},!1)},move:(F,E)=>{let R=N(F,E);if(R){c(R);return}A([F],E,"cut",Boolean(h?.mode==="cut"&&h.entries.some((w)=>w.path===F.path)))},paste:(F)=>{if(!h)return;let E=k(F);if(E){c(E);return}A(h.entries.map(({path:R,name:w,kind:T})=>({path:R,name:w,kind:T})),F,h.mode,h.mode==="cut")}}}var bn=Me.map((t)=>({...t,available:!0,tool:t.id}));function jt({rootPath:t,repo:r,onComplete:l}){let c=ut(),[p,f]=n(bn),[v,h]=n(null),[y,g]=n(null),[m,C]=n(null),k=i(null),N=i(null);o(()=>{let w=!1;return(async()=>{try{let I=await(await fetch("/api/fs/archive")).json();if(!w&&Array.isArray(I.formats)&&I.formats.length>0)f(I.formats)}catch{}})(),()=>{w=!0}},[]),o(()=>{if(c.state!=="idle"||!c.data)return;let w=c.data;if(N.current===w)return;N.current=w;let T=k.current;if(k.current=null,w.success){if(C(null),T==="compress")h(null);if(T==="extract")g(null);l()}else if(T)C(w.error||"The archive request failed")},[c.state,c.data]);let A=a((w)=>{let T=new FormData;for(let[I,_]of Object.entries(w))T.append(I,_);if(r&&r!==".")T.append("repo",r);if(t)T.append("root",t);c.submit(T,{method:"post",action:"/api/fs/action"})},[c,r,t]),F=a((w)=>{if(w.length===0)return;let T=p.find((I)=>I.id==="zip"&&I.available)?.id??p.find((I)=>I.available)?.id??"zip";C(null),g(null),h({entries:w.map(({path:I,name:_,kind:ee})=>({path:I,name:_,kind:ee})),format:T,name:we(w,T),destination:Ft(w)})},[p]),E=a((w)=>{C(null),h(null),g({archive:w,destination:Nt(w.path)})},[]),R=a((w)=>{h((T)=>{if(!T)return T;let I=we(T.entries,T.format),_=T.name===I?we(T.entries,w):T.name;return{...T,format:w,name:_}})},[]);return{formats:p,compress:v,extract:y,error:m,busy:c.state!=="idle",openCompress:F,openExtract:E,setFormat:R,setName:(w)=>h((T)=>T&&{...T,name:w}),setCompressDestination:(w)=>h((T)=>T&&{...T,destination:w}),setExtractDestination:(w)=>g((T)=>T&&{...T,destination:w}),cancel:()=>{h(null),g(null),C(null)},submitCompress:()=>{let w=v;if(!w)return;k.current="compress",C(null),A({actionType:"compress",format:w.format,name:w.name.trim(),destination:w.destination.trim()||".",paths:JSON.stringify(w.entries.map((T)=>T.path))})},submitExtract:()=>{let w=y;if(!w)return;k.current="extract",C(null),A({actionType:"extract",path:w.archive.path,destination:w.destination.trim()||"."})}}}function xn(t){if(t.shiftKey)return"range";if(t.metaKey||t.ctrlKey)return"toggle";return"plain"}function vn(t,r,l){if(!r)return[l];let c=t.indexOf(r),p=t.indexOf(l);if(c===-1||p===-1)return[l];let f=Math.min(c,p),v=Math.max(c,p);return t.slice(f,v+1)}function _t(t){let[r,l]=n(()=>new Set),[c,p]=n(null),f=a((g,m)=>{if(g==="range"){l(new Set(vn(t,c,m)));return}if(p(m),g==="toggle"){l((C)=>{let k=new Set(C);if(k.has(m))k.delete(m);else k.add(m);return k});return}l(new Set([m]))},[c,t]),v=a((g)=>{l((m)=>{if(m.has(g))return m;return new Set([g])}),p(g)},[]),h=a(()=>{l(new Set),p(null)},[]),y=a(xn,[]);return u(()=>({selected:r,count:r.size,anchor:c,gestureOf:y,applyGesture:f,ensureForContext:v,clear:h}),[r,c,y,f,v,h])}function Ge(t,r,l=0,c=[]){for(let p of t)if(c.push({path:p.path,name:p.name,kind:p.type==="folder"?"folder":"file",depth:l}),p.type==="folder"&&r(p)&&Array.isArray(p.children))Ge(p.children,r,l+1,c);return c}function Wt({listing:t,setExpandedPaths:r,setStoredExpandedPaths:l,reload:c,onMoved:p}){let f=a((y,g)=>{let m=ot(g,y);if(m.length===0)return;r((C)=>{if(m.every((N)=>C.has(N)))return C;let k=new Set(C);for(let N of m)k.add(N);return l(Array.from(k)),k})},[r,l]),v=a((y)=>{let g=t.insertEntry(y);if(!g){c();return}f(y.path,g)},[t,c,f]),h=a((y,g)=>{p?.(y,g),r((C)=>{let k=It(C,y,g);return l(Array.from(k)),k});let m=t.moveEntry(y,g);if(!m){c();return}f(g,m)},[t,c,f,r,l,p]);return{insertCreated:v,moveRenamed:h}}var yn=new Set;function Ut({scope:t,setExpandedPaths:r,setStoredExpandedPaths:l}){let[c,p]=n({scope:t,chains:new Map}),f=a((y)=>{let g=Ae(y.path,y.name);if(!g)return;p((C)=>{let k=C.scope===t?C.chains:new Map;if(k.get(y.path)?.length===g.length)return C;let A=new Map(k);return A.set(y.path,g),{scope:t,chains:A}});let m=g.slice(0,-1);r((C)=>{if(m.every((N)=>C.has(N)))return C;let k=new Set(C);for(let N of m)k.add(N);return l(Array.from(k)),k})},[t,r,l]),v=a((y)=>{let g=c.scope===t?c.chains.get(y):void 0;if(!g)return;let m=g.slice(0,-1);p((C)=>{if(C.scope!==t)return C;let k=new Map(C.chains);return k.delete(y),{scope:t,chains:k}}),r((C)=>{if(!m.some((N)=>C.has(N)))return C;let k=new Set(C);for(let N of m)k.delete(N);return l(Array.from(k)),k})},[t,c,r,l]),h=a((y,g)=>{let m=c.scope===t?c.chains:null;if(!m)return;let C=new Map,k=[],N=!1;for(let[A,F]of m){if(F.findIndex((T,I)=>T===y&&I>0&&I<F.length-1)!==-1){N=!0;continue}let R=F.map((T)=>T===y?g:T.startsWith(`${y}/`)?`${g}${T.slice(y.length)}`:T),w=R[R.length-1];if(w!==A||R.some((T,I)=>T!==F[I]))N=!0;C.set(w,R),k.push(...R.slice(0,-1))}if(!N)return;p({scope:t,chains:C}),r((A)=>{if(k.every((E)=>A.has(E)))return A;let F=new Set(A);for(let E of k)F.add(E);return l(Array.from(F)),F})},[t,c,r,l]);return{unfolded:c.scope===t&&c.chains.size>0?new Set(c.chains.keys()):yn,unfold:f,fold:v,rekey:h}}function Vt(t,r){let l=r.trim().toLowerCase();if(!l)return t;let c=(p)=>{let f=p.name.toLowerCase().includes(l);if(p.type==="folder"){let v=(p.children||[]).map(c).filter((h)=>h!==null);if(f||v.length>0)return{...p,children:f&&v.length===0?p.children:v,forceExpanded:!0};return null}return f?p:null};return t.map(c).filter((p)=>p!==null)}function Xt({dragging:t,clipboard:r,target:l}){let c=Boolean(t)&&r.moveRefusalFor(t,l)===null,[p,f]=n(!1);return o(()=>{if(!t)f(!1)},[t]),{accepts:c,highlighted:p&&c,onDragEnter:()=>{if(t)f(!0)},onDragLeave:(v)=>{if(!v.currentTarget.contains(v.relatedTarget))f(!1)},onDragOver:(v)=>{if(!c)return;if(v.preventDefault(),v.dataTransfer)v.dataTransfer.dropEffect="move"},onDrop:(v)=>{if(!c)return;v.preventDefault(),f(!1),r.move(t,l)}}}function ni({className:t="",enabled:r=!0,active:l=!0,rootPath:c,onOpenFile:p,refreshKey:f=0,onRefresh:v}){let[h,y]=S("files.searchQuery",""),[g,m,C]=S("files.expandedPaths",[]),[k,N]=n(()=>new Set(g)),{activeRepo:A,setActiveRepo:F}=gr(c),{repos:E,scanning:R,rescan:w}=Ar(c,r),{fileMap:T,folderMap:I,refreshGitStatus:_}=el(c,A,r),[ee,te]=n(null),ae=i(null);o(()=>{if(!C)return;N((O)=>{let Z=new Set(g);if(O.size===Z.size&&Array.from(Z).every((me)=>O.has(me)))return O;return Z})},[C,g]);let H=Gt({enabled:r,rootPath:c,activeRepo:A,expandedPaths:k,onExpansionPruned:(O)=>{N(O),m(Array.from(O))}});o(()=>{if(!C||!l)return;H.reload()},[f,c,r,A,C,l]);let P=r&&C?hA(H.scope):null,z=Ie(P);o(()=>{if(z.data)H.adoptRoot(z.data)},[z.data]);let G=(O)=>(_(),H.loadChildren(O)),K=(O,Z)=>{let me=new Set(k);if(Z)me.add(O);else me.delete(O);N(me),m(Array.from(me))},{unfolded:ne,unfold:q,fold:X,rekey:J}=Ut({scope:H.scope,setExpandedPaths:N,setStoredExpandedPaths:m}),ie=H.files,he=rt(ie,ne),Q=Vt(he.nodes,h),fe=Ge(Q,(O)=>O.forceExpanded!==void 0?O.forceExpanded:k.has(O.path)),le=_t(fe.map((O)=>O.path)),xe=fe.filter((O)=>le.selected.has(O.path)).map(({path:O,name:Z,kind:me})=>({path:O,name:Z,kind:me})),M=(O)=>{if(O===A)return;H.reset(),N(new Set),m([]),le.clear(),F(O)},j=()=>{if(_(),v)v();else H.reload()},{insertCreated:ce,moveRenamed:ye}=Wt({listing:H,setExpandedPaths:N,setStoredExpandedPaths:m,reload:j,onMoved:(O,Z)=>J(O,Z)}),be=os(),{pushToast:W}=He(),Y=Kt({rootPath:c,repo:A,onComplete:j,onError:(O)=>W(O,"error")}),ke=jt({rootPath:c,repo:A,onComplete:j}),ve={path:".",name:".",kind:"folder"},de=Y.clip&&!Y.refusalFor(ve)?`Paste ${Ne(Y.clip)??"item"}`:null,[V,ge]=n(null),pe=Xt({dragging:V,clipboard:Y,target:ve}),De=Fe({folderPath:".",rootPath:c,repo:A,onCreated:ce,onOpenCreated:(O)=>p?.({...O,root:c,repo:A})}),[Ke,qt]=n(!1);o(()=>qt(!0),[]);let{count:_e,clear:Ue}=le;if(o(()=>{if(!l)return;let O=(Z)=>{if(Z.key==="Escape"&&_e>0)Ue()};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[l,_e,Ue]),!r)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${t}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});let Bt=H.isLoading||z.refreshing;return e("div",{className:`flex flex-col h-full bg-paper ${t}`,children:[e(Qe,{rootPath:c,activeRepo:A,repos:E,reposScanning:R,onRefreshRepos:w,onSelectRepo:M,searchQuery:h,onSearchChange:y,onRefresh:j,refreshing:Bt}),e("div",{className:`flex-1 scrollbar-overlay-container p-2 font-mono text-[11px] text-ink/80 ${be?"file-tree-touch":""} ${pe.highlighted?"bg-info/[0.06]":""}`,onContextMenu:(O)=>{O.preventDefault(),te({x:O.clientX,y:O.clientY})},onDragEnter:pe.onDragEnter,onDragLeave:pe.onDragLeave,onDragOver:pe.onDragOver,onDrop:pe.onDrop,children:H.isLoading&&Q.length===0?e("div",{className:"p-4 text-center text-ink/40",children:"Loading files..."}):Q.length===0?e("div",{className:"p-4 text-center text-ink/40",children:"No files found"}):Q.map((O)=>e($e,{file:O,rootPath:c,basePath:H.root,repo:A,onLoadChildren:G,onOpenFile:p,onActionComplete:j,onCreated:ce,onRenamed:ye,expandedPaths:k,onToggleFolder:K,gitFileMap:T,gitFolderMap:I,clipboard:Y,archive:ke,selection:le,selectionTargets:xe,dragging:V,onDragStart:ge,onDragEnd:()=>ge(null),onDropOn:(Z)=>{if(!V)return;Y.move(V,Z)},onUnfold:q,onFold:X,foldRoots:he.roots,touch:be},O.path))}),e(Mt,{}),Ke&&e(Tt,{menu:ee,menuRef:ae,pasteLabel:de,busy:Y.busy,create:De,onAction:(O)=>{if(te(null),O==="new_file")De.openDialog("file");if(O==="new_folder")De.openDialog("folder");if(O==="paste")Y.paste(ve)}}),Ke&&e(Et,{archive:ke})]})}export{ni as FileExplorer};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n,o,i,u,a,tn,e,f,re,Ct}from"./index-
|
|
1
|
+
import{n,o,i,u,a,tn,e,f,re,Ct}from"./index-4cag7w6k.js";function j(t,s){return{top:Math.min(t.row,s.row),left:Math.min(t.col,s.col),bottom:Math.max(t.row,s.row),right:Math.max(t.col,s.col)}}function q(t){return t.bottom-t.top+1}function z(t){return t.right-t.left+1}function H(t){let s=t+1,r="";while(s>0){let d=(s-1)%26;r=String.fromCharCode(65+d)+r,s=Math.floor((s-1)/26)}return r}function X(t){return`${H(t.col)}${t.row+1}`}function F(t){let s=X({row:t.top,col:t.left}),r=X({row:t.bottom,col:t.right});return s===r?s:`${s}:${r}`}function I(t,s,r){return{row:Math.min(Math.max(t.row,0),Math.max(s-1,0)),col:Math.min(Math.max(t.col,0),Math.max(r-1,0))}}function U(t,s,r,d,p){return I({row:t.row+s,col:t.col+r},d,p)}function W(t,s){if(t<=0||s<=0)return null;return{top:0,left:0,bottom:t-1,right:s-1}}function K(t,s){let r=[];for(let d=s.top;d<=s.bottom;d+=1){let p=[];for(let c=s.left;c<=s.right;c+=1){let g=t[d]?.[c]??"";p.push(/[\t\r\n"]/.test(g)?`"${g.replace(/"/g,'""')}"`:g)}r.push(p.join("\t"))}return r.join(`\r
|
|
2
2
|
`)}function B(t,s){let[r,d]=n(null),[p,c]=n(null),[g,C]=n(!1),b=i(!1),m=a((v)=>I(v,t,s),[t,s]),y=a((v,E)=>{let G=m(v);if(E&&r)c(G);else d(G),c(G);b.current=!0,C(!0)},[r,m]),k=a((v)=>{if(!b.current)return;c(m(v))},[m]),N=a(()=>{b.current=!1,C(!1)},[]),T=a((v,E,G)=>{let S=U(p??{row:0,col:0},v,E,t,s);if(G&&r)c(S);else d(S),c(S)},[r,p,t,s]),A=a(()=>{let v=W(t,s);if(!v)return;d({row:v.top,col:v.left}),c({row:v.bottom,col:v.right})},[t,s]),L=a((v,E)=>{let G=m({row:t-1,col:v});if(E&&r)c(G);else d(m({row:0,col:v})),c(G)},[r,m,t]),P=a((v,E)=>{let G=m({row:v,col:s-1});if(E&&r)c(G);else d(m({row:v,col:0})),c(G)},[r,m,s]),l=a(()=>{d(null),c(null)},[]),x=u(()=>{if(!r||!p)return null;return j(m(r),m(p))},[r,p,m]),R=u(()=>p?m(p):null,[p,m]);return{range:x,active:R,dragging:g,begin:y,extendTo:k,endDrag:N,move:T,selectAll:A,selectColumn:L,selectRow:P,clear:l}}function Y(t){let[s,r]=n(null),d=a((C,b,m,y)=>{r({section:C,row:b,col:m,value:y,initial:y})},[]),p=a((C)=>{r((b)=>b?{...b,value:C}:b)},[]),c=a(()=>{if(s&&s.value!==s.initial)t(s);r(null)},[s,t]),g=a(()=>r(null),[]);return{edit:s,begin:d,change:p,commit:c,cancel:g}}function V(t){let s=t.target?.closest?.("[data-row][data-col]");if(!s)return null;return{row:Number(s.dataset.row),col:Number(s.dataset.col)}}function J({cells:t,width:s,selection:r,editor:d,scrollerRef:p,startEdit:c,onEditCell:g,setCopyState:C}){let b=d.edit,m=r.active;return{onPointerDown:(l)=>{if(l.button!==0)return;let x=l.target;if(x?.closest?.("[data-edit-input]"))return;if(b)d.commit();let R=V(l);if(R){p.current?.focus(),r.begin(R,l.shiftKey),l.preventDefault();return}let v=x?.closest?.("[data-col-header]");if(v){p.current?.focus(),r.selectColumn(Number(v.dataset.colHeader),l.shiftKey),l.preventDefault();return}let E=x?.closest?.("[data-row-header]");if(E){p.current?.focus(),r.selectRow(Number(E.dataset.rowHeader),l.shiftKey),l.preventDefault();return}if(x?.closest?.("[data-corner]"))p.current?.focus(),r.selectAll(),l.preventDefault()},onPointerOver:(l)=>{let x=V(l);if(x)r.extendTo(x)},onDoubleClick:(l)=>{let x=V(l);if(x){c("data",x.row,x.col);return}let R=l.target?.closest?.("[data-col-header]");if(R)c("header",0,Number(R.dataset.colHeader))},onInput:(l)=>{let x=l.target;if(x.matches?.("[data-edit-input]"))d.change(x.value)},onKeyDown:(l)=>{if(b){if(l.key==="Enter"){l.preventDefault(),d.commit(),r.move(l.shiftKey?-1:1,0,!1);return}if(l.key==="Tab"){l.preventDefault(),d.commit(),r.move(0,l.shiftKey?-1:1,!1);return}if(l.key==="Escape"){l.preventDefault(),d.cancel();return}return}let x=l.metaKey||l.ctrlKey;if(x&&l.key.toLowerCase()==="a"){l.preventDefault(),r.selectAll();return}if(l.key==="Escape"){r.clear();return}if(l.key==="Enter"||l.key==="F2"){if(!g||!m)return;l.preventDefault(),c("data",m.row,m.col);return}if(l.key==="Delete"||l.key==="Backspace"){if(!g||!m)return;l.preventDefault(),g(m.row,m.col,"");return}if(l.key.length===1&&!x&&!l.altKey){if(!g||!m)return;l.preventDefault(),c("data",m.row,m.col,l.key);return}let v={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1]}[l.key];if(v){l.preventDefault(),r.move(v[0],v[1],l.shiftKey);return}if(l.key==="Home"||l.key==="End"){l.preventDefault();let E=l.key==="Home"?0:s-1,G=x?l.key==="Home"?0:t.length-1:m?.row??0;r.move(G-(m?.row??0),E-(m?.col??0),l.shiftKey)}},onCopy:(l)=>{if(b)return;if(!r.range)return;l.clipboardData?.setData("text/plain",K(t,r.range)),l.preventDefault(),C("copied")},onPaste:(l)=>{if(b)return;l.preventDefault(),C("refused")}}}var Q=tn(function({cells:s,rowIndex:r,selectedLeft:d,selectedRight:p,activeCol:c,editingCol:g,editingValue:C}){let b=d>=0;return e("tr",{className:"odd:bg-ink/[0.02]",children:[e("th",{"data-row-header":r,className:`cursor-pointer border-b border-r border-ink/10 px-2 py-0.5 text-right font-normal tabular-nums ${b?"bg-info/10 text-ink/60":"text-ink/30"}`,title:`Select row ${r+1}`,children:r+1}),s.map((m,y)=>{let k=b&&y>=d&&y<=p;return e("td",{"data-row":r,"data-col":y,title:m,className:`cursor-cell border-b border-ink/10 px-2 py-0.5 text-ink ${k?"bg-info/10":""} ${y===c?"ring-1 ring-inset ring-info":""}`,children:y===g?e("input",{"data-edit-input":"true",value:C,spellcheck:!1,className:"w-full min-w-0 bg-transparent font-mono text-[11px] text-ink outline-none"}):e("span",{className:"block truncate",children:m})},y)})]})});function Z({status:t,tone:s="muted",actions:r,canCopy:d,copyState:p,onCopy:c}){return e("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-ink/10 bg-canvas px-2 py-1 font-sans text-[11px]",children:[e("span",{className:`truncate ${s==="warning"?"text-warning":"text-ink/50"}`,children:t}),e("div",{className:"flex shrink-0 items-center gap-2",children:[r,e("button",{type:"button",onClick:c,disabled:!d,title:"Copy the selected cells as tab-separated text",className:`flex items-center gap-1 rounded px-1.5 py-0.5 transition-colors ${d?"text-ink/60 hover:bg-ink/5 hover:text-ink":"cursor-default text-ink/25"} ${p==="failed"?"text-error":""}`,children:[p==="copied"?e(f,{size:12}):e(re,{size:12}),e("span",{children:p==="copied"?"Copied":p==="failed"?"Copy failed":"Copy"})]})]})]})}var ne=44,oe=1600;function Kc({header:t,rows:s,truncated:r,label:d,readOnlyNote:p,onEditCell:c,onEditHeader:g,actions:C}){let b=u(()=>s.reduce((h,w)=>Math.max(h,w.length),t.length),[t,s]),m=u(()=>Array.from({length:b},(h,w)=>t[w]??H(w)),[t,b]),y=u(()=>s.map((h)=>h.length===b?h:Array.from({length:b},(w,M)=>h[M]??"")),[s,b]),k=B(y.length,b),N=i(null),[T,A]=n("idle"),L=a((h)=>{if(h.section==="header")g?.(h.col,h.value);else c?.(h.row,h.col,h.value)},[c,g]),P=Y(L),l=P.edit,x=a((h,w,M,_)=>{if(h==="header"?!g:!c)return;let te=h==="header"?m[M]??"":y[w]?.[M]??"";P.begin(h,w,M,_??te)},[y,P,m,c,g]),R=a(async()=>{if(!k.range)return;let h=await Ct(K(y,k.range));A(h?"copied":"failed")},[y,k.range]);o(()=>{if(T==="idle")return;let h=setTimeout(()=>A("idle"),oe);return()=>clearTimeout(h)},[T]);let{dragging:v,endDrag:E}=k;o(()=>{if(!v)return;let h=()=>E();return window.addEventListener("pointerup",h),window.addEventListener("pointercancel",h),()=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h)}},[v,E]);let G=k.active;o(()=>{if(!G)return;N.current?.querySelector(`[data-row="${G.row}"][data-col="${G.col}"]`)?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[G]);let O=l?`${l.section}:${l.row}:${l.col}`:"";o(()=>{if(!O)return;let h=N.current?.querySelector("[data-edit-input]");h?.focus(),h?.select()},[O]);let S=J({cells:y,width:b,selection:k,editor:P,scrollerRef:N,startEdit:x,onEditCell:c,setCopyState:A});if(b===0&&y.length===0)return e("div",{className:"flex flex-1 items-center justify-center px-6 text-center text-xs text-ink/50",children:"This file has no rows."});let D=k.range,ee=T==="refused"?p??"This grid is read-only.":D?`${F(D)} · ${q(D)}×${z(D)}`:"Click a cell, drag to select a block";return e("div",{className:"flex min-h-0 flex-1 flex-col",children:[r&&e("div",{className:"shrink-0 border-b border-warning/30 bg-warning/10 px-3 py-1 font-sans text-[11px] text-warning",children:["Showing the first ",y.length.toLocaleString()," rows."]}),e(Z,{status:ee,tone:T==="refused"?"warning":"muted",actions:C,canCopy:D!==null,copyState:T,onCopy:()=>void R()}),e("div",{ref:N,tabIndex:0,role:"grid","aria-label":d??"Spreadsheet",className:"flex-1 overflow-auto outline-none",onPointerDown:S.onPointerDown,onPointerOver:S.onPointerOver,onDblClick:S.onDoubleClick,onInput:S.onInput,onKeyDown:S.onKeyDown,onCopy:S.onCopy,onPaste:S.onPaste,children:e("table",{className:"w-full table-fixed select-none border-collapse font-mono text-[11px]",children:[e("colgroup",{children:[e("col",{style:{width:`${ne}px`}}),m.map((h,w)=>e("col",{},w))]}),e("thead",{className:"sticky top-0 z-10 bg-canvas",children:e("tr",{children:[e("th",{"data-corner":!0,title:"Select all",className:"cursor-pointer border-b border-r border-ink/10 px-2 py-1 text-right font-normal text-ink/30",children:"#"}),m.map((h,w)=>{let M=D!==null&&w>=D.left&&w<=D.right,_=l?.section==="header"&&l.col===w;return e("th",{"data-col-header":w,title:h,className:`cursor-pointer border-b border-ink/10 px-2 py-1 text-left font-semibold ${M?"bg-info/10 text-ink":"text-ink/80"}`,children:_?e("input",{"data-edit-input":"true",value:l.value,spellcheck:!1,className:"w-full min-w-0 bg-transparent font-mono text-[11px] font-semibold text-ink outline-none"}):e("span",{className:"block truncate",children:h})},w)})]})}),e("tbody",{children:y.map((h,w)=>{let M=D!==null&&w>=D.top&&w<=D.bottom;return e(Q,{cells:h,rowIndex:w,selectedLeft:M?D.left:-1,selectedRight:M?D.right:-1,activeCol:G?.row===w?G.col:-1,editingCol:l?.section==="data"&&l.row===w?l.col:-1,editingValue:l?.section==="data"&&l.row===w?l.value:""},w)})})]})})]})}var Nf=2000,Qf=100;function ie(t,s){if(/\.tsv$/i.test(s??""))return"\t";let r=t.slice(0,t.indexOf(`
|
|
3
3
|
`)===-1?t.length:t.indexOf(`
|
|
4
4
|
`)),d=0,p=0,c=!1;for(let g=0;g<r.length;g+=1){let C=r[g];if(C==='"')c=!c;else if(!c&&C==="\t")d+=1;else if(!c&&C===",")p+=1}return d>p?"\t":","}function le(t,s,r){let d=[],p=[],c="",g=!1,C=0,b=()=>{if(C<r)p.push(c);c="",C+=1},m=()=>{b(),d.push(p),p=[],C=0};for(let y=0;y<t.length;y+=1){let k=t[y];if(g){if(k==='"')if(t[y+1]==='"')c+='"',y+=1;else g=!1;else c+=k;continue}if(k==='"'&&c.length===0){g=!0;continue}if(k===s){b();continue}if(k==="\r"){if(t[y+1]===`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t,l,qt,C,ee,te,F,p,pe}from"./index-
|
|
1
|
+
import{t,l,qt,C,ee,te,F,p,pe}from"./index-60v30k5h.js";var M="",O="",D="",E=[],N=new Map,S=t((e)=>ee(e,p()),"sanitizeText"),z=t((e)=>{switch(e.type){case"terminal":return{...e,value:S(e.value)};case"nonterminal":return{...e,name:S(e.name)};case"sequence":return{...e,elements:e.elements.map(z)};case"choice":return{...e,alternatives:e.alternatives.map(z)};case"optional":return{...e,element:z(e.element)};case"repetition":return{...e,element:z(e.element),separator:e.separator?z(e.separator):void 0};case"special":return{...e,text:S(e.text)}}},"sanitizeAstNode"),H=t(()=>{M="",O="",D="",E.length=0,N.clear(),F(),l.debug("[Railroad] Database cleared")},"clear"),Y=t((e)=>{M=S(e),l.debug("[Railroad] Title set:",e)},"setTitle"),P=t(()=>M,"getTitle"),q=t((e)=>{let n={...e,name:S(e.name),definition:z(e.definition),comment:e.comment?S(e.comment):void 0};if(l.debug("[Railroad] Adding rule:",n.name),N.has(n.name))l.warn(`[Railroad] Rule '${n.name}' is already defined. Overwriting.`);E.push(n),N.set(n.name,n)},"addRule"),G=t(()=>E,"getRules"),U=t((e)=>N.get(e),"getRule"),j=t((e)=>{O=S(e).replace(/^\s+/g,""),l.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),K=t(()=>O,"getAccTitle"),J=t((e)=>{D=S(e).replace(/\n\s+/g,`
|
|
2
2
|
`),l.debug("[Railroad] Accessibility description set:",e)},"setAccDescription"),Q=t(()=>D,"getAccDescription"),Z=Y,V=P,Me={clear:H,setTitle:Y,getTitle:P,addRule:q,getRules:G,getRule:U,setAccTitle:j,getAccTitle:K,setAccDescription:J,getAccDescription:Q,setDiagramTitle:Z,getDiagramTitle:V},T={compactMode:!1,padding:10,verticalSeparation:8,horizontalSeparation:10,arcRadius:10,fontSize:14,fontFamily:"monospace",terminalFill:"#FFFFC0",terminalStroke:"#000000",terminalTextColor:"#000000",nonTerminalFill:"#FFFFFF",nonTerminalStroke:"#000000",nonTerminalTextColor:"#000000",lineColor:"#000000",strokeWidth:2,markerFill:"#000000",commentFill:"#E8E8E8",commentStroke:"#888888",commentTextColor:"#666666",specialFill:"#F0E0FF",specialStroke:"#8800CC",ruleNameColor:"#000066",showMarkers:!0,markerRadius:5},re=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i,ie=/^[\w "',.-]+$/,ne=new Set(["compactMode","padding","verticalSeparation","horizontalSeparation","arcRadius","fontSize","fontFamily","terminalFill","terminalStroke","terminalTextColor","nonTerminalFill","nonTerminalStroke","nonTerminalTextColor","lineColor","strokeWidth","markerFill","commentFill","commentStroke","commentTextColor","specialFill","specialStroke","ruleNameColor","showMarkers","markerRadius"]),L=t((e)=>{if(!e)return!1;return Object.keys(e).every((n)=>n==="railroad"||ne.has(n))},"isRailroadStyleOptions"),ae=t((e)=>{if(!e)return{};if("railroad"in e&&e.railroad)return e.railroad;return L(e)?e:{}},"extractRailroadOverrides"),oe=t((e)=>{if(!e||L(e))return{};let{railroad:n,svgId:o,theme:i,look:r,...a}=e;return a},"extractThemeOverrides"),u=t((e,n)=>{if(typeof e!=="string")return n;let o=e.trim();return re.test(o)?o:n},"sanitizeColorValue"),I=t((e,n)=>{if(typeof e!=="string")return n;let o=e.trim();return ie.test(o)?o:n},"sanitizeFontFamilyValue"),R=t((e,n)=>{let o=typeof e==="number"?e:typeof e==="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(o)&&o>=0?o:n},"sanitizeNumberValue"),le=t((e)=>{let n=typeof e==="number"?e:typeof e==="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(n)&&n>0?n:void 0},"parseThemeFontSize"),se=t((e)=>{let n=I(e.fontFamily,T.fontFamily),o=le(e.fontSize)??T.fontSize;return{...T,fontFamily:n,fontSize:o,terminalFill:u(e.secondBkg??e.secondaryColor,T.terminalFill),terminalStroke:u(e.secondaryBorderColor??e.lineColor,T.terminalStroke),terminalTextColor:u(e.secondaryTextColor??e.textColor,T.terminalTextColor),nonTerminalFill:u(e.mainBkg??e.background,T.nonTerminalFill),nonTerminalStroke:u(e.primaryBorderColor??e.lineColor,T.nonTerminalStroke),nonTerminalTextColor:u(e.primaryTextColor??e.textColor,T.nonTerminalTextColor),lineColor:u(e.lineColor,T.lineColor),markerFill:u(e.lineColor,T.markerFill),commentFill:u(e.labelBackground??e.tertiaryColor,T.commentFill),commentStroke:u(e.tertiaryBorderColor??e.lineColor,T.commentStroke),commentTextColor:u(e.tertiaryTextColor??e.textColor,T.commentTextColor),specialFill:u(e.tertiaryColor??e.secondaryColor,T.specialFill),specialStroke:u(e.tertiaryBorderColor??e.secondaryBorderColor,T.specialStroke),ruleNameColor:u(e.titleColor??e.textColor,T.ruleNameColor)}},"buildThemeDefaults"),W=t((e)=>{let n=C(),o={...qt(),...n.themeVariables??{},...oe(e)},i=se(o),r={...n.railroad??{},...ae(e)};return{compactMode:r.compactMode??i.compactMode,padding:R(r.padding,i.padding),verticalSeparation:R(r.verticalSeparation,i.verticalSeparation),horizontalSeparation:R(r.horizontalSeparation,i.horizontalSeparation),arcRadius:R(r.arcRadius,i.arcRadius),fontSize:R(r.fontSize,i.fontSize),fontFamily:I(r.fontFamily,i.fontFamily),terminalFill:u(r.terminalFill,i.terminalFill),terminalStroke:u(r.terminalStroke,i.terminalStroke),terminalTextColor:u(r.terminalTextColor,i.terminalTextColor),nonTerminalFill:u(r.nonTerminalFill,i.nonTerminalFill),nonTerminalStroke:u(r.nonTerminalStroke,i.nonTerminalStroke),nonTerminalTextColor:u(r.nonTerminalTextColor,i.nonTerminalTextColor),lineColor:u(r.lineColor,i.lineColor),strokeWidth:R(r.strokeWidth,i.strokeWidth),markerFill:u(r.markerFill,i.markerFill),commentFill:u(r.commentFill,i.commentFill),commentStroke:u(r.commentStroke,i.commentStroke),commentTextColor:u(r.commentTextColor,i.commentTextColor),specialFill:u(r.specialFill,i.specialFill),specialStroke:u(r.specialStroke,i.specialStroke),ruleNameColor:u(r.ruleNameColor,i.ruleNameColor),showMarkers:r.showMarkers??i.showMarkers,markerRadius:R(r.markerRadius,i.markerRadius)}},"buildRailroadStyleOptions"),La=t((e)=>{let{fontFamily:n,fontSize:o,terminalFill:i,terminalStroke:r,terminalTextColor:a,nonTerminalFill:g,nonTerminalStroke:c,nonTerminalTextColor:s,lineColor:f,strokeWidth:h,markerFill:m,commentFill:k,commentStroke:d,commentTextColor:x,specialFill:b,specialStroke:y,ruleNameColor:v}=W(e);return`
|
|
3
3
|
.railroad-diagram {
|
|
4
4
|
font-family: ${n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d,e,E,yA,Ie,bt,Wa,st}from"./index-
|
|
1
|
+
import{d,e,E,yA,Ie,bt,Wa,st}from"./index-4cag7w6k.js";import{ia,Su,zs,Tu,Du}from"./index-hgzntg2j.js";function u(t,r){if(!t)return r;if(!r)return t;let s=Date.parse(t.generatedAt),o=Date.parse(r.generatedAt);if(Number.isNaN(s)||Number.isNaN(o))return t;return o>s?r:t}function A({className:t="",active:r=!0,tabsMode:s=!1}){let{report:o,isLoading:i,error:n,reload:l}=Du(),p=Ie(yA,{enabled:r}),a=u(p.data,o),m=a?zs(a):[];if(n&&!a)return e("div",{className:`flex h-full w-full flex-col items-center justify-center gap-2 p-8 text-center text-xs ${t}`,children:[e(E,{size:16,className:"text-error"}),e("p",{className:"text-error text-xs",children:n}),e("button",{type:"button",onClick:()=>l(),className:"text-[11px] font-semibold text-ink/70 hover:text-ink underline underline-offset-2",children:"Try again"})]});if(!a)return e("div",{className:`flex h-full w-full items-center justify-center text-ink/40 text-xs ${t}`,children:"Loading provider usage..."});return e("div",{className:`flex h-full w-full min-w-0 min-h-0 flex-col overflow-hidden bg-paper text-xs text-ink ${t}`,children:[e(bt,{left:e(d,{children:[e(Wa,{id:"usage",tabsMode:s,children:e("h2",{className:"text-xs font-semibold text-ink uppercase tracking-wider",children:"Usage"})}),e("span",{className:"text-[11px] text-ink/50 truncate",children:["Updated ",ia(a.generatedAt)]}),a.isMock&&e("span",{className:"text-[10px] font-mono uppercase tracking-wider bg-ink/5 border border-ink/15 rounded px-1.5 py-0.5 text-ink/60",children:"Mock"})]}),right:e(st,{label:"Refresh usage",onClick:()=>l({force:!0}),busy:i||p.refreshing,disabled:i})}),e("div",{className:"flex-1 min-w-0 min-h-0 w-full overflow-y-auto scrollbar-overlay-container p-3.5 space-y-4",children:[n&&e("p",{className:"text-error text-xs",children:n}),m.length>0?m.map((f)=>e(Su,{summary:f.summary},f.id)):e("p",{className:"text-[11px] text-ink/50 leading-relaxed",children:"No provider credentials detected. Add an API key in Settings → Providers and it will appear here."}),e(Tu,{})]})]})}export{A as UsagePanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d,n,o,i,u,a,e,s,m,_,Hr,ji,f,re,Vt,me,D,U,Bo,Yp,Z,Ct,kg,Zp,td}from"./index-amys498v.js";var I={name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]},zp=s(I);function O({row:t,active:r,name:l,loading:h,onSelect:p,onCopyPath:g,onReveal:N}){return e("div",{className:"grid grid-cols-[1rem_minmax(0,1fr)_3.5rem] items-start gap-x-2 px-4 py-2 border-b border-ink/5 last:border-b-0 hover:bg-ink/[0.02] group/row transition-colors",children:[e("div",{className:"h-5 flex items-center justify-center",children:r&&e(f,{size:12,className:"text-ink","aria-label":"Selected repository"})}),e("button",{type:"button",onClick:p,disabled:r||!t.isRepo,title:!t.isRepo?t.error??"Not a git repository":r?"Already showing this repository":`Show ${t.path}`,className:"min-w-0 text-left cursor-pointer disabled:cursor-default",children:e("div",{className:"h-5 flex items-center gap-1.5 min-w-0",children:[e(me,{size:11,className:r?"text-ink/60 flex-shrink-0":"text-ink/40 flex-shrink-0"}),e("span",{className:`truncate text-xs ${r?"font-semibold text-ink":"text-ink/90"}`,children:l})]})}),e("div",{className:"h-5 flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/row:opacity-100",children:[e("button",{type:"button",onClick:g,disabled:h,title:`Copy the absolute path of ${t.path}`,"aria-label":`Copy path of ${t.path}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-30 disabled:cursor-default",children:e(re,{size:11})}),e("button",{type:"button",onClick:N,title:`Reveal ${t.path} in the file manager`,"aria-label":`Reveal ${t.path}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Vt,{size:11})})]}),e("div",{className:"col-start-2 col-span-2 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0 mt-0.5",children:[t.isRepo?e(d,{children:[e("span",{className:`text-[10px] font-mono truncate ${t.detached?"text-warning":"text-ink/50"}`,title:t.detached?`Detached HEAD at ${t.branch}`:`On branch ${t.branch}`,children:t.branch}),e("span",{className:"text-[10px] text-ink/25","aria-hidden":!0,children:"·"}),e(Q,{row:t})]}):e("span",{className:"text-[10px] text-ink/40 truncate",children:t.error??"Not a git repository"}),t.isRepo&&t.subject&&e(d,{children:[e("span",{className:"text-[10px] text-ink/25","aria-hidden":!0,children:"·"}),e("span",{className:"text-[10px] text-ink/40 truncate min-w-0",title:t.subject,children:t.subject})]})]})]})}function Q({row:t}){let r=[];if(t.operation)r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:t.operation==="stash-pop"?`A stash pop stopped on ${t.conflicts} conflict(s)`:`A ${Bo[t.operation]} is in progress, stopped on ${t.conflicts} conflict(s)`,children:[e(_,{size:9}),Bo[t.operation]]},"operation"));else if(t.conflicts>0)r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:`${t.conflicts} conflicted path(s)`,children:[e(_,{size:9}),t.conflicts]},"conflicts"));if(t.changed>0||t.untracked>0)r.push(e("span",{className:"flex-shrink-0 rounded border border-info/30 px-1 text-[10px] font-mono tabular-nums text-info",title:`${t.changed} changed, ${t.untracked} untracked`,children:[t.changed>0?`${t.changed}±`:"",t.changed>0&&t.untracked>0?" ":"",t.untracked>0?`${t.untracked}?`:""]},"dirty"));if(t.gone)r.push(e("span",{className:"flex-shrink-0 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:`${t.upstream} no longer exists on the remote — fetch --prune to drop it`,children:"gone"},"gone"));else if(t.upstream&&(t.ahead>0||t.behind>0))r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 text-[10px] font-mono tabular-nums text-ink/60",title:`${t.ahead} ahead of, ${t.behind} behind ${t.upstream}`,children:[t.ahead>0&&e("span",{className:"flex items-center",children:[e(ji,{size:9}),t.ahead]}),t.behind>0&&e("span",{className:"flex items-center",children:[e(Hr,{size:9}),t.behind]})]},"track"));if(r.length===0)return e("span",{className:"text-[10px] font-mono text-ink/30",title:"Nothing to report: clean and in sync",children:"clean, in sync"});return e(d,{children:r})}function H(t){let{open:r,rootPath:l,scanning:h}=t,[p,g]=n([]),[N,k]=n(!1),[C,P]=n(!1),[M,y]=n(null),[G,E]=n(0),j=t.repos.join("\x00"),A=i(!0),b=i(null);o(()=>(A.current=!0,()=>{A.current=!1,b.current?.abort(),b.current=null}),[]);let S=a(async()=>{b.current?.abort();let v=new AbortController;b.current=v,P(!0),k(!0);try{let R=new URLSearchParams({repoDetails:"1"});if(l)R.set("root",l);let w=await fetch(`/api/fs/git?${R.toString()}`,{signal:v.signal}),F=await w.json();if(!A.current||b.current!==v)return;if(!w.ok||!Array.isArray(F.details)){y(F.error||`Failed to read repositories (HTTP ${w.status})`);return}g(F.details),y(null)}catch(R){if(!A.current||b.current!==v)return;if(R instanceof Error&&R.name==="AbortError")return;y(R instanceof Error?R.message:"Failed to read repositories")}finally{if(A.current&&b.current===v)b.current=null,P(!1),k(!1)}},[l]);o(()=>{if(!r){g([]),y(null),k(!1);return}S()},[r,S,j,h,G]);let L=a(()=>E((v)=>v+1),[]);return{details:p,loading:N,reading:C,error:M,refresh:L}}function B(t){let r=new Map;for(let l of t){if(!l||l==="."){if(!r.has(""))r.set("",{key:"",label:null,paths:[]});r.get("").paths.push(".");continue}let h=l.indexOf("/"),p=h===-1?"":l.slice(0,h),g=r.get(p);if(!g)g={key:p,label:p===""?null:p,paths:[]},r.set(p,g);g.paths.push(l)}for(let l of r.values())l.paths.sort((h,p)=>h==="."?-1:p==="."?1:h.localeCompare(p));return[...r.values()].sort((l,h)=>{if(l.key==="")return-1;if(h.key==="")return 1;return l.key.localeCompare(h.key)})}function W(t,r){if(t===".")return"workspace root";if(r==="")return t;return t.slice(r.length+1)}function q({isOpen:t,rootPath:r,activeRepo:l,repos:h,scanning:p,onSelectRepo:g,onRefreshRepos:N,onClose:k}){let[C,P]=n(""),[M,y]=n(null),{details:G,loading:E,reading:j,error:A,refresh:b}=H({open:t,rootPath:r,repos:h,scanning:p});o(()=>{if(!t)P(""),y(null)},[t]);let S=u(()=>{let x=C.trim().toLowerCase();if(!x)return G;return G.filter((c)=>c.path.toLowerCase().includes(x))},[G,C]),L=u(()=>B(S.map((x)=>x.path)),[S]),v=u(()=>{let x=new Map;for(let c of G)x.set(c.path,c);return x},[G]),R=a(()=>{N(),b()},[N,b]),w=a(async(x)=>{let c=r?td(r,x==="."?"":x):x,z=await Ct(c);y(z?{text:`Copied ${c}`,kind:"success"}:{text:"Clipboard unavailable",kind:"error"})},[r]),F=a(async(x)=>{let c=new FormData;if(c.append("actionType","open_explorer"),c.append("path","."),c.append("repo",x),r)c.append("root",r);try{let z=await fetch("/api/fs/action",{method:"POST",body:c}),T=await z.json();if(!z.ok||T.error)y({text:T.error||"Could not open the file manager",kind:"error"})}catch{y({text:"Could not open the file manager",kind:"error"})}},[r]);if(!t)return null;return e(Z,{onClose:k,maxWidthClass:"max-w-[min(96vw,720px)]",header:e("div",{className:"flex items-center gap-2 min-w-0",children:[e(zp,{size:14,className:"text-ink/60 flex-shrink-0"}),e("h2",{className:"text-sm font-semibold text-ink",children:"Repositories"}),e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:[h.length," in this workspace"]})]}),children:[e("div",{className:"px-5 py-3 flex items-center gap-2 border-b border-ink/10",children:[e(U,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:C,onChange:(x)=>P(x.currentTarget.value),placeholder:"Filter repositories…","aria-label":"Filter repositories",className:"flex-1 min-w-0 bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),e("button",{type:"button",onClick:R,disabled:j||p,title:"Re-discover repositories and re-read their state","aria-label":"Refresh repositories",className:"text-ink/40 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 flex-shrink-0",children:e(D,{size:12,className:j||p?"animate-spin":""})})]}),p&&e("div",{className:"px-5 py-1.5 border-b border-ink/10 text-[10px] font-mono text-ink/50 flex items-center gap-1.5",children:[e(m,{size:10,className:"animate-spin"}),"Still discovering repositories in this workspace…"]}),M&&e("div",{className:`px-5 py-1.5 border-b border-ink/10 text-[10px] font-mono truncate ${M.kind==="error"?"text-error":"text-ink/60"}`,title:M.text,role:"status",children:M.text}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:E&&G.length===0?e("div",{className:"flex items-center justify-center gap-2 py-12 text-xs text-ink/50 font-mono",children:[e(m,{size:14,className:"animate-spin text-info"}),"Reading repositories…"]}):A?e("div",{className:"py-12 px-6 text-center text-xs text-error font-mono",children:A}):S.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:C.trim()?"No matching repositories.":"No repositories in this workspace."}):L.map((x)=>e("div",{children:[e("div",{className:"px-4 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold bg-canvas/40 border-b border-ink/5 sticky top-0",children:x.label??kg(".",r)}),x.paths.map((c)=>{let z=v.get(c);if(!z)return null;return e(O,{row:z,active:c===l,name:W(c,x.key),loading:j,onSelect:()=>{g(c),k()},onCopyPath:()=>void w(c),onReveal:()=>void F(c)},c)})]},x.key))})]})}function kr({rootPath:t,activeRepo:r,onSelectRepo:l,repos:h,scanning:p,onRefreshRepos:g}){let[N,k]=n(!1),C=u(()=>({root:t??null,repo:r,rows:Zp(t,h),scanning:p,ready:!0,setRepo:l,refresh:g}),[t,r,h,p,l,g]),P=a(()=>k(!0),[]);return e("div",{className:"relative min-w-0",children:[e(Yp,{scope:C,onManage:P}),e(q,{isOpen:N,rootPath:t,activeRepo:r,repos:h,scanning:p,onSelectRepo:l,onRefreshRepos:g,onClose:()=>k(!1)})]})}
|
|
1
|
+
import{d,n,o,i,u,a,e,s,m,_,Hr,ji,f,re,Vt,me,D,U,Bo,Yp,Z,Ct,kg,Zp,td}from"./index-4cag7w6k.js";var I={name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]},zp=s(I);function O({row:t,active:r,name:l,loading:h,onSelect:p,onCopyPath:g,onReveal:N}){return e("div",{className:"grid grid-cols-[1rem_minmax(0,1fr)_3.5rem] items-start gap-x-2 px-4 py-2 border-b border-ink/5 last:border-b-0 hover:bg-ink/[0.02] group/row transition-colors",children:[e("div",{className:"h-5 flex items-center justify-center",children:r&&e(f,{size:12,className:"text-ink","aria-label":"Selected repository"})}),e("button",{type:"button",onClick:p,disabled:r||!t.isRepo,title:!t.isRepo?t.error??"Not a git repository":r?"Already showing this repository":`Show ${t.path}`,className:"min-w-0 text-left cursor-pointer disabled:cursor-default",children:e("div",{className:"h-5 flex items-center gap-1.5 min-w-0",children:[e(me,{size:11,className:r?"text-ink/60 flex-shrink-0":"text-ink/40 flex-shrink-0"}),e("span",{className:`truncate text-xs ${r?"font-semibold text-ink":"text-ink/90"}`,children:l})]})}),e("div",{className:"h-5 flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/row:opacity-100",children:[e("button",{type:"button",onClick:g,disabled:h,title:`Copy the absolute path of ${t.path}`,"aria-label":`Copy path of ${t.path}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-30 disabled:cursor-default",children:e(re,{size:11})}),e("button",{type:"button",onClick:N,title:`Reveal ${t.path} in the file manager`,"aria-label":`Reveal ${t.path}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Vt,{size:11})})]}),e("div",{className:"col-start-2 col-span-2 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0 mt-0.5",children:[t.isRepo?e(d,{children:[e("span",{className:`text-[10px] font-mono truncate ${t.detached?"text-warning":"text-ink/50"}`,title:t.detached?`Detached HEAD at ${t.branch}`:`On branch ${t.branch}`,children:t.branch}),e("span",{className:"text-[10px] text-ink/25","aria-hidden":!0,children:"·"}),e(Q,{row:t})]}):e("span",{className:"text-[10px] text-ink/40 truncate",children:t.error??"Not a git repository"}),t.isRepo&&t.subject&&e(d,{children:[e("span",{className:"text-[10px] text-ink/25","aria-hidden":!0,children:"·"}),e("span",{className:"text-[10px] text-ink/40 truncate min-w-0",title:t.subject,children:t.subject})]})]})]})}function Q({row:t}){let r=[];if(t.operation)r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:t.operation==="stash-pop"?`A stash pop stopped on ${t.conflicts} conflict(s)`:`A ${Bo[t.operation]} is in progress, stopped on ${t.conflicts} conflict(s)`,children:[e(_,{size:9}),Bo[t.operation]]},"operation"));else if(t.conflicts>0)r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:`${t.conflicts} conflicted path(s)`,children:[e(_,{size:9}),t.conflicts]},"conflicts"));if(t.changed>0||t.untracked>0)r.push(e("span",{className:"flex-shrink-0 rounded border border-info/30 px-1 text-[10px] font-mono tabular-nums text-info",title:`${t.changed} changed, ${t.untracked} untracked`,children:[t.changed>0?`${t.changed}±`:"",t.changed>0&&t.untracked>0?" ":"",t.untracked>0?`${t.untracked}?`:""]},"dirty"));if(t.gone)r.push(e("span",{className:"flex-shrink-0 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:`${t.upstream} no longer exists on the remote — fetch --prune to drop it`,children:"gone"},"gone"));else if(t.upstream&&(t.ahead>0||t.behind>0))r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 text-[10px] font-mono tabular-nums text-ink/60",title:`${t.ahead} ahead of, ${t.behind} behind ${t.upstream}`,children:[t.ahead>0&&e("span",{className:"flex items-center",children:[e(ji,{size:9}),t.ahead]}),t.behind>0&&e("span",{className:"flex items-center",children:[e(Hr,{size:9}),t.behind]})]},"track"));if(r.length===0)return e("span",{className:"text-[10px] font-mono text-ink/30",title:"Nothing to report: clean and in sync",children:"clean, in sync"});return e(d,{children:r})}function H(t){let{open:r,rootPath:l,scanning:h}=t,[p,g]=n([]),[N,k]=n(!1),[C,P]=n(!1),[M,y]=n(null),[G,E]=n(0),j=t.repos.join("\x00"),A=i(!0),b=i(null);o(()=>(A.current=!0,()=>{A.current=!1,b.current?.abort(),b.current=null}),[]);let S=a(async()=>{b.current?.abort();let v=new AbortController;b.current=v,P(!0),k(!0);try{let R=new URLSearchParams({repoDetails:"1"});if(l)R.set("root",l);let w=await fetch(`/api/fs/git?${R.toString()}`,{signal:v.signal}),F=await w.json();if(!A.current||b.current!==v)return;if(!w.ok||!Array.isArray(F.details)){y(F.error||`Failed to read repositories (HTTP ${w.status})`);return}g(F.details),y(null)}catch(R){if(!A.current||b.current!==v)return;if(R instanceof Error&&R.name==="AbortError")return;y(R instanceof Error?R.message:"Failed to read repositories")}finally{if(A.current&&b.current===v)b.current=null,P(!1),k(!1)}},[l]);o(()=>{if(!r){g([]),y(null),k(!1);return}S()},[r,S,j,h,G]);let L=a(()=>E((v)=>v+1),[]);return{details:p,loading:N,reading:C,error:M,refresh:L}}function B(t){let r=new Map;for(let l of t){if(!l||l==="."){if(!r.has(""))r.set("",{key:"",label:null,paths:[]});r.get("").paths.push(".");continue}let h=l.indexOf("/"),p=h===-1?"":l.slice(0,h),g=r.get(p);if(!g)g={key:p,label:p===""?null:p,paths:[]},r.set(p,g);g.paths.push(l)}for(let l of r.values())l.paths.sort((h,p)=>h==="."?-1:p==="."?1:h.localeCompare(p));return[...r.values()].sort((l,h)=>{if(l.key==="")return-1;if(h.key==="")return 1;return l.key.localeCompare(h.key)})}function W(t,r){if(t===".")return"workspace root";if(r==="")return t;return t.slice(r.length+1)}function q({isOpen:t,rootPath:r,activeRepo:l,repos:h,scanning:p,onSelectRepo:g,onRefreshRepos:N,onClose:k}){let[C,P]=n(""),[M,y]=n(null),{details:G,loading:E,reading:j,error:A,refresh:b}=H({open:t,rootPath:r,repos:h,scanning:p});o(()=>{if(!t)P(""),y(null)},[t]);let S=u(()=>{let x=C.trim().toLowerCase();if(!x)return G;return G.filter((c)=>c.path.toLowerCase().includes(x))},[G,C]),L=u(()=>B(S.map((x)=>x.path)),[S]),v=u(()=>{let x=new Map;for(let c of G)x.set(c.path,c);return x},[G]),R=a(()=>{N(),b()},[N,b]),w=a(async(x)=>{let c=r?td(r,x==="."?"":x):x,z=await Ct(c);y(z?{text:`Copied ${c}`,kind:"success"}:{text:"Clipboard unavailable",kind:"error"})},[r]),F=a(async(x)=>{let c=new FormData;if(c.append("actionType","open_explorer"),c.append("path","."),c.append("repo",x),r)c.append("root",r);try{let z=await fetch("/api/fs/action",{method:"POST",body:c}),T=await z.json();if(!z.ok||T.error)y({text:T.error||"Could not open the file manager",kind:"error"})}catch{y({text:"Could not open the file manager",kind:"error"})}},[r]);if(!t)return null;return e(Z,{onClose:k,maxWidthClass:"max-w-[min(96vw,720px)]",header:e("div",{className:"flex items-center gap-2 min-w-0",children:[e(zp,{size:14,className:"text-ink/60 flex-shrink-0"}),e("h2",{className:"text-sm font-semibold text-ink",children:"Repositories"}),e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:[h.length," in this workspace"]})]}),children:[e("div",{className:"px-5 py-3 flex items-center gap-2 border-b border-ink/10",children:[e(U,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:C,onChange:(x)=>P(x.currentTarget.value),placeholder:"Filter repositories…","aria-label":"Filter repositories",className:"flex-1 min-w-0 bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),e("button",{type:"button",onClick:R,disabled:j||p,title:"Re-discover repositories and re-read their state","aria-label":"Refresh repositories",className:"text-ink/40 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 flex-shrink-0",children:e(D,{size:12,className:j||p?"animate-spin":""})})]}),p&&e("div",{className:"px-5 py-1.5 border-b border-ink/10 text-[10px] font-mono text-ink/50 flex items-center gap-1.5",children:[e(m,{size:10,className:"animate-spin"}),"Still discovering repositories in this workspace…"]}),M&&e("div",{className:`px-5 py-1.5 border-b border-ink/10 text-[10px] font-mono truncate ${M.kind==="error"?"text-error":"text-ink/60"}`,title:M.text,role:"status",children:M.text}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:E&&G.length===0?e("div",{className:"flex items-center justify-center gap-2 py-12 text-xs text-ink/50 font-mono",children:[e(m,{size:14,className:"animate-spin text-info"}),"Reading repositories…"]}):A?e("div",{className:"py-12 px-6 text-center text-xs text-error font-mono",children:A}):S.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:C.trim()?"No matching repositories.":"No repositories in this workspace."}):L.map((x)=>e("div",{children:[e("div",{className:"px-4 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold bg-canvas/40 border-b border-ink/5 sticky top-0",children:x.label??kg(".",r)}),x.paths.map((c)=>{let z=v.get(c);if(!z)return null;return e(O,{row:z,active:c===l,name:W(c,x.key),loading:j,onSelect:()=>{g(c),k()},onCopyPath:()=>void w(c),onReveal:()=>void F(c)},c)})]},x.key))})]})}function kr({rootPath:t,activeRepo:r,onSelectRepo:l,repos:h,scanning:p,onRefreshRepos:g}){let[N,k]=n(!1),C=u(()=>({root:t??null,repo:r,rows:Zp(t,h),scanning:p,ready:!0,setRepo:l,refresh:g}),[t,r,h,p,l,g]),P=a(()=>k(!0),[]);return e("div",{className:"relative min-w-0",children:[e(Yp,{scope:C,onManage:P}),e(q,{isOpen:N,rootPath:t,activeRepo:r,repos:h,scanning:p,onSelectRepo:l,onRefreshRepos:g,onClose:()=>k(!1)})]})}
|
|
2
2
|
export{zp,kr};
|