@kabmo-labs/kabmo 0.57.0 → 0.57.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 +2 -2
- package/dist/client/static/js/{Body-k96gtstv.js → Body-p6zwk0nx.js} +1 -1
- package/dist/client/static/js/{CsvGrid-t84xmbk9.js → CsvGrid-563qmmmr.js} +1 -1
- package/dist/client/static/js/{DocxView-4jda3szm.js → DocxView-5j69q3s0.js} +1 -1
- package/dist/client/static/js/{DrawioView-9qvvtnvt.js → DrawioView-gd6k3hvn.js} +1 -1
- package/dist/client/static/js/{HtmlPreview-4pba1ys5.js → HtmlPreview-6gnktzzp.js} +1 -1
- package/dist/client/static/js/{ImageView-0gf5xdsv.js → ImageView-fkfq3fwv.js} +1 -1
- package/dist/client/static/js/{LayoutWrapper-pwbq5syv.js → LayoutWrapper-mdb1qm26.js} +1 -1
- package/dist/client/static/js/MergeDiffView-7kpjxcg9.js +1 -0
- package/dist/client/static/js/{Modal-yjszc3vy.js → Modal-0p9cr2tn.js} +1 -1
- package/dist/client/static/js/{PdfView-sny55sne.js → PdfView-n1zq27td.js} +1 -1
- package/dist/client/static/js/{SessionsView-q3800n83.js → SessionsView-gptt0rq8.js} +1 -1
- package/dist/client/static/js/{SheetView-ezqak2b4.js → SheetView-nes7j86v.js} +1 -1
- package/dist/client/static/js/{SvgPreview-q1cvdf4s.js → SvgPreview-vv0qzkt7.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-ftm2qwa3.js → abnfDiagram-O67JEVCF-02g96sn6.js} +1 -1
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-j8kqfzmf.js → architectureDiagram-NJMV4G6O-7qj2fpwt.js} +1 -1
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-m3zpsp9h.js → blockDiagram-BEXU5L5S-grdr1j2h.js} +1 -1
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-myshvbrx.js → c4Diagram-YGBWAQC7-7y980xpx.js} +1 -1
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-s0cwmsj4.js → classDiagram-v2-NBCMYWYE-29ag4js1.js} +1 -1
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-t5t02sfr.js → cose-bilkent-JH36ORCC-e5dvgehd.js} +1 -1
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-6yxd72sh.js → cynefinDiagram-VND7K2PF-eq6fmx0b.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-vft5103m.js → dagre-6A5THRUB-xfhwp8ha.js} +1 -1
- package/dist/client/static/js/{diagram-22UHCM2B-yy2jfvxt.js → diagram-22UHCM2B-1bw6x6zt.js} +1 -1
- package/dist/client/static/js/{diagram-3UASUU5V-1xqhzq20.js → diagram-3UASUU5V-076ej5n5.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-f11cxgvm.js → diagram-ATOU4E4O-cvf9fhdq.js} +1 -1
- package/dist/client/static/js/{diagram-CDSNMT55-gqmkfcp7.js → diagram-CDSNMT55-hn1wdx54.js} +1 -1
- package/dist/client/static/js/{diagram-MLGK6HIB-1fg7304a.js → diagram-MLGK6HIB-76gk27b5.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-mem80369.js → diagram-MPIPVDR6-0cbajhpx.js} +1 -1
- package/dist/client/static/js/{dockerfile-jarjwxp9.js → dockerfile-7atfjhnf.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-4rcbvfrj.js → ebnfDiagram-ZINNZB2B-n0g3b9m2.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-ykd0stxz.js → elk-276RUBZZ-f6wrjcv9.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-b2th9bk4.js → erDiagram-OPXOYQCR-jz622yrg.js} +1 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-5bvd5k2t.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-64p5r7cx.js → ganttDiagram-FUAMR5RP-2ex4nxyg.js} +1 -1
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-z3yc333r.js → gitGraphDiagram-X574FWY7-38eyay6g.js} +1 -1
- package/dist/client/static/js/{index-c2vc6znd.js → index-1q934wfk.js} +1 -1
- package/dist/client/static/js/{index-yktwxghr.js → index-28wv94gz.js} +1 -1
- package/dist/client/static/js/{index-3w18s59k.js → index-3wgjtp2k.js} +1 -1
- package/dist/client/static/js/{index-wgcgshdh.js → index-4cff0zg2.js} +1 -1
- package/dist/client/static/js/{index-t415df0c.js → index-55v3qv04.js} +1 -1
- package/dist/client/static/js/{index-hmjb96kb.js → index-63mk2qk6.js} +1 -1
- package/dist/client/static/js/{index-2gf593e3.js → index-6z30g3ha.js} +1 -1
- package/dist/client/static/js/{index-gr07t5c4.js → index-7trfm17d.js} +1 -1
- package/dist/client/static/js/{index-h4qmywn5.js → index-8444mec5.js} +1 -1
- package/dist/client/static/js/{index-5m0se6fk.js → index-9gfn1a3h.js} +1 -1
- package/dist/client/static/js/{index-n71ffk62.js → index-ays8t3t3.js} +2 -2
- package/dist/client/static/js/{index-jd2h5tvh.js → index-cxe75e06.js} +1 -1
- package/dist/client/static/js/{index-w659dhe5.js → index-db7vsjkd.js} +1 -1
- package/dist/client/static/js/{index-k9v6477a.js → index-dmb1pykr.js} +1 -1
- package/dist/client/static/js/{index-3x3nhs8n.js → index-ep99arz1.js} +1 -1
- package/dist/client/static/js/{index-k57bandz.js → index-ewst55j2.js} +1 -1
- package/dist/client/static/js/{index-mv83hpva.js → index-fqc1snjw.js} +1 -1
- package/dist/client/static/js/{index-q9gbwqbe.js → index-g2e0m757.js} +1 -1
- package/dist/client/static/js/{index-mdmtxh1c.js → index-jaxhfk9x.js} +1 -1
- package/dist/client/static/js/{index-y5mf2w81.js → index-jsn2kedv.js} +1 -1
- package/dist/client/static/js/{index-ebnd5hnr.js → index-n1xmkf2g.js} +1 -1
- package/dist/client/static/js/{index-1mm7kyjd.js → index-pe4d9wht.js} +1 -1
- package/dist/client/static/js/{index-bwwgtesb.js → index-pjf5wak8.js} +1 -1
- package/dist/client/static/js/{index-zj65csnm.js → index-sm8gpk3g.js} +1 -1
- package/dist/client/static/js/{index-nr5gwny1.js → index-st6a8q5z.js} +147 -147
- package/dist/client/static/js/{index-k6wms0kx.js → index-stmwbavz.js} +1 -1
- package/dist/client/static/js/index-swaveqxg.css +1 -0
- package/dist/client/static/js/{index-y6qtx68e.js → index-t82q5t6m.js} +1 -1
- package/dist/client/static/js/{index-ewtv8gg7.js → index-t9zjfxvc.js} +1 -1
- package/dist/client/static/js/{index-y69cbdvd.js → index-tdbcp70z.js} +1 -1
- package/dist/client/static/js/{index-6m5n8b6w.js → index-tdryzzy9.js} +1 -1
- package/dist/client/static/js/{index-g71wn1pr.js → index-tksrpqkh.js} +1 -1
- package/dist/client/static/js/{index-ep353yxd.js → index-v38j2zxn.js} +1 -1
- package/dist/client/static/js/{index-rqpbva78.js → index-x17y7xdr.js} +1 -1
- package/dist/client/static/js/{index-kbaffwp1.js → index-xfnjwhan.js} +2 -2
- package/dist/client/static/js/{index-x6945djv.js → index-xrb4kjr3.js} +1 -1
- package/dist/client/static/js/{index-dxx49b9m.js → index-zv8wrvha.js} +1 -1
- package/dist/client/static/js/{index-sw370sk7.js → index-zynbvm7x.js} +1 -1
- package/dist/client/static/js/{index-77wznmg5.js → index-zzggk17b.js} +1 -1
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-59xq3n1b.js → infoDiagram-VRGFBTTK-c55t0tvd.js} +1 -1
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-v18q4qt7.js → ishikawaDiagram-OU5B5YK6-r9kg5kg5.js} +1 -1
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-etazj0p8.js → journeyDiagram-ZHPQQLJL-zmmst4v8.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-ph15e5p2.js → kanban-definition-PNTS6WVX-3tt6sc9a.js} +1 -1
- package/dist/client/static/js/{mermaid.core-7ygd161b.js → mermaid.core-pkrs8zp5.js} +2 -2
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-j5xsftrf.js → mindmap-definition-NLK3R4M7-b4c6gxg4.js} +1 -1
- package/dist/client/static/js/one-dark-pro-sstqnzcf.js +1 -0
- package/dist/client/static/js/one-light-6fpxxq2j.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-09nvb70v.js → pegDiagram-GJSIUBJH-9jkat1mz.js} +1 -1
- package/dist/client/static/js/{pieDiagram-5QR66LMP-6ymh1960.js → pieDiagram-5QR66LMP-6pbchjh7.js} +1 -1
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-hk61avw2.js → quadrantDiagram-O4NWA36T-p9brea19.js} +1 -1
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-3jvqrfnb.js → railroadDiagram-XR7U4H2S-3cep8css.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-zthfj48k.js → requirementDiagram-PLB6GJNP-x1yjgsrr.js} +1 -1
- package/dist/client/static/js/{rust-q7n7q6dy.js → rust-yy8gekx8.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-nh5d6xte.js → sankeyDiagram-IPEJSGJF-23wzf4aj.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-crej9b40.js → sequenceDiagram-PO4LG4MO-w4wr3zzr.js} +1 -1
- package/dist/client/static/js/{sizeCapture-INFHLROL-nvvxw58j.js → sizeCapture-INFHLROL-aabfesnr.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-e6tztjnj.js → stateDiagram-v2-GCMORJYK-t0n288xw.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-xhdqjqmf.js → swimlanes-2SLR337P-1nnm0p7h.js} +1 -1
- package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-hbwg3m3k.js → swimlanesDiagram-TC7HE7FX-cx3f29mq.js} +1 -1
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-9cve31zc.js → timeline-definition-EJHVYXUP-8pyssn0q.js} +1 -1
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-asycstwe.js → usecaseDiagram-POWQR4AR-vveepvt6.js} +1 -1
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-gbzk6era.js → vennDiagram-UO4OBE2U-tqyvmqxc.js} +1 -1
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-1swwfszr.js → wardleyDiagram-VNRHLVJA-p8rs34em.js} +1 -1
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-v7qkwv0b.js → xychartDiagram-PMCCYNJV-pgnvxtps.js} +1 -1
- package/package.json +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.ts +10 -8
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/toggle-label.test.ts +37 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/toggle-label.ts +17 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.test.tsx +18 -15
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +7 -8
- package/src/server/lib/dictation/capability.server.test.ts +9 -6
- package/src/server/lib/dictation/worker-process.ts +9 -2
- package/dist/client/static/js/MergeDiffView-m4jkr786.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-f3bdtc1z.js +0 -1
- package/dist/client/static/js/index-taz2nfym.css +0 -1
- package/dist/client/static/js/one-dark-pro-4s2rr12v.js +0 -1
- package/dist/client/static/js/one-light-3bkk59ww.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d,n,o,K,i,u,a,Dr,e,s,ro,_e,ao,p,Kn,Ne,Q,I,dt,f,E,ue,pt,ae,fe,de,Jn,fn,Zn,F,S,Ra,U,La,vn,h,Mr,Lo,sr,Bm,Te,T,_m,Jg,xr,wr,xt,nt,he,_d,Ei,X,mt,ft,On,an,gt,wl,We,be,J}from"./index-nr5gwny1.js";import{wm,Tr}from"./index-jd2h5tvh.js";var jt={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]},Ve=s(jt);var Ut={name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]},Ye=s(Ut);function Xe({message:t,hasStagedChanges:l,isBusy:c=!1,amend:r=!1,seeded:m=!1,isGenerating:g=!1,suggestion:x=null,generated:v=!1,onToggleAmend:N,onChangeMessage:P,onCommit:w,onGenerate:C,onUseSuggestion:R,onDismissSuggestion:G}){let M=t.trim().length>0&&!c&&(r||l),k=(r||l)&&!c&&!g,b=r?"Rewrite the previous commit with this message":l?"Commit staged changes":"Stage changes first",y=g?"Generating…":r||l?"Generate a commit message from the staged changes":"Stage changes first";return e("div",{className:"border-t border-ink/10 bg-canvas/50 p-3 flex flex-col gap-2",children:[x&&e("div",{className:"rounded border border-ink/20 bg-paper p-2.5 space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-ink/45",children:"Generated message"}),e("div",{className:"flex items-center gap-1",children:[e("button",{type:"button",onClick:R,className:"px-2 py-0.5 rounded bg-ink text-canvas text-[10px] font-medium hover:bg-ink/90 transition-colors cursor-pointer",children:"Use"}),e("button",{type:"button",onClick:G,className:"px-2 py-0.5 rounded border border-ink/20 text-ink/70 text-[10px] font-medium hover:bg-ink/5 transition-colors cursor-pointer",children:"Dismiss"})]})]}),e("pre",{className:"whitespace-pre-wrap break-words text-[11px] text-ink/80 font-mono max-h-32 overflow-y-auto",children:x})]}),e("textarea",{value:t,onChange:(L)=>P(L.currentTarget.value),onKeyDown:(L)=>{if(L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&M)L.preventDefault(),w()},placeholder:r?"New message for the previous commit (⌘/Ctrl+Enter to commit)":"Commit message (⌘/Ctrl+Enter to commit)",rows:5,className:"w-full resize-y min-h-[100px] max-h-[200px] bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),v&&t.trim().length>0&&e("div",{className:"flex items-center gap-1 text-[10px] text-ink/40",children:[e(Ne,{size:10})," Generated from staged changes"]}),e("div",{className:"flex flex-wrap items-center gap-2",children:[e("label",{className:"flex items-center gap-1.5 text-[11px] text-ink/70 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:r,onChange:(L)=>N?.(L.currentTarget.checked),className:`${be} accent-ink cursor-pointer`}),"Amend"]}),r&&m&&e("span",{className:"text-[10px] text-ink/40",title:"The previous commit's message, loaded as an editable starting point",children:"previous message loaded"}),e("button",{type:"button",onClick:C,disabled:!k,title:y,"aria-label":"Generate commit message with AI",className:"ml-auto flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[g?e(p,{size:12,className:"animate-spin"}):e(Ne,{size:12}),g?"Generating…":"Generate"]}),e("button",{type:"button",onClick:w,disabled:!M,title:b,className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(f,{size:12}),r?"Amend commit":"Commit"]})]})]})}function Qe({operation:t,conflicts:l,isBusy:c,onAbort:r,onContinue:m}){let g=Lo[t],x=l.length,v=x===0,N=t!=="stash-pop";return e("div",{className:"border-t border-warning/30 bg-warning/5 p-3 flex flex-col gap-2",children:[e("div",{className:"flex items-center gap-2 text-xs text-ink",children:[e(I,{size:13,className:"text-warning flex-shrink-0"}),e("span",{className:"font-medium",children:[g.charAt(0).toUpperCase()+g.slice(1)," in progress"]}),e("span",{className:`font-mono tabular-nums text-[10px] ${v?"text-success":"text-warning"}`,children:v?"all conflicts resolved":`${x} conflict${x===1?"":"s"} left`})]}),!v&&e("div",{className:"max-h-20 overflow-y-auto scrollbar-overlay-container font-mono text-[10px] text-warning/90 space-y-0.5",children:l.map((P)=>e("div",{className:"truncate",title:P,children:P},P))}),e("div",{className:"flex items-stretch gap-2",children:[e("button",{type:"button",onClick:r,disabled:c,title:`Abort the ${g} and restore the previous state`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-error/40 text-error hover:bg-error/10 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(vn,{size:12}),"Abort ",g]}),N&&e("button",{type:"button",onClick:m,disabled:c||!v,title:v?`Conclude the ${g}`:`Resolve all ${x} conflict(s) first`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-transparent bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(Jn,{size:12}),"Continue ",g]})]})]})}function Ze({branchRef:t,showBranchMenu:l,setShowBranchMenu:c,branch:r,branches:m,remoteBranches:g,onCheckout:x,onMerge:v,onOpenBranchPrompt:N,onManageBranches:P,optionsRef:w,showOptions:C,setShowOptions:R,onHistory:G,onGraph:M,viewMode:k,setViewMode:b,isBusy:y=!1,syncCount:L={ahead:0,behind:0},syncing:B=!1,onSync:z,onFetch:q,detached:A=!1}){let[V,Y]=n("");o(()=>{if(!l)Y("")},[l]);let _=V.trim(),H=u(()=>m.filter((D)=>an(D,_)),[m,_]),O=u(()=>g.filter((D)=>an(D,_)),[g,_]);return e("div",{className:"p-3 border-b border-ink/10 bg-canvas/50 flex items-center justify-between",children:[e("div",{className:"relative",ref:t,children:[e("button",{onClick:()=>c(!l),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-[11px] text-ink/80 font-medium",title:A?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(de,{size:12,className:A?"text-warning":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${A?"font-mono text-warning":""}`,children:r}),e(E,{size:12,className:"text-ink/40"})]}),l&&e("div",{className:"glass-popover absolute top-full left-0 mt-1 w-64 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:[e(On,{value:V,onChange:Y,ariaLabel:"Search branches",placeholder:"Search branches…"}),e("div",{className:"max-h-48 scrollbar-overlay-container py-1",children:[H.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),H.map((D)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{x(D),c(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:D}),r===D&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==D&&e("button",{type:"button",onClick:()=>{v(D),c(!1)},title:`Merge ${D} into ${r}`,"aria-label":`Merge ${D} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Jn,{size:12})})]},D))]}),O.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),O.map((D)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{x(D),c(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:D}),r===D&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==D&&e("button",{type:"button",onClick:()=>{v(D),c(!1)},title:`Merge ${D} into ${r}`,"aria-label":`Merge ${D} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Jn,{size:12})})]},D))]}),H.length===0&&O.length===0&&e("div",{className:"px-3 py-2 text-ink/40 italic",children:["No match for “",_,"”"]}),e("div",{className:"w-full h-px bg-ink/10 my-1"}),e("button",{onClick:()=>{N(),c(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80 italic",children:[e(F,{size:12}),e("span",{children:"Create new branch..."})]}),e("button",{onClick:P,className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80",children:[e(La,{size:12}),e("span",{children:"Manage branches..."})]})]})]})]}),e("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:w,children:[e("button",{type:"button",onClick:q,disabled:y,title:"Fetch from all remotes and prune deleted branches","aria-label":"Fetch",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e(ro,{size:13})}),e("button",{type:"button",onClick:z,disabled:y,title:B?"Syncing with upstream…":L.ahead>0&&L.behind>0?`Pull ${L.behind} then push ${L.ahead} commit(s)`:L.ahead>0?`Push ${L.ahead} commit(s)`:L.behind>0?`Pull ${L.behind} commit(s)`:"Up to date — sync anyway","aria-label":"Sync with upstream","aria-busy":B,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${B?"":"disabled:opacity-40"}`,children:[e(S,{size:13,className:B?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",L.ahead," ↓",L.behind]})]}),e("button",{type:"button",onClick:G,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Kn,{size:13})}),e("button",{type:"button",onClick:M,title:"Git Graph","aria-label":"Git Graph",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Jn,{size:13})}),e("button",{type:"button",onClick:()=>R(!C),title:"View Options","aria-label":"View Options","aria-expanded":C,className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(_e,{size:13})}),C&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-36 bg-paper border border-ink/15 rounded-md shadow-lg z-50 py-1 font-mono text-xs",children:[e("button",{type:"button",onClick:()=>{b("flat"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(Ye,{size:12,className:"text-ink/60"}),e("span",{children:"View as List"})]}),k==="flat"&&e(f,{size:12,className:"text-ink"})]}),e("button",{type:"button",onClick:()=>{b("tree"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(Ve,{size:12,className:"text-ink/60"}),e("span",{children:"View as Tree"})]}),k==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function Je({activeRepo:t,repos:l,isRefreshing:c,rootPath:r,reposScanning:m,onSelectRepo:g,onRefresh:x,onRefreshRepos:v}){return e(xt,{left:e(d,{children:[e(wm,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(Tr,{rootPath:r,activeRepo:t,onSelectRepo:g,repos:l,scanning:m,onRefreshRepos:v})]}),right:e(nt,{label:"Refresh",onClick:x,busy:c})})}function Fe({change:t,isStaged:l,repo:c,rootPath:r,onAction:m}){let g=sr(t.status,l),{charStatus:x,colorClass:v}=g,N=t.file.split("/"),P=N.pop()||t.file,w=N.length>0?N.join("/"):"";return e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-ink/5 cursor-pointer group text-[11px] transition-colors",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:l,status:x,repo:c||".",root:r}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e("span",{className:`font-bold font-mono text-[10px] w-3 flex-shrink-0 text-center ${v}`,title:`Status: ${g.label}`,children:x}),e(mt,{name:P,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${v}`,title:t.file,children:P}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:[!l&&e(d,{children:[e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),m("revert",t.file)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:11})}),e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),m("stage",t.file)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(F,{size:11})})]}),l&&e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),m("unstage",t.file)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(fn,{size:11})})]})})]})}function et({change:t,repo:l,rootPath:c,onResolve:r}){let[m,g]=n(!1),[x,v]=n(null),N=t.file.split("/"),P=N.pop()||t.file,w=N.length>0?N.join("/"):"",C=()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:!1,status:t.status,repo:l,root:c}}))},R=async()=>{let k=!m;if(g(k),k&&x===null){let b=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:l||"."});if(c)b.set("root",c);try{let L=await(await fetch(`/api/fs/git?${b.toString()}`)).json();v(L.markers??{})}catch{v({})}}},G=x?.ours||"ours",M=x?.theirs||"theirs";return e("div",{className:"border-b border-warning/20 last:border-b-0",children:[e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-warning/5 cursor-pointer group text-[11px] transition-colors",onClick:C,children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e(ao,{size:11,className:"text-warning flex-shrink-0"}),e(mt,{name:P,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning",title:t.file,children:P}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w}),Mr(t.status)&&e("span",{className:"text-[10px] text-warning/70 font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),R()},title:m?"Hide resolve actions":"Show resolve actions","aria-label":m?"Hide resolve actions":"Show resolve actions","aria-expanded":m,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 flex-shrink-0",children:m?e(pt,{size:11}):e(E,{size:11})})]}),m&&e("div",{className:"px-3 pb-2 pt-0.5 flex flex-wrap items-center gap-1.5",children:[e("button",{type:"button",onClick:()=>r(t.file,"ours"),title:`Take ${G} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",G]}),e("button",{type:"button",onClick:()=>r(t.file,"theirs"),title:`Take ${M} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",M]}),e("button",{type:"button",onClick:()=>r(t.file,""),title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer flex items-center gap-1",children:[e(f,{size:10}),"mark resolved"]})]})]})}function Wt(t){let l={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let r of t){let m=r.file.replace(/^[./]+/,""),g=m.endsWith("/"),x=m.replace(/\/$/,"").split("/").filter(Boolean),v=l,N="";for(let P=0;P<x.length;P++){let w=x[P];N=N?`${N}/${w}`:w;let C=P===x.length-1;if(C&&!g)v.children.push({id:N,name:w,path:N,type:"file",change:r,children:[],changeCount:1});else{let G=v.children.find((M)=>M.type==="folder"&&M.name===w);if(!G)G={id:N,name:w,path:N,type:"folder",children:[],changeCount:0,change:C&&g?r:void 0},v.children.push(G);v=G}}}function c(r){if(r.type==="file")return 1;let m=r.change?1:0;for(let g of r.children)m+=c(g);return r.changeCount=m,r.children.sort((g,x)=>{if(g.type==="folder"&&x.type==="file")return-1;if(g.type==="file"&&x.type==="folder")return 1;return g.name.localeCompare(x.name)}),m}return c(l),l.children}function tt(t){let{sessionId:l,ready:c,read:r}=_m(),m=u(()=>Wt(t),[t]),g=u(()=>{let R=new Set;function G(M){for(let k of M)if(k.type==="folder"){if(R.add(k.id),k.children&&k.children.length>0)G(k.children)}}return G(m),R},[m]),[x,v]=T("git.expandedFolders",[]),N=u(()=>new Set(x),[x]),P=i(null);o(()=>{if(!c||P.current===l)return;if(g.size===0)return;if(P.current=l,r("git.expandedFolders",[]).length>0)return;v(Array.from(g))},[c,l,g,r,v]);let w=a((R)=>{v((G)=>{let M=new Set(G);if(M.has(R))M.delete(R);else M.add(R);return Array.from(M)})},[v]),C=a((R)=>N.has(R),[N]);return{tree:m,expandedFolders:N,toggleFolder:w,isFolderOpen:C,expandAll:()=>v(Array.from(g)),collapseAll:()=>v([])}}function He({node:t,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:m,repo:g,rootPath:x}){let v=t.type==="folder",N=v?c(t.id):!1;if(v)return e("div",{className:"select-none",children:[e("div",{className:"flex items-center justify-between px-2 py-1 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>r(t.id),children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center text-ink/40 flex-shrink-0",children:N?e(E,{size:12}):e(ue,{size:12})}),e(mt,{name:t.name,isFolder:!0,isOpen:N,size:13,className:"flex-shrink-0"}),e("span",{className:"font-medium text-ink truncate",children:t.name}),e("span",{className:"text-[10px] text-ink/40 font-normal px-1 py-0.2 bg-ink/5 rounded-full ml-1",children:t.changeCount})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!l?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("stage",t.path)},title:`Stage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(F,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("unstage",t.path)},title:`Unstage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(fn,{size:11})})})})]}),N&&t.children&&t.children.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map((k)=>e(He,{node:k,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:m,repo:g,rootPath:x},k.id))})]});let P=t.change,w=sr(P?.status||"M",l),{charStatus:C,colorClass:R}=w,G=P?P.file:t.path;return e("div",{className:"flex items-center justify-between px-2 py-0.5 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:G,staged:l,status:C,repo:g||".",root:x}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center flex-shrink-0",children:e("span",{className:`font-bold font-mono text-[10px] ${R}`,title:`Status: ${w.label}`,children:C})}),e(mt,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${R}`,title:G,children:t.name})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!l?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("revert",G)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("stage",G)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(F,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("unstage",G)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(fn,{size:11})})})})]})}function ze({changes:t,isStaged:l,repo:c,rootPath:r,onAction:m}){let{tree:g,isFolderOpen:x,toggleFolder:v}=tt(t);if(g.length===0)return null;return e("div",{className:"py-0.5",children:g.map((N)=>e(He,{node:N,isStaged:l,isFolderOpen:x,toggleFolder:v,onAction:m,repo:c,rootPath:r},N.id))})}function ot({changes:t,isLoading:l,viewMode:c,repo:r,rootPath:m,onAction:g,onResolve:x}){let[v,N]=T("git.stagedExpanded",!0),[P,w]=T("git.unstagedExpanded",!0),[C,R]=T("git.conflictsExpanded",!0),G=t.filter((b)=>Mr(b.status)),M=t.filter((b)=>{if(Mr(b.status))return!1;let y=b.status;return y&&y[0]!==" "&&y[0]!=="?"}),k=t.filter((b)=>{if(Mr(b.status))return!1;let y=b.status;return y&&y[1]!==" "&&y[1]!=="?"||y==="??"});if(l&&t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"Loading..."})});if(t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"No changes found."})});return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"py-1",children:[G.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-warning/5 cursor-pointer transition-colors",onClick:()=>R(!C),children:e("div",{className:"flex items-center space-x-1 font-semibold text-warning text-xs",children:[e("span",{className:"w-3 text-center",children:C?"▾":"▸"}),e("span",{children:"Conflicts"}),e("span",{className:"text-warning/70 font-normal ml-1 border border-warning/30 rounded-full px-1.5 text-[10px] bg-paper",children:G.length})]})}),C&&G.map((b)=>e(et,{change:b,repo:r,rootPath:m,onResolve:x??(()=>{})},`conflict-${b.file}`))]}),M.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>N(!v),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:v?"▾":"▸"}),e("span",{children:"Staged Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:M.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("button",{type:"button",onClick:(b)=>{b.stopPropagation(),g("unstage_all")},title:"Unstage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(fn,{size:12})})})]}),v&&(c==="tree"?e(ze,{changes:M,isStaged:!0,repo:r,rootPath:m,onAction:g}):M.map((b)=>e(Fe,{change:b,isStaged:!0,repo:r,rootPath:m,onAction:g},b.file+"staged")))]}),k.length>0&&e("div",{children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>w(!P),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:P?"▾":"▸"}),e("span",{children:"Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:k.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:[e("button",{type:"button",onClick:(b)=>{b.stopPropagation(),g("revert_all")},title:"Discard All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:12})}),e("button",{type:"button",onClick:(b)=>{b.stopPropagation(),g("stage_all")},title:"Stage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(F,{size:12})})]})]}),P&&(c==="tree"?e(ze,{changes:k,isStaged:!1,repo:r,rootPath:m,onAction:g}):k.map((b)=>e(Fe,{change:b,isStaged:!1,repo:r,rootPath:m,onAction:g},b.file+"unstaged")))]})]})})}function st({matches:t,loaded:l,total:c,hasMore:r,isFiltering:m}){if(m)return`${t} of ${l} loaded`;if(typeof c==="number"&&c>0)return r||l<c?`${l} of ${c}`:`${c} commits`;return r?`${l}+ commits`:`${l} commits`}function rt({isGraphMode:t,onToggleMode:l,searchQuery:c,onSearchChange:r,onRefresh:m,onClose:g,isRefreshing:x,totalCommits:v,loadedCount:N,totalCount:P,hasMore:w}){let C=st({matches:v,loaded:N,total:P,hasMore:w,isFiltering:c.trim().length>0});return e("div",{className:`flex flex-col gap-2 px-3 lg:px-5 py-3 border-b border-ink/10 bg-paper select-none
|
|
1
|
+
import{d,n,o,K,i,u,a,Dr,e,s,ro,_e,ao,p,Kn,Ne,Q,I,dt,f,E,ue,pt,ae,fe,de,Jn,fn,Zn,F,S,Ra,U,La,vn,h,Mr,Lo,sr,Bm,Te,T,_m,Jg,xr,wr,xt,nt,he,_d,Ei,X,mt,ft,On,an,gt,wl,We,be,J}from"./index-st6a8q5z.js";import{wm,Tr}from"./index-cxe75e06.js";var jt={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]},Ve=s(jt);var Ut={name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]},Ye=s(Ut);function Xe({message:t,hasStagedChanges:l,isBusy:c=!1,amend:r=!1,seeded:m=!1,isGenerating:g=!1,suggestion:x=null,generated:v=!1,onToggleAmend:N,onChangeMessage:P,onCommit:w,onGenerate:C,onUseSuggestion:R,onDismissSuggestion:G}){let M=t.trim().length>0&&!c&&(r||l),k=(r||l)&&!c&&!g,b=r?"Rewrite the previous commit with this message":l?"Commit staged changes":"Stage changes first",y=g?"Generating…":r||l?"Generate a commit message from the staged changes":"Stage changes first";return e("div",{className:"border-t border-ink/10 bg-canvas/50 p-3 flex flex-col gap-2",children:[x&&e("div",{className:"rounded border border-ink/20 bg-paper p-2.5 space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-ink/45",children:"Generated message"}),e("div",{className:"flex items-center gap-1",children:[e("button",{type:"button",onClick:R,className:"px-2 py-0.5 rounded bg-ink text-canvas text-[10px] font-medium hover:bg-ink/90 transition-colors cursor-pointer",children:"Use"}),e("button",{type:"button",onClick:G,className:"px-2 py-0.5 rounded border border-ink/20 text-ink/70 text-[10px] font-medium hover:bg-ink/5 transition-colors cursor-pointer",children:"Dismiss"})]})]}),e("pre",{className:"whitespace-pre-wrap break-words text-[11px] text-ink/80 font-mono max-h-32 overflow-y-auto",children:x})]}),e("textarea",{value:t,onChange:(L)=>P(L.currentTarget.value),onKeyDown:(L)=>{if(L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&M)L.preventDefault(),w()},placeholder:r?"New message for the previous commit (⌘/Ctrl+Enter to commit)":"Commit message (⌘/Ctrl+Enter to commit)",rows:5,className:"w-full resize-y min-h-[100px] max-h-[200px] bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),v&&t.trim().length>0&&e("div",{className:"flex items-center gap-1 text-[10px] text-ink/40",children:[e(Ne,{size:10})," Generated from staged changes"]}),e("div",{className:"flex flex-wrap items-center gap-2",children:[e("label",{className:"flex items-center gap-1.5 text-[11px] text-ink/70 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:r,onChange:(L)=>N?.(L.currentTarget.checked),className:`${be} accent-ink cursor-pointer`}),"Amend"]}),r&&m&&e("span",{className:"text-[10px] text-ink/40",title:"The previous commit's message, loaded as an editable starting point",children:"previous message loaded"}),e("button",{type:"button",onClick:C,disabled:!k,title:y,"aria-label":"Generate commit message with AI",className:"ml-auto flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[g?e(p,{size:12,className:"animate-spin"}):e(Ne,{size:12}),g?"Generating…":"Generate"]}),e("button",{type:"button",onClick:w,disabled:!M,title:b,className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(f,{size:12}),r?"Amend commit":"Commit"]})]})]})}function Qe({operation:t,conflicts:l,isBusy:c,onAbort:r,onContinue:m}){let g=Lo[t],x=l.length,v=x===0,N=t!=="stash-pop";return e("div",{className:"border-t border-warning/30 bg-warning/5 p-3 flex flex-col gap-2",children:[e("div",{className:"flex items-center gap-2 text-xs text-ink",children:[e(I,{size:13,className:"text-warning flex-shrink-0"}),e("span",{className:"font-medium",children:[g.charAt(0).toUpperCase()+g.slice(1)," in progress"]}),e("span",{className:`font-mono tabular-nums text-[10px] ${v?"text-success":"text-warning"}`,children:v?"all conflicts resolved":`${x} conflict${x===1?"":"s"} left`})]}),!v&&e("div",{className:"max-h-20 overflow-y-auto scrollbar-overlay-container font-mono text-[10px] text-warning/90 space-y-0.5",children:l.map((P)=>e("div",{className:"truncate",title:P,children:P},P))}),e("div",{className:"flex items-stretch gap-2",children:[e("button",{type:"button",onClick:r,disabled:c,title:`Abort the ${g} and restore the previous state`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-error/40 text-error hover:bg-error/10 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(vn,{size:12}),"Abort ",g]}),N&&e("button",{type:"button",onClick:m,disabled:c||!v,title:v?`Conclude the ${g}`:`Resolve all ${x} conflict(s) first`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-transparent bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(Jn,{size:12}),"Continue ",g]})]})]})}function Ze({branchRef:t,showBranchMenu:l,setShowBranchMenu:c,branch:r,branches:m,remoteBranches:g,onCheckout:x,onMerge:v,onOpenBranchPrompt:N,onManageBranches:P,optionsRef:w,showOptions:C,setShowOptions:R,onHistory:G,onGraph:M,viewMode:k,setViewMode:b,isBusy:y=!1,syncCount:L={ahead:0,behind:0},syncing:B=!1,onSync:z,onFetch:q,detached:A=!1}){let[V,Y]=n("");o(()=>{if(!l)Y("")},[l]);let _=V.trim(),H=u(()=>m.filter((D)=>an(D,_)),[m,_]),O=u(()=>g.filter((D)=>an(D,_)),[g,_]);return e("div",{className:"p-3 border-b border-ink/10 bg-canvas/50 flex items-center justify-between",children:[e("div",{className:"relative",ref:t,children:[e("button",{onClick:()=>c(!l),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-[11px] text-ink/80 font-medium",title:A?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(de,{size:12,className:A?"text-warning":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${A?"font-mono text-warning":""}`,children:r}),e(E,{size:12,className:"text-ink/40"})]}),l&&e("div",{className:"glass-popover absolute top-full left-0 mt-1 w-64 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:[e(On,{value:V,onChange:Y,ariaLabel:"Search branches",placeholder:"Search branches…"}),e("div",{className:"max-h-48 scrollbar-overlay-container py-1",children:[H.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),H.map((D)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{x(D),c(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:D}),r===D&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==D&&e("button",{type:"button",onClick:()=>{v(D),c(!1)},title:`Merge ${D} into ${r}`,"aria-label":`Merge ${D} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Jn,{size:12})})]},D))]}),O.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),O.map((D)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{x(D),c(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:D}),r===D&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==D&&e("button",{type:"button",onClick:()=>{v(D),c(!1)},title:`Merge ${D} into ${r}`,"aria-label":`Merge ${D} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Jn,{size:12})})]},D))]}),H.length===0&&O.length===0&&e("div",{className:"px-3 py-2 text-ink/40 italic",children:["No match for “",_,"”"]}),e("div",{className:"w-full h-px bg-ink/10 my-1"}),e("button",{onClick:()=>{N(),c(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80 italic",children:[e(F,{size:12}),e("span",{children:"Create new branch..."})]}),e("button",{onClick:P,className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80",children:[e(La,{size:12}),e("span",{children:"Manage branches..."})]})]})]})]}),e("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:w,children:[e("button",{type:"button",onClick:q,disabled:y,title:"Fetch from all remotes and prune deleted branches","aria-label":"Fetch",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e(ro,{size:13})}),e("button",{type:"button",onClick:z,disabled:y,title:B?"Syncing with upstream…":L.ahead>0&&L.behind>0?`Pull ${L.behind} then push ${L.ahead} commit(s)`:L.ahead>0?`Push ${L.ahead} commit(s)`:L.behind>0?`Pull ${L.behind} commit(s)`:"Up to date — sync anyway","aria-label":"Sync with upstream","aria-busy":B,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${B?"":"disabled:opacity-40"}`,children:[e(S,{size:13,className:B?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",L.ahead," ↓",L.behind]})]}),e("button",{type:"button",onClick:G,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Kn,{size:13})}),e("button",{type:"button",onClick:M,title:"Git Graph","aria-label":"Git Graph",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Jn,{size:13})}),e("button",{type:"button",onClick:()=>R(!C),title:"View Options","aria-label":"View Options","aria-expanded":C,className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(_e,{size:13})}),C&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-36 bg-paper border border-ink/15 rounded-md shadow-lg z-50 py-1 font-mono text-xs",children:[e("button",{type:"button",onClick:()=>{b("flat"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(Ye,{size:12,className:"text-ink/60"}),e("span",{children:"View as List"})]}),k==="flat"&&e(f,{size:12,className:"text-ink"})]}),e("button",{type:"button",onClick:()=>{b("tree"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(Ve,{size:12,className:"text-ink/60"}),e("span",{children:"View as Tree"})]}),k==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function Je({activeRepo:t,repos:l,isRefreshing:c,rootPath:r,reposScanning:m,onSelectRepo:g,onRefresh:x,onRefreshRepos:v}){return e(xt,{left:e(d,{children:[e(wm,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(Tr,{rootPath:r,activeRepo:t,onSelectRepo:g,repos:l,scanning:m,onRefreshRepos:v})]}),right:e(nt,{label:"Refresh",onClick:x,busy:c})})}function Fe({change:t,isStaged:l,repo:c,rootPath:r,onAction:m}){let g=sr(t.status,l),{charStatus:x,colorClass:v}=g,N=t.file.split("/"),P=N.pop()||t.file,w=N.length>0?N.join("/"):"";return e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-ink/5 cursor-pointer group text-[11px] transition-colors",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:l,status:x,repo:c||".",root:r}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e("span",{className:`font-bold font-mono text-[10px] w-3 flex-shrink-0 text-center ${v}`,title:`Status: ${g.label}`,children:x}),e(mt,{name:P,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${v}`,title:t.file,children:P}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:[!l&&e(d,{children:[e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),m("revert",t.file)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:11})}),e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),m("stage",t.file)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(F,{size:11})})]}),l&&e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),m("unstage",t.file)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(fn,{size:11})})]})})]})}function et({change:t,repo:l,rootPath:c,onResolve:r}){let[m,g]=n(!1),[x,v]=n(null),N=t.file.split("/"),P=N.pop()||t.file,w=N.length>0?N.join("/"):"",C=()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:!1,status:t.status,repo:l,root:c}}))},R=async()=>{let k=!m;if(g(k),k&&x===null){let b=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:l||"."});if(c)b.set("root",c);try{let L=await(await fetch(`/api/fs/git?${b.toString()}`)).json();v(L.markers??{})}catch{v({})}}},G=x?.ours||"ours",M=x?.theirs||"theirs";return e("div",{className:"border-b border-warning/20 last:border-b-0",children:[e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-warning/5 cursor-pointer group text-[11px] transition-colors",onClick:C,children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e(ao,{size:11,className:"text-warning flex-shrink-0"}),e(mt,{name:P,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning",title:t.file,children:P}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w}),Mr(t.status)&&e("span",{className:"text-[10px] text-warning/70 font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),R()},title:m?"Hide resolve actions":"Show resolve actions","aria-label":m?"Hide resolve actions":"Show resolve actions","aria-expanded":m,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 flex-shrink-0",children:m?e(pt,{size:11}):e(E,{size:11})})]}),m&&e("div",{className:"px-3 pb-2 pt-0.5 flex flex-wrap items-center gap-1.5",children:[e("button",{type:"button",onClick:()=>r(t.file,"ours"),title:`Take ${G} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",G]}),e("button",{type:"button",onClick:()=>r(t.file,"theirs"),title:`Take ${M} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",M]}),e("button",{type:"button",onClick:()=>r(t.file,""),title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer flex items-center gap-1",children:[e(f,{size:10}),"mark resolved"]})]})]})}function Wt(t){let l={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let r of t){let m=r.file.replace(/^[./]+/,""),g=m.endsWith("/"),x=m.replace(/\/$/,"").split("/").filter(Boolean),v=l,N="";for(let P=0;P<x.length;P++){let w=x[P];N=N?`${N}/${w}`:w;let C=P===x.length-1;if(C&&!g)v.children.push({id:N,name:w,path:N,type:"file",change:r,children:[],changeCount:1});else{let G=v.children.find((M)=>M.type==="folder"&&M.name===w);if(!G)G={id:N,name:w,path:N,type:"folder",children:[],changeCount:0,change:C&&g?r:void 0},v.children.push(G);v=G}}}function c(r){if(r.type==="file")return 1;let m=r.change?1:0;for(let g of r.children)m+=c(g);return r.changeCount=m,r.children.sort((g,x)=>{if(g.type==="folder"&&x.type==="file")return-1;if(g.type==="file"&&x.type==="folder")return 1;return g.name.localeCompare(x.name)}),m}return c(l),l.children}function tt(t){let{sessionId:l,ready:c,read:r}=_m(),m=u(()=>Wt(t),[t]),g=u(()=>{let R=new Set;function G(M){for(let k of M)if(k.type==="folder"){if(R.add(k.id),k.children&&k.children.length>0)G(k.children)}}return G(m),R},[m]),[x,v]=T("git.expandedFolders",[]),N=u(()=>new Set(x),[x]),P=i(null);o(()=>{if(!c||P.current===l)return;if(g.size===0)return;if(P.current=l,r("git.expandedFolders",[]).length>0)return;v(Array.from(g))},[c,l,g,r,v]);let w=a((R)=>{v((G)=>{let M=new Set(G);if(M.has(R))M.delete(R);else M.add(R);return Array.from(M)})},[v]),C=a((R)=>N.has(R),[N]);return{tree:m,expandedFolders:N,toggleFolder:w,isFolderOpen:C,expandAll:()=>v(Array.from(g)),collapseAll:()=>v([])}}function He({node:t,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:m,repo:g,rootPath:x}){let v=t.type==="folder",N=v?c(t.id):!1;if(v)return e("div",{className:"select-none",children:[e("div",{className:"flex items-center justify-between px-2 py-1 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>r(t.id),children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center text-ink/40 flex-shrink-0",children:N?e(E,{size:12}):e(ue,{size:12})}),e(mt,{name:t.name,isFolder:!0,isOpen:N,size:13,className:"flex-shrink-0"}),e("span",{className:"font-medium text-ink truncate",children:t.name}),e("span",{className:"text-[10px] text-ink/40 font-normal px-1 py-0.2 bg-ink/5 rounded-full ml-1",children:t.changeCount})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!l?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("stage",t.path)},title:`Stage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(F,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("unstage",t.path)},title:`Unstage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(fn,{size:11})})})})]}),N&&t.children&&t.children.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map((k)=>e(He,{node:k,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:m,repo:g,rootPath:x},k.id))})]});let P=t.change,w=sr(P?.status||"M",l),{charStatus:C,colorClass:R}=w,G=P?P.file:t.path;return e("div",{className:"flex items-center justify-between px-2 py-0.5 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:G,staged:l,status:C,repo:g||".",root:x}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center flex-shrink-0",children:e("span",{className:`font-bold font-mono text-[10px] ${R}`,title:`Status: ${w.label}`,children:C})}),e(mt,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${R}`,title:G,children:t.name})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!l?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("revert",G)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("stage",G)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(F,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("unstage",G)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(fn,{size:11})})})})]})}function ze({changes:t,isStaged:l,repo:c,rootPath:r,onAction:m}){let{tree:g,isFolderOpen:x,toggleFolder:v}=tt(t);if(g.length===0)return null;return e("div",{className:"py-0.5",children:g.map((N)=>e(He,{node:N,isStaged:l,isFolderOpen:x,toggleFolder:v,onAction:m,repo:c,rootPath:r},N.id))})}function ot({changes:t,isLoading:l,viewMode:c,repo:r,rootPath:m,onAction:g,onResolve:x}){let[v,N]=T("git.stagedExpanded",!0),[P,w]=T("git.unstagedExpanded",!0),[C,R]=T("git.conflictsExpanded",!0),G=t.filter((b)=>Mr(b.status)),M=t.filter((b)=>{if(Mr(b.status))return!1;let y=b.status;return y&&y[0]!==" "&&y[0]!=="?"}),k=t.filter((b)=>{if(Mr(b.status))return!1;let y=b.status;return y&&y[1]!==" "&&y[1]!=="?"||y==="??"});if(l&&t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"Loading..."})});if(t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"No changes found."})});return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"py-1",children:[G.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-warning/5 cursor-pointer transition-colors",onClick:()=>R(!C),children:e("div",{className:"flex items-center space-x-1 font-semibold text-warning text-xs",children:[e("span",{className:"w-3 text-center",children:C?"▾":"▸"}),e("span",{children:"Conflicts"}),e("span",{className:"text-warning/70 font-normal ml-1 border border-warning/30 rounded-full px-1.5 text-[10px] bg-paper",children:G.length})]})}),C&&G.map((b)=>e(et,{change:b,repo:r,rootPath:m,onResolve:x??(()=>{})},`conflict-${b.file}`))]}),M.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>N(!v),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:v?"▾":"▸"}),e("span",{children:"Staged Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:M.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("button",{type:"button",onClick:(b)=>{b.stopPropagation(),g("unstage_all")},title:"Unstage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(fn,{size:12})})})]}),v&&(c==="tree"?e(ze,{changes:M,isStaged:!0,repo:r,rootPath:m,onAction:g}):M.map((b)=>e(Fe,{change:b,isStaged:!0,repo:r,rootPath:m,onAction:g},b.file+"staged")))]}),k.length>0&&e("div",{children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>w(!P),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:P?"▾":"▸"}),e("span",{children:"Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:k.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:[e("button",{type:"button",onClick:(b)=>{b.stopPropagation(),g("revert_all")},title:"Discard All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:12})}),e("button",{type:"button",onClick:(b)=>{b.stopPropagation(),g("stage_all")},title:"Stage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(F,{size:12})})]})]}),P&&(c==="tree"?e(ze,{changes:k,isStaged:!1,repo:r,rootPath:m,onAction:g}):k.map((b)=>e(Fe,{change:b,isStaged:!1,repo:r,rootPath:m,onAction:g},b.file+"unstaged")))]})]})})}function st({matches:t,loaded:l,total:c,hasMore:r,isFiltering:m}){if(m)return`${t} of ${l} loaded`;if(typeof c==="number"&&c>0)return r||l<c?`${l} of ${c}`:`${c} commits`;return r?`${l}+ commits`:`${l} commits`}function rt({isGraphMode:t,onToggleMode:l,searchQuery:c,onSearchChange:r,onRefresh:m,onClose:g,isRefreshing:x,totalCommits:v,loadedCount:N,totalCount:P,hasMore:w}){let C=st({matches:v,loaded:N,total:P,hasMore:w,isFiltering:c.trim().length>0});return e("div",{className:`flex flex-col gap-2 px-3 lg:px-5 py-3 border-b border-ink/10 bg-paper select-none
|
|
2
2
|
pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:[e("div",{className:"flex items-center justify-between gap-2 lg:gap-4",children:[e("div",{className:"flex flex-col min-w-0",children:[e("div",{className:"flex items-center gap-2.5 min-w-0",children:[e("h2",{className:"text-base font-semibold text-ink tracking-tight",children:t?"Graph":"History"}),e("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-ink/5 text-ink/80 border border-ink/10 whitespace-nowrap",children:C})]}),e("p",{className:"text-xs text-muted mt-0.5 hidden lg:block",children:t?"Follow branch topology and inspect commits.":"Browse recent commits and inspect changed files."})]}),e("div",{className:"flex items-center gap-1.5 lg:gap-2 flex-shrink-0",children:[e("div",{className:"flex items-center text-xs lg:bg-ink/5 lg:p-0.5 lg:rounded-lg lg:border lg:border-ink/10",children:[e("button",{type:"button",onClick:()=>l(!1),title:"History view","aria-label":"History view","aria-pressed":!t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${!t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e(Kn,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"History"})]}),e("button",{type:"button",onClick:()=>l(!0),title:"Graph view","aria-label":"Graph view","aria-pressed":t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e(Jn,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Graph"})]})]}),e("button",{type:"button",onClick:m,disabled:x,className:"tap-target flex items-center justify-center gap-1.5 p-2 rounded-md text-ink/70 transition-colors cursor-pointer text-xs disabled:opacity-40 lg:px-2.5 lg:py-1.5 lg:border lg:border-ink/15 lg:hover:bg-ink/5 lg:hover:text-ink",title:"Refresh commit history","aria-label":"Refresh commit history",children:[e(Ra,{size:13,className:x?"animate-spin text-ink":"","aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Refresh"})]}),e("button",{type:"button",onClick:g,className:"tap-target p-2 -mr-1 rounded-md hover:bg-ink/5 text-muted hover:text-ink transition-colors cursor-pointer",title:"Close modal","aria-label":"Close commit history",children:e(h,{size:16,"aria-hidden":"true"})})]})]}),e("div",{className:"relative mt-1",children:[e(U,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/55","aria-hidden":"true"}),e("input",{type:"text",value:c,onChange:(R)=>r(R.currentTarget.value),placeholder:"Filter commits by message, author, or hash...","aria-label":"Filter commits",className:"w-full bg-ink/[0.03] border border-ink/15 rounded-md pl-8 pr-3 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),c&&e("button",{type:"button",onClick:()=>r(""),"aria-label":"Clear filter",className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-ink/55 hover:text-ink cursor-pointer",children:e(h,{size:12,"aria-hidden":"true"})})]})]})}var le=["#38bdf8","#f97316","#a855f7","#10b981","#ec4899","#eab308","#06b6d4","#6366f1"];function Oe(t,l){if(!t||!l)return!1;if(t===l)return!0;let c=Math.min(t.length,l.length);if(c>=4)return t.substring(0,c)===l.substring(0,c);return!1}function Ge(t){let l=new Map,c=[];for(let r of t){if(typeof r.lane==="number"){l.set(r.hash,r.lane);continue}let m=c.findIndex((x)=>Oe(x,r.hash)||Oe(x,r.shortHash));if(m===-1)if(m=c.indexOf(null),m===-1)m=c.length,c.push(r.hash);else c[m]=r.hash;l.set(r.hash,m);let g=r.parents&&r.parents[0];if(g)c[m]=g;else c[m]=null;if(r.parents&&r.parents.length>1)for(let x=1;x<r.parents.length;x++){let v=r.parents[x];if(!c.some((P)=>Oe(P,v))){let P=c.indexOf(null);if(P===-1)c.push(v);else c[P]=v}}}return l}function it(t,l,c,r){let m=[],g=new Map;t.forEach((x,v)=>{if(g.set(x.hash,v),x.shortHash)g.set(x.shortHash,v);if(x.hash.length>=7)g.set(x.hash.substring(0,7),v)});for(let x of t){let v=l.get(x.hash)??0,N=c[x.hash]??0,P=le[v%le.length];if(!x.parents||x.parents.length===0)continue;for(let w of x.parents){let C=g.get(w);if(typeof C!=="number"&&w.length>=7)C=g.get(w.substring(0,7));if(typeof C==="number"){let R=t[C],G=l.get(R.hash)??v,M=c[R.hash]??N+60;m.push({fromHash:x.hash,toHash:R.hash,fromLane:v,toLane:G,fromY:N,toY:M,color:le[v%le.length]})}else m.push({fromHash:x.hash,toHash:"tail-"+x.hash,fromLane:v,toLane:v,fromY:N,toY:Math.max(N+80,r),color:P})}}return m}function at(t,l,c,r){if(Math.abs(t-c)<1)return`M ${t} ${l} L ${c} ${r}`;let m=r-l,g=l+m*0.45,x=r-m*0.45;return`M ${t} ${l} C ${t} ${g}, ${c} ${x}, ${c} ${r}`}function lt({commits:t,nodePositions:l,expandedHash:c,hoveredHash:r,isGraphMode:m,laneWidth:g=18,paddingLeft:x=16,totalHeight:v}){let N=u(()=>{if(!m){let R=new Map;return t.forEach((G)=>R.set(G.hash,0)),R}return Ge(t)},[t,m]),P=u(()=>{let R=0;return N.forEach((G)=>{if(G>R)R=G}),R},[N]),w=m?(P+1)*g+x*2:36,C=u(()=>{if(!m){let R=[];for(let G=0;G<t.length-1;G++){let M=l[t[G].hash]??G*60+20,k=l[t[G+1].hash]??(G+1)*60+20;R.push({fromHash:t[G].hash,toHash:t[G+1].hash,fromLane:0,toLane:0,fromY:M,toY:k,color:"var(--theme-ink)"})}return R}return it(t,N,l,v)},[t,N,l,v,m]);return e("div",{className:"absolute top-0 left-0 pointer-events-none z-10",style:{width:w,height:v},"aria-hidden":"true",children:e("svg",{className:"w-full h-full overflow-visible",style:{width:w,height:v},children:[C.map((R)=>{let G=m?x+R.fromLane*g:16,M=m?x+R.toLane*g:16,k=m?R.color:"currentColor",b=m?0.95:0.25,y=at(G,R.fromY,M,R.toY);return e("path",{d:y,fill:"none",stroke:k,strokeWidth:m?2.25:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:b},`${R.fromHash}->${R.toHash}`)}),t.map((R)=>{let G=N.get(R.hash)??0,M=m?x+G*g:16,k=l[R.hash]??20,b=c===R.hash||c===R.shortHash,y=r===R.hash||r===R.shortHash,L=m?le[G%le.length]:"var(--theme-success)";return e("g",{"data-commit-node":R.hash,children:[(b||y)&&e("circle",{cx:M,cy:k,r:8,fill:L,fillOpacity:b?0.35:0.2,stroke:L,strokeWidth:1}),e("circle",{"data-commit-dot":"",cx:M,cy:k,r:m?4:4.5,fill:m?"var(--theme-paper)":L,stroke:L,strokeWidth:m?2.5:1.5}),m&&e("circle",{cx:M,cy:k,r:1.8,fill:L})]},`node-${R.hash}`)})]})})}var qt=[{action:"checkout",label:"checkout"},{action:"create_branch_here",label:"create branch here"},{action:"cherry_pick",label:"cherry-pick"},{action:"revert",label:"revert"},{action:"reset",label:"reset..."},{action:"merge",label:"merge into current"},{action:"rebase",label:"rebase onto this"}];function ct({commit:t,onAction:l}){return e("div",{className:"flex flex-wrap items-center gap-1.5 pt-1.5 pb-2",children:qt.map(({action:c,label:r})=>e("button",{type:"button",onClick:(m)=>{m.stopPropagation(),l(c,t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer",children:r},c))})}var Se=3;function Kt(t){let l=[];for(let c=0;c<t.length;c+=1){if(t[c].type!=="context"){l.push({row:t[c],index:c});continue}let r=c;while(r<t.length&&t[r].type==="context")r+=1;let m=r-c;if(m>Se*2+1){for(let g=c;g<c+Se;g+=1)l.push({row:t[g],index:g});l.push({row:{type:"elided",count:m-Se*2},index:-1});for(let g=r-Se;g<r;g+=1)l.push({row:t[g],index:g})}else for(let g=c;g<r;g+=1)l.push({row:t[g],index:g});c=r-1}return l}function ut({diffText:t,isLoading:l,filePath:c,fullContext:r=!1,onToggleContext:m}){let g=Ei(),x=u(()=>{if(!t)return[];let w=[],C=1,R=1,G=t.split(/\r?\n/),k=G.some((b)=>b.startsWith("@@"))?G:[`@@ -0,0 +1,${G.length} @@`,...G.map((b)=>b.startsWith("+")||b.startsWith("-")?b:`+${b}`)];for(let b of k){if(b.startsWith("diff --git")||b.startsWith("index ")||b.startsWith("---")||b.startsWith("+++")||b.startsWith("new file mode")||b.startsWith("deleted file mode")||b.startsWith("similarity index")||b.startsWith("old mode")||b.startsWith("new mode")||b.startsWith("\\ No newline"))continue;if(b.startsWith("@@")){let y=b.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(y)C=parseInt(y[1],10),R=parseInt(y[2],10);w.push({type:"meta",text:b})}else if(b.startsWith("+"))w.push({type:"add",text:b.slice(1),newNum:R++});else if(b.startsWith("-"))w.push({type:"del",text:b.slice(1),oldNum:C++});else{let y=b.startsWith(" ")?b.slice(1):b;w.push({type:"context",text:y,oldNum:C++,newNum:R++})}}return w},[t]),v=gt(c),N=u(()=>{let w=Array(x.length).fill(""),C=-1,R=(G)=>{if(C<0)return;let M=_d(x.slice(C,G).map((k)=>k.text).join(`
|
|
3
3
|
`),v);for(let k=C;k<G;k++)w[k]=M[k-C]??"";C=-1};return x.forEach((G,M)=>{if(G.type==="meta")R(M);else if(C<0)C=M}),R(x.length),w},[x,v,g]),P=u(()=>r?x.map((w,C)=>({row:w,index:C})):Kt(x),[x,r]);if(l)return e("div",{className:"my-2 p-4 rounded bg-canvas border border-ink/10 text-muted font-mono text-xs flex items-center justify-center",children:"Loading commit diff..."});if(!t||x.length===0)return e("div",{className:"my-2 p-3 rounded bg-canvas border border-ink/10 text-muted font-mono text-xs text-center",children:"No diff content available for this file."});return e("div",{className:"my-2 rounded border border-ink/15 bg-paper overflow-hidden text-[11px] font-mono leading-relaxed text-ink",children:[e("div",{className:"flex items-center justify-between px-3 py-1.5 bg-canvas border-b border-ink/10 text-ink/70 text-[10.5px]",children:[e("span",{className:"font-semibold text-muted",children:"Diff preview"}),e("button",{type:"button",onClick:m,disabled:!m,className:"hover:text-ink flex items-center gap-1 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-default",title:r?"Show only the changed hunks":"Read the whole file around the change","aria-pressed":r,children:r?e(d,{children:[e(pt,{size:12,"aria-hidden":"true"})," Collapse context"]}):e(d,{children:[e(E,{size:12,"aria-hidden":"true"})," Expand all context"]})})]}),e("div",{className:"overflow-x-auto max-h-72 select-text",children:e("div",{className:"w-max min-w-full divide-y divide-ink/[0.04]",children:P.map(({row:w,index:C},R)=>{if(w.type==="elided")return e("div",{className:"px-3 py-1 bg-canvas text-muted text-[10px] text-center select-none",title:`${w.count} unchanged line(s) hidden`,children:["⋯ ",w.count," unchanged line",w.count===1?"":"s"," hidden ⋯"]},`elided-${R}`);let G=w,M=C;if(G.type==="meta")return e("div",{className:"flex items-center gap-2 px-3 py-1 bg-canvas border-y border-ink/10 text-muted text-[10px] font-semibold",children:[e("span",{children:"↕"}),e("span",{children:G.text})]},M);let k=G.type==="add",b=G.type==="del";return e("div",{className:`flex items-start font-mono ${k?"bg-success/10 hover:bg-success/15":b?"bg-error/10 hover:bg-error/15":"text-ink hover:bg-ink/[0.02]"}`,children:[e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${b?"bg-error/15 text-ink/80 font-semibold":k?"bg-success/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:G.oldNum??(k?"+":"")}),e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${k?"bg-success/15 text-ink/80 font-semibold":b?"bg-error/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:G.newNum??(b?"-":"")}),e("div",{className:`w-4 flex-shrink-0 text-center py-0.5 select-none font-bold ${k||b?"text-ink/80":"opacity-0"}`,children:k?"+":b?"-":" "}),e("div",{className:"flex-1 py-0.5 pr-3 whitespace-pre text-ink",children:G.text?e("span",{className:"shiki",dangerouslySetInnerHTML:{__html:N[M]}}):" "})]},M)})})})]})}function ht({commit:t,isExpanded:l,onToggleExpand:c,onAction:r,onToggleFile:m,isExpandedFile:g,isLoadingFile:x,isFullContextFile:v,onToggleContext:N,fileDiffs:P,headerRef:w}){let[C,R]=n(!1),G=t.body?.trim()??"",M=G.length>0,k=t.files??[],b=k.length,y=b>0,L=M||y,B=(A)=>{A.stopPropagation(),navigator.clipboard.writeText(t.hash),R(!0),setTimeout(()=>R(!1),2000)},z=(A,V)=>{A.stopPropagation(),m(t.hash,V)},q=L?"border-b border-ink/5 transition-colors cursor-pointer hover:bg-ink/[0.015]":"border-b border-ink/5";return e("div",{onClick:L?c:void 0,"data-testid":"commit-row","data-commit-hash":t.hash,className:q,children:e("div",{className:"py-2.5 flex flex-col",children:[e("div",{className:"flex flex-col gap-1",children:[t.refs&&t.refs.length>0&&e("div",{className:"flex flex-wrap items-center gap-1.5 pb-0.5",children:t.refs.map((A,V)=>{let Y=A.includes("stash"),_=A.includes("HEAD")||A.includes("main")||A.includes("master");return e("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono border ${Y?"bg-warning/10 text-ink/80 border-warning/25 font-semibold":_?"bg-ink/10 text-ink font-semibold border-ink/20":"bg-canvas text-muted border-ink/10 font-medium"}`,children:A},V)})}),e("div",{ref:w,className:"flex items-start gap-1.5",children:e("button",{type:"button",onClick:L?(A)=>{A.stopPropagation(),c()}:void 0,"aria-expanded":L?l:void 0,className:"flex flex-1 min-w-0 items-start gap-1.5 text-left cursor-pointer rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/20",children:[e("span",{"data-commit-title":"",className:"text-[13px] font-semibold text-ink leading-snug break-words flex-1 min-w-0",children:t.message}),L&&e("span",{className:"text-ink/55 flex-shrink-0 mt-0.5","aria-hidden":"true",children:l?e(E,{size:13}):e(ue,{size:13})})]})}),M&&l&&e("div",{className:"border-l-2 border-ink/15 pl-3 py-1",children:e(J,{content:G,className:"text-ink/70"})}),e("div",{className:"flex items-center gap-x-2 gap-y-0.5 text-[11px] text-muted font-mono flex-wrap",children:[e("span",{children:t.author}),e("span",{children:t.date}),e("button",{type:"button",onClick:B,title:"Copy commit hash","aria-label":`Copy commit hash ${t.shortHash}`,className:"inline-flex items-center gap-1 hover:text-ink transition-colors cursor-pointer text-ink/70",children:[e("span",{children:t.shortHash}),C?e(f,{size:11,className:"text-success-text","aria-hidden":"true"}):e(ae,{size:11,"aria-hidden":"true"})]}),y&&e("span",{children:[b," ",b===1?"file":"files"]})]})]}),l&&e("div",{className:"mt-2",children:e(ct,{commit:t,onAction:r})}),y&&l&&e("div",{className:"mt-2 flex flex-col gap-1",children:k.map((A,V)=>{let Y=g(t.hash,A.file),_=`${t.hash}:${A.file}`,H=P[_]!==void 0?P[_]:A.diff,O=x(t.hash,A.file),D=A.status==="A"?"text-success-text font-bold":A.status==="D"?"text-error-text font-bold":A.status==="R"?"text-meta-text font-bold":"text-info-text font-bold";return e("div",{className:"flex flex-col",children:[e("button",{type:"button",onClick:(oe)=>z(oe,A),"aria-expanded":Y,className:"flex w-full items-center gap-2 py-1 px-2 rounded text-[11.5px] font-mono text-ink/80 transition-colors group cursor-pointer border border-transparent hover:border-ink/10 text-left",children:[e("span",{className:`w-3.5 text-center flex-shrink-0 text-[11px] ${D}`,children:A.status||"M"}),e("span",{className:"truncate flex-1 min-w-0 text-ink/90 group-hover:text-ink font-medium",children:A.file}),e("span",{className:"flex items-center gap-1 text-[10.5px] tabular-nums flex-shrink-0 font-medium",children:[e("span",{className:"text-success-text",children:["+",A.additions]}),e("span",{className:"text-ink/30",children:"/"}),e("span",{className:"text-error-text",children:["-",A.deletions]})]}),e("span",{className:"text-ink/55 group-hover:text-ink flex-shrink-0",children:Y?e(E,{size:13,"aria-hidden":"true"}):e(ue,{size:13,"aria-hidden":"true"})})]}),Y&&e("div",{className:"pl-4 pr-1",children:e(ut,{diffText:H,isLoading:O,filePath:A.file,fullContext:v(t.hash,A.file),onToggleContext:()=>N(t.hash,A)})})]},V)})})]})})}var xe=50;function Vt(t){if(!Array.isArray(t))return[];let l=[];for(let c of t){if(!c||typeof c!=="object")continue;let r=c;if(typeof r.file!=="string"||!r.file)continue;l.push({file:r.file,status:typeof r.status==="string"?r.status:"M",additions:typeof r.additions==="number"&&Number.isFinite(r.additions)?r.additions:0,deletions:typeof r.deletions==="number"&&Number.isFinite(r.deletions)?r.deletions:0,diff:typeof r.diff==="string"?r.diff:void 0})}return l}function Ie(t){if(!Array.isArray(t))return[];let l=[];for(let c of t){if(!c||typeof c!=="object")continue;let r=c,m=typeof r.hash==="string"&&r.hash?r.hash:"";if(!m)continue;l.push({hash:m,shortHash:typeof r.shortHash==="string"&&r.shortHash?r.shortHash:m.slice(0,8),author:typeof r.author==="string"?r.author:"Unknown",date:typeof r.date==="string"?r.date:typeof r.time==="string"?r.time:"",message:typeof r.message==="string"?r.message:"",body:typeof r.body==="string"?r.body:void 0,parents:Array.isArray(r.parents)?r.parents.filter((g)=>typeof g==="string"):[],refs:Array.isArray(r.refs)?r.refs.filter((g)=>typeof g==="string"):[],files:Vt(r.files),lane:typeof r.lane==="number"?r.lane:void 0})}return l}function bt({output:t,isGraphMode:l,rootPath:c,activeRepo:r}){let[m,g]=n(!1),[x,v]=n(t?.hasMore??t?.data?.length===xe),[N,P]=n(t?.total),w=u(()=>Ie(t?.data),[t?.data]),C=Array.isArray(t?.data)?t.data.length:0,[R,G]=n(w),[M,k]=n(C);o(()=>{if(G(w),k(C),v(t?.hasMore??C===xe),typeof t?.total==="number")P(t.total)},[w,C,t?.hasMore,t?.total]);let b=a(async()=>{if(m||!x)return;g(!0);try{let y=new FormData;if(y.set("actionType",l?"graph":"history"),y.set("limit",String(xe)),y.set("skip",String(M)),c)y.set("root",c);if(r)y.set("repo",r);let B=await(await fetch("/api/fs/git",{method:"POST",body:y})).json();if(B.success&&Array.isArray(B.data)){let z=Ie(B.data),q=B.data.length;if(G((A)=>{let V=new Set(A.map((_)=>_.hash)),Y=z.filter((_)=>!V.has(_.hash));return[...A,...Y]}),k((A)=>A+q),v(Boolean(B.hasMore??q===xe)),typeof B.total==="number")P(B.total)}else v(!1)}catch(y){console.error("Failed to load more commits:",y)}finally{g(!1)}},[m,x,l,M,c,r]);return{commits:R,hasMore:x,totalCount:N,isLoadingMore:m,handleLoadMore:b}}function vt({onExecuteAction:t,rootPath:l,activeRepo:c}){let[r,m]=n({}),[g,x]=n(new Set),[v,N]=n(new Set),[P,w]=n(new Set),C=a(async(k,b,y)=>{let L=`${k}:${b.file}`;N((B)=>new Set(B).add(L));try{let B=new FormData;if(B.set("actionType","commit_diff"),B.set("hash",k),B.set("file",b.file),y)B.set("full","1");if(l)B.set("root",l);if(c&&c!==".")B.set("repo",c);let q=await(await fetch("/api/fs/git",{method:"POST",body:B})).json();if(q&&typeof q.diff==="string")m((A)=>({...A,[L]:q.diff}));else if(q&&q.error)m((A)=>({...A,[L]:`// Error: ${q.error}`}))}catch(B){console.error("Failed to load file diff:",B);let z=B instanceof Error?B.message:"Network error";m((q)=>({...q,[L]:`// Error loading diff: ${z}`}))}finally{N((B)=>{let z=new Set(B);return z.delete(L),z})}},[l,c]),R=a(async(k,b)=>{let y=`${k}:${b.file}`,L=!g.has(y);if(x((B)=>{let z=new Set(B);if(z.has(y))z.delete(y);else z.add(y);return z}),L&&r[y]===void 0&&!b.diff)await C(k,b,!1)},[g,r,C]),G=a(async(k,b)=>{let y=`${k}:${b.file}`,L=!P.has(y);w((B)=>{let z=new Set(B);if(z.has(y))z.delete(y);else z.add(y);return z}),await C(k,b,L)},[P,C]),M=a((k,b)=>{if(!t)return;if(k==="checkout")t("checkout",void 0,{branch:b.hash});else if(k==="create_branch_here"){let y=window.prompt(`Create new branch at commit ${b.shortHash}:`,`branch-${b.shortHash}`);if(y?.trim())t("create_branch_at",void 0,{branch:y.trim(),hash:b.hash})}else if(k==="cherry_pick"){if(window.confirm(`Cherry-pick commit ${b.shortHash} onto current branch?`))t("cherry_pick",void 0,{hash:b.hash})}else if(k==="revert"){if(window.confirm(`Revert commit ${b.shortHash}?`))t("revert_commit",void 0,{hash:b.hash})}else if(k==="reset"){let y=window.prompt(`Reset current branch to ${b.shortHash} (soft, mixed, hard):`,"soft");if(y&&["soft","mixed","hard"].includes(y.toLowerCase()))t("reset_commit",void 0,{hash:b.hash,mode:y.toLowerCase()})}else if(k==="merge"){if(window.confirm(`Merge commit ${b.shortHash} into current branch?`))t("merge_commit",void 0,{hash:b.hash})}else if(k==="rebase"){if(window.confirm(`Rebase current branch onto commit ${b.shortHash}?`))t("rebase_commit",void 0,{hash:b.hash})}},[t]);return{fileDiffs:r,expandedFiles:g,loadingFiles:v,fullContextFiles:P,handleToggleFile:R,handleToggleContext:G,handleCommitAction:M}}function kt(t){let[l,c]=n({page:t,hash:""}),r=l.page===t?l.hash:"",m=a((g)=>{c((x)=>{let v=x.page===t&&x.hash===g;return{page:t,hash:v?"":g}})},[t]);return{expandedHash:r,toggleExpanded:m}}function je({output:t,onClose:l,onRefresh:c,onExecuteAction:r,rootPath:m,activeRepo:g}){if(o(()=>{if(!t)return;let j=(W)=>{if(W.key==="Escape")l()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[t,l]),!t)return null;let[x,v]=n(()=>({title:t.title,graph:t.title.toLowerCase().includes("graph")}));if(x.title!==t.title)v({title:t.title,graph:t.title.toLowerCase().includes("graph")});let N=x.graph,P=(j)=>v((W)=>({...W,graph:j})),[w,C]=n(""),{expandedHash:R,toggleExpanded:G}=kt(t),[M,k]=n(!1),{commits:b,hasMore:y,totalCount:L,isLoadingMore:B,handleLoadMore:z}=bt({output:t,isGraphMode:N,rootPath:m,activeRepo:g}),{fileDiffs:q,expandedFiles:A,loadingFiles:V,fullContextFiles:Y,handleToggleFile:_,handleToggleContext:H,handleCommitAction:O}=vt({onExecuteAction:r,rootPath:m,activeRepo:g}),D=u(()=>{if(!w.trim())return b;let j=w.toLowerCase().trim();return b.filter((W)=>W.message.toLowerCase().includes(j)||W.author.toLowerCase().includes(j)||W.shortHash.toLowerCase().includes(j)||W.hash.toLowerCase().includes(j)||W.refs?.some((ne)=>ne.toLowerCase().includes(j)))},[b,w]),oe=i(null),se=i(null),ve=i(null),me=i({}),[pe,ke]=n({}),[Pe,$e]=n(800);o(()=>{let j=ve.current;if(!j||!y||B||w.trim())return;let W=new IntersectionObserver((ne)=>{if(ne[0].isIntersecting)z()},{root:oe.current,threshold:0.1});return W.observe(j),()=>W.disconnect()},[y,B,w,z]);let re=a(()=>{if(!oe.current||!se.current)return;let j=oe.current.getBoundingClientRect(),W=oe.current.scrollTop,ne={};D.forEach((ge,Ee)=>{let we=me.current[ge.hash];if(we){let ce=we.getBoundingClientRect();ne[ge.hash]=ce.top+ce.height/2-j.top+W}else ne[ge.hash]=Ee*60+20}),ke(ne);let De=se.current.offsetHeight;$e(Math.max(De,oe.current.clientHeight,600))},[D]);K(()=>{re();let j=requestAnimationFrame(()=>{re()});return()=>cancelAnimationFrame(j)},[re,D,q,A,N,R]),o(()=>{let j=se.current;if(!j)return;let W=new ResizeObserver(()=>{re()});W.observe(j);for(let ne of Array.from(j.children))W.observe(ne);return()=>W.disconnect()},[re,D]);let ee=u(()=>Ge(D),[D]),Me=u(()=>{let j=0;return ee.forEach((W)=>{if(W>j)j=W}),j},[ee]),ye=18,Ce=16,Le=N?(Me+1)*ye+Ce*2:36,Ae=()=>{k(!0),c?.(),setTimeout(()=>k(!1),600)};return e("div",{className:"fixed inset-0 z-50 modal-scrim backdrop-blur-xs flex items-center justify-center p-0 lg:p-5",onClick:l,role:"dialog","aria-modal":"true","aria-label":t.title,children:e("div",{className:`glass-overlay bg-paper border-ink/20 shadow-2xl flex flex-col overflow-hidden
|
|
4
4
|
w-full h-full rounded-none border-0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d,n,o,K,i,u,a,cn,e,_e,as,f,os,is,ss,U,cs,h,T,xr,wr,xt,so,he,Ci,kl,mt,ft,gt,Dd,Tc}from"./index-nr5gwny1.js";import{Tr}from"./index-jd2h5tvh.js";var me=2000,W=new Map;function ge(s){if(s.length===0)return"";let r="";for(let t of s)r+=`${t.start}-${t.end},`;return r}function ee(s,r,t){let c=Ci(r),m=`${r}\x00${ge(t)}\x00${s}`;if(c){let S=W.get(m);if(S!==void 0)return W.delete(m),W.set(m,S),S}let l=kl(s,r,{marks:t});if(!c)return l;if(W.set(m,l),W.size>me){let S=W.keys().next();if(!S.done)W.delete(S.value)}return l}function te(s,r,t){let c=[],m=0;for(let l of r){if(l.start<m||l.end<=l.start||l.end>s.length)continue;if(l.start>m)c.push({text:s.slice(m,l.start),kind:"plain"});if(c.push({text:s.slice(l.start,l.end),kind:"removed"}),t)c.push({text:t,kind:"inserted"});m=l.end}if(m<s.length)c.push({text:s.slice(m),kind:"plain"});return c}function be({file:s,result:r,replacement:t,showReplacePreview:c,onOpen:m}){let l=r.ranges??[],S=c&&t.length>0;return e("button",{type:"button",onClick:()=>m(r),className:"flex w-full items-start gap-2 rounded px-1 py-0.5 text-left hover:bg-ink/5 cursor-pointer",title:`Open ${s}:${r.line}`,children:[e("span",{className:"w-6 flex-shrink-0 text-right font-mono text-ink/40",children:r.line}),S?e("span",{className:"min-w-0 truncate font-mono text-ink",children:te(r.content,l,t).map((k,b)=>k.kind==="plain"?e("span",{children:k.text},b):k.kind==="removed"?e("del",{className:"search-replace-old",children:k.text},b):e("ins",{className:"search-replace-new",children:k.text},b))}):e("span",{className:"min-w-0 truncate font-mono text-ink",dangerouslySetInnerHTML:{__html:ee(r.content,gt(s),l)}})]})}var re=cn(be);var Z={header:4,hit:4,group:16},ne={headerBox:16,hitBox:20},se=5000;function oe(s){let r=[],t=null;for(let c of s){if(!t||t.file!==c.file)t={file:c.file,results:[]},r.push(t);t.results.push(c)}return r}function ie(s){let r=[];for(let t of s){r.push({kind:"group",file:t.file,count:t.results.length});for(let c=0;c<t.results.length;c++)r.push({kind:"hit",file:t.file,result:t.results[c],last:c===t.results.length-1})}return r}function xe(s,r){if(s.kind==="group")return r.headerBox+Z.header;return r.hitBox+(s.last?Z.group:Z.hit)}function ae(s,r){let t=Array(s.length),c=Array(s.length),m=0;for(let l=0;l<s.length;l++){let S=xe(s[l],r);t[l]=m,c[l]=S,m+=S}return{offsets:t,heights:c,total:m}}function le(s,r,t,c,m=240){if(s.length===0)return{start:0,end:0};let l=Math.max(0,t),S=l-m,k=l+c+m,b=0,x=s.length-1;while(b<x){let g=b+x>>1;if(s[g]+r[g]>S)x=g;else b=g+1}let C=b;b=C,x=s.length;while(b<x){let g=b+x>>1;if(s[g]>=k)x=g;else b=g+1}return{start:C,end:b}}var Se=8,ve=8;function ce({groups:s,replacement:r,showReplacePreview:t,onOpen:c,onReplaceFile:m,replaceBusy:l}){let S=i(null),k=i(null),b=u(()=>ie(s),[s]),[x,C]=n(ne),g=u(()=>ae(b,x),[b,x]),[O,y]=n(()=>({start:0,end:Math.min(b.length,60)})),F=a((p)=>{S.current=p},[]),v=a(()=>{let p=S.current;if(!p)return;let w=le(g.offsets,g.heights,p.scrollTop,p.clientHeight);y((M)=>M.start===w.start&&M.end===w.end?M:w)},[g]),R=a(()=>{v()},[v]);K(()=>{let p=k.current;if(!p)return;let w=p.querySelector("[data-search-header] > div")?.offsetHeight??0,M=p.querySelector("[data-search-hit] > button")?.offsetHeight??0;if(w>0&&w!==x.headerBox)C((N)=>({...N,headerBox:w}));if(M>0&&M!==x.hitBox)C((N)=>({...N,hitBox:M}))},[O,x,b]),K(()=>{v()},[v]),K(()=>{let p=S.current;if(!p||typeof ResizeObserver>"u")return;let w=new ResizeObserver(()=>v());return w.observe(p),()=>w.disconnect()},[v]);let H=b.length===0?0:Math.min(O.start,b.length-1),A=Math.min(O.end,b.length),L=b.slice(H,A),_=A<b.length?g.total-g.offsets[A]:0;return e("div",{ref:F,onScroll:R,className:"flex-1 scrollbar-overlay-container px-3 text-xs",style:{overflowAnchor:"none"},children:[e("div",{style:{height:Se+(g.offsets[H]??0)},"aria-hidden":"true"}),e("div",{ref:k,children:L.map((p,w)=>{let M=H+w,N=g.heights[M];if(p.kind==="group")return e("div",{"data-search-header":"",style:{height:N},children:e("div",{className:"font-semibold text-ink/80 flex items-center justify-between group",children:[e("div",{className:"flex items-center min-w-0",children:[e(mt,{name:p.file,size:12,className:"mr-1.5 flex-shrink-0"}),e("span",{className:"truncate",children:p.file}),e("span",{className:"ml-2 bg-ink/10 text-[10px] px-1.5 py-0.5 rounded-full flex-shrink-0",children:p.count})]}),e("button",{onClick:()=>m(p.file),disabled:l,className:"touch-visible opacity-0 group-hover:opacity-100 p-1 text-ink/40 hover:text-ink rounded hover:bg-ink/5 disabled:opacity-50 flex-shrink-0",title:"Replace in this file",children:e(ss,{size:12})})]})},`group:${p.file}`);return e("div",{"data-search-hit":"",style:{height:N},children:e(re,{file:p.file,result:p.result,replacement:r,showReplacePreview:t,onOpen:c})},`hit:${p.file}:${p.result.line}:${M}`)})}),e("div",{style:{height:ve+_},"aria-hidden":"true"})]})}function ue({className:s,query:r,setQuery:t,replaceQuery:c,setReplaceQuery:m,matchCase:l,setMatchCase:S,wholeWord:k,setWholeWord:b,useRegex:x,setUseRegex:C,includeFiles:g,setIncludeFiles:O,showIncludeField:y,setShowIncludeField:F,showMenu:v,setShowMenu:R,menuRef:H,rootPath:A,activeRepo:L,setActiveRepo:_,repos:p,reposScanning:w,rescanRepos:M,results:N,isSearching:G,truncated:q,error:E,onOpenFile:z,handleReplace:D,replaceBusy:J,tabsMode:Y=!1}){let Q=u(()=>oe(N),[N]),P=i(null),X=i(null),B=a(()=>{t(""),P.current?.focus()},[t]),j=a(()=>{m(""),X.current?.focus()},[m]),V=u(()=>({matchCase:l,wholeWord:k,isRegex:x,inSelection:!1}),[l,k,x]),de=a((I)=>{Dd({path:I.file,line:Number(I.line),query:r,options:V}),z?.({path:I.file,name:I.file.split("/").pop()||I.file,root:A,repo:L})},[r,V,A,L,z]),fe=a((I)=>D(I),[D]);return e("div",{className:`flex flex-col h-full bg-paper ${s}`,children:[e(xt,{left:e(d,{children:[e(so,{id:"search",tabsMode:Y,children:e("h2",{className:"text-xs font-semibold text-ink uppercase tracking-wider",children:"Search"})}),e(Tr,{rootPath:A,activeRepo:L,onSelectRepo:_,repos:p,scanning:w,onRefreshRepos:M})]}),right:e("div",{className:"relative",ref:H,children:[e("button",{onClick:()=>R(!v),className:`p-1 rounded hover:bg-ink/5 transition-colors ${v||y?"text-ink":"text-ink/40"}`,title:"Search Options",children:e(_e,{size:14})}),v&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-48 bg-paper border border-ink/10 rounded shadow-lg z-10 py-1",children:e("button",{onClick:()=>{if(F(!y),y)O("");R(!1)},className:"w-full px-3 py-1.5 text-left text-xs text-ink hover:bg-ink/5 flex items-center justify-between",children:[e("span",{children:"Files to include"}),y&&e(f,{size:12,className:"text-ink/60"})]})})]})}),e("div",{className:"p-3 flex flex-col gap-2.5 border-b border-ink/10",children:[e("div",{className:"relative",children:e("div",{className:"flex items-center border border-ink/20 rounded bg-paper focus-within:border-ink/40 focus-within:ring-1 focus-within:ring-ink/10 transition-all",children:[e(U,{size:14,className:"ml-2 text-ink/40 flex-shrink-0"}),e("input",{ref:P,type:"text",placeholder:"Search",value:r,onChange:(I)=>t(I.currentTarget.value),className:"w-full bg-transparent border-none text-xs px-2 py-1.5 focus:outline-none text-ink placeholder-ink/35 min-w-0"}),r&&e("button",{type:"button",onClick:B,title:"Clear search","aria-label":"Clear search",className:"p-1 mr-0.5 rounded text-ink/40 hover:text-ink hover:bg-ink/5 flex-shrink-0",children:e(h,{size:12})}),e("div",{className:"flex items-center space-x-0.5 pr-1 text-ink/40 flex-shrink-0",children:[e("button",{onClick:()=>S(!l),className:`p-1 rounded hover:text-ink ${l?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Match Case",children:e(as,{size:14})}),e("button",{onClick:()=>b(!k),className:`p-1 rounded hover:text-ink ${k?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Match Whole Word",children:e(cs,{size:14})}),e("button",{onClick:()=>C(!x),className:`p-1 rounded hover:text-ink ${x?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Use Regular Expression",children:e(os,{size:14})})]})]})}),e("div",{className:"relative flex items-center space-x-1",children:[e("div",{className:"flex flex-1 min-w-0 items-center border border-ink/20 rounded bg-paper focus-within:border-ink/40 focus-within:ring-1 focus-within:ring-ink/10 transition-all",children:[e("input",{ref:X,type:"text",placeholder:"Replace",value:c,onChange:(I)=>m(I.currentTarget.value),className:"flex-1 min-w-0 bg-transparent border-none text-xs px-2 py-1.5 focus:outline-none text-ink placeholder-ink/35"}),c&&e("button",{type:"button",onClick:j,title:"Clear replace","aria-label":"Clear replace",className:"p-1 mr-0.5 rounded text-ink/40 hover:text-ink hover:bg-ink/5 flex-shrink-0",children:e(h,{size:12})})]}),e("button",{onClick:()=>D(),disabled:N.length===0||J,className:"p-1.5 rounded border border-ink/20 text-ink/60 hover:text-ink hover:bg-ink/5 disabled:opacity-50 disabled:cursor-not-allowed bg-paper",title:"Replace All",children:e(is,{size:14})})]}),y&&e("div",{className:"relative",children:e("input",{type:"text",value:g,onChange:(I)=>O(I.currentTarget.value),placeholder:"Files to include (e.g. *.js, src/*)",className:"w-full bg-paper border border-ink/20 rounded text-xs px-2 py-1.5 focus:outline-none focus:border-ink/40 focus:ring-1 focus:ring-ink/10 transition-all text-ink placeholder-ink/40"})})]}),E&&N.length===0?e("div",{className:"flex-1 px-3 py-3",role:"alert",children:e("div",{className:"rounded border border-error/30 bg-error/5 px-2.5 py-2",children:[e("div",{className:"text-[11px] font-semibold text-error",children:"Search failed"}),e("div",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-[10.5px] text-ink/70",children:E}),x&&e("div",{className:"mt-1 text-[10.5px] text-ink/50",children:["Regex is on — escape metacharacters such as ",e("code",{className:"font-mono",children:"( ) [ ] * ? +"})," or turn it off to search literally."]})]})}):G&&N.length===0?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"Searching..."}):r.trim().length<=2?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"Type at least 3 characters to search."}):N.length===0?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"No results found."}):e(d,{children:[E&&e("div",{className:"px-3 pt-2 text-[10.5px] text-error",role:"alert",children:["Search failed: ",e("span",{className:"font-mono",children:E})]}),G&&e("div",{className:"px-3 pt-2 text-ink/40 italic",children:"Searching…"}),q&&e("div",{className:"px-3 pt-2 text-ink/50 italic",children:["Showing the first ",se," matches — refine the query to see the rest."]}),e(ce,{groups:Q,replacement:c,showReplacePreview:c.length>0,onOpen:de,onReplaceFile:fe,replaceBusy:J})]})]})}function pe(s){let[r,t]=n({scope:s,results:[],truncated:!1,error:null}),[c,m]=n(!1),l=i(null),S=i(!0),k=i(s);k.current=s,o(()=>(S.current=!0,()=>{S.current=!1,l.current?.abort(),l.current=null}),[]);let b=a(async(x)=>{l.current?.abort();let C=new AbortController;l.current=C;let g=k.current;t({scope:g,results:[],truncated:!1,error:null}),m(!0);try{let O=await fetch("/api/fs/search",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams(x),signal:C.signal});await Tc(O,(y,F)=>{if(k.current!==g)return;if(y==="done"){let v=!1;try{v=JSON.parse(F)?.truncated===!0}catch{}t((R)=>R.scope===g?{...R,truncated:v}:R);return}if(y==="error"){let v="Search failed";try{v=JSON.parse(F)?.error||v}catch{}t((R)=>R.scope===g?{...R,error:v}:R);return}if(y!=="matches")return;try{let v=JSON.parse(F);if(Array.isArray(v))t((R)=>R.scope===g?{...R,results:[...R.results,...v]}:R)}catch{}},C.signal)}catch{}finally{if(S.current&&l.current===C)l.current=null,m(!1)}},[]);return{results:r.scope===s?r.results:[],isSearching:c&&r.scope===s,truncated:r.scope===s&&r.truncated,error:r.scope===s?r.error:null,start:b}}function it({className:s="",enabled:r=!0,rootPath:t,onOpenFile:c,tabsMode:m=!1}){let[l,S]=T("search.query",""),[k,b]=T("search.replaceQuery",""),[x,C]=T("search.matchCase",!1),[g,O]=T("search.wholeWord",!1),[y,F]=T("search.useRegex",!1),[v,R]=T("search.includeFiles",""),[H,A]=n(!1),[L,_]=T("search.showIncludeField",!1),{activeRepo:p,setActiveRepo:w}=xr(t),{repos:M,scanning:N,rescan:G}=wr(t,r),q=i(null),E=ft(),{results:z,isSearching:D,truncated:J,error:Y,start:Q}=pe(`${t??""}\x00${p}`);he(q,()=>A(!1));let P=a(()=>{if(!r)return;if(l.trim().length>2)return Q({q:l,matchCase:String(x),wholeWord:String(g),useRegex:String(y),includeFiles:L?v:"",...t?{root:t}:{},...p!=="."?{repo:p}:{}})},[r,l,x,g,y,L,v,t,p,Q]);o(()=>{let B=setTimeout(()=>{P()},300);return()=>clearTimeout(B)},[P]);let X=a((B)=>{if(!l)return;let j=B?[B]:Array.from(new Set(z.map((V)=>V.file)));if(j.length===0)return;E.submit({q:l,replaceWith:k,matchCase:String(x),wholeWord:String(g),useRegex:String(y),files:JSON.stringify(j),...t?{root:t}:{},...p!=="."?{repo:p}:{}},{method:"POST",action:"/api/fs/replace"})},[l,k,x,g,y,z,t,p,E]);if(o(()=>{if(E.state==="idle"&&E.data?.success)P()},[E.state,E.data,P]),!r)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${s}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e(ue,{className:s,tabsMode:m,query:l,setQuery:S,replaceQuery:k,setReplaceQuery:b,matchCase:x,setMatchCase:C,wholeWord:g,setWholeWord:O,useRegex:y,setUseRegex:F,includeFiles:v,setIncludeFiles:R,showIncludeField:L,setShowIncludeField:_,showMenu:H,setShowMenu:A,menuRef:q,rootPath:t,activeRepo:p,setActiveRepo:w,repos:M,reposScanning:N,rescanRepos:G,results:z,isSearching:D,truncated:J,error:Y,onOpenFile:c,handleReplace:X,replaceBusy:E.state!=="idle"})}export{it as SearchPanel};
|
|
1
|
+
import{d,n,o,K,i,u,a,cn,e,_e,as,f,os,is,ss,U,cs,h,T,xr,wr,xt,so,he,Ci,kl,mt,ft,gt,Dd,Tc}from"./index-st6a8q5z.js";import{Tr}from"./index-cxe75e06.js";var me=2000,W=new Map;function ge(s){if(s.length===0)return"";let r="";for(let t of s)r+=`${t.start}-${t.end},`;return r}function ee(s,r,t){let c=Ci(r),m=`${r}\x00${ge(t)}\x00${s}`;if(c){let S=W.get(m);if(S!==void 0)return W.delete(m),W.set(m,S),S}let l=kl(s,r,{marks:t});if(!c)return l;if(W.set(m,l),W.size>me){let S=W.keys().next();if(!S.done)W.delete(S.value)}return l}function te(s,r,t){let c=[],m=0;for(let l of r){if(l.start<m||l.end<=l.start||l.end>s.length)continue;if(l.start>m)c.push({text:s.slice(m,l.start),kind:"plain"});if(c.push({text:s.slice(l.start,l.end),kind:"removed"}),t)c.push({text:t,kind:"inserted"});m=l.end}if(m<s.length)c.push({text:s.slice(m),kind:"plain"});return c}function be({file:s,result:r,replacement:t,showReplacePreview:c,onOpen:m}){let l=r.ranges??[],S=c&&t.length>0;return e("button",{type:"button",onClick:()=>m(r),className:"flex w-full items-start gap-2 rounded px-1 py-0.5 text-left hover:bg-ink/5 cursor-pointer",title:`Open ${s}:${r.line}`,children:[e("span",{className:"w-6 flex-shrink-0 text-right font-mono text-ink/40",children:r.line}),S?e("span",{className:"min-w-0 truncate font-mono text-ink",children:te(r.content,l,t).map((k,b)=>k.kind==="plain"?e("span",{children:k.text},b):k.kind==="removed"?e("del",{className:"search-replace-old",children:k.text},b):e("ins",{className:"search-replace-new",children:k.text},b))}):e("span",{className:"min-w-0 truncate font-mono text-ink",dangerouslySetInnerHTML:{__html:ee(r.content,gt(s),l)}})]})}var re=cn(be);var Z={header:4,hit:4,group:16},ne={headerBox:16,hitBox:20},se=5000;function oe(s){let r=[],t=null;for(let c of s){if(!t||t.file!==c.file)t={file:c.file,results:[]},r.push(t);t.results.push(c)}return r}function ie(s){let r=[];for(let t of s){r.push({kind:"group",file:t.file,count:t.results.length});for(let c=0;c<t.results.length;c++)r.push({kind:"hit",file:t.file,result:t.results[c],last:c===t.results.length-1})}return r}function xe(s,r){if(s.kind==="group")return r.headerBox+Z.header;return r.hitBox+(s.last?Z.group:Z.hit)}function ae(s,r){let t=Array(s.length),c=Array(s.length),m=0;for(let l=0;l<s.length;l++){let S=xe(s[l],r);t[l]=m,c[l]=S,m+=S}return{offsets:t,heights:c,total:m}}function le(s,r,t,c,m=240){if(s.length===0)return{start:0,end:0};let l=Math.max(0,t),S=l-m,k=l+c+m,b=0,x=s.length-1;while(b<x){let g=b+x>>1;if(s[g]+r[g]>S)x=g;else b=g+1}let C=b;b=C,x=s.length;while(b<x){let g=b+x>>1;if(s[g]>=k)x=g;else b=g+1}return{start:C,end:b}}var Se=8,ve=8;function ce({groups:s,replacement:r,showReplacePreview:t,onOpen:c,onReplaceFile:m,replaceBusy:l}){let S=i(null),k=i(null),b=u(()=>ie(s),[s]),[x,C]=n(ne),g=u(()=>ae(b,x),[b,x]),[O,y]=n(()=>({start:0,end:Math.min(b.length,60)})),F=a((p)=>{S.current=p},[]),v=a(()=>{let p=S.current;if(!p)return;let w=le(g.offsets,g.heights,p.scrollTop,p.clientHeight);y((M)=>M.start===w.start&&M.end===w.end?M:w)},[g]),R=a(()=>{v()},[v]);K(()=>{let p=k.current;if(!p)return;let w=p.querySelector("[data-search-header] > div")?.offsetHeight??0,M=p.querySelector("[data-search-hit] > button")?.offsetHeight??0;if(w>0&&w!==x.headerBox)C((N)=>({...N,headerBox:w}));if(M>0&&M!==x.hitBox)C((N)=>({...N,hitBox:M}))},[O,x,b]),K(()=>{v()},[v]),K(()=>{let p=S.current;if(!p||typeof ResizeObserver>"u")return;let w=new ResizeObserver(()=>v());return w.observe(p),()=>w.disconnect()},[v]);let H=b.length===0?0:Math.min(O.start,b.length-1),A=Math.min(O.end,b.length),L=b.slice(H,A),_=A<b.length?g.total-g.offsets[A]:0;return e("div",{ref:F,onScroll:R,className:"flex-1 scrollbar-overlay-container px-3 text-xs",style:{overflowAnchor:"none"},children:[e("div",{style:{height:Se+(g.offsets[H]??0)},"aria-hidden":"true"}),e("div",{ref:k,children:L.map((p,w)=>{let M=H+w,N=g.heights[M];if(p.kind==="group")return e("div",{"data-search-header":"",style:{height:N},children:e("div",{className:"font-semibold text-ink/80 flex items-center justify-between group",children:[e("div",{className:"flex items-center min-w-0",children:[e(mt,{name:p.file,size:12,className:"mr-1.5 flex-shrink-0"}),e("span",{className:"truncate",children:p.file}),e("span",{className:"ml-2 bg-ink/10 text-[10px] px-1.5 py-0.5 rounded-full flex-shrink-0",children:p.count})]}),e("button",{onClick:()=>m(p.file),disabled:l,className:"touch-visible opacity-0 group-hover:opacity-100 p-1 text-ink/40 hover:text-ink rounded hover:bg-ink/5 disabled:opacity-50 flex-shrink-0",title:"Replace in this file",children:e(ss,{size:12})})]})},`group:${p.file}`);return e("div",{"data-search-hit":"",style:{height:N},children:e(re,{file:p.file,result:p.result,replacement:r,showReplacePreview:t,onOpen:c})},`hit:${p.file}:${p.result.line}:${M}`)})}),e("div",{style:{height:ve+_},"aria-hidden":"true"})]})}function ue({className:s,query:r,setQuery:t,replaceQuery:c,setReplaceQuery:m,matchCase:l,setMatchCase:S,wholeWord:k,setWholeWord:b,useRegex:x,setUseRegex:C,includeFiles:g,setIncludeFiles:O,showIncludeField:y,setShowIncludeField:F,showMenu:v,setShowMenu:R,menuRef:H,rootPath:A,activeRepo:L,setActiveRepo:_,repos:p,reposScanning:w,rescanRepos:M,results:N,isSearching:G,truncated:q,error:E,onOpenFile:z,handleReplace:D,replaceBusy:J,tabsMode:Y=!1}){let Q=u(()=>oe(N),[N]),P=i(null),X=i(null),B=a(()=>{t(""),P.current?.focus()},[t]),j=a(()=>{m(""),X.current?.focus()},[m]),V=u(()=>({matchCase:l,wholeWord:k,isRegex:x,inSelection:!1}),[l,k,x]),de=a((I)=>{Dd({path:I.file,line:Number(I.line),query:r,options:V}),z?.({path:I.file,name:I.file.split("/").pop()||I.file,root:A,repo:L})},[r,V,A,L,z]),fe=a((I)=>D(I),[D]);return e("div",{className:`flex flex-col h-full bg-paper ${s}`,children:[e(xt,{left:e(d,{children:[e(so,{id:"search",tabsMode:Y,children:e("h2",{className:"text-xs font-semibold text-ink uppercase tracking-wider",children:"Search"})}),e(Tr,{rootPath:A,activeRepo:L,onSelectRepo:_,repos:p,scanning:w,onRefreshRepos:M})]}),right:e("div",{className:"relative",ref:H,children:[e("button",{onClick:()=>R(!v),className:`p-1 rounded hover:bg-ink/5 transition-colors ${v||y?"text-ink":"text-ink/40"}`,title:"Search Options",children:e(_e,{size:14})}),v&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-48 bg-paper border border-ink/10 rounded shadow-lg z-10 py-1",children:e("button",{onClick:()=>{if(F(!y),y)O("");R(!1)},className:"w-full px-3 py-1.5 text-left text-xs text-ink hover:bg-ink/5 flex items-center justify-between",children:[e("span",{children:"Files to include"}),y&&e(f,{size:12,className:"text-ink/60"})]})})]})}),e("div",{className:"p-3 flex flex-col gap-2.5 border-b border-ink/10",children:[e("div",{className:"relative",children:e("div",{className:"flex items-center border border-ink/20 rounded bg-paper focus-within:border-ink/40 focus-within:ring-1 focus-within:ring-ink/10 transition-all",children:[e(U,{size:14,className:"ml-2 text-ink/40 flex-shrink-0"}),e("input",{ref:P,type:"text",placeholder:"Search",value:r,onChange:(I)=>t(I.currentTarget.value),className:"w-full bg-transparent border-none text-xs px-2 py-1.5 focus:outline-none text-ink placeholder-ink/35 min-w-0"}),r&&e("button",{type:"button",onClick:B,title:"Clear search","aria-label":"Clear search",className:"p-1 mr-0.5 rounded text-ink/40 hover:text-ink hover:bg-ink/5 flex-shrink-0",children:e(h,{size:12})}),e("div",{className:"flex items-center space-x-0.5 pr-1 text-ink/40 flex-shrink-0",children:[e("button",{onClick:()=>S(!l),className:`p-1 rounded hover:text-ink ${l?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Match Case",children:e(as,{size:14})}),e("button",{onClick:()=>b(!k),className:`p-1 rounded hover:text-ink ${k?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Match Whole Word",children:e(cs,{size:14})}),e("button",{onClick:()=>C(!x),className:`p-1 rounded hover:text-ink ${x?"bg-ink/10 text-ink":"hover:bg-ink/5"}`,title:"Use Regular Expression",children:e(os,{size:14})})]})]})}),e("div",{className:"relative flex items-center space-x-1",children:[e("div",{className:"flex flex-1 min-w-0 items-center border border-ink/20 rounded bg-paper focus-within:border-ink/40 focus-within:ring-1 focus-within:ring-ink/10 transition-all",children:[e("input",{ref:X,type:"text",placeholder:"Replace",value:c,onChange:(I)=>m(I.currentTarget.value),className:"flex-1 min-w-0 bg-transparent border-none text-xs px-2 py-1.5 focus:outline-none text-ink placeholder-ink/35"}),c&&e("button",{type:"button",onClick:j,title:"Clear replace","aria-label":"Clear replace",className:"p-1 mr-0.5 rounded text-ink/40 hover:text-ink hover:bg-ink/5 flex-shrink-0",children:e(h,{size:12})})]}),e("button",{onClick:()=>D(),disabled:N.length===0||J,className:"p-1.5 rounded border border-ink/20 text-ink/60 hover:text-ink hover:bg-ink/5 disabled:opacity-50 disabled:cursor-not-allowed bg-paper",title:"Replace All",children:e(is,{size:14})})]}),y&&e("div",{className:"relative",children:e("input",{type:"text",value:g,onChange:(I)=>O(I.currentTarget.value),placeholder:"Files to include (e.g. *.js, src/*)",className:"w-full bg-paper border border-ink/20 rounded text-xs px-2 py-1.5 focus:outline-none focus:border-ink/40 focus:ring-1 focus:ring-ink/10 transition-all text-ink placeholder-ink/40"})})]}),E&&N.length===0?e("div",{className:"flex-1 px-3 py-3",role:"alert",children:e("div",{className:"rounded border border-error/30 bg-error/5 px-2.5 py-2",children:[e("div",{className:"text-[11px] font-semibold text-error",children:"Search failed"}),e("div",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-[10.5px] text-ink/70",children:E}),x&&e("div",{className:"mt-1 text-[10.5px] text-ink/50",children:["Regex is on — escape metacharacters such as ",e("code",{className:"font-mono",children:"( ) [ ] * ? +"})," or turn it off to search literally."]})]})}):G&&N.length===0?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"Searching..."}):r.trim().length<=2?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"Type at least 3 characters to search."}):N.length===0?e("div",{className:"flex-1 text-ink/40 italic text-center py-4",children:"No results found."}):e(d,{children:[E&&e("div",{className:"px-3 pt-2 text-[10.5px] text-error",role:"alert",children:["Search failed: ",e("span",{className:"font-mono",children:E})]}),G&&e("div",{className:"px-3 pt-2 text-ink/40 italic",children:"Searching…"}),q&&e("div",{className:"px-3 pt-2 text-ink/50 italic",children:["Showing the first ",se," matches — refine the query to see the rest."]}),e(ce,{groups:Q,replacement:c,showReplacePreview:c.length>0,onOpen:de,onReplaceFile:fe,replaceBusy:J})]})]})}function pe(s){let[r,t]=n({scope:s,results:[],truncated:!1,error:null}),[c,m]=n(!1),l=i(null),S=i(!0),k=i(s);k.current=s,o(()=>(S.current=!0,()=>{S.current=!1,l.current?.abort(),l.current=null}),[]);let b=a(async(x)=>{l.current?.abort();let C=new AbortController;l.current=C;let g=k.current;t({scope:g,results:[],truncated:!1,error:null}),m(!0);try{let O=await fetch("/api/fs/search",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams(x),signal:C.signal});await Tc(O,(y,F)=>{if(k.current!==g)return;if(y==="done"){let v=!1;try{v=JSON.parse(F)?.truncated===!0}catch{}t((R)=>R.scope===g?{...R,truncated:v}:R);return}if(y==="error"){let v="Search failed";try{v=JSON.parse(F)?.error||v}catch{}t((R)=>R.scope===g?{...R,error:v}:R);return}if(y!=="matches")return;try{let v=JSON.parse(F);if(Array.isArray(v))t((R)=>R.scope===g?{...R,results:[...R.results,...v]}:R)}catch{}},C.signal)}catch{}finally{if(S.current&&l.current===C)l.current=null,m(!1)}},[]);return{results:r.scope===s?r.results:[],isSearching:c&&r.scope===s,truncated:r.scope===s&&r.truncated,error:r.scope===s?r.error:null,start:b}}function it({className:s="",enabled:r=!0,rootPath:t,onOpenFile:c,tabsMode:m=!1}){let[l,S]=T("search.query",""),[k,b]=T("search.replaceQuery",""),[x,C]=T("search.matchCase",!1),[g,O]=T("search.wholeWord",!1),[y,F]=T("search.useRegex",!1),[v,R]=T("search.includeFiles",""),[H,A]=n(!1),[L,_]=T("search.showIncludeField",!1),{activeRepo:p,setActiveRepo:w}=xr(t),{repos:M,scanning:N,rescan:G}=wr(t,r),q=i(null),E=ft(),{results:z,isSearching:D,truncated:J,error:Y,start:Q}=pe(`${t??""}\x00${p}`);he(q,()=>A(!1));let P=a(()=>{if(!r)return;if(l.trim().length>2)return Q({q:l,matchCase:String(x),wholeWord:String(g),useRegex:String(y),includeFiles:L?v:"",...t?{root:t}:{},...p!=="."?{repo:p}:{}})},[r,l,x,g,y,L,v,t,p,Q]);o(()=>{let B=setTimeout(()=>{P()},300);return()=>clearTimeout(B)},[P]);let X=a((B)=>{if(!l)return;let j=B?[B]:Array.from(new Set(z.map((V)=>V.file)));if(j.length===0)return;E.submit({q:l,replaceWith:k,matchCase:String(x),wholeWord:String(g),useRegex:String(y),files:JSON.stringify(j),...t?{root:t}:{},...p!=="."?{repo:p}:{}},{method:"POST",action:"/api/fs/replace"})},[l,k,x,g,y,z,t,p,E]);if(o(()=>{if(E.state==="idle"&&E.data?.success)P()},[E.state,E.data,P]),!r)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${s}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e(ue,{className:s,tabsMode:m,query:l,setQuery:S,replaceQuery:k,setReplaceQuery:b,matchCase:x,setMatchCase:C,wholeWord:g,setWholeWord:O,useRegex:y,setUseRegex:F,includeFiles:v,setIncludeFiles:R,showIncludeField:L,setShowIncludeField:_,showMenu:H,setShowMenu:A,menuRef:q,rootPath:t,activeRepo:p,setActiveRepo:w,repos:M,reposScanning:N,rescanRepos:G,results:z,isSearching:D,truncated:J,error:Y,onOpenFile:c,handleReplace:X,replaceBusy:E.state!=="idle"})}export{it as SearchPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t,l,bt,ya,w,M,O,G,z,j,q,H,m,va,Yi,b,Ar,hr,V,Mn,yt,ct,ut,ar,xc,Pt,Ot,Hn,$t,vt}from"./index-
|
|
1
|
+
import{t,l,bt,ya,w,M,O,G,z,j,q,H,m,va,Yi,b,Ar,hr,V,Mn,yt,ct,ut,ar,xc,Pt,Ot,Hn,$t,vt}from"./index-xfnjwhan.js";import{Ht}from"./index-st6a8q5z.js";import{Za}from"./index-zynbvm7x.js";var h1="flowchart-",d1=class{constructor(){this.vertexCounter=0,this.config=m(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=O,this.setAccDescription=z,this.setDiagramTitle=q,this.getAccTitle=G,this.getAccDescription=j,this.getDiagramTitle=H,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}static{t(this,"FlowDB")}sanitizeText(e){return w.sanitizeText(e,this.config)}sanitizeNodeLabelType(e){switch(e){case"markdown":case"string":case"text":return e;default:return"markdown"}}setDiagramId(e){this.diagramId=e}lookUpDomId(e){for(let r of this.vertices.values())if(r.id===e)return this.diagramId?`${this.diagramId}-${r.domId}`:r.domId;return this.diagramId?`${this.diagramId}-${e}`:e}addVertex(e,r,a,n,o,f,c={},g){if(!e||e.trim().length===0)return;let d;if(g!==void 0){let T;if(!g.includes(`
|
|
2
2
|
`))T=`{
|
|
3
3
|
`+g+`
|
|
4
4
|
}`;else T=g+`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t}from"./index-
|
|
1
|
+
import{t}from"./index-xfnjwhan.js";var $i=class{constructor(i){this.init=i,this.records=this.init()}static{t(this,"ImperativeState")}reset(){this.records=this.init()}};
|
|
2
2
|
export{$i};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d,n,o,i,u,e,s,f,E,N,It,Rt,On,an,se}from"./index-
|
|
1
|
+
import{d,n,o,i,u,e,s,f,E,N,It,Rt,On,an,se}from"./index-st6a8q5z.js";var le={name:"key-round",size:24,node:[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]},to=s(le);var ce={name:"package",size:24,node:[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]},wd=s(ce);var pe={name:"pin-off",size:24,node:[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]},wc=s(pe);var de={name:"pin",size:24,node:[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]},no=s(de);var me={name:"plug",size:24,node:[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]},Cd=s(me);var ue={name:"puzzle",size:24,node:[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]},pl=s(ue);function ne({listboxId:r,ariaLabel:p,value:c,placeholder:x,allowEmpty:R,hasSelected:O,filtered:T,groups:k,query:g,emptyText:w,activeIndex:z,optionRefs:D,icon:_,onCommit:I,onHover:P}){let B=R?1:0;return e("div",{id:r,role:"listbox","aria-label":p,className:"max-h-56 overflow-y-auto py-1",children:[R&&e("button",{type:"button",role:"option","aria-selected":c==="",ref:(m)=>{D.current[0]=m},onClick:()=>I(""),onMouseEnter:()=>P(0),className:`flex w-full items-center justify-between gap-2 px-3 py-1.5 text-left ${c===""?"text-ink":"text-ink/60"} hover:bg-ink/5`,children:[e("span",{className:"truncate italic",children:x}),c===""&&e(f,{size:11,className:"flex-shrink-0"})]}),c!==""&&!O&&e("button",{type:"button",role:"option","aria-selected":!0,onClick:()=>I(c),className:"flex w-full items-center justify-between gap-2 px-3 py-1.5 text-left text-ink",children:[e("span",{className:"truncate",children:[c," (not listed)"]}),e(f,{size:11,className:"flex-shrink-0"})]}),T.length===0?e("div",{className:"px-3 py-2 italic text-ink/40",children:g.trim()?`No match for “${g.trim()}”`:w}):k.map((m)=>e("div",{children:[m.name&&e("div",{className:"px-3 pb-0.5 pt-2 text-[9px] font-semibold uppercase tracking-wider text-ink/35",children:m.name}),m.rows.map((l)=>{let A=T.indexOf(l),v=l.value===c;return e("button",{type:"button",role:"option","aria-selected":v,"aria-disabled":l.disabled||void 0,disabled:l.disabled,ref:(H)=>{D.current[A+B]=H},onClick:()=>I(l.value),onMouseEnter:()=>P(A),title:l.hint??l.value,className:`flex w-full items-start justify-between gap-2 px-3 py-1.5 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-40 ${A===z?"bg-ink/5":""} ${v?"font-medium text-ink":"text-ink/75"}`,children:[e("span",{className:"flex min-w-0 items-center gap-2",children:[_?.(l),e("span",{className:"min-w-0",children:[e("span",{className:"block truncate",children:l.label}),l.hint&&e("span",{className:"block truncate font-mono text-[10px] text-ink/40",children:l.hint})]})]}),v&&e(f,{size:11,className:"mt-0.5 flex-shrink-0"})]},l.value)})]},m.name||"__flat"))]})}var fe="flex w-full min-w-0 items-center justify-between gap-2 rounded-md border border-ink/20 bg-paper px-2 py-1.5 text-left font-mono text-[11px] text-ink transition-colors hover:border-ink/40 focus:border-ink/50 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",be="tap-chip group flex max-w-full items-center gap-1.5 rounded-md px-1.5 py-1 text-xs font-medium transition-all focus-visible:bg-ink/5 disabled:cursor-not-allowed disabled:opacity-50",ye="tap-chip flex shrink-0 items-center justify-center rounded-md transition-colors disabled:cursor-not-allowed disabled:opacity-50";function Z({value:r,options:p,placeholder:c,ariaLabel:x,onChange:R,disabled:O,className:T,searchable:k=!0,allowEmpty:g=!0,icon:w,emptyIcon:z,heading:D,footer:_,emptyText:I="No options available",searchPlaceholder:P="Search…",variant:B="field",panelClassName:m,align:l="start",triggerLabel:A,iconOnly:v=!1,triggerClassName:H}){let[q,F]=n(null),[L,K]=n(""),[G,C]=n(0),V=i(null),U=i(null),Q=i([]),J=i(`search-select-${Math.random().toString(36).slice(2,9)}`).current,b=p.find((t)=>t.value===r),y=q!==null,Y=A??b?.label??(r?`${r} (not listed)`:c),S=u(()=>{let t=L.trim();if(!t)return p;return p.filter((a)=>an(`${a.label} ${a.value} ${a.hint??""}`,t))},[p,L]),re=u(()=>{let t=[];for(let a of S){let h=a.group??"",te=t.find((ie)=>ie.name===h);if(te)te.rows.push(a);else t.push({name:h,rows:[a]})}return t},[S]),j=(t=!1)=>{if(F(null),K(""),t)V.current?.focus()},W=()=>{if(O||!V.current)return;let t=Math.max(0,p.findIndex((a)=>a.value===r));K(""),C(t),F(It(V.current))},X=(t)=>{if(t!==r)R(t);j(!0)};o(()=>{C(0)},[L]),o(()=>{if(!y)return;Q.current[G+(g?1:0)]?.scrollIntoView({block:"nearest"})},[y,G,g]),o(()=>{if(!y||k)return;U.current?.focus()},[y,k]);let ee=(t)=>{C((a)=>{for(let h=a+t;h>=0&&h<S.length;h+=t)if(!S[h]?.disabled)return h;return a})},ae=(t)=>{if(t.key==="ArrowDown")t.preventDefault(),ee(1);else if(t.key==="ArrowUp")t.preventDefault(),ee(-1);else if(t.key==="Home")t.preventDefault(),C(0);else if(t.key==="End")t.preventDefault(),C(Math.max(0,S.length-1));else if(t.key==="Enter"){t.preventDefault();let a=S[G];if(a&&!a.disabled)X(a.value)}},M=B==="chip";return e(d,{children:[e("button",{ref:V,type:"button",role:"combobox","aria-label":M?`${x}: ${Y}`:x,"aria-haspopup":"listbox","aria-expanded":y,"aria-controls":y?J:void 0,disabled:O,title:Y,onClick:()=>y?j():W(),onKeyDown:(t)=>{if(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")t.preventDefault(),W()},className:`${H??`${M?v?ye:be:fe} ${M&&b?"bg-ink/10 text-ink":M?"text-muted hover:bg-ink/5 hover:text-ink":""}`} ${T??""}`,children:v?b?w?.(b):z:e(d,{children:[e("span",{className:"flex min-w-0 items-center gap-1.5",children:[w&&(b?w(b):z),e("span",{className:`truncate tracking-tight ${!M&&!b&&!r?"text-ink/40":""}`,children:Y})]}),e(E,{size:M?13:12,className:`flex-shrink-0 text-ink/40 transition-transform ${y?"rotate-180 text-ink/70":""}`})]})}),e(Rt,{anchor:q,align:l,className:`${m??"w-72 max-w-[calc(100vw-2rem)]"} rounded-md border border-ink/15 bg-paper py-1 text-xs shadow-lg`,...{"aria-label":x},onClose:()=>j(!0),children:e("div",{ref:U,tabIndex:k?void 0:-1,onKeyDown:ae,className:"outline-none",children:[D&&e("div",{className:"border-b border-ink/5 px-3 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-ink/40",children:D}),k?e(On,{value:L,onChange:K,ariaLabel:`Search ${x}`,placeholder:P}):null,e(ne,{listboxId:J,ariaLabel:x,value:r,placeholder:c,allowEmpty:g,hasSelected:Boolean(b),filtered:S,groups:re,query:L,emptyText:I,activeIndex:G,optionRefs:Q,icon:w,onCommit:X,onHover:C}),_?e("div",{className:"border-t border-ink/5 pt-1",children:_}):null]})})]})}var dh="modern",ph=["classic","modern"];function he(r){return r==="classic"||r==="modern"}function Cc(r){return he(r)?r:"modern"}var mh={classic:{label:"Classic",description:"A toolbar of boxed icons and compact rows — the layout Kabmo has always shipped.",caption:"Toolbar · 24px rows"},modern:{label:"Modern",description:"Permanent search, filter chips, sticky workspace headers and taller rows with one trailing column.",caption:"Search · chips · 30px rows"}};var xe="sidebarStyle",oe="omp:sidebar-style-changed";function Se(r){return Cc(N(xe,r))}function fh(r){if(typeof window>"u")return;window.dispatchEvent(new CustomEvent(oe,{detail:Cc(r)}))}function Ed(){let[r,p]=n(()=>Se());return se(oe,(c)=>{p(Cc(c.detail))}),r}
|
|
2
2
|
export{to,wd,wc,no,Cd,pl,Z,dh,ph,Cc,mh,fh,Ed};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n,o,s,N}from"./index-
|
|
1
|
+
import{n,o,s,N}from"./index-st6a8q5z.js";import{Wr,ql,fg,gg,HA,Xu}from"./index-ewst55j2.js";var ap="omp:editor-theme-changed";function a(){if(typeof window>"u")return ql;return N("editorTheme")??ql}var p={theme:null,vars:{},themes:gg(null)};function Li(){let[e,t]=n(a);if(o(()=>{let i=(d)=>{let E=d.detail;t(E||a())};return window.addEventListener(ap,i),()=>window.removeEventListener(ap,i)},[]),o(()=>{Xu(e)},[e]),e===Wr)return p;let r=fg(e);return{theme:r,vars:HA(r),themes:gg(e)}}var m={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]},ht=s(m);var op="omp:editor-indent-changed",ip=[2,4,8],Qu={width:2,insertSpaces:!0};function sp(){if(typeof window>"u")return Qu;let e=N("editorIndentWidth"),t=N("editorInsertSpaces");return{width:typeof e==="number"&&ip.includes(e)?e:Qu.width,insertSpaces:typeof t==="boolean"?t:Qu.insertSpaces}}function Ru(e){return e.insertSpaces?" ".repeat(e.width):"\t"}function Lu(){let[e,t]=n(sp);return o(()=>{let r=(i)=>{let d=i.detail;t(d??sp())};return window.addEventListener(op,r),()=>window.removeEventListener(op,r)},[]),e}var lp="omp:editor-typing-changed",Ul={autoCloseBrackets:!0,autocomplete:!0};function Fu(){if(typeof window>"u")return Ul;let e=N("editorAutoCloseBrackets"),t=N("editorAutocomplete");return{autoCloseBrackets:typeof e==="boolean"?e:Ul.autoCloseBrackets,autocomplete:typeof t==="boolean"?t:Ul.autocomplete}}function Mu(){let[e,t]=n(Fu);return o(()=>{let r=(i)=>{let d=i.detail;t(d??Fu())};return window.addEventListener(lp,r),()=>window.removeEventListener(lp,r)},[]),e}var Ps="omp:editor-blame-changed",Gl={enabled:!0,inline:!1};function Fi(){if(typeof window>"u")return Gl;let e=N("editorBlame"),t=N("editorBlameInline");return{enabled:typeof e==="boolean"?e:Gl.enabled,inline:typeof t==="boolean"?t:Gl.inline}}function cp(){let[e,t]=n(Fi);return o(()=>{let r=(i)=>{let d=i.detail;t(d??Fi())};return window.addEventListener(Ps,r),()=>window.removeEventListener(Ps,r)},[]),e}
|
|
2
2
|
export{ht,ap,Li,op,ip,Qu,sp,Ru,Lu,lp,Ul,Fu,Mu,Ps,Gl,Fi,cp};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n,o,K,i,ie,e,s,_e}from"./index-
|
|
1
|
+
import{n,o,K,i,ie,e,s,_e}from"./index-st6a8q5z.js";var _={name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]},Wa=s(_);var M={name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]},Ka=s(M);function O({widths:r,pinned:a,available:c}){if(!(c>0)||r.length===0)return r.map(()=>!0);if(r.reduce((d,u)=>d+u,0)+4*(r.length-1)<=c)return r.map(()=>!0);let m=r.map(()=>!1),v=0,f=0;r.forEach((d,u)=>{if(!a[u])return;v+=d+(f>0?4:0),f+=1,m[u]=!0});let t=c-v-30-4;return r.forEach((d,u)=>{if(a[u])return;let x=d+(f>0?4:0);if(x>t)return;t-=x,f+=1,m[u]=!0}),m}function R(r){return r.some((a)=>!a)}function ai({clusters:r,className:a="",available:c}){let b=i(null),[m,v]=n(null),[f,t]=n(0),[d,u]=n(0),x=c??f,y=r.map((l)=>`${l.id}:${l.pinned?1:0}`).join("|"),h=m?.signature===y,g=h?m.widths:[],k=r.map((l)=>l.pinned===!0),w=c===0?r.map(()=>!1):g.length>0?O({widths:g,pinned:k,available:x}):r.map(()=>!0);K(()=>{let l=b.current;if(!l)return;if(!h){let p=[...l.querySelectorAll("[data-toolbar-cluster]")];if(p.length===r.length){let T=p.map((E)=>E.getBoundingClientRect().width);if(T.some((E)=>E>0))v({signature:y,widths:T})}}if(c===void 0)t(l.clientWidth)},[c,h,y,r.length,d]),o(()=>{let l=b.current;if(!l||typeof ResizeObserver>"u")return;let p=new ResizeObserver(()=>{t(l.clientWidth),u((T)=>T+1)});return p.observe(l),()=>p.disconnect()},[]);let L=r.filter((l,p)=>!w[p]).flatMap((l)=>l.actions);return e("div",{ref:b,style:c===void 0?void 0:{maxWidth:`${c}px`},className:`flex ${c===void 0?"flex-1":"flex-none"} min-w-0 flex-nowrap items-center justify-end gap-x-1 overflow-hidden ${a}`,children:[r.map((l,p)=>w[p]?e("div",{"data-toolbar-cluster":"",className:"flex items-center flex-shrink-0",children:l.children},l.id):null),R(w)&&e(A,{actions:L})]})}function A({actions:r}){let[a,c]=n(!1),[b,m]=n(null),v=i(null),f=i(null);return o(()=>{if(!a)return;let t=(d)=>{let u=d.target;if(v.current?.contains(u)||f.current?.contains(u))return;c(!1)};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}},[a]),o(()=>{if(!a)return;let t=(d)=>{if(d.key==="Escape")c(!1)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[a]),K(()=>{if(!a)return;let t=v.current?.firstElementChild,d=f.current;if(!t||!d)return;let u=t.getBoundingClientRect(),{width:x,height:y}=d.getBoundingClientRect(),h=8,g=u.bottom+4,k=g+y+h<=window.innerHeight?g:Math.max(h,u.top-y-4),w=Math.max(h,Math.min(u.right-x,window.innerWidth-x-h));m({top:k,left:w})},[a,r.length]),e("div",{className:"relative flex-shrink-0",ref:v,children:[e("button",{type:"button",title:"More actions","aria-label":"More actions","aria-haspopup":"menu","aria-expanded":a,onClick:()=>{m(null),c(!a)},className:`flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer ${a?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,children:e(_e,{size:14})}),a&&ie(e("div",{ref:f,role:"menu",style:{top:b?.top??0,left:b?.left??0,visibility:b?"visible":"hidden"},className:"glass-popover fixed z-[80] w-52 bg-paper border border-ink/15 rounded-lg shadow-lg py-1 text-xs",children:r.map((t)=>e("button",{type:"button",role:"menuitem",disabled:t.disabled,"aria-pressed":t.active,onClick:()=>{c(!1),t.onSelect()},className:`w-full text-left flex items-center gap-2 px-3 py-1.5 transition-colors disabled:cursor-default disabled:opacity-40 ${t.active?"bg-ink/5 text-ink font-medium":"text-ink/75 hover:bg-ink/5 hover:text-ink"}`,children:[e(t.icon,{size:13,className:"flex-shrink-0"}),e("span",{className:"truncate",children:t.label})]},t.label))}),document.body)]})}
|
|
2
2
|
export{Wa,Ka,ai};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n,o,i,u,a,ze,e,ao,I,S,T,tt,cr,xl,Bi,Ii,Th,Qh,Rh,Mo,Lh,Fh,gt,Dd,zh,Uh,Lt,Pa,zd,Pl,Wd,tg}from"./index-
|
|
1
|
+
import{n,o,i,u,a,ze,e,ao,I,S,T,tt,cr,xl,Bi,Ii,Th,Qh,Rh,Mo,Lh,Fh,gt,Dd,zh,Uh,Lt,Pa,zd,Pl,Wd,tg}from"./index-st6a8q5z.js";import{ke,Dn,jl,Br,x,P,sn,Nn,D,ye,_}from"./index-e4yj4kbe.js";function We(t){let r=t.split("/").pop()??"",s=r.lastIndexOf(".");return s>0&&s<r.length-1?r.slice(s).toLowerCase():""}function wA(t){let r=Lt("fileOpener"),s=Lt("sourceCodeRenderer"),l=Pa(),c=t.extension??We(t.path),d=r.find((h)=>h.registration.matches({path:t.path,extension:c}));if(d)return{kind:"opener",pluginId:d.pluginId,Component:d.registration.component,props:{...l,path:t.path,extension:c}};let f=s.find((h)=>h.registration.extensions.includes(c));if(f)return{kind:"source",pluginId:f.pluginId,Component:f.registration.component,props:{...l,path:t.path,content:t.content,language:t.language}};return null}function CA(t){let r=Lt("diffRenderer"),s=Pa(),l=We(t.path),c=r.find((d)=>{let f=d.registration.extensions;return f===void 0||f.includes(l)});if(!c)return null;return{pluginId:c.pluginId,Component:c.registration.component,props:{...s,path:t.path,diff:t.diff}}}function EA({view:t}){if(t.kind==="opener"){let s=t.Component;return e(tt,{pluginId:t.pluginId,children:e(s,{...t.props})})}let r=t.Component;return e(tt,{pluginId:t.pluginId,children:e(r,{...t.props})})}var Tt={docx:!0},Ct={xls:!0,xlsx:!0,xlsm:!0},Dt={csv:!0,tsv:!0},It={md:!0,markdown:!0,mdx:!0},Ot={html:!0,htm:!0},Pt={drawio:!0,dio:!0},Ls={image:!0,pdf:!0,docx:!0,spreadsheet:!0,code:void 0,markdown:void 0,html:void 0,svg:void 0,csv:void 0,drawio:void 0},ku={markdown:!0,html:!0,svg:!0,csv:!0,drawio:!0,code:void 0,image:void 0,pdf:void 0,docx:void 0,spreadsheet:void 0},Nt={markdown:!0,svg:!0,csv:!0,drawio:!0,html:void 0,code:void 0,image:void 0,pdf:void 0,docx:void 0,spreadsheet:void 0};function xu(t){return Nt[t]===!0}var Xo={code:"Text",markdown:"Markdown",html:"HTML",svg:"SVG",csv:"CSV",image:"Image",pdf:"PDF",docx:"Document",spreadsheet:"Spreadsheet",drawio:"Diagram"};function Fs(t){let r=Bi(t);if(!r)return"code";if(r==="svg")return"svg";if(Pt[r])return"drawio";if(It[r])return"markdown";if(Ot[r])return"html";if(Ii(t))return"image";if(r==="pdf")return"pdf";if(Tt[r])return"docx";if(Ct[r])return"spreadsheet";if(Dt[r])return"csv";return"code"}var Wt={id:"",url:null,loadBytes:null,mimeType:null};async function Le(t){let r=await t.json().catch(()=>null);return typeof r?.error==="string"&&r.error?r.error:`Could not read the file (HTTP ${t.status}).`}function Ae(t){let r=Th(t.path);if(t.rawUrl){let c=t.rawUrl;return{id:c,url:c,mimeType:r,loadBytes:async()=>{let d=await fetch(c);if(!d.ok)throw Error(await Le(d));return d.arrayBuffer()}}}let s=tg(t.handleId);if(s){let{bytes:c}=s;return{id:t.handleId,url:null,mimeType:s.mimeType??r,loadBytes:async()=>c.slice().buffer}}let l=Pl(t.handleId);if(l)return{id:t.handleId,url:null,mimeType:r,loadBytes:async()=>(await l.getFile()).arrayBuffer()};return Wt}function Be(t,r){let s=t?Fs(t.path??""):"code",l=Ls[s]===!0,c=Boolean(t?.path)&&!t?.handleId,d=c&&t?.content===void 0&&Ii(t?.path)?t.path:null,f=d!==null,h=t&&!f&&l&&c&&t.content===void 0?xl({path:t.path,root:t.root,repo:t.repo}):null,p=Ae({path:t?.path,handleId:t?.handleId,rawUrl:d?`${xl({path:d,root:t?.root,repo:t?.repo})}&v=${r}`:h});return{viewerKind:s,isBinaryViewer:l,isImage:f,imageUrl:f?p.url:null,byteSource:p}}function Ke(t){let r=t.indexOf(`
|
|
2
2
|
`);return r>0&&t[r-1]==="\r"?"crlf":"lf"}function me(t){return t.includes("\r")?t.replace(/\r\n?/g,`
|
|
3
3
|
`):t}function Ue(t,r){let s=me(t);return r==="crlf"?s.replace(/\n/g,`\r
|
|
4
4
|
`):s}function qe(t){return String(t.id??t.path??t.name)}function Ve({target:t,key:r,isBinaryViewer:s,revision:l,loadedRef:c,contentsRef:d,baselinesRef:f,pendingRef:h,readingRef:p,remember:g}){let[v,k]=n(!1),[w,m]=n(!1),[R,y]=n(null),[E,F]=n(null);return o(()=>{if(m(!1),!t)return;let b=qe(t);if(c.current.has(b))return;if(c.current.add(b),s){y(null),F(null),k(!1);return}if(t.content!==void 0){g(b,t.content,null,null),y(null),F(null);return}if(!t.path){y("No file path supplied for this attachment."),F(null);return}let W=d.current[b]===void 0,U=!1;if(W)k(!0);y(null),F(null);let N=new URLSearchParams({path:t.path});if(t.root)N.set("root",t.root);if(t.repo&&t.repo!==".")N.set("repo",t.repo);return p.current+=1,m(!0),fetch(`/api/fs/read?${N.toString()}`).then(async(B)=>{let O=await B.json().catch(()=>null);if(!B.ok||!O||typeof O.content!=="string"){let C=Error(O?.error||`HTTP ${B.status}`);if(O?.kind)C.kind=O.kind;else if(B.status===415)C.kind="binary";throw C}return{text:O.content,mtimeMs:typeof O.mtimeMs==="number"?O.mtimeMs:null,hash:typeof O.hash==="string"?O.hash:null}}).then(({text:B,mtimeMs:O,hash:C})=>{if(U)return;let A=d.current[b];if(A!==void 0&&A!==f.current[b])return;let X=h.current;if(X&&qe(X.file)===b)return;g(b,B,O,C)}).catch((B)=>{if(U)return;if(!W)return;g(b,"",null,null);let O=B instanceof Error?B.message:"Failed to read file",C=B?.kind;F(C?O:null),y(O)}).finally(()=>{if(p.current-=1,!U)k(!1),m(!1)}),()=>{U=!0}},[r,t,g,l,s,c,d,f,h,p]),{isLoading:v,isReading:w&&!v,loadError:R,unsupported:E}}async function _e(t,r){let s=await fetch(t);if(!s.ok)throw Error(`HTTP ${s.status}`);zd(await s.blob(),r)}async function $e(t){let r=await fetch(t);if(!r.ok)throw Error(`HTTP ${r.status}`);let s=await r.blob();if(typeof ClipboardItem>"u"||!navigator.clipboard?.write)throw Error("Image clipboard unavailable");await navigator.clipboard.write([new ClipboardItem({[s.type]:s})])}function He({target:t,content:r,downloadContent:s,imageUrl:l,downloadMimeType:c,byteSource:d,byteViewer:f=!1}){let[h,p]=n(!1),g=a(()=>{p(!0),window.setTimeout(()=>p(!1),1500)},[]),v=a(()=>{if(!t)return;if(l){$e(l).then(g).catch(()=>{});return}if(f)return;if(!navigator.clipboard)return;navigator.clipboard.writeText(r).then(g).catch(()=>{})},[t,r,l,f,g]),k=a(()=>{if(!t)return;if(l){_e(l,t.name).catch(()=>{});return}if(f){let w=d?.loadBytes;if(!w)return;let m=d?.mimeType;w().then((R)=>zd(m?new Blob([R],{type:m}):new Blob([R]),t.name)).catch(()=>{});return}zd(new Blob([s],{type:c}),t.name)},[t,s,c,l,f,d]);return{copied:h,copy:v,download:k}}async function je(t){let r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return Array.from(new Uint8Array(r),(s)=>s.toString(16).padStart(2,"0")).join("")}async function Xe(t,r,s,l){if(t.handleId){let d=s==="crlf"?r.replace(/\n/g,`\r
|