getborg 0.0.124 → 0.0.126
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/bin.mjs +4900 -2407
- package/dist/client/.vite/manifest.json +359 -359
- package/dist/client/assets/{ArrowRight-D8u8fAtz.js → ArrowRight-sXL3WqRj.js} +2 -2
- package/dist/client/assets/{ArrowSquareOut-B_f6YUhV.js → ArrowSquareOut-BXw7kBJ2.js} +2 -2
- package/dist/client/assets/{ArrowsClockwise-DQYZ1Xbo.js → ArrowsClockwise-C2ZJkkb1.js} +2 -2
- package/dist/client/assets/{CaretLeft-CfrkuxuJ.js → CaretLeft-u94enBjz.js} +2 -2
- package/dist/client/assets/{ChatMarkdown-Ch9PipMk.js → ChatMarkdown-PlWZFDnz.js} +5 -5
- package/dist/client/assets/{CircleNotch-BcVOnWaH.js → CircleNotch-DqcpMoTY.js} +2 -2
- package/dist/client/assets/{DesignWorkspace-CrijZIpE.js → DesignWorkspace-DmKoQxKI.js} +3 -3
- package/dist/client/assets/DiffPanel-D77xCxTK.js +2 -0
- package/dist/client/assets/{DiffWorkerPoolProvider-B-AH2sbL.js → DiffWorkerPoolProvider-ClROlLBb.js} +2 -2
- package/dist/client/assets/{DocxPreview-HXde7oD1.js → DocxPreview-HJVaPJXL.js} +4 -4
- package/dist/client/assets/{FilePreviewPanel-DkspqFyX.js → FilePreviewPanel-CFCxGnPA.js} +9 -9
- package/dist/client/assets/{HtmlPreview-pfh_hRgS.js → HtmlPreview-CJQuCP2x.js} +2 -2
- package/dist/client/assets/{PdfPreview-VSGe6F9I.js → PdfPreview-BgV8uugr.js} +3 -3
- package/dist/client/assets/{PptxPreview-CZZ5e7rI.js → PptxPreview-BVdzk7UG.js} +3 -3
- package/dist/client/assets/PreviewPanel-C8wYTZ3K.js +2 -0
- package/dist/client/assets/PullRequestCodeTab-6b-pnSLs.js +6 -0
- package/dist/client/assets/{PullRequestReactions-BJ4eU_08.js → PullRequestReactions-kdg3iZ85.js} +4 -4
- package/dist/client/assets/{RightPanelResizeHandle-XlC9gY5e.js → RightPanelResizeHandle-kUStdA3L.js} +2 -2
- package/dist/client/assets/{VirtualizedFile-qiRlyNDc.js → VirtualizedFile-DuJYdYdq.js} +2 -2
- package/dist/client/assets/{XlsxPreview-BPtt3tW-.js → XlsxPreview-Bi4rmMAb.js} +3 -3
- package/dist/client/assets/accountData-B88fzgQo.js +16 -0
- package/dist/client/assets/assetUrls-CF9bvkMB.js +2 -0
- package/dist/client/assets/assets-CkgNlvqv.js +2 -0
- package/dist/client/assets/{browserHistoryStore-CEVJXGfr.js → browserHistoryStore-DIuEAuCl.js} +3 -3
- package/dist/client/assets/{browserRecording-BavNt16V.js → browserRecording-2dQePGOK.js} +2 -2
- package/dist/client/assets/clientAnalytics-BbUHu8ei.js +1 -0
- package/dist/client/assets/{clientPersistenceStorage-CeJLSpQl.js → clientPersistenceStorage-DsdIKJBh.js} +2 -2
- package/dist/client/assets/{combobox-CQHB5X6j.js → combobox-DVmHwJKi.js} +2 -2
- package/dist/client/assets/{composerMentionDrag-CdTT1rUK.js → composerMentionDrag-CB6wqaTe.js} +2 -2
- package/dist/client/assets/{designCanvas.logic-DduGt5E7.js → designCanvas.logic-Ce5c0YLY.js} +4 -4
- package/dist/client/assets/{designOpenFileContext-CMKir5dG.js → designOpenFileContext-B0d1oDHN.js} +2 -2
- package/dist/client/assets/{diffFileContents-CHRsIT6_.js → diffFileContents-DuZ8MpUA.js} +2 -2
- package/dist/client/assets/{empty-DUUjhkFh.js → empty-d8cb8Ewx.js} +2 -2
- package/dist/client/assets/entities-DI7lpu_V.js +2 -0
- package/dist/client/assets/{followUpQueuePersistence-C_pFQCnT.js → followUpQueuePersistence-BL42ySpK.js} +1 -1
- package/dist/client/assets/{index-DrITfTBh.js → index-e-hiL6eh.js} +3 -3
- package/dist/client/assets/{input-CyCAHFxI.js → input-DzNFHo2W.js} +2 -2
- package/dist/client/assets/{lib-BRpsbmNP.js → lib-IA-5-mGB.js} +2 -2
- package/dist/client/assets/{main-C0iNAqq8.css → main-BM6qmGP4.css} +1 -1
- package/dist/client/assets/main-U2I6YwT-.js +169 -0
- package/dist/client/assets/{pdf-C3xMIdpt.js → pdf-Bh3amywC.js} +2 -2
- package/dist/client/assets/{popover-BXSj56CI.js → popover-DZf7p2yc.js} +2 -2
- package/dist/client/assets/{pptxDocument-BnTLF4HV.js → pptxDocument-Bsm1SylK.js} +2 -2
- package/dist/client/assets/{projectFilesQueryState-Cs5skZOc.js → projectFilesQueryState-DWDFHsif.js} +2 -2
- package/dist/client/assets/queries-B-YwYiCl.js +2 -0
- package/dist/client/assets/{scroll-area-DAaT-DGF.js → scroll-area-C5ps_bkR.js} +46 -46
- package/dist/client/assets/session-BKSQ__kZ.js +68 -0
- package/dist/client/assets/{spinner-K3N_kbJr.js → spinner-BYvweYT_.js} +2 -2
- package/dist/client/assets/textarea-bjEgsW0n.js +2 -0
- package/dist/client/assets/{toggle-Sui8J_p3.js → toggle-D4wtRT7F.js} +2 -2
- package/dist/client/assets/{toggle-group-BDgfPfOF.js → toggle-group-iSglhZY5.js} +2 -2
- package/dist/client/assets/useSettings-BgyJJ6VZ.js +5 -0
- package/dist/client/assets/{useWorkspaceMutationRefresh-ApasU6PB.js → useWorkspaceMutationRefresh-C-GODI1R.js} +2 -2
- package/dist/client/assets/utils-dD8AT1Cf.js +30 -0
- package/dist/client/assets/{xlsxDocument-SRKfhPKH.js → xlsxDocument-C12kQUhH.js} +2 -2
- package/dist/client/index.html +1 -1
- package/dist/service-launcher.mjs +20 -2
- package/dist/sharedChatWorker.mjs +21887 -0
- package/package.json +2 -1
- package/dist/client/assets/DiffPanel-Bbs-arXF.js +0 -2
- package/dist/client/assets/PreviewPanel-C_WqPJu_.js +0 -2
- package/dist/client/assets/PullRequestCodeTab-DLajHhi9.js +0 -6
- package/dist/client/assets/accountData-BKyjOPQm.js +0 -16
- package/dist/client/assets/assetUrls-33nMWFnF.js +0 -2
- package/dist/client/assets/assets-1BW7ZJgz.js +0 -2
- package/dist/client/assets/clientAnalytics-ChPHl8_D.js +0 -1
- package/dist/client/assets/entities-BtD3_L53.js +0 -2
- package/dist/client/assets/main-Bi6AoLeM.js +0 -167
- package/dist/client/assets/queries-BevoHPqY.js +0 -2
- package/dist/client/assets/session-Dmu9Hk5C.js +0 -68
- package/dist/client/assets/textarea-BT0tVWKM.js +0 -2
- package/dist/client/assets/useSettings-GEQSU1F5.js +0 -5
- package/dist/client/assets/utils-ClZ5OxbV.js +0 -30
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PdfPreview-
|
|
2
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./index-DrITfTBh.js";import{F as n,Qa as r,_ as i,v as a,y as o}from"./accountData-BKyjOPQm.js";import{Eo as s,F as c,Ho as l,V as u,pn as d,t as f,wo as p}from"./utils-ClZ5OxbV.js";import{$t as m,on as h}from"./session-Dmu9Hk5C.js";import{o as g}from"./designOpenFileContext-CMKir5dG.js";import{c as _,f as v,g as y,l as b,o as x,ot as S,u as C}from"./textarea-BT0tVWKM.js";import{A as ee,Kt as w,a as T,ct as E,v as D,x as O}from"./useSettings-GEQSU1F5.js";import{a as k,l as A,n as j,o as M,r as N,s as P,t as te,u as ne}from"./empty-DUUjhkFh.js";import{At as re,Bn as ie,Br as ae,Ct as oe,Fn as se,G as ce,H as le,In as ue,Jn as de,Lt as fe,Mr as pe,Nt as me,Pt as he,Rn as ge,U as F,V as _e,X as ve,br as ye,bt as be,er as xe,gr as Se,kt as Ce,t as we,yt as I,zn as Te,zr as Ee}from"./scroll-area-DAaT-DGF.js";import{At as De,Bt as Oe,Ft as ke,Ht as Ae,Mt as je,Nt as Me,Pt as Ne,Xt as Pe,n as Fe}from"./ChatMarkdown-Ch9PipMk.js";import{t as Ie}from"./toggle-Sui8J_p3.js";import{at as Le,c as Re,ct as ze,d as Be,f as Ve,g as He,h as Ue,it as L,l as We,m as Ge,n as Ke,nt as qe,o as Je,ot as Ye,p as Xe,rt as Ze,st as Qe,t as $e,y as et}from"./composerMentionDrag-CdTT1rUK.js";import{D as tt,x as nt}from"./browserHistoryStore-CEVJXGfr.js";import{n as rt}from"./useWorkspaceMutationRefresh-ApasU6PB.js";import{i as it,n as at,r as ot,t as R}from"./fileCommentAnnotations-BgdL_7u9.js";import{i as z,n as st,r as ct,t as lt}from"./VirtualizedFile-qiRlyNDc.js";import{t as ut}from"./assets-1BW7ZJgz.js";import{a as dt,r as ft}from"./assetUrls-33nMWFnF.js";import{a as pt,c as mt,n as ht,o as B,t as gt}from"./projectFilesQueryState-Cs5skZOc.js";import{t as _t}from"./spinner-K3N_kbJr.js";var V=e(o(),1),vt=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M84,224a12,12,0,0,1-12,12H56a20,20,0,0,1-20-20V184a12,12,0,0,1,24,0v28H72A12,12,0,0,1,84,224ZM220,88v48a12,12,0,0,1-24,0V104H148a12,12,0,0,1-12-12V44H120a12,12,0,0,1,0-24h32a12,12,0,0,1,8.49,3.51l56,56A12,12,0,0,1,220,88Zm-60-8h23L160,57ZM80,20H56A20,20,0,0,0,36,40V64a12,12,0,0,0,24,0V44H80a12,12,0,0,0,0-24ZM208,164a12,12,0,0,0-12,12v36h-4a12,12,0,0,0,0,24h8a20,20,0,0,0,20-20V176A12,12,0,0,0,208,164ZM48,156a12,12,0,0,0,12-12V104a12,12,0,0,0-24,0v40A12,12,0,0,0,48,156Zm104,56H112a12,12,0,0,0,0,24h40a12,12,0,0,0,0-24Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M208,88H152V32Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M80,224a8,8,0,0,1-8,8H56a16,16,0,0,1-16-16V184a8,8,0,0,1,16,0v32H72A8,8,0,0,1,80,224ZM216,88v48a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H120a8,8,0,0,1,0-16h32a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31ZM80,24H56A16,16,0,0,0,40,40V64a8,8,0,0,0,16,0V40H80a8,8,0,0,0,0-16ZM208,168a8,8,0,0,0-8,8v40h-8a8,8,0,0,0,0,16h8a16,16,0,0,0,16-16V176A8,8,0,0,0,208,168ZM48,152a8,8,0,0,0,8-8V104a8,8,0,0,0-16,0v40A8,8,0,0,0,48,152Zm104,64H112a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M80,224a8,8,0,0,1-8,8H56a16,16,0,0,1-16-16V184a8,8,0,0,1,16,0v32H72A8,8,0,0,1,80,224ZM213.66,82.34l-56-56A8,8,0,0,0,152,24H120a8,8,0,0,0,0,16h24V88a8,8,0,0,0,8,8h48v40a8,8,0,0,0,16,0V88A8,8,0,0,0,213.66,82.34ZM80,24H56A16,16,0,0,0,40,40V64a8,8,0,0,0,16,0V40H80a8,8,0,0,0,0-16ZM208,168a8,8,0,0,0-8,8v40h-8a8,8,0,0,0,0,16h8a16,16,0,0,0,16-16V176A8,8,0,0,0,208,168ZM48,152a8,8,0,0,0,8-8V104a8,8,0,0,0-16,0v40A8,8,0,0,0,48,152Zm104,64H112a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M78,224a6,6,0,0,1-6,6H56a14,14,0,0,1-14-14V184a6,6,0,0,1,12,0v32a2,2,0,0,0,2,2H72A6,6,0,0,1,78,224ZM214,88v48a6,6,0,0,1-12,0V94H152a6,6,0,0,1-6-6V38H120a6,6,0,0,1,0-12h32a6,6,0,0,1,4.24,1.76l56,56A6,6,0,0,1,214,88Zm-56-6h35.51L158,46.49ZM80,26H56A14,14,0,0,0,42,40V64a6,6,0,0,0,12,0V40a2,2,0,0,1,2-2H80a6,6,0,0,0,0-12ZM208,170a6,6,0,0,0-6,6v40a2,2,0,0,1-2,2h-8a6,6,0,0,0,0,12h8a14,14,0,0,0,14-14V176A6,6,0,0,0,208,170ZM48,150a6,6,0,0,0,6-6V104a6,6,0,0,0-12,0v40A6,6,0,0,0,48,150Zm104,68H112a6,6,0,0,0,0,12h40a6,6,0,0,0,0-12Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M80,224a8,8,0,0,1-8,8H56a16,16,0,0,1-16-16V184a8,8,0,0,1,16,0v32H72A8,8,0,0,1,80,224ZM216,88v48a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H120a8,8,0,0,1,0-16h32a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31ZM80,24H56A16,16,0,0,0,40,40V64a8,8,0,0,0,16,0V40H80a8,8,0,0,0,0-16ZM208,168a8,8,0,0,0-8,8v40h-8a8,8,0,0,0,0,16h8a16,16,0,0,0,16-16V176A8,8,0,0,0,208,168ZM48,152a8,8,0,0,0,8-8V104a8,8,0,0,0-16,0v40A8,8,0,0,0,48,152Zm104,64H112a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M76,224a4,4,0,0,1-4,4H56a12,12,0,0,1-12-12V184a4,4,0,0,1,8,0v32a4,4,0,0,0,4,4H72A4,4,0,0,1,76,224ZM212,88v48a4,4,0,0,1-8,0V92H152a4,4,0,0,1-4-4V36H120a4,4,0,0,1,0-8h32a4,4,0,0,1,2.83,1.17l56,56A4,4,0,0,1,212,88Zm-56-4h42.34L156,41.66ZM80,28H56A12,12,0,0,0,44,40V64a4,4,0,0,0,8,0V40a4,4,0,0,1,4-4H80a4,4,0,0,0,0-8ZM208,172a4,4,0,0,0-4,4v40a4,4,0,0,1-4,4h-8a4,4,0,0,0,0,8h8a12,12,0,0,0,12-12V176A4,4,0,0,0,208,172ZM48,148a4,4,0,0,0,4-4V104a4,4,0,0,0-8,0v40A4,4,0,0,0,48,148Zm104,72H112a4,4,0,0,0,0,8h40a4,4,0,0,0,0-8Z`}))]]),yt=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M176,156h32a20,20,0,0,0,20-20V104a20,20,0,0,0-20-20H176a20,20,0,0,0-20,20v4H92V84h4a20,20,0,0,0,20-20V32A20,20,0,0,0,96,12H64A20,20,0,0,0,44,32V64A20,20,0,0,0,64,84h4V192a28,28,0,0,0,28,28h60v4a20,20,0,0,0,20,20h32a20,20,0,0,0,20-20V192a20,20,0,0,0-20-20H176a20,20,0,0,0-20,20v4H96a4,4,0,0,1-4-4V132h64v4A20,20,0,0,0,176,156ZM68,36H92V60H68ZM180,196h24v24H180Zm0-88h24v24H180Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M104,32V64a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V32a8,8,0,0,1,8-8H96A8,8,0,0,1,104,32ZM208,96H176a8,8,0,0,0-8,8v32a8,8,0,0,0,8,8h32a8,8,0,0,0,8-8V104A8,8,0,0,0,208,96Zm0,88H176a8,8,0,0,0-8,8v32a8,8,0,0,0,8,8h32a8,8,0,0,0,8-8V192A8,8,0,0,0,208,184Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M176,152h32a16,16,0,0,0,16-16V104a16,16,0,0,0-16-16H176a16,16,0,0,0-16,16v8H88V80h8a16,16,0,0,0,16-16V32A16,16,0,0,0,96,16H64A16,16,0,0,0,48,32V64A16,16,0,0,0,64,80h8V192a24,24,0,0,0,24,24h64v8a16,16,0,0,0,16,16h32a16,16,0,0,0,16-16V192a16,16,0,0,0-16-16H176a16,16,0,0,0-16,16v8H96a8,8,0,0,1-8-8V128h72v8A16,16,0,0,0,176,152ZM64,32H96V64H64ZM176,192h32v32H176Zm0-88h32v32H176Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M160,136v-8H88v64a8,8,0,0,0,8,8h64v-8a16,16,0,0,1,16-16h32a16,16,0,0,1,16,16v32a16,16,0,0,1-16,16H176a16,16,0,0,1-16-16v-8H96a24,24,0,0,1-24-24V80H64A16,16,0,0,1,48,64V32A16,16,0,0,1,64,16H96a16,16,0,0,1,16,16V64A16,16,0,0,1,96,80H88v32h72v-8a16,16,0,0,1,16-16h32a16,16,0,0,1,16,16v32a16,16,0,0,1-16,16H176A16,16,0,0,1,160,136Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M176,150h32a14,14,0,0,0,14-14V104a14,14,0,0,0-14-14H176a14,14,0,0,0-14,14v10H86V78H96a14,14,0,0,0,14-14V32A14,14,0,0,0,96,18H64A14,14,0,0,0,50,32V64A14,14,0,0,0,64,78H74V192a22,22,0,0,0,22,22h66v10a14,14,0,0,0,14,14h32a14,14,0,0,0,14-14V192a14,14,0,0,0-14-14H176a14,14,0,0,0-14,14v10H96a10,10,0,0,1-10-10V126h76v10A14,14,0,0,0,176,150ZM62,64V32a2,2,0,0,1,2-2H96a2,2,0,0,1,2,2V64a2,2,0,0,1-2,2H64A2,2,0,0,1,62,64ZM174,192a2,2,0,0,1,2-2h32a2,2,0,0,1,2,2v32a2,2,0,0,1-2,2H176a2,2,0,0,1-2-2Zm0-88a2,2,0,0,1,2-2h32a2,2,0,0,1,2,2v32a2,2,0,0,1-2,2H176a2,2,0,0,1-2-2Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M176,152h32a16,16,0,0,0,16-16V104a16,16,0,0,0-16-16H176a16,16,0,0,0-16,16v8H88V80h8a16,16,0,0,0,16-16V32A16,16,0,0,0,96,16H64A16,16,0,0,0,48,32V64A16,16,0,0,0,64,80h8V192a24,24,0,0,0,24,24h64v8a16,16,0,0,0,16,16h32a16,16,0,0,0,16-16V192a16,16,0,0,0-16-16H176a16,16,0,0,0-16,16v8H96a8,8,0,0,1-8-8V128h72v8A16,16,0,0,0,176,152ZM64,32H96V64H64ZM176,192h32v32H176Zm0-88h32v32H176Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M176,148h32a12,12,0,0,0,12-12V104a12,12,0,0,0-12-12H176a12,12,0,0,0-12,12v12H84V76H96a12,12,0,0,0,12-12V32A12,12,0,0,0,96,20H64A12,12,0,0,0,52,32V64A12,12,0,0,0,64,76H76V192a20,20,0,0,0,20,20h68v12a12,12,0,0,0,12,12h32a12,12,0,0,0,12-12V192a12,12,0,0,0-12-12H176a12,12,0,0,0-12,12v12H96a12,12,0,0,1-12-12V124h80v12A12,12,0,0,0,176,148ZM60,64V32a4,4,0,0,1,4-4H96a4,4,0,0,1,4,4V64a4,4,0,0,1-4,4H64A4,4,0,0,1,60,64ZM172,192a4,4,0,0,1,4-4h32a4,4,0,0,1,4,4v32a4,4,0,0,1-4,4H176a4,4,0,0,1-4-4Zm0-88a4,4,0,0,1,4-4h32a4,4,0,0,1,4,4v32a4,4,0,0,1-4,4H176a4,4,0,0,1-4-4Z`}))]]),bt=Object.defineProperty,xt=Object.defineProperties,St=Object.getOwnPropertyDescriptors,Ct=Object.getOwnPropertySymbols,wt=Object.prototype.hasOwnProperty,Tt=Object.prototype.propertyIsEnumerable,Et=(e,t,n)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dt=(e,t)=>{for(var n in t||={})wt.call(t,n)&&Et(e,n,t[n]);if(Ct)for(var n of Ct(t))Tt.call(t,n)&&Et(e,n,t[n]);return e},Ot=(e,t)=>xt(e,St(t)),kt=(0,V.forwardRef)((e,t)=>V.createElement(s,Ot(Dt({ref:t},e),{weights:vt})));kt.displayName=`FileDashed`;var At=Object.defineProperty,jt=Object.defineProperties,Mt=Object.getOwnPropertyDescriptors,Nt=Object.getOwnPropertySymbols,Pt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,It=(e,t,n)=>t in e?At(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lt=(e,t)=>{for(var n in t||={})Pt.call(t,n)&&It(e,n,t[n]);if(Nt)for(var n of Nt(t))Ft.call(t,n)&&It(e,n,t[n]);return e},Rt=(e,t)=>jt(e,Mt(t)),zt=(0,V.forwardRef)((e,t)=>V.createElement(s,Rt(Lt({ref:t},e),{weights:yt})));zt.displayName=`TreeView`;var Bt=typeof window>`u`?V.useEffect:V.useLayoutEffect;function Vt({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c,contentEditable:l}){let u=Ze(),d=r!==void 0,f=(0,V.useContext)(ce),p=Ye(),m=(0,V.useRef)(null),h=me(r=>{if(r!=null){if(m.current!=null)throw Error(`File: An instance should not already exist when a node is created`);u==null?m.current=new st(Ht({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),c?void 0:f,!0):m.current=new lt(Ht({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),u,a,c?void 0:f,!0),m.current.hydrate({file:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(m.current==null)throw Error(`File: A File instance should exist when unmounting`);m.current.cleanUp(),m.current=null}});return Bt(()=>{if(m.current==null)return;let i=Ht({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),a=!F(m.current.options,i);m.current.setOptions(i),m.current.render({file:e,lineAnnotations:n,forceRender:a}),r!==void 0&&m.current.setSelectedLines(r)}),Bt(()=>{if(l&&m.current!=null){if(p===void 0)throw Error(`File: Editor is not attached`);return p.edit(m.current)}},[l,p]),{ref:h,getHoveredLine:(0,V.useCallback)(()=>m.current?.getHoveredLine(),[])}}function Ht({options:e,controlledSelection:t,contentEditable:n,hasCustomHeader:r,hasEditor:i,hasGutterRenderUtility:a}){let o=n&&i,s=t||a||r;if(!s&&!o)return e;let c={...e};return s&&(c={...c,controlledSelection:t,renderCustomHeader:r?fe:e?.renderCustomHeader,renderGutterUtility:a?fe:e?.renderGutterUtility}),o&&(c={...c,useTokenTransformer:!0}),c}var H=l();function Ut({file:e,lineAnnotations:t,selectedLines:n,options:r,metrics:i,className:a,style:o,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderFilenameSuffix:u,renderHeaderMetadata:d,prerenderedHTML:f,renderGutterUtility:p,disableWorkerPool:m=!1,contentEditable:h=!1}){let{ref:g,getHoveredLine:_}=Vt({file:e,options:r,metrics:i,lineAnnotations:t,selectedLines:n,prerenderedHTML:f,hasGutterRenderUtility:p!=null,hasCustomHeader:c!=null,disableWorkerPool:m,contentEditable:h});return(0,H.jsx)(ye,{ref:g,className:a,style:o,children:L(ct({file:e,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderFilenameSuffix:u,renderHeaderMetadata:d,renderGutterUtility:p,lineAnnotations:t,getHoveredLine:_}),f)})}var Wt=a();function Gt(e,t){let n={};for(let e=0;e<t.length;e++){let r=t[e];n[r]?n[r].push(e):n[r]=[e]}let r=[{buffer1index:-1,buffer2index:-1,chain:null}];for(let t=0;t<e.length;t++){let i=n[e[t]]||[],a=0,o=r[0];for(let e=0;e<i.length;e++){let n=i[e],s;for(s=a;s<r.length&&!(r[s].buffer2index<n&&(s===r.length-1||r[s+1].buffer2index>n));s++);if(s<r.length){let e={buffer1index:t,buffer2index:n,chain:r[s]};if(a===r.length?r.push(o):r[a]=o,a=s+1,o=e,a===r.length)break}}r[a]=o}return r[r.length-1]}function Kt(e,t){let n=Gt(e,t),r=[],i=e.length,a=t.length;for(let o=n;o!==null;o=o.chain){let n=i-o.buffer1index-1,s=a-o.buffer2index-1;i=o.buffer1index,a=o.buffer2index,(n||s)&&r.push({buffer1:[i+1,n],buffer1Content:e.slice(i+1,i+1+n),buffer2:[a+1,s],buffer2Content:t.slice(a+1,a+1+s)})}return r.reverse(),r}function qt(e,t,n){let r=[];function i(e,t){r.push({ab:t,oStart:e.buffer1[0],oLength:e.buffer1[1],abStart:e.buffer2[0],abLength:e.buffer2[1]})}Kt(t,e).forEach(e=>i(e,`a`)),Kt(t,n).forEach(e=>i(e,`b`)),r.sort((e,t)=>e.oStart-t.oStart);let a=[],o=0;function s(e){e>o&&(a.push({stable:!0,buffer:`o`,bufferStart:o,bufferLength:e-o,bufferContent:t.slice(o,e)}),o=e)}for(;r.length;){let i=r.shift(),c=i.oStart,l=i.oStart+i.oLength,u=[i];for(s(c);r.length;){let e=r[0],t=e.oStart;if(t>l)break;l=Math.max(l,t+e.oLength),u.push(r.shift())}if(u.length===1){if(i.abLength>0){let t=i.ab===`a`?e:n;a.push({stable:!0,buffer:i.ab,bufferStart:i.abStart,bufferLength:i.abLength,bufferContent:t.slice(i.abStart,i.abStart+i.abLength)})}}else{let r={a:[e.length,-1,t.length,-1],b:[n.length,-1,t.length,-1]};for(;u.length;){i=u.shift();let e=i.oStart,t=e+i.oLength,n=i.abStart,a=n+i.abLength,o=r[i.ab];o[0]=Math.min(n,o[0]),o[1]=Math.max(a,o[1]),o[2]=Math.min(e,o[2]),o[3]=Math.max(t,o[3])}let o=r.a[0]+(c-r.a[2]),s=r.a[1]+(l-r.a[3]),d=r.b[0]+(c-r.b[2]),f=r.b[1]+(l-r.b[3]),p={stable:!1,aStart:o,aLength:s-o,aContent:e.slice(o,s),oStart:c,oLength:l-c,oContent:t.slice(c,l),bStart:d,bLength:f-d,bContent:n.slice(d,f)};a.push(p)}o=l}return s(t.length),a}function Jt(e,t,n,r){r=Object.assign({excludeFalseConflicts:!0,stringSeparator:/\s+/},r),typeof e==`string`&&(e=e.split(r.stringSeparator)),typeof t==`string`&&(t=t.split(r.stringSeparator)),typeof n==`string`&&(n=n.split(r.stringSeparator));let i=[],a=qt(e,t,n),o=[];function s(){o.length&&i.push({ok:o}),o=[]}function c(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return a.forEach(e=>{e.stable?o.push(...e.bufferContent):r.excludeFalseConflicts&&c(e.aContent,e.bContent)?o.push(...e.aContent):(s(),i.push({conflict:{a:e.aContent,aIndex:e.aStart,o:e.oContent,oIndex:e.oStart,b:e.bContent,bIndex:e.bStart}}))}),s(),i}var Yt=100,Xt=class{#e=[];#t=[];#n;constructor(e){this.#n=Math.max(1,e?.maxEntries??Yt)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}clear(){this.#e.length=0,this.#t.length=0}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}replaceLastUndo(e){if(this.#e.length===0){this.push(e);return}this.#e[this.#e.length-1]=e,this.clearRedo()}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),e}};function Zt(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[];for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice()}}function Qt(e,t){if(e===void 0||e.undoBoundary===!0||t.undoBoundary===!0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=tn(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PdfPreview-BgV8uugr.js","assets/rolldown-runtime-DAXXjFlN.js","assets/index-e-hiL6eh.js","assets/index-DZprGaeP.css","assets/accountData-B88fzgQo.js","assets/utils-dD8AT1Cf.js","assets/CaretLeft-u94enBjz.js","assets/spinner-BYvweYT_.js","assets/CircleNotch-DqcpMoTY.js","assets/DocxPreview-HJVaPJXL.js","assets/lib-BpnzBIoA.js","assets/documentBytes-CS3KpytE.js","assets/zipGuard-BHHl8sLU.js","assets/lib-CCiVGdun.js","assets/XlsxPreview-Bi4rmMAb.js","assets/PptxPreview-BVdzk7UG.js","assets/HtmlPreview-CJQuCP2x.js","assets/session-BKSQ__kZ.js","assets/assets-CkgNlvqv.js","assets/assetUrls-CF9bvkMB.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./index-e-hiL6eh.js";import{F as n,_ as r,eo as i,v as a,y as o}from"./accountData-B88fzgQo.js";import{Eo as s,F as c,Ho as l,V as u,pn as d,t as f,wo as p}from"./utils-dD8AT1Cf.js";import{en as m,sn as h}from"./session-BKSQ__kZ.js";import{o as g}from"./designOpenFileContext-B0d1oDHN.js";import{c as _,ct as v,f as y,g as b,l as x,o as S,u as C}from"./textarea-bjEgsW0n.js";import{A as ee,a as te,lt as w,qt as T,v as E,x as D}from"./useSettings-BgyJJ6VZ.js";import{a as O,l as k,n as A,o as j,r as M,s as N,t as ne,u as re}from"./empty-d8cb8Ewx.js";import{At as P,Bn as ie,Br as ae,Ct as oe,Fn as se,G as ce,H as le,In as ue,Jn as de,Lt as fe,Mr as pe,Nt as me,Pt as he,Rn as ge,U as F,V as _e,X as ve,br as ye,bt as be,er as xe,gr as Se,kt as Ce,t as we,yt as I,zn as Te,zr as Ee}from"./scroll-area-C5ps_bkR.js";import{At as De,Bt as Oe,Ft as ke,Ht as Ae,Mt as je,Nt as Me,Pt as Ne,Xt as Pe,n as Fe}from"./ChatMarkdown-PlWZFDnz.js";import{t as Ie}from"./toggle-D4wtRT7F.js";import{at as Le,c as Re,ct as ze,d as Be,f as Ve,g as He,h as Ue,it as L,l as We,m as Ge,n as Ke,nt as qe,o as Je,ot as Ye,p as Xe,rt as Ze,st as Qe,t as $e,y as et}from"./composerMentionDrag-CB6wqaTe.js";import{D as tt,x as nt}from"./browserHistoryStore-DIuEAuCl.js";import{n as rt}from"./useWorkspaceMutationRefresh-C-GODI1R.js";import{i as it,n as at,r as ot,t as R}from"./fileCommentAnnotations-BgdL_7u9.js";import{i as z,n as st,r as ct,t as lt}from"./VirtualizedFile-DuJYdYdq.js";import{t as ut}from"./assets-CkgNlvqv.js";import{a as dt,r as ft}from"./assetUrls-CF9bvkMB.js";import{a as pt,c as mt,n as ht,o as B,t as gt}from"./projectFilesQueryState-DWDFHsif.js";import{t as _t}from"./spinner-BYvweYT_.js";var V=e(o(),1),vt=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M84,224a12,12,0,0,1-12,12H56a20,20,0,0,1-20-20V184a12,12,0,0,1,24,0v28H72A12,12,0,0,1,84,224ZM220,88v48a12,12,0,0,1-24,0V104H148a12,12,0,0,1-12-12V44H120a12,12,0,0,1,0-24h32a12,12,0,0,1,8.49,3.51l56,56A12,12,0,0,1,220,88Zm-60-8h23L160,57ZM80,20H56A20,20,0,0,0,36,40V64a12,12,0,0,0,24,0V44H80a12,12,0,0,0,0-24ZM208,164a12,12,0,0,0-12,12v36h-4a12,12,0,0,0,0,24h8a20,20,0,0,0,20-20V176A12,12,0,0,0,208,164ZM48,156a12,12,0,0,0,12-12V104a12,12,0,0,0-24,0v40A12,12,0,0,0,48,156Zm104,56H112a12,12,0,0,0,0,24h40a12,12,0,0,0,0-24Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M208,88H152V32Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M80,224a8,8,0,0,1-8,8H56a16,16,0,0,1-16-16V184a8,8,0,0,1,16,0v32H72A8,8,0,0,1,80,224ZM216,88v48a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H120a8,8,0,0,1,0-16h32a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31ZM80,24H56A16,16,0,0,0,40,40V64a8,8,0,0,0,16,0V40H80a8,8,0,0,0,0-16ZM208,168a8,8,0,0,0-8,8v40h-8a8,8,0,0,0,0,16h8a16,16,0,0,0,16-16V176A8,8,0,0,0,208,168ZM48,152a8,8,0,0,0,8-8V104a8,8,0,0,0-16,0v40A8,8,0,0,0,48,152Zm104,64H112a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M80,224a8,8,0,0,1-8,8H56a16,16,0,0,1-16-16V184a8,8,0,0,1,16,0v32H72A8,8,0,0,1,80,224ZM213.66,82.34l-56-56A8,8,0,0,0,152,24H120a8,8,0,0,0,0,16h24V88a8,8,0,0,0,8,8h48v40a8,8,0,0,0,16,0V88A8,8,0,0,0,213.66,82.34ZM80,24H56A16,16,0,0,0,40,40V64a8,8,0,0,0,16,0V40H80a8,8,0,0,0,0-16ZM208,168a8,8,0,0,0-8,8v40h-8a8,8,0,0,0,0,16h8a16,16,0,0,0,16-16V176A8,8,0,0,0,208,168ZM48,152a8,8,0,0,0,8-8V104a8,8,0,0,0-16,0v40A8,8,0,0,0,48,152Zm104,64H112a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M78,224a6,6,0,0,1-6,6H56a14,14,0,0,1-14-14V184a6,6,0,0,1,12,0v32a2,2,0,0,0,2,2H72A6,6,0,0,1,78,224ZM214,88v48a6,6,0,0,1-12,0V94H152a6,6,0,0,1-6-6V38H120a6,6,0,0,1,0-12h32a6,6,0,0,1,4.24,1.76l56,56A6,6,0,0,1,214,88Zm-56-6h35.51L158,46.49ZM80,26H56A14,14,0,0,0,42,40V64a6,6,0,0,0,12,0V40a2,2,0,0,1,2-2H80a6,6,0,0,0,0-12ZM208,170a6,6,0,0,0-6,6v40a2,2,0,0,1-2,2h-8a6,6,0,0,0,0,12h8a14,14,0,0,0,14-14V176A6,6,0,0,0,208,170ZM48,150a6,6,0,0,0,6-6V104a6,6,0,0,0-12,0v40A6,6,0,0,0,48,150Zm104,68H112a6,6,0,0,0,0,12h40a6,6,0,0,0,0-12Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M80,224a8,8,0,0,1-8,8H56a16,16,0,0,1-16-16V184a8,8,0,0,1,16,0v32H72A8,8,0,0,1,80,224ZM216,88v48a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H120a8,8,0,0,1,0-16h32a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31ZM80,24H56A16,16,0,0,0,40,40V64a8,8,0,0,0,16,0V40H80a8,8,0,0,0,0-16ZM208,168a8,8,0,0,0-8,8v40h-8a8,8,0,0,0,0,16h8a16,16,0,0,0,16-16V176A8,8,0,0,0,208,168ZM48,152a8,8,0,0,0,8-8V104a8,8,0,0,0-16,0v40A8,8,0,0,0,48,152Zm104,64H112a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M76,224a4,4,0,0,1-4,4H56a12,12,0,0,1-12-12V184a4,4,0,0,1,8,0v32a4,4,0,0,0,4,4H72A4,4,0,0,1,76,224ZM212,88v48a4,4,0,0,1-8,0V92H152a4,4,0,0,1-4-4V36H120a4,4,0,0,1,0-8h32a4,4,0,0,1,2.83,1.17l56,56A4,4,0,0,1,212,88Zm-56-4h42.34L156,41.66ZM80,28H56A12,12,0,0,0,44,40V64a4,4,0,0,0,8,0V40a4,4,0,0,1,4-4H80a4,4,0,0,0,0-8ZM208,172a4,4,0,0,0-4,4v40a4,4,0,0,1-4,4h-8a4,4,0,0,0,0,8h8a12,12,0,0,0,12-12V176A4,4,0,0,0,208,172ZM48,148a4,4,0,0,0,4-4V104a4,4,0,0,0-8,0v40A4,4,0,0,0,48,148Zm104,72H112a4,4,0,0,0,0,8h40a4,4,0,0,0,0-8Z`}))]]),yt=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M176,156h32a20,20,0,0,0,20-20V104a20,20,0,0,0-20-20H176a20,20,0,0,0-20,20v4H92V84h4a20,20,0,0,0,20-20V32A20,20,0,0,0,96,12H64A20,20,0,0,0,44,32V64A20,20,0,0,0,64,84h4V192a28,28,0,0,0,28,28h60v4a20,20,0,0,0,20,20h32a20,20,0,0,0,20-20V192a20,20,0,0,0-20-20H176a20,20,0,0,0-20,20v4H96a4,4,0,0,1-4-4V132h64v4A20,20,0,0,0,176,156ZM68,36H92V60H68ZM180,196h24v24H180Zm0-88h24v24H180Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M104,32V64a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V32a8,8,0,0,1,8-8H96A8,8,0,0,1,104,32ZM208,96H176a8,8,0,0,0-8,8v32a8,8,0,0,0,8,8h32a8,8,0,0,0,8-8V104A8,8,0,0,0,208,96Zm0,88H176a8,8,0,0,0-8,8v32a8,8,0,0,0,8,8h32a8,8,0,0,0,8-8V192A8,8,0,0,0,208,184Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M176,152h32a16,16,0,0,0,16-16V104a16,16,0,0,0-16-16H176a16,16,0,0,0-16,16v8H88V80h8a16,16,0,0,0,16-16V32A16,16,0,0,0,96,16H64A16,16,0,0,0,48,32V64A16,16,0,0,0,64,80h8V192a24,24,0,0,0,24,24h64v8a16,16,0,0,0,16,16h32a16,16,0,0,0,16-16V192a16,16,0,0,0-16-16H176a16,16,0,0,0-16,16v8H96a8,8,0,0,1-8-8V128h72v8A16,16,0,0,0,176,152ZM64,32H96V64H64ZM176,192h32v32H176Zm0-88h32v32H176Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M160,136v-8H88v64a8,8,0,0,0,8,8h64v-8a16,16,0,0,1,16-16h32a16,16,0,0,1,16,16v32a16,16,0,0,1-16,16H176a16,16,0,0,1-16-16v-8H96a24,24,0,0,1-24-24V80H64A16,16,0,0,1,48,64V32A16,16,0,0,1,64,16H96a16,16,0,0,1,16,16V64A16,16,0,0,1,96,80H88v32h72v-8a16,16,0,0,1,16-16h32a16,16,0,0,1,16,16v32a16,16,0,0,1-16,16H176A16,16,0,0,1,160,136Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M176,150h32a14,14,0,0,0,14-14V104a14,14,0,0,0-14-14H176a14,14,0,0,0-14,14v10H86V78H96a14,14,0,0,0,14-14V32A14,14,0,0,0,96,18H64A14,14,0,0,0,50,32V64A14,14,0,0,0,64,78H74V192a22,22,0,0,0,22,22h66v10a14,14,0,0,0,14,14h32a14,14,0,0,0,14-14V192a14,14,0,0,0-14-14H176a14,14,0,0,0-14,14v10H96a10,10,0,0,1-10-10V126h76v10A14,14,0,0,0,176,150ZM62,64V32a2,2,0,0,1,2-2H96a2,2,0,0,1,2,2V64a2,2,0,0,1-2,2H64A2,2,0,0,1,62,64ZM174,192a2,2,0,0,1,2-2h32a2,2,0,0,1,2,2v32a2,2,0,0,1-2,2H176a2,2,0,0,1-2-2Zm0-88a2,2,0,0,1,2-2h32a2,2,0,0,1,2,2v32a2,2,0,0,1-2,2H176a2,2,0,0,1-2-2Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M176,152h32a16,16,0,0,0,16-16V104a16,16,0,0,0-16-16H176a16,16,0,0,0-16,16v8H88V80h8a16,16,0,0,0,16-16V32A16,16,0,0,0,96,16H64A16,16,0,0,0,48,32V64A16,16,0,0,0,64,80h8V192a24,24,0,0,0,24,24h64v8a16,16,0,0,0,16,16h32a16,16,0,0,0,16-16V192a16,16,0,0,0-16-16H176a16,16,0,0,0-16,16v8H96a8,8,0,0,1-8-8V128h72v8A16,16,0,0,0,176,152ZM64,32H96V64H64ZM176,192h32v32H176Zm0-88h32v32H176Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M176,148h32a12,12,0,0,0,12-12V104a12,12,0,0,0-12-12H176a12,12,0,0,0-12,12v12H84V76H96a12,12,0,0,0,12-12V32A12,12,0,0,0,96,20H64A12,12,0,0,0,52,32V64A12,12,0,0,0,64,76H76V192a20,20,0,0,0,20,20h68v12a12,12,0,0,0,12,12h32a12,12,0,0,0,12-12V192a12,12,0,0,0-12-12H176a12,12,0,0,0-12,12v12H96a12,12,0,0,1-12-12V124h80v12A12,12,0,0,0,176,148ZM60,64V32a4,4,0,0,1,4-4H96a4,4,0,0,1,4,4V64a4,4,0,0,1-4,4H64A4,4,0,0,1,60,64ZM172,192a4,4,0,0,1,4-4h32a4,4,0,0,1,4,4v32a4,4,0,0,1-4,4H176a4,4,0,0,1-4-4Zm0-88a4,4,0,0,1,4-4h32a4,4,0,0,1,4,4v32a4,4,0,0,1-4,4H176a4,4,0,0,1-4-4Z`}))]]),bt=Object.defineProperty,xt=Object.defineProperties,St=Object.getOwnPropertyDescriptors,Ct=Object.getOwnPropertySymbols,wt=Object.prototype.hasOwnProperty,Tt=Object.prototype.propertyIsEnumerable,Et=(e,t,n)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dt=(e,t)=>{for(var n in t||={})wt.call(t,n)&&Et(e,n,t[n]);if(Ct)for(var n of Ct(t))Tt.call(t,n)&&Et(e,n,t[n]);return e},Ot=(e,t)=>xt(e,St(t)),kt=(0,V.forwardRef)((e,t)=>V.createElement(s,Ot(Dt({ref:t},e),{weights:vt})));kt.displayName=`FileDashed`;var At=Object.defineProperty,jt=Object.defineProperties,Mt=Object.getOwnPropertyDescriptors,Nt=Object.getOwnPropertySymbols,Pt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,It=(e,t,n)=>t in e?At(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lt=(e,t)=>{for(var n in t||={})Pt.call(t,n)&&It(e,n,t[n]);if(Nt)for(var n of Nt(t))Ft.call(t,n)&&It(e,n,t[n]);return e},Rt=(e,t)=>jt(e,Mt(t)),zt=(0,V.forwardRef)((e,t)=>V.createElement(s,Rt(Lt({ref:t},e),{weights:yt})));zt.displayName=`TreeView`;var Bt=typeof window>`u`?V.useEffect:V.useLayoutEffect;function Vt({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c,contentEditable:l}){let u=Ze(),d=r!==void 0,f=(0,V.useContext)(ce),p=Ye(),m=(0,V.useRef)(null),h=me(r=>{if(r!=null){if(m.current!=null)throw Error(`File: An instance should not already exist when a node is created`);u==null?m.current=new st(Ht({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),c?void 0:f,!0):m.current=new lt(Ht({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),u,a,c?void 0:f,!0),m.current.hydrate({file:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(m.current==null)throw Error(`File: A File instance should exist when unmounting`);m.current.cleanUp(),m.current=null}});return Bt(()=>{if(m.current==null)return;let i=Ht({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),a=!F(m.current.options,i);m.current.setOptions(i),m.current.render({file:e,lineAnnotations:n,forceRender:a}),r!==void 0&&m.current.setSelectedLines(r)}),Bt(()=>{if(l&&m.current!=null){if(p===void 0)throw Error(`File: Editor is not attached`);return p.edit(m.current)}},[l,p]),{ref:h,getHoveredLine:(0,V.useCallback)(()=>m.current?.getHoveredLine(),[])}}function Ht({options:e,controlledSelection:t,contentEditable:n,hasCustomHeader:r,hasEditor:i,hasGutterRenderUtility:a}){let o=n&&i,s=t||a||r;if(!s&&!o)return e;let c={...e};return s&&(c={...c,controlledSelection:t,renderCustomHeader:r?fe:e?.renderCustomHeader,renderGutterUtility:a?fe:e?.renderGutterUtility}),o&&(c={...c,useTokenTransformer:!0}),c}var H=l();function Ut({file:e,lineAnnotations:t,selectedLines:n,options:r,metrics:i,className:a,style:o,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderFilenameSuffix:u,renderHeaderMetadata:d,prerenderedHTML:f,renderGutterUtility:p,disableWorkerPool:m=!1,contentEditable:h=!1}){let{ref:g,getHoveredLine:_}=Vt({file:e,options:r,metrics:i,lineAnnotations:t,selectedLines:n,prerenderedHTML:f,hasGutterRenderUtility:p!=null,hasCustomHeader:c!=null,disableWorkerPool:m,contentEditable:h});return(0,H.jsx)(ye,{ref:g,className:a,style:o,children:L(ct({file:e,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderFilenameSuffix:u,renderHeaderMetadata:d,renderGutterUtility:p,lineAnnotations:t,getHoveredLine:_}),f)})}var Wt=a();function Gt(e,t){let n={};for(let e=0;e<t.length;e++){let r=t[e];n[r]?n[r].push(e):n[r]=[e]}let r=[{buffer1index:-1,buffer2index:-1,chain:null}];for(let t=0;t<e.length;t++){let i=n[e[t]]||[],a=0,o=r[0];for(let e=0;e<i.length;e++){let n=i[e],s;for(s=a;s<r.length&&!(r[s].buffer2index<n&&(s===r.length-1||r[s+1].buffer2index>n));s++);if(s<r.length){let e={buffer1index:t,buffer2index:n,chain:r[s]};if(a===r.length?r.push(o):r[a]=o,a=s+1,o=e,a===r.length)break}}r[a]=o}return r[r.length-1]}function Kt(e,t){let n=Gt(e,t),r=[],i=e.length,a=t.length;for(let o=n;o!==null;o=o.chain){let n=i-o.buffer1index-1,s=a-o.buffer2index-1;i=o.buffer1index,a=o.buffer2index,(n||s)&&r.push({buffer1:[i+1,n],buffer1Content:e.slice(i+1,i+1+n),buffer2:[a+1,s],buffer2Content:t.slice(a+1,a+1+s)})}return r.reverse(),r}function qt(e,t,n){let r=[];function i(e,t){r.push({ab:t,oStart:e.buffer1[0],oLength:e.buffer1[1],abStart:e.buffer2[0],abLength:e.buffer2[1]})}Kt(t,e).forEach(e=>i(e,`a`)),Kt(t,n).forEach(e=>i(e,`b`)),r.sort((e,t)=>e.oStart-t.oStart);let a=[],o=0;function s(e){e>o&&(a.push({stable:!0,buffer:`o`,bufferStart:o,bufferLength:e-o,bufferContent:t.slice(o,e)}),o=e)}for(;r.length;){let i=r.shift(),c=i.oStart,l=i.oStart+i.oLength,u=[i];for(s(c);r.length;){let e=r[0],t=e.oStart;if(t>l)break;l=Math.max(l,t+e.oLength),u.push(r.shift())}if(u.length===1){if(i.abLength>0){let t=i.ab===`a`?e:n;a.push({stable:!0,buffer:i.ab,bufferStart:i.abStart,bufferLength:i.abLength,bufferContent:t.slice(i.abStart,i.abStart+i.abLength)})}}else{let r={a:[e.length,-1,t.length,-1],b:[n.length,-1,t.length,-1]};for(;u.length;){i=u.shift();let e=i.oStart,t=e+i.oLength,n=i.abStart,a=n+i.abLength,o=r[i.ab];o[0]=Math.min(n,o[0]),o[1]=Math.max(a,o[1]),o[2]=Math.min(e,o[2]),o[3]=Math.max(t,o[3])}let o=r.a[0]+(c-r.a[2]),s=r.a[1]+(l-r.a[3]),d=r.b[0]+(c-r.b[2]),f=r.b[1]+(l-r.b[3]),p={stable:!1,aStart:o,aLength:s-o,aContent:e.slice(o,s),oStart:c,oLength:l-c,oContent:t.slice(c,l),bStart:d,bLength:f-d,bContent:n.slice(d,f)};a.push(p)}o=l}return s(t.length),a}function Jt(e,t,n,r){r=Object.assign({excludeFalseConflicts:!0,stringSeparator:/\s+/},r),typeof e==`string`&&(e=e.split(r.stringSeparator)),typeof t==`string`&&(t=t.split(r.stringSeparator)),typeof n==`string`&&(n=n.split(r.stringSeparator));let i=[],a=qt(e,t,n),o=[];function s(){o.length&&i.push({ok:o}),o=[]}function c(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return a.forEach(e=>{e.stable?o.push(...e.bufferContent):r.excludeFalseConflicts&&c(e.aContent,e.bContent)?o.push(...e.aContent):(s(),i.push({conflict:{a:e.aContent,aIndex:e.aStart,o:e.oContent,oIndex:e.oStart,b:e.bContent,bIndex:e.bStart}}))}),s(),i}var Yt=100,Xt=class{#e=[];#t=[];#n;constructor(e){this.#n=Math.max(1,e?.maxEntries??Yt)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}clear(){this.#e.length=0,this.#t.length=0}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}replaceLastUndo(e){if(this.#e.length===0){this.push(e);return}this.#e[this.#e.length-1]=e,this.clearRedo()}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),e}};function Zt(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[];for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice()}}function Qt(e,t){if(e===void 0||e.undoBoundary===!0||t.undoBoundary===!0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=tn(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
|
|
3
3
|
`)&&!a.text.includes(`
|
|
4
4
|
`),u=o.start===o.end&&o.text.length>0&&!o.text.includes(`
|
|
5
5
|
`)&&s.text.length===0;if(l&&u){if(o.start!==a.end||(n??=`insert`,n!==`insert`))return!1;continue}let d=i.text.length===0&&i.end>i.start&&a.text.length>0,f=o.text.length===0&&o.end>o.start&&s.text.length>0;if(d&&f){if(c===i.end){if(n??=`delete`,n!==`delete`)return!1;continue}if(c+(o.end-o.start)!==i.start||(n??=`backspace`,n!==`backspace`))return!1;continue}return!1}return n!==void 0}function $t(e,t){let n=[],r=[];for(let i=0;i<e.forwardEdits.length;i++){let a=e.forwardEdits[i],o=e.inverseEdits[i],s=t.forwardEdits[i],c=t.inverseEdits[i],l=tn(s.start,e.forwardEdits);if(a.text.length>0){n.push({start:a.start,end:a.end,text:a.text+s.text}),r.push(o.text);continue}if(l===a.end){n.push({start:a.start,end:l+(s.end-s.start),text:``}),r.push(o.text+c.text);continue}n.push({start:Math.min(a.start,l),end:a.end,text:``}),r.push(c.text+o.text)}return{forwardEdits:n,inverseEdits:en(n,r),versionBefore:e.versionBefore,versionAfter:t.versionAfter,selectionsBefore:e.selectionsBefore?.slice(),selectionsAfter:t.selectionsAfter?.slice(),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:t.lineAnnotationsAfter?.slice()}}function en(e,t){let n=[];for(let r=0,i=0;r<e.length;r++){let a=e[r],o=a.start+i;n.push({start:o,end:o+a.text.length,text:t[r]}),i+=a.text.length-(a.end-a.start)}return n}function tn(e,t){let n=e;for(let e of t){let t=e.end-e.start,r=e.text.length,i=r-t;if(!(n<e.start)){if(n>=e.start+r){n-=i;continue}n=e.start+Math.min(n-e.start,t)}}return n}var nn=1e5,rn=10,an=13,on=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,sn=class{source;offset;length;lineOffsetStart;lineOffsetEnd;hasVirtualTrailingCRBreak;firstCharCode;lastCharCode;static Original=0;static Added=1;constructor(e,t,n,r,i,a,o,s){this.source=e,this.offset=t,this.length=n,this.lineOffsetStart=r,this.lineOffsetEnd=i,this.hasVirtualTrailingCRBreak=a,this.firstCharCode=o,this.lastCharCode=s}get lineBreakCount(){return this.lineOffsetEnd-this.lineOffsetStart+ +!!this.hasVirtualTrailingCRBreak}},cn=class{text;lineOffsets;constructor(e){this.text=e,this.lineOffsets=I(e)}append(e){let t=this.text.length,n=I(e);for(let e=1;e<n.length;e++)this.lineOffsets.push(t+n[e]);return this.text+=e,t}},ln=class{piece;subtreeLength;subtreeLineBreakCount;subtreeFirstCharCode;subtreeLastCharCode;left=null;right=null;parent=null;priority=0;constructor(e,t=e.length,n=e.lineBreakCount,r=e.firstCharCode,i=e.lastCharCode){this.piece=e,this.subtreeLength=t,this.subtreeLineBreakCount=n,this.subtreeFirstCharCode=r,this.subtreeLastCharCode=i}updateSubtreeLength(){this.subtreeLength=(this.left?.subtreeLength??0)+this.piece.length+(this.right?.subtreeLength??0),this.subtreeLineBreakCount=(this.left?.subtreeLineBreakCount??0)+this.piece.lineBreakCount+(this.right?.subtreeLineBreakCount??0)-+!!vn(this.left?.subtreeLastCharCode,this.piece.firstCharCode)-!!vn(this.piece.lastCharCode,this.right?.subtreeFirstCharCode),this.subtreeFirstCharCode=this.left?.subtreeFirstCharCode??this.piece.firstCharCode,this.subtreeLastCharCode=this.right?.subtreeLastCharCode??this.piece.lastCharCode}},un=class{#e;#t=new cn(``);#n=null;#r=0;#i=0;#a=null;#o=null;#s=2654435769;constructor(e){this.#e=new cn(e);let t=this.#v(sn.Original,0,e.length);this.#n=t.length>0?this.#x(t):null,this.#r=this.#n?.subtreeLength??0,this.#i=(this.#n?.subtreeLineBreakCount??0)+1}get lineCount(){return this.#i}getText(e){if(e===void 0)return this.#h();let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this.getTextSlice(t,n)}getLineText(e,t=!1){if(this.#a!==null&&this.#a[0]===e&&this.#a[1]===t)return this.#a[2];let n=this.#d(e);if(n===void 0)throw Error(`Line index out of range: ${e}`);let r=this.getTextSlice(n[0],n[1],!t);return this.#a=[e,t,r],this.#o=[e,t,r.length],r}getLineLength(e,t=!1){let n=this.#o,r=this.#a;if(n!==null&&n[0]===e&&n[1]===t)return n[2];if(r!==null&&r[0]===e&&r[1]===t){let n=r[2].length;return this.#o=[e,t,n],n}let i=this.#d(e);if(i===void 0)throw Error(`Line index out of range: ${e}`);let[a,o]=i,s=o-a;if(!t)for(;s>0&&dn(this.charAt(a+s-1).charCodeAt(0));)s--;return this.#o=[e,t,s],s}getTextSlice(e,t,n=!1){if(e>=t)return``;let r=fn(e,0,this.#r),i=fn(t,r,this.#r);if(r>=i)return``;let a=this.#l(r);if(a===void 0)return``;let o=[],[s,c]=a,l=i-r;for(;s!==null&&l>0;){let e=Math.min(s.piece.length-c,l),t=this.#_(s.piece.source),r=s.piece.offset+c,i=r+e;if(n)for(;i>r&&dn(t.text.charCodeAt(i-1));)i--;o.push(t.text.slice(r,i)),l-=e,c=0,s=this.#u(s)}return o.join(``)}charAt(e){let t=this.#l(e);if(t===void 0)return``;let[n,r]=t;return this.#_(n.piece.source).text.charAt(n.piece.offset+r)}includes(e){if(e.length===0)return!0;let t=pn(e),n=0,r=!1;return this.#g(i=>{for(let a=i.start;a<i.end;a++){let o=i.text.charCodeAt(a);for(;n>0&&o!==e.charCodeAt(n);)n=t[n-1];if(o===e.charCodeAt(n)&&n++,n===e.length)return r=!0,!1}return!0}),r}findNextNonOverlappingSubstring(e,t){if(e.length===0||e.length>this.#r)return;let n=mn(t,this.#r),r=n.reduce((e,[,t])=>Math.max(e,t),0),i=pn(e),a=0,o=0,s,c;return this.#g(t=>{for(let l=t.start;l<t.end;l++){let u=t.text.charCodeAt(l);for(;a>0&&u!==e.charCodeAt(a);)a=i[a-1];if(u===e.charCodeAt(a)&&a++,a===e.length){let t=o-e.length+1;if(!hn(n,t,t+e.length)){if(t>=r)return c=t,!1;s??=t}a=i[a-1]}o++}return!0}),c??s}search(e){if(e.text.length===0||this.#r===0||e.text.includes(`
|
|
@@ -486,7 +486,7 @@ import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./index-DrITfTB
|
|
|
486
486
|
</symbol>
|
|
487
487
|
</svg>`,ca=()=>{let e=document.createElement(`div`);e.innerHTML=sa;let t=e.firstElementChild;if(t===null||!(t instanceof SVGSVGElement))throw Error(`Failed to create sprite element`);return t},la=(e,t=16)=>`<svg width="${t}" height="${t}" aria-hidden="true" focusable="false">
|
|
488
488
|
<use href="#diffs-editor-icon-${e}"></use>
|
|
489
|
-
</svg>`,ua=class{#e;#t;#n;#r;#i;#a;constructor(e){let{textDocument:t,containerElement:n,defaultQuery:r,mode:i=`find`,initialMatch:a,scrollToMatch:o,applyReplace:s,onUpdate:c,onClose:l}=e,u={text:r,replaceText:``,caseSensitive:!1,wholeWord:!1,regex:!1},d={all:[],current:void 0},f=U(`div`,{dataset:{matches:``,noMatches:``},textContent:`No results`}),p=e=>{d.all=u.text===``?[]:t.search(u);let n=d.all.length===0;if(A.disabled=n,j.disabled=n,n){f.textContent=`No results`,f.dataset.noMatches=``,d.current=void 0,c([]);return}if(delete f.dataset.noMatches,e?.syncSelection===!1){m(c(d.all,{syncSelection:!1}));return}m(c(d.all))};this.#n=p;let m=e=>{if(e===void 0)f.textContent=`${d.all.length} results`;else{let[t,n]=e;f.textContent=`${d.all.findIndex(e=>e[0]===t&&e[1]===n)+1} of ${d.all.length}`}d.current=e},h=(e,t)=>{u[e]=t,p()},g=(e=!1,t=!1)=>{let n=d.all,r=n[0];if(n.length>0)if(e){let e=d.current?.[0]??0;r=n.at(-1);for(let t of n)if(t[1]<=e)r=t;else break}else{let e=d.current?.[1]??0;for(let t of n)if(t[0]>=e){r=t;break}}r!==void 0&&(m(r),o(r,t)),d.current=r};this.#i=e=>g(e,!0);let _=(e,n)=>({start:e,end:n,text:En(e=>t.positionAt(e),e=>t.offsetAt(e),e=>t.getLineText(e),u,e,n)}),v=()=>{if(u.text===``||d.all.length===0)return;let e=d.current;if(e===void 0&&(g(!1,!0),e=d.current,e===void 0))return;let[t,n]=e,r=_(t,n);s([r]),o([t+r.text.length,t+r.text.length],!0),d.current=void 0,p()},y=()=>{u.text===``||d.all.length===0||(s(d.all.map(([e,t])=>_(e,t))),d.current=void 0,p())},b=()=>{this.cleanup(),l()};this.#a=b;let x=e=>U(`button`,{type:`button`,title:e.label,ariaLabel:e.label,dataset:{searchIcon:``,...e.dataset},innerHTML:la(e.icon,e.size??16),onclick:e.onClick}),S=(e,t,n)=>{let r=x({icon:e,label:t,size:14,onClick:()=>{let e=!u[n];r.ariaPressed=String(e),h(n,e)}});return r.ariaPressed=String(u[n]),r},C=S(`case`,`Match Case`,`caseSensitive`),ee=S(`whole-word`,`Whole Word`,`wholeWord`),w=S(`regex`,`Regexp`,`regex`),T=U(`input`,{type:`text`,placeholder:`Replace`,dataset:`replace`,value:``,oninput:e=>{u.replaceText=e.target.value},onkeydown:e=>{if(e.isComposing)return;let t=Rn(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),v()):t!==void 0&&(e.preventDefault(),g(t===`previous`,!0))}});this.#t=U(`input`,{type:`text`,placeholder:`Search`,dataset:`search`,value:r,oninput:e=>{u.text=e.target.value,d.current=void 0,p()},onkeydown:e=>{let t=Rn(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),g(e.shiftKey,!0)):t===void 0?Nn(e)&&(e.key===`f`||e.code===`KeyF`)&&(e.preventDefault(),te(e.altKey?`replace`:`find`)):(e.preventDefault(),g(t===`previous`,!0))}});let E=U(`div`,{dataset:`searchToggles`,children:[C,ee,w]}),D=U(`div`,{dataset:{inputBox:``,find:``},children:[this.#t,E]}),O=U(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[T]}),k=U(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[x({icon:`replace`,label:`Replace`,onClick:v}),x({icon:`replace-all`,label:`Replace All`,onClick:y})]}),A=x({icon:`arrow-up`,label:`Previous`,onClick:()=>{g(!0)}}),j=x({icon:`arrow-down`,label:`Next`,onClick:()=>{g()}});A.disabled=!0,j.disabled=!0;let M=U(`div`,{dataset:`searchNav`,children:[A,j]}),N=x({icon:`close`,label:`Close`,onClick:b,dataset:{searchClose:``}}),P=U(`div`,{dataset:{searchGrid:``,mode:i},children:[D,O,k,f,M,N]}),te=e=>{P.dataset.mode=e,this.#t.focus(),this.#t.select()};this.#r=te,this.#e=U(`div`,{dataset:`searchPanel`,children:[U(`div`,{dataset:`editorWidget`,children:[P]})]}),d.current=a,n.before(this.#e),requestAnimationFrame(()=>{a===void 0?c([]):p(),this.#t.select()})}focus(){this.#t.focus()}navigate(e){this.#i?.(e)}updateMatches(e){this.#n?.(e)}setMode(e){this.#r?.(e)}close(){this.#a?.()}cleanup(){this.#e.remove()}},da=class{#e;#t;#n;constructor(e,t,n){this.#e=U(`div`,{dataset:{editorWidget:``,selectionActionPopover:``},contentEditable:`false`,children:[e]},t),this.#t=this.#e.offsetHeight,this.#n=new ResizeObserver(()=>{let e=this.#e.offsetHeight;e!==this.#t&&(this.#t=e,n())}),this.#n.observe(this.#e)}reposition(e,t,n,r,i){vr(this.#e,{gutterWidth:n,placeAbove:r,viewport:i,x:e,y:t})}get height(){return this.#t}cleanup(){this.#n.disconnect(),this.#e.remove()}};function fa(e){return{selections:e.selections?.map(e=>({start:{...e.start},end:{...e.end},direction:e.direction})),view:e.view===void 0?void 0:{...e.view}}}function pa(e){return typeof e==`object`?e:e===`indexedDB`?new va:new ma}var ma=class{#e=new Map;get(e){let t=this.#e.get(e);return t===void 0?void 0:fa(t)}set(e,t){this.#e.set(e,fa(t))}},ha=`pierre-diffs-editor-state`,ga=1,_a=`states`,va=class{#e=ya();async get(e){let t=await this.#e;if(t===void 0)return;let n=await ba(t.transaction(_a,`readonly`).objectStore(_a).get(e));return n===void 0?void 0:fa(n)}async set(e,t){let n=await this.#e;n!==void 0&&await ba(n.transaction(_a,`readwrite`).objectStore(_a).put(fa(t),e))}};function ya(){try{let e=globalThis.indexedDB;if(e===void 0)return Promise.resolve(void 0);let t=e.open(ha,ga);return t.onupgradeneeded=()=>{let e=t.result;e.objectStoreNames.contains(_a)||e.createObjectStore(_a)},ba(t)}catch{return Promise.resolve(void 0)}}function ba(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}var xa=4096,Sa=/\p{Mark}/u,Ca=class{#e;#t;#n;#r=new Map;ch=-1;tabSize=2;lineHeight=20;paddingTop=0;init(e){if(this.#e===e&&this.#t!==void 0&&this.ch!==-1)return;if(this.#e=e,this.#t??=document.createElement(`canvas`).getContext(`2d`)??void 0,this.#t===void 0)throw Error(`Could not get canvas context`);let t=e.parentElement;if(t!==null){let{paddingTop:e}=getComputedStyle(t);e.endsWith(`px`)&&(this.paddingTop=parseFloat(e.slice(0,-2)))}let{fontSize:n,fontFamily:r,tabSize:i,lineHeight:a}=getComputedStyle(e);a.endsWith(`px`)?this.lineHeight=parseFloat(a.slice(0,-2)):n.endsWith(`px`)&&(this.lineHeight=$n(parseFloat(n.slice(0,-2))*parseFloat(a)));let o=n+` `+r;(this.#n!==o||this.ch===-1)&&(this.#n=o,this.#t.font=o,this.ch=this.canvasMeasureTextWidth(`0`),this.clearTextWidthCache());let s=parseInt(i,10);Number.isNaN(s)||(this.tabSize=s)}remeasureCharacterWidth(){if(this.#t===void 0||this.#n===void 0)return!1;this.#t.font=this.#n;let e=this.canvasMeasureTextWidth(`0`),t=e!==this.ch;t&&(this.ch=e);let n=this.#a();return t||n}measureTextWidth(e){if(!e.includes(` `))return this.#i(e);if(this.#t===void 0)throw Error(`Metrics not initialized`);let t=Da(e,this.tabSize);if(t!==-1)return t*this.ch;let n=0,r=0,i=this.tabSize*this.ch;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===9){if(t>r&&(n+=this.#i(e.slice(r,t))),i>0){let e=n%i;n+=e===0?i:i-e}r=t+1}return r<e.length&&(n+=this.#i(e.slice(r))),$n(n)}#i(e){return wa(e)?this.domMeasureTextWidth(e):this.canvasMeasureTextWidth(e)}canvasMeasureTextWidth(e){if(this.#t===void 0)throw Error(`Metrics not initialized`);return $n(this.#t.measureText(e).width)}domMeasureTextWidth(e){if(this.#e===void 0)throw Error(`Metrics not initialized`);let t=e+`|`+this.#n,n=this.#r.get(t);if(n!==void 0)return n;let r=U(`span`,{style:{position:`absolute`,top:`0`,left:`0`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre`,font:`inherit`},textContent:e},this.#e),i;try{i=$n(r.getBoundingClientRect().width)}finally{r.remove()}if(this.#r.size>=xa){let e=this.#r.keys().next().value;e!==void 0&&this.#r.delete(e)}return this.#r.set(t,i),i}clearTextWidthCache(){this.#a()}#a(){let e=this.#r.size>0;return this.#r.clear(),e}};function wa(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=57343||n===8205||n===65038||n===65039||n>127&&Sa.test(e.charAt(t)))return!0}return!1}function Ta(e,t){let n=Math.max(0,Math.min(t,e.length));if(n===0||n===e.length||!wa(e))return n;let r=ir();if(r!==void 0){for(let t of r.segment(e)){let e=t.index,r=e+t.segment.length;if(n>e&&n<r)return r;if(n<=e)break}return n}let i=0;for(let t of e){let e=i+t.length;if(n>i&&n<e)return e;if(n<=i)break;i=e}return n}function Ea(e){if(!wa(e))return;let t=[0],n=ir();if(n!==void 0){for(let r of n.segment(e))t.push(r.index+r.segment.length);return t}let r=0;for(let n of e)r+=n.length,t.push(r);return t}function Da(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i>127)return-1;n+=i===9?t-n%t:1}return n}var Oa=500,ka=class{#e;#t;#n;#r=`dark`;#i=``;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=!1;#h=[re];#g=[];#_=-1;#v=!0;#y=!1;#b=0;#x;#S=0;#C=new Map;#w=!1;#T=Qn(async e=>{if(this.#m)return;let{startingLine:t=0,totalLines:n=1/0}=e??{},r=Math.min(n===1/0?1/0:t+n,this.#o.lineCount);if(this.#t===void 0&&!Ma(this.#o.languageId)){if(await this.#e.loadLanguage(this.#o.languageId),this.#m)return;this.#t=this.#e.getLanguage(this.#o.languageId)}this.#A(),this.#B(r)},500);#E=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,jobId:n}=e;t===`tokenize`&&typeof n==`number`&&n===this.#b&&this.#V(n)};get themeType(){return this.#r}getStringCommentRegexpRangesInLine(e){if(!this.#d||e<0||e>=this.#o.lineCount||(this.#j(),this.#t===void 0))return null;if(!this.#C.has(e)){this.#B(e);let t=this.#h[e]??re,n=this.#I(e,t);this.#h[e+1]=n.state}return this.#C.get(e)??null}constructor({codeOptions:e,highlighter:t,textDocument:n,matchBrackets:r,setStyle:i,onDeferTokenize:a,onThemeChange:o,__debug:s}){let{themeType:c=`system`,theme:l=Se,tokenizeMaxLineLength:u=1e3}=e;this.#n=window.matchMedia(`(prefers-color-scheme: dark)`);let d;if(d=c===`system`?this.#O():c,typeof l!=`string`&&c===`system`){let e=new MutationObserver(e=>{for(let{type:t,attributeName:n}of e)if(t===`attributes`&&n!==null&&(n===`class`||n.startsWith(`data-`))){let e=this.#O();this.#D(l[e],e);break}});e.observe(document.documentElement,{attributes:!0}),e.observe(document.body,{attributes:!0}),this.#p=[W(this.#n,`change`,()=>{let e=this.#O();this.#D(l[e],e)}),()=>e.disconnect()]}this.#e=t,this.#o=n,this.#s=u,this.#c=i,this.#l=a,this.#u=o,this.#d=r!==!1,this.#f=s??!1,this.#j(),this.#a=[],this.#k(typeof l==`string`?l:l[d],d)}#D(e,t){this.#k(e,t),this.stopBackgroundTokenize(),this.#h=[re],this.#g=[],this.#t!==void 0&&this.#o.lineCount>0&&this.#F(0),this.#u?.()}#O(){try{if(typeof document<`u`&&typeof getComputedStyle==`function`&&document.body!=null)return getComputedStyle(document.body).colorScheme===`dark`?`dark`:`light`}catch{}return this.#n.matches?`dark`:`light`}syncTheme(e){let{themeType:t=`system`,theme:n=Se}=e,r=t===`system`?this.#O():t,i=typeof n==`string`?n:n[r];r===this.#r&&i===this.#i||this.#D(i,r)}#k(e,t){let{theme:n,colorMap:r}=this.#e.setTheme(e),{colors:i={}}=this.#e.getTheme(e),a=i[`editor.selectionBackground`],o=i[`editor.lineHighlightBackground`],s=i[`editorCursor.foreground`],c=i[`editor.findMatchBackground`],l=i[`editor.findMatchHighlightBackground`],u=i[`editorBracketMatch.background`],d=i[`editorBracketMatch.border`],f=i[`editorHint.foreground`],p=i[`editorInfo.foreground`],m=i[`editorWarning.foreground`],h=i[`editorError.foreground`];this.#c(`:host {
|
|
489
|
+
</svg>`,ua=class{#e;#t;#n;#r;#i;#a;constructor(e){let{textDocument:t,containerElement:n,defaultQuery:r,mode:i=`find`,initialMatch:a,scrollToMatch:o,applyReplace:s,onUpdate:c,onClose:l}=e,u={text:r,replaceText:``,caseSensitive:!1,wholeWord:!1,regex:!1},d={all:[],current:void 0},f=U(`div`,{dataset:{matches:``,noMatches:``},textContent:`No results`}),p=e=>{d.all=u.text===``?[]:t.search(u);let n=d.all.length===0;if(k.disabled=n,A.disabled=n,n){f.textContent=`No results`,f.dataset.noMatches=``,d.current=void 0,c([]);return}if(delete f.dataset.noMatches,e?.syncSelection===!1){m(c(d.all,{syncSelection:!1}));return}m(c(d.all))};this.#n=p;let m=e=>{if(e===void 0)f.textContent=`${d.all.length} results`;else{let[t,n]=e;f.textContent=`${d.all.findIndex(e=>e[0]===t&&e[1]===n)+1} of ${d.all.length}`}d.current=e},h=(e,t)=>{u[e]=t,p()},g=(e=!1,t=!1)=>{let n=d.all,r=n[0];if(n.length>0)if(e){let e=d.current?.[0]??0;r=n.at(-1);for(let t of n)if(t[1]<=e)r=t;else break}else{let e=d.current?.[1]??0;for(let t of n)if(t[0]>=e){r=t;break}}r!==void 0&&(m(r),o(r,t)),d.current=r};this.#i=e=>g(e,!0);let _=(e,n)=>({start:e,end:n,text:En(e=>t.positionAt(e),e=>t.offsetAt(e),e=>t.getLineText(e),u,e,n)}),v=()=>{if(u.text===``||d.all.length===0)return;let e=d.current;if(e===void 0&&(g(!1,!0),e=d.current,e===void 0))return;let[t,n]=e,r=_(t,n);s([r]),o([t+r.text.length,t+r.text.length],!0),d.current=void 0,p()},y=()=>{u.text===``||d.all.length===0||(s(d.all.map(([e,t])=>_(e,t))),d.current=void 0,p())},b=()=>{this.cleanup(),l()};this.#a=b;let x=e=>U(`button`,{type:`button`,title:e.label,ariaLabel:e.label,dataset:{searchIcon:``,...e.dataset},innerHTML:la(e.icon,e.size??16),onclick:e.onClick}),S=(e,t,n)=>{let r=x({icon:e,label:t,size:14,onClick:()=>{let e=!u[n];r.ariaPressed=String(e),h(n,e)}});return r.ariaPressed=String(u[n]),r},C=S(`case`,`Match Case`,`caseSensitive`),ee=S(`whole-word`,`Whole Word`,`wholeWord`),te=S(`regex`,`Regexp`,`regex`),w=U(`input`,{type:`text`,placeholder:`Replace`,dataset:`replace`,value:``,oninput:e=>{u.replaceText=e.target.value},onkeydown:e=>{if(e.isComposing)return;let t=Rn(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),v()):t!==void 0&&(e.preventDefault(),g(t===`previous`,!0))}});this.#t=U(`input`,{type:`text`,placeholder:`Search`,dataset:`search`,value:r,oninput:e=>{u.text=e.target.value,d.current=void 0,p()},onkeydown:e=>{let t=Rn(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),g(e.shiftKey,!0)):t===void 0?Nn(e)&&(e.key===`f`||e.code===`KeyF`)&&(e.preventDefault(),ne(e.altKey?`replace`:`find`)):(e.preventDefault(),g(t===`previous`,!0))}});let T=U(`div`,{dataset:`searchToggles`,children:[C,ee,te]}),E=U(`div`,{dataset:{inputBox:``,find:``},children:[this.#t,T]}),D=U(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[w]}),O=U(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[x({icon:`replace`,label:`Replace`,onClick:v}),x({icon:`replace-all`,label:`Replace All`,onClick:y})]}),k=x({icon:`arrow-up`,label:`Previous`,onClick:()=>{g(!0)}}),A=x({icon:`arrow-down`,label:`Next`,onClick:()=>{g()}});k.disabled=!0,A.disabled=!0;let j=U(`div`,{dataset:`searchNav`,children:[k,A]}),M=x({icon:`close`,label:`Close`,onClick:b,dataset:{searchClose:``}}),N=U(`div`,{dataset:{searchGrid:``,mode:i},children:[E,D,O,f,j,M]}),ne=e=>{N.dataset.mode=e,this.#t.focus(),this.#t.select()};this.#r=ne,this.#e=U(`div`,{dataset:`searchPanel`,children:[U(`div`,{dataset:`editorWidget`,children:[N]})]}),d.current=a,n.before(this.#e),requestAnimationFrame(()=>{a===void 0?c([]):p(),this.#t.select()})}focus(){this.#t.focus()}navigate(e){this.#i?.(e)}updateMatches(e){this.#n?.(e)}setMode(e){this.#r?.(e)}close(){this.#a?.()}cleanup(){this.#e.remove()}},da=class{#e;#t;#n;constructor(e,t,n){this.#e=U(`div`,{dataset:{editorWidget:``,selectionActionPopover:``},contentEditable:`false`,children:[e]},t),this.#t=this.#e.offsetHeight,this.#n=new ResizeObserver(()=>{let e=this.#e.offsetHeight;e!==this.#t&&(this.#t=e,n())}),this.#n.observe(this.#e)}reposition(e,t,n,r,i){vr(this.#e,{gutterWidth:n,placeAbove:r,viewport:i,x:e,y:t})}get height(){return this.#t}cleanup(){this.#n.disconnect(),this.#e.remove()}};function fa(e){return{selections:e.selections?.map(e=>({start:{...e.start},end:{...e.end},direction:e.direction})),view:e.view===void 0?void 0:{...e.view}}}function pa(e){return typeof e==`object`?e:e===`indexedDB`?new va:new ma}var ma=class{#e=new Map;get(e){let t=this.#e.get(e);return t===void 0?void 0:fa(t)}set(e,t){this.#e.set(e,fa(t))}},ha=`pierre-diffs-editor-state`,ga=1,_a=`states`,va=class{#e=ya();async get(e){let t=await this.#e;if(t===void 0)return;let n=await ba(t.transaction(_a,`readonly`).objectStore(_a).get(e));return n===void 0?void 0:fa(n)}async set(e,t){let n=await this.#e;n!==void 0&&await ba(n.transaction(_a,`readwrite`).objectStore(_a).put(fa(t),e))}};function ya(){try{let e=globalThis.indexedDB;if(e===void 0)return Promise.resolve(void 0);let t=e.open(ha,ga);return t.onupgradeneeded=()=>{let e=t.result;e.objectStoreNames.contains(_a)||e.createObjectStore(_a)},ba(t)}catch{return Promise.resolve(void 0)}}function ba(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}var xa=4096,Sa=/\p{Mark}/u,Ca=class{#e;#t;#n;#r=new Map;ch=-1;tabSize=2;lineHeight=20;paddingTop=0;init(e){if(this.#e===e&&this.#t!==void 0&&this.ch!==-1)return;if(this.#e=e,this.#t??=document.createElement(`canvas`).getContext(`2d`)??void 0,this.#t===void 0)throw Error(`Could not get canvas context`);let t=e.parentElement;if(t!==null){let{paddingTop:e}=getComputedStyle(t);e.endsWith(`px`)&&(this.paddingTop=parseFloat(e.slice(0,-2)))}let{fontSize:n,fontFamily:r,tabSize:i,lineHeight:a}=getComputedStyle(e);a.endsWith(`px`)?this.lineHeight=parseFloat(a.slice(0,-2)):n.endsWith(`px`)&&(this.lineHeight=$n(parseFloat(n.slice(0,-2))*parseFloat(a)));let o=n+` `+r;(this.#n!==o||this.ch===-1)&&(this.#n=o,this.#t.font=o,this.ch=this.canvasMeasureTextWidth(`0`),this.clearTextWidthCache());let s=parseInt(i,10);Number.isNaN(s)||(this.tabSize=s)}remeasureCharacterWidth(){if(this.#t===void 0||this.#n===void 0)return!1;this.#t.font=this.#n;let e=this.canvasMeasureTextWidth(`0`),t=e!==this.ch;t&&(this.ch=e);let n=this.#a();return t||n}measureTextWidth(e){if(!e.includes(` `))return this.#i(e);if(this.#t===void 0)throw Error(`Metrics not initialized`);let t=Da(e,this.tabSize);if(t!==-1)return t*this.ch;let n=0,r=0,i=this.tabSize*this.ch;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===9){if(t>r&&(n+=this.#i(e.slice(r,t))),i>0){let e=n%i;n+=e===0?i:i-e}r=t+1}return r<e.length&&(n+=this.#i(e.slice(r))),$n(n)}#i(e){return wa(e)?this.domMeasureTextWidth(e):this.canvasMeasureTextWidth(e)}canvasMeasureTextWidth(e){if(this.#t===void 0)throw Error(`Metrics not initialized`);return $n(this.#t.measureText(e).width)}domMeasureTextWidth(e){if(this.#e===void 0)throw Error(`Metrics not initialized`);let t=e+`|`+this.#n,n=this.#r.get(t);if(n!==void 0)return n;let r=U(`span`,{style:{position:`absolute`,top:`0`,left:`0`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre`,font:`inherit`},textContent:e},this.#e),i;try{i=$n(r.getBoundingClientRect().width)}finally{r.remove()}if(this.#r.size>=xa){let e=this.#r.keys().next().value;e!==void 0&&this.#r.delete(e)}return this.#r.set(t,i),i}clearTextWidthCache(){this.#a()}#a(){let e=this.#r.size>0;return this.#r.clear(),e}};function wa(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=57343||n===8205||n===65038||n===65039||n>127&&Sa.test(e.charAt(t)))return!0}return!1}function Ta(e,t){let n=Math.max(0,Math.min(t,e.length));if(n===0||n===e.length||!wa(e))return n;let r=ir();if(r!==void 0){for(let t of r.segment(e)){let e=t.index,r=e+t.segment.length;if(n>e&&n<r)return r;if(n<=e)break}return n}let i=0;for(let t of e){let e=i+t.length;if(n>i&&n<e)return e;if(n<=i)break;i=e}return n}function Ea(e){if(!wa(e))return;let t=[0],n=ir();if(n!==void 0){for(let r of n.segment(e))t.push(r.index+r.segment.length);return t}let r=0;for(let n of e)r+=n.length,t.push(r);return t}function Da(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i>127)return-1;n+=i===9?t-n%t:1}return n}var Oa=500,ka=class{#e;#t;#n;#r=`dark`;#i=``;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=!1;#h=[P];#g=[];#_=-1;#v=!0;#y=!1;#b=0;#x;#S=0;#C=new Map;#w=!1;#T=Qn(async e=>{if(this.#m)return;let{startingLine:t=0,totalLines:n=1/0}=e??{},r=Math.min(n===1/0?1/0:t+n,this.#o.lineCount);if(this.#t===void 0&&!Ma(this.#o.languageId)){if(await this.#e.loadLanguage(this.#o.languageId),this.#m)return;this.#t=this.#e.getLanguage(this.#o.languageId)}this.#A(),this.#B(r)},500);#E=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,jobId:n}=e;t===`tokenize`&&typeof n==`number`&&n===this.#b&&this.#V(n)};get themeType(){return this.#r}getStringCommentRegexpRangesInLine(e){if(!this.#d||e<0||e>=this.#o.lineCount||(this.#j(),this.#t===void 0))return null;if(!this.#C.has(e)){this.#B(e);let t=this.#h[e]??P,n=this.#I(e,t);this.#h[e+1]=n.state}return this.#C.get(e)??null}constructor({codeOptions:e,highlighter:t,textDocument:n,matchBrackets:r,setStyle:i,onDeferTokenize:a,onThemeChange:o,__debug:s}){let{themeType:c=`system`,theme:l=Se,tokenizeMaxLineLength:u=1e3}=e;this.#n=window.matchMedia(`(prefers-color-scheme: dark)`);let d;if(d=c===`system`?this.#O():c,typeof l!=`string`&&c===`system`){let e=new MutationObserver(e=>{for(let{type:t,attributeName:n}of e)if(t===`attributes`&&n!==null&&(n===`class`||n.startsWith(`data-`))){let e=this.#O();this.#D(l[e],e);break}});e.observe(document.documentElement,{attributes:!0}),e.observe(document.body,{attributes:!0}),this.#p=[W(this.#n,`change`,()=>{let e=this.#O();this.#D(l[e],e)}),()=>e.disconnect()]}this.#e=t,this.#o=n,this.#s=u,this.#c=i,this.#l=a,this.#u=o,this.#d=r!==!1,this.#f=s??!1,this.#j(),this.#a=[],this.#k(typeof l==`string`?l:l[d],d)}#D(e,t){this.#k(e,t),this.stopBackgroundTokenize(),this.#h=[P],this.#g=[],this.#t!==void 0&&this.#o.lineCount>0&&this.#F(0),this.#u?.()}#O(){try{if(typeof document<`u`&&typeof getComputedStyle==`function`&&document.body!=null)return getComputedStyle(document.body).colorScheme===`dark`?`dark`:`light`}catch{}return this.#n.matches?`dark`:`light`}syncTheme(e){let{themeType:t=`system`,theme:n=Se}=e,r=t===`system`?this.#O():t,i=typeof n==`string`?n:n[r];r===this.#r&&i===this.#i||this.#D(i,r)}#k(e,t){let{theme:n,colorMap:r}=this.#e.setTheme(e),{colors:i={}}=this.#e.getTheme(e),a=i[`editor.selectionBackground`],o=i[`editor.lineHighlightBackground`],s=i[`editorCursor.foreground`],c=i[`editor.findMatchBackground`],l=i[`editor.findMatchHighlightBackground`],u=i[`editorBracketMatch.background`],d=i[`editorBracketMatch.border`],f=i[`editorHint.foreground`],p=i[`editorInfo.foreground`],m=i[`editorWarning.foreground`],h=i[`editorError.foreground`];this.#c(`:host {
|
|
490
490
|
--diffs-editor-selection-bg: ${a??`var(--diffs-line-bg)`};
|
|
491
491
|
--diffs-editor-line-highlight-bg: ${o??`var(--diffs-line-bg)`};
|
|
492
492
|
--diffs-editor-match-bg: ${c??`initial`};
|
|
@@ -498,7 +498,7 @@ import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./index-DrITfTB
|
|
|
498
498
|
--diffs-editor-info-fg: ${p??`initial`};
|
|
499
499
|
--diffs-editor-warning-fg: ${m??`initial`};
|
|
500
500
|
--diffs-editor-error-fg: ${h??`initial`};
|
|
501
|
-
}`),this.#i=e,this.#r=t??n.type,this.#a=r}#A(){if(this.#i===``)return;let{colorMap:e}=this.#e.setTheme(this.#i);this.#a=e}cleanUp(){this.#m=!0,this.stopBackgroundTokenize(),this.#N(),this.#p?.forEach(e=>e()),this.#p=void 0}tokenize(e,t){if(this.#j(),this.#A(),this.#t===void 0&&!Ma(this.#o.languageId))throw Error(`Grammar for language "${this.#o.languageId}" not loaded`);if(this.#d)for(let t of this.#C.keys())t>=e.startLine&&this.#C.delete(t);let{lineCount:n}=this.#o,{startingLine:r=0,totalLines:i=1/0}=t??{},a=i===1/0?n:Math.min(r+i,n),o=e.startLine,s=Math.max(r,o),c=t!==void 0&&i!==1/0&&e.lineDelta>0&&o<a&&e.endLine>=a,l=e.lineDelta===0,u=l||t===void 0||o>=s,d=e.changedLineRanges??[[o,e.endLine]];this.#g=[];let f=-1;if(o<s)for(let[e,t]of d)e<s&&(f=Math.max(f,Math.min(t,s-1)));let p=f>=o&&(l||e.lineDelta<0);l?this.#B(o):(this.#R(e),(t===void 0||o>=s)&&this.#B(s));let m=0,h=d[m][1],g,_=0,v=l?d[m][0]:s,y=!1,b=new Map,x=p?new Map:void 0;if(x!==void 0&&!l){let e=Math.min(f+1,s,a);if(e>o){this.#B(e);let t=o,n=this.#h[t]??re;for(;t<e;t++){let e=this.#I(t,n);n=e.state,x.set(t,e.resolvedTokens)}this.#h[e]=n}}let S=this.#h[v]??re;for(;v<a;){let e=l?this.#h[v+1]:void 0;u&&(this.#h[v]=S);let{resolvedTokens:t,state:n}=this.#I(v,S);if(S=n,v>=s?b.set(v,t):x?.set(v,t),u&&(this.#h[v+1]=S),y=v>=h&&l&&e!==void 0&&S.equals(e),y){m++;let e=d[m];if(e===void 0)break;if(e[0]>=a){g=e[0],_=m;break}this.#h[e[0]]===void 0?(h=e[1],v++):(v=e[0],S=this.#h[v]??S,h=e[1]),y=!1;continue}v++}if(u&&(v<a?this.#h[v+1]=S:this.#h[v]=S),x!==void 0&&x.size>0&&this.#l(x,this.#r),g!==void 0)this.#F(g,d,_);else if(!y&&v<n){let e=c&&o>=s?a:o<s&&!l?o:v;this.#F(e,d,m)}return b}prebuildStateStack(e){this.#j(),this.#T(e)}stopBackgroundTokenize(){this.#v||(this.#v=!0,this.#y=!1,this.#_=-1,this.#x=void 0,this.#S=0,this.#g=[],this.#N())}pauseBackgroundTokenize(){this.#v||this.#y||(this.#f&&console.log(`[diffs/editor] background tokenization paused`,{jobId:this.#b}),this.#y=!0)}resumeBackgroundTokenize(){this.#v||!this.#y||this.#t===void 0||this.#_<0||(this.#f&&console.log(`[diffs/editor] background tokenization resumed`,{jobId:this.#b}),this.#y=!1,this.#P(this.#b))}#j(){this.#t===void 0&&!Ma(this.#o.languageId)&&this.#e.getLoadedLanguages().includes(this.#o.languageId)&&(this.#t=this.#e.getLanguage(this.#o.languageId))}#M(){this.#w||=(globalThis.addEventListener(`message`,this.#E),!0)}#N(){this.#w&&=(globalThis.removeEventListener(`message`,this.#E),!1)}#P(e){globalThis.postMessage({type:`tokenize`,jobId:e})}#F(e,t,n=0){if(Ma(this.#o.languageId))return;let r=++this.#b;this.#f&&console.log(`[diffs/editor] background tokenization scheduled`,{jobId:r,startLine:e,changedLineRanges:t,changedRangeIndex:n}),this.#v=!1,this.#y=!1,this.#_=e,this.#x=t,this.#S=n,this.#M(),this.#P(r)}#I(e,t){let n=this.#o.getLineText(e);if(n.length>this.#s)return console.warn(`[diffs] Line(${e}) too long to tokenize: ${n.length}`),this.#L(e,null),{resolvedTokens:[[0,``,n]],state:t};if(this.#t===void 0||n===``||n.trim()===``)return this.#L(e,null),{resolvedTokens:[[0,``,n]],state:t};let r=Aa(this.#t,this.#a,n,t,Oa,this.#d);return this.#L(e,r.bracketIgnoredRanges),{resolvedTokens:r.resolvedTokens,state:r.ruleStack}}#L(e,t){this.#d&&this.#C.set(e,t)}#R(e){let t=e.changedLineChanges??[[e.startLine,e.endLine,e.lineDelta]],n=this.#h.slice();for(let[e,r,i]of t){if(i===0)continue;let t=r-e,a=e+(t-i)+1,o=e+t+1,s=n.length;if(i>0)for(let e=s-1;e>=a;e--){let t=e+i;e in n?n[t]=n[e]:Reflect.deleteProperty(n,t)}else{for(let e=a;e<s;e++){let t=e+i;e in n?n[t]=n[e]:Reflect.deleteProperty(n,t)}n.length=Math.max(Math.min(s,e+1),s+i)}for(let t=e+1;t<o;t++)Reflect.deleteProperty(n,t)}this.#h.length=Math.min(this.#h.length,e.startLine+1),n.length=Math.min(n.length,this.#o.lineCount+1);for(let t=0;t<=e.startLine;t++)Reflect.deleteProperty(n,t);this.#g=n}#z(e){return this.#g[e]??this.#h[e]}#B(e){let t=Math.min(Math.max(0,e),this.#o.lineCount);if(this.#h.length>t||this.#t===void 0)return;let n=this.#h.length-1,r=this.#h[n]??re;for(;n<t;n++){this.#h[n]=r;let e=this.#o.getLineText(n);if(e.length<=this.#s&&e!==``&&e.trim()!==``){let t=Aa(this.#t,this.#a,e,r,Oa,this.#d);this.#L(n,t.bracketIgnoredRanges),r=t.ruleStack}else this.#L(n,null)}this.#h[n]=r}#V(e){if(this.#v||this.#y||this.#t===void 0||e!==this.#b)return;this.#A();let t=performance.now(),n=new Map,r=this.#o.lineCount,i=this.#x,a=this.#_,o=this.#h[a]??re,s=!1,c=this.#S,l=i?.[c]?.[1];for(;a<r;){this.#h[a]=o;let e=l===void 0?void 0:this.#z(a+1),r=this.#o.getLineText(a);if(r.length>this.#s)console.warn(`[diffs] Line(${a}) too long to tokenize: ${r.length}`),n.set(a,[[0,``,r]]),this.#L(a,null);else if(r===``||r.trim()===``)n.set(a,[[0,``,r]]),this.#L(a,null);else{let e=Aa(this.#t,this.#a,r,o,Oa,this.#d);n.set(a,e.resolvedTokens),this.#L(a,e.bracketIgnoredRanges),o=e.ruleStack}if(this.#h[a+1]=o,s=l!==void 0&&a>=l&&e!==void 0&&o.equals(e),a++,s){c++;let e=i?.[c];if(e===void 0)break;if(l=e[1],this.#h[e[0]]===void 0)s=!1;else{a=e[0],o=this.#h[a]??o,s=!1;continue}}if(performance.now()-t>1)break}if(this.#l(n,this.#r),!(this.#v||this.#y||e!==this.#b)){if(s||a>=r){this.stopBackgroundTokenize();return}this.#_=a,this.#S=c,this.#P(e)}}};function Aa(e,t,n,r,i,a=!0){let o=e.tokenizeLine2(n,r,i);o.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${n.substring(0,100)}`);let s=o.tokens,c=s.length/2,l=[],u=[];for(let e=0;e<c;e++){let r=s[2*e],i=e+1<c?s[2*e+2]:n.length;if(r===i)continue;let o=s[2*e+1],d=Ce.getForeground(o),f=n.slice(r,i);l.push([r,t[d],f]),a&&Ce.getTokenType(o)>0&&u.push([r,i])}return{ruleStack:o.ruleStack,resolvedTokens:l,bracketIgnoredRanges:u}}function ja(e){return e.map(([e,t,n])=>e===0&&t===``?n===``?U(`br`):n:U(`span`,{dataset:{char:e.toString()},style:`color:${t};`,textContent:n}))}function Ma(e){return e===`text`||e===`ansi`}function Na(e){let t=e.getSelection?.();if(t==null||t.rangeCount===0)return;let n=t.getRangeAt(0);return{collapsed:n.collapsed,startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}}function Pa(e){if(typeof e.cacheKey!=`string`||e.cacheKey.length===0)throw Error(`Editor persistState requires a non-empty file.cacheKey for "${e.name}". Provide a unique, stable cacheKey for every editable file.`);return e.cacheKey}function Fa(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}var Ia=2,La=`selection-action`,Ra=`application/vnd.pierre.diffs-selections+json`,za=class{#e;#t=new Ca;#n;#r;#i=new Map;#a;#o;#s=new Map;#c;#l=0;#u=!1;#d;#f;#p;#m;#h;#g;#_;#v=new Map;#y=new Map;#b=new Map;#x;#S;#C;#w;#T;#E;#D;#O;#k;#A;#j;#M;#N;#P;#F;#I;#L;#R;#z;#B;#V;#H=!1;#U=!1;#W=!1;#G=!1;#K=!1;#q=!1;#J=!1;#Y;#X=``;#Z;#Q;#$;#ee;#te;#ne;#re=!1;#ie=!1;#ae=!1;#oe=!1;#se;#ce=(e,t)=>{if(this.#N?.updateRenderCache(e,t,!1,!1),this.#L!==void 0&&this.#L.totalLines!==1/0){let{startingLine:t,totalLines:n}=this.#L,r=Math.min(t+n,this.#I?.lineCount??0);for(let[n,i]of e)if(n>=t&&n<r){let e=this.#Tt(n);e!==void 0&&e.replaceChildren(...ja(i))}}};constructor(e={}){this.#e=e}setOptions(e){let t=this.#e.persistStateStorage??`inMemory`,n={...this.#e,...e};if(n.persistState===!0&&this.#N?.type===`file`){let e=this.#N.__getCurrentFile?.()??this.#P;e!==void 0&&Pa(e)}this.#e=n,this.#e.persistState!==!0&&(this.#i.clear(),this.#l++,this.#u=!1),(this.#e.persistStateStorage??`inMemory`)!==t&&(this.#l++,this.#a=void 0,this.#o=void 0,this.#s.clear())}edit(e){if(this.#e.persistState===!0&&e.type===`file`){let t=e.__getCurrentFile?.();t!==void 0&&Pa(t)}let{useTokenTransformer:t,...n}=e.options;return t!==!0&&(e.setOptions({...n,useTokenTransformer:!0}),e.rerender()),this.#N=e,this.#Te(),this.#m=e.attachEditor(this),()=>this.cleanUp()}applyEdits(e,t=!0){let n=this.#I;if(n==null)throw Error(`Editor is not attached`);let r=this.#W,i=this.#$,a=i?.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]),o=i===void 0?void 0:n.resolveEdits(e).sort((e,t)=>e.start-t.start),s=n.applyEdits(e,t,i);if(s===void 0)return;let c;i!==void 0&&a!==void 0&&o!==void 0&&(c=Yr(n,i,a,o),t&&n.setLastUndoSelectionsAfter(c)),this.#St(s,c,this.#Ct(s),{skipFocus:!r})}get canUndo(){return this.#I?.canUndo??!1}get canRedo(){return this.#I?.canRedo??!1}undo(){this.#je(`undo`)}redo(){this.#je(`redo`)}getFile(){let e=this.#P,t=this.#I;if(e===void 0||t===void 0)return;let n={...e};return Object.defineProperty(n,"contents",{enumerable:!0,get:()=>t.getText()}),n}getText(){return this.#I?.getText()??``}getState(){let e=this.#N?.getScrollContainer?.();return{selections:this.#$,view:e===void 0?void 0:{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}}setState({selections:e,view:t}){if(this.#N===void 0||this.#I===void 0)throw Error(`Editor is not attached`);if(this.#nt(e??[]),t!==void 0){let e=this.#N.getScrollContainer?.();e!==void 0&&e.scrollTo({left:t.scrollLeft,top:t.scrollTop,behavior:`instant`});return}this.#Ue()}setSelections(e){let t=this.#I;if(t===void 0)throw Error(`Text document is not initialized`);let n=e.map(e=>{let n=t.normalizePosition(e.start),r=t.normalizePosition(e.end),i=e.direction===`none`?0:e.direction===`backward`?-1:1;return G(n,r)>0&&([n,r]=[r,n],i!==0&&(i=i===1?-1:1)),{direction:i,start:n,end:r}});this.#nt(n);let r=n.at(-1);r!==void 0&&this.#ve(Wr(r).line),this.#Ue()}setMarkers(e){let t=this.#I;if(t===void 0)throw Error(`Text document is not initialized`);if(e.length===0){this.#z?.cleanup(),this.#z=void 0,this.#nt(this.#$??[]);return}this.#z??=new Vi({popoverManager:this.#Se(),getLineHeight:()=>this.#t.lineHeight,getOverlayElement:()=>this.#k,getGutterWidth:()=>this.#Et(),getCharX:(e,t)=>this.#kt(e,t),getLineY:e=>this.#Ot(e),isMouseDown:()=>this.#q||this.#K}),this.#z.setMarkers(e,t),this.#O!==void 0&&this.#z.listenHover(this.#O),this.#nt(this.#$??[])}focus(e){let t=e?.preventScroll??!1,n=this.#$?.at(-1);if(n!==void 0){let e=n.direction===-1?n.end:n.start;this.#Ve(e,t)}else this.#Ve(void 0,t)}blur(){this.#O?.blur()}cleanUp(e=!1){let t=this.#le;this.#l++,this.#fe(),this.#u=t,_e(this.#Oe),this.#n?.cleanUp(),this.#n=void 0,e||(this.#I=void 0,this.#P=void 0),this.#f?.forEach(e=>e()),this.#f=void 0,this.#d?.forEach(e=>e()),this.#d=void 0,this.#p?.forEach(e=>e()),this.#p=void 0,this.#m?.(e),this.#m=void 0,this.#g=void 0,this.#_=void 0,this.#v.clear(),this.#y.clear(),this.#b.clear(),this.#x=void 0,this.#S?.remove(),this.#S=void 0,this.#C?.remove(),this.#C=void 0,this.#w?.remove(),this.#w=void 0,this.#T?.remove(),this.#T=void 0,this.#E=void 0,this.#r?.cleanUp(),this.#r=void 0,this.#D=void 0,this.#O?.removeAttribute(`contentEditable`),this.#O=void 0,this.#W=!1,this.#k?.remove(),this.#k=void 0,this.#M?.disconnect(),this.#M=void 0,this.#oe=!1,this.#se!==void 0&&(cancelAnimationFrame(this.#se),this.#se=void 0),this.#we()}__prepareFile(e){if(this.#e.persistState!==!0)return e;let t=Pa(e),n=this.#P,r=e.lang??oe(e.name);n!==void 0&&(Pa(n)!==t||n.name!==e.name||this.#I?.languageId!==r)&&(this.#l++,this.#fe());let i=this.#ue(e,t);return i===void 0||i.getText()===e.contents?e:{...e,contents:i.getText()}}__postponeBgTokenizeToNextFrame(){let e=this.#n;e!==void 0&&(e.pauseBackgroundTokenize(),requestAnimationFrame(()=>{e.resumeBackgroundTokenize()}))}__syncRenderView=(e,t,n,r,i)=>{let a=t.shadowRoot;if(a==null){console.error(`[editor] Could not find the shadow root.`);return}let o,s,c;for(let e of a.querySelectorAll(`[data-code]`))if(e.dataset.deletions===void 0){o=e;for(let t of e.children){let e=t,{gutter:n,content:r}=e.dataset;n===void 0?r!==void 0&&(c=e):s=e}break}if(o===void 0||c===void 0)return;this.#Se().setViewportElements(t,o),this.#E!==t&&(this.#E=t,this.#S!==void 0&&t.appendChild(this.#S),this.#C!==void 0&&a.appendChild(this.#C),this.#w!==void 0&&a.appendChild(this.#w),this.#T!==void 0&&a.prepend(this.#T));let l=this.#I===void 0||this.#P===void 0||this.#P.name!==n.name||this.#P.lang!==n.lang||this.#P.cacheKey!==n.cacheKey,u=this.#le?Pa(n):void 0,d;if(l){let e=``;e=`contents`in n?n.contents:n.additionLines.join(``);let t=new Xt({maxEntries:this.#e.historyMaxEntries}),{name:r,lang:i,cacheKey:a}=n,o=i??oe(n.name),s=(u===void 0?void 0:this.#ue(n,u))??new On(n.name,e,o,0,t);this.#P={name:r,lang:i,cacheKey:a},this.#I=s,u!==void 0&&(this.#i.set(u,s),d={cacheKey:u,textDocument:s}),this.#n?.cleanUp(),this.#n=void 0,this.#we(),this.#$=this.#Q,requestAnimationFrame(()=>{this.#e.onAttach?.(this,this.#N)}),this.#I!==void 0&&this.#e.__debug===!0&&console.log(`[diffs/editor] text document rebuilt from`,n.name)}d===void 0&&this.#u&&u!==void 0&&this.#I!==void 0&&(d={cacheKey:u,textDocument:this.#I});let f=this.#I;if(this.#n==null&&f!=null&&(this.#n=new ka({highlighter:e,textDocument:f,codeOptions:this.#N?.options??{},matchBrackets:this.#e.matchBrackets,onDeferTokenize:this.#ce,onThemeChange:()=>this.#tt(),setStyle:e=>{this.#w.textContent=e},__debug:this.#e.__debug})),this.#O!==c&&(this.#D=s,this.#O=Zn(c,{contentEditable:`true`,role:`textbox`,ariaMultiLine:`true`,autocapitalize:`off`,writingSuggestions:`off`,autocorrect:!1,spellcheck:!1,translate:!1}),this.#k!==void 0&&c.after(this.#k),this.#t.init(c),this.#Re(),this.#De(c,s),this.#O!==void 0&&this.#e.__debug===!0&&console.log(`[diffs/editor] full re-render triggered !!!`)),c.ariaLabel!==n.name&&(c.ariaLabel=n.name),r!==void 0&&r.length>0||this.#be)for(let e of this.#O.children){let t=e,{lineAnnotation:n,lineType:r,separator:i}=t.dataset;(n!==void 0||i!==void 0||r===`change-deletion`)&&t.setAttribute(`contenteditable`,`false`)}if(this.#Ce(),this.#n?.syncTheme(this.#N?.options??{}),this.#F=r,this.#L=i,this.#R=i?.totalLines,this.#n?.prebuildStateStack(i),this.#z?.removePopup(),(this.#$!==void 0||this.#ee!==void 0||this.#z!==void 0)&&this.#nt(this.#$??[]),this.#Q!==void 0&&this.#j!==void 0?(this.#Q=void 0,this.#Ue(!1,`center`)):this.#te===void 0?this.#$!==void 0&&this.#$.length>0&&!this.#ae&&this.focus({preventScroll:!0}):this.#Ge(this.#te,this.#ne,this.#ie),this.#ae&&this.#B?.focus(),this.#e.__debug===!0&&i!==void 0){let{startingLine:e,totalLines:t}=i;console.log(`[diffs/editor] render file:`,n.name,`RenderRange:`,e+`-`+(e+t),`of`,this.#I?.lineCount,`lines`)}d!==void 0&&(this.#u=!1,this.#he(d.cacheKey,d.textDocument))};get#le(){return this.#e.persistState===!0&&this.#N?.type===`file`}#ue(e,t){let n=this.#i.get(t),r=e.lang??oe(e.name);return n?.languageId===r?n:void 0}#de(){let e=this.#e.persistStateStorage??`inMemory`;return(this.#a===void 0||this.#o!==e)&&(this.#a=pa(e),this.#o=e),this.#a}#fe(){let e=this.#P,t=this.#I;if(!this.#le||e===void 0||t===void 0)return;let n=Pa(e);this.#i.set(n,t);let r;try{r=this.#de()}catch{return}let i=fa(this.getState()),a=this.#c;if(a?.cacheKey===n&&a.textDocument===t){if(this.#c=void 0,t.version===a.documentVersion&&this.#$===a.selections&&i.view?.scrollLeft===a.view?.scrollLeft&&i.view?.scrollTop===a.view?.scrollTop)return;this.#pe(r,n,i,a.completion);return}this.#pe(r,n,i)}#pe(e,t,n,r){let i=this.#s.get(t);if(r!==void 0||i!==void 0){let a=r??Promise.resolve();i!==void 0&&(a=a.then(()=>i)),this.#me(t,a.then(()=>e.set(t,n)));return}let a;try{a=e.set(t,n)}catch{return}Fa(a)&&this.#me(t,a)}#me(e,t){let n=t.catch(()=>{});this.#s.set(e,n),n.finally(()=>{this.#s.get(e)===n&&this.#s.delete(e)})}#he(e,t){let n=++this.#l,r=t.version,i=this.#$,a=this.getState().view,o=o=>{let s=this.getState().view;o===void 0||n!==this.#l||this.#I!==t||t.version!==r||this.#$!==i||s?.scrollLeft!==a?.scrollLeft||s?.scrollTop!==a?.scrollTop||this.#P===void 0||Pa(this.#P)!==e||this.setState(fa(o))},s=()=>{let t;try{t=this.#de().get(e)}catch{return}if(Fa(t))return t.then(o).catch(()=>{});try{o(t)}catch{}},c=this.#s.get(e),l=c===void 0?s():c.then(s);if(Fa(l)){let n={cacheKey:e,textDocument:t,documentVersion:r,selections:i,view:a,completion:l.catch(()=>{})};this.#c=n,n.completion.finally(()=>{this.#c===n&&(this.#c=void 0)})}}#ge(e){return this.#N?.isLineRenderable?.(e+1)??!0}get#_e(){let e=this.#N;if(e?.getNearestRenderableLine!=null)return(t,n)=>{let r=e.getNearestRenderableLine(t+1,n);return r==null?void 0:r-1}}#ve(e){this.#ge(e)||this.#N?.revealLine?.(e+1)}get#ye(){return this.#N?.options.diffStyle??`split`}get#be(){return this.#N?.type===`file-diff`}get#xe(){return this.#N?.options.overflow===`wrap`}#Se(){return this.#r??=new _r({hasActivePopover:()=>this.#V!==void 0||this.#z?.isPopupVisible()===!0,updateActivePopover:()=>{this.#ct(),this.#z?.updatePopupPosition()}})}#Ce(){this.#v.clear(),this.#y.clear(),this.#b.clear(),this.#x=void 0}#we(){this.#et(null),this.#g=void 0,this.#_=void 0,this.#H=!1,this.#A?.forEach(e=>e.remove()),this.#A=void 0,this.#$=void 0,this.#Z=void 0,this.#te=void 0,this.#z?.cleanup(),this.#z=void 0,this.#B?.cleanup(),this.#B=void 0,this.#V?.cleanup(),this.#V=void 0}#Te(){this.#S=U(`style`,{dataset:`editorGlobalCss`,textContent:`
|
|
501
|
+
}`),this.#i=e,this.#r=t??n.type,this.#a=r}#A(){if(this.#i===``)return;let{colorMap:e}=this.#e.setTheme(this.#i);this.#a=e}cleanUp(){this.#m=!0,this.stopBackgroundTokenize(),this.#N(),this.#p?.forEach(e=>e()),this.#p=void 0}tokenize(e,t){if(this.#j(),this.#A(),this.#t===void 0&&!Ma(this.#o.languageId))throw Error(`Grammar for language "${this.#o.languageId}" not loaded`);if(this.#d)for(let t of this.#C.keys())t>=e.startLine&&this.#C.delete(t);let{lineCount:n}=this.#o,{startingLine:r=0,totalLines:i=1/0}=t??{},a=i===1/0?n:Math.min(r+i,n),o=e.startLine,s=Math.max(r,o),c=t!==void 0&&i!==1/0&&e.lineDelta>0&&o<a&&e.endLine>=a,l=e.lineDelta===0,u=l||t===void 0||o>=s,d=e.changedLineRanges??[[o,e.endLine]];this.#g=[];let f=-1;if(o<s)for(let[e,t]of d)e<s&&(f=Math.max(f,Math.min(t,s-1)));let p=f>=o&&(l||e.lineDelta<0);l?this.#B(o):(this.#R(e),(t===void 0||o>=s)&&this.#B(s));let m=0,h=d[m][1],g,_=0,v=l?d[m][0]:s,y=!1,b=new Map,x=p?new Map:void 0;if(x!==void 0&&!l){let e=Math.min(f+1,s,a);if(e>o){this.#B(e);let t=o,n=this.#h[t]??P;for(;t<e;t++){let e=this.#I(t,n);n=e.state,x.set(t,e.resolvedTokens)}this.#h[e]=n}}let S=this.#h[v]??P;for(;v<a;){let e=l?this.#h[v+1]:void 0;u&&(this.#h[v]=S);let{resolvedTokens:t,state:n}=this.#I(v,S);if(S=n,v>=s?b.set(v,t):x?.set(v,t),u&&(this.#h[v+1]=S),y=v>=h&&l&&e!==void 0&&S.equals(e),y){m++;let e=d[m];if(e===void 0)break;if(e[0]>=a){g=e[0],_=m;break}this.#h[e[0]]===void 0?(h=e[1],v++):(v=e[0],S=this.#h[v]??S,h=e[1]),y=!1;continue}v++}if(u&&(v<a?this.#h[v+1]=S:this.#h[v]=S),x!==void 0&&x.size>0&&this.#l(x,this.#r),g!==void 0)this.#F(g,d,_);else if(!y&&v<n){let e=c&&o>=s?a:o<s&&!l?o:v;this.#F(e,d,m)}return b}prebuildStateStack(e){this.#j(),this.#T(e)}stopBackgroundTokenize(){this.#v||(this.#v=!0,this.#y=!1,this.#_=-1,this.#x=void 0,this.#S=0,this.#g=[],this.#N())}pauseBackgroundTokenize(){this.#v||this.#y||(this.#f&&console.log(`[diffs/editor] background tokenization paused`,{jobId:this.#b}),this.#y=!0)}resumeBackgroundTokenize(){this.#v||!this.#y||this.#t===void 0||this.#_<0||(this.#f&&console.log(`[diffs/editor] background tokenization resumed`,{jobId:this.#b}),this.#y=!1,this.#P(this.#b))}#j(){this.#t===void 0&&!Ma(this.#o.languageId)&&this.#e.getLoadedLanguages().includes(this.#o.languageId)&&(this.#t=this.#e.getLanguage(this.#o.languageId))}#M(){this.#w||=(globalThis.addEventListener(`message`,this.#E),!0)}#N(){this.#w&&=(globalThis.removeEventListener(`message`,this.#E),!1)}#P(e){globalThis.postMessage({type:`tokenize`,jobId:e})}#F(e,t,n=0){if(Ma(this.#o.languageId))return;let r=++this.#b;this.#f&&console.log(`[diffs/editor] background tokenization scheduled`,{jobId:r,startLine:e,changedLineRanges:t,changedRangeIndex:n}),this.#v=!1,this.#y=!1,this.#_=e,this.#x=t,this.#S=n,this.#M(),this.#P(r)}#I(e,t){let n=this.#o.getLineText(e);if(n.length>this.#s)return console.warn(`[diffs] Line(${e}) too long to tokenize: ${n.length}`),this.#L(e,null),{resolvedTokens:[[0,``,n]],state:t};if(this.#t===void 0||n===``||n.trim()===``)return this.#L(e,null),{resolvedTokens:[[0,``,n]],state:t};let r=Aa(this.#t,this.#a,n,t,Oa,this.#d);return this.#L(e,r.bracketIgnoredRanges),{resolvedTokens:r.resolvedTokens,state:r.ruleStack}}#L(e,t){this.#d&&this.#C.set(e,t)}#R(e){let t=e.changedLineChanges??[[e.startLine,e.endLine,e.lineDelta]],n=this.#h.slice();for(let[e,r,i]of t){if(i===0)continue;let t=r-e,a=e+(t-i)+1,o=e+t+1,s=n.length;if(i>0)for(let e=s-1;e>=a;e--){let t=e+i;e in n?n[t]=n[e]:Reflect.deleteProperty(n,t)}else{for(let e=a;e<s;e++){let t=e+i;e in n?n[t]=n[e]:Reflect.deleteProperty(n,t)}n.length=Math.max(Math.min(s,e+1),s+i)}for(let t=e+1;t<o;t++)Reflect.deleteProperty(n,t)}this.#h.length=Math.min(this.#h.length,e.startLine+1),n.length=Math.min(n.length,this.#o.lineCount+1);for(let t=0;t<=e.startLine;t++)Reflect.deleteProperty(n,t);this.#g=n}#z(e){return this.#g[e]??this.#h[e]}#B(e){let t=Math.min(Math.max(0,e),this.#o.lineCount);if(this.#h.length>t||this.#t===void 0)return;let n=this.#h.length-1,r=this.#h[n]??P;for(;n<t;n++){this.#h[n]=r;let e=this.#o.getLineText(n);if(e.length<=this.#s&&e!==``&&e.trim()!==``){let t=Aa(this.#t,this.#a,e,r,Oa,this.#d);this.#L(n,t.bracketIgnoredRanges),r=t.ruleStack}else this.#L(n,null)}this.#h[n]=r}#V(e){if(this.#v||this.#y||this.#t===void 0||e!==this.#b)return;this.#A();let t=performance.now(),n=new Map,r=this.#o.lineCount,i=this.#x,a=this.#_,o=this.#h[a]??P,s=!1,c=this.#S,l=i?.[c]?.[1];for(;a<r;){this.#h[a]=o;let e=l===void 0?void 0:this.#z(a+1),r=this.#o.getLineText(a);if(r.length>this.#s)console.warn(`[diffs] Line(${a}) too long to tokenize: ${r.length}`),n.set(a,[[0,``,r]]),this.#L(a,null);else if(r===``||r.trim()===``)n.set(a,[[0,``,r]]),this.#L(a,null);else{let e=Aa(this.#t,this.#a,r,o,Oa,this.#d);n.set(a,e.resolvedTokens),this.#L(a,e.bracketIgnoredRanges),o=e.ruleStack}if(this.#h[a+1]=o,s=l!==void 0&&a>=l&&e!==void 0&&o.equals(e),a++,s){c++;let e=i?.[c];if(e===void 0)break;if(l=e[1],this.#h[e[0]]===void 0)s=!1;else{a=e[0],o=this.#h[a]??o,s=!1;continue}}if(performance.now()-t>1)break}if(this.#l(n,this.#r),!(this.#v||this.#y||e!==this.#b)){if(s||a>=r){this.stopBackgroundTokenize();return}this.#_=a,this.#S=c,this.#P(e)}}};function Aa(e,t,n,r,i,a=!0){let o=e.tokenizeLine2(n,r,i);o.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${n.substring(0,100)}`);let s=o.tokens,c=s.length/2,l=[],u=[];for(let e=0;e<c;e++){let r=s[2*e],i=e+1<c?s[2*e+2]:n.length;if(r===i)continue;let o=s[2*e+1],d=Ce.getForeground(o),f=n.slice(r,i);l.push([r,t[d],f]),a&&Ce.getTokenType(o)>0&&u.push([r,i])}return{ruleStack:o.ruleStack,resolvedTokens:l,bracketIgnoredRanges:u}}function ja(e){return e.map(([e,t,n])=>e===0&&t===``?n===``?U(`br`):n:U(`span`,{dataset:{char:e.toString()},style:`color:${t};`,textContent:n}))}function Ma(e){return e===`text`||e===`ansi`}function Na(e){let t=e.getSelection?.();if(t==null||t.rangeCount===0)return;let n=t.getRangeAt(0);return{collapsed:n.collapsed,startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}}function Pa(e){if(typeof e.cacheKey!=`string`||e.cacheKey.length===0)throw Error(`Editor persistState requires a non-empty file.cacheKey for "${e.name}". Provide a unique, stable cacheKey for every editable file.`);return e.cacheKey}function Fa(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}var Ia=2,La=`selection-action`,Ra=`application/vnd.pierre.diffs-selections+json`,za=class{#e;#t=new Ca;#n;#r;#i=new Map;#a;#o;#s=new Map;#c;#l=0;#u=!1;#d;#f;#p;#m;#h;#g;#_;#v=new Map;#y=new Map;#b=new Map;#x;#S;#C;#w;#T;#E;#D;#O;#k;#A;#j;#M;#N;#P;#F;#I;#L;#R;#z;#B;#V;#H=!1;#U=!1;#W=!1;#G=!1;#K=!1;#q=!1;#J=!1;#Y;#X=``;#Z;#Q;#$;#ee;#te;#ne;#re=!1;#ie=!1;#ae=!1;#oe=!1;#se;#ce=(e,t)=>{if(this.#N?.updateRenderCache(e,t,!1,!1),this.#L!==void 0&&this.#L.totalLines!==1/0){let{startingLine:t,totalLines:n}=this.#L,r=Math.min(t+n,this.#I?.lineCount??0);for(let[n,i]of e)if(n>=t&&n<r){let e=this.#Tt(n);e!==void 0&&e.replaceChildren(...ja(i))}}};constructor(e={}){this.#e=e}setOptions(e){let t=this.#e.persistStateStorage??`inMemory`,n={...this.#e,...e};if(n.persistState===!0&&this.#N?.type===`file`){let e=this.#N.__getCurrentFile?.()??this.#P;e!==void 0&&Pa(e)}this.#e=n,this.#e.persistState!==!0&&(this.#i.clear(),this.#l++,this.#u=!1),(this.#e.persistStateStorage??`inMemory`)!==t&&(this.#l++,this.#a=void 0,this.#o=void 0,this.#s.clear())}edit(e){if(this.#e.persistState===!0&&e.type===`file`){let t=e.__getCurrentFile?.();t!==void 0&&Pa(t)}let{useTokenTransformer:t,...n}=e.options;return t!==!0&&(e.setOptions({...n,useTokenTransformer:!0}),e.rerender()),this.#N=e,this.#Te(),this.#m=e.attachEditor(this),()=>this.cleanUp()}applyEdits(e,t=!0){let n=this.#I;if(n==null)throw Error(`Editor is not attached`);let r=this.#W,i=this.#$,a=i?.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]),o=i===void 0?void 0:n.resolveEdits(e).sort((e,t)=>e.start-t.start),s=n.applyEdits(e,t,i);if(s===void 0)return;let c;i!==void 0&&a!==void 0&&o!==void 0&&(c=Yr(n,i,a,o),t&&n.setLastUndoSelectionsAfter(c)),this.#St(s,c,this.#Ct(s),{skipFocus:!r})}get canUndo(){return this.#I?.canUndo??!1}get canRedo(){return this.#I?.canRedo??!1}undo(){this.#je(`undo`)}redo(){this.#je(`redo`)}getFile(){let e=this.#P,t=this.#I;if(e===void 0||t===void 0)return;let n={...e};return Object.defineProperty(n,"contents",{enumerable:!0,get:()=>t.getText()}),n}getText(){return this.#I?.getText()??``}getState(){let e=this.#N?.getScrollContainer?.();return{selections:this.#$,view:e===void 0?void 0:{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}}setState({selections:e,view:t}){if(this.#N===void 0||this.#I===void 0)throw Error(`Editor is not attached`);if(this.#nt(e??[]),t!==void 0){let e=this.#N.getScrollContainer?.();e!==void 0&&e.scrollTo({left:t.scrollLeft,top:t.scrollTop,behavior:`instant`});return}this.#Ue()}setSelections(e){let t=this.#I;if(t===void 0)throw Error(`Text document is not initialized`);let n=e.map(e=>{let n=t.normalizePosition(e.start),r=t.normalizePosition(e.end),i=e.direction===`none`?0:e.direction===`backward`?-1:1;return G(n,r)>0&&([n,r]=[r,n],i!==0&&(i=i===1?-1:1)),{direction:i,start:n,end:r}});this.#nt(n);let r=n.at(-1);r!==void 0&&this.#ve(Wr(r).line),this.#Ue()}setMarkers(e){let t=this.#I;if(t===void 0)throw Error(`Text document is not initialized`);if(e.length===0){this.#z?.cleanup(),this.#z=void 0,this.#nt(this.#$??[]);return}this.#z??=new Vi({popoverManager:this.#Se(),getLineHeight:()=>this.#t.lineHeight,getOverlayElement:()=>this.#k,getGutterWidth:()=>this.#Et(),getCharX:(e,t)=>this.#kt(e,t),getLineY:e=>this.#Ot(e),isMouseDown:()=>this.#q||this.#K}),this.#z.setMarkers(e,t),this.#O!==void 0&&this.#z.listenHover(this.#O),this.#nt(this.#$??[])}focus(e){let t=e?.preventScroll??!1,n=this.#$?.at(-1);if(n!==void 0){let e=n.direction===-1?n.end:n.start;this.#Ve(e,t)}else this.#Ve(void 0,t)}blur(){this.#O?.blur()}cleanUp(e=!1){let t=this.#le;this.#l++,this.#fe(),this.#u=t,_e(this.#Oe),this.#n?.cleanUp(),this.#n=void 0,e||(this.#I=void 0,this.#P=void 0),this.#f?.forEach(e=>e()),this.#f=void 0,this.#d?.forEach(e=>e()),this.#d=void 0,this.#p?.forEach(e=>e()),this.#p=void 0,this.#m?.(e),this.#m=void 0,this.#g=void 0,this.#_=void 0,this.#v.clear(),this.#y.clear(),this.#b.clear(),this.#x=void 0,this.#S?.remove(),this.#S=void 0,this.#C?.remove(),this.#C=void 0,this.#w?.remove(),this.#w=void 0,this.#T?.remove(),this.#T=void 0,this.#E=void 0,this.#r?.cleanUp(),this.#r=void 0,this.#D=void 0,this.#O?.removeAttribute(`contentEditable`),this.#O=void 0,this.#W=!1,this.#k?.remove(),this.#k=void 0,this.#M?.disconnect(),this.#M=void 0,this.#oe=!1,this.#se!==void 0&&(cancelAnimationFrame(this.#se),this.#se=void 0),this.#we()}__prepareFile(e){if(this.#e.persistState!==!0)return e;let t=Pa(e),n=this.#P,r=e.lang??oe(e.name);n!==void 0&&(Pa(n)!==t||n.name!==e.name||this.#I?.languageId!==r)&&(this.#l++,this.#fe());let i=this.#ue(e,t);return i===void 0||i.getText()===e.contents?e:{...e,contents:i.getText()}}__postponeBgTokenizeToNextFrame(){let e=this.#n;e!==void 0&&(e.pauseBackgroundTokenize(),requestAnimationFrame(()=>{e.resumeBackgroundTokenize()}))}__syncRenderView=(e,t,n,r,i)=>{let a=t.shadowRoot;if(a==null){console.error(`[editor] Could not find the shadow root.`);return}let o,s,c;for(let e of a.querySelectorAll(`[data-code]`))if(e.dataset.deletions===void 0){o=e;for(let t of e.children){let e=t,{gutter:n,content:r}=e.dataset;n===void 0?r!==void 0&&(c=e):s=e}break}if(o===void 0||c===void 0)return;this.#Se().setViewportElements(t,o),this.#E!==t&&(this.#E=t,this.#S!==void 0&&t.appendChild(this.#S),this.#C!==void 0&&a.appendChild(this.#C),this.#w!==void 0&&a.appendChild(this.#w),this.#T!==void 0&&a.prepend(this.#T));let l=this.#I===void 0||this.#P===void 0||this.#P.name!==n.name||this.#P.lang!==n.lang||this.#P.cacheKey!==n.cacheKey,u=this.#le?Pa(n):void 0,d;if(l){let e=``;e=`contents`in n?n.contents:n.additionLines.join(``);let t=new Xt({maxEntries:this.#e.historyMaxEntries}),{name:r,lang:i,cacheKey:a}=n,o=i??oe(n.name),s=(u===void 0?void 0:this.#ue(n,u))??new On(n.name,e,o,0,t);this.#P={name:r,lang:i,cacheKey:a},this.#I=s,u!==void 0&&(this.#i.set(u,s),d={cacheKey:u,textDocument:s}),this.#n?.cleanUp(),this.#n=void 0,this.#we(),this.#$=this.#Q,requestAnimationFrame(()=>{this.#e.onAttach?.(this,this.#N)}),this.#I!==void 0&&this.#e.__debug===!0&&console.log(`[diffs/editor] text document rebuilt from`,n.name)}d===void 0&&this.#u&&u!==void 0&&this.#I!==void 0&&(d={cacheKey:u,textDocument:this.#I});let f=this.#I;if(this.#n==null&&f!=null&&(this.#n=new ka({highlighter:e,textDocument:f,codeOptions:this.#N?.options??{},matchBrackets:this.#e.matchBrackets,onDeferTokenize:this.#ce,onThemeChange:()=>this.#tt(),setStyle:e=>{this.#w.textContent=e},__debug:this.#e.__debug})),this.#O!==c&&(this.#D=s,this.#O=Zn(c,{contentEditable:`true`,role:`textbox`,ariaMultiLine:`true`,autocapitalize:`off`,writingSuggestions:`off`,autocorrect:!1,spellcheck:!1,translate:!1}),this.#k!==void 0&&c.after(this.#k),this.#t.init(c),this.#Re(),this.#De(c,s),this.#O!==void 0&&this.#e.__debug===!0&&console.log(`[diffs/editor] full re-render triggered !!!`)),c.ariaLabel!==n.name&&(c.ariaLabel=n.name),r!==void 0&&r.length>0||this.#be)for(let e of this.#O.children){let t=e,{lineAnnotation:n,lineType:r,separator:i}=t.dataset;(n!==void 0||i!==void 0||r===`change-deletion`)&&t.setAttribute(`contenteditable`,`false`)}if(this.#Ce(),this.#n?.syncTheme(this.#N?.options??{}),this.#F=r,this.#L=i,this.#R=i?.totalLines,this.#n?.prebuildStateStack(i),this.#z?.removePopup(),(this.#$!==void 0||this.#ee!==void 0||this.#z!==void 0)&&this.#nt(this.#$??[]),this.#Q!==void 0&&this.#j!==void 0?(this.#Q=void 0,this.#Ue(!1,`center`)):this.#te===void 0?this.#$!==void 0&&this.#$.length>0&&!this.#ae&&this.focus({preventScroll:!0}):this.#Ge(this.#te,this.#ne,this.#ie),this.#ae&&this.#B?.focus(),this.#e.__debug===!0&&i!==void 0){let{startingLine:e,totalLines:t}=i;console.log(`[diffs/editor] render file:`,n.name,`RenderRange:`,e+`-`+(e+t),`of`,this.#I?.lineCount,`lines`)}d!==void 0&&(this.#u=!1,this.#he(d.cacheKey,d.textDocument))};get#le(){return this.#e.persistState===!0&&this.#N?.type===`file`}#ue(e,t){let n=this.#i.get(t),r=e.lang??oe(e.name);return n?.languageId===r?n:void 0}#de(){let e=this.#e.persistStateStorage??`inMemory`;return(this.#a===void 0||this.#o!==e)&&(this.#a=pa(e),this.#o=e),this.#a}#fe(){let e=this.#P,t=this.#I;if(!this.#le||e===void 0||t===void 0)return;let n=Pa(e);this.#i.set(n,t);let r;try{r=this.#de()}catch{return}let i=fa(this.getState()),a=this.#c;if(a?.cacheKey===n&&a.textDocument===t){if(this.#c=void 0,t.version===a.documentVersion&&this.#$===a.selections&&i.view?.scrollLeft===a.view?.scrollLeft&&i.view?.scrollTop===a.view?.scrollTop)return;this.#pe(r,n,i,a.completion);return}this.#pe(r,n,i)}#pe(e,t,n,r){let i=this.#s.get(t);if(r!==void 0||i!==void 0){let a=r??Promise.resolve();i!==void 0&&(a=a.then(()=>i)),this.#me(t,a.then(()=>e.set(t,n)));return}let a;try{a=e.set(t,n)}catch{return}Fa(a)&&this.#me(t,a)}#me(e,t){let n=t.catch(()=>{});this.#s.set(e,n),n.finally(()=>{this.#s.get(e)===n&&this.#s.delete(e)})}#he(e,t){let n=++this.#l,r=t.version,i=this.#$,a=this.getState().view,o=o=>{let s=this.getState().view;o===void 0||n!==this.#l||this.#I!==t||t.version!==r||this.#$!==i||s?.scrollLeft!==a?.scrollLeft||s?.scrollTop!==a?.scrollTop||this.#P===void 0||Pa(this.#P)!==e||this.setState(fa(o))},s=()=>{let t;try{t=this.#de().get(e)}catch{return}if(Fa(t))return t.then(o).catch(()=>{});try{o(t)}catch{}},c=this.#s.get(e),l=c===void 0?s():c.then(s);if(Fa(l)){let n={cacheKey:e,textDocument:t,documentVersion:r,selections:i,view:a,completion:l.catch(()=>{})};this.#c=n,n.completion.finally(()=>{this.#c===n&&(this.#c=void 0)})}}#ge(e){return this.#N?.isLineRenderable?.(e+1)??!0}get#_e(){let e=this.#N;if(e?.getNearestRenderableLine!=null)return(t,n)=>{let r=e.getNearestRenderableLine(t+1,n);return r==null?void 0:r-1}}#ve(e){this.#ge(e)||this.#N?.revealLine?.(e+1)}get#ye(){return this.#N?.options.diffStyle??`split`}get#be(){return this.#N?.type===`file-diff`}get#xe(){return this.#N?.options.overflow===`wrap`}#Se(){return this.#r??=new _r({hasActivePopover:()=>this.#V!==void 0||this.#z?.isPopupVisible()===!0,updateActivePopover:()=>{this.#ct(),this.#z?.updatePopupPosition()}})}#Ce(){this.#v.clear(),this.#y.clear(),this.#b.clear(),this.#x=void 0}#we(){this.#et(null),this.#g=void 0,this.#_=void 0,this.#H=!1,this.#A?.forEach(e=>e.remove()),this.#A=void 0,this.#$=void 0,this.#Z=void 0,this.#te=void 0,this.#z?.cleanup(),this.#z=void 0,this.#B?.cleanup(),this.#B=void 0,this.#V?.cleanup(),this.#V=void 0}#Te(){this.#S=U(`style`,{dataset:`editorGlobalCss`,textContent:`
|
|
502
502
|
[data-annotation-slot] {
|
|
503
503
|
user-select: none;
|
|
504
504
|
-webkit-user-select: none;
|
|
@@ -2176,7 +2176,7 @@ import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./index-DrITfTB
|
|
|
2176
2176
|
}`}function so(e){return`${ao}
|
|
2177
2177
|
@layer unsafe {
|
|
2178
2178
|
${e}
|
|
2179
|
-
}`}var co=new WeakMap;function lo(e){let t=co.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(Ua,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),co.set(e,i),i}function uo(e,t){if(!e.isConnected)return;let n=lo(t);if(n==null)return;let r=t.querySelector(`style[${Wa}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(Wa,``),t.appendChild(i)),i.textContent=`:host { ${Ga}: ${n}px; }`}var fo;function po(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){fo??(fo=new CSSStyleSheet,fo.replaceSync(oo(io)));let t=!1;try{e.adoptedStyleSheets=[fo],t=!0}catch{}if(t){e.querySelector(`style[${Va}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(Va,``),t.textContent=oo(io),e.prepend(t)}}function mo(e,t){ho(e,t),po(t),uo(e,t)}function ho(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});mo(this,e)}}if(customElements.define(Ba,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(Ba)))e instanceof HTMLElement&&mo(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var go=5,_o=1<<go,vo=_o*4;function yo(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function bo(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function xo(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function So(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function Co(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function wo(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function To(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,ko(e,t)}function Eo(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=So(e).get(t);if(i===void 0)return;let a=i>>go;e.childVisibleChunkSums[a]+=r}function Do(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=Ao(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=_o}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function Oo(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>go;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<go}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function ko(e,t){if(t.childIds.length<vo){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/_o),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>go]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function Ao(e,t,n,r){let i=Math.min(t.childIds.length,n+_o),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var jo=7,Mo=3,No=1<<Mo,Po=4;function Fo(e,t,n=0){return e<<Po|n<<Mo|t}function Io(e){return e.depthAndFlags>>>Po}function Lo(e){return(e.depthAndFlags&No)>>Mo}function K(e){return(e.depthAndFlags&No)!==0}function Ro(e){return e.depthAndFlags&jo}function zo(e,t){return(Ro(e)&t)!==0}function Bo(e,t){e.depthAndFlags|=t}function Vo(e,t){e.depthAndFlags=Fo(t,Ro(e),Lo(e))}var Ho=Symbol(`benchmarkInstrumentation`);function Uo(e,t){return t==null||Object.defineProperty(e,Ho,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Wo(e){return e==null?null:e[Ho]??null}function q(e,t,n){return e==null?n():e.measurePhase(t,n)}function Go(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Ko(e){return e>=48&&e<=57}function qo(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Ko(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&Ko(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function Jo(e){let t=e.toLowerCase();return{lowerValue:t,tokens:qo(t)}}function Yo(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function Xo(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=Yo(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Zo(e,t,n){let r=Xo(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Qo(e,t){return Zo(e,t,Jo)}function $o(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function es(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=$o(e,r);return a===$o(t,r)?Qo(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function ts(e,t){return es(e,t)}function ns(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Jo(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=$o(e,n);return o===$o(t,n)?Zo(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function rs(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Jo(r);return e.sortKeyById[t]=i,i}function is(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function as(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function os(e){let{hasTrailingSlash:t,segments:n}=as(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function ss(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=as(e);return{requiresDirectory:t,segments:n}}var cs=``;function ls(){let e=new Map;return e.set(cs,0),{idByValue:e,valueById:[cs],sortKeyById:[Jo(cs)]}}function us(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function ds(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var fs=Symbol(`pathStorePreparedInputKind`);function ps(e,t){return e[fs]=t,e}function ms(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function hs(e,t,n){return n==="default"?ts(e,t):n(ms(e),ms(t))}function gs(){return{depthAndFlags:Fo(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function _s(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function vs(e){return e.isDirectory?e.segments.length:e.segments.length-1}function ys(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function bs(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function xs(e,t={}){return Ds(e,t).map(e=>e.path)}function Ss(e,t={}){let n=Ds(e,t);return ps({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function Cs(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return ps({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function ws(e){let t=e,n=t.preparedPaths;if(t[fs]===`prepared`&&n!=null)return n;if(!ys(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function Ts(e){let t=e;return t[fs]===`presorted`&&t.presortedPaths!=null||bs(t.presortedPaths)?t.presortedPaths:null}function Es(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function Ds(e,t={}){let n=is(t),r=Wo(t);Go(r,`workload.inputFiles`,e.length);let i=q(r,`store.preparePathEntries.parse`,()=>e.map(e=>os(e)));return q(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>hs(e,t,n.sort))),i}var Os=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[gs()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=ls();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Wo(e),this.options=is(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,yo())}appendPaths(e){return q(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>os(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,q(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return q(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:Fo(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:Fo(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:Fo(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=os(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:Fo(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:Fo(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=os(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(q(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||q(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?ns(this.lastPreparedPath,e,this.segmentSortKeyCache):hs(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=vs(e),i=n==null?0:vs(n),a=n==null?0:_s(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=us(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:Fo(Io(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),Co(i,s),s}createFileChildUnchecked(e,t){let n=us(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Fo(Io(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Co(r,a),a}getOrCreateDirectoryChild(e,t){let n=us(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!K(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Fo(Io(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Co(r,a),this.directories.set(a,yo()),a}createDirectoryChild(e,t){let n=us(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Fo(Io(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Co(r,a),this.directories.set(a,yo()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!K(n))throw Error(`Path is not a directory: "${t}"`);if(zo(n,1))throw Error(`Duplicate path: "${t}"`);Bo(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,bo());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(K(a)){let t=bo();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;K(n)&&this.directories.set(t,yo());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),Co(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!K(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return To(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function ks(e,t=`closed`,n=null){let r=js(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function As(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function js(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function Ms(e,t){return zo(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:Io(t)<=e.defaultExpansion}function Ns(e,t,n=e.snapshot.nodes[t]){return n==null||!K(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:Ms(e,n)}function Ps(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!K(r))return;let i=Ms(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function Fs(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function Is(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function Ls(e,t){let n=Fs(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function Rs(e,t){let n=Fs(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function zs(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function Bs(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function Vs(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function Hs(e,t){e.directoryLoadInfoById.delete(t)}function Us(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function Ws(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Gs(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function Ks(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function qs(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Js(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Ys(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Xs(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function Zs(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Qs(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function $s(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function ec(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function tc(e,t,n){return{...n,visibleCountDelta:fc(e)-t}}function nc(e,t){let n=fc(e),r=As();e.transactionStack.push(r);try{t()}catch(t){throw ac(e,r,!1),t}ac(e,r,!0,fc(e)-n)}function rc(e,t){let n=e.instrumentation;if(n==null){ic(e,t);return}q(n,`store.events.record`,()=>ic(e,t))}function ic(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){uc(e,t);return}n.events.push(t),lc(n,t)}function ac(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?cc(i,t):q(n,`store.events.batch.merge`,()=>cc(i,t));return}let a=oc(t,r),o=e.instrumentation;if(o==null){uc(e,a);return}q(o,`store.events.batch.commit`,()=>uc(e,a))}function oc(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function sc(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function cc(e,t){for(let n of t.events)e.events.push(n);sc(e,t)}function lc(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function uc(e,t){let n=e.instrumentation;if(n==null){dc(e,t);return}q(n,`store.events.emit`,()=>dc(e,t))}function dc(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function fc(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function pc(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!K(n)||zo(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!K(a)?null:i}function mc(e,t){let n=t;for(;;){let t=pc(e,n);if(t==null)return n;n=t}}function hc(e,t){let n=[t],r=t;for(;;){let t=pc(e,r);if(t==null)return n;n.push(t),r=t}}function gc(e,t){let n=t==null?e.snapshot.rootId:Tc(e,t);return n==null?[]:Dc(e,n)}function _c(e,t){let n=os(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Hc(e,Vc(e,r)),{createdNodeIds:a,directoryId:o}=Oc(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=X(e,o);if(zo(n,1))throw Error(`Path already exists: "${t}"`);Bo(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=Ac(e,o,n.basename),s.add(c);Sc(e,o);let l=Hc(e,o);return Ws({affectedAncestorIds:wc(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Uc(i,l)})}function vc(e,t,n){let r=Tc(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=X(e,r);if(zo(i,2))throw Error(`The root node cannot be removed`);if(K(i)&&Y(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Hc(e,a),s=zc(e,r);Nc(e,a,r,i.nameId),Bc(e,a),Sc(e,a);let c=Hc(e,a);return Gs({affectedAncestorIds:wc(e,a),affectedNodeIds:s,path:t,projectionChanged:Uc(o,c),recursive:n.recursive===!0})}function yc(e,t,n,r){let i=Tc(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=X(e,i);if(zo(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=Lc(e,i,n),c=Hc(e,a.parentId),l=Hc(e,s.parentId),u=ds(e.snapshot.segmentTable,a.nameId),d=us(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(K(a)&&qc(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=xo(e.snapshot.nodes,Y(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Rc(e,p,o,Lo(a))===`skip`)return null;let m=a.parentId;Nc(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Kc(e,i),Mc(e,s.parentId,i),Bc(e,m),e.pathCacheVersion++,Sc(e,m),s.parentId!==m&&Sc(e,s.parentId);let h=Hc(e,m),g=Hc(e,s.parentId);return Ks({affectedAncestorIds:[...new Set([...wc(e,m),...wc(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:Wc([c,l],[h,g]),to:J(e,i)})}function bc(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function xc(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function J(e,t){let n=X(e,t),r=bc(e,t);if(r!=null)return r;if(zo(n,2))return xc(e,t,``);let i=J(e,n.parentId),a=ds(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return xc(e,t,K(n)?`${o}/`:o)}function Sc(e,t){let n=e.instrumentation;if(n==null){Yc(e,t);return}q(n,`store.recomputeCountsUpwardFrom`,()=>Yc(e,t))}function Cc(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!K(o)){Jc(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Jc(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function wc(e,t){let n=[],r=t;for(;r!=null;){let t=X(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function Tc(e,t){if(t.length===0)return e.snapshot.rootId;let n=ss(t);return Ec(e,n.segments,n.requiresDirectory)}function Ec(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=Y(e,r),a=xo(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=X(e,r);return n&&!K(i)?null:r}function Y(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function X(e,t){let n=e.snapshot.nodes[t];if(n===void 0||zo(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function Dc(e,t){let n=e.snapshot.nodes[t];if(n===void 0||zo(n,4))return[];if(!K(n))return[J(e,t)];if(Y(e,t).childIds.length===0)return zo(n,1)&&!zo(n,2)?[J(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||zo(n,4)){i.pop();continue}if(!K(n)){r.push(J(e,t.nodeId)),i.pop();continue}let a=Y(e,t.nodeId);if(a.childIds.length===0){zo(n,1)&&!zo(n,2)&&r.push(J(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function Oc(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=us(e.snapshot.segmentTable,i),a=Y(e,r),o=xo(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!K(X(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=kc(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function kc(e,t,n){let r=X(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Fo(Io(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,yo()),Mc(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function Ac(e,t,n){let r=us(e.snapshot.segmentTable,n),i=Y(e,t);if(xo(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${Zc(e,t,n)}"`);let a=X(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Fo(Io(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),Mc(e,t,o),e.activeNodeCount++,o}function jc(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}Pc(e,n,o)<0?i=a:r=a+1}return r}function Mc(e,t,n){let r=Y(e,t),i=X(e,n);xo(e.snapshot.nodes,r).set(i.nameId,n),Eo(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=jc(e,r,n);r.childIds.splice(a,0,n),wo(r,a),ko(e.snapshot.nodes,r)}function Nc(e,t,n,r){let i=Y(e,t),a=So(i),o=a.get(n)??-1;xo(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Eo(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),wo(i,o),ko(e.snapshot.nodes,i))}function Pc(e,t,n){let r=e.snapshot.options.sort;return r==="default"?Fc(e,t,n):r(Ic(e,t),Ic(e,n))}function Fc(e,t,n){let r=X(e,t),i=X(e,n),a=K(r);if(a!==K(i))return a?-1:1;let o=Xo(rs(e.snapshot.segmentTable,r.nameId),rs(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=ds(e.snapshot.segmentTable,r.nameId),c=ds(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function Ic(e,t){let n=X(e,t),r=J(e,t),i=K(n),a=i?r.slice(0,-1):r;return{basename:ds(e.snapshot.segmentTable,n.nameId),depth:Io(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function Lc(e,t,n){let r=X(e,t),i=Tc(e,n);if(i!=null){let t=X(e,i);if(K(t))return{basename:ds(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=ss(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=ss(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:Ec(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Rc(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${J(e,t)}"`);let i=X(e,t);if(Lo(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(K(i)&&Y(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return zc(e,t),Nc(e,a,t,o),Bc(e,a),Sc(e,a),`handled`}function zc(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=X(e,t.nodeId);if(t.visitedChildren||!K(i)){K(i)&&e.snapshot.directories.delete(t.nodeId),Bo(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Hs(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=Y(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function Bc(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!K(t)||zo(t,2)||Y(e,n).childIds.length>0)return;Bo(t,1),n=t.parentId===n?null:t.parentId}}function Vc(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=xo(e.snapshot.nodes,Y(e,n)).get(t);if(i==null||!K(X(e,i)))break;n=i}return n}function Hc(e,t){let n=Gc(e,t);if(n==null)return null;let r=mc(e,n),i=X(e,r),a=n===r?null:hc(e,n).map(t=>J(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:Y(e,r).childIds.length>0,path:J(e,r),terminalKind:Lo(i)})}function Uc(e,t){return Wc([e],[t])}function Wc(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function Gc(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!K(t)||zo(t,2))return null;if(!Ns(e,n,t))return n;n=t.parentId}return null}function Kc(e,t){let n=X(e,t);if(Vo(n,(t===e.snapshot.rootId?-1:Io(X(e,n.parentId)))+1),!K(n))return;let r=Y(e,t);for(let t of r.childIds)Kc(e,t)}function qc(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=X(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Jc(e,t,n=X(e,t),r=!1){let i=e.instrumentation;if(i==null){Xc(e,t,n,r);return}q(i,`store.recomputeNodeCounts`,()=>Xc(e,t,n,r))}function Yc(e,t){let n=t;for(;n!=null;){let t=X(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Jc(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Eo(Y(e,s),n,a,o),n=s}}function Xc(e,t,n,r){if(!K(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=Y(e,t);if(r){let t=e.instrumentation;t==null?To(e.snapshot.nodes,i):q(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>To(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,zo(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=pc(e,t)==null?Ns(e,t,n)?1+o:1:o}function Zc(e,t,n){let r=J(e,t);return r.length===0?n:`${r}${n}`}function Qc(e){return e!=null&&!zo(e,4)}function $c(e,t){let n=e.snapshot.nodes[t];return!Qc(n)||!K(n)||zo(n,2)?null:n}function el(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Qc(e.snapshot.nodes[n])&&(t+=1);return t}function tl(e){return Math.max(0,e.valueById.length-1)}function nl(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:el(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:tl(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function rl(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function il(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)$c(e,n)!=null&&t.push(J(e,n));for(let t of e.expandedDirectoryIds)$c(e,t)!=null&&n.push(J(e,t));return{collapsedPaths:t,expandedPaths:n}}function al(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)$c(e,n)==null||Is(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:J(e,n)});return t}function ol(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=Tc(e,n);t!=null&&Ps(e,t,!0,X(e,t))}for(let n of t.collapsedPaths){let t=Tc(e,n);t!=null&&Ps(e,t,!1,X(e,t))}}function sl(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=Tc(e,n.path);t!=null&&$c(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function cl(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function ll(e){let t=e.snapshot.segmentTable,n=ls();for(let r of e.snapshot.nodes)if(Qc(r)){if(zo(r,2)){r.nameId=0;continue}r.nameId=us(n,ds(t,r.nameId))}e.snapshot.segmentTable=n}function ul(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Qc(r)||!K(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Qc(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[X(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),To(e.snapshot.nodes,n)}}function dl(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Qc(n))break;--t}e.snapshot.nodes.length=t+1}function fl(e){let t=il(e),n=al(e);q(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>cl(e)),q(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>ll(e)),q(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>ul(e)),q(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>dl(e)),q(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>ol(e,t)),q(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>sl(e,n)),q(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>Cc(e,e.snapshot.rootId))}function pl(e){let t=il(e),n=al(e),r=q(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>gc(e)),i=Uo({...e.snapshot.options},e.instrumentation),a=q(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new Os(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,q(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>ol(e,t)),q(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>sl(e,n)),q(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>Cc(e,e.snapshot.rootId))}function ml(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function hl(e,t){let n=nl(e);t===`stable`?q(e.instrumentation,`store.cleanup.stable`,()=>fl(e)):q(e.instrumentation,`store.cleanup.aggressive`,()=>pl(e));let r=nl(e);return rl(t,t===`stable`,n,r)}var gl=64;function _l(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function vl(e){return X(e,e.snapshot.rootId).visibleSubtreeCount}function yl(e,t,n,r){let i=X(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function bl(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:zl(e,t.cursor),setSize:t.setSize,subtreeEndIndex:yl(e,t.cursor,t.index,n)}}function xl(e,t,n,r,i,a){let o=Y(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=Do(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return Sl(e,u,l,r+c,i+1,s,o.childIds.length,a)}function Sl(e,t,n,r,i,a,o,s){if(!K(X(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=Nl(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=X(e,c.terminalNodeId);if(!K(l)||!Ns(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return xl(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function Cl(e,t){let n=vl(e);if(t<0||t>=n)return null;let r=xl(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>J(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=bl(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:zl(e,r.cursor),setSize:r.setSize,subtreeEndIndex:yl(e,r.cursor,r.index,n)}}function wl(e,t,n){let r=e.instrumentation,i=vl(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return Rl(e,o+1);let t=[],n=Al(e,a);for(let r=a;r<=o&&n!=null;r++){let r=zl(e,n);t.push(r),n=Fl(e,n)}return t}let s=[],c=0,l=0,u=q(r,`store.getVisibleSlice.selectFirstRow`,()=>Al(e,a));for(let t=a;t<=o&&u!=null;t++){let t=q(r,`store.getVisibleSlice.materializeRow`,()=>zl(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=q(r,`store.getVisibleSlice.advanceCursor`,()=>Fl(e,u))}return Go(r,`workload.visibleRowsRead`,s.length),Go(r,`workload.flattenedRowsRead`,c),Go(r,`workload.flattenedSegmentsRead`,l),s}function Tl(e,t=vl(e)){let n=e.instrumentation;return n==null?Ll(e,t):q(n,`store.getVisibleTreeProjection`,()=>Ll(e,t))}function El(e){return Il(Tl(e))}function Dl(e,t){let n=Tc(e,t);if(n==null||n===e.snapshot.rootId||K(X(e,n))&&mc(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=X(e,i).parentId,n=Y(e,t),s=So(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=Oo(a,n,s),t!==o){let n=X(e,t),a=pc(e,t);if(!Ns(e,t,n)&&a!==i)return null;mc(e,t)===t&&(r+=1)}i=t}return r}function Ol(e,t){let n=Tc(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!K(r))throw Error(`Path is not a directory: "${t}"`);return Ns(e,n,r)?null:(Ps(e,n,!0,r),Sc(e,n),qs({affectedAncestorIds:wc(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function kl(e,t){let n=Tc(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!K(r))throw Error(`Path is not a directory: "${t}"`);return Ns(e,n,r)?(Ps(e,n,!1,r),Sc(e,n),Js({affectedAncestorIds:wc(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function Al(e,t){return t<0||t>=vl(e)?null:jl(e,e.snapshot.rootId,t,-1)}function jl(e,t,n,r){let i=Y(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?Do(e.snapshot.nodes,i,n):q(a,`store.getVisibleSlice.selectChildIndex`,()=>Do(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return Ml(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function Ml(e,t,n,r){if(!K(X(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=Nl(e,t,r);if(n===0)return i;let a=X(e,i.terminalNodeId);if(!K(a)||!Ns(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return jl(e,i.terminalNodeId,n-1,i.visibleDepth)}function Nl(e,t,n){return K(X(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:mc(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:q(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>mc(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Pl(e,t){let n=X(e,t);if(!K(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:pc(e,r)!==t}function Fl(e,t){let n=X(e,t.terminalNodeId);if(K(n)){let r=Y(e,t.terminalNodeId);if(Ns(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:Ml(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=X(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=Y(e,n),o=So(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return Ml(e,s,0,i);Pl(e,r)&&i--,r=n}}function Il(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function Ll(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(gl);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=_l(o,y);let x,S=_;if(K(v))S=f?mc(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:J(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&K(C)&&Ns(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function Rl(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!K(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:J(e,f)};continue}let h=l?mc(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=zl(e,g);let _=i[h];_!=null&&K(_)&&Ns(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function zl(e,t){let n=X(e,t.terminalNodeId),r=K(n)?Bl(e,t):null,i=J(e,t.terminalNodeId),a=ds(e.snapshot.segmentTable,n.nameId),o=K(n)&&Y(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?hc(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:ds(e.snapshot.segmentTable,r.nameId),nodeId:n,path:J(e,n)}}):q(c,`store.getVisibleSlice.flatten.collectSegments`,()=>hc(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:ds(e.snapshot.segmentTable,r.nameId),nodeId:n,path:J(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:K(n)&&Ns(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:K(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Bl(e,t){if(t.headNodeId===t.terminalNodeId)return Is(e,t.terminalNodeId);let n=hc(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=Is(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function Vl(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!K(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&ko(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&K(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,ko(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Hl(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Ul=class e{#e;constructor(e={}){let t=Wo(e),n=q(t,`store.builder.create`,()=>new Os(e));if(e.preparedInput!=null){let t=Ts(e.preparedInput);t==null?n.appendPreparedPaths(ws(e.preparedInput),!1):n.appendPresortedPaths(t,Es(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(q(t,`store.preparePathEntries`,()=>Ds(r,e)))}let r=q(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=q(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=q(t,`store.state.create`,()=>ks(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:q(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Hl(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&q(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?q(t,`store.state.initializeOpenVisibleCounts`,()=>Vl(this.#e)):q(t,`store.state.recomputeCounts`,()=>Cc(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return xs(e,t)}static prepareInput(e,t={}){return Ss(e,t)}static preparePresortedInput(e){return Cs(e)}list(e){return q(this.#e.instrumentation,`store.list`,()=>gc(this.#e,e))}add(e){q(this.#e.instrumentation,`store.add`,()=>{let t=vl(this.#e);rc(this.#e,tc(this.#e,t,_c(this.#e,e)))})}remove(e,t={}){q(this.#e.instrumentation,`store.remove`,()=>{let n=vl(this.#e);rc(this.#e,tc(this.#e,n,vc(this.#e,e,t)))})}move(e,t,n={}){q(this.#e.instrumentation,`store.move`,()=>{let r=vl(this.#e),i=yc(this.#e,e,t,n);i!=null&&rc(this.#e,tc(this.#e,r,i))})}batch(e){nc(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return q(this.#e.instrumentation,`store.getVisibleCount`,()=>vl(this.#e))}getVisibleSlice(e,t){return q(this.#e.instrumentation,`store.getVisibleSlice`,()=>wl(this.#e,e,t))}getVisibleRowContext(e){return q(this.#e.instrumentation,`store.getVisibleRowContext`,()=>Cl(this.#e,e))}getVisibleTreeProjection(){return El(this.#e)}getVisibleTreeProjectionData(e){return Tl(this.#e,e)}getVisibleIndex(e){return q(this.#e.instrumentation,`store.getVisibleIndex`,()=>Dl(this.#e,e))}getPathInfo(e){return q(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=Tc(this.#e,e);if(t==null)return null;let n=X(this.#e,t);return{depth:Io(n),kind:K(n)?`directory`:`file`,path:J(this.#e,t)}})}isExpanded(e){return q(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=X(this.#e,t);return Ns(this.#e,t,n)})}expand(e){q(this.#e.instrumentation,`store.expand`,()=>{let t=vl(this.#e),n=Ol(this.#e,e);n!=null&&rc(this.#e,tc(this.#e,t,n))})}collapse(e){q(this.#e.instrumentation,`store.collapse`,()=>{let t=vl(this.#e),n=kl(this.#e,e);n!=null&&rc(this.#e,tc(this.#e,t,n))})}on(e,t){return Us(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return Is(this.#e,t)}markDirectoryUnloaded(e){q(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(Y(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=vl(this.#e);Rs(this.#e,t),rc(this.#e,tc(this.#e,n,Ys({affectedAncestorIds:wc(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return q(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=vl(this.#e),r=Ls(this.#e,t);return rc(this.#e,tc(this.#e,n,Xs({affectedAncestorIds:wc(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return q(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||Is(this.#e,n)!==`loading`||!Bs(this.#e,n,e.attemptId))return!1;let r=J(this.#e,n);this.validateChildPatch(r,t);let i=vl(this.#e),a=[];for(let e of t.operations){Wl(r,e);let t=vl(this.#e);switch(e.type){case`add`:a.push(tc(this.#e,t,_c(this.#e,e.path)));break;case`remove`:a.push(tc(this.#e,t,vc(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=yc(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(tc(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return rc(this.#e,tc(this.#e,i,Zs({affectedAncestorIds:wc(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:J(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return q(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=vl(this.#e),r=zs(this.#e,t,e.attemptId);return rc(this.#e,tc(this.#e,n,Qs({affectedAncestorIds:wc(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:J(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return q(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=vl(this.#e),i=Vs(this.#e,n,e.attemptId,t);return rc(this.#e,tc(this.#e,r,$s({affectedAncestorIds:wc(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:J(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return q(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(ml(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=vl(this.#e),n=hl(this.#e,e.mode??`stable`);return rc(this.#e,tc(this.#e,t,ec({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=Y(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Jo(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=Xo(rs(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!K(X(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=X(this.#e,n);Ns(this.#e,n,i)||(Ps(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=X(this.#e,e);if(!Ns(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=Tc(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!K(X(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!K(X(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=X(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=X(this.#e,e),r=pc(this.#e,e);if(!Ns(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function Wl(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var Gl=e=>e.startsWith(`f::`)?e.slice(3):e;function Kl(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function ql(e,t){return e===``?t:`${e}/${t}`}function Jl({files:e,path:t,isFolder:n,nextBasename:r}){let i=Gl(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=Kl(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=ql(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function Yl(e){return e.endsWith(`/`)}function Xl(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function Zl(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function Ql(e,t){return t.includes(e)?Zl(t):[e]}function $l(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function eu(e,t){return{draggedPaths:e,target:t}}function tu(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Yl(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function nu(e,t){return t.kind===`root`||t.directoryPath==null?Xl(e):t.directoryPath}function ru(e,t){let n=e.map(e=>{let n=nu(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function iu(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function au(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!iu(Ul.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function ou(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function su(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function cu(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function lu(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return cu(e,t.path)?n?e:null:e;case`move`:return su(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=lu(r,e,n),r==null)return null;return r}}}function uu(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function du(e){switch(e.operation){case`add`:return{...uu(e),operation:`add`,path:e.path};case`remove`:return{...uu(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...uu(e),from:e.from,operation:`move`,to:e.to}}}function fu(e){return{...uu(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>du(e)),operation:`batch`}}function pu(e){switch(e.operation){case`add`:case`remove`:case`move`:return du(e);case`batch`:return fu(e);default:return null}}function mu(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function hu(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function gu(e){return hu(e).at(-1)??null}function _u(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function vu(e){return e.endsWith(`/`)}var yu=e=>e.toLowerCase();function bu(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function xu(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Su(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var Cu=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},wu=Symbol(`FILE_TREE_RENAME_VIEW`),Tu=512,Eu=512;function Du(e){return e===`top`||e===`center`?e:`nearest`}function Ou(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=hu(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function ku(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:Ou(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var Au=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=au({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=gu(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:Du(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=Eu){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=Ql(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=eu(t.draggedPaths,n);(tu(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}$l(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=eu(e.draggedPaths,t);if(tu(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=ru(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=vu(r),a=xu(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of hu(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=bu(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[wu](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,vu(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,vu(e)?{recursive:!0}:void 0);return}let t=vu(e),n=Jl({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:xu(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(Su(n.sourcePath,t),Su(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=au({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!mu(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=gu(e),n=_u(e,t),r=null,i=null;for(let e of this.#be()){if(gu(e)!==t)continue;let a=_u(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=hu(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!mu(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new Ul({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of hu(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(yu),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(yu),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of hu(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:Cu(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of hu(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of hu(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=ku(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,Tu)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#De()))}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=lu(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=lu(this.#c,e,!0),r=[...this.#B].map(t=>lu(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=lu(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return mu(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&ou(e)&&(this.#i=null);let t=ou(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=pu(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},ju=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function Mu(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function Nu(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Pu(e,t){return t?`${e}/`:e}function Fu(e,t=null){let n=ju(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=Mu(t.path);if(e==null)continue;let n=Pu(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of Nu(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var Z,Iu,Lu,Ru,zu,Bu,Vu,Hu,Uu,Wu,Gu={},Ku=[],qu=Array.isArray,Ju=Ku.slice,Yu=Object.assign;function Xu(e){e&&e.parentNode&&e.remove()}function Zu(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?Ju.call(arguments,2):n),Qu(e,o,r,i,null)}function Qu(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Iu,__i:-1,__u:0};return i==null&&Z.vnode!=null&&Z.vnode(a),a}function $u(e){return e.children}function ed(e,t){this.props=e,this.context=t,this.__g=0}function td(e,t){if(t==null)return e.__?td(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?td(e):null}function nd(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return nd(e)}}function rd(e){(8&e.__g||!(e.__g|=8)||!Lu.push(e)||zu++)&&Ru==Z.debounceRendering||((Ru=Z.debounceRendering)||queueMicrotask)(id)}function id(){for(var e,t,n,r,i,a,o,s,c=1;Lu.length;)Lu.length>c&&Lu.sort(Bu),e=Lu.shift(),c=Lu.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=Yu({},r)).__v=r.__v+1,Z.vnode&&Z.vnode(n),fd(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??td(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,md(a,n,o),n.__e!=i&&nd(n)));zu=0}function ad(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||Ku,b=t.length;for(c=od(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?Gu:y[m.__i]||Gu,m.__i=f,_=fd(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&_d(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=sd(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function od(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?Qu(null,o,null,null,null):qu(o)?Qu($u,{children:o},null,null,null):o.constructor==null&&o.__b>0?Qu(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=cd(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=td(s)),vd(s,s));return r}function sd(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=sd(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=td(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function cd(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ld(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function ud(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ld(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ld(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(Vu,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=Hu,e.addEventListener(t,a?Wu:Uu,a)):e.removeEventListener(t,a?Wu:Uu,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function dd(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=Hu++;else if(t.u<n.l)return;return n(Z.event?Z.event(t):t)}}}function fd(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,ee,w,T,E,D,O,k,A,j=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=Z.__b)&&d(t);n:if(typeof j==`function`)try{if(v=t.props,y=`prototype`in j&&j.prototype.render,b=(d=j.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new j(v,x):(t.__c=f=new ed(v,x),f.constructor=j,f.render=yd),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&j.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Yu({},f.__s)),Yu(f.__s,j.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&j.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&j.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=Z.__r,ee=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),w=0;w<f._sb.length;w++)f.__h.push(f._sb[w]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++ee<25);f.state=f.__s,f.getChildContext!=null&&(r=Yu({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),T=d,d!=null&&d.type===$u&&d.key==null&&(T=hd(d.props.children)),s=ad(e,qu(T)?T:[T],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(E=0,D=!1,t.__u|=c?160:128,t.__c.__z=[],O=0;O<a.length;O++)(k=a[O])==null||D||(k.nodeType==8&&k.data==`$s`?(E>0&&t.__c.__z.push(k),E++,a[O]=null):k.nodeType==8&&k.data==`/$s`?(--E>0&&t.__c.__z.push(k),D=E===0,s=a[O],a[O]=null):E>0&&(t.__c.__z.push(k),a[O]=null));if(!D){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(A=a.length;A--;)Xu(a[A]);pd(t)}else t.__e=n.__e,t.__k=n.__k,e.then||pd(t);Z.__e(e,t,n)}else s=t.__e=gd(n.__e,t,n,r,i,a,o,c,l,u);return(d=Z.diffed)&&d(t),128&t.__u?void 0:s}function pd(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(pd)}function md(e,t,n){for(var r=0;r<n.length;r++)_d(n[r],n[++r],n[++r]);Z.__c&&Z.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Z.__e(e,t.__v)}})}function hd(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:qu(e)?e.map(hd):Yu({},e)}function gd(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(Z.__m&&Z.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=Ju.call(e.childNodes),v=n.props||Gu,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;ud(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||ud(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),ad(b==`template`?e.content:e,qu(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&td(n,0),s,c,l),a!=null)for(u=a.length;u--;)Xu(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||ud(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&ud(e,u,g,v[u],i))}return e}function _d(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){Z.__e(e,n)}}function vd(e,t,n){var r,i;if(Z.unmount&&Z.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||_d(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Z.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&vd(r[i],t,n||typeof e.type!=`function`);n||Xu(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function yd(e,t,n){return this.constructor(e,n)}function bd(e,t){var n,r,i,a;t==document&&(t=document.documentElement),Z.__&&Z.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=Zu($u,null,[e]),i=[],a=[],fd(t,e,r||Gu,Gu,t.namespaceURI,r?null:t.firstChild?Ju.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),md(i,e,a)}function xd(e,t){e.__u|=32,bd(e,t)}Z={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw zu=0,e}},Iu=0,ed.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Yu({},this.state);typeof e==`function`&&(e=e(Yu({},n),this.props)),e&&Yu(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),rd(this))},ed.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),rd(this))},ed.prototype.render=$u,Lu=[],zu=0,Bu=function(e,t){return e.__v.__b-t.__v.__b},Vu=/(PointerCapture)$|Capture$/i,Hu=0,Uu=dd(!1),Wu=dd(!0);var Sd=0;Array.isArray;function Q(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Sd,__i:-1,__u:0,__source:i,__self:a};return Z.vnode&&Z.vnode(l),l}var Cd=16,wd=16,Td={};function Ed({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=Td[e]??{width:Cd,height:wd},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Q(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Q(`use`,{href:c})})}var Dd=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},Od=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},kd=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},Ad=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},jd=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},Md=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function Nd({children:e,marker:t,variant:n=`default`}){"use no memo";return Q(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Q(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Q(`span`,{"data-truncate-fade":!0}):t})})}function Pd(e){"use no memo";let{mode:t,children:n}=e;return Q(`div`,{children:[Q(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Q(`span`,{children:n}):n}),Q(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Q(`span`,{children:n}):n})]})}function Fd({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Q(Pd,{mode:t,children:e},`content`),o=Q(Nd,{marker:n,mode:t,variant:r},`marker`),s=Q(`div`,{"data-truncate-fill":!0},`fill`);return Q(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Q(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function Id({children:e,...t}){"use no memo";return Q(Fd,{mode:`truncate`,...t,children:e})}function Ld({children:e,...t}){"use no memo";return Q(Fd,{mode:`fruncate`,...t,children:e})}function Rd({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Q(Id,{...s,children:t[0]}),l=Q(Ld,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Q(`div`,{className:a,style:o});if(e.length<i)return Q(n===`end`?Ld:Id,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Dd:r===`extension`?t=Od:r===`leaf-path`&&(t=kd);else if(typeof r==`number`)t=Ad,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=jd:e===`first`&&(t=Md)}else typeof r==`function`&&(t=r);t??=Dd;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Q(Id,{...s,..._,children:f}),l=Q(Ld,{...s,...v,children:p})}return Q(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Q(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Q(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var zd={endIndex:-1,startIndex:-1};function Bd(e,t,n){return Math.min(Math.max(e,t),n)}function Vd(e,t){return e<0||t<e?zd:{endIndex:t,startIndex:e}}function Hd(e){return e.startIndex<0||e.endIndex<e.startIndex}function Ud(e,t){return Hd(e)?0:(e.endIndex-e.startIndex+1)*t}function Wd(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function Gd(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function Kd(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function qd(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function Jd(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function Yd(e,t,n){if(e.length===0||t<=0)return[];let r=Jd(e),i=Kd(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=qd(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function Xd(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=Bd(t.scrollTop,0,o),c=t.stickyRows??Yd(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=Wd(s,n,t.itemHeight),m=Wd(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?zd:Vd(m,Gd(u+d,n,t.itemHeight)),y=g+1,b=Hd(v)?zd:Vd(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=Ud(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:Hd(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var Zd={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},Qd={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},$d=`Contains git status items`;function ef(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function tf(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return ef({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function nf(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function rf(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function af(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function of(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function sf(e,t){return e!=null&&e>0?e:t}function cf(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function lf(e,t,n,r,i=0){let a=ef({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function uf(e,t,n,r,i,a,o=0){let s=tf({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function df(e,t,n,r,i,a){let o=nf({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function ff(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function pf(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function mf({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Q(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function hf(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function gf(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var _f,vf,yf,bf,xf=Object.is,Sf=0,Cf=[],wf=Z,Tf=wf.__b,Ef=wf.__r,Df=wf.diffed,Of=wf.__c,kf=wf.unmount,Af=wf.__;function jf(e,t){wf.__h&&wf.__h(vf,e,Sf||t),Sf=0;var n=vf.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Mf(e){return Sf=1,Nf(Wf,e)}function Nf(e,t,n){var r=jf(_f++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Wf(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);xf(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=vf,!vf.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,xf(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};vf.__f=!0;var a=vf.shouldComponentUpdate,o=vf.componentWillUpdate;vf.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},vf.shouldComponentUpdate=i}return r.__N||r.__}function Pf(e,t){var n=jf(_f++,3);!wf.__s&&Uf(n.__H,t)&&(n.__=e,n.u=t,vf.__H.__h.push(n))}function Ff(e,t){var n=jf(_f++,4);!wf.__s&&Uf(n.__H,t)&&(n.__=e,n.u=t,vf.__h.push(n))}function $(e){return Sf=5,If(function(){return{current:e}},[])}function If(e,t){var n=jf(_f++,7);return Uf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Lf(e,t){return Sf=8,If(function(){return e},t)}function Rf(){for(var e;e=Cf.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Vf),e.__H.__h.forEach(Hf),e.__H.__h=[]}catch(t){e.__H.__h=[],wf.__e(t,e.__v)}}wf.__b=function(e){vf=null,Tf&&Tf(e)},wf.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Af&&Af(e,t)},wf.__r=function(e){Ef&&Ef(e),_f=0;var t=(vf=e.__c).__H;t&&(yf===vf?(t.__h=[],vf.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(Vf),t.__h.forEach(Hf),t.__h=[],_f=0)),yf=vf},wf.diffed=function(e){Df&&Df(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Cf.push(t)!==1&&bf===wf.requestAnimationFrame||((bf=wf.requestAnimationFrame)||Bf)(Rf)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),yf=vf=null},wf.__c=function(e,t){t.some(function(e){try{e.__h.forEach(Vf),e.__h=e.__h.filter(function(e){return!e.__||Hf(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],wf.__e(n,e.__v)}}),Of&&Of(e,t)},wf.unmount=function(e){kf&&kf(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{Vf(e)}catch(e){t=e}}),n.__H=void 0,t&&wf.__e(t,n.__v))};var zf=typeof requestAnimationFrame==`function`;function Bf(e){var t,n=function(){clearTimeout(r),zf&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);zf&&(t=requestAnimationFrame(n))}function Vf(e){var t=vf,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),vf=t}function Hf(e){var t=vf;e.__c=e.__(),vf=t}function Uf(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!xf(t,e[n])})}function Wf(e,t){return typeof t==`function`?t(e):t}function Gf(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Q(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Q($u,{children:[Q(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Q(Id,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function Kf(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function qf(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function Jf(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function Yf({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=Xd(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:Jf(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?Jf(u,1,t,o):i&&r<=0&&c.length>0?Yd(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var Xf=400,Zf=10,Qf=40,$f=18;function ep(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?tp(e,t,n):a instanceof HTMLElement?a:null}function tp(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function np(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function rp(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function ip(){return navigator.vendor!==`Apple Computer, Inc.`}function ap(e,t){let n=e-t.top;if(n<Qf)return-Math.ceil((Qf-Math.max(0,n))/Qf*$f);let r=t.bottom-e;return r<Qf?Math.ceil((Qf-Math.max(0,r))/Qf*$f):0}function op(e,t){if(e!=null){let t=Zd[e];return t==null?null:{text:t,title:Qd[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:$d}:null}function sp(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function cp(e){return e!=null&&`toggle`in e}function lp(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function up(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function dp(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function fp(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function pp(e,t){return t&&fp(e)||(e.ctrlKey||e.metaKey)&&lp(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var mp=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function hp(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function gp(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function _p(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function vp(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function yp(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function bp(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function xp(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function Sp(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function Cp(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=Sp(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function wp(e,t){return{kind:e.kind,name:qf(e),path:t}}function Tp(e){return e==null?void 0:`${e}__tree`}function Ep(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function Dp(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Op(e,t){if(e==null)return null;if(`text`in e)return Q(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?Dp(e.icon)?t(e.icon):{name:e.icon}:Dp(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Q(`span`,{title:e.title,children:Q(Ed,{...n})})}function kp(e){e!=null&&rf(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function Ap(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=Kf(e);return Q($u,{children:[e.depth>0?Q(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Q(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Q(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Q(Ed,{...t(`file-tree-icon-chevron`)}):Q(Ed,{...t(`file-tree-icon-file`,u)})}),Q(`div`,{"data-item-section":`content`,children:e.isFlattened?Gf(e,c,a):c??Q(Rd,{minimumLength:5,split:`extension`,children:e.name})}),i?Q(`div`,{"data-item-section":`decoration`,children:r==null?null:Op(r,t)}):null,s?Q(`div`,{"data-item-section":`git`,children:Op(o,t)}):null,n?Q(`div`,{"data-item-section":`action`,children:l?Q(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Q(Ed,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function jp(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:ee,contextMenuButtonVisibility:w,contextMenuRightClickEnabled:T,registerRenameInput:E,registerButton:D,resolveIcon:O,renderDecorationForRow:k,openContextMenuForRow:A,onRowClick:j,onKeyDown:M}=e,N=Kf(t),{isParked:P=!1,mode:te=`flow`,style:ne}=r,re=te===`sticky`,ie=_?.get(N)??null??sp(t.ancestorPaths,v,y),ae=t.kind===`directory`&&(b?.has(N)??!1),oe=k(t,N),se=op(ie,ae),ce=S&&ee,le=oe!=null||x||ce,ue=ce&&w===`always`,de=a.getPath()===N,fe=de?a.getValue():``,pe=re||!de?null:Q(mf,{ref:E,ariaLabel:`Rename ${qf(t)}`,isFlattened:t.isFlattened,value:fe,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),me=Ap(t,O,{actionLaneEnabled:ce,customDecoration:oe,decorationLaneEnabled:le,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:se,gitLaneActive:x,renameInput:pe,showDecorativeActionAffordance:ue}),he={...hf({ariaLabel:qf(t),domId:t.isFocused?Ep(h,N,P):void 0,extraStyle:ne,features:{actionLaneEnabled:ce,contextMenuButtonVisibility:ce?w:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:P,itemHeight:g,mode:te,row:t,state:{containsGitChange:ae,effectiveGitStatus:ie,isContextHovered:s===N,isDragTarget:l?.kind===`directory`&&l.directoryPath===N,isDragging:c?.has(N)===!0,isFocusRinged:t.isFocused&&o===N},targetPath:N}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),T&&(i.focusMountedPathFromInput(N),A(t,N,{anchorRect:_p(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:re?void 0:()=>{i.focusMountedPathFromInput(N)},onKeyDown:re?void 0:M,ref:e=>{D(N,e)}};return!re&&de?Q(`div`,{...he,children:me}):Q(`button`,{...he,type:`button`,draggable:u&&!P,onDragEnd:u&&!P?p:void 0,onDragStart:u&&!P?e=>{f(e,t,N)}:void 0,onMouseDown:e=>{if(re){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!P?e=>{m(e,t,N)}:void 0,onClick:e=>{j(e,t,N,te)},children:me})}function Mp(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(Kf(e))).map((n,r)=>jp(e,n,t.start+r))}function Np({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=ro,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=$(null),v=$(null),y=$(!1),b=$(null),x=$(null),S=$(null),C=$(null),ee=$(null),w=$(new Map),T=$(new Map),E=$(()=>{}),D=$(null),O=$(0),k=$(!1),A=$(null);A.current!==t&&(k.current=!1,A.current=t);let j=$(!1),M=$(null),N=$(null),P=$(!1),te=$(null),ne=$(null),re=$(null),ie=$(null),ae=$(null),oe=$(null),se=$(null),ce=$(null),le=$(!1),ue=$(null),de=$(null),fe=$(null),pe=$(null),me=If(()=>new Map,[]),[,he]=Mf(0),[ge,F]=Mf(null),[_e,ve]=Mf(null),[ye,be]=Mf(null),[xe,Se]=Mf(null),[Ce,we]=Mf(0),[I,Te]=Mf(null),Ee=$(I);Ee.current=I;let De=$(null),Oe=$(null),ke=$(null),Ae=$(null),Me=$(null),Ne=$(!1),Pe=()=>{Oe.current=null,ke.current=null,Ae.current=null},Fe=(e,t)=>{Oe.current=e,ke.current=null,Ae.current=t==null?null:{path:e,scrollTop:t}},Ie=(e,t)=>{Oe.current=null,ke.current={path:e,viewportOffset:t},Ae.current=null},Le=$(d===`retain`&&t.isSearchOpen()),[Re,ze]=Mf(p);Pf(()=>{p||ze(!1)},[p]);let Be=$(!1),Ve=Lf(()=>{Be.current=!0,ze(e=>e&&!1)},[]),[He,Ue]=Mf(()=>Yf({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[L,We]=Mf(!1);Pf(()=>{We(!0)},[]);let Ge=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ke=e?.contextMenu?.triggerMode??(Ge?`right-click`:`both`),qe=Ke===`both`||Ke===`button`,Je=e?.contextMenu?.buttonVisibility??`when-needed`,Ye=Ke===`both`||Ke===`right-click`;Ff(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Me.current=t,ve(t),Se(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Ne.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Xe=Lf((e,t)=>{yp(w.current,e,t)},[]),Ze=Lf((e,t)=>{yp(T.current,e,t)},[]),Qe=Lf(e=>{x.current=e},[]),$e=Lf(e=>bp(e,T.current,w.current),[]),et=n!=null||r!=null||i!=null,{resolveIcon:tt}=If(()=>je(a),[a]),nt=t[wu](),rt=nt.getPath(),it=rt!=null,at=t.isSearchOpen(),ot=t.getSearchValue(),R=t.getFocusedPath(),z=t.getFocusedIndex(),st=t.getScrollRequest(),ct=t.isDragAndDropEnabled(),lt=t.getDragSession(),ut=If(()=>lt==null?null:new Set(lt.draggedPaths),[lt]),dt=lt?.target??null,ft=lt?.primaryPath??null,pt=Tp(o),{overlayHeight:mt,overlayRows:ht,snapshot:B,visibleRows:gt}=He,_t=B.physical.viewportHeight,V=If(()=>({end:B.window.endIndex,start:B.window.startIndex}),[B.window.endIndex,B.window.startIndex]),vt=ht,yt=B.sticky.rows,bt=B.physical.totalHeight,xt=B.sticky.height,St=If(()=>new Set(yt.map(e=>Kf(e.row))),[yt]),Ct=z>=0&&z>=V.start&&z<=V.end,wt=Lf((e,t)=>u?.({item:wp(e,t),row:e})??null,[u]),Tt=Lf(e=>rf(e==null?null:w.current.get(e)??null)?!0:rf(S.current),[]),Et=Lf(e=>{Tt(t.focusNearestPath(e))},[t,Tt]),Dt=$(Et);Dt.current=Et;let Ot=$(!0),kt=$(()=>{}),At=Lf((t=!0)=>{let n=Ee.current;n!=null&&(Ot.current=Ot.current&&t,Te(null),e?.contextMenu?.onClose?.(),Ot.current&&Et(n.path))},[e?.contextMenu,Et]);kt.current=At;let jt=Lf(e=>{let t=e==null?null:vp(S.current,e);be(e=>e===t?e:t)},[]),Mt=Lf((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=$e(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Fe(n,e?.scrollTop??null),j.current=!0,F(e=>e===n?e:n)}i.focus(),jt(a),Ot.current=!0,Te({anchorRect:r?.anchorRect??null,item:wp(e,n),path:n,source:r?.source??`keyboard`})},[t,$e,jt]),Nt=Lf(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=of(e,_t);te.current=z<0||e==null?null:Math.max(0,Math.min(z*s-e.scrollTop,Math.max(0,t-s))),P.current=!0}t.startRenaming(e)!==!1&&(Se(`focus`),he(e=>e+1))}},[t,z,s,l,_t]),Pt=Lf((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=of(i,_t),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:Yf({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return j.current=!0,df(i,a,s,l,u,d),E.current(),De.current=n?e:null,!0},[t,s,c,_t,h]),Ft=()=>y.current===!0||pe.current!=null||le.current===!0,It=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Lt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Rt=()=>{ie.current!=null&&(clearTimeout(ie.current),ie.current=null),re.current=null},zt=()=>{oe.current?.remove(),oe.current=null},Bt=()=>{Lt(ne.current),ne.current=null,ae.current=null},Vt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Ht=()=>{ce.current?.(),ce.current=null,pe.current!=null&&(clearTimeout(pe.current),pe.current=null),le.current=!1,ue.current=null,fe.current=null,de.current!=null&&(de.current.setAttribute(`draggable`,`true`),de.current.style.removeProperty(`touch-action`),de.current=null),zt(),Rt(),Bt(),se.current=null},H=(e,n)=>{let r=S.current?.getRootNode(),i=np(ep(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Ut=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Rt();return}let r=t.getItem(e.directoryPath),i=cp(r)?r:null;if(i==null||i.isExpanded()){Rt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;re.current!==a&&(Rt(),re.current=a,ie.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Wt=()=>{ne.current=null;let e=ae.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=ap(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,E.current()),Ut(H(e.clientX,e.clientY)),ne.current=It(Wt)},Gt=(e,t)=>{ae.current={clientX:e,clientY:t},ne.current??=It(Wt)},Kt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Ht(),zt(),Rt(),Bt(),t.startDrag(r)===!1){e.preventDefault();return}if(se.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),ip())){let t=rp(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Vt(t),oe.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},qt=()=>{zt(),Rt(),Bt(),se.current=null,t.cancelDrag()},Jt=(e,n,r)=>{if(pe.current!=null||le.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;fe.current={clientX:i.clientX,clientY:i.clientY},de.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!le.current;pe.current!=null&&(clearTimeout(pe.current),pe.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),ce.current===o&&(ce.current=null),t&&(a.setAttribute(`draggable`,`true`),de.current===a&&(de.current=null),fe.current=null)},s=e=>{let t=e.touches[0],n=fe.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=Zf*Zf||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),ce.current=o,pe.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),de.current===a&&(de.current=null),fe.current=null;return}le.current=!0,de.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),se.current=n;let e=a.getBoundingClientRect(),s=rp(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Vt(s),oe.current=s,ue.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=ue.current;n!=null&&oe.current!=null&&(oe.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Ut(H(t.clientX,t.clientY)),Gt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&H(n.clientX,n.clientY),t.completeDrag(),Ht()},u=()=>{t.cancelDrag(),Ht()};ce.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},Xf)},Yt=e=>{if(I!=null){if(e.key===`Escape`){At(),e.preventDefault(),e.stopPropagation();return}mp.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(nt.isActive()){if(e.key===`Escape`)nt.cancel();else if(e.key===`Enter`)nt.commit();else return;Se(`focus`),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Nt(R??void 0),e.preventDefault(),e.stopPropagation();return}if(at){if(e.key===`Escape`)P.current=!1,te.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=of(n,_t);te.current=z<0||n==null?null:Math.max(0,Math.min(z*s-n.scrollTop,Math.max(0,r-s))),P.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;Se(`focus`),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&up(e)){t.openSearch(e.key),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ge&&fp(e),r=pp(e,Ge),i=r&&S.current!=null?af(S.current):null,a=r?new Set(xp(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==R&&a.has(o)){let e=C.current;Fe(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=cp(p)?p:null,h=u!=null&&(St.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=bp(u,T.current,w.current);e==null||n==null?y=!1:Mt(e,u)}else if((e.ctrlKey||e.metaKey)&&lp(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;Se(`focus`);let b=t.getFocusedPath(),x=b!=null&&(St.has(b)||a.has(b)),ee=g&&b!==u,E=n&&c&&o===u&&b===u;if((h||E)&&b!=null&&(ee&&x||E))Fe(b,v?.scrollTop??null),j.current=!0,F(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Ie(b,Cp(S.current,v,i,u,s,xt,_t)),j.current=!0,F(e=>e===b?e:b)):Pe()}he(e=>e+1),e.preventDefault(),e.stopPropagation()};Ff(()=>{if(!(!f||!at)){if(Le.current){Le.current=!1;return}rf(ee.current)}},[at,f]),Ff(()=>{let e=x.current;switch(pf({hasRenderedInput:e!=null,previousRenamingPath:N.current,renamingPath:rt})){case`reset`:N.current=null;return;case`reveal-canonical`:rt!=null&&Pt(rt,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(De.current=null,N.current=rt,rf(e),e.select());return}},[V.end,V.start,rt,Pt,St]),Ff(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=af(e)?.dataset.itemPath??null;F(e=>e===t?e:t)},i=()=>{n(),j.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,af(e)!=null){r();return}j.current=!1,F(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),j.current=!1,F(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;F(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),Ff(()=>{let e=S.current;e!=null&&(B.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[B.physical.scrollTop]),Ff(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;D.current=of(n,g);let a=()=>{let e=t.getVisibleCount(),r=sf(D.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ue(Yf({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!k.current){k.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=sf(D.current,g),i=t.getVisibleRows(e,e)[0]??null;lf(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}E.current=a;let o=!1,l=t.subscribe(()=>{o?he(e=>e+1):o=!0,a()}),u=()=>{Ne.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,we(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||Ne.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),Ee.current!=null&&y.current&&kt.current(),Ne.current===!0){y.current=!1;return}ve(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let ee=typeof ResizeObserver<`u`?new ResizeObserver(e=>{D.current=(e[0]==null?null:cf(e[0]))??of(n,g),a()}):null;return ee?.observe(n),()=>{E.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,D.current=null,ee?.disconnect()}},[t,g,s,c,h]),Ff(()=>{Ge||I==null||At(!1)},[At,Ge,I]);let Xt=If(()=>I==null?null:`${I.path}::${I.source}`,[I]);Ff(()=>{if(Xt==null){m?.clearSlotContent(qa);return}let t=Ee.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??gp(n.getBoundingClientRect()),close:e=>{kt.current(e?.restoreFocus??!0)},restoreFocus:()=>{Ot.current&&Dt.current(Ee.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(qa,i),e?.contextMenu?.onOpen?.(t.item,r),kp(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&kp(i)}),()=>{m?.clearSlotContent(qa)}},[Xt,e?.contextMenu,m]),Ff(()=>{I!=null&&t.getItem(I.path)==null&&At()},[At,I,t]),Ff(()=>{if(I==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(hp(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&At())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),At())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[At,I]),Ff(()=>{let e=C.current,n=S.current;if(e==null||n==null){M.current=R;return}let r=R==null?null:w.current.get(R)??null,i=af(n),a=i?.dataset.itemPath??null,o=it&&x.current===i,c=f&&ee.current===i,l=P.current&&!at,u=te.current??0,d=De.current,p=Oe.current,m=ke.current,g=Ae.current,_=i!=null,v=j.current||_,y=M.current!==R,b=p!=null&&p===R&&R!=null,T=!1,D=!1;if(st!=null&&st.id!==O.current){O.current=st.id;let n=st.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,_t-s))):xt;T=!0,D=uf(e,n,s,_t,bt,st.offset,t)}t.clearScrollRequest(st.id)}let k=!T&&l&&df(e,z,s,_t,bt,u),A=!T&&d!=null&&d===R&&df(e,z,s,_t,bt,xt),N=!T&&m!=null&&m.path===R&&df(e,z,s,_t,bt,m.viewportOffset),ne=!T&&g!=null&&g.path===R&&e.scrollTop!==g.scrollTop;if(ne&&(e.scrollTop=g.scrollTop),(ne||D||A||N||k||v&&y&&d!==R&&!b&&lf(e,z,s,_t,xt))&&E.current(),T){M.current=R;return}if(!v){M.current=R;return}if(o){M.current=R;return}if(c&&!l){M.current=R;return}if(r==null){l&&z>=0&&(df(e,z,s,_t,bt,u),E.current()),M.current=R;return}(y||l||d===R||p===R||m?.path===R||g?.path===R||a==null||a!==R)&&(rf(r),d===R&&(De.current=null),p===R&&(Oe.current=null),m?.path===R&&(ke.current=null),g?.path===R&&(Ae.current=null),P.current=!1,te.current=null),M.current=R},[t,z,R,Ct,s,it,at,V,_t,f,st,h,xt,bt,gt]);let Zt=z>=0&&z>=B.visible.startIndex&&z<=B.visible.endIndex,Qt=R!=null&&vt.some(e=>Kf(e.row)===R),$t=Zt||Qt,en=qe&&j.current===!0&&$t?R:null,tn=xe===`pointer`?_e:null,nn=I?.path??Me.current??tn??en??_e,rn=I?.source===`right-click`;Ff(()=>{y.current&&I==null||jt($e(nn))},[I,$e,V,_t,Ce,vt,nn,jt,gt]);let an=Lf(e=>{if(y.current||hp(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&Se(e=>e===`pointer`?e:`pointer`),ve(e=>e===i?e:i)},[]),on=Lf(()=>{ve(null)},[]);Ff(()=>{if(!ct)return;let e=()=>{Ht(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Ht(),t.cancelDrag()}},[t,ct]);let sn=e=>{if(!ct||t.getDragSession()==null||le.current)return;let n=np(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Ut(t.getDragSession()?.target??null),Gt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},cn=e=>{if(!ct||t.getDragSession()==null||le.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Rt(),Bt(),t.setDragTarget(null))},ln=e=>{!ct||t.getDragSession()==null||le.current||(e.preventDefault(),H(e.clientX,e.clientY),t.completeDrag(),zt(),Rt(),Bt(),se.current=null)},un=B.window.height,dn=B.window.offsetTop,fn=Math.min(0,_t-un),pn=Math.min(0,_t-un-xt),mn=ge===R||P.current,hn=R!=null&&mn&&!Ct&&z>=0?gt[z]??t.getVisibleRows(z,z)[0]??null:null,gn=hn==null?null:ff(z,s,V,un),_n=se.current,vn=ft!=null&&_n!=null&&_n.path===ft&&_n.index>=V.start&&_n.index<=V.end,yn=ft!=null&&_n!=null&&_n.path===ft&&!vn&&_n.path!==hn?.path?_n:null,bn=yn==null?null:ff(yn.index,s,V,un),xn=dp((z>=0?gt[z]??t.getVisibleRows(z,z)[0]??null:null)?.ancestorPaths.at(-1)??null),Sn=at&&R!=null?Ep(o,R,!Ct):void 0,Cn=I?.path??(at?R:ge),wn=I?.path??_e,Tn=$e(nn),En=Ge&&qe&&!rn&&!it&&Tn!=null&&ye!=null&&nn!=null,Dn=Ge&&(En||I!=null),On=I?.anchorRect,kn=On==null&&Tn!=null&&ye!=null&&(I!=null||En)?ye:null,An=On==null?kn==null?void 0:{top:`${kn}px`}:{left:`${On.left}px`,position:`fixed`,right:`auto`,top:`${On.top}px`},jn=rn?{opacity:`0`}:void 0,Mn=Lf((e,n,r,i)=>{let a=gf({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:at,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=B.visible.startIndex&&n.index<=B.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(j.current=!0,F(e=>e===c?e:c),Se(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Pt(c,{targetOffset:`sticky-parents`})},[t,at,B.visible.endIndex,B.visible.startIndex,Pt]),Nn=()=>{if(y.current||!qe||nn==null||Tn==null)return;let e=t.getItem(nn);e!=null&&(jt(Tn),Ot.current=!0,Te({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:Tn.getAttribute(`aria-label`)??nn,path:e.getPath()},path:e.getPath(),source:`button`}))},Pn={contextHoverPath:wn,contextMenuButtonTriggerEnabled:qe,contextMenuButtonVisibility:Je,contextMenuEnabled:Ge,contextMenuRightClickEnabled:Ye,contextMenuTriggerMode:Ke,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:ct,draggedPathSet:ut,dragTarget:dt,gitLaneActive:et,gitStatusByPath:n,handleRowDragEnd:qt,handleRowDragStart:Kt,handleRowTouchStart:Jt,ignoredGitDirectories:r,ignoredInheritanceCache:me,instanceId:o,itemHeight:s,onKeyDown:Yt,onRowClick:Mn,openContextMenuForRow:Mt,registerButton:Xe,registerRenameInput:Qe,renameView:nt,renderDecorationForRow:wt,resolveIcon:tt,shouldSuppressContextMenu:Ft,visualFocusPath:Cn},Fn={...Pn,registerButton:Ze};return Q(`div`,{ref:S,id:pt,"data-file-tree-context-menu-button-visibility":Ge&&qe?Je:void 0,"data-file-tree-context-menu-trigger-mode":Ge?Ke:void 0,"data-file-tree-has-context-menu-action-lane":Ge&&qe?`true`:void 0,"data-file-tree-has-git-lane":et?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:ct?cn:void 0,onDragOver:ct?sn:void 0,onDrop:ct?ln:void 0,onKeyDown:Yt,onPointerLeave:Ge?on:void 0,onPointerOver:Ge?an:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Q(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:xn}}),Q(`slot`,{name:Ka,"data-type":`header-slot`}),f?Q(`div`,{"data-file-tree-search-container":!0,"data-open":at?`true`:`false`,children:Q(`input`,{ref:ee,"aria-activedescendant":Sn,"aria-controls":pt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Re?`true`:void 0,value:ot,onBlur:()=>{d===`retain`&&!Be.current||t.closeSearch()},onFocus:Ve,onPointerDown:Ve,onInput:e=>{Ve();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Q(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&L&&vt.length>0?Q(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Q(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${mt}px`},children:vt.map((e,t)=>jp(Fn,e.row,`sticky:${Kf(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${vt.length-t}`}}))})}):null,Q(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${bt}px`},children:[Q(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${dn}px`}}),Q(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${un}px`,top:`${fn}px`,bottom:`${pn}px`},children:[Mp(Pn,V,St),hn!=null&&gn!=null?jp(Pn,hn,`parked:${hn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:ft===hn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${gn}px`}}):null,yn!=null&&bn!=null?jp(Pn,yn,`parked-drag:${yn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${bn}px`}}):null]})]})]}),Ge?Q(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":Dn?`true`:`false`,style:An,children:[Q(`button`,{ref:v,type:`button`,"data-type":Ja,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":I==null?`false`:`true`,"data-visible":En?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),I!=null){At();return}Nn()},tabIndex:-1,style:jn,children:Q(Ed,{...tt(`file-tree-icon-ellipsis`)})}),I==null?null:Q(`slot`,{name:qa})]}):null,I==null?null:Q(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),At()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),At()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var Pp={hydrateRoot:(e,t)=>{xd(Zu(Np,t),e)},renderRoot:(e,t)=>{bd(Zu(Np,t),e)},unmountRoot:e=>{bd(null,e)}};function Fp(e,t){Pp.renderRoot(e,t)}function Ip(e,t){Pp.hydrateRoot(e,t)}function Lp(e){Pp.unmountRoot(e)}var Rp=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},zp=`__c`,Bp=`__k`,Vp=`__d`,Hp=`__s`,Up=/[\s\n\\/='"\0<>]/,Wp=/^(xlink|xmlns|xml)([A-Z])/,Gp=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,Kp=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,qp=new Set([`draggable`,`spellcheck`]);function Jp(e){e.__g===void 0?e[Vp]=!0:e.__g|=8}function Yp(e){e.__g===void 0?e[Vp]=!1:e.__g&=-9}function Xp(e){return e.__g===void 0?!0===e[Vp]:!!(8&e.__g)}var Zp=/["&<]/;function Qp(e){if(e.length===0||!1===Zp.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`"`;break;case 38:i=`&`;break;case 60:i=`<`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var $p={},em=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),tm=/[A-Z]/g;function nm(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:$p[n]||($p[n]=n.replace(tm,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||em.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function rm(){this.__d=!0}function im(e,t){return{__v:e,context:t,props:e.props,setState:rm,forceUpdate:rm,__d:!0,__h:[]}}function am(e,t,n){if(!e.s){if(n instanceof om){if(!n.s)return void(n.o=am.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(am.bind(null,e,t),am.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var om=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{am(r,1,a(this.v))}catch(e){am(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?am(r,1,t?t(i):i):n?am(r,1,n(i)):am(r,2,i)}catch(e){am(r,2,e)}},r},e}(),sm,cm,lm,um,dm={},fm=Array.isArray,pm=Object.assign,mm=``,hm=`<!--$s-->`,gm=`<!--/$s-->`;function _m(e,t){var n,r=e.type,i=!0;return e[zp]?(i=!1,(n=e[zp]).state=n[Hp]):n=new r(e.props,t),e[zp]=n,n.__v=e,n.props=e.props,n.context=t,Jp(n),n.state??=dm,n[Hp]??(n[Hp]=n.state),r.getDerivedStateFromProps?n.state=pm({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[Hp]===n.state?n.state:n[Hp]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),lm&&lm(e),n.render(n.props,n.state,t)}function vm(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===mm)return mm;var s=typeof e;if(s!=`object`)return s==`function`?mm:s==`string`?Qp(e):e+mm;if(fm(e)){var c,l=mm;i[Bp]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=vm(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=mm,fm(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return mm;e.__=i,sm&&sm(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===$u){if(`tpl`in g){for(var x=mm,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!fm(C)?x+=C:x+=vm(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+Qp(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var ee=t[_.__c];b=ee?ee.props.value:_.__}var w=h.prototype&&typeof h.prototype.render==`function`;if(w)v=_m(e,b),y=e[zp];else{e[zp]=y=im(e,b);for(var T=0;Xp(y)&&T++<25;){Yp(y),lm&&lm(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}Jp(y)}if(y.getChildContext!=null&&(t=pm({},t,y.getChildContext())),w&&Z.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===$u&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return vm(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[Hp]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,dm),Xp(y)?(v=_m(e,t),(y=e[zp]).getChildContext!=null&&(t=pm({},t,y.getChildContext())),vm(v=v!=null&&v.type===$u&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):mm}finally{cm&&cm(e),um&&um(e)}}}v=v!=null&&v.type===$u&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var E=vm(v,t,n,r,e,a,o);return cm&&cm(e),Z.unmount&&Z.unmount(e),e._suspended?typeof E==`string`?hm+E+gm:fm(E)?(E.unshift(hm),E.push(gm),E):E.then(function(e){return hm+e+gm}):E}catch(i){if(!a&&o&&o.onError){var D=function i(s){return o.onError(s,e,function(e,s){try{return vm(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(D!==void 0)return D;var O=Z.__e;return O&&O(i,e),mm}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=vm(v,t,n,r,e,a,o);return e._suspended?hm+s+gm:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var k,A=`<`+h,j=mm;for(var M in g){var N=g[M];if(typeof(N=bm(N)?N.value:N)!=`function`||M===`class`||M===`className`){switch(M){case`children`:k=N;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;M=`for`;break;case`className`:if(`class`in g)continue;M=`class`;break;case`defaultChecked`:M=`checked`;break;case`defaultSelected`:M=`selected`;break;case`defaultValue`:case`value`:switch(M=`value`,h){case`textarea`:k=N;continue;case`select`:r=N;continue;case`option`:r!=N||`selected`in g||(A+=` selected`)}break;case`dangerouslySetInnerHTML`:j=N&&N.__html;continue;case`style`:typeof N==`object`&&(N=nm(N));break;case`acceptCharset`:M=`accept-charset`;break;case`httpEquiv`:M=`http-equiv`;break;default:if(Wp.test(M))M=M.replace(Wp,`$1:$2`).toLowerCase();else{if(Up.test(M))continue;M[4]!==`-`&&!qp.has(M)||N==null?n?Kp.test(M)&&(M=M===`panose1`?`panose-1`:M.replace(/([A-Z])/g,`-$1`).toLowerCase()):Gp.test(M)&&(M=M.toLowerCase()):N+=mm}}N!=null&&!1!==N&&(A=!0===N||N===mm?A+` `+M:A+` `+M+`="`+(typeof N==`string`?Qp(N):N+mm)+`"`)}}if(Up.test(h))throw Error(h+` is not a valid HTML tag name in `+A+`>`);if(j||(typeof k==`string`?j=Qp(k):k!=null&&!1!==k&&!0!==k&&(j=vm(k,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),cm&&cm(e),um&&um(e),!j&&ym.has(h))return A+`/>`;var P=`</`+h+`>`,te=A+`>`;return fm(j)?[te].concat(j,[P]):typeof j==`string`?te+j+P:[te,j,P]}var ym=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function bm(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var xm=0;function Sm(e){return e!=null&&e.length>0?e:(xm+=1,`pst_ft_${xm}`)}function Cm({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??ro)}function wm(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function Tm(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function Em(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var Dm=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new Rp;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=Sm(a),this.#p=Fu(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=no(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new Au({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(Lp(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),Fp(t.wrapper,this.#w()))}setGitStatus(e){this.#p=Fu(e,this.#p);let t=this.#T();t!=null&&Fp(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),Fp(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),Ip(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),Fp(r,this.#w())}#C(){return{initialViewportHeight:Cm({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(Ka,e());return}this.#l.setSlotHtml(Ka,this.#e?.header?.html??null)}#k(e){let t=Em(e).find(e=>Tm(e)),n=wm(Ne(Me(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=Em(e),n=t.find(e=>Tm(e)),r=t.filter(e=>e!==n),i=Me(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=wm(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=Me(this.#m);t.colored&&ke(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${Ha}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(Ha,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=so(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return mo(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}};function Om(e){let[t]=(0,V.useState)(()=>new Dm(e)),n=(0,V.useRef)({timeout:null,model:t});return(0,V.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}function km(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!Object.is(e[n],t[n]))return!1;return!0}function Am(e,t,n){return Object.is(e,t)||n?.(e,t)===!0}function jm(e,t,n){let r=(0,V.useRef)({hasValue:!1,model:null,selector:null,value:void 0}),i=(0,V.useCallback)(t=>e.subscribe(t),[e]),a=(0,V.useCallback)(()=>{let i=r.current,a=t(e);if(i.model!==e||i.selector!==t||!i.hasValue)return i.hasValue=!0,i.model=e,i.selector=t,i.value=a,a;let o=i.value;return Am(o,a,n)?o:(i.value=a,a)},[n,e,t]);return(0,V.useSyncExternalStore)(i,a,a)}function Mm(e,t){return e.isOpen===t.isOpen&&e.value===t.value&&km(e.matchingPaths,t.matchingPaths)}function Nm(e){let t=jm(e,e=>({isOpen:e.isSearchOpen(),matchingPaths:e.getSearchMatchingPaths(),value:e.getSearchValue()}),Mm);return(0,V.useMemo)(()=>({...t,close:()=>{e.closeSearch()},focusNextMatch:()=>{e.focusNextSearchMatch()},focusPreviousMatch:()=>{e.focusPreviousSearchMatch()},open:t=>{e.openSearch(t)},setValue:t=>{e.setSearch(t)}}),[e,t])}var Pm=e=>{if(typeof e!=`object`||!e)return null;let t=e;return typeof t.getAttribute==`function`?t.getAttribute(`data-item-path`):null};function Fm(e){let t=[],n=[];return{isDragInProgress:()=>n.length>0,handleSelectionChange(e){t=e},handleDragStart(e){if(e.dataTransfer===null)return;let r=null;for(let t of e.composedPath())if(r=Pm(t),r!==null)break;if(r===null)return;let i=t.includes(r)?t:[r],a=i.map(e=>Ke(e)).filter(e=>e!==null);a.length!==0&&(n=i,e.dataTransfer.setData($e,a.join(` `)))},handleDragEnd(){if(n.length!==0){for(let t of n)e.deselect(t);n=[]}}}}function Im(e){return typeof e!=`object`||!e||!(`isDirectory`in e)||typeof e.isDirectory!=`function`||!e.isDirectory()||!(`isExpanded`in e)||typeof e.isExpanded!=`function`||!(`expand`in e)||typeof e.expand!=`function`||!(`collapse`in e)||typeof e.collapse!=`function`?null:e}function Lm(e,t){return t.length>0&&t.every(t=>{let n=Im(e.getItem(t));return n!==null&&n.isExpanded()})}function Rm(e,t,n){for(let r of t){let t=Im(e.getItem(r));t===null||t.isExpanded()===n||(n?t.expand():t.collapse())}}var zm=`
|
|
2179
|
+
}`}var co=new WeakMap;function lo(e){let t=co.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(Ua,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),co.set(e,i),i}function uo(e,t){if(!e.isConnected)return;let n=lo(t);if(n==null)return;let r=t.querySelector(`style[${Wa}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(Wa,``),t.appendChild(i)),i.textContent=`:host { ${Ga}: ${n}px; }`}var fo;function po(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){fo??(fo=new CSSStyleSheet,fo.replaceSync(oo(io)));let t=!1;try{e.adoptedStyleSheets=[fo],t=!0}catch{}if(t){e.querySelector(`style[${Va}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(Va,``),t.textContent=oo(io),e.prepend(t)}}function mo(e,t){ho(e,t),po(t),uo(e,t)}function ho(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});mo(this,e)}}if(customElements.define(Ba,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(Ba)))e instanceof HTMLElement&&mo(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var go=5,_o=1<<go,vo=_o*4;function yo(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function bo(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function xo(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function So(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function Co(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function wo(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function To(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,ko(e,t)}function Eo(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=So(e).get(t);if(i===void 0)return;let a=i>>go;e.childVisibleChunkSums[a]+=r}function Do(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=Ao(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=_o}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function Oo(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>go;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<go}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function ko(e,t){if(t.childIds.length<vo){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/_o),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>go]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function Ao(e,t,n,r){let i=Math.min(t.childIds.length,n+_o),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var jo=7,Mo=3,No=1<<Mo,Po=4;function Fo(e,t,n=0){return e<<Po|n<<Mo|t}function Io(e){return e.depthAndFlags>>>Po}function Lo(e){return(e.depthAndFlags&No)>>Mo}function K(e){return(e.depthAndFlags&No)!==0}function Ro(e){return e.depthAndFlags&jo}function zo(e,t){return(Ro(e)&t)!==0}function Bo(e,t){e.depthAndFlags|=t}function Vo(e,t){e.depthAndFlags=Fo(t,Ro(e),Lo(e))}var Ho=Symbol(`benchmarkInstrumentation`);function Uo(e,t){return t==null||Object.defineProperty(e,Ho,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Wo(e){return e==null?null:e[Ho]??null}function q(e,t,n){return e==null?n():e.measurePhase(t,n)}function Go(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Ko(e){return e>=48&&e<=57}function qo(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Ko(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&Ko(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function Jo(e){let t=e.toLowerCase();return{lowerValue:t,tokens:qo(t)}}function Yo(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function Xo(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=Yo(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Zo(e,t,n){let r=Xo(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Qo(e,t){return Zo(e,t,Jo)}function $o(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function es(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=$o(e,r);return a===$o(t,r)?Qo(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function ts(e,t){return es(e,t)}function ns(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Jo(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=$o(e,n);return o===$o(t,n)?Zo(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function rs(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Jo(r);return e.sortKeyById[t]=i,i}function is(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function as(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function os(e){let{hasTrailingSlash:t,segments:n}=as(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function ss(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=as(e);return{requiresDirectory:t,segments:n}}var cs=``;function ls(){let e=new Map;return e.set(cs,0),{idByValue:e,valueById:[cs],sortKeyById:[Jo(cs)]}}function us(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function ds(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var fs=Symbol(`pathStorePreparedInputKind`);function ps(e,t){return e[fs]=t,e}function ms(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function hs(e,t,n){return n==="default"?ts(e,t):n(ms(e),ms(t))}function gs(){return{depthAndFlags:Fo(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function _s(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function vs(e){return e.isDirectory?e.segments.length:e.segments.length-1}function ys(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function bs(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function xs(e,t={}){return Ds(e,t).map(e=>e.path)}function Ss(e,t={}){let n=Ds(e,t);return ps({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function Cs(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return ps({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function ws(e){let t=e,n=t.preparedPaths;if(t[fs]===`prepared`&&n!=null)return n;if(!ys(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function Ts(e){let t=e;return t[fs]===`presorted`&&t.presortedPaths!=null||bs(t.presortedPaths)?t.presortedPaths:null}function Es(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function Ds(e,t={}){let n=is(t),r=Wo(t);Go(r,`workload.inputFiles`,e.length);let i=q(r,`store.preparePathEntries.parse`,()=>e.map(e=>os(e)));return q(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>hs(e,t,n.sort))),i}var Os=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[gs()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=ls();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Wo(e),this.options=is(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,yo())}appendPaths(e){return q(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>os(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,q(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return q(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:Fo(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:Fo(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:Fo(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=os(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:Fo(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:Fo(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=os(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(q(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||q(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?ns(this.lastPreparedPath,e,this.segmentSortKeyCache):hs(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=vs(e),i=n==null?0:vs(n),a=n==null?0:_s(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=us(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:Fo(Io(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),Co(i,s),s}createFileChildUnchecked(e,t){let n=us(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Fo(Io(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Co(r,a),a}getOrCreateDirectoryChild(e,t){let n=us(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!K(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Fo(Io(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Co(r,a),this.directories.set(a,yo()),a}createDirectoryChild(e,t){let n=us(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Fo(Io(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Co(r,a),this.directories.set(a,yo()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!K(n))throw Error(`Path is not a directory: "${t}"`);if(zo(n,1))throw Error(`Duplicate path: "${t}"`);Bo(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,bo());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(K(a)){let t=bo();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;K(n)&&this.directories.set(t,yo());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),Co(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!K(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return To(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function ks(e,t=`closed`,n=null){let r=js(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function As(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function js(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function Ms(e,t){return zo(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:Io(t)<=e.defaultExpansion}function Ns(e,t,n=e.snapshot.nodes[t]){return n==null||!K(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:Ms(e,n)}function Ps(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!K(r))return;let i=Ms(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function Fs(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function Is(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function Ls(e,t){let n=Fs(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function Rs(e,t){let n=Fs(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function zs(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function Bs(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function Vs(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function Hs(e,t){e.directoryLoadInfoById.delete(t)}function Us(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function Ws(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Gs(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function Ks(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function qs(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Js(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Ys(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Xs(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function Zs(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Qs(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function $s(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function ec(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function tc(e,t,n){return{...n,visibleCountDelta:fc(e)-t}}function nc(e,t){let n=fc(e),r=As();e.transactionStack.push(r);try{t()}catch(t){throw ac(e,r,!1),t}ac(e,r,!0,fc(e)-n)}function rc(e,t){let n=e.instrumentation;if(n==null){ic(e,t);return}q(n,`store.events.record`,()=>ic(e,t))}function ic(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){uc(e,t);return}n.events.push(t),lc(n,t)}function ac(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?cc(i,t):q(n,`store.events.batch.merge`,()=>cc(i,t));return}let a=oc(t,r),o=e.instrumentation;if(o==null){uc(e,a);return}q(o,`store.events.batch.commit`,()=>uc(e,a))}function oc(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function sc(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function cc(e,t){for(let n of t.events)e.events.push(n);sc(e,t)}function lc(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function uc(e,t){let n=e.instrumentation;if(n==null){dc(e,t);return}q(n,`store.events.emit`,()=>dc(e,t))}function dc(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function fc(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function pc(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!K(n)||zo(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!K(a)?null:i}function mc(e,t){let n=t;for(;;){let t=pc(e,n);if(t==null)return n;n=t}}function hc(e,t){let n=[t],r=t;for(;;){let t=pc(e,r);if(t==null)return n;n.push(t),r=t}}function gc(e,t){let n=t==null?e.snapshot.rootId:Tc(e,t);return n==null?[]:Dc(e,n)}function _c(e,t){let n=os(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Hc(e,Vc(e,r)),{createdNodeIds:a,directoryId:o}=Oc(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=X(e,o);if(zo(n,1))throw Error(`Path already exists: "${t}"`);Bo(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=Ac(e,o,n.basename),s.add(c);Sc(e,o);let l=Hc(e,o);return Ws({affectedAncestorIds:wc(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Uc(i,l)})}function vc(e,t,n){let r=Tc(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=X(e,r);if(zo(i,2))throw Error(`The root node cannot be removed`);if(K(i)&&Y(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Hc(e,a),s=zc(e,r);Nc(e,a,r,i.nameId),Bc(e,a),Sc(e,a);let c=Hc(e,a);return Gs({affectedAncestorIds:wc(e,a),affectedNodeIds:s,path:t,projectionChanged:Uc(o,c),recursive:n.recursive===!0})}function yc(e,t,n,r){let i=Tc(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=X(e,i);if(zo(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=Lc(e,i,n),c=Hc(e,a.parentId),l=Hc(e,s.parentId),u=ds(e.snapshot.segmentTable,a.nameId),d=us(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(K(a)&&qc(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=xo(e.snapshot.nodes,Y(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Rc(e,p,o,Lo(a))===`skip`)return null;let m=a.parentId;Nc(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Kc(e,i),Mc(e,s.parentId,i),Bc(e,m),e.pathCacheVersion++,Sc(e,m),s.parentId!==m&&Sc(e,s.parentId);let h=Hc(e,m),g=Hc(e,s.parentId);return Ks({affectedAncestorIds:[...new Set([...wc(e,m),...wc(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:Wc([c,l],[h,g]),to:J(e,i)})}function bc(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function xc(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function J(e,t){let n=X(e,t),r=bc(e,t);if(r!=null)return r;if(zo(n,2))return xc(e,t,``);let i=J(e,n.parentId),a=ds(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return xc(e,t,K(n)?`${o}/`:o)}function Sc(e,t){let n=e.instrumentation;if(n==null){Yc(e,t);return}q(n,`store.recomputeCountsUpwardFrom`,()=>Yc(e,t))}function Cc(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!K(o)){Jc(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Jc(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function wc(e,t){let n=[],r=t;for(;r!=null;){let t=X(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function Tc(e,t){if(t.length===0)return e.snapshot.rootId;let n=ss(t);return Ec(e,n.segments,n.requiresDirectory)}function Ec(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=Y(e,r),a=xo(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=X(e,r);return n&&!K(i)?null:r}function Y(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function X(e,t){let n=e.snapshot.nodes[t];if(n===void 0||zo(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function Dc(e,t){let n=e.snapshot.nodes[t];if(n===void 0||zo(n,4))return[];if(!K(n))return[J(e,t)];if(Y(e,t).childIds.length===0)return zo(n,1)&&!zo(n,2)?[J(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||zo(n,4)){i.pop();continue}if(!K(n)){r.push(J(e,t.nodeId)),i.pop();continue}let a=Y(e,t.nodeId);if(a.childIds.length===0){zo(n,1)&&!zo(n,2)&&r.push(J(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function Oc(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=us(e.snapshot.segmentTable,i),a=Y(e,r),o=xo(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!K(X(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=kc(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function kc(e,t,n){let r=X(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Fo(Io(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,yo()),Mc(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function Ac(e,t,n){let r=us(e.snapshot.segmentTable,n),i=Y(e,t);if(xo(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${Zc(e,t,n)}"`);let a=X(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Fo(Io(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),Mc(e,t,o),e.activeNodeCount++,o}function jc(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}Pc(e,n,o)<0?i=a:r=a+1}return r}function Mc(e,t,n){let r=Y(e,t),i=X(e,n);xo(e.snapshot.nodes,r).set(i.nameId,n),Eo(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=jc(e,r,n);r.childIds.splice(a,0,n),wo(r,a),ko(e.snapshot.nodes,r)}function Nc(e,t,n,r){let i=Y(e,t),a=So(i),o=a.get(n)??-1;xo(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Eo(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),wo(i,o),ko(e.snapshot.nodes,i))}function Pc(e,t,n){let r=e.snapshot.options.sort;return r==="default"?Fc(e,t,n):r(Ic(e,t),Ic(e,n))}function Fc(e,t,n){let r=X(e,t),i=X(e,n),a=K(r);if(a!==K(i))return a?-1:1;let o=Xo(rs(e.snapshot.segmentTable,r.nameId),rs(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=ds(e.snapshot.segmentTable,r.nameId),c=ds(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function Ic(e,t){let n=X(e,t),r=J(e,t),i=K(n),a=i?r.slice(0,-1):r;return{basename:ds(e.snapshot.segmentTable,n.nameId),depth:Io(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function Lc(e,t,n){let r=X(e,t),i=Tc(e,n);if(i!=null){let t=X(e,i);if(K(t))return{basename:ds(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=ss(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=ss(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:Ec(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Rc(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${J(e,t)}"`);let i=X(e,t);if(Lo(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(K(i)&&Y(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return zc(e,t),Nc(e,a,t,o),Bc(e,a),Sc(e,a),`handled`}function zc(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=X(e,t.nodeId);if(t.visitedChildren||!K(i)){K(i)&&e.snapshot.directories.delete(t.nodeId),Bo(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Hs(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=Y(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function Bc(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!K(t)||zo(t,2)||Y(e,n).childIds.length>0)return;Bo(t,1),n=t.parentId===n?null:t.parentId}}function Vc(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=xo(e.snapshot.nodes,Y(e,n)).get(t);if(i==null||!K(X(e,i)))break;n=i}return n}function Hc(e,t){let n=Gc(e,t);if(n==null)return null;let r=mc(e,n),i=X(e,r),a=n===r?null:hc(e,n).map(t=>J(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:Y(e,r).childIds.length>0,path:J(e,r),terminalKind:Lo(i)})}function Uc(e,t){return Wc([e],[t])}function Wc(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function Gc(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!K(t)||zo(t,2))return null;if(!Ns(e,n,t))return n;n=t.parentId}return null}function Kc(e,t){let n=X(e,t);if(Vo(n,(t===e.snapshot.rootId?-1:Io(X(e,n.parentId)))+1),!K(n))return;let r=Y(e,t);for(let t of r.childIds)Kc(e,t)}function qc(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=X(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Jc(e,t,n=X(e,t),r=!1){let i=e.instrumentation;if(i==null){Xc(e,t,n,r);return}q(i,`store.recomputeNodeCounts`,()=>Xc(e,t,n,r))}function Yc(e,t){let n=t;for(;n!=null;){let t=X(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Jc(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Eo(Y(e,s),n,a,o),n=s}}function Xc(e,t,n,r){if(!K(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=Y(e,t);if(r){let t=e.instrumentation;t==null?To(e.snapshot.nodes,i):q(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>To(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,zo(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=pc(e,t)==null?Ns(e,t,n)?1+o:1:o}function Zc(e,t,n){let r=J(e,t);return r.length===0?n:`${r}${n}`}function Qc(e){return e!=null&&!zo(e,4)}function $c(e,t){let n=e.snapshot.nodes[t];return!Qc(n)||!K(n)||zo(n,2)?null:n}function el(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Qc(e.snapshot.nodes[n])&&(t+=1);return t}function tl(e){return Math.max(0,e.valueById.length-1)}function nl(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:el(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:tl(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function rl(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function il(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)$c(e,n)!=null&&t.push(J(e,n));for(let t of e.expandedDirectoryIds)$c(e,t)!=null&&n.push(J(e,t));return{collapsedPaths:t,expandedPaths:n}}function al(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)$c(e,n)==null||Is(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:J(e,n)});return t}function ol(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=Tc(e,n);t!=null&&Ps(e,t,!0,X(e,t))}for(let n of t.collapsedPaths){let t=Tc(e,n);t!=null&&Ps(e,t,!1,X(e,t))}}function sl(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=Tc(e,n.path);t!=null&&$c(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function cl(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function ll(e){let t=e.snapshot.segmentTable,n=ls();for(let r of e.snapshot.nodes)if(Qc(r)){if(zo(r,2)){r.nameId=0;continue}r.nameId=us(n,ds(t,r.nameId))}e.snapshot.segmentTable=n}function ul(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Qc(r)||!K(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Qc(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[X(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),To(e.snapshot.nodes,n)}}function dl(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Qc(n))break;--t}e.snapshot.nodes.length=t+1}function fl(e){let t=il(e),n=al(e);q(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>cl(e)),q(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>ll(e)),q(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>ul(e)),q(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>dl(e)),q(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>ol(e,t)),q(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>sl(e,n)),q(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>Cc(e,e.snapshot.rootId))}function pl(e){let t=il(e),n=al(e),r=q(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>gc(e)),i=Uo({...e.snapshot.options},e.instrumentation),a=q(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new Os(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,q(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>ol(e,t)),q(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>sl(e,n)),q(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>Cc(e,e.snapshot.rootId))}function ml(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function hl(e,t){let n=nl(e);t===`stable`?q(e.instrumentation,`store.cleanup.stable`,()=>fl(e)):q(e.instrumentation,`store.cleanup.aggressive`,()=>pl(e));let r=nl(e);return rl(t,t===`stable`,n,r)}var gl=64;function _l(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function vl(e){return X(e,e.snapshot.rootId).visibleSubtreeCount}function yl(e,t,n,r){let i=X(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function bl(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:zl(e,t.cursor),setSize:t.setSize,subtreeEndIndex:yl(e,t.cursor,t.index,n)}}function xl(e,t,n,r,i,a){let o=Y(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=Do(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return Sl(e,u,l,r+c,i+1,s,o.childIds.length,a)}function Sl(e,t,n,r,i,a,o,s){if(!K(X(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=Nl(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=X(e,c.terminalNodeId);if(!K(l)||!Ns(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return xl(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function Cl(e,t){let n=vl(e);if(t<0||t>=n)return null;let r=xl(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>J(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=bl(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:zl(e,r.cursor),setSize:r.setSize,subtreeEndIndex:yl(e,r.cursor,r.index,n)}}function wl(e,t,n){let r=e.instrumentation,i=vl(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return Rl(e,o+1);let t=[],n=Al(e,a);for(let r=a;r<=o&&n!=null;r++){let r=zl(e,n);t.push(r),n=Fl(e,n)}return t}let s=[],c=0,l=0,u=q(r,`store.getVisibleSlice.selectFirstRow`,()=>Al(e,a));for(let t=a;t<=o&&u!=null;t++){let t=q(r,`store.getVisibleSlice.materializeRow`,()=>zl(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=q(r,`store.getVisibleSlice.advanceCursor`,()=>Fl(e,u))}return Go(r,`workload.visibleRowsRead`,s.length),Go(r,`workload.flattenedRowsRead`,c),Go(r,`workload.flattenedSegmentsRead`,l),s}function Tl(e,t=vl(e)){let n=e.instrumentation;return n==null?Ll(e,t):q(n,`store.getVisibleTreeProjection`,()=>Ll(e,t))}function El(e){return Il(Tl(e))}function Dl(e,t){let n=Tc(e,t);if(n==null||n===e.snapshot.rootId||K(X(e,n))&&mc(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=X(e,i).parentId,n=Y(e,t),s=So(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=Oo(a,n,s),t!==o){let n=X(e,t),a=pc(e,t);if(!Ns(e,t,n)&&a!==i)return null;mc(e,t)===t&&(r+=1)}i=t}return r}function Ol(e,t){let n=Tc(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!K(r))throw Error(`Path is not a directory: "${t}"`);return Ns(e,n,r)?null:(Ps(e,n,!0,r),Sc(e,n),qs({affectedAncestorIds:wc(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function kl(e,t){let n=Tc(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!K(r))throw Error(`Path is not a directory: "${t}"`);return Ns(e,n,r)?(Ps(e,n,!1,r),Sc(e,n),Js({affectedAncestorIds:wc(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function Al(e,t){return t<0||t>=vl(e)?null:jl(e,e.snapshot.rootId,t,-1)}function jl(e,t,n,r){let i=Y(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?Do(e.snapshot.nodes,i,n):q(a,`store.getVisibleSlice.selectChildIndex`,()=>Do(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return Ml(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function Ml(e,t,n,r){if(!K(X(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=Nl(e,t,r);if(n===0)return i;let a=X(e,i.terminalNodeId);if(!K(a)||!Ns(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return jl(e,i.terminalNodeId,n-1,i.visibleDepth)}function Nl(e,t,n){return K(X(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:mc(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:q(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>mc(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Pl(e,t){let n=X(e,t);if(!K(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:pc(e,r)!==t}function Fl(e,t){let n=X(e,t.terminalNodeId);if(K(n)){let r=Y(e,t.terminalNodeId);if(Ns(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:Ml(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=X(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=Y(e,n),o=So(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return Ml(e,s,0,i);Pl(e,r)&&i--,r=n}}function Il(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function Ll(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(gl);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=_l(o,y);let x,S=_;if(K(v))S=f?mc(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:J(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&K(C)&&Ns(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function Rl(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!K(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:J(e,f)};continue}let h=l?mc(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=zl(e,g);let _=i[h];_!=null&&K(_)&&Ns(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function zl(e,t){let n=X(e,t.terminalNodeId),r=K(n)?Bl(e,t):null,i=J(e,t.terminalNodeId),a=ds(e.snapshot.segmentTable,n.nameId),o=K(n)&&Y(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?hc(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:ds(e.snapshot.segmentTable,r.nameId),nodeId:n,path:J(e,n)}}):q(c,`store.getVisibleSlice.flatten.collectSegments`,()=>hc(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:ds(e.snapshot.segmentTable,r.nameId),nodeId:n,path:J(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:K(n)&&Ns(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:K(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Bl(e,t){if(t.headNodeId===t.terminalNodeId)return Is(e,t.terminalNodeId);let n=hc(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=Is(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function Vl(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!K(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&ko(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&K(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,ko(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Hl(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Ul=class e{#e;constructor(e={}){let t=Wo(e),n=q(t,`store.builder.create`,()=>new Os(e));if(e.preparedInput!=null){let t=Ts(e.preparedInput);t==null?n.appendPreparedPaths(ws(e.preparedInput),!1):n.appendPresortedPaths(t,Es(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(q(t,`store.preparePathEntries`,()=>Ds(r,e)))}let r=q(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=q(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=q(t,`store.state.create`,()=>ks(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:q(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Hl(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&q(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?q(t,`store.state.initializeOpenVisibleCounts`,()=>Vl(this.#e)):q(t,`store.state.recomputeCounts`,()=>Cc(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return xs(e,t)}static prepareInput(e,t={}){return Ss(e,t)}static preparePresortedInput(e){return Cs(e)}list(e){return q(this.#e.instrumentation,`store.list`,()=>gc(this.#e,e))}add(e){q(this.#e.instrumentation,`store.add`,()=>{let t=vl(this.#e);rc(this.#e,tc(this.#e,t,_c(this.#e,e)))})}remove(e,t={}){q(this.#e.instrumentation,`store.remove`,()=>{let n=vl(this.#e);rc(this.#e,tc(this.#e,n,vc(this.#e,e,t)))})}move(e,t,n={}){q(this.#e.instrumentation,`store.move`,()=>{let r=vl(this.#e),i=yc(this.#e,e,t,n);i!=null&&rc(this.#e,tc(this.#e,r,i))})}batch(e){nc(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return q(this.#e.instrumentation,`store.getVisibleCount`,()=>vl(this.#e))}getVisibleSlice(e,t){return q(this.#e.instrumentation,`store.getVisibleSlice`,()=>wl(this.#e,e,t))}getVisibleRowContext(e){return q(this.#e.instrumentation,`store.getVisibleRowContext`,()=>Cl(this.#e,e))}getVisibleTreeProjection(){return El(this.#e)}getVisibleTreeProjectionData(e){return Tl(this.#e,e)}getVisibleIndex(e){return q(this.#e.instrumentation,`store.getVisibleIndex`,()=>Dl(this.#e,e))}getPathInfo(e){return q(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=Tc(this.#e,e);if(t==null)return null;let n=X(this.#e,t);return{depth:Io(n),kind:K(n)?`directory`:`file`,path:J(this.#e,t)}})}isExpanded(e){return q(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=X(this.#e,t);return Ns(this.#e,t,n)})}expand(e){q(this.#e.instrumentation,`store.expand`,()=>{let t=vl(this.#e),n=Ol(this.#e,e);n!=null&&rc(this.#e,tc(this.#e,t,n))})}collapse(e){q(this.#e.instrumentation,`store.collapse`,()=>{let t=vl(this.#e),n=kl(this.#e,e);n!=null&&rc(this.#e,tc(this.#e,t,n))})}on(e,t){return Us(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return Is(this.#e,t)}markDirectoryUnloaded(e){q(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(Y(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=vl(this.#e);Rs(this.#e,t),rc(this.#e,tc(this.#e,n,Ys({affectedAncestorIds:wc(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return q(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=vl(this.#e),r=Ls(this.#e,t);return rc(this.#e,tc(this.#e,n,Xs({affectedAncestorIds:wc(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return q(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||Is(this.#e,n)!==`loading`||!Bs(this.#e,n,e.attemptId))return!1;let r=J(this.#e,n);this.validateChildPatch(r,t);let i=vl(this.#e),a=[];for(let e of t.operations){Wl(r,e);let t=vl(this.#e);switch(e.type){case`add`:a.push(tc(this.#e,t,_c(this.#e,e.path)));break;case`remove`:a.push(tc(this.#e,t,vc(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=yc(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(tc(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return rc(this.#e,tc(this.#e,i,Zs({affectedAncestorIds:wc(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:J(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return q(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=vl(this.#e),r=zs(this.#e,t,e.attemptId);return rc(this.#e,tc(this.#e,n,Qs({affectedAncestorIds:wc(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:J(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return q(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=vl(this.#e),i=Vs(this.#e,n,e.attemptId,t);return rc(this.#e,tc(this.#e,r,$s({affectedAncestorIds:wc(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:J(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return q(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(ml(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=vl(this.#e),n=hl(this.#e,e.mode??`stable`);return rc(this.#e,tc(this.#e,t,ec({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=Y(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Jo(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=Xo(rs(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!K(X(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=X(this.#e,n);Ns(this.#e,n,i)||(Ps(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=X(this.#e,e);if(!Ns(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=Tc(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!K(X(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!K(X(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=X(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=X(this.#e,e),r=pc(this.#e,e);if(!Ns(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function Wl(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var Gl=e=>e.startsWith(`f::`)?e.slice(3):e;function Kl(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function ql(e,t){return e===``?t:`${e}/${t}`}function Jl({files:e,path:t,isFolder:n,nextBasename:r}){let i=Gl(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=Kl(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=ql(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function Yl(e){return e.endsWith(`/`)}function Xl(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function Zl(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function Ql(e,t){return t.includes(e)?Zl(t):[e]}function $l(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function eu(e,t){return{draggedPaths:e,target:t}}function tu(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Yl(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function nu(e,t){return t.kind===`root`||t.directoryPath==null?Xl(e):t.directoryPath}function ru(e,t){let n=e.map(e=>{let n=nu(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function iu(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function au(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!iu(Ul.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function ou(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function su(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function cu(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function lu(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return cu(e,t.path)?n?e:null:e;case`move`:return su(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=lu(r,e,n),r==null)return null;return r}}}function uu(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function du(e){switch(e.operation){case`add`:return{...uu(e),operation:`add`,path:e.path};case`remove`:return{...uu(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...uu(e),from:e.from,operation:`move`,to:e.to}}}function fu(e){return{...uu(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>du(e)),operation:`batch`}}function pu(e){switch(e.operation){case`add`:case`remove`:case`move`:return du(e);case`batch`:return fu(e);default:return null}}function mu(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function hu(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function gu(e){return hu(e).at(-1)??null}function _u(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function vu(e){return e.endsWith(`/`)}var yu=e=>e.toLowerCase();function bu(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function xu(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Su(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var Cu=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},wu=Symbol(`FILE_TREE_RENAME_VIEW`),Tu=512,Eu=512;function Du(e){return e===`top`||e===`center`?e:`nearest`}function Ou(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=hu(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function ku(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:Ou(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var Au=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=au({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=gu(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:Du(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=Eu){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=Ql(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=eu(t.draggedPaths,n);(tu(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}$l(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=eu(e.draggedPaths,t);if(tu(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=ru(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=vu(r),a=xu(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of hu(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=bu(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[wu](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,vu(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,vu(e)?{recursive:!0}:void 0);return}let t=vu(e),n=Jl({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:xu(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(Su(n.sourcePath,t),Su(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=au({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!mu(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=gu(e),n=_u(e,t),r=null,i=null;for(let e of this.#be()){if(gu(e)!==t)continue;let a=_u(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=hu(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!mu(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new Ul({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of hu(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(yu),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(yu),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of hu(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:Cu(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of hu(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of hu(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=ku(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,Tu)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#De()))}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=lu(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=lu(this.#c,e,!0),r=[...this.#B].map(t=>lu(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=lu(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return mu(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&ou(e)&&(this.#i=null);let t=ou(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=pu(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},ju=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function Mu(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function Nu(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Pu(e,t){return t?`${e}/`:e}function Fu(e,t=null){let n=ju(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=Mu(t.path);if(e==null)continue;let n=Pu(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of Nu(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var Z,Iu,Lu,Ru,zu,Bu,Vu,Hu,Uu,Wu,Gu={},Ku=[],qu=Array.isArray,Ju=Ku.slice,Yu=Object.assign;function Xu(e){e&&e.parentNode&&e.remove()}function Zu(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?Ju.call(arguments,2):n),Qu(e,o,r,i,null)}function Qu(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Iu,__i:-1,__u:0};return i==null&&Z.vnode!=null&&Z.vnode(a),a}function $u(e){return e.children}function ed(e,t){this.props=e,this.context=t,this.__g=0}function td(e,t){if(t==null)return e.__?td(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?td(e):null}function nd(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return nd(e)}}function rd(e){(8&e.__g||!(e.__g|=8)||!Lu.push(e)||zu++)&&Ru==Z.debounceRendering||((Ru=Z.debounceRendering)||queueMicrotask)(id)}function id(){for(var e,t,n,r,i,a,o,s,c=1;Lu.length;)Lu.length>c&&Lu.sort(Bu),e=Lu.shift(),c=Lu.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=Yu({},r)).__v=r.__v+1,Z.vnode&&Z.vnode(n),fd(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??td(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,md(a,n,o),n.__e!=i&&nd(n)));zu=0}function ad(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||Ku,b=t.length;for(c=od(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?Gu:y[m.__i]||Gu,m.__i=f,_=fd(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&_d(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=sd(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function od(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?Qu(null,o,null,null,null):qu(o)?Qu($u,{children:o},null,null,null):o.constructor==null&&o.__b>0?Qu(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=cd(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=td(s)),vd(s,s));return r}function sd(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=sd(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=td(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function cd(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ld(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function ud(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ld(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ld(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(Vu,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=Hu,e.addEventListener(t,a?Wu:Uu,a)):e.removeEventListener(t,a?Wu:Uu,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function dd(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=Hu++;else if(t.u<n.l)return;return n(Z.event?Z.event(t):t)}}}function fd(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,ee,te,w,T,E,D,O,k,A=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=Z.__b)&&d(t);n:if(typeof A==`function`)try{if(v=t.props,y=`prototype`in A&&A.prototype.render,b=(d=A.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new A(v,x):(t.__c=f=new ed(v,x),f.constructor=A,f.render=yd),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&A.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Yu({},f.__s)),Yu(f.__s,A.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&A.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&A.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=Z.__r,ee=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),te=0;te<f._sb.length;te++)f.__h.push(f._sb[te]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++ee<25);f.state=f.__s,f.getChildContext!=null&&(r=Yu({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),w=d,d!=null&&d.type===$u&&d.key==null&&(w=hd(d.props.children)),s=ad(e,qu(w)?w:[w],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(T=0,E=!1,t.__u|=c?160:128,t.__c.__z=[],D=0;D<a.length;D++)(O=a[D])==null||E||(O.nodeType==8&&O.data==`$s`?(T>0&&t.__c.__z.push(O),T++,a[D]=null):O.nodeType==8&&O.data==`/$s`?(--T>0&&t.__c.__z.push(O),E=T===0,s=a[D],a[D]=null):T>0&&(t.__c.__z.push(O),a[D]=null));if(!E){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(k=a.length;k--;)Xu(a[k]);pd(t)}else t.__e=n.__e,t.__k=n.__k,e.then||pd(t);Z.__e(e,t,n)}else s=t.__e=gd(n.__e,t,n,r,i,a,o,c,l,u);return(d=Z.diffed)&&d(t),128&t.__u?void 0:s}function pd(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(pd)}function md(e,t,n){for(var r=0;r<n.length;r++)_d(n[r],n[++r],n[++r]);Z.__c&&Z.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Z.__e(e,t.__v)}})}function hd(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:qu(e)?e.map(hd):Yu({},e)}function gd(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(Z.__m&&Z.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=Ju.call(e.childNodes),v=n.props||Gu,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;ud(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||ud(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),ad(b==`template`?e.content:e,qu(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&td(n,0),s,c,l),a!=null)for(u=a.length;u--;)Xu(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||ud(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&ud(e,u,g,v[u],i))}return e}function _d(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){Z.__e(e,n)}}function vd(e,t,n){var r,i;if(Z.unmount&&Z.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||_d(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Z.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&vd(r[i],t,n||typeof e.type!=`function`);n||Xu(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function yd(e,t,n){return this.constructor(e,n)}function bd(e,t){var n,r,i,a;t==document&&(t=document.documentElement),Z.__&&Z.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=Zu($u,null,[e]),i=[],a=[],fd(t,e,r||Gu,Gu,t.namespaceURI,r?null:t.firstChild?Ju.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),md(i,e,a)}function xd(e,t){e.__u|=32,bd(e,t)}Z={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw zu=0,e}},Iu=0,ed.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Yu({},this.state);typeof e==`function`&&(e=e(Yu({},n),this.props)),e&&Yu(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),rd(this))},ed.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),rd(this))},ed.prototype.render=$u,Lu=[],zu=0,Bu=function(e,t){return e.__v.__b-t.__v.__b},Vu=/(PointerCapture)$|Capture$/i,Hu=0,Uu=dd(!1),Wu=dd(!0);var Sd=0;Array.isArray;function Q(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Sd,__i:-1,__u:0,__source:i,__self:a};return Z.vnode&&Z.vnode(l),l}var Cd=16,wd=16,Td={};function Ed({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=Td[e]??{width:Cd,height:wd},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Q(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Q(`use`,{href:c})})}var Dd=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},Od=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},kd=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},Ad=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},jd=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},Md=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function Nd({children:e,marker:t,variant:n=`default`}){"use no memo";return Q(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Q(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Q(`span`,{"data-truncate-fade":!0}):t})})}function Pd(e){"use no memo";let{mode:t,children:n}=e;return Q(`div`,{children:[Q(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Q(`span`,{children:n}):n}),Q(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Q(`span`,{children:n}):n})]})}function Fd({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Q(Pd,{mode:t,children:e},`content`),o=Q(Nd,{marker:n,mode:t,variant:r},`marker`),s=Q(`div`,{"data-truncate-fill":!0},`fill`);return Q(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Q(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function Id({children:e,...t}){"use no memo";return Q(Fd,{mode:`truncate`,...t,children:e})}function Ld({children:e,...t}){"use no memo";return Q(Fd,{mode:`fruncate`,...t,children:e})}function Rd({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Q(Id,{...s,children:t[0]}),l=Q(Ld,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Q(`div`,{className:a,style:o});if(e.length<i)return Q(n===`end`?Ld:Id,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Dd:r===`extension`?t=Od:r===`leaf-path`&&(t=kd);else if(typeof r==`number`)t=Ad,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=jd:e===`first`&&(t=Md)}else typeof r==`function`&&(t=r);t??=Dd;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Q(Id,{...s,..._,children:f}),l=Q(Ld,{...s,...v,children:p})}return Q(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Q(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Q(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var zd={endIndex:-1,startIndex:-1};function Bd(e,t,n){return Math.min(Math.max(e,t),n)}function Vd(e,t){return e<0||t<e?zd:{endIndex:t,startIndex:e}}function Hd(e){return e.startIndex<0||e.endIndex<e.startIndex}function Ud(e,t){return Hd(e)?0:(e.endIndex-e.startIndex+1)*t}function Wd(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function Gd(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function Kd(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function qd(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function Jd(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function Yd(e,t,n){if(e.length===0||t<=0)return[];let r=Jd(e),i=Kd(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=qd(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function Xd(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=Bd(t.scrollTop,0,o),c=t.stickyRows??Yd(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=Wd(s,n,t.itemHeight),m=Wd(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?zd:Vd(m,Gd(u+d,n,t.itemHeight)),y=g+1,b=Hd(v)?zd:Vd(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=Ud(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:Hd(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var Zd={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},Qd={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},$d=`Contains git status items`;function ef(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function tf(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return ef({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function nf(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function rf(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function af(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function of(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function sf(e,t){return e!=null&&e>0?e:t}function cf(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function lf(e,t,n,r,i=0){let a=ef({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function uf(e,t,n,r,i,a,o=0){let s=tf({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function df(e,t,n,r,i,a){let o=nf({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function ff(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function pf(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function mf({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Q(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function hf(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function gf(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var _f,vf,yf,bf,xf=Object.is,Sf=0,Cf=[],wf=Z,Tf=wf.__b,Ef=wf.__r,Df=wf.diffed,Of=wf.__c,kf=wf.unmount,Af=wf.__;function jf(e,t){wf.__h&&wf.__h(vf,e,Sf||t),Sf=0;var n=vf.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Mf(e){return Sf=1,Nf(Wf,e)}function Nf(e,t,n){var r=jf(_f++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Wf(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);xf(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=vf,!vf.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,xf(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};vf.__f=!0;var a=vf.shouldComponentUpdate,o=vf.componentWillUpdate;vf.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},vf.shouldComponentUpdate=i}return r.__N||r.__}function Pf(e,t){var n=jf(_f++,3);!wf.__s&&Uf(n.__H,t)&&(n.__=e,n.u=t,vf.__H.__h.push(n))}function Ff(e,t){var n=jf(_f++,4);!wf.__s&&Uf(n.__H,t)&&(n.__=e,n.u=t,vf.__h.push(n))}function $(e){return Sf=5,If(function(){return{current:e}},[])}function If(e,t){var n=jf(_f++,7);return Uf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Lf(e,t){return Sf=8,If(function(){return e},t)}function Rf(){for(var e;e=Cf.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Vf),e.__H.__h.forEach(Hf),e.__H.__h=[]}catch(t){e.__H.__h=[],wf.__e(t,e.__v)}}wf.__b=function(e){vf=null,Tf&&Tf(e)},wf.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Af&&Af(e,t)},wf.__r=function(e){Ef&&Ef(e),_f=0;var t=(vf=e.__c).__H;t&&(yf===vf?(t.__h=[],vf.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(Vf),t.__h.forEach(Hf),t.__h=[],_f=0)),yf=vf},wf.diffed=function(e){Df&&Df(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Cf.push(t)!==1&&bf===wf.requestAnimationFrame||((bf=wf.requestAnimationFrame)||Bf)(Rf)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),yf=vf=null},wf.__c=function(e,t){t.some(function(e){try{e.__h.forEach(Vf),e.__h=e.__h.filter(function(e){return!e.__||Hf(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],wf.__e(n,e.__v)}}),Of&&Of(e,t)},wf.unmount=function(e){kf&&kf(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{Vf(e)}catch(e){t=e}}),n.__H=void 0,t&&wf.__e(t,n.__v))};var zf=typeof requestAnimationFrame==`function`;function Bf(e){var t,n=function(){clearTimeout(r),zf&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);zf&&(t=requestAnimationFrame(n))}function Vf(e){var t=vf,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),vf=t}function Hf(e){var t=vf;e.__c=e.__(),vf=t}function Uf(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!xf(t,e[n])})}function Wf(e,t){return typeof t==`function`?t(e):t}function Gf(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Q(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Q($u,{children:[Q(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Q(Id,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function Kf(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function qf(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function Jf(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function Yf({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=Xd(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:Jf(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?Jf(u,1,t,o):i&&r<=0&&c.length>0?Yd(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var Xf=400,Zf=10,Qf=40,$f=18;function ep(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?tp(e,t,n):a instanceof HTMLElement?a:null}function tp(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function np(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function rp(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function ip(){return navigator.vendor!==`Apple Computer, Inc.`}function ap(e,t){let n=e-t.top;if(n<Qf)return-Math.ceil((Qf-Math.max(0,n))/Qf*$f);let r=t.bottom-e;return r<Qf?Math.ceil((Qf-Math.max(0,r))/Qf*$f):0}function op(e,t){if(e!=null){let t=Zd[e];return t==null?null:{text:t,title:Qd[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:$d}:null}function sp(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function cp(e){return e!=null&&`toggle`in e}function lp(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function up(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function dp(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function fp(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function pp(e,t){return t&&fp(e)||(e.ctrlKey||e.metaKey)&&lp(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var mp=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function hp(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function gp(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function _p(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function vp(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function yp(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function bp(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function xp(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function Sp(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function Cp(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=Sp(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function wp(e,t){return{kind:e.kind,name:qf(e),path:t}}function Tp(e){return e==null?void 0:`${e}__tree`}function Ep(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function Dp(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Op(e,t){if(e==null)return null;if(`text`in e)return Q(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?Dp(e.icon)?t(e.icon):{name:e.icon}:Dp(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Q(`span`,{title:e.title,children:Q(Ed,{...n})})}function kp(e){e!=null&&rf(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function Ap(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=Kf(e);return Q($u,{children:[e.depth>0?Q(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Q(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Q(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Q(Ed,{...t(`file-tree-icon-chevron`)}):Q(Ed,{...t(`file-tree-icon-file`,u)})}),Q(`div`,{"data-item-section":`content`,children:e.isFlattened?Gf(e,c,a):c??Q(Rd,{minimumLength:5,split:`extension`,children:e.name})}),i?Q(`div`,{"data-item-section":`decoration`,children:r==null?null:Op(r,t)}):null,s?Q(`div`,{"data-item-section":`git`,children:Op(o,t)}):null,n?Q(`div`,{"data-item-section":`action`,children:l?Q(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Q(Ed,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function jp(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:ee,contextMenuButtonVisibility:te,contextMenuRightClickEnabled:w,registerRenameInput:T,registerButton:E,resolveIcon:D,renderDecorationForRow:O,openContextMenuForRow:k,onRowClick:A,onKeyDown:j}=e,M=Kf(t),{isParked:N=!1,mode:ne=`flow`,style:re}=r,P=ne===`sticky`,ie=_?.get(M)??null??sp(t.ancestorPaths,v,y),ae=t.kind===`directory`&&(b?.has(M)??!1),oe=O(t,M),se=op(ie,ae),ce=S&&ee,le=oe!=null||x||ce,ue=ce&&te===`always`,de=a.getPath()===M,fe=de?a.getValue():``,pe=P||!de?null:Q(mf,{ref:T,ariaLabel:`Rename ${qf(t)}`,isFlattened:t.isFlattened,value:fe,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),me=Ap(t,D,{actionLaneEnabled:ce,customDecoration:oe,decorationLaneEnabled:le,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:se,gitLaneActive:x,renameInput:pe,showDecorativeActionAffordance:ue}),he={...hf({ariaLabel:qf(t),domId:t.isFocused?Ep(h,M,N):void 0,extraStyle:re,features:{actionLaneEnabled:ce,contextMenuButtonVisibility:ce?te:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:N,itemHeight:g,mode:ne,row:t,state:{containsGitChange:ae,effectiveGitStatus:ie,isContextHovered:s===M,isDragTarget:l?.kind===`directory`&&l.directoryPath===M,isDragging:c?.has(M)===!0,isFocusRinged:t.isFocused&&o===M},targetPath:M}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),w&&(i.focusMountedPathFromInput(M),k(t,M,{anchorRect:_p(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:P?void 0:()=>{i.focusMountedPathFromInput(M)},onKeyDown:P?void 0:j,ref:e=>{E(M,e)}};return!P&&de?Q(`div`,{...he,children:me}):Q(`button`,{...he,type:`button`,draggable:u&&!N,onDragEnd:u&&!N?p:void 0,onDragStart:u&&!N?e=>{f(e,t,M)}:void 0,onMouseDown:e=>{if(P){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!N?e=>{m(e,t,M)}:void 0,onClick:e=>{A(e,t,M,ne)},children:me})}function Mp(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(Kf(e))).map((n,r)=>jp(e,n,t.start+r))}function Np({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=ro,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=$(null),v=$(null),y=$(!1),b=$(null),x=$(null),S=$(null),C=$(null),ee=$(null),te=$(new Map),w=$(new Map),T=$(()=>{}),E=$(null),D=$(0),O=$(!1),k=$(null);k.current!==t&&(O.current=!1,k.current=t);let A=$(!1),j=$(null),M=$(null),N=$(!1),ne=$(null),re=$(null),P=$(null),ie=$(null),ae=$(null),oe=$(null),se=$(null),ce=$(null),le=$(!1),ue=$(null),de=$(null),fe=$(null),pe=$(null),me=If(()=>new Map,[]),[,he]=Mf(0),[ge,F]=Mf(null),[_e,ve]=Mf(null),[ye,be]=Mf(null),[xe,Se]=Mf(null),[Ce,we]=Mf(0),[I,Te]=Mf(null),Ee=$(I);Ee.current=I;let De=$(null),Oe=$(null),ke=$(null),Ae=$(null),Me=$(null),Ne=$(!1),Pe=()=>{Oe.current=null,ke.current=null,Ae.current=null},Fe=(e,t)=>{Oe.current=e,ke.current=null,Ae.current=t==null?null:{path:e,scrollTop:t}},Ie=(e,t)=>{Oe.current=null,ke.current={path:e,viewportOffset:t},Ae.current=null},Le=$(d===`retain`&&t.isSearchOpen()),[Re,ze]=Mf(p);Pf(()=>{p||ze(!1)},[p]);let Be=$(!1),Ve=Lf(()=>{Be.current=!0,ze(e=>e&&!1)},[]),[He,Ue]=Mf(()=>Yf({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[L,We]=Mf(!1);Pf(()=>{We(!0)},[]);let Ge=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ke=e?.contextMenu?.triggerMode??(Ge?`right-click`:`both`),qe=Ke===`both`||Ke===`button`,Je=e?.contextMenu?.buttonVisibility??`when-needed`,Ye=Ke===`both`||Ke===`right-click`;Ff(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Me.current=t,ve(t),Se(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Ne.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Xe=Lf((e,t)=>{yp(te.current,e,t)},[]),Ze=Lf((e,t)=>{yp(w.current,e,t)},[]),Qe=Lf(e=>{x.current=e},[]),$e=Lf(e=>bp(e,w.current,te.current),[]),et=n!=null||r!=null||i!=null,{resolveIcon:tt}=If(()=>je(a),[a]),nt=t[wu](),rt=nt.getPath(),it=rt!=null,at=t.isSearchOpen(),ot=t.getSearchValue(),R=t.getFocusedPath(),z=t.getFocusedIndex(),st=t.getScrollRequest(),ct=t.isDragAndDropEnabled(),lt=t.getDragSession(),ut=If(()=>lt==null?null:new Set(lt.draggedPaths),[lt]),dt=lt?.target??null,ft=lt?.primaryPath??null,pt=Tp(o),{overlayHeight:mt,overlayRows:ht,snapshot:B,visibleRows:gt}=He,_t=B.physical.viewportHeight,V=If(()=>({end:B.window.endIndex,start:B.window.startIndex}),[B.window.endIndex,B.window.startIndex]),vt=ht,yt=B.sticky.rows,bt=B.physical.totalHeight,xt=B.sticky.height,St=If(()=>new Set(yt.map(e=>Kf(e.row))),[yt]),Ct=z>=0&&z>=V.start&&z<=V.end,wt=Lf((e,t)=>u?.({item:wp(e,t),row:e})??null,[u]),Tt=Lf(e=>rf(e==null?null:te.current.get(e)??null)?!0:rf(S.current),[]),Et=Lf(e=>{Tt(t.focusNearestPath(e))},[t,Tt]),Dt=$(Et);Dt.current=Et;let Ot=$(!0),kt=$(()=>{}),At=Lf((t=!0)=>{let n=Ee.current;n!=null&&(Ot.current=Ot.current&&t,Te(null),e?.contextMenu?.onClose?.(),Ot.current&&Et(n.path))},[e?.contextMenu,Et]);kt.current=At;let jt=Lf(e=>{let t=e==null?null:vp(S.current,e);be(e=>e===t?e:t)},[]),Mt=Lf((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=$e(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Fe(n,e?.scrollTop??null),A.current=!0,F(e=>e===n?e:n)}i.focus(),jt(a),Ot.current=!0,Te({anchorRect:r?.anchorRect??null,item:wp(e,n),path:n,source:r?.source??`keyboard`})},[t,$e,jt]),Nt=Lf(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=of(e,_t);ne.current=z<0||e==null?null:Math.max(0,Math.min(z*s-e.scrollTop,Math.max(0,t-s))),N.current=!0}t.startRenaming(e)!==!1&&(Se(`focus`),he(e=>e+1))}},[t,z,s,l,_t]),Pt=Lf((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=of(i,_t),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:Yf({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return A.current=!0,df(i,a,s,l,u,d),T.current(),De.current=n?e:null,!0},[t,s,c,_t,h]),Ft=()=>y.current===!0||pe.current!=null||le.current===!0,It=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Lt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Rt=()=>{ie.current!=null&&(clearTimeout(ie.current),ie.current=null),P.current=null},zt=()=>{oe.current?.remove(),oe.current=null},Bt=()=>{Lt(re.current),re.current=null,ae.current=null},Vt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Ht=()=>{ce.current?.(),ce.current=null,pe.current!=null&&(clearTimeout(pe.current),pe.current=null),le.current=!1,ue.current=null,fe.current=null,de.current!=null&&(de.current.setAttribute(`draggable`,`true`),de.current.style.removeProperty(`touch-action`),de.current=null),zt(),Rt(),Bt(),se.current=null},H=(e,n)=>{let r=S.current?.getRootNode(),i=np(ep(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Ut=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Rt();return}let r=t.getItem(e.directoryPath),i=cp(r)?r:null;if(i==null||i.isExpanded()){Rt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;P.current!==a&&(Rt(),P.current=a,ie.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Wt=()=>{re.current=null;let e=ae.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=ap(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,T.current()),Ut(H(e.clientX,e.clientY)),re.current=It(Wt)},Gt=(e,t)=>{ae.current={clientX:e,clientY:t},re.current??=It(Wt)},Kt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Ht(),zt(),Rt(),Bt(),t.startDrag(r)===!1){e.preventDefault();return}if(se.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),ip())){let t=rp(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Vt(t),oe.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},qt=()=>{zt(),Rt(),Bt(),se.current=null,t.cancelDrag()},Jt=(e,n,r)=>{if(pe.current!=null||le.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;fe.current={clientX:i.clientX,clientY:i.clientY},de.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!le.current;pe.current!=null&&(clearTimeout(pe.current),pe.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),ce.current===o&&(ce.current=null),t&&(a.setAttribute(`draggable`,`true`),de.current===a&&(de.current=null),fe.current=null)},s=e=>{let t=e.touches[0],n=fe.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=Zf*Zf||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),ce.current=o,pe.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),de.current===a&&(de.current=null),fe.current=null;return}le.current=!0,de.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),se.current=n;let e=a.getBoundingClientRect(),s=rp(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Vt(s),oe.current=s,ue.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=ue.current;n!=null&&oe.current!=null&&(oe.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Ut(H(t.clientX,t.clientY)),Gt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&H(n.clientX,n.clientY),t.completeDrag(),Ht()},u=()=>{t.cancelDrag(),Ht()};ce.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},Xf)},Yt=e=>{if(I!=null){if(e.key===`Escape`){At(),e.preventDefault(),e.stopPropagation();return}mp.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(nt.isActive()){if(e.key===`Escape`)nt.cancel();else if(e.key===`Enter`)nt.commit();else return;Se(`focus`),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Nt(R??void 0),e.preventDefault(),e.stopPropagation();return}if(at){if(e.key===`Escape`)N.current=!1,ne.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=of(n,_t);ne.current=z<0||n==null?null:Math.max(0,Math.min(z*s-n.scrollTop,Math.max(0,r-s))),N.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;Se(`focus`),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&up(e)){t.openSearch(e.key),he(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ge&&fp(e),r=pp(e,Ge),i=r&&S.current!=null?af(S.current):null,a=r?new Set(xp(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==R&&a.has(o)){let e=C.current;Fe(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=cp(p)?p:null,h=u!=null&&(St.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=bp(u,w.current,te.current);e==null||n==null?y=!1:Mt(e,u)}else if((e.ctrlKey||e.metaKey)&&lp(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;Se(`focus`);let b=t.getFocusedPath(),x=b!=null&&(St.has(b)||a.has(b)),ee=g&&b!==u,T=n&&c&&o===u&&b===u;if((h||T)&&b!=null&&(ee&&x||T))Fe(b,v?.scrollTop??null),A.current=!0,F(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Ie(b,Cp(S.current,v,i,u,s,xt,_t)),A.current=!0,F(e=>e===b?e:b)):Pe()}he(e=>e+1),e.preventDefault(),e.stopPropagation()};Ff(()=>{if(!(!f||!at)){if(Le.current){Le.current=!1;return}rf(ee.current)}},[at,f]),Ff(()=>{let e=x.current;switch(pf({hasRenderedInput:e!=null,previousRenamingPath:M.current,renamingPath:rt})){case`reset`:M.current=null;return;case`reveal-canonical`:rt!=null&&Pt(rt,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(De.current=null,M.current=rt,rf(e),e.select());return}},[V.end,V.start,rt,Pt,St]),Ff(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=af(e)?.dataset.itemPath??null;F(e=>e===t?e:t)},i=()=>{n(),A.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,af(e)!=null){r();return}A.current=!1,F(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),A.current=!1,F(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;F(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),Ff(()=>{let e=S.current;e!=null&&(B.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[B.physical.scrollTop]),Ff(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;E.current=of(n,g);let a=()=>{let e=t.getVisibleCount(),r=sf(E.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ue(Yf({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!O.current){O.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=sf(E.current,g),i=t.getVisibleRows(e,e)[0]??null;lf(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}T.current=a;let o=!1,l=t.subscribe(()=>{o?he(e=>e+1):o=!0,a()}),u=()=>{Ne.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,we(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||Ne.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),Ee.current!=null&&y.current&&kt.current(),Ne.current===!0){y.current=!1;return}ve(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let ee=typeof ResizeObserver<`u`?new ResizeObserver(e=>{E.current=(e[0]==null?null:cf(e[0]))??of(n,g),a()}):null;return ee?.observe(n),()=>{T.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,E.current=null,ee?.disconnect()}},[t,g,s,c,h]),Ff(()=>{Ge||I==null||At(!1)},[At,Ge,I]);let Xt=If(()=>I==null?null:`${I.path}::${I.source}`,[I]);Ff(()=>{if(Xt==null){m?.clearSlotContent(qa);return}let t=Ee.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??gp(n.getBoundingClientRect()),close:e=>{kt.current(e?.restoreFocus??!0)},restoreFocus:()=>{Ot.current&&Dt.current(Ee.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(qa,i),e?.contextMenu?.onOpen?.(t.item,r),kp(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&kp(i)}),()=>{m?.clearSlotContent(qa)}},[Xt,e?.contextMenu,m]),Ff(()=>{I!=null&&t.getItem(I.path)==null&&At()},[At,I,t]),Ff(()=>{if(I==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(hp(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&At())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),At())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[At,I]),Ff(()=>{let e=C.current,n=S.current;if(e==null||n==null){j.current=R;return}let r=R==null?null:te.current.get(R)??null,i=af(n),a=i?.dataset.itemPath??null,o=it&&x.current===i,c=f&&ee.current===i,l=N.current&&!at,u=ne.current??0,d=De.current,p=Oe.current,m=ke.current,g=Ae.current,_=i!=null,v=A.current||_,y=j.current!==R,b=p!=null&&p===R&&R!=null,w=!1,E=!1;if(st!=null&&st.id!==D.current){D.current=st.id;let n=st.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,_t-s))):xt;w=!0,E=uf(e,n,s,_t,bt,st.offset,t)}t.clearScrollRequest(st.id)}let O=!w&&l&&df(e,z,s,_t,bt,u),k=!w&&d!=null&&d===R&&df(e,z,s,_t,bt,xt),M=!w&&m!=null&&m.path===R&&df(e,z,s,_t,bt,m.viewportOffset),re=!w&&g!=null&&g.path===R&&e.scrollTop!==g.scrollTop;if(re&&(e.scrollTop=g.scrollTop),(re||E||k||M||O||v&&y&&d!==R&&!b&&lf(e,z,s,_t,xt))&&T.current(),w){j.current=R;return}if(!v){j.current=R;return}if(o){j.current=R;return}if(c&&!l){j.current=R;return}if(r==null){l&&z>=0&&(df(e,z,s,_t,bt,u),T.current()),j.current=R;return}(y||l||d===R||p===R||m?.path===R||g?.path===R||a==null||a!==R)&&(rf(r),d===R&&(De.current=null),p===R&&(Oe.current=null),m?.path===R&&(ke.current=null),g?.path===R&&(Ae.current=null),N.current=!1,ne.current=null),j.current=R},[t,z,R,Ct,s,it,at,V,_t,f,st,h,xt,bt,gt]);let Zt=z>=0&&z>=B.visible.startIndex&&z<=B.visible.endIndex,Qt=R!=null&&vt.some(e=>Kf(e.row)===R),$t=Zt||Qt,en=qe&&A.current===!0&&$t?R:null,tn=xe===`pointer`?_e:null,nn=I?.path??Me.current??tn??en??_e,rn=I?.source===`right-click`;Ff(()=>{y.current&&I==null||jt($e(nn))},[I,$e,V,_t,Ce,vt,nn,jt,gt]);let an=Lf(e=>{if(y.current||hp(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&Se(e=>e===`pointer`?e:`pointer`),ve(e=>e===i?e:i)},[]),on=Lf(()=>{ve(null)},[]);Ff(()=>{if(!ct)return;let e=()=>{Ht(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Ht(),t.cancelDrag()}},[t,ct]);let sn=e=>{if(!ct||t.getDragSession()==null||le.current)return;let n=np(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Ut(t.getDragSession()?.target??null),Gt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},cn=e=>{if(!ct||t.getDragSession()==null||le.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Rt(),Bt(),t.setDragTarget(null))},ln=e=>{!ct||t.getDragSession()==null||le.current||(e.preventDefault(),H(e.clientX,e.clientY),t.completeDrag(),zt(),Rt(),Bt(),se.current=null)},un=B.window.height,dn=B.window.offsetTop,fn=Math.min(0,_t-un),pn=Math.min(0,_t-un-xt),mn=ge===R||N.current,hn=R!=null&&mn&&!Ct&&z>=0?gt[z]??t.getVisibleRows(z,z)[0]??null:null,gn=hn==null?null:ff(z,s,V,un),_n=se.current,vn=ft!=null&&_n!=null&&_n.path===ft&&_n.index>=V.start&&_n.index<=V.end,yn=ft!=null&&_n!=null&&_n.path===ft&&!vn&&_n.path!==hn?.path?_n:null,bn=yn==null?null:ff(yn.index,s,V,un),xn=dp((z>=0?gt[z]??t.getVisibleRows(z,z)[0]??null:null)?.ancestorPaths.at(-1)??null),Sn=at&&R!=null?Ep(o,R,!Ct):void 0,Cn=I?.path??(at?R:ge),wn=I?.path??_e,Tn=$e(nn),En=Ge&&qe&&!rn&&!it&&Tn!=null&&ye!=null&&nn!=null,Dn=Ge&&(En||I!=null),On=I?.anchorRect,kn=On==null&&Tn!=null&&ye!=null&&(I!=null||En)?ye:null,An=On==null?kn==null?void 0:{top:`${kn}px`}:{left:`${On.left}px`,position:`fixed`,right:`auto`,top:`${On.top}px`},jn=rn?{opacity:`0`}:void 0,Mn=Lf((e,n,r,i)=>{let a=gf({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:at,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=B.visible.startIndex&&n.index<=B.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(A.current=!0,F(e=>e===c?e:c),Se(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Pt(c,{targetOffset:`sticky-parents`})},[t,at,B.visible.endIndex,B.visible.startIndex,Pt]),Nn=()=>{if(y.current||!qe||nn==null||Tn==null)return;let e=t.getItem(nn);e!=null&&(jt(Tn),Ot.current=!0,Te({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:Tn.getAttribute(`aria-label`)??nn,path:e.getPath()},path:e.getPath(),source:`button`}))},Pn={contextHoverPath:wn,contextMenuButtonTriggerEnabled:qe,contextMenuButtonVisibility:Je,contextMenuEnabled:Ge,contextMenuRightClickEnabled:Ye,contextMenuTriggerMode:Ke,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:ct,draggedPathSet:ut,dragTarget:dt,gitLaneActive:et,gitStatusByPath:n,handleRowDragEnd:qt,handleRowDragStart:Kt,handleRowTouchStart:Jt,ignoredGitDirectories:r,ignoredInheritanceCache:me,instanceId:o,itemHeight:s,onKeyDown:Yt,onRowClick:Mn,openContextMenuForRow:Mt,registerButton:Xe,registerRenameInput:Qe,renameView:nt,renderDecorationForRow:wt,resolveIcon:tt,shouldSuppressContextMenu:Ft,visualFocusPath:Cn},Fn={...Pn,registerButton:Ze};return Q(`div`,{ref:S,id:pt,"data-file-tree-context-menu-button-visibility":Ge&&qe?Je:void 0,"data-file-tree-context-menu-trigger-mode":Ge?Ke:void 0,"data-file-tree-has-context-menu-action-lane":Ge&&qe?`true`:void 0,"data-file-tree-has-git-lane":et?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:ct?cn:void 0,onDragOver:ct?sn:void 0,onDrop:ct?ln:void 0,onKeyDown:Yt,onPointerLeave:Ge?on:void 0,onPointerOver:Ge?an:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Q(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:xn}}),Q(`slot`,{name:Ka,"data-type":`header-slot`}),f?Q(`div`,{"data-file-tree-search-container":!0,"data-open":at?`true`:`false`,children:Q(`input`,{ref:ee,"aria-activedescendant":Sn,"aria-controls":pt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Re?`true`:void 0,value:ot,onBlur:()=>{d===`retain`&&!Be.current||t.closeSearch()},onFocus:Ve,onPointerDown:Ve,onInput:e=>{Ve();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Q(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&L&&vt.length>0?Q(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Q(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${mt}px`},children:vt.map((e,t)=>jp(Fn,e.row,`sticky:${Kf(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${vt.length-t}`}}))})}):null,Q(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${bt}px`},children:[Q(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${dn}px`}}),Q(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${un}px`,top:`${fn}px`,bottom:`${pn}px`},children:[Mp(Pn,V,St),hn!=null&&gn!=null?jp(Pn,hn,`parked:${hn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:ft===hn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${gn}px`}}):null,yn!=null&&bn!=null?jp(Pn,yn,`parked-drag:${yn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${bn}px`}}):null]})]})]}),Ge?Q(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":Dn?`true`:`false`,style:An,children:[Q(`button`,{ref:v,type:`button`,"data-type":Ja,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":I==null?`false`:`true`,"data-visible":En?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),I!=null){At();return}Nn()},tabIndex:-1,style:jn,children:Q(Ed,{...tt(`file-tree-icon-ellipsis`)})}),I==null?null:Q(`slot`,{name:qa})]}):null,I==null?null:Q(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),At()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),At()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var Pp={hydrateRoot:(e,t)=>{xd(Zu(Np,t),e)},renderRoot:(e,t)=>{bd(Zu(Np,t),e)},unmountRoot:e=>{bd(null,e)}};function Fp(e,t){Pp.renderRoot(e,t)}function Ip(e,t){Pp.hydrateRoot(e,t)}function Lp(e){Pp.unmountRoot(e)}var Rp=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},zp=`__c`,Bp=`__k`,Vp=`__d`,Hp=`__s`,Up=/[\s\n\\/='"\0<>]/,Wp=/^(xlink|xmlns|xml)([A-Z])/,Gp=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,Kp=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,qp=new Set([`draggable`,`spellcheck`]);function Jp(e){e.__g===void 0?e[Vp]=!0:e.__g|=8}function Yp(e){e.__g===void 0?e[Vp]=!1:e.__g&=-9}function Xp(e){return e.__g===void 0?!0===e[Vp]:!!(8&e.__g)}var Zp=/["&<]/;function Qp(e){if(e.length===0||!1===Zp.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`"`;break;case 38:i=`&`;break;case 60:i=`<`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var $p={},em=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),tm=/[A-Z]/g;function nm(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:$p[n]||($p[n]=n.replace(tm,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||em.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function rm(){this.__d=!0}function im(e,t){return{__v:e,context:t,props:e.props,setState:rm,forceUpdate:rm,__d:!0,__h:[]}}function am(e,t,n){if(!e.s){if(n instanceof om){if(!n.s)return void(n.o=am.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(am.bind(null,e,t),am.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var om=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{am(r,1,a(this.v))}catch(e){am(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?am(r,1,t?t(i):i):n?am(r,1,n(i)):am(r,2,i)}catch(e){am(r,2,e)}},r},e}(),sm,cm,lm,um,dm={},fm=Array.isArray,pm=Object.assign,mm=``,hm=`<!--$s-->`,gm=`<!--/$s-->`;function _m(e,t){var n,r=e.type,i=!0;return e[zp]?(i=!1,(n=e[zp]).state=n[Hp]):n=new r(e.props,t),e[zp]=n,n.__v=e,n.props=e.props,n.context=t,Jp(n),n.state??=dm,n[Hp]??(n[Hp]=n.state),r.getDerivedStateFromProps?n.state=pm({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[Hp]===n.state?n.state:n[Hp]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),lm&&lm(e),n.render(n.props,n.state,t)}function vm(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===mm)return mm;var s=typeof e;if(s!=`object`)return s==`function`?mm:s==`string`?Qp(e):e+mm;if(fm(e)){var c,l=mm;i[Bp]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=vm(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=mm,fm(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return mm;e.__=i,sm&&sm(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===$u){if(`tpl`in g){for(var x=mm,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!fm(C)?x+=C:x+=vm(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+Qp(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var ee=t[_.__c];b=ee?ee.props.value:_.__}var te=h.prototype&&typeof h.prototype.render==`function`;if(te)v=_m(e,b),y=e[zp];else{e[zp]=y=im(e,b);for(var w=0;Xp(y)&&w++<25;){Yp(y),lm&&lm(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}Jp(y)}if(y.getChildContext!=null&&(t=pm({},t,y.getChildContext())),te&&Z.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===$u&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return vm(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[Hp]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,dm),Xp(y)?(v=_m(e,t),(y=e[zp]).getChildContext!=null&&(t=pm({},t,y.getChildContext())),vm(v=v!=null&&v.type===$u&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):mm}finally{cm&&cm(e),um&&um(e)}}}v=v!=null&&v.type===$u&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var T=vm(v,t,n,r,e,a,o);return cm&&cm(e),Z.unmount&&Z.unmount(e),e._suspended?typeof T==`string`?hm+T+gm:fm(T)?(T.unshift(hm),T.push(gm),T):T.then(function(e){return hm+e+gm}):T}catch(i){if(!a&&o&&o.onError){var E=function i(s){return o.onError(s,e,function(e,s){try{return vm(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(E!==void 0)return E;var D=Z.__e;return D&&D(i,e),mm}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=vm(v,t,n,r,e,a,o);return e._suspended?hm+s+gm:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var O,k=`<`+h,A=mm;for(var j in g){var M=g[j];if(typeof(M=bm(M)?M.value:M)!=`function`||j===`class`||j===`className`){switch(j){case`children`:O=M;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;j=`for`;break;case`className`:if(`class`in g)continue;j=`class`;break;case`defaultChecked`:j=`checked`;break;case`defaultSelected`:j=`selected`;break;case`defaultValue`:case`value`:switch(j=`value`,h){case`textarea`:O=M;continue;case`select`:r=M;continue;case`option`:r!=M||`selected`in g||(k+=` selected`)}break;case`dangerouslySetInnerHTML`:A=M&&M.__html;continue;case`style`:typeof M==`object`&&(M=nm(M));break;case`acceptCharset`:j=`accept-charset`;break;case`httpEquiv`:j=`http-equiv`;break;default:if(Wp.test(j))j=j.replace(Wp,`$1:$2`).toLowerCase();else{if(Up.test(j))continue;j[4]!==`-`&&!qp.has(j)||M==null?n?Kp.test(j)&&(j=j===`panose1`?`panose-1`:j.replace(/([A-Z])/g,`-$1`).toLowerCase()):Gp.test(j)&&(j=j.toLowerCase()):M+=mm}}M!=null&&!1!==M&&(k=!0===M||M===mm?k+` `+j:k+` `+j+`="`+(typeof M==`string`?Qp(M):M+mm)+`"`)}}if(Up.test(h))throw Error(h+` is not a valid HTML tag name in `+k+`>`);if(A||(typeof O==`string`?A=Qp(O):O!=null&&!1!==O&&!0!==O&&(A=vm(O,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),cm&&cm(e),um&&um(e),!A&&ym.has(h))return k+`/>`;var N=`</`+h+`>`,ne=k+`>`;return fm(A)?[ne].concat(A,[N]):typeof A==`string`?ne+A+N:[ne,A,N]}var ym=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function bm(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var xm=0;function Sm(e){return e!=null&&e.length>0?e:(xm+=1,`pst_ft_${xm}`)}function Cm({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??ro)}function wm(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function Tm(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function Em(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var Dm=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new Rp;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=Sm(a),this.#p=Fu(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=no(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new Au({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(Lp(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),Fp(t.wrapper,this.#w()))}setGitStatus(e){this.#p=Fu(e,this.#p);let t=this.#T();t!=null&&Fp(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),Fp(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),Ip(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),Fp(r,this.#w())}#C(){return{initialViewportHeight:Cm({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(Ka,e());return}this.#l.setSlotHtml(Ka,this.#e?.header?.html??null)}#k(e){let t=Em(e).find(e=>Tm(e)),n=wm(Ne(Me(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=Em(e),n=t.find(e=>Tm(e)),r=t.filter(e=>e!==n),i=Me(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=wm(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=Me(this.#m);t.colored&&ke(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${Ha}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(Ha,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=so(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return mo(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}};function Om(e){let[t]=(0,V.useState)(()=>new Dm(e)),n=(0,V.useRef)({timeout:null,model:t});return(0,V.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}function km(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!Object.is(e[n],t[n]))return!1;return!0}function Am(e,t,n){return Object.is(e,t)||n?.(e,t)===!0}function jm(e,t,n){let r=(0,V.useRef)({hasValue:!1,model:null,selector:null,value:void 0}),i=(0,V.useCallback)(t=>e.subscribe(t),[e]),a=(0,V.useCallback)(()=>{let i=r.current,a=t(e);if(i.model!==e||i.selector!==t||!i.hasValue)return i.hasValue=!0,i.model=e,i.selector=t,i.value=a,a;let o=i.value;return Am(o,a,n)?o:(i.value=a,a)},[n,e,t]);return(0,V.useSyncExternalStore)(i,a,a)}function Mm(e,t){return e.isOpen===t.isOpen&&e.value===t.value&&km(e.matchingPaths,t.matchingPaths)}function Nm(e){let t=jm(e,e=>({isOpen:e.isSearchOpen(),matchingPaths:e.getSearchMatchingPaths(),value:e.getSearchValue()}),Mm);return(0,V.useMemo)(()=>({...t,close:()=>{e.closeSearch()},focusNextMatch:()=>{e.focusNextSearchMatch()},focusPreviousMatch:()=>{e.focusPreviousSearchMatch()},open:t=>{e.openSearch(t)},setValue:t=>{e.setSearch(t)}}),[e,t])}var Pm=e=>{if(typeof e!=`object`||!e)return null;let t=e;return typeof t.getAttribute==`function`?t.getAttribute(`data-item-path`):null};function Fm(e){let t=[],n=[];return{isDragInProgress:()=>n.length>0,handleSelectionChange(e){t=e},handleDragStart(e){if(e.dataTransfer===null)return;let r=null;for(let t of e.composedPath())if(r=Pm(t),r!==null)break;if(r===null)return;let i=t.includes(r)?t:[r],a=i.map(e=>Ke(e)).filter(e=>e!==null);a.length!==0&&(n=i,e.dataTransfer.setData($e,a.join(` `)))},handleDragEnd(){if(n.length!==0){for(let t of n)e.deselect(t);n=[]}}}}function Im(e){return typeof e!=`object`||!e||!(`isDirectory`in e)||typeof e.isDirectory!=`function`||!e.isDirectory()||!(`isExpanded`in e)||typeof e.isExpanded!=`function`||!(`expand`in e)||typeof e.expand!=`function`||!(`collapse`in e)||typeof e.collapse!=`function`?null:e}function Lm(e,t){return t.length>0&&t.every(t=>{let n=Im(e.getItem(t));return n!==null&&n.isExpanded()})}function Rm(e,t,n){for(let r of t){let t=Im(e.getItem(r));t===null||t.isExpanded()===n||(n?t.expand():t.collapse())}}var zm=`
|
|
2180
2180
|
:host {
|
|
2181
2181
|
--trees-bg-override: transparent;
|
|
2182
2182
|
--trees-selected-bg-override: color-mix(in srgb, currentColor 12%, transparent);
|
|
@@ -2186,7 +2186,7 @@ import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./index-DrITfTB
|
|
|
2186
2186
|
--trees-font-size-override: 12px;
|
|
2187
2187
|
}
|
|
2188
2188
|
button[data-type='item'] { border-radius: 5px; }
|
|
2189
|
-
`;function Bm(e){return e.kind===`directory`?`${e.path}/`:e.path}function Vm(e){let t=(0,Wt.c)(14),n;t[0]===e.onRefresh?n=t[1]:(n=(0,H.jsx)(d,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Refresh workspace files`,onClick:e.onRefresh}),t[0]=e.onRefresh,t[1]=n);let r=e.isPending&&`animate-spin`,i;t[2]===r?i=t[3]:(i=f(r),t[2]=r,t[3]=i);let a;t[4]===i?a=t[5]:(a=(0,H.jsx)(ne,{className:i}),t[4]=i,t[5]=a);let o;t[6]!==n||t[7]!==a?(o=(0,H.jsx)(v,{render:n,children:a}),t[6]=n,t[7]=a,t[8]=o):o=t[8];let s=e.isPending?`Refreshing…`:`Refresh files`,c;t[9]===s?c=t[10]:(c=(0,H.jsx)(C,{children:s}),t[9]=s,t[10]=c);let l;return t[11]!==o||t[12]!==c?(l=(0,H.jsxs)(b,{children:[o,c]}),t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function Hm(e){let t=(0,Wt.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):(n=t=>e.onValueChange(t.target.value),r=t=>{t.key===`Escape`&&(e.onClose(),t.currentTarget.blur())},t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==e.ariaLabel||t[4]!==e.name||t[5]!==e.value||t[6]!==n||t[7]!==r?(i=(0,H.jsx)(P,{variant:`ghost`,className:`h-7 min-w-0 flex-1`,children:(0,H.jsx)(A,{type:`search`,name:e.name,size:`sm`,value:e.value,"aria-label":e.ariaLabel,placeholder:`Search files`,spellCheck:!1,onChange:n,onKeyDown:r})}),t[3]=e.ariaLabel,t[4]=e.name,t[5]=e.value,t[6]=n,t[7]=r,t[8]=i):i=t[8],i}function Um({environmentId:e,cwd:t,projectName:n,selectedPath:r,selectedPathRevealId:i,onOpenFile:a,onRefreshSelectedFile:o,workspaceMutationId:s}){let{resolvedTheme:c}=E(),l=Je(),u=B(e,t),f=u.data?.entries??[],p=(0,V.useMemo)(()=>new Map(f.map(e=>[e.path,e.kind])),[f]),m=(0,V.useRef)(p),h=(0,V.useMemo)(()=>f.map(Bm),[f]),g=(0,V.useMemo)(()=>f.filter(e=>e.kind===`directory`).map(Bm),[f]),_=(0,V.useRef)([]),S=(0,V.useRef)(!1),w=(0,V.useRef)(null),T=(0,V.useRef)(null),D=(0,V.useRef)(null);(0,V.useEffect)(()=>{let e=e=>{D.current={x:e.clientX,y:e.clientY,at:e.timeStamp}};return document.addEventListener(`contextmenu`,e,!0),()=>document.removeEventListener(`contextmenu`,e,!0)},[]);let O=async(e,t)=>{let n=ee();if(!n){t.close();return}let r=e.path.replace(/\/$/,``),i=Re(r),a=D.current,o=a!==null&&performance.now()-a.at<1e3,s=t.anchorElement.getBoundingClientRect(),c=o?{x:a.x,y:a.y}:{x:s.left,y:s.bottom};try{let e=await n.contextMenu.show([{id:`copy-mention`,label:`Copy mention`},{id:`add-to-chat`,label:`Add to chat`}],c);if(e===`copy-mention`){try{await y(i),x.add({type:`success`,title:`Mention copied`,description:r})}catch(e){x.add({type:`error`,title:`Failed to copy mention`,description:e instanceof Error?e.message:`An error occurred.`})}return}if(e===`add-to-chat`){let e=l?.current;if(!e){x.add({type:`error`,title:`Unable to add to chat`,description:`Open a chat for this project and try again.`});return}e.insertTextAtEnd(`${i} `,{ensureLeadingBoundary:!0})||x.add({type:`error`,title:`Unable to add to chat`,description:`The chat isn't ready to accept input right now.`})}}finally{t.close()}},k=(0,V.useRef)(O);(0,V.useEffect)(()=>{k.current=O});let A=(0,V.useRef)(null),j=(0,V.useMemo)(()=>Fm({deselect:e=>A.current?.getItem(e)?.deselect()}),[]),{model:M}=Om({composition:{contextMenu:{triggerMode:`right-click`,onOpen:(e,t)=>{k.current(e,t)}}},dragAndDrop:{canDrop:()=>!1},density:`compact`,fileTreeSearchMode:`hide-non-matches`,flattenEmptyDirectories:!0,initialExpansion:1,icons:De,onSelectionChange:e=>{if(j.handleSelectionChange(e),S.current||j.isDragInProgress())return;let t=e.at(-1)?.replace(/\/$/,``);t&&m.current.get(t)===`file`&&(w.current=t,a(t))},paths:[],search:!1,unsafeCSS:zm}),N=Nm(M),P=jm(M,e=>Lm(e,g)),te=()=>{Rm(M,g,!P)},ne=e=>{if(e.trim().length===0){N.close();return}N.setValue(e)},re=()=>{u.refresh(),o?.()};rt({mutationId:s,refresh:u.refresh,resourceKey:`files:${e}:${t}`}),(0,V.useEffect)(()=>{_.current!==h&&(m.current=p,_.current=h,M.resetPaths(h))},[p,M,h]),(0,V.useEffect)(()=>{if(!r){T.current=null;return}let e={path:r,revealId:i},t=T.current;if(t?.path===e.path&&t.revealId===e.revealId||p.get(r)!==`file`)return;let n=M.getItem(r);if(!n)return;if(M.getSelectedPaths().some(e=>e.replace(/\/$/,``)===r)&&w.current===r){w.current=null,T.current=e;return}w.current=null,T.current=e,S.current=!0,M.closeSearch();for(let e of M.getSelectedPaths())M.getItem(e)?.deselect();let a=r.split(`/`),o=``;for(let e of a.slice(0,-1)){o=o?`${o}/${e}`:e;let t=M.getItem(`${o}/`)??M.getItem(o);t&&`expand`in t&&t.expand()}n.select(),M.scrollToPath(r,{focus:!0,offset:`center`}),queueMicrotask(()=>{S.current=!1})},[p,M,r,i,h]);let ie=(0,V.useRef)(null);return(0,V.useEffect)(()=>{A.current=M},[M]),(0,V.useEffect)(()=>{let e=ie.current;if(e===null)return;let t=e=>j.handleDragStart(e),n=()=>j.handleDragEnd();return e.addEventListener(`dragstart`,t,!0),e.addEventListener(`dragend`,n),()=>{e.removeEventListener(`dragstart`,t,!0),e.removeEventListener(`dragend`,n)}},[j]),(0,H.jsxs)(`div`,{ref:ie,className:`flex min-h-0 flex-1 flex-col bg-background`,"data-file-browser-panel":`${e}:${t}`,children:[(0,H.jsxs)(`div`,{className:`flex h-10 min-h-10 shrink-0 items-center gap-1 border-b border-border/60 bg-background px-2 in-data-[preview-panel-mode=inline]:mb-1 in-data-[preview-panel-mode=inline]:h-9 in-data-[preview-panel-mode=inline]:min-h-9 in-data-[preview-panel-mode=inline]:border-b-transparent`,"data-surface-subheader":!0,children:[(0,H.jsx)(Vm,{isPending:u.isPending,onRefresh:re}),(0,H.jsx)(Hm,{name:`project-files-search`,ariaLabel:`Search ${n} files`,value:N.value,onValueChange:ne,onClose:N.close}),g.length>0?(0,H.jsxs)(b,{children:[(0,H.jsx)(v,{render:(0,H.jsx)(d,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":P?`Collapse all folders`:`Expand all folders`,onClick:te}),children:P?(0,H.jsx)(ae,{className:`size-3.5`}):(0,H.jsx)(Ee,{className:`size-3.5`})}),(0,H.jsx)(C,{children:P?`Collapse all folders`:`Expand all folders`})]}):null]}),u.error&&u.data===null?(0,H.jsx)(`div`,{className:`p-4 text-xs leading-relaxed text-destructive`,children:u.error}):(0,H.jsx)(eo,{model:M,"aria-label":`${n} files`,className:`min-h-0 flex-1 overflow-hidden`,style:{colorScheme:c,"--trees-fg-override":`var(--contrast-foreground)`}})]})}function Wm(e){let t=(0,Wt.c)(14),n;t[0]===e.relativePath?n=t[1]:(n=e.relativePath.lastIndexOf(`/`),t[0]=e.relativePath,t[1]=n);let r;t[2]===e.relativePath?r=t[3]:(r=e.relativePath.lastIndexOf(`\\`),t[2]=e.relativePath,t[3]=r);let i=Math.max(n,r),a;t[4]!==i||t[5]!==e.cwd||t[6]!==e.relativePath?(a=i>=0?pe(e.relativePath.slice(0,i),e.cwd):e.cwd,t[4]=i,t[5]=e.cwd,t[6]=e.relativePath,t[7]=a):a=t[7];let o=a,s;return t[8]!==o||t[9]!==e.cwd||t[10]!==e.onTaskListChange||t[11]!==e.text||t[12]!==e.threadRef?(s=(0,H.jsx)(Fe,{text:e.text,cwd:e.cwd,imageBaseDir:o,threadRef:e.threadRef,className:`mx-auto max-w-4xl px-6 py-5`,onTaskListChange:e.onTaskListChange}),t[8]=o,t[9]=e.cwd,t[10]=e.onTaskListChange,t[11]=e.text,t[12]=e.threadRef,t[13]=s):s=t[13],s}function Gm({root:e,editor:t,onDismiss:n}){n(),t.setSelections([]);let r=e.querySelector(`diffs-container`)?.shadowRoot?.activeElement;r instanceof HTMLElement&&r.blur()}function Km(e){return e.querySelector(`diffs-container`)?.shadowRoot?.activeElement?.hasAttribute(`data-content`)===!0}function qm({root:e,editor:t,isBlocked:n,onDismiss:r}){let i=i=>{n()||i.composedPath().includes(e)||Gm({root:e,editor:t,onDismiss:r})},a=i=>{i.key!==`Escape`||n()||!Km(e)||(i.preventDefault(),i.stopImmediatePropagation(),Gm({root:e,editor:t,onDismiss:r}))};return document.addEventListener(`pointerdown`,i,!0),document.addEventListener(`keydown`,a,!0),()=>{document.removeEventListener(`pointerdown`,i,!0),document.removeEventListener(`keydown`,a,!0)}}function Jm(e){let t=e.renderedLine===void 0?e.fileTop+e.estimatedLine.top:e.scrollTop+e.renderedLine.top-e.viewportTop,n=e.renderedLine?.height??e.estimatedLine.height,r=Math.max(0,t-Math.max(0,(e.viewportHeight-n)/2));return Math.min(r,Math.max(0,e.scrollHeight-e.viewportHeight))}var Ym=n;function Xm(e,t,n){return`${e}:${t}:${Ym(n)}`}function Zm(e,t,n,r,i){return i?.contents===r&&i.cacheKey?i.cacheKey:`editor:${e}:${Xm(t,n,r)}`}function Qm(e,t){let n=t.split(`/`).filter(Boolean);return[{label:e,path:``,kind:`project`},...n.map((e,t)=>({label:e,path:n.slice(0,t+1).join(`/`),kind:t===n.length-1?`file`:`directory`}))]}function $m(e){let t=(0,Wt.c)(13),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,H.jsx)(k,{variant:`icon`,children:(0,H.jsx)(kt,{})}),r=(0,H.jsx)(M,{children:`Can't preview this file`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;t[2]===e.fileName?i=t[3]:(i=(0,H.jsxs)(N,{children:[e.fileName,` isn't a text file, so it can't be shown here.`]}),t[2]=e.fileName,t[3]=i);let a;t[4]!==e.absolutePath||t[5]!==e.environmentId||t[6]!==e.fileName||t[7]!==e.projectId||t[8]!==e.threadRef?(a=e.absolutePath===null?null:(0,H.jsx)(j,{children:(0,H.jsx)(eh,{projectId:e.projectId,absolutePath:e.absolutePath,environmentId:e.environmentId,fileName:e.fileName,threadRef:e.threadRef})}),t[4]=e.absolutePath,t[5]=e.environmentId,t[6]=e.fileName,t[7]=e.projectId,t[8]=e.threadRef,t[9]=a):a=t[9];let o;return t[10]!==i||t[11]!==a?(o=(0,H.jsxs)(te,{children:[n,r,i,a]}),t[10]=i,t[11]=a,t[12]=o):o=t[12],o}function eh(e){let t=(0,Wt.c)(13),n;t[0]!==e.absolutePath||t[1]!==e.projectId||t[2]!==e.threadRef?(n=e.projectId?{_tag:`project-file`,projectId:e.projectId,path:e.absolutePath}:{_tag:`workspace-file`,threadId:e.threadRef.threadId,path:e.absolutePath},t[0]=e.absolutePath,t[1]=e.projectId,t[2]=e.threadRef,t[3]=n):n=t[3];let r=ft(e.environmentId,n);if(r._tag===`Failure`){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This file can't be downloaded from here.`}),t[4]=e):e=t[4],e}let i=r._tag!==`Success`,a;t[5]!==r._tag||t[6]!==r.url||t[7]!==e.fileName?(a=()=>{if(r._tag!==`Success`)return;let t=document.createElement(`a`);t.href=r.url,t.download=e.fileName,t.click()},t[5]=r._tag,t[6]=r.url,t[7]=e.fileName,t[8]=a):a=t[8];let o;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,H.jsx)(g,{}),t[9]=o):o=t[9];let s;return t[10]!==i||t[11]!==a?(s=(0,H.jsxs)(d,{disabled:i,onClick:a,size:`sm`,variant:`outline`,children:[o,`Download`]}),t[10]=i,t[11]=a,t[12]=s):s=t[12],s}function th(e,t,n){return t<0||e[t]!==`[`||!/[ xX]/.test(e[t+1]??``)||e[t+2]!==`]`?e:`${e.slice(0,t+1)}${n?`x`:` `}${e.slice(t+2)}`}var nh=class{options;timer=null;latestContents=``;latestRevision=0;confirmedRevision=0;lastChangeAt=0;baseContents;saving=!1;disposed=!1;constructor(e){this.options=e,this.baseContents=e.baseContents??``}change(e){this.disposed||(this.latestContents=e,this.latestRevision+=1,this.lastChangeAt=Date.now(),this.options.onPendingChange(!0),this.schedule(this.options.debounceMs))}discard(e){this.disposed||(this.clearTimer(),this.latestContents=e,this.baseContents=e,this.confirmedRevision=this.latestRevision,this.options.onDiscard?.(e))}retry(){this.disposed||(this.options.onRetry?.(),this.confirmedRevision=0,this.schedule(0))}dispose(){this.disposed=!0,this.clearTimer(),this.latestRevision>0&&this.persistLatest()}schedule(e){this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,this.persistLatest()},e)}clearTimer(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null)}async persistLatest(){if(this.saving||this.latestRevision===this.confirmedRevision)return;this.saving=!0;let e=this.latestContents,t=this.latestRevision,n=await this.options.persist(e),r=n._tag===`Success`;if(r)this.confirmedRevision=t,this.baseContents=e,this.options.onConfirmed(e);else if(this.options.onFailure?.(n,{baseContents:this.baseContents,localContents:e})){this.confirmedRevision=t,this.saving=!1;return}if(this.saving=!1,t===this.latestRevision){r&&this.options.onPendingChange(!1);return}let i=Math.max(0,this.options.debounceMs-(Date.now()-this.lastChangeAt));this.disposed?this.persistLatest():this.schedule(i)}},rh=(0,V.lazy)(()=>t(()=>import(`./PdfPreview-VSGe6F9I.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),ih=(0,V.lazy)(()=>t(()=>import(`./DocxPreview-HXde7oD1.js`),__vite__mapDeps([9,1,2,3,4,5,10,7,8,11,12,13]))),ah=(0,V.lazy)(()=>t(()=>import(`./XlsxPreview-BPtt3tW-.js`),__vite__mapDeps([14,1,2,3,4,5,7,8,11,12]))),oh=(0,V.lazy)(()=>t(()=>import(`./PptxPreview-CZZ5e7rI.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,11,12]))),sh=(0,V.lazy)(()=>t(()=>import(`./HtmlPreview-pfh_hRgS.js`),__vite__mapDeps([16,4,1,5,17,2,3,18,19,7,8])));function ch(e){let t=(0,Wt.c)(13),n;t[0]!==e.absolutePath||t[1]!==e.projectId||t[2]!==e.threadRef?(n=e.projectId?{_tag:`project-file`,projectId:e.projectId,path:e.absolutePath}:{_tag:`workspace-file`,threadId:e.threadRef.threadId,path:e.absolutePath},t[0]=e.absolutePath,t[1]=e.projectId,t[2]=e.threadRef,t[3]=n):n=t[3];let r=ft(e.environmentId,n),i;t[4]===e.fileName?i=t[5]:(i=lh(e.fileName),t[4]=e.fileName,t[5]=i);let a=i;if(a===null)return null;if(r._tag===`Failure`){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:`Unable to load this document.`}),t[6]=e):e=t[6],e}if(r._tag!==`Success`){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,H.jsx)(_t,{className:`size-5`})}),t[7]=e):e=t[7],e}let o=a,s;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,H.jsx)(_t,{className:`size-5`})}),t[8]=s):s=t[8];let c;return t[9]!==o||t[10]!==r.url||t[11]!==e.fileName?(c=(0,H.jsx)(V.Suspense,{fallback:s,children:(0,H.jsx)(o,{fileName:e.fileName,url:r.url})}),t[9]=o,t[10]=r.url,t[11]=e.fileName,t[12]=c):c=t[12],c}function lh(e){let t=e.toLowerCase();return t.endsWith(`.pdf`)?rh:t.endsWith(`.docx`)?ih:t.endsWith(`.xlsx`)?ah:t.endsWith(`.pptx`)?oh:null}var uh=`borgcode.fileExplorerOpen`,dh=`borgcode.renderMarkdown`,fh=`borgcode.renderHtml`,ph=500,mh=`data-file-link-reveal`,hh=`
|
|
2189
|
+
`;function Bm(e){return e.kind===`directory`?`${e.path}/`:e.path}function Vm(e){let t=(0,Wt.c)(14),n;t[0]===e.onRefresh?n=t[1]:(n=(0,H.jsx)(d,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Refresh workspace files`,onClick:e.onRefresh}),t[0]=e.onRefresh,t[1]=n);let r=e.isPending&&`animate-spin`,i;t[2]===r?i=t[3]:(i=f(r),t[2]=r,t[3]=i);let a;t[4]===i?a=t[5]:(a=(0,H.jsx)(re,{className:i}),t[4]=i,t[5]=a);let o;t[6]!==n||t[7]!==a?(o=(0,H.jsx)(y,{render:n,children:a}),t[6]=n,t[7]=a,t[8]=o):o=t[8];let s=e.isPending?`Refreshing…`:`Refresh files`,c;t[9]===s?c=t[10]:(c=(0,H.jsx)(C,{children:s}),t[9]=s,t[10]=c);let l;return t[11]!==o||t[12]!==c?(l=(0,H.jsxs)(x,{children:[o,c]}),t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function Hm(e){let t=(0,Wt.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):(n=t=>e.onValueChange(t.target.value),r=t=>{t.key===`Escape`&&(e.onClose(),t.currentTarget.blur())},t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==e.ariaLabel||t[4]!==e.name||t[5]!==e.value||t[6]!==n||t[7]!==r?(i=(0,H.jsx)(N,{variant:`ghost`,className:`h-7 min-w-0 flex-1`,children:(0,H.jsx)(k,{type:`search`,name:e.name,size:`sm`,value:e.value,"aria-label":e.ariaLabel,placeholder:`Search files`,spellCheck:!1,onChange:n,onKeyDown:r})}),t[3]=e.ariaLabel,t[4]=e.name,t[5]=e.value,t[6]=n,t[7]=r,t[8]=i):i=t[8],i}function Um({environmentId:e,cwd:t,projectName:n,selectedPath:r,selectedPathRevealId:i,onOpenFile:a,onRefreshSelectedFile:o,workspaceMutationId:s}){let{resolvedTheme:c}=w(),l=Je(),u=B(e,t),f=u.data?.entries??[],p=(0,V.useMemo)(()=>new Map(f.map(e=>[e.path,e.kind])),[f]),m=(0,V.useRef)(p),h=(0,V.useMemo)(()=>f.map(Bm),[f]),g=(0,V.useMemo)(()=>f.filter(e=>e.kind===`directory`).map(Bm),[f]),_=(0,V.useRef)([]),v=(0,V.useRef)(!1),te=(0,V.useRef)(null),T=(0,V.useRef)(null),E=(0,V.useRef)(null);(0,V.useEffect)(()=>{let e=e=>{E.current={x:e.clientX,y:e.clientY,at:e.timeStamp}};return document.addEventListener(`contextmenu`,e,!0),()=>document.removeEventListener(`contextmenu`,e,!0)},[]);let D=async(e,t)=>{let n=ee();if(!n){t.close();return}let r=e.path.replace(/\/$/,``),i=Re(r),a=E.current,o=a!==null&&performance.now()-a.at<1e3,s=t.anchorElement.getBoundingClientRect(),c=o?{x:a.x,y:a.y}:{x:s.left,y:s.bottom};try{let e=await n.contextMenu.show([{id:`copy-mention`,label:`Copy mention`},{id:`add-to-chat`,label:`Add to chat`}],c);if(e===`copy-mention`){try{await b(i),S.add({type:`success`,title:`Mention copied`,description:r})}catch(e){S.add({type:`error`,title:`Failed to copy mention`,description:e instanceof Error?e.message:`An error occurred.`})}return}if(e===`add-to-chat`){let e=l?.current;if(!e){S.add({type:`error`,title:`Unable to add to chat`,description:`Open a chat for this project and try again.`});return}e.insertTextAtEnd(`${i} `,{ensureLeadingBoundary:!0})||S.add({type:`error`,title:`Unable to add to chat`,description:`The chat isn't ready to accept input right now.`})}}finally{t.close()}},O=(0,V.useRef)(D);(0,V.useEffect)(()=>{O.current=D});let k=(0,V.useRef)(null),A=(0,V.useMemo)(()=>Fm({deselect:e=>k.current?.getItem(e)?.deselect()}),[]),{model:j}=Om({composition:{contextMenu:{triggerMode:`right-click`,onOpen:(e,t)=>{O.current(e,t)}}},dragAndDrop:{canDrop:()=>!1},density:`compact`,fileTreeSearchMode:`hide-non-matches`,flattenEmptyDirectories:!0,initialExpansion:1,icons:De,onSelectionChange:e=>{if(A.handleSelectionChange(e),v.current||A.isDragInProgress())return;let t=e.at(-1)?.replace(/\/$/,``);t&&m.current.get(t)===`file`&&(te.current=t,a(t))},paths:[],search:!1,unsafeCSS:zm}),M=Nm(j),N=jm(j,e=>Lm(e,g)),ne=()=>{Rm(j,g,!N)},re=e=>{if(e.trim().length===0){M.close();return}M.setValue(e)},P=()=>{u.refresh(),o?.()};rt({mutationId:s,refresh:u.refresh,resourceKey:`files:${e}:${t}`}),(0,V.useEffect)(()=>{_.current!==h&&(m.current=p,_.current=h,j.resetPaths(h))},[p,j,h]),(0,V.useEffect)(()=>{if(!r){T.current=null;return}let e={path:r,revealId:i},t=T.current;if(t?.path===e.path&&t.revealId===e.revealId||p.get(r)!==`file`)return;let n=j.getItem(r);if(!n)return;if(j.getSelectedPaths().some(e=>e.replace(/\/$/,``)===r)&&te.current===r){te.current=null,T.current=e;return}te.current=null,T.current=e,v.current=!0,j.closeSearch();for(let e of j.getSelectedPaths())j.getItem(e)?.deselect();let a=r.split(`/`),o=``;for(let e of a.slice(0,-1)){o=o?`${o}/${e}`:e;let t=j.getItem(`${o}/`)??j.getItem(o);t&&`expand`in t&&t.expand()}n.select(),j.scrollToPath(r,{focus:!0,offset:`center`}),queueMicrotask(()=>{v.current=!1})},[p,j,r,i,h]);let ie=(0,V.useRef)(null);return(0,V.useEffect)(()=>{k.current=j},[j]),(0,V.useEffect)(()=>{let e=ie.current;if(e===null)return;let t=e=>A.handleDragStart(e),n=()=>A.handleDragEnd();return e.addEventListener(`dragstart`,t,!0),e.addEventListener(`dragend`,n),()=>{e.removeEventListener(`dragstart`,t,!0),e.removeEventListener(`dragend`,n)}},[A]),(0,H.jsxs)(`div`,{ref:ie,className:`flex min-h-0 flex-1 flex-col bg-background`,"data-file-browser-panel":`${e}:${t}`,children:[(0,H.jsxs)(`div`,{className:`flex h-10 min-h-10 shrink-0 items-center gap-1 border-b border-border/60 bg-background px-2 in-data-[preview-panel-mode=inline]:mb-1 in-data-[preview-panel-mode=inline]:h-9 in-data-[preview-panel-mode=inline]:min-h-9 in-data-[preview-panel-mode=inline]:border-b-transparent`,"data-surface-subheader":!0,children:[(0,H.jsx)(Vm,{isPending:u.isPending,onRefresh:P}),(0,H.jsx)(Hm,{name:`project-files-search`,ariaLabel:`Search ${n} files`,value:M.value,onValueChange:re,onClose:M.close}),g.length>0?(0,H.jsxs)(x,{children:[(0,H.jsx)(y,{render:(0,H.jsx)(d,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":N?`Collapse all folders`:`Expand all folders`,onClick:ne}),children:N?(0,H.jsx)(ae,{className:`size-3.5`}):(0,H.jsx)(Ee,{className:`size-3.5`})}),(0,H.jsx)(C,{children:N?`Collapse all folders`:`Expand all folders`})]}):null]}),u.error&&u.data===null?(0,H.jsx)(`div`,{className:`p-4 text-xs leading-relaxed text-destructive`,children:u.error}):(0,H.jsx)(eo,{model:j,"aria-label":`${n} files`,className:`min-h-0 flex-1 overflow-hidden`,style:{colorScheme:c,"--trees-fg-override":`var(--contrast-foreground)`}})]})}function Wm(e){let t=(0,Wt.c)(14),n;t[0]===e.relativePath?n=t[1]:(n=e.relativePath.lastIndexOf(`/`),t[0]=e.relativePath,t[1]=n);let r;t[2]===e.relativePath?r=t[3]:(r=e.relativePath.lastIndexOf(`\\`),t[2]=e.relativePath,t[3]=r);let i=Math.max(n,r),a;t[4]!==i||t[5]!==e.cwd||t[6]!==e.relativePath?(a=i>=0?pe(e.relativePath.slice(0,i),e.cwd):e.cwd,t[4]=i,t[5]=e.cwd,t[6]=e.relativePath,t[7]=a):a=t[7];let o=a,s;return t[8]!==o||t[9]!==e.cwd||t[10]!==e.onTaskListChange||t[11]!==e.text||t[12]!==e.threadRef?(s=(0,H.jsx)(Fe,{text:e.text,cwd:e.cwd,imageBaseDir:o,threadRef:e.threadRef,className:`mx-auto max-w-4xl px-6 py-5`,onTaskListChange:e.onTaskListChange}),t[8]=o,t[9]=e.cwd,t[10]=e.onTaskListChange,t[11]=e.text,t[12]=e.threadRef,t[13]=s):s=t[13],s}function Gm({root:e,editor:t,onDismiss:n}){n(),t.setSelections([]);let r=e.querySelector(`diffs-container`)?.shadowRoot?.activeElement;r instanceof HTMLElement&&r.blur()}function Km(e){return e.querySelector(`diffs-container`)?.shadowRoot?.activeElement?.hasAttribute(`data-content`)===!0}function qm({root:e,editor:t,isBlocked:n,onDismiss:r}){let i=i=>{n()||i.composedPath().includes(e)||Gm({root:e,editor:t,onDismiss:r})},a=i=>{i.key!==`Escape`||n()||!Km(e)||(i.preventDefault(),i.stopImmediatePropagation(),Gm({root:e,editor:t,onDismiss:r}))};return document.addEventListener(`pointerdown`,i,!0),document.addEventListener(`keydown`,a,!0),()=>{document.removeEventListener(`pointerdown`,i,!0),document.removeEventListener(`keydown`,a,!0)}}function Jm(e){let t=e.renderedLine===void 0?e.fileTop+e.estimatedLine.top:e.scrollTop+e.renderedLine.top-e.viewportTop,n=e.renderedLine?.height??e.estimatedLine.height,r=Math.max(0,t-Math.max(0,(e.viewportHeight-n)/2));return Math.min(r,Math.max(0,e.scrollHeight-e.viewportHeight))}var Ym=n;function Xm(e,t,n){return`${e}:${t}:${Ym(n)}`}function Zm(e,t,n,r,i){return i?.contents===r&&i.cacheKey?i.cacheKey:`editor:${e}:${Xm(t,n,r)}`}function Qm(e,t){let n=t.split(`/`).filter(Boolean);return[{label:e,path:``,kind:`project`},...n.map((e,t)=>({label:e,path:n.slice(0,t+1).join(`/`),kind:t===n.length-1?`file`:`directory`}))]}function $m(e){let t=(0,Wt.c)(13),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,H.jsx)(O,{variant:`icon`,children:(0,H.jsx)(kt,{})}),r=(0,H.jsx)(j,{children:`Can't preview this file`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;t[2]===e.fileName?i=t[3]:(i=(0,H.jsxs)(M,{children:[e.fileName,` isn't a text file, so it can't be shown here.`]}),t[2]=e.fileName,t[3]=i);let a;t[4]!==e.absolutePath||t[5]!==e.environmentId||t[6]!==e.fileName||t[7]!==e.projectId||t[8]!==e.threadRef?(a=e.absolutePath===null?null:(0,H.jsx)(A,{children:(0,H.jsx)(eh,{projectId:e.projectId,absolutePath:e.absolutePath,environmentId:e.environmentId,fileName:e.fileName,threadRef:e.threadRef})}),t[4]=e.absolutePath,t[5]=e.environmentId,t[6]=e.fileName,t[7]=e.projectId,t[8]=e.threadRef,t[9]=a):a=t[9];let o;return t[10]!==i||t[11]!==a?(o=(0,H.jsxs)(ne,{children:[n,r,i,a]}),t[10]=i,t[11]=a,t[12]=o):o=t[12],o}function eh(e){let t=(0,Wt.c)(13),n;t[0]!==e.absolutePath||t[1]!==e.projectId||t[2]!==e.threadRef?(n=e.projectId?{_tag:`project-file`,projectId:e.projectId,path:e.absolutePath}:{_tag:`workspace-file`,threadId:e.threadRef.threadId,path:e.absolutePath},t[0]=e.absolutePath,t[1]=e.projectId,t[2]=e.threadRef,t[3]=n):n=t[3];let r=ft(e.environmentId,n);if(r._tag===`Failure`){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This file can't be downloaded from here.`}),t[4]=e):e=t[4],e}let i=r._tag!==`Success`,a;t[5]!==r._tag||t[6]!==r.url||t[7]!==e.fileName?(a=()=>{if(r._tag!==`Success`)return;let t=document.createElement(`a`);t.href=r.url,t.download=e.fileName,t.click()},t[5]=r._tag,t[6]=r.url,t[7]=e.fileName,t[8]=a):a=t[8];let o;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,H.jsx)(g,{}),t[9]=o):o=t[9];let s;return t[10]!==i||t[11]!==a?(s=(0,H.jsxs)(d,{disabled:i,onClick:a,size:`sm`,variant:`outline`,children:[o,`Download`]}),t[10]=i,t[11]=a,t[12]=s):s=t[12],s}function th(e,t,n){return t<0||e[t]!==`[`||!/[ xX]/.test(e[t+1]??``)||e[t+2]!==`]`?e:`${e.slice(0,t+1)}${n?`x`:` `}${e.slice(t+2)}`}var nh=class{options;timer=null;latestContents=``;latestRevision=0;confirmedRevision=0;lastChangeAt=0;baseContents;saving=!1;disposed=!1;constructor(e){this.options=e,this.baseContents=e.baseContents??``}change(e){this.disposed||(this.latestContents=e,this.latestRevision+=1,this.lastChangeAt=Date.now(),this.options.onPendingChange(!0),this.schedule(this.options.debounceMs))}discard(e){this.disposed||(this.clearTimer(),this.latestContents=e,this.baseContents=e,this.confirmedRevision=this.latestRevision,this.options.onDiscard?.(e))}retry(){this.disposed||(this.options.onRetry?.(),this.confirmedRevision=0,this.schedule(0))}dispose(){this.disposed=!0,this.clearTimer(),this.latestRevision>0&&this.persistLatest()}schedule(e){this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,this.persistLatest()},e)}clearTimer(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null)}async persistLatest(){if(this.saving||this.latestRevision===this.confirmedRevision)return;this.saving=!0;let e=this.latestContents,t=this.latestRevision,n=await this.options.persist(e),r=n._tag===`Success`;if(r)this.confirmedRevision=t,this.baseContents=e,this.options.onConfirmed(e);else if(this.options.onFailure?.(n,{baseContents:this.baseContents,localContents:e})){this.confirmedRevision=t,this.saving=!1;return}if(this.saving=!1,t===this.latestRevision){r&&this.options.onPendingChange(!1);return}let i=Math.max(0,this.options.debounceMs-(Date.now()-this.lastChangeAt));this.disposed?this.persistLatest():this.schedule(i)}},rh=(0,V.lazy)(()=>t(()=>import(`./PdfPreview-BgV8uugr.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),ih=(0,V.lazy)(()=>t(()=>import(`./DocxPreview-HJVaPJXL.js`),__vite__mapDeps([9,1,2,3,4,5,10,7,8,11,12,13]))),ah=(0,V.lazy)(()=>t(()=>import(`./XlsxPreview-Bi4rmMAb.js`),__vite__mapDeps([14,1,2,3,4,5,7,8,11,12]))),oh=(0,V.lazy)(()=>t(()=>import(`./PptxPreview-BVdzk7UG.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,11,12]))),sh=(0,V.lazy)(()=>t(()=>import(`./HtmlPreview-CJQuCP2x.js`),__vite__mapDeps([16,4,1,5,17,2,3,18,19,7,8])));function ch(e){let t=(0,Wt.c)(13),n;t[0]!==e.absolutePath||t[1]!==e.projectId||t[2]!==e.threadRef?(n=e.projectId?{_tag:`project-file`,projectId:e.projectId,path:e.absolutePath}:{_tag:`workspace-file`,threadId:e.threadRef.threadId,path:e.absolutePath},t[0]=e.absolutePath,t[1]=e.projectId,t[2]=e.threadRef,t[3]=n):n=t[3];let r=ft(e.environmentId,n),i;t[4]===e.fileName?i=t[5]:(i=lh(e.fileName),t[4]=e.fileName,t[5]=i);let a=i;if(a===null)return null;if(r._tag===`Failure`){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:`Unable to load this document.`}),t[6]=e):e=t[6],e}if(r._tag!==`Success`){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,H.jsx)(_t,{className:`size-5`})}),t[7]=e):e=t[7],e}let o=a,s;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,H.jsx)(_t,{className:`size-5`})}),t[8]=s):s=t[8];let c;return t[9]!==o||t[10]!==r.url||t[11]!==e.fileName?(c=(0,H.jsx)(V.Suspense,{fallback:s,children:(0,H.jsx)(o,{fileName:e.fileName,url:r.url})}),t[9]=o,t[10]=r.url,t[11]=e.fileName,t[12]=c):c=t[12],c}function lh(e){let t=e.toLowerCase();return t.endsWith(`.pdf`)?rh:t.endsWith(`.docx`)?ih:t.endsWith(`.xlsx`)?ah:t.endsWith(`.pptx`)?oh:null}var uh=`borgcode.fileExplorerOpen`,dh=`borgcode.renderMarkdown`,fh=`borgcode.renderHtml`,ph=500,mh=`data-file-link-reveal`,hh=`
|
|
2190
2190
|
${de}
|
|
2191
2191
|
|
|
2192
2192
|
diffs-container {
|
|
@@ -2227,11 +2227,11 @@ import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./index-DrITfTB
|
|
|
2227
2227
|
) !important;
|
|
2228
2228
|
color: var(--diffs-selection-number-fg) !important;
|
|
2229
2229
|
}
|
|
2230
|
-
`;function gh(e){let t=(0,Wt.c)(13),n;t[0]!==e.absolutePath||t[1]!==e.projectId||t[2]!==e.threadRef?(n=e.projectId?{_tag:`project-file`,projectId:e.projectId,path:e.absolutePath}:{_tag:`workspace-file`,threadId:e.threadRef.threadId,path:e.absolutePath},t[0]=e.absolutePath,t[1]=e.projectId,t[2]=e.threadRef,t[3]=n):n=t[3];let r=ft(e.environmentId,n),[i,a]=(0,V.useState)(null),o;t[4]!==r._tag||t[5]!==r.url||t[6]!==e.workspaceMutationId?(o=e.workspaceMutationId===null?``:`${r._tag===`Success`&&r.url.includes(`?`)?`&`:`?`}workspace-revision=${encodeURIComponent(e.workspaceMutationId)}`,t[4]=r._tag,t[5]=r.url,t[6]=e.workspaceMutationId,t[7]=o):o=t[7];let s=o,c=r._tag===`Success`?`${r.url}${s}`:null;if(r._tag===`Failure`||c!==null&&i===c){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:`Unable to load workspace image.`}),t[8]=e):e=t[8],e}let l;return t[9]!==r._tag||t[10]!==c||t[11]!==e.alt?(l=r._tag===`Success`&&c!==null?(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,H.jsx)(`img`,{className:`max-h-full max-w-full object-contain`,src:c,alt:e.alt,onError:()=>a(c)})}):(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,H.jsx)(_t,{className:`size-5`})}),t[9]=r._tag,t[10]=c,t[11]=e.alt,t[12]=l):l=t[12],l}function _h(e,t){let n=1;for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);r===10?n+=1:r===13&&(n+=1,e.charCodeAt(t+1)===10&&(t+=1))}return Math.min(Math.max(1,t),n)}function vh(e,t){let n=e.shadowRoot??e;for(let e of n.querySelectorAll(`[${mh}]`))e.removeAttribute(mh);t!==null&&(n.querySelector(`[data-line="${t}"]`)?.setAttribute(mh,``),n.querySelector(`[data-column-number="${t}"]`)?.setAttribute(mh,``))}var yh=30,bh=20,xh=2;function Sh(e,t,n){let r=(0,Wt.c)(5),[i]=(0,V.useState)(Ch),a;return r[0]!==e||r[1]!==t||r[2]!==n||r[3]!==i?(a=(r,a,o)=>{if(e===null)return;let s=i.get(e),c=s??{frameId:null,cancelGuard:null,handledRequestId:null,latestRequestId:null};s||i.set(e,c);let l=()=>{c.frameId!==null&&(cancelAnimationFrame(c.frameId),c.frameId=null),c.cancelGuard?.()};if(o===`unmount`){l();return}let u=a.file?.contents;if(vh(r,t===null||u===void 0?null:_h(u,t)),!(a instanceof lt))return;if(c.latestRequestId!==n&&(l(),c.latestRequestId=n,c.handledRequestId=null),t===null){r.style.minHeight=``;return}let d=r.closest(`.file-preview-virtualizer`);if(!d||(r.style.minHeight=`${Math.ceil(Math.max(a.height,d.clientHeight))}px`,c.handledRequestId===n||c.frameId!==null))return;let f=e=>{let t=a.getLinePosition(e);if(!t)return null;let n=d.getBoundingClientRect(),i=d.scrollTop+r.getBoundingClientRect().top-n.top,o=(r.shadowRoot??r).querySelector(`[data-line="${e}"]`)?.getBoundingClientRect();return Jm({scrollTop:d.scrollTop,scrollHeight:d.scrollHeight,viewportTop:n.top,viewportHeight:d.clientHeight,fileTop:i,estimatedLine:t,...o&&o.height>0?{renderedLine:{top:o.top,height:o.height}}:{}})},p=e=>{let t=bh,n=null,r=()=>{n!==null&&(cancelAnimationFrame(n),n=null),d.removeEventListener(`wheel`,r),d.removeEventListener(`touchstart`,r),d.removeEventListener(`pointerdown`,r,!0),window.removeEventListener(`keydown`,r,!0),c.cancelGuard===r&&(c.cancelGuard=null)};d.addEventListener(`wheel`,r,{passive:!0}),d.addEventListener(`touchstart`,r,{passive:!0}),d.addEventListener(`pointerdown`,r,{passive:!0,capture:!0}),window.addEventListener(`keydown`,r,!0);let i=()=>{if(n=null,--t,t<=0||!d.isConnected){r();return}let a=f(e);a!==null&&Math.abs(d.scrollTop-a)>xh&&(d.scrollTop=a),n=requestAnimationFrame(i)};n=requestAnimationFrame(i),c.cancelGuard=r},m=e=>{c.frameId=requestAnimationFrame(()=>{if(c.frameId=null,c.latestRequestId!==n||!r.isConnected)return;let i=a.file?.contents,o=i===void 0?null:_h(i,t),s=o===null?null:f(o);if(o===null||s===null){e<yh&&m(e+1);return}vh(r,o),d.scrollTop=s,c.handledRequestId=n,p(o)})};m(0)},r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a):a=r[4],a}function Ch(){return new Map}function wh(e){return typeof e==`object`&&!!e&&e._tag===`ProjectWriteFileError`&&e.failure===`revision_conflict`&&typeof e.currentContents==`string`}function Th({environmentId:e,cwd:t,relativePath:r,contents:i,revision:a,onPendingChange:o,onConflict:s}){let c=w(S.writeFile),l=(0,V.useRef)(a),u=(0,V.useRef)(null),d=(0,V.useMemo)(()=>new nh({debounceMs:ph,baseContents:i,onPendingChange:e=>o(r,e),persist:n=>c({environmentId:e,input:{cwd:t,relativePath:r,contents:n,...l.current?{expectedRevision:l.current}:{}}}),onConfirmed:i=>{l.current=n(i),gt(e,t,r,i)},onFailure:(n,i)=>{if(n._tag!==`Failure`)return!1;let a=h(n);if(!wh(a))return!1;let o=Fh({baseContents:i.baseContents,localContents:i.localContents,currentContents:a.currentContents});return o.hasConflict?s?.(a.currentContents):(l.current=a.currentRevision,pt(e,t,r,o.contents),u.current?.change(o.contents)),!0},onRetry:()=>{l.current=void 0},onDiscard:e=>{l.current=n(e)}}),[t,e,s,o,r,c]);return(0,V.useEffect)(()=>(u.current=d,()=>{u.current=null,d.dispose()}),[d]),d}function Eh(e){let t=(0,Wt.c)(115),{environmentId:n,cwd:r,relativePath:i,composerDraftTarget:a,contents:o,revision:s,resolvedTheme:l,revealRequestId:f,wordWrap:p,onPostRender:m,onPendingChange:h}=e,g=c(Ph),_=c(Nh),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],t[0]=v):v=t[0];let[y,b]=(0,V.useState)(v),[x,S]=(0,V.useState)(null),[C,ee]=(0,V.useState)(0),[w,T]=(0,V.useState)(null),E=w?.revealRequestId===f?w.range:null,D;t[1]===f?D=t[2]:(D=e=>{T({revealRequestId:f,range:e})},t[1]=f,t[2]=D);let O=D,k=(0,V.useRef)(null),A=(0,V.useRef)(null),j;t[3]!==o||t[4]!==r||t[5]!==n||t[6]!==h||t[7]!==i||t[8]!==s?(j={environmentId:n,cwd:r,relativePath:i,contents:o,revision:s,onPendingChange:h,onConflict:S},t[3]=o,t[4]=r,t[5]=n,t[6]=h,t[7]=i,t[8]=s,t[9]=j):j=t[9];let M=Th(j),N;t[10]!==g||t[11]!==a||t[12]!==r||t[13]!==n||t[14]!==i||t[15]!==M?(N=new za({persistState:!0,persistStateStorage:`inMemory`,onChange:(e,t)=>{if(pt(n,r,i,e.contents),M.change(e.contents),t){let n=it(t);b(n);for(let t of n)for(let n of t.metadata.entries)n.kind===`comment`&&g(a,u({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:n.text,contents:e.contents}))}}}),t[10]=g,t[11]=a,t[12]=r,t[13]=n,t[14]=i,t[15]=M,t[16]=N):N=t[16];let P=N,te,ne;t[17]===P?(te=t[18],ne=t[19]):(te=()=>()=>{P.cleanUp()},ne=[P],t[17]=P,t[18]=te,t[19]=ne),(0,V.useEffect)(te,ne);let re;t[20]!==a||t[21]!==_||t[22]!==O?(re=e=>{O(null),_(a,e),b(t=>t.flatMap(t=>{let n=t.metadata.entries.filter(t=>t.id!==e);return n.length>0?[{...t,metadata:{entries:n}}]:[]}))},t[20]=a,t[21]=_,t[22]=O,t[23]=re):re=t[23];let ie=re,ae;t[24]!==g||t[25]!==a||t[26]!==o||t[27]!==y||t[28]!==i||t[29]!==O?(ae=(e,t)=>{O(null);let n=y.flatMap(Mh).find(t=>t.id===e);n&&g(a,u({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:t,contents:o})),b(n=>n.map(n=>({...n,metadata:{entries:n.metadata.entries.map(n=>n.id===e?{...n,kind:`comment`,text:t}:n)}})))},t[24]=g,t[25]=a,t[26]=o,t[27]=y,t[28]=i,t[29]=O,t[30]=ae):ae=t[30];let oe=ae,se;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(se=e=>{let{startLine:t,endLine:n}=ot(e),r={id:at(),kind:`draft`,startLine:t,endLine:n,text:``};b(e=>{let t=e.flatMap(Ah),i=t.findIndex(e=>e.lineNumber===n);return i<0?[...t,{lineNumber:n,metadata:{entries:[r]}}]:t.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,r]}}:e)})},t[31]=se):se=t[31];let ce=se,le;t[32]===y?le=t[33]:(le=y.some(Oh),t[32]=y,t[33]=le);let ue=le,de,fe;t[34]!==P||t[35]!==ue||t[36]!==O?(de=()=>{let e=k.current;if(e)return qm({root:e,editor:P,isBlocked:()=>ue,onDismiss:()=>O(null)})},fe=[P,ue,O],t[34]=P,t[35]=ue,t[36]=O,t[37]=de,t[38]=fe):(de=t[37],fe=t[38]),(0,V.useEffect)(de,fe);let pe;t[39]===O?pe=t[40]:(pe=e=>{O(e),e&&ce(e)},t[39]=O,t[40]=pe);let me=pe,he;t[41]!==m||t[42]!==E?(he=(e,t,n)=>{m(e,t,n),A.current!==null&&(cancelAnimationFrame(A.current),A.current=null),n!==`unmount`&&(A.current=requestAnimationFrame(()=>{A.current=null,e.isConnected&&t.setSelectedLines(E,{notify:!1})}))},t[41]=m,t[42]=E,t[43]=he):he=t[43];let ge=he,[F,_e]=(0,V.useState)(!1),ve;t[44]!==x||t[45]!==r||t[46]!==n||t[47]!==h||t[48]!==i||t[49]!==M?(ve=()=>{x!==null&&(M.discard(x),pt(n,r,i,x),S(null),h(i,!1),ee(Dh))},t[44]=x,t[45]=r,t[46]=n,t[47]=h,t[48]=i,t[49]=M,t[50]=ve):ve=t[50];let ye=ve,be;t[51]===M?be=t[52]:(be=()=>{S(null),M.retry()},t[51]=M,t[52]=be);let Se=be,Ce;t[53]!==x||t[54]!==Se||t[55]!==ye?(Ce=x===null?null:(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-warning/30 bg-warning-surface px-3 py-2 text-xs text-warning-foreground`,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1`,children:`This file changed on disk while you were editing.`}),(0,H.jsx)(d,{size:`xs`,variant:`ghost`,onClick:()=>_e(!0),children:`Compare`}),(0,H.jsx)(d,{size:`xs`,variant:`ghost`,onClick:ye,children:`Load latest`}),(0,H.jsx)(d,{size:`xs`,onClick:Se,children:`Keep mine`})]}),t[53]=x,t[54]=Se,t[55]=ye,t[56]=Ce):Ce=t[56];let we;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(we={overscrollSize:600,intersectionObserverMargin:1200},t[57]=we):we=t[57];let I;t[58]!==o||t[59]!==r||t[60]!==P||t[61]!==n||t[62]!==i?(I=Zm(n,r,i,o,P.getFile()),t[58]=o,t[59]=r,t[60]=P,t[61]=n,t[62]=i,t[63]=I):I=t[63];let Te;t[64]!==o||t[65]!==i||t[66]!==I?(Te={name:i,contents:o,cacheKey:I},t[64]=o,t[65]=i,t[66]=I,t[67]=Te):Te=t[67];let Ee=!ue,De=!ue,Oe=p?`wrap`:`scroll`,ke;t[68]===l?ke=t[69]:(ke=xe(l),t[68]=l,t[69]=ke);let Ae;t[70]!==me||t[71]!==ge||t[72]!==l||t[73]!==O||t[74]!==Ee||t[75]!==De||t[76]!==Oe||t[77]!==ke?(Ae={disableFileHeader:!0,enableGutterUtility:Ee,enableLineSelection:De,onGutterUtilityClick:O,onLineSelectionChange:O,onLineSelectionEnd:me,overflow:Oe,theme:ke,themeType:l,unsafeCSS:hh,onPostRender:ge},t[70]=me,t[71]=ge,t[72]=l,t[73]=O,t[74]=Ee,t[75]=De,t[76]=Oe,t[77]=ke,t[78]=Ae):Ae=t[78];let je;t[79]!==ie||t[80]!==oe?(je=e=>(0,H.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,H.jsx)(z,{kind:e.kind,rangeLabel:R(e.startLine,e.endLine),text:e.text,onCancel:()=>ie(e.id),onComment:t=>oe(e.id,t),onDelete:()=>ie(e.id)},e.id))}),t[79]=ie,t[80]=oe,t[81]=je):je=t[81];let Me;t[82]!==C||t[83]!==y||t[84]!==E||t[85]!==Te||t[86]!==Ae||t[87]!==je?(Me=(0,H.jsx)(`div`,{ref:k,className:`flex min-h-0 flex-1`,children:(0,H.jsx)(qe,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:we,children:(0,H.jsx)(Ut,{file:Te,options:Ae,selectedLines:E,lineAnnotations:y,renderAnnotation:je,className:`min-h-full`,contentEditable:!0},C)})}),t[82]=C,t[83]=y,t[84]=E,t[85]=Te,t[86]=Ae,t[87]=je,t[88]=Me):Me=t[88];let Ne;t[89]!==P||t[90]!==Me?(Ne=(0,H.jsx)(Le,{editor:P,children:Me}),t[89]=P,t[90]=Me,t[91]=Ne):Ne=t[91];let Pe;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,H.jsxs)(Xe,{children:[(0,H.jsx)(He,{children:`Compare file versions`}),(0,H.jsx)(Be,{children:`The version on disk changed while you were editing. Choose which version to keep.`})]}),t[92]=Pe):Pe=t[92];let Fe;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,H.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`Line changes`}),t[93]=Fe):Fe=t[93];let Ie=x??``,Re;t[94]!==o||t[95]!==Ie?(Re=(0,H.jsxs)(Ge,{children:[Fe,(0,H.jsx)(Ih,{onDisk:Ie,mine:o})]}),t[94]=o,t[95]=Ie,t[96]=Re):Re=t[96];let ze;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,H.jsx)(d,{variant:`ghost`,onClick:()=>_e(!1),children:`Close`}),t[97]=ze):ze=t[97];let L;t[98]===ye?L=t[99]:(L=(0,H.jsx)(d,{variant:`ghost`,onClick:ye,children:`Load latest`}),t[98]=ye,t[99]=L);let Ke;t[100]===Se?Ke=t[101]:(Ke=(0,H.jsx)(d,{onClick:Se,children:`Keep mine`}),t[100]=Se,t[101]=Ke);let Je;t[102]!==L||t[103]!==Ke?(Je=(0,H.jsxs)(Ve,{children:[ze,L,Ke]}),t[102]=L,t[103]=Ke,t[104]=Je):Je=t[104];let Ye;t[105]!==Re||t[106]!==Je?(Ye=(0,H.jsxs)(Ue,{className:`max-w-5xl`,children:[Pe,Re,Je]}),t[105]=Re,t[106]=Je,t[107]=Ye):Ye=t[107];let Ze;t[108]!==F||t[109]!==Ye?(Ze=(0,H.jsx)(We,{open:F,onOpenChange:_e,children:Ye}),t[108]=F,t[109]=Ye,t[110]=Ze):Ze=t[110];let Qe;return t[111]!==Ce||t[112]!==Ne||t[113]!==Ze?(Qe=(0,H.jsxs)(H.Fragment,{children:[Ce,Ne,Ze]}),t[111]=Ce,t[112]=Ne,t[113]=Ze,t[114]=Qe):Qe=t[114],Qe}function Dh(e){return e+1}function Oh(e){return e.metadata.entries.some(kh)}function kh(e){return e.kind===`draft`}function Ah(e){let t=e.metadata.entries.filter(jh);return t.length>0?[{...e,metadata:{entries:t}}]:[]}function jh(e){return e.kind!==`draft`}function Mh(e){return e.metadata.entries}function Nh(e){return e.removeReviewComment}function Ph(e){return e.addReviewComment}function Fh(e){let t=Jt(e.localContents.split(`
|
|
2230
|
+
`;function gh(e){let t=(0,Wt.c)(13),n;t[0]!==e.absolutePath||t[1]!==e.projectId||t[2]!==e.threadRef?(n=e.projectId?{_tag:`project-file`,projectId:e.projectId,path:e.absolutePath}:{_tag:`workspace-file`,threadId:e.threadRef.threadId,path:e.absolutePath},t[0]=e.absolutePath,t[1]=e.projectId,t[2]=e.threadRef,t[3]=n):n=t[3];let r=ft(e.environmentId,n),[i,a]=(0,V.useState)(null),o;t[4]!==r._tag||t[5]!==r.url||t[6]!==e.workspaceMutationId?(o=e.workspaceMutationId===null?``:`${r._tag===`Success`&&r.url.includes(`?`)?`&`:`?`}workspace-revision=${encodeURIComponent(e.workspaceMutationId)}`,t[4]=r._tag,t[5]=r.url,t[6]=e.workspaceMutationId,t[7]=o):o=t[7];let s=o,c=r._tag===`Success`?`${r.url}${s}`:null;if(r._tag===`Failure`||c!==null&&i===c){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:`Unable to load workspace image.`}),t[8]=e):e=t[8],e}let l;return t[9]!==r._tag||t[10]!==c||t[11]!==e.alt?(l=r._tag===`Success`&&c!==null?(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,H.jsx)(`img`,{className:`max-h-full max-w-full object-contain`,src:c,alt:e.alt,onError:()=>a(c)})}):(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,H.jsx)(_t,{className:`size-5`})}),t[9]=r._tag,t[10]=c,t[11]=e.alt,t[12]=l):l=t[12],l}function _h(e,t){let n=1;for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);r===10?n+=1:r===13&&(n+=1,e.charCodeAt(t+1)===10&&(t+=1))}return Math.min(Math.max(1,t),n)}function vh(e,t){let n=e.shadowRoot??e;for(let e of n.querySelectorAll(`[${mh}]`))e.removeAttribute(mh);t!==null&&(n.querySelector(`[data-line="${t}"]`)?.setAttribute(mh,``),n.querySelector(`[data-column-number="${t}"]`)?.setAttribute(mh,``))}var yh=30,bh=20,xh=2;function Sh(e,t,n){let r=(0,Wt.c)(5),[i]=(0,V.useState)(Ch),a;return r[0]!==e||r[1]!==t||r[2]!==n||r[3]!==i?(a=(r,a,o)=>{if(e===null)return;let s=i.get(e),c=s??{frameId:null,cancelGuard:null,handledRequestId:null,latestRequestId:null};s||i.set(e,c);let l=()=>{c.frameId!==null&&(cancelAnimationFrame(c.frameId),c.frameId=null),c.cancelGuard?.()};if(o===`unmount`){l();return}let u=a.file?.contents;if(vh(r,t===null||u===void 0?null:_h(u,t)),!(a instanceof lt))return;if(c.latestRequestId!==n&&(l(),c.latestRequestId=n,c.handledRequestId=null),t===null){r.style.minHeight=``;return}let d=r.closest(`.file-preview-virtualizer`);if(!d||(r.style.minHeight=`${Math.ceil(Math.max(a.height,d.clientHeight))}px`,c.handledRequestId===n||c.frameId!==null))return;let f=e=>{let t=a.getLinePosition(e);if(!t)return null;let n=d.getBoundingClientRect(),i=d.scrollTop+r.getBoundingClientRect().top-n.top,o=(r.shadowRoot??r).querySelector(`[data-line="${e}"]`)?.getBoundingClientRect();return Jm({scrollTop:d.scrollTop,scrollHeight:d.scrollHeight,viewportTop:n.top,viewportHeight:d.clientHeight,fileTop:i,estimatedLine:t,...o&&o.height>0?{renderedLine:{top:o.top,height:o.height}}:{}})},p=e=>{let t=bh,n=null,r=()=>{n!==null&&(cancelAnimationFrame(n),n=null),d.removeEventListener(`wheel`,r),d.removeEventListener(`touchstart`,r),d.removeEventListener(`pointerdown`,r,!0),window.removeEventListener(`keydown`,r,!0),c.cancelGuard===r&&(c.cancelGuard=null)};d.addEventListener(`wheel`,r,{passive:!0}),d.addEventListener(`touchstart`,r,{passive:!0}),d.addEventListener(`pointerdown`,r,{passive:!0,capture:!0}),window.addEventListener(`keydown`,r,!0);let i=()=>{if(n=null,--t,t<=0||!d.isConnected){r();return}let a=f(e);a!==null&&Math.abs(d.scrollTop-a)>xh&&(d.scrollTop=a),n=requestAnimationFrame(i)};n=requestAnimationFrame(i),c.cancelGuard=r},m=e=>{c.frameId=requestAnimationFrame(()=>{if(c.frameId=null,c.latestRequestId!==n||!r.isConnected)return;let i=a.file?.contents,o=i===void 0?null:_h(i,t),s=o===null?null:f(o);if(o===null||s===null){e<yh&&m(e+1);return}vh(r,o),d.scrollTop=s,c.handledRequestId=n,p(o)})};m(0)},r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a):a=r[4],a}function Ch(){return new Map}function wh(e){return typeof e==`object`&&!!e&&e._tag===`ProjectWriteFileError`&&e.failure===`revision_conflict`&&typeof e.currentContents==`string`}function Th({environmentId:e,cwd:t,relativePath:r,contents:i,revision:a,onPendingChange:o,onConflict:s}){let c=T(v.writeFile),l=(0,V.useRef)(a),u=(0,V.useRef)(null),d=(0,V.useMemo)(()=>new nh({debounceMs:ph,baseContents:i,onPendingChange:e=>o(r,e),persist:n=>c({environmentId:e,input:{cwd:t,relativePath:r,contents:n,...l.current?{expectedRevision:l.current}:{}}}),onConfirmed:i=>{l.current=n(i),gt(e,t,r,i)},onFailure:(n,i)=>{if(n._tag!==`Failure`)return!1;let a=h(n);if(!wh(a))return!1;let o=Fh({baseContents:i.baseContents,localContents:i.localContents,currentContents:a.currentContents});return o.hasConflict?s?.(a.currentContents):(l.current=a.currentRevision,pt(e,t,r,o.contents),u.current?.change(o.contents)),!0},onRetry:()=>{l.current=void 0},onDiscard:e=>{l.current=n(e)}}),[t,e,s,o,r,c]);return(0,V.useEffect)(()=>(u.current=d,()=>{u.current=null,d.dispose()}),[d]),d}function Eh(e){let t=(0,Wt.c)(115),{environmentId:n,cwd:r,relativePath:i,composerDraftTarget:a,contents:o,revision:s,resolvedTheme:l,revealRequestId:f,wordWrap:p,onPostRender:m,onPendingChange:h}=e,g=c(Ph),_=c(Nh),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],t[0]=v):v=t[0];let[y,b]=(0,V.useState)(v),[x,S]=(0,V.useState)(null),[C,ee]=(0,V.useState)(0),[te,w]=(0,V.useState)(null),T=te?.revealRequestId===f?te.range:null,E;t[1]===f?E=t[2]:(E=e=>{w({revealRequestId:f,range:e})},t[1]=f,t[2]=E);let D=E,O=(0,V.useRef)(null),k=(0,V.useRef)(null),A;t[3]!==o||t[4]!==r||t[5]!==n||t[6]!==h||t[7]!==i||t[8]!==s?(A={environmentId:n,cwd:r,relativePath:i,contents:o,revision:s,onPendingChange:h,onConflict:S},t[3]=o,t[4]=r,t[5]=n,t[6]=h,t[7]=i,t[8]=s,t[9]=A):A=t[9];let j=Th(A),M;t[10]!==g||t[11]!==a||t[12]!==r||t[13]!==n||t[14]!==i||t[15]!==j?(M=new za({persistState:!0,persistStateStorage:`inMemory`,onChange:(e,t)=>{if(pt(n,r,i,e.contents),j.change(e.contents),t){let n=it(t);b(n);for(let t of n)for(let n of t.metadata.entries)n.kind===`comment`&&g(a,u({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:n.text,contents:e.contents}))}}}),t[10]=g,t[11]=a,t[12]=r,t[13]=n,t[14]=i,t[15]=j,t[16]=M):M=t[16];let N=M,ne,re;t[17]===N?(ne=t[18],re=t[19]):(ne=()=>()=>{N.cleanUp()},re=[N],t[17]=N,t[18]=ne,t[19]=re),(0,V.useEffect)(ne,re);let P;t[20]!==a||t[21]!==_||t[22]!==D?(P=e=>{D(null),_(a,e),b(t=>t.flatMap(t=>{let n=t.metadata.entries.filter(t=>t.id!==e);return n.length>0?[{...t,metadata:{entries:n}}]:[]}))},t[20]=a,t[21]=_,t[22]=D,t[23]=P):P=t[23];let ie=P,ae;t[24]!==g||t[25]!==a||t[26]!==o||t[27]!==y||t[28]!==i||t[29]!==D?(ae=(e,t)=>{D(null);let n=y.flatMap(Mh).find(t=>t.id===e);n&&g(a,u({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:t,contents:o})),b(n=>n.map(n=>({...n,metadata:{entries:n.metadata.entries.map(n=>n.id===e?{...n,kind:`comment`,text:t}:n)}})))},t[24]=g,t[25]=a,t[26]=o,t[27]=y,t[28]=i,t[29]=D,t[30]=ae):ae=t[30];let oe=ae,se;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(se=e=>{let{startLine:t,endLine:n}=ot(e),r={id:at(),kind:`draft`,startLine:t,endLine:n,text:``};b(e=>{let t=e.flatMap(Ah),i=t.findIndex(e=>e.lineNumber===n);return i<0?[...t,{lineNumber:n,metadata:{entries:[r]}}]:t.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,r]}}:e)})},t[31]=se):se=t[31];let ce=se,le;t[32]===y?le=t[33]:(le=y.some(Oh),t[32]=y,t[33]=le);let ue=le,de,fe;t[34]!==N||t[35]!==ue||t[36]!==D?(de=()=>{let e=O.current;if(e)return qm({root:e,editor:N,isBlocked:()=>ue,onDismiss:()=>D(null)})},fe=[N,ue,D],t[34]=N,t[35]=ue,t[36]=D,t[37]=de,t[38]=fe):(de=t[37],fe=t[38]),(0,V.useEffect)(de,fe);let pe;t[39]===D?pe=t[40]:(pe=e=>{D(e),e&&ce(e)},t[39]=D,t[40]=pe);let me=pe,he;t[41]!==m||t[42]!==T?(he=(e,t,n)=>{m(e,t,n),k.current!==null&&(cancelAnimationFrame(k.current),k.current=null),n!==`unmount`&&(k.current=requestAnimationFrame(()=>{k.current=null,e.isConnected&&t.setSelectedLines(T,{notify:!1})}))},t[41]=m,t[42]=T,t[43]=he):he=t[43];let ge=he,[F,_e]=(0,V.useState)(!1),ve;t[44]!==x||t[45]!==r||t[46]!==n||t[47]!==h||t[48]!==i||t[49]!==j?(ve=()=>{x!==null&&(j.discard(x),pt(n,r,i,x),S(null),h(i,!1),ee(Dh))},t[44]=x,t[45]=r,t[46]=n,t[47]=h,t[48]=i,t[49]=j,t[50]=ve):ve=t[50];let ye=ve,be;t[51]===j?be=t[52]:(be=()=>{S(null),j.retry()},t[51]=j,t[52]=be);let Se=be,Ce;t[53]!==x||t[54]!==Se||t[55]!==ye?(Ce=x===null?null:(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-warning/30 bg-warning-surface px-3 py-2 text-xs text-warning-foreground`,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1`,children:`This file changed on disk while you were editing.`}),(0,H.jsx)(d,{size:`xs`,variant:`ghost`,onClick:()=>_e(!0),children:`Compare`}),(0,H.jsx)(d,{size:`xs`,variant:`ghost`,onClick:ye,children:`Load latest`}),(0,H.jsx)(d,{size:`xs`,onClick:Se,children:`Keep mine`})]}),t[53]=x,t[54]=Se,t[55]=ye,t[56]=Ce):Ce=t[56];let we;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(we={overscrollSize:600,intersectionObserverMargin:1200},t[57]=we):we=t[57];let I;t[58]!==o||t[59]!==r||t[60]!==N||t[61]!==n||t[62]!==i?(I=Zm(n,r,i,o,N.getFile()),t[58]=o,t[59]=r,t[60]=N,t[61]=n,t[62]=i,t[63]=I):I=t[63];let Te;t[64]!==o||t[65]!==i||t[66]!==I?(Te={name:i,contents:o,cacheKey:I},t[64]=o,t[65]=i,t[66]=I,t[67]=Te):Te=t[67];let Ee=!ue,De=!ue,Oe=p?`wrap`:`scroll`,ke;t[68]===l?ke=t[69]:(ke=xe(l),t[68]=l,t[69]=ke);let Ae;t[70]!==me||t[71]!==ge||t[72]!==l||t[73]!==D||t[74]!==Ee||t[75]!==De||t[76]!==Oe||t[77]!==ke?(Ae={disableFileHeader:!0,enableGutterUtility:Ee,enableLineSelection:De,onGutterUtilityClick:D,onLineSelectionChange:D,onLineSelectionEnd:me,overflow:Oe,theme:ke,themeType:l,unsafeCSS:hh,onPostRender:ge},t[70]=me,t[71]=ge,t[72]=l,t[73]=D,t[74]=Ee,t[75]=De,t[76]=Oe,t[77]=ke,t[78]=Ae):Ae=t[78];let je;t[79]!==ie||t[80]!==oe?(je=e=>(0,H.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,H.jsx)(z,{kind:e.kind,rangeLabel:R(e.startLine,e.endLine),text:e.text,onCancel:()=>ie(e.id),onComment:t=>oe(e.id,t),onDelete:()=>ie(e.id)},e.id))}),t[79]=ie,t[80]=oe,t[81]=je):je=t[81];let Me;t[82]!==C||t[83]!==y||t[84]!==T||t[85]!==Te||t[86]!==Ae||t[87]!==je?(Me=(0,H.jsx)(`div`,{ref:O,className:`flex min-h-0 flex-1`,children:(0,H.jsx)(qe,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:we,children:(0,H.jsx)(Ut,{file:Te,options:Ae,selectedLines:T,lineAnnotations:y,renderAnnotation:je,className:`min-h-full`,contentEditable:!0},C)})}),t[82]=C,t[83]=y,t[84]=T,t[85]=Te,t[86]=Ae,t[87]=je,t[88]=Me):Me=t[88];let Ne;t[89]!==N||t[90]!==Me?(Ne=(0,H.jsx)(Le,{editor:N,children:Me}),t[89]=N,t[90]=Me,t[91]=Ne):Ne=t[91];let Pe;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,H.jsxs)(Xe,{children:[(0,H.jsx)(He,{children:`Compare file versions`}),(0,H.jsx)(Be,{children:`The version on disk changed while you were editing. Choose which version to keep.`})]}),t[92]=Pe):Pe=t[92];let Fe;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,H.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`Line changes`}),t[93]=Fe):Fe=t[93];let Ie=x??``,Re;t[94]!==o||t[95]!==Ie?(Re=(0,H.jsxs)(Ge,{children:[Fe,(0,H.jsx)(Ih,{onDisk:Ie,mine:o})]}),t[94]=o,t[95]=Ie,t[96]=Re):Re=t[96];let ze;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,H.jsx)(d,{variant:`ghost`,onClick:()=>_e(!1),children:`Close`}),t[97]=ze):ze=t[97];let L;t[98]===ye?L=t[99]:(L=(0,H.jsx)(d,{variant:`ghost`,onClick:ye,children:`Load latest`}),t[98]=ye,t[99]=L);let Ke;t[100]===Se?Ke=t[101]:(Ke=(0,H.jsx)(d,{onClick:Se,children:`Keep mine`}),t[100]=Se,t[101]=Ke);let Je;t[102]!==L||t[103]!==Ke?(Je=(0,H.jsxs)(Ve,{children:[ze,L,Ke]}),t[102]=L,t[103]=Ke,t[104]=Je):Je=t[104];let Ye;t[105]!==Re||t[106]!==Je?(Ye=(0,H.jsxs)(Ue,{className:`max-w-5xl`,children:[Pe,Re,Je]}),t[105]=Re,t[106]=Je,t[107]=Ye):Ye=t[107];let Ze;t[108]!==F||t[109]!==Ye?(Ze=(0,H.jsx)(We,{open:F,onOpenChange:_e,children:Ye}),t[108]=F,t[109]=Ye,t[110]=Ze):Ze=t[110];let Qe;return t[111]!==Ce||t[112]!==Ne||t[113]!==Ze?(Qe=(0,H.jsxs)(H.Fragment,{children:[Ce,Ne,Ze]}),t[111]=Ce,t[112]=Ne,t[113]=Ze,t[114]=Qe):Qe=t[114],Qe}function Dh(e){return e+1}function Oh(e){return e.metadata.entries.some(kh)}function kh(e){return e.kind===`draft`}function Ah(e){let t=e.metadata.entries.filter(jh);return t.length>0?[{...e,metadata:{entries:t}}]:[]}function jh(e){return e.kind!==`draft`}function Mh(e){return e.metadata.entries}function Nh(e){return e.removeReviewComment}function Ph(e){return e.addReviewComment}function Fh(e){let t=Jt(e.localContents.split(`
|
|
2231
2231
|
`),e.baseContents.split(`
|
|
2232
2232
|
`),e.currentContents.split(`
|
|
2233
2233
|
`),{excludeFalseConflicts:!0});return{contents:t.flatMap(e=>e.ok??[]).join(`
|
|
2234
2234
|
`),hasConflict:t.some(e=>e.conflict!==void 0)}}function Ih({onDisk:e,mine:t}){let n=(0,V.useMemo)(()=>ve(e,t),[t,e]),r=0;return(0,H.jsx)(`pre`,{className:`max-h-[60vh] overflow-auto rounded-md border border-border/60 bg-muted/30 p-3 text-xs leading-relaxed`,children:n.flatMap(e=>{let t=e.value.split(`
|
|
2235
2235
|
`);return t.at(-1)===``&&t.pop(),t.map(t=>(0,H.jsxs)(`span`,{className:f(`block whitespace-pre-wrap`,e.added&&`bg-success/15 text-success-foreground`,e.removed&&`bg-destructive/15 text-destructive-foreground`),children:[(0,H.jsx)(`span`,{className:`me-2 inline-block w-3 select-none text-center text-muted-foreground`,children:e.added?`+`:e.removed?`−`:` `}),t,`
|
|
2236
|
-
`]},`diff-line-${r++}`))})})}function Lh(e){let t=(0,Wt.c)(55),{environmentId:n,cwd:r,relativePath:i,contents:a,revision:o,threadRef:s,onPendingChange:c}=e,[l,u]=(0,V.useState)(null),[f,p]=(0,V.useState)(!1),m;t[0]!==a||t[1]!==r||t[2]!==n||t[3]!==c||t[4]!==i||t[5]!==o?(m={environmentId:n,cwd:r,relativePath:i,contents:a,revision:o,onPendingChange:c,onConflict:u},t[0]=a,t[1]=r,t[2]=n,t[3]=c,t[4]=i,t[5]=o,t[6]=m):m=t[6];let h=Th(m),g;t[7]!==l||t[8]!==r||t[9]!==n||t[10]!==c||t[11]!==i||t[12]!==h?(g=()=>{l!==null&&(h.discard(l),pt(n,r,i,l),u(null),c(i,!1))},t[7]=l,t[8]=r,t[9]=n,t[10]=c,t[11]=i,t[12]=h,t[13]=g):g=t[13];let _=g,v;t[14]===h?v=t[15]:(v=()=>{u(null),h.retry()},t[14]=h,t[15]=v);let y=v,b;t[16]!==l||t[17]!==y||t[18]!==_?(b=l===null?null:(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-warning/30 bg-warning-surface px-3 py-2 text-xs text-warning-foreground`,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1`,children:`This file changed on disk while you were editing.`}),(0,H.jsx)(d,{size:`xs`,variant:`ghost`,onClick:()=>p(!0),children:`Compare`}),(0,H.jsx)(d,{size:`xs`,variant:`ghost`,onClick:_,children:`Load latest`}),(0,H.jsx)(d,{size:`xs`,onClick:y,children:`Keep mine`})]}),t[16]=l,t[17]=y,t[18]=_,t[19]=b):b=t[19];let x;t[20]!==a||t[21]!==r||t[22]!==n||t[23]!==i||t[24]!==h?(x=e=>{let{markerOffset:t,checked:o}=e,s=ht(n,r,i)?.contents??a,c=th(s,t,o);c!==s&&(pt(n,r,i,c),h.change(c))},t[20]=a,t[21]=r,t[22]=n,t[23]=i,t[24]=h,t[25]=x):x=t[25];let S;t[26]!==a||t[27]!==r||t[28]!==i||t[29]!==x||t[30]!==s?(S=(0,H.jsx)(we,{className:`min-h-0 flex-1`,children:(0,H.jsx)(Wm,{text:a,cwd:r,relativePath:i,threadRef:s,onTaskListChange:x})}),t[26]=a,t[27]=r,t[28]=i,t[29]=x,t[30]=s,t[31]=S):S=t[31];let C;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,H.jsxs)(Xe,{children:[(0,H.jsx)(He,{children:`Compare file versions`}),(0,H.jsx)(Be,{children:`The version on disk changed while you were editing. Choose which version to keep.`})]}),t[32]=C):C=t[32];let ee;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,H.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`Line changes`}),t[33]=ee):ee=t[33];let w=l??``,T;t[34]!==a||t[35]!==w?(T=(0,H.jsxs)(Ge,{children:[ee,(0,H.jsx)(Ih,{onDisk:w,mine:a})]}),t[34]=a,t[35]=w,t[36]=T):T=t[36];let E;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,H.jsx)(d,{variant:`ghost`,onClick:()=>p(!1),children:`Close`}),t[37]=E):E=t[37];let D;t[38]===_?D=t[39]:(D=(0,H.jsx)(d,{variant:`ghost`,onClick:_,children:`Load latest`}),t[38]=_,t[39]=D);let O;t[40]===y?O=t[41]:(O=(0,H.jsx)(d,{onClick:y,children:`Keep mine`}),t[40]=y,t[41]=O);let k;t[42]!==D||t[43]!==O?(k=(0,H.jsxs)(Ve,{children:[E,D,O]}),t[42]=D,t[43]=O,t[44]=k):k=t[44];let A;t[45]!==T||t[46]!==k?(A=(0,H.jsxs)(Ue,{className:`max-w-5xl`,children:[C,T,k]}),t[45]=T,t[46]=k,t[47]=A):A=t[47];let j;t[48]!==f||t[49]!==A?(j=(0,H.jsx)(We,{open:f,onOpenChange:p,children:A}),t[48]=f,t[49]=A,t[50]=j):j=t[50];let M;return t[51]!==j||t[52]!==b||t[53]!==S?(M=(0,H.jsxs)(H.Fragment,{children:[b,S,j]}),t[51]=j,t[52]=b,t[53]=S,t[54]=M):M=t[54],M}function Rh(e){let t=(0,Wt.c)(104),{environmentId:n,projectId:a,cwd:o,projectName:s,relativePath:c,threadRef:l,composerDraftTarget:u,keybindings:d,availableEditors:g,revealLine:y,revealRequestId:S,onOpenFile:ee,onPendingChange:k,selectedFilePending:A,workspaceMutationId:j}=e,{resolvedTheme:M}=E(),N=T(Bh),P=O(),te=Oe(n),ne=D(n),re;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(re={reportFailure:!1},t[0]=re):re=t[0];let ae=dt(ut.createUrl,re),oe;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(oe={reportFailure:!1},t[1]=oe):oe=t[1];let ce=w(nt.open,oe),le;t[2]===c?le=t[3]:(le=c===null?null:ie(c),t[2]=c,t[3]=le);let de=le,fe=de===`image`,me;t[4]!==de||t[5]!==c?(me=de===`document`||c!==null&&ge(c),t[4]=de,t[5]=c,t[6]=me):me=t[6];let he=me,F=mt(n,o,c,!fe&&!he,!0),[_e,ve]=i(uh,!1,r),[ye,be]=i(dh,!0,r),[Se,Ce]=i(fh,!0,r),[I,Ee]=(0,V.useState)(null),De=(0,V.useRef)(null),ke=de===`markdown`,je;t[7]===c?je=t[8]:(je=c!==null&&ue(c),t[7]=c,t[8]=je);let Me=je,Ne=y===null||I?.path===c&&I.requestId===S,Fe=ke&&ye&&Ne,Le=Me&&Se&&Ne,Re=Fe||Le,Be=Me?Re?`Show HTML source`:`Show rendered page`:Re?`Show markdown source`:`Show rendered markdown`,Ve;t[9]===c?Ve=t[10]:(Ve=c!==null&&tt()&&se(c),t[9]=c,t[10]=Ve);let He=Ve,Ue;t[11]!==o||t[12]!==c?(Ue=c?pe(c,o):null,t[11]=o,t[12]=c,t[13]=Ue):Ue=t[13];let L=Ue,We;t[14]!==s||t[15]!==c?(We=c?Qm(s,c):[],t[14]=s,t[15]=c,t[16]=We):We=t[16];let Ge=We,Ke=Sh(c,y,S),Je=c!==null&&!fe&&!he&&!A,Ye=`file:${n}:${o}:${c??``}`,Xe;t[17]!==F.refresh||t[18]!==Ye||t[19]!==Je||t[20]!==j?(Xe={enabled:Je,mutationId:j,refresh:F.refresh,resourceKey:Ye},t[17]=F.refresh,t[18]=Ye,t[19]=Je,t[20]=j,t[21]=Xe):Xe=t[21],rt(Xe);let Ze;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=()=>{(De.current?.querySelector(`[data-current-file-crumb='true']`))?.scrollIntoView({block:`nearest`,inline:`end`})},t[22]=Ze):Ze=t[22];let $e;t[23]===c?$e=t[24]:($e=[c],t[23]=c,t[24]=$e),(0,V.useEffect)(Ze,$e);let it;t[25]===ve?it=t[26]:(it=()=>ve(zh),t[25]=ve,t[26]=it);let at=it,ot;t[27]!==L||t[28]!==ae||t[29]!==ne||t[30]!==ce||t[31]!==l?(ot=()=>{!L||!ne||(async()=>{let e=await Ae({threadRef:l,filePath:L,httpBaseUrl:ne,createAssetUrl:ae,openPreview:ce});if(e._tag===`Success`||m(e))return;let t=h(e);x.add(_({type:`error`,title:`Unable to open file in browser`,description:t instanceof Error?t.message:`An error occurred.`}))})()},t[27]=L,t[28]=ae,t[29]=ne,t[30]=ce,t[31]=l,t[32]=ot):ot=t[32];let R=ot,z;t[33]!==L||t[34]!==g||t[35]!==Ge||t[36]!==He||t[37]!==n||t[38]!==_e||t[39]!==R||t[40]!==Me||t[41]!==ke||t[42]!==Re||t[43]!==d||t[44]!==P||t[45]!==s||t[46]!==c||t[47]!==te||t[48]!==Be||t[49]!==S||t[50]!==Ce||t[51]!==be||t[52]!==at?(z=c?(0,H.jsxs)(`div`,{className:`flex h-10 min-h-10 shrink-0 items-center gap-2 border-b border-border/60 bg-background px-3 in-data-[preview-panel-mode=inline]:mb-3 in-data-[preview-panel-mode=inline]:h-7 in-data-[preview-panel-mode=inline]:min-h-7 in-data-[preview-panel-mode=inline]:border-b-transparent`,"data-surface-subheader":!0,children:[(0,H.jsx)(we,{ref:De,hideScrollbars:!0,scrollFade:!0,className:`min-w-0 flex-1 rounded-none`,"data-file-breadcrumbs":!0,children:(0,H.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center text-xs`,children:Ge.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center`,"data-current-file-crumb":e.kind===`file`,children:[t>0?(0,H.jsx)(p,{className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}):null,(0,H.jsxs)(b,{children:[(0,H.jsx)(v,{render:(0,H.jsx)(`span`,{className:f(`max-w-40 truncate`,e.kind===`file`?`font-medium text-foreground`:`text-muted-foreground`)}),children:e.label}),(0,H.jsx)(C,{side:`top`,className:`max-w-80`,children:e.path||s})]})]},e.path||`project`))})}),L&&(n===P||te.mode!==`local-exec`)?(0,H.jsx)(et,{environmentId:n,keybindings:d,availableEditors:g,openInCwd:L,compact:!0,enableShortcut:!1}):null,ke||Me?(0,H.jsxs)(b,{children:[(0,H.jsx)(v,{render:(0,H.jsx)(Ie,{className:`shrink-0`,pressed:Re,onPressedChange:e=>{Me?Ce(e):be(e),Ee(e&&c!==null?{path:c,requestId:S}:null)},"aria-label":Be,variant:`ghost`,size:`sm`,children:Re?(0,H.jsx)(ze,{className:`size-3.5`}):(0,H.jsx)(Pe,{className:`size-3.5`})})}),(0,H.jsx)(C,{children:Be})]}):null,He?(0,H.jsxs)(b,{children:[(0,H.jsx)(v,{render:(0,H.jsx)(Ie,{className:`shrink-0`,pressed:!1,onPressedChange:R,"aria-label":`Open file in preview browser`,variant:`ghost`,size:`sm`,children:(0,H.jsx)(Qe,{className:`size-3.5`})})}),(0,H.jsx)(C,{children:`Open file in preview browser`})]}):null,(0,H.jsxs)(b,{children:[(0,H.jsx)(v,{render:(0,H.jsx)(Ie,{className:`shrink-0`,pressed:_e,onPressedChange:at,"aria-label":_e?`Hide file explorer`:`Show file explorer`,variant:`ghost`,size:`sm`,children:(0,H.jsx)(zt,{className:`size-3.5`})})}),(0,H.jsx)(C,{children:_e?`Hide file explorer`:`Show file explorer`})]})]}):null,t[33]=L,t[34]=g,t[35]=Ge,t[36]=He,t[37]=n,t[38]=_e,t[39]=R,t[40]=Me,t[41]=ke,t[42]=Re,t[43]=d,t[44]=P,t[45]=s,t[46]=c,t[47]=te,t[48]=Be,t[49]=S,t[50]=Ce,t[51]=be,t[52]=at,t[53]=z):z=t[53];let st;t[54]!==F.data||t[55]!==c?(st=c&&F.data?.truncated?(0,H.jsxs)(`div`,{className:`shrink-0 border-b border-warning/20 bg-warning-surface px-3 py-1.5 text-[11px] text-warning-foreground`,children:[`Preview limited to the first 1 MB of a `,F.data.byteLength.toLocaleString(),` byte file.`]}):null,t[54]=F.data,t[55]=c,t[56]=st):st=t[56];let ct=c?`flex`:`hidden`,lt;t[57]===ct?lt=t[58]:(lt=f(`min-w-0 flex-1 flex-col overflow-hidden`,ct),t[57]=ct,t[58]=lt);let ft;t[59]!==L||t[60]!==u||t[61]!==o||t[62]!==n||t[63]!==F.data||t[64]!==F.error||t[65]!==F.failure||t[66]!==Me||t[67]!==fe||t[68]!==ke||t[69]!==he||t[70]!==Ke||t[71]!==k||t[72]!==a||t[73]!==c||t[74]!==Le||t[75]!==Fe||t[76]!==M||t[77]!==S||t[78]!==l||t[79]!==N||t[80]!==j?(ft=c&&fe&&L?(0,H.jsx)(gh,{projectId:typeof u==`string`?a:void 0,environmentId:n,threadRef:l,absolutePath:L,alt:c,workspaceMutationId:j},L):c&&he&&L?(0,H.jsx)(ch,{projectId:typeof u==`string`?a:void 0,absolutePath:L,environmentId:n,fileName:c.split(`/`).pop()??c,threadRef:l},L):c&&F.failure===`binary_file`&&F.data===null?(0,H.jsx)($m,{projectId:typeof u==`string`?a:void 0,absolutePath:Te(c)?L:null,environmentId:n,fileName:c.split(`/`).pop()??c,threadRef:l}):c&&F.error&&F.data===null?(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:F.error}):c&&F.data===null?(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,H.jsx)(_t,{className:`size-5`})}):c&&F.data?Me&&Le?(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,H.jsx)(_t,{className:`size-5`})}),children:(0,H.jsx)(sh,{threadRef:l,projectId:typeof u==`string`?a:void 0,filePath:c,version:Xm(o,c,F.data.contents),fileName:c.split(`/`).pop()??c})}):ke&&Fe?(0,H.jsx)(Lh,{environmentId:n,cwd:o,relativePath:c,threadRef:l,contents:F.data.contents,revision:F.data.revision,onPendingChange:k}):F.data.truncated?(0,H.jsx)(qe,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:(0,H.jsx)(Ut,{file:{name:c,contents:F.data.contents,cacheKey:Xm(o,c,F.data.contents)},options:{disableFileHeader:!0,overflow:N?`wrap`:`scroll`,theme:xe(M),themeType:M,unsafeCSS:hh,onPostRender:Ke},className:`min-h-full`})},`${c}:${M}:${F.data.byteLength}`):(0,H.jsx)(Eh,{environmentId:n,cwd:o,relativePath:c,composerDraftTarget:u,contents:F.data.contents,revision:F.data.revision,resolvedTheme:M,revealRequestId:S,wordWrap:N,onPostRender:Ke,onPendingChange:k},`${c}:${M}`):null,t[59]=L,t[60]=u,t[61]=o,t[62]=n,t[63]=F.data,t[64]=F.error,t[65]=F.failure,t[66]=Me,t[67]=fe,t[68]=ke,t[69]=he,t[70]=Ke,t[71]=k,t[72]=a,t[73]=c,t[74]=Le,t[75]=Fe,t[76]=M,t[77]=S,t[78]=l,t[79]=N,t[80]=j,t[81]=ft):ft=t[81];let pt;t[82]!==lt||t[83]!==ft?(pt=(0,H.jsx)(`div`,{className:lt,children:ft}),t[82]=lt,t[83]=ft,t[84]=pt):pt=t[84];let ht;t[85]!==o||t[86]!==n||t[87]!==_e||t[88]!==F.refresh||t[89]!==fe||t[90]!==he||t[91]!==ee||t[92]!==s||t[93]!==c||t[94]!==S||t[95]!==j?(ht=_e||c===null?(0,H.jsx)(`aside`,{className:f(`flex min-h-0 shrink-0 bg-background`,c?`w-[min(22rem,46%)] min-w-64 border-l border-border/60`:`min-w-0 flex-1`),children:(0,H.jsx)(Um,{environmentId:n,cwd:o,projectName:s,selectedPath:c,selectedPathRevealId:S,onOpenFile:ee,workspaceMutationId:j,...c&&!fe&&!he?{onRefreshSelectedFile:F.refresh}:{}},`${n}:${o}`)}):null,t[85]=o,t[86]=n,t[87]=_e,t[88]=F.refresh,t[89]=fe,t[90]=he,t[91]=ee,t[92]=s,t[93]=c,t[94]=S,t[95]=j,t[96]=ht):ht=t[96];let B;t[97]!==pt||t[98]!==ht?(B=(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[pt,ht]}),t[97]=pt,t[98]=ht,t[99]=B):B=t[99];let gt;return t[100]!==z||t[101]!==st||t[102]!==B?(gt=(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[z,st,B]}),t[100]=z,t[101]=st,t[102]=B,t[103]=gt):gt=t[103],gt}function zh(e){return!e}function Bh(e){return e.wordWrap}export{Rh as default,Fh as mergeFileContents};
|
|
2237
|
-
//# sourceMappingURL=FilePreviewPanel-
|
|
2236
|
+
`]},`diff-line-${r++}`))})})}function Lh(e){let t=(0,Wt.c)(55),{environmentId:n,cwd:r,relativePath:i,contents:a,revision:o,threadRef:s,onPendingChange:c}=e,[l,u]=(0,V.useState)(null),[f,p]=(0,V.useState)(!1),m;t[0]!==a||t[1]!==r||t[2]!==n||t[3]!==c||t[4]!==i||t[5]!==o?(m={environmentId:n,cwd:r,relativePath:i,contents:a,revision:o,onPendingChange:c,onConflict:u},t[0]=a,t[1]=r,t[2]=n,t[3]=c,t[4]=i,t[5]=o,t[6]=m):m=t[6];let h=Th(m),g;t[7]!==l||t[8]!==r||t[9]!==n||t[10]!==c||t[11]!==i||t[12]!==h?(g=()=>{l!==null&&(h.discard(l),pt(n,r,i,l),u(null),c(i,!1))},t[7]=l,t[8]=r,t[9]=n,t[10]=c,t[11]=i,t[12]=h,t[13]=g):g=t[13];let _=g,v;t[14]===h?v=t[15]:(v=()=>{u(null),h.retry()},t[14]=h,t[15]=v);let y=v,b;t[16]!==l||t[17]!==y||t[18]!==_?(b=l===null?null:(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-warning/30 bg-warning-surface px-3 py-2 text-xs text-warning-foreground`,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1`,children:`This file changed on disk while you were editing.`}),(0,H.jsx)(d,{size:`xs`,variant:`ghost`,onClick:()=>p(!0),children:`Compare`}),(0,H.jsx)(d,{size:`xs`,variant:`ghost`,onClick:_,children:`Load latest`}),(0,H.jsx)(d,{size:`xs`,onClick:y,children:`Keep mine`})]}),t[16]=l,t[17]=y,t[18]=_,t[19]=b):b=t[19];let x;t[20]!==a||t[21]!==r||t[22]!==n||t[23]!==i||t[24]!==h?(x=e=>{let{markerOffset:t,checked:o}=e,s=ht(n,r,i)?.contents??a,c=th(s,t,o);c!==s&&(pt(n,r,i,c),h.change(c))},t[20]=a,t[21]=r,t[22]=n,t[23]=i,t[24]=h,t[25]=x):x=t[25];let S;t[26]!==a||t[27]!==r||t[28]!==i||t[29]!==x||t[30]!==s?(S=(0,H.jsx)(we,{className:`min-h-0 flex-1`,children:(0,H.jsx)(Wm,{text:a,cwd:r,relativePath:i,threadRef:s,onTaskListChange:x})}),t[26]=a,t[27]=r,t[28]=i,t[29]=x,t[30]=s,t[31]=S):S=t[31];let C;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,H.jsxs)(Xe,{children:[(0,H.jsx)(He,{children:`Compare file versions`}),(0,H.jsx)(Be,{children:`The version on disk changed while you were editing. Choose which version to keep.`})]}),t[32]=C):C=t[32];let ee;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,H.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`Line changes`}),t[33]=ee):ee=t[33];let te=l??``,w;t[34]!==a||t[35]!==te?(w=(0,H.jsxs)(Ge,{children:[ee,(0,H.jsx)(Ih,{onDisk:te,mine:a})]}),t[34]=a,t[35]=te,t[36]=w):w=t[36];let T;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,H.jsx)(d,{variant:`ghost`,onClick:()=>p(!1),children:`Close`}),t[37]=T):T=t[37];let E;t[38]===_?E=t[39]:(E=(0,H.jsx)(d,{variant:`ghost`,onClick:_,children:`Load latest`}),t[38]=_,t[39]=E);let D;t[40]===y?D=t[41]:(D=(0,H.jsx)(d,{onClick:y,children:`Keep mine`}),t[40]=y,t[41]=D);let O;t[42]!==E||t[43]!==D?(O=(0,H.jsxs)(Ve,{children:[T,E,D]}),t[42]=E,t[43]=D,t[44]=O):O=t[44];let k;t[45]!==w||t[46]!==O?(k=(0,H.jsxs)(Ue,{className:`max-w-5xl`,children:[C,w,O]}),t[45]=w,t[46]=O,t[47]=k):k=t[47];let A;t[48]!==f||t[49]!==k?(A=(0,H.jsx)(We,{open:f,onOpenChange:p,children:k}),t[48]=f,t[49]=k,t[50]=A):A=t[50];let j;return t[51]!==A||t[52]!==b||t[53]!==S?(j=(0,H.jsxs)(H.Fragment,{children:[b,S,A]}),t[51]=A,t[52]=b,t[53]=S,t[54]=j):j=t[54],j}function Rh(e){let t=(0,Wt.c)(104),{environmentId:n,projectId:a,cwd:o,projectName:s,relativePath:c,threadRef:l,composerDraftTarget:u,keybindings:d,availableEditors:g,revealLine:v,revealRequestId:b,onOpenFile:ee,onPendingChange:O,selectedFilePending:k,workspaceMutationId:A}=e,{resolvedTheme:j}=w(),M=te(Bh),N=D(),ne=Oe(n),re=E(n),P;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(P={reportFailure:!1},t[0]=P):P=t[0];let ae=dt(ut.createUrl,P),oe;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(oe={reportFailure:!1},t[1]=oe):oe=t[1];let ce=T(nt.open,oe),le;t[2]===c?le=t[3]:(le=c===null?null:ie(c),t[2]=c,t[3]=le);let de=le,fe=de===`image`,me;t[4]!==de||t[5]!==c?(me=de===`document`||c!==null&&ge(c),t[4]=de,t[5]=c,t[6]=me):me=t[6];let he=me,F=mt(n,o,c,!fe&&!he,!0),[_e,ve]=r(uh,!1,i),[ye,be]=r(dh,!0,i),[Se,Ce]=r(fh,!0,i),[I,Ee]=(0,V.useState)(null),De=(0,V.useRef)(null),ke=de===`markdown`,je;t[7]===c?je=t[8]:(je=c!==null&&ue(c),t[7]=c,t[8]=je);let Me=je,Ne=v===null||I?.path===c&&I.requestId===b,Fe=ke&&ye&&Ne,Le=Me&&Se&&Ne,Re=Fe||Le,Be=Me?Re?`Show HTML source`:`Show rendered page`:Re?`Show markdown source`:`Show rendered markdown`,Ve;t[9]===c?Ve=t[10]:(Ve=c!==null&&tt()&&se(c),t[9]=c,t[10]=Ve);let He=Ve,Ue;t[11]!==o||t[12]!==c?(Ue=c?pe(c,o):null,t[11]=o,t[12]=c,t[13]=Ue):Ue=t[13];let L=Ue,We;t[14]!==s||t[15]!==c?(We=c?Qm(s,c):[],t[14]=s,t[15]=c,t[16]=We):We=t[16];let Ge=We,Ke=Sh(c,v,b),Je=c!==null&&!fe&&!he&&!k,Ye=`file:${n}:${o}:${c??``}`,Xe;t[17]!==F.refresh||t[18]!==Ye||t[19]!==Je||t[20]!==A?(Xe={enabled:Je,mutationId:A,refresh:F.refresh,resourceKey:Ye},t[17]=F.refresh,t[18]=Ye,t[19]=Je,t[20]=A,t[21]=Xe):Xe=t[21],rt(Xe);let Ze;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=()=>{(De.current?.querySelector(`[data-current-file-crumb='true']`))?.scrollIntoView({block:`nearest`,inline:`end`})},t[22]=Ze):Ze=t[22];let $e;t[23]===c?$e=t[24]:($e=[c],t[23]=c,t[24]=$e),(0,V.useEffect)(Ze,$e);let it;t[25]===ve?it=t[26]:(it=()=>ve(zh),t[25]=ve,t[26]=it);let at=it,ot;t[27]!==L||t[28]!==ae||t[29]!==re||t[30]!==ce||t[31]!==l?(ot=()=>{!L||!re||(async()=>{let e=await Ae({threadRef:l,filePath:L,httpBaseUrl:re,createAssetUrl:ae,openPreview:ce});if(e._tag===`Success`||m(e))return;let t=h(e);S.add(_({type:`error`,title:`Unable to open file in browser`,description:t instanceof Error?t.message:`An error occurred.`}))})()},t[27]=L,t[28]=ae,t[29]=re,t[30]=ce,t[31]=l,t[32]=ot):ot=t[32];let R=ot,z;t[33]!==L||t[34]!==g||t[35]!==Ge||t[36]!==He||t[37]!==n||t[38]!==_e||t[39]!==R||t[40]!==Me||t[41]!==ke||t[42]!==Re||t[43]!==d||t[44]!==N||t[45]!==s||t[46]!==c||t[47]!==ne||t[48]!==Be||t[49]!==b||t[50]!==Ce||t[51]!==be||t[52]!==at?(z=c?(0,H.jsxs)(`div`,{className:`flex h-10 min-h-10 shrink-0 items-center gap-2 border-b border-border/60 bg-background px-3 in-data-[preview-panel-mode=inline]:mb-3 in-data-[preview-panel-mode=inline]:h-7 in-data-[preview-panel-mode=inline]:min-h-7 in-data-[preview-panel-mode=inline]:border-b-transparent`,"data-surface-subheader":!0,children:[(0,H.jsx)(we,{ref:De,hideScrollbars:!0,scrollFade:!0,className:`min-w-0 flex-1 rounded-none`,"data-file-breadcrumbs":!0,children:(0,H.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center text-xs`,children:Ge.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center`,"data-current-file-crumb":e.kind===`file`,children:[t>0?(0,H.jsx)(p,{className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}):null,(0,H.jsxs)(x,{children:[(0,H.jsx)(y,{render:(0,H.jsx)(`span`,{className:f(`max-w-40 truncate`,e.kind===`file`?`font-medium text-foreground`:`text-muted-foreground`)}),children:e.label}),(0,H.jsx)(C,{side:`top`,className:`max-w-80`,children:e.path||s})]})]},e.path||`project`))})}),L&&(n===N||ne.mode!==`local-exec`)?(0,H.jsx)(et,{environmentId:n,keybindings:d,availableEditors:g,openInCwd:L,compact:!0,enableShortcut:!1}):null,ke||Me?(0,H.jsxs)(x,{children:[(0,H.jsx)(y,{render:(0,H.jsx)(Ie,{className:`shrink-0`,pressed:Re,onPressedChange:e=>{Me?Ce(e):be(e),Ee(e&&c!==null?{path:c,requestId:b}:null)},"aria-label":Be,variant:`ghost`,size:`sm`,children:Re?(0,H.jsx)(ze,{className:`size-3.5`}):(0,H.jsx)(Pe,{className:`size-3.5`})})}),(0,H.jsx)(C,{children:Be})]}):null,He?(0,H.jsxs)(x,{children:[(0,H.jsx)(y,{render:(0,H.jsx)(Ie,{className:`shrink-0`,pressed:!1,onPressedChange:R,"aria-label":`Open file in preview browser`,variant:`ghost`,size:`sm`,children:(0,H.jsx)(Qe,{className:`size-3.5`})})}),(0,H.jsx)(C,{children:`Open file in preview browser`})]}):null,(0,H.jsxs)(x,{children:[(0,H.jsx)(y,{render:(0,H.jsx)(Ie,{className:`shrink-0`,pressed:_e,onPressedChange:at,"aria-label":_e?`Hide file explorer`:`Show file explorer`,variant:`ghost`,size:`sm`,children:(0,H.jsx)(zt,{className:`size-3.5`})})}),(0,H.jsx)(C,{children:_e?`Hide file explorer`:`Show file explorer`})]})]}):null,t[33]=L,t[34]=g,t[35]=Ge,t[36]=He,t[37]=n,t[38]=_e,t[39]=R,t[40]=Me,t[41]=ke,t[42]=Re,t[43]=d,t[44]=N,t[45]=s,t[46]=c,t[47]=ne,t[48]=Be,t[49]=b,t[50]=Ce,t[51]=be,t[52]=at,t[53]=z):z=t[53];let st;t[54]!==F.data||t[55]!==c?(st=c&&F.data?.truncated?(0,H.jsxs)(`div`,{className:`shrink-0 border-b border-warning/20 bg-warning-surface px-3 py-1.5 text-[11px] text-warning-foreground`,children:[`Preview limited to the first 1 MB of a `,F.data.byteLength.toLocaleString(),` byte file.`]}):null,t[54]=F.data,t[55]=c,t[56]=st):st=t[56];let ct=c?`flex`:`hidden`,lt;t[57]===ct?lt=t[58]:(lt=f(`min-w-0 flex-1 flex-col overflow-hidden`,ct),t[57]=ct,t[58]=lt);let ft;t[59]!==L||t[60]!==u||t[61]!==o||t[62]!==n||t[63]!==F.data||t[64]!==F.error||t[65]!==F.failure||t[66]!==Me||t[67]!==fe||t[68]!==ke||t[69]!==he||t[70]!==Ke||t[71]!==O||t[72]!==a||t[73]!==c||t[74]!==Le||t[75]!==Fe||t[76]!==j||t[77]!==b||t[78]!==l||t[79]!==M||t[80]!==A?(ft=c&&fe&&L?(0,H.jsx)(gh,{projectId:typeof u==`string`?a:void 0,environmentId:n,threadRef:l,absolutePath:L,alt:c,workspaceMutationId:A},L):c&&he&&L?(0,H.jsx)(ch,{projectId:typeof u==`string`?a:void 0,absolutePath:L,environmentId:n,fileName:c.split(`/`).pop()??c,threadRef:l},L):c&&F.failure===`binary_file`&&F.data===null?(0,H.jsx)($m,{projectId:typeof u==`string`?a:void 0,absolutePath:Te(c)?L:null,environmentId:n,fileName:c.split(`/`).pop()??c,threadRef:l}):c&&F.error&&F.data===null?(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:F.error}):c&&F.data===null?(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,H.jsx)(_t,{className:`size-5`})}):c&&F.data?Me&&Le?(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,H.jsx)(_t,{className:`size-5`})}),children:(0,H.jsx)(sh,{threadRef:l,projectId:typeof u==`string`?a:void 0,filePath:c,version:Xm(o,c,F.data.contents),fileName:c.split(`/`).pop()??c})}):ke&&Fe?(0,H.jsx)(Lh,{environmentId:n,cwd:o,relativePath:c,threadRef:l,contents:F.data.contents,revision:F.data.revision,onPendingChange:O}):F.data.truncated?(0,H.jsx)(qe,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:(0,H.jsx)(Ut,{file:{name:c,contents:F.data.contents,cacheKey:Xm(o,c,F.data.contents)},options:{disableFileHeader:!0,overflow:M?`wrap`:`scroll`,theme:xe(j),themeType:j,unsafeCSS:hh,onPostRender:Ke},className:`min-h-full`})},`${c}:${j}:${F.data.byteLength}`):(0,H.jsx)(Eh,{environmentId:n,cwd:o,relativePath:c,composerDraftTarget:u,contents:F.data.contents,revision:F.data.revision,resolvedTheme:j,revealRequestId:b,wordWrap:M,onPostRender:Ke,onPendingChange:O},`${c}:${j}`):null,t[59]=L,t[60]=u,t[61]=o,t[62]=n,t[63]=F.data,t[64]=F.error,t[65]=F.failure,t[66]=Me,t[67]=fe,t[68]=ke,t[69]=he,t[70]=Ke,t[71]=O,t[72]=a,t[73]=c,t[74]=Le,t[75]=Fe,t[76]=j,t[77]=b,t[78]=l,t[79]=M,t[80]=A,t[81]=ft):ft=t[81];let pt;t[82]!==lt||t[83]!==ft?(pt=(0,H.jsx)(`div`,{className:lt,children:ft}),t[82]=lt,t[83]=ft,t[84]=pt):pt=t[84];let ht;t[85]!==o||t[86]!==n||t[87]!==_e||t[88]!==F.refresh||t[89]!==fe||t[90]!==he||t[91]!==ee||t[92]!==s||t[93]!==c||t[94]!==b||t[95]!==A?(ht=_e||c===null?(0,H.jsx)(`aside`,{className:f(`flex min-h-0 shrink-0 bg-background`,c?`w-[min(22rem,46%)] min-w-64 border-l border-border/60`:`min-w-0 flex-1`),children:(0,H.jsx)(Um,{environmentId:n,cwd:o,projectName:s,selectedPath:c,selectedPathRevealId:b,onOpenFile:ee,workspaceMutationId:A,...c&&!fe&&!he?{onRefreshSelectedFile:F.refresh}:{}},`${n}:${o}`)}):null,t[85]=o,t[86]=n,t[87]=_e,t[88]=F.refresh,t[89]=fe,t[90]=he,t[91]=ee,t[92]=s,t[93]=c,t[94]=b,t[95]=A,t[96]=ht):ht=t[96];let B;t[97]!==pt||t[98]!==ht?(B=(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[pt,ht]}),t[97]=pt,t[98]=ht,t[99]=B):B=t[99];let gt;return t[100]!==z||t[101]!==st||t[102]!==B?(gt=(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[z,st,B]}),t[100]=z,t[101]=st,t[102]=B,t[103]=gt):gt=t[103],gt}function zh(e){return!e}function Bh(e){return e.wordWrap}export{Rh as default,Fh as mergeFileContents};
|
|
2237
|
+
//# sourceMappingURL=FilePreviewPanel-CFCxGnPA.js.map
|