getborg 0.0.119 → 0.0.124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/{FetchHttpClient-C-jciW95.mjs → FetchHttpClient-DkBX_tvM.mjs} +814 -814
  2. package/dist/{FileSystem-NX0EtGtm.mjs → FileSystem-B8SvsKCB.mjs} +87 -18
  3. package/dist/{Mime-C6O17O_3.mjs → Mime-mwjBDTG5.mjs} +945 -945
  4. package/dist/{NodeHttpIncomingMessage-CylGKvlB.mjs → NodeHttpIncomingMessage-Caou0eJc.mjs} +3 -3
  5. package/dist/{NodeHttpServer-EarHJJzn.mjs → NodeHttpServer-CiwRW4qX.mjs} +7 -7
  6. package/dist/{NodePtyAdapter-C6ioPYk6.mjs → NodePtyAdapter-DCy0YCxP.mjs} +2 -2
  7. package/dist/{NodeServices-C18DO3cx.mjs → NodeServices-KA4IGVlf.mjs} +4 -4
  8. package/dist/{NodeSqliteClient-CWkKfsSo.mjs → NodeSqliteClient-y7W-gFvl.mjs} +3 -3
  9. package/dist/{NodeStream-1N7oXzTp.mjs → NodeStream-Cwt3mZYs.mjs} +2 -2
  10. package/dist/{SqlClient-Cusaqpaw.mjs → SqlClient-D-oF89aw.mjs} +2 -2
  11. package/dist/bin.mjs +29698 -21001
  12. package/dist/{borgTelemetryNode-CHLcRFOW.mjs → borgTelemetryNode-BTLPaUwA.mjs} +5 -5
  13. package/dist/client/.vite/manifest.json +396 -320
  14. package/dist/client/assets/{ArrowRight-CgvCTAzu.js → ArrowRight-D8u8fAtz.js} +2 -2
  15. package/dist/client/assets/{ArrowSquareOut-C1CwJQ7R.js → ArrowSquareOut-B_f6YUhV.js} +2 -2
  16. package/dist/client/assets/{ArrowsClockwise-CBwAQTtQ.js → ArrowsClockwise-DQYZ1Xbo.js} +2 -2
  17. package/dist/client/assets/{CaretLeft-Bk0n02vc.js → CaretLeft-CfrkuxuJ.js} +2 -2
  18. package/dist/client/assets/ChatMarkdown-Ch9PipMk.js +249 -0
  19. package/dist/client/assets/CircleNotch-BcVOnWaH.js +2 -0
  20. package/dist/client/assets/DesignWorkspace-CrijZIpE.js +3 -0
  21. package/dist/client/assets/DiffPanel-Bbs-arXF.js +2 -0
  22. package/dist/client/assets/DiffWorkerPoolProvider-B-AH2sbL.js +10 -0
  23. package/dist/client/assets/{DocxPreview-B7-febv_.js → DocxPreview-HXde7oD1.js} +4 -4
  24. package/dist/client/assets/FilePreviewPanel-DkspqFyX.js +2237 -0
  25. package/dist/client/assets/HtmlPreview-pfh_hRgS.js +2 -0
  26. package/dist/client/assets/{PdfPreview-W5mTp32l.js → PdfPreview-VSGe6F9I.js} +3 -3
  27. package/dist/client/assets/PptxPreview-CZZ5e7rI.js +3 -0
  28. package/dist/client/assets/PreviewPanel-C_WqPJu_.js +2 -0
  29. package/dist/client/assets/PullRequestCodeTab-DLajHhi9.js +6 -0
  30. package/dist/client/assets/PullRequestReactions-BJ4eU_08.js +12 -0
  31. package/dist/client/assets/{RightPanelResizeHandle-DBci-Ee2.js → RightPanelResizeHandle-XlC9gY5e.js} +2 -2
  32. package/dist/client/assets/VirtualizedFile-qiRlyNDc.js +2 -0
  33. package/dist/client/assets/XlsxPreview-BPtt3tW-.js +3 -0
  34. package/dist/client/assets/accountData-BKyjOPQm.js +16 -0
  35. package/dist/client/assets/assetUrls-33nMWFnF.js +2 -0
  36. package/dist/client/assets/assets-1BW7ZJgz.js +2 -0
  37. package/dist/client/assets/{browserHistoryStore-DLbnuO9R.js → browserHistoryStore-CEVJXGfr.js} +3 -3
  38. package/dist/client/assets/browserRecording-BavNt16V.js +2 -0
  39. package/dist/client/assets/clientAnalytics-ChPHl8_D.js +1 -0
  40. package/dist/client/assets/clientPersistenceStorage-CeJLSpQl.js +2 -0
  41. package/dist/client/assets/combobox-CQHB5X6j.js +2 -0
  42. package/dist/client/assets/composerMentionDrag-CdTT1rUK.js +2 -0
  43. package/dist/client/assets/designCanvas.logic-DduGt5E7.js +8 -0
  44. package/dist/client/assets/{designOpenFileContext-CCL9VKvQ.js → designOpenFileContext-CMKir5dG.js} +2 -2
  45. package/dist/client/assets/{diffFileContents-CgDa-z2d.js → diffFileContents-CHRsIT6_.js} +3 -3
  46. package/dist/client/assets/{empty-CLS3rXBc.js → empty-DUUjhkFh.js} +2 -2
  47. package/dist/client/assets/entities-BtD3_L53.js +2 -0
  48. package/dist/client/assets/followUpQueuePersistence-C_pFQCnT.js +1 -0
  49. package/dist/client/assets/{index-DnoL7z0M.js → index-DrITfTBh.js} +3 -3
  50. package/dist/client/assets/{input-BbliVf4z.js → input-CyCAHFxI.js} +2 -2
  51. package/dist/client/assets/{lib-CySB76JU.js → lib-BRpsbmNP.js} +2 -2
  52. package/dist/client/assets/main-Bi6AoLeM.js +167 -0
  53. package/dist/client/assets/main-C0iNAqq8.css +2 -0
  54. package/dist/client/assets/{pdf-CdULDwXT.js → pdf-C3xMIdpt.js} +2 -2
  55. package/dist/client/assets/popover-BXSj56CI.js +2 -0
  56. package/dist/client/assets/pptxDocument-BnTLF4HV.js +3 -0
  57. package/dist/client/assets/projectFilesQueryState-Cs5skZOc.js +2 -0
  58. package/dist/client/assets/queries-BevoHPqY.js +2 -0
  59. package/dist/client/assets/{scroll-area-BW5o0Izf.js → scroll-area-DAaT-DGF.js} +36 -36
  60. package/dist/client/assets/session-Dmu9Hk5C.js +68 -0
  61. package/dist/client/assets/spinner-K3N_kbJr.js +2 -0
  62. package/dist/client/assets/textarea-BT0tVWKM.js +2 -0
  63. package/dist/client/assets/{toggle-DwBa6pBo.js → toggle-Sui8J_p3.js} +2 -2
  64. package/dist/client/assets/toggle-group-BDgfPfOF.js +2 -0
  65. package/dist/client/assets/useSettings-GEQSU1F5.js +5 -0
  66. package/dist/client/assets/{useWorkspaceMutationRefresh-DLI4brDf.js → useWorkspaceMutationRefresh-ApasU6PB.js} +2 -2
  67. package/dist/client/assets/utils-ClZ5OxbV.js +30 -0
  68. package/dist/client/assets/xlsxDocument-SRKfhPKH.js +2 -0
  69. package/dist/client/index.html +1 -1
  70. package/dist/service-launcher.mjs +1 -1
  71. package/package.json +2 -2
  72. package/dist/client/assets/ChatMarkdown-6kh9qKYW.js +0 -249
  73. package/dist/client/assets/DesignWorkspace-DPuyt5mw.js +0 -3
  74. package/dist/client/assets/DiffPanel-DzRhendL.js +0 -2
  75. package/dist/client/assets/DiffWorkerPoolProvider-BU7l1oGv.js +0 -10
  76. package/dist/client/assets/FilePreviewPanel-B3x43muL.js +0 -2231
  77. package/dist/client/assets/HtmlPreview-DY3PT2FT.js +0 -2
  78. package/dist/client/assets/PptxPreview-B02U0OAE.js +0 -3
  79. package/dist/client/assets/PreviewPanel-DhzZlEWJ.js +0 -2
  80. package/dist/client/assets/PullRequestCodeTab-CoB5ByAD.js +0 -6
  81. package/dist/client/assets/PullRequestReactions-DVg6Hz1F.js +0 -12
  82. package/dist/client/assets/VirtualizedFile-Bz5fGbNr.js +0 -2
  83. package/dist/client/assets/XlsxPreview-8ACeuCsx.js +0 -3
  84. package/dist/client/assets/accountData-C4ZvicpJ.js +0 -16
  85. package/dist/client/assets/assetUrls-CbeTQh3H.js +0 -2
  86. package/dist/client/assets/browserRecording-DpmNgRt_.js +0 -2
  87. package/dist/client/assets/clientPersistenceStorage-BlYjZvCd.js +0 -2
  88. package/dist/client/assets/combobox-CByZwSML.js +0 -2
  89. package/dist/client/assets/composerMentionDrag-1fGsNlV_.js +0 -2
  90. package/dist/client/assets/designCanvas.logic-BaQE_ItM.js +0 -8
  91. package/dist/client/assets/entities-DPi_gbtI.js +0 -2
  92. package/dist/client/assets/main-Ck7oK5At.js +0 -161
  93. package/dist/client/assets/main-YscGsfgO.css +0 -2
  94. package/dist/client/assets/popover-CFDsW-_z.js +0 -2
  95. package/dist/client/assets/pptxDocument-Dh-M0DL5.js +0 -3
  96. package/dist/client/assets/projectFilesQueryState-CmtzaSrb.js +0 -2
  97. package/dist/client/assets/queries-DRotn4pk.js +0 -2
  98. package/dist/client/assets/session-D3Szkrpk.js +0 -67
  99. package/dist/client/assets/spinner-DHhZaoFg.js +0 -2
  100. package/dist/client/assets/textarea-5SMJbr7K.js +0 -5
  101. package/dist/client/assets/toggle-group-BU7-0DcW.js +0 -2
  102. package/dist/client/assets/utils-DgzD4MA_.js +0 -30
  103. package/dist/client/assets/xlsxDocument-BMNJtufK.js +0 -2
@@ -0,0 +1,2237 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PdfPreview-VSGe6F9I.js","assets/rolldown-runtime-DAXXjFlN.js","assets/index-DrITfTBh.js","assets/index-DZprGaeP.css","assets/accountData-BKyjOPQm.js","assets/utils-ClZ5OxbV.js","assets/CaretLeft-CfrkuxuJ.js","assets/spinner-K3N_kbJr.js","assets/CircleNotch-BcVOnWaH.js","assets/DocxPreview-HXde7oD1.js","assets/lib-BpnzBIoA.js","assets/documentBytes-CS3KpytE.js","assets/zipGuard-BHHl8sLU.js","assets/lib-CCiVGdun.js","assets/XlsxPreview-BPtt3tW-.js","assets/PptxPreview-CZZ5e7rI.js","assets/HtmlPreview-pfh_hRgS.js","assets/session-Dmu9Hk5C.js","assets/assets-1BW7ZJgz.js","assets/assetUrls-33nMWFnF.js"])))=>i.map(i=>d[i]);
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(`
3
+ `)&&!a.text.includes(`
4
+ `),u=o.start===o.end&&o.text.length>0&&!o.text.includes(`
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(`
6
+ `)||e.text.includes(`\r`)||e.regex&&(e.text.includes(`\\n`)||e.text.includes(`\\r`)))return[];let t;try{t=wn(e.text,e.regex,e.caseSensitive)}catch{return[]}return this.#c(t,e.wholeWord,nn)}#c(e,t,n){let r=[],i=this.#r,a=e=>this.charAt(e);for(let o=0;o<this.#i;o++){let s=this.getLineText(o),c=this.offsetAt({line:o,character:0});e.lastIndex=0;let l;for(;(l=e.exec(s))!==null;){let o=l.index,u=l[0];if(u.length===0){e.lastIndex=Dn(s,o);continue}let d=c+o;if((!t||Sn(d,u.length,i,a))&&(r.push([d,d+u.length]),r.length>=n))return r;o===e.lastIndex&&(e.lastIndex=Dn(s,o))}}return r}insert(e,t){if(e.length===0)return;let n=fn(t,0,this.#r);this.#y(n,n,e)}delete(e,t){if(t<=0||this.#r===0)return;let n=fn(e,0,this.#r),r=fn(n+t,n,this.#r);n!==r&&this.#y(n,r,``)}applyEdits(e){if(e.length!==0)for(let t=e.length-1;t>=0;t--){let n=e[t],r=fn(n.start,0,this.#r),i=fn(n.end,r,this.#r);this.#y(r,i,n.text)}}positionAt(e){let t=fn(e,0,this.#r);if(this.#r===0)return{line:0,character:0};let n=this.#f(t);return{line:n,character:t-(n===0?0:this.#p(n-1))}}positionsAt(e){let t=Array.from({length:e.length});if(e.length===0)return t;if(this.#r===0)return t.fill({line:0,character:0});for(let n=0;n<e.length;n++)t[n]=this.positionAt(e[n]);return t}offsetAt(e){if(e.line<0||this.#r===0)return 0;if(e.line>=this.#i)throw Error(`Line index out of range: ${e.line}`);let t=this.#d(e.line);if(t===void 0)throw Error(`Line index out of range: ${e.line}`);let n=fn(e.character,0,t[1]-t[0]);return t[0]+n}#l(e){if(e<0||e>=this.#r)return;let t=this.#n,n=e;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e){t=t.left;continue}if(n-=e,n<t.piece.length)return[t,n];n-=t.piece.length,t=t.right}}#u(e){if(e.right!==null){let t=e.right;for(;t.left!==null;)t=t.left;return t}let t=e;for(;t.parent!==null&&t===t.parent.right;)t=t.parent;return t.parent}#d(e){if(e<0)throw Error(`Line index out of range: ${e}`);if(this.#r===0){if(e===0)return[0,0];throw Error(`Line index out of range: ${e}`)}if(e>=this.#i)throw Error(`Line index out of range: ${e}`);return[e===0?0:this.#p(e-1),e<this.#i-1?this.#p(e):this.#r]}#f(e){let t=this.#n,n=fn(e,0,this.#r),r=0;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e){t=t.left;continue}if(r+=(t.left?.subtreeLineBreakCount??0)-+!!vn(t.left?.subtreeLastCharCode,t.piece.firstCharCode),n-=e,n<=t.piece.length){let e=this.#_(t.piece.source),i=Math.min(yn(e.lineOffsets,t.piece.offset+n),t.piece.lineOffsetEnd);return r+=i-t.piece.lineOffsetStart,n===t.piece.length&&t.piece.hasVirtualTrailingCRBreak&&r++,n===t.piece.length&&vn(t.piece.lastCharCode,this.#u(t)?.piece.firstCharCode)&&r--,r}r+=t.piece.lineBreakCount-+!!vn(t.piece.lastCharCode,t.right?.subtreeFirstCharCode),n-=t.piece.length,t=t.right}return this.#i-1}#p(e){let t=this.#n,n=e,r=0,i;for(;t!==null;){let e=(t.left?.subtreeLineBreakCount??0)-+!!vn(t.left?.subtreeLastCharCode,t.piece.firstCharCode);if(n<e){i=t.piece.firstCharCode,t=t.left;continue}let a=t.left?.subtreeLength??0;r+=a,n-=e;let o=t.right?.subtreeFirstCharCode??i,s=t.piece.lineBreakCount-+!!vn(t.piece.lastCharCode,o);if(n<s)return r+this.#m(t.piece,n);r+=t.piece.length,n-=s,t=t.right}return this.#r}#m(e,t){return t<e.lineOffsetEnd-e.lineOffsetStart?this.#_(e.source).lineOffsets[e.lineOffsetStart+t]-e.offset:e.length}#h(){let e=[];return this.#g(t=>{e.push(t.text.slice(t.start,t.end))}),e.join(``)}#g(e){this.#O(this.#n,t=>{let n=this.#_(t.piece.source);return e({text:n.text,lineOffsets:n.lineOffsets,lineOffsetStart:t.piece.lineOffsetStart,lineOffsetEnd:t.piece.lineOffsetEnd,start:t.piece.offset,end:t.piece.offset+t.piece.length})})}#_(e){return e===sn.Original?this.#e:this.#t}#v(e,t,n){let r=this.#_(e),i=t+n,a=yn(r.lineOffsets,t),o=yn(r.lineOffsets,i),s=r.text.charCodeAt(i-1);return new sn(e,t,n,a,o,s===an&&r.lineOffsets[o-1]!==i,r.text.charCodeAt(t),s)}#y(e,t,n){if(e===t&&n.length===0)return;let[r,i]=this.#w(this.#n,e),[,a]=this.#w(i,t-e),o;if(n.length>0){let e=this.#v(sn.Added,this.#t.append(n),n.length);o=this.#T(this.#E(r,e),a)}else{let[e,t]=this.#D(a);o=e===void 0?r:this.#T(this.#E(r,e),t)}o!==null&&(o.parent=null),this.#n=o,this.#r=o?.subtreeLength??0,this.#i=(o?.subtreeLineBreakCount??0)+1,this.#a=null,this.#o=null}#b(){return this.#s=Math.imul(this.#s,1664525)+1013904223>>>0,this.#s}#x(e){let t=new ln(e);return t.priority=this.#b(),t}#S(e,t){e.left=t,t!==null&&(t.parent=e)}#C(e,t){e.right=t,t!==null&&(t.parent=e)}#w(e,t){if(e===null)return[null,null];let n=e.left?.subtreeLength??0;if(t<=n){let[n,r]=this.#w(e.left,t);return this.#S(e,r),e.updateSubtreeLength(),[n,e]}let r=e.piece.length;if(t>=n+r){let[i,a]=this.#w(e.right,t-n-r);return this.#C(e,i),e.updateSubtreeLength(),[e,a]}let i=t-n,a=new ln(this.#v(e.piece.source,e.piece.offset,i)),o=new ln(this.#v(e.piece.source,e.piece.offset+i,r-i));return a.priority=e.priority,o.priority=e.priority,this.#S(a,e.left),this.#C(o,e.right),a.updateSubtreeLength(),o.updateSubtreeLength(),[a,o]}#T(e,t){return e===null?t:t===null?e:e.priority>=t.priority?(this.#C(e,this.#T(e.right,t)),e.updateSubtreeLength(),e):(this.#S(t,this.#T(e,t.left)),t.updateSubtreeLength(),t)}#E(e,t){if(e===null)return this.#x(t);let n=e;for(;n.right!==null;)n=n.right;if(gn(n.piece,t)){n.piece=_n(n.piece,t);for(let t=n;t!==null&&(t.updateSubtreeLength(),t!==e);)t=t.parent;return e}return this.#T(e,this.#x(t))}#D(e){if(e===null)return[void 0,null];if(e.left===null)return[e.piece,e.right];let[t,n]=this.#D(e.left);return this.#S(e,n),e.updateSubtreeLength(),[t,e]}#O(e,t){return e===null?!0:!this.#O(e.left,t)||t(e)===!1?!1:this.#O(e.right,t)}};function dn(e){return e===10||e===13}function fn(e,t,n){return Math.min(Math.max(e,t),n)}function pn(e){let t=Array.from({length:e.length}).fill(0),n=0;for(let r=1;r<e.length;r++){let i=e.charCodeAt(r);for(;n>0&&i!==e.charCodeAt(n);)n=t[n-1];i===e.charCodeAt(n)&&n++,t[r]=n}return t}function mn(e,t){let n=[];for(let[r,i]of e){let e=fn(r,0,t),a=fn(i,e,t);e<a&&n.push([e,a])}n.sort((e,t)=>e[0]-t[0]);let r=[];for(let e of n){let t=r[r.length-1];if(t!==void 0&&e[0]<=t[1]){t[1]=Math.max(t[1],e[1]);continue}r.push(e)}return r}function hn(e,t,n){let r=0,i=e.length;for(;r<i;){let n=r+Math.floor((i-r)/2);e[n][1]<=t?r=n+1:i=n}let a=e[r];return a!==void 0&&a[0]<n}function gn(e,t){return e.source===t.source&&e.offset+e.length===t.offset&&!vn(e.lastCharCode,t.firstCharCode)}function _n(e,t){return new sn(e.source,e.offset,e.length+t.length,e.lineOffsetStart,t.lineOffsetEnd,t.hasVirtualTrailingCRBreak,e.firstCharCode,t.lastCharCode)}function vn(e,t){return e===an&&t===rn}function yn(e,t){let n=0,r=e.length;for(;n<r;){let i=n+Math.floor((r-n)/2);e[i]<=t?n=i+1:r=i}return n}function bn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function xn(e){if(e<=32||e===127)return!0;let t=String.fromCharCode(e);return on.includes(t)}function Sn(e,t,n,r){let i=e<=0||xn(Cn(r,e-1)),a=e+t>=n||xn(Cn(r,e+t));return i&&a}function Cn(e,t){let n=e(t);return n.length===0?0:n.charCodeAt(0)}function wn(e,t,n){let r=t?e:bn(e);return new RegExp(r,`g${n?``:`i`}${t?`m`:``}`)}function Tn(e,t){return e.replace(/\$([$&]|\d+)/g,(e,n)=>n===`$`?`$`:n===`&`?t[0]??``:t[Number(n)]??``)}function En(e,t,n,r,i,a){if(!r.regex)return r.replaceText;let o=e(i),s=n(o.line),c=i-t({line:o.line,character:0}),l;try{l=wn(r.text,!0,r.caseSensitive)}catch{return r.replaceText}l.lastIndex=c;let u=l.exec(s);return u===null||u.index!==c||u[0].length!==a-i?r.replaceText:Tn(r.replaceText,u)}function Dn(e,t){if(t+1<e.length){let n=e.charCodeAt(t),r=e.charCodeAt(t+1);if(n>=55296&&n<=56319&&r>=56320&&r<=57343)return t+2}return t+1}var On=class e{#e;#t;#n;#r;#i;#a;constructor(e,t,n=`text`,r=0,i=new Xt){this.#e=new URL(e,`file://`).toString(),this.#t=n,this.#n=r,this.#r=new un(t),this.#i=i;let a=this.#r.getLineText(0,!0);a.endsWith(`\r
7
+ `)?this.#a=`\r
8
+ `:a.endsWith(`\r`)?this.#a=`\r`:this.#a=`
9
+ `}get uri(){return this.#e}get languageId(){return this.#t}get version(){return this.#n}get lineCount(){return this.#r.lineCount}get eol(){return this.#a}get canUndo(){return this.#i.canUndo}get canRedo(){return this.#i.canRedo}positionAt(e){return this.normalizePosition(this.#r.positionAt(e))}positionsAt(e){let t=this.#r.positionsAt(e);for(let e=0;e<t.length;e++)t[e]=this.normalizePosition(t[e]);return t}offsetAt(e){return this.#r.offsetAt(this.normalizePosition(e))}getText(e){return e===void 0?this.#r.getText():this.#r.getText({start:this.normalizePosition(e.start),end:this.normalizePosition(e.end)})}getLineText(e,t){return this.#r.getLineText(e,t)}normalizeEol(e){return e.replace(/\r\n|\r|\n/g,this.eol)}getLineLength(e,t){return this.#r.getLineLength(e,t)}charAt(e){return typeof e==`number`?this.#r.charAt(e):this.#r.charAt(this.offsetAt(e))}getTextSlice(e,t){return this.#r.getTextSlice(e,t)}findNextNonOverlappingSubstring(e,t){return this.#r.findNextNonOverlappingSubstring(e,t)}search(e){return this.#r.search(e)}applyEdits(e,t=!0,n,r,i=!1){if(e.length!==0)return this.#o(this.#d(this.resolveEdits(e)),t,n,r,i)}resolveEdits(e){return e.map(e=>this.#c(e))}applyResolvedEdits(e,t=!0,n,r,i=!1){if(e.length!==0)return this.#o(this.#d(e.map(e=>this.#l(e))),t,n,r,i)}#o(e,t,n,r,i){let a=Zt(this,e,this.#n,this.#n+1,t?n:void 0,t?r:void 0);t&&i&&(a.undoBoundary=!0);let o=this.#i.peekUndo(),s=this.#f(e);return this.#n++,s.lineDelta===0&&Qt(o,a)?this.#i.replaceLastUndo($t(o,a)):this.#i.push(a),s}setLastUndoSelectionsAfter(e){this.#i.setLastUndoSelectionsAfter(e)}setLastUndoLineAnnotations(e,t){this.#i.setLastUndoLineAnnotations(e,t)}undo(){let e=this.#i.popUndoToRedo();if(e===void 0)return;let t=this.#f(e.inverseEdits);if(t===void 0)return;this.#n=e.versionBefore;let n=e.selectionsBefore?.slice();return[t,n,e.lineAnnotationsBefore?.slice(),n===void 0?e.inverseEdits.map(e=>({...e})):void 0]}redo(){let e=this.#i.popRedoToUndo();if(e===void 0)return;let t=this.#f(e.forwardEdits);if(t===void 0)return;this.#n=e.versionAfter;let n=e.selectionsAfter?.slice();return[t,n,e.lineAnnotationsAfter?.slice(),n===void 0?e.forwardEdits.map(e=>({...e})):void 0]}normalizePosition(t){let n=e.#s(t.line,this.lineCount-1);return{line:n,character:e.#s(t.character,this.getLineLength(n))}}static#s(e,t){return Number.isNaN(e)?0:Math.max(0,Math.min(Math.floor(e),t))}#c(e){let t=this.offsetAt(e.range.start),n=this.offsetAt(e.range.end);if(t>n){let e=t;t=n,n=e}return this.#l({start:t,end:n,text:e.newText})}#l(e){let{start:t,end:n}=e,r=t===n;return this.#u(t)&&t--,r?n=t:this.#u(n)&&n++,{start:t,end:n,text:e.text}}#u(e){let t=this.#r.charAt(e-1).charCodeAt(0),n=this.#r.charAt(e).charCodeAt(0);return t>=55296&&t<=56319&&n>=56320&&n<=57343}#d(e){let t=[...e].sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});for(let e=0;e<t.length-1;e++)if(t[e].end>t[e+1].start)throw Error(`Overlapping text edits are not supported`);return t}#f(e){let t=this.#r.lineCount,n=this.positionsAt(e.flatMap(e=>[e.start,e.end])),r=this.#p(e,n),i=n[0],a=n[n.length-1],o=a.line===t-1&&a.character===this.#r.getLineLength(a.line);this.#r.applyEdits(e);let s=this.#r.lineCount;return{startLine:r.startLine,startCharacter:i.character,endCharacter:a.character,endLine:Math.min(r.endLine,Math.max(0,s-1)),endedAtDocumentEnd:o,previousLineCount:t,lineCount:s,lineDelta:s-t,changedLineRanges:r.ranges,changedLineChanges:r.changes}}#p(e,t){let n=1/0,r=0,i=0,a=[],o=[],s=this.#r.lineCount-1,c=this.#r.getLineLength(s);for(let l=0;l<e.length;l++){let u=e[l],d=t[l*2],f=t[l*2+1],p=d.line,m=f.line,h=be(u.text),g=p+i,_=g+h,v=h-(m-p);n=Math.min(n,p),r=Math.max(r,_);let y=a[a.length-1];y!==void 0&&g<=y[1]+1?a[a.length-1]=[y[0],Math.max(y[1],_)]:a.push([g,_]),o.push([g,_,v,d.character,f.character,m===s&&f.character===c]),i+=v}return n===1/0?{startLine:0,endLine:0,ranges:[[0,0]],changes:[[0,0,0,0,0,!1]]}:{startLine:n,endLine:r,ranges:a,changes:o}}},kn=void 0,An=void 0;function jn(){return kn??=/macOS|MacIntel|iPhone|iPad|iPod/i.test(Fn())}function Mn(){return An??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Nn({metaKey:e,ctrlKey:t},n=jn()){return n?e&&!t:t&&!e}function Pn(e){if(jn()&&e.ctrlKey&&!e.altKey&&!e.metaKey)switch(e.key){case`a`:return`start`;case`e`:return`end`;case`p`:return`up`;case`n`:return`down`;case`f`:return`right`;case`b`:return`left`}if(!e.altKey&&!e.ctrlKey&&!e.metaKey){if(e.key===`ArrowUp`)return`up`;if(e.key===`ArrowDown`)return`down`;if(e.key===`ArrowLeft`)return`left`;if(e.key===`ArrowRight`)return`right`;if(e.key===`Home`)return`start`;if(e.key===`End`)return`end`}if(Nn(e)){if(e.key===`ArrowLeft`)return`textStart`;if(e.key===`ArrowRight`)return`end`}}function Fn(){let e=globalThis.navigator;return e?.platform??e?.userAgentData?.platform??`unknown`}var In={a:`selectAll`,d:`findNextMatch`};function Ln(e,t=jn()){let n=Nn(e,t),{shiftKey:r,altKey:i,key:a}=e,o=a.length===1?a.toLowerCase():a;if(t&&e.ctrlKey&&!e.metaKey&&!r&&!i&&(o===`k`||e.code===`KeyK`))return`deleteHardLineForward`;if(!e.metaKey&&!e.ctrlKey&&r&&i&&(o===`a`||e.code===`KeyA`))return`toggleBlockComment`;if(!e.metaKey&&!e.ctrlKey&&r&&i){if(o===`ArrowUp`)return`copyLineUp`;if(o===`ArrowDown`)return`copyLineDown`}if(!e.metaKey&&!e.ctrlKey&&!r&&!i&&o===`Escape`)return`simplifySelection`;if(!e.metaKey&&!r){if(!e.ctrlKey&&i&&o===`ArrowUp`)return`moveLineUp`;if(!e.ctrlKey&&i&&o===`ArrowDown`)return`moveLineDown`;if((t||navigator.platform.includes(`Linux`))&&e.ctrlKey&&i){if(o===`p`||e.code===`KeyP`)return`moveLineUp`;if(o===`n`||e.code===`KeyN`)return`moveLineDown`}}if(n&&(o===`f`||e.code===`KeyF`))return i?`openSearchReplacePanel`:`openSearchPanel`;if(!i){if(!n&&o===`Tab`)return r?`outdent`:`indent`;if(n)return!r&&o===`Enter`?`insertBlankLine`:!r&&(o===`/`||e.code===`Slash`)?`toggleComment`:!r&&o===`[`?`indentLess`:!r&&o===`]`?`indentMore`:o===`z`?r?`redo`:`undo`:!t&&o===`y`?`redo`:o===`Home`||t&&o===`ArrowUp`?r?`expandSelectionDocStart`:`moveCursorToDocStart`:o===`End`||t&&o===`ArrowDown`?r?`expandSelectionDocEnd`:`moveCursorToDocEnd`:In[o]}}function Rn(e,t=jn()){if(!e.altKey&&Nn(e,t)&&((e.key.length===1?e.key.toLowerCase():e.key)===`g`||e.code===`KeyG`))return e.shiftKey?`previous`:`next`}var zn=`::selection {
10
+ background-color: #0000;
11
+ }
12
+
13
+ [data-deleted-text-selection] [data-deletions] ::selection, [data-deleted-text-selection] [data-line-type="change-deletion"] ::selection {
14
+ background-color: var(--diffs-editor-selection-bg);
15
+ }
16
+
17
+ @keyframes blinking {
18
+ 0% {
19
+ opacity: 1;
20
+ }
21
+
22
+ 50% {
23
+ opacity: 0;
24
+ }
25
+
26
+ 100% {
27
+ opacity: 1;
28
+ }
29
+ }
30
+
31
+ :host, [data-code], [data-content], [data-diff-type="split"][data-overflow="wrap"] {
32
+ position: relative;
33
+ }
34
+
35
+ [data-code] {
36
+ container-type: inline-size;
37
+ }
38
+
39
+ [data-content] {
40
+ cursor: text;
41
+ caret-color: var(--diffs-bg-caret);
42
+ background-color: #0000;
43
+ outline: none;
44
+ }
45
+
46
+ [data-line] {
47
+ cursor: text;
48
+ background-color: #0000;
49
+ }
50
+
51
+ [data-line]:after {
52
+ content: "";
53
+ z-index: -20;
54
+ background-color: var(--diffs-line-bg);
55
+ pointer-events: none;
56
+ position: absolute;
57
+ inset: 0;
58
+ }
59
+
60
+ [data-line][data-selected-line]:after {
61
+ background-color: var(--diffs-computed-diff-line-bg, var(--diffs-bg));
62
+ background-image: linear-gradient(var(--diffs-editor-line-highlight-bg),
63
+ var(--diffs-editor-line-highlight-bg));
64
+ }
65
+
66
+ [data-editor-overlay] {
67
+ display: contents;
68
+ }
69
+
70
+ [data-caret], [data-selection-range], [data-match-range], [data-bracket-match-range], [data-marker-range] {
71
+ height: 1lh;
72
+ line-height: var(--diffs-line-height);
73
+ pointer-events: none;
74
+ position: absolute;
75
+ top: 0;
76
+ left: 0;
77
+ }
78
+
79
+ [data-caret] {
80
+ background-color: var(--diffs-bg-caret-override, var(--diffs-editor-cursor-fg, light-dark(color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg)))));
81
+ visibility: hidden;
82
+ width: 2px;
83
+ }
84
+
85
+ @media (prefers-reduced-motion: no-preference) {
86
+ [data-caret] {
87
+ animation: 1.2s .8s infinite blinking;
88
+ }
89
+ }
90
+
91
+ [data-selection-range] {
92
+ z-index: -10;
93
+ background-color: var(--diffs-editor-selection-bg);
94
+ }
95
+
96
+ [data-selection-corner] {
97
+ background-color: var(--diffs-selection-corner-bg, var(--diffs-bg));
98
+ width: 100%;
99
+ height: 100%;
100
+ }
101
+
102
+ [data-match-range] {
103
+ z-index: -10;
104
+ background-color: var(--diffs-editor-match-bg, var(--diffs-editor-selection-bg));
105
+ }
106
+
107
+ [data-match-range]:not([data-focus]) {
108
+ background-color: var(--diffs-editor-match-highlight-bg, light-dark(#ff963288, #ff963266));
109
+ }
110
+
111
+ [data-bracket-match-range] {
112
+ z-index: -9;
113
+ box-sizing: border-box;
114
+ border-bottom: 1px solid
115
+ var(--diffs-editor-bracket-match-border, color-mix(in lab, var(--diffs-fg) 60%, transparent));
116
+ background-color: var(--diffs-editor-bracket-match-bg, color-mix(in lab, var(--diffs-fg) 5%, transparent));
117
+ }
118
+
119
+ [data-rtl] {
120
+ border-top-left-radius: 3px;
121
+ }
122
+
123
+ [data-rtr] {
124
+ border-top-right-radius: 3px;
125
+ }
126
+
127
+ [data-rbl] {
128
+ border-bottom-left-radius: 3px;
129
+ }
130
+
131
+ [data-rbr] {
132
+ border-bottom-right-radius: 3px;
133
+ }
134
+
135
+ [data-marker-range] {
136
+ z-index: 1;
137
+ background-color: var(--diffs-marker-bg);
138
+ mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+");
139
+ mask-position: 0 100%;
140
+ mask-size: 6px 3px;
141
+ mask-repeat: repeat-x;
142
+ }
143
+
144
+ [data-marker-error] {
145
+ --diffs-marker-contrast: #fff;
146
+ --diffs-marker-bg: var(--diffs-editor-error-fg, var(--diffs-deletion-base));
147
+ }
148
+
149
+ [data-marker-warning] {
150
+ --diffs-marker-contrast: #000;
151
+ --diffs-marker-bg: var(--diffs-editor-warning-fg, light-dark(var(--diffs-warning-light), var(--diffs-warning-dark)));
152
+ }
153
+
154
+ [data-marker-info] {
155
+ --diffs-marker-contrast: #fff;
156
+ --diffs-marker-bg: var(--diffs-editor-info-fg, var(--diffs-modified-base));
157
+ }
158
+
159
+ [data-marker-hint] {
160
+ --diffs-marker-contrast: light-dark(#fff, #000);
161
+ --diffs-marker-bg: var(--diffs-editor-hint-fg, var(--diffs-fg-number));
162
+ }
163
+
164
+ @media (width >= 480px) {
165
+ [data-content] {
166
+ caret-color: #0000;
167
+ }
168
+
169
+ [data-content]:focus ~ [data-editor-overlay] [data-caret] {
170
+ visibility: visible;
171
+ }
172
+ }
173
+
174
+ [data-editor-widget] {
175
+ --diffs-widget-fg: var(--diffs-fg);
176
+ --diffs-widget-bg: color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));
177
+ --diffs-widget-border: color-mix(in lab, var(--diffs-fg) 20%, transparent);
178
+ --diffs-widget-shadow: inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013,
179
+ 0 6px 18px #00000013;
180
+ z-index: 100;
181
+ width: fit-content;
182
+ max-width: calc(100% - 24px);
183
+ font: 14px/20px var(--diffs-header-font-fallback);
184
+ border: 1px solid var(--diffs-widget-border);
185
+ background-color: var(--diffs-widget-bg);
186
+ box-shadow: var(--diffs-widget-shadow);
187
+ background-clip: padding-box;
188
+ border-radius: 9px;
189
+ position: absolute;
190
+ top: 0;
191
+ left: 0;
192
+ }
193
+
194
+ [data-marker-popup], [data-selection-action-popover] {
195
+ --popover-viewport-left: 0px;
196
+ --popover-viewport-right: 100cqw;
197
+ --popover-min-left: calc(var(--popover-viewport-left) + var(--gutter-width, 0px) + 8px);
198
+ --popover-available-width: max(0px,
199
+ calc(var(--popover-viewport-right) - var(--popover-min-left) - 8px));
200
+ max-width: min(640px, var(--popover-available-width));
201
+ translate: clamp(var(--popover-min-left),
202
+ var(--popover-x, var(--popover-min-left)),
203
+ calc(var(--popover-viewport-right) - 8px - 100%))
204
+ calc(var(--popover-y, 0px) + var(--popover-y-shift, 0px));
205
+ }
206
+
207
+ [data-marker-popup] {
208
+ --diffs-widget-bg: var(--diffs-marker-bg);
209
+ --diffs-widget-shadow: 0 4px 8px #00000026, 0 6px 18px #00000026;
210
+ min-width: min(180px, var(--popover-available-width));
211
+ overflow-wrap: anywhere;
212
+ color: var(--diffs-marker-contrast, contrast-color(#fff, #000));
213
+ white-space: normal;
214
+ pointer-events: auto;
215
+ border: 0;
216
+ padding: 8px 12px;
217
+
218
+ & [data-marker-message] {
219
+ white-space: normal;
220
+ overflow-wrap: anywhere;
221
+
222
+ & code {
223
+ white-space: normal;
224
+ color: inherit;
225
+ background-color: #0000;
226
+ display: inline;
227
+ }
228
+ }
229
+ }
230
+
231
+ [data-selection-action-popover] {
232
+ pointer-events: auto;
233
+ flex-wrap: wrap;
234
+ align-items: center;
235
+ gap: 4px;
236
+ width: max-content;
237
+ padding: 4px;
238
+ display: flex;
239
+ }
240
+
241
+ [data-search-panel] {
242
+ z-index: 100;
243
+ flex-direction: column;
244
+ justify-content: right;
245
+ width: 100%;
246
+ height: 0;
247
+ display: flex;
248
+ position: sticky;
249
+ top: 16px;
250
+ right: 16px;
251
+ container: search-panel / inline-size;
252
+
253
+ & [data-editor-widget] {
254
+ z-index: 100;
255
+ flex-shrink: 0;
256
+ align-items: stretch;
257
+ gap: 8px;
258
+ min-width: 260px;
259
+ max-width: 100%;
260
+ margin-inline: auto 16px;
261
+ padding: 4px;
262
+ display: flex;
263
+ position: relative;
264
+ }
265
+
266
+ & svg {
267
+ fill: currentColor;
268
+ width: 12px;
269
+ height: 12px;
270
+ display: block;
271
+ }
272
+ }
273
+
274
+ [data-search-grid] {
275
+ grid-template-columns: auto auto auto;
276
+ grid-template-areas: "find matches nav"
277
+ "replace actions .";
278
+ align-items: center;
279
+ gap: 4px 6px;
280
+ width: 100%;
281
+ display: grid;
282
+ }
283
+
284
+ [data-input-box][data-find] {
285
+ grid-area: find;
286
+ }
287
+
288
+ [data-search-nav] {
289
+ grid-area: nav;
290
+ }
291
+
292
+ [data-input-box][data-replace] {
293
+ grid-area: replace;
294
+ }
295
+
296
+ [data-replace-actions] {
297
+ grid-area: actions;
298
+ }
299
+
300
+ [data-search-grid][data-mode="find"] {
301
+ grid-template-areas: "find matches nav";
302
+ }
303
+
304
+ [data-search-grid][data-mode="find"] [data-replace-cell] {
305
+ display: none;
306
+ }
307
+
308
+ @container search-panel (width < 400px) {
309
+ [data-search-panel] [data-editor-widget] {
310
+ padding: 10px;
311
+ }
312
+
313
+ [data-search-grid][data-mode="replace"] {
314
+ grid-template-columns: auto 1fr auto;
315
+ grid-template-areas: "find find find"
316
+ "replace replace replace"
317
+ "nav matches actions";
318
+ }
319
+
320
+ [data-search-grid][data-mode="find"] {
321
+ grid-template-columns: auto 1fr auto;
322
+ grid-template-areas: "find find find"
323
+ "nav matches matches";
324
+ }
325
+
326
+ [data-replace-actions] {
327
+ justify-self: end;
328
+ }
329
+
330
+ [data-search-grid] [data-input-box] {
331
+ width: auto;
332
+ }
333
+ }
334
+
335
+ [data-input-box] {
336
+ align-items: center;
337
+ width: 200px;
338
+ display: flex;
339
+ position: relative;
340
+
341
+ & input {
342
+ width: 100%;
343
+ min-width: 0;
344
+ color: var(--diffs-fg);
345
+ background-color: var(--diffs-bg);
346
+ border: 1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));
347
+ border-radius: 6px;
348
+ outline: none;
349
+ flex-grow: 1;
350
+ padding-inline: 6px;
351
+ font-size: 13px;
352
+ line-height: 24px;
353
+
354
+ &::selection {
355
+ background-color: color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg));
356
+ }
357
+
358
+ &:focus-visible {
359
+ outline: 1px solid var(--diffs-modified-base);
360
+ }
361
+ }
362
+
363
+ &[data-find] input {
364
+ padding-inline-end: 72px;
365
+ }
366
+
367
+ & [data-search-icon] {
368
+ --diffs-search-icon-size: 20px;
369
+ }
370
+ }
371
+
372
+ [data-search-toggles] {
373
+ align-items: center;
374
+ gap: 1px;
375
+ display: flex;
376
+ position: absolute;
377
+ top: 50%;
378
+ right: 4px;
379
+ transform: translateY(-50%);
380
+ }
381
+
382
+ [data-matches] {
383
+ white-space: nowrap;
384
+ min-width: 50px;
385
+ color: color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));
386
+ flex-shrink: 0;
387
+ grid-area: matches;
388
+ font-size: 12px;
389
+ font-weight: 500;
390
+ line-height: 20px;
391
+
392
+ &[data-no-matches] {
393
+ color: color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg));
394
+ }
395
+ }
396
+
397
+ [data-replace-actions], [data-search-nav] {
398
+ align-items: center;
399
+ display: flex;
400
+ }
401
+
402
+ [data-search-icon] {
403
+ appearance: none;
404
+ width: var(--diffs-search-icon-size, 24px);
405
+ height: var(--diffs-search-icon-size, 24px);
406
+ color: color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));
407
+ border-radius: var(--diffs-search-icon-radius, 4px);
408
+ cursor: pointer;
409
+ background: none;
410
+ border: 0;
411
+ flex-shrink: 0;
412
+ justify-content: center;
413
+ align-items: center;
414
+ margin: 0;
415
+ padding: 0;
416
+ transition: background-color .1s ease-in-out, color .1s ease-in-out;
417
+ display: flex;
418
+
419
+ &:disabled {
420
+ opacity: .25;
421
+ cursor: default;
422
+ }
423
+
424
+ &:not(:disabled):hover {
425
+ color: var(--diffs-fg);
426
+ }
427
+
428
+ &:focus-visible {
429
+ outline: 1px solid var(--diffs-modified-base);
430
+ }
431
+
432
+ &[aria-pressed="true"] {
433
+ color: var(--diffs-modified-base);
434
+ }
435
+ }
436
+
437
+ [data-search-close] {
438
+ --diffs-search-icon-size: 20px;
439
+ --diffs-search-icon-radius: 50%;
440
+ color: var(--diffs-widget-bg);
441
+ background-color: color-mix(in lab,
442
+ var(--diffs-widget-fg) 50%,
443
+ var(--diffs-bg));
444
+ position: absolute;
445
+ top: 0;
446
+ right: 0;
447
+ transform: translate(50%, -50%);
448
+
449
+ &:not(:disabled):hover {
450
+ opacity: 1;
451
+ color: var(--diffs-widget-bg);
452
+ background-color: var(--diffs-widget-fg);
453
+ }
454
+ }
455
+ `,Bn=`//`,Vn=[`/*`,`*/`],Hn={sql:{lineComment:`--`},ruby:{lineComment:`#`,blockComment:[`=begin`,`=end`]},rst:{lineComment:`..`},coffeescript:{lineComment:`#`,blockComment:[`###`,`###`]},cmd:{lineComment:`@REM`},julia:{lineComment:`#`,blockComment:[`#=`,`=#`]},yaml:{lineComment:`#`},yml:{lineComment:`#`},markdown:{lineComment:null,blockComment:[`<!--`,`-->`]},zsh:{lineComment:`#`},makefile:{lineComment:`#`},handlebars:{lineComment:null,blockComment:[`{{!--`,`--}}`]},ini:{lineComment:`;`,blockComment:[`;`,` `]},powershell:{lineComment:`#`,blockComment:[`<#`,`#>`]},vb:{lineComment:`'`},xml:{lineComment:null,blockComment:[`<!--`,`-->`]},lua:{lineComment:`--`,blockComment:[`--[[`,`]]`]},html:{lineComment:null,blockComment:[`<!--`,`-->`]},diff:{lineComment:`#`,blockComment:[`#`,` `]},r:{lineComment:`#`},fsharp:{blockComment:[`(*`,`*)`]},pug:{lineComment:`//-`},perl:{lineComment:`#`},tex:{lineComment:`%`},clojure:{lineComment:`;;`},css:{lineComment:null},python:{lineComment:`#`,blockComment:[`"""`,`"""`]},dotenv:{lineComment:`#`},dockerfile:{lineComment:`#`},razor:{lineComment:null,blockComment:[`<!--`,`-->`]},prompt:{lineComment:null,blockComment:[`<!--`,`-->`]}};function Un(e,t){let n={...Hn[e],...t?.[e]};return{lineComment:n.lineComment===void 0?Bn:n.lineComment,blockComment:n.blockComment??Vn}}function Wn(e,t,n){let r=[],i=new Set;for(let a of t){let t=a.end.line;a.start.line<t&&a.end.character===0&&t--;let o=r.length,s=1/0;for(let o=a.start.line;o<=t;o++){if(i.has(o))continue;i.add(o);let t=e.getLineText(o),a=t.length-t.trimStart().length,c=a===t.length;c||(s=Math.min(s,a)),r.push({line:o,comment:t.slice(a,a+n.length)===n?a:-1,empty:c,indent:a,single:!1})}if(s!==1/0)for(let e=o;e<r.length;e++)r[e].empty||(r[e].indent=s);r.length===o+1&&(r[o].single=!0)}let a=r.some(e=>e.comment<0&&(!e.empty||e.single)),o=[];if(a){for(let e of r){if(e.empty&&!e.single)continue;let t={line:e.line,character:e.indent};o.push({range:{start:t,end:t},newText:n+` `})}return o}for(let t of r){if(t.comment<0)continue;let r=e.getLineText(t.line),i=t.comment,a=i+n.length+ +(r[i+n.length]===` `);o.push({range:{start:{line:t.line,character:i},end:{line:t.line,character:a}},newText:``})}return o}var Gn=50;function Kn(e,t,n,r,i){let a=Math.max(0,r-Gn),o=e.getTextSlice(a,r),s=e.getTextSlice(i,i+Gn),c=o.length-o.trimEnd().length,l=s.length-s.trimStart().length,u=o.length-c;if(o.slice(u-t.length,u)===t&&s.slice(l,l+n.length)===n)return{open:{start:r-c-t.length,end:r-c+ +(c>0),text:``},close:{start:i+l-+(l>0),end:i+l+n.length,text:``},contentStart:r,contentEnd:i};let d=i-r<=Gn*2?e.getTextSlice(r,i):void 0,f=d??e.getTextSlice(r,r+Gn),p=d??e.getTextSlice(i-Gn,i),m=f.length-f.trimStart().length,h=i-(p.length-p.trimEnd().length)-n.length;if(f.slice(m,m+t.length)!==t||e.getTextSlice(h,h+n.length)!==n)return;let g=r+m,_=g+t.length+ +!!/\s/.test(f[t.length+m]??``),v=h-+!!/\s/.test(e.getTextSlice(h-1,h));return{open:{start:g,end:_,text:``},close:{start:v,end:h+n.length,text:``},contentStart:_,contentEnd:v}}function qn(e,t,n,r){let i=0,a=t.length;for(;i<a;){let n=i+a>>>1;t[n].end<e?i=n+1:a=n}let o=n[i];for(let n=i;n<t.length;n++){let i=t[n];if(e<i.start)break;if(i.start===i.end&&e===i.start){if(r<0)break;o+=i.text.length;continue}if(e>i.end){o+=i.text.length-(i.end-i.start);continue}return e===i.end?i.start+o+i.text.length:i.start+o+(r>0?i.text.length:0)}return e+o}function Jn(e,t,[n,r],i=!1){let a=t.map(t=>{let{start:n,end:r}=t;if(i){let t=r.line;n.line<t&&r.character===0&&t--;let i=e.getLineText(n.line),a=i.length-i.trimStart().length;n={line:n.line,character:a},r={line:t,character:e.getLineLength(t)}}return{from:e.offsetAt(n),to:e.offsetAt(r),direction:t.direction,comment:void 0}});if(i&&a.length>1){a.sort((e,t)=>{let n=e.from-t.from;return n===0?e.to-t.to:n});let e=0;for(let t=1;t<a.length;t++){let n=a[e],r=a[t];r.from<=n.to?n.to=Math.max(n.to,r.to):a[++e]=r}a.length=e+1}for(let t of a)t.comment=Kn(e,n,r,t.from,t.to);let o=a.every(e=>e.comment!==void 0),s=[];for(let e of a){let t=e.comment;if(o&&t!==void 0){s.push(t.open,t.close);continue}if(t===void 0){if(e.from===e.to){s.push({start:e.from,end:e.to,text:n+` `+r});continue}s.push({start:e.from,end:e.from,text:n+` `},{start:e.to,end:e.to,text:` `+r})}}if(s.length===0)return;s.sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});let c=s.map(t=>({range:{start:e.positionAt(t.start),end:e.positionAt(t.end)},newText:t.text}));if(i)return{edits:c,nextSelectionOffsets:[]};let l=a.map(e=>{let t=e.comment;return o&&t!==void 0?{start:t.contentStart,end:t.contentEnd,startAssociation:1,endAssociation:-1}:t===void 0?e.from===e.to?{start:e.from,end:e.to,startAssociation:-1,endAssociation:-1,collapsedInset:n.length+1}:{start:e.from,end:e.to,startAssociation:1,endAssociation:-1}:{start:e.from,end:e.to,startAssociation:1,endAssociation:1}}),u=Array(s.length+1);u[0]=0;for(let e=0;e<s.length;e++){let t=s[e];u[e+1]=u[e]+t.text.length-(t.end-t.start)}return{edits:c,nextSelectionOffsets:l.map((e,t)=>{let n=qn(e.start,s,u,e.startAssociation)+(e.collapsedInset??0);return[n,e.collapsedInset===void 0?qn(e.end,s,u,e.endAssociation):n,a[t].direction]})}}function U(e,t,n){let{style:r,dataset:i,children:a,...o}=t??{},s=document.createElement(e);return Object.assign(s,o),r!==void 0&&(typeof r==`string`?s.style.cssText=r:Object.assign(s.style,r)),i!==void 0&&(typeof i==`string`?s.dataset[i]=``:Array.isArray(i)?i.forEach(e=>{s.dataset[e]=``}):Object.assign(s.dataset,i)),a!==void 0&&s.replaceChildren(...a),n!==void 0&&n.appendChild(s),s}function W(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Yn(e,t=`line`){let n=e.dataset[t];if(n===void 0)return;let r=parseInt(n,10);if(!Number.isNaN(r))return r}function Xn(e,t){if(e.nodeType===3){let n=e.textContent?.length??0;return Math.max(0,Math.min(t,n))}return e.nodeType===1?Math.max(0,Math.min(t,e.childNodes.length)):0}function Zn(e,t){return Object.assign(e,t)}function Qn(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}function $n(e,t=1e3){return Math.round(e*t)/t}function er(e){return e.endsWith(`
456
+ `)||e.endsWith(`\r`)}function tr(e){if(!(typeof Intl>`u`||typeof Intl.Segmenter!=`function`))return new Intl.Segmenter(void 0,e)}var nr,rr=!1;function ir(){return rr||=(nr=tr({granularity:`grapheme`}),!0),nr}function ar(e,t){let n=or(e);if(n.length===0)return;let r=[],i=!1;for(let a of t){if(a.side===`deletions`||a.lineNumber<=0){r.push(a);continue}let t=a.lineNumber-1,o=e.previousLineCount,s=!1;for(let e of n){let n=Math.max(1,o+e.lineDelta),r=sr(t,e,n);if(r===void 0){s=!0,t=void 0;break}(r!==t||lr(t,e))&&(s=!0),t=r,o=n}if(t===void 0){i=!0;continue}let c=t+1;if(s){r.push(c===a.lineNumber?a:{...a,lineNumber:c}),i=!0;continue}r.push(a)}return i?r:void 0}function or(e){if(e.changedLineChanges!==void 0)return e.changedLineChanges.flatMap(([e,t,n,r=0,i=0,a=!1])=>{if(n===0)return[];let o=Math.max(0,t-e);return[{startLine:e,startCharacter:r,endLine:e+Math.max(0,o-n),deletesEndLine:n<0&&a,insertedLineBreaks:o,lineDelta:n}]});if(e.lineDelta===0)return e.changedLineRanges.flatMap(([e,t])=>{let n=t-e;return n<=0?[]:[{startLine:e,startCharacter:0,endLine:e,deletesEndLine:!1,insertedLineBreaks:n,lineDelta:n}]});let t=Math.max(0,-e.lineDelta),n=e.endedAtDocumentEnd&&e.startLine+t===e.previousLineCount-1;return[{startLine:e.startLine,startCharacter:e.startCharacter,endLine:e.startLine+t,deletesEndLine:n,insertedLineBreaks:Math.max(0,e.lineDelta),lineDelta:e.lineDelta}]}function sr(e,t,n){if(e<t.startLine)return e;if(e>t.endLine||t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)return e+t.lineDelta;if(t.startLine===t.endLine)return t.startCharacter===0?e+t.insertedLineBreaks:e;if(cr(e,t))return;let r=Math.min(Math.max(0,e-t.startLine),t.insertedLineBreaks);return ur(t.startLine+r,n)}function cr(e,t){return!(t.lineDelta>=0||e<t.startLine||e>t.endLine||e===t.startLine&&t.startCharacter>0||e===t.endLine&&!t.deletesEndLine)}function lr(e,t){return t.lineDelta===0||e<t.startLine||e>t.endLine?!1:!(t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)}function ur(e,t){return Math.max(0,Math.min(e,Math.max(0,t-1)))}function dr(e,t,n){let r=new Map,i=new Map;for(let t of e){let e=t.lineNumber;r.has(e)||r.set(e,[]),i.has(e)||i.set(e,[]),(t.side===`deletions`?i:r).get(e).push(he(t))}let a=t.parentElement?.previousElementSibling,o,s;if(a!=null&&a instanceof HTMLElement&&a.dataset.deletions!==void 0)for(let e of a.children){let t=e,{gutter:n,content:r}=t.dataset;n===void 0?r!==void 0&&(s=t):o=t}fr(t,n),s!==void 0&&fr(s,o);let c=pr(r,t,n);if(s===void 0)return;let l=pr(i,s,o);requestAnimationFrame(()=>{mr(r,i,c,l)})}function fr(e,t){let n=[];for(let r=1;r<e.childElementCount;r++){let i=e.children[r];i.dataset.lineAnnotation!==void 0&&(n.push(i),t!==void 0&&n.push(t.children[r]))}for(let e of n)e.remove()}function pr(e,t,n){let r=new Map;for(let n of t.children){let t=Yn(n);if(t!==void 0){let i=e.get(t);if(i!==void 0){let e=U(`div`,{dataset:{lineAnnotation:`0,`+(t-1)},children:[U(`div`,{dataset:`annotationContent`,children:i.map(e=>U(`slot`,{name:e}))})]});n.after(e),r.set(t,e)}}}if(n!==void 0)for(let t of n.children){let n=Yn(t,`columnNumber`);if(n!==void 0&&e.has(n)){let e=U(`div`,{dataset:{gutterBuffer:`annotation`,bufferSize:`1`},style:{gridRow:`span 1`}});t.after(e)}}return r}function mr(e,t,n,r){let i=new Map;for(let[t,n]of e.entries()){let e=r.get(t);if(n.length===0&&e!==void 0){let n=hr(e);n>0&&i.set(t,n)}}for(let[e,r]of t.entries()){let t=n.get(e);if(r.length===0&&t!==void 0){let n=hr(t);n>0&&i.set(e,n)}}gr(e,n,i),gr(t,r,i)}function hr(e){let t=e.firstElementChild;return t instanceof HTMLElement?t.getBoundingClientRect().height:0}function gr(e,t,n){for(let[r,i]of t.entries()){let t=e.get(r),a=n.get(r);t?.length===0&&a!==void 0&&i.style.setProperty(`--diffs-annotation-min-height`,`${a}px`)}}var _r=class{#e;#t;#n;#r;#i;#a;#o=0;#s=0;#c=0;#l=!0;#u;#d=new Map;#f;#p;constructor(e){this.#f=e.hasActivePopover,this.#p=e.updateActivePopover}setViewportElements(e,t){let n=this.#e!==e||this.#t!==t;this.#e=e,n&&(this.#t=t,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0)}cleanUp(){this.#t=void 0,this.#e=void 0,this.#n=void 0,this.#r=void 0,this.#i=void 0,this.#a=void 0,this.#o=0,this.#s=0,this.#c=0,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0,this.#d.clear()}resetPlacement(e=`default`){this.#d.delete(e)}setPlacement(e,t=`default`){this.#d.set(t,e)}choosePlacement(e){let{preferred:t,fallback:n,viewport:r,popoverHeight:i,atDocumentEdge:a,placementKey:o=`default`}=e,s=this.#d.get(o),c;if(r!==void 0&&i>0){let e=(e,t=0)=>e.top>=r.top+t&&e.bottom<=r.bottom-t;c=s===`fallback`&&e(n)&&!e(t,4)||!e(t)&&e(n)?`fallback`:`preferred`}else c=a?`fallback`:`preferred`;return this.#d.set(o,c),c}getPlacementBounds(){let e=this.#g();if(e===void 0)return;let t=this.#_(),n,r;if(t===void 0?(n=0,r=window.innerHeight):(n=t.top,r=t.bottom),n=Math.max(n,e.top),r=Math.min(r,e.bottom),r<=n)return;let i=this.#o,a=this.#s,o=this.#c>0?this.#c:e.width,s=t===void 0?0:t.left,c=t===void 0?window.innerWidth:t.right,l=i,u=i+o,d=Math.max(l,s-e.left+i),f=Math.min(u,c-e.left+i);return{top:n-e.top+a,bottom:r-e.top+a,left:d,right:Math.max(d,f)}}#m(){let e=this.#e;if(e===void 0)return;if(this.#r===e&&(this.#n===void 0||this.#n.isConnected))return this.#n;let t=e.parentElement;for(;t!==null;){let n=getComputedStyle(t).overflowY;if(n===`auto`||n===`scroll`||n===`overlay`)return this.#n=t,this.#r=e,t;t=t.parentElement}this.#n=void 0,this.#r=e}#h(){if(!this.#l)return;this.#v();let e=this.#t;this.#i=e?.getBoundingClientRect(),this.#o=e?.scrollLeft??0,this.#s=e?.scrollTop??0,this.#c=e?.clientWidth??0,this.#a=this.#m()?.getBoundingClientRect(),this.#l=!1}#g(){return this.#h(),this.#i}#_(){return this.#h(),this.#a}#v(){if(this.#u!==void 0)return;let e,t=()=>{this.#l=!0,!(!this.#f()||e!==void 0)&&(e=requestAnimationFrame(()=>{e=void 0,this.#p()}))},n=this.#m(),r=this.#t;this.#u=[W(n===void 0?window:n,`scroll`,t,{passive:!0}),...r===void 0?[]:[W(r,`scroll`,t,{passive:!0})],W(window,`resize`,t,{passive:!0}),()=>{e!==void 0&&(cancelAnimationFrame(e),e=void 0)}]}};function vr(e,{gutterWidth:t,placeAbove:n,viewport:r,x:i,y:a}){if(e.style.setProperty(`--gutter-width`,t+`px`),e.style.setProperty(`--popover-x`,i+`px`),e.style.setProperty(`--popover-y`,a+`px`),e.style.setProperty(`--popover-y-shift`,n?`-100%`:`0px`),r===void 0){e.style.removeProperty(`--popover-viewport-left`),e.style.removeProperty(`--popover-viewport-right`);return}e.style.setProperty(`--popover-viewport-left`,r.left+`px`),e.style.setProperty(`--popover-viewport-right`,r.right+`px`)}var yr=new Map([[`'`,`'`],[`"`,`"`],["`","`"],[`{`,`}`],[`[`,`]`],[`<`,`>`],[`(`,`)`]]),br=new Set([`'`,`"`,"`"]),xr=new Set([`{`,`[`,`(`,`<`]);function Sr(e,t=0){let n=Di(e.startContainer,e.startOffset),r=Di(e.endContainer,e.endOffset);if(!(n===null||r===null))return{start:n,end:r,direction:t}}function Cr(e,t,n,r){if(e===void 0)return[[],t];let{start:i,end:a}=t,o=[],s={...t},c=i.line!==a.line,l=a.line;i.line<a.line&&a.character===0&&l--;for(let t=i.line;t<=l;t++){let l=e.getLineText(t);if(l===void 0||c&&l.trim().length===0)continue;let u=l.startsWith(` `)?` `:` `.repeat(n),d=0,f=u;if(r){if(l.startsWith(` `))d=1;else if(l.startsWith(` `)){let e=l.length-l.trimStart().length;d=Math.min(u.length,e)}if(d===0)continue;f=``}o.push({range:{start:{line:t,character:0},end:{line:t,character:d}},newText:f});let p=f.length-d;t===i.line&&(s={...s,start:{...i,character:Math.max(0,i.character+p)}}),t===a.line&&(s={...s,end:{...a,character:Math.max(0,a.character+p)}})}return[o,s]}function wr(e,t,n,r={}){let i=e.lineCount;return t.map(t=>{let{line:a,character:o}=n===`up`||n===`left`?t.start:t.end;if(n===`textStart`||n===`start`||n===`end`){let i=Wr(t);a=i.line,o=i.character;let s=Dr(e,a,o,r);if(n===`textStart`){let t=e.getLineText(a).slice(s.start,s.end),n=s.start+wi(t);o=o===n?s.start:n}else o=n===`start`?s.start:s.end}else if(n===`up`){let t=Tr(e,a,o,-1,r);t===void 0?a>0&&(a=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`)??a):(a=t.line,o=t.character)}else if(n===`down`){let t=Tr(e,a,o,1,r);if(t!==void 0)a=t.line,o=t.character;else{let e=Math.max(i-1,0);a<e&&(a=r.resolveRenderableLine==null?a+1:Math.min(r.resolveRenderableLine(a+1,`down`)??a,e))}}else if(Ur(t)){let t=e.getLineLength(a);if(o=Math.min(o,t),n===`left`){if(o>0)o=bi(e,a,o,!1);else if(a>0){let t=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`);t!==void 0&&(a=t,o=e.getLineLength(a))}}else if(o<t)o=bi(e,a,o,!0);else if(a<i-1){let e=r.resolveRenderableLine==null?a+1:r.resolveRenderableLine(a+1,`down`);e!==void 0&&(a=Math.min(e,i-1),o=0)}}let s={line:a,character:o};return{start:s,end:s,direction:0}})}function Tr(e,t,n,r,i){if(i.getSoftLineOffsets===void 0)return;let a=Dr(e,t,n,i),o=a.index+r,s=t,c;if(o>=0&&o<a.count)c=kr(e,s,o,i);else{let a=t+r;if(a<0||a>=e.lineCount)return{line:t,character:n};let o=i.resolveRenderableLine==null?a:i.resolveRenderableLine(a,r<0?`up`:`down`);if(o===void 0)return{line:t,character:n};s=Math.min(o,e.lineCount-1);let l=Or(e,s,i);c=kr(e,s,r<0?l-1:0,i)}let l=Math.max(0,n-a.start),u=c.start+l,d=c.index===c.count-1?u:Math.min(u,c.end),f=e.getLineText(s);return{line:s,character:d>f.length?d:Er(f,d)}}function Er(e,t){if(t<=0||t>=e.length)return t;let n=ir();if(n!==void 0){for(let r of n.segment(e)){if(t<=r.index)return t;let e=r.index+r.segment.length;if(t<e)return e}return t}let r=0;for(let n of e){if(t<=r)return t;let e=r+n.length;if(t<e)return e;r=e}return t}function Dr(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};for(let i=0;i+1<a.length;i++){let a=kr(e,t,i,r);if(n>=a.start&&n<=a.end)return a}return kr(e,t,n<(a[0]??0)?0:a.length-2,r)}function Or(e,t,n){let r=n.getSoftLineOffsets?.(t);return r===void 0||r.length<2?1:r.length-1}function kr(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};let o=a.length-1,s=Math.max(0,Math.min(n,o-1)),c=Math.max(0,Math.min(i,a[s]??0));return{start:c,end:Math.max(c,Math.min(i,a[s+1]??i)),index:s,count:o}}function Ar(e,t,n,r={}){return t.map(t=>{let i=t.direction===-1?t.start:t.end,[a]=wr(e,[{start:i,end:i,direction:0}],n,r);return Xr(t,a)})}function jr(e,t,n,r,i=2,a=!1){if(t[t.length-1]===void 0)return{nextSelections:[]};let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=s[(t.length-1)*2],l=s[(t.length-1)*2+1],u=[],d=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=u[u.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(d=!1),u.push(t)}d||u.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let f=Ei(e,n,i),p=[],m=Array.from({length:t.length}),h=0,g,_=()=>{if(g===void 0)return;let t=Ei(e,{start:g.start,end:g.end,text:f.text},i),n=Ci(e,t.text,t.start);p.push({start:t.start,end:t.end,text:n});let r=[g.start+h+n.length,g.start+h+n.length];for(let e of g.indices)m[e]=r;h+=n.length-(t.end-t.start),g=void 0};for(let e of u){let t=Math.max(0,e.start+(f.start-c)),n=Math.max(t,e.end+(f.end-l));if(g!==void 0&&t<g.end){g.end=Math.max(g.end,n),g.indices.push(e.index);continue}_(),g={start:t,end:n,indices:[e.index]}}_();let v=e.applyResolvedEdits(p,!0,t,void 0,a),y=Ti(e,m.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(y),v!==void 0&&r!==void 0){let t=ar(v,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:y,change:v}}function Mr(e,t){if(t.length!==e.length+2)return;let n=yr.get(t[0]);if(!(n===void 0||t[t.length-1]!==n||t.slice(1,-1)!==e))return 1}function Nr(e,t,n,r){let i=t.start+n,a=i+r.length;if(t.end-t.start>0){let n=e.getTextSlice(t.start,t.end),a=Mr(n,r)??r.indexOf(n);if(a!==-1&&a+n.length<=r.length){let e=i+a;return[e,e+n.length]}}return[a,a]}function Pr(e,t,n,r,i=!1,a=`selection`){if(t.length!==n.length)throw Error(`Selection text replacements must match the selection count`);let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=[],l=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=c[c.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(l=!1),c.push(t)}l||c.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let u=n.every(e=>e===``),d,f=Array.from({length:t.length});if(u){d=[];let e=!1;for(let t of c){if(f[t.index]=[t.end,t.end],t.start>=t.end)continue;e=!0;let n=d[d.length-1];n!==void 0&&t.start<n.end?d[d.length-1]={start:n.start,end:Math.max(n.end,t.end),text:``}:d.push({start:t.start,end:t.end,text:``})}if(!e)return{nextSelections:t};for(let e of c){let t=e.end,n=0,r=t;for(let e of d){if(t<=e.start)break;if(t>=e.end){n-=e.end-e.start;continue}r=e.start+n;break}r===t&&(r+=n),f[e.index]=[r,r]}}else{d=[];let t=0,r=-1;for(let i=0;i<c.length;i++){let o=c[i];if(o.start<r)throw Error(`Overlapping multi-selection edits are not supported`);r=o.end;let s=Ci(e,n[a===`document`?i:o.index],o.start);d.push({start:o.start,end:o.end,text:s}),f[o.index]=Nr(e,o,t,s),t+=s.length-(o.end-o.start)}}let p=e.applyResolvedEdits(d,!0,t,void 0,i),m=Ti(e,f.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(m),p!==void 0&&r!==void 0){let t=ar(p,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:m,change:p}}function Fr(e,t){return e===`never`?!1:e===`brackets`?xr.has(t):e===`quotes`?br.has(t):!0}function Ir(e,t,n,r){if(n.length!==1||t.length===0)return;let i=yr.get(n);if(i===void 0||!Fr(r,n))return;let a=[];for(let r of t){if(Ur(r))return;a.push(n+e.getText(r)+i)}return a}function Lr(e,t,n){let r=[],i=[];for(let n of t){let[t,a]=xi(e,n);if(!Ur(n)){i.push([t,a]);continue}let{line:o,character:s}=n.start,c=t,l=e.getLineText(o),u=l.length,d=c-s,f=yi(l),p;if(s>0&&s<u){let e=vi(l,s,!1,f),t=vi(l,s,!0,f);p={start:d+e,end:d+t,text:l.slice(s,t)+l.slice(e,s)},i.push([d+t,d+t])}else if(s===u&&f.length>=2){let e=f[f.length-1],t=f[f.length-2];p={start:d+t,end:c,text:l.slice(e,u)+l.slice(t,e)},i.push([c,c])}else if(s===0&&o>0&&u>0){let t=o-1,n=e.getLineText(t),r=n.length,a=e.offsetAt({line:t,character:r}),s=r>0?vi(n,r,!1,yi(n)):r,u=vi(l,0,!0,f),d=a-(r-s),m=l.slice(0,u)+e.getTextSlice(a,c)+n.slice(s,r);p={start:d,end:c+u,text:m};let h=d+m.length;i.push([h,h])}else{i.push([t,a]);continue}r.push(p)}if(r.length===0)return{nextSelections:t};r.sort((e,t)=>e.start-t.start);for(let e=1;e<r.length;e++)if(r[e].start<r[e-1].end)throw Error(`Overlapping multi-selection edits are not supported`);let a=e.applyResolvedEdits(r,!0,t),o=Ti(e,i);if(e.setLastUndoSelectionsAfter(o),a!==void 0&&n!==void 0){let t=ar(a,n);t!==void 0&&e.setLastUndoLineAnnotations(n,t)}return{nextSelections:o,change:a}}function Rr(e,t,n){let r=t.map(t=>{let n=Si(e,t);return{start:n.start,end:n.end,direction:0}});return Pr(e,r,r.map(()=>``),n)}function zr(e,t,n,r){let i=t.map(t=>{if(!Ur(t))return{start:t.start,end:t.end,direction:0};let r=Wr(t),{line:i,character:a}=r,o=n?.(i,a)??0;if(a>o)return{start:{line:i,character:o},end:{line:i,character:a},direction:0};if(i===0)return{start:r,end:r,direction:0};let s=e.getLineLength(i-1);return{start:{line:i-1,character:s},end:{line:i,character:0},direction:0}});return Pr(e,i,i.map(()=>``),r)}function Br(e,t,n){let r=t.map(t=>{let[n,r]=_i(e,t);return{start:n,end:r,direction:0}});return Pr(e,r,r.map(()=>``),n)}function Vr(e,t,n){if(!Ur(t))return[t.start,t.end];let r=Wr(t),{line:i,character:a}=r,o=e.getLineLength(i),s=e.lineCount;if(a=Math.min(a,o),n)return a<o?[{line:i,character:a},{line:i,character:bi(e,i,a,!0)}]:i<s-1?[{line:i,character:o},{line:i+1,character:0}]:[r,r];if(a>0)return[{line:i,character:bi(e,i,a,!1)},{line:i,character:a}];if(i>0){let t=e.getLineLength(i-1);return[{line:i-1,character:t},{line:i,character:0}]}return[r,r]}function Hr(e,t,n,r,i=2){let a=t.map(t=>{let[r,a]=Vr(e,t,n);if(!n&&Ur(t)){let t=Ei(e,{start:e.offsetAt(r),end:e.offsetAt(a),text:``},i);r=e.positionAt(t.start),a=e.positionAt(t.end)}return{start:r,end:a,direction:0}});return Pr(e,a,a.map(()=>``),r)}function Ur(e){return e.start.line===e.end.line&&e.start.character===e.end.character}function Wr(e){let{start:t,end:n,direction:r}=e;return r===-1?t:n}function Gr(e){return e===`context`||e===`context-expanded`||e===`change-addition`}function Kr(e,t){let n=Ur(e),r=Ur(t);return n&&r?G(e.start,t.start)===0:n?G(t.start,e.start)<=0&&G(e.start,t.end)<=0:r?G(e.start,t.start)<=0&&G(t.start,e.end)<=0:G(e.start,t.end)<0&&G(t.start,e.end)<0}function G(e,t){return e.line===t.line?e.character-t.character:e.line-t.line}function qr(e,t,n){let r=t===n?0:t<n?1:-1,i=Math.min(t,n),a=Math.max(t,n);return{start:e.positionAt(i),end:e.positionAt(a),direction:r}}function Jr(e,t){let n=0;for(let r of t){if(e<r.start)break;if(e>=r.end)n+=r.text.length-(r.end-r.start);else return r.start+n+r.text.length}return e+n}function Yr(e,t,n,r){return t.map((t,i)=>{let[a,o]=n[i],s=Jr(a,r),c=Jr(o,r);return qr(e,t.direction===-1?c:s,t.direction===-1?s:c)})}function Xr(e,t){let n=e.direction===-1?e.end:e.start,r=G(n,t.start),i=G(n,t.end),a=t.end;a=r<=0?t.end:i>=0?t.start:r===0?t.end:t.start;let o=G(n,a);return{start:o<=0?n:a,end:o<=0?a:n,direction:o===0?0:o<0?1:-1}}function Zr(e,t){let n=G(t.start,e.start)<0,r=G(t.end,e.end)>0;return n&&!r?{start:t.start,end:e.end,direction:-1}:r&&!n?{start:e.start,end:t.end,direction:1}:e.direction===-1?{start:t.start,end:e.end,direction:G(t.start,e.end)===0?0:-1}:{start:e.start,end:t.end,direction:G(e.start,t.end)===0?0:1}}function Qr(e,t){return $r(e.map(e=>Zr(e,t)))}function $r(e){if(e.length<=1)return e;let t=e.map((e,t)=>({index:t,selection:e})).sort((e,t)=>{let n=G(e.selection.start,t.selection.start);if(n!==0)return n;let r=G(e.selection.end,t.selection.end);return r===0?e.index-t.index:r}),n=[],r=t[0];for(let e of t.slice(1)){if(Kr(r.selection,e.selection)){let t=e.index>r.index?e:r,n=G(e.selection.start,r.selection.start)<0?e.selection.start:r.selection.start,i=G(e.selection.end,r.selection.end)>0?e.selection.end:r.selection.end,a=t.selection.direction;a===0&&G(n,i)!==0&&(a=G(t.selection.start,n)===0?-1:1),r={index:t.index,selection:{direction:a,end:i,start:n}};continue}n.push(r),r=e}return n.push(r),n.sort((e,t)=>e.index-t.index).map(({selection:e})=>e)}function ei(e){let t=e.map(e=>{let t=e.end.line;return e.end.character===0&&G(e.start,e.end)!==0&&t--,{startLine:e.start.line,endLine:Math.max(e.start.line,t)}}).sort((e,t)=>{let n=e.startLine-t.startLine;return n===0?e.endLine-t.endLine:n}),n=[];for(let e of t){let t=n.at(-1);t!==void 0&&e.startLine<=t.endLine+1?t.endLine=Math.max(t.endLine,e.endLine):n.push({...e})}return n}function ti(e,t,n,r){let i=e=>{let i=e.line+t;if(i>=n){let e=Math.max(0,n-1);return{line:e,character:r(e)}}return i<0?{line:0,character:0}:{line:i,character:e.character}};return{start:i(e.start),end:i(e.end),direction:e.direction}}function ni(e,t){if(t.length===0)return;let n=t.map(t=>Ur(t)?hi(e,t):t),r=n.map(t=>e.getText(t)),i=r[0];if(i.length===0||r.some(e=>e!==i))return;let a=n.map(t=>[e.offsetAt(t.start),e.offsetAt(t.end)]),o=e.findNextNonOverlappingSubstring(i,a);if(o===void 0)return n.some((e,n)=>{let r=t[n];return G(e.start,r.start)!==0||G(e.end,r.end)!==0||e.direction!==r.direction})?n:void 0;let s=qr(e,o,o+i.length);return[...n,s]}function ri(e){let t=e.lineCount-1;return{start:{line:0,character:0},end:{line:t,character:e.getLineLength(t)},direction:1}}function ii(e,t,n){let r=0;if(t){let t=e.lineCount-1;r=n===!0&&t>0&&e.getLineLength(t)===0?t-1:t}let i=t?e.getLineLength(r):0,a={line:r,character:i};return{start:a,end:a,direction:1}}function ai(e,t){if(Ur(t)){let n=t.start.line;return{start:e.offsetAt({line:n,character:0}),end:n<e.lineCount-1?e.offsetAt({line:n+1,character:0}):e.offsetAt({line:n,character:e.getLineLength(n)})}}let n=e.offsetAt(t.start),r=e.offsetAt(t.end);return n<=r?{start:n,end:r}:{start:r,end:n}}function oi(e,t){return t.map(t=>ai(e,t)).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n})}function si(e,t){return oi(e,t).map(({start:t,end:n})=>e.getTextSlice(t,n))}function ci(e,t){let n=oi(e,t),r=e.eol,i=``,a=-1;for(let t of n)if(!(t.end<=t.start)){if(t.start<=a){t.end>a&&(i+=e.getTextSlice(a,t.end),a=t.end);continue}i.length>0&&!er(i)&&(i+=r),i+=e.getTextSlice(t.start,t.end),a=t.end}return i}function li(e,t){if(Ur(t))return ui(e,t);let[n,r]=G(t.start,t.end)<=0?[t.start,t.end]:[t.end,t.start];return{start:e.offsetAt(n),end:e.offsetAt(r),text:``}}function ui(e,t){let n=t.start.line,r=e.offsetAt({line:n,character:0}),i=e.offsetAt({line:n,character:e.getLineLength(n)});return n<e.lineCount-1?{start:r,end:e.offsetAt({line:n+1,character:0}),text:``}:n>0?{start:e.offsetAt({line:n-1,character:e.getLineLength(n-1)}),end:i,text:``}:{start:r,end:i,text:``}}function di(e){let t=[];for(let{edit:n}of e){if(n.start>=n.end)continue;let e=t.at(-1);e!==void 0&&n.start<=e.end?t[t.length-1]={start:e.start,end:Math.max(e.end,n.end),text:``}:t.push(n)}return t}function fi(e,t){let n=Array.from({length:e.length}),r=0,i=0;for(let a of e){for(;r<t.length&&a.edit.start>t[r].end;){let e=t[r];i-=e.end-e.start,r++}let e=t[r];e!==void 0&&a.edit.start>=e.start&&a.edit.start<=e.end?n[a.index]=e.start+i:n[a.index]=a.edit.start+i}return n}function pi(e,t){let n=[...t.map((t,n)=>({index:n,edit:li(e,t)}))].sort((e,t)=>{let n=e.edit.start-t.edit.start;if(n!==0)return n;let r=e.edit.end-t.edit.end;return r===0?e.index-t.index:r}),r=di(n);return{text:ci(e,t),edits:r,nextSelectionOffsets:fi(n,r)}}function mi(e,t){let n=Math.max(0,t),r=Oi(e),i=null;for(let e of r){i=e;let t=Ii(e);if(n<=t+(e.textContent?.length??0)){let r=ki(e,n<t?0:n-t);if(r!==null)return r}}if(i!==null){let e=ki(i,i.textContent?.length??0);return e===null?[i,0]:e}let a=0,o=null;for(let t of e.childNodes){if(t.nodeType===1&&t.tagName===`BR`)return[t,0];if(t.nodeType!==3)continue;o=t;let e=Li(o.textContent,o.textContent?.length??0);if(n<=a+e)return[o,Li(o.textContent,n-a)];a+=e}return o===null?[e,0]:[o,Li(o.textContent,o.textContent?.length??0)]}function hi(e,t){let{line:n,character:r}=t.start,i=e.getLineText(n),a=gi(i,Math.max(0,Math.min(r,i.length)));return a===void 0?t:{start:{line:n,character:a.start},end:{line:n,character:a.end},direction:1}}function gi(e,t){let n=tr({granularity:`word`});if(n!==void 0){for(let r of n.segment(e)){if(r.isWordLike!==!0)continue;let e=r.index,n=e+r.segment.length;if(t>=e&&t<=n)return{start:e,end:n}}return}let r=/[\p{Alphabetic}\p{Number}_]+/gu,i;for(;(i=r.exec(e))!==null;){let e=i.index,n=e+i[0].length;if(t>=e&&t<=n)return{start:e,end:n}}}function _i(e,t){if(!Ur(t))return[t.start,t.end];let n=Wr(t),{line:r,character:i}=n;if(i===0){if(r===0)return[n,n];let t=e.getLineLength(r-1);return[{line:r-1,character:t},{line:r,character:0}]}let a=e.getLineText(r),o=yi(a),s=i,c;for(;s>0;){let e=vi(a,s,!1,o),t=a.slice(e,s),n=/\S/.test(t)?/\p{Alphabetic}|\p{Number}|_/u.test(t)?1:2:0;if(c!==void 0&&n!==c)break;(n!==0||s!==i)&&(c=n),s=e}return[{line:r,character:s},{line:r,character:i}]}function vi(e,t,n,r){if(n){for(let e of r)if(e>t)return e;return e.length}for(let e=r.length-1;e>=0;e--){let n=r[e];if(n<t)return n}return 0}function yi(e){let t=[0],n=ir();if(n!==void 0){for(let r of n.segment(e))r.index>0&&t.push(r.index);return t}let r=0;for(let n of e)r>0&&t.push(r),r+=n.length;return t}function bi(e,t,n,r){let i=e.getLineLength(t);if(r){if(n>=i)return i;let r=e.offsetAt({line:t,character:0}),a=e.getTextSlice(r+n,r+i),o=ir();if(o!==void 0){for(let e of o.segment(a))return n+e.segment.length;return i}for(let e of a)return n+e.length;return i}if(n<=0)return 0;let a=e.offsetAt({line:t,character:0}),o=e.getTextSlice(a,a+n),s=0,c=ir();if(c!==void 0){for(let e of c.segment(o))s=e.index;return s}let l=0;for(let e of o)s=l,l+=e.length;return s}function xi(e,t){let n=t.direction===-1;return[e.offsetAt(n?t.end:t.start),e.offsetAt(Wr(t))]}function Si(e,t){if(!Ur(t))return{start:t.start,end:t.end};let{line:n,character:r}=t.start,i=e.getLineText(n).length;return r<i?{start:{line:n,character:r},end:{line:n,character:i}}:n<e.lineCount-1?{start:{line:n,character:r},end:{line:n+1,character:0}}:{start:{line:n,character:r},end:{line:n,character:r}}}function Ci(e,t,n){if(t!==`
457
+ `&&t!==`\r`&&t!==`\r
458
+ `)return t;let r=e.positionAt(n).line,i=e.getLineText(r),a=wi(i);return a===0?t:t+i.slice(0,a)}function wi(e){let t=0;for(;t<e.length;t++){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}return t}function Ti(e,t){let n=[];for(let[e,r]of t)n.push(Math.min(e,r),Math.max(e,r));let r=e.positionsAt(n);return t.map(([e,t],n)=>{let i=e===t?0:e<t?1:-1;return{start:r[n*2],end:r[n*2+1],direction:i}})}function Ei(e,t,n){if(t.text!==``||t.start!==t.end-1)return t;let r=e.positionAt(t.end);if(r.character===0)return t;let i=e.getLineText(r.line),a=i.slice(0,r.character);if(/[^ \t]/.test(a)||i[r.character-1]===` `)return t;let o=Math.max(0,r.character-n),s=i.slice(o,r.character);return s.length===n&&/^ +$/.test(s)?{...t,start:t.end-s.length}:t}function Di(e,t){let n=e.nodeType===1?e:e.parentElement;for(;n!==null&&Fi(n)===void 0;)n=n.parentElement;if(n===null)return null;let r=Fi(n);if(r===void 0)return null;if(e.nodeType===3)return e.parentElement===null?null:Ni(e.parentElement)===null?{line:r,character:Mi(n,e)+Li(e.textContent,t)}:{line:r,character:Pi(e,t)};if(e.nodeType===1){let i=e;if(i.tagName===`DIV`){let e=0;for(let n=0;n<t;n++)e=Pi(i.childNodes[n]);return{line:r,character:e}}if(i.tagName===`BR`)return{line:r,character:0};if(i.tagName===`SPAN`){if(t<i.childNodes.length){let e=i.childNodes[t];if(e?.nodeType===1){let t=Ii(e);if(t!==void 0)return{line:r,character:t};let n=Ni(e),i=n===null?void 0:Ii(n);if(i!==void 0)return{line:r,character:i}}}return{line:r,character:t>0?Pi(i.childNodes[t-1]):Mi(n,i)}}return{line:r,character:Mi(n,i)}}return null}function Oi(e){let t=[];for(let n of e.childNodes){if(n.nodeType!==1)continue;let e=n;if(e.tagName===`SPAN`){if(Ii(e)!==void 0){t.push(e);continue}for(let n of e.childNodes)n.nodeType===1&&Ii(n)!==void 0&&t.push(n)}}return t}function ki(e,t){let n=Math.max(0,t),r=[{container:e,index:0}];for(;r.length>0;){let e=r[r.length-1];if(e.index>=e.container.childNodes.length){r.pop();continue}let t=e.container.childNodes[e.index];if(e.index++,t.nodeType===3){let e=Li(t.textContent,t.textContent?.length??0);if(n<=e)return[t,n];n-=e}else t.nodeType===1&&r.push({container:t,index:0})}return null}function Ai(e,t){let n=0,r=[{container:e,index:0}];for(;r.length>0;){let e=r[r.length-1];if(e.index>=e.container.childNodes.length){r.pop();continue}let i=e.container.childNodes[e.index];if(i===t)return n;e.index++,i.nodeType===3?n+=Li(i.textContent,i.textContent?.length??0):i.nodeType===1&&r.push({container:i,index:0})}return n}function ji(e,t){let n=t;for(;n!==null;){if(n===e)return!0;n=n.parentElement}return!1}function Mi(e,t){if(t.parentElement===e){let n=0,r=Array.prototype.indexOf.call(e.childNodes,t);for(let t=0;t<r;t++)n=Pi(e.childNodes[t]);return n}for(let n of Oi(e))if(ji(n,t))return Ii(n)+(t.nodeType===3?Ai(n,t):0);let n=0,r=t.nodeType===1?t:t.parentElement;for(;r!==null&&r.parentElement!==null&&Fi(r.parentElement)===void 0;){let e=r.parentElement,t=Array.prototype.indexOf.call(e.childNodes,r);for(let r=0;r<t;r++)n=Pi(e.childNodes[r]);r=e}return n}function Ni(e){let t=e;for(;t!==null;){if(Fi(t)!==void 0)return null;if(Ii(t)!==void 0)return t;t=t.parentElement}return null}function Pi(e,t){if(e===void 0)return 0;if(e.nodeType===3){let n=e.parentElement;if(n===null)return 0;let r=Ni(n);if(r===null)return 0;let i=Ii(r);if(i===void 0)return 0;let a=t===void 0?Li(e.textContent,e.textContent?.length??0):Li(e.textContent,t);return i+Ai(r,e)+a}if(e.nodeType!==1)return 0;let n=e;if(n.tagName!==`SPAN`&&n.tagName!==`BR`)return 0;let r=Ii(n);if(r!==void 0)return r+(n.textContent?.length??0);let i=0;for(let e of n.childNodes)i=Math.max(i,Pi(e));return i}function Fi(e){let{line:t,lineType:n}=e.dataset;if(t!==void 0&&n!==`change-deletion`){let e=parseInt(t,10);if(!Number.isNaN(e))return e-1}}function Ii(e){let{char:t}=e.dataset;if(t!==void 0){let e=parseInt(t,10);if(!Number.isNaN(e))return e}}function Li(e,t){let n=e??``,r=n.search(/[\r\n]/);return Math.min(t,r===-1?n.length:r)}var Ri=300,zi=100,Bi=`marker-popup`,Vi=class{#e;#t=[];#n=0;#r;#i;#a;#o;#s;#c;#l;#u=!1;constructor(e){this.#e=e}get markers(){return this.#t}isPopupVisible(){return this.#l!==void 0}updatePopupPosition(){let e=this.#l,t=this.#r;if(e===void 0||t===void 0)return;let n=this.#t[e];if(n===void 0){this.removePopup();return}this.#_(t,n.start.line,n.start.character)}setMarkers(e,t){this.#n=t.lineCount,this.#t=e.map(e=>({...e,start:t.normalizePosition(e.start),end:t.normalizePosition(e.end)})),this.removePopup()}listenHover(e){this.#a?.forEach(e=>e()),this.#a=void 0,this.#t.length!==0&&(this.#a=[W(e,`mouseover`,e=>{if(this.#e.isMouseDown())return;let t=e.composedPath()[0];if(t===void 0)return;let n=this.#d(t);n===void 0?(this.#f(),this.#h()):this.#m(n)}),W(e,`mouseleave`,()=>{this.#f(),this.#h()})])}removePopup(){this.#f(),this.#p(),this.#v()}cleanup(){this.#a?.forEach(e=>e()),this.#a=void 0,this.removePopup(),this.#t=[]}#d(e){let t=e.closest(`[data-line]`);if(t==null)return;let n=Yn(t);if(n===void 0)return;let r;if(e.tagName===`SPAN`){let t=e.dataset.char;if(t===void 0||(r=parseInt(t,10),Number.isNaN(r)))return}else if(e.tagName===`BR`)r=0;else return;let i={line:n-1,character:r};for(let e=this.#t.length-1;e>=0;e--)if(Kr({start:i,end:i},this.#t[e]))return e}#f(){this.#o!==void 0&&(clearTimeout(this.#o),this.#o=void 0),this.#c=void 0}#p(){this.#s!==void 0&&(clearTimeout(this.#s),this.#s=void 0)}#m(e){if(e===this.#l||e===this.#c){this.#p();return}if(this.#f(),this.#p(),this.#r!==void 0){this.#y(e);return}this.#c=e,this.#o=setTimeout(()=>{this.#o=void 0,this.#c=void 0,this.#y(e)},Ri)}#h(){this.#u||(this.#p(),this.#s=setTimeout(()=>{this.#s=void 0,this.#u||this.removePopup()},zi))}#g(e,t,n,r,i=this.#e.popoverManager.getPlacementBounds()){vr(e,{gutterWidth:this.#e.getGutterWidth(),placeAbove:r,viewport:i,x:t,y:n})}#_(e,t,n){let{getCharX:r,getLineY:i,getLineHeight:a,popoverManager:o}=this.#e,[s,c]=r(t,n),l=a(),u=i(t)+c*l,d=e.offsetHeight,f={top:u+l,bottom:u+l+d},p={top:u-d,bottom:u},m=t>=this.#n-3,h=o.getPlacementBounds(),g=o.choosePlacement({preferred:f,fallback:p,viewport:h,popoverHeight:d,atDocumentEdge:m,placementKey:Bi})===`fallback`;this.#g(e,s,g?u:u+l,g,h)}#v(){this.#i?.forEach(e=>e()),this.#i=void 0,this.#r?.remove(),this.#r=void 0,this.#l=void 0,this.#u=!1,this.#e.popoverManager.resetPlacement(Bi)}#y(e){if(e===this.#l)return;let t=this.#e.getOverlayElement();if(e>=this.#t.length||t==null)return;let{start:n,message:r,severity:i}=this.#t[e],{line:a,character:o}=n,s=this.#r;if(this.#e.popoverManager.resetPlacement(Bi),s!==void 0){Ui(s,i);let t=s.firstElementChild;t?.dataset.markerMessage!==void 0&&(typeof r==`string`?t.textContent=r:r instanceof HTMLElement?t.replaceChildren(r):t.innerHTML=r.html),this.#_(s,a,o),this.#l=e;return}this.#r=U(`div`,{dataset:{editorWidget:``,markerPopup:``,[Wi(i)]:``},children:[U(`div`,{dataset:`markerMessage`,...typeof r==`string`?{textContent:r}:r instanceof HTMLElement?{children:[r]}:{innerHTML:r.html}})]},t),this.#_(this.#r,a,o),this.#l=e,this.#i=[W(this.#r,`mouseenter`,()=>{this.#u=!0,this.#p()}),W(this.#r,`mouseleave`,()=>{this.#u=!1,this.#h()})]}},Hi=[`error`,`warning`,`info`,`hint`];function Ui(e,t){for(let t of Hi)delete e.dataset[Wi(t)];e.dataset[Wi(t)]=``}function Wi(e){switch(e){case`error`:return`markerError`;case`warning`:return`markerWarning`;case`info`:return`markerInfo`;case`hint`:return`markerHint`}}var Gi=new Map([[`(`,`)`],[`[`,`]`],[`{`,`}`]]),Ki=new Map([...Gi].map(([e,t])=>[t,e])),qi=1e3,Ji=5e4;function Yi(e,t,n){let r=Xi(e,t,e.normalizePosition(n));if(r===void 0)return;let i=Gi.get(r.char),a=Ki.get(r.char);if(i!==void 0)return aa(r,$i(e,t,r,i));if(a!==void 0)return aa(ea(e,t,r,a),r)}function Xi(e,t,n){let r=Zi(n);if(r!==void 0){let n=Qi(e,t,r);if(n!==void 0)return n}return Qi(e,t,n)}function Zi(e){if(e.character>0)return{line:e.line,character:e.character-1}}function Qi(e,t,n){let r=e.getLineText(n.line)[n.character];if(!(r===void 0||!Gi.has(r)&&!Ki.has(r)||ta(t,n)))return{...n,char:r}}function $i(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s<e.lineCount;s++){if(a>=qi)return;a++;let c=e.getLineText(s),l=t.getStringCommentRegexpRangesInLine(s),u={index:0},d=s===n.line?n.character:0;for(let e=d;e<c.length;e++){if(o>=Ji)return;if(o++,ra(l,e,u))continue;let t=c[e];if(t===n.char)i++;else if(t===r&&(i--,i===0))return{line:s,character:e,char:t}}}}function ea(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s>=0;s--){if(a>=qi)return;a++;let c=e.getLineText(s),l=t.getStringCommentRegexpRangesInLine(s),u={index:l===null?-1:l.length-1},d=s===n.line?n.character:c.length-1;for(let e=d;e>=0;e--){if(o>=Ji)return;if(o++,ia(l,e,u))continue;let t=c[e];if(t===n.char)i++;else if(t===r&&(i--,i===0))return{line:s,character:e,char:t}}}}function ta(e,t){return na(e.getStringCommentRegexpRangesInLine(t.line),t.character)}function na(e,t){if(e===null)return!1;for(let[n,r]of e){if(t<n)return!1;if(t<r)return!0}return!1}function ra(e,t,n){if(e===null)return!1;for(;n.index<e.length&&t>=e[n.index][1];)n.index++;let r=e[n.index];return r!==void 0&&t>=r[0]}function ia(e,t,n){if(e===null)return!1;for(;n.index>=0&&t<e[n.index][0];)n.index--;let r=e[n.index];return r!==void 0&&t<r[1]}function aa(e,t){if(!(e===void 0||t===void 0))return[oa(e),oa(t)]}function oa(e){return{start:{line:e.line,character:e.character},end:{line:e.line,character:e.character+1}}}var sa=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
459
+ <symbol id="diffs-editor-icon-close" viewBox="0 0 16 16">
460
+ <path fill="currentColor" d="M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z"></path>
461
+ </symbol>
462
+ <symbol id="diffs-editor-icon-arrow-up" viewBox="0 0 16 16">
463
+ <path fill="currentColor" transform="rotate(-90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
464
+ </symbol>
465
+ <symbol id="diffs-editor-icon-arrow-down" viewBox="0 0 16 16">
466
+ <path fill="currentColor" transform="rotate(90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
467
+ </symbol>
468
+ <symbol id="diffs-editor-icon-case" viewBox="0 0 16 16">
469
+ <path fill="currentColor" d="M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z"></path>
470
+ <path fill="currentColor" d="M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z"></path>
471
+ </symbol>
472
+ <symbol id="diffs-editor-icon-whole-word" viewBox="0 0 16 16">
473
+ <path fill="currentColor" d="M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z"></path>
474
+ <path fill="currentColor" d="M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z"></path>
475
+ <path fill="currentColor" d="M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z"></path>
476
+ </symbol>
477
+ <symbol id="diffs-editor-icon-regex" viewBox="0 0 16 16">
478
+ <path fill="currentColor" d="M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z"></path>
479
+ <path fill="currentColor" d="M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z"></path>
480
+ </symbol>
481
+ <symbol id="diffs-editor-icon-replace" viewBox="0 0 16 16">
482
+ <path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M5.28033 5.71967C5.57322 6.01256 5.57322 6.48744 5.28033 6.78033L3.56066 8.5H11.75C12.7165 8.5 13.5 7.7165 13.5 6.75V2.75C13.5 2.33579 13.8358 2 14.25 2C14.6642 2 15 2.33579 15 2.75V6.75C15 8.54493 13.5449 10 11.75 10H3.56066L5.28033 11.7197C5.57322 12.0126 5.57322 12.4874 5.28033 12.7803C4.98744 13.0732 4.51256 13.0732 4.21967 12.7803L1.21967 9.78033C0.926777 9.48744 0.926777 9.01256 1.21967 8.71967L4.21967 5.71967C4.51256 5.42678 4.98744 5.42678 5.28033 5.71967Z"></path>
483
+ </symbol>
484
+ <symbol id="diffs-editor-icon-replace-all" viewBox="0 0 16 16">
485
+ <path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967L14.7803 3.21967C15.0732 3.51256 15.0732 3.98744 14.7803 4.28033L11.7803 7.28033C11.4874 7.57322 11.0126 7.57322 10.7197 7.28033C10.4268 6.98744 10.4268 6.51256 10.7197 6.21967L12.4393 4.5H4.25C3.2835 4.5 2.5 5.2835 2.5 6.25V6.875C2.5 7.28921 2.16421 7.625 1.75 7.625C1.33579 7.625 1 7.28921 1 6.875V6.25C1 4.45507 2.45508 3 4.25 3H12.4393L10.7197 1.28033C10.4268 0.987437 10.4268 0.512563 10.7197 0.21967ZM5.28033 8.71967C5.57322 9.01256 5.57322 9.48744 5.28033 9.78033L3.56066 11.5H11.75C12.7165 11.5 13.5 10.7165 13.5 9.75V9.125C13.5 8.71079 13.8358 8.375 14.25 8.375C14.6642 8.375 15 8.71079 15 9.125V9.75C15 11.5449 13.5449 13 11.75 13H3.56066L5.28033 14.7197C5.57322 15.0126 5.57322 15.4874 5.28033 15.7803C4.98744 16.0732 4.51256 16.0732 4.21967 15.7803L1.21967 12.7803C0.926777 12.4874 0.926777 12.0126 1.21967 11.7197L4.21967 8.71967C4.51256 8.42678 4.98744 8.42678 5.28033 8.71967Z"></path>
486
+ </symbol>
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
+ <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 {
490
+ --diffs-editor-selection-bg: ${a??`var(--diffs-line-bg)`};
491
+ --diffs-editor-line-highlight-bg: ${o??`var(--diffs-line-bg)`};
492
+ --diffs-editor-match-bg: ${c??`initial`};
493
+ --diffs-editor-match-highlight-bg: ${l??`initial`};
494
+ --diffs-editor-bracket-match-bg: ${u??`initial`};
495
+ --diffs-editor-bracket-match-border: ${d??`initial`};
496
+ --diffs-editor-cursor-fg: ${s??`initial`};
497
+ --diffs-editor-hint-fg: ${f??`initial`};
498
+ --diffs-editor-info-fg: ${p??`initial`};
499
+ --diffs-editor-warning-fg: ${m??`initial`};
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:`
502
+ [data-annotation-slot] {
503
+ user-select: none;
504
+ -webkit-user-select: none;
505
+ }
506
+ `}),this.#C=U(`style`,{dataset:`editorCss`,textContent:zn}),this.#w=U(`style`,{dataset:`editorThemeCss`}),this.#T=ca(),this.#k=U(`div`,{dataset:`editorOverlay`}),this.#f=[W(document,`selectionchange`,()=>{let e=this.#E?.shadowRoot;if(this.#H||this.#U||e==null||!this.#W||this.#$!==void 0&&this.#$.length>1&&!this.#q)return;let t=document.getSelection();if(t==null)return;let n=typeof t.getComposedRanges==`function`?t.getComposedRanges({shadowRoots:[e]})?.[0]:Na(e);if(n===void 0||!this.#jt(n))return;let r=Sr(n,0);if(r!==void 0){if(this.#q&&this.#J&&this.#$!==void 0&&this.#$.length>0){let e=this.#$.at(-1);this.#nt([Zr(e,r)]);return}if(this.#q)this.#Y===void 0?this.#Y=r:r=Xr(this.#Y,r);else if(this.#Y!==void 0)r.direction=Xr(this.#Y,r).direction;else if(this.#$!==void 0&&this.#$.length===1){let e=this.#$[0];G(e.start,r.start)===0&&G(e.end,r.end)===0&&(r.direction=e.direction)}this.#Z===void 0?this.#nt([r]):this.#nt([...this.#Z.filter(e=>!Kr(e,r)),r])}},{passive:!0}),W(document,`pointerup`,e=>{e.pointerType===`mouse`&&(this.#p?.forEach(e=>e()),this.#p=void 0,this.#K&&(this.#K=!1,this.#Ve()),this.#H=!1,this.#q=!1,this.#J=!1,this.#Y=void 0,this.#Z=void 0,this.#e.enabledSelectionAction===!0&&this.#$!==void 0&&this.#$.length>0&&!Ur(this.#$.at(-1))&&this.#nt(this.#$))},{passive:!0}),W(document,`keydown`,e=>{e.key===`Shift`&&(this.#Y=this.#$?.at(-1))},{passive:!0}),W(document,`keyup`,e=>{e.key===`Shift`&&(this.#Y=void 0)},{passive:!0})]}#Ee(e){this.#p?.forEach(e=>e()),this.#p=e}#De(e,t){let{onFocus:n,onBlur:r}=this.#e,i=t=>{let n=t.composedPath()[0];return n!==void 0&&(n===e||e.contains(n))};this.#d?.forEach(e=>e()),this.#d=[W(e,`focus`,()=>{this.#W=!0,n?.(),!this.#q&&!this.#H&&this.#$!==void 0&&this.#$.length>0&&this.#He(this.#$.at(-1))},{passive:!0}),W(e,`blur`,()=>{this.#W=!1,r?.()},{passive:!0}),W(e,`pointerdown`,t=>{if(this.#U=!1,t.pointerType===`mouse`){if(this.#qe(t)){this.#$e(!0),this.#$!==void 0&&this.#nt([]);return}if(this.#$e(!1),this.#z?.removePopup(),Mn()&&this.#F!==void 0&&this.#F.length>0){let t=[...e.querySelectorAll(`[data-line-annotation]`)].map(e=>[W(e,`mouseenter`,()=>{this.#H=!0}),W(e,`mouseleave`,()=>{this.#H=!1})]).flat();this.#Ee(t)}if(this.#q=!0,this.#Y=void 0,t.button===0&&Nn(t)&&(this.#Z=this.#$?.map(e=>({...e}))),t.shiftKey){let e=this.#$?.at(-1);if(e!==void 0){let t=e.direction===-1?e.end:e.start;this.#He({start:t,end:t,direction:0})}this.#J=!0}}},{passive:!0}),W(e,`keydown`,e=>{if(e.key===`Escape`){e.preventDefault(),this.#B?.close(),this.#B=void 0,this.#ae=!1,this.#V?.cleanup(),this.#V=void 0,this.#je(`simplifySelection`);return}if(!i(e))return;this.#U=!1;let t=Pn(e),n=this.#I;if(this.#$!==void 0&&this.#$.length>0&&t!==void 0&&n!==void 0){let r={getSoftLineOffsets:this.#xe?e=>this.#At(e):void 0,resolveRenderableLine:this.#_e};e.shiftKey?this.#nt(Ar(n,this.#$,t,r)):this.#nt(wr(n,this.#$,t,r)),this.#Ue(),e.preventDefault();return}if((e.key.length===1?e.key.toLowerCase():e.key)===`v`&&Nn(e)){if(e.repeat&&this.#be){e.preventDefault();return}if(this.#e.clipboard!==void 0){e.preventDefault(),le(this.#Oe);return}}if(this.#B!==void 0){let t=Rn(e);if(t!==void 0){e.preventDefault(),this.#B.navigate(t===`previous`);return}}let r=Ln(e);r!==void 0&&(e.preventDefault(),this.#je(r))}),W(e,`copy`,e=>{i(e)&&(e.preventDefault(),this.#Ze()?e.clipboardData?.setData(`text`,this.#Qe()):this.#pt(e.clipboardData,this.#dt(),this.#ft()))}),W(e,`cut`,e=>{if(i(e))if(e.preventDefault(),this.#Ze())e.clipboardData?.setData(`text`,this.#Qe());else{let t=this.#ft();this.#pt(e.clipboardData,this.#mt(),t)}}),W(e,`paste`,e=>{if(!i(e))return;e.preventDefault();let t=e.clipboardData,n=this.#I;if(t===null||n===void 0)return;let r=t.getData(`text`),a=this.#$?.length??0;if(a>1){let e=t.getData(Ra);if(e!==void 0)try{let t=JSON.parse(e);Array.isArray(t)&&t.length===a&&(r=t)}catch{}}this.#gt(Array.isArray(r)?r.map(e=>n.normalizeEol(e)):n.normalizeEol(r),void 0,!0,`document`)}),W(e,`beforeinput`,e=>{i(e)&&e.inputType!==`insertCompositionText`&&(e.preventDefault(),this.#Be(e.inputType,e.data))}),W(e,`drop`,e=>{i(e)&&e.preventDefault()}),W(e,`compositionstart`,e=>{i(e)&&(this.#G=!0,this.#H=!0)},{passive:!0}),W(e,`compositionend`,e=>{if(!i(e))return;this.#H=!1;let t=this.#G;this.#G=!1,(e.data!==``||!t)&&this.#Be(`insertText`,e.data)},{passive:!0})];let a=this.#E?.shadowRoot?.querySelector(`[data-deletions]`);if(a!=null&&this.#d.push(W(a,`pointerdown`,e=>{let t=e.composedPath()[0],n=t instanceof HTMLElement?t.closest(`[data-column-number]`):null;n instanceof HTMLElement&&this.#Xe(n,a,e.pointerType===`mouse`)||(this.#$e(!0),this.#$!==void 0&&this.#nt([]))},{passive:!0})),t!==void 0){let e=(e,t=!1)=>{let n=e;return n?.dataset.lineNumberContent===void 0?t&&n?.tagName===`SPAN`&&(n=n.closest(`[data-line]`)):n=n.parentElement??void 0,n},n=e=>{if(e===void 0)return;let t=e.dataset.lineType,n=Yn(e)??Yn(e,`columnNumber`);if(!(n===void 0||t===void 0||!Gr(t)))return n-1};this.#d.push(W(t,`pointerdown`,t=>{if(this.#N?.options.enableLineSelection===!0)return;let r=e(t.composedPath()[0]);if(r?.dataset.lineType===`change-deletion`){let e=r.closest(`[data-code]`);e!=null&&this.#Xe(r,e,t.pointerType===`mouse`);return}if(t.pointerType!==`mouse`)return;let i=this.#I,a=n(r);if(a===void 0||i===void 0)return;this.#z?.removePopup();let o=this.#Ke(a,a,i);this.#K=!0,this.#Y=o,this.#nt([o]),this.#He(o),this.#Ve(),this.#Ee([W(document,`mousemove`,t=>{if(!this.#K)return;let r=this.#I,i=n(e(t.composedPath()[0],!0));if(i===void 0||r===void 0)return;let a=this.#Y?.start.line??i,o=this.#Ke(a,i,r);this.#Y??=o,this.#nt([o]),this.#Ve(o.direction===-1?o.start:o.end)},{passive:!0})])},{passive:!0}))}this.#z?.listenHover(e),this.#M?.disconnect(),this.#M=new ResizeObserver(this.#Le),this.#M.observe(e),this.#M.observe(e.parentElement),this.#ke(e)}#Oe=async()=>{let e=this.#e.clipboard;if(e!==void 0){let t=await e.readText(),n=this.#$?.length??0;if(n>1){let r=await e.readText(Ra);try{let e=JSON.parse(r);Array.isArray(e)&&e.length===n&&(t=e)}catch{}}let r=this.#I;r!==void 0&&this.#gt(Array.isArray(t)?t.map(e=>r.normalizeEol(e)):r.normalizeEol(t),void 0,!0,`document`)}};#ke(e){this.#be&&this.#ye===`split`&&this.#xe&&(this.#h={top:e.offsetTop,left:e.offsetLeft-this.#Et()},this.#e.__debug===!0&&console.log(`[diffs/editor] content offset:`,this.#h))}get#Ae(){if(this.#be&&this.#ye===`split`&&this.#xe)return this.#h}#je(e){let t=this.#I;if(t!==void 0)switch(e){case`openSearchPanel`:this.#lt(`find`);break;case`openSearchReplacePanel`:this.#lt(`replace`);break;case`findNextMatch`:{let e=this.#$;if(e===void 0)break;if(e.some(Ur)){let n=e.map(e=>Ur(e)?hi(t,e):e);this.#nt(n),this.focus()}else{let n=ni(t,e);if(n!==void 0){this.#nt(n);let e=n.at(-1);e!==void 0&&this.#ve(Wr(e).line),this.#Ue()}}break}case`moveLineUp`:case`moveLineDown`:this.#Ie(e===`moveLineUp`?-1:1);break;case`copyLineUp`:case`copyLineDown`:this.#Pe(e===`copyLineUp`?-1:1);break;case`simplifySelection`:{let e=this.#$,t=e?.at(-1);if(e===void 0||t===void 0)break;if(e.length>1)this.#nt([t]),this.#Ve(Wr(t));else if(!Ur(t)){let e=Wr(t);this.#nt([{start:e,end:e,direction:0}]),this.#Ve(e)}break}case`insertBlankLine`:this.#Fe();break;case`deleteHardLineForward`:this.#bt();break;case`toggleComment`:case`toggleBlockComment`:{let n=this.#$;if(n===void 0)break;let{lineComment:r,blockComment:i}=Un(t.languageId,this.#e.languageCommentConfig);if(e===`toggleComment`&&r!==null){this.#Ne(Wn(t,n,r));break}let a=e===`toggleComment`,o=Jn(t,n,i,a);o!==void 0&&this.#Ne(o.edits,a?void 0:e=>o.nextSelectionOffsets.map(([t,n,r])=>({start:e.positionAt(t),end:e.positionAt(n),direction:r})));break}case`indent`:case`outdent`:case`indentLess`:case`indentMore`:if(this.#$!==void 0){let n=[],r=[],i=new Set,a=[];for(let o of this.#$){let s=o.start.line,c=e===`outdent`||e===`indentLess`,l=e===`indentLess`||e===`indentMore`;if(s!==o.end.line||c||l){let e=Cr(t,o,this.#t.tabSize,c);for(let t of e[0]){let e=t.range.start.line;i.has(e)||(i.add(e),n.push(t))}r.push(e[1])}else{let e=t.charAt({line:s,character:0})===` `?` `:` `.repeat(this.#t.tabSize);n.push({range:o,newText:e}),a.push({line:s,startCharacter:o.start.character,addedLength:e.length-(o.end.character-o.start.character),selectionIndex:r.length});let i={line:o.start.line,character:o.start.character+e.length};r.push({start:i,end:i,direction:0})}}for(let e of a){let t=0;for(let n of a)n.line===e.line&&n.startCharacter<e.startCharacter&&(t+=n.addedLength);if(t!==0){let n=r[e.selectionIndex],i={line:e.line,character:n.start.character+t};r[e.selectionIndex]={start:i,end:i,direction:0}}}let o=t.applyEdits(n,!0,this.#$,r);o!==void 0&&this.#St(o,r)}break;case`selectAll`:{let e=ri(t);this.#nt([e]),this.focus();let n=this.#wt();n!==void 0&&(this.#U=!0,this.#He({start:{line:n.first,character:0},end:{line:n.last,character:t.getLineLength(n.last)},direction:1}));break}case`moveCursorToDocStart`:case`moveCursorToDocEnd`:{let n=ii(t,e===`moveCursorToDocEnd`,this.#be);this.#nt([n]),this.#ve(Wr(n).line),this.#Ue()}break;case`expandSelectionDocStart`:case`expandSelectionDocEnd`:{let n=e===`expandSelectionDocEnd`,r=this.#$;if(r!==void 0){let e=ii(t,n,this.#be);this.#nt(Qr(r,e)),this.#ve(Wr(e).line),this.#Ue()}}break;case`undo`:case`redo`:this.#Me(e);break}}#Me(e){let t=this.#I;if(t===void 0||e===`undo`&&!t.canUndo||e===`redo`&&!t.canRedo)return;let n=this.#$,r=n?.map(e=>[t.offsetAt(e.start),t.offsetAt(e.end)]),i=e===`undo`?t.undo():t.redo();if(i===void 0)return;let[a,o,s,c]=i,l=o??(n!==void 0&&r!==void 0&&c!==void 0?Yr(t,n,r,c):void 0);this.#St(a,l,s)}#Ne(e,t){let n=this.#I,r=this.#$;if(n===void 0||r===void 0)return;let i=t===void 0,a=i?r.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]):void 0,o=i?e.map(e=>{let t=n.offsetAt(e.range.start),r=n.offsetAt(e.range.end);return{start:Math.min(t,r),end:Math.max(t,r),text:e.newText}}).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n}):void 0,s=n.applyEdits(e,!0,r,void 0,!0);if(s===void 0)return;let c=i?Yr(n,r,a,o):t(n);n.setLastUndoSelectionsAfter(c),this.#St(s,c,this.#Ct(s))}#Pe(e){let t=this.#I,n=this.#$;if(t===void 0||n===void 0)return;let r=ei(n);if(r.length===0)return;let i=[],a=0,o=[];for(let n of r){i.push(a);let r=n.endLine-n.startLine+1;a+=r;let s=t.getText({start:{line:n.startLine,character:0},end:{line:n.endLine,character:t.getLineLength(n.endLine)}});if(e>0){let e={line:n.startLine,character:0};o.push({range:{start:e,end:e},newText:s+t.eol})}else if(n.endLine<t.lineCount-1){let e={line:n.endLine+1,character:0};o.push({range:{start:e,end:e},newText:s+t.eol})}else{let e={line:n.endLine,character:t.getLineLength(n.endLine)};o.push({range:{start:e,end:e},newText:t.eol+s})}}let s=n.map(t=>{let n=t.start.line,a=0,o=r.length-1;for(;a<=o;){let e=a+o>>>1,t=r[e];if(n<t.startLine)o=e-1;else if(n>t.endLine)a=e+1;else{a=e;break}}let s=Math.max(0,a<=o?a:o),c=r[s],l=i[s]+(e>0?c.endLine-c.startLine+1:0);return{start:{...t.start,line:t.start.line+l},end:{...t.end,line:t.end.line+l},direction:t.direction}});this.#Ne(o,()=>s)}#Fe(){let e=this.#I,t=this.#$;if(e===void 0||t===void 0)return;let n=t.map(e=>Wr(e).line),r=Array.from(new Set(n)).sort((e,t)=>e-t),i=new Map,a=new Map,o=[];for(let t=0;t<r.length;t++){let n=r[t],s=e.getLineText(n),c=/^\s*/.exec(s)?.[0]??``;i.set(n,t),a.set(n,c);let l={line:n,character:e.getLineLength(n)};o.push({range:{start:l,end:l},newText:e.eol+c})}let s=t.map((e,t)=>{let r=n[t],o={line:r+1+i.get(r),character:a.get(r).length};return{start:o,end:o,direction:0}});this.#Ne(o,()=>s)}#Ie(e){let t=this.#I,n=this.#$;if(t===void 0||n===void 0)return;let r=ei(n);if(r.length===0||e<0&&r[0].startLine===0||e>0&&r.at(-1).endLine>=t.lineCount-1)return;let i=t.lineCount,a=e=>e<i-1?{line:e+1,character:0}:{line:e,character:t.getLineLength(e)},o=(e,n)=>{let r=e.map(e=>t.getLineText(e)).join(t.eol);return n?r+t.eol:r},s=[];if(e<0)for(let e of r){let t=e.startLine-1,n=[];for(let t=e.startLine;t<=e.endLine;t++)n.push(t);s.push({range:{start:{line:t,character:0},end:a(e.endLine)},newText:o([...n,t],e.endLine<i-1)})}else for(let e=r.length-1;e>=0;e--){let t=r[e],n=t.endLine+1,c=[];for(let e=t.startLine;e<=t.endLine;e++)c.push(e);s.push({range:{start:{line:t.startLine,character:0},end:a(n)},newText:o([n,...c],n<i-1)})}let c=r.at(-1),l=e>0&&c.endLine===i-2?t.getLineLength(c.endLine):t.getLineLength(i-1),u=n.map(n=>ti(n,e,i,e=>e===i-1?l:t.getLineLength(e))),d=t.applyEdits(s,!0,n,u,!0);d!==void 0&&this.#St(d,u)}#Le=()=>{let e=this.#F?.length??0,t=this.#g,n=this.#_;this.#g=void 0,this.#_=void 0;let r=this.#Et()!==t,i=this.#Dt()!==n;!r&&!i||(this.#b.clear(),this.#x=void 0,this.#t.clearTextWidthCache(),i&&(this.#xe||e>0)&&(this.#v.clear(),this.#y.clear()),(this.#$!==void 0||this.#ee!==void 0||this.#z!==void 0)&&(this.#nt(this.#$??[]),this.#$!==void 0&&this.focus()),this.#z?.removePopup(),this.#ke(this.#O))};#Re(){if(this.#oe)return;let e=document.fonts;e!==void 0&&(this.#oe=!0,e.ready.then(()=>{this.#O===void 0||!this.#t.remeasureCharacterWidth()||(this.#g=void 0,this.#_=void 0,this.#Ce(),(this.#$!==void 0||this.#ee!==void 0||this.#z!==void 0)&&this.#nt(this.#$??[]),this.#z?.removePopup())}))}#ze(e,t,n=this.#L,r){let i=this.#n,a=this.#N,o=this.#I,s=this.#D,c=this.#O;if(i===void 0||a===void 0||o===void 0||c===void 0)return;i.stopBackgroundTokenize();let l=performance.now(),u=i.tokenize(e,n),d=performance.now();if(u.size>0){let e=c.children,t=new Set;for(let e of u.keys())this.#ge(e)&&t.add(e);for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0){let e=Yn(r),n=r.dataset.lineType;if(e===void 0||n===`change-deletion`)continue;let i=e-1;if(t.has(i)){let e=u.get(i);if(r.replaceChildren(...ja(e)),t.delete(i),t.size===0)break}}}if(t.size>0){let n=0;for(let t=e.length-1;t>=0;t--){let r=e[t],i=Yn(r);if(i!==void 0&&r.dataset.lineType!==`change-deletion`){n=i;break}}for(let e of t){if(e<n)continue;let t=u.get(e),r=String(e+1);U(`div`,{dataset:{line:r,lineType:`context`,lineIndex:e.toString()},children:ja(t)},c),s!==void 0&&U(`div`,{dataset:{lineType:`context`,columnNumber:r,lineIndex:e.toString()},children:[U(`span`,{dataset:{lineNumberContent:``},textContent:r})]},s)}}}if(e.lineDelta<0)for(let t of[c.children,s?.children??[]])for(let n=t.length-1;n>=0;n--){let r=t[n],i=Yn(r)??Yn(r,`columnNumber`),a=r.dataset.lineType;if(!(i===void 0||a===`change-deletion`)){if(i-1<e.lineCount)break;r.remove()}}let f=e.lineDelta!==0;if(f){let e=c.children.length;for(let t of c.children){let{bufferSize:n}=t.dataset;n!==void 0&&(e+=parseInt(n)-1)}c.style.gridRow=`span `+e,s!==void 0&&(s.style.gridRow=`span `+e)}a.updateRenderCache(u,i.themeType,!f,f),a.file!==void 0&&(a.file.contents=o.getText()),f&&a.applyDocumentChange(o,t,r),this.#be&&(this.#ye===`unified`||f)&&this.#Ce(),t!==void 0&&(this.#F=t,dr(t,c,s)),this.#e.__debug===!0&&console.log(`[diffs/editor] re-render in: ${$n(performance.now()-d)}ms,`,`tokenize in: ${$n(d-l)}ms (${u.size} dirty lines)`)}#Be(e,t){switch(e){case`insertText`:{let e=t??``,n=this.#I,r=this.#$,i=n!==void 0&&r!==void 0?Ir(n,r,e,this.#e.autoSurround):void 0;this.#gt(i??e);break}case`insertCompositionText`:break;case`insertLineBreak`:case`insertParagraph`:this.#gt(this.#I?.eol??`
507
+ `);break;case`deleteContentBackward`:this.#_t();break;case`deleteContentForward`:this.#_t(!0);break;case`deleteSoftLineBackward`:case`deleteHardLineBackward`:this.#vt();break;case`deleteWordBackward`:this.#yt();break;case`insertTranspose`:this.#xt();break;default:console.warn(`[diffs] Unknown input type: ${e}`,t);break}}#Ve(e,t=!0){this.#W=!0,e===void 0?this.#O?.focus({preventScroll:t}):(this.#H=!0,this.#He({start:e,end:e,direction:0}),requestAnimationFrame(()=>{this.#O?.focus({preventScroll:t}),requestAnimationFrame(()=>{this.#H=!1})}))}#He(e){let t=window.getSelection();if(t===null)return;let{start:n,end:r,direction:i}=e;G(n,r)>0&&([n,r]=[r,n]);let a=this.#Tt(n.line),o=this.#Tt(r.line);if(a===void 0||o===void 0)return;let[s,c]=mi(a,n.character),[l,u]=mi(o,r.character);i===-1&&([s,c,l,u]=[l,u,s,c]);try{t.setBaseAndExtent(s,Xn(s,c),l,Xn(l,u))}catch(e){console.error(`[diffs/editor] failed to update window selection:`,e)}}#Ue(e=!1,t=`nearest`){let n=this.#$?.at(-1);if(n===void 0)return;let r=this.#j;if(r!==void 0)r.scrollIntoView({block:t,inline:`nearest`}),e||this.#Ve(n.direction===-1?n.end:n.start);else{let t=Wr(n);this.#Ge(t.line,t.character,e)}}#We(){let e=this.#B===void 0?0:48,t=this.#Et()+this.#t.ch;return`${e}px ${this.#t.ch}px 0 ${t}px`}#Ge(e,t=0,n=!1){this.__postponeBgTokenizeToNextFrame();let r=U(`div`,{style:{position:`absolute`,left:`0`,width:`2px`,height:this.#t.lineHeight+`px`,scrollMargin:this.#We()}});if(this.#Tt(e)!==void 0){let[i,a]=this.#kt(e,t),o=this.#Ot(e)+a*this.#t.lineHeight;r.style.top=o+`px`,r.style.left=i+`px`,this.#k?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),n||this.#Ve({line:e,character:t}),this.#te=void 0,this.#ne=void 0,this.#re=!1,this.#ie=!1}else{let i=this.#N?.getLinePosition?.(e+1);if(i!==void 0)r.style.top=i.top+`px`,this.#E?.shadowRoot?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),i.height>0&&this.#ge(e)?(this.#te=e,this.#ne=t,this.#ie=n):(this.#te=void 0,this.#ne=void 0,this.#ie=!1);else{let i=0;if(this.#te===e&&this.#O!==void 0)for(let t=this.#O.childElementCount-1;t>=0;t--){let n=this.#O.children[t],r=n.dataset.lineType,a=Yn(n);if(r!==void 0&&Gr(r)&&a!==void 0){i=(e-(a-1))*this.#t.lineHeight;break}}let a=((this.#F??[]).filter(t=>t.lineNumber<e).length+e)*this.#t.lineHeight+i;r.style.top=a+`px`,this.#E?.shadowRoot?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),this.#te===e&&(i===0||this.#re)||!this.#ge(e)?(this.#te=void 0,this.#ne=void 0,this.#re=!1,this.#ie=!1):(this.#te=e,this.#ne=t,this.#re=i!==0,this.#ie=n)}}r.remove()}#Ke(e,t,n){let r=e=>({line:e,character:0}),i=e=>({line:e,character:n.getLineText(e).length});return t<e?{start:r(t),end:i(e),direction:-1}:{start:r(e),end:i(t),direction:1}}#qe(e){let t=e.composedPath()[0];return t instanceof HTMLElement&&t.closest(`[data-line]`)?.getAttribute(`data-line-type`)===`change-deletion`}#Je(e,t,n){let r=[...n.querySelectorAll(`[data-content] > [data-line]`)],i=r.indexOf(e),a=r.indexOf(t),[o,s]=a<i?[t,e]:[e,t],c=window.getSelection();if(c!==null){let e=document.createRange();e.setStart(o,0),e.setEnd(s,s.childNodes.length),c.removeAllRanges(),c.addRange(e)}this.#$e(!0),this.#nt([]),[...n.querySelectorAll(`[data-gutter] > [data-column-number]`)][a]?.setAttribute(`data-selected-line`,`single`);let l=Math.min(i,a),u=Math.max(i,a);this.#X=l<0?``:r.slice(l,u+1).filter(e=>e.getAttribute(`data-line-type`)===`change-deletion`).map(e=>e.textContent??``).join(`
508
+ `)}#Ye(e,t){let n=e.parentElement;if(n==null||t==null)return;let r=[...n.children].indexOf(e),i=t.children[r];return i instanceof HTMLElement?i:void 0}#Xe(e,t,n){let r=t.querySelector(`[data-content]`),i=this.#Ye(e,r);return i===void 0?!1:(this.#Je(i,i,t),n&&this.#Ee([W(document,`mousemove`,e=>{let n=e.composedPath()[0],a=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(a instanceof HTMLElement&&t.contains(a)){let e=this.#Ye(a,r);e!==void 0&&this.#Je(i,e,t)}},{passive:!0})]),!0)}#Ze(){return this.#E?.shadowRoot?.querySelector(`pre`)?.hasAttribute(`data-deleted-text-selection`)??!1}#Qe(){return this.#X===``?window.getSelection()?.toString()??``:this.#X}#$e(e){let t=this.#E?.shadowRoot?.querySelector(`pre`);if(t!=null)if(e){t.setAttribute(`data-deleted-text-selection`,``);for(let e of t.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);this.#X=``}else t.removeAttribute(`data-deleted-text-selection`),this.#X=``}#et(e,t=!1){if(this.#N?.options.controlledSelection!==!0)try{this.#N?.setSelectedLines(e,{notify:!1,activeLineSide:`additions`,lineNumberOnly:t})}catch{}}#tt(){this.#se===void 0&&(this.#se=requestAnimationFrame(()=>{this.#se=void 0,(this.#$!==void 0||this.#ee!==void 0||this.#z!==void 0)&&this.#nt(this.#$??[])}))}#nt(e){if(this.__postponeBgTokenizeToNextFrame(),this.#j=void 0,this.#et(null),e.length===0&&this.#ee===void 0&&this.#z===void 0){this.#$=void 0,this.#A?.forEach(e=>e.remove()),this.#A?.clear(),this.#V?.cleanup(),this.#V=void 0;return}let t=document.createDocumentFragment(),n={fragment:t,elements:new Map};if(e.length>0){let t=$r(e),r=t.at(-1);this.#$=t;let i=t.some(e=>!Ur(e)),a=Wr(r).line+1;this.#et({start:a,end:a},i);for(let e of t)Ur(e)||this.#rt(n,`selection`,e),this.#st(n,e,e===r);let o=this.#e.matchBrackets!==!1&&this.#I!==void 0&&this.#n!==void 0&&Ur(r)?Yi(this.#I,this.#n,r.start):void 0;if(o!==void 0)for(let e of o)this.#rt(n,`bracketMatch`,e)}let r=this.#I;if(this.#ee!==void 0&&r!==void 0){let e=this.#$?.at(-1),t=e===void 0?-1:r.offsetAt(e.start),i=e===void 0?-1:r.offsetAt(e.end);for(let[e,a]of this.#ee){let o={start:r.positionAt(e),end:r.positionAt(a)},s=t===e&&i===a;this.#rt(n,`match`,o,s?`focus`:void 0)}}if(this.#z!==void 0&&r!==void 0)for(let e of this.#z.markers)this.#rt(n,`marker`,e,Wi(e.severity));this.#k?.appendChild(t),this.#A?.forEach(e=>e.remove()),this.#A?.clear(),this.#A=n.elements,this.#ct()}#rt(e,t,n,r){if(this.#I===void 0)return;let{start:i,end:a}=n;for(let n=i.line;n<=a.line;n++){if(!this.#Mt(n))continue;let o=n===a.line,s=n===i.line?i.character:0,c=o?a.character:this.#I.getLineLength(n);if(this.#xe){let i=this.#Dt(),a=this.#I.getLineText(n);if(2*this.#t.ch+this.#t.measureTextWidth(a)>i){this.#it(e,n,a,s,c,o,t,r);continue}}let l=0,u=0,d=0;l=s===0?this.#Et()+this.#t.ch+(this.#Ae?.left??0):this.#kt(n,s)[0],!o&&t===`selection`&&(d=this.#t.ch),u=s===c?d:this.#kt(n,c)[0]-l+d,this.#ot(e,t,n,0,l,u,r)}}#it(e,t,n,r,i,a,o,s){let c=this.#At(t),l=c.length-1,u=this.#Et()+this.#t.ch+(this.#Ae?.left??0);for(let d=0;d<l;d++){let f=c[d],p=c[d+1],m=Math.max(r,f),h=Math.min(i,p);if(m>h)continue;let g=this.#at(n,f,m),_=u+g,v=0;!a&&d===l-1&&o===`selection`&&(v=this.#t.ch);let y=m===h?v:this.#at(n,f,h)-g+v;this.#ot(e,o,t,d,_,y,s)}}#at(e,t,n){if(n<=t)return 0;let r=e.slice(t,n),i=Da(r,this.#t.tabSize);return i===-1?this.#t.measureTextWidth(r):i*this.#t.ch}#ot(e,t,n,r,i,a,o){if(a===0)return;let{ch:s,lineHeight:c}=this.#t,l=this.#Ot(n)+r*c,u=`${t}-${n}/${r}-${i}-${a} ${o??``}`,d=this.#A,f=(this.#e.roundedSelection??!0)&&t===`selection`,p=(n,r,i,a)=>{let o=this.#Ot(n)+r*c,l=this.#Tt(n),u=`initial`;this.#be&&l?.dataset.lineType===`change-addition`&&(u=getComputedStyle(l).getPropertyValue(`--diffs-line-bg`));let f=`width:${s}px;transform:translateX(${i}px) translateY(${o}px);--diffs-selection-corner-bg:${u}`,p={selectionCorner:``,[a]:``},m=`${t}-block-${n}/${r}-${i}-1ch`,h=m+`-`+a;if(a===`rbl`){let t=m+`-rtl`,n=e.elements.get(t);n!==void 0&&(n.remove(),e.elements.delete(t),h+=`-rtl`,p.rtl=``)}let g=e.elements.get(h);g===void 0&&(d?.has(h)===!0?(g=d.get(h),g.style.cssText=f,d.delete(h)):g=U(`div`,{dataset:`selectionRange`,style:{cssText:f},children:[U(`div`,{dataset:p})]},e.fragment),e.elements.set(h,g))},m=t=>{let o=i+a,c=t.dataset,l=e.previousSelectionRange;if((l===void 0||l.line!==n||l.wrapLine!==r)&&(e.previousSelectionRange={element:t,line:n,wrapLine:r,left:i,width:a}),l===void 0||o<=l.left)[`rtl`,`rtr`,`rbl`,`rbr`].forEach(e=>{c[e]=``});else{let e=l.line,t=l.wrapLine,a=l.left,u=l.element.dataset,d=a+l.width;a>i&&p(e,t,a-s,`rbr`),delete u.rbl,delete c.rtl,delete c.rtr,o>=d&&delete u.rbr,o>d&&(p(e,t,d,`rbl`),c.rtr=``),o<d&&p(n,r,o,`rtl`),i<a&&(c.rtl=``),c.rbl=``,c.rbr=``}},h=e.elements.get(u);if(h!==void 0){f&&m(h);return}d?.has(u)===!0?(h=d.get(u),d.delete(u)):h=U(`div`,{dataset:o?[t+`Range`,o]:t+`Range`},e.fragment),h.style.width=`${a}px`,h.style.transform=`translateX(${i}px) translateY(${l}px)`,f&&m(h),e.elements.set(u,h)}#st(e,t,n){let{line:r,character:i}=Wr(t);if(!this.#Mt(r))return;let[a,o]=this.#kt(r,i),s=`caret-`+r+`/`+o+`:`+i;if(e.elements.has(s))return;let c=U(`div`,{dataset:`caret`,style:{transform:`translateX(${a-1}px) translateY(${this.#Ot(r)+o*this.#t.lineHeight}px)`}},e.fragment);e.elements.set(s,c),n&&(c.style.scrollMargin=this.#We(),this.#j=c)}#ct(){let e=this.#$?.at(-1),t=this.#k,n=this.#I,r=this.#e.renderSelectionAction,i=()=>{this.#V?.cleanup(),this.#V=void 0};if(this.#e.enabledSelectionAction!==!0||r===void 0||e===void 0||Ur(e)||this.#q||t===void 0||n===void 0){i();return}let a=Wr(e);if(!this.#Mt(a.line)){i();return}if(this.#V===void 0){let a=()=>this.#$?.at(-1)??e,o=r({textDocument:n,get selection(){return a()},applyEdits:e=>this.applyEdits(e),getSelectionText:()=>this.#I?.getText(a())??``,replaceSelectionText:e=>{this.#gt(e,[a()])},close:()=>{i(),this.#Ue()}});this.#V=new da(o,t,()=>this.#ct()),this.#Se().resetPlacement(La)}let o=this.#t.lineHeight,s=e.direction===-1,c={placeAbove:s,anchor:a},l=s?{placeAbove:!1,anchor:e.end}:{placeAbove:!0,anchor:e.start},u=this.#V.height,d=e=>{let[t,n]=this.#kt(e.anchor.line,e.anchor.character),r=this.#Ot(e.anchor.line)+n*o,i=e.placeAbove?r:r+o,a=e.placeAbove?i-u:i;return{top:a,bottom:a+u,left:t,anchorTop:i}},f=d(c),p=d(l),m=n.lineCount,h=s?a.line<3:a.line>=m-3,g=this.#Mt(l.anchor.line),_=this.#Se(),v=_.getPlacementBounds(),y=g&&_.choosePlacement({preferred:f,fallback:p,viewport:v,popoverHeight:u,atDocumentEdge:h,placementKey:La})===`fallback`;g||_.setPlacement(`preferred`,La);let{placeAbove:b}=y?l:c,{left:x,anchorTop:S}=y?p:f;this.#V.reposition(x,S,this.#Et(),b,v)}#lt(e){if(this.#B!==void 0){this.#B.setMode(e);return}this.#ut(e)}#ut(e){this.#B?.cleanup();let t=this.#I,n=this.#E?.shadowRoot?.querySelector(`pre`),r=this.#$;if(t===void 0||n==null)return;let i=``,a;if(r!==void 0&&r.length>0){let e=r.at(-1);if(Ur(e)){e=hi(t,e),this.#nt([...r.slice(0,-1),e]);let n=t.getText(e);n!==``&&!n.includes(`
509
+ `)&&(i=n,a=[t.offsetAt(e.start),t.offsetAt(e.end)])}}let o=([e,n],r)=>{let i=qr(t,e,n);this.#nt([i]),this.#ve(Wr(i).line),this.#Ue(!0),this.#ae=r},s=new ua({textDocument:t,containerElement:n,defaultQuery:i,mode:e,initialMatch:a,scrollToMatch:o,applyReplace:e=>{if(e.length===0)return;let n=t.applyEdits(e.map(e=>({range:{start:t.positionAt(e.start),end:t.positionAt(e.end)},newText:e.text})),!0,this.#$);n!==void 0&&this.#St(n,void 0,this.#Ct(n),{skipSearchRefresh:!0})},onUpdate:(e,n)=>{if(e.length===0){this.#ee=void 0,this.#nt(this.#$??[]);return}if(this.#ee=e,n?.syncSelection===!1){this.#nt(this.#$??[]);let n=this.#$?.at(-1);if(n!==void 0){let r=t.offsetAt(n.start),i=t.offsetAt(n.end);for(let t of e)if(t[0]===r&&t[1]===i)return t}return}let r=this.#$?.at(-1),i=0,a;r!==void 0&&(i=t.offsetAt(r.start));for(let t of e)if(t[0]>=i){a=t;break}return a===void 0?this.#nt(this.#$??[]):o(a,!0),a},onClose:()=>{this.#B=void 0,this.#ae=!1,this.#ee=void 0,this.#nt(this.#$??[])}});this.#B=s,this.#ae=!1}#dt(){let e=this.#I,t=this.#$;return e===void 0||t===void 0?``:ci(e,t)}#ft(){let e=this.#I,t=this.#$;return e===void 0||t===void 0?[]:si(e,t)}#pt(e,t,n){e!==null&&(e.setData(`text`,t),n.length>1&&e.setData(Ra,JSON.stringify(n)))}#mt(){let e=this.#I,t=this.#$;if(e===void 0||t===void 0||t.length===0)return``;if(t.some(e=>Ur(e))){let n=pi(e,t);return this.#ht(n.edits,n.nextSelectionOffsets),n.text}let n=ci(e,t);return this.#gt(``,void 0,!0),n}#ht(e,t){let n=this.#I,r=this.#$;if(n===void 0||r===void 0||e.length===0)return;let i=n.applyResolvedEdits(e,!0,r,void 0,!0);if(i===void 0)return;let a=t.map(e=>{let t=n.positionAt(e);return{start:t,end:t,direction:0}});n.setLastUndoSelectionsAfter(a),this.#St(i,a,this.#Ct(i))}#gt(e,t=this.#$,n=!1,r=`selection`){if(t===void 0)return;let i=this.#I,a=t.at(-1);if(i===void 0||a===void 0)return;let{nextSelections:o,change:s}=Array.isArray(e)&&e.length===t.length?Pr(i,t,e,this.#F,n,r):jr(i,t,{start:i.offsetAt(a.start),end:i.offsetAt(a.end),text:Array.isArray(e)?e.join(i.eol):e},this.#F,void 0,n);s!==void 0&&this.#St(s,o,this.#Ct(s))}#_t(e=!1){let t=this.#$,n=this.#I;if(t===void 0||n===void 0)return;let{nextSelections:r,change:i}=Hr(n,t,e,this.#F,this.#t.tabSize);i!==void 0&&this.#St(i,r,this.#Ct(i))}#vt(){let e=this.#$,t=this.#I;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=zr(t,e,this.#xe?(e,t)=>{let n=this.#At(e);for(let e=0;e+1<n.length;e++){let r=n[e],i=n[e+1];if(t>=r&&t<=i)return r}return 0}:void 0,this.#F);r!==void 0&&this.#St(r,n,this.#Ct(r))}#yt(){let e=this.#$,t=this.#I;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Br(t,e,this.#F);r!==void 0&&this.#St(r,n,this.#Ct(r))}#bt(){let e=this.#$,t=this.#I;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Rr(t,e,this.#F);r!==void 0&&this.#St(r,n,this.#Ct(r))}#xt(){let e=this.#$,t=this.#I;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Lr(t,e,this.#F);r!==void 0&&this.#St(r,n,this.#Ct(r))}#St(e,t,n,r){let i=this.getFile(),a=this.#e.onChange;if(i!==void 0&&a!==void 0&&a(i,n??this.#F),e.lineDelta!==0||this.#xe)for(let t of this.#v.keys())t>=e.startLine&&this.#v.delete(t);if(this.#xe)for(let t of this.#y.keys())t>=e.startLine&&this.#y.delete(t);this.#x=void 0;let o=this.#L,s;if(o!==void 0&&t!==void 0&&t.length>0){let n=t.at(-1),r=o.startingLine+o.totalLines;if(n.end.line>=r){let t=n.end.line-o.startingLine+1,i=this.#R===void 0||this.#R===1/0?1/0:this.#R*Ia;e.startLine<=r&&t<=i&&this.#ge(n.end.line)?(n.end.line>r&&(s=!0),o={...o,totalLines:t},this.#L=o):s=!0}}if(this.#ze(e,n,o,s),r?.skipSearchRefresh!==!0&&this.#B!==void 0&&this.#ee!==void 0&&this.#B.updateMatches({syncSelection:!1}),t!==void 0&&(this.#nt(t),r?.skipFocus!==!0)){let e=t.at(-1);if(e!==void 0&&this.#ve(Wr(e).line),this.#j!==void 0)requestAnimationFrame(()=>{this.#j?.scrollIntoView({block:`nearest`,inline:`nearest`})});else if(t.length>0){let e=Wr(t.at(-1));this.#Ge(e.line,e.character)}this.focus({preventScroll:!0})}}#Ct(e){if(this.#F!==void 0){let t=ar(e,this.#F);if(t!==void 0)return this.#I?.setLastUndoLineAnnotations(this.#F,t),t}}#wt(){let e=this.#O;if(e===void 0)return;let t,n;for(let r of e.children){let e=r,i=e.dataset.lineType,a=Yn(e);if(a===void 0||i===void 0||!Gr(i))continue;let o=a-1;(t===void 0||o<t)&&(t=o),(n===void 0||o>n)&&(n=o)}return t===void 0||n===void 0?void 0:{first:t,last:n}}#Tt(e){let t=this.#b.get(e);if(t!==void 0)return t??void 0;let n=this.#O;if(n!==void 0){if(this.#L!==void 0){let{startingLine:r}=this.#L,{children:i}=n;for(let n=e-r;n<=i.length;n++){let r=i[n];if(r===void 0)break;let a=Yn(r),o=r.dataset.lineType;if(a!==void 0&&a===e+1&&o!==void 0&&Gr(o)){t=r;break}}}return t??=n.querySelector(`[data-line="${e+1}"]`+(this.#ye===`unified`?`:not([data-line-type="change-deletion"])`:``)),t!==void 0&&this.#b.set(e,t),t??void 0}}#Et(){if(this.#D===void 0)return 0;if(this.#g===void 0){let e=this.#O?.parentElement?.style.getPropertyValue(`--diffs-column-number-width`);e!==void 0&&e.length>2&&e.endsWith(`px`)?this.#g=parseInt(e.slice(0,-2),10):this.#g=this.#D.offsetWidth}return this.#g}#Dt(){if(this.#O===void 0)return 0;if(this.#_===void 0){let e=this.#O.parentElement?.style.getPropertyValue(`--diffs-column-content-width`);e!==void 0&&e.length>2&&e.endsWith(`px`)?this.#_=parseFloat(e.slice(0,-2)):this.#_=this.#O.offsetWidth}return this.#_}#Ot(e){let t=this.#v.get(e);if(t!==void 0)return t;let n=this.#Tt(e);if(n===void 0)return-1;let r=n.offsetTop+this.#t.paddingTop;return r+=this.#Ae?.top??0,this.#v.set(e,r),r}#kt(e,t){if(this.#x!==void 0&&this.#x[0]===e&&this.#x[1]===t)return[this.#x[2],this.#x[3]];let n=this.#I?.getLineText(e),r=this.#Et()+this.#t.ch;if(n===void 0||n.length===0||t<=0)return[r+(this.#Ae?.left??0),0];let i=Ta(n,Math.min(t,n.length)),a=n.slice(0,i),o=Da(a,this.#t.tabSize),s=0,c=0;if(s=o===-1?r+this.#t.measureTextWidth(a):r+o*this.#t.ch,this.#xe){let t=this.#Dt();if(2*this.#t.ch+this.#t.measureTextWidth(n)>t){let t=this.#At(e);for(let e=0;e+1<t.length;e++){let a=t[e];if(i<=t[e+1]){c=e;let t=n.slice(a,i),o=Da(t,this.#t.tabSize);s=o===-1?r+this.#t.measureTextWidth(t):r+o*this.#t.ch;break}}}s+=this.#Ae?.left??0}return this.#x===void 0?this.#x=[e,t,s,c]:(this.#x[0]=e,this.#x[1]=t,this.#x[2]=s,this.#x[3]=c),[s,c]}#At(e){let t=this.#y.get(e);if(t!==void 0)return t;let n=this.#I?.getLineText(e);if(n===void 0||n.length===0){let t=new Uint32Array([0]);return this.#y.set(e,t),t}let r=U(`div`,{style:{position:`absolute`,top:`0`,left:`0`,width:`100%`,boxSizing:`border-box`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,font:`inherit`,paddingInline:`1ch`,tabSize:this.#t.tabSize.toString()},textContent:n},this.#O),i=r.firstChild,a=document.createRange(),o=[];try{let t=Ea(n),s=r.getBoundingClientRect().left+this.#t.ch,c=0,l=-1/0;for(let e=0,r=0;e<n.length;){let n=t===void 0?e+1:t[r+1];a.setStart(i,e),a.setEnd(i,n);let{left:u,top:d}=a.getBoundingClientRect();if(d>l){let t=Mn()&&o.length>0&&u-s>this.#t.ch/2;o.push(t?c:e),l=d}c=e,e=n,r++}let u=new Uint32Array(o.length+1);for(let e=0;e<o.length;e++)u[e]=o[e];return u[o.length]=n.length,this.#y.set(e,u),u}finally{r.remove()}}#jt({startContainer:e,endContainer:t}){let n=this.#O;return n===void 0?!1:n.contains(e)&&n.contains(t)}#Mt(e){let t=this.#I?.lineCount??0;return e<0||e>=t?!1:this.#Tt(e)!==void 0}},Ba=`file-tree-container`,Va=`data-file-tree-style`,Ha=`data-file-tree-unsafe-css`,Ua=`data-file-tree-scrollbar-measure`,Wa=`data-file-tree-scrollbar-gutter-measured`,Ga=`--trees-scrollbar-gutter-measured`,Ka=`header`,qa=`context-menu`,Ja=`context-menu-trigger`,Ya=typeof window>`u`?V.useEffect:V.useLayoutEffect;function Xa(e,t,n){let r=e==null?null:(0,H.jsx)(`div`,{slot:Ka,children:e}),i=t!=null&&n!=null?(0,H.jsx)(`div`,{slot:qa,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,H.jsxs)(H.Fragment,{children:[r,i]})}function Za(e,t){return typeof window>`u`&&t!=null?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,H.jsx)(H.Fragment,{children:e})}function Qa(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function $a(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function eo({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),u=(0,V.useRef)(n.getComposition()),d=(0,V.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,V.useCallback)(()=>{s(null)},[]),m=(0,V.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,V.useMemo)(()=>$a(h,e,f,p,m),[h,p,m,f,e]),_=(0,V.useCallback)(e=>{l(e)},[]);(0,V.useEffect)(()=>{f||s(null)},[f]),Ya(()=>{n.setComposition(g)},[g,n]),Ya(()=>{if(c!=null)return r!=null&&Qa(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=Za(Xa(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,H.jsx)(Ba,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}var to={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function no(e,t){if(typeof e==`number`)return{itemHeight:t??to.default.itemHeight,factor:e};let n=to[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var ro=to.default.itemHeight,io=`@layer base, theme, unsafe;
510
+
511
+ @layer base {
512
+ :host {
513
+ /*
514
+ CSS variables use a fallback stack to ensure user and theme colors slot
515
+ in with ease. User colors take precedence over theme colors, which take
516
+ precedence over defaults.
517
+
518
+ Fallback order:
519
+
520
+ 1. --trees-*-override (explicit)
521
+ 2. --trees-theme-* (e.g. Shiki/VS Code tokens)
522
+ 3. defaults
523
+
524
+ Theme variable names mirror Shiki/VS Code theme file JSON tokens.
525
+
526
+ // Available CSS Color Overrides
527
+ --trees-fg-override
528
+ --trees-fg-muted-override
529
+ --trees-bg-override
530
+ --trees-bg-muted-override
531
+ --trees-accent-override
532
+ --trees-border-color-override
533
+
534
+ --trees-focus-ring-color-override
535
+ --trees-focus-ring-width-override
536
+ --trees-focus-ring-offset-override
537
+
538
+ --trees-search-fg-override
539
+ --trees-search-font-weight-override
540
+ --trees-search-bg-override
541
+
542
+ --trees-selected-fg-override
543
+ --trees-selected-bg-override
544
+ --trees-selected-focused-border-color-override
545
+
546
+ // Git Status Color Overrides
547
+ --trees-status-added-override
548
+ --trees-status-ignored-override
549
+ --trees-status-modified-override
550
+ --trees-status-renamed-override
551
+ --trees-status-untracked-override
552
+ --trees-status-deleted-override
553
+ --trees-git-added-color-override
554
+ --trees-git-ignored-color-override
555
+ --trees-git-modified-color-override
556
+ --trees-git-renamed-color-override
557
+ --trees-git-untracked-color-override
558
+ --trees-git-deleted-color-override
559
+
560
+ // Built-in File Icon Color Overrides
561
+ --trees-file-icon-color
562
+ --trees-file-icon-color-astro
563
+ --trees-file-icon-color-babel
564
+ --trees-file-icon-color-bash
565
+ --trees-file-icon-color-biome
566
+ --trees-file-icon-color-bootstrap
567
+ --trees-file-icon-color-browserslist
568
+ --trees-file-icon-color-bun
569
+ --trees-file-icon-color-c
570
+ --trees-file-icon-color-cpp
571
+ --trees-file-icon-color-claude
572
+ --trees-file-icon-color-css
573
+ --trees-file-icon-color-database
574
+ --trees-file-icon-color-default
575
+ --trees-file-icon-color-docker
576
+ --trees-file-icon-color-eslint
577
+ --trees-file-icon-color-git
578
+ --trees-file-icon-color-go
579
+ --trees-file-icon-color-graphql
580
+ --trees-file-icon-color-html
581
+ --trees-file-icon-color-image
582
+ --trees-file-icon-color-javascript
583
+ --trees-file-icon-color-json
584
+ --trees-file-icon-color-markdown
585
+ --trees-file-icon-color-mcp
586
+ --trees-file-icon-color-npm
587
+ --trees-file-icon-color-oxc
588
+ --trees-file-icon-color-postcss
589
+ --trees-file-icon-color-prettier
590
+ --trees-file-icon-color-python
591
+ --trees-file-icon-color-react
592
+ --trees-file-icon-color-ruby
593
+ --trees-file-icon-color-rust
594
+ --trees-file-icon-color-sass
595
+ --trees-file-icon-color-svg
596
+ --trees-file-icon-color-svelte
597
+ --trees-file-icon-color-svgo
598
+ --trees-file-icon-color-swift
599
+ --trees-file-icon-color-table
600
+ --trees-file-icon-color-text
601
+ --trees-file-icon-color-tailwind
602
+ --trees-file-icon-color-terraform
603
+ --trees-file-icon-color-typescript
604
+ --trees-file-icon-color-vite
605
+ --trees-file-icon-color-vscode
606
+ --trees-file-icon-color-vue
607
+ --trees-file-icon-color-wasm
608
+ --trees-file-icon-color-webpack
609
+ --trees-file-icon-color-yml
610
+ --trees-file-icon-color-zig
611
+ --trees-file-icon-color-zip
612
+
613
+ // Density
614
+ //
615
+ // A unitless scale factor for padding, gaps, and indentation. Usually
616
+ // set via \`density\` on useFileTree. Individual overrides take precedence.
617
+ //
618
+ // Compact: 0.8
619
+ // Default: 1
620
+ // Relaxed: 1.2
621
+ //
622
+ --trees-density-override
623
+
624
+ // Available CSS Layout Overrides
625
+ --trees-gap-override
626
+ --trees-border-radius-override
627
+ --trees-font-family-override
628
+ --trees-font-size-override
629
+ --trees-font-weight-regular-override
630
+ --trees-font-weight-semibold-override
631
+ --trees-level-gap-override
632
+ --trees-item-padding-x-override
633
+ --trees-item-margin-x-override
634
+ --trees-item-row-gap-override
635
+ --trees-icon-width-override
636
+ --trees-icon-nudge-override
637
+ --trees-scrollbar-gutter-override
638
+ --trees-padding-inline-override
639
+ */
640
+
641
+ --trees-accent: var(--trees-accent-override, #009fff);
642
+ --trees-fg: var(
643
+ --trees-fg-override,
644
+ var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1))
645
+ );
646
+ --trees-fg-muted: var(
647
+ --trees-fg-muted-override,
648
+ var(--trees-theme-sidebar-header-fg, light-dark(#84848a, #84848a))
649
+ );
650
+ --trees-bg: var(
651
+ --trees-bg-override,
652
+ var(--trees-theme-sidebar-bg, light-dark(#f8f8f8, #141415))
653
+ );
654
+ /* var(--trees-theme-list-hover-bg, light-dark(#dfebff59, #19283c59)) */
655
+ --trees-bg-muted: var(
656
+ --trees-bg-muted-override,
657
+ var(
658
+ --trees-theme-list-hover-bg,
659
+ light-dark(
660
+ color-mix(
661
+ in lab,
662
+ var(--trees-accent) var(--trees-bg-alpha-light, 8%),
663
+ var(--trees-bg)
664
+ ),
665
+ color-mix(
666
+ in lab,
667
+ var(--trees-accent) var(--trees-bg-alpha-dark, 10%),
668
+ var(--trees-bg)
669
+ )
670
+ )
671
+ )
672
+ );
673
+ --trees-input-bg: var(
674
+ --trees-input-bg-override,
675
+ light-dark(#f8f8f8, #070707)
676
+ );
677
+
678
+ --trees-added-light: #16a994;
679
+ --trees-added-dark: #00cab1;
680
+ --trees-ignored-light: #adadb1;
681
+ --trees-ignored-dark: #4a4a4e;
682
+ --trees-modified-light: #1ca1c7;
683
+ --trees-modified-dark: #08c0ef;
684
+ --trees-renamed-light: #d5a910;
685
+ --trees-renamed-dark: #ffd452;
686
+ --trees-untracked-light: #16a994;
687
+ --trees-untracked-dark: #00cab1;
688
+ --trees-deleted-light: #ff2e3f;
689
+ --trees-deleted-dark: #ff6762;
690
+
691
+ --trees-border-color: var(
692
+ --trees-border-color-override,
693
+ var(--trees-theme-sidebar-border, light-dark(#eeeeef, #070707))
694
+ );
695
+ --trees-indent-guide-bg: var(
696
+ --trees-indent-guide-bg-override,
697
+ color-mix(in lab, var(--trees-fg-muted) 25%, transparent)
698
+ );
699
+ --trees-density: var(--trees-density-override, 1);
700
+ --trees-border-radius: var(
701
+ --trees-border-radius-override,
702
+ calc(6px * var(--trees-density))
703
+ );
704
+
705
+ --trees-font-family: var(--trees-font-family-override, system-ui);
706
+ --trees-font-size: var(--trees-font-size-override, 13px);
707
+ --trees-font-weight-regular: var(--trees-font-weight-regular-override, 400);
708
+ --trees-font-weight-semibold: var(
709
+ --trees-font-weight-semibold-override,
710
+ 600
711
+ );
712
+
713
+ --trees-focus-ring-color: var(
714
+ --trees-focus-ring-color-override,
715
+ var(--trees-theme-focus-ring, var(--trees-accent))
716
+ );
717
+ --trees-focus-ring-width: var(--trees-focus-ring-width-override, 1px);
718
+ --trees-focus-ring-offset: var(--trees-focus-ring-offset-override, -1px);
719
+
720
+ --trees-search-fg: var(
721
+ --trees-search-fg-override,
722
+ var(--trees-theme-input-fg, var(--trees-fg))
723
+ );
724
+ --trees-search-font-weight: var(--trees-search-font-weight-override, 600);
725
+ --trees-search-bg: var(
726
+ --trees-search-bg-override,
727
+ var(--trees-theme-input-bg, var(--trees-input-bg))
728
+ );
729
+
730
+ --trees-scrollbar-thumb: var(
731
+ --trees-scrollbar-thumb-override,
732
+ var(
733
+ --trees-theme-scrollbar-thumb,
734
+ color-mix(in lab, var(--trees-fg) 25%, var(--trees-bg))
735
+ )
736
+ );
737
+
738
+ --trees-selected-fg: var(
739
+ --trees-selected-fg-override,
740
+ var(--trees-theme-list-active-selection-fg, var(--trees-fg))
741
+ );
742
+ --trees-selected-bg: var(
743
+ --trees-selected-bg-override,
744
+ var(
745
+ --trees-theme-list-active-selection-bg,
746
+ light-dark(
747
+ color-mix(in lab, var(--trees-accent) 12%, var(--trees-bg)),
748
+ color-mix(in lab, var(--trees-accent) 15%, var(--trees-bg))
749
+ )
750
+ )
751
+ );
752
+ --trees-selected-focused-border-color: var(
753
+ --trees-selected-focused-border-color-override,
754
+ var(--trees-theme-focus-ring, var(--trees-accent))
755
+ );
756
+
757
+ /* Git status (e.g. from Shiki theme gitDecoration.*) */
758
+ --trees-status-added: var(
759
+ --trees-status-added-override,
760
+ var(
761
+ --trees-theme-git-added-fg,
762
+ light-dark(var(--trees-added-light), var(--trees-added-dark))
763
+ )
764
+ );
765
+ --trees-status-ignored: var(
766
+ --trees-status-ignored-override,
767
+ var(
768
+ --trees-theme-git-ignored-fg,
769
+ light-dark(var(--trees-ignored-light), var(--trees-ignored-dark))
770
+ )
771
+ );
772
+ --trees-status-modified: var(
773
+ --trees-status-modified-override,
774
+ var(
775
+ --trees-theme-git-modified-fg,
776
+ light-dark(var(--trees-modified-light), var(--trees-modified-dark))
777
+ )
778
+ );
779
+ --trees-status-renamed: var(
780
+ --trees-status-renamed-override,
781
+ var(
782
+ --trees-theme-git-renamed-fg,
783
+ light-dark(var(--trees-renamed-light), var(--trees-renamed-dark))
784
+ )
785
+ );
786
+ --trees-status-untracked: var(
787
+ --trees-status-untracked-override,
788
+ var(
789
+ --trees-theme-git-untracked-fg,
790
+ light-dark(var(--trees-untracked-light), var(--trees-untracked-dark))
791
+ )
792
+ );
793
+ --trees-status-deleted: var(
794
+ --trees-status-deleted-override,
795
+ var(
796
+ --trees-theme-git-deleted-fg,
797
+ light-dark(var(--trees-deleted-light), var(--trees-deleted-dark))
798
+ )
799
+ );
800
+ --trees-git-modified-color: var(
801
+ --trees-git-modified-color-override,
802
+ var(--trees-status-modified)
803
+ );
804
+ --trees-git-added-color: var(
805
+ --trees-git-added-color-override,
806
+ var(--trees-status-added)
807
+ );
808
+ --trees-git-ignored-color: var(
809
+ --trees-git-ignored-color-override,
810
+ var(--trees-status-ignored)
811
+ );
812
+ --trees-git-deleted-color: var(
813
+ --trees-git-deleted-color-override,
814
+ var(--trees-status-deleted)
815
+ );
816
+ --trees-git-renamed-color: var(
817
+ --trees-git-renamed-color-override,
818
+ var(--trees-status-renamed)
819
+ );
820
+ --trees-git-untracked-color: var(
821
+ --trees-git-untracked-color-override,
822
+ var(--trees-status-untracked)
823
+ );
824
+
825
+ --trees-icon-gray: light-dark(#84848a, #adadb1);
826
+ --trees-icon-red: light-dark(#d52c36, #ff6762);
827
+ --trees-icon-vermilion: light-dark(#ff8c5b, #d5512f);
828
+ --trees-icon-orange: light-dark(#d47628, #ffa359);
829
+ --trees-icon-yellow: light-dark(#d5a910, #ffd452);
830
+ --trees-icon-green: light-dark(#199f43, #5ecc71);
831
+ --trees-icon-teal: light-dark(#17a5af, #64d1db);
832
+ --trees-icon-cyan: light-dark(#1ca1c7, #68cdf2);
833
+ --trees-icon-blue: light-dark(#1a85d4, #69b1ff);
834
+ --trees-icon-indigo: light-dark(#693acf, #9d6afb);
835
+ --trees-icon-purple: light-dark(#a631be, #d568ea);
836
+ --trees-icon-pink: light-dark(#d32a61, #ff678d);
837
+ --trees-icon-mauve: light-dark(#594c5b, #79697b);
838
+
839
+ --trees-file-icon-color-default: var(
840
+ --trees-file-icon-color,
841
+ var(--trees-icon-gray)
842
+ );
843
+ --trees-file-icon-color-astro: var(
844
+ --trees-file-icon-color,
845
+ var(--trees-icon-purple)
846
+ );
847
+ --trees-file-icon-color-babel: var(
848
+ --trees-file-icon-color,
849
+ var(--trees-icon-yellow)
850
+ );
851
+ --trees-file-icon-color-bash: var(
852
+ --trees-file-icon-color,
853
+ var(--trees-icon-green)
854
+ );
855
+ --trees-file-icon-color-biome: var(
856
+ --trees-file-icon-color,
857
+ var(--trees-icon-blue)
858
+ );
859
+ --trees-file-icon-color-bootstrap: var(
860
+ --trees-file-icon-color,
861
+ var(--trees-icon-indigo)
862
+ );
863
+ --trees-file-icon-color-browserslist: var(
864
+ --trees-file-icon-color,
865
+ var(--trees-icon-yellow)
866
+ );
867
+ --trees-file-icon-color-bun: var(
868
+ --trees-file-icon-color,
869
+ var(--trees-icon-mauve)
870
+ );
871
+ --trees-file-icon-color-c: var(
872
+ --trees-file-icon-color,
873
+ var(--trees-icon-blue)
874
+ );
875
+ --trees-file-icon-color-cpp: var(
876
+ --trees-file-icon-color,
877
+ var(--trees-icon-blue)
878
+ );
879
+ --trees-file-icon-color-claude: var(
880
+ --trees-file-icon-color,
881
+ var(--trees-icon-orange)
882
+ );
883
+ --trees-file-icon-color-css: var(
884
+ --trees-file-icon-color,
885
+ var(--trees-icon-indigo)
886
+ );
887
+ --trees-file-icon-color-database: var(
888
+ --trees-file-icon-color,
889
+ var(--trees-icon-purple)
890
+ );
891
+ --trees-file-icon-color-docker: var(
892
+ --trees-file-icon-color,
893
+ var(--trees-icon-blue)
894
+ );
895
+ --trees-file-icon-color-eslint: var(
896
+ --trees-file-icon-color,
897
+ var(--trees-icon-indigo)
898
+ );
899
+ --trees-file-icon-color-git: var(
900
+ --trees-file-icon-vermilion,
901
+ var(--trees-icon-vermilion)
902
+ );
903
+ --trees-file-icon-color-go: var(
904
+ --trees-file-icon-color,
905
+ var(--trees-icon-cyan)
906
+ );
907
+ --trees-file-icon-color-graphql: var(
908
+ --trees-file-icon-color,
909
+ var(--trees-icon-pink)
910
+ );
911
+ --trees-file-icon-color-html: var(
912
+ --trees-file-icon-color,
913
+ var(--trees-icon-orange)
914
+ );
915
+ --trees-file-icon-color-image: var(
916
+ --trees-file-icon-color,
917
+ var(--trees-icon-pink)
918
+ );
919
+ --trees-file-icon-color-javascript: var(
920
+ --trees-file-icon-color,
921
+ var(--trees-icon-yellow)
922
+ );
923
+ --trees-file-icon-color-json: var(
924
+ --trees-file-icon-color,
925
+ var(--trees-icon-orange)
926
+ );
927
+ --trees-file-icon-color-markdown: var(
928
+ --trees-file-icon-color,
929
+ var(--trees-icon-green)
930
+ );
931
+ --trees-file-icon-color-mcp: var(
932
+ --trees-file-icon-color,
933
+ var(--trees-icon-teal)
934
+ );
935
+ --trees-file-icon-color-npm: var(
936
+ --trees-file-icon-color,
937
+ var(--trees-icon-red)
938
+ );
939
+ --trees-file-icon-color-oxc: var(
940
+ --trees-file-icon-cyan,
941
+ var(--trees-icon-cyan)
942
+ );
943
+ --trees-file-icon-color-postcss: var(
944
+ --trees-file-icon-color,
945
+ var(--trees-icon-red)
946
+ );
947
+ --trees-file-icon-color-prettier: var(
948
+ --trees-file-icon-color,
949
+ var(--trees-icon-teal)
950
+ );
951
+ --trees-file-icon-color-python: var(
952
+ --trees-file-icon-color,
953
+ var(--trees-icon-blue)
954
+ );
955
+ --trees-file-icon-color-react: var(
956
+ --trees-file-icon-color,
957
+ var(--trees-icon-cyan)
958
+ );
959
+ --trees-file-icon-color-ruby: var(
960
+ --trees-file-icon-color,
961
+ var(--trees-icon-red)
962
+ );
963
+ --trees-file-icon-color-rust: var(
964
+ --trees-file-icon-color,
965
+ var(--trees-icon-orange)
966
+ );
967
+ --trees-file-icon-color-sass: var(
968
+ --trees-file-icon-color,
969
+ var(--trees-icon-pink)
970
+ );
971
+ --trees-file-icon-color-svg: var(
972
+ --trees-file-icon-color,
973
+ var(--trees-icon-orange)
974
+ );
975
+ --trees-file-icon-color-svelte: var(
976
+ --trees-file-icon-color,
977
+ var(--trees-icon-red)
978
+ );
979
+ --trees-file-icon-color-svgo: var(
980
+ --trees-file-icon-color,
981
+ var(--trees-icon-green)
982
+ );
983
+ --trees-file-icon-color-swift: var(
984
+ --trees-file-icon-color,
985
+ var(--trees-icon-orange)
986
+ );
987
+ --trees-file-icon-color-table: var(
988
+ --trees-file-icon-color,
989
+ var(--trees-icon-teal)
990
+ );
991
+ --trees-file-icon-color-text: var(
992
+ --trees-file-icon-color,
993
+ var(--trees-icon-gray)
994
+ );
995
+ --trees-file-icon-color-tailwind: var(
996
+ --trees-file-icon-color,
997
+ var(--trees-icon-cyan)
998
+ );
999
+ --trees-file-icon-color-terraform: var(
1000
+ --trees-file-icon-color,
1001
+ var(--trees-icon-indigo)
1002
+ );
1003
+ --trees-file-icon-color-typescript: var(
1004
+ --trees-file-icon-color,
1005
+ var(--trees-icon-blue)
1006
+ );
1007
+ --trees-file-icon-color-vite: var(
1008
+ --trees-file-icon-color,
1009
+ var(--trees-icon-purple)
1010
+ );
1011
+ --trees-file-icon-color-vscode: var(
1012
+ --trees-file-icon-color,
1013
+ var(--trees-icon-blue)
1014
+ );
1015
+ --trees-file-icon-color-vue: var(
1016
+ --trees-file-icon-color,
1017
+ var(--trees-icon-green)
1018
+ );
1019
+ --trees-file-icon-color-wasm: var(
1020
+ --trees-file-icon-color,
1021
+ var(--trees-icon-indigo)
1022
+ );
1023
+ --trees-file-icon-color-webpack: var(
1024
+ --trees-file-icon-color,
1025
+ var(--trees-icon-blue)
1026
+ );
1027
+ --trees-file-icon-color-yml: var(
1028
+ --trees-file-icon-color,
1029
+ var(--trees-icon-red)
1030
+ );
1031
+ --trees-file-icon-color-zig: var(
1032
+ --trees-file-icon-color,
1033
+ var(--trees-icon-orange)
1034
+ );
1035
+ --trees-file-icon-color-zip: var(
1036
+ --trees-file-icon-color,
1037
+ var(--trees-icon-orange)
1038
+ );
1039
+
1040
+ --trees-level-gap: var(
1041
+ --trees-level-gap-override,
1042
+ calc(8px * var(--trees-density))
1043
+ );
1044
+ --trees-item-padding-x: var(
1045
+ --trees-item-padding-x-override,
1046
+ calc(8px * var(--trees-density))
1047
+ );
1048
+ --trees-item-margin-x: var(
1049
+ --trees-item-margin-x-override,
1050
+ calc(2px * var(--trees-density))
1051
+ );
1052
+ --trees-item-row-gap: var(
1053
+ --trees-item-row-gap-override,
1054
+ calc(6px * var(--trees-density))
1055
+ );
1056
+ --trees-icon-width: var(--trees-icon-width-override, 16px);
1057
+ --trees-icon-nudge: var(
1058
+ --trees-icon-nudge-override,
1059
+ calc(1px * var(--trees-density))
1060
+ );
1061
+ --trees-row-height: var(--trees-item-height, 30px);
1062
+ --trees-git-lane-width: var(--trees-git-lane-width-override, 12px);
1063
+ --trees-action-lane-width: var(
1064
+ --trees-action-lane-width-override,
1065
+ calc(var(--trees-icon-width) + 2px)
1066
+ );
1067
+ /* Keep the floating trigger aligned with the row's action lane. Going in
1068
+ from the root's right edge: the scroll container reserves
1069
+ \`--trees-padding-inline\` of effective inset on each side (its asymmetric
1070
+ padding formula cancels the scrollbar gutter on the right), the row
1071
+ sits inside that inset, and its trailing \`--trees-item-padding-x\` is the
1072
+ action lane itself. The trigger's own focus-ring margin then trims one
1073
+ pixel back so the button's visible right edge lines up with the lane. */
1074
+ --trees-context-menu-trigger-inline-offset: calc(
1075
+ var(--trees-padding-inline) + var(--trees-item-padding-x) -
1076
+ var(--trees-focus-ring-width)
1077
+ );
1078
+
1079
+ --trees-scrollbar-gutter: var(--trees-scrollbar-gutter-override, 6px);
1080
+ --trees-padding-inline: var(--trees-padding-inline-override, 16px);
1081
+
1082
+ color-scheme: light dark;
1083
+ display: flex;
1084
+ flex-direction: column;
1085
+ font-size: var(--trees-font-size);
1086
+ color: var(--trees-fg);
1087
+ background-color: var(--trees-bg);
1088
+ --truncate-marker-background-color: var(--trees-bg);
1089
+ --truncate-marker-background-overlay-color: transparent;
1090
+ font-family: var(--trees-font-family);
1091
+ font-weight: var(--trees-font-weight-regular);
1092
+ }
1093
+
1094
+ :host([data-file-tree-virtualized='true']) {
1095
+ height: 100%;
1096
+ overflow: hidden;
1097
+ }
1098
+
1099
+ [data-file-tree-virtualized-wrapper='true'] {
1100
+ height: 100%;
1101
+ overflow: hidden;
1102
+ display: flex;
1103
+ flex-direction: column;
1104
+ }
1105
+
1106
+ [data-file-tree-virtualized-root='true'] {
1107
+ height: 100%;
1108
+ display: flex;
1109
+ flex-direction: column;
1110
+ overflow: hidden;
1111
+ }
1112
+
1113
+ [data-file-tree-virtualized-scroll='true'],
1114
+ [data-file-tree-scrollbar-measure='true'] {
1115
+ --trees-scrollbar-thumb-current: transparent;
1116
+ overflow-y: auto;
1117
+ scrollbar-gutter: stable;
1118
+
1119
+ &:hover {
1120
+ --trees-scrollbar-thumb-current: var(--trees-scrollbar-thumb);
1121
+ }
1122
+
1123
+ &::-webkit-scrollbar {
1124
+ width: var(--trees-scrollbar-gutter);
1125
+ height: var(--trees-scrollbar-gutter);
1126
+ }
1127
+
1128
+ &::-webkit-scrollbar-track {
1129
+ background: transparent;
1130
+ }
1131
+
1132
+ &::-webkit-scrollbar-thumb {
1133
+ background-color: var(--trees-scrollbar-thumb-current);
1134
+ border: 1px solid transparent;
1135
+ background-clip: content-box;
1136
+ border-radius: calc(var(--trees-scrollbar-gutter) / 2);
1137
+ }
1138
+
1139
+ &::-webkit-scrollbar-corner {
1140
+ background-color: transparent;
1141
+ }
1142
+ }
1143
+
1144
+ /* These are styles for a temporarily generated element to measure the size
1145
+ * of the scrollbar. It's intended to be somewhat similar in scrollbar style
1146
+ * scope to the scrollable tree so \`--trees-scrollbar-gutter-measured\` is an
1147
+ * accurate reflection of the size the scrollbar gutter takes up. */
1148
+ [data-file-tree-scrollbar-measure='true'] {
1149
+ position: absolute;
1150
+ top: 0;
1151
+ left: 0;
1152
+ visibility: hidden;
1153
+ pointer-events: none;
1154
+ width: 100px;
1155
+ height: 100px;
1156
+ }
1157
+
1158
+ @supports (-moz-appearance: none) {
1159
+ [data-file-tree-virtualized-scroll='true'],
1160
+ [data-file-tree-scrollbar-measure='true'] {
1161
+ scrollbar-width: thin;
1162
+ scrollbar-color: var(--trees-scrollbar-thumb-current) transparent;
1163
+ }
1164
+ }
1165
+
1166
+ [data-file-tree-virtualized-scroll='true'] {
1167
+ position: relative;
1168
+ overflow-y: auto;
1169
+ flex: 1 1 0;
1170
+ min-height: 0;
1171
+ padding-inline: max(
1172
+ calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
1173
+ 0px
1174
+ )
1175
+ /* NOTE(amadeus): We can assume that all Webkit based browser gutters
1176
+ * will align to the value of '--trees-scrollbar-gutter', however if not, then
1177
+ * \`--trees-scrollbar-gutter-measured\` should correct it. Mostly we are
1178
+ * hoping to avoid SSR alignment jumps if possible. In non-SSR'd environments
1179
+ * \`--trees-scrollbar-gutter-measured\` should always be immediately available.
1180
+ */
1181
+ max(
1182
+ calc(
1183
+ var(--trees-padding-inline) - var(--trees-item-margin-x) -
1184
+ var(
1185
+ --trees-scrollbar-gutter-measured,
1186
+ var(--trees-scrollbar-gutter)
1187
+ )
1188
+ ),
1189
+ 0px
1190
+ );
1191
+ }
1192
+
1193
+ @supports (-moz-appearance: none) {
1194
+ [data-file-tree-virtualized-scroll='true'] {
1195
+ padding-inline: max(
1196
+ calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
1197
+ 0px
1198
+ )
1199
+ /* NOTE(amadeus): However on Firefox it can vary a little bit, but most
1200
+ * likely the majority of cases will default to a 0px width scrollbar lets
1201
+ * inherit that first to avoid SSR jumps. In non-SSR'd environments
1202
+ * \`--trees-scrollbar-gutter-measured\` should always be immediately available.
1203
+ */
1204
+ max(
1205
+ calc(
1206
+ var(--trees-padding-inline) - var(--trees-item-margin-x) -
1207
+ var(--trees-scrollbar-gutter-measured, 0px)
1208
+ ),
1209
+ 0px
1210
+ );
1211
+ }
1212
+ }
1213
+
1214
+ [data-file-tree-sticky-overlay='true'] {
1215
+ position: sticky;
1216
+ top: 0;
1217
+ height: 0;
1218
+ z-index: 4;
1219
+ overflow: visible;
1220
+ pointer-events: none;
1221
+ }
1222
+
1223
+ /* The overlay DOM is kept populated even at scrollTop=0 so the browser has
1224
+ * the rendered rows on hand the moment scrolling begins — otherwise the
1225
+ * compositor paints a scrolled frame before React can mount the overlay,
1226
+ * and the topmost sticky folder jumps up by a couple of pixels before it
1227
+ * "snaps" into its pinned position. We hide it via CSS whenever the scroll
1228
+ * is at the top and no scroll is in progress, so the preview doesn't leak
1229
+ * through at rest. \`data-overlay-reveal\` is stamped on the root only when
1230
+ * the user initiates a scroll while already at the top — exactly the case
1231
+ * where we need the pre-mounted overlay to be visible through the first
1232
+ * compositor frame. It is deliberately distinct from the general
1233
+ * \`data-is-scrolling\` flag so a scroll that ends at the top (e.g. ArrowUp
1234
+ * navigation) re-hides the overlay the instant the scroll lands, rather
1235
+ * than waiting for the hover-suppression timer to elapse. */
1236
+ [data-file-tree-virtualized-root='true'][data-scroll-at-top='true']:not(
1237
+ [data-overlay-reveal]
1238
+ )
1239
+ [data-file-tree-sticky-overlay='true'] {
1240
+ visibility: hidden;
1241
+ }
1242
+
1243
+ [data-file-tree-sticky-overlay-content='true'] {
1244
+ background-color: var(--trees-bg);
1245
+ position: relative;
1246
+ pointer-events: none;
1247
+ }
1248
+
1249
+ [data-file-tree-virtualized-list='true'] {
1250
+ background-color: var(--trees-bg);
1251
+ position: relative;
1252
+ min-height: 100%;
1253
+ width: 100%;
1254
+ overflow-anchor: none;
1255
+
1256
+ &[data-is-scrolling] {
1257
+ pointer-events: none;
1258
+ }
1259
+ }
1260
+
1261
+ [data-file-tree-virtualized-sticky-offset='true'] {
1262
+ contain: layout size;
1263
+ }
1264
+
1265
+ [data-file-tree-virtualized-sticky='true'] {
1266
+ position: sticky;
1267
+ top: 0;
1268
+ width: 100%;
1269
+ display: flex;
1270
+ flex-direction: column;
1271
+ isolation: isolate;
1272
+ /* Promote to its own compositor layer so text inside the window is
1273
+ * rasterized once and GPU-translated during scroll. Without this, the
1274
+ * browser re-paints the window (and its text) at every scroll frame,
1275
+ * which produces visible 1px shake / character tearing. */
1276
+ will-change: transform;
1277
+ }
1278
+
1279
+ [data-file-tree-search-container] {
1280
+ display: flex;
1281
+ padding: 0;
1282
+ padding-inline: var(--trees-padding-inline);
1283
+ margin-bottom: var(--trees-item-row-gap);
1284
+ }
1285
+
1286
+ [data-file-tree-search-input] {
1287
+ --trees-focus-ring-width: 2px;
1288
+ font-family: var(--trees-font-family);
1289
+ font-size: var(--trees-font-size);
1290
+ flex: 1;
1291
+ height: var(--trees-row-height);
1292
+ /* 1px breathing room so the focus-visible outline isn't clipped when the
1293
+ * input sits flush against the top of the scroll container. */
1294
+ margin-block: 1px;
1295
+ padding-inline: var(--trees-item-padding-x);
1296
+ line-height: var(--trees-row-height);
1297
+ color: var(--trees-search-fg);
1298
+ background-color: var(--trees-search-bg);
1299
+ border: 1px solid var(--trees-border-color);
1300
+ border-radius: var(--trees-border-radius);
1301
+ outline: none;
1302
+
1303
+ &::placeholder {
1304
+ color: color-mix(
1305
+ in lab,
1306
+ var(--trees-search-fg) 65%,
1307
+ var(--trees-search-bg)
1308
+ );
1309
+ }
1310
+
1311
+ &:focus-visible,
1312
+ &[data-file-tree-search-input-fake-focus='true'] {
1313
+ outline: var(--trees-focus-ring-width) solid var(--trees-focus-ring-color);
1314
+ outline-offset: var(--trees-focus-ring-offset);
1315
+ }
1316
+ }
1317
+
1318
+ /* The wrapper for the tree items */
1319
+ [role='tree'] {
1320
+ position: relative;
1321
+ display: flex;
1322
+ flex-direction: column;
1323
+ gap: var(--trees-gap-override, 0);
1324
+ }
1325
+
1326
+ /* LIST ITEM */
1327
+ [data-type='item'] {
1328
+ color: inherit;
1329
+ font-family: var(--trees-font-family);
1330
+ font-size: var(--trees-font-size);
1331
+ text-align: start;
1332
+ outline: none;
1333
+ background-color: var(--trees-bg);
1334
+ border: none;
1335
+ position: relative;
1336
+
1337
+ padding: 0 var(--trees-item-padding-x);
1338
+ margin: 0 var(--trees-item-margin-x);
1339
+ cursor: pointer;
1340
+ -webkit-user-select: none;
1341
+ user-select: none;
1342
+ -webkit-touch-callout: none;
1343
+ touch-action: manipulation;
1344
+ display: flex;
1345
+ flex: 0 0 var(--trees-row-height);
1346
+ align-items: center;
1347
+ height: var(--trees-row-height);
1348
+ line-height: var(--trees-row-height);
1349
+ gap: var(--trees-item-row-gap);
1350
+ border-radius: var(--trees-border-radius);
1351
+ /* Row states may be translucent, so markers paint the tree background first
1352
+ * and then the state color on top to avoid compositing the same alpha twice. */
1353
+ --truncate-marker-background-color: var(--trees-bg);
1354
+ --truncate-marker-background-overlay-color: transparent;
1355
+ --truncate-marker-block-inset: 0px;
1356
+
1357
+ &:hover,
1358
+ &[data-item-context-hover='true'] {
1359
+ background-color: var(--trees-bg-muted);
1360
+ --truncate-marker-background-overlay-color: var(--trees-bg-muted);
1361
+ }
1362
+
1363
+ &[data-item-focused='true'],
1364
+ &:focus-visible {
1365
+ z-index: 2;
1366
+
1367
+ /* Flattened segment markers sit high enough to cover the row outline unless
1368
+ * their painted background is inset by the focus ring width. */
1369
+ [data-item-flattened-subitems] {
1370
+ --truncate-marker-block-inset: var(--trees-focus-ring-width);
1371
+ }
1372
+
1373
+ &::before {
1374
+ position: absolute;
1375
+ inset: 0;
1376
+ content: '';
1377
+ display: block;
1378
+ border-radius: var(--trees-border-radius);
1379
+ outline: var(--trees-focus-ring-width) solid
1380
+ var(--trees-focus-ring-color);
1381
+ outline-offset: var(--trees-focus-ring-offset);
1382
+ pointer-events: none;
1383
+ }
1384
+
1385
+ &[data-item-selected='true']::before {
1386
+ outline-color: var(--trees-selected-focused-border-color);
1387
+ }
1388
+ }
1389
+
1390
+ &[data-item-selected='true'] {
1391
+ color: var(--trees-selected-fg);
1392
+ background-color: var(--trees-selected-bg);
1393
+ --truncate-marker-background-overlay-color: var(--trees-selected-bg);
1394
+ z-index: 3;
1395
+
1396
+ [data-item-section='icon'] {
1397
+ color: var(--trees-selected-fg);
1398
+ }
1399
+ }
1400
+
1401
+ &[data-item-search-match='true'] {
1402
+ font-weight: var(--trees-search-font-weight);
1403
+ }
1404
+ }
1405
+
1406
+ [data-type='item'][data-file-tree-sticky-row='true'] {
1407
+ pointer-events: auto;
1408
+ }
1409
+
1410
+ /* Sticky rows opt back into pointer events because the overlay wrapper is
1411
+ * inert. During scroll, put them back under the same hover suppression as
1412
+ * the virtualized list so translucent hover states and menu triggers do not
1413
+ * paint over rows moving beneath the sticky stack. */
1414
+ [data-file-tree-virtualized-root='true'][data-is-scrolling]
1415
+ [data-type='item'][data-file-tree-sticky-row='true'] {
1416
+ pointer-events: none;
1417
+ }
1418
+
1419
+ [data-file-tree-virtualized-root='true'][data-is-scrolling]
1420
+ [data-type='item'][data-file-tree-sticky-row='true']:hover:not(
1421
+ [data-item-selected='true']
1422
+ ),
1423
+ [data-file-tree-virtualized-root='true'][data-is-scrolling]
1424
+ [data-type='item'][data-file-tree-sticky-row='true'][data-item-context-hover='true']:not(
1425
+ [data-item-selected='true']
1426
+ ) {
1427
+ background-color: var(--trees-bg);
1428
+ --truncate-marker-background-overlay-color: transparent;
1429
+ }
1430
+
1431
+ [data-item-selected='true']:has(+ [data-item-selected='true']) {
1432
+ border-bottom-left-radius: 0;
1433
+ border-bottom-right-radius: 0;
1434
+ }
1435
+
1436
+ [data-item-selected='true'] + [data-item-selected='true'] {
1437
+ border-top-left-radius: 0;
1438
+ border-top-right-radius: 0;
1439
+ }
1440
+
1441
+ /* Flattened Directory Parts */
1442
+ [data-item-flattened-subitems] {
1443
+ display: inline-flex;
1444
+ align-items: center;
1445
+ gap: 2px;
1446
+ }
1447
+ [data-item-flattened-subitem]:hover,
1448
+ [data-item-flattened-subitem-drag-target='true'] {
1449
+ text-decoration: underline;
1450
+ }
1451
+
1452
+ /* Icon for each item */
1453
+ [data-item-section='icon'] {
1454
+ flex-shrink: 0;
1455
+ display: flex;
1456
+ align-items: center;
1457
+ justify-content: center;
1458
+ color: var(--trees-fg-muted);
1459
+ fill: currentColor;
1460
+ width: var(--trees-icon-width);
1461
+ }
1462
+
1463
+ :where([data-item-section='icon'] > [data-icon-token]) {
1464
+ color: var(--trees-fg-muted);
1465
+ }
1466
+
1467
+ [data-file-tree-colored-icons='true'] {
1468
+ [data-icon-token='astro'] {
1469
+ color: var(--trees-file-icon-color-astro);
1470
+ }
1471
+ [data-icon-token='babel'] {
1472
+ color: var(--trees-file-icon-color-babel);
1473
+ }
1474
+ [data-icon-token='bash'] {
1475
+ color: var(--trees-file-icon-color-bash);
1476
+ }
1477
+ [data-icon-token='biome'] {
1478
+ color: var(--trees-file-icon-color-biome);
1479
+ }
1480
+ [data-icon-token='bootstrap'] {
1481
+ color: var(--trees-file-icon-color-bootstrap);
1482
+ }
1483
+ [data-icon-token='browserslist'] {
1484
+ color: var(--trees-file-icon-color-browserslist);
1485
+ }
1486
+ [data-icon-token='bun'] {
1487
+ color: var(--trees-file-icon-color-bun);
1488
+ }
1489
+ [data-icon-token='c'] {
1490
+ color: var(--trees-file-icon-color-c);
1491
+ }
1492
+ [data-icon-token='cpp'] {
1493
+ color: var(--trees-file-icon-color-cpp);
1494
+ }
1495
+ [data-icon-token='claude'] {
1496
+ color: var(--trees-file-icon-color-claude);
1497
+ }
1498
+ [data-icon-token='css'] {
1499
+ color: var(--trees-file-icon-color-css);
1500
+ }
1501
+ [data-icon-token='database'] {
1502
+ color: var(--trees-file-icon-color-database);
1503
+ }
1504
+ [data-icon-token='default'] {
1505
+ color: var(--trees-file-icon-color-default);
1506
+ }
1507
+ [data-icon-token='docker'] {
1508
+ color: var(--trees-file-icon-color-docker);
1509
+ }
1510
+ [data-icon-token='eslint'] {
1511
+ color: var(--trees-file-icon-color-eslint);
1512
+ }
1513
+ [data-icon-token='git'] {
1514
+ color: var(--trees-file-icon-color-git);
1515
+ }
1516
+ [data-icon-token='go'] {
1517
+ color: var(--trees-file-icon-color-go);
1518
+ }
1519
+ [data-icon-token='graphql'] {
1520
+ color: var(--trees-file-icon-color-graphql);
1521
+ }
1522
+ [data-icon-token='html'] {
1523
+ color: var(--trees-file-icon-color-html);
1524
+ }
1525
+ [data-icon-token='image'] {
1526
+ color: var(--trees-file-icon-color-image);
1527
+ }
1528
+ [data-icon-token='javascript'] {
1529
+ color: var(--trees-file-icon-color-javascript);
1530
+ }
1531
+ [data-icon-token='json'] {
1532
+ color: var(--trees-file-icon-color-json);
1533
+ }
1534
+ [data-icon-token='markdown'] {
1535
+ color: var(--trees-file-icon-color-markdown);
1536
+ }
1537
+ [data-icon-token='mcp'] {
1538
+ color: var(--trees-file-icon-color-mcp);
1539
+ }
1540
+ [data-icon-token='npm'] {
1541
+ color: var(--trees-file-icon-color-npm);
1542
+ }
1543
+ [data-icon-token='oxc'] {
1544
+ color: var(--trees-file-icon-color-oxc);
1545
+ }
1546
+ [data-icon-token='postcss'] {
1547
+ color: var(--trees-file-icon-color-postcss);
1548
+ }
1549
+ [data-icon-token='prettier'] {
1550
+ color: var(--trees-file-icon-color-prettier);
1551
+ }
1552
+ [data-icon-token='python'] {
1553
+ color: var(--trees-file-icon-color-python);
1554
+ }
1555
+ [data-icon-token='react'] {
1556
+ color: var(--trees-file-icon-color-react);
1557
+ }
1558
+ [data-icon-token='ruby'] {
1559
+ color: var(--trees-file-icon-color-ruby);
1560
+ }
1561
+ [data-icon-token='rust'] {
1562
+ color: var(--trees-file-icon-color-rust);
1563
+ }
1564
+ [data-icon-token='sass'] {
1565
+ color: var(--trees-file-icon-color-sass);
1566
+ }
1567
+ [data-icon-token='svg'] {
1568
+ color: var(--trees-file-icon-color-svg);
1569
+ }
1570
+ [data-icon-token='svelte'] {
1571
+ color: var(--trees-file-icon-color-svelte);
1572
+ }
1573
+ [data-icon-token='svgo'] {
1574
+ color: var(--trees-file-icon-color-svgo);
1575
+ }
1576
+ [data-icon-token='swift'] {
1577
+ color: var(--trees-file-icon-color-swift);
1578
+ }
1579
+ [data-icon-token='table'] {
1580
+ color: var(--trees-file-icon-color-table);
1581
+ }
1582
+ [data-icon-token='text'] {
1583
+ color: var(--trees-file-icon-color-text);
1584
+ }
1585
+ [data-icon-token='tailwind'] {
1586
+ color: var(--trees-file-icon-color-tailwind);
1587
+ }
1588
+ [data-icon-token='terraform'] {
1589
+ color: var(--trees-file-icon-color-terraform);
1590
+ }
1591
+ [data-icon-token='typescript'] {
1592
+ color: var(--trees-file-icon-color-typescript);
1593
+ }
1594
+ [data-icon-token='vite'] {
1595
+ color: var(--trees-file-icon-color-vite);
1596
+ }
1597
+ [data-icon-token='vscode'] {
1598
+ color: var(--trees-file-icon-color-vscode);
1599
+ }
1600
+ [data-icon-token='vue'] {
1601
+ color: var(--trees-file-icon-color-vue);
1602
+ }
1603
+ [data-icon-token='wasm'] {
1604
+ color: var(--trees-file-icon-color-wasm);
1605
+ }
1606
+ [data-icon-token='webpack'] {
1607
+ color: var(--trees-file-icon-color-webpack);
1608
+ }
1609
+ [data-icon-token='yml'] {
1610
+ color: var(--trees-file-icon-color-yml);
1611
+ }
1612
+ [data-icon-token='zig'] {
1613
+ color: var(--trees-file-icon-color-zig);
1614
+ }
1615
+ [data-icon-token='zip'] {
1616
+ color: var(--trees-file-icon-color-zip);
1617
+ }
1618
+ }
1619
+
1620
+ /* Chevron rotation and visual alignment */
1621
+ /* Chevron pointing down */
1622
+ [data-icon-name='file-tree-icon-chevron'] {
1623
+ &[data-align-capitals='false'] {
1624
+ transform: translate(0, var(--trees-icon-nudge));
1625
+ }
1626
+ &[data-align-capitals='true'] {
1627
+ transform: translate(0, 0);
1628
+ }
1629
+ }
1630
+
1631
+ [data-item-section='content'] {
1632
+ flex: 0 1 auto;
1633
+ text-align: start;
1634
+ min-width: 0;
1635
+ max-width: 100%;
1636
+ overflow: hidden;
1637
+ text-overflow: ellipsis;
1638
+ /* Breaks middle truncate component to also set this */
1639
+ /* white-space: nowrap; */
1640
+ }
1641
+
1642
+ [data-item-section='decoration'] {
1643
+ flex: 1 1 0;
1644
+ min-width: 0;
1645
+ display: flex;
1646
+ justify-content: flex-end;
1647
+ text-align: end;
1648
+ overflow: hidden;
1649
+ color: var(--trees-fg-muted);
1650
+ }
1651
+
1652
+ [data-item-section='decoration'] > span {
1653
+ min-width: 0;
1654
+ max-width: 100%;
1655
+ display: inline-flex;
1656
+ align-items: center;
1657
+ justify-content: flex-end;
1658
+ overflow: hidden;
1659
+ text-overflow: ellipsis;
1660
+ white-space: nowrap;
1661
+ }
1662
+
1663
+ [data-item-section='git'],
1664
+ [data-item-section='action'] {
1665
+ flex: 0 0 auto;
1666
+ display: flex;
1667
+ align-items: center;
1668
+ justify-content: center;
1669
+ }
1670
+
1671
+ [data-item-section='git'] {
1672
+ width: var(--trees-git-lane-width);
1673
+ }
1674
+
1675
+ [data-item-section='action'] {
1676
+ width: var(--trees-action-lane-width);
1677
+ color: var(--trees-fg-muted);
1678
+ fill: currentColor;
1679
+ pointer-events: none;
1680
+ }
1681
+
1682
+ [data-item-section='git'] > span,
1683
+ [data-item-section='action'] > span {
1684
+ width: 100%;
1685
+ display: inline-flex;
1686
+ align-items: center;
1687
+ justify-content: center;
1688
+ }
1689
+
1690
+ [data-item-action-affordance='decorative'] {
1691
+ opacity: 0.85;
1692
+ }
1693
+
1694
+ [data-item-rename-input] {
1695
+ appearance: none;
1696
+ width: 100%;
1697
+ min-width: 0;
1698
+ height: calc(var(--trees-row-height) - 4px);
1699
+ font-family: inherit;
1700
+ font-size: inherit;
1701
+ /* line-height: calc(var(--trees-row-height) - 8px); */
1702
+ color: inherit;
1703
+ background-color: transparent;
1704
+ border: 0;
1705
+ padding-inline: 6px;
1706
+ outline: none;
1707
+ box-sizing: border-box;
1708
+ }
1709
+
1710
+ [data-item-section='content']:has([data-item-rename-input])
1711
+ ~ [data-item-section='action'],
1712
+ [data-item-section='content']:has([data-item-rename-input])
1713
+ ~ [data-item-section='decoration'] {
1714
+ display: none;
1715
+ }
1716
+
1717
+ /* Chevron pointing right */
1718
+ [aria-expanded='false'][data-item-type='folder']
1719
+ > [data-item-section='icon']
1720
+ > [data-icon-name='file-tree-icon-chevron'] {
1721
+ &[data-align-capitals='true'] {
1722
+ transform: rotate(-90deg)
1723
+ translate(
1724
+ calc(var(--trees-icon-nudge) / 2),
1725
+ calc(var(--trees-icon-nudge) / 2)
1726
+ );
1727
+ }
1728
+ &[data-align-capitals='false'] {
1729
+ transform: rotate(-90deg)
1730
+ translate(
1731
+ calc(var(--trees-icon-nudge) / 2 * -1),
1732
+ calc(var(--trees-icon-nudge) / 2)
1733
+ );
1734
+ }
1735
+ }
1736
+
1737
+ /* LIST IDENTATION */
1738
+ /* Spacing container */
1739
+ [data-item-section='spacing'] {
1740
+ display: flex;
1741
+ flex-direction: row;
1742
+ align-items: center;
1743
+ justify-content: center;
1744
+ height: var(--trees-row-height);
1745
+ padding-left: calc(calc(var(--trees-icon-width) / 2) - 0.5px);
1746
+
1747
+ &:empty {
1748
+ padding-left: 0;
1749
+ }
1750
+ }
1751
+
1752
+ /* Spacing per level */
1753
+ [data-item-section='spacing-item'] {
1754
+ transform: translateX(-0.25px);
1755
+ display: inline-block;
1756
+ border-left: 1px solid var(--trees-indent-guide-bg);
1757
+ height: 100%;
1758
+ margin-right: calc(var(--trees-level-gap) - 1px);
1759
+ opacity: 0;
1760
+ transition: opacity 150ms ease;
1761
+
1762
+ & + & {
1763
+ margin-left: calc(
1764
+ var(--trees-item-row-gap) + calc(var(--trees-icon-width) / 2) - 0.5px
1765
+ );
1766
+ }
1767
+ }
1768
+
1769
+ :host(:hover) [data-item-section='spacing-item'] {
1770
+ opacity: 0.75;
1771
+ }
1772
+
1773
+ /* Git status indicator */
1774
+
1775
+ /* This is a folder that contains a git change */
1776
+ [data-item-contains-git-change='true'] > [data-item-section='git'] {
1777
+ color: var(--trees-git-modified-color);
1778
+ opacity: 0.5;
1779
+ fill: currentColor;
1780
+ }
1781
+
1782
+ /* These are files that have a git change */
1783
+ [data-item-git-status] {
1784
+ &
1785
+ > :where([data-item-section='icon'])
1786
+ > :where(:not([data-icon-name='file-tree-icon-chevron'])) {
1787
+ color: var(--trees-item-git-status-color);
1788
+ }
1789
+ & > [data-item-section='content'] {
1790
+ color: var(--trees-item-git-status-color);
1791
+ }
1792
+ & > [data-item-section='git'] {
1793
+ color: var(--trees-item-git-status-color);
1794
+ font-weight: var(--trees-font-weight-semibold);
1795
+ }
1796
+ }
1797
+
1798
+ [data-item-git-status='added'] {
1799
+ --trees-item-git-status-color: var(--trees-git-added-color);
1800
+ }
1801
+
1802
+ [data-item-git-status='deleted'] {
1803
+ --trees-item-git-status-color: var(--trees-git-deleted-color);
1804
+ }
1805
+
1806
+ [data-item-git-status='ignored'] {
1807
+ --trees-item-git-status-color: var(--trees-git-ignored-color);
1808
+
1809
+ & > [data-item-section='icon'] {
1810
+ opacity: 0.5;
1811
+ }
1812
+ }
1813
+
1814
+ [data-item-section='git'] [data-icon-name='file-tree-icon-dot'] {
1815
+ /* this is a nudge to align the dot with the likely lowercase text. it's slightly
1816
+ generalizable, but other fonts are gonna need other nudges i assume */
1817
+ transform: translateY(calc(0.65ex - 50%));
1818
+ }
1819
+
1820
+ [data-item-git-status='modified'] {
1821
+ --trees-item-git-status-color: var(--trees-git-modified-color);
1822
+ }
1823
+
1824
+ [data-item-git-status='renamed'] {
1825
+ --trees-item-git-status-color: var(--trees-git-renamed-color);
1826
+ }
1827
+
1828
+ [data-item-git-status='untracked'] {
1829
+ --trees-item-git-status-color: var(--trees-git-untracked-color);
1830
+ }
1831
+
1832
+ /* Drag and drop */
1833
+ [data-item-drag-target='true'] {
1834
+ background-color: var(--trees-selected-bg);
1835
+ }
1836
+
1837
+ [data-item-dragging='true'] {
1838
+ opacity: 0.5;
1839
+ }
1840
+
1841
+ /* Lock icon for locked paths (sibling of content) */
1842
+ [data-item-section='lock'] {
1843
+ flex: 0 0 auto;
1844
+ margin-left: auto;
1845
+ display: flex;
1846
+ align-items: center;
1847
+ color: var(--trees-fg-muted);
1848
+ }
1849
+ [data-item-section='lock'] svg {
1850
+ display: block;
1851
+ }
1852
+
1853
+ [data-type='header-slot'] {
1854
+ display: block;
1855
+ flex: 0 0 auto;
1856
+ }
1857
+
1858
+ [data-type='context-menu-wash'] {
1859
+ position: absolute;
1860
+ inset: 0;
1861
+ z-index: 3;
1862
+ background-color: transparent;
1863
+ touch-action: none;
1864
+ }
1865
+
1866
+ [data-type='context-menu-anchor'] {
1867
+ position: absolute;
1868
+ top: 0;
1869
+ right: var(--trees-context-menu-trigger-inline-offset);
1870
+ z-index: 4;
1871
+ display: none;
1872
+ align-items: center;
1873
+
1874
+ &[data-visible='true'] {
1875
+ display: flex;
1876
+ }
1877
+ }
1878
+
1879
+ /* Hide the floating trigger while the scroll container is actively moving.
1880
+ * The anchor is positioned against the root, not the scroll content, so its
1881
+ * \`top\` follows the row via a React state update — one frame behind the
1882
+ * compositor. That delay is visible as the trigger hovering over the wrong
1883
+ * row during the first frame of a scroll. The \`data-is-scrolling\` flag on
1884
+ * the root is flipped synchronously on \`wheel\`/\`touchmove\`/\`keydown\` before
1885
+ * the compositor commits the next paint, so this selector hides the anchor
1886
+ * in the same frame the scroll begins. */
1887
+ [data-file-tree-virtualized-root='true'][data-is-scrolling]
1888
+ [data-type='context-menu-anchor'] {
1889
+ display: none;
1890
+ }
1891
+
1892
+ [data-type='context-menu-anchor'] > slot[name='context-menu'] {
1893
+ display: block;
1894
+ width: 0;
1895
+ min-width: 0;
1896
+ flex: 0 0 0;
1897
+ overflow: visible;
1898
+ }
1899
+
1900
+ /* Single floating context menu trigger */
1901
+ [data-type='context-menu-trigger'] {
1902
+ all: unset;
1903
+ align-items: center;
1904
+ justify-content: center;
1905
+ width: var(--trees-action-lane-width);
1906
+ color: var(--trees-fg-muted);
1907
+ fill: currentColor;
1908
+ cursor: pointer;
1909
+ font-family: var(--trees-font-family);
1910
+ font-size: var(--trees-font-size);
1911
+ border-top-right-radius: var(--trees-border-radius);
1912
+ border-bottom-right-radius: var(--trees-border-radius);
1913
+ margin: var(--trees-focus-ring-width);
1914
+ height: calc(var(--trees-row-height) - var(--trees-focus-ring-width) * 2);
1915
+ border-width: 0;
1916
+ transition: color 120ms ease;
1917
+
1918
+ display: flex;
1919
+ }
1920
+
1921
+ [data-type='context-menu-trigger']:hover,
1922
+ [data-type='context-menu-trigger'][aria-expanded='true'] {
1923
+ color: var(--trees-fg);
1924
+ }
1925
+
1926
+ /** @pierre/truncate css here, manually copy pasted for now */
1927
+ [data-truncate-container] {
1928
+ /* CUSTOM TO TREES, TO SUPPORT THE OUTLINE */
1929
+ margin-top: -1px;
1930
+ margin-bottom: -1px;
1931
+
1932
+ /* Width of the fade from default marker to text */
1933
+ --truncate-internal-marker-fade-width: var(
1934
+ --truncate-marker-fade-width,
1935
+ 2px
1936
+ );
1937
+ /* Width of the solid color between the fade from the default marker to the text */
1938
+ --truncate-internal-marker-gap: var(--truncate-marker-gap, 0px);
1939
+ /* Opacity of the marker 'color' property, not of the element itself */
1940
+ --truncate-internal-marker-opacity: var(--truncate-marker-opacity, 50%);
1941
+ /* Opacity of the marker 'color' property specifically for the middle truncate, not opacity of the element itself */
1942
+ --truncate-internal-middle-marker-opacity: var(
1943
+ --truncate-middle-marker-opacity,
1944
+ 80%
1945
+ );
1946
+ /* Background color of the default marker */
1947
+ --truncate-internal-marker-background-color: var(
1948
+ --truncate-marker-background-color,
1949
+ light-dark(white, black)
1950
+ );
1951
+ --truncate-internal-marker-background-overlay-color: var(
1952
+ --truncate-marker-background-overlay-color,
1953
+ transparent
1954
+ );
1955
+ --truncate-internal-marker-block-inset: var(
1956
+ --truncate-marker-block-inset,
1957
+ 0px
1958
+ );
1959
+ /* Duration of the fade out animation for the marker */
1960
+ --truncate-internal-marker-fade-out-duration: var(
1961
+ --truncate-marker-fade-out-duration,
1962
+ 0ms
1963
+ );
1964
+ /* Duration of the fade in animation for the marker */
1965
+ --truncate-internal-marker-fade-in-duration: var(
1966
+ --truncate-marker-fade-in-duration,
1967
+ 100ms
1968
+ );
1969
+
1970
+ /* FADE Variant specifics */
1971
+ --truncate-internal-fade-marker-color: var(
1972
+ --truncate-fade-marker-color,
1973
+ #000
1974
+ );
1975
+ --truncate-internal-fade-marker-width: var(
1976
+ --truncate-fade-marker-width,
1977
+ 0.2lh
1978
+ );
1979
+
1980
+ /*
1981
+ In some special cases people might be adding spacing in other ways
1982
+ that would benefit from being able to override this, however the container
1983
+ query below can't use this and would need to be redeclared with the overridden
1984
+ value. It's a bad time, but better than nothing.
1985
+ */
1986
+ --truncate-internal-single-line-height: 1lh;
1987
+
1988
+ height: var(--truncate-internal-single-line-height);
1989
+ min-width: 0;
1990
+ overflow: hidden;
1991
+ }
1992
+
1993
+ [data-truncate-marker] {
1994
+ display: flex;
1995
+ position: absolute;
1996
+ height: var(--truncate-internal-single-line-height);
1997
+ padding-block: var(--truncate-internal-marker-block-inset);
1998
+ box-sizing: border-box;
1999
+ align-items: center;
2000
+ background-clip: content-box;
2001
+ z-index: 2;
2002
+ color: color-mix(
2003
+ in srgb,
2004
+ currentColor var(--truncate-internal-marker-opacity),
2005
+ transparent
2006
+ );
2007
+
2008
+ /* Core trick for hiding the marker until overflow occurs */
2009
+ opacity: 0;
2010
+ transition: opacity var(--truncate-internal-marker-fade-out-duration)
2011
+ ease-in-out;
2012
+ }
2013
+
2014
+ @container measure (height > 1lh) {
2015
+ [data-truncate-marker] {
2016
+ opacity: 1;
2017
+ transition: opacity var(--truncate-internal-marker-fade-in-duration)
2018
+ ease-in-out;
2019
+ }
2020
+ }
2021
+
2022
+ [data-truncate-grid] {
2023
+ display: grid;
2024
+ position: relative;
2025
+ }
2026
+
2027
+ [data-truncate-content='visible'] {
2028
+ white-space: nowrap;
2029
+ }
2030
+
2031
+ [data-truncate-content='overflow'] {
2032
+ opacity: 0;
2033
+ pointer-events: none;
2034
+ -webkit-user-select: none;
2035
+ user-select: none;
2036
+ word-break: break-all;
2037
+ margin-top: calc(-1 * var(--truncate-internal-single-line-height));
2038
+ }
2039
+
2040
+ [data-truncate-marker-cell] {
2041
+ container: measure / size;
2042
+ overflow: visible;
2043
+ -webkit-user-select: none;
2044
+ user-select: none;
2045
+ pointer-events: none;
2046
+ }
2047
+
2048
+ [data-truncate-container='truncate'] {
2049
+ & [data-truncate-grid] {
2050
+ grid-template-columns: minmax(0, max-content) 0;
2051
+ }
2052
+ & [data-truncate-marker] {
2053
+ right: 0;
2054
+ }
2055
+ & [data-truncate-fade] {
2056
+ margin-right: calc(-2 * var(--truncate-internal-fade-marker-width));
2057
+ }
2058
+ }
2059
+
2060
+ [data-truncate-container='fruncate'] {
2061
+ & [data-truncate-grid] {
2062
+ grid-template-columns: 0 minmax(0, max-content) auto;
2063
+ }
2064
+ & [data-truncate-content] {
2065
+ direction: rtl;
2066
+ }
2067
+ & [data-truncate-content] > span {
2068
+ unicode-bidi: plaintext;
2069
+ }
2070
+ & [data-truncate-fade] {
2071
+ margin-left: calc(-2 * var(--truncate-internal-fade-marker-width));
2072
+ }
2073
+ }
2074
+
2075
+ [data-truncate-variant='default'] {
2076
+ & [data-truncate-marker] {
2077
+ background-color: var(--truncate-internal-marker-background-color);
2078
+ background-image: linear-gradient(
2079
+ var(--truncate-internal-marker-background-overlay-color),
2080
+ var(--truncate-internal-marker-background-overlay-color)
2081
+ );
2082
+ }
2083
+ & [data-truncate-marker]::after,
2084
+ & [data-truncate-marker]::before {
2085
+ content: '';
2086
+ position: absolute;
2087
+ width: calc(
2088
+ var(--truncate-internal-marker-fade-width) +
2089
+ var(--truncate-internal-marker-gap)
2090
+ );
2091
+ inset-block-start: var(--truncate-internal-marker-block-inset);
2092
+ height: max(
2093
+ 0px,
2094
+ calc(
2095
+ var(--truncate-internal-single-line-height) -
2096
+ var(--truncate-internal-marker-block-inset) * 2
2097
+ )
2098
+ );
2099
+ background-color: var(--truncate-internal-marker-background-color);
2100
+ background-image: linear-gradient(
2101
+ var(--truncate-internal-marker-background-overlay-color),
2102
+ var(--truncate-internal-marker-background-overlay-color)
2103
+ );
2104
+ mask-image: linear-gradient(
2105
+ var(--truncate-internal-fade-dir),
2106
+ #000 0%,
2107
+ #000 var(--truncate-internal-marker-gap),
2108
+ transparent 100%
2109
+ );
2110
+ }
2111
+ & [data-truncate-marker]::after {
2112
+ --truncate-internal-fade-dir: to right;
2113
+ right: calc(
2114
+ -1 *
2115
+ (
2116
+ var(--truncate-internal-marker-fade-width) +
2117
+ var(--truncate-internal-marker-gap)
2118
+ )
2119
+ );
2120
+ }
2121
+ & [data-truncate-marker]::before {
2122
+ --truncate-internal-fade-dir: to left;
2123
+ left: calc(
2124
+ -1 *
2125
+ (
2126
+ var(--truncate-internal-marker-fade-width) +
2127
+ var(--truncate-internal-marker-gap)
2128
+ )
2129
+ );
2130
+ }
2131
+ }
2132
+
2133
+ [data-truncate-variant='fade'] {
2134
+ & [data-truncate-marker] {
2135
+ background: transparent;
2136
+ }
2137
+ }
2138
+
2139
+ [data-truncate-fade] {
2140
+ box-shadow:
2141
+ 0 0 calc(var(--truncate-internal-fade-marker-width) / 2)
2142
+ var(--truncate-internal-fade-marker-color),
2143
+ 0 0 var(--truncate-internal-fade-marker-width)
2144
+ var(--truncate-internal-fade-marker-color);
2145
+ width: calc(var(--truncate-internal-fade-marker-width) * 2);
2146
+ height: calc(
2147
+ var(--truncate-internal-single-line-height) -
2148
+ (var(--truncate-internal-fade-marker-width) * 2)
2149
+ );
2150
+ margin: var(--truncate-internal-fade-marker-width) 0;
2151
+ }
2152
+
2153
+ [data-truncate-group-container='middle'] {
2154
+ & [data-truncate-container] {
2155
+ --truncate-marker-opacity: var(--truncate-internal-middle-marker-opacity);
2156
+ }
2157
+
2158
+ display: flex;
2159
+ min-width: 0;
2160
+
2161
+ & > div {
2162
+ min-width: 0;
2163
+ }
2164
+
2165
+ & > div[data-truncate-segment-priority='1'] {
2166
+ flex: 0 1 max-content;
2167
+ }
2168
+ & > div[data-truncate-segment-priority='2'] {
2169
+ flex: 0 999999 max-content;
2170
+ }
2171
+ }
2172
+ }
2173
+ `,ao=`@layer base, unsafe;`;function oo(e){return`${ao}
2174
+ @layer base {
2175
+ ${e}
2176
+ }`}function so(e){return`${ao}
2177
+ @layer unsafe {
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=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;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=`
2180
+ :host {
2181
+ --trees-bg-override: transparent;
2182
+ --trees-selected-bg-override: color-mix(in srgb, currentColor 12%, transparent);
2183
+ --trees-hover-bg-override: color-mix(in srgb, currentColor 7%, transparent);
2184
+ --trees-border-color-override: color-mix(in srgb, currentColor 14%, transparent);
2185
+ --trees-font-family-override: var(--font-sans);
2186
+ --trees-font-size-override: 12px;
2187
+ }
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=`
2190
+ ${de}
2191
+
2192
+ diffs-container {
2193
+ --diffs-bg: var(--code-background, var(--background)) !important;
2194
+ --diffs-light-bg: var(--code-background, var(--background)) !important;
2195
+ --diffs-dark-bg: var(--code-background, var(--background)) !important;
2196
+ background-color: var(--code-background, var(--background)) !important;
2197
+ color: var(--code-foreground, var(--foreground)) !important;
2198
+ }
2199
+
2200
+ [${mh}][data-line] {
2201
+ background-color: light-dark(
2202
+ color-mix(
2203
+ in lab,
2204
+ var(--diffs-computed-diff-line-bg) 82%,
2205
+ var(--diffs-bg-selection-override, var(--diffs-selection-base))
2206
+ ),
2207
+ color-mix(
2208
+ in lab,
2209
+ var(--diffs-computed-diff-line-bg) 75%,
2210
+ var(--diffs-bg-selection-override, var(--diffs-selection-base))
2211
+ )
2212
+ ) !important;
2213
+ }
2214
+
2215
+ [${mh}][data-column-number] {
2216
+ background-color: light-dark(
2217
+ color-mix(
2218
+ in lab,
2219
+ var(--diffs-computed-diff-line-bg) 75%,
2220
+ var(--diffs-bg-selection-number-override, var(--diffs-selection-base))
2221
+ ),
2222
+ color-mix(
2223
+ in lab,
2224
+ var(--diffs-computed-diff-line-bg) 60%,
2225
+ var(--diffs-bg-selection-number-override, var(--diffs-selection-base))
2226
+ )
2227
+ ) !important;
2228
+ color: var(--diffs-selection-number-fg) !important;
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(`
2231
+ `),e.baseContents.split(`
2232
+ `),e.currentContents.split(`
2233
+ `),{excludeFalseConflicts:!0});return{contents:t.flatMap(e=>e.ok??[]).join(`
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
+ `);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-DkspqFyX.js.map