@inkeep/open-knowledge 0.46.0-beta.6 → 0.46.0-beta.8

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 (526) hide show
  1. package/dist/THIRD_PARTY_NOTICES.md +10 -0
  2. package/dist/{acp-harness-probe-Bhr8FI29.mjs → acp-harness-probe-4DjqrOhu.mjs} +2 -2
  3. package/dist/assets/skills/discovery/SKILL.md +1 -2
  4. package/dist/assets/skills/packs/codebase-wiki/SKILL.md +6 -7
  5. package/dist/assets/skills/packs/codebase-wiki/references/generate-and-refresh.md +160 -0
  6. package/dist/assets/skills/packs/entity-vault/SKILL.md +2 -3
  7. package/dist/assets/skills/packs/knowledge-base/SKILL.md +26 -9
  8. package/dist/assets/skills/packs/knowledge-base/consolidate/SKILL.md +160 -0
  9. package/dist/assets/skills/packs/knowledge-base/research/SKILL.md +375 -0
  10. package/dist/assets/skills/packs/okf/SKILL.md +2 -3
  11. package/dist/assets/skills/packs/plain-notes/SKILL.md +4 -3
  12. package/dist/assets/skills/packs/software-lifecycle/SKILL.md +14 -3
  13. package/dist/assets/skills/packs/software-lifecycle/frame-a-proposal/SKILL.md +222 -0
  14. package/dist/assets/skills/packs/software-lifecycle/record-a-decision/SKILL.md +188 -0
  15. package/dist/assets/skills/packs/software-lifecycle/review-a-design/SKILL.md +137 -0
  16. package/dist/assets/skills/packs/software-lifecycle/write-a-postmortem/SKILL.md +202 -0
  17. package/dist/assets/skills/packs/software-lifecycle/write-a-spec/SKILL.md +298 -0
  18. package/dist/assets/skills/packs/worldbuilding/SKILL.md +2 -3
  19. package/dist/assets/skills/packs/writing-pipeline/SKILL.md +5 -3
  20. package/dist/assets/skills/project/SKILL.md +29 -30
  21. package/dist/assets/skills/project/references/anti-patterns.md +1 -1
  22. package/dist/assets/skills/project/references/corpus-qa.md +1 -1
  23. package/dist/assets/skills/project/references/folder-model.md +1 -1
  24. package/dist/assets/skills/project/references/ingest-and-sources.md +230 -13
  25. package/dist/assets/skills/project/references/onboard-existing-repo.md +319 -0
  26. package/dist/assets/skills/project/references/preview.md +1 -1
  27. package/dist/assets/skills/project/references/setup.md +6 -0
  28. package/dist/assets/skills/project/references/starter-packs.md +41 -0
  29. package/dist/assets/skills/write-skill/SKILL.md +69 -28
  30. package/dist/assets/skills/write-skill/references/pressure-testing.md +4 -3
  31. package/dist/cli.mjs +62 -62
  32. package/dist/constants-GWFx-UC8.mjs +2 -0
  33. package/dist/{git-handle-CK_JXuyw.mjs → git-handle-CUCj-M_k.mjs} +2 -2
  34. package/dist/git-handle-c0ljFZis.mjs +1 -0
  35. package/dist/index.mjs +1 -1
  36. package/dist/{init-DoPgyAbZ.mjs → init-DWCsIT2Y.mjs} +37 -37
  37. package/dist/init-ZV2BMIkj.mjs +1 -0
  38. package/dist/{launch-json-removal-iD7o5ZhH.mjs → launch-json-removal-BCxhJz-M.mjs} +2 -2
  39. package/dist/{loader-doXjfQUX.mjs → loader-84N4YMxM.mjs} +2 -2
  40. package/dist/loader-gOaiaXCo.mjs +1 -0
  41. package/dist/md-manager-usiCjUg4.mjs +2 -0
  42. package/dist/{open-browser-BHXl6F9O.mjs → open-browser-D-fJ9iwf.mjs} +2 -2
  43. package/dist/parse-worker.mjs +1 -1
  44. package/dist/{preview-C67jEM8C.mjs → preview-Ce0jIM-0.mjs} +2 -2
  45. package/dist/preview-TJlA1vTS.mjs +1 -0
  46. package/dist/public/assets/ActivityModeContent-DwfZoDZE.js +1 -0
  47. package/dist/public/assets/{AgentDiffPane-6bk9bV9U.js → AgentDiffPane-BwPzooAs.js} +2 -2
  48. package/dist/public/assets/{AgentThreadClientBinder-u3ZVSSHE.js → AgentThreadClientBinder-Lk-U9Zg5.js} +1 -1
  49. package/dist/public/assets/AppMenubar-7eBxIB37.js +1 -0
  50. package/dist/public/assets/{BugReportHistory-D_60pb7r.js → BugReportHistory-CaAYnGNR.js} +1 -1
  51. package/dist/public/assets/{BugReportHistoryDialog-BzJsPoev.js → BugReportHistoryDialog-DFfft492.js} +1 -1
  52. package/dist/public/assets/ChangedOutsideBadge-Colj6RSy.js +1 -0
  53. package/dist/public/assets/CodeMirrorPropInput-BPdsBH1q.js +3 -0
  54. package/dist/public/assets/{ConfigSharingInfoTooltip-BMJ7SIjf.js → ConfigSharingInfoTooltip-QTCODx7g.js} +1 -1
  55. package/dist/public/assets/{ConsentDialogBody-DWXqUhzJ.js → ConsentDialogBody-U4UzjnaQ.js} +1 -1
  56. package/dist/public/assets/CopyButton-O0Y9mXoH.js +1 -0
  57. package/dist/public/assets/DiffView-kKTjtgKq.js +3 -0
  58. package/dist/public/assets/DocumentContext-e2BbWZTU.js +38 -0
  59. package/dist/public/assets/EditorModeToggle-DLKntrL5.js +2 -0
  60. package/dist/public/assets/EnableSyncConfirmDialog-B7V1Wevc.js +1 -0
  61. package/dist/public/assets/FeedbackForm-YYOLAdPR.js +1 -0
  62. package/dist/public/assets/{GraphPanel-DZMLD8ni.js → GraphPanel-D3gnL5o6.js} +2 -2
  63. package/dist/public/assets/ImportSkillDialog-BNwWAA09.js +1 -0
  64. package/dist/public/assets/{LintConfigEditor-k9WOKYkq.js → LintConfigEditor-BUt6XicS.js} +1 -1
  65. package/dist/public/assets/ManagedArtifactProperties-3CrCQfFo.js +2 -0
  66. package/dist/public/assets/ManagedArtifactProperties-DK6O07ZX.js +1 -0
  67. package/dist/public/assets/McpConsentDialogBody-CTl5E-Pz.js +1 -0
  68. package/dist/public/assets/{MermaidDocEditor-CGsfhioE.js → MermaidDocEditor-rdCH3a-W.js} +1 -1
  69. package/dist/public/assets/{RegisteredAgentIcon-CyQDojW_.js → RegisteredAgentIcon-CHh3fima.js} +1 -1
  70. package/dist/public/assets/{ReportBugDialogBody-CdEV6nCR.js → ReportBugDialogBody-DfS6oBiL.js} +1 -1
  71. package/dist/public/assets/SchemaConfigEditor-DaRdC9By.js +1 -0
  72. package/dist/public/assets/SettingsDialogBody-JKJ7DbBe.js +7 -0
  73. package/dist/public/assets/{ShareBranchSwitchDialog-jGb4KF7T.js → ShareBranchSwitchDialog-BT-R1a5Z.js} +1 -1
  74. package/dist/public/assets/ShareReceiveDialog-D7WQ4KbX.js +1 -0
  75. package/dist/public/assets/ShareReceiveMissDialog-AS-ub3Fc.js +1 -0
  76. package/dist/public/assets/SkillEditBanner-DPe0it-V.js +1 -0
  77. package/dist/public/assets/SkillModeBanner-CsKHM-QY.js +1 -0
  78. package/dist/public/assets/SkillOriginInline-VUn5IDZk.js +1 -0
  79. package/dist/public/assets/SkillToolbarControls-CzJ4nZzA.js +1 -0
  80. package/dist/public/assets/SourceEditor-C-cUCtJw.js +1 -0
  81. package/dist/public/assets/{TerminalPanel-BHN2VN4r.js → TerminalPanel-yzvzgUXS.js} +3 -3
  82. package/dist/public/assets/TerminalSessionsHost-dj1xA_0P.js +2 -0
  83. package/dist/public/assets/{TerminalWindowApp-CntBjoWb.js → TerminalWindowApp-B6EhrqIb.js} +1 -1
  84. package/dist/public/assets/ThreadView-aANZPCSh.js +6 -0
  85. package/dist/public/assets/TimelineDiffPane-u9qtPOhN.js +2 -0
  86. package/dist/public/assets/{abnfDiagram-VRR7QNED-Cyah47m9.js → abnfDiagram-VRR7QNED-CYyOqigz.js} +1 -1
  87. package/dist/public/assets/agent-diff-store-DKxdS6mK.js +1 -0
  88. package/dist/public/assets/agent-visibility-Dz2lrJHw.js +1 -0
  89. package/dist/public/assets/{arc-B3aheyNj.js → arc-DpnwTjlg.js} +1 -1
  90. package/dist/public/assets/architecture-TIHT7OUA-Bl7-zFAE.js +1 -0
  91. package/dist/public/assets/{architectureDiagram-ZJ3FMSHR-lZYHIfAt.js → architectureDiagram-ZJ3FMSHR-BArScuNA.js} +1 -1
  92. package/dist/public/assets/arrow-up-right-BZsQghvQ.js +1 -0
  93. package/dist/public/assets/auth-state-cache-C9Qx3bjQ.js +11 -0
  94. package/dist/public/assets/badge-DB5BJfSU.js +1 -0
  95. package/dist/public/assets/{blockDiagram-677ZJIJ3-mULu-3uH.js → blockDiagram-677ZJIJ3-BKdJnykw.js} +1 -1
  96. package/dist/public/assets/{braces-DwnwFx_V.js → braces-CqiL3TOP.js} +1 -1
  97. package/dist/public/assets/button-oSXzJYWO.js +1 -0
  98. package/dist/public/assets/{c4Diagram-LMCZKHZV-DN4YpCzk.js → c4Diagram-LMCZKHZV-BGzHBzYq.js} +1 -1
  99. package/dist/public/assets/{calendar-DqGTQwGe.js → calendar-C2lP75MI.js} +1 -1
  100. package/dist/public/assets/{case-sensitive-nl0tWMnZ.js → case-sensitive-DcowXaLf.js} +1 -1
  101. package/dist/public/assets/channel-Bf_IZmsH.js +1 -0
  102. package/dist/public/assets/check-DA7_vRdO.js +1 -0
  103. package/dist/public/assets/checkbox-DYPwCq3O.js +1 -0
  104. package/dist/public/assets/{chevron-down-Bx9f3tW-.js → chevron-down-BJumc1E_.js} +1 -1
  105. package/dist/public/assets/chevron-left-D8z-buF6.js +1 -0
  106. package/dist/public/assets/chevron-right-CgsPV9lV.js +1 -0
  107. package/dist/public/assets/chunk-2Q5K7J3B-CBNXZghD.js +1 -0
  108. package/dist/public/assets/{chunk-32BRIVSS-DqkgLIEw.js → chunk-32BRIVSS-DWFi-mYl.js} +1 -1
  109. package/dist/public/assets/{chunk-52WLFC77-9s8UsQXp.js → chunk-52WLFC77-C3ewIu0v.js} +1 -1
  110. package/dist/public/assets/{chunk-5FCAYU7R-CkSFjjQr.js → chunk-5FCAYU7R-DH0H_TSt.js} +1 -1
  111. package/dist/public/assets/{chunk-5HE753X5-C1Ig4mMr.js → chunk-5HE753X5-COZLeOUQ.js} +1 -1
  112. package/dist/public/assets/{chunk-5JV3BV7I-CIggZV0d.js → chunk-5JV3BV7I-BtSn9e5l.js} +1 -1
  113. package/dist/public/assets/{chunk-5TONJI2A-BklATmUd.js → chunk-5TONJI2A-CyVAUHQY.js} +1 -1
  114. package/dist/public/assets/{chunk-5VM5RSS4-g5HeYq-z.js → chunk-5VM5RSS4-DkfDxTnu.js} +1 -1
  115. package/dist/public/assets/{chunk-7BUUIJ7U-Dw__VSpN.js → chunk-7BUUIJ7U-Bwj5weSU.js} +1 -1
  116. package/dist/public/assets/{chunk-BIQX33UG-CRLx_yn0.js → chunk-BIQX33UG-WShnA3hi.js} +1 -1
  117. package/dist/public/assets/{chunk-BO2N2NFS-BptiXfus.js → chunk-BO2N2NFS-0fL-jnUT.js} +4 -4
  118. package/dist/public/assets/{chunk-C7G6YPKG-CmP7ozUj.js → chunk-C7G6YPKG-JOVwaeql.js} +1 -1
  119. package/dist/public/assets/{chunk-CQNSW5MT-BZUHEMrz.js → chunk-CQNSW5MT-DmFd2LFl.js} +1 -1
  120. package/dist/public/assets/{chunk-CYSBUYHQ-BRTRwmYZ.js → chunk-CYSBUYHQ-BOCWcr_T.js} +1 -1
  121. package/dist/public/assets/{chunk-EMLP6XTP-DHUO1B6Q.js → chunk-EMLP6XTP-_039-Ubh.js} +1 -1
  122. package/dist/public/assets/{chunk-EX3LRPZG-aq_XJzX2.js → chunk-EX3LRPZG-CMgFCagr.js} +1 -1
  123. package/dist/public/assets/{chunk-FWX5IMBZ-rnR9hrS_.js → chunk-FWX5IMBZ-C4vKCoUv.js} +2 -2
  124. package/dist/public/assets/{chunk-HOUHSVGY-D0096-9K.js → chunk-HOUHSVGY-CZX004Ef.js} +1 -1
  125. package/dist/public/assets/{chunk-ICXQ74PX-BUnmDgqa.js → chunk-ICXQ74PX-B_iuJAXS.js} +1 -1
  126. package/dist/public/assets/{chunk-JG7HCLWE-BwRUs0j6.js → chunk-JG7HCLWE-CtDpq51e.js} +1 -1
  127. package/dist/public/assets/{chunk-JWPE2WC7-BOwE-mq8.js → chunk-JWPE2WC7-pDBBV-ex.js} +1 -1
  128. package/dist/public/assets/{chunk-MOJQB5TN-CYyw3U64.js → chunk-MOJQB5TN-BOLftHeO.js} +1 -1
  129. package/dist/public/assets/{chunk-MOZMSUNE-_aAOLW1j.js → chunk-MOZMSUNE-B90rFhRO.js} +1 -1
  130. package/dist/public/assets/{chunk-OGEWGWER-DLH_3q-Z.js → chunk-OGEWGWER-dIUHPavN.js} +1 -1
  131. package/dist/public/assets/{chunk-OSBZ3O6U-BOkYzK-N.js → chunk-OSBZ3O6U-C8f7zxUa.js} +1 -1
  132. package/dist/public/assets/{chunk-PUDLZKDR-Co9OjZVi.js → chunk-PUDLZKDR-QPYzmUFw.js} +1 -1
  133. package/dist/public/assets/{chunk-Q4XR5HBZ-CjNiHUWo.js → chunk-Q4XR5HBZ--1adMSrR.js} +1 -1
  134. package/dist/public/assets/{chunk-QBLGF6JB-Cf-f1lin.js → chunk-QBLGF6JB-q87mQ87z.js} +1 -1
  135. package/dist/public/assets/{chunk-R7FJI6CG-C_nyMdyL.js → chunk-R7FJI6CG-B5NnR0wG.js} +1 -1
  136. package/dist/public/assets/{chunk-RYQCIY6F-DXXN4Rzo.js → chunk-RYQCIY6F-BnIBPlEn.js} +1 -1
  137. package/dist/public/assets/{chunk-U6XO7XAA-Hw5M1kkd.js → chunk-U6XO7XAA-DuxWv8i1.js} +1 -1
  138. package/dist/public/assets/{chunk-V7JOEXUC-CLdet7qK.js → chunk-V7JOEXUC-zQePb8W4.js} +1 -1
  139. package/dist/public/assets/chunk-VAUOI2AC-K9aKY8La.js +1 -0
  140. package/dist/public/assets/{chunk-VR4S4FIN-CnZ3Jw81.js → chunk-VR4S4FIN-DOfDyz67.js} +1 -1
  141. package/dist/public/assets/{chunk-WYO6CB5R-C-c-Ja6D.js → chunk-WYO6CB5R-DAcO6KqN.js} +2 -2
  142. package/dist/public/assets/chunk-XXDRQBXY-CRN6FsNM.js +1 -0
  143. package/dist/public/assets/{chunk-YOTPTUD7-CBowI675.js → chunk-YOTPTUD7-DSjCnGGQ.js} +1 -1
  144. package/dist/public/assets/{chunk-ZGVPDNZ5-DfBSa8vW.js → chunk-ZGVPDNZ5-CnXHsnX3.js} +1 -1
  145. package/dist/public/assets/{chunk-ZIRB5QZD-Cas2Em51.js → chunk-ZIRB5QZD-rA251rHW.js} +1 -1
  146. package/dist/public/assets/classDiagram-OUVF2IWQ-B8NyhReL.js +1 -0
  147. package/dist/public/assets/classDiagram-v2-EOCWNBFH-To5zrK6k.js +1 -0
  148. package/dist/public/assets/client-version-DmJhhHKP.js +1 -0
  149. package/dist/public/assets/collapsible-BTn3nxAn.js +1 -0
  150. package/dist/public/assets/{comment-chips-BYH7v5tl.js → comment-chips-i9o0Cefh.js} +2 -2
  151. package/dist/public/assets/{config-provider-B9kQH9zn.js → config-provider-CYJIA2qw.js} +2 -2
  152. package/dist/public/assets/{cose-bilkent-JH36ORCC-CzZaHQ2l.js → cose-bilkent-JH36ORCC-BO3tFb1k.js} +1 -1
  153. package/dist/public/assets/createLucideIcon-BiRV80uZ.js +1 -0
  154. package/dist/public/assets/cynefin-VYW2F7L2-DjK3ZZKp.js +1 -0
  155. package/dist/public/assets/{cynefinDiagram-TSTJHNR4-7PYslCmH.js → cynefinDiagram-TSTJHNR4-kMgUnu_c.js} +1 -1
  156. package/dist/public/assets/{dagre-BeM31D08.js → dagre-DmGue-PX.js} +1 -1
  157. package/dist/public/assets/{dagre-VKFMJZFB-DsY-o9S9.js → dagre-VKFMJZFB-CgYSDfeg.js} +1 -1
  158. package/dist/public/assets/{diagram-FQU43EPY-Cc40Oq-m.js → diagram-FQU43EPY-XRWiX7Im.js} +1 -1
  159. package/dist/public/assets/{diagram-G47NLZAW-DdbiGkJk.js → diagram-G47NLZAW-BzqAYczi.js} +1 -1
  160. package/dist/public/assets/{diagram-NH7WQ7WH-BoEA_7qN.js → diagram-NH7WQ7WH-CAOpGCwL.js} +1 -1
  161. package/dist/public/assets/{diagram-OA4YK3LP-ChsGI8c4.js → diagram-OA4YK3LP-CsYFi60N.js} +1 -1
  162. package/dist/public/assets/{diagram-WEI45ONY-znZ94tAq.js → diagram-WEI45ONY-BPyyv8e3.js} +1 -1
  163. package/dist/public/assets/dialog-CkjkuWLF.js +5 -0
  164. package/dist/public/assets/dist-1J1E9P12.js +1 -0
  165. package/dist/public/assets/{dist-D7mv9smG.js → dist-6Q9yuoli.js} +1 -1
  166. package/dist/public/assets/dist-BCIZY0Wq.js +1 -0
  167. package/dist/public/assets/{dist-Dcu3hl7e.js → dist-BK-fqCFD.js} +1 -1
  168. package/dist/public/assets/{dist-DEamjSXE.js → dist-BM4ov2mK.js} +1 -1
  169. package/dist/public/assets/dist-BVNHmhkE.js +1 -0
  170. package/dist/public/assets/{dist-B25wDFyk.js → dist-Bdhn2jv42.js} +1 -1
  171. package/dist/public/assets/{dist-P9LB04An.js → dist-BkSGIgDv.js} +1 -1
  172. package/dist/public/assets/dist-C22Eiu6U.js +1 -0
  173. package/dist/public/assets/{dist-CxGvJvCN.js → dist-C2ZNHEgX.js} +1 -1
  174. package/dist/public/assets/dist-CEBfbNax.js +1 -0
  175. package/dist/public/assets/{dist-Dolq1sN0.js → dist-CKHaw45-.js} +1 -1
  176. package/dist/public/assets/{dist-DlSSwTCj.js → dist-CTPwMRld.js} +1 -1
  177. package/dist/public/assets/{dist-DmIoqGC0.js → dist-D2AiGKcA.js} +1 -1
  178. package/dist/public/assets/dist-D57Bktz_.js +1 -0
  179. package/dist/public/assets/{dist-CsRIthsw2.js → dist-DA8rIjtg.js} +1 -1
  180. package/dist/public/assets/dist-DcPsSRVd.js +1 -0
  181. package/dist/public/assets/{dist-BMMI5Kdg.js → dist-Dqtgp0QD2.js} +1 -1
  182. package/dist/public/assets/dist-Dyi4atb6.js +1 -0
  183. package/dist/public/assets/{dist-DdFyq-YY.js → dist-FPlC48Ke.js} +1 -1
  184. package/dist/public/assets/{dist-C7VIqwIG.js → dist-MQd-Irtl.js} +1 -1
  185. package/dist/public/assets/{dist-C4Kl8QaT.js → dist-_8wb0R99.js} +1 -1
  186. package/dist/public/assets/{dist-DJbbCXtB.js → dist-fOA99pqU2.js} +184 -182
  187. package/dist/public/assets/doc-paths-C6A87aH3.js +1 -0
  188. package/dist/public/assets/documents-events-Dr9N-4vu.js +1 -0
  189. package/dist/public/assets/download-D3RTVXwv.js +1 -0
  190. package/dist/public/assets/dropdown-menu-D2umi56L.js +1 -0
  191. package/dist/public/assets/{ebnfDiagram-CCIWWBDH-DX6whEUG.js → ebnfDiagram-CCIWWBDH-CUTAjine.js} +1 -1
  192. package/dist/public/assets/{erDiagram-Q63AITRT-CgloxApp.js → erDiagram-Q63AITRT-BSu96D8g.js} +1 -1
  193. package/dist/public/assets/es2015-Du0OjwY5.js +41 -0
  194. package/dist/public/assets/{esm-QF0-_nlB.js → esm-DbmiTy2g.js} +1 -1
  195. package/dist/public/assets/eventmodeling-45OFAUF4-C3gCuhXd.js +1 -0
  196. package/dist/public/assets/{eye-CASw1HTi.js → eye-yERBaQWj.js} +1 -1
  197. package/dist/public/assets/field-i4kPdg1V.js +1 -0
  198. package/dist/public/assets/file-tree-adapter-CvmXjY-P.js +1 -0
  199. package/dist/public/assets/file-tree-utils-DL3JhHtX.js +1 -0
  200. package/dist/public/assets/flowDiagram-23GEKE2U-V8thnmzy.js +1 -0
  201. package/dist/public/assets/folder-8ceGqZIO.js +1 -0
  202. package/dist/public/assets/folder-config-api-DdtJAaIR.js +1 -0
  203. package/dist/public/assets/{folder-open-wLd69QUc.js → folder-open-CvyyCBOn.js} +1 -1
  204. package/dist/public/assets/follow-file-BpD8YozT.js +1 -0
  205. package/dist/public/assets/form-lIFpKMVU.js +1 -0
  206. package/dist/public/assets/{ganttDiagram-NO4QXBWP-BZQXYXPf.js → ganttDiagram-NO4QXBWP-Crrr-q7s.js} +1 -1
  207. package/dist/public/assets/{git-branch-CMJAiYLz.js → git-branch-oPfvsh1I.js} +1 -1
  208. package/dist/public/assets/gitGraph-TEB2WS4Q-BERn_Vnm.js +1 -0
  209. package/dist/public/assets/{gitGraphDiagram-IHSO6WYX-DnT15zfc.js → gitGraphDiagram-IHSO6WYX-BdMHODo-.js} +1 -1
  210. package/dist/public/assets/{globals-CdX3jOLC.js → globals-B5uVOYYT.js} +2 -2
  211. package/dist/public/assets/globals-C6R3KMxA.css +1 -0
  212. package/dist/public/assets/{graphlib-CIYGRnfF.js → graphlib-DIVfLvlR.js} +1 -1
  213. package/dist/public/assets/{hash-DNKDqZ18.js → hash-DP25l_li.js} +1 -1
  214. package/dist/public/assets/{highlighted-body-OFNGDK62-DN5QVB2g.js → highlighted-body-OFNGDK62-Cue0vPGT.js} +1 -1
  215. package/dist/public/assets/index-DoyHoCFU.js +2092 -0
  216. package/dist/public/assets/{info-yKMseklR.js → info-Bza7Xa6D.js} +1 -1
  217. package/dist/public/assets/info-DKCQHKI2-xuBgM0S3.js +1 -0
  218. package/dist/public/assets/{infoDiagram-FWYZ7A6U-CPJF9vn1.js → infoDiagram-FWYZ7A6U-_RNxdwPC.js} +1 -1
  219. package/dist/public/assets/input-C4n4n5Hc.js +1 -0
  220. package/dist/public/assets/input-group-C_H5NgPX.js +1 -0
  221. package/dist/public/assets/{ishikawaDiagram-FXEZZL3T-CPmyb7Oh.js → ishikawaDiagram-FXEZZL3T-BbXzN7UF.js} +1 -1
  222. package/dist/public/assets/{journeyDiagram-5HDEW3XC-DHsl5S9z.js → journeyDiagram-5HDEW3XC-BqwkEnJh.js} +1 -1
  223. package/dist/public/assets/{kanban-definition-HUTT4EX6-BS2xX-qh.js → kanban-definition-HUTT4EX6-CX-ROP0U.js} +1 -1
  224. package/dist/public/assets/{label-DyipnO5I.js → label-Ds0LTB-Z.js} +1 -1
  225. package/dist/public/assets/{line-PfwSO0Y4.js → line-D0lohJ6a.js} +1 -1
  226. package/dist/public/assets/{linear-DY7zcaob.js → linear-By98wvuz.js} +1 -1
  227. package/dist/public/assets/lint-config-client-Cc5n1dKz.js +1 -0
  228. package/dist/public/assets/loader-circle-Cn2Xr4cN.js +1 -0
  229. package/dist/public/assets/{map-B5g_BAkn.js → map-XagOZNs9.js} +1 -1
  230. package/dist/public/assets/markdownlint-rule-browser-C5r1T2gD.js +1 -0
  231. package/dist/public/assets/mermaid-GHXKKRXX-CFTslKYT.js +1 -0
  232. package/dist/public/assets/{mermaid-parser.core-DtiAO5KW.js → mermaid-parser.core-DtOR1aVt.js} +2 -2
  233. package/dist/public/assets/{mermaid.core-2-fa7F6R.js → mermaid.core-DFRkYHGF.js} +3 -3
  234. package/dist/public/assets/{mindmap-definition-LN4V7U3C-CTVrQgzc.js → mindmap-definition-LN4V7U3C-BPq8CY-V.js} +1 -1
  235. package/dist/public/assets/minus-CBRjUXY7.js +1 -0
  236. package/dist/public/assets/{miss-dialog-store-Bx4JLuKB.js → miss-dialog-store-DBqQ_Nyn.js} +1 -1
  237. package/dist/public/assets/navigation-targets-CgViVl5N.js +1 -0
  238. package/dist/public/assets/{now-bAD2ZsK-.js → now-BJ6wHiq6.js} +1 -1
  239. package/dist/public/assets/open-managed-artifact-tab-B9P9gMUF.js +1 -0
  240. package/dist/public/assets/{ordinal-Dj8tTCMd.js → ordinal-BhGTF2Fp.js} +1 -1
  241. package/dist/public/assets/packet-7NZHBO7P-DhQWKabl.js +1 -0
  242. package/dist/public/assets/panel-FwLLPu5s.js +1 -0
  243. package/dist/public/assets/{panel-right-open-CWgBRlZa.js → panel-right-open-ChixO1pm.js} +1 -1
  244. package/dist/public/assets/{paperclip-FiPqbd6f.js → paperclip-CFZOhV8C.js} +1 -1
  245. package/dist/public/assets/{pegDiagram-2B236MQR-DVy6JL4F.js → pegDiagram-2B236MQR-Bs6HaUdW.js} +1 -1
  246. package/dist/public/assets/pending-receive-nav-store-lElziPqC.js +1 -0
  247. package/dist/public/assets/pie-RZYD4A2V-DaewLp2Y.js +1 -0
  248. package/dist/public/assets/{pieDiagram-ENE6RG2P-Kxbx45IP.js → pieDiagram-ENE6RG2P-BBo6EMS4.js} +1 -1
  249. package/dist/public/assets/{project-paths-DdZAF_-I.js → project-paths-Cgrv2qcw.js} +1 -1
  250. package/dist/public/assets/prop-types-Bzfc0oqg.js +1 -0
  251. package/dist/public/assets/{propagation-api-OHat7V1z.js → propagation-api-DCmicIMI.js} +1 -1
  252. package/dist/public/assets/{quadrantDiagram-ABIIQ3AL-BbCFEjhq.js → quadrantDiagram-ABIIQ3AL-qmZeOoSr.js} +1 -1
  253. package/dist/public/assets/radar-I7S5WNFK-DljmjJ2C.js +1 -0
  254. package/dist/public/assets/radio-group-DFFiLDEM.js +1 -0
  255. package/dist/public/assets/railroad-3IZDKUUU-6CgLOfBJ.js +1 -0
  256. package/dist/public/assets/railroad-abnf-AHOZXSZD-DQ60e1aW.js +1 -0
  257. package/dist/public/assets/railroad-ebnf-EBAXGLYW-Da8xQ_1N.js +1 -0
  258. package/dist/public/assets/railroad-peg-LSFZ7HO6-CDOeiUF5.js +1 -0
  259. package/dist/public/assets/{railroadDiagram-RFXS5EU6-6SEpaCgo.js → railroadDiagram-RFXS5EU6-DE_EvwtV.js} +1 -1
  260. package/dist/public/assets/{receive-store-C8NL_Ow-.js → receive-store-Bz-bzj4g.js} +1 -1
  261. package/dist/public/assets/{refresh-cw-DClG_qgN.js → refresh-cw-D3t5sdqM.js} +1 -1
  262. package/dist/public/assets/{requirementDiagram-TGXJPOKE-brbJ6VUS.js → requirementDiagram-TGXJPOKE-BZ-rKt8B.js} +1 -1
  263. package/dist/public/assets/{sankeyDiagram-HTMAVEWB-DT0MK3ep.js → sankeyDiagram-HTMAVEWB-B9AZEJIc.js} +1 -1
  264. package/dist/public/assets/{schema-fields-view-intent-CDu72Aty.js → schema-fields-view-intent-SQVE5W3s.js} +1 -1
  265. package/dist/public/assets/select-DyVZCohx.js +1 -0
  266. package/dist/public/assets/{selection-context-BNYOSYyM.js → selection-context-DdcFoUdp.js} +1 -1
  267. package/dist/public/assets/{separator-DExEeoYE.js → separator-4_yBRx-q.js} +1 -1
  268. package/dist/public/assets/{sequenceDiagram-DBY2YBRQ-BPJt9blB.js → sequenceDiagram-DBY2YBRQ-DR0l3jeO.js} +1 -1
  269. package/dist/public/assets/{sizeCapture-X5ZJPWSS-1l7G4SwD.js → sizeCapture-X5ZJPWSS-CK3vwB3X.js} +1 -1
  270. package/dist/public/assets/skeleton-BlTc8h6X.js +1 -0
  271. package/dist/public/assets/skill-actions-DCU7_Sac.js +2 -0
  272. package/dist/public/assets/skill-scope-CYrWegR8.js +1 -0
  273. package/dist/public/assets/skills-api-CC0Fy08A.js +1 -0
  274. package/dist/public/assets/square-pen-wqme9vlv.js +1 -0
  275. package/dist/public/assets/{src-U1RHfo7d.js → src-BULLuFw_.js} +1 -1
  276. package/dist/public/assets/{src-CaBa9Z1L.js → src-DsJU4LsJ.js} +1 -1
  277. package/dist/public/assets/{stateDiagram-2N3HPSRC-QGlUFt6h.js → stateDiagram-2N3HPSRC-DEWfQHsO.js} +1 -1
  278. package/dist/public/assets/stateDiagram-v2-6OUMAXLB-aJyvpelO.js +1 -0
  279. package/dist/public/assets/{swimlanes-5IMT3BWC-BHsr6MBF.js → swimlanes-5IMT3BWC-B6x4Ld9j.js} +2 -2
  280. package/dist/public/assets/swimlanesDiagram-G3AALYLV-NoFAxBaw.js +8 -0
  281. package/dist/public/assets/switch-CsstPO-E.js +1 -0
  282. package/dist/public/assets/tabs-C8ykgpIi.js +1 -0
  283. package/dist/public/assets/tag-pill-input-7XN11_mj.js +1 -0
  284. package/dist/public/assets/target-navigation-intent-D2OBNu7k.js +1 -0
  285. package/dist/public/assets/{telemetry-impl-DV07MMfz.js → telemetry-impl-D4kQ8pzt.js} +2 -2
  286. package/dist/public/assets/telemetry-startup-B15S0fJ7.js +1 -0
  287. package/dist/public/assets/terminal-input-events-B8xUcID4.js +1 -0
  288. package/dist/public/assets/terminal-launch-events-nCAKTwef.js +1 -0
  289. package/dist/public/assets/{terminal-telemetry-CvNM4wYv.js → terminal-telemetry-vp1G0ekC.js} +1 -1
  290. package/dist/public/assets/textarea-DKb-eo87.js +1 -0
  291. package/dist/public/assets/{thread-client-CSOJeVWW.js → thread-client-KM4rZX_M.js} +1 -1
  292. package/dist/public/assets/{timeline-definition-FHXFAJF6-DitS4FqW.js → timeline-definition-FHXFAJF6-DB7l9JZO.js} +1 -1
  293. package/dist/public/assets/timeline-diff-store-C89mH-2r.js +1 -0
  294. package/dist/public/assets/{toggle-group-CjXmmTGy.js → toggle-group-DMfnQ5Pd.js} +1 -1
  295. package/dist/public/assets/tooltip-DkZ6fphS.js +1 -0
  296. package/dist/public/assets/{trash-2-DE3a7L75.js → trash-2-5vqPZUBk.js} +1 -1
  297. package/dist/public/assets/treeView-QDETBFTQ-Ds4YBLMo.js +1 -0
  298. package/dist/public/assets/treemap-6X3UGDF4-D2ccHx16.js +1 -0
  299. package/dist/public/assets/{triangle-alert-Bcc1P5yx.js → triangle-alert-BwCftF1V.js} +1 -1
  300. package/dist/public/assets/typing-burst-detector-DlPntV7a.js +8 -0
  301. package/dist/public/assets/undo-2-BRIW1mxN.js +1 -0
  302. package/dist/public/assets/uninstall-m1tFru3-.js +1 -0
  303. package/dist/public/assets/use-activity-panel--7zr9R-m.js +1 -0
  304. package/dist/public/assets/use-apply-config-color-theme-CFiJF3-G.js +2 -0
  305. package/dist/public/assets/use-collab-url-CVCbUQ9-.js +1 -0
  306. package/dist/public/assets/{use-live-xterm-theme-B2MdP4nP.js → use-live-xterm-theme-CAutS4BK.js} +1 -1
  307. package/dist/public/assets/use-open-skill-CxYgcPyr.js +1 -0
  308. package/dist/public/assets/use-settings-route-b4_ubAQl.js +1 -0
  309. package/dist/public/assets/use-skill-directory-DacYw073.js +1 -0
  310. package/dist/public/assets/use-skills-CQ-I1uBW.js +1 -0
  311. package/dist/public/assets/use-terminal-enabled-Czv-AS7W.js +1 -0
  312. package/dist/public/assets/use-timeline-entry-diff--zp5POjE.js +6 -0
  313. package/dist/public/assets/use-workspace-DoTTAGcg.js +1 -0
  314. package/dist/public/assets/{vennDiagram-L72KCM5P-D7jabRjK.js → vennDiagram-L72KCM5P-D6bPpaIm.js} +1 -1
  315. package/dist/public/assets/wardley-OPB4EBWU-JuWm1scq.js +1 -0
  316. package/dist/public/assets/{wardleyDiagram-EHGQE667-C3olh_ef.js → wardleyDiagram-EHGQE667-9U25ZM8P.js} +1 -1
  317. package/dist/public/assets/{wrench-4e3jxe5l.js → wrench-CqOvU1qQ.js} +1 -1
  318. package/dist/public/assets/x-C6kVbc_i.js +1 -0
  319. package/dist/public/assets/{xychartDiagram-FW5EYKEG-WqIWQJdh.js → xychartDiagram-FW5EYKEG-WSgFIUEO.js} +1 -1
  320. package/dist/public/index.html +148 -138
  321. package/dist/public/uninstall.html +26 -25
  322. package/dist/{repair-launch-json-CvIvu8iY.mjs → repair-launch-json-DKnGHC3s.mjs} +2 -2
  323. package/dist/{repair-mcp-configs-Bm9hjjRi.mjs → repair-mcp-configs-BNqk430t.mjs} +2 -2
  324. package/dist/repair-skills-COiT9pxq.mjs +1 -0
  325. package/dist/repair-skills-HLaZ-M-Y.mjs +4 -0
  326. package/dist/server-lock-DTx_HmnT.mjs +1 -0
  327. package/dist/{server-lock-D7crxuP7.mjs → server-lock-N4bxkmqA.mjs} +2 -2
  328. package/dist/{src-DPfeLt-2.mjs → src-B9fZz8CV.mjs} +6 -6
  329. package/dist/{src-DmtkLnli.mjs → src-BAuCUhtO.mjs} +121 -120
  330. package/dist/src-BldBF2Y_.mjs +1 -0
  331. package/dist/src-CBxmkYgG.mjs +2030 -0
  332. package/dist/{start-CbJoa5l7.mjs → start-CGRdHb1G.mjs} +3 -3
  333. package/dist/start-uD8bt0wq.mjs +1 -0
  334. package/dist/{write-project-skill-BzhJIXSv.mjs → write-project-skill-DZsw6Rkw.mjs} +4 -4
  335. package/package.json +4 -4
  336. package/dist/assets/skills/project/references/workflow-guides.md +0 -30
  337. package/dist/constants-CScYQw9V.mjs +0 -2
  338. package/dist/git-handle-DyS9-xsk.mjs +0 -1
  339. package/dist/init-BIInZq9o.mjs +0 -1
  340. package/dist/loader-BC9hZLNV.mjs +0 -1
  341. package/dist/md-manager-BWTSpVXC.mjs +0 -2
  342. package/dist/preview-DrXnMxVX.mjs +0 -1
  343. package/dist/public/assets/ActivityModeContent-BquAhT5x.js +0 -1
  344. package/dist/public/assets/AppMenubar-DHWqgWXl.js +0 -1
  345. package/dist/public/assets/CodeMirrorPropInput-DOcEkWLX.js +0 -3
  346. package/dist/public/assets/CopyButton-1Q6Wnnjb.js +0 -1
  347. package/dist/public/assets/DocumentContext-uE-Jpe8-.js +0 -38
  348. package/dist/public/assets/EditorModeToggle-DBmNyzRU.js +0 -2
  349. package/dist/public/assets/EnableSyncConfirmDialog-Dufpw3Xm.js +0 -1
  350. package/dist/public/assets/FeedbackForm-CuzqS5aL.js +0 -1
  351. package/dist/public/assets/ManagedArtifactProperties-xXR4EKXf.js +0 -1
  352. package/dist/public/assets/McpConsentDialogBody-CHmK7aXE.js +0 -1
  353. package/dist/public/assets/PropertyPanel-C0kyK4Hh.js +0 -2
  354. package/dist/public/assets/SchemaConfigEditor-BFx4ZhVm.js +0 -1
  355. package/dist/public/assets/SettingsDialogBody-Chz13SZG.js +0 -7
  356. package/dist/public/assets/ShareReceiveDialog-C7_nVZOF.js +0 -1
  357. package/dist/public/assets/ShareReceiveMissDialog-Dv1nzqQa.js +0 -1
  358. package/dist/public/assets/SkillEditorActions-2WrfNbQp.js +0 -1
  359. package/dist/public/assets/SourceEditor-CmpVF187.js +0 -1
  360. package/dist/public/assets/TerminalSessionsHost-Yz2cECTk.js +0 -2
  361. package/dist/public/assets/ThreadView-loAOfVAD.js +0 -6
  362. package/dist/public/assets/TimelineDiffPane-C5gRZMQN.js +0 -2
  363. package/dist/public/assets/agent-diff-store-BvRAZqCN.js +0 -1
  364. package/dist/public/assets/agent-visibility-DJ6Bc0aU.js +0 -1
  365. package/dist/public/assets/architecture-TIHT7OUA-BfFQVb2N.js +0 -1
  366. package/dist/public/assets/arrow-up-right-obRIg3Sv.js +0 -1
  367. package/dist/public/assets/auth-state-cache-CEu3ZBI_.js +0 -11
  368. package/dist/public/assets/badge-DXHoKHez.js +0 -1
  369. package/dist/public/assets/button-Gol9BgNB.js +0 -1
  370. package/dist/public/assets/channel-D04u7HkE.js +0 -1
  371. package/dist/public/assets/check-GqWaoTdV.js +0 -1
  372. package/dist/public/assets/checkbox-BkZH9Oy1.js +0 -1
  373. package/dist/public/assets/chevron-left-BQ6OM94c.js +0 -1
  374. package/dist/public/assets/chevron-right-C8oTR6gu.js +0 -1
  375. package/dist/public/assets/chunk-2Q5K7J3B-Cczs20mb.js +0 -1
  376. package/dist/public/assets/chunk-VAUOI2AC-D9H5NlkH.js +0 -1
  377. package/dist/public/assets/chunk-XXDRQBXY-BjAUTr8E.js +0 -1
  378. package/dist/public/assets/classDiagram-OUVF2IWQ-BCgYs9Pk.js +0 -1
  379. package/dist/public/assets/classDiagram-v2-EOCWNBFH-BpVLL4-U.js +0 -1
  380. package/dist/public/assets/client-version-MIkctMik.js +0 -1
  381. package/dist/public/assets/collapsible-B1mS1n9y.js +0 -1
  382. package/dist/public/assets/config-context-D3FvmHZm.js +0 -1
  383. package/dist/public/assets/copy-9EDFYcyR.js +0 -1
  384. package/dist/public/assets/createLucideIcon-DAkhoPjT.js +0 -1
  385. package/dist/public/assets/cynefin-VYW2F7L2-BVFEANjh.js +0 -1
  386. package/dist/public/assets/dialog-6-bc7qPg.js +0 -5
  387. package/dist/public/assets/dist-BJa2CfR3.js +0 -1
  388. package/dist/public/assets/dist-BNcdLYQI.js +0 -1
  389. package/dist/public/assets/dist-BjDuLI_j.js +0 -1
  390. package/dist/public/assets/dist-D6h-uzOv.js +0 -1
  391. package/dist/public/assets/dist-DAU1MdSo.js +0 -1
  392. package/dist/public/assets/dist-DPWWCZ4h.js +0 -1
  393. package/dist/public/assets/dist-nHZgBxFS.js +0 -1
  394. package/dist/public/assets/doc-hash-BbU2eA08.js +0 -1
  395. package/dist/public/assets/documents-events-C-mYs64z.js +0 -1
  396. package/dist/public/assets/dropdown-menu-xw8WTdb-.js +0 -1
  397. package/dist/public/assets/es2015-BNlmLq62.js +0 -41
  398. package/dist/public/assets/eventmodeling-45OFAUF4-usNuB_rF.js +0 -1
  399. package/dist/public/assets/field-BNyAQHKf.js +0 -1
  400. package/dist/public/assets/file-tree-adapter-c4ru9pmD.js +0 -1
  401. package/dist/public/assets/file-tree-utils-Lc0SvgnU.js +0 -1
  402. package/dist/public/assets/flowDiagram-23GEKE2U-CDs0Vlps.js +0 -1
  403. package/dist/public/assets/follow-file-BVJ6G9Hs.js +0 -1
  404. package/dist/public/assets/form-gDsa08Xi.js +0 -1
  405. package/dist/public/assets/gitGraph-TEB2WS4Q-DXc_YvuI.js +0 -1
  406. package/dist/public/assets/globals-Cf_md-qZ.css +0 -1
  407. package/dist/public/assets/index-DVlIcKqo.js +0 -2014
  408. package/dist/public/assets/info-DKCQHKI2-C0DL9Ht0.js +0 -1
  409. package/dist/public/assets/input-D4OPkja2.js +0 -1
  410. package/dist/public/assets/lint-config-client-DJg7YDu3.js +0 -1
  411. package/dist/public/assets/loader-circle-Cg5SU7AZ.js +0 -1
  412. package/dist/public/assets/markdownlint-rule-browser-6yvn3dt6.js +0 -1
  413. package/dist/public/assets/mermaid-GHXKKRXX-C9klxgAS.js +0 -1
  414. package/dist/public/assets/minus-CI_HyT1V.js +0 -1
  415. package/dist/public/assets/navigation-targets-DwSgIIy0.js +0 -1
  416. package/dist/public/assets/open-managed-artifact-tab-Dpz9X1m_.js +0 -1
  417. package/dist/public/assets/packet-7NZHBO7P-BpFruX6n.js +0 -1
  418. package/dist/public/assets/panel-BbxjQP3-.js +0 -1
  419. package/dist/public/assets/pending-receive-nav-store-t5K6mYGs.js +0 -1
  420. package/dist/public/assets/pie-RZYD4A2V-lVpCCOkJ.js +0 -1
  421. package/dist/public/assets/prop-types-65NJPmd-.js +0 -1
  422. package/dist/public/assets/radar-I7S5WNFK-Bd-i9axl.js +0 -1
  423. package/dist/public/assets/radio-group-CGEdWasQ.js +0 -1
  424. package/dist/public/assets/railroad-3IZDKUUU-D6ewe_eA.js +0 -1
  425. package/dist/public/assets/railroad-abnf-AHOZXSZD-DKqyYXL-.js +0 -1
  426. package/dist/public/assets/railroad-ebnf-EBAXGLYW-CtMezBX2.js +0 -1
  427. package/dist/public/assets/railroad-peg-LSFZ7HO6-DJ-63J6n.js +0 -1
  428. package/dist/public/assets/skeleton-Mo1oLtEu.js +0 -1
  429. package/dist/public/assets/skill-actions-ByBHG3Gh.js +0 -1
  430. package/dist/public/assets/skills-api-DWPhWBud.js +0 -1
  431. package/dist/public/assets/sliders-horizontal-BNv-Koqw.js +0 -1
  432. package/dist/public/assets/square-pen-C1vIlMAW.js +0 -1
  433. package/dist/public/assets/stateDiagram-v2-6OUMAXLB-D_6D-nLI.js +0 -1
  434. package/dist/public/assets/swimlanesDiagram-G3AALYLV-cqXTLbrM.js +0 -8
  435. package/dist/public/assets/switch-DYic2V-1.js +0 -1
  436. package/dist/public/assets/tag-pill-input-BHj4spSb.js +0 -1
  437. package/dist/public/assets/target-navigation-intent-B5jnqgZ_.js +0 -1
  438. package/dist/public/assets/telemetry-startup-Cy1VVosp.js +0 -1
  439. package/dist/public/assets/terminal-input-events-C5UuEsAB.js +0 -1
  440. package/dist/public/assets/terminal-launch-events-CtZeptxC.js +0 -1
  441. package/dist/public/assets/textarea-bScbzsdX.js +0 -1
  442. package/dist/public/assets/timeline-diff-store-BwCud4Ug.js +0 -1
  443. package/dist/public/assets/tooltip-B4J7VHmA.js +0 -1
  444. package/dist/public/assets/treeView-QDETBFTQ-CuznZlQn.js +0 -1
  445. package/dist/public/assets/treemap-6X3UGDF4-DCd6umeO.js +0 -1
  446. package/dist/public/assets/typing-burst-detector-CZREoy8B.js +0 -8
  447. package/dist/public/assets/uninstall-CA1cQCnA.js +0 -1
  448. package/dist/public/assets/use-activity-panel-DWxDopZd.js +0 -1
  449. package/dist/public/assets/use-apply-config-color-theme-DSCn9I0W.js +0 -2
  450. package/dist/public/assets/use-collab-url-CE02D4PJ.js +0 -1
  451. package/dist/public/assets/use-settings-route-BX1P2p9-.js +0 -1
  452. package/dist/public/assets/use-terminal-enabled-BlXFMDFQ.js +0 -1
  453. package/dist/public/assets/use-timeline-entry-diff-BI1BVnmy.js +0 -6
  454. package/dist/public/assets/use-workspace-DcPrrukl.js +0 -1
  455. package/dist/public/assets/wardley-OPB4EBWU-DH0Qf9r4.js +0 -1
  456. package/dist/public/assets/workspace-paths-CU85-ZRd.js +0 -1
  457. package/dist/public/assets/x-Du5jsNHa.js +0 -1
  458. package/dist/repair-skills-BHY_AeM4.mjs +0 -4
  459. package/dist/repair-skills-CUT1NbJx.mjs +0 -1
  460. package/dist/server-lock-CG809RrD.mjs +0 -1
  461. package/dist/src-D4iCDwsy.mjs +0 -1
  462. package/dist/src-T1lGYBC1.mjs +0 -3275
  463. package/dist/start-Bc8dmiQL.mjs +0 -1
  464. /package/dist/public/assets/{ActivityPanelDiffView-DYFlG61N.js → ActivityPanelDiffView-ZX0cv7Dl.js} +0 -0
  465. /package/dist/public/assets/{__vite-browser-external-z7jTWlYs.js → __vite-browser-external-DwydhYHF.js} +0 -0
  466. /package/dist/public/assets/{agent-presence-BdWbAeV-.js → agent-presence-BcWu61SE.js} +0 -0
  467. /package/dist/public/assets/{array-CC6md2n_.js → array-DpLqdF3L.js} +0 -0
  468. /package/dist/public/assets/{chunk-KEIR6QF5-BppCe61B.js → chunk-KEIR6QF5-Bf0oDx3Z.js} +0 -0
  469. /package/dist/public/assets/{chunk-Y2CYZVJY-CP7lNZai.js → chunk-Y2CYZVJY-PbmsUfAu.js} +0 -0
  470. /package/dist/public/assets/{clike-BAopx-wt.js → clike-BrXLgO2o.js} +0 -0
  471. /package/dist/public/assets/{clipboard-adapter-ZCy01ehf.js → clipboard-adapter-B3lKEXcw.js} +0 -0
  472. /package/dist/public/assets/{colors-QyrgP4ww.js → colors-B-WRw0bG.js} +0 -0
  473. /package/dist/public/assets/{copilot-BiqH8PgI.js → copilot-BkvifxDd.js} +0 -0
  474. /package/dist/public/assets/{cursor-BDHSyD-9.js → cursor-D-FuCbK1.js} +0 -0
  475. /package/dist/public/assets/{cytoscape.esm-Ci36Fm6r.js → cytoscape.esm-BkIkmBTc.js} +0 -0
  476. /package/dist/public/assets/{defaultLocale-ByXO85kN.js → defaultLocale-DoD61tXl.js} +0 -0
  477. /package/dist/public/assets/{desktop-bridge-types-DHaZbwZ0.js → desktop-bridge-types-5ScET3Cg.js} +0 -0
  478. /package/dist/public/assets/{diff-KHO8LkSI.js → diff-DTEjW6Ec.js} +0 -0
  479. /package/dist/public/assets/{dist-B8I5m7M1.js → dist-BVbCw0G-.js} +0 -0
  480. /package/dist/public/assets/{dist-Cljnhi3D.js → dist-CA7QPULb.js} +0 -0
  481. /package/dist/public/assets/{dist-DFt8VaPU.js → dist-CF921uP8.js} +0 -0
  482. /package/dist/public/assets/{dist-Bpk5HQQh.js → dist-D4eaXg-1.js} +0 -0
  483. /package/dist/public/assets/{dist-BCZq3DKc.js → dist-DuwTJb1j.js} +0 -0
  484. /package/dist/public/assets/{documents-fetch-Db-Ikele.js → documents-fetch-AfOPbdF_.js} +0 -0
  485. /package/dist/public/assets/{external-link-Ct0_ujyY.js → external-link-LAxhzgCI.js} +0 -0
  486. /package/dist/public/assets/{file-tree-rename-validation-DDA1ck2Y.js → file-tree-rename-validation-CkkVvtpx.js} +0 -0
  487. /package/dist/public/assets/{floating-ui.dom-DxCSXcm6.js → floating-ui.dom-DQ0F0qgY.js} +0 -0
  488. /package/dist/public/assets/{format-4tjAvLkN.js → format-Bj7zR862.js} +0 -0
  489. /package/dist/public/assets/{go-7c8IMl4m.js → go-D3-a1upg.js} +0 -0
  490. /package/dist/public/assets/{init-CL1Yxhhi.js → init-D0AX7DDe.js} +0 -0
  491. /package/dist/public/assets/{isObject-5PVyZ800.js → isObject-Bs1dF4ay.js} +0 -0
  492. /package/dist/public/assets/{katex-BlgnTlTx.js → katex-DGLcd7nU.js} +0 -0
  493. /package/dist/public/assets/{lib-Iu39CNZE.js → lib-RJCjKODX.js} +0 -0
  494. /package/dist/public/assets/{libesm-WVpTb_tB.js → libesm-D5Z2fjiR.js} +0 -0
  495. /package/dist/public/assets/{lint-plugin-meta-BoxMoaxR.js → lint-plugin-meta-DEfDN-Lf.js} +0 -0
  496. /package/dist/public/assets/{lru-string-cache-7Y9kMeow.js → lru-string-cache-CHVwK1CS.js} +0 -0
  497. /package/dist/public/assets/{lua-DnREcbBQ.js → lua-B71IklsF.js} +0 -0
  498. /package/dist/public/assets/{markdownit-YwcN3EvW.js → markdownit-BIJhOARi.js} +0 -0
  499. /package/dist/public/assets/{mcp-consent-store-CDAQY6Np.js → mcp-consent-store-B7QM8uoo.js} +0 -0
  500. /package/dist/public/assets/{min-DVq-2erP.js → min-nSRrTGDE.js} +0 -0
  501. /package/dist/public/assets/{overlay-layers-Dhz8IqAf.js → overlay-layers-cTOQ-1PW.js} +0 -0
  502. /package/dist/public/assets/{panzoom.es-D0o6IaL6.js → panzoom.es-D_Inq3Bn.js} +0 -0
  503. /package/dist/public/assets/{parse-api-error-BtEL2kxi.js → parse-api-error-CqQte8A1.js} +0 -0
  504. /package/dist/public/assets/{path-BGTOauh6.js → path-rUjnF-It.js} +0 -0
  505. /package/dist/public/assets/{pdf-DLVdEoR9.js → pdf-B6i840eQ.js} +0 -0
  506. /package/dist/public/assets/{pdf.worker-Cuhr1SjJ.js → pdf.worker-BVtQmJKT.js} +0 -0
  507. /package/dist/public/assets/{perl-D6YK7dbe.js → perl-B5Ul8OcV.js} +0 -0
  508. /package/dist/public/assets/{properties-BPzWpIa7.js → properties-CWbs0haa.js} +0 -0
  509. /package/dist/public/assets/{r-tzVlUzeq.js → r-DcrAlDW2.js} +0 -0
  510. /package/dist/public/assets/{rough.esm-kQd3CdGR.js → rough.esm-BfebUORF.js} +0 -0
  511. /package/dist/public/assets/{ruby-_eAC-08N.js → ruby-i1xYQ9jV.js} +0 -0
  512. /package/dist/public/assets/{share-metadata-rows-Ds3RIKZ4.js → share-metadata-rows-aPZCgxxk.js} +0 -0
  513. /package/dist/public/assets/{shell-CRkrz4LQ.js → shell-cUw_P8eQ.js} +0 -0
  514. /package/dist/public/assets/{sortable.esm-_jt9EfAF.js → sortable.esm-ByX1chKY.js} +0 -0
  515. /package/dist/public/assets/{sql-BtxU5QDI.js → sql-xiwUJ94E.js} +0 -0
  516. /package/dist/public/assets/{src-BJaEWo8x.js → src-DkpCd49O.js} +0 -0
  517. /package/dist/public/assets/{startup-marks-CyxDWRgR.js → startup-marks-BHZdrXwz.js} +0 -0
  518. /package/dist/public/assets/{stex-EWGki41Z.js → stex-rJmw0eOd.js} +0 -0
  519. /package/dist/public/assets/{swift-BmtuXdIg.js → swift-Cl1DeyT6.js} +0 -0
  520. /package/dist/public/assets/{thread-draft-staging-CKJIG41d.js → thread-draft-staging-t1CtDp8W.js} +0 -0
  521. /package/dist/public/assets/{toml-yD0H4nkp.js → toml-B2JpJCpy.js} +0 -0
  522. /package/dist/public/assets/{trace-api-DHyWZzIa.js → trace-api-C3cW9MnH.js} +0 -0
  523. /package/dist/public/assets/{use-installed-clis-8r2iSkgN.js → use-installed-clis-BR1AXhaE.js} +0 -0
  524. /package/dist/public/assets/{useLintConfigViewMode-CyzSEZ5z.js → useLintConfigViewMode-eMibVVkV.js} +0 -0
  525. /package/dist/public/assets/{w3c-keyname-DtWCia6R.js → w3c-keyname-DKgbz_c6.js} +0 -0
  526. /package/dist/public/assets/{worktree-store-B-NxI13K.js → worktree-store-Cn9IFis3.js} +0 -0
@@ -1,2014 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DV07MMfz.js","./chunk-CYidjpOJ.js","./preload-helper-Chd9yIcd.js","./trace-api-DHyWZzIa.js","./propagation-api-OHat7V1z.js","./ReportBugDialogBody-CdEV6nCR.js","./dist-DJbbCXtB.js","./lib-Iu39CNZE.js","./markdownit-YwcN3EvW.js","./w3c-keyname-DtWCia6R.js","./dist-Nvb76hAm.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./checkbox-BkZH9Oy1.js","./dist-D6h-uzOv.js","./createLucideIcon-DAkhoPjT.js","./bundle-mjs-SHeFpKGC.js","./react-dom-DPxgxlDT.js","./dist-DFt8VaPU.js","./dist-DEamjSXE.js","./check-GqWaoTdV.js","./minus-CI_HyT1V.js","./compiler-runtime-BfE3aGVn.js","./dialog-6-bc7qPg.js","./dist-BNcdLYQI.js","./es2015-BNlmLq62.js","./button-Gol9BgNB.js","./x-Du5jsNHa.js","./CopyButton-1Q6Wnnjb.js","./tooltip-B4J7VHmA.js","./dist-nHZgBxFS.js","./floating-ui.dom-DxCSXcm6.js","./copy-9EDFYcyR.js","./loader-circle-Cg5SU7AZ.js","./BugReportHistory-D_60pb7r.js","./collapsible-B1mS1n9y.js","./chevron-down-Bx9f3tW-.js","./folder-open-wLd69QUc.js","./trash-2-DE3a7L75.js","./badge-DXHoKHez.js","./triangle-alert-Bcc1P5yx.js","./input-D4OPkja2.js","./textarea-bScbzsdX.js","./external-link-Ct0_ujyY.js","./clipboard-adapter-ZCy01ehf.js","./BugReportHistoryDialog-BzJsPoev.js","./GraphPanel-DZMLD8ni.js","./dist-BCZq3DKc.js","./toggle-group-CjXmmTGy.js","./dist-BjDuLI_j.js","./dist-DAU1MdSo.js","./useQuery-ZeEDLtxh.js","./min-DVq-2erP.js","./src-BJaEWo8x.js","./colors-QyrgP4ww.js","./ordinal-Dj8tTCMd.js","./init-CL1Yxhhi.js","./isObject-5PVyZ800.js","./now-bAD2ZsK-.js","./arrow-up-right-obRIg3Sv.js","./prop-types-65NJPmd-.js","./navigation-targets-DwSgIIy0.js","./file-tree-utils-Lc0SvgnU.js","./doc-hash-BbU2eA08.js","./documents-events-C-mYs64z.js","./documents-fetch-Db-Ikele.js","./parse-api-error-BtEL2kxi.js","./startup-marks-CyxDWRgR.js","./dist-PQ5KMVDh.js","./target-navigation-intent-B5jnqgZ_.js","./panel-BbxjQP3-.js","./overlay-layers-Dhz8IqAf.js","./ActivityModeContent-BquAhT5x.js","./DocumentContext-uE-Jpe8-.js","./esm-QF0-_nlB.js","./dist-D7mv9smG.js","./dist-CxGvJvCN.js","./dist-P9LB04An.js","./dist-DPWWCZ4h.js","./dist-B25wDFyk.js","./dist-DdFyq-YY.js","./dist-CsRIthsw2.js","./dist-C4Kl8QaT.js","./dist-BMMI5Kdg.js","./stex-EWGki41Z.js","./config-provider-B9kQH9zn.js","./client-version-MIkctMik.js","./use-apply-config-color-theme-DSCn9I0W.js","./config-context-D3FvmHZm.js","./switch-DYic2V-1.js","./terminal-input-events-C5UuEsAB.js","./CodeMirrorPropInput-DOcEkWLX.js","./git-branch-CMJAiYLz.js","./chevron-right-C8oTR6gu.js","./workspace-paths-CU85-ZRd.js","./eye-CASw1HTi.js","./hash-DNKDqZ18.js","./info-yKMseklR.js","./paperclip-FiPqbd6f.js","./sliders-horizontal-BNv-Koqw.js","./dist-B8I5m7M1.js","./file-tree-rename-validation-DDA1ck2Y.js","./use-collab-url-CE02D4PJ.js","./DocumentContext-B0sQn39F.css","./timeline-diff-store-BwCud4Ug.js","./agent-diff-store-BvRAZqCN.js","./cursor-BDHSyD-9.js","./copilot-BiqH8PgI.js","./use-activity-panel-DWxDopZd.js","./agent-presence-BdWbAeV-.js","./lru-string-cache-7Y9kMeow.js","./SettingsDialogBody-Chz13SZG.js","./sortable.esm-_jt9EfAF.js","./dropdown-menu-xw8WTdb-.js","./dist-BJa2CfR3.js","./label-DyipnO5I.js","./radio-group-CGEdWasQ.js","./separator-DExEeoYE.js","./EnableSyncConfirmDialog-Dufpw3Xm.js","./RegisteredAgentIcon-CyQDojW_.js","./skill-actions-ByBHG3Gh.js","./refresh-cw-DClG_qgN.js","./agent-visibility-DJ6Bc0aU.js","./use-settings-route-BX1P2p9-.js","./skills-api-DWPhWBud.js","./use-workspace-DcPrrukl.js","./auth-state-cache-CEu3ZBI_.js","./square-pen-C1vIlMAW.js","./open-managed-artifact-tab-Dpz9X1m_.js","./field-BNyAQHKf.js","./form-gDsa08Xi.js","./ConfigSharingInfoTooltip-BMJ7SIjf.js","./schema-fields-view-intent-CDu72Aty.js","./lint-plugin-meta-BoxMoaxR.js","./markdownlint-rule-browser-6yvn3dt6.js","./skeleton-Mo1oLtEu.js","./tag-pill-input-BHj4spSb.js","./lint-config-client-DJg7YDu3.js","./use-terminal-enabled-BlXFMDFQ.js","./terminal-telemetry-CvNM4wYv.js","./ManagedArtifactProperties-xXR4EKXf.js","./PropertyPanel-C0kyK4Hh.js","./format-4tjAvLkN.js","./braces-DwnwFx_V.js","./comment-chips-BYH7v5tl.js","./selection-context-BNYOSYyM.js","./MermaidDocEditor-CGsfhioE.js","./dist-DmIoqGC0.js","./dist-DlSSwTCj.js","./src-U1RHfo7d.js","./SourceEditor-CmpVF187.js","./typing-burst-detector-CZREoy8B.js","./wrench-4e3jxe5l.js","./SkillEditorActions-2WrfNbQp.js","./LintConfigEditor-k9WOKYkq.js","./EditorModeToggle-DBmNyzRU.js","./useLintConfigViewMode-CyzSEZ5z.js","./SchemaConfigEditor-BFx4ZhVm.js","./case-sensitive-nl0tWMnZ.js","./TimelineDiffPane-C5gRZMQN.js","./use-timeline-entry-diff-BI1BVnmy.js","./libesm-WVpTb_tB.js","./panel-right-open-CWgBRlZa.js","./AgentDiffPane-6bk9bV9U.js","./AppMenubar-DHWqgWXl.js","./AgentThreadClientBinder-u3ZVSSHE.js","./thread-client-CSOJeVWW.js","./TerminalSessionsHost-Yz2cECTk.js","./terminal-launch-events-CtZeptxC.js","./thread-draft-staging-CKJIG41d.js","./McpConsentDialogBody-CHmK7aXE.js","./mcp-consent-store-CDAQY6Np.js","./ShareBranchSwitchDialog-jGb4KF7T.js","./miss-dialog-store-Bx4JLuKB.js","./share-metadata-rows-Ds3RIKZ4.js","./desktop-bridge-types-DHaZbwZ0.js","./receive-store-C8NL_Ow-.js","./worktree-store-B-NxI13K.js","./ShareReceiveMissDialog-Dv1nzqQa.js","./pending-receive-nav-store-t5K6mYGs.js","./ConsentDialogBody-DWXqUhzJ.js","./project-paths-DdZAF_-I.js","./ShareReceiveDialog-C7_nVZOF.js","./TerminalWindowApp-CntBjoWb.js","./use-live-xterm-theme-B2MdP4nP.js","./use-installed-clis-8r2iSkgN.js","./telemetry-startup-Cy1VVosp.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./globals-CdX3jOLC.js";import{t as n}from"./preload-helper-Chd9yIcd.js";import{t as r}from"./jsx-runtime-BUgB2tll.js";import{$ as i,$t as a,A as o,An as s,At as c,B as l,Bt as u,C as d,Cn as f,Ct as p,D as m,Dn as h,Dt as g,En as _,Et as v,F as y,Fn as b,Ft as x,Gt as S,H as C,Ht as w,I as T,In as E,J as D,Jt as O,K as k,Kt as A,L as j,Ln as M,M as N,Mt as P,N as F,Nn as I,Nt as L,O as R,On as z,Ot as B,P as V,Pt as H,Q as U,Qt as ee,R as W,S as te,Sn as G,St as ne,Tn as K,Tt as q,U as re,Ut as ie,V as ae,Vt as oe,Wt as se,X as ce,Xt as le,Y as ue,Yt as de,Z as fe,Zt as pe,_ as me,_n as he,a as ge,an as _e,at as ve,b as ye,bn as be,bt as xe,c as Se,cn as Ce,ct as we,d as Te,dn as Ee,en as De,et as Oe,f as ke,fn as Ae,ft as je,g as Me,gt as Ne,h as Pe,hn as Fe,ht as Ie,i as Le,in as Re,it as ze,j as Be,jn as Ve,jt as He,k as Ue,kn as We,kt as Ge,l as Ke,ln as qe,lt as Je,m as Ye,mn as Xe,n as Ze,nn as Qe,nt as $e,o as et,on as tt,p as nt,pn as rt,q as it,qt as at,r as ot,rn as st,rt as ct,s as lt,sn as ut,t as dt,tn as ft,tt as pt,u as mt,un as ht,ut as gt,vt as _t,w as vt,wn as yt,wt as bt,xn as xt,y as St,yn as Ct,yt as wt,z as Tt}from"./DocumentContext-uE-Jpe8-.js";import{t as Et}from"./react-f2sANaYj.js";import{n as J,r as Dt,t as Ot}from"./dist-Nvb76hAm.js";import{_ as kt,a as At,c as jt,d as Mt,f as Nt,g as Pt,h as Ft,i as It,l as Lt,m as Rt,n as zt,o as Bt,p as Vt,r as Ht,s as Ut,t as Wt,u as Gt,v as Kt,y as qt}from"./useQuery-ZeEDLtxh.js";import{n as Jt,t as Yt}from"./dist-PQ5KMVDh.js";import{t as Xt}from"./react-dom-DPxgxlDT.js";import{t as Zt}from"./compiler-runtime-BfE3aGVn.js";import{a as Qt,c as $t,i as en,l as tn,o as nn,r as rn,s as an,t as on,u as sn}from"./terminal-input-events-C5UuEsAB.js";import{n as cn,s as Y,t as ln}from"./createLucideIcon-DAkhoPjT.js";import{n as un,r as dn,t as X}from"./button-Gol9BgNB.js";import{c as fn,i as pn,l as mn,o as hn,t as gn}from"./dist-D6h-uzOv.js";import{i as _n,n as vn,r as yn,t as bn}from"./tooltip-B4J7VHmA.js";import{n as xn,r as Sn,t as Cn}from"./collapsible-B1mS1n9y.js";import{a as wn,c as Tn,i as En,n as Dn,o as On,s as kn,t as An}from"./dialog-6-bc7qPg.js";import{$ as jn,A as Mn,B as Nn,C as Pn,D as Fn,E as In,J as Ln,K as Rn,P as zn,T as Bn,U as Vn,V as Hn,W as Un,Z as Wn,_ as Gn,b as Kn,ct as qn,dt as Jn,et as Yn,f as Xn,ft as Zn,j as Qn,l as $n,lt as er,m as tr,nt as nr,pt as rr,q as ir,tt as ar,u as or,ut as sr}from"./CodeMirrorPropInput-DOcEkWLX.js";import{t as cr}from"./checkbox-BkZH9Oy1.js";import{a as lr,d as ur,i as dr,l as fr,n as pr,o as mr,r as hr,s as gr,t as _r,u as vr}from"./floating-ui.dom-DxCSXcm6.js";import{_ as yr,a as br,c as xr,d as Sr,f as Cr,g as wr,h as Tr,i as Er,l as Dr,m as Or,n as kr,o as Ar,p as jr,r as Mr,s as Nr,t as Pr,u as Fr}from"./dist-BJa2CfR3.js";import{a as Ir,d as Lr,f as Rr,i as zr,m as Br,n as Vr,o as Hr,p as Ur,r as Wr,s as Gr,t as Kr,u as qr}from"./dropdown-menu-xw8WTdb-.js";import{t as Jr}from"./label-DyipnO5I.js";import{c as Yr,s as Xr}from"./switch-DYic2V-1.js";import{n as Zr,t as Qr}from"./radio-group-CGEdWasQ.js";import{t as $r}from"./separator-DExEeoYE.js";import{n as ei,r as ti,t as ni}from"./toggle-group-CjXmmTGy.js";import{C as ri,S as ii,a as ai,b as oi,c as si,f as ci,h as li,n as ui,o as di,r as fi,s as pi,t as mi,u as hi,v as gi,x as _i}from"./agent-visibility-DJ6Bc0aU.js";import{a as vi,i as yi,n as bi,r as xi}from"./terminal-telemetry-CvNM4wYv.js";import{$a as Si,$i as Ci,$n as wi,Aa as Ti,Ai as Ei,Ar as Di,At as Oi,C as ki,Cn as Ai,Ct as ji,Di as Mi,Dr as Ni,Er as Pi,F as Fi,Ft as Ii,G as Li,Gt as Ri,Hi as zi,Hn as Bi,I as Vi,It as Hi,Kn as Ui,Kt as Wi,Ln as Gi,M as Ki,Mi as qi,Mn as Ji,Nr as Yi,O as Xi,Oi as Zi,Qr as Qi,Qt as $i,R as ea,Ri as ta,Rr as na,Si as ra,Sr as ia,Un as aa,V as oa,Vn as sa,Wn as ca,Wr as la,Xr as ua,Yt as da,Za as fa,_i as pa,_o as ma,aa as ha,c as ga,ci as _a,cn as va,cr as ya,ct as ba,da as xa,do as Sa,ea as Ca,fa as wa,fi as Ta,fo as Ea,ga as Da,gi as Oa,go as ka,ha as Aa,ho as ja,ia as Ma,io as Na,ir as Pa,ji as Fa,jn as Ia,jr as La,k as Ra,ki as za,kn as Ba,la as Va,li as Ha,lo as Ua,lt as Wa,ma as Ga,mi as Ka,n as qa,ni as Ja,nr as Ya,oa as Xa,oi as Za,or as Qa,po as $a,pt as eo,q as to,qn as no,r as ro,ri as io,rn as ao,ro as oo,so,t as co,ti as lo,tr as uo,ua as fo,uo as po,ur as mo,v as ho,vo as go,wn as _o,wr as vo,ya as yo,yi as bo,yo as xo,yr as So,z as Co,zi as wo}from"./dist-DJbbCXtB.js";import{t as To}from"./git-branch-CMJAiYLz.js";import{c as Eo,d as Do,f as Oo,l as ko,p as Ao,u as jo}from"./EnableSyncConfirmDialog-Dufpw3Xm.js";import{t as Mo}from"./arrow-up-right-obRIg3Sv.js";import{r as No,t as Po}from"./RegisteredAgentIcon-CyQDojW_.js";import{a as Fo,c as Io,d as Lo,f as Ro,h as zo,i as Bo,l as Vo,m as Ho,n as Uo,o as Wo,p as Go,r as Ko,s as qo,t as Jo,u as Yo}from"./PropertyPanel-C0kyK4Hh.js";import{t as Xo}from"./case-sensitive-nl0tWMnZ.js";import{t as Zo}from"./check-GqWaoTdV.js";import{t as Qo}from"./chevron-left-BQ6OM94c.js";import{t as $o}from"./chevron-down-Bx9f3tW-.js";import{t as es}from"./chevron-right-C8oTR6gu.js";import{t as ts}from"./CopyButton-1Q6Wnnjb.js";import{a as ns,i as rs,n as is,o as as,r as os,s as ss}from"./prop-types-65NJPmd-.js";import{S as cs,_ as ls,a as us,b as ds,c as fs,d as ps,f as ms,g as hs,i as gs,l as _s,m as vs,n as ys,o as bs,p as xs,r as Ss,s as Cs,u as ws,v as Ts,x as Es,y as Ds}from"./skill-actions-ByBHG3Gh.js";import{B as Os,D as ks,E as As,F as js,G as Ms,H as Ns,I as Ps,K as Fs,L as Is,M as Ls,N as Rs,O as zs,P as Bs,R as Vs,S as Hs,T as Us,U as Ws,V as Gs,W as Ks,_ as qs,a as Js,c as Ys,j as Xs,l as Zs,m as Qs,n as $s,r as ec,t as tc,u as nc,v as rc,w as ic,z as ac}from"./auth-state-cache-CEu3ZBI_.js";import{a as oc,d as sc,i as cc,l as lc,n as uc,o as dc,r as fc,s as pc,t as mc,u as hc}from"./workspace-paths-CU85-ZRd.js";import{t as gc}from"./copy-9EDFYcyR.js";import{n as _c,t as vc}from"./square-pen-C1vIlMAW.js";import{t as yc}from"./eye-CASw1HTi.js";import{a as bc,i as xc,n as Sc,o as Cc,r as wc,s as Tc,t as Ec}from"./pending-receive-nav-store-t5K6mYGs.js";import{t as Dc}from"./folder-open-wLd69QUc.js";import{i as Oc,o as kc,t as Ac}from"./open-managed-artifact-tab-Dpz9X1m_.js";import{t as jc}from"./hash-DNKDqZ18.js";import{A as Mc,C as Nc,M as Pc,N as Fc,O as Ic,S as Lc,T as Rc,_ as zc,a as Bc,b as Vc,c as Hc,d as Uc,f as Wc,g as Gc,h as Kc,j as qc,k as Jc,l as Yc,m as Xc,n as Zc,o as Qc,p as $c,r as el,s as tl,t as nl,u as rl,v as il,w as al,x as ol,y as sl}from"./terminal-launch-events-CtZeptxC.js";import{t as cl}from"./info-yKMseklR.js";import{t as ll}from"./loader-circle-Cg5SU7AZ.js";import{n as ul,t as dl}from"./miss-dialog-store-Bx4JLuKB.js";import{$ as fl,A as pl,B as ml,C as hl,D as gl,E as _l,F as vl,G as yl,H as bl,I as xl,J as Sl,K as Cl,L as wl,M as Tl,N as El,O as Dl,P as Ol,Q as kl,R as Al,S as jl,T as Ml,U as Nl,V as Pl,X as Fl,Y as Il,Z as Ll,_ as Rl,a as zl,at as Bl,b as Vl,c as Hl,d as Ul,et as Wl,f as Gl,g as Kl,h as ql,i as Jl,it as Yl,j as Xl,k as Zl,l as Ql,m as $l,n as eu,nt as tu,o as nu,q as ru,r as iu,rt as au,s as ou,t as su,tt as cu,u as lu,v as uu,w as du,y as fu,z as pu}from"./comment-chips-BYH7v5tl.js";import{n as mu,t as hu}from"./panel-right-open-CWgBRlZa.js";import{t as gu}from"./paperclip-FiPqbd6f.js";import{t as _u}from"./refresh-cw-DClG_qgN.js";import{c as vu,n as yu,o as bu,r as xu,s as Su,t as Cu}from"./field-BNyAQHKf.js";import{t as wu}from"./sliders-horizontal-BNv-Koqw.js";import{t as Tu}from"./trash-2-DE3a7L75.js";import{t as Eu}from"./triangle-alert-Bcc1P5yx.js";import{i as Du,n as Ou,r as ku,t as Au}from"./timeline-diff-store-BwCud4Ug.js";import{t as ju}from"./x-Du5jsNHa.js";import{n as Mu,t as Nu}from"./dist-B8I5m7M1.js";import{a as Pu,i as Fu,n as Iu,r as Lu}from"./project-paths-DdZAF_-I.js";import{t as Ru}from"./input-D4OPkja2.js";import{t as zu}from"./dist-BCZq3DKc.js";import{_ as Bu,c as Vu,f as Hu,h as Uu,i as Wu,m as Gu,n as Ku,p as qu,r as Ju,s as Yu,t as Xu,v as Zu}from"./use-settings-route-BX1P2p9-.js";import{t as Qu}from"./parse-api-error-BtEL2kxi.js";import{n as $u,r as ed,t as td}from"./file-tree-rename-validation-DDA1ck2Y.js";import{a as nd,c as rd,d as id,i as ad,l as od,n as sd,o as cd,s as ld,u as ud}from"./file-tree-utils-Lc0SvgnU.js";import{a as dd,i as fd,n as pd,o as md,r as hd,s as gd}from"./navigation-targets-DwSgIIy0.js";import{c as _d,i as vd,l as yd,n as bd,o as xd,r as Sd,s as Cd,u as wd}from"./documents-events-C-mYs64z.js";import{t as Td}from"./documents-fetch-Db-Ikele.js";import{a as Ed,i as Dd,o as Od}from"./startup-marks-CyxDWRgR.js";import{a as kd,c as Ad,d as jd,f as Md,h as Nd,i as Pd,l as Fd,n as Id,o as Ld,p as Rd,r as zd,s as Bd,t as Vd,u as Hd}from"./doc-hash-BbU2eA08.js";import{t as Ud}from"./badge-DXHoKHez.js";import{c as Wd,i as Gd,n as Kd,t as qd}from"./config-provider-B9kQH9zn.js";import{i as Jd,r as Yd,t as Xd}from"./use-collab-url-CE02D4PJ.js";import{n as Zd,t as Qd}from"./client-version-MIkctMik.js";import{$ as $d,Et as ef,Ft as tf,I as nf,It as rf,J as af,Lt as of,Mt as sf,Nt as cf,Ot as lf,Q as uf,X as df,Z as ff,jt as pf,k as mf,kt as hf,ot as gf,w as _f,wt as vf,xt as yf}from"./dist-D7mv9smG.js";import{n as bf,s as xf,t as Sf}from"./esm-QF0-_nlB.js";import{n as Cf}from"./dist-C4Kl8QaT.js";import{n as wf}from"./config-context-D3FvmHZm.js";import{n as Tf,t as Ef}from"./external-link-Ct0_ujyY.js";import{n as Df,r as Of,t as kf}from"./worktree-store-B-NxI13K.js";import{t as Af}from"./overlay-layers-Dhz8IqAf.js";import{t as jf}from"./use-workspace-DcPrrukl.js";import{A as Mf,C as Nf,D as Pf,E as Ff,F as If,I as Lf,L as Rf,M as zf,N as Bf,O as Vf,R as Hf,S as Uf,_ as Wf,a as Gf,b as Kf,c as qf,d as Jf,f as Yf,g as Xf,i as Zf,j as Qf,l as $f,m as ep,n as tp,o as np,p as rp,s as ip,t as ap,u as op,v as sp,w as cp,y as lp}from"./typing-burst-detector-CZREoy8B.js";import{c as up,i as dp,n as fp,r as pp,s as mp,t as hp}from"./selection-context-BNYOSYyM.js";import{t as gp}from"./use-installed-clis-8r2iSkgN.js";import{a as _p,n as vp,o as yp}from"./follow-file-BVJ6G9Hs.js";import{a as bp,c as xp,i as Sp,n as Cp,o as wp,r as Tp,s as Ep,t as Dp}from"./panel-BbxjQP3-.js";import{t as Op}from"./textarea-bScbzsdX.js";import{t as kp}from"./target-navigation-intent-B5jnqgZ_.js";import{t as Ap}from"./lint-plugin-meta-BoxMoaxR.js";import{t as jp}from"./skeleton-Mo1oLtEu.js";import{c as Mp,i as Np,l as Pp,r as Fp}from"./lint-config-client-DJg7YDu3.js";import{a as Ip,o as Lp,t as Rp}from"./agent-diff-store-BvRAZqCN.js";import{t as zp}from"./dist-DmIoqGC0.js";import{a as Bp,i as Vp,n as Hp,o as Up,r as Wp,s as Gp,t as Kp}from"./EditorModeToggle-DBmNyzRU.js";import{n as qp}from"./clipboard-adapter-ZCy01ehf.js";import{a as Jp,f as Yp,i as Xp,l as Zp,n as Qp,p as $p,r as em,s as tm,t as nm,u as rm}from"./sortable.esm-_jt9EfAF.js";import{i as im,o as am,r as om,u as sm}from"./skills-api-DWPhWBud.js";import{C as cm,D as lm,E as um,O as dm,S as fm,T as pm,_ as mm,a as hm,b as gm,c as _m,d as vm,f as ym,g as bm,h as xm,i as Sm,k as Cm,l as wm,m as Tm,n as Em,o as Dm,p as Om,r as km,s as Am,t as jm,u as Mm,v as Nm,w as Pm,x as Fm,y as Im}from"./file-tree-adapter-c4ru9pmD.js";import{t as Lm}from"./use-live-xterm-theme-B2MdP4nP.js";import{n as Rm,r as zm}from"./agent-presence-BdWbAeV-.js";import{a as Bm,c as Vm,d as Hm,f as Um,i as Wm,l as Gm,m as Km,n as qm,o as Jm,s as Ym,t as Xm,u as Zm}from"./form-gDsa08Xi.js";import{n as Qm,t as $m}from"./mcp-consent-store-CDAQY6Np.js";import{a as eh,t as th}from"./receive-store-C8NL_Ow-.js";function nh(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.45.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DV07MMfz.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}var rh=class extends At{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ih(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Bt({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),jt.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ih(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ah=class extends qt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new rh({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=oh(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=oh(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=oh(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=oh(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){jt.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Nt(t,e))}findAll(e={}){return this.getAll().filter(t=>Nt(e,t))}notify(e){jt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return jt.batch(()=>Promise.all(e.map(e=>e.continue().catch(Rt))))}};function oh(e){return e.options.scope?.id}var sh=class extends qt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Mt(r,t),a=this.get(i);return a||(a=new It({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){jt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Vt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Vt(e,t)):t}notify(e){jt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){jt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){jt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ch=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new sh,this.#t=e.mutationCache||new ah,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Kt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ut.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Pt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Lt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return jt.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;jt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return jt.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=jt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Rt).catch(Rt)}invalidateQueries(e,t={}){return jt.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=jt.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Rt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Rt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Pt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Rt).catch(Rt)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Rt).catch(Rt)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ut.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Gt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Ft(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Gt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Ft(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Mt(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===kt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Z=r(),Q=e(Et(),1),lh=t(),$=Zt(),uh=3100,dh=3;function fh(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??dh;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var ph={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},mh=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function hh(e,t={}){let n=t.rng??Math.random,r=t.colors??mh,i=ph[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var gh=1.8,_h=90,vh=16,yh=380,bh=.025,xh=.1,Sh=.18,Ch=400,wh=9.2736,Th=18.1799,Eh=14.5244,Dh={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function Oh(e,t){let{halfWidth:n,apexLift:r}=Dh[t];return`M${e-n} ${Eh+.3} Q${e} ${Eh-r}, ${e+n} ${Eh+.3}`}function kh(e){let t=1.5,n=.3;return`M${e-t} ${Eh-n} Q${e} ${Eh+1.4}, ${e+t} ${Eh-n}`}var Ah=15,jh=15;function Mh(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function Nh(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=fh(g,t);_(n),y(Lh),S(hh(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},uh)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(Ih),S(hh(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},uh))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/yh)),C=-Math.max(-1,Math.min(1,b/yh))*vh,w=S*vh,T=0,E=0;if(x>=1){let e=Math.min(x/_h,1)*gh;T=y/x*e,E=b/x*e}let D=Math.abs(C-r)<.01&&Math.abs(w-i)<.01&&Math.abs(T-a)<.01&&Math.abs(E-o)<.01;if(!m&&D)return;l(),r+=(C-r)*xh,i+=(w-i)*xh,u.style.transform=`perspective(${Ch}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*Sh,o+=(E-o)*Sh;let O=i*bh,k=-r*bh,A=a+O,j=o+k;h.current.x=A,h.current.y=j,p.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=Y(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=Y(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let ee=(F||T)&&`ok-blob-eye-hidden`,W;t[22]===ee?W=t[23]:(W=Y(`ok-blob-eye`,ee),t[22]=ee,t[23]=W);let te;t[24]===W?te=t[25]:(te=(0,Z.jsx)(`ellipse`,{cx:wh,cy:Eh,rx:1.2722,ry:1.9083,className:W}),t[24]=W,t[25]=te);let G=(F||T)&&`ok-blob-eye-hidden`,ne;t[26]===G?ne=t[27]:(ne=Y(`ok-blob-eye ok-blob-eye-right`,G),t[26]=G,t[27]=ne);let K;t[28]===ne?K=t[29]:(K=(0,Z.jsx)(`ellipse`,{cx:Th,cy:Eh,rx:1.2722,ry:1.9083,className:ne}),t[28]=ne,t[29]=K);let q;t[30]===I?q=t[31]:(q=Oh(wh,I),t[30]=I,t[31]=q);let re=(!F||T)&&`ok-blob-eye-hidden`,ie;t[32]===re?ie=t[33]:(ie=Y(`ok-blob-happy-eye`,re),t[32]=re,t[33]=ie);let ae;t[34]!==q||t[35]!==ie?(ae=(0,Z.jsx)(`path`,{d:q,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ie}),t[34]=q,t[35]=ie,t[36]=ae):ae=t[36];let oe;t[37]===I?oe=t[38]:(oe=Oh(Th,I),t[37]=I,t[38]=oe);let se=(!F||T)&&`ok-blob-eye-hidden`,ce;t[39]===se?ce=t[40]:(ce=Y(`ok-blob-happy-eye`,se),t[39]=se,t[40]=ce);let le;t[41]!==oe||t[42]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[41]=oe,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===T?ue=t[45]:(ue=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:kh(wh),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:kh(Th),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ue);let de;t[46]!==te||t[47]!==K||t[48]!==ae||t[49]!==le||t[50]!==ue?(de=(0,Z.jsxs)(`g`,{ref:p,children:[te,K,ae,le,ue]}),t[46]=te,t[47]=K,t[48]=ae,t[49]=le,t[50]=ue,t[51]=de):de=t[51];let fe;t[52]!==B||t[53]!==H||t[54]!==de?(fe=(0,Z.jsxs)(`g`,{className:H,children:[U,de]},B),t[52]=B,t[53]=H,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===T?pe=t[57]:(pe=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=pe);let me;t[58]!==v||t[59]!==x?(me=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(Ph)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=me):me=t[60];let he;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==fe||t[65]!==pe||t[66]!==me?(he=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:Fh,children:[fe,pe,me]}),t[61]=D,t[62]=s,t[63]=z,t[64]=fe,t[65]=pe,t[66]=me,t[67]=he):he=t[67];let ge;return t[68]!==R||t[69]!==he?(ge=(0,Z.jsx)(`span`,{ref:d,className:R,children:he}),t[68]=R,t[69]=he,t[70]=ge):ge=t[70],ge}function Ph(e){return(0,Z.jsx)(`circle`,{cx:Ah+e.originDx,cy:jh+e.originDy,r:e.size,className:`ok-blob-firework`,style:Mh(e)},e.id)}function Fh(e){return e.preventDefault()}function Ih(e){return e+1}function Lh(e){return e+1}var Rh=(0,Q.lazy)(()=>n(()=>import(`./ReportBugDialogBody-CdEV6nCR.js`),__vite__mapDeps([5,1,6,2,3,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44]),import.meta.url)),zh=1200,Bh=`[cmdk-root],[data-radix-popper-content-wrapper]`,Vh=500;function Hh(e){let t=(0,$.c)(8),[n,r]=(0,Q.useState)(e.open),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(0);e.open&&!n&&r(!0);let l,u;if(t[0]!==e.crashInvite||t[1]!==e.open?(l=()=>{if(!e.open){a(!1);return}let t=c.current+=1,n=window.okDesktop?.bugReport?.captureScreenshot;if(typeof n!=`function`||e.crashInvite!==void 0){s(null),a(!0);return}s(null);let r=!1,i=e=>{r||c.current!==t||(r=!0,s(e),a(!0))},o=setTimeout(()=>i(null),zh),l=performance.now(),u=0,d=()=>{if(c.current!==t)return;let e=performance.now()-l>=Vh;if(document.querySelector(Bh)!==null&&!e){u=requestAnimationFrame(d);return}u=requestAnimationFrame(()=>{c.current===t&&n().then(i).catch(()=>i(null))})};return u=requestAnimationFrame(d),()=>{c.current+=1,clearTimeout(o),cancelAnimationFrame(u)}},u=[e.open,e.crashInvite],t[0]=e.crashInvite,t[1]=e.open,t[2]=l,t[3]=u):(l=t[2],u=t[3]),(0,Q.useEffect)(l,u),!n)return null;let d=e.open&&i,f;return t[4]!==e||t[5]!==o||t[6]!==d?(f=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Rh,{...e,open:d,screenshot:o})}),t[4]=e,t[5]=o,t[6]=d,t[7]=f):f=t[7],f}var Uh=`ContextMenu`,[Wh,Gh]=fn(Uh,[yr]),Kh=yr(),[qh,Jh]=Wh(Uh),Yh=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:a=!0}=e,[o,s]=Q.useState(!1),c=Kh(t),l=gn(r),u=Q.useCallback(e=>{s(e),l(e)},[l]);return(0,Z.jsx)(qh,{scope:t,open:o,onOpenChange:u,modal:a,children:(0,Z.jsx)(Cr,{...c,dir:i,open:o,onOpenChange:u,modal:a,children:n})})};Yh.displayName=Uh;var Xh=`ContextMenuTrigger`,Zh=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=Jh(Xh,n),o=Kh(n),s=Q.useRef({x:0,y:0}),c=Q.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),l=Q.useRef(0),u=Q.useCallback(()=>window.clearTimeout(l.current),[]),d=e=>{s.current={x:e.clientX,y:e.clientY},a.onOpenChange(!0)};return Q.useEffect(()=>u,[u]),Q.useEffect(()=>void(r&&u()),[r,u]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pr,{...o,virtualRef:c}),(0,Z.jsx)(mn.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:hn(e.onContextMenu,e=>{u(),d(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:hn(e.onPointerDown,Eg(e=>{u(),l.current=window.setTimeout(()=>d(e),700)})),onPointerMove:r?e.onPointerMove:hn(e.onPointerMove,Eg(u)),onPointerCancel:r?e.onPointerCancel:hn(e.onPointerCancel,Eg(u)),onPointerUp:r?e.onPointerUp:hn(e.onPointerUp,Eg(u))})]})});Zh.displayName=Xh;var Qh=`ContextMenuPortal`,$h=e=>{let{__scopeContextMenu:t,...n}=e,r=Kh(t);return(0,Z.jsx)(Dr,{...r,...n})};$h.displayName=Qh;var eg=`ContextMenuContent`,tg=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Jh(eg,n),a=Kh(n),o=Q.useRef(!1);return(0,Z.jsx)(Er,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});tg.displayName=eg;var ng=`ContextMenuGroup`,rg=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Kh(n);return(0,Z.jsx)(br,{...i,...r,ref:t})});rg.displayName=ng;var ig=`ContextMenuLabel`,ag=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Kh(n);return(0,Z.jsx)(xr,{...i,...r,ref:t})});ag.displayName=ig;var og=`ContextMenuItem`,sg=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Kh(n);return(0,Z.jsx)(Ar,{...i,...r,ref:t})});sg.displayName=og;var cg=`ContextMenuCheckboxItem`,lg=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Kh(n);return(0,Z.jsx)(Mr,{...i,...r,ref:t})});lg.displayName=cg;var ug=`ContextMenuRadioGroup`,dg=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Kh(n);return(0,Z.jsx)(Fr,{...i,...r,ref:t})});dg.displayName=ug;var fg=`ContextMenuRadioItem`,pg=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Kh(n);return(0,Z.jsx)(Sr,{...i,...r,ref:t})});pg.displayName=fg;var mg=`ContextMenuItemIndicator`,hg=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Kh(n);return(0,Z.jsx)(Nr,{...i,...r,ref:t})});hg.displayName=mg;var gg=`ContextMenuSeparator`,_g=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Kh(n);return(0,Z.jsx)(jr,{...i,...r,ref:t})});_g.displayName=gg;var vg=`ContextMenuArrow`,yg=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Kh(n);return(0,Z.jsx)(kr,{...i,...r,ref:t})});yg.displayName=vg;var bg=`ContextMenuSub`,xg=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=Kh(t),[s,c]=pn({prop:i,defaultProp:a??!1,onChange:r,caller:bg});return(0,Z.jsx)(Or,{...o,open:s,onOpenChange:c,children:n})};xg.displayName=bg;var Sg=`ContextMenuSubTrigger`,Cg=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Kh(n);return(0,Z.jsx)(wr,{...i,...r,ref:t})});Cg.displayName=Sg;var wg=`ContextMenuSubContent`,Tg=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Kh(n);return(0,Z.jsx)(Tr,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Tg.displayName=wg;function Eg(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var Dg=Yh,Og=Zh,kg=$h,Ag=tg,jg=rg,Mg=ag,Ng=sg,Pg=lg,Fg=hg,Ig=_g,Lg=xg,Rg=Cg,zg=Tg,Bg=new WeakMap;function Vg(e,t){typeof e!=`object`||!e||typeof t!=`string`||t.trim()===``||Bg.set(e,t)}function Hg(e){if(!(typeof e!=`object`||!e))return Bg.get(e)}function Ug(e){let t=(0,$.c)(24),{error:n,resetErrorBoundary:r}=e,{_:i}=Dt(),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null),c=typeof window<`u`?window.okDesktop:void 0,l;t[0]!==i||t[1]!==n?(l=n instanceof Error&&n.message?n.message:i({id:`W5A0Ly`}),t[0]=i,t[1]=n,t[2]=l):l=t[2];let u=l,d,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{s.current?.focus()},f=[],t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f);let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Nh,{size:80,variant:`sleeping`}),t[5]=p):p=t[5];let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h1`,{id:`app-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:(0,Z.jsx)(J,{id:`nwtY4N`})}),t[6]=m):m=t[6];let h;t[7]===u?h=t[8]:(h=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,(0,Z.jsx)(`p`,{className:`max-w-sm text-sm break-words text-muted-foreground`,children:u})]}),t[7]=u,t[8]=h);let g;t[9]===r?g=t[10]:(g=()=>r(),t[9]=r,t[10]=g);let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(J,{id:`KDw4GX`}),t[11]=_):_=t[11];let v;t[12]===g?v=t[13]:(v=(0,Z.jsx)(X,{ref:s,variant:`default`,onClick:g,children:_}),t[12]=g,t[13]=v);let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=c?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>o(!0),children:(0,Z.jsx)(J,{id:`ii5mVn`})}):null,t[14]=y):y=t[14];let b;t[15]===v?b=t[16]:(b=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[v,y]}),t[15]=v,t[16]=b);let x;t[17]!==n||t[18]!==a?(x=c?(0,Z.jsx)(Kg,{children:(0,Z.jsx)(Hh,{open:a,onOpenChange:o,systemWide:c.config.mode===`navigator`,crashContext:{source:`app shell`,errorMessage:n instanceof Error&&n.message?n.message:String(n),componentStack:Hg(n)}})}):null,t[17]=n,t[18]=a,t[19]=x):x=t[19];let S;return t[20]!==b||t[21]!==x||t[22]!==h?(S=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`app-error-title`,"data-slot":`app-error-boundary`,className:`flex h-screen flex-col items-center justify-center gap-8 p-8 text-center`,children:[p,h,b,x]}),t[20]=b,t[21]=x,t[22]=h,t[23]=S):S=t[23],S}function Wg(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(sn,{FallbackComponent:Ug,onError:Gg,children:n}),t[0]=n,t[1]=r),r}function Gg(e,t){Vg(e,t.componentStack),console.error(`[AppErrorBoundary] app-shell render crash`,e,t.componentStack??``)}function Kg(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(sn,{fallback:null,onError:qg,children:n}),t[0]=n,t[1]=r),r}function qg(e){console.error(`[CrashReportingBoundary] crash-reporting UI render crash`,e)}function Jg(){let e=(0,$.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:[`acp-catalog`],queryFn:Zg,staleTime:3e5},e[0]=t):t=e[0];let n=Wt(t),r;e[1]===n.data?.agents?r=e[2]:(r=()=>(_i(xi(n.data?.agents??[]).map(Xg)),Yg),e[1]=n.data?.agents,e[2]=r);let i;return e[3]===n.data?i=e[4]:(i=[n.data],e[3]=n.data,e[4]=i),(0,Q.useEffect)(r,i),null}function Yg(){return _i([])}function Xg(e){return{source:e.source,id:e.id,name:e.name,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl}}}function Zg(e){let{signal:t}=e;return yi(t)}var Qg=ln(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),$g=ln(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),e_=ln(`bird`,[[`path`,{d:`M16 7h.01`,key:`1kdx03`}],[`path`,{d:`M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20`,key:`oj1oa8`}],[`path`,{d:`m20 7 2 .5-2 .5`,key:`12nv4d`}],[`path`,{d:`M10 18v3`,key:`1yea0a`}],[`path`,{d:`M14 17.75V21`,key:`1pymcb`}],[`path`,{d:`M7 18a6 6 0 0 0 3.84-10.61`,key:`1npnn0`}]]),t_=ln(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),n_=ln(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),r_=ln(`book-marked`,[[`path`,{d:`M10 2v8l3-3 3 3V2`,key:`sqw3rj`}],[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}]]),i_=ln(`cat`,[[`path`,{d:`M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z`,key:`x6xyqk`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M11.25 16.25h1.5L12 17l-.75-.75Z`,key:`12kq1m`}]]),a_=ln(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),o_=ln(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),s_=ln(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),c_=ln(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),l_=ln(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),u_=ln(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),d_=ln(`dog`,[[`path`,{d:`M11.25 16.25h1.5L12 17z`,key:`w7jh35`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309`,key:`u7s9ue`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5`,key:`v8hric`}]]),f_=ln(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),p_=ln(`file-check`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m9 15 2 2 4-4`,key:`1grp1n`}]]),m_=ln(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),h_=ln(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),g_=ln(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),__=ln(`file-key`,[[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M4 12v6`,key:`bg1pfk`}],[`path`,{d:`M4 14h2`,key:`1sf9f8`}],[`path`,{d:`M9.65 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v4`,key:`d56i0q`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),v_=ln(`fish`,[[`path`,{d:`M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z`,key:`15baut`}],[`path`,{d:`M18 12v.5`,key:`18hhni`}],[`path`,{d:`M16 17.93a9.77 9.77 0 0 1 0-11.86`,key:`16dt7o`}],[`path`,{d:`M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33`,key:`l9di03`}],[`path`,{d:`M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4`,key:`1kjonw`}],[`path`,{d:`m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98`,key:`1zlm23`}]]),y_=ln(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),b_=ln(`folder-cog`,[[`path`,{d:`M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3`,key:`128dxu`}],[`path`,{d:`m14.305 19.53.923-.382`,key:`3m78fa`}],[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m16.852 15.228-.383-.923`,key:`5xggr7`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`m20.772 16.852.924-.383`,key:`htqkph`}],[`path`,{d:`m20.772 19.148.924.383`,key:`9w9pjp`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),x_=ln(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),S_=ln(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),C_=ln(`grid-2x2-x`,[[`path`,{d:`M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3`,key:`11za1p`}],[`path`,{d:`m16 16 5 5`,key:`8tpb07`}],[`path`,{d:`m16 21 5-5`,key:`193jll`}]]),w_=ln(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),T_=ln(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),E_=ln(`highlighter`,[[`path`,{d:`m9 11-6 6v3h9l3-3`,key:`1a3l36`}],[`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`,key:`14a9rk`}]]),D_=ln(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),O_=ln(`library`,[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]),k_=ln(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),A_=ln(`list-collapse`,[[`path`,{d:`M10 5h11`,key:`1hkqpe`}],[`path`,{d:`M10 12h11`,key:`6m4ad9`}],[`path`,{d:`M10 19h11`,key:`14g2nv`}],[`path`,{d:`m3 10 3-3-3-3`,key:`i7pm08`}],[`path`,{d:`m3 20 3-3-3-3`,key:`20gx1n`}]]),j_=ln(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),M_=ln(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),N_=ln(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),P_=ln(`megaphone`,[[`path`,{d:`M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z`,key:`q8bfy3`}],[`path`,{d:`M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14`,key:`1853fq`}],[`path`,{d:`M8 6v8`,key:`15ugcq`}]]),F_=ln(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),I_=ln(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),L_=ln(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),R_=ln(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),z_=ln(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),B_=ln(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),V_=ln(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),H_=ln(`rabbit`,[[`path`,{d:`M13 16a3 3 0 0 1 2.24 5`,key:`1epib5`}],[`path`,{d:`M18 12h.01`,key:`yjnet6`}],[`path`,{d:`M18 21h-8a4 4 0 0 1-4-4 7 7 0 0 1 7-7h.2L9.6 6.4a1 1 0 1 1 2.8-2.8L15.8 7h.2c3.3 0 6 2.7 6 6v1a2 2 0 0 1-2 2h-1a3 3 0 0 0-3 3`,key:`ue9ozu`}],[`path`,{d:`M20 8.54V4a2 2 0 1 0-4 0v3`,key:`49iql8`}],[`path`,{d:`M7.612 12.524a3 3 0 1 0-1.6 4.3`,key:`1e33i0`}]]),U_=ln(`rat`,[[`path`,{d:`M13 22H4a2 2 0 0 1 0-4h12`,key:`bt3f23`}],[`path`,{d:`M13.236 18a3 3 0 0 0-2.2-5`,key:`1tbvmo`}],[`path`,{d:`M16 9h.01`,key:`1bdo4e`}],[`path`,{d:`M16.82 3.94a3 3 0 1 1 3.237 4.868l1.815 2.587a1.5 1.5 0 0 1-1.5 2.1l-2.872-.453a3 3 0 0 0-3.5 3`,key:`9ch7kn`}],[`path`,{d:`M17 4.988a3 3 0 1 0-5.2 2.052A7 7 0 0 0 4 14.015 4 4 0 0 0 8 18`,key:`3s7e9i`}]]),W_=ln(`replace-all`,[[`path`,{d:`M14 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`zg1ipl`}],[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M19 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`txt6k4`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),G_=ln(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),K_=ln(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),q_=ln(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),J_=ln(`shrimp`,[[`path`,{d:`M11 12h.01`,key:`1lr4k6`}],[`path`,{d:`M13 22c.5-.5 1.12-1 2.5-1-1.38 0-2-.5-2.5-1`,key:`fatpdi`}],[`path`,{d:`M14 2a3.28 3.28 0 0 1-3.227 1.798l-6.17-.561A2.387 2.387 0 1 0 4.387 8H15.5a1 1 0 0 1 0 13 1 1 0 0 0 0-5H12a7 7 0 0 1-7-7V8`,key:`kehrqe`}],[`path`,{d:`M14 8a8.5 8.5 0 0 1 0 8`,key:`1imjx2`}],[`path`,{d:`M16 16c2 0 4.5-4 4-6`,key:`z0nejz`}]]),Y_=ln(`snail`,[[`path`,{d:`M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0`,key:`hneq2s`}],[`circle`,{cx:`10`,cy:`13`,r:`8`,key:`194lz3`}],[`path`,{d:`M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6`,key:`ixqyt7`}],[`path`,{d:`M18 3 19.1 5.2`,key:`9tjm43`}],[`path`,{d:`M22 3 20.9 5.2`,key:`j3odrs`}]]),X_=ln(`spell-check`,[[`path`,{d:`m6 16 6-12 6 12`,key:`1b4byz`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`m16 20 2 2 4-4`,key:`13tcca`}]]),Z_=ln(`square-code`,[[`path`,{d:`m10 9-3 3 3 3`,key:`1oro0q`}],[`path`,{d:`m14 15 3-3-3-3`,key:`bz13h7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),Q_=ln(`squirrel`,[[`path`,{d:`M15.236 22a3 3 0 0 0-2.2-5`,key:`21bitc`}],[`path`,{d:`M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4`,key:`oh0fg0`}],[`path`,{d:`M18 13h.01`,key:`9veqaj`}],[`path`,{d:`M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10`,key:`980v8a`}]]),$_=ln(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),ev=ln(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),tv=ln(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),nv=ln(`table-properties`,[[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),rv=ln(`telescope`,[[`path`,{d:`m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44`,key:`k4qptu`}],[`path`,{d:`m13.56 11.747 4.332-.924`,key:`19l80z`}],[`path`,{d:`m16 21-3.105-6.21`,key:`7oh9d`}],[`path`,{d:`M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z`,key:`m7xp4m`}],[`path`,{d:`m6.158 8.633 1.114 4.456`,key:`74o979`}],[`path`,{d:`m8 21 3.105-6.21`,key:`1fvxut`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}]]),iv=ln(`text-align-center`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M17 12H7`,key:`16if0g`}],[`path`,{d:`M19 19H5`,key:`vjpgq2`}]]),av=ln(`text-align-end`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M21 19H7`,key:`4cu937`}]]),ov=ln(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),sv=ln(`text-quote`,[[`path`,{d:`M17 5H3`,key:`1cn7zz`}],[`path`,{d:`M21 12H8`,key:`scolzb`}],[`path`,{d:`M21 19H8`,key:`13qgcb`}],[`path`,{d:`M3 12v7`,key:`1ri8j3`}]]),cv=ln(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),lv=ln(`thumbs-up`,[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]),uv=ln(`turtle`,[[`path`,{d:`m12 10 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a8 8 0 1 0-16 0v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3l2-4h4Z`,key:`1lbbv7`}],[`path`,{d:`M4.82 7.9 8 10`,key:`m9wose`}],[`path`,{d:`M15.18 7.9 12 10`,key:`p8dp2u`}],[`path`,{d:`M16.93 10H20a2 2 0 0 1 0 4H2`,key:`12nsm7`}]]),dv=ln(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),fv=ln(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),pv=ln(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),mv=ln(`whole-word`,[[`circle`,{cx:`7`,cy:`12`,r:`3`,key:`12clwm`}],[`path`,{d:`M10 9v6`,key:`17i7lo`}],[`circle`,{cx:`17`,cy:`12`,r:`3`,key:`gl7c2s`}],[`path`,{d:`M14 7v8`,key:`dl84cr`}],[`path`,{d:`M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1`,key:`lt2kga`}]]),hv=180,gv=5e3;function _v(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function vv(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function yv(e){let{parent:t,sanitizedName:n,enclosingProject:r,enclosingGit:i,targetState:a}=e;return t===``||n===``?{kind:`idle`}:r===null?i===null?a===`exists-nonempty`?{kind:`block-nonempty`}:{kind:`free`}:{kind:`confirm-git`,gitRoot:i.gitRoot}:{kind:`block-nested`,rootPath:r.rootPath}}function bv(e){let t=e instanceof Error?e.message:String(e);for(let e of ki)if(t.startsWith(`${e}:`)||t.includes(`${e}: `))return e===`nested-project`||e===`target-not-empty`?{reason:e}:{reason:e,message:t};return{reason:`unknown`,message:t}}function xv(e){switch(e.reason){case`nested-project`:return{id:`ScwcF2`};case`target-not-empty`:return{id:`e8L17t`};case`invalid-args`:return{id:`6bTTAN`};case`mkdir-failed`:return{id:`gJR87V`};case`git-init-failed`:return{id:`4CfgPM`};case`init-failed`:return{id:`l17ab4`};case`discovery-failed`:return{id:`ThmUrC`};case`unknown`:return{id:`AddR83`}}}function Sv(e){let t=(0,$.c)(186),{open:n,onOpenChange:r,bridge:i,initialPackId:a,packs:o}=e,{_:s}=Dt(),c=(0,Q.useId)(),l=(0,Q.useId)(),u=(0,Q.useId)(),d=(0,Q.useId)(),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(kv),[b,x]=(0,Q.useState)(`shared`),[S,C]=(0,Q.useState)(!1),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w={kind:`idle`},t[0]=w):w=t[0];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(`idle`),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(null),N;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(N={kind:`idle`},t[1]=N):N=t[1];let[P,F]=(0,Q.useState)(N),[I,L]=(0,Q.useState)(0),R;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(R=new Set,t[2]=R):R=t[2];let z=(0,Q.useRef)(R),B=(0,Q.useRef)(null),V=(0,Q.useRef)(null),H=(0,Q.useRef)(null),U=(0,Q.useRef)(0),ee,W;t[3]!==i||t[4]!==n?(ee=()=>{if(!n)return;z.current.clear(),M(null),E({kind:`idle`}),O(`idle`),A(!1),_(``),y(new Set(ro)),x(`shared`),C(!1),F({kind:`idle`}),U.current+=1;let e=!1;p(``),h(!0),i.fs.defaultProjectsRoot().then(t=>{e||p(t)}).catch(Ov).finally(()=>{e||h(!1)});let t=requestAnimationFrame(()=>{H.current?.focus()});return()=>{e=!0,cancelAnimationFrame(t)}},W=[n,i],t[3]=i,t[4]=n,t[5]=ee,t[6]=W):(ee=t[5],W=t[6]),(0,Q.useEffect)(ee,W);let te;t[7]!==i||t[8]!==f||t[9]!==g||t[10]!==n?(te=()=>{if(!n)return;V.current!==null&&clearTimeout(V.current),B.current!==null&&B.current.abort();let e=Za(g);if(f===``||e===``){E({kind:`idle`}),O(`idle`);return}let t=f,r=_v(t,e),a=new AbortController;return B.current=a,V.current=setTimeout(()=>{O(`in-flight`),Promise.all([i.fs.findEnclosingProjectRoot(t),i.fs.findEnclosingGitRoot(t),i.fs.folderState(r)]).then(n=>{let[r,i,o]=n;a.signal.aborted||(O(`idle`),E(yv({parent:t,sanitizedName:e,enclosingProject:r,enclosingGit:i,targetState:o})))}).catch(e=>{a.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),O(`idle`),E({kind:`free`}))})},hv),()=>{V.current!==null&&clearTimeout(V.current),a.abort()}},t[7]=i,t[8]=f,t[9]=g,t[10]=n,t[11]=te):te=t[11];let G;t[12]!==i||t[13]!==f||t[14]!==g||t[15]!==n||t[16]!==I?(G=[n,f,g,i,I],t[12]=i,t[13]=f,t[14]=g,t[15]=n,t[16]=I,t[17]=G):G=t[17],(0,Q.useEffect)(te,G);let ne,K;t[18]===n?(ne=t[19],K=t[20]):(ne=()=>{if(!n)return;let e=()=>L(Dv);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},K=[n],t[18]=n,t[19]=ne,t[20]=K),(0,Q.useEffect)(ne,K);let q=(0,Q.useRef)(`idle`),re,ie;t[21]===D?(re=t[22],ie=t[23]):(re=()=>{q.current=D},ie=[D],t[21]=D,t[22]=re,t[23]=ie),(0,Q.useEffect)(re,ie);let ae,oe;t[24]!==T.kind||t[25]!==n?(ae=()=>{if(!n||T.kind!==`confirm-git`)return;let e=setInterval(()=>{q.current!==`in-flight`&&L(Ev)},gv);return()=>clearInterval(e)},oe=[n,T.kind],t[24]=T.kind,t[25]=n,t[26]=ae,t[27]=oe):(ae=t[26],oe=t[27]),(0,Q.useEffect)(ae,oe);let se;t[28]!==T.gitRoot||t[29]!==T.kind||t[30]!==P.gitRoot||t[31]!==P.kind?(se=()=>{if(T.kind!==`confirm-git`){P.kind!==`idle`&&(U.current+=1,F({kind:`idle`}));return}P.kind===`confirming`&&P.gitRoot!==T.gitRoot&&F({kind:`idle`}),P.kind===`pending`&&P.gitRoot!==T.gitRoot&&(U.current+=1,F({kind:`idle`}))},t[28]=T.gitRoot,t[29]=T.kind,t[30]=P.gitRoot,t[31]=P.kind,t[32]=se):se=t[32];let ce;t[33]!==T||t[34]!==P?(ce=[T,P],t[33]=T,t[34]=P,t[35]=ce):ce=t[35],(0,Q.useEffect)(se,ce);let le;t[36]!==i||t[37]!==T.kind||t[38]!==n?(le=()=>{if(!n)return;let e=null;T.kind===`block-nested`?e=`nested`:T.kind===`block-nonempty`?e=`nonempty`:T.kind===`confirm-git`&&(e=`git-confirm`),e!==null&&(z.current.has(e)||(z.current.add(e),i.project.recordCreateNewBannerShown(e).catch(Tv)))},t[36]=i,t[37]=T.kind,t[38]=n,t[39]=le):le=t[39];let ue;t[40]!==i||t[41]!==T||t[42]!==n?(ue=[n,T,i],t[40]=i,t[41]=T,t[42]=n,t[43]=ue):ue=t[43],(0,Q.useEffect)(le,ue);let de;t[44]!==a||t[45]!==o?(de=o?.find(e=>e.id===a),t[44]=a,t[45]=o,t[46]=de):de=t[46];let fe=de,pe=g,me,he,ge,_e,ve;t[47]!==T.kind||t[48]!==f||t[49]!==pe?(_e=pe===``?``:Za(pe),he=pe!==``&&_e!==pe&&_e!==``,ge=pe!==``&&_e===``,me=T.kind===`block-nonempty`,ve=f!==``&&_e!==``?_v(f,_e):``,t[47]=T.kind,t[48]=f,t[49]=pe,t[50]=me,t[51]=he,t[52]=ge,t[53]=_e,t[54]=ve):(me=t[50],he=t[51],ge=t[52],_e=t[53],ve=t[54]);let ye=ve,be=!k&&f!==``&&pe!==``&&_e!==``&&D===`idle`&&(T.kind===`free`||T.kind===`confirm-git`),xe=k||pe!==``&&!be,Se;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(e){y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[55]=Se):Se=t[55];let Ce=Se,we;t[56]!==i||t[57]!==f?(we=async function(){try{let e=await i.dialog.openFolder(f===``?void 0:{defaultPath:f});if(e===null)return;p(e),L(wv),M(null)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[56]=i,t[57]=f,t[58]=we):we=t[58];let Te=we,Ee;t[59]!==s||t[60]!==i||t[61]!==k||t[62]!==be||t[63]!==v||t[64]!==a||t[65]!==f||t[66]!==r||t[67]!==pe||t[68]!==_e||t[69]!==b?(Ee=async function(e){if(e.preventDefault(),!k){if(pe.trim()===``){Mu.error(s({id:`5OqaJi`})),H.current?.focus();return}if(be){A(!0),M(null);try{await i.project.createNew({parent:f,name:_e,editors:Array.from(v),sharing:b,packId:a}),r(!1)}catch(e){M(bv(e)),A(!1)}}}},t[59]=s,t[60]=i,t[61]=k,t[62]=be,t[63]=v,t[64]=a,t[65]=f,t[66]=r,t[67]=pe,t[68]=_e,t[69]=b,t[70]=Ee):Ee=t[70];let De=Ee,Oe;t[71]!==k||t[72]!==r?(Oe=function(e){k||r(e)},t[71]=k,t[72]=r,t[73]=Oe):Oe=t[73];let ke=Oe,Ae;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=async function(e){F({kind:`confirming`,gitRoot:e})},t[74]=Ae):Ae=t[74];let je=Ae,Me;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Me=async function(){F({kind:`idle`})},t[75]=Me):Me=t[75];let Ne=Me,Pe;t[76]===i?Pe=t[77]:(Pe=async function(e){let t=U.current+1;U.current=t,F({kind:`pending`,gitRoot:e});try{if(await i.fs.removeGitFolder(e),U.current!==t)return;L(Cv),F({kind:`idle`})}catch(e){let n=e;if(U.current!==t)return;let r=n instanceof Error?n.message:String(n);console.error(`[CreateProjectDialog] bridge.fs.removeGitFolder failed:`,n),F({kind:`error`,message:r})}},t[76]=i,t[77]=Pe);let Fe=Pe,Ie;t[78]!==i||t[79]!==r?(Ie=async function(e){r(!1);try{await i.project.open({path:e,target:`new-window`,entryPoint:`create-new-nested-redirect`})}catch(e){console.warn(`[CreateProjectDialog] project.open failed:`,e)}},t[78]=i,t[79]=r,t[80]=Ie):Ie=t[80];let Le=Ie,Re=ge||me||he?`${u} ${d}`:u,ze;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsx)(Tn,{children:(0,Z.jsx)(J,{id:`wbv9xO`})}),t[81]=ze):ze=t[81];let Be;t[82]===fe?Be=t[83]:(Be=(0,Z.jsxs)(kn,{children:[ze,(0,Z.jsx)(wn,{children:fe?(0,Z.jsx)(J,{id:`D2CwBE`,values:{0:fe.name,1:fe.entryCounts.folders},components:{0:(0,Z.jsx)(`strong`,{})}}):(0,Z.jsx)(J,{id:`O6yEPk`})})]}),t[82]=fe,t[83]=Be);let Ve;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,Z.jsx)(J,{id:`OyIC0Q`}),t[84]=Ve):Ve=t[84];let He;t[85]===l?He=t[86]:(He=(0,Z.jsx)(Jr,{htmlFor:l,children:Ve}),t[85]=l,t[86]=He);let Ue;t[87]===s?Ue=t[88]:(Ue=s({id:`cV7LOw`}),t[87]=s,t[88]=Ue);let We;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(We=e=>_(e.target.value),t[89]=We):We=t[89];let Ge=ge||me,Ke;t[90]!==k||t[91]!==g||t[92]!==Re||t[93]!==l||t[94]!==Ue||t[95]!==Ge?(Ke=(0,Z.jsx)(Ru,{id:l,ref:H,value:g,placeholder:Ue,onChange:We,disabled:k,autoComplete:`off`,"aria-invalid":Ge,"aria-describedby":Re,"data-testid":`create-name`}),t[90]=k,t[91]=g,t[92]=Re,t[93]=l,t[94]=Ue,t[95]=Ge,t[96]=Ke):Ke=t[96];let qe;t[97]!==d||t[98]!==me||t[99]!==he||t[100]!==ge||t[101]!==_e?(qe=ge?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-erased`,children:(0,Z.jsx)(J,{id:`_PBJRl`})}):me?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-taken`,children:(0,Z.jsx)(J,{id:`7apDiJ`,values:{sanitized:_e},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):he?(0,Z.jsx)(`p`,{id:d,role:`status`,"aria-live":`polite`,className:`text-1sm text-muted-foreground`,"data-testid":`create-name-hint-diverged`,children:(0,Z.jsx)(J,{id:`KnoB--`,values:{sanitized:_e},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null,t[97]=d,t[98]=me,t[99]=he,t[100]=ge,t[101]=_e,t[102]=qe):qe=t[102];let Je;t[103]!==He||t[104]!==Ke||t[105]!==qe?(Je=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[He,Ke,qe]}),t[103]=He,t[104]=Ke,t[105]=qe,t[106]=Je):Je=t[106];let Ye;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(Jr,{children:(0,Z.jsx)(J,{id:`wJijgU`})}),t[107]=Ye):Ye=t[107];let Xe;t[108]!==f||t[109]!==m?(Xe=f===``?m?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(J,{id:`iHAJDj`})}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(J,{id:`8m8diM`})}):f,t[108]=f,t[109]=m,t[110]=Xe):Xe=t[110];let Ze;t[111]===Xe?Ze=t[112]:(Ze=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1 rounded-md border border-input bg-muted/50 px-2.5 py-1 text-sm text-foreground wrap-break-word`,"data-testid":`create-location-display`,children:Xe}),t[111]=Xe,t[112]=Ze);let Qe;t[113]===Te?Qe=t[114]:(Qe=()=>void Te(),t[113]=Te,t[114]=Qe);let $e;t[115]===Symbol.for(`react.memo_cache_sentinel`)?($e=(0,Z.jsx)(J,{id:`O2UpM1`}),t[115]=$e):$e=t[115];let et;t[116]!==k||t[117]!==Qe?(et=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:k,onClick:Qe,"data-testid":`create-browse`,children:$e}),t[116]=k,t[117]=Qe,t[118]=et):et=t[118];let tt;t[119]!==Ze||t[120]!==et?(tt=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Ze,et]}),t[119]=Ze,t[120]=et,t[121]=tt):tt=t[121];let nt;t[122]===ye?nt=t[123]:(nt=ye===``?null:(0,Z.jsx)(J,{id:`k_yIIc`,values:{targetPreview:ye},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}}),t[122]=ye,t[123]=nt);let rt;t[124]!==u||t[125]!==nt?(rt=(0,Z.jsx)(`p`,{id:u,className:`text-1sm text-muted-foreground wrap-break-word`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:nt}),t[124]=u,t[125]=nt,t[126]=rt):rt=t[126];let it;t[127]!==tt||t[128]!==rt?(it=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Ye,tt,rt]}),t[127]=tt,t[128]=rt,t[129]=it):it=t[129];let at;t[130]!==T||t[131]!==Fe||t[132]!==Le||t[133]!==P?(at=(0,Z.jsx)(Av,{cascade:T,onOpenNested:Le,removeGitState:P,onRequestRemoveGit:je,onCancelRemoveGit:Ne,onConfirmRemoveGit:Fe}),t[130]=T,t[131]=Fe,t[132]=Le,t[133]=P,t[134]=at):at=t[134];let ot;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(ot=(0,Z.jsxs)(Sn,{className:`group flex w-full items-center justify-between gap-2 px-3 py-2 text-sm font-medium hover:bg-muted/50`,"data-testid":`create-advanced-trigger`,children:[(0,Z.jsx)(J,{id:`VNgKZz`}),(0,Z.jsx)(es,{className:`size-4 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]}),t[135]=ot):ot=t[135];let st;t[136]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`0YEbfk`})}),t[136]=st):st=t[136];let ct;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`8IP5jY`})}),t[137]=ct):ct=t[137];let lt;t[138]!==k||t[139]!==v?(lt=ro.map(e=>{let t=`create-editor-${e}`;return(0,Z.jsxs)(Jr,{htmlFor:t,className:`text-sm font-normal`,children:[(0,Z.jsx)(cr,{id:t,checked:v.has(e),onCheckedChange:()=>Ce(e),disabled:k,"data-testid":`create-editor-${e}`}),(0,Z.jsx)(`span`,{children:Co[e]})]},e)}),t[138]=k,t[139]=v,t[140]=lt):lt=t[140];let ut;t[141]===lt?ut=t[142]:(ut=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col space-y-2 pb-2`,children:[st,ct,lt]}),t[141]=lt,t[142]=ut);let dt;t[143]!==k||t[144]!==b?(dt=(0,Z.jsx)(Pu,{idPrefix:`create`,testIdPrefix:`create-sharing`,value:b,onValueChange:x,disabled:k}),t[143]=k,t[144]=b,t[145]=dt):dt=t[145];let ft;t[146]!==ut||t[147]!==dt?(ft=(0,Z.jsxs)(xn,{className:`space-y-6 border-t border-border px-3 py-4`,children:[ut,dt]}),t[146]=ut,t[147]=dt,t[148]=ft):ft=t[148];let pt;t[149]!==S||t[150]!==ft?(pt=(0,Z.jsxs)(Cn,{open:S,onOpenChange:C,className:`rounded-md border border-border`,"data-testid":`create-advanced`,children:[ot,ft]}),t[149]=S,t[150]=ft,t[151]=pt):pt=t[151];let mt;t[152]!==s||t[153]!==j?(mt=j===null?null:(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-submit-error`,children:s(xv(j))}),t[152]=s,t[153]=j,t[154]=mt):mt=t[154];let ht;t[155]!==c||t[156]!==De||t[157]!==Je||t[158]!==it||t[159]!==at||t[160]!==pt||t[161]!==mt?(ht=(0,Z.jsx)(Dn,{className:`space-y-6`,children:(0,Z.jsxs)(`form`,{id:c,onSubmit:De,"data-testid":`create-project-form`,className:`space-y-6`,children:[Je,it,at,pt,mt]})}),t[155]=c,t[156]=De,t[157]=Je,t[158]=it,t[159]=at,t[160]=pt,t[161]=mt,t[162]=ht):ht=t[162];let gt;t[163]===r?gt=t[164]:(gt=()=>r(!1),t[163]=r,t[164]=gt);let _t;t[165]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Z.jsx)(J,{id:`dEgA5A`}),t[165]=_t):_t=t[165];let vt;t[166]!==k||t[167]!==gt?(vt=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:gt,disabled:k,"data-testid":`create-cancel`,children:_t}),t[166]=k,t[167]=gt,t[168]=vt):vt=t[168];let yt;t[169]===k?yt=t[170]:(yt=k?(0,Z.jsx)(J,{id:`E9bKSA`}):(0,Z.jsx)(J,{id:`hYgDIe`}),t[169]=k,t[170]=yt);let bt;t[171]!==c||t[172]!==xe||t[173]!==yt?(bt=(0,Z.jsx)(X,{type:`submit`,form:c,disabled:xe,"data-testid":`create-submit`,children:yt}),t[171]=c,t[172]=xe,t[173]=yt,t[174]=bt):bt=t[174];let xt;t[175]!==vt||t[176]!==bt?(xt=(0,Z.jsxs)(On,{children:[vt,bt]}),t[175]=vt,t[176]=bt,t[177]=xt):xt=t[177];let St;t[178]!==Be||t[179]!==ht||t[180]!==xt?(St=(0,Z.jsxs)(En,{className:`sm:max-w-lg`,"data-testid":`create-project-dialog`,children:[Be,ht,xt]}),t[178]=Be,t[179]=ht,t[180]=xt,t[181]=St):St=t[181];let Ct;return t[182]!==ke||t[183]!==n||t[184]!==St?(Ct=(0,Z.jsx)(An,{open:n,onOpenChange:ke,children:St}),t[182]=ke,t[183]=n,t[184]=St,t[185]=Ct):Ct=t[185],Ct}function Cv(e){return e+1}function wv(e){return e+1}function Tv(){}function Ev(e){return e+1}function Dv(e){return e+1}function Ov(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function kv(){return new Set(ro)}function Av(e){let t=(0,$.c)(37),{cascade:n,onOpenNested:r,removeGitState:i,onRequestRemoveGit:a,onCancelRemoveGit:o,onConfirmRemoveGit:s}=e;if(n.kind===`idle`||n.kind===`free`||n.kind===`block-nonempty`)return null;if(n.kind===`block-nested`){let{rootPath:e}=n,i;t[0]===e?i=t[1]:(i=vv(e),t[0]=e,t[1]=i);let a=i,o;t[2]===e?o=t[3]:(o={rootPath:e},t[2]=e,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})},t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`mb-2`,children:(0,Z.jsx)(J,{id:`W7XJN4`,values:o,components:s})}),t[5]=o,t[6]=c);let l;t[7]!==r||t[8]!==e?(l=()=>r(e),t[7]=r,t[8]=e,t[9]=l):l=t[9];let u;t[10]===a?u=t[11]:(u=(0,Z.jsx)(J,{id:`1Ta7Fd`,values:{basename:a}}),t[10]=a,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:l,"data-testid":`create-banner-nested-open`,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;return t[15]!==c||t[16]!==d?(f=(0,Z.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-banner-nested`,children:[c,d]}),t[15]=c,t[16]=d,t[17]=f):f=t[17],f}if(n.kind===`confirm-git`){let{gitRoot:e}=n,r;if(t[18]!==e){let n;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(n=/\/+$/,t[20]=n):n=t[20],r=e.replace(n,``),t[18]=e,t[19]=r}else r=t[19];let c=`${r}/.git`,l=i.kind===`error`?i.message:null,u;t[21]===e?u=t[22]:(u={gitRoot:e},t[21]=e,t[22]=u);let d;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(d={0:(0,Z.jsx)(`code`,{}),1:(0,Z.jsx)(`code`,{})},t[23]=d):d=t[23];let f;t[24]===u?f=t[25]:(f=(0,Z.jsx)(`p`,{children:(0,Z.jsx)(J,{id:`FEK4oC`,values:u,components:d})}),t[24]=u,t[25]=f);let p;t[26]!==e||t[27]!==o||t[28]!==s||t[29]!==a||t[30]!==l||t[31]!==i.kind||t[32]!==c?(p=i.kind===`idle`||i.kind===`error`?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1`,children:[(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(e),"data-testid":`create-banner-git-remove`,children:(0,Z.jsx)(J,{id:`YTLmTM`,components:{0:(0,Z.jsx)(`code`,{})}})}),i.kind===`error`?(0,Z.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,"data-testid":`create-banner-git-remove-error`,children:(0,Z.jsx)(J,{id:`SkMZlS`,values:{targetGitPath:c,removeGitError:l},components:{0:(0,Z.jsx)(`code`,{})}})}):null]}):(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 rounded border border-blue-400/60 bg-white/40 p-2 dark:border-blue-600/60 dark:bg-black/20`,"data-testid":`create-banner-git-remove-confirm`,children:[(0,Z.jsx)(`p`,{className:`text-xs`,children:(0,Z.jsx)(J,{id:`WZ-vBy`,values:{targetGitPath:c},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(X,{type:`button`,variant:`destructive`,size:`sm`,disabled:i.kind===`pending`,onClick:()=>s(e),"data-testid":`create-banner-git-remove-confirm-button`,children:i.kind===`pending`?(0,Z.jsx)(J,{id:`0-31GV`}):(0,Z.jsx)(J,{id:`v-h2hx`,values:{targetGitPath:c}})}),(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,disabled:i.kind===`pending`,onClick:o,"data-testid":`create-banner-git-remove-cancel`,children:(0,Z.jsx)(J,{id:`dEgA5A`})})]})]}),t[26]=e,t[27]=o,t[28]=s,t[29]=a,t[30]=l,t[31]=i.kind,t[32]=c,t[33]=p):p=t[33];let m;return t[34]!==f||t[35]!==p?(m=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`rounded-md border border-blue-300 bg-blue-50 px-3 py-2 text-sm text-blue-900 dark:border-blue-700 dark:bg-blue-950 dark:text-blue-200`,"data-testid":`create-banner-git-confirm`,children:[f,p]}),t[34]=f,t[35]=p,t[36]=m):m=t[36],m}return null}function jv(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`GitHub`}),r=(0,Z.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function Mv(e){if(e===null)return`none`;switch(e.kind){case`doc`:case`folder-index`:return`doc`;case`folder`:return`folder`;case`asset`:case`skill-file`:case`large-file`:return`asset`;case`missing`:return`none`}}var Nv={back:{id:`iH8pgl`},forward:{id:`rxWGWX`},newFile:{id:`HdkSiO`},newFolder:{id:`96G6Re`},openGraph:{id:`3Fcb0I`},initializeStarterPack:{id:`fWi7pn`},newProject:{id:`gKi-a_`},openFolderOnDisk:{id:`WPwDin`},openFileOnDisk:{id:`ka6Eke`},switchProject:{id:`xaDWAI`},settings:{id:`Tz0i8g`},installClaudeDesktop:{id:`62Pc08`},reportBug:{id:`cd5EXh`},bugReportHistory:{id:`QHCx0c`},sendFeedback:{id:`RoafuO`},newFromTemplate:{id:`Uuj_R4`},rename:{id:`2wxgft`},duplicate:{id:`euc6Ns`},moveToTrash:{id:`q3TWG7`},revealInFinder:{id:`LtSYdi`},copyFullPath:{id:`Up2_7p`},copyRelativePath:{id:`M6mvVi`},closeTab:{id:`r6ncaO`},newWorktree:{id:`DXd9LM`},switchWorktree:{id:`8Vq20-`},sidebarShow:{id:`151wvk`},sidebarHide:{id:`Q1mtyd`},docPanelShow:{id:`fSRzLo`},docPanelHide:{id:`GSYWCm`},terminalShow:{id:`xi9KGG`},terminalHide:{id:`9xCnv8`},showHiddenFiles:{id:`XcGbim`},showOkFolders:{id:`GHsJb8`},showOnlyMarkdownFiles:{id:`WkTLN7`},showSkillsSection:{id:`NF_Wcg`},expandAll:{id:`OlAl5i`},collapseAll:{id:`qvWGzP`},newTerminal:{id:`ZBxvV3`},killTerminal:{id:`5_j-DA`},checkForUpdates:{id:`WMCwmR`},setUpIntegrations:{id:`AhoGwP`},checkSpelling:{id:`ZgJVnp`},openOnGithub:{id:`LeGeTf`}},Pv={"navigate-back":Qo,"navigate-forward":es,"new-file":er,"new-folder":x_,"open-graph":F_,"initialize-starter-pack":L_,"new-project":tn,"open-folder":Dc,"open-file":qn,"switch-project":h,settings:K_,"install-claude-desktop":_c,"report-bug":E,"bug-report-history":Fc,"send-feedback":Bl,"new-from-template":er,rename:hc,duplicate:gc,"move-to-trash":Tu,"reveal-in-finder":Dc,"copy-full-path":gc,"copy-relative-path":gc,"close-tab":ju,"new-worktree":To,"switch-worktree":To,"toggle-sidebar":xt,"toggle-doc-panel":Pc,"toggle-terminal":qc,"toggle-show-hidden-files":yc,"toggle-show-ok-folders":S_,"toggle-show-only-markdown-files":qn,"toggle-show-skills-section":lc,"expand-all-tree":fv,"collapse-all-tree":y_,"new-terminal":qc,"kill-terminal":qc,"check-for-updates":_u,"set-up-integrations":t_,"toggle-spell-check":X_,"open-github":jv},Fv={"new-file":e=>{e.closePalette(),e.openNewItemDialog(`file`)},"new-folder":e=>{e.closePalette(),e.openNewItemDialog(`folder`)},"open-graph":e=>{e.closePalette(),tu(`graph`)},"initialize-starter-pack":e=>{e.closePalette(),e.openSeedDialog()},"new-project":e=>{e.closePalette(),e.openCreateProjectDialog()},"open-folder":e=>{let t=e.bridge;t&&e.runAction(async()=>{let e=await t.dialog.openFolder();e&&await t.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})})},"open-file":e=>{let t=e.bridge;t&&e.runAction(()=>t.project.openFile())},"switch-project":e=>{let t=e.bridge;t&&e.runAction(()=>t.navigator.open(),zu._({id:`jol95m`}))},settings:e=>{e.closePalette(),window.location.hash!==`#settings`&&(window.location.hash=Xu)},"install-claude-desktop":e=>{e.closePalette(),window.location.hash=`#install-claude-desktop`},"report-bug":e=>{e.closePalette(),e.openReportBugDialog()},"bug-report-history":e=>{e.closePalette(),e.openBugReportHistory()},"send-feedback":e=>{e.closePalette(),e.openFeedbackDialog()},"check-for-updates":e=>e.runAction(async()=>{await e.bridge?.update.checkNow()}),"set-up-integrations":e=>e.runAction(async()=>{await e.bridge?.mcpWiring.reconfigure()}),"toggle-spell-check":e=>e.runAction(async()=>{await e.bridge?.spellcheck.toggle()}),"open-github":e=>e.openExternalUrl(eo)};function Iv(e){return{host:e.bridge===null?`web`:`desktop`,activeTargetKind:e.contextualTargetKind,singleFile:e.singleFile,terminalLive:e.viewMenuState.terminalLive===!0,canExpandAll:e.viewMenuState.canExpandAll!==!1,canCollapseAll:e.viewMenuState.canCollapseAll!==!1,hasActiveDoc:e.activeDocName!==null,showInstallSkill:!1}}function Lv(e,t){if(e.stateToggle){let n=t.viewMenuState[e.stateToggle.stateField]===!0?e.stateToggle.hideKey:e.stateToggle.showKey;return zu._(Nv[n])}return zu._(Nv[e.labelKey])}function Rv(e){let t=e.menuActionId;return e=>e.emitMenuAction(t)}function zv(e){let t=e.palette;if(!t)throw Error(`command ${e.id} has no palette presence`);let n=Pv[e.id];if(!n)throw Error(`command ${e.id} has no palette icon`);let r=e.checkField;return{id:e.id,menuActionId:e.menuActionId,label:t=>Lv(e,t),keywords:e.keywords,icon:n,group:t.group,visibility:t.visibility,shortcutId:e.shortcutId,shortcutDesktopOnly:e.shortcutDesktopOnly,checked:r?e=>e.viewMenuState[r]===!0:void 0,available:t=>Ui(e.availability,Iv(t)),dispatch:Fv[e.id]??Rv(e)}}var Bv=ho.flatMap(e=>e.palette?[zv(e)]:[]),Vv=`ok-omnibar-recents-v1`,Hv=10;function Uv(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function Wv(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Gv(e,t){return`${e}:${t}`}function Kv(e){let t=Wv(e);if(!t)return[];try{let e=t.getItem(Vv);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(Uv).slice(0,Hv):[]}catch{return[]}}function qv(e,t){let n=Wv(t);if(n)try{n.setItem(Vv,JSON.stringify(e.slice(0,Hv)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function Jv(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,Hv)}function Yv(e,t){return e.filter(e=>t.has(Gv(e.kind,e.path)))}var Xv=50,Zv=50,Qv=``,$v=null;function ey(e){return e.trim().toLowerCase()}function ty(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ny(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function ry(e,t,n=new Map,r=new Map,i=new Set){let a=[],o=new Set;for(let t of e){o.add(t);let e=r.get(t),i=e?.modified,s=n.get(t);a.push({kind:`file`,path:t,name:Mi(t),...s&&{title:s},...e?.docExt&&{docExt:e.docExt},...i&&{modifiedTs:Date.parse(i)}})}for(let e of i)o.has(e)||(o.add(e),a.push({kind:`file`,path:e,name:Mi(e),bodyIndexed:!1}));for(let e of t)a.push({kind:`folder`,path:e,name:Mi(e)});return a.sort((e,t)=>{let n=e.path.localeCompare(t.path);return n===0?e.kind===t.kind?0:e.kind===`folder`?-1:1:n}),a}function iy(e){return Bi({kind:e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function ay(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`}:${e.path}`,e])),corpus:sa(e.map(iy))}}function oy(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.docExt??``}\u0000${e.modifiedTs??0} ${e.bodyIndexed===!1?`0`:`1`}`).join(``)}function sy(e){let t=oy(e);return $v&&Qv===t?$v:(Qv=t,$v=ay(e),$v)}function cy(e,t,n=Xv){return ly(sy(e),t,n)}function ly(e,t,n=Xv){let r=ey(t);return r?Ha(e.corpus,r,{intent:`omnibar`,limit:n,scopes:[`page`,`folder`,`file`]}).map(t=>e.byId.get(t.document.id)).filter(e=>e!==void 0):e.entries.slice(0,20)}function uy(e,t){let n=ny(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(ty).join(`|`)})`,`gi`),i=[],a=0;for(let t of e.matchAll(r)){let n=t.index??0;n>a&&i.push({text:e.slice(a,n),match:!1,start:a}),i.push({text:t[0],match:!0,start:n}),a=n+t[0].length}return a<e.length&&i.push({text:e.slice(a),match:!1,start:a}),i.length>0?i:[{text:e,match:!1,start:0}]}function dy(e){if(e.kind!==`page`&&e.kind!==`folder`&&e.kind!==`file`||typeof e.path!=`string`)return null;let t=Mi(e.path);return{kind:e.kind===`folder`?`folder`:`file`,path:e.path,name:t,...e.kind===`file`&&{bodyIndexed:!1},...e.title&&{title:e.title},...e.snippet&&{snippet:e.snippet},...typeof e.score==`number`&&{score:e.score}}}async function fy(e,t={}){let n=e.trim();if(!n)return{entries:[],truncated:!1,ready:!0};let r=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({query:n,intent:`full_text`,ranking:t.semantic?`relevance`:`navigation`,scopes:[`page`,`folder`,`content`,`file`],limit:t.limit??Zv,source:`omnibar`,...t.semantic?{semantic:!0}:{}}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(Qu(e)??`Search failed with status ${r.status}`)}let i=await r.json();return{entries:(i.results??[]).map(dy).filter(e=>!!e),truncated:i.truncated===!0,ready:i.ready!==!1}}function py(e,t,n=[]){let r=ey(t);return r?ey([e,...n].join(` `)).includes(r):!0}function my(e,t,n={}){if(e.trim()===``)return`idle`;if(t.length===0)return`empty`;if(n.truncated)return`truncated`;for(let e of t)if(`snippet`in e&&typeof e.snippet==`string`&&e.snippet.length>0)return`content`;return`name-only`}function hy(e){let{query:t,firedQuery:n,status:r,resultCount:i}=e,a=i>0,o=t!==``&&t!==n,s=a&&(r===`loading`||t!==n),c=null;r===`error`&&t!==``?c={kind:`retry`,query:t}:o&&r!==`loading`&&(c={kind:`search`,query:t});let l=null;return r===`loading`?l=`searching`:t===``&&!a?l=`empty`:r===`success`&&!o&&!a&&(l=`no-results`),{submit:c,results:{show:a,dimmed:s,forQuery:a?n:null},notice:l}}var gy=`tag:`;function _y(e,t){if(!e.toLowerCase().startsWith(`tag:`))return{kind:`normal`,query:e};let n=e.slice(4).replace(/^\s+/,``).trim();return n&&t.has(n)?{kind:`tag-docs`,tagName:n}:{kind:`tag-list`,query:n}}function vy(e,t){return Xe(e,t)}var yy=rt;async function by(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`/api/tags/${e} responded with ${t.status}`);let n=await t.json();return Array.isArray(n.docs)?n.docs:[]}var xy=(0,Q.lazy)(()=>n(()=>import(`./FeedbackForm-CuzqS5aL.js`).then(e=>({default:e.FeedbackForm})),[],import.meta.url)),Sy=e=>{let t=(0,$.c)(11),{open:n,onOpenChange:r,source:i,onSuccess:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(kn,{children:(0,Z.jsx)(Tn,{children:(0,Z.jsx)(J,{id:`SItQRc`})})}),t[0]=o):o=t[0];let s;t[1]!==r||t[2]!==a?(s=()=>{r(!1),a?.()},t[1]=r,t[2]=a,t[3]=s):s=t[3];let c;t[4]!==i||t[5]!==s?(c=(0,Z.jsxs)(En,{children:[o,(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(xy,{source:i,onSuccess:s})})]}),t[4]=i,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==r||t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(An,{open:n,onOpenChange:r,children:c}),t[7]=r,t[8]=n,t[9]=c,t[10]=l):l=t[10],l},Cy=[`.md`,`.mdx`];function wy(e){let t=e.toLowerCase();for(let e of Cy)if(t.endsWith(e))return e;return null}var Ty={local:0,inherited:1};function Ey(e){return[...e].sort((e,t)=>{let n=Ty[e.scope]-Ty[t.scope];if(n!==0)return n;let r=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return r.localeCompare(i)})}var Dy=`__blank__`;function Oy(e){return e.trim()?e.includes(`..`)?`dotdot`:e.startsWith(`/`)?`leading-slash`:e.includes(`\\`)?`backslash`:e.includes(`\0`)?`null-byte`:null:`empty`}function ky(e){switch(e){case`empty`:return{id:`hYDc6B`};case`dotdot`:return{id:`Wyxs0x`};case`leading-slash`:return{id:`OYnx7O`};case`backslash`:return{id:`qo4zCg`};case`null-byte`:return{id:`saYiIO`}}}function Ay(e){let t=e.fileName.trim(),n=wy(t)?t:`${t}${e.fileExtension??`.md`}`;if(e.kind===`folder`){let t=(e.folderName??``).trim();return`${e.initialDir?`${e.initialDir}/${t}`:t}/${n}`}return e.initialDir?`${e.initialDir}/${n}`:n}function jy(e,t){return Bu(e.target)?!1:Zu(e,`new-item`,t)}function My(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function Ny(e){let t=(0,$.c)(136),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:o,initialTemplate:s,defaultToTemplate:c,description:l,onCreated:u,folderConfig:d}=e,{_:f}=Dt(),{addPage:p}=rs(),m=Ws(d?null:a),h=d??m,[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(Dy),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),A=(0,Q.useId)(),j=(0,Q.useId)(),M=(0,Q.useId)(),N=(0,Q.useId)(),P=(0,Q.useId)(),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z,B;t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==o?(z=()=>{n&&(T(null),k(null),D(!1),y(``),x(i===`file`&&s?s:Dy),C(!1),I(!1),_(i===`file`?o??`untitled`:`index`))},B=[n,i,o,s],t[0]=s,t[1]=i,t[2]=n,t[3]=o,t[4]=z,t[5]=B):(z=t[4],B=t[5]),(0,Q.useEffect)(z,B);let V;t[6]!==h.state.data||t[7]!==h.state.status?(V=h.state.status===`ready`?Ey(h.state.data.folder.templates_available??[]):[],t[6]=h.state.data,t[7]=h.state.status,t[8]=V):V=t[8];let H=V,U;t[9]!==h.state.data||t[10]!==h.state.status||t[11]!==n||t[12]!==b?(U=()=>{n&&b!==Dy&&h.state.status===`ready`&&((h.state.data.folder.templates_available??[]).some(e=>e.name===b)||x(Dy))},t[9]=h.state.data,t[10]=h.state.status,t[11]=n,t[12]=b,t[13]=U):U=t[13];let ee;t[14]!==h.state||t[15]!==n||t[16]!==b?(ee=[n,b,h.state],t[14]=h.state,t[15]=n,t[16]=b,t[17]=ee):ee=t[17],(0,Q.useEffect)(U,ee);let W;t[18]!==c||t[19]!==h.state.data||t[20]!==h.state.status||t[21]!==s||t[22]!==n||t[23]!==S?(W=()=>{if(!n||!c||s||S||h.state.status!==`ready`)return;let e=Ey(h.state.data.folder.templates_available??[]);e.length>0&&x(e[0].name)},t[18]=c,t[19]=h.state.data,t[20]=h.state.status,t[21]=s,t[22]=n,t[23]=S,t[24]=W):W=t[24];let te;t[25]!==c||t[26]!==h.state||t[27]!==s||t[28]!==n||t[29]!==S?(te=[n,c,s,S,h.state],t[25]=c,t[26]=h.state,t[27]=s,t[28]=n,t[29]=S,t[30]=te):te=t[30],(0,Q.useEffect)(W,te);let G=i===`file`,ne=h.state.status===`loading`||h.state.status===`idle`,K=h.state.status===`error`?h.state.message:null,q;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(q=function(e){_(e),T(null)},t[31]=q):q=t[31];let re=q,ie;t[32]!==g||t[33]!==v||t[34]!==a||t[35]!==i?(ie=function(){return Ay({kind:i,initialDir:a,fileName:g,folderName:v})},t[32]=g,t[33]=v,t[34]=a,t[35]=i,t[36]=ie):ie=t[36];let ae=ie,oe;t[37]!==f||t[38]!==g||t[39]!==v||t[40]!==i?(oe=function(){if(i===`folder`){let e=Oy(v.trim());if(e)return{message:f({id:`ODGGlj`,values:{detail:f(ky(e))}}),field:`folder`}}let e=Oy(g.trim());return e?{message:f(ky(e)),field:`file`}:null},t[37]=f,t[38]=g,t[39]=v,t[40]=i,t[41]=oe):oe=t[41];let se=oe,ce;t[42]!==E||t[43]!==g||t[44]!==v||t[45]!==i?(ce=E||!g.trim()||i===`folder`&&!v.trim(),t[42]=E,t[43]=g,t[44]=v,t[45]=i,t[46]=ce):ce=t[46];let le=ce,ue;t[47]!==f||t[48]!==p||t[49]!==ae||t[50]!==se||t[51]!==i||t[52]!==u||t[53]!==r||t[54]!==b?(ue=async function(){let e=se();if(e){T(e.message),k(e.field);return}D(!0),T(null),k(null);let t=ae(),n=i===`file`&&b!==Dy?b:void 0,a={path:t};n!==void 0&&(a.template=n);try{let e=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),t=e.status,n=await pe(e,f({id:`d2uTPx`,values:{status:t}}));if(!n.ok){D(!1),T(n.title),k(`form`);return}let o=Ra.safeParse(n.body);if(D(!1),!o.success){T(f(i===`folder`?{id:`K1ckLX`}:{id:`fJgQHX`})),k(`form`);return}let s=o.data.docName;r(!1),window.location.hash=`#/${s}`,p(s),Sd([`files`,`backlinks`,`graph`]),u?.(s)}catch(e){console.warn(`[NewItemDialog] create failed:`,e),D(!1),T(f({id:`HIb0vl`})),k(`form`)}},t[47]=f,t[48]=p,t[49]=ae,t[50]=se,t[51]=i,t[52]=u,t[53]=r,t[54]=b,t[55]=ue):ue=t[55];let de=ue,fe;t[56]!==f||t[57]!==a?(fe=a||f({id:`L6Hhh6`}),t[56]=f,t[57]=a,t[58]=fe):fe=t[58];let me=fe,he;t[59]===i?he=t[60]:(he=(0,Z.jsx)(Tn,{children:i===`file`?(0,Z.jsx)(J,{id:`HdkSiO`}):(0,Z.jsx)(J,{id:`96G6Re`})}),t[59]=i,t[60]=he);let ge;t[61]!==l||t[62]!==me?(ge=l??(0,Z.jsx)(J,{id:`NvOvTi`,values:{dirDisplay:me},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})}}),t[61]=l,t[62]=me,t[63]=ge):ge=t[63];let _e;t[64]===ge?_e=t[65]:(_e=(0,Z.jsx)(wn,{children:ge}),t[64]=ge,t[65]=_e);let ve;t[66]!==he||t[67]!==_e?(ve=(0,Z.jsxs)(kn,{children:[he,_e]}),t[66]=he,t[67]=_e,t[68]=ve):ve=t[68];let ye;t[69]!==b||t[70]!==G||t[71]!==N||t[72]!==F||t[73]!==P||t[74]!==H||t[75]!==K||t[76]!==ne?(ye=G&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{id:N,className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`f65AOQ`})}),K?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,children:(0,Z.jsx)(J,{id:`sE7R19`,values:{templatesError:K}})}):null,(0,Z.jsx)(Fy,{triggerId:P,labelledById:N,open:F,onOpenChange:I,value:b,onValueChange:e=>{x(e),C(!0)},templates:H,loading:ne}),!ne&&!K&&H.length===0?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`uWtdQR`})}):null]}),t[69]=b,t[70]=G,t[71]=N,t[72]=F,t[73]=P,t[74]=H,t[75]=K,t[76]=ne,t[77]=ye):ye=t[77];let be;t[78]!==f||t[79]!==w||t[80]!==O||t[81]!==A||t[82]!==j||t[83]!==v||t[84]!==i?(be=i===`folder`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:j,children:(0,Z.jsx)(J,{id:`cqQyPB`})}),(0,Z.jsx)(Ru,{ref:R,id:j,value:v,onChange:e=>{y(e.target.value),T(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":w&&(O===`folder`||O===`form`)?A:void 0,"aria-invalid":w&&(O===`folder`||O===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=Oy(v.trim());if(t){T(f({id:`ODGGlj`,values:{detail:f(ky(t))}})),k(`folder`);return}L.current?.focus()}}})]}),t[78]=f,t[79]=w,t[80]=O,t[81]=A,t[82]=j,t[83]=v,t[84]=i,t[85]=be):be=t[85];let xe;t[86]===i?xe=t[87]:(xe=i===`folder`?(0,Z.jsx)(J,{id:`jjtmV_`}):(0,Z.jsx)(J,{id:`s-XOaI`}),t[86]=i,t[87]=xe);let Se;t[88]!==M||t[89]!==xe?(Se=(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:M,children:xe}),t[88]=M,t[89]=xe,t[90]=Se):Se=t[90];let Ce;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=e=>re(e.target.value),t[91]=Ce):Ce=t[91];let we=i===`file`,Te=w&&(O===`file`||O===`form`)?A:void 0,Ee=w&&(O===`file`||O===`form`)?!0:void 0,De;t[92]!==de||t[93]!==le?(De=e=>{e.key===`Enter`&&!le&&de()},t[92]=de,t[93]=le,t[94]=De):De=t[94];let Oe;t[95]!==M||t[96]!==g||t[97]!==we||t[98]!==Te||t[99]!==Ee||t[100]!==De?(Oe=(0,Z.jsx)(Ru,{ref:L,id:M,value:g,onChange:Ce,placeholder:`my-note`,autoFocus:we,"aria-describedby":Te,"aria-invalid":Ee,onFocus:Py,onKeyDown:De}),t[95]=M,t[96]=g,t[97]=we,t[98]=Te,t[99]=Ee,t[100]=De,t[101]=Oe):Oe=t[101];let ke;t[102]!==w||t[103]!==A?(ke=w&&(0,Z.jsx)(`p`,{id:A,role:`alert`,className:`text-1sm text-destructive`,children:w}),t[102]=w,t[103]=A,t[104]=ke):ke=t[104];let Ae;t[105]!==Se||t[106]!==Oe||t[107]!==ke?(Ae=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Se,Oe,ke]}),t[105]=Se,t[106]=Oe,t[107]=ke,t[108]=Ae):Ae=t[108];let je;t[109]!==ye||t[110]!==be||t[111]!==Ae?(je=(0,Z.jsxs)(Dn,{className:`space-y-6 pb-1`,children:[ye,be,Ae]}),t[109]=ye,t[110]=be,t[111]=Ae,t[112]=je):je=t[112];let Me;t[113]===r?Me=t[114]:(Me=()=>r(!1),t[113]=r,t[114]=Me);let Ne;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Z.jsx)(J,{id:`dEgA5A`}),t[115]=Ne):Ne=t[115];let Pe;t[116]!==E||t[117]!==Me?(Pe=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:Me,disabled:E,children:Ne}),t[116]=E,t[117]=Me,t[118]=Pe):Pe=t[118];let Fe;t[119]===E?Fe=t[120]:(Fe=E?(0,Z.jsx)(J,{id:`E9bKSA`}):(0,Z.jsx)(J,{id:`hYgDIe`}),t[119]=E,t[120]=Fe);let Ie;t[121]!==de||t[122]!==le||t[123]!==Fe?(Ie=(0,Z.jsx)(X,{onClick:de,disabled:le,children:Fe}),t[121]=de,t[122]=le,t[123]=Fe,t[124]=Ie):Ie=t[124];let Le;t[125]!==Pe||t[126]!==Ie?(Le=(0,Z.jsxs)(On,{children:[Pe,Ie]}),t[125]=Pe,t[126]=Ie,t[127]=Le):Le=t[127];let Re;t[128]!==ve||t[129]!==je||t[130]!==Le?(Re=(0,Z.jsxs)(En,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[ve,je,Le]}),t[128]=ve,t[129]=je,t[130]=Le,t[131]=Re):Re=t[131];let ze;return t[132]!==r||t[133]!==n||t[134]!==Re?(ze=(0,Z.jsx)(An,{open:n,onOpenChange:r,children:Re}),t[132]=r,t[133]=n,t[134]=Re,t[135]=ze):ze=t[135],ze}function Py(e){return My(e.currentTarget)}function Fy(e){let t=(0,$.c)(66),{triggerId:n,labelledById:r,open:i,onOpenChange:o,value:s,onValueChange:c,templates:l,loading:u}=e,{_:d}=Dt(),f=(0,Q.useId)(),p;if(t[0]!==l||t[1]!==s){let e;t[3]===s?e=t[4]:(e=e=>e.name===s,t[3]=s,t[4]=e),p=l.find(e),t[0]=l,t[1]=s,t[2]=p}else p=t[2];let m=p,h=s===Dy,g=i?f:void 0,_=`${r} ${n}`,v;t[5]!==h||t[6]!==u||t[7]!==m?.name||t[8]!==m?.title||t[9]!==s?(v=u?(0,Z.jsx)(J,{id:`Hl89Qd`}):h?(0,Z.jsx)(J,{id:`E7BhZn`}):m?.title??m?.name??s,t[5]=h,t[6]=u,t[7]=m?.name,t[8]=m?.title,t[9]=s,t[10]=v):v=t[10];let y;t[11]===v?y=t[12]:(y=(0,Z.jsx)(`span`,{className:`truncate`,children:v}),t[11]=v,t[12]=y);let b;t[13]!==h||t[14]!==u||t[15]!==m?(b=!u&&!h&&m?(0,Z.jsx)(zy,{entry:m}):null,t[13]=h,t[14]=u,t[15]=m,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==b?(x=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[y,b]}),t[17]=y,t[18]=b,t[19]=x):x=t[19];let S;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(a_,{className:`ml-2 size-4 shrink-0 opacity-50`,"aria-hidden":`true`}),t[20]=S):S=t[20];let C;t[21]!==u||t[22]!==i||t[23]!==g||t[24]!==_||t[25]!==x||t[26]!==n?(C=(0,Z.jsx)($t,{asChild:!0,children:(0,Z.jsxs)(X,{id:n,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":i,"aria-haspopup":`listbox`,"aria-controls":g,"aria-labelledby":_,disabled:u,className:`w-full justify-between font-normal`,children:[x,S]})}),t[21]=u,t[22]=i,t[23]=g,t[24]=_,t[25]=x,t[26]=n,t[27]=C):C=t[27];let w;t[28]===d?w=t[29]:(w=d({id:`UQAp48`}),t[28]=d,t[29]=w);let T;t[30]===w?T=t[31]:(T=(0,Z.jsx)(st,{placeholder:w}),t[30]=w,t[31]=T);let E;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(ft,{children:(0,Z.jsx)(J,{id:`c8iK2Y`})}),t[32]=E):E=t[32];let D;if(t[33]!==o||t[34]!==c||t[35]!==l||t[36]!==s){let e;t[38]!==o||t[39]!==c||t[40]!==s?(e=e=>{let t=e.title??e.name,n=e.title&&e.title!==e.name?e.name:void 0,r=`${e.scope}:${e.source_folder}:${e.name}`;return(0,Z.jsxs)(Re,{value:r,keywords:[t,e.name,e.description??``,e.scope,e.source_folder??``],onSelect:()=>{c(e.name),o(!1)},className:`items-start gap-3`,children:[(0,Z.jsx)(Zo,{className:Y(`mt-1 size-4 shrink-0`,s===e.name?`opacity-100`:`opacity-0`),"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t}),n?(0,Z.jsx)(`code`,{className:`font-mono text-2xs text-muted-foreground shrink-0`,children:n}):null,(0,Z.jsx)(zy,{entry:e,className:`ml-auto`})]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):null]})]},r)},t[38]=o,t[39]=c,t[40]=s,t[41]=e):e=t[41],D=l.map(e),t[33]=o,t[34]=c,t[35]=l,t[36]=s,t[37]=D}else D=t[37];let O;t[42]!==o||t[43]!==c?(O=()=>{c(Dy),o(!1)},t[42]=o,t[43]=c,t[44]=O):O=t[44];let k=s===Dy?`opacity-100`:`opacity-0`,A;t[45]===k?A=t[46]:(A=Y(`mt-1 size-4 shrink-0`,k),t[45]=k,t[46]=A);let j;t[47]===A?j=t[48]:(j=(0,Z.jsx)(Zo,{className:A,"aria-hidden":`true`}),t[47]=A,t[48]=j);let M;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`E7BhZn`})}),t[49]=M):M=t[49];let N;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[M,(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hZoBHK`})})]}),t[50]=N):N=t[50];let P;t[51]!==O||t[52]!==j?(P=(0,Z.jsxs)(Re,{value:`Blank note empty`,onSelect:O,className:`items-start gap-3`,children:[j,N]}),t[51]=O,t[52]=j,t[53]=P):P=t[53];let F;t[54]!==f||t[55]!==D||t[56]!==P?(F=(0,Z.jsxs)(_e,{id:f,className:`subtle-scrollbar`,children:[E,D,P]}),t[54]=f,t[55]=D,t[56]=P,t[57]=F):F=t[57];let I;t[58]!==T||t[59]!==F?(I=(0,Z.jsx)(an,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:Ry,onWheel:Ly,onTouchMove:Iy,children:(0,Z.jsxs)(a,{children:[T,F]})}),t[58]=T,t[59]=F,t[60]=I):I=t[60];let L;return t[61]!==o||t[62]!==i||t[63]!==I||t[64]!==C?(L=(0,Z.jsxs)(Qt,{open:i,onOpenChange:o,children:[C,I]}),t[61]=o,t[62]=i,t[63]=I,t[64]=C,t[65]=L):L=t[65],L}function Iy(e){e.stopPropagation()}function Ly(e){e.stopPropagation()}function Ry(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function zy(e){let t=(0,$.c)(7),{entry:n,className:r}=e;if(n.scope===`inherited`){let e;t[0]===r?e=t[1]:(e=Y(`shrink-0 text-2xs`,r),t[0]=r,t[1]=e);let i;t[2]===n.source_folder?i=t[3]:(i=n.source_folder||(0,Z.jsx)(J,{id:`ZNK2Tq`}),t[2]=n.source_folder,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Z.jsx)(Ud,{variant:`gray`,className:e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}return null}function By(e){return e.split(`/`).pop()??e}function Vy(e,t){let n=[];for(let r of t?.folders??[]){let t=`${r.path}/.ok/templates/`,i=e.created.filter(e=>e.kind===`file`&&(e.path.startsWith(t)||e.path.includes(`/${t}`))).map(e=>By(e.path)),a=i.length,o=e.created.some(e=>e.kind===`folder`&&(e.path===r.path||e.path.endsWith(`/${r.path}`)));(a>0||o)&&n.push({path:r.path,summary:r.summary,templateCount:a,templates:i})}return n}function Hy(e){return e.created.filter(e=>e.kind===`file`&&!e.path.split(`/`).includes(`.ok`)).map(e=>({path:e.path,name:By(e.path)}))}function Uy(e){let t=(0,$.c)(17),{plan:n,selectedPack:r}=e,{_:i}=Dt(),a,o,s,c;if(t[0]!==i||t[1]!==n||t[2]!==r){let e=Vy(n,r),l=Hy(n),u=n.packSkill?.pending?n.packSkill:void 0,d=e.length,f=l.length,p=e.reduce(Xy,0),m=+!!u,h={"log.md":i({id:`EoaQyO`}),"USER.md":i({id:`bV6DJA`}),"SOUL.md":i({id:`Waiy-j`}),"ACCESS_POLICY.md":i({id:`6ZhdPI`}),"HEARTBEAT.md":i({id:`MDZSJe`}),"OVERVIEW.md":i({id:`dMsx3p`}),"welcome.md":i({id:`WWcqsG`}),"index.md":i({id:`uFQbYd`})},g=[d>0?{key:`folders`,n:d,label:i({id:`VsaI0G`,values:{folderCount:d}})}:null,f>0?{key:`files`,n:f,label:i({id:`DgcGrb`,values:{fileCount:f}})}:null,p>0?{key:`templates`,n:p,label:i({id:`ba3vIW`,values:{templateCount:p}})}:null,m>0?{key:`skills`,n:m,label:i({id:`HAvRAI`,values:{skillCount:m}})}:null].filter(Yy),_=e.map(e=>({key:`folder:${e.path}`,icon:S_,name:`${By(e.path)}/`,pill:e.templateCount>0?i({id:`-5jISU`,values:{0:e.templateCount}}):void 0,pillTooltip:e.templateCount>0?e.templates:void 0,description:e.summary||void 0})),v=l.map(e=>({key:`file:${e.path}`,icon:Ve,name:e.name,title:e.name,description:h[e.name]})),y=u?[{key:`skill:${u.name}`,icon:T_,name:oc(u.name),title:u.name,description:i({id:`FEqWFL`})}]:[],b=[{key:`folders`,label:i({id:`pcqlQu`,values:{0:_.length}}),rows:_},{key:`files`,label:i({id:`ZgGuA4`,values:{0:v.length}}),rows:v},{key:`skill`,label:i({id:`OZJeTZ`}),rows:y}].filter(Jy);s=`space-y-5`;let x;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(`h3`,{className:`flex items-center gap-1.5 text-xs font-medium uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`xSVO3J`})}),t[7]=x):x=t[7];let S=g.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs`,children:g.map(qy)}):null;t[8]===S?c=t[9]:(c=(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-between items-baseline gap-x-2 gap-y-0.5`,children:[x,S]}),t[8]=S,t[9]=c),a=`space-y-5`,o=b.map(Wy),t[0]=i,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else a=t[3],o=t[4],s=t[5],c=t[6];let l;t[10]!==a||t[11]!==o?(l=(0,Z.jsx)(`div`,{className:a,children:o}),t[10]=a,t[11]=o,t[12]=l):l=t[12];let u;return t[13]!==s||t[14]!==c||t[15]!==l?(u=(0,Z.jsxs)(`section`,{className:s,children:[c,l]}),t[13]=s,t[14]=c,t[15]=l,t[16]=u):u=t[16],u}function Wy(e){return(0,Z.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Z.jsxs)(`h4`,{className:`flex items-baseline gap-2 text-xs font-medium uppercase font-mono tracking-wider text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:e.label}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/50`,children:e.rows.length})]}),(0,Z.jsx)(`ul`,{className:`space-y-4`,children:e.rows.map(Gy)})]},e.key)}function Gy(e){let t=e.icon;return(0,Z.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-lg border border-border/60`,children:(0,Z.jsx)(t,{className:`size-4 text-muted-foreground`})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 py-0.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-1sm text-foreground/90`,title:e.title,children:e.name}),e.pill?e.pillTooltip&&e.pillTooltip.length>0?(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(_n,{className:`shrink-0 cursor-help rounded bg-transparent p-0 font-mono text-2xs uppercase tracking-wide text-muted-foreground transition-colors hover:text-foreground/70 focus-visible:text-foreground/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:e.pill}),(0,Z.jsx)(vn,{children:(0,Z.jsx)(`ul`,{className:`space-y-0.5 text-left font-mono`,children:e.pillTooltip.map(Ky)})})]}):(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-2xs uppercase tracking-wide text-muted-foreground`,children:e.pill}):null]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-muted-foreground`,children:e.description}):null]})]},e.key)}function Ky(e){return(0,Z.jsx)(`li`,{children:e},e)}function qy(e,t){return(0,Z.jsxs)(Q.Fragment,{children:[t>0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground/50`,children:`·`}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`text-foreground/80`,children:e.n}),` `,(0,Z.jsx)(`span`,{className:`text-muted-foreground/80`,children:e.label})]})]},e.key)}function Jy(e){return e.rows.length>0}function Yy(e){return e!==null}function Xy(e,t){return e+t.templateCount}async function Zy(e){let t=await e.json().catch(()=>null),n=ji.safeParse(t);if(!n.success)return{kind:`internal`,message:`HTTP ${e.status}`};let r=n.data.detail??n.data.title,i=n.data.type;return i===`urn:ok:error:seed-prerequisite-missing`?{kind:`prerequisite-missing`,message:r}:i===`urn:ok:error:seed-invalid-root`?{kind:`invalid-root`,message:r}:i===`urn:ok:error:no-project-dir`?{kind:`no-project`,message:r}:{kind:`internal`,message:r}}function Qy(){let e=typeof window<`u`?window.okDesktop:void 0;if(e?.seed){let t=e.seed.apply;return{plan:e.seed.plan,apply:async(e,n)=>{let r=await t(e,n);return r.ok&&vd(),r},listPacks:e.seed.listPacks}}return{plan:async e=>{let t=new URLSearchParams;e?.rootDir&&t.set(`rootDir`,e.rootDir),e?.packId&&t.set(`packId`,e.packId);let n=t.toString(),r=await fetch(`/api/seed/plan${n?`?${n}`:``}`);if(!r.ok)return{ok:!1,error:await Zy(r)};let i=await r.json().catch(()=>null);return i?.plan?{ok:!0,plan:i.plan}:{ok:!1,error:{kind:`internal`,message:`Malformed plan response`}}},apply:async(e,t)=>{let n=await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e,packId:t?.packId})});if(!n.ok)return{ok:!1,error:await Zy(n)};let r=await n.json().catch(()=>null);return r?.result?(vd(),{ok:!0,result:r.result}):{ok:!1,error:{kind:`internal`,message:`Malformed apply response`}}},listPacks:async()=>{let e=await fetch(`/api/seed/packs`);if(!e.ok)return{ok:!1,error:{kind:`internal`,message:`HTTP ${e.status}`}};let t=await e.json().catch(()=>null);return!t||!Array.isArray(t.packs)?{ok:!1,error:{kind:`internal`,message:`Malformed listPacks response`}}:{ok:!0,packs:t.packs}}}}var $y={"knowledge-base":O_,"software-lifecycle":To,"codebase-wiki":r_,"plain-notes":ev,worldbuilding:l_,"writing-pipeline":z_,"entity-vault":F_,okf:p_};function eb(e){return $y[e]??O_}function tb(e){let t=(0,$.c)(69),{onPackSelect:n,onCreateBlankFile:r,collapsedPackIds:i,className:a,packs:o}=e,{_:s}=Dt(),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),m=o===void 0,h,g;t[0]===m?(h=t[1],g=t[2]):(h=()=>{if(!m)return;let e=!1;return(async()=>{try{let t=await Qy().listPacks();if(e)return;t.ok?l(t.packs):d(t.error.message)}catch(t){let n=t;if(e)return;d(n instanceof Error?n.message:String(n))}})(),()=>{e=!0}},g=[m],t[0]=m,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=m?c:o;if(u!==null){let e;t[3]===a?e=t[4]:(e=Y(`rounded-md bg-destructive/10 p-4 text-sm text-destructive`,a),t[3]=a,t[4]=e);let n;t[5]===u?n=t[6]:(n=(0,Z.jsx)(J,{id:`56WWtu`,values:{error:u}}),t[5]=u,t[6]=n);let r;return t[7]!==e||t[8]!==n?(r=(0,Z.jsx)(`div`,{role:`alert`,className:e,children:n}),t[7]=e,t[8]=n,t[9]=r):r=t[9],r}if(_===null){let e;t[10]===a?e=t[11]:(e=Y(`@container/packgrid w-full max-w-5xl`,a),t[10]=a,t[11]=e);let n;t[12]===s?n=t[13]:(n=s({id:`BeWTQy`}),t[12]=s,t[13]=n);let r;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`div`,{className:`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,children:Array.from({length:Object.keys($y).length},rb).map(nb)}),t[14]=r):r=t[14];let i;return t[15]!==e||t[16]!==n||t[17]!==r?(i=(0,Z.jsx)(`div`,{role:`status`,className:e,"aria-busy":`true`,"aria-label":n,children:r}),t[15]=e,t[16]=n,t[17]=r,t[18]=i):i=t[18],i}if(_.length===0){let e;t[19]===a?e=t[20]:(e=Y(`flex w-full max-w-5xl items-center justify-center rounded-2xl border border-dashed border-border/60 bg-muted/20 p-8 text-sm text-muted-foreground`,a),t[19]=a,t[20]=e);let n;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(J,{id:`zLGXna`}),t[21]=n):n=t[21];let r;return t[22]===e?r=t[23]:(r=(0,Z.jsx)(`div`,{role:`status`,className:e,children:n}),t[22]=e,t[23]=r),r}let v;t[24]===i?v=t[25]:(v=i??[],t[24]=i,t[25]=v);let y;t[26]===v?y=t[27]:(y=new Set(v),t[26]=v,t[27]=y);let b=y,x,S,C,w,T,E,D,O,k;if(t[28]!==a||t[29]!==b||t[30]!==f||t[31]!==r||t[32]!==n||t[33]!==_){let e;t[43]===b?e=t[44]:(e=e=>!b.has(e.id),t[43]=b,t[44]=e);let i=_.filter(e),o;t[45]===b?o=t[46]:(o=e=>b.has(e.id),t[45]=b,t[46]=o),C=_.filter(o),S=C.length>0,w=S||r!=null,t[47]===a?k=t[48]:(k=Y(`@container/packgrid w-full max-w-5xl`,a),t[47]=a,t[48]=k),x=Cn,T=f,E=p;let s;t[49]===n?s=t[50]:(s=e=>(0,Z.jsx)(ib,{pack:e,onSelect:()=>n(e.id)},e.id),t[49]=n,t[50]=s);let c=i.map(s);t[51]===c?D=t[52]:(D=(0,Z.jsx)(`div`,{className:`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,children:c}),t[51]=c,t[52]=D),O=S?(0,Z.jsx)(xn,{className:`-mx-1 -mb-1 overflow-hidden px-1 pb-1 data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:(0,Z.jsx)(`div`,{className:Y(`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,`pt-4`),children:C.map(e=>(0,Z.jsx)(ib,{pack:e,onSelect:()=>n(e.id)},e.id))})}):null,t[28]=a,t[29]=b,t[30]=f,t[31]=r,t[32]=n,t[33]=_,t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T,t[39]=E,t[40]=D,t[41]=O,t[42]=k}else x=t[34],S=t[35],C=t[36],w=t[37],T=t[38],E=t[39],D=t[40],O=t[41],k=t[42];let A;t[53]!==f||t[54]!==S||t[55]!==C||t[56]!==r||t[57]!==w?(A=w?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[S?(0,Z.jsx)(Sn,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`link-muted`,size:`sm`,children:[f?(0,Z.jsx)(J,{id:`6lGV3K`}):(0,Z.jsx)(J,{id:`ymWJLd`,values:{0:C.length}}),(0,Z.jsx)($o,{"aria-hidden":`true`,className:Y(`size-3.5 transition-transform`,f&&`rotate-180`)})]})}):(0,Z.jsx)(`span`,{}),r?(0,Z.jsx)(X,{type:`button`,variant:`link-muted`,size:`sm`,onClick:r,children:(0,Z.jsx)(J,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Jn,{"aria-hidden":`true`,className:`size-3.5`})}})}):null]}):null,t[53]=f,t[54]=S,t[55]=C,t[56]=r,t[57]=w,t[58]=A):A=t[58];let j;t[59]!==x||t[60]!==A||t[61]!==T||t[62]!==E||t[63]!==D||t[64]!==O?(j=(0,Z.jsxs)(x,{open:T,onOpenChange:E,children:[D,O,A]}),t[59]=x,t[60]=A,t[61]=T,t[62]=E,t[63]=D,t[64]=O,t[65]=j):j=t[65];let M;return t[66]!==j||t[67]!==k?(M=(0,Z.jsx)(`div`,{className:k,children:j}),t[66]=j,t[67]=k,t[68]=M):M=t[68],M}function nb(e){return(0,Z.jsx)(ab,{},`skeleton-${e}`)}function rb(e,t){return t}function ib(e){let t=(0,$.c)(17),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=eb(n.id),t[0]=n.id,t[1]=i);let a=i,o;t[2]===a?o=t[3]:(o=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 shrink-0 text-muted-foreground`,children:(0,Z.jsx)(a,{className:`size-3.5`})}),t[2]=a,t[3]=o);let s;t[4]===n.name?s=t[5]:(s=(0,Z.jsx)(`h3`,{className:`min-w-0 wrap-break-word text-sm font-medium leading-tight`,children:n.name}),t[4]=n.name,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-row items-start gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]===n.description?l=t[10]:(l=(0,Z.jsx)(`p`,{className:`line-clamp-2 text-1sm leading-relaxed text-muted-foreground`,children:n.description}),t[9]=n.description,t[10]=l);let u;t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2`,children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13];let d;return t[14]!==r||t[15]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,onClick:r,className:`group flex h-full min-w-0 flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px`,children:u}),t[14]=r,t[15]=u,t[16]=d):d=t[16],d}function ab(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`size-10 animate-pulse rounded-lg bg-muted`,"aria-hidden":`true`,children:(0,Z.jsx)(ll,{className:`size-5 animate-spin text-muted-foreground opacity-0`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-[200px] flex-col items-start gap-4 rounded-xl border border-border/60 bg-card p-6`,children:[t,(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-4 w-1/2 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-muted`})]}),(0,Z.jsx)(`div`,{className:`mt-auto h-3 w-20 animate-pulse rounded bg-muted`})]}),e[1]=n):n=e[1],n}var ob=`knowledge-base`;function sb(e){let t=(0,$.c)(94),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,{_:o}=Dt(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={kind:`loading`},t[0]=s):s=t[0];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(a??ob),[m,h]=(0,Q.useState)(`project-root`),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(a===void 0?`pick`:`configure`),b=(0,Q.useRef)(!0),x=u?.find(e=>e.id===f),S,C;t[1]!==n||t[2]!==u?(S=()=>{if(!n||u!==null)return;let e=!1;return(async()=>{try{let t=await Qy().listPacks();if(e)return;t.ok?d(t.packs):(d([]),l({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;d([]),l({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},C=[n,u],t[1]=n,t[2]=u,t[3]=S,t[4]=C):(S=t[3],C=t[4]),(0,Q.useEffect)(S,C);let w,T;t[5]!==a||t[6]!==n?(w=()=>{n&&(p(a??ob),h(`project-root`),_(``),y(a===void 0?`pick`:`configure`),l({kind:`loading`}),b.current=!0)},T=[n,a],t[5]=a,t[6]=n,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,Q.useEffect)(w,T),(0,Q.useEffect)(()=>{x&&_(x.defaultSubfolder??``)},[x]);let E;t[9]===g?E=t[10]:(E=g.trim(),t[9]=g,t[10]=E);let D=E,O=m===`subfolder`&&D===``,k,A;t[11]!==o||t[12]!==n||t[13]!==u||t[14]!==m||t[15]!==f||t[16]!==v||t[17]!==O||t[18]!==D?(k=()=>{if(!n||v!==`configure`||u===null)return;if(O){l({kind:`error`,message:o({id:`Z8KDox`})});return}let e=m===`project-root`?void 0:D,t=b.current?0:200;b.current=!1;let r=!1,i=setTimeout(()=>{r||(l(cb),Qy().plan({rootDir:e,packId:f}).then(e=>{if(!r){if(!e.ok){l({kind:`error`,message:e.error.message});return}l(e.plan.created.length>0||e.plan.packSkill?.pending===!0?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||l({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},A=[n,v,u,f,m,D,O,o],t[11]=o,t[12]=n,t[13]=u,t[14]=m,t[15]=f,t[16]=v,t[17]=O,t[18]=D,t[19]=k,t[20]=A):(k=t[19],A=t[20]),(0,Q.useEffect)(k,A);let j=async function(){if(c.kind!==`plan`)return;let e=c.plan;l({kind:`applying`,plan:e});let t;try{t=await Qy().apply(e,{packId:f})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);Mu.error(o({id:`iqugog`,values:{errorDetail:r}})),l({kind:`plan`,plan:e});return}if(t.ok){let n=x?.name??o({id:`W8vpBM`}),a=t.result.applied,s=e.packSkill?.pending===!0,c=o(a>0?{id:`x3-2ta`,values:{packName:n,projectEntries:a}}:s?{id:`B2Srgd`,values:{packName:n}}:{id:`K6jjWB`,values:{packName:n}});Mu.success(c),i?.(),r(!1)}else{let n=t.error.message;Mu.error(o({id:`iqugog`,values:{errorDetail:n}})),l({kind:`plan`,plan:e})}},M=a!==void 0,N=x?.name,P=o(v===`configure`&&x?{id:`hxEUVJ`,values:{selectedPackName:N}}:{id:`RGkNeJ`}),F;t[21]===o?F=t[22]:(F=o({id:`gvApb7`}),t[21]=o,t[22]=F);let I;t[23]===o?I=t[24]:(I=o({id:`hCOLSd`}),t[23]=o,t[24]=I);let L;t[25]===o?L=t[26]:(L=o({id:`Fy4GgU`}),t[25]=o,t[26]=L);let R;t[27]===o?R=t[28]:(R=o({id:`Qw-7Ie`}),t[27]=o,t[28]=R);let z;t[29]===o?z=t[30]:(z=o({id:`_ayOfA`}),t[29]=o,t[30]=z);let B;t[31]===o?B=t[32]:(B=o({id:`Zf0w-R`}),t[31]=o,t[32]=B);let V;t[33]===o?V=t[34]:(V=o({id:`hmYd9H`}),t[33]=o,t[34]=V);let H;t[35]===o?H=t[36]:(H=o({id:`VBE2dw`}),t[35]=o,t[36]=H);let U;t[37]!==F||t[38]!==I||t[39]!==L||t[40]!==R||t[41]!==z||t[42]!==B||t[43]!==V||t[44]!==H?(U={"knowledge-base":F,"software-lifecycle":I,"codebase-wiki":L,"plain-notes":R,okf:z,"writing-pipeline":B,"entity-vault":V,worldbuilding:H},t[37]=F,t[38]=I,t[39]=L,t[40]=R,t[41]=z,t[42]=B,t[43]=V,t[44]=H,t[45]=U):U=t[45];let ee=U,W;t[46]!==o||t[47]!==ee||t[48]!==x||t[49]!==v?(W=v===`configure`&&x?ee[x.id]??x.description:o({id:`msqUNq`}),t[46]=o,t[47]=ee,t[48]=x,t[49]=v,t[50]=W):W=t[50];let te=W,G;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(G=function(e){p(e),y(`configure`),b.current=!0},t[51]=G):G=t[51];let ne=G,K;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(){y(`pick`),l({kind:`loading`}),b.current=!0},t[52]=K):K=t[52];let q=K,re;t[53]===P?re=t[54]:(re=(0,Z.jsx)(Tn,{children:P}),t[53]=P,t[54]=re);let ie;t[55]===te?ie=t[56]:(ie=(0,Z.jsx)(wn,{children:te}),t[55]=te,t[56]=ie);let ae;t[57]!==re||t[58]!==ie?(ae=(0,Z.jsxs)(kn,{children:[re,ie]}),t[57]=re,t[58]=ie,t[59]=ae):ae=t[59];let oe;t[60]!==u||t[61]!==c||t[62]!==m||t[63]!==x||t[64]!==v||t[65]!==g?(oe=v===`pick`?(0,Z.jsx)(Dn,{children:(0,Z.jsx)(tb,{packs:u,onPackSelect:ne})}):(0,Z.jsxs)(Dn,{className:`space-y-6`,children:[(0,Z.jsx)(lb,{choice:m,subfolder:g,placeholder:x?.defaultSubfolder??`subfolder`,onChoiceChange:h,onSubfolderChange:_}),(0,Z.jsx)(ub,{phase:c,selectedPack:x})]}),t[60]=u,t[61]=c,t[62]=m,t[63]=x,t[64]=v,t[65]=g,t[66]=oe):oe=t[66];let se;t[67]!==M||t[68]!==v?(se=v===`configure`&&!M?(0,Z.jsxs)(X,{className:`mr-auto uppercase font-mono`,variant:`ghost`,onClick:q,children:[(0,Z.jsx)(Zn,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(J,{id:`iH8pgl`})]}):null,t[67]=M,t[68]=v,t[69]=se):se=t[69];let ce;t[70]===r?ce=t[71]:(ce=()=>r(!1),t[70]=r,t[71]=ce);let le;t[72]===c.kind?le=t[73]:(le=c.kind===`already-seeded`||c.kind===`error`?(0,Z.jsx)(J,{id:`yz7wBu`}):(0,Z.jsx)(J,{id:`dEgA5A`}),t[72]=c.kind,t[73]=le);let ue;t[74]!==ce||t[75]!==le?(ue=(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,onClick:ce,children:le}),t[74]=ce,t[75]=le,t[76]=ue):ue=t[76];let de;t[77]!==j||t[78]!==c.kind||t[79]!==v||t[80]!==O?(de=v===`configure`&&c.kind===`plan`?(0,Z.jsx)(X,{onClick:j,disabled:O,children:(0,Z.jsx)(J,{id:`4TzU0n`})}):v===`configure`&&c.kind===`applying`?(0,Z.jsxs)(X,{disabled:!0,children:[(0,Z.jsx)(ll,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(J,{id:`XYlJJT`})]}):null,t[77]=j,t[78]=c.kind,t[79]=v,t[80]=O,t[81]=de):de=t[81];let fe;t[82]!==se||t[83]!==ue||t[84]!==de?(fe=(0,Z.jsxs)(On,{children:[se,ue,de]}),t[82]=se,t[83]=ue,t[84]=de,t[85]=fe):fe=t[85];let pe;t[86]!==ae||t[87]!==oe||t[88]!==fe?(pe=(0,Z.jsxs)(En,{className:`sm:max-w-4xl`,"data-ok-layer-spawned":``,children:[ae,oe,fe]}),t[86]=ae,t[87]=oe,t[88]=fe,t[89]=pe):pe=t[89];let me;return t[90]!==r||t[91]!==n||t[92]!==pe?(me=(0,Z.jsx)(An,{open:n,onOpenChange:r,children:pe}),t[90]=r,t[91]=n,t[92]=pe,t[93]=me):me=t[93],me}function cb(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function lb(e){let t=(0,$.c)(22),{choice:n,subfolder:r,placeholder:i,onChoiceChange:a,onSubfolderChange:o}=e,{_:s}=Dt(),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`3wiBAs`})}),t[0]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=e=>a(e),t[1]=a,t[2]=l);let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Su,{children:(0,Z.jsx)(J,{id:`RSqaSd`})}),t[3]=u):u=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(bu,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(Cu,{orientation:`horizontal`,children:[(0,Z.jsxs)(yu,{children:[u,(0,Z.jsx)(xu,{className:`text-1sm`,children:(0,Z.jsx)(J,{id:`ZvzbDF`})})]}),(0,Z.jsx)(Zr,{value:`project-root`,id:`seed-root-project-root`})]})}),t[4]=d):d=t[4];let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Su,{children:(0,Z.jsx)(J,{id:`ZWgr0b`})}),t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(xu,{className:`nth-last-2:mt-0 text-1sm`,children:(0,Z.jsx)(J,{id:`KQGZuq`})}),t[6]=p):p=t[6];let m;t[7]!==s||t[8]!==n||t[9]!==o||t[10]!==i||t[11]!==r?(m=n===`subfolder`&&(0,Z.jsx)(Ru,{value:r,onChange:e=>o(e.target.value),placeholder:i,"aria-label":s({id:`NYUhy5`}),spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`}),t[7]=s,t[8]=n,t[9]=o,t[10]=i,t[11]=r,t[12]=m):m=t[12];let h;t[13]===m?h=t[14]:(h=(0,Z.jsxs)(yu,{children:[f,p,m]}),t[13]=m,t[14]=h);let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Zr,{value:`subfolder`,id:`seed-root-subfolder`}),t[15]=g):g=t[15];let _;t[16]===h?_=t[17]:(_=(0,Z.jsx)(bu,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(Cu,{orientation:`horizontal`,children:[h,g]})}),t[16]=h,t[17]=_);let v;return t[18]!==n||t[19]!==_||t[20]!==l?(v=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[c,(0,Z.jsxs)(Qr,{className:`sm:flex`,value:n,onValueChange:l,children:[d,_]})]}),t[18]=n,t[19]=_,t[20]=l,t[21]=v):v=t[21],v}function ub(e){let t=(0,$.c)(19),{phase:n,selectedPack:r}=e,{_:i}=Dt();if(n.kind===`loading`){let e=r?.folders.length??6,n;t[0]===i?n=t[1]:(n=i({id:`--T3kB`}),t[0]=i,t[1]=n);let a;t[2]===e?a=t[3]:(a=(0,Z.jsx)(`ul`,{className:`space-y-2`,children:Array.from({length:e},pb).map(fb)}),t[2]=e,t[3]=a);let o;return t[4]!==n||t[5]!==a?(o=(0,Z.jsx)(`section`,{role:`status`,"aria-busy":`true`,"aria-label":n,children:a}),t[4]=n,t[5]=a,t[6]=o):o=t[6],o}if(n.kind===`error`){let e;return t[7]===n.message?e=t[8]:(e=(0,Z.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[7]=n.message,t[8]=e),e}if(n.kind===`already-seeded`){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`font-medium`,children:(0,Z.jsx)(J,{id:`YwPUUP`})}),t[9]=e):e=t[9];let n;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`py-2 text-sm`,children:[e,(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:(0,Z.jsx)(J,{id:`h-AdvS`})})]}),t[10]=n):n=t[10],n}let a;t[11]!==n.plan||t[12]!==r?(a=n.plan.created.length>0||n.plan.packSkill?.pending?(0,Z.jsx)(Uy,{plan:n.plan,selectedPack:r}):null,t[11]=n.plan,t[12]=r,t[13]=a):a=t[13];let o;t[14]===n.plan.warnings?o=t[15]:(o=n.plan.warnings.length>0?(0,Z.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,children:n.plan.warnings.map(db)}):null,t[14]=n.plan.warnings,t[15]=o);let s;return t[16]!==a||t[17]!==o?(s=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[a,o]}),t[16]=a,t[17]=o,t[18]=s):s=t[18],s}function db(e){return(0,Z.jsx)(`p`,{children:e},e)}function fb(e){return(0,Z.jsxs)(`li`,{"aria-hidden":`true`,className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`size-8 shrink-0 animate-pulse rounded-lg bg-muted`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 py-0.5`,children:[(0,Z.jsx)(`span`,{className:`block h-3.5 w-28 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`span`,{className:`mt-2 block h-3 w-4/5 animate-pulse rounded bg-muted`})]})]},`seed-skeleton-${e}`)}function pb(e,t){return t}function mb(){return(0,Q.useSyncExternalStore)(Of,kf,kf)}function hb(e,t){return e instanceof Error&&e.message?e.message:t}async function gb(e,t,n,r=`action`){try{n(null),await e()}catch(e){console.error(`[${r}] action failed:`,e),n(hb(e,t))}}async function _b(e,t,n=Mu,r=`action`){await gb(e,t,e=>{e!==null&&n.error(e)},r)}var vb=(0,Q.createContext)(!1);function yb(e){let t=(0,$.c)(5),{children:n}=e,[r,i]=(0,Q.useState)(xb),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{if(window.okDesktop)return;let e=new AbortController;return Jd(e.signal).then(t=>{e.signal.aborted||t.status!==`ok`||i(t.config.singleFile)}).catch(bb),()=>e.abort()},o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o);let s;return t[2]!==n||t[3]!==r?(s=(0,Z.jsx)(vb,{value:r,children:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}function bb(){}function xb(){return typeof window<`u`?window.okDesktop?.config.singleFile??!1:!1}function Sb(){return(0,Q.use)(vb)}function Cb(e,t,n){let r=[],i=new Set,a=new Set,o=t!==null&&t.mainRoot===e.project.mainRoot;e.projectSynthesized||(r.push({branch:e.project.branch??null,path:e.project.path,opened:!0,isMain:!0,isCurrent:e.project.path===n}),i.add(e.project.path),e.project.branch!=null&&a.add(e.project.branch));let s=[...e.worktrees].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt));for(let e of s)i.has(e.path)||(r.push({branch:e.branch??null,path:e.path,opened:!0,isMain:!1,isCurrent:e.path===n}),i.add(e.path),e.branch!=null&&a.add(e.branch));if(o){let e=t.entries.filter(e=>e.branch!==null&&!a.has(e.branch)&&(e.worktreePath===null||!i.has(e.worktreePath))).sort((e,t)=>(e.branch??``).localeCompare(t.branch??``));for(let t of e)r.push({branch:t.branch,path:t.worktreePath,opened:t.worktreePath!==null,isMain:t.isMain,isCurrent:t.isCurrent}),t.branch!=null&&a.add(t.branch),t.worktreePath!=null&&i.add(t.worktreePath)}return r.sort((e,t)=>wb(e)-wb(t))}function wb(e){return e.isMain?0:e.opened?1:2}function Tb(e){let t=e.split(/[/\\]/).filter(e=>e.length>0);return t.length>0?t[t.length-1]??e:e}function Eb(e){let t=[],n=new Map;for(let r of e){let e=r.gitCommonDir,i=r.mainRoot;if(e===void 0||i===void 0){t.push({project:r,mainRoot:r.path,worktrees:[]});continue}let a=n.get(e);a===void 0&&(a=t.length,n.set(e,a),t.push({project:null,mainRoot:i,worktrees:[]}));let o=t[a];o!==void 0&&(r.isLinkedWorktree?o.worktrees.push(r):o.project===null&&(o.project=r))}return t.map(e=>{let t=e.project===null;return{project:e.project??{path:e.mainRoot,name:Tb(e.mainRoot),lastOpenedAt:``},worktrees:e.worktrees,projectSynthesized:t}})}function Db(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(Dg,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function Ob(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Og,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function kb(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(jg,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function Ab(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(Lg,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function jb(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(kg,{children:(0,Z.jsx)(Ag,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Mb(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=Y(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(Ng,{"data-slot":`context-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function Nb(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=Y(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(es,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(Rg,{"data-slot":`context-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Pb(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(zg,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fb(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=Y(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(Fg,{children:(0,Z.jsx)(Zo,{})})}),t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==s?(l=(0,Z.jsxs)(Pg,{"data-slot":`context-menu-checkbox-item`,"data-inset":a,className:s,checked:n,...o,children:[c,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=s,t[14]=l):l=t[14],l}function Ib(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Y(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Mg,{"data-slot":`context-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function Lb(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ig,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Rb(e){let t=(0,$.c)(14),{path:n,name:r,onRemoveRecent:i,testIdPrefix:a}=e,{_:o}=Dt(),s;t[0]!==o||t[1]!==r?(s=o({id:`Y6PKd1`,values:{name:r}}),t[0]=o,t[1]=r,t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=o({id:`Es-eZU`}),t[3]=o,t[4]=c);let l;t[5]!==i||t[6]!==n?(l=e=>{e.stopPropagation(),i(n)},t[5]=i,t[6]=n,t[7]=l):l=t[7];let u=`${a}-remove-${n}`,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(ju,{"aria-hidden":`true`,className:`size-3.5`}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==c||t[11]!==l||t[12]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,tabIndex:-1,"aria-hidden":`true`,"aria-label":s,title:c,onClick:l,className:`absolute top-1/2 right-1 size-6 -translate-y-1/2 text-muted-foreground opacity-0 transition-opacity group-hover/recent:opacity-100 focus-visible:opacity-100`,"data-testid":u,children:d}),t[9]=s,t[10]=c,t[11]=l,t[12]=u,t[13]=f):f=t[13],f}function zb(e){let t=(0,$.c)(13),{path:n,onRemoveRecent:r,testIdPrefix:i,children:a}=e,o;t[0]===a?o=t[1]:(o=(0,Z.jsx)(Ob,{asChild:!0,children:a}),t[0]=a,t[1]=o);let s;t[2]!==r||t[3]!==n?(s=()=>r(n),t[2]=r,t[3]=n,t[4]=s):s=t[4];let c=`${i}-context-remove-${n}`,l,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(ju,{"aria-hidden":`true`}),u=(0,Z.jsx)(J,{id:`Es-eZU`}),t[5]=l,t[6]=u):(l=t[5],u=t[6]);let d;t[7]!==s||t[8]!==c?(d=(0,Z.jsx)(jb,{children:(0,Z.jsxs)(Mb,{onSelect:s,"data-testid":c,children:[l,u]})}),t[7]=s,t[8]=c,t[9]=d):d=t[9];let f;return t[10]!==o||t[11]!==d?(f=(0,Z.jsxs)(Db,{children:[o,d]}),t[10]=o,t[11]=d,t[12]=f):f=t[12],f}var Bb=(0,Q.lazy)(()=>n(()=>import(`./BugReportHistoryDialog-BzJsPoev.js`),__vite__mapDeps([45,10,1,11,12,23,14,15,16,17,24,25,26,22,27,34,35,36,37,33,38,39]),import.meta.url)),Vb=3e3,Hb=600,Ub=20,Wb=(e,t,n)=>_b(e,t,n,`CommandPalette`);function Gb(e){window.location.assign(Bd(e))}function Kb(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:ad(t)}function qb(e){let t=(0,$.c)(27),{entry:n,query:r,onSelect:i,disabled:a}=e,o=r===void 0?``:r,s=a===void 0?!1:a,c;t[0]===n?c=t[1]:(c=`title`in n&&n.title?n.title:n.path.split(`/`).pop()??n.path,t[0]=n,t[1]=c);let l=c,u=`snippet`in n?n.snippet:void 0,d=`docExt`in n?n.docExt:void 0,f=`bodyIndexed`in n?n.bodyIndexed:void 0,p=`${n.kind} ${n.path}`,m=`command-palette-nav-${n.kind}-${n.path}`,h;t[2]!==f||t[3]!==d||t[4]!==n.kind||t[5]!==n.path?(h=(0,Z.jsx)(ut,{bodyIndexed:f,className:`mt-0.5 size-4`,docExt:d,kind:n.kind,path:n.path}),t[2]=f,t[3]=d,t[4]=n.kind,t[5]=n.path,t[6]=h):h=t[6];let g;t[7]!==o||t[8]!==l?(g=(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:(0,Z.jsx)(Yb,{query:o,text:l})}),t[7]=o,t[8]=l,t[9]=g):g=t[9];let _;t[10]!==n.path||t[11]!==o?(_=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(Yb,{query:o,text:n.path})}),t[10]=n.path,t[11]=o,t[12]=_):_=t[12];let v;t[13]!==o||t[14]!==u?(v=u?(0,Z.jsx)(`span`,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(Yb,{query:o,text:u})}):null,t[13]=o,t[14]=u,t[15]=v):v=t[15];let y;t[16]!==g||t[17]!==_||t[18]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[g,_,v]}),t[16]=g,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;return t[20]!==s||t[21]!==i||t[22]!==y||t[23]!==p||t[24]!==m||t[25]!==h?(b=(0,Z.jsxs)(Re,{value:p,onSelect:i,disabled:s,"data-testid":m,className:`items-start`,children:[h,y]}),t[20]=s,t[21]=i,t[22]=y,t[23]=p,t[24]=m,t[25]=h,t[26]=b):b=t[26],b}function Jb(e){let t=(0,$.c)(5),{mode:n,inExclusiveMode:r,paletteModeKind:i}=e;if(r||i!==`normal`||n===`idle`||n===`content`)return null;let a=`command-palette-search-hint-${n}`,o;t[0]===n?o=t[1]:(o=n===`name-only`?(0,Z.jsx)(J,{id:`GuLeuE`,values:{0:Hu(`find`)},components:{0:(0,Z.jsx)(le,{"aria-label":Uu(`find`)})}}):n===`truncated`?(0,Z.jsx)(J,{id:`-q4abP`}):(0,Z.jsx)(J,{id:`DbILZA`}),t[0]=n,t[1]=o);let s;return t[2]!==a||t[3]!==o?(s=(0,Z.jsx)(`div`,{"aria-live":`polite`,"data-testid":a,className:`border-t px-3 py-2 text-muted-foreground text-xs`,children:o}),t[2]=a,t[3]=o,t[4]=s):s=t[4],s}function Yb(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=uy(n,r).map(Xb),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[3]=i,t[4]=a),a}function Xb(e){let t=`${e.start}:${e.match?`match`:`plain`}`;return e.match?(0,Z.jsx)(`mark`,{className:`rounded-sm bg-primary/10 px-0.5 font-semibold text-primary`,children:e.text},t):(0,Z.jsx)(`span`,{children:e.text},t)}function Zb({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function Qb(e){let t=(0,$.c)(146),{bridge:n,open:r,onOpenChange:i}=e,a=n===void 0?null:n,{_:o}=Dt(),s=Sb(),[c,l]=(0,Q.useState)(``),u=(0,Q.useDeferredValue)(c),d=u.trim(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],t[0]=f):f=t[0];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(`idle`),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),C;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[1]=C):C=t[1];let[w,T]=(0,Q.useState)(C),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(`idle`),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=[],t[2]=A):A=t[2];let[j,M]=(0,Q.useState)(A),N;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(N=[],t[3]=N):N=t[3];let[P,F]=(0,Q.useState)(N),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),[B,V]=(0,Q.useState)(!1),[H,U]=(0,Q.useState)(!1),[ee,W]=(0,Q.useState)(!1),[te,G]=(0,Q.useState)(!1),[ne,K]=(0,Q.useState)(!1),q;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(q=[],t[4]=q):q=t[4];let[re,ie]=(0,Q.useState)(q),[ae,oe]=(0,Q.useState)(`idle`),se;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(se=[],t[5]=se):se=t[5];let[ce,ue]=(0,Q.useState)(se),[de,fe]=(0,Q.useState)(`idle`),pe=(0,Q.useRef)(!1),me=(0,Q.useRef)(null),he=(0,Q.useRef)(null),ge=(0,Q.useRef)(null),ve=(0,Q.useRef)(null),{activeDocName:ye,activeTarget:be}=ot(),{pages:xe,pageTitles:Se,pageMeta:Ce,folderPaths:we,filePaths:Te,loading:Ee}=rs(),Oe=jf(),{states:ke,refresh:Ae}=_s(),{dispatch:je}=ds(),Me;t[6]===r?Me=t[7]:(Me={enabled:r},t[6]=r,t[7]=Me);let{status:Ne,refresh:Pe}=Gs(Me),Fe=(Ne?.enabled??!1)&&(Ne?.keyPresent??!1),Ie=Ne?.embedded??0,Le=Ne?.total??0,ze=Fe&&Le>0&&Ie<Le,Be;t[8]!==x||t[9]!==r||t[10]!==Pe||t[11]!==ze?(Be=()=>{if(!r||!x||!ze)return;let e=window.setInterval(()=>Pe(),2500);return()=>window.clearInterval(e)},t[8]=x,t[9]=r,t[10]=Pe,t[11]=ze,t[12]=Be):Be=t[12];let Ve;t[13]!==x||t[14]!==r||t[15]!==ze?(Ve=[r,x,ze],t[13]=x,t[14]=r,t[15]=ze,t[16]=Ve):Ve=t[16],(0,Q.useEffect)(Be,Ve);let He=xs({docName:ye,workspace:Oe}),Ue=ry(xe,we,Se,Ce,Te),We=Yv(P,new Set(Ue.map(nx))),Ge=a?.config.projectPath??null,Ke=a?j.filter(e=>e.path!==Ge):[],qe=mb(),Je=a&&qe?qe.entries.filter(tx):[],Ye;t[17]!==ye||t[18]!==be?(Ye=Kb(be,ye),t[17]=ye,t[18]=be,t[19]=Ye):Ye=t[19];let Xe=Ye,Ze=d===``?[]:cy(Ue,d,8),$e,et;t[20]!==i||t[21]!==r?($e=()=>{let e=function(e){Zu(e,`command-palette`)&&(!r&&Af()||(e.preventDefault(),i(!r)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},et=[i,r],t[20]=i,t[21]=r,t[22]=$e,t[23]=et):($e=t[22],et=t[23]),(0,Q.useEffect)($e,et);let nt,rt;t[24]!==o||t[25]!==a||t[26]!==r||t[27]!==Ae?(nt=()=>{if(r){if(F(Kv()),Ae(),a){let e=!1;return Wb(async()=>{let t=await a.project.listRecent();e||M(t)},o({id:`fYKgzG`})),()=>{e=!0}}return}l(``),ie([]),oe(`idle`),pe.current=!1,ue([]),fe(`idle`),S(!1),ge.current?.abort(),ge.current=null,ve.current!==null&&(window.clearTimeout(ve.current),ve.current=null),T([]),D(null),k(`idle`)},rt=[r,a,Ae,o],t[24]=o,t[25]=a,t[26]=r,t[27]=Ae,t[28]=nt,t[29]=rt):(nt=t[28],rt=t[29]),(0,Q.useEffect)(nt,rt);let it;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(it=()=>{me.current&&(me.current.scrollTop=0)},t[30]=it):it=t[30];let at;t[31]===c?at=t[32]:(at=[c],t[31]=c,t[32]=at),(0,Q.useEffect)(it,at);let ct=new Set(re.map(ex)),lt=x?{kind:`normal`,query:u}:_y(u,ct),ut=lt.kind!==`normal`,dt=ut||x,pt=lt.kind===`tag-list`?lt.query:``,mt=lt.kind===`tag-docs`?lt.tagName:``,ht=c.trim(),gt=x?hy({query:ht,firedQuery:E,status:O,resultCount:w.length}):null,_t=gt?.submit?.query??``,vt=gt?.results.forQuery??``,yt,bt;t[33]!==ut||t[34]!==r?(yt=()=>{if(!r||!ut||pe.current)return;pe.current=!0,oe(`loading`);let e=!1;return yy().then(t=>{e||(ie(t),oe(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),ie([]),oe(`error`))}),()=>{e=!0}},bt=[r,ut],t[33]=ut,t[34]=r,t[35]=yt,t[36]=bt):(yt=t[35],bt=t[36]),(0,Q.useEffect)(yt,bt);let xt=lt.kind===`tag-docs`?lt.tagName:null;(0,Q.useEffect)(()=>{if(!r||xt===null){ue([]),fe(`idle`);return}fe(`loading`),ue([]);let e=!1;return by(xt).then(t=>{e||(ue(t),fe(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),ue([]),fe(`error`))}),()=>{e=!0}},[r,xt]),(0,Q.useEffect)(()=>{if(!r||!d||dt||Ee){m([]),g(`idle`),v(!1),b(!1);return}let e=!1,t=!1,n=0,i=null,a,o;g(`loading`);let s=()=>e||n>=Ub?!1:(n+=1,o=window.setTimeout(l,Hb),!0),c=()=>{e||t&&s()||(m([]),g(`error`),v(!1),b(!1))};function l(){let n=new AbortController;i=n,a=window.setTimeout(()=>{n.abort(),c()},Vb),fy(d,{signal:n.signal}).then(n=>{let{entries:r,truncated:i,ready:o}=n;if(window.clearTimeout(a),!e){if(!o){t||(t=!0,m([]),v(!1),b(!0),g(`success`)),s()||b(!1);return}m(r),v(i),b(!1),g(`success`)}}).catch(t=>{window.clearTimeout(a),!e&&(t instanceof Error&&t.name===`AbortError`||c())})}return l(),()=>{e=!0,window.clearTimeout(a),window.clearTimeout(o),i?.abort()}},[r,d,dt,Ee]);let St;t[37]!==o||t[38]!==i?(St=(e,t)=>{let n=t===void 0?o({id:`uuoHOU`}):t;i(!1),Wb(async()=>{await e()},n)},t[37]=o,t[38]=i,t[39]=St):St=t[39];let Ct=St,wt;t[40]!==o||t[41]!==a?(wt=e=>{a&&Wb(async()=>{await a.project.removeRecent(e),M(t=>t.filter(t=>t.path!==e))},o({id:`viwC-K`}))},t[40]=o,t[41]=a,t[42]=wt):wt=t[42];let Tt=wt,Et;t[43]!==o||t[44]!==a||t[45]!==Ct?(Et=e=>{if(!a)return;let t=e.worktreePath;if(t!==null){Ct(()=>a.project.open({path:t,target:`new-window`,entryPoint:`worktree`}),o({id:`LwMxXg`}));return}let n=e.branch;n!==null&&Ct(async()=>{let e=await a.worktree.create({branch:n,createBranch:!1});if(!e.ok)throw Error(e.reason);Df(),await a.project.open({path:e.path,target:`new-window`,entryPoint:`worktree`})},o({id:`LwMxXg`}))},t[43]=o,t[44]=a,t[45]=Ct,t[46]=Et):Et=t[46];let Ot=Et,kt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(kt=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=Jv(Kv(),t);qv(n),F(n)},t[47]=kt):kt=t[47];let At=kt,jt;t[48]===i?jt=t[49]:(jt=function(e){i(!1),At(e),Gb(e.path)},t[48]=i,t[49]=jt);let Mt=jt,Nt=!dt&&d===``&&We.length>0,Pt=Zb({searchResults:p,fallbackSearchResults:Ze,searchStatus:h}),Ft=!dt&&Pt.length>0,It=!dt&&d!==``&&(Ee||y)&&!Ft,Lt=!dt&&d!==``&&h===`loading`&&!Ft&&!It,Rt=!dt&&a!==null&&Ke.length>0&&(d===``||Ke.some(e=>py(`${e.name} ${e.path}`,u,[`open recent project`]))),zt=Je.filter(e=>d===``||py(e.branch??``,u,[`worktree branch`])),Bt=!dt&&a!==null&&zt.length>0,Vt=fc(),Ht=!dt&&!Vt&&He!==null&&(d===``||li.some(e=>{let t=e.displayName;return py(o({id:`WqLq6M`,values:{displayName:t}}),u,[e.id,`agent handoff`,`open in`])})),Ut=lt.kind===`tag-list`?vy(re,lt.query):[],Wt=lt.kind===`tag-list`&&ae!==`loading`&&Ut.length===0,Gt=lt.kind===`tag-docs`&&de===`success`&&ce.length===0,Kt=Mc(),qt;t[50]===i?qt=t[51]:(qt=e=>{i(!1),rn(e)},t[50]=i,t[51]=qt);let Jt=qt,Yt;t[52]!==a||t[53]!==i?(Yt=e=>{i(!1),Tf(e,a?{okDesktop:{shell:a.shell}}:{okDesktop:void 0})},t[52]=a,t[53]=i,t[54]=Yt):Yt=t[54];let Xt=Yt,Zt;t[55]===i?Zt=t[56]:(Zt=()=>i(!1),t[55]=i,t[56]=Zt);let Qt;t[57]===L?Qt=t[58]:(Qt=e=>L(e),t[57]=L,t[58]=Qt);let $t;t[59]===z?$t=t[60]:($t=()=>z(!0),t[59]=z,t[60]=$t);let en;t[61]===V?en=t[62]:(en=()=>V(!0),t[61]=V,t[62]=en);let tn;t[63]===U?tn=t[64]:(tn=()=>U(!0),t[63]=U,t[64]=tn);let nn;t[65]===W?nn=t[66]:(nn=()=>{G(!0),W(!0)},t[65]=W,t[66]=nn);let an;t[67]===K?an=t[68]:(an=()=>K(!0),t[67]=K,t[68]=an);let on={bridge:a,singleFile:s,activeDocName:ye,contextualTargetKind:Mv(be),viewMenuState:Kt,emitMenuAction:Jt,runAction:Ct,openExternalUrl:Xt,closePalette:Zt,openNewItemDialog:Qt,openSeedDialog:$t,openCreateProjectDialog:en,openReportBugDialog:tn,openBugReportHistory:nn,openFeedbackDialog:an},sn=dt?[]:Bv.flatMap(e=>{if(!e.available(on)||e.visibility===`search-only`&&d===``)return[];let t=e.label(on);return py(t,u,e.keywords)?[{cmd:e,label:t}]:[]}),cn=sn.length>0,ln;t[69]===o?ln=t[70]:(ln=e=>{switch(e){case`commands`:return o({id:`45MZFs`});case`project`:return o({id:`e0NrBM`});case`file`:return o({id:`J2eKUI`});case`view`:return o({id:`jpctdh`});case`terminal`:return o({id:`ALhMYW`});case`app`:return o({id:`IrC12v`})}},t[69]=o,t[70]=ln);let un=ln,dn=e=>{let t=sn.filter(t=>t.cmd.group===e);return t.length===0?null:(0,Z.jsx)(Qe,{heading:un(e),children:t.map(e=>{let{cmd:t,label:n}=e,r=t.shortcutId!==void 0&&(t.shortcutDesktopOnly!==!0||a!==null)?Hu(t.shortcutId):null;return(0,Z.jsxs)(Re,{value:`${n} ${t.keywords.join(` `)}`,onSelect:()=>t.dispatch(on),"data-testid":`command-palette-${t.id}`,children:[(0,Z.jsx)(t.icon,{}),(0,Z.jsx)(`span`,{children:n}),t.checked?.(on)?(0,Z.jsx)(Zo,{className:`ml-auto text-muted-foreground`,"aria-hidden":`true`}):null,r?(0,Z.jsx)(tt,{children:r}):null]},t.id)})},e)},X=dt||Nt||Ft||Lt||It||Rt||Ht||cn,fn;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(fn=function(e){l(`${gy}${e}`)},t[71]=fn):fn=t[71];let pn=fn,mn;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(mn=function(){ge.current?.abort(),ge.current=null,ve.current!==null&&(window.clearTimeout(ve.current),ve.current=null),T([]),D(null),k(`idle`)},t[72]=mn):mn=t[72];let hn=mn,gn;t[73]===c?gn=t[74]:(gn=function(){S(!0),c.startsWith(`tag:`)&&l(c.slice(gy.length)),hn(),he.current?.focus()},t[73]=c,t[74]=gn);let _n=gn,vn;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(vn=function(){S(!1),l(``),hn(),he.current?.focus()},t[75]=vn):vn=t[75];let yn=vn,bn=function(e){let t=e.trim();if(!t||Ee)return;ge.current?.abort(),ve.current!==null&&window.clearTimeout(ve.current);let n=new AbortController;ge.current=n,k(`loading`);let r=!1,i=window.setTimeout(()=>{r=!0,n.abort(),k(`error`)},Vb);ve.current=i,fy(t,{signal:n.signal,semantic:!0,limit:30}).then(e=>{let{entries:r}=e;xn(i,n),T(r),D(t),k(`success`)}).catch(e=>{xn(i,n),!(e instanceof Error&&e.name===`AbortError`&&!r)&&(console.debug(`[semantic-search] fire failed`,{timedOut:r,error:e}),k(`error`))})};function xn(e,t){window.clearTimeout(e),ve.current===e&&(ve.current=null),ge.current===t&&(ge.current=null)}let Sn=function(e){!x||e.key!==`Enter`||(gt?.submit?(e.preventDefault(),e.stopPropagation(),bn(gt.submit.query)):O===`loading`&&(e.preventDefault(),e.stopPropagation()))},Cn;t[76]===x?Cn=t[77]:(Cn=function(e){x&&(e.preventDefault(),yn())},t[76]=x,t[77]=Cn);let wn=Cn,Tn;t[78]===o?Tn=t[79]:(Tn=o({id:`1bDVu5`}),t[78]=o,t[79]=Tn);let En;t[80]===o?En=t[81]:(En=o({id:`5GRxoA`}),t[80]=o,t[81]=En);let Dn;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(Dn={shouldFilter:!1,className:`[&_[cmdk-input-wrapper]_svg]:h-4 [&_[cmdk-input-wrapper]_svg]:w-4 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4`},t[82]=Dn):Dn=t[82];let On;t[83]!==o||t[84]!==x?(On=o(x?{id:`zXj1rA`}:{id:`ggs9f8`}),t[83]=o,t[84]=x,t[85]=On):On=t[85];let kn;t[86]!==x||t[87]!==ut?(kn=()=>{x&&(S(!1),hn()),l(ut?``:gy),he.current?.focus()},t[86]=x,t[87]=ut,t[88]=kn):kn=t[88];let An=ut?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,jn;t[89]===An?jn=t[90]:(jn=Y(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,An),t[89]=An,t[90]=jn);let Mn,Nn;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Mn=(0,Z.jsx)(jc,{className:`size-3.5`}),Nn=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`0rwwOn`})}),t[91]=Mn,t[92]=Nn):(Mn=t[91],Nn=t[92]);let Pn;t[93]!==ut||t[94]!==kn||t[95]!==jn?(Pn=(0,Z.jsxs)(`button`,{type:`button`,onClick:kn,"data-testid":`command-palette-filter-tag`,"data-active":ut,"aria-pressed":ut,className:jn,children:[Mn,Nn]}),t[93]=ut,t[94]=kn,t[95]=jn,t[96]=Pn):Pn=t[96];let Fn;t[97]!==_n||t[98]!==x||t[99]!==Fe?(Fn=Fe?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>x?yn():_n(),"data-testid":`command-palette-filter-semantic`,"data-active":x,"aria-pressed":x,className:Y(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,x?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`),children:[(0,Z.jsx)(lc,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`9tJX8r`})})]}):null,t[97]=_n,t[98]=x,t[99]=Fe,t[100]=Fn):Fn=t[100];let In;t[101]!==Pn||t[102]!==Fn?(In=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:[Pn,Fn]}),t[101]=Pn,t[102]=Fn,t[103]=In):In=t[103];let Ln;t[104]===It?Ln=t[105]:(Ln=It?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-6 text-muted-foreground text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-search-preparing`,children:[(0,Z.jsx)(ll,{className:`size-4 animate-spin`}),(0,Z.jsx)(J,{id:`yIPXut`})]}):null,t[104]=It,t[105]=Ln);let Rn;t[106]!==Ft||t[107]!==Lt?(Rn=Lt&&!Ft?(0,Z.jsx)(ft,{children:(0,Z.jsx)(J,{id:`WRNXKp`})}):null,t[106]=Ft,t[107]=Lt,t[108]=Rn):Rn=t[108];let zn=Jb,Bn=my(d,Pt,{truncated:_}),Vn;t[109]!==zn||t[110]!==dt||t[111]!==lt.kind||t[112]!==Bn?(Vn=(0,Z.jsx)(zn,{mode:Bn,inExclusiveMode:dt,paletteModeKind:lt.kind}),t[109]=zn,t[110]=dt,t[111]=lt.kind,t[112]=Bn,t[113]=Vn):Vn=t[113];let Hn=I===`file`,Un;t[114]===L?Un=t[115]:(Un=e=>{e||L(null)},t[114]=L,t[115]=Un);let Wn;t[116]!==Xe||t[117]!==Hn||t[118]!==Un?(Wn=(0,Z.jsx)(Ny,{open:Hn,onOpenChange:Un,kind:`file`,initialDir:Xe}),t[116]=Xe,t[117]=Hn,t[118]=Un,t[119]=Wn):Wn=t[119];let Gn=I===`folder`,Kn;t[120]===L?Kn=t[121]:(Kn=e=>{e||L(null)},t[120]=L,t[121]=Kn);let Jn;t[122]!==Xe||t[123]!==Gn||t[124]!==Kn?(Jn=(0,Z.jsx)(Ny,{open:Gn,onOpenChange:Kn,kind:`folder`,initialDir:Xe}),t[122]=Xe,t[123]=Gn,t[124]=Kn,t[125]=Jn):Jn=t[125];let Yn;t[126]!==R||t[127]!==z?(Yn=(0,Z.jsx)(sb,{open:R,onOpenChange:z}),t[126]=R,t[127]=z,t[128]=Yn):Yn=t[128];let Xn;t[129]!==a||t[130]!==B||t[131]!==V?(Xn=a?(0,Z.jsx)(Sv,{open:B,onOpenChange:V,bridge:a}):null,t[129]=a,t[130]=B,t[131]=V,t[132]=Xn):Xn=t[132];let Zn;t[133]!==a||t[134]!==H||t[135]!==U?(Zn=a?(0,Z.jsx)(Hh,{open:H,onOpenChange:U}):null,t[133]=a,t[134]=H,t[135]=U,t[136]=Zn):Zn=t[136];let Qn;t[137]!==a||t[138]!==te||t[139]!==ee||t[140]!==W||t[141]!==U?(Qn=a&&te?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Bb,{open:ee,onOpenChange:W,onReportABug:()=>{W(!1),U(!0)}})}):null,t[137]=a,t[138]=te,t[139]=ee,t[140]=W,t[141]=U,t[142]=Qn):Qn=t[142];let $n;return t[143]!==ne||t[144]!==K?($n=(0,Z.jsx)(Sy,{open:ne,onOpenChange:K,source:`command_palette`}),t[143]=ne,t[144]=K,t[145]=$n):$n=t[145],(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(De,{open:r,onOpenChange:i,title:Tn,description:En,className:`sm:max-w-2xl`,commandProps:Dn,onEscapeKeyDown:wn,children:[(0,Z.jsx)(st,{ref:he,value:c,onValueChange:l,onKeyDown:Sn,placeholder:On}),In,(0,Z.jsxs)(_e,{ref:me,className:`subtle-scrollbar`,children:[x&&gt?(0,Z.jsxs)(Z.Fragment,{children:[ze?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-semantic-indexing`,children:[(0,Z.jsx)(ll,{className:`size-3.5 animate-spin`}),(0,Z.jsx)(J,{id:`kCNU4q`,values:{semanticIndexedCount:Ie,semanticTotalCount:Le}})]}):null,gt.submit?(0,Z.jsx)(Qe,{children:(0,Z.jsx)(Re,{value:`semantic-submit`,onSelect:()=>bn(_t),"data-testid":`command-palette-semantic-submit`,children:gt.submit.kind===`retry`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(lc,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-amber-700 dark:text-amber-400`,children:(0,Z.jsx)(J,{id:`w4ZzmQ`})}),(0,Z.jsx)(tt,{children:`↵`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(lc,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,Z.jsx)(J,{id:`FNTx6u`,values:{semanticSubmitQuery:_t}})}),(0,Z.jsx)(tt,{children:`↵`})]})})}):null,gt.notice===`empty`?(0,Z.jsx)(ft,{"data-testid":`command-palette-semantic-empty`,children:(0,Z.jsx)(J,{id:`l5J_HM`,components:{0:(0,Z.jsx)(le,{"aria-label":o({id:`9Vnjc9`})})}})}):null,gt.notice===`searching`?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-6 text-muted-foreground text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-semantic-searching`,children:[(0,Z.jsx)(ll,{className:`size-4 animate-spin`}),(0,Z.jsx)(J,{id:`PBwmDJ`})]}):null,gt.notice===`no-results`?(0,Z.jsx)(ft,{"data-testid":`command-palette-semantic-no-results`,children:(0,Z.jsx)(J,{id:`yFyZMJ`,values:{semanticQueryText:ht}})}):null,gt.results.show?(0,Z.jsx)(Qe,{heading:gt.results.dimmed?o({id:`QlxHAH`,values:{semanticResultsLabel:vt}}):o({id:`9tJX8r`}),children:(0,Z.jsx)(`div`,{"data-testid":`command-palette-semantic-results`,"data-dimmed":gt.results.dimmed,children:w.map(e=>(0,Z.jsx)(qb,{entry:e,disabled:gt.results.dimmed,onSelect:()=>Mt(e)},Gv(e.kind,e.path)))})}):null]}):null,Ln,Rn,X?null:(0,Z.jsx)(ft,{children:h===`error`?(0,Z.jsx)(J,{id:`pkAft1`}):(0,Z.jsx)(J,{id:`i3f2kh`})}),lt.kind===`tag-list`?(0,Z.jsxs)(Qe,{heading:lt.query?o({id:`evs0iw`,values:{tagListQuery:pt}}):o({id:`2QM24L`}),children:[ae===`loading`?(0,Z.jsx)(ft,{children:(0,Z.jsx)(J,{id:`a_u4ck`})}):null,ae===`error`?(0,Z.jsx)(ft,{children:(0,Z.jsx)(J,{id:`qTcZZu`,components:{0:(0,Z.jsx)(le,{"aria-label":o({id:`69KLIV`})})}})}):null,Wt?(0,Z.jsx)(ft,{children:lt.query?o({id:`X0ttSN`,values:{tagListQuery:pt}}):o({id:`JLUTgi`})}):null,Ut.map(e=>(0,Z.jsxs)(Re,{value:`tag ${e.name}`,onSelect:()=>pn(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(jc,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),(0,Z.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:(0,Z.jsx)(J,{id:`fVcm9t`,values:{0:e.count}})})]},`tag:${e.name}`))]}):null,lt.kind===`tag-docs`?(0,Z.jsxs)(Qe,{heading:o({id:`hGmuTc`,values:{tagDocsName:mt}}),children:[de===`loading`?(0,Z.jsx)(ft,{children:(0,Z.jsx)(J,{id:`pWbsW6`})}):null,de===`error`?(0,Z.jsx)(ft,{children:(0,Z.jsx)(J,{id:`z_4xza`,components:{0:(0,Z.jsx)(le,{"aria-label":o({id:`69KLIV`})})}})}):null,Gt?(0,Z.jsx)(ft,{children:o({id:`NIWAux`,values:{tagDocsName:mt}})}):null,ce.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName,n=e.matchingTags.filter(e=>e!==lt.tagName).map($b).join(`, `);return(0,Z.jsxs)(Re,{value:`tag-doc ${e.docName}`,onSelect:()=>{i(!1),Gb(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(qn,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:t}),(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:e.docName}),e.matchingTags.length>0&&e.matchingTags.some(e=>e!==lt.tagName)?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:(0,Z.jsx)(J,{id:`CvsD6Y`,values:{viaTags:n}})}):null]})]},`tag-doc:${e.docName}`)})]}):null,Nt?(0,Z.jsx)(Qe,{heading:o({id:`MmDDWK`}),children:We.map(e=>(0,Z.jsx)(qb,{entry:e,onSelect:()=>Mt(e)},Gv(e.kind,e.path)))}):null,dn(`commands`),Ht?(0,Z.jsx)(Qe,{heading:o({id:`O7_W_a`}),children:li.filter(e=>{let t=e.displayName;return py(o({id:`WqLq6M`,values:{displayName:t}}),u,[e.id,`agent handoff`,`open in`])}).map(e=>{let t=ke[e.id],n=t.installed===!0&&He!==null,r=e.displayName,a=t.installed===null?o({id:`IA6JW2`}):t.installed===!1?o({id:`5SwVv1`}):null,s=o(a?{id:`1ZpfyB`,values:{displayName:r,hint:a}}:{id:`WqLq6M`,values:{displayName:r}});return(0,Z.jsxs)(Re,{value:`send to ai ${e.displayName} ${e.id} agent open in`,disabled:!n,onSelect:()=>{!n||!He||(i(!1),je(e.id,He))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":s,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`WqLq6M`,values:{displayName:r}})}),a?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:a}):null]},e.id)})}):null,dn(`project`),Rt&&a?(0,Z.jsx)(Qe,{heading:o({id:`3iyGWF`}),children:Ke.filter(e=>py(`${e.name} ${e.path}`,u,[`open recent project`])).slice(0,10).map(e=>{let t=e.isLinkedWorktree===!0,n=t?To:S_,r=t&&e.mainRoot!==void 0?Tb(e.mainRoot):null;return(0,Z.jsx)(zb,{path:e.path,onRemoveRecent:Tt,testIdPrefix:`command-palette-recent`,children:(0,Z.jsxs)(`div`,{className:`group/recent relative flex items-center`,children:[(0,Z.jsxs)(Re,{value:`${e.name} ${e.path} recent project`,onSelect:()=>Ct(()=>a.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),o({id:`SUOoXn`})),"data-testid":`command-palette-recent-${e.path}`,className:`flex-1 items-start pr-8`,children:[(0,Z.jsx)(n,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:e.name}),r===null?null:(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`8Gzz2G`,values:{worktreeOf:r}})}),(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:e.path})]})]}),(0,Z.jsx)(Rb,{path:e.path,name:e.name,onRemoveRecent:Tt,testIdPrefix:`command-palette-recent`})]})},e.path)})}):null,Bt&&a?(0,Z.jsx)(Qe,{heading:o({id:`sxjyRq`}),children:zt.slice(0,10).map(e=>(0,Z.jsxs)(Re,{value:`${e.branch} worktree branch`,onSelect:()=>Ot(e),"data-testid":`command-palette-worktree-${e.branch}`,className:`items-start`,children:[(0,Z.jsx)(To,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:e.branch}),(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:e.worktreePath??o({id:`iO8V-7`})})]})]},e.branch))}):null,[`file`,`view`,`terminal`,`app`].map(e=>dn(e)),Ft?(0,Z.jsx)(Qe,{heading:o({id:`A1taO8`}),children:Pt.map(e=>(0,Z.jsx)(qb,{entry:e,query:d,onSelect:()=>Mt(e)},Gv(e.kind,e.path)))}):null]}),Vn]}),Wn,Jn,Yn,Xn,Zn,Qn,$n]})}function $b(e){return`#${e}`}function ex(e){return e.name}function tx(e){return e.branch!==null&&!e.isCurrent}function nx(e){return Gv(e.kind,e.path)}function rx(e){return e===`eperm`?zu._({id:`XuQzrk`}):zu._({id:`BUyQnq`})}async function ix(e){let t=await e.restartServer(e.config.projectPath);return t.ok?{ok:!0}:{ok:!1,message:rx(t.reason)}}var ax=500;function ox(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function sx(e){return e?.kind===`null-collab`}function cx(e){if(e===null)return zu._({id:`Ua78MH`});if(e.kind===`null-collab`)return zu._({id:`TJnkyf`});if(e.code===`network`)return zu._({id:`aoa6xA`});if(e.code===`invalid-body`)return zu._({id:`FRYB1Q`});let t=e.code;return zu._({id:`4nj6n8`,values:{code:t}})}function lx(){let e=(0,$.c)(28),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=ot(),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),d=typeof window<`u`?window.okDesktop:void 0,f,p;e[0]!==n||e[1]!==t?(f=()=>{if(t!==null||n){o(!1);return}let e=setTimeout(()=>o(!0),ax);return()=>clearTimeout(e)},p=[t,n],e[0]=n,e[1]=t,e[2]=f,e[3]=p):(f=e[2],p=e[3]),(0,Q.useEffect)(f,p);let m=ox(t,n,a);if(m===`hidden`)return null;if(m===`terminal`){let t;e[4]===r?t=e[5]:(t=sx(r),e[4]=r,e[5]=t);let n=t,a;e[6]===r?a=e[7]:(a=cx(r),e[6]=r,e[7]=a);let o=a,f;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=async()=>{if(d){u(null),c(!0);try{let e=await ix(d);e.ok||(u(e.message),c(!1))}catch{c(!1)}}},e[8]=f):f=e[8];let p=f,m;e[9]!==o||e[10]!==n?(m=(0,Z.jsx)(`span`,{children:n?(0,Z.jsx)(J,{id:`AAlr5Y`,components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}}):(0,Z.jsx)(J,{id:`noH1JX`,values:{errorDetail:o},components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`}),1:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}})}),e[9]=o,e[10]=n,e[11]=m):m=e[11];let h;e[12]===i?h=e[13]:(h=()=>{u(null),i()},e[12]=i,e[13]=h);let g;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(J,{id:`6gRgw8`}),e[14]=g):g=e[14];let _;e[15]!==s||e[16]!==h?(_=(0,Z.jsx)(`button`,{type:`button`,onClick:h,disabled:s,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900 disabled:opacity-60`,children:g}),e[15]=s,e[16]=h,e[17]=_):_=e[17];let v;e[18]===s?v=e[19]:(v=d?(0,Z.jsx)(`button`,{type:`button`,onClick:p,disabled:s,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900 disabled:opacity-60`,children:s?(0,Z.jsx)(J,{id:`0Er6-M`}):(0,Z.jsx)(J,{id:`uaUc6t`})}):null,e[18]=s,e[19]=v);let y;e[20]===l?y=e[21]:(y=l===null?null:(0,Z.jsx)(`span`,{className:`w-full text-red-950 text-xs`,children:l}),e[20]=l,e[21]=y);let b;return e[22]!==y||e[23]!==m||e[24]!==_||e[25]!==v?(b=(0,Z.jsxs)(`div`,{role:`alert`,"aria-live":`assertive`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[m,_,v,y]}),e[22]=y,e[23]=m,e[24]=_,e[25]=v,e[26]=b):b=e[26],b}let h;return e[27]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md`,children:(0,Z.jsx)(J,{id:`UYcGIW`})}),e[27]=h):h=e[27],h}function ux(e){let t=(0,$.c)(5),{bridge:n}=e,[r,i]=(0,Q.useState)(!1),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>en(e=>{e===`new-project`&&i(!0)}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o);let s;return t[2]!==n||t[3]!==r?(s=(0,Z.jsx)(Sv,{open:r,onOpenChange:i,bridge:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}var dx=`ok-acp-desktop-migration-v1`,fx=[`ok-preferred-agent-v1`,`ok-ask-ai-agent-v2`,`ok-ask-ai-default-agent-v1`];function px(e){try{return localStorage.getItem(e)}catch{return null}}function mx(){try{localStorage.setItem(dx,`1`)}catch{}}function hx(){return fx.some(e=>px(e)!==null)}function gx(e){return li.every(t=>e[t.id]?.installed!=null)?li.filter(t=>e[t.id]?.installed===!0).map(e=>e.id):null}function _x(e){let t=(0,$.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>{if(px(dx)!==null)return;if(!hx()){mx();return}let t=gx(e);if(t!==null){for(let e of t)hi(si(e),!0);mx()}},r=[e],t[0]=e,t[1]=n,t[2]=r),(0,Q.useEffect)(n,r)}function vx(){let{states:e}=_s();return _x(e),null}function yx(e,t){e.chain().focus().insertContent({type:`text`,text:t}).run()}function bx(e){if(e.isDestroyed)return null;try{let t=e.view.coordsAtPos(e.state.selection.from);return{left:t.left,top:t.top,bottom:t.bottom}}catch{return null}}function xx(){let e=(0,$.c)(29),{_:t}=Dt(),[n,r]=(0,Q.useState)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=function(e){let t=e.detail;if(!t?.editor||t.editor.isDestroyed)return;let n=bx(t.editor);n&&r({editor:t.editor,...n})};return document.addEventListener(y,e),()=>document.removeEventListener(y,e)},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o=n?.editor??null,s,c;if(e[2]===o?(s=e[3],c=e[4]):(s=()=>{if(!o)return;let e=function(){let e=o,t=bx(e);r(n=>!n||n.editor!==e?n:t?{...n,...t}:null)};return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),window.addEventListener(`resize`,e),()=>{document.removeEventListener(`scroll`,e,{capture:!0}),window.removeEventListener(`resize`,e)}},c=[o],e[2]=o,e[3]=s,e[4]=c),(0,Q.useEffect)(s,c),!n)return null;let l;e[5]===n?l=e[6]:(l=function(e){if(!n)return;let{editor:t}=n;r(null),e&&!t.isDestroyed&&t.commands.focus()},e[5]=n,e[6]=l);let u=l,d;e[7]===u?d=e[8]:(d=e=>{e||u(!1)},e[7]=u,e[8]=d);let f=n.bottom-n.top,p;e[9]!==n.left||e[10]!==n.top||e[11]!==f?(p=(0,Z.jsx)(nn,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":!0,"data-testid":`emoji-picker-anchor`,className:`pointer-events-none fixed`,style:{left:n.left,top:n.top,height:f}})}),e[9]=n.left,e[10]=n.top,e[11]=f,e[12]=p):p=e[12];let m;e[13]===t?m=e[14]:(m=t({id:`pFPzHA`}),e[13]=t,e[14]=m);let h,g;e[15]===u?(h=e[16],g=e[17]):(g=()=>u(!0),h=()=>u(!1),e[15]=u,e[16]=h,e[17]=g);let _;e[18]===n.editor?_=e[19]:(_=(0,Z.jsx)(zo,{onSelect:e=>{let t=n.editor;r(null),yx(t,e)}}),e[18]=n.editor,e[19]=_);let v;e[20]!==h||e[21]!==_||e[22]!==m||e[23]!==g?(v=(0,Z.jsx)(an,{className:`w-auto p-0`,align:`start`,"aria-label":m,"data-testid":`emoji-picker-popover`,onEscapeKeyDown:g,onInteractOutside:h,children:_}),e[20]=h,e[21]=_,e[22]=m,e[23]=g,e[24]=v):v=e[24];let b;return e[25]!==v||e[26]!==d||e[27]!==p?(b=(0,Z.jsxs)(Qt,{open:!0,onOpenChange:d,children:[p,v]}),e[25]=v,e[26]=d,e[27]=p,e[28]=b):b=e[28],b}async function Sx(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.json().catch(()=>null),n=t.status,r=t.statusText;throw Error(Qu(e)??zu._({id:`lHwYMr`,values:{status:n,statusText:r}}))}return(await t.json()).docs??[]}function Cx(){let e=(0,$.c)(18),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={kind:`idle`},e[0]=a):a=e[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(0),l,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=function(e){let t=e.detail;if(!t||typeof t.value!=`string`)return;let r=c.current+=1;i(t.value),n(!0),s({kind:`loading`}),Sx(t.value).then(e=>{c.current===r&&s({kind:`ready`,docs:e})}).catch(e=>{c.current===r&&s({kind:`error`,message:e instanceof Error?e.message:String(e)})})};return document.addEventListener(me,e),()=>document.removeEventListener(me,e)},u=[],e[1]=l,e[2]=u):(l=e[1],u=e[2]),(0,Q.useEffect)(l,u);let d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){n(!1),window.location.assign(Bd(e))},e[3]=d):d=e[3];let f=d,p=r??``,m;e[4]===p?m=e[5]:(m={tagName:p},e[4]=p,e[5]=m);let h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h={0:(0,Z.jsx)(`span`,{className:`font-mono break-all`})},e[6]=h):h=e[6];let g;e[7]===m?g=e[8]:(g=(0,Z.jsx)(kn,{children:(0,Z.jsx)(Tn,{children:(0,Z.jsx)(J,{id:`7H4UHD`,values:m,components:h})})}),e[7]=m,e[8]=g);let _=r??``,v;e[9]!==o||e[10]!==_?(v=(0,Z.jsx)(Dn,{children:(0,Z.jsx)(wx,{fetchState:o,tag:_,onSelectDoc:f})}),e[9]=o,e[10]=_,e[11]=v):v=e[11];let y;e[12]!==g||e[13]!==v?(y=(0,Z.jsxs)(En,{children:[g,v]}),e[12]=g,e[13]=v,e[14]=y):y=e[14];let b;return e[15]!==t||e[16]!==y?(b=(0,Z.jsx)(An,{open:t,onOpenChange:n,children:y}),e[15]=t,e[16]=y,e[17]=b):b=e[17],b}function wx(e){let t=(0,$.c)(15),{fetchState:n,tag:r,onSelectDoc:i}=e;if(n.kind===`idle`||n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-loading`,children:(0,Z.jsx)(J,{id:`yQE2r9`})}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`tag-dialog-error`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.docs.length===0){let e;t[3]===r?e=t[4]:(e={tag:r},t[3]=r,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n={0:(0,Z.jsx)(`span`,{className:`font-mono`})},t[5]=n):n=t[5];let i;return t[6]===e?i=t[7]:(i=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-empty`,children:(0,Z.jsx)(J,{id:`lAiyU_`,values:e,components:n})}),t[6]=e,t[7]=i),i}let a;if(t[8]!==n.docs||t[9]!==i){let e;t[11]===i?e=t[12]:(e=e=>{let t=e.matchingTags??[];return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`w-full rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring`,onClick:()=>i(e.docName),"data-testid":`tag-dialog-row`,children:[(0,Z.jsx)(`span`,{className:`block truncate font-medium`,children:e.title}),e.docName===e.title?null:(0,Z.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.docName}),t.length>0?(0,Z.jsx)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1`,"data-testid":`tag-dialog-row-matches`,children:t.map(Tx)}):null]})},e.docName)},t[11]=i,t[12]=e),a=n.docs.map(e),t[8]=n.docs,t[9]=i,t[10]=a}else a=t[10];let o;return t[13]===a?o=t[14]:(o=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`tag-dialog-list`,children:a}),t[13]=a,t[14]=o),o}function Tx(e){return(0,Z.jsxs)(`span`,{"data-testid":`tag-dialog-row-match`,"data-tag":e,className:`tag pointer-events-none text-xs`,children:[`#`,e]},e)}var Ex=`raw-mdx-nav`,Dx=`ok-editor-mode-v1`,Ox=[`wysiwyg`,`source`],kx=`wysiwyg`;function Ax(e){return Ox.includes(e)}function jx(e=localStorage){try{let t=e.getItem(Dx);if(t===null)return kx;if(Ax(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return kx}function Mx(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return Ax(n)?n:jx(t)}function Nx(e,t=localStorage){try{return t.setItem(Dx,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function Px(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(Mx),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),Nx(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function Fx(e){let t=(0,$.c)(4),{_:n}=Dt(),r=(0,Q.useRef)(!1),i,a;t[0]!==n||t[1]!==e?(i=()=>{e===`no-push-permission`&&!r.current&&(r.current=!0,Mu.info(n({id:`JkCD2u`})))},a=[e,n],t[0]=n,t[1]=e,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Q.useEffect)(i,a)}function Ix(e,t){return e===`follow`?(0,Z.jsx)(J,{id:`Sxx_Zz`,values:{project:t}}):e===`full`?(0,Z.jsx)(J,{id:`4zEZS5`,values:{project:t}}):(0,Z.jsx)(J,{id:`AaaESH`,values:{project:t}})}function Lx(){let e=(0,$.c)(8),{projectLocalConfig:t,projectLocalSynced:n,projectLocalBinding:r}=wf(),i=(0,Q.useRef)(!1),a;e[0]!==r||e[1]!==t?.autoSync||e[2]!==n?(a=()=>{if(!n||i.current||r===null)return;let e=t?.autoSync;if(e?.inheritedNoticePending!==!0)return;i.current=!0;let a=typeof e.inheritedFrom==`string`?e.inheritedFrom:``;Mu(Ix(so({mode:e.mode,enabled:e.enabled}),a)),r.patch({autoSync:{inheritedNoticePending:null}})},e[0]=r,e[1]=t?.autoSync,e[2]=n,e[3]=a):a=e[3];let o;e[4]!==r||e[5]!==t||e[6]!==n?(o=[n,t,r],e[4]=r,e[5]=t,e[6]=n,e[7]=o):o=e[7],(0,Q.useEffect)(a,o)}var Rx=`ok-terminal-dock-v1`,zx=`right`;function Bx(e){return e===`bottom`?`bottom`:`right`}function Vx(e){try{return Bx((e??localStorage).getItem(Rx))}catch{return zx}}function Hx(e,t){try{(t??localStorage).setItem(Rx,e)}catch{}}function Ux(){try{return typeof localStorage>`u`?zx:Vx()}catch{return zx}}function Wx(e){let t=(0,$.c)(36),{open:n,variant:r,onResolved:i}=e,{_:a}=Dt(),o=Eo(),s;t[0]!==a||t[1]!==i||t[2]!==r||t[3]!==o?(s=function(e){if(o===null){Mu.error(a({id:`fiMNLl`}));return}let t=o(e?r===`follow`?`follow`:`full`:`off`);if(!t.ok){let n=t.error;Mu.error(a(e?{id:`FUMerq`,values:{detail:n}}:{id:`0t0bbC`,values:{detail:n}}));return}i()},t[0]=a,t[1]=i,t[2]=r,t[3]=o,t[4]=s):s=t[4];let c=s,l;t[5]===r?l=t[6]:(l=(0,Z.jsx)(kn,{children:(0,Z.jsx)(ko,{variant:r})}),t[5]=r,t[6]=l);let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(jo,{variant:r}),t[7]=r,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`QYTOaN`,components:{0:(0,Z.jsx)(`span`,{className:`font-medium`})}})}),t[9]=d):d=t[9];let f;t[10]===u?f=t[11]:(f=(0,Z.jsxs)(Dn,{children:[u,d]}),t[10]=u,t[11]=f);let p;t[12]===c?p=t[13]:(p=()=>c(!1),t[12]=c,t[13]=p);let m=o===null,h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(J,{id:`IKoTAC`}),t[14]=h):h=t[14];let g;t[15]!==p||t[16]!==m?(g=(0,Z.jsx)(X,{variant:`outline`,className:`uppercase font-mono`,onClick:p,disabled:m,children:h}),t[15]=p,t[16]=m,t[17]=g):g=t[17];let _;t[18]===c?_=t[19]:(_=()=>c(!0),t[18]=c,t[19]=_);let v=o===null,y;t[20]===r?y=t[21]:(y=r===`follow`?(0,Z.jsx)(J,{id:`U4nTfu`}):(0,Z.jsx)(J,{id:`XU0OXn`}),t[20]=r,t[21]=y);let b;t[22]!==_||t[23]!==v||t[24]!==y?(b=(0,Z.jsx)(X,{onClick:_,disabled:v,children:y}),t[22]=_,t[23]=v,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==g?(x=(0,Z.jsxs)(On,{children:[g,b]}),t[26]=b,t[27]=g,t[28]=x):x=t[28];let S;t[29]!==x||t[30]!==l||t[31]!==f?(S=(0,Z.jsxs)(En,{className:`sm:max-w-lg`,showCloseButton:!1,children:[l,f,x]}),t[29]=x,t[30]=l,t[31]=f,t[32]=S):S=t[32];let C;return t[33]!==n||t[34]!==S?(C=(0,Z.jsx)(An,{open:n,onOpenChange:Gx,children:S}),t[33]=n,t[34]=S,t[35]=C):C=t[35],C}function Gx(){}function Kx(e){if(!(!e.autoSyncOnboardingDismissed&&e.hasRemote===!0&&e.projectLocalSynced===!0&&e.projectSynced===!0&&e.projectLocalConfig!==null&&so(e.projectLocalConfig.autoSync??void 0)===null&&Na(e.projectConfig?.autoSync?.default)===null))return null;switch(e.pushPermissionCheckStatus){case`allowed`:return`full`;case`denied`:return`follow`;default:return null}}function qx(e){let t=(0,$.c)(57),{primary:n,onPrimary:r,primaryDisabled:i,installedTargets:a,selectedTargetId:o,onSelectTarget:s,threadAgents:c,onOpenSettings:l,terminal:u,terminals:d,menuEmptyState:f,menuLeading:p,onMenuOpenChange:m,menuAlign:h,triggerAriaLabel:g,testIds:_}=e,v=i===void 0?!1:i,y=h===void 0?`end`:h,{_:b}=Dt(),x=a.length>0,S=d&&d.length>0?d:null,C=S!=null||u!=null,w=x||C,T=c!==void 0&&c.length>0,E;t[0]===_?E=t[1]:(E=e=>typeof _.terminal==`function`?_.terminal(e):_.terminal,t[0]=_,t[1]=E);let D=E,O;t[2]!==r||t[3]!==n||t[4]!==v||t[5]!==_.primary?(O=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`gap-1.5`,disabled:v,onClick:r,"data-testid":_.primary,children:n}),t[2]=r,t[3]=n,t[4]=v,t[5]=_.primary,t[6]=O):O=t[6];let k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)($o,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[7]=k):k=t[7];let A;t[8]!==_.trigger||t[9]!==g?(A=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon`,"aria-label":g,"data-testid":_.trigger,children:k})}),t[8]=_.trigger,t[9]=g,t[10]=A):A=t[10];let j;t[11]!==w||t[12]!==p||t[13]!==T?(j=p?(0,Z.jsxs)(Z.Fragment,{children:[p,T||w?(0,Z.jsx)(qr,{}):null]}):null,t[11]=w,t[12]=p,t[13]=T,t[14]=j):j=t[14];let M;t[15]!==b||t[16]!==w||t[17]!==T||t[18]!==_||t[19]!==c?(M=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(zr,{"aria-label":b({id:`vPKX2i`}),children:[(0,Z.jsxs)(Hr,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(J,{id:`RXEbZy`}),(0,Z.jsx)(pi,{})]}),c?.map(e=>(0,Z.jsxs)(Ir,{onSelect:e.onSelect,"data-testid":_.threadAgent?.(e.key),children:[(0,Z.jsx)(Po,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.selected?(0,Z.jsx)(Zo,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.key))]}),w?(0,Z.jsx)(qr,{}):null]}):null,t[15]=b,t[16]=w,t[17]=T,t[18]=_,t[19]=c,t[20]=M):M=t[20];let N;t[21]!==b||t[22]!==S||t[23]!==w||t[24]!==a||t[25]!==s||t[26]!==o||t[27]!==x||t[28]!==C||t[29]!==u||t[30]!==D||t[31]!==_?(N=w?(0,Z.jsxs)(Z.Fragment,{children:[C?(0,Z.jsxs)(zr,{"aria-label":b({id:`ALhMYW`}),children:[(0,Z.jsx)(Hr,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),S?S.map(e=>(0,Z.jsxs)(Ir,{onSelect:e.onSelect,"data-testid":D(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(di,{id:ai(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Zo,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):u?(0,Z.jsxs)(Ir,{onSelect:u.onSelect,"data-testid":D(`claude`),"aria-label":b({id:`AcK_r0`}),children:[(0,Z.jsx)(di,{id:ai(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`fcgvCA`})}),u.selected?(0,Z.jsx)(Zo,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,x?(0,Z.jsxs)(Z.Fragment,{children:[C?(0,Z.jsx)(qr,{}):null,(0,Z.jsxs)(zr,{"aria-label":b({id:`BBqGS9`}),children:[(0,Z.jsx)(Hr,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),a.map(e=>(0,Z.jsxs)(Ir,{onSelect:()=>s(e),"data-testid":_.option(e.id),children:[(0,Z.jsx)(di,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),o===e.id?(0,Z.jsx)(Zo,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):null,t[21]=b,t[22]=S,t[23]=w,t[24]=a,t[25]=s,t[26]=o,t[27]=x,t[28]=C,t[29]=u,t[30]=D,t[31]=_,t[32]=N):N=t[32];let P=!T&&!w?f:null,F;t[33]!==w||t[34]!==T?(F=T||w?(0,Z.jsx)(qr,{}):null,t[33]=w,t[34]=T,t[35]=F):F=t[35];let I;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(wu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),t[36]=I):I=t[36];let L;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`jRAGrQ`})}),t[37]=L):L=t[37];let R;t[38]!==l||t[39]!==_.settings?(R=(0,Z.jsxs)(Ir,{onSelect:l,"data-testid":_.settings,children:[I,L]}),t[38]=l,t[39]=_.settings,t[40]=R):R=t[40];let z;t[41]!==y||t[42]!==P||t[43]!==F||t[44]!==R||t[45]!==j||t[46]!==M||t[47]!==N||t[48]!==_.menu?(z=(0,Z.jsxs)(Wr,{align:y,className:`max-h-80 min-w-[200px]`,"data-testid":_.menu,children:[j,M,N,P,F,R]}),t[41]=y,t[42]=P,t[43]=F,t[44]=R,t[45]=j,t[46]=M,t[47]=N,t[48]=_.menu,t[49]=z):z=t[49];let B;t[50]!==m||t[51]!==z||t[52]!==A?(B=(0,Z.jsxs)(Kr,{modal:!1,onOpenChange:m,children:[A,z]}),t[50]=m,t[51]=z,t[52]=A,t[53]=B):B=t[53];let V;return t[54]!==B||t[55]!==O?(V=(0,Z.jsxs)(yp,{children:[O,B]}),t[54]=B,t[55]=O,t[56]=V):V=t[56],V}async function Jx({sharedInstruction:e=``,threadIds:t,submit:n=!1,resolve:r=!1}={}){return(await Kl({threadIds:t,resolve:r,compose:async t=>(on(Jl(t.map(e=>Hl(e.payload)),e),{newTab:!1,submit:n}),!0)})).length}function Yx(e){let t=(0,$.c)(9),{onStartNewChat:n}=e,{_:r}=Dt(),i;t[0]===r?i=t[1]:(i=r({id:`rY9lqA`}),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(tn,{className:`size-4`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:(0,Z.jsx)(J,{id:`vPF04k`})}),t[3]=o):o=t[3];let s;t[4]===n?s=t[5]:(s=(0,Z.jsxs)(Ir,{onSelect:n,className:`gap-2`,"data-testid":`comment-queue-send-new`,children:[a,o]}),t[4]=n,t[5]=s);let c;return t[6]!==i||t[7]!==s?(c=(0,Z.jsx)(zr,{"aria-label":i,children:s}),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function Xx(e){let t=new Map;for(let n of e){let e=t.get(n.docName);e?e.push(n):t.set(n.docName,[n])}return[...t].map(([e,t])=>({docName:e,threads:t}))}function Zx(){let e=(0,$.c)(39),t=ci(),n=fs(),{states:r}=_s(),i=ri(),a=ii(),[o,s]=(0,Q.useState)(Qx),c,l,u,d,f,p,m,h,g,_;if(e[0]!==a||e[1]!==t||e[2]!==i||e[3]!==o||e[4]!==r||e[5]!==n){let v;e[16]===t?v=e[17]:(v=e=>ui(t,e.source,e.id,!0,e.supported),e[16]=t,e[17]=v);let y=i.filter(v),b=gi(y,a),x;e[18]===n?.installedClis?x=e[19]:(x=n?.installedClis??{},e[18]=n?.installedClis,e[19]=x);let S=ol({sticky:o,effectiveThreadAgent:b,enabledClis:n===null?[]:Vc(t,n.installedClis),enabledDesktopTargets:sl(t),installedClis:x,terminalAvailable:n!==null,threadsAvailable:!0,desktopSelectable:!0}),C=S.kind===`thread`,w=S.kind===`cli`?S.cli:null,T=S.kind===`desktop`?li.find(e=>e.id===S.target)??null:null,E;e[20]===t?E=e[21]:(E=li.filter(e=>mi(t,e.id)),e[20]=t,e[21]=E);let D=E,O;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>{s(e),al(e)},e[22]=O):O=e[22];let k=O,A=n===null?void 0:Vc(t,n.installedClis).map(e=>{let{displayName:t}=Ri[e];return{cli:e,label:t,ariaLabel:zu._({id:`QYfQdv`,values:{displayName:t}}),selected:w===e,onSelect:()=>k(Rc(e))}});p=C,m=b,h=w,g=T,e[23]===r?_=e[24]:(_=li.some(e=>r[e.id]?.installed==null),e[23]=r,e[24]=_),c=D,l=w===null?T?.id??null:null,e[25]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>k(e.id),e[25]=u):u=e[25],d=A,f=y.map(e=>({key:`${e.source}:${e.id}`,id:e.id,name:e.name,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl},selected:C&&b!==null&&b.source===e.source&&b.id===e.id,onSelect:()=>{oi(e),k(Lc)}})),e[0]=a,e[1]=t,e[2]=i,e[3]=o,e[4]=r,e[5]=n,e[6]=c,e[7]=l,e[8]=u,e[9]=d,e[10]=f,e[11]=p,e[12]=m,e[13]=h,e[14]=g,e[15]=_}else c=e[6],l=e[7],u=e[8],d=e[9],f=e[10],p=e[11],m=e[12],h=e[13],g=e[14],_=e[15];let v;e[26]!==c||e[27]!==l||e[28]!==u||e[29]!==d||e[30]!==f?(v={installedTargets:c,selectedTargetId:l,onSelectTarget:u,terminals:d,threadAgents:f},e[26]=c,e[27]=l,e[28]=u,e[29]=d,e[30]=f,e[31]=v):v=e[31];let y;return e[32]!==v||e[33]!==p||e[34]!==m||e[35]!==h||e[36]!==g||e[37]!==_?(y={isThreadSelected:p,threadAgent:m,cli:h,target:g,probePending:_,rows:v},e[32]=v,e[33]=p,e[34]=m,e[35]=h,e[36]=g,e[37]=_,e[38]=y):y=e[38],y}function Qx(){return Nc()}function $x(e){return Jl(e.map(Hl),``)}function eS(){let e=(0,$.c)(17),t=jf(),n=ci(),{dispatch:r}=ds(),i=fs(),{states:a}=_s(),o=ri(),s=ii(),c,l;if(e[0]!==s||e[1]!==n||e[2]!==o||e[3]!==i){let t;e[6]===n?t=e[7]:(t=e=>ui(n,e.source,e.id,!0,e.supported),e[6]=n,e[7]=t),c=gi(o.filter(t),s);let r;e[8]===i?.installedClis?r=e[9]:(r=i?.installedClis??{},e[8]=i?.installedClis,e[9]=r),l=ol({sticky:Nc(),effectiveThreadAgent:c,enabledClis:i===null?[]:Vc(n,i.installedClis),enabledDesktopTargets:sl(n),installedClis:r,terminalAvailable:i!==null,threadsAvailable:!0,desktopSelectable:!0}),e[0]=s,e[1]=n,e[2]=o,e[3]=i,e[4]=c,e[5]=l}else c=e[4],l=e[5];let u=l,d;return e[10]!==c||e[11]!==r||e[12]!==u||e[13]!==a||e[14]!==i||e[15]!==t?(d=async e=>{let n=e.map(nS);if(n.length===0)return!1;let o=ws({docName:null,workspace:t,instruction:$x(n),mentions:[...new Set(n.map(tS))]});if(o===null)return Mu.error(zu._({id:`3V94ia`})),!1;if(u.kind===`thread`)return Ds(o,c===null?void 0:{agent:{source:c.source,id:c.id}}),!0;if(u.kind===`cli`&&i!==null)try{return i.launchInTerminal(o,u.cli),!0}catch{return Mu.error(zu._({id:`IZXuGP`})),!1}if(u.kind===`none`)return Mu.info(zu._({id:`8YymuQ`})),Wu(),!1;if(u.kind===`cli`)return Mu.error(zu._({id:`8jeVmd`})),!1;if(u.kind!==`desktop`)return Mu.error(zu._({id:`kq-Qj4`})),!1;let s=li.find(e=>e.id===u.target)??null;return s===null?(Mu.error(zu._({id:`F9e3PM`})),!1):a[s.id]?.installed===!0?(await r(s.id,o)).ok:(Ts(s),Mu.info(zu._({id:`L1BQTH`,values:{0:s.displayName}})),!1)},e[10]=c,e[11]=r,e[12]=u,e[13]=a,e[14]=i,e[15]=t,e[16]=d):d=e[16],d}function tS(e){return mc(e.docName)}function nS(e){return e.payload}function rS(){let e=(0,$.c)(28),{_:t}=Dt(),n=Zx(),r=eS(),i=ml(),a=Pl(),o=i.map(cS).filter(sS),s;e[0]===a?s=e[1]:(s=e=>a.includes(e.id),e[0]=a,e[1]=s);let c=o.filter(s).length,l=Ic(),u;e[2]!==l||e[3]!==n?(u=l===null?n.isThreadSelected?(0,Z.jsx)(Po,{agentId:n.threadAgent?.id??``,iconUrl:n.threadAgent?.iconUrl,className:`size-4`}):n.cli===null?n.target?(0,Z.jsx)(di,{id:n.target.id,className:`size-4`,"aria-hidden":!0}):void 0:(0,Z.jsx)(di,{id:ai(n.cli),className:`size-4`,"aria-hidden":!0}):l.kind===`thread`?(0,Z.jsx)(Po,{agentId:l.agentId,iconUrl:l.iconUrl,className:`size-4`}):(0,Z.jsx)(di,{id:ai(l.cli),className:`size-4`,"aria-hidden":!0}),e[2]=l,e[3]=n,e[4]=u):u=e[4];let d=u,f;e[5]!==r||e[6]!==l?(f=function(){if(l===null){Kl({compose:r});return}Jx()},e[5]=r,e[6]=l,e[7]=f):f=e[7];let p=f,m=Dp,h;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(xp,{children:(0,Z.jsx)(J,{id:`b24kPi`})}),e[8]=h):h=e[8];let g;e[9]===i.length?g=e[10]:(g=(0,Z.jsxs)(Ep,{children:[h,(0,Z.jsx)(Tp,{children:i.length})]}),e[9]=i.length,e[10]=g);let _=Cp,v=o.length===0?(0,Z.jsx)(Sp,{children:(0,Z.jsx)(J,{id:`teS4nP`})}):Xx(o).map(e=>(0,Z.jsxs)(`section`,{"aria-label":e.docName,className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground`,title:e.docName,children:[(0,Z.jsx)(qn,{className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:zl(e.docName)}),(0,Z.jsx)(Ud,{variant:`outline`,className:`shrink-0 px-1 py-0 text-[10px] tabular-nums`,children:e.threads.length})]}),e.threads.map(e=>(0,Z.jsxs)(`div`,{className:`flex gap-2 rounded-md border p-2`,children:[(0,Z.jsx)(cr,{checked:a.includes(e.id),onCheckedChange:()=>Al(e.id),"aria-label":t({id:`ZHAM1l`}),className:`mt-0.5`}),(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,"aria-label":t({id:`rscgd_`,values:{0:zl(e.docName)}}),onClick:()=>ou(e),className:`h-auto min-h-0 min-w-0 flex-1 flex-col items-start gap-1 px-0 py-0 text-left font-normal hover:bg-transparent`,children:[(0,Z.jsx)(iu,{thread:e,className:`text-xs`}),(0,Z.jsx)(`span`,{className:`line-clamp-2 w-full text-sm whitespace-normal text-foreground`,children:e.body})]}),(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`size-5 shrink-0 p-0 text-muted-foreground hover:text-foreground`,"aria-label":t({id:`AYfna1`}),onClick:()=>Ml(e.id),children:(0,Z.jsx)(ju,{className:`size-3`})})]},e.id))]},e.docName)),y;e[11]!==_||e[12]!==v?(y=(0,Z.jsx)(_,{className:`flex flex-col gap-4`,children:v}),e[11]=_,e[12]=v,e[13]=y):y=e[13];let b;e[14]!==t||e[15]!==r||e[16]!==d||e[17]!==o.length||e[18]!==l||e[19]!==n||e[20]!==c||e[21]!==p?(b=o.length>0&&(0,Z.jsxs)(wp,{children:[(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`min-w-0`,onClick:Gl,children:(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(J,{id:`xCJdfg`})})}),(0,Z.jsx)(qx,{primary:(0,Z.jsxs)(Z.Fragment,{children:[d,(0,Z.jsx)(`span`,{className:`truncate`,children:l===null?(0,Z.jsx)(J,{id:`vPF04k`}):(0,Z.jsx)(J,{id:`sKEgGd`})})]}),onPrimary:p,primaryDisabled:c===0,menuLeading:l===null?void 0:(0,Z.jsx)(Yx,{onStartNewChat:()=>void Kl({compose:r})}),onOpenSettings:Wu,menuEmptyState:(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:n.probePending?(0,Z.jsx)(J,{id:`CPmYSG`}):(0,Z.jsx)(J,{id:`t9Qn8y`})}),triggerAriaLabel:t({id:`xo6PEb`}),testIds:{primary:`comment-queue-send`,trigger:`comment-queue-send-trigger`,menu:`comment-queue-send-menu`,option:oS,threadAgent:aS,settings:`comment-queue-agent-option-settings`,terminal:iS},...n.rows})]}),e[14]=t,e[15]=r,e[16]=d,e[17]=o.length,e[18]=l,e[19]=n,e[20]=c,e[21]=p,e[22]=b):b=e[22];let x;return e[23]!==m||e[24]!==g||e[25]!==y||e[26]!==b?(x=(0,Z.jsxs)(m,{children:[g,y,b]}),e[23]=m,e[24]=g,e[25]=y,e[26]=b,e[27]=x):x=e[27],x}function iS(e){return`comment-queue-agent-option-terminal-${e}`}function aS(e){return`comment-queue-agent-option-thread-${e}`}function oS(e){return`comment-queue-agent-option-${e}`}function sS(e){return e!==null}function cS(e){return jl(e)}function lS(e,t){let n=Math.max(1,Math.round((t-e)/1e3));if(n<60)return`${n}s`;let r=Math.round(n/60);return r<60?`${r}m`:`${Math.round(r/60)}h`}function uS(e){let t=(0,$.c)(79),{thread:n,now:r,cardRef:i,focused:a,onClose:o}=e,{_:s}=Dt(),[c,l]=(0,Q.useState)(n.body),[u,d]=(0,Q.useState)(!1),f=(0,Q.useRef)(null),p=n.status===`orphaned`,m=n.status===`resolved`,h,g;t[0]===u?(h=t[1],g=t[2]):(h=()=>{if(!u)return;let e=f.current;if(e===null)return;e.focus();let t=e.value.length;e.setSelectionRange(t,t)},g=[u],t[0]=u,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _;t[3]!==n.anchor||t[4]!==n.docName||t[5]!==n.target?(_=function(e){if(n.anchor===null)return;if(n.target.kind===`property`){kl({key:n.target.key,path:n.target.path,quote:e,start:n.anchor.start,end:n.anchor.end});return}let t=se(n.docName);if(!t)return;let r=Il(t.state.doc,e,n.anchor);r&&(t.chain().focus().setTextSelection(r).run(),Cl(t,r))},t[3]=n.anchor,t[4]=n.docName,t[5]=n.target,t[6]=_):_=t[6];let v=_,y;t[7]!==n.docName||t[8]!==n.id?(y=function(){let e=se(n.docName);if(!e)return;let{from:t,to:r,empty:i}=e.state.selection;if(i)return;let a=e.state.doc.textBetween(t,r,` `).trim();a.length>0&&gl(n.id,a,Sl(e.state.doc,t,r))},t[7]=n.docName,t[8]=n.id,t[9]=y):y=t[9];let b=y,x,S,C,w;t[10]===n.id?(x=t[11],S=t[12],C=t[13],w=t[14]):(x=()=>pl(n.id),S=()=>Ul(n.id),C=()=>pl(n.id),w=()=>Ul(n.id),t[10]=n.id,t[11]=x,t[12]=S,t[13]=C,t[14]=w);let T=m&&`opacity-70`,E=p&&`border-amber-500/40 bg-amber-500/5`,D=a&&`ring-2 ring-primary`,O;t[15]!==E||t[16]!==D||t[17]!==T?(O=Y(`flex flex-col gap-1.5 rounded-lg border p-2.5 transition-shadow`,T,E,D),t[15]=E,t[16]=D,t[17]=T,t[18]=O):O=t[18];let k;t[19]!==r||t[20]!==n.createdAt?(k=lS(n.createdAt,r),t[19]=r,t[20]=n.createdAt,t[21]=k):k=t[21];let A;t[22]===k?A=t[23]:(A=(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:k}),t[22]=k,t[23]=A);let j;t[24]===m?j=t[25]:(j=m&&(0,Z.jsxs)(Ud,{variant:`outline`,className:`gap-1 border-green-600/40 text-green-700 dark:text-green-500`,children:[(0,Z.jsx)(Zo,{className:`size-2.5`}),(0,Z.jsx)(J,{id:`O6H89R`})]}),t[24]=m,t[25]=j);let M;t[26]===p?M=t[27]:(M=p&&(0,Z.jsxs)(Ud,{variant:`outline`,className:`gap-1 border-amber-500/50 text-amber-600 dark:text-amber-500`,children:[(0,Z.jsx)(Yl,{className:`size-2.5`}),(0,Z.jsx)(J,{id:`UEdTEN`})]}),t[26]=p,t[27]=M);let N;t[28]===s?N=t[29]:(N=s({id:`X2zUS5`}),t[28]=s,t[29]=N);let P;t[30]===s?P=t[31]:(P=s({id:`X2zUS5`}),t[30]=s,t[31]=P);let F;t[32]===n.id?F=t[33]:(F=()=>ql(n.id),t[32]=n.id,t[33]=F);let I;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Tu,{className:`size-3.5`}),t[34]=I):I=t[34];let L;t[35]!==N||t[36]!==P||t[37]!==F?(L=(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`size-6 p-0 text-muted-foreground hover:text-destructive`,"aria-label":N,title:P,onClick:F,children:I}),t[35]=N,t[36]=P,t[37]=F,t[38]=L):L=t[38];let R;t[39]!==s||t[40]!==o?(R=o&&(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`-mr-1 size-6 p-0 text-muted-foreground hover:text-foreground`,"aria-label":s({id:`yz7wBu`}),onClick:o,children:(0,Z.jsx)(ju,{className:`size-3.5`})}),t[39]=s,t[40]=o,t[41]=R):R=t[41];let z;t[42]!==j||t[43]!==M||t[44]!==L||t[45]!==R?(z=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[j,M,L,R]}),t[42]=j,t[43]=M,t[44]=L,t[45]=R,t[46]=z):z=t[46];let B;t[47]!==A||t[48]!==z?(B=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[A,z]}),t[47]=A,t[48]=z,t[49]=B):B=t[49];let V;t[50]!==s||t[51]!==p||t[52]!==v||t[53]!==n.anchor||t[54]!==n.target?(V=p?(0,Z.jsx)(`p`,{className:`rounded border-l-2 border-amber-500/60 bg-amber-500/10 px-2 py-1 text-xs text-amber-700 dark:text-amber-400`,children:(0,Z.jsx)(J,{id:`nG-XA9`})}):(0,Z.jsx)(X,{type:`button`,variant:`ghost`,disabled:n.anchor===null,onClick:()=>v(n.anchor?.quote??``),title:n.anchor===null?s({id:`aoT2xX`}):n.target.kind===`property`?s({id:`5GBQ-F`}):s({id:`DpjYd6`}),className:`h-auto w-full justify-start truncate rounded border-l-2 border-muted-foreground/40 bg-muted/40 px-2 py-1 text-left text-xs font-normal text-muted-foreground hover:bg-muted/70 disabled:opacity-100`,children:(0,Z.jsx)(`span`,{className:`truncate`,children:n.target.kind===`property`?(0,Z.jsxs)(`span`,{className:`font-mono`,children:[nu(n.target.key,n.target.path),`:`,n.anchor===null?``:` “${n.anchor.quote}”`]}):(0,Z.jsxs)(Z.Fragment,{children:[`“`,n.anchor?.quote??``,`”`]})})}),t[50]=s,t[51]=p,t[52]=v,t[53]=n.anchor,t[54]=n.target,t[55]=V):V=t[55];let H;t[56]===n.body?H=t[57]:(H=(0,Z.jsx)(`p`,{className:`text-sm text-foreground/90`,children:n.body}),t[56]=n.body,t[57]=H);let U;t[58]!==s||t[59]!==c||t[60]!==u||t[61]!==p||t[62]!==m||t[63]!==b||t[64]!==n.body||t[65]!==n.id||t[66]!==n.queued?(U=p?(0,Z.jsxs)(X,{size:`sm`,variant:`outline`,className:`min-w-0`,onClick:b,children:[(0,Z.jsx)(ul,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(J,{id:`QlkiD5`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[u&&(0,Z.jsx)(Op,{ref:f,rows:1,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{if(e.key===`Escape`){l(n.body),d(!1);return}if(e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing)return;e.preventDefault();let t=c.trim();if(t.length===0||t===n.body){d(!1);return}Rl(n.id,t),d(!1)},placeholder:s({id:`akmOT9`}),className:`min-h-0 resize-none px-2 py-1 text-sm leading-5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-nowrap items-center justify-end gap-1.5`,children:[!m&&(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,"aria-label":s({id:`akmOT9`}),title:s({id:`akmOT9`}),"aria-expanded":u,className:Y(`size-7 shrink-0 p-0`,u?`text-foreground`:`text-muted-foreground hover:text-foreground`),onClick:()=>{l(n.body),d(dS)},children:(0,Z.jsx)(hc,{className:`size-3.5`})}),!m&&(n.queued?(0,Z.jsxs)(X,{size:`sm`,variant:`outline`,"aria-label":s({id:`r0mxIn`}),className:`group/queued min-w-0 border-primary/40 text-primary hover:bg-primary/10 hover:text-primary`,onClick:()=>wl(n.id),children:[(0,Z.jsxs)(`span`,{className:`relative inline-flex size-3.5 shrink-0`,children:[(0,Z.jsx)(Zo,{className:`absolute inset-0 size-3.5 opacity-100 transition-opacity duration-150 ease-out group-hover/queued:opacity-0 group-focus-within/queued:opacity-0 motion-reduce:transition-none`,"aria-hidden":!0}),(0,Z.jsx)(ju,{className:`absolute inset-0 size-3.5 opacity-0 transition-opacity duration-150 ease-out group-hover/queued:opacity-100 group-focus-within/queued:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(J,{id:`8wu9lr`})})]}):(0,Z.jsxs)(X,{size:`sm`,variant:`ghost`,className:`min-w-0 text-muted-foreground hover:text-foreground`,onClick:()=>wl(n.id),children:[(0,Z.jsx)(lc,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(J,{id:`b24kPi`})})]})),m?(0,Z.jsxs)(X,{size:`sm`,variant:`outline`,className:`min-w-0`,onClick:()=>_l(n.id),children:[(0,Z.jsx)(vu,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(J,{id:`M7SqjM`})})]}):(0,Z.jsxs)(X,{size:`sm`,variant:`outline`,className:`min-w-0`,onClick:()=>Dl(n.id),children:[(0,Z.jsx)(Zo,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(J,{id:`2FoHU3`})})]})]})]}),t[58]=s,t[59]=c,t[60]=u,t[61]=p,t[62]=m,t[63]=b,t[64]=n.body,t[65]=n.id,t[66]=n.queued,t[67]=U):U=t[67];let ee;return t[68]!==i||t[69]!==O||t[70]!==B||t[71]!==V||t[72]!==H||t[73]!==U||t[74]!==x||t[75]!==S||t[76]!==C||t[77]!==w?(ee=(0,Z.jsxs)(`article`,{ref:i,onPointerEnter:x,onPointerLeave:S,onFocusCapture:C,onBlurCapture:w,className:O,children:[B,V,H,U]}),t[68]=i,t[69]=O,t[70]=B,t[71]=V,t[72]=H,t[73]=U,t[74]=x,t[75]=S,t[76]=C,t[77]=w,t[78]=ee):ee=t[78],ee}function dS(e){return!e}function fS(e){let t=(0,$.c)(39),{docName:n}=e,{_:r}=Dt(),i=pu(n),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=new Map,t[0]=l):l=t[0];let u=(0,Q.useRef)(l),[d]=(0,Q.useState)(_S),f,p;t[1]===n?(f=t[2],p=t[3]):(f=()=>{du(n).catch(gS)},p=[n],t[1]=n,t[2]=f,t[3]=p),(0,Q.useEffect)(f,p);let m=(0,Q.useRef)(null),h,g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{let e=Ol(e=>{c(e),u.current.get(e)?.scrollIntoView({block:`center`,behavior:`smooth`}),m.current!==null&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>{m.current=null,c(t=>t===e?null:t)},1600)});return()=>{e(),m.current!==null&&window.clearTimeout(m.current)}},g=[],t[4]=h,t[5]=g):(h=t[4],g=t[5]),(0,Q.useEffect)(h,g);let _;t[6]===i?_=t[7]:(_=i.filter(hS),t[6]=i,t[7]=_);let v=_,y,b,x,S,C,w;if(t[8]!==r||t[9]!==v||t[10]!==a||t[11]!==i){let e=i.filter(mS);w=a?i:v,b=Dp,y=Ep,t[18]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(xp,{children:(0,Z.jsx)(J,{id:`VbyRUy`})}),t[18]=C):C=t[18],x=`flex items-center gap-2`,S=e.length>0&&(0,Z.jsxs)(X,{size:`sm`,variant:`ghost`,className:`h-6 gap-1 px-1.5 text-xs`,onClick:()=>o(pS),children:[a?(0,Z.jsx)(o_,{className:`size-3`}):(0,Z.jsx)(Zo,{className:`size-3`}),r(a?{id:`LRLKnQ`}:{id:`j0ItfO`,values:{0:e.length}})]}),t[8]=r,t[9]=v,t[10]=a,t[11]=i,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w}else y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17];let T;t[19]===v.length?T=t[20]:(T=(0,Z.jsx)(Tp,{children:v.length}),t[19]=v.length,t[20]=T);let E;t[21]!==T||t[22]!==x||t[23]!==S?(E=(0,Z.jsxs)(`div`,{className:x,children:[S,T]}),t[21]=T,t[22]=x,t[23]=S,t[24]=E):E=t[24];let D;t[25]!==y||t[26]!==E||t[27]!==C?(D=(0,Z.jsxs)(y,{children:[C,E]}),t[25]=y,t[26]=E,t[27]=C,t[28]=D):D=t[28];let O;t[29]!==s||t[30]!==d||t[31]!==w?(O=w.length===0?(0,Z.jsx)(Sp,{children:(0,Z.jsx)(J,{id:`zpfN9p`})}):w.map(e=>(0,Z.jsx)(uS,{thread:e,now:d,focused:s===e.id,cardRef:t=>{t?u.current.set(e.id,t):u.current.delete(e.id)}},e.id)),t[29]=s,t[30]=d,t[31]=w,t[32]=O):O=t[32];let k;t[33]===O?k=t[34]:(k=(0,Z.jsx)(Cp,{className:`flex flex-col gap-3`,children:O}),t[33]=O,t[34]=k);let A;return t[35]!==b||t[36]!==D||t[37]!==k?(A=(0,Z.jsxs)(b,{children:[D,k]}),t[35]=b,t[36]=D,t[37]=k,t[38]=A):A=t[38],A}function pS(e){return!e}function mS(e){return e.status===`resolved`}function hS(e){return e.status!==`resolved`}function gS(){}function _S(){return Date.now()}function vS(e){let t=(0,$.c)(2),{docName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Dd,{name:`comments-panel`,children:(0,Z.jsx)(fS,{docName:n})}),t[0]=n,t[1]=r),r}function yS(e){let t=(0,$.c)(13),{docName:n}=e,{_:r}=Dt(),[i,a]=(0,Q.useState)(`doc`),o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>(bl()&&a(`project`),Nl(()=>a(`project`))),s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,Q.useEffect)(o,s);let c;t[2]===r?c=t[3]:(c=r({id:`b24kPi`}),t[2]=r,t[3]=c);let l;t[4]!==i||t[5]!==c?(l=(0,Z.jsx)(Uf,{scope:i,onScopeChange:a,projectLabel:c}),t[4]=i,t[5]=c,t[6]=l):l=t[6];let u;t[7]!==n||t[8]!==i?(u=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:i===`doc`?(0,Z.jsx)(vS,{docName:n}):(0,Z.jsx)(rS,{})}),t[7]=n,t[8]=i,t[9]=u):u=t[9];let d;return t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col pt-2`,children:[l,u]}),t[10]=l,t[11]=u,t[12]=d):d=t[12],d}var bS=new Map(ba.map(e=>[e.id,e.alias]));function xS(e){return e.source===`markdownlint`?bS.get(e.code):void 0}function SS(e,t,n){return Ia({relativePath:mc(e),source:t.source,code:t.code,ruleAlias:xS(t),message:t.message,line:t.range.start.line+1,column:t.range.start.character+1,lineText:n})}function CS(e){return Ba(e===null?null:mc(e))}var wS=5;async function TS(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=ji.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new zn(zu._({id:`XopE_I`,values:{status:r}}),{status:r})}let r=ga.safeParse(n);if(!r.success)throw new zn(zu._({id:`lZAiSP`}),{status:t.status});return r.data.backlinks}async function ES(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=ji.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new zn(zu._({id:`GemPfn`,values:{status:r}}),{status:r})}let r=Li.safeParse(n);if(!r.success)throw new zn(zu._({id:`2YZwPB`}),{status:t.status});return r.data.forwardLinks}function DS(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function OS(e){window.location.hash=Bd(e)}function kS(e){let t=(0,$.c)(9),{title:n,count:r,isLoading:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)($o,{className:`size-3.5 text-muted-foreground transition-transform group-data-[state=closed]:-rotate-90`}),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,Z.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[a,(0,Z.jsx)(xp,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(Tp,{children:r}),t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(Sn,{className:`group flex w-full cursor-pointer items-center justify-between px-5 py-3 text-left transition-colors hover:bg-muted/40`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function AS(e){let t=(0,$.c)(10),{total:n,expanded:r,onToggle:i}=e;if(n<=wS)return null;let a=n-wS,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)($o,{className:`size-3`}):(0,Z.jsx)(es,{className:`size-3`}),t[0]=r,t[1]=o);let s;t[2]!==r||t[3]!==a?(s=r?(0,Z.jsx)(J,{id:`6fGjTz`}):(0,Z.jsx)(J,{id:`ZptNUh`,values:{hidden:a}}),t[2]=r,t[3]=a,t[4]=s):s=t[4];let c;return t[5]!==r||t[6]!==i||t[7]!==o||t[8]!==s?(c=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,className:`mt-2 inline-flex cursor-pointer items-center gap-1 px-3 text-xs text-muted-foreground transition-colors hover:text-foreground`,onClick:i,children:[o,s]}),t[5]=r,t[6]=i,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function jS(e){let t=(0,$.c)(35),{icon:n,iconColorClass:r,rowTooltip:i,title:a,path:o,anchor:s,snippet:c,titleHover:l,ariaLabel:u,href:d,external:f,disabled:p,onClick:m}=e,h=o!==void 0&&o!==a,g=r??`text-muted-foreground`,_;t[0]===g?_=t[1]:(_=Y(`mt-0.5 shrink-0`,g),t[0]=g,t[1]=_);let v;t[2]!==n||t[3]!==_?(v=(0,Z.jsx)(`span`,{className:_,children:n}),t[2]=n,t[3]=_,t[4]=v):v=t[4];let y=v,b;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==d||t[9]!==m||t[10]!==a||t[11]!==l?(b=d?(0,Z.jsxs)(`a`,{href:d,target:f?`_blank`:void 0,rel:f?`noopener noreferrer`:void 0,"aria-label":u,title:l,onClick:m,className:`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,children:[a,f?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[` `,(0,Z.jsx)(J,{id:`dbtjJh`})]}):null]}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":u,title:l,disabled:p,onClick:m,className:Y(`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,`cursor-pointer bg-transparent p-0 disabled:cursor-not-allowed disabled:opacity-60`),children:a}),t[5]=u,t[6]=p,t[7]=f,t[8]=d,t[9]=m,t[10]=a,t[11]=l,t[12]=b):b=t[12];let x=b,S;t[13]===y?S=t[14]:(S=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:y}),t[13]=y,t[14]=S);let C;t[15]!==s||t[16]!==o||t[17]!==h?(C=h?(0,Z.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[o,s?(0,Z.jsxs)(`span`,{className:`ml-1`,children:[`· #`,s]}):null]}):null,t[15]=s,t[16]=o,t[17]=h,t[18]=C):C=t[18];let w;t[19]===c?w=t[20]:(w=c?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:c}):null,t[19]=c,t[20]=w);let T;t[21]!==x||t[22]!==C||t[23]!==w?(T=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[x,C,w]}),t[21]=x,t[22]=C,t[23]=w,t[24]=T):T=t[24];let E;t[25]!==S||t[26]!==T?(E=(0,Z.jsxs)(`div`,{className:`group relative flex items-start gap-2.5 rounded-md px-3 py-2.5 transition-colors hover:bg-muted/80`,children:[S,T]}),t[25]=S,t[26]=T,t[27]=E):E=t[27];let D=E;if(i){let e;t[28]===D?e=t[29]:(e=(0,Z.jsx)(_n,{asChild:!0,children:D}),t[28]=D,t[29]=e);let n;t[30]===i?n=t[31]:(n=(0,Z.jsx)(vn,{side:`top`,children:i}),t[30]=i,t[31]=n);let r;return t[32]!==e||t[33]!==n?(r=(0,Z.jsxs)(bn,{children:[e,n]}),t[32]=e,t[33]=n,t[34]=r):r=t[34],r}return D}function MS(e){let t=(0,$.c)(39),{docName:n}=e,{_:r}=Dt(),{folderPaths:i,pages:a,pagesBySlug:o,pagesByBasename:s,loading:c}=rs(),l,u;t[0]===n?(l=t[1],u=t[2]):(l=[`backlinks`,n],u=()=>TS(n),t[0]=n,t[1]=l,t[2]=u);let d;t[3]!==n||t[4]!==c||t[5]!==a?(d=!c&&(a.has(n)||Di(n)),t[3]=n,t[4]=c,t[5]=a,t[6]=d):d=t[6];let f;t[7]!==l||t[8]!==u||t[9]!==d?(f={queryKey:l,queryFn:u,enabled:d},t[7]=l,t[8]=u,t[9]=d,t[10]=f):f=t[10];let{data:p,isLoading:m,error:h}=Wt(f),g;t[11]===p?g=t[12]:(g=p===void 0?[]:p,t[11]=p,t[12]=g);let _=g,[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(n);b!==n&&(x(n),y(!1));let S;t[13]!==_||t[14]!==v?(S=v?_:_.slice(0,wS),t[13]=_,t[14]=v,t[15]=S):S=t[15];let C=S,w;t[16]===r?w=t[17]:(w=r({id:`9NJWgv`}),t[16]=r,t[17]=w);let T;t[18]!==_.length||t[19]!==m||t[20]!==w?(T=(0,Z.jsx)(kS,{title:w,count:_.length,isLoading:m}),t[18]=_.length,t[19]=m,t[20]=w,t[21]=T):T=t[21];let E;t[22]!==r||t[23]!==_.length||t[24]!==h||t[25]!==v||t[26]!==i||t[27]!==m||t[28]!==a||t[29]!==s||t[30]!==o||t[31]!==C?(E=h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(bp,{children:h instanceof Error?h.message:r({id:`Xet9MX`})})}):_.length===0&&!m?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Sp,{children:(0,Z.jsx)(J,{id:`rVxu1k`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:C.map((e,t)=>{let n=kp(e.source,{pages:a,folderPaths:i,pagesBySlug:o,pagesByBasename:s});return(0,Z.jsx)(jS,{icon:(0,Z.jsx)(Ve,{className:`size-3.5`}),title:e.title,path:DS(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:Bd(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(AS,{total:_.length,expanded:v,onToggle:()=>y(NS)})]}),t[22]=r,t[23]=_.length,t[24]=h,t[25]=v,t[26]=i,t[27]=m,t[28]=a,t[29]=s,t[30]=o,t[31]=C,t[32]=E):E=t[32];let D;t[33]!==m||t[34]!==E?(D=(0,Z.jsx)(xn,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":m,children:E})}),t[33]=m,t[34]=E,t[35]=D):D=t[35];let O;return t[36]!==D||t[37]!==T?(O=(0,Z.jsxs)(Cn,{defaultOpen:!0,children:[T,D]}),t[36]=D,t[37]=T,t[38]=O):O=t[38],O}function NS(e){return!e}function PS(e){let t=(0,$.c)(49),{docName:n}=e,{_:r}=Dt(),{addPage:i,folderPaths:a,pages:o,pagesBySlug:s,pagesByBasename:c,loading:l}=rs(),u,f;t[0]===n?(u=t[1],f=t[2]):(u=[`forward-links`,n],f=()=>ES(n),t[0]=n,t[1]=u,t[2]=f);let p;t[3]!==n||t[4]!==o||t[5]!==l?(p=!l&&(o.has(n)||Di(n)),t[3]=n,t[4]=o,t[5]=l,t[6]=p):p=t[6];let m;t[7]!==u||t[8]!==f||t[9]!==p?(m={queryKey:u,queryFn:f,enabled:p},t[7]=u,t[8]=f,t[9]=p,t[10]=m):m=t[10];let{data:h,isLoading:g,error:_}=Wt(m),v;t[11]===h?v=t[12]:(v=h===void 0?[]:h,t[11]=h,t[12]=v);let y=v,[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(n);w!==n&&(T(n),C(!1),x(null));let E;t[13]!==S||t[14]!==y?(E=S?y:y.slice(0,wS),t[13]=S,t[14]=y,t[15]=E):E=t[15];let D=E,O;t[16]!==r||t[17]!==i||t[18]!==b?(O=async function(e,t){if(!b){x(t);try{await d(e,{addPage:i,onCreated:OS}),x(null)}catch(e){let t=e;Mu.error(t instanceof Error?t.message:r({id:`tfi40B`})),x(null)}}},t[16]=r,t[17]=i,t[18]=b,t[19]=O):O=t[19];let k=O,A;t[20]!==r||t[21]!==b||t[22]!==a||t[23]!==k||t[24]!==o||t[25]!==c||t[26]!==s||t[27]!==l?(A=function(e){let{title:t}=e;if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(jS,{icon:(0,Z.jsx)(Mo,{className:`size-3.5`}),rowTooltip:r({id:`XDzAnp`}),title:e.title,path:t?void 0:e.url,titleHover:e.url,snippet:e.snippet,href:e.url,external:!0},`ext:${e.url}`)}let n=Pn(e.docName,{pages:o,folderPaths:a,pagesBySlug:s,pagesByBasename:c}),i=!l&&n.kind===`create`,u=!l&&n.kind===`navigate`&&n.displayState===`folder`,d=DS(e.docName),f=e.title===e.docName?d:e.title,p=`doc:${e.docName}:${e.anchor??``}`,m=n.kind===`navigate`?n.hashDocName:e.docName,h=n.kind===`navigate`&&n.hash?n.hash:Bd(m,e.anchor);if(i&&n.kind===`create`){let i={initialDir:n.initialDir,suggestedName:n.suggestedName};return(0,Z.jsx)(jS,{icon:(0,Z.jsx)(Eu,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:r(b===p?{id:`kj9pAE`}:{id:`IQPyrD`}),ariaLabel:r(b===p?{id:`un8kBM`,values:{linkTitle:t}}:{id:`jEdF24`,values:{linkTitle:t}}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,disabled:b!==null,onClick:()=>void k(i,p)},p)}return u&&n.kind===`navigate`?(0,Z.jsx)(jS,{icon:(0,Z.jsx)(S_,{className:`size-3.5`}),iconColorClass:`text-sky-600 dark:text-sky-400`,ariaLabel:r({id:`P6lAT3`,values:{linkTitle:t}}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},p):(0,Z.jsx)(jS,{icon:(0,Z.jsx)(Ve,{className:`size-3.5`}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},p)},t[20]=r,t[21]=b,t[22]=a,t[23]=k,t[24]=o,t[25]=c,t[26]=s,t[27]=l,t[28]=A):A=t[28];let j=A,M;t[29]===r?M=t[30]:(M=r({id:`O0Z2Xr`}),t[29]=r,t[30]=M);let N;t[31]!==g||t[32]!==y.length||t[33]!==M?(N=(0,Z.jsx)(kS,{title:M,count:y.length,isLoading:g}),t[31]=g,t[32]=y.length,t[33]=M,t[34]=N):N=t[34];let P;t[35]!==r||t[36]!==_||t[37]!==S||t[38]!==g||t[39]!==y.length||t[40]!==j||t[41]!==D?(P=_?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(bp,{children:_ instanceof Error?_.message:r({id:`pZAs1T`})})}):y.length===0&&!g?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Sp,{children:(0,Z.jsx)(J,{id:`roiUQQ`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:D.map(j)}),(0,Z.jsx)(AS,{total:y.length,expanded:S,onToggle:()=>C(FS)})]}),t[35]=r,t[36]=_,t[37]=S,t[38]=g,t[39]=y.length,t[40]=j,t[41]=D,t[42]=P):P=t[42];let F;t[43]!==g||t[44]!==P?(F=(0,Z.jsx)(xn,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":g,children:P})}),t[43]=g,t[44]=P,t[45]=F):F=t[45];let I;return t[46]!==N||t[47]!==F?(I=(0,Z.jsxs)(Cn,{defaultOpen:!0,children:[N,F]}),t[46]=N,t[47]=F,t[48]=I):I=t[48],I}function FS(e){return!e}function IS(e){let t=(0,$.c)(11),{docName:n,className:r}=e,i=r===void 0?``:r,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(PS,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)($r,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(MS,{docName:n}),t[3]=n,t[4]=s);let c;t[5]!==a||t[6]!==s?(c=(0,Z.jsxs)(Cp,{className:`px-0 py-0`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==i||t[9]!==c?(l=(0,Z.jsx)(Dp,{className:i,children:c}),t[8]=i,t[9]=c,t[10]=l):l=t[10],l}function LS(e){let t=e.setTimer??((e,t)=>setTimeout(e,t)),n=e.clearTimer??(e=>clearTimeout(e)),r=!1,i=!1,a=null,o=null,s=e.baseMs,c=!1,l=n=>{if(!r){if(e.isPaused()){c=!0;return}a=t(u,n)}};async function u(){if(a=null,c=!1,r)return;if(e.isPaused()){c=!0;return}o=new AbortController;let t=o.signal;try{let n=await e.poll(t);if(r)return;n===`ok`?(s=e.baseMs,l(e.baseMs)):(s=Math.min(s*2,e.maxBackoffMs),l(s))}catch{if(r||t.aborted)return;s=Math.min(s*2,e.maxBackoffMs),l(s)}}return{start(){r||i||(i=!0,u())},resume(){r||!e.isPaused()&&c&&a===null&&(c=!1,u())},stop(){r=!0,a!==null&&(n(a),a=null),o?.abort()}}}var RS=1e4,zS=6e4;async function BS(e,t,n){try{let r=await fetch(`/api/history?docName=${encodeURIComponent(e)}&limit=100`,{signal:t});if(!r.ok)return n.setError(n.unavailableMessage),`error`;let i=await r.json();return n.setEntries((i.entries??[]).filter(VS)),n.setError(null),`ok`}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw e;return n.setError(n.unavailableMessage),console.error(`[timeline]`,e),`error`}finally{t.aborted||n.setLoading(!1)}}function VS(e){return e.type===`checkpoint`?e.checkpoint!==null&&Ti(e.checkpoint.kind):!0}function HS(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return zu._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return zu._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return zu._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return zu._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?zu._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function US(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function WS(e){if(e.type===`checkpoint`)return{kind:`recovered`};if(e.type===`upstream`)return{kind:`upstream`};let t=e.message,n=/^rollback: .+ to ([0-9a-f]{7,40})$/.exec(t);if(n)return{kind:`restore`,targetSha7:n[1].slice(0,7)};let r=/^rename: (.+) -> (.+)$/.exec(t);return r?{kind:`rename`,from:r[1],to:r[2]}:t.startsWith(`reconcile: `)?{kind:`reconcile`}:t.startsWith(`import: `)?{kind:`upstream`}:{kind:`edit`}}function GS(e){return e.split(`/`).pop()??e}function KS(e){return e.type===`checkpoint`?zu._({id:`C-twqs`}):e.type===`upstream`?zu._({id:`K_vT1F`}):e.contributors.length===1?e.contributors[0].name:e.contributors.length>1?e.contributors.map(e=>e.name).join(`, `):e.author===`openknowledge-server`||e.author===`server`?zu._({id:`B2DrPb`}):e.author}function qS(e){let t=(0,$.c)(18),{entry:n,isDark:r}=e;if(n.type===`checkpoint`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Fc,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[0]=e):e=t[0],e}if(n.type===`upstream`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(To,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[1]=e):e=t[1],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[2]===i?a=t[3]:(a=mo(i),t[2]=i,t[3]=a);let o=a,s=r?qa[o]??co[o]:co[o],c;t[4]!==s||t[5]!==i?(c=s??_o(i),t[4]=s,t[5]=i,t[6]=c):c=t[6];let l=c;if(o!==`bot`){let e;t[7]===l?e=t[8]:(e={color:l},t[7]=l,t[8]=e);let n;return t[9]!==o||t[10]!==e?(n=(0,Z.jsx)(Lp,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[9]=o,t[10]=e,t[11]=n):n=t[11],n}if(e.name===`File System`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(w_,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}if(e.name===`OpenKnowledge (service)`||e.name===`Git (upstream)`){let e;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ao,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=e):e=t[13],e}let u;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(pv,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=u):u=t[14],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(lc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ao,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=e):e=t[16],e}let i;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(pv,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[17]=i):i=t[17],i}function JS(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function YS(e){let t=(0,$.c)(21),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,s;t[0]===n?(o=t[1],s=t[2]):([o,...s]=n,t[0]=n,t[1]=o,t[2]=s);let c=s.length,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=l):l=t[3];let u;t[4]===o?u=t[5]:(u=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[l,o]}),t[4]=o,t[5]=u);let d;t[6]!==r||t[7]!==s?(d=r&&s.map(ZS),t[6]=r,t[7]=s,t[8]=d):d=t[8];let f;t[9]!==a||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[u,d]}),t[9]=a,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]!==r||t[14]!==c||t[15]!==a||t[16]!==s.length?(p=s.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(XS)},children:[r?(0,Z.jsx)($o,{className:`size-3`}):(0,Z.jsx)(es,{className:`size-3`}),r?(0,Z.jsx)(J,{id:`vLyv1R`}):(0,Z.jsx)(J,{id:`ZptNUh`,values:{hidden:c}})]}),t[13]=r,t[14]=c,t[15]=a,t[16]=s.length,t[17]=p):p=t[17];let m;return t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[f,p]}),t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function XS(e){return!e}function ZS(e,t){return(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),e]},`${t}-${e}`)}function QS(e){let t=(0,$.c)(36),{descriptor:n,allDocs:r,versionBySha7:i,onJumpToVersion:a}=e,{_:o}=Dt();if(n.kind===`restore`){let e,r;t[0]!==o||t[1]!==n.targetSha7||t[2]!==i?(r=i.get(n.targetSha7),e=o(r?{id:`sICrVf`,values:{0:US(r.timestamp)}}:{id:`i09An-`,values:{0:n.targetSha7}}),t[0]=o,t[1]=n.targetSha7,t[2]=i,t[3]=e,t[4]=r):(e=t[3],r=t[4]);let s=e,c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(vu,{className:`size-3 shrink-0`,"aria-hidden":!0}),t[5]=c):c=t[5];let l;return t[6]!==n.targetSha7||t[7]!==s||t[8]!==a||t[9]!==r?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[c,r?(0,Z.jsx)(`button`,{type:`button`,className:`truncate text-left underline-offset-2 hover:text-foreground hover:underline`,title:s,onClick:e=>{e.stopPropagation(),a(n.targetSha7)},children:s}):(0,Z.jsx)(`span`,{className:`truncate`,title:s,children:s})]}),t[6]=n.targetSha7,t[7]=s,t[8]=a,t[9]=r,t[10]=l):l=t[10],l}if(n.kind===`rename`){let e=`${n.from} → ${n.to}`,r;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Qg,{className:`size-3 shrink-0`,"aria-hidden":!0}),t[11]=r):r=t[11];let i;t[12]!==o||t[13]!==n.from||t[14]!==n.to?(i=o({id:`GkYV_4`,values:{0:GS(n.from),1:GS(n.to)}}),t[12]=o,t[13]=n.from,t[14]=n.to,t[15]=i):i=t[15];let a;t[16]===i?a=t[17]:(a=(0,Z.jsx)(`span`,{className:`truncate`,children:i}),t[16]=i,t[17]=a);let s;return t[18]!==e||t[19]!==a?(s=(0,Z.jsxs)(`p`,{className:`flex items-center gap-1 truncate text-xs text-muted-foreground`,title:e,children:[r,a]}),t[18]=e,t[19]=a,t[20]=s):s=t[20],s}if(n.kind===`reconcile`){let e;t[21]===o?e=t[22]:(e=o({id:`0qyKG6`}),t[21]=o,t[22]=e);let n;return t[23]===e?n=t[24]:(n=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e}),t[23]=e,t[24]=n),n}if(n.kind===`recovered`)return null;if(r.length>0){let e;t[25]===r?e=t[26]:(e=r.join(`, `),t[25]=r,t[26]=e);let n;t[27]===r?n=t[28]:(n=r.join(`, `),t[27]=r,t[28]=n);let i;return t[29]!==e||t[30]!==n?(i=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:e,children:n}),t[29]=e,t[30]=n,t[31]=i):i=t[31],i}if(n.kind===`upstream`)return null;let s;t[32]===o?s=t[33]:(s=o({id:`MRZxAn`}),t[32]=o,t[33]=s);let c;return t[34]===s?c=t[35]:(c=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:s}),t[34]=s,t[35]=c),c}function $S(e){let t=(0,$.c)(122),{entry:n,isDark:r,docName:i,laterEdits:a,onRestoreSuccess:o,versionBySha7:s,onJumpToVersion:c,registerRowRef:l,flashing:u}=e,{_:d}=Dt(),f;t[0]===n.timestamp?f=t[1]:(f=HS(n.timestamp),t[0]=n.timestamp,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=KS(n),t[2]=n,t[3]=m);let h=m,g;t[4]===n.timestamp?g=t[5]:(g=US(n.timestamp),t[4]=n.timestamp,t[5]=g);let _=g,v;t[6]===n.contributors?v=t[7]:(v=n.contributors.flatMap(eC),t[6]=n.contributors,t[7]=v);let y=v,b;t[8]===n?b=t[9]:(b=JS(n),t[8]=n,t[9]=b);let x=b,S;t[10]===n?S=t[11]:(S=WS(n),t[10]=n,t[11]=S);let C=S,[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(null),k=ku(),A=k?.docName===i&&k.sha===n.sha,j,M;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>O.current?.abort(),M=[],t[12]=j,t[13]=M):(j=t[12],M=t[13]),(0,Q.useEffect)(j,M);let N;t[14]!==_||t[15]!==h||t[16]!==i||t[17]!==n.parentSha||t[18]!==n.sha||t[19]!==a||t[20]!==p?(N=()=>{Rp(),Ou({docName:i,sha:n.sha,parentSha:n.parentSha??null,laterEdits:a,authorName:h,relativeTime:p,absoluteTime:_})},t[14]=_,t[15]=h,t[16]=i,t[17]=n.parentSha,t[18]=n.sha,t[19]=a,t[20]=p,t[21]=N):N=t[21];let P=N,F;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(){O.current?.abort(),O.current=null,D(!1),T(!1)},t[22]=F):F=t[22];let I=F,L;t[23]!==d||t[24]!==i||t[25]!==n.sha||t[26]!==o?(L=async function(){D(!0);let e=new AbortController;O.current=e;let t=function(){e.signal.aborted||D(!1),O.current===e&&(O.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:i,commitSha:n.sha}),signal:e.signal})}catch(r){let a=r;!e.signal.aborted&&!(a instanceof DOMException&&a.name===`AbortError`)&&(console.error(`[timeline] rollback fetch failed`,{docName:i,sha:n.sha,err:a}),Mu.error(d({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)T(!1),o();else{let e=`HTTP ${r.status}`;try{let t=ji.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:i,sha:n.sha,status:r.status,detail:e}),Mu.error(d({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[23]=d,t[24]=i,t[25]=n.sha,t[26]=o,t[27]=L):L=t[27];let R=L,z;t[28]!==n||t[29]!==r?(z=(0,Z.jsx)(qS,{entry:n,isDark:r}),t[28]=n,t[29]=r,t[30]=z):z=t[30];let B=z,V=u?`ring-2 ring-ring ring-offset-1 ring-offset-background`:``,H;t[31]===V?H=t[32]:(H=[`flex flex-col rounded-lg transition-shadow`,V],t[31]=V,t[32]=H);let U=H.join(` `),ee=A?`bg-muted`:`hover:bg-muted/80`,W;t[33]===ee?W=t[34]:(W=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,ee],t[33]=ee,t[34]=W);let te=W.join(` `),G;t[35]===P?G=t[36]:(G=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},t[35]=P,t[36]=G);let ne;t[37]===B?ne=t[38]:(ne=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:B}),t[37]=B,t[38]=ne);let K;t[39]===h?K=t[40]:(K=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:h}),t[39]=h,t[40]=K);let q;t[41]!==n.timestamp||t[42]!==p?(q=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:p}),t[41]=n.timestamp,t[42]=p,t[43]=q):q=t[43];let re;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[44]=re):re=t[44];let ie;t[45]===d?ie=t[46]:(ie=d({id:`Yea-K5`}),t[45]=d,t[46]=ie);let ae;t[47]!==R||t[48]!==a?(ae=e=>{e.stopPropagation(),a>0?T(!0):R()},t[47]=R,t[48]=a,t[49]=ae):ae=t[49];let oe;t[50]===E?oe=t[51]:(oe=E?(0,Z.jsx)(ll,{className:`size-3 animate-spin`}):(0,Z.jsx)(Du,{className:`size-3`}),t[50]=E,t[51]=oe);let se;t[52]!==E||t[53]!==ie||t[54]!==ae||t[55]!==oe?(se=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":ie,disabled:E,onClick:ae,children:oe})}),t[52]=E,t[53]=ie,t[54]=ae,t[55]=oe,t[56]=se):se=t[56];let ce;t[57]===d?ce=t[58]:(ce=d({id:`Yea-K5`}),t[57]=d,t[58]=ce);let le;t[59]===ce?le=t[60]:(le=(0,Z.jsx)(vn,{side:`top`,children:ce}),t[59]=ce,t[60]=le);let ue;t[61]!==se||t[62]!==le?(ue=(0,Z.jsxs)(bn,{children:[se,le]}),t[61]=se,t[62]=le,t[63]=ue):ue=t[63];let de;t[64]!==K||t[65]!==q||t[66]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[K,q,re,ue]}),t[64]=K,t[65]=q,t[66]=ue,t[67]=de):de=t[67];let fe;t[68]===x?fe=t[69]:(fe=x.length>0&&(0,Z.jsx)(YS,{summaries:x}),t[68]=x,t[69]=fe);let pe;t[70]!==y||t[71]!==C||t[72]!==c||t[73]!==s?(pe=(0,Z.jsx)(QS,{descriptor:C,allDocs:y,versionBySha7:s,onJumpToVersion:c}),t[70]=y,t[71]=C,t[72]=c,t[73]=s,t[74]=pe):pe=t[74];let me;t[75]!==de||t[76]!==fe||t[77]!==pe?(me=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[de,fe,pe]}),t[75]=de,t[76]=fe,t[77]=pe,t[78]=me):me=t[78];let he;t[79]!==P||t[80]!==A||t[81]!==te||t[82]!==G||t[83]!==ne||t[84]!==me?(he=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-pressed":A,"data-testid":`timeline-entry-open`,className:te,onClick:P,onKeyDown:G,children:[ne,me]}),t[79]=P,t[80]=A,t[81]=te,t[82]=G,t[83]=ne,t[84]=me,t[85]=he):he=t[85];let ge;t[86]!==l||t[87]!==U||t[88]!==he?(ge=(0,Z.jsx)(`div`,{ref:l,className:U,children:he}),t[86]=l,t[87]=U,t[88]=he,t[89]=ge):ge=t[89];let _e;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>{e?T(!0):I()},t[90]=_e):_e=t[90];let ve;t[91]===d?ve=t[92]:(ve=d({id:`n3wx1q`}),t[91]=d,t[92]=ve);let ye;t[93]===ve?ye=t[94]:(ye=(0,Z.jsx)(Tn,{children:ve}),t[93]=ve,t[94]=ye);let be;t[95]===a?be=t[96]:(be=(0,Z.jsx)(J,{id:`nfPccR`,values:{laterEdits:a}}),t[95]=a,t[96]=be);let xe;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(J,{id:`5ZbJFS`}),t[97]=xe):xe=t[97];let Se;t[98]===be?Se=t[99]:(Se=(0,Z.jsxs)(wn,{children:[be,` `,xe]}),t[98]=be,t[99]=Se);let Ce;t[100]!==ye||t[101]!==Se?(Ce=(0,Z.jsxs)(kn,{children:[ye,Se]}),t[100]=ye,t[101]=Se,t[102]=Ce):Ce=t[102];let we;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(X,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:I,children:(0,Z.jsx)(J,{id:`dEgA5A`})}),t[103]=we):we=t[103];let Te;t[104]===R?Te=t[105]:(Te=()=>R(),t[104]=R,t[105]=Te);let Ee;t[106]===E?Ee=t[107]:(Ee=E?(0,Z.jsx)(ll,{className:`mr-2 size-4 animate-spin`}):null,t[106]=E,t[107]=Ee);let De;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(J,{id:`yKu_3Y`}),t[108]=De):De=t[108];let Oe;t[109]!==E||t[110]!==Te||t[111]!==Ee?(Oe=(0,Z.jsxs)(On,{children:[we,(0,Z.jsxs)(X,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:E,onClick:Te,children:[Ee,De]})]}),t[109]=E,t[110]=Te,t[111]=Ee,t[112]=Oe):Oe=t[112];let ke;t[113]!==Ce||t[114]!==Oe?(ke=(0,Z.jsxs)(En,{children:[Ce,Oe]}),t[113]=Ce,t[114]=Oe,t[115]=ke):ke=t[115];let Ae;t[116]!==w||t[117]!==ke?(Ae=(0,Z.jsx)(An,{open:w,onOpenChange:_e,children:ke}),t[116]=w,t[117]=ke,t[118]=Ae):Ae=t[118];let je;return t[119]!==ge||t[120]!==Ae?(je=(0,Z.jsxs)(Z.Fragment,{children:[ge,Ae]}),t[119]=ge,t[120]=Ae,t[121]=je):je=t[121],je}function eC(e){return e.docs}function tC(e){let t=(0,$.c)(27),{docName:n}=e,{_:r}=Dt(),{resolvedTheme:i}=Jt(),a=i===`dark`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],t[0]=o):o=t[0];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(new Map),[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(null),_=new Map;for(let e of s)_.set(e.sha.slice(0,7),e);let v,y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>()=>clearTimeout(g.current??void 0),y=[],t[1]=v,t[2]=y):(v=t[1],y=t[2]),(0,Q.useEffect)(v,y);let b=function(e){let t=_.get(e);t&&(p.current.get(t.sha)?.scrollIntoView({behavior:`smooth`,block:`center`}),h(t.sha),clearTimeout(g.current??void 0),g.current=setTimeout(()=>h(null),1600))},x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){Au()},t[3]=x):x=t[3];let S=x,C,w;t[4]!==r||t[5]!==n?(C=()=>{if(!n){c([]);return}u(!0);let e=LS({baseMs:RS,maxBackoffMs:zS,isPaused:rC,poll:e=>BS(n,e,{setEntries:c,setError:f,setLoading:u,unavailableMessage:r({id:`brCtGB`})})});e.start();let t=()=>e.resume();return typeof document<`u`&&document.addEventListener(`visibilitychange`,t),()=>{e.stop(),typeof document<`u`&&document.removeEventListener(`visibilitychange`,t)}},w=[n,r],t[4]=r,t[5]=n,t[6]=C,t[7]=w):(C=t[6],w=t[7]),(0,Q.useEffect)(C,w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Ep,{children:(0,Z.jsx)(xp,{children:(0,Z.jsx)(J,{id:`cklVjM`})})}),t[8]=T):T=t[8];let E;t[9]!==r||t[10]!==l?(E=l&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":r({id:`o49mDZ`}),children:[1,2,3].map(nC)}),t[9]=r,t[10]=l,t[11]=E):E=t[11];let D;t[12]!==d||t[13]!==l?(D=!l&&d&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:d})}),t[12]=d,t[13]=l,t[14]=D):D=t[14];let O;t[15]!==s||t[16]!==d||t[17]!==l?(O=!l&&!d&&s.length===0&&(0,Z.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Ta25TG`})})}),t[15]=s,t[16]=d,t[17]=l,t[18]=O):O=t[18];let k=!l&&!d&&s.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:s.map((e,t)=>(0,Z.jsx)($S,{entry:e,isDark:a,docName:n,laterEdits:t,onRestoreSuccess:S,versionBySha7:_,onJumpToVersion:b,registerRowRef:t=>{t?p.current.set(e.sha,t):p.current.delete(e.sha)},flashing:m===e.sha},e.sha))}),A;t[19]!==E||t[20]!==D||t[21]!==O||t[22]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[E,D,O,k]}),t[19]=E,t[20]=D,t[21]=O,t[22]=k,t[23]=A):A=t[23];let j;return t[24]!==A||t[25]!==T?(j=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[T,A]}),t[24]=A,t[25]=T,t[26]=j):j=t[26],j}function nC(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(jp,{className:`size-3.5 rounded mt-0.5 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(jp,{className:`h-3 w-28`}),(0,Z.jsx)(jp,{className:`h-3 w-40`})]})]},e)}function rC(){return typeof document<`u`&&document.visibilityState===`hidden`}var iC=`open-knowledge:lint-source-fixed`,aC=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`lint-fix`})});function oC(e,t){let n=e.split(`
3
- `),r=0;for(let e=0;e<t.line&&e<n.length;e+=1)r+=n[e].length+1;let i=n[Math.min(t.line,n.length-1)]?.length??0;return r+Math.min(Math.max(t.character,0),i)}function sC(e){return e.flatMap(e=>e.fixes??[])}function cC(e,t){if(t.length===0)return!1;let n=e.document.getText(`source`),r=n.toString(),i=t.map(e=>({from:oC(r,e.range.start),to:oC(r,e.range.end),insert:e.newText})).sort((e,t)=>t.to-e.to||t.from-e.from||e.insert.localeCompare(t.insert));return e.document.transact(()=>{let e=1/0,t;for(let r of i){let i=t!==void 0&&r.from===t.from&&r.to===t.to&&r.insert===t.insert;t=r,!(i||r.to>e)&&(r.to>r.from&&n.delete(r.from,r.to-r.from),r.insert.length>0&&n.insert(r.from,r.insert),e=r.from)}},aC),typeof window<`u`&&window.dispatchEvent(new CustomEvent(iC)),!0}var lC=300;function uC(e,t){let n=(0,$.c)(7),r;n[0]===t?r=n[1]:(r=t?.enabled?JSON.stringify(t):null,n[0]=t,n[1]=r);let i=r,a;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],n[2]=a):a=n[2];let[o,s]=(0,Q.useState)(a),c,l;return n[3]!==i||n[4]!==e?(c=()=>{if(!e||i===null){s(dC);return}let t=JSON.parse(i),n=e.document.getText(`source`),r=null,a=!1,o=e.configuration.name,c=()=>void na(n.toString(),t,o).then(e=>{a||s(e)}).catch(e=>{a||console.warn(`[lint] lintDocument failed`,e)}),l=()=>{r&&clearTimeout(r),r=setTimeout(c,lC)};return c(),n.observe(l),()=>{a=!0,r&&clearTimeout(r),n.unobserve(l)}},l=[e,i],n[3]=i,n[4]=e,n[5]=c,n[6]=l):(c=n[5],l=n[6]),(0,Q.useEffect)(c,l),o}function dC(e){return e.length===0?e:[]}var fC=[{id:`outline`,icon:M_},{id:`links`,icon:K},{id:`graph`,icon:F_},{id:`timeline`,icon:s_},{id:`problems`,icon:Eu}],pC=[{id:`comments`,icon:Bl}];function mC(e){let t=0,n=0;for(let r of e)r.severity===`error`?t+=1:n+=1;return{errorCount:t,warningCount:n}}function hC(e){return e===`outline`?zu._({id:`dD7NPy`}):e===`links`?zu._({id:`Rj01Fz`}):e===`graph`?zu._({id:`x2fr_j`}):e===`problems`?zu._({id:`OXdGnd`}):e===`comments`?zu._({id:`VbyRUy`}):zu._({id:`cklVjM`})}function gC(){return n(()=>import(`./GraphPanel-DZMLD8ni.js`),__vite__mapDeps([46,1,6,2,3,7,8,9,47,10,11,12,15,16,48,14,17,49,50,26,22,29,30,31,19,24,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,40,68,69,70,43,71]),import.meta.url)}var _C=(0,Q.lazy)(async()=>({default:(await gC()).GraphPanel})),vC=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BquAhT5x.js`),__vite__mapDeps([72,1,47,10,11,12,23,14,15,16,17,24,25,26,22,27,29,30,31,19,73,2,74,75,9,76,77,78,79,80,81,82,83,84,6,3,7,8,85,68,86,87,88,4,89,49,18,20,36,35,90,91,37,38,40,61,62,63,43,65,92,93,28,32,60,64,66,67,94,95,96,97,33,21,98,99,100,101,39,41,102,103,104,105,106,107,108,109,110]),import.meta.url)).ActivityModeContent}));function yC(e){let t=(0,$.c)(48),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o}=e,{_:s}=Dt(),{activeProvider:c,activeDocName:l}=ot(),{data:u}=Pp(n),d=l===n?c:null,f=uC(d,u?.effective??null),p=sp(n),m;t[0]!==p||t[1]!==f?(m=[...f,...p],t[0]=p,t[1]=f,t[2]=m):m=t[2];let h=m,g,_;t[3]!==n||t[4]!==f||t[5]!==d?(g=()=>{d!==null&&Yf(n,`lint`,mC(f))},_=[n,d,f],t[3]=n,t[4]=f,t[5]=d,t[6]=g,t[7]=_):(g=t[6],_=t[7]),(0,Q.useEffect)(g,_);let v,y;t[8]!==n||t[9]!==p||t[10]!==d?(v=()=>{d!==null&&Yf(n,`links`,mC(p))},y=[n,d,p],t[8]=n,t[9]=p,t[10]=d,t[11]=v,t[12]=y):(v=t[11],y=t[12]),(0,Q.useEffect)(v,y);let b;t[13]===d?b=t[14]:(b=e=>{d!==null&&e.fixes&&e.fixes.length>0&&cC(d,e.fixes)},t[13]=d,t[14]=b);let x=b,S;t[15]!==f||t[16]!==d?(S=()=>{d!==null&&cC(d,sC(f))},t[15]=f,t[16]=d,t[17]=S):S=t[17];let C=S,w=fs(),T;t[18]!==n||t[19]!==d?(T=e=>{if(d===null)return;let t=d.document.getText(`source`).toString().split(`
4
- `)[e.range.start.line];on(SS(n,e,t),{submit:!0})},t[18]=n,t[19]=d,t[20]=T):T=t[20];let E=T,D;t[21]===n?D=t[22]:(D=e=>{on(CS(e===`doc`?n:null),{submit:!0})},t[21]=n,t[22]=D);let O=D,k=Sb(),A,j,M;if(t[23]!==s||t[24]!==i||t[25]!==h||t[26]!==o||t[27]!==a||t[28]!==k){let e=k?fC.filter(bC):fC,n=k?e:[...e,...pC];A=n.some(e=>e.id===i)?i:`outline`,j=o===`doc`&&n.length>1,M=j?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(ni,{type:`single`,variant:`outline`,value:A,onValueChange:e=>{e&&a(e)},"aria-label":s({id:`SrOuyg`}),children:n.map(e=>{let{id:t,icon:n}=e,r=hC(t),i=t===`problems`&&h.length>0;return(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(ei,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":i?s({id:`2m_bmh`,values:{0:h.length,label:r}}):r,asChild:!0,children:(0,Z.jsxs)(_n,{className:`relative`,children:[(0,Z.jsx)(n,{}),i&&(0,Z.jsx)(Ud,{variant:`destructive`,"aria-hidden":`true`,className:`absolute -right-1.5 -top-1.5 h-4 min-w-4 rounded-full px-1 text-[10px] leading-none`,children:h.length>99?`99+`:h.length})]})}),(0,Z.jsx)(vn,{side:`bottom`,children:r})]},t)})})}):null,t[23]=s,t[24]=i,t[25]=h,t[26]=o,t[27]=a,t[28]=k,t[29]=A,t[30]=j,t[31]=M}else A=t[29],j=t[30],M=t[31];let N;t[32]!==h||t[33]!==n||t[34]!==A||t[35]!==E||t[36]!==C||t[37]!==x||t[38]!==O||t[39]!==r||t[40]!==d||t[41]!==o||t[42]!==j||t[43]!==w?(N=o===`doc`?(0,Z.jsxs)(`div`,{...j?{role:`tabpanel`,id:`panel-${A}`,"aria-labelledby":`tab-${A}`}:{},className:`min-h-0 flex-1`,children:[A===`outline`&&(0,Z.jsx)(Kf,{docName:n,isSourceMode:r}),A===`links`&&(0,Z.jsx)(IS,{docName:n}),A===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-lCAuQ`})}),children:(0,Z.jsx)(_C,{activeDocName:n})}),A===`timeline`&&(0,Z.jsx)(tC,{docName:n}),A===`comments`&&(0,Z.jsx)(yS,{docName:n}),A===`problems`&&(0,Z.jsx)($f,{docName:n,diagnostics:h,onFix:d===null?void 0:x,onAutoFix:d===null?void 0:C,onAskAi:d!==null&&w!==null?E:void 0,onFixWithAi:w===null?void 0:O})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(vC,{})})}),t[32]=h,t[33]=n,t[34]=A,t[35]=E,t[36]=C,t[37]=x,t[38]=O,t[39]=r,t[40]=d,t[41]=o,t[42]=j,t[43]=w,t[44]=N):N=t[44];let P;return t[45]!==M||t[46]!==N?(P=(0,Z.jsxs)(Z.Fragment,{children:[M,N]}),t[45]=M,t[46]=N,t[47]=P):P=t[47],P}function bC(e){return e.id===`outline`||e.id===`problems`}function xC(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function SC(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function CC(e){return e/100*window.innerHeight}function wC(e){return e/100*window.innerWidth}function TC(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function EC({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=TC(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=SC(t,i);break;case`em`:r=xC(t,i);break;case`vh`:r=CC(i);break;case`vw`:r=wC(i);break}return r}function DC(e){return parseFloat(e.toFixed(3))}function OC({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function kC(e){let{panels:t}=e,n=OC({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=DC(EC({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=DC(EC({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=DC(EC({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=DC(EC({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function AC(e,t=`Assertion error`){if(!e)throw Error(t)}function jC(e,t){return Array.from(t).sort(e===`horizontal`?MC:NC)}function MC(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function NC(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function PC(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function FC(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function IC({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=FC(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return AC(i,`No rect found`),i}var LC;function RC(){return LC===void 0&&(LC=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),LC}function zC(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=jC(n,Array.from(t.children).filter(PC).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,IC({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=RC()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:OC({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var BC=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},VC={cursorFlags:0,state:`inactive`},HC=new BC;function UC(){return VC}function WC(e){return HC.addListener(`change`,e)}function GC(e){let t=VC,n={...VC};n.cursorFlags=e,VC=n,HC.emit(`change`,{prev:t,next:n})}function KC(e){let t=VC;VC=e,HC.emit(`change`,{prev:t,next:e})}var qC=e=>e,JC=()=>{},YC=1,XC=2,ZC=4,QC=8,$C=3,ew=12,tw;function nw(){return tw===void 0&&(tw=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(tw=!0)),tw}function rw({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&nw()){let t=(e&YC)!==0,n=(e&XC)!==0,r=(e&ZC)!==0,i=(e&QC)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return nw()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var iw=new WeakMap;function aw(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=iw.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=UC();switch(r.state){case`active`:case`hover`:{let e=rw({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}iw.set(e,{prevStyle:t,styleSheet:n})}var ow=new Map,sw=new BC;function cw(e){ow=new Map(ow),ow.delete(e)}function lw(e,t){for(let[t]of ow)if(t.id===e)return t}function uw(e,t){for(let[t,n]of ow)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function dw(){return ow}function fw(e,t){return sw.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function pw(e,t,n){let r=ow.get(e);ow=new Map(ow),ow.set(e,t),sw.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function mw(e){let t=UC(),n=!1;switch(t.state){case`active`:KC({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(aw(e),n=!0,t.hitRegions.forEach(e=>{let t=uw(e.group.id,!0);pw(e.group,t,{isUserInteraction:!0})}))}return n}function hw(e){e.defaultPrevented||mw(e.currentTarget)}function gw(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=FC(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function _w(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function vw(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:ww(e),b:ww(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();AC(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Cw(Sw(n.a)),b:Cw(Sw(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var yw=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function bw(e){let t=getComputedStyle(Tw(e)??e).display;return t===`flex`||t===`inline-flex`}function xw(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||bw(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||yw.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Sw(e){let t=e.length;for(;t--;){let n=e[t];if(AC(n,`Missing node`),xw(n))return n}return null}function Cw(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ww(e){let t=[];for(;e;)t.push(e),e=Tw(e);return t}function Tw(e){let{parentNode:t}=e;return _w(t)?t.host:t}function Ew(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Dw({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!PC(n)||n.contains(e)||e.contains(n))return!0;if(vw(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Ew(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Ow(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=zC(r),a=gw(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Dw({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function kw(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}function Aw(e,t,n=0){return Math.abs(DC(e)-DC(t))<=n}function jw(e,t){return Aw(e,t)?0:e>t?1:-1}function Mw({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(jw(r,c)<0)if(a){let e=(i+c)/2;r=jw(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=DC(r),r}function Nw({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Aw(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;AC(u!=null,`Invalid first pivot index`),AC(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];AC(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(AC(n!=null,`Previous layout not found for panel index ${t}`),Aw(n,i)){let t=o-n;jw(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];AC(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(AC(n!=null,`Previous layout not found for panel index ${t}`),Aw(n,o)){let t=n-i;jw(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];AC(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&jw(i,c)<0)if(e>0){let t=c-o,n=t/2;jw(i+e,c)<0&&(e=jw(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;jw(i-e,c)<0&&(e=jw(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];AC(e!=null,`Previous layout not found for panel index ${r}`);let a=Mw({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];AC(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Mw({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Aw(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(kw(c,l))return i;{let t=e<0?d:u,r=s[t];AC(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Mw({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Aw(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];AC(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Mw({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Aw(i,s)||(t-=s-i,l[r]=s),Aw(t,0))break;e>0?r--:r++}}}if(!Aw(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function Pw(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||jw(e[n],t[n])!==0)return!1;return!0}function Fw({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!Aw(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];AC(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];AC(i!=null,`No layout data found for index ${e}`);let o=r[e];AC(o!=null,`No layout data found for index ${e}`);let s=Mw({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Aw(a,0))for(let e=0;e<t.length;e++){let n=r[e];AC(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Mw({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Aw(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Iw({groupId:e,panelId:t}){let n=()=>{let t=dw();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&Aw(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:DC(100-e)}}return Nw({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=Fw({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});Pw(c,u)||pw(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Aw(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=OC({group:t});s(DC(EC({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Lw(e){e.defaultPrevented||Ow(e,dw()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=Iw({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Rw(e){let t=dw();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function zw({groupId:e}){let t=()=>{let t=dw();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=Fw({layout:e,panelConstraints:r});return n?o:(Pw(o,c)||pw(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Bw(e,t){let n=Rw(e),r=uw(n.id,!0),i=n.separators.find(t=>t.element===e);AC(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);AC(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=zw({groupId:n.id}).getLayout(),c=Fw({layout:Nw({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Pw(s,c)||pw(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function Vw(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Rw(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Bw(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Bw(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Bw(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Bw(t,-5);break;case`End`:e.preventDefault(),Bw(t,100);break;case`Enter`:{e.preventDefault();let n=Rw(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=uw(n.id,!0),o=n.separators.find(e=>e.element===t);AC(o,`Matching separator not found`);let s=a.get(o);AC(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(AC(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Bw(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Rw(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);AC(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),Bw(t,-100);break}}function Hw(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=dw(),n=Ow(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),KC({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function Uw({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=Nw({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Pw(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?YC:XC;break;case`vertical`:s|=d<0?ZC:QC;break}}else pw(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&$C:c|=s&$C,t.movementY===0?c|=o&ew:c|=s&ew,GC(c),aw(e)}function Ww(e){let t=dw(),n=UC();switch(n.state){case`active`:Uw({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Gw(e){if(e.defaultPrevented)return;let t=UC(),n=dw();switch(t.state){case`active`:if(e.buttons===0){KC({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=uw(e.group.id,!0);pw(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Uw({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Ow(e,n);r.length===0?t.state!==`inactive`&&KC({cursorFlags:0,state:`inactive`}):KC({cursorFlags:0,hitRegions:r,state:`hover`}),aw(e.currentTarget);break}}}function Kw(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(UC().state){case`hover`:KC({cursorFlags:0,state:`inactive`})}}function qw(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||mw(e.currentTarget)&&e.preventDefault()}function Jw(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=DC(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=DC((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Yw(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=OC({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:DC(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Xw(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Zw({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=DC(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=DC((r[e]??0)/a*l);else{let e=DC(l/c.length);for(let t of c)u[t]=e}return u}function Qw(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var $w=new Map;function eT(e){let t=!0;AC(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=OC({group:e});if(t===0)return;let n=uw(e.id);if(!n)return;let r=kC(e),i=n.defaultLayoutDeferred?Jw(r):n.layout,a=Fw({layout:Zw({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Pw(n.layout,a)&&Xw(n.derivedPanelConstraints,r)&&n.groupSize===t)return;pw(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Yw(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{AC(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=OC({group:e}),s=kC(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Qw(e.panels,l)||(l=void 0));let u=Fw({layout:e.mutableState.layouts[c]??l??Jw(s),panelConstraints:s}),d=e.element.ownerDocument;$w.set(d,($w.get(d)??0)+1);let f=new Map;return zC(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),pw(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{AC(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,Vw)}),$w.get(d)===1&&(d.addEventListener(`contextmenu`,hw,!0),d.addEventListener(`dblclick`,Lw,!0),d.addEventListener(`pointerdown`,Hw,!0),d.addEventListener(`pointerleave`,Ww),d.addEventListener(`pointermove`,Gw),d.addEventListener(`pointerout`,Kw),d.addEventListener(`pointerup`,qw,!0)),function(){t=!1,$w.set(d,Math.max(0,($w.get(d)??0)-1)),cw(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Vw)}),$w.get(d)||(d.removeEventListener(`contextmenu`,hw,!0),d.removeEventListener(`dblclick`,Lw,!0),d.removeEventListener(`pointerdown`,Hw,!0),d.removeEventListener(`pointerleave`,Ww),d.removeEventListener(`pointermove`,Gw),d.removeEventListener(`pointerout`,Kw),d.removeEventListener(`pointerup`,qw,!0)),a.disconnect()}}function tT(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function nT(e){let t=(0,Q.useId)();return`${e??t}`}var rT=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function iT(e){let t=(0,Q.useRef)(e);return rT(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function aT(...e){return iT(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function oT(e){let t=(0,Q.useRef)({...e});return rT(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var sT=(0,Q.createContext)(null);function cT(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:qC});(0,Q.useImperativeHandle)(t,()=>n.current,[]),rT(()=>{Object.assign(n.current,zw({groupId:e}))})}function lT({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,Q.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=iT(e=>{Pw(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=iT((e,t)=>{Pw(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=nT(s),v=(0,Q.useRef)(null),[y,b]=tT(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=aT(v,a);cT(_,o);let C=iT((e,t)=>{let r=UC(),i=lw(e),a=uw(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=oT({defaultLayout:n,disableCursor:r}),T=(0,Q.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=jC(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=jC(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=lw(_),i=uw(_);r&&i&&pw(r,{...i,derivedPanelConstraints:kC(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,Q.useRef)(null);return rT(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=eT(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=uw(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=fw(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Aw(t.collapsedSize,i[t.panelId]),a=Aw(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=UC().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(sT.Provider,{value:T,children:(0,Z.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}lT.displayName=`Group`;function uT(){return(0,Q.useRef)(null)}function dT(){let e=(0,Q.useContext)(sT);return AC(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function fT(e,t){let{id:n}=dT(),r=(0,Q.useRef)({collapse:JC,expand:JC,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:JC});(0,Q.useImperativeHandle)(t,()=>r.current,[]),rT(()=>{Object.assign(r.current,Iw({groupId:n,panelId:e}))})}function pT({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=nT(c),_=oT({disabled:a}),v=(0,Q.useRef)(null),y=aT(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=dT(),T=d!==null,E=iT((e,t,n)=>{d?.(e,c,n)});rT(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,Q.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),fT(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>fw(x,e),D,D),k;return k=O?JSON.parse(O):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...mT,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Z.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}pT.displayName=`Panel`;var mT={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function hT(){return(0,Q.useRef)(null)}function gT({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=Fw({layout:Nw({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Fw({layout:Nw({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function _T({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=nT(a),l=oT({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),[m,h]=(0,Q.useState)(!1),g=(0,Q.useRef)(null),_=aT(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=dT(),C=b===`horizontal`?`vertical`:`horizontal`;rT(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=WC(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=fw(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(gT({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,Q.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}_T.displayName=`Separator`;function vT(e){let t=(0,$.c)(50),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({fileName:r,extension:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=Dt(),[o,s]=(0,Q.useState)(`diagram`),c=Gp(i),l;t[4]===n?l=t[5]:(l={"data-mermaid-file-viewer-extension":n},t[4]=n,t[5]=l);let u=l;if(c.status===`loading`){let e;return t[6]!==u||t[7]!==r?(e=(0,Z.jsx)(Up,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u}),t[6]=u,t[7]=r,t[8]=e):e=t[8],e}if(c.status===`error`){let e;return t[9]!==u||t[10]!==c.message||t[11]!==r||t[12]!==i.src?(e=(0,Z.jsx)(Bp,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u,message:c.message,openHref:i.src}),t[9]=u,t[10]=c.message,t[11]=r,t[12]=i.src,t[13]=e):e=t[13],e}let d=c.content,f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e&&s(e)},t[14]=f):f=t[14];let p;t[15]===a?p=t[16]:(p=a({id:`72xhRD`}),t[15]=a,t[16]=p);let m;t[17]===a?m=t[18]:(m=a({id:`DEWDbv`}),t[17]=a,t[18]=m);let h;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(_n,{children:(0,Z.jsx)(Fe,{className:`size-4`})}),t[19]=h):h=t[19];let g;t[20]===m?g=t[21]:(g=(0,Z.jsx)(ei,{value:`diagram`,"aria-label":m,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:h}),t[20]=m,t[21]=g);let _;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(vn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`i-ShMB`})}),t[22]=_):_=t[22];let v;t[23]===g?v=t[24]:(v=(0,Z.jsxs)(bn,{children:[g,_]}),t[23]=g,t[24]=v);let y;t[25]===a?y=t[26]:(y=a({id:`Y6SK9K`}),t[25]=a,t[26]=y);let b;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(_n,{children:(0,Z.jsx)(I,{className:`size-4`})}),t[27]=b):b=t[27];let x;t[28]===y?x=t[29]:(x=(0,Z.jsx)(ei,{value:`source`,"aria-label":y,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:b}),t[28]=y,t[29]=x);let S;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(vn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`wdxz7K`})}),t[30]=S):S=t[30];let C;t[31]===x?C=t[32]:(C=(0,Z.jsxs)(bn,{children:[x,S]}),t[31]=x,t[32]=C);let w;t[33]!==o||t[34]!==C||t[35]!==p||t[36]!==v?(w=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center border-b bg-background py-2`,children:(0,Z.jsxs)(ni,{type:`single`,value:o,onValueChange:f,"aria-label":p,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[v,C]})}),t[33]=o,t[34]=C,t[35]=p,t[36]=v,t[37]=w):w=t[37];let T;t[38]!==n||t[39]!==r||t[40]!==o||t[41]!==i||t[42]!==d?(T=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:o===`diagram`?(0,Z.jsx)(`div`,{className:`flex h-full min-h-0 flex-col p-3 [&_.mermaid-error-source]:hidden`,children:(0,Z.jsx)(Qn,{chart:d,className:`min-h-0 flex-1`})}):(0,Z.jsx)(Vp,{...i,fileName:r,extension:n})}),t[38]=n,t[39]=r,t[40]=o,t[41]=i,t[42]=d,t[43]=T):T=t[43];let E;return t[44]!==u||t[45]!==r||t[46]!==o||t[47]!==w||t[48]!==T?(E=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-mermaid-file-viewer":``,"data-mermaid-file-viewer-state":`loaded`,"data-mermaid-file-viewer-mode":o,...u,children:[w,T]}),t[44]=u,t[45]=r,t[46]=o,t[47]=w,t[48]=T,t[49]=E):E=t[49],E}function yT(e){return bo(`/api/asset?path=${encodeURIComponent(e)}`)}function bT(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function xT(e){let t=(0,$.c)(8),{assetPath:n,mediaKind:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(Wp,{entry:{kind:`asset`,path:n},className:`shrink-0 border-b bg-background px-3 py-1.5`}),t[0]=n,t[1]=i);let a;t[2]!==n||t[3]!==r?(a=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(ST,{assetPath:n,mediaKind:r})}),t[2]=n,t[3]=r,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function ST(e){let t=(0,$.c)(33),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=yT(n),t[0]=n,t[1]=o);let s=o,c;t[2]===n?c=t[3]:(c=n.split(`/`).pop()??n,t[2]=n,t[3]=c);let l=c,u,d,f,p;if(t[4]!==n||t[5]!==l||t[6]!==i||t[7]!==r||t[8]!==s){p=Symbol.for(`react.early_return_sentinel`);bb0:{if(f=l.includes(`.`)?l.split(`.`).pop()??``:``,d=f.length>0?f.toUpperCase():`FILE`,u=i?`text`:r,u===`pdf`){let e;t[13]!==l||t[14]!==s?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(j,{src:s,title:l,fillContainer:!0})}),t[13]=l,t[14]=s,t[15]=e):e=t[15];let n;t[16]!==l||t[17]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:e}),t[16]=l,t[17]=e,t[18]=n):n=t[18],p=n;break bb0}if(u===`text`){let e;t[19]===n?e=t[20]:(e=bT(n),t[19]=n,t[20]=e),p=(0,Z.jsx)(Vp,{src:e,fileName:l,extension:f.toLowerCase()},n);break bb0}if(u===`mermaid`){let e;t[21]===n?e=t[22]:(e=bT(n),t[21]=n,t[22]=e),p=(0,Z.jsx)(vT,{src:e,fileName:l,extension:f.toLowerCase()},n);break bb0}}t[4]=n,t[5]=l,t[6]=i,t[7]=r,t[8]=s,t[9]=u,t[10]=d,t[11]=f,t[12]=p}else u=t[9],d=t[10],f=t[11],p=t[12];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[23]!==n||t[24]!==u||t[25]!==d||t[26]!==l||t[27]!==f||t[28]!==s?(m=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:u===`image`?(0,Z.jsx)(W,{src:s,alt:l,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):u===`video`?(0,Z.jsx)(`video`,{src:s,controls:!0,className:`max-h-full max-w-full`}):u===`audio`?(0,Z.jsx)(`audio`,{src:s,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-8 text-center`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-center tracking-wide text-muted-foreground/80 text-2xs font-mono`,children:d}),(0,Z.jsx)(`div`,{className:`max-w-full text-balance break-words tracking-tight font-light text-2xl`,children:l})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(X,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(J,{id:`qFWMl-`})}),(0,Z.jsx)(X,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{Kn({url:s,projectRelPath:n,ext:f.toLowerCase(),title:l,forceOsDelegation:!1})},children:(0,Z.jsx)(J,{id:`9npOH9`})})]})]})}),t[23]=n,t[24]=u,t[25]=d,t[26]=l,t[27]=f,t[28]=s,t[29]=m):m=t[29];let h;return t[30]!==l||t[31]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:m}),t[30]=l,t[31]=m,t[32]=h):h=t[32],h}function CT(){let e=(0,$.c)(5),{_:t}=Dt(),n;e[0]===t?n=e[1]:(n=t({id:`3VsNTI`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(jp,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(jp,{className:`h-4 w-full`}),(0,Z.jsx)(jp,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function wT(e){let{_:t}=Dt();return e===`existing-repo`?[{id:`draft-spec`,icon:m_,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:M_,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:F_,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:rv,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:m_,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:e_,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function TT(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=Dt(),a=wT(n),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(void 0),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>()=>clearTimeout(c.current),u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,Q.useEffect)(l,u);let d,f;if(t[2]!==i||t[3]!==r||t[4]!==o||t[5]!==a){let e=function(e,t){qp(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch(ET)};t[8]===r?d=t[9]:(d=Y(`w-full divide-y divide-border/60 overflow-hidden rounded-2xl border border-border/60 bg-card`,r),t[8]=r,t[9]=d),f=a.map(t=>{let n=t.icon,r=o===t.id;return(0,Z.jsxs)(`li`,{className:`group flex items-start gap-3 p-3.5`,"data-testid":`copy-prompt-${t.id}`,children:[(0,Z.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium leading-tight text-foreground`,children:t.label}),(0,Z.jsx)(`span`,{className:`truncate text-1sm leading-relaxed text-muted-foreground`,children:t.prompt})]}),(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.id,t.prompt),"aria-label":i(r?{id:`6V3Ea3`}:{id:`RG4XHV`,values:{0:t.label}}),className:Y(`shrink-0 gap-1.5 transition-opacity focus-visible:opacity-100 uppercase font-mono`,r?`opacity-100`:`opacity-0 group-hover:opacity-100`),"data-testid":`copy-prompt-button-${t.id}`,children:[r?(0,Z.jsx)(Zo,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(gc,{className:`size-3.5`,"aria-hidden":`true`}),i(r?{id:`6V3Ea3`}:{id:`he3ygx`})]})]},t.id)}),t[2]=i,t[3]=r,t[4]=o,t[5]=a,t[6]=d,t[7]=f}else d=t[6],f=t[7];let p;return t[10]!==d||t[11]!==f?(p=(0,Z.jsx)(`ul`,{className:d,children:f}),t[10]=d,t[11]=f,t[12]=p):p=t[12],p}function ET(){}var DT=`ok-ask-ai-draft-v2`,OT={doc:null,dismissed:!1};function kT(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var AT=null,jT=new Set;function MT(e){if(e===null)return!0;let t=e.content;return!Array.isArray(t)||t.length===0?!0:t.every(e=>{let t=e.content;return!Array.isArray(t)||t.length===0})}function NT(){let e=kT();if(!e)return OT;try{let t=e.getItem(DT);if(!t)return OT;let n=JSON.parse(t);return typeof n!=`object`||!n||Array.isArray(n)?OT:{doc:n,dismissed:!1}}catch(e){return console.warn(`failed to parse stored draft — clearing`,e),OT}}function PT(){return AT===null&&(AT=NT()),AT}function FT(e){let t=kT();if(t)try{e&&!MT(e)?t.setItem(DT,JSON.stringify(e)):t.removeItem(DT)}catch{}}function IT(){for(let e of jT)e()}function LT(){return PT()}function RT(e){let t=e&&!MT(e)?e:null;AT={...PT(),doc:t},FT(t),IT()}function zT(){RT(null)}var BT=Zi;function VT(e){let t=Xn(e).kind;return t===`folder`||t===`asset`?t:`page`}function HT(e){let t=(0,$.c)(14),{items:n,query:r,selectedIndex:i,onSelect:a,loading:o,error:s,hasMore:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=c===void 0?!1:c,{_:f}=Dt(),p=(0,Q.useId)(),m=(0,Q.useRef)(null),h,g;t[0]===i?(h=t[1],g=t[2]):(h=()=>{(m.current?.querySelectorAll(`[role="option"]`))?.item(i)?.scrollIntoView({block:`nearest`})},g=[i],t[0]=i,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=i>=0&&i<n.length?n[i]:null,v;return t[3]!==f||t[4]!==u||t[5]!==d||t[6]!==n||t[7]!==p||t[8]!==l||t[9]!==a||t[10]!==r||t[11]!==i||t[12]!==_?(v=(0,Z.jsx)(`div`,{ref:m,className:`w-80 max-w-[min(28rem,90vw)] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:l?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:f({id:`3m2GBo`})}):u?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`assertive`,children:f({id:`weP6me`})}):n.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:r.trim()===``?f({id:`0E9DR6`}):f({id:`yQyglE`})}):(0,Z.jsxs)(`div`,{role:`listbox`,id:p,"aria-label":f({id:`05n5wS`}),tabIndex:-1,className:`max-h-64 overflow-y-auto subtle-scrollbar`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:_?_.title:``}),n.map((e,t)=>{let n=t===i,r=VT(e.path),o=r===`folder`,s=o?`${e.path}/`:e.path;return(0,Z.jsxs)(`button`,{id:`${p}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-active":n,"data-mention-kind":r,"data-testid":`composer-mention-option-${e.docName}`,className:`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),a(e)},children:[(0,Z.jsx)(Ce,{path:e.path,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),o?(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:f({id:`kNqMMd`})}):null]}),(0,Z.jsx)(`span`,{className:`line-clamp-2 break-all text-xs text-muted-foreground`,children:s})]})]},e.docName)}),d?(0,Z.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,"aria-hidden":!0,children:f({id:`F1T9y_`})}):null]})}),t[3]=f,t[4]=u,t[5]=d,t[6]=n,t[7]=p,t[8]=l,t[9]=a,t[10]=r,t[11]=i,t[12]=_,t[13]=v):v=t[13],v}var UT=8,WT=new Da(`composerMentionSuggestion`);function GT(e){return e.kind===`asset`?e.docName.replace(/^\//,``):e.kind===`folder`?e.docName:mc(e.docName)}var KT=zi.create({name:`doc`,topNode:!0,content:`paragraph+`}),qT=zi.create({name:`paragraph`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML(){return[`p`,0]}}),JT=zi.create({name:`text`,group:`inline`}),YT=zi.create({name:`hardBreak`,group:`inline`,inline:!0,selectable:!1,parseHTML(){return[{tag:`br`}]},renderHTML(){return[`br`]},addKeyboardShortcuts(){return{"Shift-Enter":()=>this.editor.commands.insertContent({type:`hardBreak`})}}}),XT=wo.create({name:`composerHistory`,addProseMirrorPlugins(){return[za(),Va({"Mod-z":Fa,"Mod-y":Ei,"Shift-Mod-z":Ei})]}}),ZT=zi.create({name:`composerMention`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{path:{default:``},label:{default:``}}},parseHTML(){return[{tag:`span[data-composer-mention]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.label||e.attrs.path);return[`span`,ha(t,{"data-composer-mention":String(e.attrs.path??``),class:`composer-mention-chip`}),`@${n}`]},renderText({node:e}){return`@${e.attrs.path}`},addNodeView(){return({node:e,editor:t,getPos:n})=>{let r=String(e.attrs.path??``),i=String(e.attrs.label||e.attrs.path),a=document.createElement(`span`);a.className=`composer-mention-chip group/mention`,a.setAttribute(`data-composer-mention`,r),a.title=i;let o=document.createElement(`button`);o.type=`button`,o.className=`composer-mention-icon`,o.setAttribute(`aria-label`,zu._({id:`Xzy0s0`,values:{fullLabel:i}}));let s=document.createElement(`span`);s.className=`composer-mention-glyph composer-mention-glyph-icon`,s.setAttribute(`aria-hidden`,`true`),s.innerHTML=Ee(r),o.appendChild(s);let c=document.createElement(`span`);c.className=`composer-mention-glyph composer-mention-glyph-x`,c.setAttribute(`aria-hidden`,`true`),c.innerHTML=Ae(ju),o.appendChild(c),o.addEventListener(`mousedown`,e=>e.preventDefault()),o.addEventListener(`click`,r=>{r.preventDefault();let i=typeof n==`function`?n():null;i!=null&&t.chain().focus().deleteRange({from:i,to:i+e.nodeSize}).run()}),a.appendChild(o);let l=document.createElement(`span`);return l.className=`composer-mention-label`,l.textContent=i,a.appendChild(l),{dom:a}}},addProseMirrorPlugins(){return[eE(this.editor)]}});function QT(e){return[KT,qT,JT,YT,XT,ZT,...e?.placeholder?[BT.configure({placeholder:e.placeholder})]:[]]}function $T(e=$n){let t=[],n=!1,r=null,i=!1;return{snapshot(){return{loaded:n,error:i}},async getItems(a){if(!n){r||=e();try{t=await r,n=!0,i=!1}catch(e){console.error(`[composer-mention] failed to fetch pages`,e),t=[],i=!0}finally{r=null}}return or(t,a).map(e=>({docName:e.docName,title:e.title,path:GT(e)})).filter(e=>e.path!==``)},reset(){t=[],n=!1,r=null,i=!1}}}function eE(e){let t=$T();return ir({editor:e,pluginKey:WT,char:`@`,items:({query:e})=>t.getItems(e),command:({editor:e,range:t,props:n})=>{try{e.chain().focus().deleteRange(t).insertContent([{type:`composerMention`,attrs:{path:n.path,label:n.title}},{type:`text`,text:` `}]).run()}catch(e){console.error(`[composer-mention] insert failed`,{item:n,range:t},e)}},render:()=>{let e=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=null,s=e=>{n?.command(e)},c=e=>{let n=e.items??[],{loaded:i,error:a}=t.snapshot();return{items:n,query:e.query??``,selectedIndex:r,onSelect:s,loading:!i&&!a,error:a,hasMore:n.length>=UT}},l=()=>{!e||!n||e.updateProps(c(n))};return{onBeforeStart(t){n=t,r=0;let s=Vn(()=>n,`composer-mention`);i.popup=s.popup,a=s.doPosition,o=s.reveal,e=new jn(HT,{props:c(t),editor:t.editor}),s.popup.appendChild(e.element),i.stopAutoUpdate=s.startAutoUpdate()},onStart(e){n=e,r=0,l(),o?.()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),l(),a?.()},onKeyDown({event:e}){if(!n)return!1;let t=n.items;if(e.key===`ArrowDown`)return t.length===0?!1:(r=(r+1)%t.length,l(),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(r=(r-1+t.length)%t.length,l(),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e?(n.command(e),!0):!1}return!1},onExit(){Un(i),a=null,o=null,e?.destroy(),e=null,n=null,r=0,t.reset()}}}})}function tE(e){let t=[],n=new Set,r=[];return e.state.doc.forEach(e=>{let i=``;e.forEach(e=>{if(e.type.name===`composerMention`){let r=String(e.attrs.path??``);r!==``&&(i+=`@${r}`,n.has(r)||(n.add(r),t.push(r)))}else e.isText?i+=e.text??``:e.type.name===`hardBreak`&&(i+=`
5
- `)}),r.push(i)}),{instruction:r.join(`
6
- `).trim(),mentions:t}}function nE(e){let{instruction:t,mentions:n}=tE(e);return t===``&&n.length===0}function rE(e){let t=e?.content;return!Array.isArray(t)||t.length===0?!1:t.some(e=>Array.isArray(e.content)&&e.content.length>0)}function iE(e){let t=(0,$.c)(30),{ref:n,ariaLabel:r,onEmptyChange:i,onContentChange:a,onMentionsChange:o,onSubmit:s,onEscape:c,className:l,placeholder:u,initialDoc:d}=e,f=(0,Q.useRef)(i),p=(0,Q.useRef)(a),m=(0,Q.useRef)(o),h=(0,Q.useRef)(s),g=(0,Q.useRef)(c),_;t[0]!==a||t[1]!==i||t[2]!==c||t[3]!==o||t[4]!==s?(_=()=>{f.current=i,p.current=a,m.current=o,h.current=s,g.current=c},t[0]=a,t[1]=i,t[2]=c,t[3]=o,t[4]=s,t[5]=_):_=t[5],(0,Q.useEffect)(_);let v;t[6]===u?v=t[7]:(v=QT({placeholder:u}),t[6]=u,t[7]=v);let y=d??void 0,b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=Y(`composer-prosemirror py-1 outline-none`),t[8]=b):b=t[8];let x;t[9]===r?x=t[10]:(x={role:`textbox`,"aria-label":r,"aria-multiline":`true`,class:b},t[9]=r,t[10]=x);let S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(e,t)=>t.key===`Escape`?WT.getState(e.state)?.active?!1:g.current===void 0?(e.dom.blur(),!0):(g.current(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?WT.getState(e.state)?.active?!1:(h.current(),!0):!1,t[11]=S):S=t[11];let C;t[12]===x?C=t[13]:(C={attributes:x,handleKeyDown:S},t[12]=x,t[13]=C);let w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{let{editor:t}=e;f.current(nE(t)),p.current?.(t.getJSON()),m.current?.(tE(t).mentions)},t[14]=w):w=t[14];let T;t[15]!==v||t[16]!==y||t[17]!==C?(T={extensions:v,content:y,immediatelyRender:!0,editorProps:C,onUpdate:w},t[15]=v,t[16]=y,t[17]=C,t[18]=T):T=t[18];let E=ar(T),D;t[19]!==E||t[20]!==d?(D=()=>{E&&(nE(E)&&rE(d)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),zT()),f.current(nE(E)),m.current?.(tE(E).mentions))},t[19]=E,t[20]=d,t[21]=D):D=t[21];let O;t[22]===E?O=t[23]:(O=[E],t[22]=E,t[23]=O),(0,Q.useEffect)(D,O);let k,A;t[24]===E?(k=t[25],A=t[26]):(k=()=>({focus:()=>E?.commands.focus(),blur:()=>E?.commands.blur(),clear:()=>E?.commands.clearContent(!0),setText:e=>{E&&(E.commands.setContent(e),p.current?.(E.getJSON()),m.current?.(tE(E).mentions))},getContent:()=>E?tE(E):{instruction:``,mentions:[]}}),A=[E],t[24]=E,t[25]=k,t[26]=A),(0,Q.useImperativeHandle)(n,k,A);let j;return t[27]!==l||t[28]!==E?(j=(0,Z.jsx)(Ln,{editor:E,className:l}),t[27]=l,t[28]=E,t[29]=j):j=t[29],j}function aE(e,t,n){return e.trim().length>0||t.length>0||n}new Set(li.map(e=>e.id));function oE(e,t){al(e,t)}function sE(e){let t=(0,$.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(J,{id:`5PrrYw`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function cE(e){let t=(0,$.c)(29),{scenario:n,className:r}=e,{_:i}=Dt(),{states:a,refresh:o}=_s(),s=ci(),{dispatch:c}=ds(),l=jf(),u=fs(),[d,f]=(0,Q.useState)(uE),p=ii(),m=ri(),h;t[0]===s?h=t[1]:(h=e=>ui(s,e.source,e.id,!0,e.supported),t[0]=s,t[1]=h);let g=m.filter(h),_=gi(g,p),v;t[2]===u?.installedClis?v=t[3]:(v=u?.installedClis??{},t[2]=u?.installedClis,t[3]=v);let y=ol({sticky:d,effectiveThreadAgent:_,enabledClis:u===null?[]:Vc(s,u.installedClis),enabledDesktopTargets:sl(s),installedClis:v,terminalAvailable:u!==null,threadsAvailable:!0,desktopSelectable:!0}),b=y.kind===`thread`,x=y.kind===`cli`?y.cli:null,S=y.kind===`desktop`?y.target:null,C=x!==null,w=(0,Q.useRef)(null),[T]=(0,Q.useState)(lE),[E,D]=(0,Q.useState)(!0),[O,k]=(0,Q.useState)(!1),A;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){D(e),e||k(!1)},t[4]=A):A=t[4];let j=A,M=wT(n),N;t[5]===s?N=t[6]:(N=e=>mi(s,e.id),t[5]=s,t[6]=N);let P=li.filter(N),F=li.every(e=>a[e.id]?.installed!=null),I=u!==null&&Vc(s,u.installedClis).length>0,L=F&&P.length===0&&g.length===0&&!I,R;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){f(e),al(e),oE(e)},t[7]=R):R=t[7];let z=R,B;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){f(Rc(e)),al(Rc(e))},t[8]=B):B=t[8];let V=B,H;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){oi(e),f(Lc),al(Lc)},t[9]=H):H=t[9];let U=H,ee=function(){let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!aE(e,t,!1)){k(!0);return}let r=ps({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(Ds(r,_===null?void 0:{agent:{source:_.source,id:_.id}}),w.current?.clear(),zT())},W=function(){if(u===null||x===null)return;let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!aE(e,t,!1)){k(!0);return}let r=ps({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(u.launchInTerminal(r,x),w.current?.clear(),zT())},te=function(e){let{instruction:t,mentions:r}=w.current?.getContent()??{instruction:``,mentions:[]};if(!aE(t,r,!1)){k(!0);return}if(oE(e),a[e]?.installed!==!0){let t=li.find(t=>t.id===e);t&&Ts(t);return}let i=ps({workspace:l,description:t,scenario:n,mentions:r});i!==null&&(c(e,i),w.current?.clear(),zT())},G=function(){b?ee():C?W():S!==null&&te(S)},ne=function(e){w.current?.setText(e),w.current?.focus()};if(L){let e;t[10]===r?e=t[11]:(e=Y(`flex w-full flex-wrap items-center justify-between gap-3 rounded-2xl border border-border/60 bg-card px-4 py-3`,r),t[10]=r,t[11]=e);let n;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(lc,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[12]=n):n=t[12];let i;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n,(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`XT-L4j`})})]}),t[13]=i):i=t[13];let a;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:Wu,className:`gap-1.5`,"data-testid":`create-configure-agents`,children:[(0,Z.jsx)(wu,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`jRAGrQ`})]}),t[14]=a):a=t[14];let o;return t[15]===e?o=t[16]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[15]=e,t[16]=o),o}let K=u?Vc(s,u.installedClis):[],q=P.length>0,re=K.length>0,ie=g.length>0,ae=y.kind!==`none`,oe;t[17]===r?oe=t[18]:(oe=Y(`flex w-full flex-col gap-3`,r),t[17]=r,t[18]=oe);let se;t[19]===i?se=t[20]:(se=i({id:`7hctf2`}),t[19]=i,t[20]=se);let ce;t[21]===i?ce=t[22]:(ce=i({id:`0jD-Gn`}),t[21]=i,t[22]=ce);let le;t[23]!==E||t[24]!==O?(le=O&&E?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(J,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[23]=E,t[24]=O,t[25]=le):le=t[25];let ue=ae?(0,Z.jsxs)(yp,{children:[(0,Z.jsx)(X,{type:`button`,onClick:()=>b?ee():C?W():S===null?void 0:te(S),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:b&&_!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Po,{agentId:_.id,iconUrl:_.iconUrl,className:`size-3.5`}),(0,Z.jsx)(sE,{agentName:_.name})]}):C&&x!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(di,{id:ai(x),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`4rjwLG`,values:{0:Ri[x].displayName}})]}):S===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(di,{id:S,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`9dw5bW`,values:{0:ls(S)}})]})}),(0,Z.jsxs)(Kr,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,"aria-label":i({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)($o,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(Wr,{align:`end`,className:`max-h-80 min-w-[200px]`,children:[ie?(0,Z.jsxs)(zr,{"aria-label":i({id:`vPKX2i`}),children:[(0,Z.jsxs)(Hr,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(J,{id:`RXEbZy`}),(0,Z.jsx)(pi,{})]}),g.map(e=>(0,Z.jsxs)(Ir,{onSelect:()=>U(e),"data-testid":`create-agent-option-thread-${e.source}:${e.id}`,children:[(0,Z.jsx)(Po,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),b&&_!==null&&_.source===e.source&&_.id===e.id?(0,Z.jsx)(Zo,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},`${e.source}:${e.id}`))]}):null,ie&&(re||q)?(0,Z.jsx)(qr,{}):null,re?(0,Z.jsxs)(zr,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(Hr,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),K.map(e=>{let{displayName:t}=Ri[e];return(0,Z.jsxs)(Ir,{onSelect:()=>V(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(di,{id:ai(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),x===e?(0,Z.jsx)(Zo,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,q?(0,Z.jsxs)(Z.Fragment,{children:[re?(0,Z.jsx)(qr,{}):null,(0,Z.jsxs)(zr,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(Hr,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),P.map(e=>(0,Z.jsxs)(Ir,{onSelect:()=>z(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(di,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!C&&e.id===S?(0,Z.jsx)(Zo,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null,(0,Z.jsx)(qr,{}),(0,Z.jsxs)(Ir,{onSelect:Wu,"data-testid":`create-agent-option-settings`,children:[(0,Z.jsx)(wu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`jRAGrQ`})})]})]})]})]}):(0,Z.jsx)(X,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(J,{id:`hYgDIe`})}),de;return t[26]!==le||t[27]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[le,ue]}),t[26]=le,t[27]=ue,t[28]=de):de=t[28],(0,Z.jsxs)(`div`,{className:oe,children:[(0,Z.jsxs)(`div`,{onMouseDown:e=>_p(e,w),className:`flex w-full cursor-text flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[(0,Z.jsx)(iE,{ref:w,ariaLabel:se,placeholder:ce,onEmptyChange:j,onContentChange:RT,onSubmit:G,initialDoc:T,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),de]}),n!==`existing-repo`&&M.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`I5685_`})}),M.map(e=>{let t=e.icon;return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>ne(e.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":`true`}),e.label]},e.id)})]}):null]})}function lE(){return LT().doc??void 0}function uE(){return Nc()}function dE(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(Nh,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-start gap-3 @md/emptystate:flex-row @md/emptystate:items-center @md/emptystate:gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function fE({isOnboarding:e,isEmbedded:t}){return e?{title:{id:`6h4zVU`},subtitle:t?{id:`vGeNNQ`}:{id:`qpQwGC`}}:{title:{id:`FOGD7m`},subtitle:t?{id:`3DTatP`}:{id:`MqQoV-`}}}var pE=`open-knowledge:create-top-level-file`;function mE(e={}){window.dispatchEvent(new CustomEvent(pE,{detail:e}))}function hE(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(pE,t),()=>window.removeEventListener(pE,t)}function gE(e){let t=(0,$.c)(28),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=Dt(),a=fc(),{title:o,subtitle:s}=fE({isOnboarding:!1,isEmbedded:a}),c=Ns(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p=dE,m=i(o),h=i(s),g;t[3]!==p||t[4]!==n||t[5]!==m||t[6]!==h?(g=(0,Z.jsx)(p,{title:m,subtitle:h,celebrateSignal:n}),t[3]=p,t[4]=n,t[5]=m,t[6]=h,t[7]=g):g=t[7];let _;t[8]===a?_=t[9]:(_=a?(0,Z.jsx)(TT,{scenario:`existing-repo`}):(0,Z.jsx)(cE,{scenario:`existing-repo`}),t[8]=a,t[9]=_);let v;t[10]!==u||t[11]!==f||t[12]!==d?(v=d||f||u.length>0?(0,Z.jsx)(yE,{templates:u,loading:d,error:f,onSelect:vE}):null,t[10]=u,t[11]=f,t[12]=d,t[13]=v):v=t[13];let y,b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(tn,{"aria-hidden":`true`,className:`size-3`}),b=(0,Z.jsx)(J,{id:`IajAbS`}),t[14]=y,t[15]=b):(y=t[14],b=t[15]);let x;t[16]===r?x=t[17]:(x=(0,Z.jsxs)(X,{onClick:r,variant:`link-muted`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider`,children:[y,b]}),t[16]=r,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(X,{variant:`link-muted`,className:`justify-end`,size:`sm`,onClick:_E,children:(0,Z.jsx)(J,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Jn,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=S):S=t[18];let C;t[19]===x?C=t[20]:(C=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[x,S]}),t[19]=x,t[20]=C);let w;t[21]!==C||t[22]!==v?(w=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[v,C]}),t[21]=C,t[22]=v,t[23]=w):w=t[23];let T;return t[24]!==w||t[25]!==g||t[26]!==_?(T=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[g,_,w]}),t[24]=w,t[25]=g,t[26]=_,t[27]=T):T=t[27],T}function _E(){return mE({initialDir:``})}function vE(e,t){return mE({template:{folder:e,name:t}})}function yE(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=Dt(),s;t[0]===o?s=t[1]:(s=o({id:`_8quCH`}),t[0]=o,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`_8quCH`})}),t[2]=c):c=t[2];let l;t[3]!==o||t[4]!==i||t[5]!==r||t[6]!==n?(l=r||i?null:(0,Z.jsx)(Ud,{className:`text-2xs`,variant:`gray`,"aria-label":o({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=o,t[4]=i,t[5]=r,t[6]=n,t[7]=l):l=t[7];let u;t[8]===l?u=t[9]:(u=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,l]}),t[8]=l,t[9]=u);let d;t[10]===o?d=t[11]:(d=o({id:`irFGwu`}),t[10]=o,t[11]=d);let f;t[12]!==i||t[13]!==r||t[14]!==a||t[15]!==n?(f=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(J,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(bE,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>a(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=i,t[13]=r,t[14]=a,t[15]=n,t[16]=f):f=t[16];let p;t[17]!==r||t[18]!==d||t[19]!==f?(p=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":d,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:f})}),t[17]=r,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;return t[21]!==s||t[22]!==u||t[23]!==p?(m=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex w-full flex-col gap-3`,children:[u,p]}),t[21]=s,t[22]=u,t[23]=p,t[24]=m):m=t[24],m}function bE(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=Dt(),o;t[0]!==n.name||t[1]!==n.title?(o=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=o):o=t[2];let s=o,c=`${n.name}.md`,l=n.source_folder===``,u;t[3]!==a||t[4]!==s||t[5]!==c||t[6]!==l||t[7]!==r?(u=a(l?{id:`89TtiD`,values:{displayTitle:s,fileName:c}}:{id:`0_J12R`,values:{displayTitle:s,fileName:c,targetLabel:r}}),t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=r,t[8]=u):u=t[8];let d=u,f;t[9]===s?f=t[10]:(f=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:s}),t[9]=s,t[10]=f);let p;t[11]===c?p=t[12]:(p=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:c}),t[11]=c,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h=`shrink-0 font-mono text-1sm ${l?`text-muted-foreground/70`:`text-muted-foreground`}`,g;t[16]!==h||t[17]!==r?(g=(0,Z.jsx)(`span`,{className:h,children:r}),t[16]=h,t[17]=r,t[18]=g):g=t[18];let _;return t[19]!==d||t[20]!==i||t[21]!==m||t[22]!==g?(_=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,onClick:i,"aria-label":d,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-none p-4 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50`,children:[m,g]}),t[19]=d,t[20]=i,t[21]=m,t[22]=g,t[23]=_):_=t[23],_}function xE(e){let t=(0,$.c)(25),{terminalDock:n}=e,r=n===void 0?null:n,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(void 0),m,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{let e=!1,t=async function(){try{let{ok:t,body:n}=await Td();if(e)return;let r=t?Vi.safeParse(n):null;r?.success?(l(wE(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=_d(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(p.current)}},h=[],t[0]=m,t[1]=h):(m=t[0],h=t[1]),(0,Q.useEffect)(m,h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){clearTimeout(p.current),p.current=setTimeout(()=>d(CE),500),Td().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=Vi.safeParse(n);r.success&&l(wE(r.data.documents))}).catch(SE)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r!==null){let e=r===`bottom`?`justify-end`:`justify-center`,n;t[4]===e?n=t[5]:(n=Y(`@container/emptystate flex min-h-0 flex-1 flex-col items-center pb-8 pt-10`,e),t[4]=e,t[5]=n);let i;t[6]!==u||t[7]!==y||t[8]!==v?(i=v?(0,Z.jsx)(TE,{isOnboarding:y,celebrateSignal:u}):null,t[6]=u,t[7]=y,t[8]=v,t[9]=i):i=t[9];let a;t[10]===i?a=t[11]:(a=(0,Z.jsx)(`div`,{className:`flex w-full flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:i}),t[10]=i,t[11]=a);let o;return t[12]!==n||t[13]!==a?(o=(0,Z.jsx)(`div`,{className:n,children:a}),t[12]=n,t[13]=a,t[14]=o):o=t[14],o}let S;t[15]!==u||t[16]!==y||t[17]!==v?(S=v?y?(0,Z.jsx)(EE,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(gE,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[15]=u,t[16]=y,t[17]=v,t[18]=S):S=t[18];let C;t[19]!==o||t[20]!==i?(C=(0,Z.jsx)(sb,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[19]=o,t[20]=i,t[21]=C):C=t[21];let w;return t[22]!==S||t[23]!==C?(w=(0,Z.jsx)(`div`,{className:`@container/emptystate flex min-h-0 flex-1 flex-col items-center overflow-y-auto subtle-scrollbar`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-1 flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:[S,C]})}),t[22]=S,t[23]=C,t[24]=w):w=t[24],w}function SE(){}function CE(e){return e+1}function wE(e){return nd(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function TE(e){let t=(0,$.c)(15),{isOnboarding:n,celebrateSignal:r}=e,{_:i}=Dt(),a=fc(),o,s,c,l;if(t[0]!==i||t[1]!==a||t[2]!==n){let{title:e,subtitle:r}=fE({isOnboarding:n,isEmbedded:a});l=`w-full max-w-5xl`,o=dE,s=i(e),c=i(r),t[0]=i,t[1]=a,t[2]=n,t[3]=o,t[4]=s,t[5]=c,t[6]=l}else o=t[3],s=t[4],c=t[5],l=t[6];let u;t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:r}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=u):u=t[11];let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(`div`,{className:l,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function EE(e){let t=(0,$.c)(29),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=Dt(),a=fc(),o,s,c,l;if(t[0]!==i||t[1]!==a){let{title:e,subtitle:n}=fE({isOnboarding:!0,isEmbedded:a});l=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,o=dE,s=i(e),c=i(n),t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c,t[5]=l}else o=t[2],s=t[3],c=t[4],l=t[5];let u;t[6]!==o||t[7]!==n||t[8]!==s||t[9]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:n}),t[6]=o,t[7]=n,t[8]=s,t[9]=c,t[10]=u):u=t[10];let d;t[11]===a?d=t[12]:(d=a?(0,Z.jsx)(TT,{scenario:`new-project`}):(0,Z.jsx)(cE,{scenario:`new-project`}),t[11]=a,t[12]=d);let f;t[13]!==i||t[14]!==a?(f=i(a?{id:`GubkSu`}:{id:`xeXS4P`}),t[13]=i,t[14]=a,t[15]=f):f=t[15];let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(OE,{label:f}),t[16]=f,t[17]=p);let m;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`okf`,`entity-vault`],t[18]=m):m=t[18];let h;t[19]===r?h=t[20]:(h=(0,Z.jsx)(tb,{onPackSelect:r,onCreateBlankFile:DE,collapsedPackIds:m}),t[19]=r,t[20]=h);let g;t[21]!==p||t[22]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[p,h]}),t[21]=p,t[22]=h,t[23]=g):g=t[23];let _;return t[24]!==g||t[25]!==l||t[26]!==u||t[27]!==d?(_=(0,Z.jsxs)(`div`,{className:l,children:[u,d,g]}),t[24]=g,t[25]=l,t[26]=u,t[27]=d,t[28]=_):_=t[28],_}function DE(){return mE()}function OE(e){let t=(0,$.c)(13),{label:n}=e,{_:r}=Dt(),i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`jAMpHn`}),t[2]=r,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(cl,{className:`size-3.5`,"aria-hidden":!0}),t[4]=o):o=t[4];let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(_n,{className:`text-muted-foreground transition-colors hover:text-foreground`,"aria-label":a,"data-testid":`starter-pack-info`,children:o}),t[5]=a,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(vn,{className:`max-w-xs`,children:(0,Z.jsx)(`p`,{className:`leading-relaxed wrap-break-word`,children:(0,Z.jsx)(J,{id:`k4CuuV`})})}),t[7]=c):c=t[7];let l;t[8]===s?l=t[9]:(l=(0,Z.jsxs)(bn,{children:[s,c]}),t[8]=s,t[9]=l);let u;return t[10]!==i||t[11]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[i,l]}),t[10]=i,t[11]=l,t[12]=u):u=t[12],u}function kE(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function AE(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=Dt(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)(ME,{}),(0,Z.jsx)(jp,{className:`h-7 w-full`}),(0,Z.jsx)(jp,{className:`h-7 w-full`}),(0,Z.jsx)(jp,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(J,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.frontmatterLocal?f=t[4]:(f=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=f);let p=f,m;t[5]===r.data.folder.path?m=t[6]:(m=kE(r.data.folder.path),t[5]=r.data.folder.path,t[6]=m);let h=m,g;t[7]===p?g=t[8]:(g=Object.keys(p),t[7]=p,t[8]=g);let _=g,v;t[9]!==a||t[10]!==n||t[11]!==i?(v=async function(e,t){let r=await kc(n,{[e]:t});if(!r.ok){let{error:e}=r;Mu.error(a({id:`xXo8FT`,values:{error:e}}));return}i()},t[9]=a,t[10]=n,t[11]=i,t[12]=v):v=t[12];let y=v,b;t[13]!==a||t[14]!==n||t[15]!==i?(b=async function(e){let t=await kc(n,{[e]:null});if(!t.ok){let{error:e}=t;Mu.error(a({id:`ZU8VV_`,values:{error:e}}));return}i()},t[13]=a,t[14]=n,t[15]=i,t[16]=b):b=t[16];let x=b,S;t[17]!==y||t[18]!==p?(S=function(e,t){let n=p[e];y(e,Ro(n,t))},t[17]=y,t[18]=p,t[19]=S):S=t[19];let C=S,w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){l({name:``,type:`text`,value:``,error:null}),s(!1)},t[20]=w):w=t[20];let T=w,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){l(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Yo[e];return{...t,type:e,value:n,error:null}})},t[21]=E):E=t[21];let D=E,O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){l(t=>t&&{...t,value:e})},t[22]=O):O=t[22];let k=O,A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(t=>t&&{...t,name:e,error:null})},t[23]=A):A=t[23];let j=A,M;t[24]!==a||t[25]!==c||t[26]!==n||t[27]!==i||t[28]!==p?(M=async function(e){if(!c)return;let t=e??c.value,r=c.name.trim();if(!r){l({...c,value:t,error:a({id:`8_brI5`})});return}if(Ni(t)){l({...c,value:t,error:a({id:`hXUWyd`})});return}if(Object.hasOwn(p,r)){l({...c,value:t,error:a({id:`CTJLpz`,values:{trimmed:r}})});return}let o=await kc(n,{[r]:t});if(!o.ok){l({...c,value:t,error:o.error});return}l(null),i()},t[24]=a,t[25]=c,t[26]=n,t[27]=i,t[28]=p,t[29]=M):M=t[29];let N=M,P;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){d({key:e,draft:e,error:null})},t[30]=P):P=t[30];let F=P,I;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){d(t=>t&&{...t,draft:e,error:null})},t[31]=I):I=t[31];let L=I,R;t[32]!==a||t[33]!==n||t[34]!==i||t[35]!==p||t[36]!==u?(R=async function(){if(!u)return;let e=u.draft.trim();if(!e){d({...u,error:a({id:`8_brI5`})});return}if(e===u.key){d(null);return}if(Object.hasOwn(p,e)){d({...u,error:a({id:`CTJLpz`,values:{trimmed:e}})});return}let t=p[u.key],r=await kc(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},t[32]=a,t[33]=n,t[34]=i,t[35]=p,t[36]=u,t[37]=R):R=t[37];let z=R,B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){d(null)},t[38]=B):B=t[38];let V=B,H=!o,U;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>s(!e),t[39]=U):U=t[39];let ee=`size-3 transition-transform ${o?``:`rotate-90`}`,W;t[40]===ee?W=t[41]:(W=(0,Z.jsx)(es,{className:ee,"aria-hidden":!0}),t[40]=ee,t[41]=W);let te;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`vQIVHc`})}),t[42]=te):te=t[42];let G;t[43]===W?G=t[44]:(G=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[W,te]}),t[43]=W,t[44]=G);let ne;t[45]===h?ne=t[46]:(ne=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:jE,children:h}),t[45]=h,t[46]=ne);let K;t[47]!==G||t[48]!==ne?(K=(0,Z.jsxs)(Sn,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[G,ne]}),t[47]=G,t[48]=ne,t[49]=K):K=t[49];let q;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hSBIG-`})}),t[50]=q):q=t[50];let re;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(re=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(qo,{keyName:e,value:t,declared:Ho(t,ia(t)),rename:{state:u?.key===e?u:null,onBegin:()=>F(e),onChangeDraft:L,onCommit:z,onCancel:V},badge:null,onCommit:t=>void y(e,t),onChangeType:t=>C(e,t),onRemove:()=>void x(e)},e)}),t[51]=c,t[52]=y,t[53]=z,t[54]=_,t[55]=p,t[56]=x,t[57]=u,t[58]=C,t[59]=re):re=t[59];let ie;t[60]!==c||t[61]!==N?(ie=c?(0,Z.jsx)(Wo,{draft:c,onChangeName:j,onChangeType:D,onChangeValue:k,onCommit:e=>void N(e),onCancel:()=>l(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>T(),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(tn,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=ie):ie=t[62];let ae;t[63]!==re||t[64]!==ie?(ae=(0,Z.jsx)(xn,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[q,re,ie]})}),t[63]=re,t[64]=ie,t[65]=ae):ae=t[65];let oe;return t[66]!==H||t[67]!==K||t[68]!==ae?(oe=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Cn,{open:H,onOpenChange:U,children:[K,ae]})}),t[66]=H,t[67]=K,t[68]=ae,t[69]=oe):oe=t[69],oe}function jE(e){return e.stopPropagation()}function ME(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(b_,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function NE(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?zu._({id:`xOTzt5`}):t<3600?zu._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?zu._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?zu._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function PE(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function FE(e){let t=e.message,n=t.indexOf(`: `),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+2);switch(r){case`template-create`:return{Icon:Ks,label:zu._({id:`QR5SP1`}),detail:PE(i)};case`template-edit`:return{Icon:hc,label:zu._({id:`-LHLx7`}),detail:PE(i)};case`template-delete`:return{Icon:Tu,label:zu._({id:`_gkGSK`}),detail:PE(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:Qg,label:zu._({id:`KPW5WC`}),detail:`${PE(e??``)} → ${PE(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:b_,label:zu._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:b_,label:zu._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:b_,label:zu._({id:`ZQLDTl`}),detail:``};default:return{Icon:Fc,label:r.replace(/-/g,` `),detail:PE(i)}}}function IE(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?zu._({id:`B2DrPb`}):e.author||zu._({id:`Ef7StM`})}function LE(e){let t=(0,$.c)(15),{folderPath:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(!1),u,d;if(t[1]===n?(u=t[2],d=t[3]):(u=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){l(!0),s(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),l(!1),s(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),l(!0),s(!1))}};s(!0),t();let r=wd(t);return()=>{e=!0,r()}},d=[n],t[1]=n,t[2]=u,t[3]=d),(0,Q.useEffect)(u,d),c||!o&&i.length===0)return null;let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`XJOV1Y`})}),t[4]=f):f=t[4];let p;t[5]===i.length?p=t[6]:(p=i.length>0?(0,Z.jsx)(Ud,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=p);let m;t[7]===p?m=t[8]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[f,p]}),t[7]=p,t[8]=m);let h;t[9]!==i||t[10]!==o?(h=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:o?(0,Z.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-busy":`true`,children:[(0,Z.jsx)(jp,{className:`h-8 w-full`}),(0,Z.jsx)(jp,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(RE)})}),t[9]=i,t[10]=o,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==h?(g=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function RE(e){let{Icon:t,label:n,detail:r}=FE(e);return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm`,children:[(0,Z.jsx)(t,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:n}),r?(0,Z.jsx)(`code`,{className:`ml-1.5 font-mono text-xs text-muted-foreground`,children:r}):null]}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(pv,{className:`size-3`,"aria-hidden":!0}),IE(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:NE(e.timestamp)})]},e.sha)}function zE(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function BE(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=zE(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function VE(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function HE(e,t){let n=e===``?``:`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:BE(e,t.pageTitles)})),i=[...t.pages].filter(e=>e.startsWith(n)).map(e=>({docName:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({docName:e,rel:n})=>{let r=t.pageMeta.get(e);return{kind:`file`,path:e,name:n,title:VE(e,n,t.pageTitles),size:r?.size??0,modified:r?.modified??``}}),a=[...r,...i].sort((e,t)=>e.kind===t.kind?e.title.localeCompare(t.title)||e.name.localeCompare(t.name):e.kind===`folder`?-1:1);return{title:BE(e,t.pageTitles),children:a}}function UE(e){let t=(0,$.c)(41),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-QCLWk`})})}),(0,Z.jsx)(jp,{className:`h-12 w-full`}),(0,Z.jsx)(jp,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(J,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.folder.templates_available?f=t[4]:(f=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-QCLWk`})}),t[5]=m):m=t[5];let h;t[6]===p.length?h=t[7]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,(0,Z.jsx)(Ud,{className:`text-xs`,variant:`secondary`,children:p.length})]}),t[6]=p.length,t[7]=h);let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(X,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>d(!0),children:[(0,Z.jsx)(tn,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(J,{id:`G1Gw0v`})]}),t[8]=g):g=t[8];let _;t[9]===h?_=t[10]:(_=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[h,g]}),t[9]=h,t[10]=_);let v;t[11]===p?v=t[12]:(v=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:p.map(e=>(0,Z.jsx)(Rs,{template:e,onCreate:()=>l(e.name),onEdit:()=>Ac(ze(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(Io,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=p,t[12]=v);let y;t[13]!==_||t[14]!==v?(y=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[_,v]}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||s(null)},t[16]=b):b=t[16];let x;t[17]!==o||t[18]!==i?(x=(0,Z.jsx)(Bs,{template:o,onOpenChange:b,onDeleted:i}),t[17]=o,t[18]=i,t[19]=x):x=t[19];let S;t[20]===p?S=t[21]:(S=new Set(p.map(WE)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),Ac(ze(n,e))},t[22]=n,t[23]=i,t[24]=C):C=t[24];let w;t[25]!==n||t[26]!==u||t[27]!==S||t[28]!==C?(w=(0,Z.jsx)(js,{folderPath:n,existingNames:S,open:u,onOpenChange:d,onCreated:C}),t[25]=n,t[26]=u,t[27]=S,t[28]=C,t[29]=w):w=t[29];let T=c!==null,E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||l(null)},t[30]=E):E=t[30];let D=c??void 0,O;t[31]!==a||t[32]!==n||t[33]!==T||t[34]!==D?(O=(0,Z.jsx)(Ny,{open:T,onOpenChange:E,kind:`file`,initialDir:n,initialTemplate:D,folderConfig:a}),t[31]=a,t[32]=n,t[33]=T,t[34]=D,t[35]=O):O=t[35];let k;return t[36]!==w||t[37]!==O||t[38]!==y||t[39]!==x?(k=(0,Z.jsxs)(Z.Fragment,{children:[y,x,w,O]}),t[36]=w,t[37]=O,t[38]=y,t[39]=x,t[40]=k):k=t[40],k}function WE(e){return e.name}function GE(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Y(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Y(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function KE(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qE(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function JE(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=Y(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function YE(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=Y(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function XE(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ZE(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return zu._({id:`xOTzt5`});if(r<60)return zu._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return zu._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?zu._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function QE(e,t,n){return[...e].sort((e,r)=>{if(e.kind!==r.kind)return e.kind===`folder`?-1:1;let i=0;switch(t){case`name`:i=e.title.localeCompare(r.title)||e.name.localeCompare(r.name);break;case`modified`:{let t=e.kind===`file`?e.modified:``,n=r.kind===`file`?r.modified:``;i=t.localeCompare(n);break}}return n===`asc`?i:-i})}function $E(e){let t=(0,$.c)(10),{label:n,sortKey:r,activeKey:i,activeDir:a,onSort:o}=e,s=i===r,c;t[0]!==o||t[1]!==r?(c=()=>o(r),t[0]=o,t[1]=r,t[2]=c):c=t[2];let l;t[3]!==a||t[4]!==s?(l=s?a===`asc`?(0,Z.jsx)(sr,{className:`ml-1 size-3`}):(0,Z.jsx)(rr,{className:`ml-1 size-3`}):(0,Z.jsx)($g,{className:`ml-1 size-3 text-muted-foreground/50`}),t[3]=a,t[4]=s,t[5]=l):l=t[5];let u;return t[6]!==n||t[7]!==c||t[8]!==l?(u=(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`-ml-3 h-8 uppercase font-mono`,onClick:c,children:[n,l]}),t[6]=n,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function eD(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=Dt(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=rs(),l=Ws(n),{state:u,refresh:d}=l,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(`name`),[g,_]=(0,Q.useState)(`asc`);if(a){let e;t[0]===r?e=t[1]:(e=r({id:`X9VpsP`}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(jp,{className:`size-5 rounded`}),(0,Z.jsx)(jp,{className:`h-7 w-48`})]}),(0,Z.jsx)(jp,{className:`h-9 w-20 rounded-md`})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(jp,{className:`h-4 w-16`}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[n,(0,Z.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 border-b px-4 py-3`,children:[i,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(jp,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(rD)]})]}),t[4]=a):a=t[4];let o;return t[5]===e?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":e,children:a}),t[5]=e,t[6]=o),o}let v,y,b,x,S,C,w,T,E,D,O;if(t[7]!==r||t[8]!==u||t[9]!==l||t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==s||t[14]!==o||t[15]!==d||t[16]!==g||t[17]!==m){let e=HE(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=QE(e.children,m,g),f=e.title||(n===``?r({id:`3aeN7X`}):e.title),k;t[29]===m?k=t[30]:(k=function(e){e===m?_(nD):(h(e),_(`asc`))},t[29]=m,t[30]=k);let A=k;O=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,C=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(Dc,{className:`size-5 text-muted-foreground`}),t[31]=j):j=t[31];let M=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:f})]}),N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(X,{onClick:()=>p(!0),children:[(0,Z.jsx)(tn,{className:`size-4`}),(0,Z.jsx)(J,{id:`isRobC`})]}),t[32]=N):N=t[32],t[33]===M?w=t[34]:(w=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[M,N]})}),t[33]=M,t[34]=w),t[35]!==u||t[36]!==n||t[37]!==d?(T=(0,Z.jsx)(AE,{folderPath:n,state:u,onChange:d}),t[35]=u,t[36]=n,t[37]=d,t[38]=T):T=t[38],t[39]!==u||t[40]!==l||t[41]!==n||t[42]!==d?(E=(0,Z.jsx)(UE,{folderPath:n,state:u,onChange:d,folderConfigHandle:l}),t[39]=u,t[40]=l,t[41]=n,t[42]=d,t[43]=E):E=t[43],t[44]===n?D=t[45]:(D=(0,Z.jsx)(LE,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=GE;let P=m===`name`?g===`asc`?`ascending`:`descending`:`none`,F;t[46]===r?F=t[47]:(F=r({id:`6YtxFj`}),t[46]=r,t[47]=F);let I;t[48]!==A||t[49]!==g||t[50]!==m||t[51]!==F?(I=(0,Z.jsx)($E,{label:F,sortKey:`name`,activeKey:m,activeDir:g,onSort:A}),t[48]=A,t[49]=g,t[50]=m,t[51]=F,t[52]=I):I=t[52];let L;t[53]!==P||t[54]!==I?(L=(0,Z.jsx)(YE,{"aria-sort":P,children:I}),t[53]=P,t[54]=I,t[55]=L):L=t[55];let R=m===`modified`?g===`asc`?`ascending`:`descending`:`none`,z;t[56]===r?z=t[57]:(z=r({id:`tgWuMB`}),t[56]=r,t[57]=z);let B;t[58]!==A||t[59]!==g||t[60]!==m||t[61]!==z?(B=(0,Z.jsx)($E,{label:z,sortKey:`modified`,activeKey:m,activeDir:g,onSort:A}),t[58]=A,t[59]=g,t[60]=m,t[61]=z,t[62]=B):B=t[62];let V;t[63]!==R||t[64]!==B?(V=(0,Z.jsx)(YE,{className:`w-32`,"aria-sort":R,children:B}),t[63]=R,t[64]=B,t[65]=V):V=t[65],t[66]!==L||t[67]!==V?(x=(0,Z.jsx)(KE,{children:(0,Z.jsxs)(JE,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=qE,b=a.length?a.map(tD):(0,Z.jsx)(JE,{children:(0,Z.jsx)(XE,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Pkw7J9`})})}),t[7]=r,t[8]=u,t[9]=l,t[10]=n,t[11]=i,t[12]=c,t[13]=s,t[14]=o,t[15]=d,t[16]=g,t[17]=m,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O}else v=t[18],y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28];let k;t[69]!==v||t[70]!==b?(k=(0,Z.jsx)(v,{children:b}),t[69]=v,t[70]=b,t[71]=k):k=t[71];let A;t[72]!==y||t[73]!==k||t[74]!==x?(A=(0,Z.jsxs)(y,{children:[x,k]}),t[72]=y,t[73]=k,t[74]=x,t[75]=A):A=t[75];let j;t[76]!==A||t[77]!==S?(j=(0,Z.jsx)(`div`,{className:S,children:A}),t[76]=A,t[77]=S,t[78]=j):j=t[78];let M;t[79]!==j||t[80]!==C||t[81]!==w||t[82]!==T||t[83]!==E||t[84]!==D?(M=(0,Z.jsxs)(`div`,{className:C,children:[w,T,E,D,j]}),t[79]=j,t[80]=C,t[81]=w,t[82]=T,t[83]=E,t[84]=D,t[85]=M):M=t[85];let N;t[86]!==M||t[87]!==O?(N=(0,Z.jsx)(`div`,{className:O,children:M}),t[86]=M,t[87]=O,t[88]=N):N=t[88];let P;t[89]!==f||t[90]!==l||t[91]!==n?(P=(0,Z.jsx)(Ny,{open:f,onOpenChange:p,kind:`file`,initialDir:n,folderConfig:l,suggestedName:`index`}),t[89]=f,t[90]=l,t[91]=n,t[92]=P):P=t[92];let F;return t[93]!==N||t[94]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[93]=N,t[94]=P,t[95]=F):F=t[95],F}function tD(e){return(0,Z.jsxs)(JE,{children:[(0,Z.jsx)(XE,{children:(0,Z.jsxs)(`a`,{href:Bd(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Z.jsx)(S_,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Ve,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(XE,{className:`text-muted-foreground`,children:e.kind===`file`?ZE(e.modified):`—`})]},e.path)}function nD(e){return e===`asc`?`desc`:`asc`}function rD(e){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 last:border-b-0`,children:[(0,Z.jsx)(jp,{className:`size-4 rounded`}),(0,Z.jsx)(jp,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(jp,{className:`h-4 w-16`})})]},e)}function iD(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l,u;t[0]===o?(l=t[1],u=t[2]):(l=()=>{o?s.current?.focus():c.current?.focus()},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(g_,{className:`size-9`,"aria-hidden":`true`})}),t[3]=d):d=t[3];let f=o?void 0:-1,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(J,{id:`P3hnm0`}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsx)(`h2`,{ref:c,id:`large-file-title`,tabIndex:f,className:`text-2xl font-light text-balance outline-none`,children:p}),t[5]=f,t[6]=m);let h;t[7]===r?h=t[8]:(h=uo(r),t[7]=r,t[8]=h);let g;t[9]===i?g=t[10]:(g=uo(i),t[9]=i,t[10]=g);let _;t[11]!==n||t[12]!==h||t[13]!==g?(_=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`GJH-AT`,values:{0:h,1:g,docName:n}})}),t[11]=n,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==o?(y=o?(0,Z.jsxs)(X,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(Zn,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=y):y=t[20];let b;return t[21]!==v||t[22]!==y?(b=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[d,v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23],b}function aD(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(oD),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>P(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let s;t[2]===n?s=t[3]:(s=function(){Ge(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(J,{id:`dEgA5A`}),t[5]=u):u=t[5];let d;return t[6]===c?d=t[7]:(d=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[l,(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:c,children:u})]}),t[6]=c,t[7]=d),d}function oD(){return new Set}function sD(e){let t=(0,$.c)(20),{nav:n}=e,{state:r,refetch:i}=bc(n),a=(0,Q.useRef)(null),o=n.branch,s,c;t[0]===r.phase?(s=t[1],c=t[2]):(s=()=>{r.phase===`resolved`&&a.current?.querySelector(`button`)?.focus()},c=[r.phase],t[0]=r.phase,t[1]=s,t[2]=c),(0,Q.useEffect)(s,c);let l;t[3]===n.path?l=t[4]:(l=function(){window.location.hash=Ad(xc(n.path))},t[3]=n.path,t[4]=l);let u=l,d;t[5]!==o||t[6]!==n.kind?(d=function(e){Sc.arm({kind:n.kind,path:e,branch:o}),window.location.hash=n.kind===`folder`?Ad(e):Bd(e)},t[5]=o,t[6]=n.kind,t[7]=d):d=t[7];let f=d,p=r.phase===`pending`?`polite`:void 0,m=r.phase===`resolved`?r.resolution.verdict:void 0,h=r.phase===`pending`?`flex h-full flex-col items-center justify-center gap-3 p-8 text-center text-sm text-muted-foreground`:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,g;t[8]!==u||t[9]!==n||t[10]!==f||t[11]!==i||t[12]!==r?(g=(0,Z.jsx)(wc,{nav:n,state:r,onBrowseFolder:u,onOpenRenamed:f,onEnableAutoSync:u,onSyncCompleted:i,onPullApplied:i}),t[8]=u,t[9]=n,t[10]=f,t[11]=i,t[12]=r,t[13]=g):g=t[13];let _;return t[14]!==r.phase||t[15]!==p||t[16]!==m||t[17]!==h||t[18]!==g?(_=(0,Z.jsx)(`div`,{ref:a,role:`status`,"aria-live":p,"data-testid":`share-receive-miss-panel`,"data-phase":r.phase,"data-verdict":m,className:h,children:g}),t[14]=r.phase,t[15]=p,t[16]=m,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}var cD=e(Xt(),1);function lD(e){let t=(0,$.c)(9),{text:n}=e,r;t[0]===n?r=t[1]:(r=io(n),t[0]=n,t[1]=r);let{map:i}=r,a,o;if(t[2]!==i||t[3]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Ja(n),r=e.length>0?e:Object.keys(i);if(r.length===0){o=null;break bb0}let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(J,{id:`l_UFPv`}),t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=(e,t)=>{let n=i[e];return n===void 0?null:(0,Z.jsx)(uD,{keyName:e,value:n},`${e}-${t}`)},t[7]=i,t[8]=c),a=(0,Z.jsx)(Ko,{title:s,count:r.length,testId:`readonly-property-panel`,className:`pt-4`,children:r.map(c)})}t[2]=i,t[3]=n,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function uD(e){let t=(0,$.c)(12),{keyName:n,value:r}=e,i=Lo[ia(r)],a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground`,children:(0,Z.jsx)(i,{className:`size-3.5`})}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`span`,{className:`flex h-7 w-32 shrink-0 items-center truncate px-2 text-sm text-muted-foreground`,children:n}),t[2]=n,t[3]=o);let s;t[4]!==n||t[5]!==r?(s=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(dD,{keyName:n,value:r})}),t[4]=n,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==n||t[8]!==a||t[9]!==o||t[10]!==s?(c=(0,Z.jsxs)(`div`,{className:`group flex items-start gap-1 py-0.5`,"data-testid":`readonly-property-row`,"data-key":n,children:[a,o,s]}),t[7]=n,t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function dD(e){let t=(0,$.c)(8),{keyName:n,value:r}=e;if(Go(r)){let e;return t[0]!==n||t[1]!==r?(e=(0,Z.jsx)(Vo,{keyName:n,value:r}),t[0]=n,t[1]=r,t[2]=e):e=t[2],e}let i;t[3]===r?i=t[4]:(i=Array.isArray(r)?r.filter(fD).join(`, `):String(r),t[3]=r,t[4]=i);let a=i,o;return t[5]!==a||t[6]!==n?(o=(0,Z.jsx)(`div`,{className:`flex min-h-7 items-center px-2 py-1 text-sm break-words`,"data-testid":`readonly-property-value`,"data-key":n,children:a}),t[5]=a,t[6]=n,t[7]=o):o=t[7],o}function fD(e){return typeof e==`string`}function pD(e){let t=(0,$.c)(29),{fileName:n,text:r}=e,i,a,o,s;if(t[0]!==r){let e=Oa(r).body;s=ar,i=Ye,a=!1,o=Mn().parseWithFallback(e),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c={attributes:{class:`pt-4`}},t[5]=c):c=t[5];let l;t[6]!==i||t[7]!==a||t[8]!==o?(l={extensions:i,editable:a,content:o,editorProps:c},t[6]=i,t[7]=a,t[8]=o,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=[r],t[10]=r,t[11]=u);let d=s(l,u),[f]=(0,Q.useState)(mD),p=(0,Q.useRef)(null),m,h;t[12]===f?(m=t[13],h=t[14]):(m=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},h=[f],t[12]=f,t[13]=m,t[14]=h),(0,Q.useLayoutEffect)(m,h);let g;t[15]===r?g=t[16]:(g=(0,Z.jsx)(lD,{text:r}),t[15]=r,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}})}),t[17]=_):_=t[17];let v;t[18]===g?v=t[19]:(v=(0,Z.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto`,children:[g,_]}),t[18]=g,t[19]=v);let y;t[20]===d?y=t[21]:(y=(0,Z.jsx)(Ln,{editor:d,className:`tiptap-editor-portal-content h-full`}),t[20]=d,t[21]=y);let b;t[22]!==f||t[23]!==y?(b=(0,cD.createPortal)(y,f),t[22]=f,t[23]=y,t[24]=b):b=t[24];let x;return t[25]!==n||t[26]!==v||t[27]!==b?(x=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:[v,b]}),t[25]=n,t[26]=v,t[27]=b,t[28]=x):x=t[28],x}function mD(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var hD=`data-skill-markdown`;function gD(e){let t=(0,$.c)(12),{scope:n,name:r,path:i,fileName:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==n?(o={loadText:e=>am({scope:n,name:r,path:i},e)},t[0]=r,t[1]=i,t[2]=n,t[3]=o):o=t[3];let s=Gp(o);if(s.status===`loading`){let e;return t[4]===a?e=t[5]:(e=(0,Z.jsx)(Up,{fileName:a,dataAttr:hD}),t[4]=a,t[5]=e),e}if(s.status===`error`){let e;return t[6]!==s.message||t[7]!==a?(e=(0,Z.jsx)(Bp,{fileName:a,dataAttr:hD,message:s.message}),t[6]=s.message,t[7]=a,t[8]=e):e=t[8],e}let c;return t[9]!==s.content||t[10]!==a?(c=(0,Z.jsx)(pD,{fileName:a,text:s.content}),t[9]=s.content,t[10]=a,t[11]=c):c=t[11],c}var _D=new Set([`md`,`mdx`]);function vD(e){let t=(0,$.c)(19),{scope:n,name:r,path:i}=e,a;t[0]===i?a=t[1]:(a=i.split(`/`).pop()??i,t[0]=i,t[1]=a);let o=a,s=o.lastIndexOf(`.`),c,l;if(t[2]!==s||t[3]!==o?(c=s>=0?o.slice(s+1).toLowerCase():``,l=_D.has(c),t[2]=s,t[3]=o,t[4]=c,t[5]=l):(c=t[4],l=t[5]),l){let e;return t[6]!==o||t[7]!==r||t[8]!==i||t[9]!==n?(e=(0,Z.jsx)(gD,{scope:n,name:r,path:i,fileName:o}),t[6]=o,t[7]=r,t[8]=i,t[9]=n,t[10]=e):e=t[10],e}let u;t[11]!==r||t[12]!==i||t[13]!==n?(u=e=>am({scope:n,name:r,path:i},e),t[11]=r,t[12]=i,t[13]=n,t[14]=u):u=t[14];let d;return t[15]!==c||t[16]!==o||t[17]!==u?(d=(0,Z.jsx)(Vp,{fileName:o,extension:c,loadText:u}),t[15]=c,t[16]=o,t[17]=u,t[18]=d):d=t[18],d}function yD(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var bD=yD(()=>n(()=>import(`./SettingsDialogBody-Chz13SZG.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([111,1,112,17,12,6,2,3,7,8,9,85,68,22,11,86,87,88,47,10,89,30,31,14,15,16,19,49,24,25,29,18,20,36,13,21,35,23,26,27,113,114,50,93,115,90,116,117,48,51,73,74,75,76,77,78,79,80,81,82,83,84,4,91,37,38,40,61,62,63,43,65,92,28,32,60,64,66,67,94,95,96,97,33,98,99,100,101,39,41,102,103,118,59,119,106,120,121,122,107,123,44,124,125,126,127,128,129,42,130,131,132,133,134,135,136,137,138,139]),import.meta.url));function xD(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=Dt(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(J,{id:`hwFOFD`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[o,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:a})]}),t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(X,{variant:`default`,onClick:SD,children:(0,Z.jsx)(J,{id:`HpK_8d`})}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[s,c]}),t[7]=s,t[8]=l),l}function SD(){return window.location.reload()}function CD(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(sn,{fallbackRender:TD,onError:wD,children:n}),t[0]=n,t[1]=r),r}function wD(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function TD(e){return(0,Z.jsx)(xD,{...e})}function ED(e=typeof window>`u`?void 0:window.location){return e?.protocol===`file:`}function DD(e){let{groups:t,translate:n}=e,r=[],i=new Set;for(let e of t)if(e.enabled)for(let t of e.items)i.add(t.id),r.push({id:`section:${t.id}`,kind:`section`,sectionId:t.id,label:t.label,keywords:[e.label]});for(let e of Xs)if(i.has(e.sectionId))for(let t of e.fields){let i=t.path.join(`.`);r.push({id:`field:${e.sectionId}:${i}`,kind:`field`,sectionId:e.sectionId,label:n(t.label),keywords:t.description?[n(t.description)]:[],targetField:i})}if(i.has(`plugin:markdownlint`))for(let e of ba)r.push({id:`rule:${e.id}`,kind:`rule`,sectionId:`plugin:markdownlint`,label:e.name,keywords:[e.id,e.alias,...e.aliases],ruleId:e.id});return r}function OD(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function kD(e){let t=(0,$.c)(45),{open:n,initialSection:r,onOpenChange:i}=e,a=r===void 0?null:r,{_:o}=Dt(),{collabUrl:s}=ot(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d,projectConfig:f,merged:p}=wf(),{desktopPresent:m}=Ls(),[h,g]=(0,Q.useState)(a??`preferences`),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(0),w=(0,Q.useRef)(null),T,E;t[0]!==a||t[1]!==n?(T=()=>{n&&(g(a??`preferences`),v(``))},E=[n,a],t[0]=a,t[1]=n,t[2]=T,t[3]=E):(T=t[2],E=t[3]),(0,Q.useEffect)(T,E);let D,O;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>Yu(g),O=[],t[4]=D,t[5]=O):(D=t[4],O=t[5]),(0,Q.useEffect)(D,O);let k,A;t[6]===y?(k=t[7],A=t[8]):(k=()=>{if(!y)return;let e=w.current;if(!e)return;let t=null,n=null,r=null,i=null,a=()=>{let r=e.querySelector(`[data-field="${y.path}"]`);return r?(r.scrollIntoView({block:`center`}),r.classList.add(`animate-settings-nav-flash`),t=r,n=setTimeout(()=>r.classList.remove(`animate-settings-nav-flash`),750),!0):!1};return a()||(i=new MutationObserver(()=>{a()&&i?.disconnect()}),i.observe(e,{childList:!0,subtree:!0}),r=setTimeout(()=>i?.disconnect(),4e3)),()=>{i?.disconnect(),n&&clearTimeout(n),r&&clearTimeout(r),t?.classList.remove(`animate-settings-nav-flash`)}},A=[y],t[6]=y,t[7]=k,t[8]=A),(0,Q.useEffect)(k,A);let j=s!==null,M=typeof window<`u`&&window.okDesktop!=null,N=M&&window.okDesktop?.config.ptyAvailable===!0,P,F;if(t[9]!==o||t[10]!==m||t[11]!==j||t[12]!==p?.appearance?.colorThemeEnabled||t[13]!==f?.contentRules){let e;t[16]===f?.contentRules?e=t[17]:(e=e=>f?.contentRules?.[e.id]?.enabled===!0,t[16]=f?.contentRules,t[17]=e);let n=Ap.filter(e).map(AD),r=p?.appearance?.colorThemeEnabled!==!1,i=ED();P=[{id:`user`,label:o({id:`7PzzBU`}),enabled:!0,items:[{id:`preferences`,label:o({id:`Q6hhn8`})},{id:`configure-agents`,label:o({id:`jRAGrQ`})},{id:`hotkeys`,label:o({id:`4KmEoC`})},{id:`account`,label:o({id:`AeXO77`})},{id:`user-plugins-manage`,label:o({id:`ohUJJM`})},...M?[{id:`ai-tools`,label:o({id:`_5qBNl`})}]:[]]},{id:`project`,label:o({id:`ZWyHmq`}),enabled:j,items:[{id:`sync`,label:o({id:`Nu4DdT`})},{id:`search`,label:o({id:`A1taO8`})},{id:`plugins-manage`,label:o({id:`ohUJJM`})},{id:`content-rules`,label:o({id:`OPOiKn`})},...i?[]:[{id:`link-previews`,label:o({id:`gh27t1`})}],...N?[{id:`terminal`,label:o({id:`ALhMYW`})}]:[],...M?[{id:`project-ai-tools`,label:o({id:`crqzW5`})}]:[],{id:`project-templates`,label:o({id:`iTylMl`})},{id:`skills`,label:o({id:`PCSkw2`})},{id:`okignore`,label:o({id:`3zyg_A`})},{id:`sharing`,label:o({id:`cs4mps`})}]},{id:`plugins`,label:o({id:`ohUJJM`}),enabled:!0,items:[...j?n:[],...r?[{id:`plugin:theme`,label:o({id:`fJ3EbT`})}]:[]]},{id:`integrations`,label:o({id:`nbfdhU`}),enabled:!0,items:[]}],F=DD({groups:P,translate:o}),t[9]=o,t[10]=m,t[11]=j,t[12]=p?.appearance?.colorThemeEnabled,t[13]=f?.contentRules,t[14]=P,t[15]=F}else P=t[14],F=t[15];let I=F,L;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(L=function(e){C.current+=1;let t=C.current;g(e.sectionId),e.kind===`field`&&e.targetField?b({path:e.targetField}):e.kind===`rule`&&e.ruleId&&S({query:e.ruleId,nonce:t}),v(``)},t[18]=L):L=t[18];let R=L,z;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Tn,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})}),t[19]=z):z=t[19];let B;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(wn,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`RDrXh4`})}),t[20]=B):B=t[20];let V;t[21]!==h||t[22]!==P||t[23]!==I||t[24]!==_?(V=(0,Z.jsx)(jD,{groups:P,activeId:h,onSelect:g,entries:I,searchQuery:_,onSearchChange:v,onNavigate:R}),t[21]=h,t[22]=P,t[23]=I,t[24]=_,t[25]=V):V=t[25];let H;t[26]===o?H=t[27]:(H=o({id:`OXb_Df`}),t[26]=o,t[27]=H);let U;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(zD,{}),t[28]=U):U=t[28];let ee=l?c:null,W;t[29]!==h||t[30]!==u||t[31]!==d||t[32]!==x||t[33]!==ee?(W=(0,Z.jsx)(CD,{children:(0,Z.jsx)(Q.Suspense,{fallback:U,children:(0,Z.jsx)(bD,{activeId:h,userBinding:ee,okignoreBinding:u,okignoreSynced:d,markdownlintRuleQuery:x})})}),t[29]=h,t[30]=u,t[31]=d,t[32]=x,t[33]=ee,t[34]=W):W=t[34];let te;t[35]!==H||t[36]!==W?(te=(0,Z.jsx)(`section`,{ref:w,"aria-label":H,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:W}),t[35]=H,t[36]=W,t[37]=te):te=t[37];let G;t[38]!==V||t[39]!==te?(G=(0,Z.jsxs)(En,{className:`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,"data-testid":`settings-dialog`,children:[z,B,V,te]}),t[38]=V,t[39]=te,t[40]=G):G=t[40];let ne;return t[41]!==i||t[42]!==n||t[43]!==G?(ne=(0,Z.jsx)(An,{open:n,onOpenChange:i,children:G}),t[41]=i,t[42]=n,t[43]=G,t[44]=ne):ne=t[44],ne}function AD(e){return{id:`plugin:${e.id}`,label:e.label}}function jD(e){let t=(0,$.c)(46),{groups:n,activeId:r,onSelect:i,entries:o,searchQuery:s,onSearchChange:c,onNavigate:l}=e,{_:u}=Dt(),d,f,p,m,h,g,_,v,y,b;if(t[0]!==u||t[1]!==o||t[2]!==l||t[3]!==c||t[4]!==s){f=s.trim();let e=f===``?[]:o.filter(e=>py(e.label,f,e.keywords)),n=e.filter(PD),r=e.filter(ND),i=e.filter(MD);t[15]===u?y=t[16]:(y=u({id:`y1t8bQ`}),t[15]=u,t[16]=y),b=`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:min-h-0 sm:flex-col sm:gap-0 sm:overflow-x-visible sm:border-r sm:border-b-0 sm:py-4`,d=a,p=!1,m=`h-auto w-full shrink-0 bg-transparent sm:mb-3 [&_[data-slot=command-input-wrapper]]:h-9 [&_[data-slot=command-input-wrapper]]:rounded-lg [&_[data-slot=command-input-wrapper]]:border [&_[data-slot=command-input-wrapper]]:border-input`,h=`settings-search`;let x;t[17]===u?x=t[18]:(x=u({id:`1DahsC`}),t[17]=u,t[18]=x),t[19]!==c||t[20]!==s||t[21]!==x?(g=(0,Z.jsx)(st,{value:s,onValueChange:c,placeholder:x,className:`py-0`,"data-testid":`settings-search-input`}),t[19]=c,t[20]=s,t[21]=x,t[22]=g):g=t[22];let S=f===``?null:(0,Z.jsx)(J,{id:`TQJCR6`,values:{0:e.length}});t[23]===S?_=t[24]:(_=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`settings-search-result-count`,children:S}),t[23]=S,t[24]=_),v=f===``?null:(0,Z.jsxs)(_e,{"data-testid":`settings-search-results`,className:`mt-1.5`,children:[(0,Z.jsx)(ft,{"data-testid":`settings-search-empty`,children:(0,Z.jsx)(J,{id:`ljFWEt`})}),n.length>0?(0,Z.jsx)(Qe,{heading:u({id:`R4OWFD`}),children:n.map(e=>(0,Z.jsx)(FD,{entry:e,query:f,onNavigate:l},e.id))}):null,r.length>0?(0,Z.jsx)(Qe,{heading:u({id:`Tz0i8g`}),children:r.map(e=>(0,Z.jsx)(FD,{entry:e,query:f,onNavigate:l},e.id))}):null,i.length>0?(0,Z.jsx)(Qe,{heading:u({id:`v2a04T`}),children:i.map(e=>(0,Z.jsx)(FD,{entry:e,query:f,onNavigate:l},e.id))}):null]}),t[0]=u,t[1]=o,t[2]=l,t[3]=c,t[4]=s,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=y,t[14]=b}else d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14];let x;t[25]!==d||t[26]!==p||t[27]!==m||t[28]!==h||t[29]!==g||t[30]!==_||t[31]!==v?(x=(0,Z.jsxs)(d,{shouldFilter:p,className:m,"data-testid":h,children:[g,_,v]}),t[25]=d,t[26]=p,t[27]=m,t[28]=h,t[29]=g,t[30]=_,t[31]=v,t[32]=x):x=t[32];let S;t[33]!==r||t[34]!==n||t[35]!==i||t[36]!==f?(S=f===``?n.map(e=>(0,Z.jsx)(RD,{group:e,activeId:r,onSelect:i},e.id)):null,t[33]=r,t[34]=n,t[35]=i,t[36]=f,t[37]=S):S=t[37];let C;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(LD,{}),t[38]=C):C=t[38];let w;t[39]===S?w=t[40]:(w=(0,Z.jsxs)(`div`,{className:`contents subtle-scrollbar sm:flex sm:min-h-0 sm:flex-1 sm:flex-col sm:overflow-y-auto sm:overscroll-contain`,children:[S,C]}),t[39]=S,t[40]=w);let T;return t[41]!==w||t[42]!==y||t[43]!==b||t[44]!==x?(T=(0,Z.jsxs)(`nav`,{"aria-label":y,className:b,children:[x,w]}),t[41]=w,t[42]=y,t[43]=b,t[44]=x,t[45]=T):T=t[45],T}function MD(e){return e.kind===`rule`}function ND(e){return e.kind===`field`}function PD(e){return e.kind===`section`}function FD(e){let t=(0,$.c)(13),{entry:n,query:r,onNavigate:i}=e,a=n.id,o;t[0]!==n||t[1]!==i?(o=()=>i(n),t[0]=n,t[1]=i,t[2]=o):o=t[2];let s=`settings-search-result-${n.id}`,c;t[3]!==n.label||t[4]!==r?(c=uy(n.label,r).map(ID),t[3]=n.label,t[4]=r,t[5]=c):c=t[5];let l;t[6]===c?l=t[7]:(l=(0,Z.jsx)(`span`,{className:`truncate`,children:c}),t[6]=c,t[7]=l);let u;return t[8]!==n.id||t[9]!==o||t[10]!==s||t[11]!==l?(u=(0,Z.jsx)(Re,{value:a,onSelect:o,"data-testid":s,children:l}),t[8]=n.id,t[9]=o,t[10]=s,t[11]=l,t[12]=u):u=t[12],u}function ID(e){return e.match?(0,Z.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.text},e.start):(0,Z.jsx)(`span`,{children:e.text},e.start)}function LD(){let e=(0,$.c)(4),t=typeof window<`u`?window.okDesktop??null:null,n=t?.appVersion;if(!t||!n)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=OD(n),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`p`,{className:`whitespace-nowrap font-mono text-xs text-muted-foreground/70`,"data-testid":`settings-sidebar-version`,children:[`v`,n]}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{t.shell.openExternal(i)},e[2]=o):o=e[2];let s;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`div`,{className:`ml-auto shrink-0 px-2 sm:ml-0 sm:mt-auto sm:pt-3`,children:[a,(0,Z.jsxs)(`button`,{type:`button`,onClick:o,"data-testid":`settings-sidebar-release-notes`,className:Y(`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded text-xs text-muted-foreground transition-colors hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:[(0,Z.jsx)(J,{id:`_PACVa`}),(0,Z.jsx)(Mo,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function RD(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,s=n.enabled?void 0:o,c=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,l;t[0]===c?l=t[1]:(l=Y(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,c),t[0]=c,t[1]=l);let u;t[2]!==n.label||t[3]!==a||t[4]!==s||t[5]!==l?(u=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":s,className:l,children:n.label}),t[2]=n.label,t[3]=a,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==n.enabled?(d=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`px-2 text-xs italic text-muted-foreground/60 sm:mb-1`,children:(0,Z.jsx)(J,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=d):d=t[9];let f;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:Y(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],f=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=f}else f=t[15];let p;t[21]!==a||t[22]!==f?(p=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:f}),t[21]=a,t[22]=f,t[23]=p):p=t[23];let m;return t[24]!==u||t[25]!==d||t[26]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[u,d,p]}),t[24]=u,t[25]=d,t[26]=p,t[27]=m):m=t[27],m}function zD(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`GsBUCk`})}),n=(0,Z.jsx)(jp,{className:`h-5 w-32`}),r=(0,Z.jsx)(jp,{className:`h-4 w-64`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-3`,"data-testid":`settings-content-skeleton`,children:[t,n,r,(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(jp,{className:`h-9 w-full`}),(0,Z.jsx)(jp,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function BD(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(lT,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function VD(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(pT,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function HD(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Y(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(_T,{"data-slot":`resizable-handle`,className:a,...r,children:o}),t[8]=r,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function UD(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:i,replaceOpen:a,caseSensitive:o,wholeWord:s,current:c,total:l,onQueryChange:u,onReplacementChange:d,onReplaceOpenChange:f,onCaseSensitiveChange:p,onWholeWordChange:m,onNext:h,onPrevious:g,onReplaceCurrent:_,onReplaceAll:v,onClose:y}=e,{_:b}=Dt(),x=r.length>0,S=l>0,C;t[0]!==b||t[1]!==c||t[2]!==S||t[3]!==x||t[4]!==l?(C=x?S?`${c} / ${l}`:b({id:`Ev2r9A`}):``,t[0]=b,t[1]=c,t[2]=S,t[3]=x,t[4]=l,t[5]=C):C=t[5];let w=C,T;t[6]!==y||t[7]!==h||t[8]!==g?(T=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?g():h()):e.key===`Escape`&&(e.preventDefault(),y())},t[6]=y,t[7]=h,t[8]=g,t[9]=T):T=t[9];let E=T,D;t[10]!==y||t[11]!==_?(D=function(e){e.key===`Enter`?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),y())},t[10]=y,t[11]=_,t[12]=D):D=t[12];let O=D,k;t[13]===b?k=t[14]:(k=b({id:`MVxpbf`}),t[13]=b,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(J,{id:`KujtjC`})}),t[15]=A):A=t[15];let j;t[16]===u?j=t[17]:(j=e=>u(e.target.value),t[16]=u,t[17]=j);let M;t[18]===b?M=t[19]:(M=b({id:`KujtjC`}),t[18]=b,t[19]=M);let N;t[20]!==n||t[21]!==E||t[22]!==r||t[23]!==j||t[24]!==M?(N=(0,Z.jsx)(zc,{ref:n,id:`ok-find-input`,value:r,onChange:j,onKeyDown:E,placeholder:M,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=E,t[22]=r,t[23]=j,t[24]=M,t[25]=N):N=t[25];let P;t[26]===b?P=t[27]:(P=b({id:`-8PP0T`}),t[26]=b,t[27]=P);let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Xo,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(ti,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":P,pressed:o,onPressedChange:p,className:`size-6 min-w-6 px-0`,children:F})}),t[29]=o,t[30]=p,t[31]=P,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(vn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`-8PP0T`})}),t[33]=L):L=t[33];let R;t[34]===I?R=t[35]:(R=(0,Z.jsxs)(bn,{children:[I,L]}),t[34]=I,t[35]=R);let z;t[36]===b?z=t[37]:(z=b({id:`_7UQ7y`}),t[36]=b,t[37]=z);let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(mv,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(ti,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":z,pressed:s,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:B})}),t[39]=m,t[40]=z,t[41]=s,t[42]=V):V=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(vn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`_7UQ7y`})}),t[43]=H):H=t[43];let U;t[44]===V?U=t[45]:(U=(0,Z.jsxs)(bn,{children:[V,H]}),t[44]=V,t[45]=U);let ee;t[46]!==R||t[47]!==U?(ee=(0,Z.jsxs)(Gc,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=ee):ee=t[48];let W;t[49]!==ee||t[50]!==N?(W=(0,Z.jsxs)(Kc,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,ee]}),t[49]=ee,t[50]=N,t[51]=W):W=t[51];let te;t[52]===w?te=t[53]:(te=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:w}),t[52]=w,t[53]=te);let G;t[54]===b?G=t[55]:(G=b({id:`oqB2ez`}),t[54]=b,t[55]=G);let ne=!S,K;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(Yr,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=K):K=t[56];let q;t[57]!==g||t[58]!==G||t[59]!==ne?(q=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":G,disabled:ne,onClick:g,children:K})}),t[57]=g,t[58]=G,t[59]=ne,t[60]=q):q=t[60];let re;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(vn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`oqB2ez`})}),t[61]=re):re=t[61];let ie;t[62]===q?ie=t[63]:(ie=(0,Z.jsxs)(bn,{children:[q,re]}),t[62]=q,t[63]=ie);let ae;t[64]===b?ae=t[65]:(ae=b({id:`SiUUCS`}),t[64]=b,t[65]=ae);let oe=!S,se;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)($o,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=se):se=t[66];let ce;t[67]!==h||t[68]!==ae||t[69]!==oe?(ce=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ae,disabled:oe,onClick:h,children:se})}),t[67]=h,t[68]=ae,t[69]=oe,t[70]=ce):ce=t[70];let le;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(vn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`SiUUCS`})}),t[71]=le):le=t[71];let ue;t[72]===ce?ue=t[73]:(ue=(0,Z.jsxs)(bn,{children:[ce,le]}),t[72]=ce,t[73]=ue);let de=a?`secondary`:`ghost`,fe;t[74]!==b||t[75]!==a?(fe=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=fe):fe=t[76];let pe=a?`ok-replace-input`:void 0,me;t[77]!==f||t[78]!==a?(me=()=>f(!a),t[77]=f,t[78]=a,t[79]=me):me=t[79];let he;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(G_,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=he):he=t[80];let ge;t[81]!==a||t[82]!==de||t[83]!==fe||t[84]!==pe||t[85]!==me?(ge=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:de,size:`icon-sm`,"aria-label":fe,"aria-expanded":a,"aria-controls":pe,onClick:me,children:he})}),t[81]=a,t[82]=de,t[83]=fe,t[84]=pe,t[85]=me,t[86]=ge):ge=t[86];let _e;t[87]===a?_e=t[88]:(_e=(0,Z.jsx)(vn,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`UkQGhd`}):(0,Z.jsx)(J,{id:`1RluQD`})}),t[87]=a,t[88]=_e);let ve;t[89]!==ge||t[90]!==_e?(ve=(0,Z.jsxs)(bn,{children:[ge,_e]}),t[89]=ge,t[90]=_e,t[91]=ve):ve=t[91];let ye;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(ye=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(J,{id:`fqSfXY`})}),(0,Z.jsx)(Ru,{id:`ok-replace-input`,value:i,onChange:e=>d(e.target.value),onKeyDown:O,placeholder:b({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`bS_boY`}),disabled:!S,onClick:_,children:(0,Z.jsx)(G_,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(vn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`bS_boY`})})]}),(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`dr1vFs`}),disabled:!S,onClick:v,children:(0,Z.jsx)(W_,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(vn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`dr1vFs`})})]})]}):null,t[92]=b,t[93]=O,t[94]=S,t[95]=v,t[96]=_,t[97]=d,t[98]=a,t[99]=i,t[100]=ye):ye=t[100];let be;t[101]===b?be=t[102]:(be=b({id:`wJo9oS`}),t[101]=b,t[102]=be);let xe;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(ju,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=xe):xe=t[103];let Se;t[104]!==y||t[105]!==be?(Se=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":be,onClick:y,children:xe})}),t[104]=y,t[105]=be,t[106]=Se):Se=t[106];let Ce;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(vn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`yz7wBu`})}),t[107]=Ce):Ce=t[107];let we;t[108]===Se?we=t[109]:(we=(0,Z.jsxs)(bn,{children:[Se,Ce]}),t[108]=Se,t[109]=we);let Te;return t[110]!==W||t[111]!==te||t[112]!==ie||t[113]!==ue||t[114]!==k||t[115]!==ve||t[116]!==ye||t[117]!==we?(Te=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":k,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[A,W,te,ie,ue,ve,ye,we]}),t[110]=W,t[111]=te,t[112]=ie,t[113]=ue,t[114]=k,t[115]=ve,t[116]=ye,t[117]=we,t[118]=Te):Te=t[118],Te}var WD={current:0,total:0},GD=120,KD=100;function qD(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?se(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(A,n,JD)}function JD(){return null}function YD(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
7
- `,`
8
- `).trim();return i.length===0||i.length>GD||i.includes(`
9
- `)?null:i}function XD(e){let t=it(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function ZD(e,t){return e.current===t.current&&e.total===t.total}function QD(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(WD)}function $D(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=In(e);if(!t)return;let n=t.dom.querySelector(`.ok-find-match-active`);n instanceof HTMLElement&&n.scrollIntoView({block:`center`,inline:`nearest`,behavior:`auto`})})}function eO(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=qD(n),a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=(0,Q.useRef)(n),c=(0,Q.useRef)(0),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={open:!1,replaceOpen:!1,query:``,replacement:``,caseSensitive:!1,wholeWord:!1,activeIndex:0},t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(WD),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(nO))},h=[n],t[1]=n,t[2]=m,t[3]=h),(0,Q.useEffect)(m,h);let g,_;t[4]===u.activeIndex?(g=t[5],_=t[6]):(g=()=>{c.current=u.activeIndex},_=[u.activeIndex],t[4]=u.activeIndex,t[5]=g,t[6]=_),(0,Q.useEffect)(g,_);let v,y;t[7]===i?(v=t[8],y=t[9]):(v=()=>{let e=o.current;e&&e!==i&&!e.isDestroyed&&e.commands.clearFindMatches(),o.current=i},y=[i],t[7]=i,t[8]=v,t[9]=y),(0,Q.useEffect)(v,y);let b,x;t[10]===u.open?(b=t[11],x=t[12]):(b=()=>{if(!u.open||!a.current)return;let e=requestAnimationFrame(()=>{a.current?.focus(),a.current?.select()});return()=>cancelAnimationFrame(e)},x=[u.open],t[10]=u.open,t[11]=b,t[12]=x),(0,Q.useEffect)(b,x);let S,C;t[13]!==u.open||t[14]!==r?(S=()=>{!u.open||!r||d(tO)},C=[u.open,r],t[13]=u.open,t[14]=r,t[15]=S,t[16]=C):(S=t[15],C=t[16]),(0,Q.useEffect)(S,C);let w,T;t[17]!==i||t[18]!==u.caseSensitive||t[19]!==u.open||t[20]!==u.query||t[21]!==u.wholeWord||t[22]!==r?(w=()=>{if(!i||i.isDestroyed){p(WD);return}if(!u.open||r){i.commands.clearFindMatches(),p(WD);return}let e=window.setTimeout(()=>{if(i.isDestroyed)return;i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current});let e=XD(i);p(t=>ZD(t,e)?t:e)},KD);return()=>window.clearTimeout(e)},T=[i,u.open,u.query,u.caseSensitive,u.wholeWord,r],t[17]=i,t[18]=u.caseSensitive,t[19]=u.open,t[20]=u.query,t[21]=u.wholeWord,t[22]=r,t[23]=w,t[24]=T):(w=t[23],T=t[24]),(0,Q.useEffect)(w,T);let E,D;t[25]!==i||t[26]!==u.open||t[27]!==r?(E=()=>{if(!i||i.isDestroyed||!u.open||r)return;let e=()=>{let e=it(i.state),t=XD(i);p(e=>ZD(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})};return i.on(`transaction`,e),()=>{i.off(`transaction`,e)}},D=[i,u.open,r],t[25]=i,t[26]=u.open,t[27]=r,t[28]=E,t[29]=D):(E=t[28],D=t[29]),(0,Q.useEffect)(E,D);let O,k;t[30]!==n||t[31]!==i||t[32]!==u.open||t[33]!==r?(O=()=>{let e=function(e){let t=YD(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)&&!Af()){if(Zu(t,`find`)){t.preventDefault(),u.open?QD(i,d,p):e(!1);return}if(Zu(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=Zu(t,`find-next`),n=Zu(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&$D(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),QD(i,d,p))}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},k=[n,i,u.open,r],t[30]=n,t[31]=i,t[32]=u.open,t[33]=r,t[34]=O,t[35]=k):(O=t[34],k=t[35]),(0,Q.useEffect)(O,k);let A;t[36]!==i||t[37]!==u.caseSensitive||t[38]!==u.query||t[39]!==u.wholeWord?(A=function(){return!i||i.isDestroyed?!1:(i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current}),!0)},t[36]=i,t[37]=u.caseSensitive,t[38]=u.query,t[39]=u.wholeWord,t[40]=A):A=t[40];let j=A,M;t[41]===i?M=t[42]:(M=function(){if(!i||i.isDestroyed)return;let e=it(i.state),t=XD(i);p(e=>ZD(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})},t[41]=i,t[42]=M);let N=M,P;t[43]===i?P=t[44]:(P=function(){QD(i,d,p)},t[43]=i,t[44]=P);let F=P,I;t[45]!==j||t[46]!==i||t[47]!==N?(I=function(){!i||i.isDestroyed||(j(),i.commands.selectNextFindMatch()&&$D(i),N())},t[45]=j,t[46]=i,t[47]=N,t[48]=I):I=t[48];let L=I,R;t[49]!==j||t[50]!==i||t[51]!==N?(R=function(){!i||i.isDestroyed||(j(),i.commands.selectPreviousFindMatch()&&$D(i),N())},t[49]=j,t[50]=i,t[51]=N,t[52]=R):R=t[52];let z=R,B;t[53]!==j||t[54]!==i||t[55]!==u.replacement||t[56]!==N?(B=function(){!i||i.isDestroyed||(j(),i.commands.replaceCurrentFindMatch(u.replacement)&&$D(i),N())},t[53]=j,t[54]=i,t[55]=u.replacement,t[56]=N,t[57]=B):B=t[57];let V=B,H;t[58]!==j||t[59]!==i||t[60]!==u.replacement||t[61]!==N?(H=function(){!i||i.isDestroyed||(j(),i.commands.replaceAllFindMatches(u.replacement)&&$D(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let ee,W,te,G,ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ee=e=>d(t=>({...t,query:e,activeIndex:0})),W=e=>d(t=>({...t,replacement:e})),te=e=>d(t=>({...t,replaceOpen:e})),G=e=>d(t=>({...t,caseSensitive:e})),ne=e=>d(t=>({...t,wholeWord:e})),t[63]=ee,t[64]=W,t[65]=te,t[66]=G,t[67]=ne):(ee=t[63],W=t[64],te=t[65],G=t[66],ne=t[67]);let K;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(K=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(UD,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:ee,onReplacementChange:W,onReplaceOpenChange:te,onCaseSensitiveChange:G,onWholeWordChange:ne,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=K):K=t[80],K}function tO(e){return{...e,open:!1,activeIndex:0}}function nO(e){return{...e,activeIndex:0}}var rO=300;function iO(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(np),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(np);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(ip(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,rO)};return n.observe(s),()=>{r=!0,n.unobserve(s),a&&clearTimeout(a)}},o=[e,t],n[0]=t,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Q.useEffect)(a,o),r}function aO(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function oO(e){let t=(0,$.c)(8),{poolEntries:n}=ot(),r;t[0]!==e||t[1]!==n?(r=e?n.find(t=>t.docName===e)??null:null,t[0]=e,t[1]=n,t[2]=r):r=t[2];let i=r?.provider??null,a;t[3]===i?a=t[4]:(a=()=>aO(i),t[3]=i,t[4]=a);let[o,s]=(0,Q.useState)(a),c,l;return t[5]===i?(c=t[6],l=t[7]):(c=()=>{if(!i){s(null);return}let e=i.document.getMap(`lifecycle`);s(aO(i));let t=()=>s(aO(i));return e.observe(t),()=>{e.unobserve(t)}},l=[i],t[5]=i,t[6]=c,t[7]=l),(0,Q.useEffect)(c,l),o}function sO(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>ap(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(Gf,r)}var cO=`ok-doc-panel-width-v1`;function lO(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function uO(e){try{let t=(e??localStorage).getItem(cO);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?lO(n):320}catch{return 320}}function dO(e,t){try{(t??localStorage).setItem(cO,String(lO(e)))}catch{}}function fO(){try{return typeof localStorage>`u`?320:uO()}catch{return 320}}var pO=1024,mO=1280,hO={left:pO,right:mO};function gO(e,t,n){return e==null?t>=hO[n]?`above`:`below`:`embedded`}function _O(e){return e===`above`?`open`:`collapsed`}var vO=`ok-sidebar-pins-v2`;function yO(e){return e===`open`||e===`collapsed`}function bO(e){return e===`above`||e===`below`||e===`embedded`}function xO(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!bO(e)||!yO(t[e]))return!1;return!0}function SO(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return xO(n.left)&&(r.left=n.left),xO(n.right)&&(r.right=n.right),r}function CO(e){try{let t=(e??localStorage).getItem(vO);return t==null?{}:SO(t)}catch{return{}}}function wO(e,t){try{t.setItem(vO,JSON.stringify(e))}catch{}}function TO(e,t,n){return n[e]?.[t]??_O(t)}function EO(e,t,n,r){let i=r??localStorage,a=CO(i);return a[e]={...a[e],[t]:n},wO(a,i),a}var DO=`ok-terminal-width-v1`;function OO(e){return Number.isFinite(e)?e<320?320:Math.round(e):480}function kO(e){try{let t=(e??localStorage).getItem(DO);if(t==null)return 480;let n=Number.parseInt(t,10);return Number.isFinite(n)?OO(n):480}catch{return 480}}function AO(e,t){try{(t??localStorage).setItem(DO,String(OO(e)))}catch{}}function jO(){try{return typeof localStorage>`u`?480:kO()}catch{return 480}}function MO(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(`connecting`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(`connecting`);return}let t=e.configuration.websocketProvider.status;e.isSynced?r(`synced`):r(t===`connected`?`connected`:t===`disconnected`?`disconnected`:`connecting`);let n=e=>{let{status:t}=e;r(t===`connected`?NO:t===`disconnected`?`disconnected`:`connecting`)},i=e=>{let{state:t}=e;r(t?`synced`:`connected`)},a=()=>r(`disconnected`);return e.on(`status`,n),e.on(`synced`,i),e.on(`disconnect`,a),()=>{e.off(`status`,n),e.off(`synced`,i),e.off(`disconnect`,a)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a),n}function NO(e){return e===`synced`?`synced`:`connected`}function PO(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function FO(e){let t=(0,$.c)(21),{path:n,onRemove:r}=e,{_:i}=Dt(),a,o;t[0]!==i||t[1]!==n?(a=PO(n),o=i({id:`hnq8fP`,values:{label:a}}),t[0]=i,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s=o,c=`composer-context-chip-file-${n}`,l;t[4]===r?l=t[5]:(l=e=>{(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),r())},t[4]=r,t[5]=l);let u;t[6]===n?u=t[7]:(u=(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-1/2 inline-flex size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,children:(0,Z.jsx)(Ce,{path:n,className:`size-3`,showExtensionBadge:!1})}),t[6]=n,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(ju,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0}),t[8]=d):d=t[8];let f;t[9]!==r||t[10]!==s||t[11]!==l||t[12]!==u?(f=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s,onClick:r,onKeyDown:l,className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[u,d]}),t[9]=r,t[10]=s,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===a?p=t[15]:(p=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:a}),t[14]=a,t[15]=p);let m;return t[16]!==n||t[17]!==c||t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`span`,{"data-testid":c,title:n,className:`group/chip inline-flex max-w-[14rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[f,p]}),t[16]=n,t[17]=c,t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function IO(e){let t=(0,$.c)(11),{files:n,onRemoveFile:r,className:i,children:a}=e;if(n.length===0&&Q.Children.toArray(a).length===0)return null;let o;t[0]===i?o=t[1]:(o=Y(`flex flex-wrap items-center gap-1`,i),t[0]=i,t[1]=o);let s;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,Z.jsx)(FO,{path:e,onRemove:()=>r(e)},e),t[5]=r,t[6]=e),s=n.map(e),t[2]=n,t[3]=r,t[4]=s}else s=t[4];let c;return t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsxs)(`div`,{className:o,"data-testid":`composer-context-chips`,children:[s,a]}),t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}var LO=`ok-onboarding-card-v1`,RO={initialized:!1,steps:{file:!1,askedAi:!1},fileBaseline:0,dismissed:!1,completed:!1};function zO(e){return e===!0}function BO(e){if(typeof e!=`object`||!e)return RO;let t=e,n=typeof t.steps==`object`&&t.steps!==null?t.steps:{};return{initialized:zO(t.initialized),steps:{file:zO(n.file),askedAi:zO(n.askedAi)},fileBaseline:typeof t.fileBaseline==`number`&&Number.isFinite(t.fileBaseline)&&t.fileBaseline>=0?t.fileBaseline:0,dismissed:zO(t.dismissed),completed:zO(t.completed)}}function VO(e){try{let t=(e??localStorage).getItem(LO);return t==null?RO:BO(JSON.parse(t))}catch(e){return console.warn(`[onboarding-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),RO}}function HO(e,t){try{(t??localStorage).setItem(LO,JSON.stringify(e))}catch(e){console.warn(`[onboarding-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function UO(e){let t=VO(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,HO(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},activate(e=0){t.initialized||a({...t,initialized:!0,fileBaseline:e})},markStepComplete(e){t.steps[e]||a({...t,steps:{...t.steps,[e]:!0}})},dismiss(){t.dismissed||a({...t,dismissed:!0})},markCompleted(){t.completed||a({...t,completed:!0})},install(){r||(r=!0,t=VO(e),i())}}}var WO=UO();function GO(e){let t=e===void 0?WO:e;return(0,Q.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot)}function KO(){WO.install()}function qO(e){return nd(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}async function JO(){let e=await fetch(`/api/documents`);if(!e.ok)throw Error(`documents request failed: ${e.status}`);let t=await e.json(),n=Vi.safeParse(t);if(!n.success)throw Error(`documents response did not match schema`,{cause:n.error});return qO(n.data.documents)}async function YO(e=WO){let t=e.getSnapshot();if(!(t.steps.file||!t.initialized))try{await JO()>t.fileBaseline&&e.markStepComplete(`file`)}catch(e){console.warn(`[onboarding-signals] file-step count read failed; leaving step incomplete`,e)}}function XO(e=WO){e.getSnapshot().initialized&&e.markStepComplete(`askedAi`)}var ZO=5200,QO=500,$O=/\.(md|mdx)$/i;function ek(e,t){return $O.test(e)?e:t?`${e}${t}`:mc(e)}function tk(e){return $O.test(e)?e.replace($O,``):null}function nk(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function rk(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(ik),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`);n(e.matches);let t=e=>n(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function ik(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function ak(e,t){let n=(0,$.c)(9),[r,i]=(0,Q.useState)(0),[a,o]=(0,Q.useState)(!0),s,c;if(n[0]!==t||n[1]!==a?(s=()=>{if(!t)return;if(a){let e=setTimeout(()=>o(!1),ZO);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(ok),o(!0)},QO);return()=>clearTimeout(e)},c=[a,t],n[0]=t,n[1]=a,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,Q.useEffect)(s,c),!t){let t=e[0]??``,r;return n[4]===t?r=n[5]:(r={text:t,visible:!0},n[4]=t,n[5]=r),r}let l=e[e.length>0?r%e.length:0]??``,u;return n[6]!==l||n[7]!==a?(u={text:l,visible:a},n[6]=l,n[7]=a,n[8]=u):u=n[8],u}function ok(e){return e+1}function sk(e){let t=(0,$.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(J,{id:`5PrrYw`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function ck(e){let t=(0,$.c)(102),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,c=a===void 0?!1:a,{_:l}=Dt(),u=i!==void 0,d=u?null:n??null,f=r??`wysiwyg`,p=rk(),m=jf(),{pageMeta:h}=rs(),{states:g}=_s(),_=ci(),{dispatch:v}=ds(),y=fs(),[b]=(0,Q.useState)(xk),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(!0),[T,E]=(0,Q.useState)(!1),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),[k]=(0,Q.useState)(bk),A,j;t[0]!==c||t[1]!==n||t[2]!==u||t[3]!==r?(A=()=>{if(u||n==null)return;let e=document.documentElement,t=()=>{if(Ne(n))return;let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(yk);if(e.length===0)return;let t=!1,r=()=>{t=!0};window.addEventListener(`wheel`,r,{passive:!0}),window.addEventListener(`touchstart`,r,{passive:!0});let i=performance.now(),a=()=>{if(Ne(n)&&(t=!0),t||performance.now()-i>=300){window.removeEventListener(`wheel`,r),window.removeEventListener(`touchstart`,r);return}for(let t of e)t.scrollTop=t.scrollHeight-t.clientHeight;requestAnimationFrame(a)};requestAnimationFrame(a)},i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{if(Ne(n))return;let e=se(n),t=O.current;if(!(!e||e.isDestroyed||!t))try{let n=e.view,r=n.coordsAtPos(e.state.selection.head).bottom-(t.getBoundingClientRect().top-28);if(r<=0)return;let i=n.dom.closest(`.editor-doc-scroll`);i instanceof HTMLElement&&(i.scrollTop+=r)}catch{}})},a=O.current;if(c||!a){t(),e.style.removeProperty(`--ask-composer-height`);return}let o=()=>{t(),e.style.setProperty(`--ask-composer-height`,`${a.offsetHeight+56}px`)};o(),i();let s=new ResizeObserver(o);return s.observe(a),()=>{s.disconnect(),t(),e.style.removeProperty(`--ask-composer-height`)}},j=[c,r,n,u],t[0]=c,t[1]=n,t[2]=u,t[3]=r,t[4]=A,t[5]=j):(A=t[4],j=t[5]),(0,Q.useEffect)(A,j);let M=(0,Q.useRef)(c),N=(0,Q.useRef)(s),P;t[6]!==c||t[7]!==s?(P=()=>{M.current=c,N.current=s},t[6]=c,t[7]=s,t[8]=P):P=t[8],(0,Q.useEffect)(P);let F,I;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>V(()=>{M.current?N.current?.():D.current?.focus()}),I=[],t[9]=F,t[10]=I):(F=t[9],I=t[10]),(0,Q.useEffect)(F,I);let L;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(L=[],t[11]=L):L=t[11],(0,Q.useEffect)(_k,L);let R=(0,Q.useRef)(c),z,B;t[12]===c?(z=t[13],B=t[14]):(z=()=>{let e=R.current;R.current=c,e&&!c&&D.current?.focus()},B=[c],t[12]=c,t[13]=z,t[14]=B),(0,Q.useEffect)(z,B);let H;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(H=[],t[15]=H):H=t[15];let[U,ee]=(0,Q.useState)(H),[W,te]=(0,Q.useState)(gk),G=Ql(),ne=lu(),[K,q]=(0,Q.useState)(!1),[re,ie]=(0,Q.useState)(!1),ae=G.length,oe=ne>0&&re,ce;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ce=[],t[16]=ce):ce=t[16];let[le,ue]=(0,Q.useState)(ce),de;t[17]!==n||t[18]!==u||t[19]!==h?(de=u||n==null?``:ek(n,h.get(n)?.docExt),t[17]=n,t[18]=u,t[19]=h,t[20]=de):de=t[20];let fe=de,pe,me;t[21]!==fe||t[22]!==W||t[23]!==u||t[24]!==C?(pe=()=>{u||C||ee(e=>{if(W.has(fe))return e;let t=tk(fe),n=t===null?e:e.filter(e=>e===fe||tk(e)!==t);return n.includes(fe)?n.length===e.length?e:n:[...n,fe]})},me=[u,C,fe,W],t[21]=fe,t[22]=W,t[23]=u,t[24]=C,t[25]=pe,t[26]=me):(pe=t[25],me=t[26]),(0,Q.useEffect)(pe,me);let he=u?i&&!W.has(i)&&!le.includes(i)?[i]:[]:U.filter(e=>!W.has(e)&&!le.includes(e)),ge=Uo(d,f),_e=Uo(d,`frontmatter`),[ve,ye]=(0,Q.useState)(null),[be,xe]=(0,Q.useState)(!1),Se,Ce;t[27]===ge?(Se=t[28],Ce=t[29]):(Se=()=>{ge&&ye(ge)},Ce=[ge],t[27]=ge,t[28]=Se,t[29]=Ce),(0,Q.useEffect)(Se,Ce);let we,Te;t[30]===_e?(we=t[31],Te=t[32]):(we=()=>{_e&&ye(_e)},Te=[_e],t[30]=_e,t[31]=we,t[32]=Te),(0,Q.useEffect)(we,Te);let Ee,De;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=()=>El(()=>{ye(null),xe(!1)}),De=[],t[33]=Ee,t[34]=De):(Ee=t[33],De=t[34]),(0,Q.useEffect)(Ee,De);let Oe=ii(),ke=ri(),Ae;t[35]===_?Ae=t[36]:(Ae=e=>ui(_,e.source,e.id,!0,e.supported),t[35]=_,t[36]=Ae);let je=ke.filter(Ae),Me=gi(je,Oe),Pe;t[37]===y?.installedClis?Pe=t[38]:(Pe=y?.installedClis??{},t[37]=y?.installedClis,t[38]=Pe);let Fe=ol({sticky:x??b,effectiveThreadAgent:Me,enabledClis:y===null?[]:Vc(_,y.installedClis),enabledDesktopTargets:sl(_),installedClis:Pe,terminalAvailable:y!==null,threadsAvailable:!0,desktopSelectable:!0}),Ie=Fe.kind===`thread`,Le=Fe.kind===`cli`?Fe.cli:null,Re=Le!==null,ze=Fe.kind===`desktop`?li.find(e=>e.id===Fe.target)??null:null,Be=!T&&(!C||ve!==null||oe)&&(Re||ze!==null||Ie),Ve;t[39]===_?Ve=t[40]:(Ve=li.filter(e=>mi(_,e.id)),t[39]=_,t[40]=Ve);let He=Ve,Ue;t[41]===g?Ue=t[42]:(Ue=li.some(e=>g[e.id]?.installed==null),t[41]=g,t[42]=Ue);let We=Ue,Ge=y===null?void 0:Vc(_,y.installedClis).map(e=>{let{displayName:t}=Ri[e];return{cli:e,label:t,ariaLabel:l({id:`QYfQdv`,values:{displayName:t}}),selected:Le===e,onSelect:()=>Xe(e)}}),Ke;t[43]!==l||t[44]!==oe?(Ke=oe?[l({id:`NeQ_0G`})]:[l({id:`KYSocE`}),l({id:`7Ongq0`}),l({id:`HPTPGr`}),l({id:`qiRoLb`})],t[43]=l,t[44]=oe,t[45]=Ke):Ke=t[45];let qe=ak(Ke,!p&&C&&!c&&!oe),Je;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Je=e=>{S(e.id),al(e.id)},t[46]=Je):Je=t[46];let Ye=Je,Xe=e=>{let t=Rc(e);S(t),al(t)},Ze;if(t[47]===Symbol.for(`react.memo_cache_sentinel`)){let e=()=>{S(Lc),al(Lc)};Ze=t=>{oi(t),e()},t[47]=Ze}else Ze=t[47];let Qe=Ze,$e=()=>{D.current?.clear(),ye(null),xe(!1),ee([]),te(new Set),ie(!1),q(!1),zT()},et=async(e,t)=>{let n=t===void 0?!0:t,r=()=>{n&&$e()};if(e===null)return Mu.error(l({id:`y8B54M`})),!1;if(Ie)return Ds(e,Me===null?void 0:{agent:{source:Me.source,id:Me.id}}),XO(),r(),!0;if(Le!==null&&y!==null){try{y.launchInTerminal(e,Le)}catch{return Mu.error(l({id:`jBVUXo`})),!1}return XO(),r(),!0}if(ze===null)return Mu.error(l({id:`teFjfG`})),!1;if(g[ze.id]?.installed!==!0)return Ts(ze),Mu.info(l({id:`L1BQTH`,values:{0:ze.displayName}})),r(),!1;E(!0);let i=await v(ze.id,e).finally(()=>{E(!1),r()});return i.ok&&XO(),i.ok},tt=()=>{let{instruction:e,mentions:t}=D.current?.getContent()??{instruction:``,mentions:[]};if(u)return ws({docName:null,folderRelativePath:i,workspace:m,instruction:e,mentions:[...new Set([...he,...t])].filter(e=>e!==i)});let r=ve?up(ve):void 0,a=ve?.docName??null,o=ve?a:he.includes(fe)?n??null:null,s=o===null?null:ek(o,h.get(o)?.docExt),c=[...new Set([...he,...t])].filter(e=>e!==s);return ws({docName:o,...s===null?{}:{docRelativePath:s},workspace:m,instruction:e,mentions:c,selection:r})},nt=()=>{if(Be){if(oe){rt();return}et(tt())}},rt=async()=>{let{instruction:e,mentions:t}=D.current?.getContent()??{instruction:``,mentions:[]};(await Kl({compose:async n=>{let r=ws({docName:null,workspace:m,instruction:Jl(n.map(hk),e,ve?{docName:ve.docName,markdown:ve.markdown}:void 0),mentions:[...new Set([...n.map(mk),...he,...t])]});return r===null?(Mu.error(l({id:`253MN6`})),!1):et(r,!1)}})).length>0&&$e()};if(c)return null;let it=``,at=``;if(ve){let e;t[48]!==h||t[49]!==ve?(e=dp(ve,ek(ve.docName,h.get(ve.docName)?.docExt).split(`/`).pop()??``),t[48]=h,t[49]=ve,t[50]=e):e=t[50],it=e;let n;t[51]===ve.markdown?n=t[52]:(n=fp(ve.markdown),t[51]=ve.markdown,t[52]=n),at=n}let ot;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ot=e=>_p(e,D),t[53]=ot):ot=t[53];let st;t[54]!==l||t[55]!==u||t[56]!==o?(st=u?null:(0,Z.jsx)(X,{type:`button`,variant:`outline`,"aria-label":l({id:`EWX92Z`}),onClick:()=>o?.(),"data-testid":`ask-ai-collapse`,className:`-top-2.5 -translate-x-1/2 absolute left-1/2 z-10 h-5 w-10 rounded-md p-0 text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100`,children:(0,Z.jsx)($o,{className:`size-3.5`,"aria-hidden":!0})}),t[54]=l,t[55]=u,t[56]=o,t[57]=st):st=t[57];let ct;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ct=e=>te(t=>{let n=new Set(t);return n.add(e),n}),t[58]=ct):ct=t[58];let lt;t[59]!==l||t[60]!==it||t[61]!==at||t[62]!==ve||t[63]!==be?(lt=ve?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:it,className:`group/chip inline-flex max-w-[16rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":l({id:`irrm_E`}),onClick:()=>{ye(null),xe(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(sv,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,"aria-hidden":!0}),(0,Z.jsx)(ju,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Z.jsx)(X,{type:`button`,variant:`ghost`,"aria-expanded":be,"aria-label":l(be?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>xe(pk),"data-testid":`composer-selection-peek`,className:`h-auto min-h-0 min-w-0 shrink justify-start px-0 py-0 text-left font-normal text-muted-foreground text-xs hover:bg-transparent hover:text-foreground`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:it})})]}),be&&at!==``?(0,Z.jsx)(`p`,{className:`max-h-24 w-full basis-full overflow-y-auto whitespace-pre-wrap text-2xs text-muted-foreground/80 subtle-scrollbar`,"data-testid":`composer-selection-preview`,children:at}):null]}):null,t[59]=l,t[60]=it,t[61]=at,t[62]=ve,t[63]=be,t[64]=lt):lt=t[64];let ut;t[65]!==K||t[66]!==oe||t[67]!==ae||t[68]!==G||t[69]!==ne?(ut=ae>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(su,{count:oe?ne:ae,attached:oe,expanded:K,onAttach:()=>{ie(!0),Zl()},onToggleExpanded:()=>q(fk),onDismiss:()=>{ie(!1),q(!1)}}),oe&&K&&(0,Z.jsx)(eu,{threads:G})]}),t[65]=K,t[66]=oe,t[67]=ae,t[68]=G,t[69]=ne,t[70]=ut):ut=t[70];let dt;t[71]===l?dt=t[72]:(dt=l({id:`xWEvuo`}),t[71]=l,t[72]=dt);let ft;t[73]!==C||t[74]!==p||t[75]!==qe?(ft=C?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:Y(`pointer-events-none absolute inset-0 truncate px-0 py-1 text-base text-muted-foreground/60 md:text-sm`,!p&&`transition-opacity duration-500 ease-in-out`,qe.visible?`opacity-100`:`opacity-0`),children:qe.text}):null,t[73]=C,t[74]=p,t[75]=qe,t[76]=ft):ft=t[76];let pt=qx,mt=Ie?(0,Z.jsx)(Po,{agentId:Me?.id??``,iconUrl:Me?.iconUrl,className:`size-4`}):Le===null?ze?(0,Z.jsx)(di,{id:ze.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(di,{id:ai(Le),className:`size-4`,"aria-hidden":!0}),ht=Ie?Me===null?(0,Z.jsx)(J,{id:`G7bn_N`}):(0,Z.jsx)(sk,{agentName:Me.name}):Le===null?ze?(0,Z.jsx)(J,{id:`nUNZL4`,values:{0:ze.displayName}}):(0,Z.jsx)(J,{id:`F-vBv0`}):(0,Z.jsx)(J,{id:`ti6aF_`,values:{0:Ri[Le].displayName}}),gt;t[77]===ht?gt=t[78]:(gt=(0,Z.jsx)(`span`,{children:ht}),t[77]=ht,t[78]=gt);let _t;t[79]===T?_t=t[80]:(_t=T?(0,Z.jsx)(ll,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t[79]=T,t[80]=_t);let vt;t[81]!==mt||t[82]!==gt||t[83]!==_t?(vt=(0,Z.jsxs)(Z.Fragment,{children:[mt,gt,_t]}),t[81]=mt,t[82]=gt,t[83]=_t,t[84]=vt):vt=t[84];let yt=!Be,bt=Re?null:ze?.id??null,xt=je.map(e=>({key:`${e.source}:${e.id}`,id:e.id,name:e.name,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl},selected:Ie&&Me!==null&&Me.source===e.source&&Me.id===e.id,onSelect:()=>Qe(e)})),St;t[85]===We?St=t[86]:(St=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:We?(0,Z.jsx)(J,{id:`CPmYSG`}):(0,Z.jsx)(J,{id:`t9Qn8y`})}),t[85]=We,t[86]=St);let Ct;t[87]===l?Ct=t[88]:(Ct=l({id:`nskygk`}),t[87]=l,t[88]=Ct);let wt;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(wt={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:dk,threadAgent:uk,settings:`ask-ai-agent-option-settings`,terminal:lk},t[89]=wt):wt=t[89];let Tt;t[90]!==pt||t[91]!==Ge||t[92]!==He||t[93]!==Ye||t[94]!==nt||t[95]!==vt||t[96]!==yt||t[97]!==bt||t[98]!==xt||t[99]!==St||t[100]!==Ct?(Tt=(0,Z.jsx)(pt,{primary:vt,onPrimary:nt,primaryDisabled:yt,installedTargets:He,selectedTargetId:bt,onSelectTarget:Ye,threadAgents:xt,onOpenSettings:Wu,terminals:Ge,menuEmptyState:St,triggerAriaLabel:Ct,testIds:wt}),t[90]=pt,t[91]=Ge,t[92]=He,t[93]=Ye,t[94]=nt,t[95]=vt,t[96]=yt,t[97]=bt,t[98]=xt,t[99]=St,t[100]=Ct,t[101]=Tt):Tt=t[101];let Et=(0,Z.jsxs)(`div`,{ref:O,onMouseDown:ot,className:`pointer-events-auto group relative flex cursor-text flex-col gap-1.5 rounded-2xl border border-border/60 bg-card px-3 py-2 shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[st,(0,Z.jsxs)(IO,{files:he,onRemoveFile:ct,children:[lt,ut]}),(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Z.jsx)(iE,{ref:D,ariaLabel:dt,onEmptyChange:w,onContentChange:RT,onMentionsChange:ue,onSubmit:nt,initialDoc:k,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),ft]}),Tt]})]});return u?(0,Z.jsx)(`div`,{className:`shrink-0 pt-2 pb-3`,"data-testid":`bottom-composer`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-4xl px-6`,children:Et})}):(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-[var(--conflict-footer-height,0px)] z-20 editor-content-aligned bg-gradient-to-t from-background from-65% via-background to-transparent pt-10 pb-2`,"data-testid":`bottom-composer`,children:Et})}function lk(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function uk(e){return`ask-ai-agent-option-thread-${e}`}function dk(e){return`ask-ai-agent-option-${e}`}function fk(e){return!e}function pk(e){return!e}function mk(e){return mc(e.payload.docName)}function hk(e){return Hl(e.payload)}function gk(){return new Set}function _k(){let e=vk;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function vk(e){Zu(e,`open-ask-ai`)&&(Af()||nk(e.target)||(e.preventDefault(),F()))}function yk(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function bk(){return LT().doc??void 0}function xk(){return Nc()}function Sk(e){return!e.terminalVisible&&!e.isEmbedded&&e.activeDocName!==null}function Ck(e){return!e.terminalVisible&&!e.isEmbedded}function wk(e,t={}){let n=T(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var Tk=200,Ek=`Outside any block`;function Dk(e){let t=(0,$.c)(5),{editor:n}=e,r=ye(n),i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1),s,c;t[0]!==r||t[1]!==n?(s=()=>{if(a.current!==null&&(window.clearTimeout(a.current),a.current=null),!n||!i.current)return;let e=r!==null&&r.ancestorChain.length>0,t;return t=e?Ok(n,r):o.current?Ek:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},Tk),()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)}},c=[n,r],t[0]=r,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`div`,{ref:i,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`}),t[4]=l):l=t[4],l}function Ok(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=wk(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=wk(a);try{let t=e.state.doc.resolve(r.pos),n=t.index(t.depth),a=t.parent.childCount;return`Selected: ${i}, ${n+1} of ${a} in ${o}`}catch{return`Selected: ${i} in ${o}`}}var kk=new Da(`okCommentAnchors`);function Ak(e,t){e.isDestroyed||e.view.dispatch(e.state.tr.setMeta(kk,{draft:t}))}function jk(e){uu(e)}function Mk(e,t,n){let r=[],i=hl(e).filter(e=>e.status===`open`&&e.target.kind===`body`&&e.anchor!==null);if(i.length>0){let e=ru(t);for(let t of i){if(t.anchor===null)continue;let n=Fl(e,t.anchor.quote,t.anchor);n!==null&&r.push({id:t.id,from:n.from,to:n.to})}}return n!==null&&n.from<n.to&&r.push({id:null,from:n.from,to:n.to}),r}function Nk(e,t,n){let r=Mk(e,t,n);if(r.length===0)return xa.empty;let i=Wl(r,Vl()).map(e=>fo.inline(e.from,e.to,e.threadId===null?{style:e.style}:{style:e.style,"data-comment-thread":e.threadId}));return xa.create(t,i)}function Pk(e,t){return typeof t==`object`&&t&&`draft`in t?`draft`:e.docChanged?`rebuild`:t===void 0?`reuse`:`rebuild`}function Fk(e){return new Aa({key:kk,state:{init:(t,n)=>({draft:null,decorations:Nk(e,n.doc,null)}),apply(t,n,r,i){let a=t.getMeta(kk);switch(Pk(t,a)){case`reuse`:return n;case`draft`:{let t=a.draft;return{draft:t,decorations:Nk(e,i.doc,t)}}default:{let r=n.draft===null?null:{from:t.mapping.map(n.draft.from),to:t.mapping.map(n.draft.to)};return{draft:r,decorations:Nk(e,i.doc,r)}}}}},props:{decorations(e){return kk.getState(e)?.decorations},handleClick(t,n){let r=null;for(let i of Mk(e,t.state.doc,null))i.id!==null&&(n<i.from||n>i.to||(r===null||i.to-i.from<r.to-r.from)&&(r=i));return r?.id==null?!1:(jk(r.id),!0)}}})}function Ik(e){let t=(0,$.c)(4),{editor:n,docName:r}=e,i,a;return t[0]!==r||t[1]!==n?(i=()=>{let e=!1;queueMicrotask(()=>{e||n.isDestroyed||(n.registerPlugin(Fk(r)),du(r).then(()=>{e||n.isDestroyed||n.view.dispatch(n.state.tr.setMeta(kk,{refresh:!0}))}).catch(Lk))});let t=()=>{if(e||n.isDestroyed)return;let t=n.editorView;t&&t.dispatch(t.state.tr.setMeta(kk,{refresh:!0}))},i=Xl(t),a=Tl(t);return()=>{e=!0,i(),a(),n.isDestroyed||n.unregisterPlugin(kk)}},a=[n,r],t[0]=r,t[1]=n,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Q.useEffect)(i,a),null}function Lk(){}var Rk=34,zk=30,Bk=4;function Vk(e,t,n){let r=[...e].sort((e,t)=>e.y-t.y),i=t+n-zk,a=[],o=t-Bk;for(let e of r){let r=e.y<t||e.y>t+n,s=e.y-zk/2,c=Math.min(i,Math.max(s,o+Bk,t));a.push({id:e.id,top:c,offscreen:r}),o=c+zk}return a}function Hk(e){let t=(0,$.c)(31),{editor:n,docName:r}=e,{_:i}=Dt(),a=pu(r),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[0]=u):u=t[0];let[d,f]=(0,Q.useState)(u),p,m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>vl(e=>s(e)),m=[],t[1]=p,t[2]=m):(p=t[1],m=t[2]),(0,Q.useEffect)(p,m);let h,g;t[3]!==n||t[4]!==a?(h=()=>{let e=In(n);if(!e)return;let t=yl(e.dom);if(!t)return;let r=a.filter(Uk),i=()=>{let i=t.getBoundingClientRect(),a=[];if(r.length>0){let t=ru(n.state.doc);for(let n of r){let r;if(n.target.kind===`property`){let e=Ll(n.target.key);if(e===null)continue;r=e.top+e.height/2}else{if(n.anchor===null)continue;let i=Fl(t,n.anchor.quote,n.anchor);if(i===null)continue;try{r=e.coordsAtPos(i.from).top}catch{continue}}a.push({id:n.id,y:r})}}l({top:i.top,height:i.height,left:i.right-Rk}),f(Vk(a,i.top,i.height))};i();let o=0,s=()=>{o===0&&(o=requestAnimationFrame(()=>{o=0,i()}))};window.addEventListener(`resize`,s),t.addEventListener(`scroll`,s,{passive:!0});let c=new ResizeObserver(s);return c.observe(t),n.on(`update`,s),()=>{o!==0&&cancelAnimationFrame(o),window.removeEventListener(`resize`,s),t.removeEventListener(`scroll`,s),c.disconnect(),n.off(`update`,s)}},g=[n,a],t[3]=n,t[4]=a,t[5]=h,t[6]=g):(h=t[5],g=t[6]),(0,Q.useEffect)(h,g);let _;t[7]!==o||t[8]!==n||t[9]!==a?(_=function(e){if(o===e){uu(null);return}let t=a.find(t=>t.id===e);if(t?.target.kind===`property`)t.anchor!==null&&kl({key:t.target.key,path:t.target.path,quote:t.anchor.quote,start:t.anchor.start,end:t.anchor.end})||fl(t.target.key);else if(t&&t.anchor!==null){let e=Il(n.state.doc,t.anchor.quote,t.anchor);e&&Cl(n,e)}uu(e)},t[7]=o,t[8]=n,t[9]=a,t[10]=_):_=t[10];let v=_;if(c===null||d.length===0)return null;let y;t[11]!==c.height||t[12]!==c.left||t[13]!==c.top?(y={top:c.top,height:c.height,left:c.left,width:Rk},t[11]=c.height,t[12]=c.left,t[13]=c.top,t[14]=y):y=t[14];let b;if(t[15]!==i||t[16]!==o||t[17]!==v||t[18]!==d||t[19]!==c.top||t[20]!==a){let e;t[22]!==i||t[23]!==o||t[24]!==v||t[25]!==c.top||t[26]!==a?(e=e=>{let t=a.find(t=>t.id===e.id);if(!t)return null;let n=e.id===o;return(0,Z.jsx)(X,{type:`button`,variant:`ghost`,"aria-label":i(n?{id:`M92_0q`}:{id:`ojGc_T`}),"aria-expanded":n,className:Y(`pointer-events-auto absolute left-0 size-7 rounded-full border bg-background p-0 shadow-sm transition-colors hover:bg-muted`,e.offscreen&&`opacity-40 hover:opacity-100`,n&&`border-amber-500 bg-amber-50`),style:{top:e.top-c.top},"data-comment-thread":t.id,onClick:()=>v(t.id),onPointerEnter:()=>pl(t.id),onPointerLeave:()=>Ul(t.id),children:(0,Z.jsx)(Bl,{className:`size-3.5 text-amber-500`})},e.id)},t[22]=i,t[23]=o,t[24]=v,t[25]=c.top,t[26]=a,t[27]=e):e=t[27],b=d.map(e),t[15]=i,t[16]=o,t[17]=v,t[18]=d,t[19]=c.top,t[20]=a,t[21]=b}else b=t[21];let x;return t[28]!==y||t[29]!==b?(x=(0,cD.createPortal)((0,Z.jsx)(`div`,{className:`pointer-events-none fixed z-30`,style:y,children:b}),document.body),t[28]=y,t[29]=b,t[30]=x):x=t[30],x}function Uk(e){return e.status===`open`&&(e.target.kind===`property`||e.anchor!==null)}function Wk(e){let t=(0,$.c)(61),{editor:n,docName:r,shortcutEnabled:i}=e,{_:a}=Dt(),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!0),u=(0,Q.useRef)(null),d=(0,Q.useRef)(null),f,p;t[0]!==n||t[1]!==i?(f=()=>{if(!i)return;let e=e=>{if(!Zu(e,`add-comment`))return;let t=e.target;t instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)||n.state.selection.empty||(e.preventDefault(),fu())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},p=[i,n],t[0]=n,t[1]=i,t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m,h;t[4]===n?(m=t[5],h=t[6]):(m=()=>xl(()=>{let{from:e,to:t,empty:r}=n.state.selection;if(r||t-e<1)return;let i=n.state.doc.textBetween(e,t,`
10
- `).trim();if(i.length===0)return;let{prefix:a,suffix:o}=Sl(n.state.doc,e,t);s({from:e,to:t,quote:i,prefix:a,suffix:o}),Ak(n,{from:e,to:t})}),h=[n],t[4]=n,t[5]=m,t[6]=h),(0,Q.useEffect)(m,h);let g,_;t[7]!==o||t[8]!==n?(g=()=>{if(o===null)return;let e=d.current;if(!e)return;let t=In(n);if(!t)return;let r={getBoundingClientRect:()=>{try{return Xa(t,o.from,o.to)}catch{return new DOMRect}},contextElement:t.dom};return hr(r,e,()=>{dr(r,e,{placement:`bottom-start`,strategy:`fixed`,middleware:[fr(8),lr(),vr({padding:8})]}).then(t=>{let{x:n,y:r}=t;e.style.position=`fixed`,e.style.left=`${n}px`,e.style.top=`${r}px`})})},_=[o,n],t[7]=o,t[8]=n,t[9]=g,t[10]=_):(g=t[9],_=t[10]),(0,Q.useEffect)(g,_);let v,y;t[11]===o?(v=t[12],y=t[13]):(v=()=>{o!==null&&u.current?.focus()},y=[o],t[11]=o,t[12]=v,t[13]=y),(0,Q.useEffect)(v,y);let b;t[14]===n?b=t[15]:(b=function(){u.current?.clear(),l(!0),s(null),Ak(n,null)},t[14]=n,t[15]=b);let x=b,S;t[16]!==o||t[17]!==x?(S=()=>{if(o===null)return;let e=e=>{let t=d.current;if(t===null)return;let n=e.target;n instanceof Node&&(t.contains(n)||n instanceof Element&&n.closest(`[data-suggestion-popup]`)!==null||x())};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},t[16]=o,t[17]=x,t[18]=S):S=t[18],(0,Q.useEffect)(S);let C;t[19]!==o||t[20]!==r||t[21]!==n||t[22]!==x?(C=function(e){if(o===null)return;let t=u.current?.getContent().instruction.trim()??``;t.length!==0&&($l({docName:r,quote:o.quote,prefix:o.prefix,suffix:o.suffix,body:t,onCreated:e?Gk:void 0}),n.isDestroyed||n.commands.setTextSelection(Math.min(o.to,n.state.doc.content.size)),x())},t[19]=o,t[20]=r,t[21]=n,t[22]=x,t[23]=C):C=t[23];let w=C;if(o===null)return null;let T;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T={position:`fixed`,top:0,left:0},t[24]=T):T=t[24];let E;t[25]===a?E=t[26]:(E=a({id:`4eO-iB`}),t[25]=a,t[26]=E);let D;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(ju,{className:`size-3.5`}),t[27]=D):D=t[27];let O;t[28]!==x||t[29]!==E?(O=(0,Z.jsx)(`div`,{className:`-mt-1 -mr-1 -mb-1 flex justify-end`,children:(0,Z.jsx)(X,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":E,onClick:x,className:`size-6 shrink-0 p-0 text-muted-foreground hover:text-foreground`,children:D})}),t[28]=x,t[29]=E,t[30]=O):O=t[30];let k;t[31]===a?k=t[32]:(k=a({id:`vYOUOk`}),t[31]=a,t[32]=k);let A;t[33]===a?A=t[34]:(A=a({id:`vYOUOk`}),t[33]=a,t[34]=A);let j;t[35]===w?j=t[36]:(j=()=>w(!1),t[35]=w,t[36]=j);let M;t[37]!==x||t[38]!==k||t[39]!==A||t[40]!==j?(M=(0,Z.jsx)(iE,{ref:u,ariaLabel:k,placeholder:A,onEmptyChange:l,onSubmit:j,onEscape:x,className:`max-h-40 min-h-16 overflow-y-auto rounded-md border px-2 py-1 text-sm`}),t[37]=x,t[38]=k,t[39]=A,t[40]=j,t[41]=M):M=t[41];let N;t[42]===w?N=t[43]:(N=()=>w(!1),t[42]=w,t[43]=N);let P;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(J,{id:`hqVQbT`}),t[44]=P):P=t[44];let F;t[45]!==c||t[46]!==N?(F=(0,Z.jsx)(X,{size:`sm`,variant:`outline`,onClick:N,disabled:c,children:P}),t[45]=c,t[46]=N,t[47]=F):F=t[47];let I;t[48]===w?I=t[49]:(I=()=>w(!0),t[48]=w,t[49]=I);let L;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(J,{id:`l7X_SM`}),t[50]=L):L=t[50];let R;t[51]!==c||t[52]!==I?(R=(0,Z.jsx)(X,{size:`sm`,onClick:I,disabled:c,children:L}),t[51]=c,t[52]=I,t[53]=R):R=t[53];let z;t[54]!==F||t[55]!==R?(z=(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[F,R]}),t[54]=F,t[55]=R,t[56]=z):z=t[56];let B;return t[57]!==O||t[58]!==M||t[59]!==z?(B=(0,cD.createPortal)((0,Z.jsxs)(`div`,{ref:d,className:`z-[60] flex w-80 flex-col gap-2 rounded-lg border bg-popover p-3 shadow-lg`,style:T,"data-testid":`comment-composer`,children:[O,M,z]}),document.body),t[57]=O,t[58]=M,t[59]=z,t[60]=B):B=t[60],B}function Gk(e){Jx({threadIds:[e],submit:!0,resolve:!0})}function Kk(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(sn,{fallbackRender:qk,children:n}),t[0]=n,t[1]=r),r}function qk(){return null}function Jk(e){let t=(0,$.c)(20),{editor:n,docName:r}=e,[i,a]=(0,Q.useState)(null),[o]=(0,Q.useState)(Qk),s=(0,Q.useRef)(null),c=pu(r),l;t[0]!==i||t[1]!==c?(l=i?c.find(e=>e.id===i)??null:null,t[0]=i,t[1]=c,t[2]=l):l=t[2];let u=l,d,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>vl(e=>a(e)),f=[],t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f);let p,m;t[5]!==u||t[6]!==i?(p=()=>{i!==null&&(u===null||u.status!==`open`)&&uu(null)},m=[i,u],t[5]=u,t[6]=i,t[7]=p,t[8]=m):(p=t[7],m=t[8]),(0,Q.useEffect)(p,m);let h,g;t[9]!==n||t[10]!==u?(h=()=>{if(u===null)return;let e=s.current;if(!e)return;let t=In(n);if(!t)return;let r=u.target.kind===`property`?u.target.key:null,i=r===null&&u.anchor!==null?Il(n.state.doc,u.anchor.quote,u.anchor):null;if(r===null&&i===null)return;let a={getBoundingClientRect:()=>{if(r!==null)return Ll(r)??new DOMRect;if(i===null)return new DOMRect;try{return Xa(t,i.from,i.to)}catch{return new DOMRect}},contextElement:t.dom};return hr(a,e,()=>{dr(a,e,{placement:`bottom-start`,strategy:`fixed`,middleware:[fr(8),lr(),vr({padding:8})]}).then(t=>{let{x:n,y:r}=t;e.style.position=`fixed`,e.style.left=`${n}px`,e.style.top=`${r}px`})})},g=[u,n],t[9]=n,t[10]=u,t[11]=h,t[12]=g):(h=t[11],g=t[12]),(0,Q.useEffect)(h,g);let _,v;if(t[13]===u?(_=t[14],v=t[15]):(_=()=>{if(u===null)return;let e=e=>{let t=e.target;s.current?.contains(t)||t?.closest(`[data-comment-thread]`)||uu(null)},t=Zk;return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},v=[u],t[13]=u,t[14]=_,t[15]=v),(0,Q.useEffect)(_,v),u===null)return null;let y;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(y={position:`fixed`,top:0,left:0},t[16]=y):y=t[16];let b;return t[17]!==o||t[18]!==u?(b=(0,cD.createPortal)((0,Z.jsx)(`div`,{ref:s,className:`z-50 w-80 rounded-lg bg-popover shadow-lg`,style:y,children:(0,Z.jsx)(uS,{thread:u,now:o,focused:!1,cardRef:Xk,onClose:Yk})}),document.body),t[17]=o,t[18]=u,t[19]=b):b=t[19],b}function Yk(){return uu(null)}function Xk(){}function Zk(e){e.key===`Escape`&&uu(null)}function Qk(){return Date.now()}var $k=!1;function eA(e,t,n,r){let i=e[t];if(typeof i!=`function`){console.warn(`[cold-mount-instrumentation] target missing method "${t}"`);return}e[t]=function(...e){let t=performance.now(),a,o=!1;try{return a=i.apply(this,e),o=!0,a}finally{let e=performance.now()-t,i;if(o&&r)try{i=r(this,a,t,e)}catch(e){i={"instrumentation-error":e instanceof Error?e.message:String(e)}}try{Ed(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function tA(e){return e?.doc?typeof e.doc.nodeSize==`number`?e.doc.nodeSize:e.doc.content&&typeof e.doc.content.size==`number`?e.doc.content.size:null:null}var nA=0,rA=0,iA=0,aA=0,oA=null,sA=[`linkResolutionDecoration$`],cA=new WeakSet,lA=new WeakSet;function uA(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function dA(){return!1}function fA(){return!dA()}function pA(e,t){if(fA())return t;let n=`ok/cold/nodeview-factory-${uA(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;Ed(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function mA(e){if(fA())return;let t=e.state.plugins;for(let e of t){if(lA.has(e))continue;let t=e.spec?.key?.key;if(!t||!sA.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){lA.add(e);continue}let i=`ok/cold/decoration-${uA(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;Ed(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},lA.add(e)}}function hA(e){if(fA())return;let t=e._props?.nodeViews;if(!(!t||typeof t!=`object`))for(let[e,n]of Object.entries(t)){if(typeof n!=`function`||n.__okWrapped===!0)continue;let r=pA(e,n);r.__okWrapped=!0,t[e]=r}}function gA(e){return fA()?e:e.map(e=>{let t=e.name??`unknown`,n=uA(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ed(`ok/cold/ext-${n}-on-before-create`,{ext:t,hook:`onBeforeCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ed(`ok/cold/ext-${n}-on-create`,{ext:t,hook:`onCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onUpdate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ed(`ok/cold/ext-${n}-on-update`,{ext:t,hook:`onUpdate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onDestroy(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ed(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function _A(){if(!$k){$k=!0,eA(ta.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return fA()||(oA=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:tA(i.editorState),durationMs:r}}),eA(ta.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!fA()&&!cA.has(e)&&t.view&&(mA(t.view),hA(t.view),cA.add(e)),{docSize:tA(t.editorState)}}),eA(ta.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{aA+=1;let i=e;return!fA()&&i.view&&hA(i.view),{docSize:tA(i.view),seq:aA,durationMs:r}}),eA(wa.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(rA+=1,{seq:rA,docSize:tA(e.state),durationMs:r})),eA(wa.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(iA+=1,{seq:iA,docSize:tA(e.state),durationMs:r})),eA(u.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{nA+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:nA,topLevelYElements:a,durationMs:r}}),eA(Wn.prototype,`init`,`ok/cold/ec-init`,e=>({editorPresent:!!e.props?.editor}));try{typeof PerformanceObserver<`u`&&new PerformanceObserver(e=>{for(let t of e.getEntries()){let e=t.name;if((e===`first-paint`||e===`first-contentful-paint`)&&(Ed(e===`first-paint`?`ok/cold/paint-fp`:`ok/cold/paint-fcp`,{entryType:t.entryType,startTime:Math.round(t.startTime*1e3)/1e3},{startTime:t.startTime,duration:0}),!fA()&&e===`first-paint`&&oA!==null)){let e=oA,n=Math.max(0,t.startTime-e);Ed(`ok/cold/append-to-paint`,{paintEntryType:t.entryType,durationMs:Math.round(n*1e3)/1e3,paintAt:Math.round(t.startTime*1e3)/1e3},{startTime:e,duration:n}),oA=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}function vA(){let[e]=(0,Q.useState)(Qa);return e}var yA=class{awareness=null;started=!1;renewIntervalMs;now;constructor(e,t={}){this.ticker=e,this.renewIntervalMs=t.renewIntervalMs??15e3,this.now=t.now??(()=>Date.now())}start(){this.started||(this.started=!0,this.ticker.start(()=>this.renewIfStale()))}stop(){this.started&&(this.started=!1,this.ticker.stop(),this.awareness=null)}setAwareness(e){this.awareness=e}clearAwareness(e){this.awareness===e&&(this.awareness=null)}renewIfStale(){let e=this.awareness;if(e===null)return;let t=e.getLocalState();if(t===null)return;let n=e.meta.get(e.clientID)?.lastUpdated??0;this.now()-n>=this.renewIntervalMs&&e.setLocalState(t)}},bA=class{worker=null;start(e){typeof Worker>`u`||this.worker!==null||(this.worker=new Worker(new URL(``+new URL(`awareness-heartbeat.worker-BYkbsKQ2.js`,import.meta.url).href,``+import.meta.url),{type:`module`}),this.worker.onmessage=t=>{t.data===`tick`&&e()},this.worker.postMessage(`start`))}stop(){this.worker!==null&&(this.worker.postMessage(`stop`),this.worker.terminate(),this.worker=null)}},xA=null;function SA(){return xA===null&&(xA=new yA(new bA)),xA}function CA({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:Ya(e.display_name),color:_o(e.id,to),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:_o(e.id,to),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function wA(e,t){return e>t}function TA(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.isChangeOrigin===!0?!0:`snapshot`in t&&`prevSnapshot`in t&&t.snapshot===null&&t.prevSnapshot===null}var EA=3,DA=6e4;function OA(e,t){let n=0;for(let r of e)t-r<DA&&(n+=1);return n<EA}var kA=new Map;function AA(e,t){for(let n of e.changed.keys()){let e=n;for(;e!=null;){if(e===t)return!0;let n=e._item;e=n==null?null:n.parent}}return!1}function jA(e){let t=ie.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function MA(e){let{fragment:t,docName:n,onWedged:r}=e,i=0,a=0,o=!1,s=!1,c=!1,l=null,u=new WeakSet,d=e=>{let t=ie.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){Ed.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-prosemirror-changed`}),console.warn(`[binding-staleness-guard] ySync binding on "${n}" exposes no _prosemirrorChanged — write-back gate disarmed (vendored y-tiptap contract change?)`);return}if(u.has(t))return;u.add(t);let r=t._prosemirrorChanged.bind(t);t._prosemirrorChanged=e=>{wA(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!wA(i,a)||l!==null&&jA(l.state))return;o=!0;let e=Date.now();for(let[t,n]of kA)n.every(t=>e-t>=DA)&&kA.delete(t);let t=(kA.get(n)??[]).filter(t=>e-t<DA);if(!OA(t,e)){kA.set(n,t),Ed.count(`ok/editor/binding-wedge-rate-capped`,{docName:n}),console.warn(`[binding-staleness-guard] wedge on "${n}" rate-capped (externalSeq=${i}, appliedSeq=${a}) — publication gate stays closed, no further recycle`);return}t.push(e),kA.set(n,t),console.warn(`[binding-staleness-guard] wedged binding on "${n}" — Y→PM apply missing (externalSeq=${i}, appliedSeq=${a})`);try{r({externalSeq:i,appliedSeq:a})}catch(e){o=!1,Ed.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==ie&&AA(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new Aa({state:{init:()=>null,apply:e=>(TA(e.getMeta(ie))&&(a=i,o&&Ed.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!wA(i,a)||jA(t)?!0:e.getMeta(ie)!==void 0,view:e=>{let r=t.doc;return r==null?(Ed.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-ydoc`}),console.error(`[binding-staleness-guard] fragment has no Y.Doc for "${n}" — staleness guard disarmed`),{}):(s=!0,l=e,d(e.state),r.off(`beforeObserverCalls`,p),r.on(`beforeObserverCalls`,p),{destroy:()=>{s=!1,l=null,r.off(`beforeObserverCalls`,p)}})}})}function NA(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var PA=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&Ma(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(lr(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(vr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(fr(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(_r(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ur(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(pr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(mr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(gr(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=Xa(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof Ga){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof qi){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():NA(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&dr(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},FA=e=>new Aa({key:typeof e.pluginKey==`string`?new Da(e.pluginKey):e.pluginKey,view:t=>new PA({view:t,...e})});wo.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[FA({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var IA=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return Ci(e,{textSerializers:Ca(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(lr(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(vr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(fr(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(_r(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ur(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(pr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(mr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(gr(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){let{selection:e}=this.editor.state,t=Xa(this.view,e.from,e.to);dr({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},LA=e=>new Aa({key:typeof e.pluginKey==`string`?new Da(e.pluginKey):e.pluginKey,view:t=>new IA({view:t,...e})});wo.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[LA({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function RA(e,t){return e??new Da(t)}var zA=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,BA=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),VA=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),HA=new Set([`children`,`className`,`style`]),UA=new Set([`tabIndex`]),WA=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),GA={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function KA(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function qA(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function JA(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||WA.has(e)}function YA(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function XA(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:GA[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function ZA(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function QA(e){return UA.has(e)}function $A(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function ej(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function tj(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||VA.has(e)?String(t):`${t}px`}function nj(e,t){BA.has(t)||e.style.removeProperty(YA(t))}function rj(e,t,n){BA.has(t)||e.style.setProperty(YA(t),tj(t,n))}function ij(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(HA.has(r)||!JA(r)||KA(r,t[r])||KA(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=qA(r);if(a==null||a===!1){QA(r)&&ej(e,r),e.removeAttribute(o);return}if(a===!0){QA(r)&&$A(e,r,!0),e.setAttribute(o,``);return}if(QA(r)){$A(e,r,a);return}e.setAttribute(o,String(a))})}function aj(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function oj(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){nj(e,t);return}rj(e,t,a)}})}function sj(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!KA(t,n))return;let{eventName:i,options:a}=XA(t),o=t=>{n(ZA(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function cj(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);zA(()=>{let i=n.current;return aj(e,i.className,t.className),oj(e,i.style,t.style),ij(e,i,t),r.current=sj(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var lj=Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,Q.useRef)(document.createElement(`div`)),f=(0,Q.useRef)(RA(e,`bubbleMenu`)).current;cj(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Yn(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,Q.useRef)(h);g.current=h;let[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=FA({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,Q.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,cD.createPortal)(c,d.current)});Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,Q.useRef)(document.createElement(`div`)),d=(0,Q.useRef)(RA(e,`floatingMenu`)).current;cj(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Yn(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,Q.useRef)(m);h.current=m;let[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=LA({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,Q.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,cD.createPortal)(s,u.current)});function uj(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)($r,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[t,(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`comment-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,onClick:dj,children:[(0,Z.jsx)(lc,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`xWEvuo`})})]})]}),e[1]=n):n=e[1],n}function dj(){return fu()}var fj=[{name:`paragraph`,label:`Text`,icon:B_,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:s,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:We,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:z,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:G,isActive:e=>e.isActive(`list`,{ordered:!1})&&!e.isActive(`listItem`,{checked:!0})&&!e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleBulletList().run()},{name:`orderedList`,label:`Ordered List`,icon:yt,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:f,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:be,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:Z_,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function pj(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:mj},t[0]=n,t[1]=r);let{current:i,activeStates:a}=nr(r),o=i.icon,s;t[2]===o?s=t[3]:(s=(0,Z.jsx)(o,{className:`size-3.5`}),t[2]=o,t[3]=s);let c;t[4]===i.label?c=t[5]:(c=(0,Z.jsx)(`span`,{children:i.label}),t[4]=i.label,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)($o,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[s,c,l]})}),t[7]=s,t[8]=c,t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n?(d=fj.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Ir,{className:r?`bg-accent text-accent-foreground`:``,onSelect:()=>{e.command(n)},children:[(0,Z.jsx)(t,{className:`size-4`}),(0,Z.jsx)(`span`,{children:e.label})]},e.name)}),t[10]=a,t[11]=n,t[12]=d):d=t[12];let f;t[13]===d?f=t[14]:(f=(0,Z.jsx)(Wr,{align:`start`,sideOffset:8,className:`w-44 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto subtle-scrollbar`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==u||t[16]!==f?(p=(0,Z.jsxs)(Kr,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function mj(e){let t=Object.fromEntries(fj.map(t=>[t.name,t.isActive(e.editor)]));return{current:fj.find(e=>t[e.name])??fj[0],activeStates:t}}var hj=`0 2px 4px rgba(0, 0, 0, 0.08)`,gj=150,_j=globalThis.ScrollTimeline;function vj(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+56);return{startOffset:o,endOffset:o+a,maxShift:a}}var yj=new WeakMap;function bj(e){let t=yj.get(e);if(t){for(let e of t.animations)e.cancel();yj.delete(e)}}function xj(e){for(let t of Array.from(e.cells))bj(t)}var Sj=e=>e.cellIndex===0?`3`:`2`;function Cj(e,t){return wj(e,t,e=>({transform:`translateY(${e}px)`}))}function wj(e,t,n){if(!(t>0))return[{offset:0,...n(0)},{offset:1,...n(0)}];let r=t=>Math.max(0,Math.min(t-e.startOffset,e.maxShift));return Array.from(new Set([0,e.startOffset/t,e.endOffset/t,1].map(e=>Math.max(0,Math.min(e,1))))).sort((e,t)=>e-t).map(e=>({offset:e,...n(r(e*t))}))}function Tj(e,t,n,r){if(!(t>0))return[{...n,offset:0},{...n,offset:1}];let i=e.startOffset/t;if(i<=0)return[{...r,offset:0},{...r,offset:1}];if(i>=1)return[{...n,offset:0},{...n,offset:1}];let a=Math.min(i+1/t,1);return[{...n,offset:0},{...n,offset:i},{...r,offset:a},{...r,offset:1}]}function Ej(e,t,n){return Tj(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:hj})}function Dj(e,t){return Tj(e,t,{opacity:`0`},{opacity:`1`})}function Oj(e,t,n,r){let i=Sj(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=yj.get(e);if(o?.key===a)return;if(o)for(let e of o.animations)e.cancel();let s={timeline:t,fill:`both`,easing:`linear`},c=e.animate(Cj(n,r),s),l=e.animate(Ej(n,r,i),s),u=e.animate(Dj(n,r),{...s,pseudoElement:`::before`});yj.set(e,{key:a,animations:[c,l,u]})}function kj(e,t){let n=Sj(e),r=`in|${t}|${n}`,i=yj.get(e);if(i?.key===r)return;if(i)for(let e of i.animations)e.cancel();let a=e.animate([{transform:`translateY(${t}px)`,zIndex:n,boxShadow:hj}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});yj.set(e,{key:r,animations:[a,o]})}function Aj(e,t,n,r){let i=e.getBoundingClientRect().top,a=e.scrollTop,o=e.scrollHeight-e.clientHeight,s=t.querySelectorAll(`.tableWrapper`);for(let e of s){r?.(e);let t=e.querySelector(`table`);if(!t)continue;let s=t.querySelector(`tbody`)?.rows[0];if(!s||!Array.from(s.cells).some(e=>e.tagName===`TH`))continue;let c=t.getBoundingClientRect(),l=s.getBoundingClientRect(),u=vj(a,i,c.top,c.height,l.height);if(!u){xj(s);continue}if(n){if(o<=0){xj(s);continue}for(let e of Array.from(s.cells))Oj(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+56){xj(s);continue}for(let e of Array.from(s.cells))kj(e,d)}}var jj=wo.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new Aa({key:new Da(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||Aj(t,e.dom,n,u)},l=()=>{r??=requestAnimationFrame(()=>{r=null,c()})};function u(e){s.has(e)||(s.add(e),e.addEventListener(`contentvisibilityautostatechange`,l))}let d=()=>{if(n){i??l(),i!=null&&clearTimeout(i),i=setTimeout(()=>{i=null,c()},gj);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&_j)try{n=new _j({source:t,axis:`block`})}catch{n=null}t?.addEventListener(`scroll`,d,{passive:!0}),t&&typeof ResizeObserver<`u`&&(a=new ResizeObserver(l),a.observe(t),a.observe(e.dom)),c()}}),{update(e,t){t.doc.eq(e.state.doc)||c()},destroy(){o=!0,t?.removeEventListener(`scroll`,d),a?.disconnect(),r!=null&&cancelAnimationFrame(r),i!=null&&clearTimeout(i);for(let e of s)e.removeEventListener(`contentvisibilityautostatechange`,l);s.clear();for(let t of e.dom.querySelectorAll(`.tableWrapper > table > tbody > tr:first-child`))xj(t)}}}})]}});function Mj(e){return()=>{let t=null;try{t=e.view.dom.closest(`.editor-doc-scroll`)}catch{}let n={top:56,bottom:Nj(`--ask-composer-height`)+Nj(`--conflict-footer-height`)};return t?{boundary:t,padding:n}:{padding:n}}}function Nj(e){let t=Number.parseFloat(document.documentElement.style.getPropertyValue(e));return Number.isFinite(t)?t:0}function Pj(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(n!==`File`&&n!==`WikiEmbedFile`)return null;let r=(t.attrs.props??{}).src;return typeof r!=`string`||r.length===0?null:r}function Fj(e){let t=e.state.selection.node;if(!t)return``;let n=t.attrs.props??{},r=typeof n.alias==`string`?n.alias:``;if(r.length>0)return r;let i=typeof n.name==`string`?n.name:``;return i.length>0?i:Tt(typeof n.src==`string`?n.src:``)}function Ij(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,n.rel=`noopener noreferrer`,n.style.display=`none`,document.body.appendChild(n),n.click(),n.remove()}function Lj(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=Dt(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:Rj},t[0]=n,t[1]=i),nr(i)===null)return null;let a;t[2]===r?a=t[3]:(a=r({id:`WcWS__`}),t[2]=r,t[3]=a);let o;t[4]===n?o=t[5]:(o=e=>{e.preventDefault();let t=Pj(n);t&&Ij(t,Fj(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(_c,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a,className:`text-accent-foreground`,onMouseDown:o,children:s})}),t[7]=a,t[8]=o,t[9]=c):c=t[9];let l;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(vn,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`WcWS__`})}),t[10]=l):l=t[10];let u;return t[11]===c?u=t[12]:(u=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(bn,{children:[c,l]})}),t[11]=c,t[12]=u),u}function Rj(e){return Pj(e.editor)}function zj(e){return Pj(e)!==null}var Bj=`img, .ok-embed, .ok-video`,Vj=220,Hj=`cubic-bezier(0.23, 1, 0.32, 1)`,Uj=`ok-image-align-flip`,Wj=.5;function Gj(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Kj(){return typeof requestAnimationFrame==`function`}function qj(e){return e?e.querySelector(Bj):null}function Jj(e,t){if(Gj()||!Kj()){t();return}let n=qj(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=qj(e);if(!t)return;for(let e of t.getAnimations())e.id===Uj&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<Wj)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:Vj,easing:Hj,fill:`none`});i.id=Uj})}var Yj=[{value:`left`,label:`Align left`,icon:ov},{value:`center`,label:`Align center`,icon:iv},{value:`right`,label:`Align right`,icon:av}];function Xj(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!St.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function Zj(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Qj},t[0]=n,t[1]=r);let i=nr(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=Yj.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(!St.has(a)||i.attrs.kind!==`element`)return;let o=a===`CommonMarkImage`,s=r.from,c={...i.attrs.props??{},align:t},l=o?{...i.attrs,componentName:`img`,props:c,sourceDirty:!0}:{...i.attrs,props:c,sourceDirty:!0},u=n.state.tr.setNodeMarkup(s,null,l);u.setSelection(Ga.create(u.doc,s)),Jj(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(vn,{side:`bottom`,sideOffset:8,children:r})]},t)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function Qj(e){return Xj(e.editor)}function $j(e){return Xj(e)!==null}function eM({editor:e}){if(it(e.state).query||e.isActive(`codeBlock`))return!1;if($j(e)||zj(e))return!0;if(e.state.selection.empty)return!1;let{from:t,to:n}=e.state.selection;return!!e.state.doc.textBetween(t,n,` `).trim()}function tM(e){throw Error(`Unhandled AddLinkShortcutAction variant: ${JSON.stringify(e)}`)}function nM(e){let{selection:t}=e.state;if(t.empty){if(!e.isActive(`link`))return null;let n=C(e.state,t.from,`link`);return n===null?null:{kind:`edit-link`,markId:n}}return!eM({editor:e})||$j(e)||zj(e)?null:{kind:`open-popover`}}function rM(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function iM(e){let{from:t,to:n}=e.state.selection,r=!1;return e.state.doc.nodesBetween(t,n,e=>e.type.name===`footnoteReference`?(r=!0,!1):!0),r}function aM(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function oM(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=Dt(),i;t[0]===n?i=t[1]:(i={editor:n,selector:sM},t[0]=n,t[1]=i);let a=nr(i),o;t[2]!==a||t[3]!==n?(o=()=>{if(a||!rM(n)||n.state.selection.empty||aM(n)||iM(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=la(Ai(n.state.doc)),o=wi(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(o,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=a,t[3]=n,t[4]=o):o=t[4];let s=o,c;t[5]===r?c=t[6]:(c=r({id:`sIGbBZ`}),t[5]=r,t[6]=c);let l;t[7]===s?l=t[8]:(l=e=>{e.preventDefault(),s()},t[7]=s,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(he,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==c||t[12]!==l?(d=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":c,onMouseDown:l,disabled:a,children:u})}),t[10]=a,t[11]=c,t[12]=l,t[13]=d):d=t[13];let f;t[14]===r?f=t[15]:(f=r({id:`sIGbBZ`}),t[14]=r,t[15]=f);let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(vn,{side:`bottom`,sideOffset:8,children:f}),t[16]=f,t[17]=p);let m;return t[18]!==d||t[19]!==p?(m=(0,Z.jsxs)(bn,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function sM(e){let t=e.editor;return!!(!rM(t)||t.state.selection.empty||aM(t)||iM(t))}var cM=[{name:`bold`,icon:n_,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:D_,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:dv,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:tv,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:I,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:E_,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function lM(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:uM},t[0]=n,t[1]=r);let i=nr(r),a;t[2]!==i||t[3]!==n?(a=cM.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":e.name,className:r?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:t=>{t.preventDefault(),e.command(n)},children:(0,Z.jsx)(t,{className:`size-3.5`})})}),(0,Z.jsxs)(vn,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(le,{"aria-label":Uu(e.shortcutId),children:Hu(e.shortcutId)})]})]},e.name)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function uM(e){return Object.fromEntries(cM.map(t=>[t.name,t.isActive(e.editor)]))}var dM=`open-knowledge:open-link-edit-popover`;function fM(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(dM))}function pM(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(dM,n),()=>t.removeEventListener(dM,n)}function mM(e){return e.state.selection.empty&&e.isActive(`link`)?e.getAttributes(`link`).href??``:``}async function hM(e,t){let n;try{n=await navigator.clipboard.readText()}catch(e){e instanceof DOMException||console.warn(`[link-popover] clipboard pre-fill read failed unexpectedly`,e);return}let r=Ue(n);r!==null&&(t(e=>e===``?r:e),requestAnimationFrame(()=>{let t=e.current;t&&t.value===r&&t.select()}))}function gM(e,t,n,r){let i=mM(e);n(i),r(!0),i===``&&hM(t,n)}function _M(e){let t=(0,$.c)(72),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,{_:a}=Dt(),[o,s]=(0,Q.useState)(!1),[c,u]=(0,Q.useState)(``),d=(0,Q.useRef)(null),{folderPaths:f,loading:p,pages:m}=rs(),h;t[0]===n?h=t[1]:(h=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=h);let g=h,_;t[2]===n?_=t[3]:(_=n.getAttributes(`link`).href??``,t[2]=n,t[3]=_);let v=_,y,b;t[4]!==n||t[5]!==i?(y=()=>pM(()=>{i&&gM(n,d,u,s)}),b=[i,n],t[4]=n,t[5]=i,t[6]=y,t[7]=b):(y=t[6],b=t[7]),(0,Q.useEffect)(y,b);let x,S;t[8]!==n||t[9]!==i?(x=()=>{let e=e=>{if(!i||!Zu(e,`add-link`)||!n.editorView?.hasFocus())return;let t=nM(n);if(t!==null)switch(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t.kind){case`open-popover`:fM();return;case`edit-link`:{let{markId:e}=t;re(e),requestAnimationFrame(()=>{l(n).setActiveNode(e)});return}default:tM(t)}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},S=[i,n],t[8]=n,t[9]=i,t[10]=x,t[11]=S):(x=t[10],S=t[11]),(0,Q.useEffect)(x,S);let C,w;t[12]===n?(C=t[13],w=t[14]):(C=()=>{let e=function(){n.state.selection.empty&&s(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},w=[n],t[12]=n,t[13]=C,t[14]=w),(0,Q.useEffect)(C,w);let T,E;t[15]===o?(T=t[16],E=t[17]):(T=()=>{if(!o)return;let e=!1,t=0,n=r=>{if(e)return;let i=d.current;i&&(i.focus(),document.activeElement===i)||(r<60?t=requestAnimationFrame(()=>n(r+1)):console.warn(`[link-popover] URL input never became focusable`))};return t=requestAnimationFrame(()=>n(0)),()=>{e=!0,cancelAnimationFrame(t)}},E=[o],t[15]=o,t[16]=T,t[17]=E),(0,Q.useEffect)(T,E);let D;t[18]!==n||t[19]!==g||t[20]!==c?(D=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():g&&n.chain().focus().unsetLink().run(),s(!1)},t[18]=n,t[19]=g,t[20]=c,t[21]=D):D=t[21];let O=D,k;t[22]===n?k=t[23]:(k=function(){n.chain().focus().unsetLink().run(),s(!1)},t[22]=n,t[23]=k);let A=k,j;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(e){u(tr(e.path,null))},t[24]=j):j=t[24];let M=j,N;t[25]!==O||t[26]!==n?(N=function(e){e.key===`Enter`&&(e.preventDefault(),O()),e.key===`Escape`&&(e.preventDefault(),s(!1),n.chain().focus().run())},t[25]=O,t[26]=n,t[27]=N):N=t[27];let P=N;if(o){let e;t[28]===a?e=t[29]:(e=a({id:`ZsGpr_`}),t[28]=a,t[29]=e);let n;t[30]===a?n=t[31]:(n=a({id:`roAe2K`}),t[30]=a,t[31]=n);let r;t[32]!==f||t[33]!==P||t[34]!==p||t[35]!==m||t[36]!==e||t[37]!==n||t[38]!==c?(r=(0,Z.jsx)(te,{ref:d,type:`text`,placeholder:e,value:c,pages:m,folderPaths:f,loading:p,onValueChange:u,onSuggestionSelect:M,onKeyDown:P,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[32]=f,t[33]=P,t[34]=p,t[35]=m,t[36]=e,t[37]=n,t[38]=c,t[39]=r):r=t[39];let i;t[40]===a?i=t[41]:(i=a({id:`tP5DDk`}),t[40]=a,t[41]=i);let o;t[42]===O?o=t[43]:(o=()=>{O()},t[42]=O,t[43]=o);let s;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(u_,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[44]=s):s=t[44];let l;t[45]!==i||t[46]!==o?(l=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":i,onClick:o,children:s}),t[45]=i,t[46]=o,t[47]=l):l=t[47];let h;t[48]!==r||t[49]!==l?(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[r,l]}),t[48]=r,t[49]=l,t[50]=h):h=t[50];let _;t[51]!==a||t[52]!==v||t[53]!==g||t[54]!==A?(_=g&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),Gn(v)},children:(0,Z.jsx)(Mo,{className:`size-3.5`})})}),(0,Z.jsx)(vn,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`2vIPtm`})})]}),(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),A()},children:(0,Z.jsx)(Tu,{className:`size-3.5`})})}),(0,Z.jsx)(vn,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`484LKL`})})]})]}),t[51]=a,t[52]=v,t[53]=g,t[54]=A,t[55]=_):_=t[55];let y;return t[56]!==h||t[57]!==_?(y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[h,_]}),t[56]=h,t[57]=_,t[58]=y):y=t[58],y}let F;t[59]===a?F=t[60]:(F=a({id:`p0Iq25`}),t[59]=a,t[60]=F);let I=g?`bg-accent text-primary`:`text-accent-foreground`,L;t[61]===n?L=t[62]:(L=e=>{e.preventDefault(),gM(n,d,u,s)},t[61]=n,t[62]=L);let R;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(k_,{className:`size-3.5`}),t[63]=R):R=t[63];let z;t[64]!==F||t[65]!==I||t[66]!==L?(z=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":F,className:I,onMouseDown:L,children:R})}),t[64]=F,t[65]=I,t[66]=L,t[67]=z):z=t[67];let B;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(J,{id:`yzF66j`}),t[68]=B):B=t[68];let V;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsxs)(vn,{side:`bottom`,sideOffset:8,children:[B,(0,Z.jsx)(le,{children:Hu(`add-link`)})]}),t[69]=V):V=t[69];let H;return t[70]===z?H=t[71]:(H=(0,Z.jsxs)(bn,{children:[z,V]}),t[70]=z,t[71]=H),H}function vM(e){let t=(0,$.c)(18),{editor:n}=e,{_:r}=Dt(),i;t[0]===n?i=t[1]:(i=()=>{let e=Nn(n),t=Bn(n);e===null||!t||cp({editor:n,docName:e,ytext:t.getText(`source`)})},t[0]=n,t[1]=i);let a=i,o;t[2]===r?o=t[3]:(o=r({id:`M0jOcG`}),t[2]=r,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Hp,{className:`size-3.5`,"aria-hidden":`true`}),t[4]=s):s=t[4];let c;t[5]!==a||t[6]!==o?(c=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`view-in-source-bubble-button`,className:`text-accent-foreground/80`,"aria-label":o,onMouseDown:yM,onClick:a,children:s})}),t[5]=a,t[6]=o,t[7]=c):c=t[7];let l;t[8]===r?l=t[9]:(l=r({id:`M0jOcG`}),t[8]=r,t[9]=l);let u;t[10]===l?u=t[11]:(u=(0,Z.jsx)(`span`,{children:l}),t[10]=l,t[11]=u);let d;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(le,{"aria-label":Uu(`view-source-at-cursor`),children:Hu(`view-source-at-cursor`)}),t[12]=d):d=t[12];let f;t[13]===u?f=t[14]:(f=(0,Z.jsxs)(vn,{side:`bottom`,sideOffset:8,children:[u,d]}),t[13]=u,t[14]=f);let p;return t[15]!==c||t[16]!==f?(p=(0,Z.jsxs)(bn,{children:[c,f]}),t[15]=c,t[16]=f,t[17]=p):p=t[17],p}function yM(e){return e.preventDefault()}function bM(e){let t=(0,$.c)(30),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!0:r,a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(0),c=(0,Q.useRef)(null),l;t[0]===n?l=t[1]:(l={editor:n,selector:TM},t[0]=n,t[1]=l);let u=nr(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:wM},t[2]=n,t[3]=d);let f=nr(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return Xa(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=p):p=t[6];let m;t[7]!==n.view.dom||t[8]!==p?(m={getBoundingClientRect:p,contextElement:n.view.dom},t[7]=n.view.dom,t[8]=p,t[9]=m):m=t[9];let h=m,g;t[10]===n?g=t[11]:(g=Mj(n),t[10]=n,t[11]=g);let _=g,v;t[12]!==_||t[13]!==h?(v=()=>{let e=a.current;e&&(c.current?.(),c.current=hr(h,e,()=>{dr(h,e,{placement:`top`,strategy:`fixed`,middleware:[fr(8),lr(_),vr({padding:8}),mr(_)]}).then(t=>{let{x:n,y:r,middlewareData:i}=t;e.isConnected&&(e.style.position=`fixed`,e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.visibility=i.hide?.referenceHidden?`hidden`:`visible`)}).catch(CM)}))},t[12]=_,t[13]=h,t[14]=v):v=t[14];let y=v,b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{c.current?.(),c.current=null,s(SM)},t[15]=b):b=t[15];let x=b,S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S={padding:8},t[16]=S):S=t[16];let C;t[17]!==_||t[18]!==y?(C={onShow:y,onHide:x,strategy:`fixed`,flip:_,shift:S,hide:_},t[17]=_,t[18]=y,t[19]=C):C=t[19];let w;t[20]!==n||t[21]!==f||t[22]!==u||t[23]!==i||t[24]!==o?(w=u?(0,Z.jsx)(Zj,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(Lj,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pj,{editor:n}),(0,Z.jsx)($r,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(lM,{editor:n},o),(0,Z.jsx)($r,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(_M,{editor:n,shortcutEnabled:i},`${o}-link`),(0,Z.jsx)(oM,{editor:n},`${o}-footnote`),(0,Z.jsx)(vM,{editor:n},`${o}-view-source`),(0,Z.jsx)(uj,{},`${o}-comment`)]}),t[20]=n,t[21]=f,t[22]=u,t[23]=i,t[24]=o,t[25]=w):w=t[25];let T;return t[26]!==n||t[27]!==C||t[28]!==w?(T=(0,Z.jsx)(lj,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:xM,shouldShow:eM,updateDelay:250,options:C,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:w}),t[26]=n,t[27]=C,t[28]=w,t[29]=T):T=t[29],T}function xM(){return document.body}function SM(e){return e+1}function CM(){}function wM(e){return zj(e.editor)}function TM(e){return $j(e.editor)}var EM=new Da(`markdownLintDecorations`),DM=`ok-lint-block`,OM=`ok-lint-block-error`,kM=`ok-lint-block-atom`,AM=400;function jM(e,t,n){let r=new Map;if(t.length===0)return r;let{spans:i,fmLineCount:a}=Hf(e,n);for(let e of t){let t=e.range.start.line+1;if(a>0&&t<=a)continue;let n=If(i,t);if(n===null)continue;let o=r.get(n);o?o.push(e):r.set(n,[e])}return r}var MM=`data-ok-lint`,NM=`data-ok-lint-fixable`;function PM(e,t){let n=new Map;if(t.size===0)return{set:xa.empty,fixesByOffset:n};let r=[],i=0;return e.forEach((e,a)=>{let o=t.get(i);if(i+=1,!o||o.length===0)return;let s=o.some(e=>e.severity===`error`),c=o.map(e=>`${e.source}/${e.code}: ${e.message}`).join(`
11
- `),l=[DM];e.textContent.length===0&&l.push(kM),s&&l.push(OM);let u={class:l.join(` `),[MM]:c},d=sC(o);d.length>0&&(u[NM]=`1`,n.set(a,d)),r.push(fo.node(a,a+e.nodeSize,u))}),{set:xa.create(e,r),fixesByOffset:n}}function FM(e,t){let n=document.createElement(`div`);n.className=`ok-lint-tooltip`,n.hidden=!0;let r=document.createElement(`div`);r.className=`ok-lint-tooltip-message`,n.appendChild(r);let i=document.createElement(`button`);i.type=`button`,i.className=Y(`ok-lint-tooltip-fix`,un({variant:`default`,size:`xs`}),`mt-1 self-start`),i.hidden=!0,n.appendChild(i),n.style.position=`fixed`,n.style.top=`0`,n.style.left=`0`,document.body.appendChild(n);let a=null,o=!1,s=null,c=null,l=0,u=0,d={getBoundingClientRect:()=>({width:0,height:0,x:l,y:u,top:u,left:l,right:l,bottom:u})};function f(){s!==null&&(clearTimeout(s),s=null)}function p(){f(),a=null,n.hidden=!0,c?.(),c=null}function m(){o||(f(),s=setTimeout(p,140))}function h(){dr(d,n,{placement:`top-start`,middleware:[fr(6),lr(),vr({padding:8})]}).then(({x:e,y:t})=>{n.isConnected&&(n.style.left=`${e}px`,n.style.top=`${t}px`)}).catch(e=>{n.isConnected&&console.warn(`[markdown-lint] tooltip computePosition failed`,e)})}function g(e){let s=e.getAttribute(MM);if(!s){m();return}f(),a=e,r.textContent=s;let l=t.applyFix?t.getFixes(e):[];l.length>0&&t.applyFix?(i.hidden=!1,i.textContent=zu._({id:`c4fVUV`}),i.onclick=()=>{t.applyFix?.(l),o=!1,p()}):(i.hidden=!0,i.onclick=null),n.hidden=!1,c?.(),c=hr(d,n,h)}function _(e){let t=e,n=e.target?.closest(`.${DM}`)??null;n?n===a?f():(l=t.clientX,u=t.clientY,g(n)):a&&m()}function v(e){let t=e.relatedTarget;if(t===n||t?.closest(`.ok-lint-tooltip`)){f();return}t?.closest(`.${DM}`)||m()}function y(){o=!0,f()}function b(e){o=!1;let t=e.relatedTarget;t!==a&&!t?.closest(`.${DM}`)&&m()}return n.addEventListener(`pointerenter`,y),n.addEventListener(`pointerleave`,b),e.dom.addEventListener(`pointerover`,_),e.dom.addEventListener(`pointerout`,v),{destroy(){f(),c?.(),e.dom.removeEventListener(`pointerover`,_),e.dom.removeEventListener(`pointerout`,v),n.remove()}}}var IM=wo.create({name:`markdownLintDecorations`,addOptions(){return{docName:``,getSource:void 0,applyFix:void 0}},addProseMirrorPlugins(){let{docName:e,getSource:t,applyFix:n}=this.options,r=new Wa({extensions:Ta});return[new Aa({key:EM,state:{init:()=>xa.empty,apply(e,t){return e.getMeta(EM)||t.map(e.mapping,e.doc)}},props:{decorations(e){return EM.getState(e)??null}},view(i){let a=null,o=null,s=!1,c=0,l=new Map;async function u(){if(s)return;let n=t?.()??null,r=a?.enabled?await d(a):{kind:`ok`,set:xa.empty,fixesByOffset:new Map};if(s||r.kind===`stale`)return;if(r.kind===`mismatch`){c<2&&(c+=1,f());return}c=0,l=r.fixesByOffset;let o=r.set,u=EM.getState(i.state)??xa.empty;if((o.find().length>0||u.find().length>0)&&i.dispatch(i.state.tr.setMeta(EM,o)),a?.enabled){let t=Qf(e);t?.kind===`lint`&&g(t.detail)&&Vf(e)}n!==null&&!s&&t?.()!==n&&f()}async function d(n){let a=i.state.doc,o=t?.()??r.serialize(a.toJSON()),s=await na(o,n,e);if(!i.state.doc.eq(a))return{kind:`stale`};let{spans:c}=Hf(o,r);return c.length===Rf(a)?{kind:`ok`,...PM(a,jM(o,s,r))}:{kind:`mismatch`}}function f(){o&&clearTimeout(o),o=setTimeout(()=>{u().catch(e=>{console.warn(`[markdown-lint] decoration pass failed`,e)})},AM)}let p=0;async function m(){let t=++p,n=await Np(e);s||t!==p||(a=n,await u())}let h=()=>{m().catch(e=>{console.warn(`[markdown-lint] config load/lint pass failed`,e)})};function g(n){if(!i.dom.isConnected||i.dom.offsetParent===null)return!1;let{spans:a,fmLineCount:o}=Hf(t?.()??r.serialize(i.state.doc.toJSON()),r);if(a.length!==Rf(i.state.doc)||o>0&&n.line<=o)return!1;let s=If(a,n.line);if(s===null)return!1;let c=-1;return i.state.doc.forEach((e,t,n)=>{n===s&&(c=t)}),c<0?!1:wt(e,()=>{i.dispatch(i.state.tr.setSelection(yo.near(i.state.doc.resolve(c+1)))),i.focus();let e=i.nodeDOM(c);e instanceof HTMLElement&&e.scrollIntoView({behavior:`smooth`,block:`start`})})}function _(t){let n=t.detail;!n||s||g(n)&&Vf(e)}h();let v=Mp(h),y=FM(i,{getFixes:e=>{if(e.getAttribute(NM)!==`1`||l.size===0)return[];let t;try{t=i.posAtDOM(e,0)}catch(e){return console.warn(`[markdown-lint] posAtDOM failed on lint block; Fix button suppressed`,e),[]}let n=Math.min(Math.max(t,0),i.state.doc.content.size),r=i.state.doc.resolve(n),a=r.depth>=1?r.before(1):0;return l.get(a)??[]},applyFix:n});window.addEventListener(qf,_);let b=()=>{s||f()};return window.addEventListener(iC,b),{update(e,t){e.state.doc.eq(t.doc)||f()},destroy(){s=!0,o&&clearTimeout(o),v(),y.destroy(),window.removeEventListener(qf,_),window.removeEventListener(iC,b)}}}})]}}),LM=1400,RM=new Da(`okAgentInsertFlash`);function zM(e,t){let n=e.content.findDiffStart(t.content);if(n==null)return null;let r=e.content.findDiffEnd(t.content),i=t.content.size,a=Math.max(0,Math.min(n,i)),o=Math.max(a,Math.min(r?.b??i,i));return o<=a?null:{from:a,to:o}}var BM=6e3;function VM(){return new Aa({key:RM,state:{init:()=>xa.empty,apply(e,t){let n=t.map(e.mapping,e.doc),r=e.getMeta(RM);if(r===void 0)return n;if(r.sweep===!0){let e=n.find().filter(e=>r.now-(e.spec.addedAt??0)>=LM);e.length>0&&(n=n.remove(e))}if(r.add!==void 0&&r.add.to>r.add.from){let t={addedAt:r.now};n=n.add(e.doc,[fo.inline(r.add.from,r.add.to,{class:`ok-agent-insert-flash`},t)])}return n}},props:{decorations(e){return RM.getState(e)}}})}function HM(e,t){return(n,r)=>{let i=r,a=dm(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function UM(e,t){let n=lm(e);t(n.target,{tabBehavior:`append`}),Rd(n.hash)}var WM=5,GM=1;function KM(e){let t=(0,$.c)(14),{editor:n,axis:r,anchor:i,onClickGesture:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(null),c=(0,Q.useRef)(a),l,u;t[0]===a?(l=t[1],u=t[2]):(l=()=>{c.current=a},u=[a],t[0]=a,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{s.current?.abort(),s.current=null,o.current=null,document.body.style.cursor=``,document.body.style.userSelect=``},f=[],t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f);let[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>!(e&&o.current!==null),t[5]=_):_=t[5];let v=_,y;t[6]!==i||t[7]!==r||t[8]!==n?(y=e=>{if(e.button!==0)return;s.current?.abort(),o.current={startX:e.clientX,startY:e.clientY,isDragging:!1,lastTarget:null};let t=new AbortController;s.current=t;let{signal:a}=t,l=e=>{let t=o.current;if(!t)return;if(!t.isDragging){let n=e.clientX-t.startX,r=e.clientY-t.startY;if(Math.hypot(n,r)<WM)return;t.isDragging=!0,m(!0),document.body.style.cursor=`grabbing`,document.body.style.userSelect=`none`}let n=qM(i,r,e.clientX,e.clientY);t.lastTarget=n,g(n)},u=()=>{t.abort(),s.current===t&&(s.current=null),document.body.style.cursor=``,document.body.style.userSelect=``;let e=o.current;o.current=null,m(!1),g(null),e&&(e.isDragging&&e.lastTarget?ZM(n,i,r,e.lastTarget.index):e.isDragging||c.current())};document.addEventListener(`pointermove`,l,{signal:a}),document.addEventListener(`pointerup`,u,{signal:a}),document.addEventListener(`pointercancel`,u,{signal:a})},t[6]=i,t[7]=r,t[8]=n,t[9]=y):y=t[9];let b=y,x;return t[10]!==h||t[11]!==p||t[12]!==b?(x={onPointerDown:b,shouldAllowOpen:v,isDragging:p,indicator:h},t[10]=h,t[11]=p,t[12]=b,t[13]=x):x=t[13],x}function qM(e,t,n,r){let i=e.closest(`table`);if(!i)return null;let a=i.getBoundingClientRect();if(t===`row`){let e=Array.from(i.rows);if(e.length===0)return null;for(let t=0;t<e.length;t++){let n=e[t].getBoundingClientRect();if(r<n.top)return{index:GM,rect:YM(a,JM(e,0,n.top))};if(r<=n.bottom){let i=r>=n.top+n.height/2,o=i?t+1:t,s=Math.max(GM,o);return{index:s,rect:YM(a,s===o?i?n.bottom:n.top:JM(e,0,n.top))}}}let t=e[e.length-1].getBoundingClientRect();return{index:e.length,rect:YM(a,t.bottom)}}let o=i.rows[0];if(!o)return null;let s=Array.from(o.cells);if(s.length===0)return null;for(let e=0;e<s.length;e++){let t=s[e].getBoundingClientRect();if(n<t.left)return{index:0,rect:XM(a,t.left)};if(n<=t.right){let r=n>=t.left+t.width/2,i=r?t.right:t.left;return{index:r?e+1:e,rect:XM(a,i)}}}let c=s[s.length-1].getBoundingClientRect();return{index:s.length,rect:XM(a,c.right)}}function JM(e,t,n){let r=e[t];return r?r.getBoundingClientRect().bottom:n}function YM(e,t){return{left:e.left,top:t-1,width:e.width,height:2}}function XM(e,t){return{left:t-1,top:e.top,width:2,height:e.height}}function ZM(e,t,n,r){let i=n===`row`?QM(t):t.cellIndex;if(i<0||n===`row`&&(i<GM||r<GM)||r===i||r===i+1)return;let{state:a,view:o}=e,s=$M(a.selection.$from);if(s<0){console.warn(`[table-drag-reorder] no table found at selection depth`);return}let c=a.doc.nodeAt(s);if(!c){console.warn(`[table-drag-reorder] nodeAt returned null at tablePos`,s);return}let l=a.tr;nN(l,s,c,n===`row`?eN(c,i,r):tN(c,i,r)),o.dispatch(l)}function QM(e){let t=e.parentElement,n=t?.closest(`table`);return n?Array.prototype.indexOf.call(n.rows,t):-1}function $M(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole===`table`)return e.before(t);return-1}function eN(e,t,n){let r=[];e.forEach(e=>{r.push(e)});let[i]=r.splice(t,1),a=n>t?n-1:n;return r.splice(a,0,i),e.type.create(e.attrs,r,e.marks)}function tN(e,t,n){let r=n>t?n-1:n,i=[];return e.forEach(e=>{let n=[];e.forEach(e=>{n.push(e)});let[a]=n.splice(t,1);n.splice(r,0,a),i.push(e.type.create(e.attrs,n,e.marks))}),e.type.create(e.attrs,i,e.marks)}function nN(e,t,n,r){e.replaceRangeWith(t,t+n.nodeSize,r)}function rN(e){return[...e?[{label:`Toggle header column`,icon:c_,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:Zn,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:Jn,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:Tu,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:C_,run:e=>e.chain().focus().deleteTable().run()}]}function iN(e){return[...e?[{label:`Toggle header row`,icon:nv,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:sr,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:rr,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:Tu,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:C_,run:e=>e.chain().focus().deleteTable().run()}]}function aN(e){if(!e.isEditable||it(e.state).query)return null;let{state:t,view:n}=e,r=t.selection.$from,i=-1;for(let e=r.depth;e>0;e--){let t=r.node(e).type.spec.tableRole;if(t===`cell`||t===`header_cell`){i=r.before(e);break}}if(i<0)return null;let a=n.nodeDOM(i);if(!(a instanceof HTMLTableCellElement))return null;let o=a.closest(`table`),s=a.closest(`tr`),c=a.closest(`.ProseMirror`);if(!o||!s||!c)return null;let l=Array.prototype.indexOf.call(o.rows,s),u=a.cellIndex,d=o.rows[0]?.cells[u],f=o.rows[l]?.cells[0];return!d||!f?null:{columnAnchor:d,rowAnchor:f,isFirstColumn:u===0,isFirstRow:l===0}}function oN(e){let t=(0,$.c)(37),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(!1),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>c(!0),t[0]=l):l=t[0];let u;t[1]!==r||t[2]!==i||t[3]!==n?(u={editor:n,axis:i,anchor:r,onClickGesture:l},t[1]=r,t[2]=i,t[3]=n,t[4]=u):u=t[4];let d=KM(u),f,p;t[5]!==r||t[6]!==i?(f=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return hr(r,e,()=>{dr(r,e,{strategy:`absolute`,placement:t,middleware:[fr(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(sN)})},p=[r,i],t[5]=r,t[6]=i,t[7]=f,t[8]=p):(f=t[7],p=t[8]),(0,Q.useEffect)(f,p);let m=i===`column`?f_:Ms,h;t[9]===d?h=t[10]:(h=e=>{d.shouldAllowOpen(e)&&c(e)},t[9]=d,t[10]=h);let g=i===`column`?`h-3 w-7 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative cursor-grab before:absolute before:-inset-[6px] before:content-[""]`:`h-7 w-3 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative cursor-grab before:absolute before:-inset-[6px] before:content-[""]`,_=i===`column`?`Column options`:`Row options`,v;t[11]===m?v=t[12]:(v=(0,Z.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t[11]=m,t[12]=v);let y;t[13]!==d.onPointerDown||t[14]!==g||t[15]!==_||t[16]!==v?(y=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{variant:`secondary`,onPointerDown:d.onPointerDown,className:g,"aria-label":_,children:v})}),t[13]=d.onPointerDown,t[14]=g,t[15]=_,t[16]=v,t[17]=y):y=t[17];let b=i===`column`?`center`:`start`,x=i===`column`?`bottom`:`right`,S;if(t[18]!==n||t[19]!==a){let e;t[21]===n?e=t[22]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(qr,{}),(0,Z.jsxs)(Ir,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[21]=n,t[22]=e),S=a.map(e),t[18]=n,t[19]=a,t[20]=S}else S=t[20];let C;t[23]!==b||t[24]!==x||t[25]!==S?(C=(0,Z.jsx)(Wr,{align:b,side:x,className:`w-auto min-w-44 whitespace-nowrap`,children:S}),t[23]=b,t[24]=x,t[25]=S,t[26]=C):C=t[26];let w;t[27]!==s||t[28]!==C||t[29]!==h||t[30]!==y?(w=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(Kr,{open:s,onOpenChange:h,children:[y,C]})}),t[27]=s,t[28]=C,t[29]=h,t[30]=y,t[31]=w):w=t[31];let T;t[32]===d.indicator?T=t[33]:(T=d.indicator&&(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none fixed z-50 bg-primary`,style:{left:d.indicator.rect.left,top:d.indicator.rect.top,width:d.indicator.rect.width,height:d.indicator.rect.height}}),t[32]=d.indicator,t[33]=T);let E;return t[34]!==w||t[35]!==T?(E=(0,Z.jsxs)(Z.Fragment,{children:[w,T]}),t[34]=w,t[35]=T,t[36]=E):E=t[36],E}function sN(){}function cN(e){let t=(0,$.c)(18),{editor:n}=e,[r,i]=(0,Q.useState)(null),a,o;if(t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=()=>i(e=>{let t=aN(n);return e&&t&&e.columnAnchor===t.columnAnchor&&e.rowAnchor===t.rowAnchor?e:t});return e(),n.on(`selectionUpdate`,e),n.on(`update`,e),()=>{n.off(`selectionUpdate`,e),n.off(`update`,e)}},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),!r)return null;let s=r.columnAnchor,c;t[3]===r.isFirstColumn?c=t[4]:(c=rN(r.isFirstColumn),t[3]=r.isFirstColumn,t[4]=c);let l;t[5]!==r.columnAnchor||t[6]!==n||t[7]!==c?(l=(0,Z.jsx)(oN,{editor:n,anchor:s,axis:`column`,items:c}),t[5]=r.columnAnchor,t[6]=n,t[7]=c,t[8]=l):l=t[8];let u=r.rowAnchor,d;t[9]===r.isFirstRow?d=t[10]:(d=iN(r.isFirstRow),t[9]=r.isFirstRow,t[10]=d);let f;t[11]!==r.rowAnchor||t[12]!==n||t[13]!==d?(f=(0,Z.jsx)(oN,{editor:n,anchor:u,axis:`row`,items:d}),t[11]=r.rowAnchor,t[12]=n,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Z.jsxs)(`div`,{className:`ok-table-cell-handle-layer`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function lN(e){let{fragment:t,docName:n}=e,r=!1,i=!1,a=!1,o=()=>{r=!0},s=e=>{console.warn(`[walk-currency] ${e} at view init — stale pre-warm cannot be invalidated: a remote edit that landed in the construct→mount gap will not render, and the first local transaction may silently erase it from the CRDT for every peer and disk (vendored y-tiptap contract change? re-verify y-tiptap.cjs:263-268)`)},c=()=>{i&&(i=!1,t.unobserveDeep(o))},l=e=>{let t=ie.getState(e.state)?.binding;if(!t){Ed.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){Ed.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}Ed.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return wo.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new Aa({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var uN=new WeakMap;function dN(e){let t=document.createElement(`span`);t.classList.add(`collaboration-cursor__caret`),t.style.borderColor=e.color;let n=document.createElement(`div`);return n.classList.add(`collaboration-cursor__label`),n.style.backgroundColor=e.color,n.style.color=aa(e.color),n.textContent=e.name,t.append(n),t}var fN={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null};function pN(e,t){let n=null;for(let[r,i]of e.entries()){let e=i;typeof e?.timestamp!=`number`||e.timestamp<=t||(n===null||e.timestamp>n.entry.timestamp)&&(n={key:`${r}:${e.timestamp}`,entry:e})}return n}var mN=100,hN=100,gN=3,_N=250;function vN(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function yN(e,t){let n=In(e);if(!n||t.contains(n.dom))return!1;if(!vN(e))return console.warn(`[TiptapEditor] TipTap EditorContent binding fields missing; detached editor repair skipped`),!1;let r=e;if(r.contentComponent==null)return!1;try{n.setProps({nodeViews:{}})}catch{}return r.contentComponent=null,r.isEditorContentInitialized=!1,!0}function bN(){let e=new Wa({extensions:Ta});return{mdManager:e,text:N({mdManager:e}),html:Be({mdManager:e}),paste:R({mdManager:e}),copy:o({mdManager:e}),drop:m({mdManager:e})}}function xN(e,t){return t?{collaboration:vt.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[lN({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:vt.configure({document:e.document}),guard:[]}}function SN(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=xN(t,r);return[...Ye.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),BT.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,wo.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[k]}}),wo.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[w(e,{cursorBuilder:dN})]}}),wo.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[MA({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,jj,IM.configure({docName:t.configuration.name??``,getSource:()=>t.document.getText(`source`).toString(),applyFix:e=>cC(t,e)})]}function CN(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{uN.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=uN.get(e);if(uN.delete(e),r==null)return;let i=performance.now();Ed(`ok/editor/create-tiptap`,{docName:t.configuration.name??`unknown`,ytextLength:t.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-4 pb-4 h-full`},clipboardTextParser:(e,t,r,i)=>{let a=n.mdManager.parse(e);return i.state.schema.nodeFromJSON(a).content},clipboardTextSerializer:(e,t)=>n.text(e,t),clipboardSerializer:n.html.serializer,handlePaste:(e,t)=>n.paste(e,t),handleDrop:HM(n.drop,e.onSidebarDrop),handleDOMEvents:{copy:(e,t)=>n.copy(e,t,!1),cut:(e,t)=>n.copy(e,t,!0)}},extensions:gA(SN(e))}}function wN(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=CN({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:c,onWedged:a,onSidebarDrop:o}),u=l.onBeforeCreate;return{...l,onBeforeCreate:e=>{u?.(e);let{editor:t}=e,{doc:n,mapping:r}=oe(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var TN=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(fN),c=vA(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=ot(),p=n.configuration.name??``,[m]=(0,Q.useState)(bN),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new ta(wN({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;Ed(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{UM(e,f)}})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=m,t[1]=p,t[2]=f,t[3]=r,t[4]=n,t[5]=d,t[6]=h):h=t[6];let[g]=(0,Q.useState)(h),_,v;if(t[7]!==g||t[8]!==p||t[9]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=H(p)??crypto.randomUUID();_=Q.use,v=He({docName:p,mountId:r,construct:g,sizeStats:e}),t[7]=g,t[8]=p,t[9]=n.document,t[10]=_,t[11]=v}else _=t[10],v=t[11];let y=_(v),b=y.editor,x,S;t[12]===y?(x=t[13],S=t[14]):(x=()=>()=>{we(y)},S=[y],t[12]=y,t[13]=x,t[14]=S),(0,Q.useEffect)(x,S);let C;return t[15]!==u||t[16]!==p||t[17]!==b||t[18]!==c||t[19]!==i||t[20]!==a||t[21]!==l||t[22]!==n?(C=(0,Z.jsx)(EN,{provider:n,isSourceMode:i,docName:p,activeDocName:u,identity:c,principal:l,editor:b,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[15]=u,t[16]=p,t[17]=b,t[18]=c,t[19]=i,t[20]=a,t[21]=l,t[22]=n,t[23]=C):C=t[23],C},EN=e=>{let t=(0,$.c)(127),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:u,flashStateRef:d,portalTarget:f}=e,p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(0),g,_;t[0]===f?(g=t[1],_=t[2]):(g=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},_=[f],t[0]=f,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_);let v,y;t[3]!==c||t[4]!==f?(v=()=>{yN(c,f)&&h(DN)},y=[c,f],t[3]=c,t[4]=f,t[5]=v,t[6]=y):(v=t[5],y=t[6]),(0,Q.useEffect)(v,y);let b;t[7]!==c||t[8]!==n.configuration.name?(b=()=>(Hn(c,n.configuration.name??null),()=>{Hn(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=b):b=t[9];let x;t[10]!==c||t[11]!==n?(x=[c,n],t[10]=c,t[11]=n,t[12]=x):x=t[12],(0,Q.useEffect)(b,x);let C;t[13]!==c||t[14]!==n.configuration.name?(C=()=>{let e=n.configuration.name;if(e)return S(e,c),()=>at(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=C):C=t[15];let w;t[16]!==c||t[17]!==n?(w=[c,n],t[16]=c,t[17]=n,t[18]=w):w=t[18],(0,Q.useEffect)(C,w);let T;t[19]!==c||t[20]!==r||t[21]!==n.configuration.name||t[22]!==n.document?(T=()=>{if(r)return;let e=n.configuration.name;if(!e||!zf(e))return;let t=!1,i=null,a=()=>{queueMicrotask(()=>{if(t)return;let r=Mf(e);r?.kind===`selection-offset`&&(i=Ff({editor:c,docName:e,navigation:r,ydoc:n.document,transition:{from:`source`,to:`wysiwyg`}}))})};return In(c)?a():c.on(`create`,a),()=>{t=!0,c.off(`create`,a),i?.cancel(`mode-flip`)}},t[19]=c,t[20]=r,t[21]=n.configuration.name,t[22]=n.document,t[23]=T):T=t[23];let E;t[24]!==c||t[25]!==r||t[26]!==n?(E=[c,n,r],t[24]=c,t[25]=r,t[26]=n,t[27]=E):E=t[27],(0,Q.useEffect)(T,E);let D;t[28]!==c||t[29]!==n.configuration.name?(D=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,tp(e,`wysiwyg`,Zf(c)),pp(e,`wysiwyg`,mp(c,e))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),c.on(`selectionUpdate`,i),c.on(`update`,i),()=>{t&&clearTimeout(t),c.off(`selectionUpdate`,i),c.off(`update`,i),tp(e,`wysiwyg`,null),pp(e,`wysiwyg`,null)}},t[28]=c,t[29]=n.configuration.name,t[30]=D):D=t[30];let O;t[31]!==c||t[32]!==n?(O=[c,n],t[31]=c,t[32]=n,t[33]=O):O=t[33],(0,Q.useEffect)(D,O);let k;t[34]!==c||t[35]!==n.configuration.name?(k=()=>{},t[34]=c,t[35]=n.configuration.name,t[36]=k):k=t[36];let A;t[37]!==c||t[38]!==n?(A=[c,n],t[37]=c,t[38]=n,t[39]=A):A=t[39],(0,Q.useEffect)(k,A);let j,M;t[40]===c?(j=t[41],M=t[42]):(j=()=>{let e=ON,t=null,n=()=>{if(t||c.isDestroyed)return;let n=In(c);n&&(t=n.dom,t.addEventListener(`keydown`,e),t.addEventListener(`paste`,e),t.addEventListener(`drop`,e),t.addEventListener(`cut`,e))},r=()=>{t&&=(t.removeEventListener(`keydown`,e),t.removeEventListener(`paste`,e),t.removeEventListener(`drop`,e),t.removeEventListener(`cut`,e),null)};return In(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},M=[c],t[40]=c,t[41]=j,t[42]=M),(0,Q.useEffect)(j,M);let N,P;t[43]!==i||t[44]!==c?(N=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!In(c))return;e=!0;let t=Je(i)?.selection??null;if(t)try{let e=c.state.doc.content.size;if(t.type===`text`){let n=Math.max(0,Math.min(t.anchor,e)),r=Math.max(0,Math.min(t.head,e));c.commands.setTextSelection({from:n,to:r})}else{let n=Math.max(0,Math.min(t.from,e));c.commands.setNodeSelection(n)}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(JSON.stringify({event:`ok-editor-selection-restore-failed`,docName:i,message:n})),Ed(`ok/editor/selection-restore-failed`,{docName:i,message:n})}ve(i)};if(In(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},P=[c,i],t[43]=i,t[44]=c,t[45]=N,t[46]=P):(N=t[45],P=t[46]),(0,Q.useEffect)(N,P);let F,I;t[47]!==d||t[48]!==n.document||t[49]!==u?(F=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{d.current=e;let t=u.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},l=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(d.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},oa)};c(fN);let f=()=>{if(no(e),!ya(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),l()},e)}return}r=n,l()};e.observe(f);let p=()=>{document.visibilityState===`visible`?ya(e,t)&&(t=Date.now(),r=Date.now(),l()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},I=[n.document,d,u],t[47]=d,t[48]=n.document,t[49]=u,t[50]=F,t[51]=I):(F=t[50],I=t[51]),(0,Q.useEffect)(F,I);let L=(0,Q.useRef)(null),R;t[52]!==a||t[53]!==i||t[54]!==c||t[55]!==n?(R=()=>{let e=VM(),t=n.document.getMap(`agent-flash`),r=null,o=!1;queueMicrotask(()=>{o||c.isDestroyed||c.registerPlugin(e)});let s=[],l=()=>c.editorView??null,u=(e,t,n)=>{if(e.dispatch(e.state.tr.setMeta(RM,{add:{from:t,to:n},now:Date.now()})),r!==null&&clearTimeout(r),r=window.setTimeout(()=>{r=null;let e=l();e?.dispatch(e.state.tr.setMeta(RM,{now:Date.now(),sweep:!0}))},LM+50),!vp()||document.visibilityState!==`visible`||e.hasFocus())return;let a=()=>{let e=l();if(!(e==null||e.hasFocus()||document.visibilityState!==`visible`)&&!Ne(i))try{let r=e.state.doc.content.size,i=Math.max(0,Math.min(Math.floor((t+n)/2),r-1)),a=e.domAtPos(i),o=a.node,s=o.nodeType===Node.TEXT_NODE?o.parentElement:o.childNodes[a.offset]??o,c=s instanceof HTMLElement?s:s?.parentElement??null;if(c==null)return;let l=c.getBoundingClientRect();if(l.top>=0&&l.bottom<=window.innerHeight)return;c.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}};requestAnimationFrame(a),s.push(window.setTimeout(a,250),window.setTimeout(a,550))},d=e=>{let{transaction:n}=e;if(!n.docChanged||n.getMeta(ie)?.isChangeOrigin!==!0||!ya(t,Date.now()-1400)||i!==a)return;let r=pN(t,Date.now()-LM);if(r!==null&&r.key===L.current)return;let o=zM(n.before,n.doc);if(o===null)return;let s=l();s!=null&&(r!==null&&(L.current=r.key),u(s,o.from,o.to))};c.on(`transaction`,d);let f=()=>{if(o||i!==a)return;let e=l();if(e==null)return;let n=pN(t,Date.now()-BM);if(n===null||n.key===L.current)return;let r=n.entry.changedBlocks;if(r===void 0)return;let s=Lf(e.state.doc,r.from,r.to);s!==null&&(L.current=n.key,u(e,s.from,s.to))},p=requestAnimationFrame(f),m=()=>{requestAnimationFrame(f)};return n.on(`synced`,m),()=>{o=!0,c.off(`transaction`,d),n.off(`synced`,m),cancelAnimationFrame(p),r!==null&&clearTimeout(r);for(let e of s)clearTimeout(e);c.unregisterPlugin(RM)}},t[52]=a,t[53]=i,t[54]=c,t[55]=n,t[56]=R):R=t[56];let z;t[57]!==a||t[58]!==i||t[59]!==c||t[60]!==n.document||t[61]!==n.off||t[62]!==n.on?(z=[c,n.document,i,a,n.on,n.off],t[57]=a,t[58]=i,t[59]=c,t[60]=n.document,t[61]=n.off,t[62]=n.on,t[63]=z):z=t[63],(0,Q.useEffect)(R,z);let B,V;t[64]!==a||t[65]!==i||t[66]!==c||t[67]!==r||t[68]!==n?(B=()=>{if(r)return;let e=0,t,o=null,s=null,l=null,u=function(){if(e<mN){e+=1,t=window.setTimeout(m,hN);return}o=null,s=null,e=0},d=function(e){let t=In(c);if(!t)return null;let n=CSS.escape(e);return t.dom.querySelector(`#${n}`)??t.dom.querySelector(`[data-mirror-source-id="${n}"]`)},f=function(e){let t=d(e);return t?wt(i,()=>{t.scrollIntoView({behavior:`smooth`,block:`start`})}):!1},p=function(e,n){let r=gN,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(f(e),--r,r>0&&(t=window.setTimeout(o,_N)))};t=window.setTimeout(o,_N)};function m(){if(!o||i!==a)return;let t=o,n=s;if(!n){u();return}f(t)?(l=n,o=null,s=null,e=0,p(t,n)):u()}let h=function(){if(i!==a)return;let n=window.location.hash;if(!o&&l===n)return;let r=Vd(n);if(!r){l=n;return}o=r,s=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),m()},g=function(){if(i===a){if(o){m();return}h()}};return h(),n.on(`synced`,g),c.on(`transaction`,g),window.addEventListener(`hashchange`,h),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,g),c.off(`transaction`,g),window.removeEventListener(`hashchange`,h)}},V=[n,c,i,a,r],t[64]=a,t[65]=i,t[66]=c,t[67]=r,t[68]=n,t[69]=B,t[70]=V):(B=t[69],V=t[70]),(0,Q.useEffect)(B,V);let H,U;t[71]!==i||t[72]!==c?(H=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=In(c);if(!n)return;let r=n.dom.querySelectorAll(`h1, h2, h3, h4, h5, h6`)[t.index];r&&wt(i,()=>{r.scrollIntoView({behavior:`smooth`,block:`start`})})};return window.addEventListener(lp,e),()=>window.removeEventListener(lp,e)},U=[c,i],t[71]=i,t[72]=c,t[73]=H,t[74]=U):(H=t[73],U=t[74]),(0,Q.useEffect)(H,U);let ee;t[75]!==a||t[76]!==i||t[77]!==o||t[78]!==r||t[79]!==s||t[80]!==n.awareness?(ee=()=>{let e=n.awareness;if(!e)return;if(i!==a){e.setLocalState(null);return}e.setLocalState({user:CA({principal:s,identity:o}),mode:r?`source`:`wysiwyg`});let t=SA();return t.start(),t.setAwareness(e),()=>t.clearAwareness(e)},t[75]=a,t[76]=i,t[77]=o,t[78]=r,t[79]=s,t[80]=n.awareness,t[81]=ee):ee=t[81];let W;t[82]!==a||t[83]!==i||t[84]!==o||t[85]!==r||t[86]!==s||t[87]!==n?(W=[n,i,a,o,s,r],t[82]=a,t[83]=i,t[84]=o,t[85]=r,t[86]=s,t[87]=n,t[88]=W):W=t[88],(0,Q.useEffect)(ee,W);let te,G;t[89]!==c||t[90]!==r?(te=()=>(Rn(c,r),()=>{Rn(c,!1)}),G=[c,r],t[89]=c,t[90]=r,t[91]=te,t[92]=G):(te=t[91],G=t[92]),(0,Q.useEffect)(te,G);let ne;t[93]!==a||t[94]!==i||t[95]!==c||t[96]!==r?(ne=!r&&(0,Z.jsx)(bM,{editor:c,shortcutEnabled:i===a}),t[93]=a,t[94]=i,t[95]=c,t[96]=r,t[97]=ne):ne=t[97];let K;t[98]!==a||t[99]!==i||t[100]!==c||t[101]!==r?(K=!r&&(0,Z.jsxs)(Kk,{children:[(0,Z.jsx)(Wk,{editor:c,docName:i,shortcutEnabled:i===a}),(0,Z.jsx)(Ik,{editor:c,docName:i}),(0,Z.jsx)(Jk,{editor:c,docName:i}),i===a&&(0,Z.jsx)(Hk,{editor:c,docName:i})]}),t[98]=a,t[99]=i,t[100]=c,t[101]=r,t[102]=K):K=t[102];let q;t[103]!==c||t[104]!==r?(q=!r&&(0,Z.jsx)(cN,{editor:c}),t[103]=c,t[104]=r,t[105]=q):q=t[105];let re;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[106]=re):re=t[106];let oe;t[107]!==c||t[108]!==m?(oe=(0,Z.jsx)(Ln,{editor:c,className:`tiptap-editor-portal-content h-full`},m),t[107]=c,t[108]=m,t[109]=oe):oe=t[109];let se;t[110]!==f||t[111]!==oe?(se=(0,cD.createPortal)(oe,f),t[110]=f,t[111]=oe,t[112]=se):se=t[112];let ce;t[113]===c?ce=t[114]:(ce=(0,Z.jsx)(Dk,{editor:c}),t[113]=c,t[114]=ce);let le;t[115]===c?le=t[116]:(le=l(c),t[115]=c,t[116]=le);let ue;t[117]===le.store?ue=t[118]:(ue=(0,Z.jsx)(ae,{store:le.store}),t[117]=le.store,t[118]=ue);let de;return t[119]!==ne||t[120]!==K||t[121]!==q||t[122]!==se||t[123]!==ce||t[124]!==ue||t[125]!==u?(de=(0,Z.jsxs)(`div`,{ref:u,className:`tiptap-editor h-full`,"data-agent-flash-state":`idle`,"data-agent-flash-count":`0`,"data-agent-flash-position":`append`,"data-agent-flash-agent-id":``,children:[ne,K,q,re,se,ce,ue]}),t[119]=ne,t[120]=K,t[121]=q,t[122]=se,t[123]=ce,t[124]=ue,t[125]=u,t[126]=de):de=t[126],de};function DN(e){return e+1}function ON(){return Fn()}var kN=null;function AN(e){let t=(0,$.c)(3),n=(0,Q.useRef)(null),r,i;return t[0]===e?(r=t[1],i=t[2]):(r=()=>{if(!e)return;let t=n.current;if(!t)return;let r={};kN=r;let i=document.documentElement,a=null,o=()=>{if(kN!==r)return;let e=`${t.offsetHeight}px`;e!==a&&(a=e,i.style.setProperty(`--conflict-footer-height`,e))};o();let s=new ResizeObserver(o);return s.observe(t),()=>{s.disconnect(),kN===r&&(kN=null,i.style.removeProperty(`--conflict-footer-height`))}},i=[e],t[0]=e,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i),n}var jN=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function MN(e,t,n,r,i,a){if(e==r)return[];let o=HN(e,t,n,r,i,a),s=UN(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new jN(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new jN(t,t+o,i,i),new jN(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new jN(t,t,i,i+o),new jN(n,n,i+o+c,a)]}if(c==1||l==1)return[new jN(t,n,i,a)];let u=GN(e,t,n,r,i,a);if(u){let[o,s,c]=u;return MN(e,t,o,r,i,s).concat(MN(e,o+c,n,r,s+c,a))}return IN(e,t,n,r,i,a)}var NN=1e9,PN=0,FN=!1;function IN(e,t,n,r,i,a){let o=n-t,s=a-i;if(NN<1e9&&Math.min(o,s)>NN*16||PN>0&&Date.now()>PN)return Math.min(o,s)>NN*64?[new jN(t,n,i,a)]:KN(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);RN.reset(c),zN.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:zN,f=d?null:RN;for(let p=0;p<c;p++){if(p>NN||PN>0&&!(p&63)&&Date.now()>PN)return KN(e,t,n,r,i,a);let m=RN.advance(p,o,s,c,d,!1,l)||zN.advance(p,o,s,c,f,!0,u);if(m)return BN(e,t,n,t+m[0],r,i,a,i+m[1])}return[new jN(t,n,i,a)]}var LN=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1)if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}return null}},RN=new LN,zN=new LN;function BN(e,t,n,r,i,a,o,s){let c=!1;return!sP(e,r)&&++r==n&&(c=!0),!sP(i,s)&&++s==o&&(c=!0),c?[new jN(t,n,a,o)]:MN(e,t,r,i,a,s).concat(MN(e,r,n,i,s,o))}function VN(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function HN(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=VN(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!sP(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function UN(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=VN(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!sP(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function WN(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){sP(e,s)||s++;let u=s+o;if(sP(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=HN(e,u,n,r,i+f+d.length,a),c=UN(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function GN(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=GN(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:WN(e,t,n,r,i,a,Math.floor(o/4),-1)}function KN(e,t,n,r,i,a){FN=!0;let o=n-t,s=a-i,c;if(o<s){let s=WN(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=WN(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new jN(t,n,i,a)];let[l,u,d]=c;return MN(e,t,l,r,i,u).concat(MN(e,l+d,n,r,u+d,a))}function qN(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new jN(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function JN(e,t,n){for(;;){qN(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=HN(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new jN(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=UN(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new jN(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new jN(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new jN(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function YN(e,t,n){for(let r=0,i=0;i<e.length;i++){let a=e[i],o=a.toA-a.fromA,s=a.toB-a.fromB;if(o&&s||o>3||s>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-r,u=c-a.toA,d=nP(t,a.fromA,l),f=tP(t,a.toA,u),p=a.fromA-d,m=f-a.toA;if((!o||!s)&&p&&m){let l=Math.max(o,s),[u,h,g]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];l>p&&t.slice(d,a.fromA)==u.slice(g-p,g)?(a=e[i]=new jN(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=tP(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new jN(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=nP(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new jN(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=iP(n,a.fromB,a.toB),r,o=t<0?-1:rP(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=iP(t,a.fromA,a.toA),r,o=n<0?-1:rP(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return qN(e,3),e}var XN;try{XN=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function ZN(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function QN(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!ZN(n):XN?!aP(n)||t==e.length-1?+!!XN.test(String.fromCharCode(n)):XN.test(e.slice(t,t+2))?2:0:0}function $N(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!ZN(n):XN?!oP(n)||t==1?+!!XN.test(String.fromCharCode(n)):XN.test(e.slice(t-2,t))?2:0:0}var eP=8;function tP(e,t,n){if(t==e.length||!$N(e,t))return t;for(let r=t,i=t+n,a=0;a<eP;a++){let t=QN(e,r);if(!t||r+t>i)return r;r+=t}return t}function nP(e,t,n){if(!t||!QN(e,t))return t;for(let r=t,i=t-n,a=0;a<eP;a++){let t=$N(e,r);if(!t||r-t<i)return r;r-=t}return t}function rP(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function iP(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var aP=e=>e>=55296&&e<=56319,oP=e=>e>=56320&&e<=57343;function sP(e,t){return!t||t==e.length||!aP(e.charCodeAt(t-1))||!oP(e.charCodeAt(t))}function cP(e,t,n){let r=n?.override;return r?r(e,t):(NN=(n?.scanLimit??1e9)>>1,PN=n?.timeout?Date.now()+n.timeout:0,FN=!1,JN(e,t,MN(e,0,e.length,t,0,t.length)))}function lP(){return!FN}function uP(e,t,n){return YN(cP(e,t,n),e,t)}var dP=hf.define({combine:e=>e[0]}),fP=tf.define(),pP=hf.define(),mP=rf.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(fP)&&(e=n.value);for(let n of t.state.facet(pP))e=n(e,t);return e}});function hP(e){let t=e.field(mP,!1);if(!t)return null;let n=e.facet(dP);return{chunks:t,side:n?n.side:null}}var gP=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return yP(uP(e.toString(),t.toString(),n),e,t,0,0,lP())}static updateA(e,t,n,r,i){return CP(SP(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return CP(SP(e,r,!1,t.length),e,t,n,i)}};function _P(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[i.from,a.from]}function vP(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.from==e&&a.from==t?[e,t]:[i.to+1,a.to+1]}function yP(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=_P(c.fromA+r,c.fromB+i,t,n),[d,f]=vP(c.toA+r,c.toB+i,t,n),p=[c.offset(-l+r,-u+i)];for(;s<e.length-1;){let a=e[s+1],[o,c]=_P(a.fromA+r,a.fromB+i,t,n);if(o>d+1&&c>f+1)break;p.push(a.offset(-l+r,-u+i)),[d,f]=vP(a.toA+r,a.toB+i,t,n),s++}o.push(new gP(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var bP=1e3;function xP(e,t,n,r){let i=0,a=e.length;for(;;){if(i==a){let r=0,a=0;i&&({toA:r,toB:a}=e[i-1]);let o=t-(n?r:a);return[r+o,a+o]}let o=i+a>>1,s=e[o],[c,l]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(c>t)a=o;else if(l<=t)i=o+1;else return r?[s.fromA,s.fromB]:[s.toA,s.toB]}}function SP(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>bP&&([l,d]=xP(e,a-bP,n,!0)),o<t.length-bP&&([u,f]=xP(e,o+bP,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function CP(e,t,n,r,i){if(!e.length)return t;let a=[];for(let o=0,s=0,c=0,l=0;;o++){let u=o==e.length?null:e[o],d=u?u.fromA+s:n.length,f=u?u.fromB+c:r.length;for(;l<t.length;){let e=t[l];if(u&&(e.toA+s>d||e.toB+c>f))break;a.push(e.offset(s,c)),l++}if(!u)break;let p=u.toA+s+u.diffA,m=u.toB+c+u.diffB,h=uP(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of yP(h,n,r,d,f,lP()))a.push(e);for(s+=u.diffA,c+=u.diffB;l<t.length;){let e=t[l];if(e.fromA+s>p&&e.fromB+c>m)break;l++}}return a}var wP={scanLimit:500},TP=uf.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=FP(e))}update(e){(e.docChanged||e.viewportChanged||DP(e.startState,e.state)||OP(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=FP(e.view))}},{decorations:e=>e.deco}),EP=pf.low(gf({class:`cm-changeGutter`,markers:e=>e.plugin(TP)?.gutter||sf.empty}));function DP(e,t){return e.field(mP,!1)!=t.field(mP,!1)}function OP(e,t){return e.facet(dP)!=t.facet(dP)}var kP=af.line({class:`cm-changedLine`}),AP=af.mark({class:`cm-changedText`}),jP=af.mark({tagName:`ins`,class:`cm-insertedLine`}),MP=af.mark({tagName:`del`,class:`cm-deletedLine`}),NP=new class extends ff{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function PP(e,t,n,r,i,a){let o=n?e.fromA:e.fromB,s=n?e.toA:e.toB,c=0;if(o!=s){i.add(o,o,kP),i.add(o,s,n?MP:jP),a&&a.add(o,o,NP);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,kP),a&&a.add(u,u,NP);continue}let t=u+l.value.length;if(r)for(;c<e.changes.length;){let r=e.changes[c],a=o+(n?r.fromA:r.fromB),s=o+(n?r.toA:r.toB),l=Math.max(u,a),d=Math.min(t,s);if(l<d&&i.add(l,d,AP),s<t)c++;else break}u=t}}}function FP(e){let t=e.state.field(mP),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(dP),o=n==`a`,s=new cf,c=i?new cf:null,{from:l,to:u}=e.viewport;for(let n of t){if((o?n.fromA:n.fromB)>=u)break;(o?n.toA:n.toB)>l&&(!a||!a(e.state,n,s,c))&&PP(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var IP=class extends $d{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement(`div`);return e.className=`cm-mergeSpacer`,e.style.height=this.height+`px`,e}updateDOM(e){return e.style.height=this.height+`px`,!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},LP=tf.define({map:(e,t)=>e.map(t)}),RP=rf.define({create:()=>af.none,update:(e,t)=>{for(let e of t.effects)if(e.is(LP))return e.value;return e.map(t.changes)},provide:e=>df.decorations.from(e)}),zP=.01;function BP(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function VP(e,t,n){let r=new cf,i=new cf,a=e.state.field(RP).iter(),o=t.state.field(RP).iter(),s=0,c=0,l=0,u=0,d=e.viewport,f=t.viewport;for(let p=0;;p++){let m=p<n.length?n[p]:null,h=m?m.fromA:e.state.doc.length,g=m?m.fromB:t.state.doc.length;if(s<h){let n=e.lineBlockAt(s).top+l-(t.lineBlockAt(c).top+u);n<-zP?(l-=n,r.add(s,s,af.widget({widget:new IP(-n),block:!0,side:-1}))):n>zP&&(u+=n,i.add(c,c,af.widget({widget:new IP(n),block:!0,side:-1})))}if(h>s+1e3&&s<d.from&&h>d.from&&c<f.from&&g>f.from){let e=Math.min(d.from-s,f.from-c);s+=e,c+=e,p--}else if(m)s=m.toA,c=m.toB;else break;for(;a.value&&a.from<s;)l-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)u-=o.value.spec.widget.height,o.next()}for(;a.value;)l-=a.value.spec.widget.height,a.next();for(;o.value;)u-=o.value.spec.widget.height,o.next();let p=e.contentHeight+l-(t.contentHeight+u);p<zP?r.add(e.state.doc.length,e.state.doc.length,af.widget({widget:new IP(-p),block:!0,side:1})):p>zP&&i.add(t.state.doc.length,t.state.doc.length,af.widget({widget:new IP(p),block:!0,side:1}));let m=r.finish(),h=i.finish();BP(m,e.state.field(RP))||e.dispatch({effects:LP.of(m)}),BP(h,t.state.field(RP))||t.dispatch({effects:LP.of(h)})}var HP=tf.define({map:(e,t)=>t.mapPos(e)}),UP=class extends $d{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-collapsedLines`,t.textContent=e.state.phrase(`$ unchanged lines`,this.lines),t.addEventListener(`click`,t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:HP.of(n)});let{side:r,sibling:i}=e.state.facet(dP);i&&i().dispatch({effects:HP.of(WP(n,e.state.field(mP),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function WP(e,t,n){let r=0,i=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return i+(e-r);[r,i]=n?[o.toA,o.toB]:[o.toB,o.toA]}}var GP=rf.define({create(e){return af.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(HP)&&(e=e.update({filter:e=>e!=n.value}));if(e.size&&t.state.field(mP)!=t.startState.field(mP,!1)){let n=t.state.facet(dP).side==`a`,r=[];for(let i of t.state.field(mP))e.between(n?i.fromA:i.fromB,n?i.toA:i.toB,e=>{r.push(e)});r.length&&(e=e.update({filter:e=>r.indexOf(e)<0}))}return e},provide:e=>df.decorations.from(e)});function KP({margin:e=3,minSize:t=4}){return GP.init(n=>qP(n,e,t))}function qP(e,t,n){let r=new cf,i=e.facet(dP).side==`a`,a=e.field(mP),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,af.replace({widget:new UP(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var JP=df.styleModule.of(new yf({".cm-mergeView":{overflowY:`auto`},".cm-mergeViewEditors":{display:`flex`,alignItems:`stretch`},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:`hidden`},".cm-merge-revert":{width:`1.6em`,flexGrow:0,flexShrink:0,position:`relative`},".cm-merge-revert button":{position:`absolute`,display:`block`,width:`100%`,boxSizing:`border-box`,textAlign:`center`,background:`none`,border:`none`,font:`inherit`,cursor:`pointer`}})),YP=df.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:`auto !important`,overflowY:`visible !important`},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:`rgba(160, 128, 100, .08)`},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:`rgba(100, 160, 128, .08)`},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat`},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat`},"&light.cm-merge-b .cm-changedText":{background:`linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat`},"&dark.cm-merge-b .cm-changedText":{background:`linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat`},"&.cm-merge-b .cm-deletedText":{background:`#ff000033`},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:`none`},".cm-deletedChunk":{paddingLeft:`6px`,"& .cm-chunkButtons":{position:`absolute`,insetInlineEnd:`5px`},"& button":{border:`none`,cursor:`pointer`,color:`white`,margin:`0 2px`,borderRadius:`3px`,"&[name=accept]":{background:`#2a2`},"&[name=reject]":{background:`#d43`}}},".cm-collapsedLines":{padding:`5px 5px 5px 10px`,cursor:`pointer`,"&:before":{content:`"⦚"`,marginInlineEnd:`7px`},"&:after":{content:`"⦚"`,marginInlineStart:`7px`}},"&light .cm-collapsedLines":{color:`#444`,background:`linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)`},"&dark .cm-collapsedLines":{color:`#ddd`,background:`linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)`},".cm-changeGutter":{width:`3px`,paddingLeft:`1px`},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:`#e43`},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:`#fa9`},"&light.cm-merge-b .cm-changedLineGutter":{background:`#2b2`},"&dark.cm-merge-b .cm-changedLineGutter":{background:`#8f8`},".cm-inlineChangedLineGutter":{background:`#75d`}}),XP=new ef,ZP=new ef,QP=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||wP;let t=[pf.low(TP),YP,JP,RP,df.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(LP)))&&this.measure()})],n=[dP.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(EP);let r=lf.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],df.editorAttributes.of({class:`cm-merge-a`}),ZP.of(n),t]}),i=[dP.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(EP);let a=lf.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],df.editorAttributes.of({class:`cm-merge-b`}),ZP.of(i),t]});this.chunks=gP.build(r.doc,a.doc,this.diffConf);let o=[mP.init(()=>this.chunks),XP.of(e.collapseUnchanged?KP(e.collapseUnchanged):[])];r=r.update({effects:tf.appendConfig.of(o)}).state,a=a.update({effects:tf.appendConfig.of(o)}).state,this.dom=document.createElement(`div`),this.dom.className=`cm-mergeView`,this.editorDOM=this.dom.appendChild(document.createElement(`div`)),this.editorDOM.className=`cm-mergeViewEditors`;let s=e.orientation||`a-b`,c=document.createElement(`div`);c.className=`cm-mergeViewEditor`;let l=document.createElement(`div`);l.className=`cm-mergeViewEditor`,this.editorDOM.appendChild(s==`a-b`?c:l),this.editorDOM.appendChild(s==`a-b`?l:c),this.a=new df({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new df({state:a,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls==`b-to-a`,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(e=>e.docChanged)){let n=e[e.length-1],r=e.reduce((e,t)=>e.compose(t.changes),vf.empty(e[0].startState.doc.length));this.chunks=t==this.a?gP.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):gP.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:fP.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:fP.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if(`diffConfig`in e&&(this.diffConf=e.diffConfig),`orientation`in e){let t=e.orientation!=`b-a`;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent=``)}}if(`revertControls`in e||`renderRevertControl`in e){let t=!!this.revertDOM,n=this.revertToA,r=this.renderRevert;`revertControls`in e&&(t=!!e.revertControls,n=e.revertControls==`b-to-a`),`renderRevertControl`in e&&(r=e.renderRevertControl),this.setupRevertControls(t,n,r)}let t=`highlightChanges`in e,n=`gutter`in e,r=`collapseUnchanged`in e;if(t||n||r){let i=[],a=[];if(t||n){let r=this.a.state.facet(dP),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(ZP.reconfigure([dP.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?EP:[]])),a.push(ZP.reconfigure([dP.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?EP:[]]))}if(r){let t=XP.reconfigure(e.collapseUnchanged?KP(e.collapseUnchanged):[]);i.push(t),a.push(t)}this.a.dispatch({effects:i}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement(`div`),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener(`mousedown`,e=>this.revertClicked(e)),this.revertDOM.className=`cm-merge-revert`):this.revertDOM&&(this.revertDOM.textContent=``)}scheduleMeasure(){this.measuring<0&&(this.measuring=(this.dom.ownerDocument.defaultView||window).requestAnimationFrame(()=>{this.measuring=-1,this.measure()}))}measure(){VP(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let a=this.chunks[i];if(a.fromA>n.to||a.fromB>r.to)break;if(a.fromA<n.from||a.fromB<r.from)continue;let o=this.a.lineBlockAt(a.fromA).top+`px`;for(;t&&+t.dataset.chunk<i;)t=$P(t);t&&t.dataset.chunk==String(i)?(t.style.top!=o&&(t.style.top=o),t=t.nextSibling):e.insertBefore(this.renderRevertButton(o,i),t)}for(;t;)t=$P(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement(`button`);let e=this.a.state.phrase(`Revert this chunk`);n.setAttribute(`aria-label`,e),n.setAttribute(`title`,e),n.textContent=this.revertToLeft?`⇜`:`⇝`}return n.style.top=e,n.setAttribute(`data-chunk`,String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[t,r,i,a,o,s]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],c=t.state.sliceDoc(i,Math.max(i,a-1));i!=a&&s<=r.state.doc.length&&(c+=t.state.lineBreak),r.dispatch({changes:{from:o,to:Math.min(r.state.doc.length,s),insert:c},userEvent:`revert`}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function $P(e){let t=e.nextSibling;return e.remove(),t}var eF=new class extends ff{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},tF=pf.low(gf({class:`cm-changeGutter`,markers:e=>e.plugin(TP)?.gutter||sf.empty,widgetMarker:(e,t)=>t instanceof oF?eF:null}));function nF(e){let t=typeof e.original==`string`?of.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||wP;return[pf.low(TP),dF,YP,df.editorAttributes.of({class:`cm-merge-b`}),pP.of((e,t)=>{let r=t.effects.find(e=>e.is(rF));return r&&(e=gP.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=gP.updateB(e,t.state.field(iF),t.newDoc,t.changes,n)),e}),dP.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?_F:void 0,side:`b`}),iF.init(()=>t),e.gutter===!1?[]:tF,e.collapseUnchanged?KP(e.collapseUnchanged):[],mP.init(e=>gP.build(t,e.doc,n))]}var rF=tf.define(),iF=rf.define({create:()=>of.empty,update(e,t){for(let n of t.effects)n.is(rF)&&(e=n.value.doc);return e}}),aF=new WeakMap,oF=class extends $d{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||=this.buildDOM(e)}};function sF(e,t,n){let r=aF.get(t.changes);if(r)return r;let i=af.widget({block:!0,side:-1,widget:new oF(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(dP),c=document.createElement(`div`);if(c.className=`cm-deletedChunk`,s){let t=c.appendChild(document.createElement(`div`));t.className=`cm-chunkButtons`;let n=e=>{e.preventDefault(),cF(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),lF(r,r.posAtDOM(c))};if(typeof s==`function`)t.appendChild(s(`accept`,n)),t.appendChild(s(`reject`,i));else{let r=t.appendChild(document.createElement(`button`));r.name=`accept`,r.textContent=e.phrase(`Accept`),r.onmousedown=n;let a=t.appendChild(document.createElement(`button`));a.name=`reject`,a.textContent=e.phrase(`Reject`),a.onmousedown=i}}if(n||t.fromA>=t.toA)return c;let l=r.state.field(iF).sliceString(t.fromA,t.endA),u=a&&e.facet(mf),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
12
- `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
13
- `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;nf(t,{style:t=>_f(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return aF.set(t.changes,i),i}function cF(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(mP).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(iF);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=vf.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:rF.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function lF(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(mP).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(iF).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(a+=n.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:a},userEvent:`revert`}),!0}function uF(e){let t=new cf;for(let n of e.field(mP)){let r=e.facet(dP).overrideChunk&&pF(e,n);t.add(n.fromB,n.fromB,sF(e,n,!!r))}return t.finish()}var dF=rf.define({create:e=>uF(e),update(e,t){return t.state.field(mP,!1)==t.startState.field(mP,!1)?e:uF(t.state)},provide:e=>df.decorations.from(e)}),fF=new WeakMap;function pF(e,t){let n=fF.get(t);if(n!==void 0)return n;n=null;let r=e.field(iF),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(af.widget({widget:new mF(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(AP.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return fF.set(t,n),n}var mF=class extends $d{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let t=document.createElement(`del`);return t.className=`cm-deletedText`,t.textContent=this.text,t}},hF=new class extends ff{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},gF=af.line({class:`cm-inlineChangedLine`});function _F(e,t,n,r){let i=pF(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,hF),n.add(o.from,o.from,gF);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var vF=bf({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),yF=Sf({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),bF=df.theme({".cm-deletedChunk .cm-chunkButtons":{display:`flex`,gap:`0.25rem`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button']":{margin:`0`,border:`1px solid transparent`,borderRadius:`min(var(--radius-md), 10px)`,color:`var(--primary-foreground)`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button'][data-variant='destructive']":{color:`var(--destructive)`}});function xF({addControl:e,nextId:t,removeControl:n,root:r}){return(i,a)=>{let o=document.createElement(`span`);o.className=`inline-flex`;let s=t();return e({id:s,host:o,type:i,action:a}),queueMicrotask(()=>{r.contains(o)||n(s)}),o}}function SF(e){let t=(0,$.c)(33),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=Dt(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=Jt(),g=(0,Q.useRef)(c),_=(0,Q.useRef)(l),[v,y]=(0,Q.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[0]=b):b=t[0];let[x,S]=(0,Q.useState)(b),C=AN(a===!0),w;t[1]!==l||t[2]!==c?(w=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=w):w=t[3],(0,Q.useEffect)(w);let T,E;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(T=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?vF:yF,u=[df.editable.of(!1),lf.readOnly.of(!0)],g=[zp,Cf(),...u,l,df.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new df({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=xF({addControl:e=>{r||(t.set(e.id,e.host),S(t=>[...t,e]))},nextId:()=>(m.current+=1,m.current),removeControl:s,root:e}),a=new df({doc:d,extensions:[zp,Cf(),df.editable.of(!1),l,bF,df.lineWrapping,nF({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),df.updateListener.of(e=>{let t=hP(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=hP(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new QP({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new df({doc:d,extensions:[...g,nF({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},E=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,Q.useEffect)(T,E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){let e=p.current;!e||!(e instanceof df)||g.current?.(e.state.doc.toString())},t[12]=D):D=t[12];let O=D,k;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(){let e=p.current;!e||!(e instanceof df)||xf(e)},t[13]=k):k=t[13];let A=k,j=v===0,M;t[14]!==u||t[15]!==v?(M=v===null?``:v===0?u({id:`lPzyrU`}):zu._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=P):P=t[17];let F;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,cD.createPortal)((0,Z.jsx)(X,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),F=x.map(e),t[18]=u,t[19]=x,t[20]=F}else F=t[20];let I;t[23]!==j||t[24]!==C||t[25]!==a||t[26]!==N||t[27]!==l||t[28]!==c?(I=a&&(0,Z.jsxs)(`div`,{ref:C,className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${j?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:N}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(J,{id:`XyOUTJ`})}),(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:A,children:`Undo`}),c&&(0,Z.jsx)(X,{variant:`default`,size:`sm`,disabled:!j,onClick:O,children:(0,Z.jsx)(J,{id:`Lcehxn`})})]})]}),t[23]=j,t[24]=C,t[25]=a,t[26]=N,t[27]=l,t[28]=c,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[P,F,I]}),t[30]=I,t[31]=F,t[32]=L):L=t[32],L}async function CF(e,t,n){try{let r={file:e,strategy:t};n!==void 0&&(r.content=n);let i=await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(i.ok)return{ok:!0};let a;try{let e=await i.json();typeof e.detail==`string`?a=e.detail:typeof e.title==`string`&&(a=e.title)}catch{}return{ok:!1,detail:a}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(JSON.stringify({event:`conflict-resolve-dispatch-failed`,file:e,strategy:t,detail:r})),{ok:!1,detail:r}}}async function wF(e,t){return CF(e,`content`,t)}async function TF(e){return CF(e,`mine`)}async function EF(e){return CF(e,`theirs`)}async function DF(e){return CF(e,`delete`)}async function OF(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json(),r=n.kind===`delete-modify`||n.kind===`modify-delete`||n.kind===`both-modified`?n.kind:`both-modified`;return n.kind!==r&&console.warn(JSON.stringify({event:`conflict-kind-missing-fallback`,file:e,receivedKind:n.kind??null})),{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``,kind:r}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function kF(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=Dt(),{conflicts:i,loading:a}=zs(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>kd(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h=AN(l?.kind===`delete-modify`||l?.kind===`modify-delete`),g,_;t[5]===n?(g=t[6],_=t[7]):(g=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),_=[n],t[5]=n,t[6]=g,t[7]=_),(0,Q.useEffect)(g,_);let v=a||s===void 0,y,b;t[8]!==v||t[9]!==c?(y=()=>{if(v)return;let e=!1;return u(null),f(!1),OF(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},b=[c,v],t[8]=v,t[9]=c,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,Q.useEffect)(y,b);let x;t[12]!==r||t[13]!==c?(x=async function(e){let t=await wF(c,e);t.ok||Mu.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=x):x=t[14];let S=x,C;t[15]!==r||t[16]!==c?(C=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),Mu.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=C):C=t[17];let w=C;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(SF,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(DF),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===w?u=t[36]:(u=()=>void w(EF),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let g;t[44]!==h||t[45]!==i||t[46]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=h,t[45]=i,t[46]=m,t[47]=g):g=t[47];let _;return t[48]!==g||t[49]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[48]=g,t[49]=e,t[50]=_):_=t[50],_}if(l.kind===`modify-delete`){let e;t[51]===l.ours?e=t[52]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(SF,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[51]=l.ours,t[52]=e);let n;t[53]===c?n=t[54]:(n={filePath:c},t[53]=c,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[55]=r):r=t[55];let i;t[56]===n?i=t[57]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(TF),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`0NA4b3`}),t[60]=o):o=t[60];let s;t[61]!==p||t[62]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[61]=p,t[62]=a,t[63]=s):s=t[63];let u;t[64]===w?u=t[65]:(u=()=>void w(DF),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`qSxaOz`}),t[66]=d):d=t[66];let f;t[67]!==p||t[68]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[67]=p,t[68]=u,t[69]=f):f=t[69];let m;t[70]!==s||t[71]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[70]=s,t[71]=f,t[72]=m):m=t[72];let g;t[73]!==h||t[74]!==i||t[75]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[73]=h,t[74]=i,t[75]=m,t[76]=g):g=t[76];let _;return t[77]!==g||t[78]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[77]=g,t[78]=e,t[79]=_):_=t[79],_}let T;t[80]===S?T=t[81]:(T=e=>void S(e),t[80]=S,t[81]=T);let E;return t[82]!==l.ours||t[83]!==l.theirs||t[84]!==T?(E=(0,Z.jsx)(SF,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:T}),t[82]=l.ours,t[83]=l.theirs,t[84]=T,t[85]=E):E=t[85],E}function AF(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Te(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var jF=`__back-nav__`;function MF(e){return e instanceof Ke||e instanceof lt||e instanceof et||e instanceof ge||e instanceof Se||e instanceof B?e.docName:null}function NF(e){return e instanceof Ke||e instanceof lt}function PF(e){if(e instanceof Ke){let t=e.docName;return{title:zu._({id:`Jejur6`}),summary:zu._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof lt){let t=e.docName;return{title:zu._({id:`V7QxyT`}),summary:zu._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof et){let t=e.docName;return{title:zu._({id:`1di5fu`}),summary:zu._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof ge){let t=e.docName;return{title:zu._({id:`wvbc1r`}),summary:zu._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Se)return{title:zu._({id:`Gfr4fu`}),summary:zu._({id:`UW2Fg3`})};if(e instanceof B){let t=e.docName;return{title:zu._({id:`vv7kpg`}),summary:zu._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:zu._({id:`W5A0Ly`});return{title:zu._({id:`29VNqC`}),summary:t}}function FF(e){let t=(0,$.c)(37),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=PF(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!1),m=typeof window<`u`?window.okDesktop:void 0,h=m&&NF(n)?m:null,g,_;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{d.current?.focus()},_=[],t[2]=g,t[3]=_):(g=t[2],_=t[3]),(0,Q.useEffect)(g,_);let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Nh,{size:80,variant:`sleeping`}),t[4]=v):v=t[4];let y;t[5]===c?y=t[6]:(y=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=y);let b;t[7]===l?b=t[8]:(b=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=b);let x;t[9]!==y||t[10]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[y,b]}),t[9]=y,t[10]=b,t[11]=x):x=t[11];let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(J,{id:`KDw4GX`}),t[12]=S):S=t[12];let C;t[13]===r?C=t[14]:(C=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:S}),t[13]=r,t[14]=C);let w;t[15]===h?w=t[16]:(w=h?(0,Z.jsx)(X,{variant:`outline-mono`,onClick:()=>{ix(h).then(LF).catch(IF)},children:(0,Z.jsx)(J,{id:`uaUc6t`})}):null,t[15]=h,t[16]=w);let T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=m?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>p(!0),children:(0,Z.jsx)(J,{id:`ii5mVn`})}):null,t[17]=T):T=t[17];let E;t[18]!==i||t[19]!==u||t[20]!==n||t[21]!==o||t[22]!==a||t[23]!==r?(E=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(mt(MF(n)??i),o(a),r(jF))},children:(0,Z.jsx)(J,{id:`CKyk7Q`})}):null,t[18]=i,t[19]=u,t[20]=n,t[21]=o,t[22]=a,t[23]=r,t[24]=E):E=t[24];let D;t[25]!==w||t[26]!==E||t[27]!==C?(D=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[C,w,T,E]}),t[25]=w,t[26]=E,t[27]=C,t[28]=D):D=t[28];let O;t[29]!==i||t[30]!==n||t[31]!==f?(O=m?(0,Z.jsx)(Hh,{open:f,onOpenChange:p,crashContext:{source:`document view`,docName:MF(n)??i,errorMessage:n instanceof Error&&n.message?n.message:String(n),componentStack:Hg(n)}}):null,t[29]=i,t[30]=n,t[31]=f,t[32]=O):O=t[32];let k;return t[33]!==D||t[34]!==O||t[35]!==x?(k=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[v,x,D,O]}),t[33]=D,t[34]=O,t[35]=x,t[36]=k):k=t[36],k}function IF(){}function LF(e){e.ok||Mu.error(e.message,{id:`server-restart-error`,duration:1/0})}function RF(e){let t=(0,$.c)(17),{activeDocName:n,previousDocName:r,onNavigateBack:i,onRecycle:a,children:o}=e,s;t[0]!==n||t[1]!==i||t[2]!==r?(s=e=>(0,Z.jsx)(FF,{...e,activeDocName:n,previousDocName:r,onNavigateBack:i}),t[0]=n,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c;t[4]===n?c=t[5]:(c=[n],t[4]=n,t[5]=c);let l;t[6]!==n||t[7]!==a?(l=e=>{if(e.reason===`imperative-api`){if(Array.isArray(e.args)&&e.args[0]===jF){console.warn(`[DocumentErrorBoundary] back-nav reset (no recycle)`);return}a(n),console.warn(`[DocumentErrorBoundary] retry recycled ${n}`)}else console.warn(`[DocumentErrorBoundary] reset by key change (${e.prev?.[0]} → ${e.next?.[0]})`)},t[6]=n,t[7]=a,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=(e,t)=>{Vg(e,t.componentStack),console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${PF(e).title}`,e,t.componentStack??``)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(sn,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function zF(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=io(t);return{map:n,keys:Ja(t),parseError:r}}function BF(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>zF(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>{let e=va(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Me(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=Pe(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(VF,{cover:d}):null,t[9]=d,t[10]=f,t[11]=g):g=t[11];let _;t[12]!==f||t[13]!==p||t[14]!==l?(_=p?(0,Z.jsx)(HF,{icon:l,hasCover:f}):null,t[12]=f,t[13]=p,t[14]=l,t[15]=_):_=t[15];let v;return t[16]!==m||t[17]!==h||t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":m,"data-has-icon":h,"aria-hidden":`true`,"data-testid":`page-header`,children:[g,_]}),t[16]=m,t[17]=h,t[18]=g,t[19]=_,t[20]=v):v=t[20],v}function VF(e){let t=(0,$.c)(2),{cover:n}=e,r;return t[0]===n.value?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`page-header-cover`,"data-testid":`page-header-cover`,children:(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,loading:`lazy`,referrerPolicy:`no-referrer`,className:`page-header-cover-img`})}),t[0]=n.value,t[1]=r),r}function HF(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}var UF=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-xXR4EKXf.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([140,1,6,2,3,7,8,9,10,11,12,15,16,73,74,75,76,77,78,79,80,81,82,83,84,31,85,68,22,86,87,88,47,4,89,30,14,17,19,49,24,25,29,18,20,36,35,23,26,27,90,91,37,38,40,61,62,63,43,65,92,93,28,32,60,64,66,67,94,95,96,97,33,21,98,99,100,101,39,41,102,103,141,112,13,113,114,50,142,143,128,144,42,137,145,124]),import.meta.url)).ManagedArtifactProperties})),WF=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{MermaidDocEditor:e}=await import(`./MermaidDocEditor-CGsfhioE.js`);return{MermaidDocEditor:e}},__vite__mapDeps([146,1,74,75,9,85,6,2,3,7,8,68,12,22,11,86,87,88,10,91,76,77,78,79,80,81,82,83,84,31,47,15,16,26,37,38,40,17,61,62,63,43,65,147,148,149,71]),import.meta.url)).MermaidDocEditor})),GF=Od(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function KF(e){let t=e.threshold??GF;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function qF(e){return e.hasEmittedFirstToggle||!e.isActive||!e.isLarge?!1:e.renderSource&&e.renderVisual}function JF(e,t,n){return e?t:n}var YF=Od(`ACTIVITY_MOUNT_LIMIT`,3);function XF(){return n(()=>import(`./SourceEditor-CmpVF187.js`),__vite__mapDeps([150,1,74,75,9,80,148,6,2,3,7,8,85,68,12,22,11,86,87,88,73,76,77,78,79,81,82,83,84,31,47,10,4,89,30,14,15,16,17,19,49,24,25,29,18,20,36,35,23,26,27,90,91,37,38,40,61,62,63,43,65,92,93,28,32,60,64,66,67,94,95,96,97,33,21,98,99,100,101,39,41,102,103,149,151,48,50,51,121,152,133,70,135,137,123,145]),import.meta.url)}var ZF=(0,Q.lazy)(async()=>({default:(await XF()).SourceEditor}));function QF(e,t,n){if(n<=0)return[];let r=e.filter(e=>!nt(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function $F(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:zu._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?zu._({id:`Sc1bKE`,values:{docName:e}}):zu._({id:`ovIGrT`,values:{docName:e}}),actionLabel:zu._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:zu._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?zu._({id:`bmC18N`,values:{docName:e}}):zu._({id:`pAgkuZ`,values:{docName:e}})}:null}function eI(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Dd,{name:`activity-pool`,children:(0,Z.jsx)(tI,{...e})}),t[0]=e,t[1]=n),n}function tI(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ot(),{pages:u,loading:d}=rs(),f=QF(c,n,YF),p=(0,Q.useRef)(``),m=f.map(nI).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)L(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;x(e,t&&t.length>0?t:crypto.randomUUID())}Ed(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,gt(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(cI,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!Di(e.docName)&&!Si(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function nI(e){return e.docName}function rI(e){let t=(0,$.c)(18),{isActive:n,docName:r,mode:i,initialScrollTop:a,bodyAnchorRef:o,children:s}=e,c=(0,Q.useRef)(null),l=(0,Q.useRef)(a??0),u=(0,Q.useRef)(null),d=(0,Q.useRef)(n),f=(0,Q.useRef)(!1),m,h;t[0]===n?(m=t[1],h=t[2]):(m=()=>{d.current=n},h=[n],t[0]=n,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let _=(0,Q.useRef)(i),y,b;t[3]===i?(y=t[4],b=t[5]):(y=()=>{_.current=i},b=[i],t[3]=i,t[4]=y,t[5]=b),(0,Q.useLayoutEffect)(y,b);let x,S;t[6]!==o||t[7]!==r?(x=()=>{let e=c.current;if(!e)return;let t=()=>{if(!(!d.current||f.current)&&e.scrollTop>0){let t=v(e,o?.current);if(!g(t))return;l.current=e.scrollTop,u.current=t.kind===`measured`?t.contentPos:null,t.kind===`measured`&&_t(r,{offset:e.scrollTop-t.contentPos,mode:_.current,fraction:xe(e.scrollTop,e.scrollHeight,e.clientHeight)})}};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},S=[o,r],t[6]=o,t[7]=r,t[8]=x,t[9]=S):(x=t[8],S=t[9]),(0,Q.useEffect)(x,S);let C,w;t[10]!==o||t[11]!==r||t[12]!==n?(C=()=>{if(!n)return;let e=c.current;if(!e||Ne(r))return;let t=Ie(r);if(t&&t.mode!==_.current){let n=Math.max(0,e.scrollHeight-e.clientHeight),i=Math.round(t.fraction*n),a=n>0;a&&(e.scrollTop=i),Ed(`ok/scroll-restore/cross-mode`,{docName:r,savedMode:t.mode,mode:_.current,fraction:Number(t.fraction.toFixed(4)),target:i,applied:a&&e.scrollTop===i});return}let i=l.current,a=t?.offset,s=u.current===null?null:i-u.current,d=a??s;if(i===0&&d===null)return;let m=()=>p(i,d,v(e,o?.current));f.current=!0;let h=e.style.overflowAnchor;e.style.overflowAnchor=`none`;let g=performance.now(),y=!1,b=!1,x=m();x!==null&&(e.scrollTop=x,bt(e.scrollTop,x)&&e.scrollHeight>x&&(b=!0,Ed(`ok/scroll-restore/phase1-success`,{target:x,elapsedMs:performance.now()-g})));let S=e.scrollTop,C=!1,w=0,T=()=>{C||(C=!0,f.current=!1,e.style.overflowAnchor=h,cancelAnimationFrame(w),clearTimeout(O),e.removeEventListener(`wheel`,E),e.removeEventListener(`touchstart`,E),e.removeEventListener(`mousedown`,E),e.removeEventListener(`keydown`,E))},E=()=>{b||Ed(`ok/scroll-restore/yielded`,{reason:`user`,elapsedMs:performance.now()-g,finalScrollTop:e.scrollTop}),T()};e.addEventListener(`wheel`,E,{passive:!0}),e.addEventListener(`touchstart`,E,{passive:!0}),e.addEventListener(`mousedown`,E),e.addEventListener(`keydown`,E);let D=()=>{if(!C){if(Ne(r)){b||Ed(`ok/scroll-restore/yielded`,{reason:`landing`,elapsedMs:performance.now()-g,finalScrollTop:e.scrollTop}),T();return}if(q(S,e.scrollTop)){b||Ed(`ok/scroll-restore/yielded`,{reason:`external`,elapsedMs:performance.now()-g,finalScrollTop:e.scrollTop}),T();return}x=m(),x!==null&&!bt(e.scrollTop,x)&&e.scrollHeight>x&&(e.scrollTop=x,bt(e.scrollTop,x)&&!y&&(Ed(`ok/scroll-restore/phase2-success`,{target:x,elapsedMs:performance.now()-g}),y=!0,b=!0)),S=e.scrollTop,w=requestAnimationFrame(D)}};w=requestAnimationFrame(D);let O=setTimeout(()=>{if(C)return;let t=m();(t===null||!bt(e.scrollTop,t)&&e.scrollHeight>t)&&Ed(`ok/scroll-restore/abandoned`,{...t===null?{}:{target:t},anchorMeasurable:t!==null,elapsedMs:performance.now()-g,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),T()},ne);return T},w=[n,o,r],t[10]=o,t[11]=r,t[12]=n,t[13]=C,t[14]=w):(C=t[13],w=t[14]),(0,Q.useLayoutEffect)(C,w);let T;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(T={overflowAnchor:`auto`},t[15]=T):T=t[15];let E;return t[16]===s?E=t[17]:(E=(0,Z.jsx)(`div`,{ref:c,"data-testid":`editor-scroll-container`,className:`editor-doc-scroll subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:T,children:s}),t[16]=s,t[17]=E),E}function iI(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(CT,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(ZF,{docName:f,ytext:p,provider:n.provider,placeholder:a,isSourceModeActive:o})}),t[6]=a,t[7]=n.docName,t[8]=n.provider,t[9]=o,t[10]=p,t[11]=m):m=t[11],m}function aI(e){let t=(0,$.c)(18),{view:n}=e,r=n.kind===`failed`,i=r?`alert`:`status`,a=!r,o;t[0]===r?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full border bg-muted text-muted-foreground`,children:r?(0,Z.jsx)(_u,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(ll,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(X,{type:`button`,onClick:oI,children:[(0,Z.jsx)(_u,{className:`size-4`,"aria-hidden":`true`}),n.actionLabel]}):null,t[9]=r,t[10]=n.actionLabel,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==l||t[16]!==u?(d=(0,Z.jsxs)(`div`,{"data-slot":`server-restart-recovery`,role:i,"aria-busy":a,className:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,children:[o,l,u]}),t[12]=i,t[13]=a,t[14]=o,t[15]=l,t[16]=u,t[17]=d):d=t[17],d}function oI(){return window.location.reload()}function sI(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function cI(e){let t=(0,$.c)(68),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=$F(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=oO(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=Si(n.docName),t[3]=n.docName,t[4]=m);let h=m,g;t[5]===n.docName?g=t[6]:(g=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[5]=n.docName,t[6]=g);let[_]=(0,Q.useState)(g),v=(0,Q.useRef)(null),y=n.provider.document.getText(`source`).length,[b,x]=(0,Q.useState)(i),S,C;t[7]!==r||t[8]!==i||t[9]!==b?(S=()=>{r&&b!==i&&x(i)},C=[r,i,b],t[7]=r,t[8]=i,t[9]=b,t[10]=S,t[11]=C):(S=t[10],C=t[11]),(0,Q.useEffect)(S,C);let w;t[12]!==r||t[13]!==i||t[14]!==b?(w=JF(r,i,b),t[12]=r,t[13]=i,t[14]=b,t[15]=w):w=t[15];let T=w,[E,D]=(0,Q.useState)(T),[O,k]=(0,Q.useState)(!T),A,j;t[16]!==T||t[17]!==E||t[18]!==O?(A=()=>{T&&!E?D(!0):!T&&!O&&k(!0)},j=[T,E,O],t[16]=T,t[17]=E,t[18]=O,t[19]=A,t[20]=j):(A=t[19],j=t[20]),(0,Q.useEffect)(A,j);let M=KF({ytextLength:y,isSourceMode:T,visitedSource:E,visitedVisual:O}),N=(0,Q.useRef)(``),P=`${M.isLarge}-${M.renderSource}-${M.renderVisual}`,F,I;t[21]!==T||t[22]!==n.docName||t[23]!==M.isLarge||t[24]!==M.renderSource||t[25]!==M.renderVisual||t[26]!==P||t[27]!==y?(I=()=>{N.current!==P&&(N.current=P,M.isLarge&&Ed(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:y,isSourceMode:T,renderSource:M.renderSource,renderVisual:M.renderVisual}))},F=[P,M.isLarge,M.renderSource,M.renderVisual,n.docName,y,T],t[21]=T,t[22]=n.docName,t[23]=M.isLarge,t[24]=M.renderSource,t[25]=M.renderVisual,t[26]=P,t[27]=y,t[28]=F,t[29]=I):(F=t[28],I=t[29]),(0,Q.useEffect)(I,F);let L;t[30]===n.docName?L=t[31]:(L=()=>Je(n.docName),t[30]=n.docName,t[31]=L);let[R]=(0,Q.useState)(L),z=R?.html??null,[B,V]=(0,Q.useState)(!1),U,ee;t[32]!==T||t[33]!==n.docName||t[34]!==M.isLarge||t[35]!==M.renderSource||t[36]!==M.renderVisual||t[37]!==B||t[38]!==r||t[39]!==y?(U=()=>{qF({isActive:r,isLarge:M.isLarge,renderSource:M.renderSource,renderVisual:M.renderVisual,hasEmittedFirstToggle:B})&&(Ed(`ok/cold/first-toggle`,{docName:n.docName,mountId:H(n.docName),ytextLength:y,modeEnteredFirst:T?`source`:`visual`}),V(!0))},ee=[B,r,M.isLarge,M.renderSource,M.renderVisual,n.docName,y,T],t[32]=T,t[33]=n.docName,t[34]=M.isLarge,t[35]=M.renderSource,t[36]=M.renderVisual,t[37]=B,t[38]=r,t[39]=y,t[40]=U,t[41]=ee):(U=t[40],ee=t[41]),(0,Q.useEffect)(U,ee);let W=r?`visible`:`hidden`,te=`editor:${n.docName}`,G=T?`source`:`wysiwyg`,ne=R?.scrollTop,K;t[42]!==a||t[43]!==T||t[44]!==n||t[45]!==M.renderSource||t[46]!==M.renderVisual||t[47]!==r||t[48]!==p||t[49]!==h||t[50]!==o||t[51]!==c||t[52]!==l||t[53]!==_||t[54]!==s||t[55]!==f||t[56]!==z?(K=f?(0,Z.jsx)(aI,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(RF,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:z?(0,Z.jsx)(sI,{html:z}):(0,Z.jsx)(CT,{}),children:(0,Z.jsx)(AF,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(kF,{docName:n.docName,provider:n.provider}):h?(0,Z.jsx)(WF,{docName:n.docName,provider:n.provider,isSourceMode:T}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!T&&(Di(n.docName)||$e(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(UF,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(BF,{provider:n.provider}),(0,Z.jsx)(Jo,{provider:n.provider})]})),(0,Z.jsx)(`div`,{ref:v,"aria-hidden":!0,className:`h-0`,[je]:``}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[M.renderSource?(0,Z.jsx)(`div`,{className:T?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(iI,{entry:n,isActive:r,isSourceMode:T,editorPlaceholder:a})}):null,M.renderVisual?(0,Z.jsx)(`div`,{className:T?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(TN,{provider:n.provider,placeholder:a,isSourceMode:T,portalTarget:_},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[42]=a,t[43]=T,t[44]=n,t[45]=M.renderSource,t[46]=M.renderVisual,t[47]=r,t[48]=p,t[49]=h,t[50]=o,t[51]=c,t[52]=l,t[53]=_,t[54]=s,t[55]=f,t[56]=z,t[57]=K):K=t[57];let q;t[58]!==n.docName||t[59]!==r||t[60]!==G||t[61]!==ne||t[62]!==K?(q=(0,Z.jsx)(rI,{isActive:r,docName:n.docName,mode:G,initialScrollTop:ne,bodyAnchorRef:v,children:K}),t[58]=n.docName,t[59]=r,t[60]=G,t[61]=ne,t[62]=K,t[63]=q):q=t[63];let re;return t[64]!==W||t[65]!==te||t[66]!==q?(re=(0,Z.jsx)(Q.Activity,{mode:W,name:te,children:q}),t[64]=W,t[65]=te,t[66]=q,t[67]=re):re=t[67],re}function lI(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function uI(e){let{value:t,unit:n}=lI(e);return n===`rem`?t*16:t}function dI(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var fI=3600*24*7;function pI(e){let t=(0,$.c)(28),{direction:n,currentWidth:r,onResize:i,onToggle:a,isCollapsed:o,minResizeWidth:s,maxResizeWidth:c,enableToggle:l,enableAutoCollapse:u,autoCollapseThreshold:d,expandThreshold:f,enableDrag:p,setIsDraggingRail:m,widthCookieName:h,widthCookieMaxAge:g,isNested:_}=e,v=n===void 0?`right`:n,y=o===void 0?!1:o,b=s===void 0?`14rem`:s,x=c===void 0?`24rem`:c,S=l===void 0?!0:l,C=u===void 0?!0:u,w=d===void 0?1.5:d,T=f===void 0?.2:f,E=p===void 0?!0:p,D=m===void 0?mI:m,O=g===void 0?fI:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,ee;t[0]===r?(U=t[1],ee=t[2]):(U=()=>{V.current=r},ee=[r],t[0]=r,t[1]=U,t[2]=ee),(0,Q.useEffect)(U,ee);let W,te;t[3]===y?(W=t[4],te=t[5]):(W=()=>{H.current=y},te=[y],t[3]=y,t[4]=W,t[5]=te),(0,Q.useEffect)(W,te);let G=uI(b),ne;t[6]===x?ne=t[7]:(ne=uI(x),t[6]=x,t[7]=ne);let K=ne,q;t[8]!==E||t[9]!==k?(q=function(e){E&&(P.current=!0,j.current=H.current?0:uI(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=q):q=t[10];let re=q,ie,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==K||t[18]!==G||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=lI(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=G*w;else if(e<=G){let n=G*(w-1);t=G-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>G*T){a();let t=n(r,M.current,j.current,s),c=Math.max(G,Math.min(K,t)),u=dI(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(G,Math.min(K,u)),f=dI(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ae=[i,a,D,G,K,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=K,t[18]=G,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=ae):(ie=t[24],ae=t[25]),(0,Q.useEffect)(ie,ae);let oe;return t[26]===re?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:re},t[26]=re,t[27]=oe),oe}function mI(){}var hI=3600*24*7,gI=`18rem`,_I=`3rem`,vI=`app-file-sidebar`,yI=`14.625rem`,bI=`32rem`,xI=`sidebar_width`,SI=/^\d+(?:\.\d+)?(?:rem|px)$/,CI=Q.createContext(null);function wI(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${xI}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return SI.test(n)?n:e}function TI(){let e=Q.use(CI);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function EI(e){let t=(0,$.c)(58),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?gI:c,[u]=Q.useState(OI),d;t[8]===u?d=t[9]:(d=()=>gO(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>wI(l),t[10]=l,t[11]=m);let[h,g]=Q.useState(m),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x;t[12]===u?x=t[13]:(x=()=>{let e=CO();return TO(`left`,gO(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==w||t[15]!==f||t[16]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),EO(`left`,f,t?`open`:`collapsed`)},t[14]=w,t[15]=f,t[16]=o,t[17]=T):T=t[17];let E=T,D;t[18]===E?D=t[19]:(D=function(){E(DI)},t[18]=E,t[19]=D);let O=D,k=Q.useRef(w),A;t[20]===w?A=t[21]:(A=()=>{k.current=w},t[20]=w,t[21]=A),Q.useLayoutEffect(A);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[22]=j):j=t[22];let M=j,N,P;t[23]===u?(N=t[24],P=t[25]):(P=()=>{let e=window.matchMedia(`(min-width: ${pO}px)`),t=()=>{let e=gO(u,window.innerWidth,`left`);p(e),C(TO(`left`,e,CO())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[23]=u,t[24]=N,t[25]=P),Q.useEffect(P,N);let F,I;t[26]===w?(F=t[27],I=t[28]):(F=()=>{w||document.getElementById(vI)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[26]=w,t[27]=F,t[28]=I),Q.useLayoutEffect(F,I);let L,R;t[29]!==w||t[30]!==f||t[31]!==E?(L=()=>{if(f===`above`||!w)return;let e=e=>{e.key===`Escape`&&(Af()||E(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},R=[f,w,E],t[29]=w,t[30]=f,t[31]=E,t[32]=L,t[33]=R):(L=t[32],R=t[33]),Q.useEffect(L,R);let z,B;t[34]===O?(z=t[35],B=t[36]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{Zu(e,`toggle-files-sidebar`)&&(Af()||(e.preventDefault(),O()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[34]=O,t[35]=z,t[36]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,H;t[37]!==_||t[38]!==w||t[39]!==E||t[40]!==y||t[41]!==V||t[42]!==O||t[43]!==h?(H={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[37]=_,t[38]=w,t[39]=E,t[40]=y,t[41]=V,t[42]=O,t[43]=h,t[44]=H):H=t[44];let U;t[45]!==s||t[46]!==h?(U={"--sidebar-width":h,"--sidebar-width-icon":_I,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let ee=U,W;t[48]===r?W=t[49]:(W=Y(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=W);let te;t[50]!==n||t[51]!==a||t[52]!==ee||t[53]!==W?(te=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:ee,className:W,...a,children:n}),t[50]=n,t[51]=a,t[52]=ee,t[53]=W,t[54]=te):te=t[54];let G;return t[55]!==H||t[56]!==te?(G=(0,Z.jsx)(CI.Provider,{value:H,children:te}),t[55]=H,t[56]=te,t[57]=G):G=t[57],G}function DI(e){return!e}function OI(){return ca()}function kI(e){let t=(0,$.c)(39),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{_:d}=Dt(),{state:f,isDraggingRail:p}=TI();if(u===`none`){let e;t[7]===r?e=t[8]:(e=Y(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}let m=f===`collapsed`?u:``,h=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,g;t[14]===h?g=t[15]:(g=Y(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,h,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=h,t[15]=g);let _;t[16]===g?_=t[17]:(_=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[16]=g,t[17]=_);let v;t[18]===d?v=t[19]:(v=d({id:`07q4Qk`}),t[18]=d,t[19]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[20]!==r||t[21]!==y?(b=Y(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=x);let S;t[25]!==i||t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==v?(S=(0,Z.jsx)(`nav`,{id:vI,"aria-label":v,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[25]=i,t[26]=c,t[27]=b,t[28]=x,t[29]=v,t[30]=S):S=t[30];let C;return t[31]!==p||t[32]!==c||t[33]!==f||t[34]!==S||t[35]!==m||t[36]!==_||t[37]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":p,children:[_,S]}),t[31]=p,t[32]=c,t[33]=f,t[34]=S,t[35]=m,t[36]=_,t[37]=l,t[38]=C):C=t[38],C}function AI(e){let t=(0,$.c)(34),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=Dt(),{toggleSidebar:o,state:s}=TI(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Uu(`toggle-files-sidebar`);c=X,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=vI,h=a(s===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;t[14]===n?g=t[15]:(g=Y(n),t[14]=n,t[15]=g);let _;t[16]!==r||t[17]!==o?(_=e=>{r?.(e),o()},t[16]=r,t[17]=o,t[18]=_):_=t[18];let v;t[19]===s?v=t[20]:(v=s===`expanded`?(0,Z.jsx)(xt,{}):(0,Z.jsx)(R_,{}),t[19]=s,t[20]=v);let y;return t[21]!==c||t[22]!==i||t[23]!==l||t[24]!==v||t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m||t[30]!==h||t[31]!==g||t[32]!==_?(y=(0,Z.jsx)(c,{"data-sidebar":l,"data-slot":u,variant:d,size:f,"aria-expanded":p,"aria-controls":m,"aria-label":h,className:g,onClick:_,...i,children:v}),t[21]=c,t[22]=i,t[23]=l,t[24]=v,t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h,t[31]=g,t[32]=_,t[33]=y):y=t[33],y}function jI(e){let t=(0,$.c)(32),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{_:l}=Dt(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=TI(),h=f===`collapsed`,g;t[6]!==s||t[7]!==c||t[8]!==m||t[9]!==d||t[10]!==h||t[11]!==u||t[12]!==p?(g={direction:`right`,enableDrag:s,enableToggle:c,onResize:d,onToggle:u,currentWidth:p,isCollapsed:h,minResizeWidth:yI,maxResizeWidth:bI,setIsDraggingRail:m,widthCookieName:xI,widthCookieMaxAge:hI},t[6]=s,t[7]=c,t[8]=m,t[9]=d,t[10]=h,t[11]=u,t[12]=p,t[13]=g):g=t[13];let{dragRef:_,handleMouseDown:v}=pI(g),y;t[14]!==l||t[15]!==f?(y=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=l,t[15]=f,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==r?(b=e=>{r?.(e),e.defaultPrevented||v(e)},t[17]=v,t[18]=r,t[19]=b):b=t[19];let x;t[20]!==l||t[21]!==f?(x=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=l,t[21]=f,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=Y(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=S);let C;return t[25]!==_||t[26]!==i||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S?(C=(0,Z.jsx)(`button`,{ref:_,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":y,tabIndex:-1,onMouseDown:b,title:x,className:S,...i}),t[25]=_,t[26]=i,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function MI(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onAnimationEnd:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showPushPulse:a,setShowPushPulse:o}=TI(),s;t[4]!==r||t[5]!==o?(s=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&o(!1)},t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l=a?``:void 0,u;t[7]===n?u=t[8]:(u=Y(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,n),t[7]=n,t[8]=u);let d;return t[9]!==c||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":l,onAnimationEnd:c,className:u,...i}),t[9]=c,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function NI(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function PI(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function FI(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function II(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`relative flex w-full min-w-0 flex-col p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function LI(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?cn:`div`,o;t[4]===n?o=t[5]:(o=Y(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function RI(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?cn:`button`,o;t[4]===n?o=t[5]:(o=Y(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-action`,"data-sidebar":`group-action`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function zI(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function BI(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function VI(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var HI=dn(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-hover hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function UI(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?cn:`button`,{state:m}=TI(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Y(HI({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(_n,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(vn,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(bn,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function WI(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?!1:i,s=a===void 0?!1:a,c=o?cn:`button`,l=s&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,u;t[5]!==n||t[6]!==l?(u=Y(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,l,n),t[5]=n,t[6]=l,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==r||t[10]!==u?(d=(0,Z.jsx)(c,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:u,...r}),t[8]=c,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}function GI(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu-sub`,"data-sidebar":`menu-sub`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function KI(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`group/menu-sub-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-sub-item`,"data-sidebar":`menu-sub-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qI(e){let t=(0,$.c)(14),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:i,size:a,isActive:o,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?!1:i,c=a===void 0?`md`:a,l=o===void 0?!1:o,u=s?cn:`a`,d;t[6]===n?d=t[7]:(d=Y(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,n),t[6]=n,t[7]=d);let f;return t[8]!==u||t[9]!==l||t[10]!==r||t[11]!==c||t[12]!==d?(f=(0,Z.jsx)(u,{"data-slot":`sidebar-menu-sub-button`,"data-sidebar":`menu-sub-button`,"data-size":c,"data-active":l,className:d,...r}),t[8]=u,t[9]=l,t[10]=r,t[11]=c,t[12]=d,t[13]=f):f=t[13],f}function JI(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function YI(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Hi.safeParse(t);return n.success?n.data.currentBranch??null:null}var XI=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:JI({fetchBranch:YI,subscribeToEvent:xd}),ZI=XI.subscribe,QI=XI.getSnapshot;function $I(){return(0,Q.useSyncExternalStore)(ZI,QI,QI)}function eL(){let e=(0,$.c)(6),t=$I(),n=jf(),{state:r}=TI(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&ks(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function tL(e){let t=(0,$.c)(30),{stats:n,selectionStats:r,showStats:i,composerBadge:a,reserveRightGutter:o}=e,s=i===void 0?!0:i,c=o===void 0?!1:o,{_:l}=Dt(),u=eL();if(!s&&u===null&&a==null)return null;let d=r??n,f=r!=null,{words:p,chars:m,tokens:h}=d,g;t[0]!==l||t[1]!==f||t[2]!==s?(g=l(s?f?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=l,t[1]=f,t[2]=s,t[3]=g):g=t[3];let _=c&&`pr-12`,v;t[4]===_?v=t[5]:(v=Y(`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,_),t[4]=_,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[6]=y):y=t[6];let b;t[7]!==l||t[8]!==a?(b=a?(0,Z.jsxs)(X,{type:`button`,variant:`outline`,onClick:a.onReopen,"data-testid":`ask-ai-reopen-badge`,className:`-translate-x-1/2 absolute bottom-0 left-1/2 z-10 h-auto gap-1 rounded-md rounded-b-none bg-card px-2.5 py-0.5 text-2xs font-normal text-muted-foreground shadow-sm hover:text-foreground active:not-aria-[haspopup]:translate-y-0`,children:[(0,Z.jsx)(lc,{className:`size-3`,"aria-hidden":!0}),l({id:`xWEvuo`}),(0,Z.jsx)(Yr,{className:`size-3`,"aria-hidden":!0})]}):null,t[7]=l,t[8]=a,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u===null?null:(0,Z.jsx)(nL,{identity:u}),t[10]=u,t[11]=x);let S;t[12]===x?S=t[13]:(S=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:x}),t[12]=x,t[13]=S);let C;t[14]!==l||t[15]!==d.chars||t[16]!==d.tokens||t[17]!==d.words||t[18]!==m||t[19]!==f||t[20]!==s||t[21]!==h||t[22]!==p?(C=s?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[f?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:l({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.words.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`gljvbT`,values:{words:p}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.chars.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`d5rK4X`,values:{chars:m}})]}),(0,Z.jsxs)(`span`,{children:[d.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.tokens.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`uynXup`,values:{tokens:h}})]})]}):null,t[14]=l,t[15]=d.chars,t[16]=d.tokens,t[17]=d.words,t[18]=m,t[19]=f,t[20]=s,t[21]=h,t[22]=p,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==g||t[26]!==v||t[27]!==b||t[28]!==S?(w=(0,Z.jsxs)(`section`,{"aria-label":g,className:v,children:[y,b,S,C]}),t[24]=C,t[25]=g,t[26]=v,t[27]=b,t[28]=S,t[29]=w):w=t[29],w}function nL(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(vn,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(To,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function rL(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:i}=Dt(),a;t[3]===i?a=t[4]:(a=i({id:`3__SjS`}),t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=Y(n),t[5]=n,t[6]=o);let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,Z.jsx)(`nav`,{"aria-label":a,"data-slot":`breadcrumb`,className:o,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function iL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function aL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function oL(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=Y(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function sL(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Y(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(es,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var cL=1,lL=2,uL=4;function dL(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=ua(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:pt(n,``).prefix.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>uL?[...u.slice(0,cL).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(cL,-lL)},...u.slice(-lL).map((e,t)=>d(e,u.length-lL+t))]:u.map((e,t)=>d(e,t));a=rL,t[8]===r?c=t[9]:(c=Y(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=iL,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(fL)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[10]!==i||t[11]!==o||t[12]!==s?(u=(0,Z.jsx)(i,{className:o,children:s}),t[10]=i,t[11]=o,t[12]=s,t[13]=u):u=t[13];let d;return t[14]!==a||t[15]!==c||t[16]!==u?(d=(0,Z.jsx)(a,{className:c,children:u}),t[14]=a,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function fL(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(sL,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(aL,{className:`shrink-0`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,title:e.hidden.join(` / `),className:`flex size-4 items-center justify-center text-muted-foreground/70`,children:(0,Z.jsx)(f_,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(aL,{className:`min-w-0`,children:(0,Z.jsx)(oL,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var pL=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-2WrfNbQp.js`);return{SkillEditorActions:e}},__vite__mapDeps([153,1,6,2,3,7,8,9,10,11,12,15,16,113,14,17,114,30,31,19,49,24,25,50,20,93,22,26,36,120,47,23,27,115,119,106,94,32,37,33,121,99,38,100,122,68,107,39,41,88,64,123,66,44,124,125]),import.meta.url)).SkillEditorActions}));function mL(e){let t=(0,$.c)(94),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l,reserveRightGutter:u}=e,d=u===void 0?!1:u,{_:f}=Dt(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Hu(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A;if(t[1]!==f||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==d||t[9]!==o||t[10]!==i){_=Uu(`toggle-document-panel`);let e;t[27]===n?e=t[28]:(e=n?ua(n):null,t[27]=n,t[28]=e);let u=e,p;t[29]===n?p=t[30]:(p=n?$e(n):null,t[29]=n,t[30]=p);let m=p,j;t[31]!==u||t[32]!==m?(j=u?.kind===`skill`?{scope:u.scope,name:u.name}:m?{scope:`project`,name:m}:null,t[31]=u,t[32]=m,t[33]=j):j=t[33];let M=j;x=`editor-toolbar`,S=`pointer-events-none absolute inset-x-0 top-0 z-10`;let N;t[34]!==n||t[35]!==M?(N=M?null:(0,Z.jsx)(dL,{docName:n}),t[34]=n,t[35]=M,t[36]=N):N=t[36];let P;t[37]===n?P=t[38]:(P=n===null?null:(0,Z.jsx)(Wp,{entry:{kind:`document`,docName:n},className:`shrink-0`}),t[37]=n,t[38]=P);let F;t[39]!==N||t[40]!==P?(F=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex min-w-0 items-center gap-2`,children:[N,P]}),t[39]=N,t[40]=P,t[41]=F):F=t[41];let I;t[42]!==r||t[43]!==a||t[44]!==i?(I=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(Kp,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[42]=r,t[43]=a,t[44]=i,t[45]=I):I=t[45],t[46]!==F||t[47]!==I?(C=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[F,I]})}),t[46]=F,t[47]=I,t[48]=C):C=t[48];let L=d&&`pr-9`;t[49]===L?v=t[50]:(v=Y(`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,L),t[49]=L,t[50]=v),t[51]===M?y=t[52]:(y=M?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(pL,{scope:M.scope,name:M.name})}):null,t[51]=M,t[52]=y),t[53]!==f||t[54]!==s||t[55]!==o?(b=o&&(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(_n,{children:(0,Z.jsx)(j_,{})})}),(0,Z.jsx)(vn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`81H_23`})})]}),t[53]=f,t[54]=s,t[55]=o,t[56]=b):b=t[56],g=bn,h=X,w=``,T=`ghost`,E=`icon`,D=l,O=!c,k=`doc-panel`,A=f(c?{id:`u7H-Wn`,values:{panelShortcutLabel:_}}:{id:`2hpdRq`,values:{panelShortcutLabel:_}}),t[1]=f,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=d,t[9]=o,t[10]=i,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=x,t[18]=S,t[19]=C,t[20]=w,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k,t[26]=A}else h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16],x=t[17],S=t[18],C=t[19],w=t[20],T=t[21],E=t[22],D=t[23],O=t[24],k=t[25],A=t[26];let j;t[57]===c?j=t[58]:(j=(0,Z.jsx)(_n,{children:c?(0,Z.jsx)(hu,{}):(0,Z.jsx)(mu,{})}),t[57]=c,t[58]=j);let M;t[59]!==h||t[60]!==j||t[61]!==w||t[62]!==T||t[63]!==E||t[64]!==D||t[65]!==O||t[66]!==k||t[67]!==A?(M=(0,Z.jsx)(h,{"data-doc-panel-toggle":w,variant:T,size:E,onClick:D,"aria-expanded":O,"aria-controls":k,"aria-label":A,asChild:!0,children:j}),t[59]=h,t[60]=j,t[61]=w,t[62]=T,t[63]=E,t[64]=D,t[65]=O,t[66]=k,t[67]=A,t[68]=M):M=t[68];let N;t[69]!==f||t[70]!==c?(N=f(c?{id:`6iDEWA`}:{id:`170Js2`}),t[69]=f,t[70]=c,t[71]=N):N=t[71];let P;t[72]===N?P=t[73]:(P=(0,Z.jsx)(`span`,{children:N}),t[72]=N,t[73]=P);let F;t[74]===_?F=t[75]:(F=(0,Z.jsx)(le,{"aria-label":_,children:m}),t[74]=_,t[75]=F);let I;t[76]!==P||t[77]!==F?(I=(0,Z.jsxs)(vn,{side:`bottom`,children:[P,` `,F]}),t[76]=P,t[77]=F,t[78]=I):I=t[78];let L;t[79]!==g||t[80]!==M||t[81]!==I?(L=(0,Z.jsxs)(g,{children:[M,I]}),t[79]=g,t[80]=M,t[81]=I,t[82]=L):L=t[82];let R;t[83]!==v||t[84]!==y||t[85]!==b||t[86]!==L?(R=(0,Z.jsxs)(`div`,{className:v,children:[y,b,L]}),t[83]=v,t[84]=y,t[85]=b,t[86]=L,t[87]=R):R=t[87];let z;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[88]=z):z=t[88];let B;return t[89]!==x||t[90]!==S||t[91]!==C||t[92]!==R?(B=(0,Z.jsxs)(`div`,{"data-testid":x,className:S,children:[C,R,z]}),t[89]=x,t[90]=S,t[91]=C,t[92]=R,t[93]=B):B=t[93],B}function hL(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function gL(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var _L=`ok-terminal-height-v1`,vL=1/3,yL=.5;function bL(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*yL))}function xL(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*vL)}function SL(e,t){let n=bL(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(xL(t),n)}function CL(){return typeof window>`u`?0:window.innerHeight}function wL(e,t){return SL(e,t??CL())}function TL(e,t){try{let n=e??localStorage,r=t??CL(),i=n.getItem(_L);if(i==null)return SL(xL(r),r);let a=Number.parseInt(i,10);return SL(Number.isFinite(a)?a:xL(r),r)}catch{return 240}}function EL(e,t,n){try{let r=t??localStorage,i=n??CL();r.setItem(_L,String(SL(e,i)))}catch{}}function DL(){try{return typeof localStorage>`u`?240:TL()}catch{return 240}}function OL(e){let t=(0,$.c)(19),{dockPosition:n,onReveal:r,className:i}=e,{_:a}=Dt(),o=n===`right`,s;t[0]===a?s=t[1]:(s=a({id:`vja0Dg`}),t[0]=a,t[1]=s);let c=s,l=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,u;t[2]!==i||t[3]!==l?(u=Y(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,l,i),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===o?d=t[6]:(d=o?(0,Z.jsx)(Qo,{"aria-hidden":`true`}):(0,Z.jsx)(Yr,{"aria-hidden":`true`}),t[5]=o,t[6]=d);let f;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:u,children:d})}),t[7]=n,t[8]=c,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=o?`left`:`top`,m;t[13]!==c||t[14]!==p?(m=(0,Z.jsx)(vn,{side:p,sideOffset:8,children:c}),t[13]=c,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,Z.jsxs)(bn,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}var kL=`terminal-dock-panel`;function AL(e){let t=(0,$.c)(52),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s,onReveal:c,showRevealTab:l}=e,u=a===void 0?`bottom`:a,d=l===void 0?!1:l,{resolvedTheme:f}=Jt(),p=hT(),[m,h]=(0,Q.useState)(!r),g=Lm(f).background,_=r&&u===`bottom`,v=d&&u===`bottom`&&c!=null,[y]=(0,Q.useState)(jL),b=(0,Q.useRef)(y),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(!1),w=(0,Q.useRef)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=function(e){w.current!=null&&clearTimeout(w.current),w.current=setTimeout(()=>{EL(e),w.current=null},100)},t[0]=T):T=t[0];let E=T,D=(0,Q.useRef)(0),O;t[1]!==u||t[2]!==r?(O=function(e,t){D.current>=5||(D.current+=1,console.warn(JSON.stringify({event:`ok-terminal-dock-stranded-while-hidden`,panelPx:Math.round(e),panelPct:Number.isFinite(t)?Math.round(t*10)/10:null,dockPosition:u,visible:r,dockHeightPx:b.current,innerWidth:window.innerWidth,innerHeight:window.innerHeight,devicePixelRatio:window.devicePixelRatio})))},t[1]=u,t[2]=r,t[3]=O):O=t[3];let k=O,A=(0,Q.useRef)(null),j,M;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>{w.current!=null&&clearTimeout(w.current),A.current!=null&&(window.removeEventListener(`pointerup`,A.current),A.current=null)},M=[],t[4]=j,t[5]=M):(j=t[4],M=t[5]),(0,Q.useEffect)(j,M);let N,P;t[6]!==_||t[7]!==p?(N=()=>{let e=p.current;if(e!=null)try{_?e.resize(`${b.current}px`):e.collapse()}catch{}},P=[_,p],t[6]=_,t[7]=p,t[8]=N,t[9]=P):(N=t[8],P=t[9]),(0,Q.useEffect)(N,P);let F,I;t[10]!==_||t[11]!==p?(I=()=>{let e=()=>{let e=wL(b.current);if(e!==b.current&&(b.current=e,_))try{p.current?.resize(`${e}px`)}catch{}};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},F=[_,p],t[10]=_,t[11]=p,t[12]=F,t[13]=I):(F=t[12],I=t[13]),(0,Q.useEffect)(I,F);let L=x||void 0,R;t[14]!==c||t[15]!==v?(R=v&&c?(0,Z.jsx)(OL,{dockPosition:`bottom`,onReveal:c,className:`right-3 bottom-0`}):null,t[14]=c,t[15]=v,t[16]=R):R=t[16];let z;t[17]!==n||t[18]!==s||t[19]!==R?(z=(0,Z.jsx)(VD,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsxs)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:[n,R]})}),t[17]=n,t[18]=s,t[19]=R,t[20]=z):z=t[20];let B=!_,V;t[21]===_?V=t[22]:(V=()=>{if(!_)return;S(!0),C.current=!0;let e=()=>{S(!1),C.current=!1,window.removeEventListener(`pointerup`,e),A.current=null};A.current=e,window.addEventListener(`pointerup`,e)},t[21]=_,t[22]=V);let H;t[23]!==_||t[24]!==B||t[25]!==V?(H=(0,Z.jsx)(HD,{withHandle:_,disabled:B,onPointerDown:V}),t[23]=_,t[24]=B,t[25]=V,t[26]=H):H=t[26];let U;t[27]===g?U=t[28]:(U={backgroundColor:g},t[27]=g,t[28]=U);let ee=_?`${y}px`:0,W;t[29]!==_||t[30]!==i||t[31]!==p||t[32]!==k||t[33]!==r?(W=e=>{let t=e.asPercentage===0;if(h(t),!_&&e.inPixels>0&&!C.current){k(e.inPixels,e.asPercentage);try{p.current?.collapse()}catch{}return}C.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(b.current=e.inPixels,E(e.inPixels)))},t[29]=_,t[30]=i,t[31]=p,t[32]=k,t[33]=r,t[34]=W):W=t[34];let te=!x&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,G;t[35]===te?G=t[36]:(G=Y(`flex flex-col`,te),t[35]=te,t[36]=G);let ne;t[37]===o?ne=t[38]:(ne=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[37]=o,t[38]=ne);let K;t[39]!==m||t[40]!==p||t[41]!==U||t[42]!==ee||t[43]!==W||t[44]!==G||t[45]!==ne?(K=(0,Z.jsx)(VD,{id:kL,style:U,panelRef:p,defaultSize:ee,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:W,inert:m,className:G,children:ne}),t[39]=m,t[40]=p,t[41]=U,t[42]=ee,t[43]=W,t[44]=G,t[45]=ne,t[46]=K):K=t[46];let q;return t[47]!==L||t[48]!==z||t[49]!==H||t[50]!==K?(q=(0,Z.jsxs)(BD,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":L,children:[z,H,K]}),t[47]=L,t[48]=z,t[49]=H,t[50]=K,t[51]=q):q=t[51],q}function jL(){return DL()}var ML=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BquAhT5x.js`),__vite__mapDeps([72,1,47,10,11,12,23,14,15,16,17,24,25,26,22,27,29,30,31,19,73,2,74,75,9,76,77,78,79,80,81,82,83,84,6,3,7,8,85,68,86,87,88,4,89,49,18,20,36,35,90,91,37,38,40,61,62,63,43,65,92,93,28,32,60,64,66,67,94,95,96,97,33,21,98,99,100,101,39,41,102,103,104,105,106,107,108,109,110]),import.meta.url)).ActivityModeContent})),NL=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./LintConfigEditor-k9WOKYkq.js`),__vite__mapDeps([154,10,1,11,12,22,155,2,74,75,9,6,3,7,8,85,68,86,87,88,89,30,31,14,15,16,17,19,49,24,25,29,18,20,36,48,50,26,147,80,148,100,62,134,13,21,35,115,59,93,97,129,117,39,41,135,136,27,137,43,156]),import.meta.url)).LintConfigEditor})),PL=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./SchemaConfigEditor-BFx4ZhVm.js`),__vite__mapDeps([157,1,10,11,12,89,30,31,14,15,16,17,19,49,24,25,29,22,18,20,36,115,26,143,158,96,38,100,155,2,74,75,9,6,3,7,8,85,68,86,87,88,48,50,147,80,148,62,132,39,41,136,27,137,156]),import.meta.url)).SchemaConfigEditor}));function FL(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`NYn1cR`})}),e[0]=t):t=e[0],t}var IL=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./TimelineDiffPane-C5gRZMQN.js`),__vite__mapDeps([159,1,2,160,6,3,7,8,9,73,74,75,76,77,78,79,80,81,82,83,84,31,85,68,12,22,11,86,87,88,47,10,4,89,30,14,15,16,17,19,49,24,25,29,18,20,36,35,23,26,27,90,91,37,38,40,61,62,63,43,65,92,93,28,32,60,64,66,67,94,95,96,97,33,21,98,99,100,101,39,41,102,103,161,48,50,162,104,110,71]),import.meta.url)).TimelineDiffPane})),LL=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./AgentDiffPane-6bk9bV9U.js`),__vite__mapDeps([163,1,2,160,6,3,7,8,9,73,74,75,76,77,78,79,80,81,82,83,84,31,85,68,12,22,11,86,87,88,47,10,4,89,30,14,15,16,17,19,49,24,25,29,18,20,36,35,23,26,27,90,91,37,38,40,61,62,63,43,65,92,93,28,32,60,64,66,67,94,95,96,97,33,21,98,99,100,101,39,41,102,103,161,48,50,162,105,106,107,110,71,108,109]),import.meta.url)).AgentDiffPane})),RL=`300px`,zL=`600px`,BL=new Set([`doc-panel`,`terminal-column`,`agent-panel`]);function VL(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(UL,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(HL,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Dd,{name:`editor-area`,children:(0,Z.jsxs)(Bo,{children:[n,r]})}),t[3]=n,t[4]=i),i}function HL(){let e=(0,$.c)(6),t=Vu(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==t.section||e[4]!==n?(r=(0,Z.jsx)(kD,{open:t.open,initialSection:t.section,onOpenChange:n}),e[2]=t.open,e[3]=t.section,e[4]=n,e[5]=r):r=e[5],r}function UL(e){let t=(0,$.c)(286),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:l,terminalDock:u,terminalHasSessions:d,onTerminalPlacement:f,onRevealTerminal:p}=e,m=s===void 0?!1:s,h=u===void 0?`right`:u,g=d===void 0?!1:d,{_}=Dt(),{resolvedTheme:v}=Jt(),y=Lm(v).background,{activeDocName:b,activeProvider:x,activeTarget:S,recycleDocument:C,docPanelMode:w,docPanelAgentId:T,docPanelExpandSignal:E}=ot(),{openDocumentTransition:D}=Le(),{requestAddProperty:O}=Fo(),k=iO(x,b),A=sO(b,n===`source`?`source`:`wysiwyg`),j=MO(x),M=j===`connected`||j===`synced`,N=oO(b)===`conflict`,[P,F]=(0,Q.useState)(!1),I,L;t[0]!==x||t[1]!==P?(I=()=>{x!=null&&!P&&F(!0)},L=[x,P],t[0]=x,t[1]=P,t[2]=I,t[3]=L):(I=t[2],L=t[3]),(0,Q.useEffect)(I,L);let R=(0,Q.useDeferredValue)(b),z=S?.kind===`missing`,B=!!b&&S?.kind!==`folder`,V;t[4]!==_||t[5]!==z?(V=z?_({id:`K-a33w`}):void 0,t[4]=_,t[5]=z,t[6]=V):V=t[6];let H=V,U=ku(),ee,W;t[7]!==b||t[8]!==U?(ee=()=>{U&&U.docName!==b&&Au()},W=[b,U],t[7]=b,t[8]=U,t[9]=ee,t[10]=W):(ee=t[9],W=t[10]),(0,Q.useEffect)(ee,W);let te=Ip(),G=te?.docName??null,ne=(0,Q.useRef)(null),K;t[11]!==b||t[12]!==G||t[13]!==D?(K=()=>{if(G==null){ne.current=null;return}if(ne.current=G,G!==b){let e=Bd(G);window.location.hash===e?D(G):window.location.hash=e}},t[11]=b,t[12]=G,t[13]=D,t[14]=K):K=t[14];let q;t[15]===G?q=t[16]:(q=[G],t[15]=G,t[16]=q),(0,Q.useEffect)(K,q);let re,ie;t[17]!==b||t[18]!==G?(re=()=>{if(G!=null){if(G===b){ne.current=null;return}ne.current!==G&&Rp()}},ie=[b,G],t[17]=b,t[18]=G,t[19]=re,t[20]=ie):(re=t[19],ie=t[20]),(0,Q.useEffect)(re,ie);let ae,oe;t[21]!==T||t[22]!==w?(ae=()=>{w===`agent`&&T!==null||Rp()},oe=[w,T],t[21]=T,t[22]=w,t[23]=ae,t[24]=oe):(ae=t[23],oe=t[24]),(0,Q.useEffect)(ae,oe);let se=(0,Q.useSyncExternalStore)(Sc.subscribe,Sc.getSnapshot,Sc.getSnapshot),ce;t[25]!==S||t[26]!==se?(ce=Ec(S,se),t[25]=S,t[26]=se,t[27]=ce):ce=t[27];let le=ce,[ue]=(0,Q.useState)(JL),de=ue!==null,fe;t[28]===ue?fe=t[29]:(fe=()=>gO(ue,window.innerWidth,`right`),t[28]=ue,t[29]=fe);let[pe,me]=(0,Q.useState)(fe),he=(0,Q.useRef)(pe),ge,_e;t[30]===pe?(ge=t[31],_e=t[32]):(ge=()=>{he.current=pe},_e=[pe],t[30]=pe,t[31]=ge,t[32]=_e),(0,Q.useEffect)(ge,_e);let ve=hT(),ye=hT(),be;t[33]===pe?be=t[34]:(be=()=>TO(`right`,pe,CO())===`collapsed`,t[33]=pe,t[34]=be);let[xe]=(0,Q.useState)(be),[Se,Ce]=(0,Q.useState)(xe),we=(0,Q.useRef)(Se),[Te,Ee]=(0,Q.useState)(null),[De,Oe]=(0,Q.useState)(null),[Ae,je]=(0,Q.useState)(null),Me=o?.terminal!=null,Ne=h===`right`,Pe=Ne?`right`:`bottom`,Fe=Ne&&m,Ie=!m&&p!=null&&(Me||g),Re=Ie&&!Ne,ze=Ie&&Ne,Be=Ne&&m&&Te!=null,Ve=Be?Te:De,He=(Ne?Be:m)&&Ve!=null,Ue,We;t[35]!==Ve||t[36]!==f||t[37]!==Pe||t[38]!==Ae||t[39]!==He?(Ue=()=>{f?.({container:Ve,isShowing:He,dockPosition:Pe,editorRegion:Ae})},We=[f,Ve,He,Pe,Ae],t[35]=Ve,t[36]=f,t[37]=Pe,t[38]=Ae,t[39]=He,t[40]=Ue,t[41]=We):(Ue=t[40],We=t[41]),(0,Q.useEffect)(Ue,We);let Ge,Ke;t[42]===Se?(Ge=t[43],Ke=t[44]):(Ge=()=>{we.current=Se},Ke=[Se],t[42]=Se,t[43]=Ge,t[44]=Ke),(0,Q.useEffect)(Ge,Ke);let[qe,Je]=(0,Q.useState)(!1),Ye=(0,Q.useRef)(!1),[Xe]=(0,Q.useState)(qL),Ze=(0,Q.useRef)(Xe),Qe=(0,Q.useRef)(null),$e;t[45]===Symbol.for(`react.memo_cache_sentinel`)?($e=function(e){Qe.current!=null&&clearTimeout(Qe.current),Qe.current=setTimeout(()=>{dO(e),Qe.current=null},100)},t[45]=$e):$e=t[45];let et=$e,[tt]=(0,Q.useState)(KL),nt=(0,Q.useRef)(tt),[rt,it]=(0,Q.useState)(!1),at=(0,Q.useRef)(!1),st=(0,Q.useRef)(null),ct;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ct=function(e){st.current!=null&&clearTimeout(st.current),st.current=setTimeout(()=>{AO(e),st.current=null},100)},t[46]=ct):ct=t[46];let lt=ct,ut,dt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ut=()=>()=>{Qe.current!=null&&clearTimeout(Qe.current),st.current!=null&&clearTimeout(st.current)},dt=[],t[47]=ut,t[48]=dt):(ut=t[47],dt=t[48]),(0,Q.useEffect)(ut,dt);let[ft,pt]=(0,Q.useState)(null),mt=(0,Q.useRef)(null),ht=uT(),gt=(0,Q.useRef)(Fe),_t,vt;t[49]===Fe?(_t=t[50],vt=t[51]):(_t=()=>{gt.current=Fe},vt=[Fe],t[49]=Fe,t[50]=_t,t[51]=vt),(0,Q.useEffect)(_t,vt);let yt;t[52]!==ve||t[53]!==ye?(yt=function(){for(let e of[ve,ye]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=mt.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[52]=ve,t[53]=ye,t[54]=yt):yt=t[54];let bt=yt,xt;t[55]!==ht||t[56]!==bt?(xt=function(e){if(Ye.current||at.current)return;let t=ht.current;if(t!=null)try{let n=bt();if(n==null)return;let r=t.getLayout(),i=Object.keys(r);if(i.length===0)return;let a=i.find(GL);if(a==null)return;let o={};if(`doc-panel`in r&&(o[`doc-panel`]=e?0:Ze.current),`terminal-column`in r&&(o[`terminal-column`]=nt.current),Object.keys(o).length===0)return;let s=gL({currentLayout:r,containerPx:n,pinnedPx:o,residualId:a});s!==r&&t.setLayout(s)}catch{}},t[55]=ht,t[56]=bt,t[57]=xt):xt=t[57];let St=xt,Ct=(0,Q.useRef)(St),wt;t[58]===St?wt=t[59]:(wt=()=>{Ct.current=St},t[58]=St,t[59]=wt),(0,Q.useEffect)(wt);let Tt;t[60]!==St||t[61]!==ve?(Tt=function(){gt.current?St(!1):ve.current?.expand()},t[60]=St,t[61]=ve,t[62]=Tt):Tt=t[62];let Et=Tt,Ot;t[63]!==St||t[64]!==Se||t[65]!==ve?(Ot=function(){if(ve.current==null)return;let e=he.current;Se?(EO(`right`,e,`open`),gt.current?St(!1):ve.current?.expand()):(EO(`right`,e,`collapsed`),gt.current?St(!0):ve.current?.collapse())},t[63]=St,t[64]=Se,t[65]=ve,t[66]=Ot):Ot=t[66];let kt=Ot,At,jt;t[67]!==St||t[68]!==ue||t[69]!==ve?(At=()=>{let e=window.matchMedia(`(min-width: ${mO}px)`),t=()=>{let e=gO(ue,window.innerWidth,`right`);me(e);let t=TO(`right`,e,CO())===`collapsed`;Ce(t),gt.current?St(t):t?ve.current?.collapse():ve.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},jt=[ue,ve,St],t[67]=St,t[68]=ue,t[69]=ve,t[70]=At,t[71]=jt):(At=t[70],jt=t[71]),(0,Q.useEffect)(At,jt);let Mt,Nt;t[72]!==ft||t[73]!==de?(Mt=()=>{if(ft==null||de)return;let e=new ResizeObserver(()=>{Ct.current(we.current)});return e.observe(ft),()=>e.disconnect()},Nt=[ft,de],t[72]=ft,t[73]=de,t[74]=Mt,t[75]=Nt):(Mt=t[74],Nt=t[75]),(0,Q.useEffect)(Mt,Nt);let Pt,Ft;t[76]!==Et||t[77]!==a?(Pt=()=>{let e=e=>{a(e),Et()},t=cu();return t&&e(t),au(t=>{cu(),e(t)})},Ft=[a,Et],t[76]=Et,t[77]=a,t[78]=Pt,t[79]=Ft):(Pt=t[78],Ft=t[79]),(0,Q.useEffect)(Pt,Ft);let It,Lt;t[80]!==E||t[81]!==Et?(It=()=>{E!==0&&Et()},Lt=[E,Et],t[80]=E,t[81]=Et,t[82]=It,t[83]=Lt):(It=t[82],Lt=t[83]),(0,Q.useEffect)(It,Lt);let Rt=(0,Q.useRef)(Fe),zt,Bt;t[84]!==Se||t[85]!==Fe?(zt=()=>{if(Rt.current===Fe)return;Rt.current=Fe;let e=Se;queueMicrotask(()=>{Ct.current(e)})},Bt=[Fe,Se],t[84]=Se,t[85]=Fe,t[86]=zt,t[87]=Bt):(zt=t[86],Bt=t[87]),(0,Q.useLayoutEffect)(zt,Bt);let Vt,Ht;t[88]===Se?(Vt=t[89],Ht=t[90]):(Vt=()=>{if(!Se||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},Ht=[Se],t[88]=Se,t[89]=Vt,t[90]=Ht),(0,Q.useLayoutEffect)(Vt,Ht);let Ut,Wt;t[91]===Se?(Ut=t[92],Wt=t[93]):(Ut=()=>{Jc({docPanelVisible:!Se}),window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Se})},Wt=[Se],t[91]=Se,t[92]=Ut,t[93]=Wt),(0,Q.useEffect)(Ut,Wt);let Gt,Kt;t[94]===kt?(Gt=t[95],Kt=t[96]):(Gt=()=>en(e=>{e===`toggle-doc-panel`&&kt()}),Kt=[kt],t[94]=kt,t[95]=Gt,t[96]=Kt),(0,Q.useEffect)(Gt,Kt);let qt,Yt;t[97]===kt?(qt=t[98],Yt=t[99]):(qt=()=>{if(window.okDesktop!=null)return;let e=e=>{Zu(e,`toggle-document-panel`)&&(Af()||(e.preventDefault(),kt()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Yt=[kt],t[97]=kt,t[98]=qt,t[99]=Yt),(0,Q.useEffect)(qt,Yt);let Xt=(0,Q.useRef)(null),[Zt,Qt]=(0,Q.useState)(null),[$t,tn]=(0,Q.useState)(!1),nn=S?.kind===`large-file`?S.docName:b,rn,an;t[100]===nn?(rn=t[101],an=t[102]):(rn=()=>{if(nn&&nn!==Xt.current){let e=Xt.current;Xt.current=nn,Qt(e)}},an=[nn],t[100]=nn,t[101]=rn,t[102]=an),(0,Q.useEffect)(rn,an);let on;t[103]===D?on=t[104]:(on=function(e){let t=Bd(e);window.location.hash===t?D(e):window.location.hash=t},t[103]=D,t[104]=on);let sn=on,cn,ln=null;if(S?.kind===`large-file`){let e;t[105]!==sn||t[106]!==Zt?(e=Zt?{previousDocName:Zt,onNavigateBack:sn}:void 0,t[105]=sn,t[106]=Zt,t[107]=e):e=t[107];let n;t[108]!==S.docName||t[109]!==S.limit||t[110]!==S.size||t[111]!==e?(n=(0,Z.jsx)(iD,{docName:S.docName,size:S.size,limit:S.limit,backNav:e}),t[108]=S.docName,t[109]=S.limit,t[110]=S.size,t[111]=e,t[112]=n):n=t[112],cn=n}else if(S?.kind===`folder`){let e;t[113]!==de||t[114]!==m?(e=Ck({terminalVisible:m,isEmbedded:de}),t[113]=de,t[114]=m,t[115]=e):e=t[115];let n=e,r;t[116]===S.folderPath?r=t[117]:(r=(0,Z.jsx)(eD,{folderPath:S.folderPath}),t[116]=S.folderPath,t[117]=r);let i;t[118]===n?i=t[119]:(i=n?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-2 bg-linear-to-t from-background to-transparent`}):null,t[118]=n,t[119]=i);let a;t[120]!==r||t[121]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[r,i]}),t[120]=r,t[121]=i,t[122]=a):a=t[122];let o;t[123]!==S.folderPath||t[124]!==n?(o=n?(0,Z.jsx)(ck,{folderPath:S.folderPath}):null,t[123]=S.folderPath,t[124]=n,t[125]=o):o=t[125];let s;if(t[126]!==a||t[127]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[a,o]}),t[126]=a,t[127]=o,t[128]=s):s=t[128],cn=s,w===`agent`&&T!==null){let e;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(HD,{withHandle:!0}),t[129]=e):e=t[129];let n;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(VD,{id:`agent-panel`,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(ML,{showBackButton:!1})})})]}),t[130]=n):n=t[130],ln=n}}else if(S?.kind===`asset`&&La(S.assetPath.split(`/`).pop()??S.assetPath)){let e;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(FL,{}),t[131]=e):e=t[131];let n;t[132]===S.assetPath?n=t[133]:(n=(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(NL,{assetPath:S.assetPath},S.assetPath)}),t[132]=S.assetPath,t[133]=n),cn=n}else if(S?.kind===`asset`&&Pi(S.assetPath)){let e;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(FL,{}),t[134]=e):e=t[134];let n;t[135]===S.assetPath?n=t[136]:(n=(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(PL,{assetPath:S.assetPath},S.assetPath)}),t[135]=S.assetPath,t[136]=n),cn=n}else if(S?.kind===`asset`){let e;t[137]!==S.assetPath||t[138]!==S.mediaKind?(e=(0,Z.jsx)(xT,{assetPath:S.assetPath,mediaKind:S.mediaKind},S.assetPath),t[137]=S.assetPath,t[138]=S.mediaKind,t[139]=e):e=t[139],cn=e}else if(S?.kind===`skill-file`){let e=`${S.scope}/${S.name}/${S.path}`,n;t[140]!==S.name||t[141]!==S.path||t[142]!==S.scope||t[143]!==e?(n=(0,Z.jsx)(vD,{scope:S.scope,name:S.name,path:S.path},e),t[140]=S.name,t[141]=S.path,t[142]=S.scope,t[143]=e,t[144]=n):n=t[144],cn=n}else if(le){let e;t[145]===le?e=t[146]:(e=(0,Z.jsx)(sD,{nav:le},le.path),t[145]=le,t[146]=e),cn=e}else if(!x||!b)if((typeof window<`u`?zd(window.location.hash):null)!==null)if(o!=null&&P){let e;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(CT,{}),t[147]=e):e=t[147],cn=e;let n;t[148]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(HD,{withHandle:!0,disabled:!0}),t[148]=n):n=t[148];let r=xe?0:`${Xe}px`,i;t[149]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[149]=i):i=t[149];let a;t[150]===r?a=t[151]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(VD,{id:`doc-panel`,defaultSize:r,minSize:RL,maxSize:zL,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[150]=r,t[151]=a),ln=a}else{let e;return t[152]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(CT,{}),t[152]=e):e=t[152],e}else{let e=m?Pe:null,n;t[153]===e?n=t[154]:(n=(0,Z.jsx)(xE,{terminalDock:e}),t[153]=e,t[154]=n),cn=n}else{let e=n===`source`,o=!M,s=Se,l;t[155]!==b||t[156]!==O?(l=function(){b&&O(b)},t[155]=b,t[156]=O,t[157]=l):l=t[157];let u=l,d;t[158]!==b||t[159]!==te||t[160]!==G||t[161]!==de||t[162]!==m||t[163]!==U?(d=Sk({terminalVisible:m,isEmbedded:de,activeDocName:b})&&!(U&&U.docName===b)&&!(te&&G===b),t[158]=b,t[159]=te,t[160]=G,t[161]=de,t[162]=m,t[163]=U,t[164]=d):d=t[164];let f=d,p=R??b,h=Zt??void 0,g;t[165]!==H||t[166]!==e||t[167]!==sn||t[168]!==C||t[169]!==p||t[170]!==h?(g=(0,Z.jsx)(eI,{activeDocName:p,isSourceMode:e,editorPlaceholder:H,previousDocName:h,onNavigateBack:sn,onRecycle:C}),t[165]=H,t[166]=e,t[167]=sn,t[168]=C,t[169]=p,t[170]=h,t[171]=g):g=t[171];let _;t[172]!==b||t[173]!==e?(_=(0,Z.jsx)(eO,{activeDocName:b,isSourceMode:e}),t[172]=b,t[173]=e,t[174]=_):_=t[174];let v;t[175]!==b||t[176]!==R?(v=hL({activeDocName:b,deferredActiveDocName:R,mountResolved:b!==null&&c(b),syncResolved:b!==null&&ke(b)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(CT,{}),b===null?null:(0,Z.jsx)(aD,{docName:b})]}):null,t[175]=b,t[176]=R,t[177]=v):v=t[177];let y;t[178]!==b||t[179]!==Se||t[180]!==U||t[181]!==kt?(y=U&&U.docName===b?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(IL,{view:U,isPanelCollapsed:Se,onTogglePanel:kt})}):null,t[178]=b,t[179]=Se,t[180]=U,t[181]=kt,t[182]=y):y=t[182];let x;t[183]!==b||t[184]!==te||t[185]!==G||t[186]!==Se||t[187]!==kt?(x=te&&G===b?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(LL,{view:te,isPanelCollapsed:Se,onTogglePanel:kt})}):null,t[183]=b,t[184]=te,t[185]=G,t[186]=Se,t[187]=kt,t[188]=x):x=t[188];let S;t[189]!==g||t[190]!==_||t[191]!==v||t[192]!==y||t[193]!==x?(S=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[g,_,v,y,x]}),t[189]=g,t[190]=_,t[191]=v,t[192]=y,t[193]=x,t[194]=S):S=t[194];let T;t[195]!==b||t[196]!==N||t[197]!==s||t[198]!==e||t[199]!==r||t[200]!==u||t[201]!==ze||t[202]!==o||t[203]!==kt?(T=!N&&(0,Z.jsx)(mL,{activeDocName:b,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:u,isPanelCollapsed:s,onTogglePanel:kt,reserveRightGutter:ze&&s}),t[195]=b,t[196]=N,t[197]=s,t[198]=e,t[199]=r,t[200]=u,t[201]=ze,t[202]=o,t[203]=kt,t[204]=T):T=t[204];let E;t[205]!==b||t[206]!==$t||t[207]!==e||t[208]!==f?(E=f?(0,Z.jsx)(ck,{docName:b,surface:e?`source`:`wysiwyg`,dismissed:$t,onDismiss:()=>tn(!0),onReopen:()=>tn(!1)}):null,t[205]=b,t[206]=$t,t[207]=e,t[208]=f,t[209]=E):E=t[209];let D;t[210]!==S||t[211]!==T||t[212]!==E?(D=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[S,T,E]}),t[210]=S,t[211]=T,t[212]=E,t[213]=D):D=t[213];let j;t[214]!==$t||t[215]!==f?(j=f&&$t?{onReopen:()=>tn(!1)}:null,t[214]=$t,t[215]=f,t[216]=j):j=t[216];let P;t[217]!==Re||t[218]!==A||t[219]!==B||t[220]!==k||t[221]!==j?(P=(0,Z.jsx)(tL,{stats:k,selectionStats:A,showStats:B,composerBadge:j,reserveRightGutter:Re}),t[217]=Re,t[218]=A,t[219]=B,t[220]=k,t[221]=j,t[222]=P):P=t[222];let F;t[223]!==D||t[224]!==P?(F=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[D,P]}),t[223]=D,t[224]=P,t[225]=F):F=t[225],cn=F;let I=Fe&&Se,L=!Se,z;t[226]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>{Je(!0),Ye.current=!0;let e=()=>{Je(!1),Ye.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[226]=z):z=t[226];let V;t[227]!==Se||t[228]!==L?(V=(0,Z.jsx)(HD,{withHandle:L,disabled:Se,onPointerDown:z}),t[227]=Se,t[228]=L,t[229]=V):V=t[229];let ee=xe?0:`${Xe}px`,W=I?`0px`:RL,ne;t[230]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>{Ce(e.asPercentage===0),e.inPixels>0&&Ye.current&&(Ze.current=e.inPixels,et(e.inPixels))},t[230]=ne):ne=t[230];let K=!qe&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,q;t[231]===K?q=t[232]:(q=Y(`flex flex-col bg-muted/20`,K),t[231]=K,t[232]=q);let re;t[233]!==b||t[234]!==i||t[235]!==w||t[236]!==e||t[237]!==a?(re=(0,Z.jsx)(yC,{docName:b,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:w}),t[233]=b,t[234]=i,t[235]=w,t[236]=e,t[237]=a,t[238]=re):re=t[238];let ie;t[239]!==I||t[240]!==Se||t[241]!==ve||t[242]!==ee||t[243]!==W||t[244]!==q||t[245]!==re?(ie=(0,Z.jsx)(VD,{id:`doc-panel`,panelRef:ve,disabled:I,defaultSize:ee,minSize:W,maxSize:zL,collapsible:!0,collapsedSize:0,onResize:ne,inert:Se,className:q,children:re}),t[239]=I,t[240]=Se,t[241]=ve,t[242]=ee,t[243]=W,t[244]=q,t[245]=re,t[246]=ie):ie=t[246];let ae;t[247]!==V||t[248]!==ie?(ae=(0,Z.jsxs)(Z.Fragment,{children:[V,ie]}),t[247]=V,t[248]=ie,t[249]=ae):ae=t[249],ln=ae}let un=l??WL,dn;t[250]!==Re||t[251]!==p||t[252]!==un||t[253]!==Pe||t[254]!==m||t[255]!==cn?(dn=(0,Z.jsx)(AL,{visible:m,onVisibleChange:un,dockPosition:Pe,onBottomContainer:Oe,onEditorRegion:je,onReveal:p,showRevealTab:Re,children:cn}),t[250]=Re,t[251]=p,t[252]=un,t[253]=Pe,t[254]=m,t[255]=cn,t[256]=dn):dn=t[256];let X=dn,fn;t[257]!==tt||t[258]!==rt||t[259]!==l||t[260]!==ye||t[261]!==Fe||t[262]!==y?(fn=Fe?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(HD,{withHandle:!0,onPointerDown:()=>{it(!0),at.current=!0;let e=()=>{it(!1),at.current=!1,window.removeEventListener(`pointerup`,e),ye.current?.isCollapsed()&&l?.(!1)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)(VD,{id:`terminal-column`,panelRef:ye,style:{backgroundColor:y},defaultSize:`${tt}px`,minSize:`320px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:e=>{e.inPixels>0&&at.current&&(nt.current=e.inPixels,lt(e.inPixels))},className:Y(`flex flex-col`,!rt&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:Ee,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[257]=tt,t[258]=rt,t[259]=l,t[260]=ye,t[261]=Fe,t[262]=y,t[263]=fn):fn=t[263];let pn=fn,mn=ln!=null&&!xe||Fe,hn;t[264]===Symbol.for(`react.memo_cache_sentinel`)?(hn=e=>{pt(e),mt.current=e},t[264]=hn):hn=t[264];let gn=qe||rt||void 0,_n=Fe?`5%`:`30%`,vn;t[265]===mn?vn=t[266]:(vn=mn?{}:{defaultSize:`100%`},t[265]=mn,t[266]=vn);let yn=!(qe||rt)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,bn;t[267]===yn?bn=t[268]:(bn=Y(yn),t[267]=yn,t[268]=bn);let xn;t[269]!==X||t[270]!==_n||t[271]!==vn||t[272]!==bn?(xn=(0,Z.jsx)(VD,{minSize:_n,...vn,className:bn,children:X}),t[269]=X,t[270]=_n,t[271]=vn,t[272]=bn,t[273]=xn):xn=t[273];let Sn;t[274]!==ht||t[275]!==ln||t[276]!==gn||t[277]!==xn||t[278]!==pn?(Sn=(0,Z.jsxs)(BD,{orientation:`horizontal`,groupRef:ht,"data-dragging":gn,children:[xn,ln,pn]}),t[274]=ht,t[275]=ln,t[276]=gn,t[277]=xn,t[278]=pn,t[279]=Sn):Sn=t[279];let Cn;t[280]!==p||t[281]!==ze?(Cn=ze?(0,Z.jsx)(OL,{dockPosition:`right`,onReveal:p,className:`top-2.5 right-0`}):null,t[280]=p,t[281]=ze,t[282]=Cn):Cn=t[282];let wn;return t[283]!==Sn||t[284]!==Cn?(wn=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,ref:hn,children:[Sn,Cn]}),t[283]=Sn,t[284]=Cn,t[285]=wn):wn=t[285],wn}function WL(){}function GL(e){return!BL.has(e)}function KL(){return jO()}function qL(){return fO()}function JL(){return ca()}function YL(){if(typeof window>`u`)return!1;let e=window.okDesktop;return e!=null&&e.menu!=null&&e.platform!==`darwin`}function XL(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind)return!1;if(r.kind===`human`&&i.kind===`human`){if(r.clientId!==i.clientId||r.mode!==i.mode||r.tabCount!==i.tabCount)return!1;let e=r.user,t=i.user;if(e.name!==t.name||e.color!==t.color||e.icon!==t.icon)return!1}else if(r.kind===`agent`&&i.kind===`agent`){if(r.agentId!==i.agentId)return!1;let e=r.presence,t=i.presence;if(e.displayName!==t.displayName||e.icon!==t.icon||e.color!==t.color||e.currentDoc!==t.currentDoc||e.mode!==t.mode)return!1}}return!0}function ZL(e){let t=new Map;for(let n of e){let e=n.user.principalId;if(typeof e==`string`&&e.length>0){let r=t.get(e);r?r.push(n):t.set(e,[n])}}let n=new Map;for(let[e,r]of t){let t=r.reduce((e,t)=>Math.min(e,t.clientId),1/0);n.set(e,{repClientId:t,count:r.length})}let r=[];for(let t of e){let e=t.user.principalId;if(typeof e==`string`&&e.length>0){let i=n.get(e);i&&i.repClientId===t.clientId&&r.push({...t,tabCount:i.count})}else r.push({...t,tabCount:1})}return r}var QL=1e3,$L=!1;function eR(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function tR(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:Rm(i)?a=i:(a=void 0,$L||($L=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=(r?.getLocalState())?.user?.principalId??null,t=r?.clientID??null,i=[];if(r)for(let[n,a]of r.getStates().entries()){let r=a;if(!r.user||typeof r.user!=`object`)continue;let o=r.user;o.type===`human`&&(eR({entryPrincipalId:o.principalId,entryClientId:n,localPrincipalId:e,localClientId:t})||i.push({kind:`human`,clientId:n,user:o,mode:r.mode??`wysiwyg`,tabCount:1}))}let s=ZL(i),{current:c,crossDoc:l}=a?zm(a,n,Date.now()):{current:[],crossDoc:[]},u=nR,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>XL(e.current,p)&&XL(e.crossDoc,m)?e:{current:p,crossDoc:m})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,QL);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function nR(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var rR=!1,iR=new Set,aR=!1;function oR(){for(let e of iR)e()}function sR(e){rR!==e&&(rR=e,oR())}function cR(){return rR}function lR(e){return iR.add(e),()=>{iR.delete(e)}}function uR(e){let t=[e.onUpdateRelaunching(()=>sR(!0)),e.onUpdateRelaunchFailed(()=>sR(!1))];return()=>{for(let e of t)e()}}function dR(){if(aR||typeof window>`u`)return;let e=window.okDesktop;e&&(aR=!0,uR(e))}function fR(){return(0,Q.useSyncExternalStore)(lR,cR,pR)}function pR(){return!1}var mR=`sync-status`;async function hR(e){try{let t=await ix(e);t.ok||Mu.error(t.message,{id:mR,duration:1/0})}catch{}}function gR(e,t){let n=(0,$.c)(6),{_:r}=Dt(),i=fR(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==i||n[3]!==e?(c=()=>{if(s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t)if(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current){if(i){Mu.dismiss(mR);return}o.current=!0;let e=window.okDesktop;Mu.warning(r({id:`HGNCsl`}),{id:mR,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{hR(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,Mu.success(r({id:`GhjUB_`}),{id:mR,duration:3e3}))},l=[e,t,r,i],n[0]=r,n[1]=t,n[2]=i,n[3]=e,n[4]=c,n[5]=l):(c=n[4],l=n[5]),(0,Q.useEffect)(c,l)}var _R=4,vR=3,yR={Bird:e_,Cat:i_,Dog:d_,Fish:v_,Mouse:U_,Rabbit:H_,Shrimp:J_,Snail:Y_,Squirrel:Q_,Turtle:uv};Object.freeze(Object.keys(yR));function bR(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(yR,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var xR={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function SR(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=Dt(),o=bR(n),s=o.kind===`animal`?yR[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=Gi(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=aa(n.color),t[2]=n.color,t[3]=u);let d=u,f=n.name,p;t[4]!==a||t[5]!==i||t[6]!==f?(p=i>1?a({id:`qAhFeg`,values:{userName:f,tabCount:i}}):f,t[4]=a,t[5]=i,t[6]=f,t[7]=p):p=t[7];let m=p,h;t[8]!==a||t[9]!==i||t[10]!==f?(h=i>1?a({id:`BEkF-P`,values:{userName:f,tabCount:i}}):f,t[8]=a,t[9]=i,t[10]=f,t[11]=h):h=t[11];let g=h,_;t[12]===n.color?_=t[13]:(_={backgroundColor:n.color},t[12]=n.color,t[13]=_);let v;t[14]!==s||t[15]!==d||t[16]!==l?(v=s?(0,Z.jsx)(s,{size:18,color:d,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:d},children:l}),t[14]=s,t[15]=d,t[16]=l,t[17]=v):v=t[17];let y;t[18]!==g||t[19]!==r||t[20]!==_||t[21]!==v?(y=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":g,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:_,children:v})}),t[18]=g,t[19]=r,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;t[23]===m?b=t[24]:(b=(0,Z.jsx)(vn,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(bn,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function CR(e){let t=xR[e.icon];return e.displayName||t||zu._({id:`iEQQyu`})}function wR(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(e===`writing`),i=(0,Q.useRef)(null),a,o;return t[0]===e?(a=t[1],o=t[2]):(a=()=>{if(e===`writing`){i.current!==null&&(clearTimeout(i.current),i.current=null),r(!0);return}return i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,r(!1)},600),()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)}},o=[e],t[0]=e,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),n}function TR(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=Dt(),{activeDocName:s}=ot(),{presence:c,agentId:l}=n,u=CR(c),d=wR(c.mode),f=!r&&d,p=c.currentDoc&&!Yi(c.currentDoc)?c.currentDoc:null,m=s!==null||p!==null,h=m?`cursor-pointer`:`cursor-default opacity-50`,g=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,_=f&&!i?`ring-primary/40 animate-pulse`:``,v;t[0]!==h||t[1]!==g||t[2]!==_?(v=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,h,g,_].filter(Boolean),t[0]=h,t[1]=g,t[2]=_,t[3]=v):v=t[3];let y=v.join(` `),b=r?`true`:void 0,x=i?`true`:void 0,S=m?void 0:`true`,C;t[4]!==c.mode||t[5]!==b||t[6]!==x||t[7]!==S?(C={"data-presence-badge":`agent`,"data-presence-mode":c.mode,"data-presence-crossdoc":b,"data-presence-scoped":x,"data-presence-inert":S},t[4]=c.mode,t[5]=b,t[6]=x,t[7]=S,t[8]=C):C=t[8];let w=C,T=o(r&&p?{id:`b4AQFK`,values:{tooltipName:u,realCurrentDoc:p}}:{id:`RfHNf8`,values:{tooltipName:u}}),E;t[9]!==l||t[10]!==T||t[11]!==w||t[12]!==m||t[13]!==a||t[14]!==c.color||t[15]!==c.icon||t[16]!==p||t[17]!==y||t[18]!==u?(E=m?(0,Z.jsx)(`button`,{type:`button`,...w,"aria-label":T,className:y,style:{backgroundColor:c.color},onClick:()=>a(l,p),children:(0,Z.jsx)(Lp,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...w,role:`img`,"aria-label":u,className:y,style:{backgroundColor:c.color},children:(0,Z.jsx)(Lp,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=l,t[10]=T,t[11]=w,t[12]=m,t[13]=a,t[14]=c.color,t[15]=c.icon,t[16]=p,t[17]=y,t[18]=u,t[19]=E):E=t[19];let D=E,O;t[20]===D?O=t[21]:(O=(0,Z.jsx)(_n,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(vn,{className:`flex flex-col gap-0.5`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;return t[30]!==O||t[31]!==j?(M=(0,Z.jsxs)(bn,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function ER(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?zu._({id:`9euN0m`,values:{count:n}}):zu._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)($t,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(SR,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(TR,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(an,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(Qt,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function DR(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(SR,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(TR,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function OR(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ot(),{current:s,crossDoc:c}=tR(t,r,n);if(gR(MO(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,_R),n;e[6]===s?n=e[7]:(n=s.slice(_R),e[6]=s,e[7]=n);let r=n,u=c.slice(0,vR),d;e[8]===c?d=e[9]:(d=c.slice(vR),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>DR(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(ER,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>DR(e,p,!0,m)),f.length>0?(0,Z.jsx)(ER,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function kR(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.state.query().then(e=>{t||n(e.channel)}).catch(AR),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={channel:t},e[2]=t,e[3]=a),a}function AR(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function jR(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=Dt(),{channel:i}=kR();if(i!==`beta`)return null;let a;t[0]===r?a=t[1]:(a=r({id:`9fhQRL`}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`cSCbv3`}),t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==a?(s=(0,Z.jsx)(Ud,{variant:`secondary`,"aria-label":a,"data-testid":`beta-badge`,className:n,children:o}),t[3]=n,t[4]=a,t[5]=s):s=t[5],s}function MR(e,t){return t.trim()}function NR(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function PR(e,t){let n=MR(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function FR(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(rd(e)){let t=s.get(Am(e.docName,e.docExt));if(t){let n=ud(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:oo(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(od(e))return{...e,path:VR(e.path,n)};if(ld(e)){let t=s.get(e.path);return t&&$u(t)?{kind:`document`,docName:gm(t),docExt:td(t),size:e.size,modified:e.modified}:{...e,path:t??VR(e.path,n)}}return e})}function IR(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>rd(e)?!i.has(e.docName)&&!GR(e.docName,n):od(e)?!GR(e.path,n):ld(e)?!a.has(e.path)&&!GR(e.path,n):!0)}function LR(e,t){if(e.kind!==`asset`||t.some(t=>ld(t)&&t.path===e.path))return e;let n=Nm(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function RR(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>HR(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>rd(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>od(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(rd(i)){let e=WR(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(od(i)){let e=UR(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function zR(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function BR(e,t){let n=e.kind===`file`?Am(e.path,e.docExt):e.path;return uc(t.contentDir,n,t.pathSeparator)}function VR(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function HR(e,t){return rd(e)&&rd(t)?e.docName===t.docName:od(e)&&od(t)||ld(e)&&ld(t)?e.path===t.path:!1}function UR(e,t,n){return e===t?n:WR(e,t,n)}function WR(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function GR(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}var KR=[`.md`,`.mdx`],qR=`group relative -mb-px flex h-10 min-w-28 max-w-64 shrink-0 cursor-pointer items-center overflow-hidden border border-transparent font-medium transition-colors`,JR=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,YR=Y(JR,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),XR=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function ZR(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function QR(e){let t=Bd(e);window.location.hash!==t&&(window.location.hash=t)}function $R(e,t){let n=[t,...KR].filter((e,t,n)=>e&&n.indexOf(e)===t),r=e.toLowerCase(),i=n.find(t=>e.length>t.length&&r.endsWith(t.toLowerCase()));return i?e.slice(0,-i.length):e}function ez(e){return e.metaKey||e.ctrlKey}var tz=1e3;function nz(e,t){return e<0||e>=t?null:e<8?String(e+1):e===t-1?`9`:null}function rz(e,t){return nz(e,t)}function iz(e,t){let n=nz(e,t);if(n)return[`Meta+${n}`,`Control+${n}`].join(` `)}function az(e,t){if(!ez(e)||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key))return null;let n=Number(e.key);if(n===9)return t>0?t-1:null;let r=n-1;return r<Math.min(8,t)?r:null}function oz(e){let t=(0,$.c)(3),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Y(Uc(!0),`font-mono tabular-nums hover:bg-transparent animate-in fade-in-0 zoom-in-95 duration-150 motion-reduce:animate-none motion-reduce:duration-0`),t[0]=r):r=t[0];let i=`⌘${n}`,a;return t[1]===i?a=t[2]:(a=(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`editor-tab-shortcut-hint`,className:r,children:(0,Z.jsx)(le,{className:`text-[10px]`,children:i})}),t[1]=i,t[2]=a),a}function sz(e){let t=(0,$.c)(37),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({activateFromKeyboard:n,className:r,tabId:l,disabled:i,onKeyDown:a,ref:o,style:s,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u;t[9]!==i||t[10]!==l?(u={id:l,disabled:i},t[9]=i,t[10]=l,t[11]=u):u=t[11];let{attributes:d,listeners:f,rect:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=Jp(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=rl({activeWidth:v,isDragging:_,outerStyle:s,transform:h,transition:g}),t[12]=_,t[13]=s,t[14]=v,t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=y,x;t[18]!==o||t[19]!==m?(x=function(e){m(e),typeof o==`function`?o(e):o&&`current`in o&&(o.current=e)},t[18]=o,t[19]=m,t[20]=x):x=t[20];let S=x,C=f?.onKeyDown,w;t[21]!==n||t[22]!==_||t[23]!==a||t[24]!==C?(w=function(e){a?.(e);let t=Yc({event:e,hasKeyboardActivation:!!n,isDragging:_});if(t!==`ignore`){if(t===`activate-tab`&&n){e.preventDefault(),n();return}C?.(e)}},t[21]=n,t[22]=_,t[23]=a,t[24]=C,t[25]=w):w=t[25];let T=w,E;t[26]!==r||t[27]!==_?(E=Hc({className:r,isDragging:_}),t[26]=r,t[27]=_,t[28]=E):E=t[28];let D;return t[29]!==d||t[30]!==S||t[31]!==T||t[32]!==f||t[33]!==c||t[34]!==b||t[35]!==E?(D=(0,Z.jsx)(`div`,{ref:S,"data-editor-tab-sortable":``,className:E,style:b,...c,...d,...f,onKeyDown:T}),t[29]=d,t[30]=S,t[31]=T,t[32]=f,t[33]=c,t[34]=b,t[35]=E,t[36]=D):D=t[36],D}function cz(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:s,pinTab:c,pinnedTabIds:l,tabId:u,unpinTab:d}=e,f=a===void 0?!0:a;if(o!==void 0&&o)return n;let p;t[0]!==f||t[1]!==l||t[2]!==u?(p=f&&l.includes(u),t[0]=f,t[1]=l,t[2]=u,t[3]=p):p=t[3];let m=p,h;if(t[4]!==s||t[5]!==l||t[6]!==u){let e;t[8]===u?e=t[9]:(e=e=>e!==u,t[8]=u,t[9]=e),h=ce(s.filter(e),l),t[4]=s,t[5]=l,t[6]=u,t[7]=h}else h=t[7];let g=h,_;t[10]!==s||t[11]!==l?(_=ce(s,l),t[10]=s,t[11]=l,t[12]=_):_=t[12];let v=_,y;t[13]===n?y=t[14]:(y=(0,Z.jsx)(Ob,{asChild:!0,children:n}),t[13]=n,t[14]=y);let b;t[15]!==r||t[16]!==u?(b=()=>r(u),t[15]=r,t[16]=u,t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(J,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(Mb,{disabled:m,onSelect:b,children:x}),t[19]=m,t[20]=b,t[21]=S):S=t[21];let C=g.length===0,w;t[22]!==i||t[23]!==g?(w=()=>{i(g)},t[22]=i,t[23]=g,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(J,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(Mb,{disabled:C,onSelect:w,children:T}),t[26]=C,t[27]=w,t[28]=E):E=t[28];let D=v.length===0,O;t[29]!==v||t[30]!==i?(O=()=>{i(v)},t[29]=v,t[30]=i,t[31]=O):O=t[31];let k;t[32]===l.length?k=t[33]:(k=l.length?(0,Z.jsx)(J,{id:`U2Kx6T`}):(0,Z.jsx)(J,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(Mb,{disabled:D,"data-testid":`editor-tab-context-close-all`,onSelect:O,children:k}),t[34]=D,t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==f||t[39]!==m||t[40]!==c||t[41]!==u||t[42]!==d?(j=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Lb,{}),(0,Z.jsx)(Mb,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(J,{id:`SYfHmN`}):(0,Z.jsx)(J,{id:`3pU8e-`})})]}),t[38]=f,t[39]=m,t[40]=c,t[41]=u,t[42]=d,t[43]=j):j=t[43];let M;t[44]!==E||t[45]!==A||t[46]!==j||t[47]!==S?(M=(0,Z.jsxs)(jb,{className:`min-w-40`,children:[S,E,A,j]}),t[44]=E,t[45]=A,t[46]=j,t[47]=S,t[48]=M):M=t[48];let N;return t[49]!==M||t[50]!==y?(N=(0,Z.jsxs)(Db,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function lz(e){let t=(0,$.c)(28),{accessibleLabel:n,closeTab:r,forceCloseVisible:i,isActive:a,isPinned:o,shortcutHint:s,tabId:c,unpinTab:l}=e,u=i===void 0?!1:i,d=s===void 0?null:s,{_:f}=Dt();if(d){let e;return t[0]===d?e=t[1]:(e=(0,Z.jsx)(oz,{value:d}),t[0]=d,t[1]=e),e}if(o){let e;t[2]!==f||t[3]!==n?(e=f({id:`t18QYR`,values:{accessibleLabel:n}}),t[2]=f,t[3]=n,t[4]=e):e=t[4];let r;t[5]!==c||t[6]!==l?(r=e=>{e.stopPropagation(),l(c)},t[5]=c,t[6]=l,t[7]=r):r=t[7];let i;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(V_,{"aria-hidden":`true`}),t[8]=i):i=t[8];let a;return t[9]!==e||t[10]!==r?(a=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[9]=e,t[10]=r,t[11]=a):a=t[11],a}let p;t[12]!==f||t[13]!==n?(p=f({id:`JLzQi_`,values:{accessibleLabel:n}}),t[12]=f,t[13]=n,t[14]=p):p=t[14];let m=u||a,h;t[15]===m?h=t[16]:(h=Uc(m),t[15]=m,t[16]=h);let g;t[17]===a?g=t[18]:(g=Wc(a),t[17]=a,t[18]=g);let _;t[19]!==r||t[20]!==c?(_=e=>{e.stopPropagation(),r(c)},t[19]=r,t[20]=c,t[21]=_):_=t[21];let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(ju,{"aria-hidden":`true`}),t[22]=v):v=t[22];let y;return t[23]!==p||t[24]!==h||t[25]!==g||t[26]!==_?(y=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":p,"data-testid":`editor-tab-close-button`,className:h,tabIndex:g,onClick:_,children:v}),t[23]=p,t[24]=h,t[25]=g,t[26]=_,t[27]=y):y=t[27],y}function uz(e){let t=(0,$.c)(1),{hasConflict:n}=e;if(!n)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Eu,{"aria-hidden":`true`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function dz(e){let t=(0,$.c)(27),{accessibleLabel:n,activateTab:r,baseName:i,docName:a,enterRenameMode:o,extension:s,hideDocExtension:c,tabId:l}=e,{_:u}=Dt(),d=oO(a)===`conflict`,f;t[0]!==u||t[1]!==n||t[2]!==d?(f=d?u({id:`mVFyH-`,values:{accessibleLabel:n}}):n,t[0]=u,t[1]=n,t[2]=d,t[3]=f):f=t[3];let p=f,m;t[4]!==r||t[5]!==l?(m=()=>{r(l)},t[4]=r,t[5]=l,t[6]=m):m=t[6];let h;t[7]!==a||t[8]!==o||t[9]!==l?(h=e=>{e.preventDefault(),e.stopPropagation(),o(l,a)},t[7]=a,t[8]=o,t[9]=l,t[10]=h):h=t[10];let g;t[11]===d?g=t[12]:(g=(0,Z.jsx)(uz,{hasConflict:d}),t[11]=d,t[12]=g);let _;t[13]===i?_=t[14]:(_=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),t[13]=i,t[14]=_);let v;t[15]!==s||t[16]!==c?(v=!c&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:s}),t[15]=s,t[16]=c,t[17]=v):v=t[17];let y;t[18]!==_||t[19]!==v?(y=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[_,v]}),t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==p||t[22]!==m||t[23]!==h||t[24]!==g||t[25]!==y?(b=(0,Z.jsxs)(`button`,{type:`button`,"aria-label":p,title:p,className:XR,onClick:m,onDoubleClick:h,tabIndex:-1,children:[g,y]}),t[21]=p,t[22]=m,t[23]=h,t[24]=g,t[25]=y,t[26]=b):b=t[26],b}function fz(){let e=(0,$.c)(94),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeNewTab:s,closeTab:c,closeTabs:l,isNewTabActive:u,newTabIds:d,openNewTab:f,openTabs:p,pinTab:m,pinnedTabIds:h,reopenClosedTab:g,reconcileLocalRename:_,reorderTabs:v,unpinTab:y,visibleTabIds:b}=ot(),{_:x}=Dt(),{pageMeta:S}=rs(),C=(0,Q.useRef)(null),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(!1),[P,F]=(0,Q.useState)(!1),I=(0,Q.useRef)(null),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(null),B=(0,Q.useRef)(t),V=(0,Q.useRef)(null),H=(0,Q.useRef)(!1),W=(0,Q.useRef)(!1),te;e[0]!==n||e[1]!==t||e[2]!==i?(te=n??(i?Oe(i):t?ue(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=te):te=e[3];let G=te,ne;e[4]!==r||e[5]!==G||e[6]!==u||e[7]!==d||e[8]!==p?(ne=u?`${r??`__new-tab__`}\u0000${p.join(`\0`)}\u0000${d.join(`\0`)}`:G?`${G}\u0000${p.join(`\0`)}`:``,e[4]=r,e[5]=G,e[6]=u,e[7]=d,e[8]=p,e[9]=ne):ne=e[9];let K=ne,q,re;e[10]===t?(q=e[11],re=e[12]):(q=()=>{B.current=t},re=[t],e[10]=t,e[11]=q,e[12]=re),(0,Q.useEffect)(q,re);let ie,ae;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>()=>{V.current!==null&&(window.clearTimeout(V.current),V.current=null)},ae=[],e[13]=ie,e[14]=ae):(ie=e[13],ae=e[14]),(0,Q.useEffect)(ie,ae);let oe,se;e[15]===K?(oe=e[16],se=e[17]):(oe=()=>{K&&(C.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},se=[K],e[15]=K,e[16]=oe,e[17]=se),(0,Q.useEffect)(oe,se);let ce,le;e[18]===E?(ce=e[19],le=e[20]):(ce=()=>{E&&(I.current?.focus(),I.current?.select())},le=[E],e[18]=E,e[19]=ce,e[20]=le),(0,Q.useEffect)(ce,le);let de,fe;e[21]!==p||e[22]!==E?(de=()=>{!E||p.includes(E.tabId)||(R.current=!0,z.current=null,D(null),k(``),j(null),N(!1))},fe=[p,E],e[21]=p,e[22]=E,e[23]=de,e[24]=fe):(de=e[23],fe=e[24]),(0,Q.useEffect)(de,fe);let me;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(e,t){let n=t.split(`/`);R.current=!1,z.current=null,D({docName:t,tabId:e}),k(n[n.length-1]),j(null)},e[25]=me):me=e[25];let he=me,ge=function(){R.current=!0,z.current=null,D(null),k(``),j(null),N(!1)},_e=async function(){if(R.current){R.current=!1;return}if(L.current)return;let e=E?.docName;if(!e){ge();return}let t=MR(`file`,$R(O,S.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ge();return}if(t===z.current){I.current?.focus();return}if(!NR(t)){j(x({id:`P8yDjG`})),I.current?.focus();return}let i=PR({kind:`file`,path:e,name:r},t);L.current=!0,N(!0),j(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(R.current){N(!1),L.current=!1;return}let r=await pe(n,`Server error (HTTP ${n.status})`);if(!r.ok){j(r.title),N(!1),L.current=!1,z.current=t,I.current?.focus();return}let a=ee(Oi,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=B.current,s=zR(o,a),c=!0;try{await _({renamed:a}),Sd([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),Mu.error(x({id:`MUBR8r`}))}R.current=!0,D(null),k(``),j(null),N(!1),L.current=!1,z.current=null,c&&s&&s!==o&&QR(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),j(x({id:`HIb0vl`})),N(!1),L.current=!1,z.current=t,I.current?.focus()}},ve=typeof window<`u`&&window.okDesktop!=null,ye;e[26]===d?ye=e[27]:(ye=new Set(d),e[26]=d,e[27]=ye);let be=ye,xe;e[28]===w?xe=e[29]:(xe=tl(w),e[28]=w,e[29]=xe);let Se;e[30]===xe?Se=e[31]:(Se=[xe],e[30]=xe,e[31]=Se);let Ce=Se,we;e[32]!==s||e[33]!==l||e[34]!==be?(we=function(e){let t=[],n=[];for(let r of e)be.has(r)?n.push(r):t.push(r);t.length>0&&l(t);for(let e of n)s(e)},e[32]=s,e[33]=l,e[34]=be,e[35]=we):we=e[35];let Te=we,Ee,De;e[36]!==o||e[37]!==a||e[38]!==r||e[39]!==G||e[40]!==u||e[41]!==d||e[42]!==f||e[43]!==g||e[44]!==b?(Ee=()=>{let e=new Set(d),t=function(){V.current!==null&&(window.clearTimeout(V.current),V.current=null)},n=function(e){H.current!==e&&(H.current=e)},i=function(e){W.current!==e&&(W.current=e,F(e))},s=function(){n(!0),!(W.current||V.current!==null)&&(V.current=window.setTimeout(()=>{V.current=null,H.current&&i(!0)},tz))},c=function(){t(),n(!1),i(!1)},l=function(t){e.has(t)?o(t):a(t)},p=function(e){if(b.length===0)return;let t=u?r:G,n=t?b.indexOf(t):-1;l(b[((n>=0?n:0)+e+b.length)%b.length])},m=function(e){if(!ez(e)||Af())return;if(s(),Zu(e,`tab-new`)){e.preventDefault(),f();return}if(Zu(e,`tab-reopen-closed`)){e.preventDefault(),g();return}if(Zu(e,`tab-next`)){e.preventDefault(),p(1);return}if(Zu(e,`tab-previous`)){e.preventDefault(),p(-1);return}let t=az(e,b.length);t!==null&&(e.preventDefault(),l(b[t]))},h=function(e){!e.metaKey&&!e.ctrlKey&&c()};return window.addEventListener(`keydown`,m,{capture:!0}),window.addEventListener(`keyup`,h,{capture:!0}),window.addEventListener(`blur`,c),document.addEventListener(`visibilitychange`,c),()=>{window.removeEventListener(`keydown`,m,{capture:!0}),window.removeEventListener(`keyup`,h,{capture:!0}),window.removeEventListener(`blur`,c),document.removeEventListener(`visibilitychange`,c)}},De=[r,G,o,a,u,d,f,g,b],e[36]=o,e[37]=a,e[38]=r,e[39]=G,e[40]=u,e[41]=d,e[42]=f,e[43]=g,e[44]=b,e[45]=Ee,e[46]=De):(Ee=e[45],De=e[46]),(0,Q.useEffect)(Ee,De);let ke;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(ke={activationConstraint:{distance:8}},e[47]=ke):ke=e[47];let Ae;e[48]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={coordinateGetter:Xp,keyboardCodes:Qc},e[48]=Ae):Ae=e[48];let je=$p(Yp(rm,ke),Yp(Zp,Ae)),Me=P,Ne;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=function(){T($c(C.current,`[data-editor-tab-sortable]`))},e[49]=Ne):Ne=e[49];let Pe=Ne,Fe;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=function(){T(null)},e[50]=Fe):Fe=e[50];let Ie=Fe,Le;e[51]!==Ie||e[52]!==v||e[53]!==b?(Le=function(e){Ie();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=b.indexOf(t),i=b.indexOf(n);r<0||i<0||r===i||v(Qp([...b],r,i),t)},e[51]=Ie,e[52]=v,e[53]=b,e[54]=Le):Le=e[54];let Re=Le,ze=ve?``:void 0,Be;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(Be=Y(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,ve&&`[-webkit-app-region:drag]`),e[55]=Be):Be=e[55];let Ve=Bc,He;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(He=Y(`flex items-end gap-1`,ve&&`[-webkit-app-region:no-drag]`),e[56]=He):He=e[56];let Ue=tm,We=Xc,Ge;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ge={container:typeof document<`u`?document.body:void 0},e[57]=Ge):Ge=e[57];let Ke=nm,qe;e[58]===b?qe=e[59]:(qe=[...b],e[58]=b,e[59]=qe);let Je=em,Ye=b.map((e,t)=>{let n=P?rz(t,b.length):null,i=iz(t,b.length);if(be.has(e)){let t=e===r;return(0,Z.jsx)(cz,{tabId:e,canPin:!1,openTabs:b,closeTab:s,closeTabs:Te,pinTab:m,pinnedTabIds:h,unpinTab:y,children:(0,Z.jsxs)(sz,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":t?`true`:void 0,className:Y(qR,t?JR:YR),onAuxClick:t=>{t.button===1&&(t.preventDefault(),s(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":x({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:XR,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(J,{id:`3YvS-c`})})}),n?(0,Z.jsx)(oz,{value:n}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":x({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:Uc(Me||t),tabIndex:Wc(t),onClick:t=>{t.stopPropagation(),s(e)},children:(0,Z.jsx)(ju,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let l=U(e),u=e===G,d=h.includes(e);if(l.kind===`folder`){let{baseName:t,label:r,prefix:o}=pt(l.folderPath,`/`),s=`${o}${r}`;return(0,Z.jsx)(cz,{tabId:e,openTabs:b,closeTab:c,closeTabs:Te,pinTab:m,pinnedTabIds:h,unpinTab:y,children:(0,Z.jsxs)(sz,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:Y(qR,u?JR:YR),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&c(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":s,title:s,className:XR,onClick:()=>{a(e)},tabIndex:-1,children:[o&&(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate`,u&&`text-muted-foreground`),children:o}),(0,Z.jsxs)(`span`,{className:Y(`flex min-w-0 items-center`,o?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(lz,{accessibleLabel:s,closeTab:c,forceCloseVisible:Me,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:y})]})},e)}if(l.kind===`asset`||l.kind===`skill-file`){let{baseName:t,label:r,prefix:o}=pt(l.kind===`asset`?l.assetPath:l.path,``),s=`${o}${r}`;return(0,Z.jsx)(cz,{tabId:e,openTabs:b,closeTab:c,closeTabs:Te,pinTab:m,pinnedTabIds:h,unpinTab:y,children:(0,Z.jsxs)(sz,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:Y(qR,u?JR:YR),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&c(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":s,className:XR,onClick:()=>{a(e)},tabIndex:-1,children:[o?(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate text-muted-foreground/60`,u&&`text-muted-foreground`),children:o}):null,(0,Z.jsx)(`span`,{className:Y(`min-w-0 truncate`,o?`max-w-[70%] shrink-0`:`flex-1`),children:t})]}),(0,Z.jsx)(lz,{accessibleLabel:s,closeTab:c,forceCloseVisible:Me,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:y})]})},e)}let f=l.docName,p=S.get(f)?.docExt??`.md`,{baseName:g,extension:_,label:v,prefix:C}=pt(f,p),w=`${C}${v}`,T=p===`.md`||p===`.mdx`,D=E?.tabId===e,N=`editor-tab-rename-error-${ZR(f)}`;return(0,Z.jsx)(cz,{disabled:D,tabId:e,openTabs:b,closeTab:c,closeTabs:Te,pinTab:m,pinnedTabIds:h,unpinTab:y,children:(0,Z.jsx)(sz,{tabId:e,activateFromKeyboard:()=>a(e),disabled:D,"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:Y(qR,u?JR:YR,D&&A&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&c(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:D?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Kc,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(zc,{ref:I,value:O,disabled:M,"aria-label":x({id:`Dw1T_W`,values:{label:v}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":A?!0:void 0,"aria-describedby":A?N:void 0,"aria-busy":M||void 0,title:A??f,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{k($R(e.target.value,p)),j(null),z.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),_e()):e.key===`Escape`&&(e.preventDefault(),ge())},onBlur:_e}),(0,Z.jsx)(Gc,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(il,{className:`text-muted-foreground/60 text-xs`,children:p})})]}),A?(0,Z.jsx)(`span`,{id:N,role:`alert`,className:`sr-only`,children:A}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(dz,{accessibleLabel:w,activateTab:a,baseName:g,docName:f,enterRenameMode:he,extension:_,hideDocExtension:T,tabId:e}),(0,Z.jsx)(lz,{accessibleLabel:w,closeTab:c,forceCloseVisible:Me,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:y})]})})},e)}),Xe;e[60]!==Ke||e[61]!==qe||e[62]!==Je||e[63]!==Ye?(Xe=(0,Z.jsx)(Ke,{items:qe,strategy:Je,children:Ye}),e[60]=Ke,e[61]=qe,e[62]=Je,e[63]=Ye,e[64]=Xe):Xe=e[64];let Ze;e[65]!==Ue||e[66]!==Ie||e[67]!==Re||e[68]!==Pe||e[69]!==je||e[70]!==!1||e[71]!==We||e[72]!==Ge||e[73]!==Xe||e[74]!==Ce?(Ze=(0,Z.jsx)(Ue,{sensors:je,autoScroll:!1,collisionDetection:We,modifiers:Ce,onDragStart:Pe,onDragEnd:Re,onDragCancel:Ie,accessibility:Ge,children:Xe}),e[65]=Ue,e[66]=Ie,e[67]=Re,e[68]=Pe,e[69]=je,e[70]=!1,e[71]=We,e[72]=Ge,e[73]=Xe,e[74]=Ce,e[75]=Ze):Ze=e[75];let Qe;e[76]===x?Qe=e[77]:(Qe=x({id:`3YvS-c`}),e[76]=x,e[77]=Qe);let $e;e[78]===Symbol.for(`react.memo_cache_sentinel`)?($e=(0,Z.jsx)(tn,{"aria-hidden":`true`}),e[78]=$e):$e=e[78];let et;e[79]!==f||e[80]!==Qe?(et=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Qe,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:f,children:$e})}),e[79]=f,e[80]=Qe,e[81]=et):et=e[81];let tt;e[82]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,Z.jsx)(vn,{children:(0,Z.jsx)(J,{id:`3YvS-c`})}),e[82]=tt):tt=e[82];let nt;e[83]===et?nt=e[84]:(nt=(0,Z.jsxs)(bn,{children:[et,tt]}),e[83]=et,e[84]=nt);let rt;e[85]!==He||e[86]!==Ze||e[87]!==nt?(rt=(0,Z.jsxs)(`div`,{className:He,children:[Ze,nt]}),e[85]=He,e[86]=Ze,e[87]=nt,e[88]=rt):rt=e[88];let it;return e[89]!==ze||e[90]!==Be||e[91]!==Ve||e[92]!==rt?(it=(0,Z.jsx)(`div`,{ref:C,"data-electron-drag":ze,className:Be,onWheel:Ve,children:rt}),e[89]=ze,e[90]=Be,e[91]=Ve,e[92]=rt,e[93]=it):it=e[93],it}var pz=(e,t,n)=>{if(e&&`reportValidity`in e){let r=Zm(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},mz=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?pz(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>pz(t,n,e))}},hz=(e,t)=>{t.shouldUseNativeValidation&&mz(e,t);let n={};for(let r in e){let i=Zm(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(gz(t.names||Object.keys(e),r)){let e=Object.assign({},Zm(n,r));Hm(e,`root`,a),Hm(n,r,e)}else Hm(n,r,a)}return n},gz=(e,t)=>{let n=_z(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>_z(e).match(`^${n}\\.\\d+`))};function _z(e){return e.replace(/[\[\]]/g,``)}function vz(){return vz=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vz.apply(null,arguments)}function yz(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function bz(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=Gm(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function xz(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(vz({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=Gm(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function Sz(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve(yz(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&mz({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:hz(bz(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(yz(function(){return Promise.resolve((n.mode===`sync`?ma:go)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&mz({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof xo}(e))return{values:{},errors:hz(xz(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var Cz=`https://openknowledge.ai/api/subscribe`;async function wz(e,t){try{let n=await fetch(Cz,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function Tz(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=Dt(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g,_;if(t[3]!==u){let e=ja({email:$a({message:u({id:`Wq6Wcm`})})});_=Um,g=Sz(e),t[3]=u,t[4]=g,t[5]=_}else g=t[4],_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v={email:``},t[6]=v):v=t[6];let y;t[7]===g?y=t[8]:(y={resolver:g,defaultValues:v},t[7]=g,t[8]=y);let b=_(y),{isSubmitting:x}=b.formState,S=b.formState.errors.email?.message??b.formState.errors.root?.message,C;t[9]!==u||t[10]!==b||t[11]!==a||t[12]!==n?(C=async function(e){b.clearErrors(`root`);let t=await wz(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){b.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){b.setError(`root`,{message:u({id:`4mLBx9`})});return}b.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=b,t[11]=a,t[12]=n,t[13]=C):C=t[13];let w=C,T;t[14]===l?T=t[15]:(T=Y(`flex flex-col gap-3`,l),t[14]=l,t[15]=T);let E=d?-1:void 0,D;t[16]!==d||t[17]!==r?(D=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Zo,{className:`size-4 text-primary`}),(0,Z.jsx)(J,{id:`PIMM5l`})]}):r??(0,Z.jsx)(J,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=D):D=t[18];let O;t[19]!==D||t[20]!==E?(O=(0,Z.jsx)(`p`,{ref:p,tabIndex:E,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:D}),t[19]=D,t[20]=E,t[21]=O):O=t[21];let k;t[22]!==i||t[23]!==d?(k=d?(0,Z.jsx)(J,{id:`pBROkv`}):i??(0,Z.jsx)(J,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=k):k=t[24];let A;t[25]===k?A=t[26]:(A=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:k}),t[25]=k,t[26]=A);let j;t[27]!==O||t[28]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[O,A]}),t[27]=O,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==u||t[31]!==o?(M=o?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(ju,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=M):M=t[32];let N;t[33]!==j||t[34]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[j,M]}),t[33]=j,t[34]=M,t[35]=N):N=t[35];let P;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==S||t[40]!==b||t[41]!==x||t[42]!==w||t[43]!==d?(P=d?null:(0,Z.jsxs)(`form`,{onSubmit:b.handleSubmit(w),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(Vm,{control:b.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(Kc,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(Gc,{className:`pl-2.5`,children:(0,Z.jsx)(N_,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(zc,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(X,{type:`submit`,disabled:x,size:c?`icon`:`default`,className:Y(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ll,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Jn,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`EDl9kS`})})]}):(0,Z.jsx)(J,{id:`EDl9kS`})})]})}}),S?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:S}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=S,t[40]=b,t[41]=x,t[42]=w,t[43]=d,t[44]=P):P=t[44];let F;return t[45]!==N||t[46]!==P||t[47]!==T?(F=(0,Z.jsxs)(`div`,{className:T,children:[N,P]}),t[45]=N,t[46]=P,t[47]=T,t[48]=F):F=t[48],F}var Ez=`ok-feedback-nudge-v1`,Dz={firstSeenAt:null,shownAt:null,dismissed:!1};function Oz(e){let t=0;for(let n of e)cd(n)||t++;return t}function kz(e,t,n){return!e.dismissed&&e.shownAt==null&&e.firstSeenAt!=null&&t-e.firstSeenAt>=12096e5&&n>=10}function Az(e){return e===!0}function jz(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}function Mz(e){if(typeof e!=`object`||!e)return Dz;let t=e;return{firstSeenAt:jz(t.firstSeenAt),shownAt:jz(t.shownAt),dismissed:Az(t.dismissed)}}function Nz(e){try{let t=(e??localStorage).getItem(Ez);return t==null?Dz:Mz(JSON.parse(t))}catch(e){return console.warn(`[feedback-nudge-store] readPersistedState failed (corrupt/privacy/SSR)`,e),Dz}}function Pz(e,t){try{(t??localStorage).setItem(Ez,JSON.stringify(e))}catch(e){console.warn(`[feedback-nudge-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function Fz(e){let t=Nz(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,Pz(t,e),i()}function o(){t=Nz(e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},recordFirstSeen(e){t.firstSeenAt??a({...t,firstSeenAt:e})},recordShown(e){t.shownAt??a({...t,shownAt:e})},dismiss(){t.dismissed||a({...t,dismissed:!0})},syncFromStorage:o,install(){r||(r=!0,o())}}}var Iz=Fz();typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`storage`,e=>{(e.key===`ok-feedback-nudge-v1`||e.key===null)&&Iz.syncFromStorage()});function Lz(){Iz.install()}var Rz=`https://github.com/inkeep/open-knowledge`,zz=`https://discord.gg/VRKk2EaGHN`,Bz=`https://x.com/OpenKnowledge`,Vz=`ok-subscribe-card-v1`,Hz={subscribed:!1,dismissed:!1,shownVersions:[]};function Uz(e,t){return!e.subscribed&&!e.dismissed&&e.shownVersions.length<3&&!e.shownVersions.includes(t)}function Wz(e){return e===!0}function Gz(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Kz(e){if(typeof e!=`object`||!e)return Hz;let t=e;return{subscribed:Wz(t.subscribed),dismissed:Wz(t.dismissed),shownVersions:Gz(t.shownVersions)}}function qz(e){try{let t=(e??localStorage).getItem(Vz);return t==null?Hz:Kz(JSON.parse(t))}catch(e){return console.warn(`[subscribe-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),Hz}}function Jz(e,t){try{(t??localStorage).setItem(Vz,JSON.stringify(e))}catch(e){console.warn(`[subscribe-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function Yz(e){let t=qz(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,Jz(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},markSubscribed(){t.subscribed||a({...t,subscribed:!0})},dismiss(){t.dismissed||a({...t,dismissed:!0})},recordShown(e){t.shownVersions.includes(e)||a({...t,shownVersions:[...t.shownVersions,e]})},install(){r||(r=!0,t=qz(e),i())}}}var Xz=Yz();function Zz(){Xz.install()}function Qz(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Discord`}),r=(0,Z.jsx)(`path`,{d:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9554 2.4189-2.1568 2.4189Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function $z(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Z.jsx)(`path`,{d:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var eB=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:M}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:zz,icon:Qz},{label:`X (Twitter)`,href:Bz,icon:$z},{label:`GitHub`,href:Rz,icon:jv}]}],tB=`${Rz}/releases`,nB=`group flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`;function rB(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var iB=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=Dt(),i,a,o,s;t[0]!==r||t[1]!==n?(i=rB(n),a=`img`,o=`ml-auto flex items-center gap-1 text-xs tabular-nums text-muted-foreground`,s=r({id:`SVLPt5`,values:{formatted:i}}),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s):(i=t[2],a=t[3],o=t[4],s=t[5]);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)($_,{className:`size-3 fill-current`,"aria-hidden":`true`}),t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==a||t[9]!==o||t[10]!==s?(l=(0,Z.jsxs)(`span`,{role:a,className:o,"aria-label":s,children:[c,i]}),t[7]=i,t[8]=a,t[9]=o,t[10]=s,t[11]=l):l=t[11],l},aB=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=Dt(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>Ef(e,o),l=e=>Ef(e,o),t[0]=o,t[1]=c,t[2]=l);let u;t[3]===s?u=t[4]:(u=(0,Z.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[3]=s,t[4]=u);let d;t[5]!==i||t[6]!==a?(d=typeof a==`string`?a:i(a),t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==r?(f=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:c,onAuxClick:l,className:nB,children:[u,d,r]})}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=r,t[14]=f):f=t[14],f},oB=e=>{let t=(0,$.c)(7),{icon:n,onSelect:r,children:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Y(nB,`h-auto w-full justify-start font-normal`),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,Z.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[1]=n,t[2]=o);let s;return t[3]!==i||t[4]!==r||t[5]!==o?(s=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(X,{variant:`ghost`,className:a,onClick:r,children:[o,i]})}),t[3]=i,t[4]=r,t[5]=o,t[6]=s):s=t[6],s},sB=e=>{let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:n}),t[0]=n,t[1]=r),r},cB=()=>{let e=(0,$.c)(36),{_:t}=Dt(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=typeof window<`u`&&window.okDesktop!=null,p,m;e[0]!==n||e[1]!==u?(p=()=>{if(!n||u!==null)return;let e=new AbortController;return Pa({signal:e.signal}).then(e=>{e!==null&&d(e)}),()=>e.abort()},m=[n,u],e[0]=n,e[1]=u,e[2]=p,e[3]=m):(p=e[2],m=e[3]),(0,Q.useEffect)(p,m);let h;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>{r(e),e||a(!1)},e[4]=h):h=e[4];let g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(b,{className:`size-4`}),e[5]=g):g=e[5];let _;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)($t,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[g,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`s-MGs7`})})]})})}),e[6]=_):_=e[6];let v;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsxs)(bn,{children:[_,(0,Z.jsx)(vn,{children:(0,Z.jsx)(J,{id:`s-MGs7`})})]}),e[7]=v):v=e[7];let y;e[8]!==t||e[9]!==u?(y=eB.map((e,n)=>(0,Z.jsxs)(`div`,{className:Y(n>0&&`mt-3`),children:[(0,Z.jsx)(sB,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[e.links.map(e=>(0,Z.jsx)(aB,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&u!==null?(0,Z.jsx)(iB,{count:u}):void 0},e.href)),e.key===`resources`&&(0,Z.jsxs)(Z.Fragment,{children:[f&&(0,Z.jsx)(oB,{icon:E,onSelect:()=>{r(!1),s(!0)},children:(0,Z.jsx)(J,{id:`cd5EXh`})}),(0,Z.jsx)(oB,{icon:Bl,onSelect:()=>{r(!1),l(!0)},children:(0,Z.jsx)(J,{id:`RoafuO`})})]})]})})]},e.key)),e[8]=t,e[9]=u,e[10]=y):y=e[10];let x;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(sB,{children:(0,Z.jsx)(J,{id:`arUUsK`})}),e[11]=x):x=e[11];let S;e[12]===t?S=e[13]:(S=t({id:`arUUsK`}),e[12]=t,e[13]=S);let C;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(aB,{link:{label:{id:`3ePd3I`},href:tB,icon:P_}}),e[14]=C):C=e[14];let w;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)($t,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,className:Y(nB,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(N_,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(J,{id:`EDl9kS`})]})}),e[15]=w):w=e[15];let T;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(an,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(Tz,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:lB})}),e[16]=T):T=e[16];let D;e[17]===i?D=e[18]:(D=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[C,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Qt,{open:i,onOpenChange:a,children:[w,T]})})]}),e[17]=i,e[18]=D);let O;e[19]!==D||e[20]!==S?(O=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[x,(0,Z.jsx)(`nav`,{"aria-label":S,children:D})]}),e[19]=D,e[20]=S,e[21]=O):O=e[21];let k;e[22]!==O||e[23]!==y?(k=(0,Z.jsxs)(an,{align:`end`,className:`w-56 p-3`,children:[y,O]}),e[22]=O,e[23]=y,e[24]=k):k=e[24];let A;e[25]!==n||e[26]!==k?(A=(0,Z.jsxs)(Qt,{open:n,onOpenChange:h,children:[v,k]}),e[25]=n,e[26]=k,e[27]=A):A=e[27];let j;e[28]===o?j=e[29]:(j=f&&(0,Z.jsx)(Hh,{open:o,onOpenChange:s}),e[28]=o,e[29]=j);let M;e[30]===c?M=e[31]:(M=(0,Z.jsx)(Sy,{open:c,onOpenChange:l,onSuccess:uB}),e[30]=c,e[31]=M);let N;return e[32]!==A||e[33]!==j||e[34]!==M?(N=(0,Z.jsxs)(Z.Fragment,{children:[A,j,M]}),e[32]=A,e[33]=j,e[34]=M,e[35]=N):N=e[35],N};function lB(){return Xz.markSubscribed()}function uB(){return Iz.dismiss()}function dB(e){let t=(0,$.c)(14),{className:n}=e,{_:r}=Dt(),i=typeof window<`u`?window.okDesktop?.instanceLabel??null:null;if(!i)return null;let a;t[0]===r?a=t[1]:(a=r({id:`iRdfLr`,values:{label:i}}),t[0]=r,t[1]=a);let o,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(To,{"aria-hidden":`true`}),s=(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:i}),t[2]=o,t[3]=s):(o=t[2],s=t[3]);let c;t[4]!==n||t[5]!==a?(c=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsxs)(Ud,{variant:`secondary`,"aria-label":a,"data-testid":`instance-badge`,className:n,children:[o,s]})}),t[4]=n,t[5]=a,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=r({id:`c5PTFE`,values:{label:i}}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(vn,{children:l}),t[9]=l,t[10]=u);let d;return t[11]!==c||t[12]!==u?(d=(0,Z.jsxs)(bn,{children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13],d}var fB=1,pB=2,mB=fB|pB;function hB(){if(!(typeof window>`u`))return window.navigation}function gB(){let e=hB();return e?(e.canGoBack?fB:0)|(e.canGoForward?pB:0):mB}function _B(e){let t=hB();return t?(t.addEventListener(`currententrychange`,e),()=>t.removeEventListener(`currententrychange`,e)):()=>{}}function vB(){let e=(0,$.c)(42),{_:t}=Dt(),n=(0,Q.useSyncExternalStore)(_B,gB,xB),r=(n&fB)!==0,i=(n&pB)!==0,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Hu(`navigate-back`),e[0]=a):a=e[0];let o=a,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=Uu(`navigate-back`),e[1]=s):s=e[1];let c=s,l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=Hu(`navigate-forward`),e[2]=l):l=e[2];let u=l,d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=Uu(`navigate-forward`),e[3]=d):d=e[3];let f=d,p;e[4]===t?p=e[5]:(p=t({id:`kBNHN1`}),e[4]=t,e[5]=p);let m;e[6]===t?m=e[7]:(m=t({id:`iH8pgl`}),e[6]=t,e[7]=m);let h=!r,g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Zn,{"aria-hidden":`true`}),e[8]=g):g=e[8];let _;e[9]!==m||e[10]!==h?(_=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{"aria-label":m,disabled:h,onClick:bB,size:`icon-sm`,variant:`ghost`,children:g})}),e[9]=m,e[10]=h,e[11]=_):_=e[11];let v;e[12]===t?v=e[13]:(v=t({id:`iH8pgl`}),e[12]=t,e[13]=v);let y;e[14]===v?y=e[15]:(y=(0,Z.jsx)(`span`,{children:v}),e[14]=v,e[15]=y);let b;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(le,{"aria-label":c,children:o}),e[16]=b):b=e[16];let x;e[17]===y?x=e[18]:(x=(0,Z.jsxs)(vn,{children:[y,` `,b]}),e[17]=y,e[18]=x);let S;e[19]!==x||e[20]!==_?(S=(0,Z.jsxs)(bn,{children:[_,x]}),e[19]=x,e[20]=_,e[21]=S):S=e[21];let C;e[22]===t?C=e[23]:(C=t({id:`rxWGWX`}),e[22]=t,e[23]=C);let w=!i,T;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Jn,{"aria-hidden":`true`}),e[24]=T):T=e[24];let E;e[25]!==C||e[26]!==w?(E=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{"aria-label":C,disabled:w,onClick:yB,size:`icon-sm`,variant:`ghost`,children:T})}),e[25]=C,e[26]=w,e[27]=E):E=e[27];let D;e[28]===t?D=e[29]:(D=t({id:`rxWGWX`}),e[28]=t,e[29]=D);let O;e[30]===D?O=e[31]:(O=(0,Z.jsx)(`span`,{children:D}),e[30]=D,e[31]=O);let k;e[32]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(le,{"aria-label":f,children:u}),e[32]=k):k=e[32];let A;e[33]===O?A=e[34]:(A=(0,Z.jsxs)(vn,{children:[O,` `,k]}),e[33]=O,e[34]=A);let j;e[35]!==E||e[36]!==A?(j=(0,Z.jsxs)(bn,{children:[E,A]}),e[35]=E,e[36]=A,e[37]=j):j=e[37];let M;return e[38]!==S||e[39]!==j||e[40]!==p?(M=(0,Z.jsxs)(yp,{"aria-label":p,className:`shrink-0 [-webkit-app-region:no-drag]`,"data-testid":`navigation-history-controls`,children:[S,j]}),e[38]=S,e[39]=j,e[40]=p,e[41]=M):M=e[41],M}function yB(){return rn(`navigate-forward`)}function bB(){return rn(`navigate-back`)}function xB(){return mB}var SB=50,CB=()=>{let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t.current===null&&(t.current=setTimeout(()=>{t.current=null,bD.preload()},SB))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},s=[],e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,Q.useEffect)(o,s);let c,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Xu)},l=(0,Z.jsx)(K_,{className:`size-4`}),e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(bn,{children:[u,(0,Z.jsx)(vn,{children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},wB=`https://openknowledge.ai/docs/features/share`,TB={mac:`⌘ C`,windowsLinux:`Ctrl C`};function EB(e){let t=(0,$.c)(52),{input:n,onClickWhenNoRemote:r}=e,{_:i}=Dt(),{status:a}=Oo(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h=Tc(c?.freshness,a),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=qu(TB),t[4]=g):g=t[4];let _=g,v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=Gu(TB),t[5]=v):v=t[5];let y=v,x;t[6]!==i||t[7]!==o||t[8]!==p||t[9]!==n||t[10]!==r?(x=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await As({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:qp,toastSuccess:PB,toastError:NB,logEvent:MB});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1,freshness:e.freshness}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0,freshness:e.freshness})}catch{Mu.error(i({id:`u3YnKw`}))}s(!1)}},t[6]=i,t[7]=o,t[8]=p,t[9]=n,t[10]=r,t[11]=x):x=t[11];let S=x,C=c!==null,w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e||l(null)},t[12]=w):w=t[12];let T;t[13]!==i||t[14]!==n?.kind?(T=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[13]=i,t[14]=n?.kind,t[15]=T):T=t[15];let E=o||m,D,O;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(q_,{className:`size-3.5`,"aria-hidden":!0}),O=(0,Z.jsx)(J,{id:`Z8lGw6`}),t[16]=D,t[17]=O):(D=t[16],O=t[17]);let k;t[18]!==S||t[19]!==T||t[20]!==E?(k=(0,Z.jsx)(nn,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":T,onClick:S,disabled:E,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[D,O]})}),t[18]=S,t[19]=T,t[20]=E,t[21]=k):k=t[21];let A=h?`w-96`:`w-80`,j;t[22]===A?j=t[23]:(j=Y(`flex flex-col gap-2`,A),t[22]=A,t[23]=j);let M;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`Z8lGw6`})}),t[24]=M):M=t[24];let N;t[25]===c?.autoCopyFailed?N=t[26]:(N=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`vj-33a`,values:{copyShortcut:_},components:{0:(0,Z.jsx)(le,{"aria-label":y})}})}):null,t[25]=c?.autoCopyFailed,t[26]=N);let P=c?.url??``,F;t[27]===i?F=t[28]:(F=i({id:`5-FeN2`}),t[27]=i,t[28]=F);let I;t[29]!==P||t[30]!==F?(I=(0,Z.jsx)(Ru,{ref:u,readOnly:!0,value:P,onFocus:jB,onClick:AB,onContextMenu:kB,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":F}),t[29]=P,t[30]=F,t[31]=I):I=t[31];let L=c?.url??``,R=c?.autoCopyFailed===!1,z;t[32]!==L||t[33]!==R?(z=(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-1 flex items-center`,children:(0,Z.jsx)(`div`,{className:`rounded-md bg-background/50 backdrop-blur-sm`,children:(0,Z.jsx)(ts,{copyContent:L,clipboardWrite:qp,initialCopied:R})})}),t[32]=L,t[33]=R,t[34]=z):z=t[34];let B;t[35]!==I||t[36]!==z?(B=(0,Z.jsxs)(`div`,{className:`relative`,children:[I,z]}),t[35]=I,t[36]=z,t[37]=B):B=t[37];let V=c?.freshness,H=n?.kind??`doc`,U;t[38]!==a||t[39]!==V||t[40]!==H?(U=(0,Z.jsx)(Cc,{freshness:V,status:a,kind:H}),t[38]=a,t[39]=V,t[40]=H,t[41]=U):U=t[41];let ee;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsxs)(`a`,{href:wB,target:`_blank`,rel:`noopener noreferrer`,onClick:OB,onAuxClick:DB,className:`mt-2 flex items-center gap-1.5 self-start text-xs text-muted-foreground transition-colors hover:text-primary`,children:[(0,Z.jsx)(b,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`aByJ8j`})]}),t[42]=ee):ee=t[42];let W;t[43]!==j||t[44]!==N||t[45]!==B||t[46]!==U?(W=(0,Z.jsxs)(an,{align:`end`,className:j,"data-testid":`share-button-popover`,children:[M,N,B,U,ee]}),t[43]=j,t[44]=N,t[45]=B,t[46]=U,t[47]=W):W=t[47];let te;return t[48]!==k||t[49]!==W||t[50]!==C?(te=(0,Z.jsxs)(Qt,{open:C,onOpenChange:w,children:[k,W]}),t[48]=k,t[49]=W,t[50]=C,t[51]=te):te=t[51],te}function DB(e){return Ef(e,wB)}function OB(e){return Ef(e,wB)}function kB(e){return e.currentTarget.select()}function AB(e){return e.currentTarget.select()}function jB(e){return e.currentTarget.select()}function MB(e){return console.log(e)}function NB(e){e!==`Link ready but could not copy to clipboard.`&&Mu.error(e)}function PB(e){return Mu.success(e)}var FB=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-DHWqgWXl.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([164,1,10,11,12,14,15,16,17,49,114,30,31,19,24,25,50,20,93,22]),import.meta.url));function IB(e){let t=(0,$.c)(40),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=Dt(),{activeDocName:o,activeTarget:s}=ot(),c=o?ua(o):null,{state:l,isDraggingRail:u}=TI(),d=Sb(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=Hu(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=Uu(`toggle-files-sidebar`),t[1]=m):m=t[1];let h=m,g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=Hu(`command-palette`),t[2]=g):g=t[2];let _=g,v=Uu(`command-palette`),[y,b]=(0,Q.useState)(!1),x;bb0:{if(s?.kind===`folder`){let e;t[3]===s.folderPath?e=t[4]:(e=Us(s.folderPath),t[3]=s.folderPath,t[4]=e),x=e;break bb0}if(o&&!c){let e;t[5]===o?e=t[6]:(e=ic(o),t[5]=o,t[6]=e),x=e;break bb0}if(!s&&!o){let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=Us(``),t[7]=e):e=t[7],x=e;break bb0}x=null}let S=x,C=typeof window<`u`&&window.okDesktop!=null,w=l===`collapsed`,T=C?``:void 0,E=C&&w&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,D=C&&!u&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,O;t[8]!==E||t[9]!==D?(O=Y(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,C&&`[-webkit-app-region:drag]`,E,D),t[8]=E,t[9]=D,t[10]=O):O=t[10];let k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=YL()&&(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(FB,{})}),t[11]=k):k=t[11];let A=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(yp,{"aria-label":a({id:`V6AIOn`}),className:Y(`-ml-1 shrink-0 has-[>[data-slot=button-group]]:gap-0`,C&&`[-webkit-app-region:no-drag]`),children:[(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(AI,{className:Y(`shrink-0 text-muted-foreground`,C&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsxs)(vn,{children:[(0,Z.jsx)(`span`,{children:a(l===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`})}),` `,(0,Z.jsx)(le,{"aria-label":h,children:p})]})]}),w&&i&&(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`DbCfXV`,values:{searchShortcutLabel:v}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Y(`shrink-0 text-muted-foreground`,C&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(Ct,{"aria-hidden":`true`})})}),(0,Z.jsxs)(vn,{children:[(0,Z.jsx)(`span`,{children:a({id:`A1taO8`})}),` `,(0,Z.jsx)(le,{"aria-label":v,children:_})]})]}),C&&w&&(0,Z.jsx)(vB,{})]}),(0,Z.jsx)($r,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(fz,{})]}),j;t[12]!==k||t[13]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[k,A]}),t[12]=k,t[13]=A,t[14]=j):j=t[14];let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=Y(`flex shrink-0 items-center justify-end gap-2 px-3`,C&&`*:[-webkit-app-region:no-drag]`,C&&`mr-[var(--ok-titlebar-reserve-right,0px)]`),t[15]=M):M=t[15];let N;t[16]!==y||t[17]!==b||t[18]!==S||t[19]!==d?(N=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(EB,{input:S,onClickWhenNoRemote:()=>b(!0)}),(0,Z.jsx)(Hs,{open:y,onOpenChange:b})]}),t[16]=y,t[17]=b,t[18]=S,t[19]=d,t[20]=N):N=t[20];let P;t[21]!==r||t[22]!==n?(P=(0,Z.jsx)(rc,{onSignIn:n,onSetIdentity:r}),t[21]=r,t[22]=n,t[23]=P):P=t[23];let F,I,L,R;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(OR,{}),I=(0,Z.jsx)($r,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),L=(0,Z.jsx)(dB,{}),R=(0,Z.jsx)(jR,{}),t[24]=F,t[25]=I,t[26]=L,t[27]=R):(F=t[24],I=t[25],L=t[26],R=t[27]);let z;t[28]===d?z=t[29]:(z=!d&&(0,Z.jsx)(CB,{}),t[28]=d,t[29]=z);let B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(cB,{}),t[30]=B):B=t[30];let V;t[31]!==N||t[32]!==P||t[33]!==z?(V=(0,Z.jsxs)(`div`,{className:M,children:[N,P,F,I,L,R,z,B]}),t[31]=N,t[32]=P,t[33]=z,t[34]=V):V=t[34];let H;return t[35]!==j||t[36]!==V||t[37]!==T||t[38]!==O?(H=(0,Z.jsxs)(`header`,{"data-electron-drag":T,className:O,children:[j,V]}),t[35]=j,t[36]=V,t[37]=T,t[38]=O,t[39]=H):H=t[39],H}function LB(e,t){return Ji({relativePath:mc(e),instruction:``,selectionMarkdown:t,target:`claude-code`})}var RB=(0,Q.lazy)(()=>n(()=>import(`./AgentThreadClientBinder-u3ZVSSHE.js`).then(e=>({default:e.AgentThreadClientBinder})),__vite__mapDeps([165,1,22,12,166,47,100,17,102,6,2,3,7,8,9]),import.meta.url)),zB=(0,Q.lazy)(()=>n(()=>import(`./TerminalSessionsHost-Yz2cECTk.js`).then(e=>({default:e.TerminalSessionsHost})),__vite__mapDeps([167,1,2,112,17,12,6,3,7,8,9,47,10,11,14,15,16,49,113,114,30,31,19,24,25,50,20,93,22,90,29,51,26,119,106,36,168,122,68,107,39,41,42,33,99,38,27,100,138,85,86,87,88,139,166,169,123,71]),import.meta.url));function BB(e){let t=(0,$.c)(114),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=Px(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(fC[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,_=g!=null&&g.terminal!=null&&g.config.ptyAvailable===!0,[v,y]=(0,Q.useState)(!1),b=gp(),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(null),A=(0,Q.useRef)(0),[j,M]=(0,Q.useState)(Ux),N;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e){M(e),Hx(e),y(!0)},t[2]=N):N=t[2];let P=N,F;t[3]===j?F=t[4]:(F=function(){P(j===`right`?`bottom`:`right`)},t[3]=j,t[4]=F);let I=F,L;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(L={container:null,isShowing:!1,dockPosition:`bottom`,editorRegion:null},t[5]=L):L=t[5];let[R,z]=(0,Q.useState)(L),B=(0,Q.useRef)(0),V;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(){y(!0),el()},t[6]=V):V=t[6];let H=V,U;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(U=function(){y(!0)},t[7]=U):U=t[7];let ee=U,W=Do(),{projectConfig:te,projectLocalConfig:G,projectLocalSynced:ne,projectSynced:K}=wf(),{activeDocName:q,activeProvider:re}=ot(),ie=W?.hasRemote,ae=W?.pushPermission?.checkStatus,oe;t[8]!==m||t[9]!==te||t[10]!==G||t[11]!==ne||t[12]!==K||t[13]!==ie||t[14]!==ae?(oe=Kx({autoSyncOnboardingDismissed:m,hasRemote:ie,projectLocalSynced:ne,projectSynced:K,projectLocalConfig:G,projectConfig:te,pushPermissionCheckStatus:ae}),t[8]=m,t[9]=te,t[10]=G,t[11]=ne,t[12]=K,t[13]=ie,t[14]=ae,t[15]=oe):oe=t[15];let ce=oe,le,ue;t[16]===q?(le=t[17],ue=t[18]):(le=()=>{let e=function(e){let t=e.detail;t&&q&&Bf(q,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(Ex,e),()=>window.removeEventListener(Ex,e)},ue=[q],t[16]=q,t[17]=le,t[18]=ue),(0,Q.useEffect)(le,ue);let de;t[19]!==q||t[20]!==o?(de=function(e){if(!_||q==null)return!1;let t=hp(q,o)?.markdown??``;if(t.trim()===``)return!1;let n=`${LB(q,t)}\n\n`;return y(!0),on(n,{newTab:e,submit:!1}),!0},t[19]=q,t[20]=o,t[21]=de):de=t[21];let fe=(0,Q.useEffectEvent)(de),pe;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>H(),t[22]=pe):pe=t[22];let me=(0,Q.useEffectEvent)(pe),he;t[23]===fe?he=t[24]:(he=()=>en(e=>{if(e===`toggle-terminal`){if(fe(!1))return;y(UB)}else e===`new-terminal`&&y(!0)}),t[23]=fe,t[24]=he);let ge;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ge=[],t[25]=ge):ge=t[25],(0,Q.useEffect)(he,ge);let _e;t[26]===fe?_e=t[27]:(_e=()=>{if(window.okDesktop!=null)return;let e=function(e){Zu(e,`toggle-terminal-panel`)&&(Af()||(e.preventDefault(),!fe(!1)&&y(HB)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[26]=fe,t[27]=_e);let ve;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ve=[],t[28]=ve):ve=t[28],(0,Q.useEffect)(_e,ve);let ye;t[29]!==me||t[30]!==fe?(ye=()=>{if(!_)return;let e=function(e){Zu(e,`new-terminal-tab`)&&(Af()||(e.preventDefault(),fe(!0)||me()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[29]=me,t[30]=fe,t[31]=ye):ye=t[31];let be;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(be=[_],t[32]=be):be=t[32],(0,Q.useEffect)(ye,be);let xe,Se;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>Zc((e,t,n)=>{let{stage:r}=n;y(!0),B.current+=1,D({prompt:r?null:e,cli:t,nonce:B.current,stagePaste:r?e:void 0})}),Se=[],t[33]=xe,t[34]=Se):(xe=t[33],Se=t[34]),(0,Q.useEffect)(xe,Se);let Ce,we;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=()=>Es(e=>{y(!0),A.current+=1,k({agentSource:e.agentSource,agentId:e.agentId,prompt:e.prompt,docName:e.docName,titleHint:e.titleHint,nonce:A.current})}),we=[],t[35]=Ce,t[36]=we):(Ce=t[35],we=t[36]),(0,Q.useEffect)(Ce,we);let Te,Ee;t[37]===v?(Te=t[38],Ee=t[39]):(Te=()=>{v||D(null)},Ee=[v],t[37]=v,t[38]=Te,t[39]=Ee),(0,Q.useEffect)(Te,Ee);let De,Oe;t[40]!==C||t[41]!==v?(De=()=>{window.okDesktop!=null&&C&&(Jc({terminalVisible:v}),window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v}))},Oe=[v,C],t[40]=C,t[41]=v,t[42]=De,t[43]=Oe):(De=t[42],Oe=t[43]),(0,Q.useEffect)(De,Oe);let ke,Ae;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ke=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){w(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||!e.visible||(T.current=!0,y(!0))}).catch(VB).finally(()=>{t||w(!0)}),()=>{t=!0}},Ae=[],t[44]=ke,t[45]=Ae):(ke=t[44],Ae=t[45]),(0,Q.useEffect)(ke,Ae);let je,Me;t[46]===v?(je=t[47],Me=t[48]):(je=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&bi()}},Me=[v],t[46]=v,t[47]=je,t[48]=Me),(0,Q.useEffect)(je,Me),Fx(W?.pausedReason),Lx();let Ne;t[49]!==q||t[50]!==re||t[51]!==o||t[52]!==a?(Ne=function(e){q&&re&&o!==e&&Nf({from:o,to:e,docName:q,ytext:re.document.getText(`source`)}),s(e),a(e)},t[49]=q,t[50]=re,t[51]=o,t[52]=a,t[53]=Ne):Ne=t[53];let Pe=Ne,Fe;t[54]!==o||t[55]!==Pe?(Fe=()=>{Pe(o===`source`?`wysiwyg`:`source`)},t[54]=o,t[55]=Pe,t[56]=Fe):Fe=t[56];let Ie=(0,Q.useEffectEvent)(Fe),Le=o===`wysiwyg`&&!!q&&!!re,Re;t[57]!==q||t[58]!==re||t[59]!==Le?(Re=()=>{if(!Le||!q||!re)return;let e=se(q);e&&cp({editor:e,docName:q,ytext:re.document.getText(`source`)})},t[57]=q,t[58]=re,t[59]=Le,t[60]=Re):Re=t[60];let ze=(0,Q.useEffectEvent)(Re),Be,Ve;t[61]===Le?(Be=t[62],Ve=t[63]):(Be=()=>{window.okDesktop?.editor.notifyViewMenuStateChanged({canViewInSource:Le})},Ve=[Le],t[61]=Le,t[62]=Be,t[63]=Ve),(0,Q.useEffect)(Be,Ve);let He;t[64]!==ze||t[65]!==Ie?(He=()=>{let e=function(e){if(Zu(e,`toggle-editor-mode`)){if(Af())return;e.preventDefault(),Ie();return}if(Zu(e,`view-source-at-cursor`)){if(Af())return;e.preventDefault(),ze()}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[64]=ze,t[65]=Ie,t[66]=He):He=t[66];let Ue;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=[],t[67]=Ue):Ue=t[67],(0,Q.useEffect)(He,Ue);let We;t[68]===ze?We=t[69]:(We=()=>en(e=>{e===`toggle-source`&&ze()}),t[68]=ze,t[69]=We);let Ge;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=[],t[70]=Ge):Ge=t[70],(0,Q.useEffect)(We,Ge);let Ke,qe;t[71]===q?(Ke=t[72],qe=t[73]):(Ke=()=>{let e=function(e){e.detail?.docName===q&&s(`source`)};return window.addEventListener(Pf,e),()=>window.removeEventListener(Pf,e)},qe=[q],t[71]=q,t[72]=Ke,t[73]=qe),(0,Q.useEffect)(Ke,qe);let Je;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(RB,{})}),t[74]=Je):Je=t[74];let Ye,Xe;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=()=>{d(`auth`),l(!0)},Xe=()=>{d(`identity`),l(!0)},t[75]=Ye,t[76]=Xe):(Ye=t[75],Xe=t[76]);let Ze;t[77]===r?Ze=t[78]:(Ze=(0,Z.jsx)(IB,{onSignIn:Ye,onSetIdentity:Xe,onOpenSearch:r}),t[77]=r,t[78]=Ze);let Qe;t[79]!==f||t[80]!==o||t[81]!==Pe||t[82]!==x||t[83]!==j||t[84]!==v?(Qe=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Z.jsx)(VL,{editorMode:o,onModeChange:Pe,activeTab:f,onActiveTabChange:p,terminalBridge:_?g:null,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:j,terminalHasSessions:x,onTerminalPlacement:z,onRevealTerminal:ee})})}),t[79]=f,t[80]=o,t[81]=Pe,t[82]=x,t[83]=j,t[84]=v,t[85]=Qe):Qe=t[85];let $e;t[86]===R.editorRegion?$e=t[87]:($e=()=>R.editorRegion?.focus(),t[86]=R.editorRegion,t[87]=$e);let et;t[88]!==b||t[89]!==$e||t[90]!==j||t[91]!==E||t[92]!==R.container||t[93]!==R.isShowing||t[94]!==v||t[95]!==O||t[96]!==I?(et=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(zB,{bridge:_?g:null,visible:v,onVisibleChange:y,launch:E,threadLaunch:O,installedClis:b,container:R.container,isShowing:R.isShowing,onRequestEditorFocus:$e,dockPosition:j,onToggleDock:I,onHasSessionsChange:S})}),t[88]=b,t[89]=$e,t[90]=j,t[91]=E,t[92]=R.container,t[93]=R.isShowing,t[94]=v,t[95]=O,t[96]=I,t[97]=et):et=t[97];let tt=u===`identity`,nt;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(nt=()=>{l(!1)},t[98]=nt):nt=t[98];let rt;t[99]!==c||t[100]!==tt?(rt=(0,Z.jsx)(Ps,{open:c,onOpenChange:l,identityPrompt:tt,onSuccess:nt}),t[99]=c,t[100]=tt,t[101]=rt):rt=t[101];let it=ce!==null,at=ce??`full`,st;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(st=()=>h(!0),t[102]=st):st=t[102];let ct;t[103]!==it||t[104]!==at?(ct=(0,Z.jsx)(Wx,{open:it,variant:at,onResolved:st}),t[103]=it,t[104]=at,t[105]=ct):ct=t[105];let lt,ut;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,Z.jsx)(Cx,{}),ut=(0,Z.jsx)(xx,{}),t[106]=lt,t[107]=ut):(lt=t[106],ut=t[107]);let dt;return t[108]!==Ze||t[109]!==Qe||t[110]!==et||t[111]!==rt||t[112]!==ct?(dt=(0,Z.jsxs)(Z.Fragment,{children:[Je,Ze,Qe,et,rt,ct,lt,ut]}),t[108]=Ze,t[109]=Qe,t[110]=et,t[111]=rt,t[112]=ct,t[113]=dt):dt=t[113],dt}function VB(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function HB(e){return!e}function UB(e){return!e}function WB(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(!1),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>en(e=>{e===`send-feedback`&&n(!0)}),i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a=(0,Z.jsx)(Sy,{open:t,onOpenChange:n,source:`help_menu`}),e[2]=t,e[3]=a),a}function GB(e){let t=Bd(kd(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function KB(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=zs();if(n)return null;if(r===`server`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Eu,{"aria-hidden":`true`,className:`mr-1.5 inline size-3`}),`Couldn't load conflicts — reload to retry.`]})}),e[0]=t):t=e[0],t}if(t.length===0)return null;let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-wider text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Eu,{"aria-hidden":`true`,className:`size-3`}),`Conflicts`]}),e[1]=i):i=e[1];let a;e[2]===t.length?a=e[3]:(a=(0,Z.jsxs)(`header`,{className:`flex items-center justify-between px-2 pb-1.5`,children:[i,(0,Z.jsx)(`span`,{"data-testid":`conflicts-section-count`,className:`rounded-full bg-amber-500 px-1.5 py-0.5 font-mono text-[10px] font-medium leading-none text-white`,children:t.length})]}),e[2]=t.length,e[3]=a);let o;e[4]===t?o=e[5]:(o=t.map(qB),e[4]=t,e[5]=o);let s;e[6]===o?s=e[7]:(s=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-px`,children:o}),e[6]=o,e[7]=s);let c;return e[8]!==a||e[9]!==s?(c=(0,Z.jsxs)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:[a,s]}),e[8]=a,e[9]=s,e[10]=c):c=e[10],c}function qB(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>GB(e.file),children:[(0,Z.jsx)(Eu,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var JB=`proactive_card`;function YB(){let e=!1,t=!1;return{isEvaluated:()=>e,isShown:()=>t,latchEvaluated:()=>{e=!0},latchShown:()=>{t=!0}}}var XB=YB();function ZB(e){let t=(0,$.c)(14),{pages:n,ready:r,blocked:i,store:a,now:o,session:s}=e,c=a===void 0?Iz:a,l=o===void 0?Date.now:o,u=s===void 0?XB:s,{dismissed:d}=(0,Q.useSyncExternalStore)(c.subscribe,c.getSnapshot,c.getSnapshot),f;t[0]===u?f=t[1]:(f=u.isShown(),t[0]=u,t[1]=f);let[p,m]=(0,Q.useState)(f),h,g;t[2]!==l||t[3]!==c?(h=()=>{c.recordFirstSeen(l())},g=[c,l],t[2]=l,t[3]=c,t[4]=h,t[5]=g):(h=t[4],g=t[5]),(0,Q.useEffect)(h,g);let _,v;return t[6]!==i||t[7]!==l||t[8]!==n||t[9]!==r||t[10]!==u||t[11]!==c?(_=()=>{u.isEvaluated()||!r||n==null||(u.latchEvaluated(),!i&&kz(c.getSnapshot(),l(),Oz(n))&&(c.recordShown(l()),u.latchShown(),m(!0)))},v=[r,i,n,c,l,u],t[6]=i,t[7]=l,t[8]=n,t[9]=r,t[10]=u,t[11]=c,t[12]=_,t[13]=v):(_=t[12],v=t[13]),(0,Q.useEffect)(_,v),p&&!d}var QB=`Relaunch`,$B=`Release notes`,eV=`Updates paused`,tV=`Download`,nV=`Reset to defaults`,rV=`Relaunching to install the update…`,iV=`Relaunch failed — please restart manually`;function aV(e){return`Update to ${e} didn't install.`}var oV=`Retry`,sV=`Download manually`,cV=`Recovery action failed — please try again`;function lV(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function uV(e){return`Version ${e} ready to install`}function dV(e){return`Updated to Version ${e}`}function fV(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var pV=0,mV=0,hV=1,gV=2,_V=3,vV=6e4;function yV(e,t,n=()=>{},r=vV,i={isEligible:()=>!1,onShown:()=>{}}){let a=[],o=new Set,s=`update-downloaded`;return a.push(e.onUpdateDownloaded(({version:r})=>{let i=s,a=()=>{t({id:i,body:uV(r),priority:gV,action:{label:QB,onClick:()=>{t({id:i,body:rV,priority:gV,dismissible:!1}),e.update.relaunchNow().then(()=>{n(i)},e=>{a(),t({id:`relaunch-error-${r}`,body:lV(iV,e),variant:`error`,priority:hV})})}}})};a()})),a.push(e.onUpdateRelaunching(()=>{t({id:s,body:rV,priority:gV,dismissible:!1})})),a.push(e.onUpdateRelaunchFailed(({version:r,message:i,downloadUrl:a})=>{if(a){let i=`install-failed-${r}`,o=()=>{t({id:i,body:aV(r),variant:`error`,priority:hV,action:{label:oV,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{console.warn(`[update-notice] install-failed retry rejected`,e),o()})}},secondaryAction:{label:sV,onClick:()=>{e.shell.openExternal(a)}}})};o();return}t({id:`relaunch-error-${r}`,body:i?`${iV}: ${i}`:iV,variant:`error`,priority:hV})})),a.push(e.onWhatsNew(({version:a,releaseUrl:s})=>{if(i.isEligible(a)){i.onShown(a),t({id:`whats-new-combined-${a}`,body:dV(a),variant:`success`,priority:_V,combinedSubscribe:!0,whatsNew:{version:a,releaseUrl:s},action:{label:$B,onClick:()=>{e.shell.openExternal(s)}}}),e.update.dismissWhatsNew(a);return}let c=`whats-new-${a}`;t({id:c,body:dV(a),variant:`success`,priority:_V,action:{label:$B,onClick:()=>{e.shell.openExternal(s)}},onDismiss:()=>{e.update.dismissWhatsNew(a)}});let l=setTimeout(()=>{o.delete(l),n(c),e.update.dismissWhatsNew(a)},r);o.add(l)})),a.push(e.onWhatsNewDismissed(({version:e})=>{n(`whats-new-${e}`)})),a.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:eV,priority:mV,action:{label:tV,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of a)e();for(let e of o)clearTimeout(e);o.clear()}}function bV(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:lV(cV,e),variant:`error`,priority:pV})};n({id:i,body:fV(t.currentBuild),priority:pV,action:{label:nV,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var xV=[],SV=new Set,CV=!1;function wV(){for(let e of SV)e()}function TV(e){let t=xV.findIndex(t=>t.id===e.id);if(t===-1)xV=[...xV,e];else{let n=xV.slice();n[t]=e,xV=n}wV()}function EV(e){let t=xV.filter(t=>t.id!==e);t.length!==xV.length&&(xV=t,wV())}function DV(){return xV}function OV(e){return SV.add(e),()=>{SV.delete(e)}}function kV(){if(CV||typeof window>`u`)return;let e=window.okDesktop;e&&(CV=!0,yV(e,TV,EV,void 0,{isEligible:e=>Uz(Xz.getSnapshot(),e),onShown:e=>Xz.recordShown(e)}),e.state.query().then(t=>{t.schemaIncompatibility&&bV(e,t.schemaIncompatibility,TV,EV)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var AV=new URL(`/api/feedback`,{BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.45.0`}?.VITE_OK_FEEDBACK_INTAKE_ORIGIN||`https://openknowledge.ai`).href;function jV(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=typeof r.result==`string`?r.result:``,n=e.indexOf(`,`);t(n===-1?``:e.slice(n+1))},r.onerror=()=>n(r.error??Error(`file read failed`)),r.readAsDataURL(e)})}async function MV(e){return{contentType:e.type,base64:await jV(e)}}function NV(){return typeof window<`u`&&window.okDesktop?.platform||`web`}async function PV(e){try{let t=await fetch(AV,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...e,appVersion:Qd,platform:NV()}),signal:AbortSignal.timeout(3e4)});if(t.ok){let e=await t.json().catch(e=>(console.warn(`[feedback] action=submit result=ok-parse-error message=${e instanceof Error?e.message:String(e)}`),null));return{ok:!0,reference:e&&typeof e.reference==`string`?e.reference:``}}return t.status===400||t.status===413?{ok:!1,reason:`invalid`}:t.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[feedback] action=submit result=http-error status=${t.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[feedback] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}var FV=dn(`group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed`,{variants:{size:{default:`gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2`,sm:`gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5`,xs:`gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1`},orientation:{horizontal:`min-w-40 items-center`,vertical:`w-24 flex-col has-data-[slot=attachment-content]:w-30`}}});function IV(e){let t=(0,$.c)(16),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,state:i,size:a,orientation:o,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?`done`:i,c=a===void 0?`default`:a,l=o===void 0?`horizontal`:o,u;t[6]!==n||t[7]!==l||t[8]!==c?(u=Y(FV({size:c,orientation:l}),n),t[6]=n,t[7]=l,t[8]=c,t[9]=u):u=t[9];let d;return t[10]!==l||t[11]!==r||t[12]!==c||t[13]!==s||t[14]!==u?(d=(0,Z.jsx)(`div`,{"data-slot":`attachment`,"data-state":s,"data-size":c,"data-orientation":l,className:u,...r}),t[10]=l,t[11]=r,t[12]=c,t[13]=s,t[14]=u,t[15]=d):d=t[15],d}var LV=dn(`relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5`,{variants:{variant:{icon:``,image:`opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover`}},defaultVariants:{variant:`icon`}});function RV(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`icon`:i,o;t[4]!==n||t[5]!==a?(o=Y(LV({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(`div`,{"data-slot":`attachment-media`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function zV(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`attachment-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function BV(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{"data-slot":`attachment-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function VV(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80`,`max-w-full`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{"data-slot":`attachment-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function HV(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`attachment-actions`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function UV(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:a,size:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`icon-xs`:i,s=a??`ghost`,c;t[5]===n?c=t[6]:(c=Y(n),t[5]=n,t[6]=c);let l;return t[7]!==r||t[8]!==o||t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(X,{"data-slot":`attachment-action`,variant:s,size:o,className:c,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function WV(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`attachment-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var GV=[{value:`too-slow`,label:{id:`YJPN3F`}},{value:`hard-to-use`,label:{id:`MDBJwN`}},{value:`missing-feature`,label:{id:`anmUZq`}},{value:`something-broke`,label:{id:`dXCi3J`}},{value:`formatting`,label:{id:`RcrskJ`}},{value:`other`,label:{id:`_IX_7x`}}],KV=3,qV=3*1024*1024,JV=[`image/png`,`image/jpeg`,`image/webp`],YV=`data-[state=on]:border-primary data-[state=on]:bg-primary/5 data-[state=on]:text-primary`,XV=`rounded-full border border-input bg-transparent px-3 ${YV}`;function ZV(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function QV(e,t){let n=new Set(e.map(e=>`${e.name}:${e.size}`)),r=Array.from(t??[]).filter(e=>JV.includes(e.type)&&!n.has(`${e.name}:${e.size}`));return[...e,...r].slice(0,KV)}var $V=e=>{let t=(0,$.c)(5),{file:n}=e,[r,i]=(0,Q.useState)(null),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=URL.createObjectURL(n);return i(e),()=>URL.revokeObjectURL(e)},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o);let s;return t[3]===r?s=t[4]:(s=r?(0,Z.jsx)(`img`,{src:r,alt:``,className:`size-full object-cover`}):null,t[3]=r,t[4]=s),s},eH=e=>{let t=(0,$.c)(58),{onSuccess:n,source:r,compact:i,title:a,onDismiss:o,className:s}=e,c=r===void 0?`resources_menu`:r,{_:l}=Dt(),u=(0,Q.useRef)(null),d,f;if(t[0]!==l){let e=ja({rating:Ua([`positive`,`negative`],{error:l({id:`H-hzll`})}),reasons:Sa(ka()),message:ka(),attachments:Sa(po(File)).max(KV,l({id:`E9gh86`,values:{MAX_ATTACHMENTS:KV}})).refine(nH,l({id:`s7us1p`})).refine(iH,l({id:`ItxGi3`})),shareEmail:Ea(),email:ka()}).refine(aH,{path:[`email`],message:l({id:`fwrPh4`})});f=Um,d=Sz(e),t[0]=l,t[1]=d,t[2]=f}else d=t[1],f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={rating:void 0,reasons:p,message:``,attachments:[],shareEmail:!1,email:``},t[4]=m):m=t[4];let h;t[5]===d?h=t[6]:(h={resolver:d,defaultValues:m},t[5]=d,t[6]=h);let g=f(h),_;t[7]===g.control?_=t[8]:(_={control:g.control,name:`rating`},t[7]=g.control,t[8]=_);let v=Km(_),y=!i||v!=null,b;t[9]===g.control?b=t[10]:(b={control:g.control,name:`shareEmail`},t[9]=g.control,t[10]=b);let x=Km(b),S;t[11]===g.control?S=t[12]:(S={control:g.control,name:`attachments`},t[11]=g.control,t[12]=S);let C=Km(S),w=C.length>=KV,T=g.formState.errors.attachments,E;t[13]===g?E=t[14]:(E=e=>g.setValue(`attachments`,e,{shouldValidate:!0}),t[13]=g,t[14]=E);let D=E,O;t[15]!==l||t[16]!==g||t[17]!==n||t[18]!==c?(O=async e=>{try{let t=e.attachments.length?await Promise.all(e.attachments.map(MV)):void 0,r=await PV({kind:`general`,rating:e.rating,reasons:e.reasons,message:e.message.trim()||void 0,email:e.shareEmail&&e.email?e.email:void 0,attachments:t,source:c});if(r.ok){Mu.success(l({id:`LvdLef`})),g.reset(),n?.();return}if(r.reason===`unavailable`){Mu.error(l({id:`D8JJwQ`}));return}Mu.error(l({id:`D2emTw`}))}catch(e){let t=e;console.warn(`[feedback] action=submit result=unexpected-error message=${t instanceof Error?t.message:String(t)}`),Mu.error(l({id:`D2emTw`}))}},t[15]=l,t[16]=g,t[17]=n,t[18]=c,t[19]=O):O=t[19];let k=O,A;t[20]!==g||t[21]!==k?(A=g.handleSubmit(k),t[20]=g,t[21]=k,t[22]=A):A=t[22];let j=i?`space-y-3`:`space-y-5`,M;t[23]!==s||t[24]!==j?(M=Y(j,s),t[23]=s,t[24]=j,t[25]=M):M=t[25];let N;t[26]!==l||t[27]!==o||t[28]!==a?(N=(a||o)&&(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[a?(0,Z.jsx)(`p`,{className:`font-medium text-1sm`,children:a}):(0,Z.jsx)(`span`,{}),o?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":l({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(ju,{className:`size-4`})}):null]}),t[26]=l,t[27]=o,t[28]=a,t[29]=N):N=t[29];let P;t[30]!==l||t[31]!==i||t[32]!==g?(P=e=>{let{field:t}=e;return(0,Z.jsxs)(Bm,{children:[(0,Z.jsx)(qm,{children:(0,Z.jsxs)(ni,{type:`single`,variant:`outline`,spacing:2,"aria-label":l({id:`rg7hNd`}),value:t.value??``,onValueChange:e=>{e&&(t.onChange(e),e===`positive`&&g.setValue(`reasons`,[]))},className:`w-full`,children:[(0,Z.jsxs)(ei,{value:`positive`,className:Y(`h-auto flex-1 justify-center py-2`,i?`gap-1.5 text-xs`:`gap-2`,YV),children:[(0,Z.jsx)(lv,{className:`size-4`}),(0,Z.jsx)(J,{id:`OEEQKT`})]}),(0,Z.jsxs)(ei,{value:`negative`,className:Y(`h-auto flex-1 justify-center py-2`,i?`gap-1.5 text-xs`:`gap-2`,YV),children:[(0,Z.jsx)(cv,{className:`size-4`}),(0,Z.jsx)(J,{id:`U0QBh4`})]})]})}),(0,Z.jsx)(Ym,{})]})},t[30]=l,t[31]=i,t[32]=g,t[33]=P):P=t[33];let F;t[34]!==g.control||t[35]!==P?(F=(0,Z.jsx)(Wm,{control:g.control,name:`rating`,render:P}),t[34]=g.control,t[35]=P,t[36]=F):F=t[36];let I;t[37]!==l||t[38]!==w||t[39]!==C||t[40]!==T||t[41]!==i||t[42]!==g.control||t[43]!==g.formState.isSubmitting||t[44]!==v||t[45]!==D||t[46]!==x||t[47]!==y?(I=y&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[v===`negative`&&(0,Z.jsx)(Wm,{control:g.control,name:`reasons`,render:e=>{let{field:t}=e;return(0,Z.jsxs)(Bm,{children:[(0,Z.jsx)(Jm,{children:(0,Z.jsx)(J,{id:`Fqx38P`})}),(0,Z.jsx)(qm,{children:(0,Z.jsx)(ni,{type:`multiple`,variant:`outline`,spacing:2,value:t.value,onValueChange:t.onChange,className:`w-full flex-wrap justify-start`,children:GV.map(e=>(0,Z.jsx)(ei,{value:e.value,className:XV,children:l(e.label)},e.value))})})]})}}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(Wm,{control:g.control,name:`message`,render:e=>{let{field:t}=e;return(0,Z.jsx)(Bm,{children:(0,Z.jsx)(qm,{children:(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(Op,{...t,placeholder:l({id:`QlAG4m`}),className:Y(`resize-none pb-9`,i?`min-h-16`:`min-h-20`)}),(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(`span`,{className:Y(`absolute bottom-1.5 left-1.5 inline-flex`,w&&`cursor-not-allowed`),children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,disabled:w,onClick:()=>u.current?.click(),className:`size-7 text-muted-foreground`,children:[(0,Z.jsx)(gu,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`3LbBJn`})})]})})}),(0,Z.jsx)(vn,{children:w?(0,Z.jsx)(J,{id:`ASqqsQ`,values:{MAX_ATTACHMENTS:KV}}):(0,Z.jsx)(J,{id:`3LbBJn`})})]}),(0,Z.jsx)(Ru,{ref:u,type:`file`,accept:JV.join(`,`),multiple:!0,className:`hidden`,onChange:e=>{D(QV(C,e.target.files)),e.target.value=``}})]})})})}}),C.length>0&&(0,Z.jsx)(WV,{children:C.map((e,t)=>(0,Z.jsxs)(IV,{size:`xs`,children:[(0,Z.jsx)(RV,{variant:`image`,children:(0,Z.jsx)($V,{file:e})}),(0,Z.jsxs)(zV,{children:[(0,Z.jsx)(BV,{children:e.name}),(0,Z.jsx)(VV,{children:ZV(e.size)})]}),(0,Z.jsx)(HV,{children:(0,Z.jsx)(UV,{type:`button`,"aria-label":l({id:`w61W3L`,values:{0:e.name}}),onClick:()=>D(C.filter((e,n)=>n!==t)),children:(0,Z.jsx)(ju,{className:`size-3.5`})})})]},`${e.name}:${e.size}`))}),T?.message&&(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,children:T.message})]})]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(Wm,{control:g.control,name:`shareEmail`,render:oH}),x&&(0,Z.jsx)(Wm,{control:g.control,name:`email`,render:e=>{let{field:t}=e;return(0,Z.jsxs)(Bm,{children:[(0,Z.jsx)(qm,{children:(0,Z.jsx)(Ru,{...t,type:`email`,placeholder:l({id:`JHf6qZ`})})}),(0,Z.jsx)(Ym,{})]})}})]}),(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(X,{type:`submit`,size:i?`sm`:`default`,disabled:g.formState.isSubmitting,children:g.formState.isSubmitting?(0,Z.jsx)(J,{id:`9bG48P`}):(0,Z.jsx)(J,{id:`JlFcis`})})})]}),t[37]=l,t[38]=w,t[39]=C,t[40]=T,t[41]=i,t[42]=g.control,t[43]=g.formState.isSubmitting,t[44]=v,t[45]=D,t[46]=x,t[47]=y,t[48]=I):I=t[48];let L;t[49]!==A||t[50]!==M||t[51]!==N||t[52]!==F||t[53]!==I?(L=(0,Z.jsxs)(`form`,{onSubmit:A,className:M,children:[N,F,I]}),t[49]=A,t[50]=M,t[51]=N,t[52]=F,t[53]=I,t[54]=L):L=t[54];let R;return t[55]!==g||t[56]!==L?(R=(0,Z.jsx)(Xm,{...g,children:L}),t[55]=g,t[56]=L,t[57]=R):R=t[57],R};function tH(e){return JV.includes(e.type)}function nH(e){return e.every(tH)}function rH(e,t){return e+t.size}function iH(e){return e.reduce(rH,0)<=qV}function aH(e){return!e.shareEmail||$a().safeParse(e.email).success}function oH(e){let{field:t}=e;return(0,Z.jsxs)(Bm,{className:`flex flex-row items-center gap-2 space-y-0`,children:[(0,Z.jsx)(qm,{children:(0,Z.jsx)(cr,{checked:t.value,onCheckedChange:e=>t.onChange(e===!0)})}),(0,Z.jsx)(Jm,{className:`font-normal`,children:(0,Z.jsx)(J,{id:`SF9qpO`})})]})}function sH(e){let t=(0,$.c)(10),{onClose:n}=e,{_:r}=Dt(),i;t[0]===r?i=t[1]:(i=r({id:`u5hSeG`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`s0-xF4`}),t[2]=r,t[3]=a);let o;t[4]!==n||t[5]!==a?(o=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:(0,Z.jsx)(eH,{compact:!0,source:JB,title:a,onDismiss:n,onSuccess:n})}),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==i||t[8]!==o?(s=(0,Z.jsx)(`section`,{"aria-label":i,className:`mx-1 mb-1 overflow-hidden rounded-lg border bg-card text-card-foreground`,children:o}),t[7]=i,t[8]=o,t[9]=s):s=t[9],s}function cH(){let e=(0,$.c)(5),t=os(),n=(0,Q.useSyncExternalStore)(WO.subscribe,WO.getSnapshot,WO.getSnapshot),r=(0,Q.useSyncExternalStore)(OV,DV,DV),i=n.initialized&&!n.dismissed&&!n.completed||r.length>0,a=t?.pages??null,o=t!=null&&!t.loading,s;if(e[0]!==i||e[1]!==a||e[2]!==o?(s={pages:a,ready:o,blocked:i},e[0]=i,e[1]=a,e[2]=o,e[3]=s):s=e[3],!ZB(s))return null;let c;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(sH,{onClose:lH}),e[4]=c):c=e[4],c}function lH(){return Iz.dismiss()}var uH=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
14
- <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
15
- <path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
16
- </symbol>
17
- <symbol id="file-tree-icon-dot" viewBox="0 0 6 6">
18
- <circle cx="3" cy="3" r="3" />
19
- </symbol>
20
- <symbol id="file-tree-icon-file" viewBox="0 0 16 16">
21
- <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".5"/>
22
- <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
23
- </symbol>
24
- <symbol id="file-tree-icon-lock" viewBox="0 0 16 16">
25
- <path fill="currentcolor" d="M4 5.336V4a4 4 0 1 1 8 0v1.336c1.586.54 2 1.843 2 4.664v1c0 4.118-.883 5-5 5H7c-4.117 0-5-.883-5-5v-1c0-2.821.414-4.124 2-4.664M5.5 4v1.054Q6.166 4.998 7 5h2q.834-.002 1.5.054V4a2.5 2.5 0 0 0-5 0m-2 6v1c0 .995.055 1.692.167 2.193.107.483.246.686.35.79s.307.243.79.35c.5.112 1.198.167 2.193.167h2c.995 0 1.692-.055 2.193-.166.483-.108.686-.247.79-.35.104-.105.243-.308.35-.791.112-.5.167-1.198.167-2.193v-1c0-.995-.055-1.692-.166-2.193-.108-.483-.247-.686-.35-.79-.105-.104-.308-.243-.791-.35C10.693 6.555 9.995 6.5 9 6.5H7c-.995 0-1.692.055-2.193.167-.483.107-.686.246-.79.35s-.243.307-.35.79C3.555 8.307 3.5 9.005 3.5 10" />
26
- </symbol>
27
- <symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
28
- <path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />
29
- </symbol>
30
- </svg>`,dH=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
31
- <path fill="currentColor" d="M6.08 13.92c-.63-.57-.81-1.79-.55-2.67.45.56 1.08.73 1.73.83 1 .15 1.99.1 2.92-.37l.32-.19q.13.38.08.78a2.1 2.1 0 0 1-.9 1.5q-.3.24-.61.43c-.64.44-.81.95-.57 1.69l.02.08a1.7 1.7 0 0 1-.74-.64 2 2 0 0 1-.3-.98q0-.27-.02-.52-.07-.61-.61-.62a.7.7 0 0 0-.75.6z" class="bg" opacity=".6"/>
32
- <path fill="currentColor" d="M2.5 11.1s1.86-.9 3.72-.9l1.4-4.39c.05-.21.2-.36.38-.36s.33.15.38.36l1.4 4.38c2.2 0 3.72.92 3.72.92l-3.16-8.69q-.13-.4-.45-.42H6.11q-.3.02-.45.42z" class="fg"/>
33
- </symbol>`,fH=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
34
- <path fill="currentColor" fill-rule="evenodd" d="M9.49.5q1.92.05 2.66.54 1.27.6 1.35 1.52v.23a4 4 0 0 1-.53 1.9l-1.38 1.24q-.74.38-.72.63c.77.82 1.33 1.29.85 2.42q-.47 1.1-2.04 2.28c-.5.32-1.88 1.35-2.96 1.86-1.64.77-3.1 1.4-4.65 1.89-.51.16-1.5.16-1.5.16L.5 15A76 76 0 0 0 5.76 3.49q-.1-.08-.1-.2.1 0 .32-.35l-.03-.09q-1.17.39-2.38 1.3l-.13.03q0-.1-.21-.16-.46.31-.82.7l-.13-.19.16-.06-.03-.16-.34.29L2 4.5q.36-.48.72-.54l.04-.1V3.8q.16 0 .15-.06l.13-.06a6 6 0 0 0 1.13-.9v-.03H4.1l-.12.07q0-.1-.1-.1l-.15.07-.04-.1q.93-.52 1.63-1.05Q7.89.65 9.5.5M8.46 7.83l-.32.04c-1.31.54-2.31.82-2.91.88a71 71 0 0 0-2.2 4.54h.07q.58-.04 3.04-1.42.13 0 1.66-1.05L9.18 9.7v.03q.45-.2.81-1.3v-.2q-.5-.46-1.53-.4m.28-5.75c-.5.1-.75.19-.72.38l-1.16 2.6q-.17.1-.34.95-.3.48-.25.77v.1l.22.05A15 15 0 0 1 8.86 6c1.1-.71 2.12-1.38 2.8-2.54q.24-.33.21-.54-.02-.33-.4-.54c-.54 0-1.07-.34-1.63-.28l-.94-.03z" clip-rule="evenodd"/>
35
- </symbol>`,pH=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
36
- <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
37
- <path fill="currentColor" d="M11.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zM7 6.75C7 6.42 6.64 6 6 6s-1 .42-1 .75q-.01.25.22.41.26.21.89.35.74.14 1.28.53c.37.29.61.7.61 1.21 0 .87-.68 1.5-1.5 1.7v.55a.5.5 0 0 1-1 0v-.56c-.82-.18-1.5-.82-1.5-1.69a.5.5 0 0 1 1 0c0 .33.36.75 1 .75s1-.42 1-.75q.01-.25-.22-.41a2 2 0 0 0-.89-.35q-.74-.14-1.28-.53A1.5 1.5 0 0 1 4 6.75c0-.87.68-1.5 1.5-1.7V4.5a.5.5 0 0 1 1 0v.56c.82.18 1.5.82 1.5 1.69a.5.5 0 0 1-1 0" class="fg-stroke"/>
38
- </symbol>`,mH=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
39
- <path fill="currentColor" d="M8 2 4.88 7.35a7 7 0 0 1 3.7-.13l1.04.25-.99 4.16-1.05-.25a2.7 2.7 0 0 0-3.07 1.45l-.98-.47a4 4 0 0 1 1.07-1.31 3.8 3.8 0 0 1 3.23-.71l.5-2.08a6 6 0 0 0-5.07 1.12A5.9 5.9 0 0 0 1 14h14z"/>
40
- </symbol>`,hH=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
41
- <path fill="currentColor" fill-rule="evenodd" d="M11.72 1.5A2.5 2.5 0 0 1 14.2 4q.02 1.08.3 2.09c.22.73.56 1.24 1.08 1.45.22.08.4.27.4.5s-.18.43-.4.51q-.76.34-1.08 1.45c-.2.65-.27 1.32-.3 2a2.5 2.5 0 0 1-2.48 2.5H4.25A2.6 2.6 0 0 1 1.7 12c-.04-.85-.1-1.68-.22-2.04C1.26 9.23.92 8.7.4 8.5.18 8.42 0 8.23 0 8s.18-.42.4-.5q.77-.35 1.09-1.46c.1-.36.17-1.19.2-2.04a2.6 2.6 0 0 1 2.56-2.5z" class="bg" clip-rule="evenodd" opacity=".2"/>
42
- <path fill="currentColor" fill-rule="evenodd" d="M8.47 4.54c1.23 0 2.04.68 2.04 1.73 0 .73-.55 1.39-1.24 1.5v.04c.94.1 1.58.77 1.58 1.7 0 1.2-.9 1.95-2.37 1.95H5.97a.3.3 0 0 1-.2-.08.3.3 0 0 1-.08-.2V4.82a.3.3 0 0 1 .08-.2.3.3 0 0 1 .2-.08zm-1.7 6.04h1.49q1.47-.01 1.49-1.15Q9.74 8.31 8.2 8.3H6.77zm0-5.16v2.06h1.21c.93 0 1.45-.38 1.45-1.06 0-.65-.44-1-1.22-1z" class="fg" clip-rule="evenodd"/>
43
- </symbol>`,gH=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
44
- <path fill="currentColor" d="M8.88 6.96c0 3.82 3.72 4.7 5.7 3.74-.23.9-1.04 1.67-2.35 1.93-.02.4.42 1.28.82 1.63-.9.35-1.94-.12-2.51-.48a5 5 0 0 0-.32 1.87c-.68 0-1.57-1-1.8-1.37-.3.18-.85 1.15-.96 1.72a2.4 2.4 0 0 1-.81-.86 2.4 2.4 0 0 1-.3-1.15c-.38.27-1.48.95-1.99 1.18-.25-.58-.15-1.3 0-2.06-.21.12-1.8.27-2.43.12.32-.36.75-1.19.94-1.57A4.5 4.5 0 0 1 .44 10.6c.48-.22.97-.53 1.49-1.06C1.26 9.17.24 8.64 0 7.7a6 6 0 0 0 1.79-.32C1.28 7.08.44 6.15.6 5.01c.42.21 1.3.37 1.73.3a3.4 3.4 0 0 1-.25-2.75 5 5 0 0 0 1.48 1c-.08-.8.3-2.31.8-2.71.2.46.73 1.21 1.08 1.4.09-.61.87-2.06 1.57-2.25 0 .5.27 1.4.5 1.67.51-.54 2.25-1.44 3.64-1.13-.43.45-.75.61-.86.98 1.05 0 2.78.34 4.27 1.93-2.34-.89-5.69.56-5.69 3.5" class="bg" opacity=".5"/>
45
- <path fill="currentColor" d="M11.21 3.59a4.1 4.1 0 0 0 2.47 2.89c.24-.22.61-.38.95-.19.76.44.2 1.26-.34 1.66l-.07.06a13 13 0 0 1-4.49 1.61l-.3-.43a10.5 10.5 0 0 0 4.13-1.31 1 1 0 0 0 .23-.25.5.5 0 0 0-.21-.69l-.15-.06a4.5 4.5 0 0 1-1.77-1.31 4.5 4.5 0 0 1-.88-1.77q.2-.12.43-.21"/>
46
- <path fill="currentColor" d="M10.36 5.18a.4.4 0 0 0-.03.38c.09.2.3.3.46.23s.24-.3.15-.5l-.01-.02q.23.13.34.39a.83.83 0 0 1-.43 1.08.8.8 0 0 1-1.08-.43.83.83 0 0 1 .6-1.13"/>
47
- </symbol>`,_H=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
48
- <path fill="currentColor" d="M8 14c3.87 0 7-2.46 7-5.49 0-1.88-1.2-3.53-3.04-4.52q-1.1-.61-1.84-1.07C9.2 2.35 8.64 2 8 2s-1.36.45-2.31 1.03A29 29 0 0 1 4.04 4C2.2 4.98 1 6.63 1 8.51 1 11.54 4.13 14 8 14M7.18 3.88q.3-.66.3-1.37c0-.08.11-.1.13-.01.38 1.57-.53 2.35-1.2 2.61-.08.03-.12-.07-.06-.12a3 3 0 0 0 .83-1.12m1.2-.05a3 3 0 0 0-.45-1.3V2.5c-.04-.07.05-.15.1-.1 1.15 1.2.77 2.3.33 2.87-.05.05-.13 0-.11-.08q.21-.67.13-1.37m1.04-.32a3 3 0 0 0-.94-1.02v-.01c-.06-.05-.01-.16.07-.12 1.51.61 1.61 1.8 1.43 2.5l-.03.03a.07.07 0 0 1-.1-.06 3 3 0 0 0-.43-1.32m-2.97.32c-.36.3-.74.43-1.2.56q-.11 0-.1-.1a3.5 3.5 0 0 0 1.76-1.57s.09-.07.1.04c0 .18-.2.76-.56 1.07m2.89 6.36q-.13.52-.55.88a1.3 1.3 0 0 1-.75.35 1.3 1.3 0 0 1-.77-.35 1.7 1.7 0 0 1-.54-.88.13.13 0 0 1 .15-.15h2.31a.14.14 0 0 1 .15.15M6.15 8.95a1.1 1.1 0 0 1-1.39-.14A1.1 1.1 0 0 1 5.12 7a1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1-.17 1.69m4.96 0a1.1 1.1 0 0 1-1.4-.14 1.1 1.1 0 0 1 .37-1.8 1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1 .24 1.2 1 1 0 0 1-.41.5"/>
49
- </symbol>`,vH=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
50
- <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
51
- </symbol>`,yH=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
52
- <path fill="currentColor" d="M3.75 10.31 6.5 8.77l.04-.14-.04-.07h-.14l-.46-.03-1.57-.04-1.38-.07-1.33-.07-.34-.07L1 7.86l.03-.21.28-.18.4.03.89.07 1.33.08.97.06 1.43.16h.22l.03-.1-.07-.05-.06-.06-1.39-.92-1.48-.98-.79-.57-.42-.28-.2-.28-.1-.6.39-.41.52.04.12.03.52.4 1.12.86L6.2 6.04l.2.17.09-.06.01-.04-.1-.15-.76-1.46-.85-1.46-.37-.6-.1-.36a1 1 0 0 1-.06-.42l.42-.59.25-.07.6.08.22.2.36.84.58 1.3.9 1.77.29.53.14.47.04.14h.1v-.07l.07-1 .14-1.22.14-1.57.04-.45.23-.53.42-.28.36.15.28.41-.04.25-.16 1.08-.36 1.7-.21 1.14h.12l.14-.15.58-.76.97-1.2.42-.5.5-.51.32-.25h.6l.44.66-.2.68-.61.79-.52.65-.74 1-.45.8.04.05h.1l1.68-.36.9-.16 1.06-.18.5.23.05.22-.2.48-1.15.28-1.34.28-2 .46-.04.01.03.04.9.09.4.03h.94l1.77.14.46.28.27.37-.04.28-.72.37-.95-.23-2.24-.53-.76-.18h-.11v.06l.64.63L12 10.86l1.48 1.35.07.34-.18.28-.2-.03-1.29-.98-.5-.42-1.12-.95h-.07v.1l.25.38 1.37 2.05.07.63-.1.2-.36.14-.38-.08-.8-1.12-.85-1.26-.66-1.15-.07.05-.4 4.23-.19.21-.42.17-.35-.28-.2-.42.2-.87.23-1.12.18-.9.17-1.1.1-.36v-.03h-.1l-.84 1.16-1.27 1.72-1 1.07-.24.1-.42-.22.04-.39.22-.32 1.4-1.8.84-1.1.57-.64-.02-.07h-.04l-3.7 2.4-.66.09-.28-.28.03-.42.14-.14 1.12-.77z"/>
53
- </symbol>`,bH=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
54
- <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
55
- </symbol>`,xH=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
56
- <path fill="currentColor" d="M8 15c-5.76 0-7-1.24-7-7V2a1 1 0 0 1 1-1h6c5.77 0 7 1.24 7 7s-1.24 7-7 7" class="vector" opacity=".2"/>
57
- <path fill="currentColor" d="M10.1 9.19h.73c.03.49.22.6 1 .6.76 0 .93-.12.93-.68 0-.52-.17-.67-.94-.85-1.38-.3-1.68-.56-1.68-1.47 0-1.05.3-1.29 1.67-1.29 1.29 0 1.57.2 1.6 1.13h-.74c-.01-.34-.17-.42-.85-.42-.77 0-.94.1-.94.58 0 .42.17.55.96.73 1.36.3 1.66.58 1.66 1.59 0 1.14-.31 1.39-1.73 1.39-1.39 0-1.69-.24-1.67-1.31m-3.9 0h.74c.03.49.21.6.99.6.76 0 .93-.12.93-.68 0-.52-.17-.67-.93-.85-1.39-.3-1.69-.56-1.69-1.47 0-1.05.3-1.29 1.67-1.29 1.3 0 1.58.2 1.6 1.13h-.73c-.02-.34-.18-.42-.85-.42-.78 0-.95.1-.95.58 0 .42.17.55.96.73 1.37.3 1.67.58 1.67 1.59 0 1.14-.32 1.39-1.74 1.39-1.38 0-1.68-.24-1.66-1.31m-1.22 0h.75c-.09 1.07-.37 1.31-1.56 1.31-1.37 0-1.68-.45-1.68-2.5 0-1.96.36-2.5 1.68-2.5 1.16 0 1.44.25 1.52 1.35h-.76c-.08-.52-.22-.64-.76-.64-.74 0-.9.33-.9 1.78 0 1.47.16 1.8.9 1.8.58 0 .74-.11.8-.6"/>
58
- </symbol>`,SH=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
59
- <path fill="currentColor" d="M14.953 9.733a12.4 12.4 0 0 1-.244 1.936c-.207.933-.532 1.58-.996 2.044s-1.11.789-2.044.996C10.73 14.918 9.533 15 8 15s-2.73-.082-3.669-.291c-.933-.207-1.58-.532-2.044-.996s-.789-1.11-.996-2.044c-.122-.547-.2-1.182-.244-1.92q.23.364.532.667c.64.639 1.482 1.031 2.533 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265a4 4 0 0 0 .541-.683"/>
60
- <path fill="currentColor" d="M14.93 5.924c-.046.663-.118 1.24-.23 1.743-.207.932-.532 1.579-.995 2.042s-1.11.789-2.042.996c-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997s-.789-1.11-.996-2.042a12 12 0 0 1-.227-1.683l.016-.188a4 4 0 0 0 .5.62c.638.639 1.48 1.031 2.532 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265.192-.192.357-.404.506-.633z"/>
61
- <path fill="currentColor" d="M8 1c1.533 0 2.73.082 3.669.291.933.207 1.58.533 2.044.996.403.404.904.944.91 1.695.004.764-.509 1.318-.918 1.727-.463.463-1.11.789-2.042.996-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997-.406-.406-.915-.953-.915-1.71 0-.758.509-1.305.915-1.712.464-.463 1.11-.789 2.044-.996C5.27 1.082 6.467 1 8 1"/>
62
- </symbol>`,CH=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
63
- <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".4"/>
64
- <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
65
- </symbol>`,wH=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
66
- <path fill="currentColor" d="M15.85 6.54c-.05-.04-.45-.36-1.31-.36q-.34 0-.68.06a2.7 2.7 0 0 0-1.14-1.79l-.23-.14-.15.23a3 3 0 0 0-.4 1q-.24 1.01.26 1.84c-.4.24-1.03.3-1.17.3H.5a.5.5 0 0 0-.5.52q-.01 1.46.46 2.83.55 1.5 1.6 2.18c.79.5 2.08.79 3.54.79q.96 0 1.94-.18a8 8 0 0 0 2.55-.97 7 7 0 0 0 1.73-1.5 10 10 0 0 0 1.7-3.06h.15a2.4 2.4 0 0 0 1.8-.7 2 2 0 0 0 .47-.74l.06-.2z"/>
67
- <path fill="currentColor" d="M1.48 7.36h1.4a.14.14 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H1.48a.13.13 0 0 0-.13.14v1.32q.02.13.13.13m1.94 0h1.41a.14.14 0 0 0 .13-.13V5.91q-.01-.12-.13-.14h-1.4a.13.13 0 0 0-.13.14v1.32q0 .13.12.13m1.98 0h1.4q.13 0 .14-.13V5.91a.13.13 0 0 0-.14-.14H5.4q-.1.01-.12.14v1.32q0 .13.12.13m1.95 0h1.42q.1 0 .12-.13V5.91q0-.12-.12-.14H7.35q-.1.01-.12.14v1.32q.01.13.12.13M3.42 5.5h1.41c.07 0 .13-.08.13-.15V4.03a.13.13 0 0 0-.13-.14h-1.4q-.12 0-.13.14v1.31q0 .13.12.15m1.98 0h1.4c.08 0 .14-.08.14-.15V4.03q0-.13-.14-.14H5.4q-.1 0-.12.14v1.31q0 .13.12.15m1.95 0h1.42c.06 0 .12-.08.12-.15V4.03q-.01-.13-.12-.14H7.35q-.1 0-.12.14v1.31q.01.13.12.15m0-1.9h1.42q.1-.02.12-.14v-1.3Q8.88 2 8.77 2H7.35q-.1 0-.12.14v1.3q.01.13.12.14m1.97 3.78h1.4a.13.13 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H9.32q-.1.01-.12.14v1.32q.01.13.12.13" opacity=".5"/>
68
- </symbol>`,TH=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
69
- <path fill="currentColor" d="M11.16 6.1 8.12 4.35a.3.3 0 0 0-.24 0L4.84 6.1a.3.3 0 0 0-.12.2v3.5q0 .14.12.22l3.04 1.74q.12.08.24 0l3.04-1.74a.2.2 0 0 0 .13-.22V6.3a.3.3 0 0 0-.13-.2" opacity=".5"/>
70
- <path fill="currentColor" d="m.1 7.69 3.63-6.3A.8.8 0 0 1 4.37 1h7.26c.26 0 .5.17.64.4l3.63 6.27a.8.8 0 0 1 0 .75l-3.63 6.24a.7.7 0 0 1-.64.34H4.37a.7.7 0 0 1-.64-.34L.1 8.41a.7.7 0 0 1 0-.72m3 3.02q.01.15.14.23l4.63 2.66q.13.06.26 0l4.63-2.66a.3.3 0 0 0 .14-.23V5.4a.3.3 0 0 0-.14-.23L8.13 2.52a.3.3 0 0 0-.26 0L3.24 5.17a.3.3 0 0 0-.14.23z"/>
71
- </symbol>`,EH=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
72
- <path fill="currentColor" d="M12.3 13c-1.59 0-2.68-.99-2.68-2.5 0-1.43 1-2.34 2.88-2.35h2.16v-.83c0-1.08-.62-1.68-1.73-1.68-1.05 0-1.66.54-1.73 1.36H9.93c.09-1.43 1.06-2.48 3.05-2.48 1.75 0 3.02.95 3.02 2.68v5.66h-1.29v-1.02h-.04c-.41.66-1.16 1.16-2.37 1.16m.36-1.12c1.14 0 2-.72 2-1.74v-.96H12.6c-1.12 0-1.6.54-1.6 1.28 0 .97.8 1.42 1.66 1.42m-11.24.98H0L3.8 2h1.39l3.8 10.86H7.54l-1.08-3.2H2.5zm3.09-9.25h-.04l-1.6 4.95H6.1z"/>
73
- </symbol>`,DH=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
74
- <path fill="currentColor" d="M14.74 7.38 8.62 1.26a.9.9 0 0 0-1.27 0L6.08 2.53l1.61 1.61a1.07 1.07 0 0 1 1.36 1.37l1.55 1.55a1.07 1.07 0 0 1 1.1 1.77 1.07 1.07 0 0 1-1.74-1.16L8.5 6.22v3.8a1.07 1.07 0 1 1-.89-.02V6.15a1.07 1.07 0 0 1-.58-1.4l-1.58-1.6-4.2 4.2a.9.9 0 0 0 0 1.27l6.12 6.12a.9.9 0 0 0 1.27 0l6.09-6.09a.9.9 0 0 0 0-1.27"/>
75
- </symbol>`,OH=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
76
- <path fill="currentColor" fill-rule="evenodd" d="M4.41 4.57A3.2 3.2 0 0 1 6.87 5q.74.49 1.08 1.29.08.12-.1.16l-1.55.4c-.14.03-.15.04-.27-.1a1 1 0 0 0-.44-.34 1.6 1.6 0 0 0-1.68.14q-.95.61-.94 1.73c0 .73.52 1.33 1.25 1.43q.95.1 1.58-.6l.25-.34h-1.8c-.19 0-.24-.12-.17-.27.12-.28.34-.76.47-1a.3.3 0 0 1 .24-.14h2.98a4 4 0 0 1 .64-1.19 4 4 0 0 1 2.6-1.52 3.5 3.5 0 0 1 2.64.46q1.13.73 1.31 2.04a3.5 3.5 0 0 1-1.06 3.09q-.93.92-2.23 1.17l-.74.08a3.5 3.5 0 0 1-2.27-.8 3 3 0 0 1-.93-1.42 4 4 0 0 1-.39.61 4 4 0 0 1-2.64 1.56 3.3 3.3 0 0 1-2.5-.6 3 3 0 0 1-1.18-2.03 3.5 3.5 0 0 1 .8-2.67 4 4 0 0 1 2.6-1.58M13.1 7.5a1.53 1.53 0 0 0-1.9-1.21q-1.3.3-1.62 1.59a1.5 1.5 0 0 0 .85 1.72q.77.33 1.52-.05a2 2 0 0 0 1.18-1.74q0-.17-.03-.3" clip-rule="evenodd"/>
77
- </symbol>`,kH=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
78
- <path fill="currentColor" fill-rule="evenodd" d="M8 1a1.25 1.25 0 0 1 1.18 1.65l2.8 1.61q.33-.25.77-.26a1.25 1.25 0 0 1 .48 2.4v3.2a1.25 1.25 0 1 1-1.25 2.13l-2.8 1.62A1.25 1.25 0 0 1 8 15a1.25 1.25 0 0 1-1.18-1.65l-2.8-1.62q-.33.26-.77.27a1.25 1.25 0 0 1-.48-2.4V6.4a1.25 1.25 0 1 1 1.25-2.14l2.8-1.61A1.25 1.25 0 0 1 8 1M4.44 11.14l-.06.13 2.75 1.58a1.25 1.25 0 0 1 1.74 0l2.74-1.58-.05-.13zm3.89-7.68a1.3 1.3 0 0 1-.66 0L4.03 9.77q.37.3.45.78h7.04q.08-.48.45-.78zM4.38 4.73a1.24 1.24 0 0 1-1.02 1.76v3.02l.13.01 3.67-6.35-.03-.02zm4.46-1.56 3.67 6.35.13-.01V6.49a1.25 1.25 0 0 1-1.03-1.76L8.87 3.15z" clip-rule="evenodd"/>
79
- </symbol>`,AH=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
80
- <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
81
- <path fill="currentColor" d="M10.48 3.76a.5.5 0 0 1 .4.58L10.6 5.8h1.14a.5.5 0 0 1 0 1h-1.32L10 9.2h1.08a.5.5 0 0 1 0 1H9.8l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H6.4l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H4.25a.5.5 0 0 1 0-1h1.32L6 6.8H4.93a.5.5 0 0 1 0-1H6.2l.3-1.64a.5.5 0 1 1 .98.18L7.2 5.8h2.4l.3-1.64a.5.5 0 0 1 .58-.4M6.58 9.2h2.4l.44-2.4h-2.4z" class="fg"/>
82
- </symbol>`,jH=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
83
- <path fill="currentColor" d="M12.5 2A2.5 2.5 0 0 1 15 4.5v4.67l-4.05-3.54-4.08 4.08-3-2L1 10.6V4.5A2.5 2.5 0 0 1 3.5 2z" opacity=".3"/>
84
- <path fill="currentColor" d="M15 10.5v1a2.5 2.5 0 0 1-2.5 2.5h-9a2.5 2.5 0 0 1-2.46-2.04L4 9l3 2 4-4zm-7-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>
85
- </symbol>`,MH=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
86
- <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
87
- <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66M3.5 9.5h.98c0 .76.15.92.85.92.77 0 .94-.18.94-1.02V5.1h1v4.34c0 1.54-.35 1.87-1.92 1.87-1.55 0-1.89-.32-1.86-1.8"/>
88
- </symbol>`,NH=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
89
- <path fill="currentColor" d="M13.25 11.5V9.75a.5.5 0 0 1 .36-.48l.55-.15a1.16 1.16 0 0 0 0-2.24l-.55-.15a.5.5 0 0 1-.36-.48V4.5a2.5 2.5 0 0 0-2.5-2.5h-.25a.5.5 0 0 0 0 1h.25a1.5 1.5 0 0 1 1.5 1.5v1.75a1.5 1.5 0 0 0 1.09 1.44l.54.15a.16.16 0 0 1 0 .32l-.54.15a1.5 1.5 0 0 0-1.09 1.44v1.75a1.5 1.5 0 0 1-1.5 1.5h-.25a.5.5 0 0 0 0 1h.25a2.5 2.5 0 0 0 2.5-2.5m-10.5 0V9.75a.5.5 0 0 0-.36-.48l-.55-.15a1.16 1.16 0 0 1 0-2.24l.55-.15a.5.5 0 0 0 .36-.48V4.5A2.5 2.5 0 0 1 5.25 2h.25a.5.5 0 0 1 0 1h-.25a1.5 1.5 0 0 0-1.5 1.5v1.75a1.5 1.5 0 0 1-1.09 1.44l-.54.15a.16.16 0 0 0 0 .32l.54.15a1.5 1.5 0 0 1 1.09 1.45v1.74a1.5 1.5 0 0 0 1.5 1.5h.25a.5.5 0 0 1 0 1h-.25a2.5 2.5 0 0 1-2.5-2.5"/>
90
- </symbol>`,PH=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
91
- <path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
92
- </symbol>`,FH=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
93
- <path fill="currentColor" d="M9.26-.04a3 3 0 0 1 2 .82 2.8 2.8 0 0 1 .8 2.35 2.9 2.9 0 0 1 2.41.8l.03.02a2.74 2.74 0 0 1 0 3.94l-5.8 5.69-.04.06-.02.07q0 .04.02.07.01.04.04.06l1.2 1.17a.55.55 0 0 1 0 .79.6.6 0 0 1-.81 0l-1.2-1.17a1.3 1.3 0 0 1 0-1.84L13.7 7.1a1.65 1.65 0 0 0 .37-1.82 2 2 0 0 0-.37-.54l-.03-.03a1.73 1.73 0 0 0-2.4 0L6.47 9.4l-.07.06a.58.58 0 0 1-.92-.18.6.6 0 0 1 .12-.6l4.85-4.76a1.65 1.65 0 0 0 0-2.36 1.73 1.73 0 0 0-2.4 0l-6.43 6.3a.6.6 0 0 1-.8 0 .55.55 0 0 1 0-.8L7.25.79a3 3 0 0 1 2-.82"/>
94
- <path fill="currentColor" d="M9.26 2.19a.6.6 0 0 1 .52.34.6.6 0 0 1 0 .43l-.12.18L4.9 7.79a1.65 1.65 0 0 0 0 2.36 1.73 1.73 0 0 0 2.4 0l4.75-4.66a.58.58 0 0 1 .93.18.6.6 0 0 1-.12.61l-4.75 4.66a2.9 2.9 0 0 1-4.01 0 2.75 2.75 0 0 1-.62-3.04A3 3 0 0 1 4.1 7l4.74-4.65a.6.6 0 0 1 .4-.16"/>
95
- </symbol>`,IH=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
96
- <defs>
97
- <linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
98
- <stop stop-color="currentColor"/>
99
- <stop offset="1" stop-color="currentColor" stop-opacity="0"/>
100
- </linearGradient>
101
- </defs>
102
- <path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
103
- <path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
104
- <path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
105
- </symbol>`,LH=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
106
- <path fill="currentColor" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z" class="vector" opacity=".2"/>
107
- <path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
108
- </symbol>`,RH=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
109
- <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .5.5V3h3.5a.5.5 0 0 1 .38.83L10.5 7.69v1.44q.41.04.95-.16a4 4 0 0 0 .72-.35l.04-.03h.01a.5.5 0 0 1 .67.1l2 2.5a.5.5 0 0 1 0 .62c-.76.96-3.14 2.69-6.89 2.69s-6.13-1.73-6.89-2.69a.5.5 0 0 1 0-.62l2-2.5a.5.5 0 0 1 .67-.1l.05.03.16.09q.22.13.56.26.54.2.95.16V7.69L2.12 3.83A.5.5 0 0 1 2.5 3H6V1.5a.5.5 0 0 1 .5-.5zM7 3.5a.5.5 0 0 1-.5.5H3.6l2.78 3.17a.5.5 0 0 1 .12.33v2a.5.5 0 0 1-.28.45c-.7.35-1.5.15-2.02-.05a5 5 0 0 1-.58-.26l-1.46 1.84c.82.78 2.8 2.02 5.84 2.02s5.02-1.24 5.84-2.02l-1.46-1.83a5 5 0 0 1-.58.26c-.52.2-1.33.39-2.02.04a.5.5 0 0 1-.28-.45v-2a.5.5 0 0 1 .12-.33L12.4 4H9.5a.5.5 0 0 1-.5-.5V2H7z"/>
110
- </symbol>`,zH=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
111
- <path fill="currentColor" d="M14.5 8a6.5 6.5 0 0 0-5.9-6.47l5.42 8.93A7 7 0 0 0 14.5 8M2.88 12A6.5 6.5 0 0 0 8 14.5c2.08 0 3.93-.98 5.12-2.5zm8.62-1h1.68L11.5 8.24zm-1-.55a4 4 0 0 1-.7.55h.7zM8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M5.5 11h.7a4 4 0 0 1-.7-.55zm-2.68 0H4.5V8.24zm3.76-6.2A4 4 0 0 1 8 4.5q.76 0 1.42.3L8 2.46zM1.5 8q0 1.31.48 2.46L7.4 1.53A6.5 6.5 0 0 0 1.5 8m14 0a7.5 7.5 0 0 1-.99 3.72l-.01.03-.02.03A7.5 7.5 0 0 1 8 15.5a7.5 7.5 0 0 1-6.5-3.75l-.01-.03A7.5 7.5 0 1 1 15.5 8"/>
112
- </symbol>`,BH=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
113
- <path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
114
- <path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
115
- <path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
116
- <path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
117
- </symbol>`,VH=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
118
- <path fill="currentColor" d="M8.33 8.4H10c1.16 0 1.9-.73 1.9-1.86V5.08q0-.24.25-.24h.74c.75 0 1.33.32 1.66.97q.4.73.41 1.46c.09.9.09 1.78-.24 2.67-.25.73-.75 1.3-1.58 1.46h-4.8c-.08 0-.25 0-.25.08v.4s.17.09.25.09h2.82q.34-.02.33.32v1.06c0 .56-.25.97-.75 1.13-.41.16-.83.33-1.24.4a7 7 0 0 1-2.98-.07 3 3 0 0 1-1.16-.49c-.33-.32-.58-.65-.5-1.14v-2.91c0-1.13.67-1.78 1.82-1.78q.89-.1 1.66-.08m2.32 4.86a.65.65 0 0 0-.66-.65c-.34 0-.67.33-.67.65s.33.57.67.65a.65.65 0 0 0 .66-.65" class="bg" opacity=".8"/>
119
- <path fill="currentColor" d="M7.67 7.6H6c-1.16 0-1.9.73-1.9 1.86v1.46q0 .24-.25.24h-.74c-.75 0-1.33-.32-1.66-.97a3 3 0 0 1-.41-1.46 6 6 0 0 1 .24-2.67c.25-.73.75-1.3 1.58-1.46h4.8c.08 0 .25 0 .25-.08v-.4s-.17-.09-.25-.09H4.85c-.24 0-.33-.08-.33-.32V2.65c0-.56.25-.97.75-1.13.41-.16.83-.33 1.24-.4a7 7 0 0 1 2.98.07c.41.09.83.25 1.16.49.33.32.58.65.5 1.13v2.92c0 1.14-.67 1.78-1.82 1.78-.58.08-1.16.08-1.66.08M5.35 2.73c0 .33.25.65.66.65.33 0 .66-.32.66-.65 0-.32-.33-.56-.66-.64a.65.65 0 0 0-.66.64" class="fg"/>
120
- </symbol>`,HH=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
121
- <path fill="currentColor" d="M8 6.65c.73 0 1.31.6 1.31 1.35S8.73 9.35 8 9.35 6.69 8.75 6.69 8 7.27 6.65 8 6.65"/>
122
- <path fill="currentColor" fill-rule="evenodd" d="M8 2.55c1.3-.99 2.59-1.34 3.5-.8.92.55 1.27 1.87 1.08 3.53C14.06 5.94 15 6.9 15 8s-.94 2.06-2.42 2.72c.19 1.65-.16 2.98-1.08 3.52-.91.55-2.2.2-3.5-.8-1.3 1-2.58 1.35-3.5.8-.91-.54-1.27-1.87-1.08-3.52C1.94 10.06 1 9.1 1 8s.94-2.06 2.42-2.72c-.19-1.66.17-2.98 1.08-3.52s2.2-.2 3.5.8M4.26 11.2c-.08 1.34.28 2.03.68 2.26s1.15.22 2.25-.52l.11-.09a12 12 0 0 1-1.24-1.39 11 11 0 0 1-1.8-.41zm7.47-.15q-.83.27-1.79.41-.6.8-1.24 1.4l.11.08c1.1.74 1.86.76 2.25.52.4-.23.76-.92.68-2.26zm-3.04.54a14 14 0 0 1-1.38 0q.34.38.69.7.35-.32.7-.7M8 5.29q-.76 0-1.47.1A13 13 0 0 0 5.07 8a14 14 0 0 0 1.46 2.62 13 13 0 0 0 2.94 0A13 13 0 0 0 10.93 8a14 14 0 0 0-1.46-2.62A13 13 0 0 0 8 5.3M4.64 9.18q-.15.5-.25.96.44.16.94.27a15 15 0 0 1-.7-1.23m6.73 0a15 15 0 0 1-.7 1.23q.5-.11.95-.27a10 10 0 0 0-.25-.96M3.44 6.26C2.27 6.86 1.87 7.53 1.87 8s.4 1.14 1.57 1.74l.13.07q.18-.88.55-1.81a12 12 0 0 1-.55-1.8q-.07.02-.13.06m8.99-.07A12 12 0 0 1 11.88 8q.36.94.55 1.8l.13-.06c1.17-.6 1.56-1.27 1.56-1.74s-.39-1.14-1.56-1.74zm-7.1-.6q-.5.11-.94.27.1.46.25.96a15 15 0 0 1 .69-1.23m5.34 0a15 15 0 0 1 .7 1.23q.14-.5.24-.96-.44-.15-.94-.27M7.18 3.06c-1.09-.74-1.85-.76-2.24-.52s-.76.92-.69 2.26l.01.15a11 11 0 0 1 1.8-.41q.6-.8 1.24-1.4zm3.88-.52c-.4-.24-1.15-.22-2.25.52l-.12.08q.65.6 1.25 1.4.96.15 1.8.41v-.14c.08-1.35-.28-2.04-.68-2.27M8 3.7a10 10 0 0 0-.7.7 14 14 0 0 1 1.4 0 10 10 0 0 0-.7-.7" clip-rule="evenodd"/>
123
- </symbol>`,UH=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
124
- <path fill="currentColor" fill-rule="evenodd" d="M11.04 2c.48 0 .92.23 1.18.6l2.54 3.65c.37.52.3 1.23-.15 1.69l-5.58 5.64a1.47 1.47 0 0 1-2.06 0L1.39 7.94a1.3 1.3 0 0 1-.15-1.7l2.54-3.63q.2-.3.5-.45.33-.16.68-.16zm.84 2.17a.5.5 0 0 0-.7-.05L8 6.84 4.83 4.12a.5.5 0 0 0-.65.76L6.65 7H3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1H9.35l2.48-2.12a.5.5 0 0 0 .05-.7" clip-rule="evenodd"/>
125
- </symbol>`,WH=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
126
- <path fill="currentColor" fill-rule="evenodd" d="M8 .8a.2.2 0 0 1 .18.1l.38.6.16.02.5-.53.01-.01a.2.2 0 0 1 .33.08l.25.68.16.05.59-.43h.02a.2.2 0 0 1 .3.14l.12.71.15.08.65-.3a.2.2 0 0 1 .2.02.2.2 0 0 1 .1.18l-.03.72.12.1.71-.16a.2.2 0 0 1 .25.25l-.17.7q.06.06.1.13l.73-.03A.2.2 0 0 1 14 4a.2.2 0 0 1 .02.2l-.3.66.08.14.71.12a.2.2 0 0 1 .14.32l-.43.59.05.16.68.25a.2.2 0 0 1 .07.35l-.53.49.01.16.62.38a.2.2 0 0 1 0 .36l-.62.38-.01.16.53.5a.2.2 0 0 1-.07.34l-.68.25-.05.16.43.59a.2.2 0 0 1-.14.32l-.72.12-.07.15.3.65a.2.2 0 0 1-.02.2.2.2 0 0 1-.18.1l-.72-.03-.1.13.16.7a.2.2 0 0 1-.25.25l-.7-.17-.13.1.03.73a.2.2 0 0 1-.1.18.2.2 0 0 1-.2.02l-.66-.3-.14.08-.12.71a.2.2 0 0 1-.32.14l-.59-.43-.16.05-.25.68a.2.2 0 0 1-.34.07l-.5-.53-.16.01-.38.62a.2.2 0 0 1-.36 0l-.38-.62-.16-.01-.5.53a.2.2 0 0 1-.34-.07l-.25-.68-.16-.05-.59.43a.2.2 0 0 1-.32-.14L5 13.78l-.15-.07-.65.3a.2.2 0 0 1-.2-.02.2.2 0 0 1-.1-.18l.03-.72-.13-.1-.7.16a.2.2 0 0 1-.25-.25l.17-.7-.1-.13-.73.03a.2.2 0 0 1-.2-.3l.3-.66-.08-.14-.71-.12a.2.2 0 0 1-.14-.32l.43-.59-.05-.16-.68-.25A.2.2 0 0 1 1 9.22l.53-.5-.02-.16-.6-.38A.2.2 0 0 1 .8 8a.2.2 0 0 1 .1-.18l.6-.38.02-.16-.53-.5a.2.2 0 0 1 .07-.34l.68-.25.05-.16-.43-.59a.2.2 0 0 1 .14-.32L2.2 5l.08-.15L2 4.2a.2.2 0 0 1 .2-.3l.72.03.1-.13-.16-.7a.2.2 0 0 1 .25-.25l.7.16.13-.1-.03-.72A.2.2 0 0 1 4 2a.2.2 0 0 1 .2-.02l.65.3L5 2.2l.12-.71v-.03a.2.2 0 0 1 .32-.1l.59.41.16-.04.25-.68.01-.02A.2.2 0 0 1 6.8.99l.49.53.16-.02.38-.61.02-.02A.2.2 0 0 1 8 .79M6.8 9.45h1.26l.06.01q.03.01.03.05v1.52q0 .07-.09.06h-4.5A5.4 5.4 0 0 0 8 13.42a5.4 5.4 0 0 0 4.45-2.33h-2.42c-.36 0-.68-.5-.77-.75-.08-.22-.2-.91-.25-1.12-.15-.61-.59-.71-.78-.73H6.8zM8 2.58a5.4 5.4 0 0 0-4.07 1.85h5.74l.17.02c.23.03.6.12.96.35.34.23.83.68.83 1.4 0 .66-.55 1.16-1.08 1.5.42.33.7.53.86 1.44.04.17.34.32.62.29.29-.03.62-.16.62-.75v-.24q0-.1.07-.1h.68A5.43 5.43 0 0 0 8 2.59M2.96 6.03a5.4 5.4 0 0 0-.19 3.37h1.66V6.03zM6.8 7.06h1.66c.35 0 .77-.12.77-.47 0-.42-.55-.53-.65-.53H6.8z" clip-rule="evenodd"/>
127
- </symbol>`,GH=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
128
- <path fill="currentColor" fill-rule="evenodd" d="M8.08 1.44c2.41-.91 4.96-.37 5.35 1.27.39 1.62-.92 3.56-2.6 4.25a5 5 0 0 1-3.26.35c-.58-.2-.92-.62-1-.85-.03-.09-.09-.24 0-.3.05-.03.08-.02.22.15s.7.6 1.75.48c2.78-.34 4.45-2.64 3.92-3.88-.37-.87-2.5-1.26-5.18.16C4.03 4.81 3.85 6.24 3.82 6.8c-.08 1.5 1.73 2.28 2.7 3.4q.04.03.07.08c.3-.12.7-.19 1.35-.2 1.58-.03 2.47 1.08 2.43 2.08-.03.78-.7 1.1-.82 1.13-.1.01-.14.02-.15-.06q-.03-.06.13-.15c.16-.09.42-.3.48-.72.05-.43-.24-1.44-1.76-1.63a3 3 0 0 0-1.33.08c.27.62.32 1.87-.29 2.83-.63 1-1.8 1.61-2.93 1.27-.37-.1-.93-.92-.45-2.05.46-1.07 2.4-2.12 2.66-2.26-.9-.83-3.08-1.95-3.4-3.65-.08-.49.13-1.65 1.46-2.98a12 12 0 0 1 4.11-2.52m-1.88 9.7c-.01.01-.9.47-1.52 1.17-.59.66-.75 1.48-.43 1.69.3.18 1-.04 1.51-.62a3 3 0 0 0 .5-.9q.2-.64.02-1.39z" clip-rule="evenodd"/>
129
- </symbol>`,KH=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
130
- <path fill="currentColor" d="M4 3v3.5l1.5-1L7 15 .5 6l1-1.5L0 3l2.5-2h1zm12 0-1.5 1.5 1 1.5L9 15l1.5-9.5 1.5 1V3l.5-2h1zm-8 8.5a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1"/>
131
- <path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
132
- </symbol>`,qH=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
133
- <path fill="currentColor" d="m3.98 3.7 3.36-2.08a4.5 4.5 0 0 1 5.9 1.23 4 4 0 0 1 .7 3.02q-.16.75-.58 1.4c.42.77.56 1.66.4 2.52a3.7 3.7 0 0 1-1.57 2.4l-.17.1-3.36 2.09a4.5 4.5 0 0 1-5.9-1.23 4 4 0 0 1-.66-1.44 4 4 0 0 1-.04-1.58 4 4 0 0 1 .58-1.4 4 4 0 0 1-.4-2.52 3.7 3.7 0 0 1 1.57-2.4zl3.36-2.08zm7.87 0a2.7 2.7 0 0 0-1.26-.95 2.7 2.7 0 0 0-1.6-.07 3 3 0 0 0-.52.2l-.16.09-3.36 2.08a2 2 0 0 0-.69.64 2 2 0 0 0-.36.86 2.3 2.3 0 0 0 .42 1.81A2.7 2.7 0 0 0 7.18 9.4q.28-.06.53-.2l.16-.09 1.28-.79.2-.09a.8.8 0 0 1 .87.31.7.7 0 0 1 .13.55.7.7 0 0 1-.24.4l-.08.05-3.36 2.08-.2.09a1 1 0 0 1-.49-.02 1 1 0 0 1-.38-.3 1 1 0 0 1-.13-.37v-.1l.01-.13-.13-.03a4 4 0 0 1-1.1-.5l-.2-.14-.18-.12-.07.18-.08.3a2.3 2.3 0 0 0 .43 1.82q.45.64 1.19.93.73.28 1.51.14l.16-.04q.27-.07.52-.2l.16-.09 3.36-2.08q.4-.25.69-.64.27-.4.36-.86a2.3 2.3 0 0 0-.42-1.82 2.7 2.7 0 0 0-1.27-.95 2.7 2.7 0 0 0-1.6-.08q-.27.07-.52.2l-.16.1-1.28.79-.2.09a1 1 0 0 1-.49-.03 1 1 0 0 1-.38-.29.7.7 0 0 1-.13-.54.7.7 0 0 1 .24-.4l.08-.06L9.33 4.4l.2-.1a.8.8 0 0 1 .87.32 1 1 0 0 1 .13.38v.22l.11.04q.6.18 1.12.5l.2.14.17.12.06-.19.08-.3a2.3 2.3 0 0 0-.42-1.81z"/>
134
- </symbol>`,JH=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
135
- <path fill="currentColor" d="M5 7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z"/>
136
- <path fill="currentColor" d="M6 1a5 5 0 0 1 4.58 3H7a3 3 0 0 0-3 3v3.58A5 5 0 0 1 6 1" opacity=".5"/>
137
- </symbol>`,YH=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
138
- <path fill="currentColor" d="M9.43 4.8A.6.6 0 1 1 9.19 6l-.56.96a1.2 1.2 0 0 1 .32 1.58l.7.53a.89.89 0 1 1-.17.22l-.7-.52a1.2 1.2 0 0 1-1.4.25l-.56.87a.75.75 0 1 1-.57-.2 1 1 0 0 1 .32.05l.56-.87a1.2 1.2 0 0 1-.4-1.24l-1.2-.47a.56.56 0 1 1 .1-.28v.02l1.2.47a1.2 1.2 0 0 1 1.56-.55l.56-.97a.6.6 0 0 1-.15-.64.6.6 0 0 1 .63-.4"/>
139
- <path fill="currentColor" fill-rule="evenodd" d="M9.17 1q.16.63.27 1.26a6 6 0 0 1 1.61.67q.52-.38 1.08-.71l1.65 1.64q-.32.56-.68 1.05.48.78.72 1.67.6.09 1.18.25v2.32q-.55.15-1.11.24a6 6 0 0 1-.7 1.82q.31.44.59.91l-1.65 1.65-.85-.55a6 6 0 0 1-1.9.83q-.08.47-.2.95H6.84q-.12-.46-.2-.93a6 6 0 0 1-1.96-.81q-.39.27-.8.51l-1.65-1.65q.25-.43.53-.84a6 6 0 0 1-.75-1.9L1 9.16V6.83q.54-.14 1.09-.24a6 6 0 0 1 .77-1.74q-.33-.47-.63-.98l1.65-1.65q.54.32 1.03.68a6 6 0 0 1 1.66-.66q.1-.61.26-1.24zM7.96 3.73a4 4 0 0 0-1.74.36 4.5 4.5 0 0 0-2.3 2.3 4.4 4.4 0 0 0-.1 3.29l.03.06a4.4 4.4 0 0 0 2.4 2.47 4.4 4.4 0 0 0 3.48-.02l.03-.02a4.4 4.4 0 0 0 2.3-2.42l.06-.14a4.4 4.4 0 0 0-.2-3.4 4.4 4.4 0 0 0-2.13-2.07L9.47 4a4 4 0 0 0-1.51-.27" clip-rule="evenodd"/>
140
- </symbol>`,XH=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
141
- <path fill="currentColor" d="M9.63 1c6.15 4.35 4.16 9.15 4.16 9.15s1.75 2.05 1.04 3.85c0 0-.72-1.26-1.93-1.26-1.17 0-1.85 1.26-4.2 1.26C3.47 14 1 9.46 1 9.46c4.71 3.22 7.93.94 7.93.94C6.8 9.12 2.29 3 2.29 3c3.93 3.47 5.63 4.39 5.63 4.39-1.01-.87-3.86-5.13-3.86-5.13C6.34 4.66 10.86 8 10.86 8c1.28-3.7-1.23-7-1.23-7"/>
142
- </symbol>`,ZH=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
143
- <path fill="currentColor" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" opacity=".4"/>
144
- <path fill="currentColor" d="M11.5 8a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5zM5 12h2.5v-1H5zm3.5 0H11v-1H8.5zM5 10h2.5V9H5zm3.5 0H11V9H8.5zm1-9a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
145
- </symbol>`,QH=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
146
- <path fill="currentColor" fill-rule="evenodd" d="M8 4Q5.2 4 4.5 6.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C8.98 7.23 9.77 8 11.5 8q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C10.52 4.77 9.73 4 8 4M4.5 8Q1.7 8 1 10.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C5.48 11.23 6.26 12 8 12q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C7.02 8.77 6.24 8 4.5 8" clip-rule="evenodd"/>
147
- </symbol>`,$H=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
148
- <path fill="currentColor" d="M1 0v5.05l4.35 2.53V2.53zm9.18 5.34L5.83 2.82v5.05l4.35 2.53zm.47 5.06V5.34L15 2.82v5.05zm-.48 5.6-4.35-2.53V8.42l4.35 2.53z"/>
149
- </symbol>`,eU=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
150
- <path fill="currentColor" fill-rule="evenodd" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" clip-rule="evenodd" opacity=".4"/>
151
- <path fill="currentColor" d="M8.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zm2-2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm-1-8a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z"/>
152
- </symbol>`,tU=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
153
- <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
154
- <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66m-3 1.57V5.99H3.5v-.9h4.21v.9H6.1v5.22z"/>
155
- </symbol>`,nU=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
156
- <path fill="currentColor" d="M8.57 14.87c-.18.26-.55.11-.55-.22v-3.18l-.05-.27-.13-.22-.2-.15-.24-.06H4.29c-.26 0-.4-.32-.26-.55L6.08 7c.3-.46 0-1.1-.5-1.1H1.8c-.25 0-.4-.32-.25-.56l2.65-4.2A.3.3 0 0 1 4.46 1h7.9c.26 0 .4.32.26.55l-2.05 3.23c-.29.46 0 1.1.5 1.1h3.12c.26 0 .4.34.24.57z"/>
157
- </symbol>`,rU=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
158
- <path fill="currentColor" d="m5.11 9.68-2.4 1.84a.6.6 0 0 1-.75-.04l-.77-.7a.6.6 0 0 1 0-.87L3.28 8zm5.52-8.42a.51.51 0 0 1 .87.36V4.8L7.32 8 5.1 6.32z" opacity=".75"/>
159
- <path fill="currentColor" d="M11.1 14.99h.03zM1.96 4.52a.6.6 0 0 1 .75-.04l8.8 6.71v3.19a.51.51 0 0 1-.88.36L1.19 6.1a.6.6 0 0 1 0-.87z" opacity=".65"/>
160
- <path fill="currentColor" d="M11.62 14.91a.9.9 0 0 1-1-.17.51.51 0 0 0 .88-.36V1.62a.51.51 0 0 0-.87-.36.9.9 0 0 1 1-.17l2.87 1.39a.9.9 0 0 1 .5.8v9.44a.9.9 0 0 1-.5.8z"/>
161
- </symbol>`,iU=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
162
- <path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
163
- <path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
164
- </symbol>`,aU=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
165
- <path fill="currentColor" d="M13 1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h3a2 2 0 1 0 4 0z" class="subtract" opacity=".2"/>
166
- <path fill="currentColor" d="M4.64 11.4h.02l.8-3.4h.91l.73 3.45L7.88 8h.96l-1.25 5h-.97L5.9 9.6 5.1 13h-1L3 8h.98z"/>
167
- <path fill="currentColor" fill-rule="evenodd" d="M13 13h-1.02l-.33-1.11H9.9L9.64 13h-.97l1.26-5h1.54zm-2.49-3.77-.42 1.84h1.32l-.49-1.84z" clip-rule="evenodd"/>
168
- </symbol>`,oU=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
169
- <path fill="currentColor" d="M14.1 11.79 8.26 15v-2.5l3.64-1.94zm.4-.35V4.73l-2.14 1.2v4.3zm-12.6.35L7.74 15v-2.5L4.1 10.56zm-.4-.35V4.73l2.14 1.2v4.3zm.25-7.15 6-3.29v2.42L3.9 5.47l-.03.01zm12.5 0L8.25 1v2.42l3.85 2.05.03.01z" class="bg" opacity=".4"/>
170
- <path fill="currentColor" d="m7.74 11.93-3.59-1.92v-3.8l3.6 2.02zm.52 0 3.59-1.92v-3.8l-3.6 2.02zM4.4 5.77 8 3.85l3.6 1.93L8 7.8z" class="fg"/>
171
- </symbol>`,sU=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
172
- <path fill="currentColor" d="M7.5 2A1.5 1.5 0 0 1 9 3.5v3A1.5 1.5 0 0 1 7.5 8h-2v2A1.5 1.5 0 0 0 7 11.5v-1A1.5 1.5 0 0 1 8.5 9h5a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 7 13.5v-1A2.5 2.5 0 0 1 4.5 10V8h-2A1.5 1.5 0 0 1 1 6.5v-3A1.5 1.5 0 0 1 2.5 2zm1 8a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm-6-7a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5z"/>
173
- </symbol>`,cU=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
174
- <path fill="currentColor" d="m14.73 1.5-7.29 8.82h4.17l-1.73 2.04H5.76L1.27 14.5l7.3-8.91H4.39l1.73-2.05h4.12z"/>
175
- <path fill="currentColor" d="M5.21 3.54 3.56 5.6h-.55v4.73h.83L2.1 12.36H1V3.54zm9.79 0v8.82h-4.3l1.74-2.04h.55V5.68h-.83l1.74-2.14z"/>
176
- </symbol>`,lU=[pH,vH,bH,xH,SH,CH,EH,DH,OH,AH,jH,MH,NH,PH,FH,VH,UH,WH,XH,ZH,eU,tU,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
177
- <path fill="currentColor" d="M4.585 2a2 2 0 0 1 1.028.285l1.788 1.072a1 1 0 0 0 .514.143H12A2 2 0 0 1 13.935 5H0V4a2 2 0 0 1 2-2z" class="bg" opacity=".5"/>
178
- <path fill="currentColor" fill-rule="evenodd" d="M14 12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-1.25h1v-1H0V6h14zM9.9 8.25c-.883 0-1.9.5-1.9.5H7v1h1v1s1.017.5 1.9.5c.884 0 1.6-.672 1.6-1.5s-.716-1.5-1.6-1.5M2 9.75v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1zm-5-1v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1z" class="fg" clip-rule="evenodd"/>
179
- </symbol>`],uU=[dH,fH,mH,hH,gH,_H,yH,wH,TH,kH,IH,LH,RH,zH,BH,HH,GH,KH,qH,JH,YH,QH,$H,nU,rU,iU,aU,oU,sU,cU];function dU(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
180
- `)}\n</svg>`)}var fU=dU(uH,lU),pU={minimal:uH,standard:fU,complete:dU(fU,uU)},mU={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},hU={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},gU={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},_U=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),vU=new Set([`complete`]);function yU(e){return pU[e===`none`?`minimal`:e]}function bU(e){return`file-tree-builtin-${e}`}function xU(e){return e!==`none`&&vU.has(e)}function SU(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=mU[t.toLowerCase()];if(i!=null&&(r||_U.has(i)))return i;for(let e of n){if(r){let t=gU[e];if(t!=null)return t}let t=hU[e];if(t!=null&&(r||_U.has(t)))return t}return`default`}var CU=`file-tree-container`,wU=`data-file-tree-style`,TU=`data-file-tree-unsafe-css`,EU=`data-file-tree-scrollbar-measure`,DU=`data-file-tree-scrollbar-gutter-measured`,OU=`--trees-scrollbar-gutter-measured`,kU=`header`,AU=`context-menu`,jU=`context-menu-trigger`;function MU(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function NU(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(MU(e)?`none`:`complete`),colored:e.colored??!0}}var PU=e=>e.trim().toLowerCase(),FU=e=>e.split(`/`).at(-1)??e,IU=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function LU(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function RU(e){let t=NU(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(PU(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let n=FU(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return LU(c,e);for(let[t,n]of a)if(s.includes(t))return LU(n,e);let l=IU(n);for(let t of l){let n=i.get(t);if(n!=null)return LU(n,e)}let u=SU(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:bU(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:LU(s,e)}}}var zU=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,BU=/^0(?:\.0+)?%?$/;function VU(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function HU(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||zU.test(t))return!0;let n=VU(t);return n!=null&&BU.test(n)}function UU(e){return HU(e)?void 0:e}function WU(e){let t=e.colors??{},n=t[`sideBar.background`]??t[`editor.background`]??e.bg,r=t[`sideBar.foreground`]??t[`editor.foreground`]??e.fg,i=t[`sideBar.border`],a=t[`list.activeSelectionForeground`]??t[`sideBar.foreground`],o=n?.toLowerCase(),s=t[`list.hoverBackground`],c=s?.toLowerCase()===o?void 0:s,l=t[`list.activeSelectionBackground`],u=l?.toLowerCase()===o?t[`list.focusBackground`]??t[`editor.selectionBackground`]:l??t[`editor.selectionBackground`],d=UU(t[`list.focusOutline`])??UU(t.focusBorder),f=t[`input.background`]??n,p=t[`input.border`],m=t[`scrollbarSlider.background`],h=t[`sideBarSectionHeader.foreground`]??r,g=t[`gitDecoration.addedResourceForeground`]??t[`terminal.ansiGreen`]??t[`editorGutter.addedBackground`],_=t[`gitDecoration.modifiedResourceForeground`]??t[`terminal.ansiBlue`]??t[`editorGutter.modifiedBackground`],v=t[`gitDecoration.deletedResourceForeground`]??t[`terminal.ansiRed`]??t[`editorGutter.deletedBackground`],y=e.type===`dark`,b={colorScheme:y?`dark`:`light`,backgroundColor:n??``,color:r??``,borderColor:`var(--trees-theme-sidebar-border, light-dark(oklch(0% 0 0 / 0.15), oklch(100% 0 0 / 0.15)))`,"--trees-theme-sidebar-bg":n??``,"--trees-theme-sidebar-fg":r??``,"--trees-theme-sidebar-header-fg":h??``,"--trees-theme-list-active-selection-fg":a??r??``,"--trees-theme-list-hover-bg":c??(y?`rgba(255,255,255,0.08)`:`rgba(0,0,0,0.06)`),"--trees-theme-list-active-selection-bg":u??`transparent`,"--trees-theme-focus-ring":d??r??``,"--trees-theme-input-bg":f??``};return i!=null&&i!==``&&(b[`--trees-theme-sidebar-border`]=i),p!=null&&p!==``&&(b[`--trees-theme-input-border`]=p),m!=null&&m!==``&&(b[`--trees-theme-scrollbar-thumb`]=m),g!=null&&g!==``&&(b[`--trees-theme-git-added-fg`]=g),_!=null&&_!==``&&(b[`--trees-theme-git-modified-fg`]=_),v!=null&&v!==``&&(b[`--trees-theme-git-deleted-fg`]=v),b}var GU=5,KU=1<<GU,qU=KU*4;function JU(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function YU(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function XU(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 ZU(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 QU(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function $U(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 eW(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,iW(e,t)}function tW(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=ZU(e).get(t);if(i===void 0)return;let a=i>>GU;e.childVisibleChunkSums[a]+=r}function nW(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=aW(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=KU}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 rW(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>GU;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<GU}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 iW(e,t){if(t.childIds.length<qU){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/KU),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>>GU]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function aW(e,t,n,r){let i=Math.min(t.childIds.length,n+KU),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 oW=7,sW=3,cW=1<<sW,lW=4;function uW(e,t,n=0){return e<<lW|n<<sW|t}function dW(e){return e.depthAndFlags>>>lW}function fW(e){return(e.depthAndFlags&cW)>>sW}function pW(e){return(e.depthAndFlags&cW)!==0}function mW(e){return e.depthAndFlags&oW}function hW(e,t){return(mW(e)&t)!==0}function gW(e,t){e.depthAndFlags|=t}function _W(e,t){e.depthAndFlags=uW(t,mW(e),fW(e))}var vW=Symbol(`benchmarkInstrumentation`);function yW(e,t){return t==null||Object.defineProperty(e,vW,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function bW(e){return e==null?null:e[vW]??null}function xW(e,t,n){return e==null?n():e.measurePhase(t,n)}function SW(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function CW(e){return e>=48&&e<=57}function wW(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!CW(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&&CW(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 TW(e){let t=e.toLowerCase();return{lowerValue:t,tokens:wW(t)}}function EW(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 DW(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=EW(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function OW(e,t,n){let r=DW(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function kW(e,t){return OW(e,t,TW)}function AW(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function jW(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=AW(e,r);return a===AW(t,r)?kW(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 MW(e,t){return jW(e,t)}function NW(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=TW(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=AW(e,n);return o===AW(t,n)?OW(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 PW(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=TW(r);return e.sortKeyById[t]=i,i}function FW(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function IW(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 LW(e){let{hasTrailingSlash:t,segments:n}=IW(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function RW(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=IW(e);return{requiresDirectory:t,segments:n}}var zW=``;function BW(){let e=new Map;return e.set(zW,0),{idByValue:e,valueById:[zW],sortKeyById:[TW(zW)]}}function VW(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 HW(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var UW=Symbol(`pathStorePreparedInputKind`);function WW(e,t){return e[UW]=t,e}function GW(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function KW(e,t,n){return n===`default`?MW(e,t):n(GW(e),GW(t))}function qW(){return{depthAndFlags:uW(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function JW(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 YW(e){return e.isDirectory?e.segments.length:e.segments.length-1}function XW(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 ZW(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function QW(e,t={}){return iG(e,t).map(e=>e.path)}function $W(e,t={}){let n=iG(e,t);return WW({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function eG(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 WW({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function tG(e){let t=e,n=t.preparedPaths;if(t[UW]===`prepared`&&n!=null)return n;if(!XW(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function nG(e){let t=e;return t[UW]===`presorted`&&t.presortedPaths!=null||ZW(t.presortedPaths)?t.presortedPaths:null}function rG(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function iG(e,t={}){let n=FW(t),r=bW(t);SW(r,`workload.inputFiles`,e.length);let i=xW(r,`store.preparePathEntries.parse`,()=>e.map(e=>LW(e)));return xW(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>KW(e,t,n.sort))),i}var aG=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[qW()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=BW();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=bW(e),this.options=FW(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,JU())}appendPaths(e){return xW(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>LW(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,xW(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return xW(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:uW(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:uW(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:uW(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=LW(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:uW(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:uW(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=LW(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(xW(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||xW(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`?NW(this.lastPreparedPath,e,this.segmentSortKeyCache):KW(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=YW(e),i=n==null?0:YW(n),a=n==null?0:JW(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=VW(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:uW(dW(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),QU(i,s),s}createFileChildUnchecked(e,t){let n=VW(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:uW(dW(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),QU(r,a),a}getOrCreateDirectoryChild(e,t){let n=VW(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&&!pW(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:uW(dW(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),QU(r,a),this.directories.set(a,JU()),a}createDirectoryChild(e,t){let n=VW(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:uW(dW(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),QU(r,a),this.directories.set(a,JU()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!pW(n))throw Error(`Path is not a directory: "${t}"`);if(hW(n,1))throw Error(`Duplicate path: "${t}"`);gW(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,YU());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(pW(a)){let t=YU();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;pW(n)&&this.directories.set(t,JU());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),QU(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!pW(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 eW(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function oG(e,t=`closed`,n=null){let r=cG(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 sG(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function cG(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 lG(e,t){return hW(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:dW(t)<=e.defaultExpansion}function uG(e,t,n=e.snapshot.nodes[t]){return n==null||!pW(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:lG(e,n)}function dG(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!pW(r))return;let i=lG(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 fG(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 pG(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function mG(e,t){let n=fG(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 hG(e,t){let n=fG(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function gG(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 _G(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function vG(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 yG(e,t){e.directoryLoadInfoById.delete(t)}function bG(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 xG(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function SG(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function CG(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function wG(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function TG(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function EG(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function DG(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 OG(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 kG(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 AG(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 jG(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 MG(e,t,n){return{...n,visibleCountDelta:UG(e)-t}}function NG(e,t){let n=UG(e),r=sG();e.transactionStack.push(r);try{t()}catch(t){throw IG(e,r,!1),t}IG(e,r,!0,UG(e)-n)}function PG(e,t){let n=e.instrumentation;if(n==null){FG(e,t);return}xW(n,`store.events.record`,()=>FG(e,t))}function FG(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){VG(e,t);return}n.events.push(t),BG(n,t)}function IG(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?zG(i,t):xW(n,`store.events.batch.merge`,()=>zG(i,t));return}let a=LG(t,r),o=e.instrumentation;if(o==null){VG(e,a);return}xW(o,`store.events.batch.commit`,()=>VG(e,a))}function LG(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 RG(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function zG(e,t){for(let n of t.events)e.events.push(n);RG(e,t)}function BG(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function VG(e,t){let n=e.instrumentation;if(n==null){HG(e,t);return}xW(n,`store.events.emit`,()=>HG(e,t))}function HG(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function UG(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function WG(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!pW(n)||hW(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||!pW(a)?null:i}function GG(e,t){let n=t;for(;;){let t=WG(e,n);if(t==null)return n;n=t}}function KG(e,t){let n=[t],r=t;for(;;){let t=WG(e,r);if(t==null)return n;n.push(t),r=t}}function qG(e,t){let n=t==null?e.snapshot.rootId:rK(e,t);return n==null?[]:sK(e,n)}function JG(e,t){let n=LW(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=SK(e,xK(e,r)),{createdNodeIds:a,directoryId:o}=cK(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=oK(e,o);if(hW(n,1))throw Error(`Path already exists: "${t}"`);gW(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=uK(e,o,n.basename),s.add(c);eK(e,o);let l=SK(e,o);return xG({affectedAncestorIds:nK(e,c),affectedNodeIds:[...s],path:t,projectionChanged:CK(i,l)})}function YG(e,t,n){let r=rK(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=oK(e,r);if(hW(i,2))throw Error(`The root node cannot be removed`);if(pW(i)&&aK(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=SK(e,a),s=yK(e,r);pK(e,a,r,i.nameId),bK(e,a),eK(e,a);let c=SK(e,a);return SG({affectedAncestorIds:nK(e,a),affectedNodeIds:s,path:t,projectionChanged:CK(o,c),recursive:n.recursive===!0})}function XG(e,t,n,r){let i=rK(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=oK(e,i);if(hW(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=_K(e,i,n),c=SK(e,a.parentId),l=SK(e,s.parentId),u=HW(e.snapshot.segmentTable,a.nameId),d=VW(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(pW(a)&&DK(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=XU(e.snapshot.nodes,aK(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&vK(e,p,o,fW(a))===`skip`)return null;let m=a.parentId;pK(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),EK(e,i),fK(e,s.parentId,i),bK(e,m),e.pathCacheVersion++,eK(e,m),s.parentId!==m&&eK(e,s.parentId);let h=SK(e,m),g=SK(e,s.parentId);return CG({affectedAncestorIds:[...new Set([...nK(e,m),...nK(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:wK([c,l],[h,g]),to:$G(e,i)})}function ZG(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function QG(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function $G(e,t){let n=oK(e,t),r=ZG(e,t);if(r!=null)return r;if(hW(n,2))return QG(e,t,``);let i=$G(e,n.parentId),a=HW(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return QG(e,t,pW(n)?`${o}/`:o)}function eK(e,t){let n=e.instrumentation;if(n==null){kK(e,t);return}xW(n,`store.recomputeCountsUpwardFrom`,()=>kK(e,t))}function tK(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||!pW(o)){OK(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){OK(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function nK(e,t){let n=[],r=t;for(;r!=null;){let t=oK(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function rK(e,t){if(t.length===0)return e.snapshot.rootId;let n=RW(t);return iK(e,n.segments,n.requiresDirectory)}function iK(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=aK(e,r),a=XU(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=oK(e,r);return n&&!pW(i)?null:r}function aK(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 oK(e,t){let n=e.snapshot.nodes[t];if(n===void 0||hW(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function sK(e,t){let n=e.snapshot.nodes[t];if(n===void 0||hW(n,4))return[];if(!pW(n))return[$G(e,t)];if(aK(e,t).childIds.length===0)return hW(n,1)&&!hW(n,2)?[$G(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||hW(n,4)){i.pop();continue}if(!pW(n)){r.push($G(e,t.nodeId)),i.pop();continue}let a=aK(e,t.nodeId);if(a.childIds.length===0){hW(n,1)&&!hW(n,2)&&r.push($G(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 cK(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=VW(e.snapshot.segmentTable,i),a=aK(e,r),o=XU(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!pW(oK(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=lK(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function lK(e,t,n){let r=oK(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:uW(dW(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,JU()),fK(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function uK(e,t,n){let r=VW(e.snapshot.segmentTable,n),i=aK(e,t);if(XU(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${jK(e,t,n)}"`);let a=oK(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:uW(dW(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),fK(e,t,o),e.activeNodeCount++,o}function dK(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}mK(e,n,o)<0?i=a:r=a+1}return r}function fK(e,t,n){let r=aK(e,t),i=oK(e,n);XU(e.snapshot.nodes,r).set(i.nameId,n),tW(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=dK(e,r,n);r.childIds.splice(a,0,n),$U(r,a),iW(e.snapshot.nodes,r)}function pK(e,t,n,r){let i=aK(e,t),a=ZU(i),o=a.get(n)??-1;XU(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&tW(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),$U(i,o),iW(e.snapshot.nodes,i))}function mK(e,t,n){let r=e.snapshot.options.sort;return r===`default`?hK(e,t,n):r(gK(e,t),gK(e,n))}function hK(e,t,n){let r=oK(e,t),i=oK(e,n),a=pW(r);if(a!==pW(i))return a?-1:1;let o=DW(PW(e.snapshot.segmentTable,r.nameId),PW(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=HW(e.snapshot.segmentTable,r.nameId),c=HW(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function gK(e,t){let n=oK(e,t),r=$G(e,t),i=pW(n),a=i?r.slice(0,-1):r;return{basename:HW(e.snapshot.segmentTable,n.nameId),depth:dW(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function _K(e,t,n){let r=oK(e,t),i=rK(e,n);if(i!=null){let t=oK(e,i);if(pW(t))return{basename:HW(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=RW(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=RW(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:iK(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function vK(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${$G(e,t)}"`);let i=oK(e,t);if(fW(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(pW(i)&&aK(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return yK(e,t),pK(e,a,t,o),bK(e,a),eK(e,a),`handled`}function yK(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=oK(e,t.nodeId);if(t.visitedChildren||!pW(i)){pW(i)&&e.snapshot.directories.delete(t.nodeId),gW(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),yG(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=aK(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 bK(e,t){let n=t;for(;n!=null;){let t=oK(e,n);if(!pW(t)||hW(t,2)||aK(e,n).childIds.length>0)return;gW(t,1),n=t.parentId===n?null:t.parentId}}function xK(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=XU(e.snapshot.nodes,aK(e,n)).get(t);if(i==null||!pW(oK(e,i)))break;n=i}return n}function SK(e,t){let n=TK(e,t);if(n==null)return null;let r=GG(e,n),i=oK(e,r),a=n===r?null:KG(e,n).map(t=>$G(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:aK(e,r).childIds.length>0,path:$G(e,r),terminalKind:fW(i)})}function CK(e,t){return wK([e],[t])}function wK(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 TK(e,t){let n=t;for(;n!=null;){let t=oK(e,n);if(!pW(t)||hW(t,2))return null;if(!uG(e,n,t))return n;n=t.parentId}return null}function EK(e,t){let n=oK(e,t);if(_W(n,(t===e.snapshot.rootId?-1:dW(oK(e,n.parentId)))+1),!pW(n))return;let r=aK(e,t);for(let t of r.childIds)EK(e,t)}function DK(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=oK(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function OK(e,t,n=oK(e,t),r=!1){let i=e.instrumentation;if(i==null){AK(e,t,n,r);return}xW(i,`store.recomputeNodeCounts`,()=>AK(e,t,n,r))}function kK(e,t){let n=t;for(;n!=null;){let t=oK(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(OK(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&tW(aK(e,s),n,a,o),n=s}}function AK(e,t,n,r){if(!pW(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=aK(e,t);if(r){let t=e.instrumentation;t==null?eW(e.snapshot.nodes,i):xW(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>eW(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,hW(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=WG(e,t)==null?uG(e,t,n)?1+o:1:o}function jK(e,t,n){let r=$G(e,t);return r.length===0?n:`${r}${n}`}function MK(e){return e!=null&&!hW(e,4)}function NK(e,t){let n=e.snapshot.nodes[t];return!MK(n)||!pW(n)||hW(n,2)?null:n}function PK(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&MK(e.snapshot.nodes[n])&&(t+=1);return t}function FK(e){return Math.max(0,e.valueById.length-1)}function IK(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:PK(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:FK(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function LK(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 RK(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)NK(e,n)!=null&&t.push($G(e,n));for(let t of e.expandedDirectoryIds)NK(e,t)!=null&&n.push($G(e,t));return{collapsedPaths:t,expandedPaths:n}}function zK(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)NK(e,n)==null||pG(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:$G(e,n)});return t}function BK(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=rK(e,n);t!=null&&dG(e,t,!0,oK(e,t))}for(let n of t.collapsedPaths){let t=rK(e,n);t!=null&&dG(e,t,!1,oK(e,t))}}function VK(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=rK(e,n.path);t!=null&&NK(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function HK(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function UK(e){let t=e.snapshot.segmentTable,n=BW();for(let r of e.snapshot.nodes)if(MK(r)){if(hW(r,2)){r.nameId=0;continue}r.nameId=VW(n,HW(t,r.nameId))}e.snapshot.segmentTable=n}function WK(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!MK(r)||!pW(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return MK(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[oK(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),eW(e.snapshot.nodes,n)}}function GK(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(MK(n))break;--t}e.snapshot.nodes.length=t+1}function KK(e){let t=RK(e),n=zK(e);xW(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>HK(e)),xW(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>UK(e)),xW(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>WK(e)),xW(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>GK(e)),xW(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>BK(e,t)),xW(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>VK(e,n)),xW(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>tK(e,e.snapshot.rootId))}function qK(e){let t=RK(e),n=zK(e),r=xW(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>qG(e)),i=yW({...e.snapshot.options},e.instrumentation),a=xW(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new aG(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,xW(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>BK(e,t)),xW(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>VK(e,n)),xW(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>tK(e,e.snapshot.rootId))}function JK(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function YK(e,t){let n=IK(e);t===`stable`?xW(e.instrumentation,`store.cleanup.stable`,()=>KK(e)):xW(e.instrumentation,`store.cleanup.aggressive`,()=>qK(e));let r=IK(e);return LK(t,t===`stable`,n,r)}var XK=64;function ZK(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 QK(e){return oK(e,e.snapshot.rootId).visibleSubtreeCount}function $K(e,t,n,r){let i=oK(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function eq(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:yq(e,t.cursor),setSize:t.setSize,subtreeEndIndex:$K(e,t.cursor,t.index,n)}}function tq(e,t,n,r,i,a){let o=aK(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=nW(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return nq(e,u,l,r+c,i+1,s,o.childIds.length,a)}function nq(e,t,n,r,i,a,o,s){if(!pW(oK(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=pq(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=oK(e,c.terminalNodeId);if(!pW(l)||!uG(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return tq(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function rq(e,t){let n=QK(e);if(t<0||t>=n)return null;let r=tq(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>$G(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=eq(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:yq(e,r.cursor),setSize:r.setSize,subtreeEndIndex:$K(e,r.cursor,r.index,n)}}function iq(e,t,n){let r=e.instrumentation,i=QK(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 vq(e,o+1);let t=[],n=uq(e,a);for(let r=a;r<=o&&n!=null;r++){let r=yq(e,n);t.push(r),n=hq(e,n)}return t}let s=[],c=0,l=0,u=xW(r,`store.getVisibleSlice.selectFirstRow`,()=>uq(e,a));for(let t=a;t<=o&&u!=null;t++){let t=xW(r,`store.getVisibleSlice.materializeRow`,()=>yq(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=xW(r,`store.getVisibleSlice.advanceCursor`,()=>hq(e,u))}return SW(r,`workload.visibleRowsRead`,s.length),SW(r,`workload.flattenedRowsRead`,c),SW(r,`workload.flattenedSegmentsRead`,l),s}function aq(e,t=QK(e)){let n=e.instrumentation;return n==null?_q(e,t):xW(n,`store.getVisibleTreeProjection`,()=>_q(e,t))}function oq(e){return gq(aq(e))}function sq(e,t){let n=rK(e,t);if(n==null||n===e.snapshot.rootId||pW(oK(e,n))&&GG(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=oK(e,i).parentId,n=aK(e,t),s=ZU(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=rW(a,n,s),t!==o){let n=oK(e,t),a=WG(e,t);if(!uG(e,t,n)&&a!==i)return null;GG(e,t)===t&&(r+=1)}i=t}return r}function cq(e,t){let n=rK(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=oK(e,n);if(!pW(r))throw Error(`Path is not a directory: "${t}"`);return uG(e,n,r)?null:(dG(e,n,!0,r),eK(e,n),wG({affectedAncestorIds:nK(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function lq(e,t){let n=rK(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=oK(e,n);if(!pW(r))throw Error(`Path is not a directory: "${t}"`);return uG(e,n,r)?(dG(e,n,!1,r),eK(e,n),TG({affectedAncestorIds:nK(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function uq(e,t){return t<0||t>=QK(e)?null:dq(e,e.snapshot.rootId,t,-1)}function dq(e,t,n,r){let i=aK(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?nW(e.snapshot.nodes,i,n):xW(a,`store.getVisibleSlice.selectChildIndex`,()=>nW(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return fq(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function fq(e,t,n,r){if(!pW(oK(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=pq(e,t,r);if(n===0)return i;let a=oK(e,i.terminalNodeId);if(!pW(a)||!uG(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return dq(e,i.terminalNodeId,n-1,i.visibleDepth)}function pq(e,t,n){return pW(oK(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:GG(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:xW(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>GG(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function mq(e,t){let n=oK(e,t);if(!pW(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:WG(e,r)!==t}function hq(e,t){let n=oK(e,t.terminalNodeId);if(pW(n)){let r=aK(e,t.terminalNodeId);if(uG(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:fq(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=oK(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=aK(e,n),o=ZU(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 fq(e,s,0,i);mq(e,r)&&i--,r=n}}function gq(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 _q(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(XK);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=ZK(o,y);let x,S=_;if(pW(v))S=f?GG(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:$G(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&&pW(C)&&uG(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 vq(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(!pW(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:$G(e,f)};continue}let h=l?GG(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=yq(e,g);let _=i[h];_!=null&&pW(_)&&uG(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function yq(e,t){let n=oK(e,t.terminalNodeId),r=pW(n)?bq(e,t):null,i=$G(e,t.terminalNodeId),a=HW(e.snapshot.segmentTable,n.nameId),o=pW(n)&&aK(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?KG(e,t.headNodeId).map(n=>{let r=oK(e,n);return{isTerminal:n===t.terminalNodeId,name:HW(e.snapshot.segmentTable,r.nameId),nodeId:n,path:$G(e,n)}}):xW(c,`store.getVisibleSlice.flatten.collectSegments`,()=>KG(e,t.headNodeId).map(n=>{let r=oK(e,n);return{isTerminal:n===t.terminalNodeId,name:HW(e.snapshot.segmentTable,r.nameId),nodeId:n,path:$G(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:pW(n)&&uG(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:pW(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function bq(e,t){if(t.headNodeId===t.terminalNodeId)return pG(e,t.terminalNodeId);let n=KG(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=pG(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function xq(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||!pW(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&&iW(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&pW(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,iW(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Sq(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Cq=class e{#e;constructor(e={}){let t=bW(e),n=xW(t,`store.builder.create`,()=>new aG(e));if(e.preparedInput!=null){let t=nG(e.preparedInput);t==null?n.appendPreparedPaths(tG(e.preparedInput),!1):n.appendPresortedPaths(t,rG(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(xW(t,`store.preparePathEntries`,()=>iG(r,e)))}let r=xW(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=xW(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=xW(t,`store.state.create`,()=>oG(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:xW(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Sq(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&xW(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?xW(t,`store.state.initializeOpenVisibleCounts`,()=>xq(this.#e)):xW(t,`store.state.recomputeCounts`,()=>tK(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return QW(e,t)}static prepareInput(e,t={}){return $W(e,t)}static preparePresortedInput(e){return eG(e)}list(e){return xW(this.#e.instrumentation,`store.list`,()=>qG(this.#e,e))}add(e){xW(this.#e.instrumentation,`store.add`,()=>{let t=QK(this.#e);PG(this.#e,MG(this.#e,t,JG(this.#e,e)))})}remove(e,t={}){xW(this.#e.instrumentation,`store.remove`,()=>{let n=QK(this.#e);PG(this.#e,MG(this.#e,n,YG(this.#e,e,t)))})}move(e,t,n={}){xW(this.#e.instrumentation,`store.move`,()=>{let r=QK(this.#e),i=XG(this.#e,e,t,n);i!=null&&PG(this.#e,MG(this.#e,r,i))})}batch(e){NG(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 xW(this.#e.instrumentation,`store.getVisibleCount`,()=>QK(this.#e))}getVisibleSlice(e,t){return xW(this.#e.instrumentation,`store.getVisibleSlice`,()=>iq(this.#e,e,t))}getVisibleRowContext(e){return xW(this.#e.instrumentation,`store.getVisibleRowContext`,()=>rq(this.#e,e))}getVisibleTreeProjection(){return oq(this.#e)}getVisibleTreeProjectionData(e){return aq(this.#e,e)}getVisibleIndex(e){return xW(this.#e.instrumentation,`store.getVisibleIndex`,()=>sq(this.#e,e))}getPathInfo(e){return xW(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=rK(this.#e,e);if(t==null)return null;let n=oK(this.#e,t);return{depth:dW(n),kind:pW(n)?`directory`:`file`,path:$G(this.#e,t)}})}isExpanded(e){return xW(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=oK(this.#e,t);return uG(this.#e,t,n)})}expand(e){xW(this.#e.instrumentation,`store.expand`,()=>{let t=QK(this.#e),n=cq(this.#e,e);n!=null&&PG(this.#e,MG(this.#e,t,n))})}collapse(e){xW(this.#e.instrumentation,`store.collapse`,()=>{let t=QK(this.#e),n=lq(this.#e,e);n!=null&&PG(this.#e,MG(this.#e,t,n))})}on(e,t){return bG(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return pG(this.#e,t)}markDirectoryUnloaded(e){xW(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(aK(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=QK(this.#e);hG(this.#e,t),PG(this.#e,MG(this.#e,n,EG({affectedAncestorIds:nK(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return xW(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=QK(this.#e),r=mG(this.#e,t);return PG(this.#e,MG(this.#e,n,DG({affectedAncestorIds:nK(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return xW(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||pG(this.#e,n)!==`loading`||!_G(this.#e,n,e.attemptId))return!1;let r=$G(this.#e,n);this.validateChildPatch(r,t);let i=QK(this.#e),a=[];for(let e of t.operations){wq(r,e);let t=QK(this.#e);switch(e.type){case`add`:a.push(MG(this.#e,t,JG(this.#e,e.path)));break;case`remove`:a.push(MG(this.#e,t,YG(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=XG(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(MG(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return PG(this.#e,MG(this.#e,i,OG({affectedAncestorIds:nK(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:$G(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return xW(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=QK(this.#e),r=gG(this.#e,t,e.attemptId);return PG(this.#e,MG(this.#e,n,kG({affectedAncestorIds:nK(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:$G(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return xW(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=QK(this.#e),i=vG(this.#e,n,e.attemptId,t);return PG(this.#e,MG(this.#e,r,AG({affectedAncestorIds:nK(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:$G(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return xW(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(JK(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=QK(this.#e),n=YK(this.#e,e.mode??`stable`);return PG(this.#e,MG(this.#e,t,jG({...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=aK(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??TW(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=DW(PW(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(!pW(oK(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=oK(this.#e,n);uG(this.#e,n,i)||(dG(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=oK(this.#e,e);if(!uG(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=rK(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!pW(oK(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!pW(oK(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=oK(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=oK(this.#e,e),r=WG(this.#e,e);if(!uG(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 wq(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 Tq={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function Eq(e,t){if(typeof e==`number`)return{itemHeight:t??Tq.default.itemHeight,factor:e};let n=Tq[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Dq=Tq.default.itemHeight,Oq=`@layer base, theme, unsafe;
181
-
182
- @layer base {
183
- :host {
184
- /*
185
- CSS variables use a fallback stack to ensure user and theme colors slot
186
- in with ease. User colors take precedence over theme colors, which take
187
- precedence over defaults.
188
-
189
- Fallback order:
190
-
191
- 1. --trees-*-override (explicit)
192
- 2. --trees-theme-* (e.g. Shiki/VS Code tokens)
193
- 3. defaults
194
-
195
- Theme variable names mirror Shiki/VS Code theme file JSON tokens.
196
-
197
- // Available CSS Color Overrides
198
- --trees-fg-override
199
- --trees-fg-muted-override
200
- --trees-bg-override
201
- --trees-bg-muted-override
202
- --trees-accent-override
203
- --trees-border-color-override
204
-
205
- --trees-focus-ring-color-override
206
- --trees-focus-ring-width-override
207
- --trees-focus-ring-offset-override
208
-
209
- --trees-search-fg-override
210
- --trees-search-font-weight-override
211
- --trees-search-bg-override
212
-
213
- --trees-selected-fg-override
214
- --trees-selected-bg-override
215
- --trees-selected-focused-border-color-override
216
-
217
- // Git Status Color Overrides
218
- --trees-status-added-override
219
- --trees-status-ignored-override
220
- --trees-status-modified-override
221
- --trees-status-renamed-override
222
- --trees-status-untracked-override
223
- --trees-status-deleted-override
224
- --trees-git-added-color-override
225
- --trees-git-ignored-color-override
226
- --trees-git-modified-color-override
227
- --trees-git-renamed-color-override
228
- --trees-git-untracked-color-override
229
- --trees-git-deleted-color-override
230
-
231
- // Built-in File Icon Color Overrides
232
- --trees-file-icon-color
233
- --trees-file-icon-color-astro
234
- --trees-file-icon-color-babel
235
- --trees-file-icon-color-bash
236
- --trees-file-icon-color-biome
237
- --trees-file-icon-color-bootstrap
238
- --trees-file-icon-color-browserslist
239
- --trees-file-icon-color-bun
240
- --trees-file-icon-color-c
241
- --trees-file-icon-color-cpp
242
- --trees-file-icon-color-claude
243
- --trees-file-icon-color-css
244
- --trees-file-icon-color-database
245
- --trees-file-icon-color-default
246
- --trees-file-icon-color-docker
247
- --trees-file-icon-color-eslint
248
- --trees-file-icon-color-git
249
- --trees-file-icon-color-go
250
- --trees-file-icon-color-graphql
251
- --trees-file-icon-color-html
252
- --trees-file-icon-color-image
253
- --trees-file-icon-color-javascript
254
- --trees-file-icon-color-json
255
- --trees-file-icon-color-markdown
256
- --trees-file-icon-color-mcp
257
- --trees-file-icon-color-npm
258
- --trees-file-icon-color-oxc
259
- --trees-file-icon-color-postcss
260
- --trees-file-icon-color-prettier
261
- --trees-file-icon-color-python
262
- --trees-file-icon-color-react
263
- --trees-file-icon-color-ruby
264
- --trees-file-icon-color-rust
265
- --trees-file-icon-color-sass
266
- --trees-file-icon-color-svg
267
- --trees-file-icon-color-svelte
268
- --trees-file-icon-color-svgo
269
- --trees-file-icon-color-swift
270
- --trees-file-icon-color-table
271
- --trees-file-icon-color-text
272
- --trees-file-icon-color-tailwind
273
- --trees-file-icon-color-terraform
274
- --trees-file-icon-color-typescript
275
- --trees-file-icon-color-vite
276
- --trees-file-icon-color-vscode
277
- --trees-file-icon-color-vue
278
- --trees-file-icon-color-wasm
279
- --trees-file-icon-color-webpack
280
- --trees-file-icon-color-yml
281
- --trees-file-icon-color-zig
282
- --trees-file-icon-color-zip
283
-
284
- // Density
285
- //
286
- // A unitless scale factor for padding, gaps, and indentation. Usually
287
- // set via \`density\` on useFileTree. Individual overrides take precedence.
288
- //
289
- // Compact: 0.8
290
- // Default: 1
291
- // Relaxed: 1.2
292
- //
293
- --trees-density-override
294
-
295
- // Available CSS Layout Overrides
296
- --trees-gap-override
297
- --trees-border-radius-override
298
- --trees-font-family-override
299
- --trees-font-size-override
300
- --trees-font-weight-regular-override
301
- --trees-font-weight-semibold-override
302
- --trees-level-gap-override
303
- --trees-item-padding-x-override
304
- --trees-item-margin-x-override
305
- --trees-item-row-gap-override
306
- --trees-icon-width-override
307
- --trees-icon-nudge-override
308
- --trees-scrollbar-gutter-override
309
- --trees-padding-inline-override
310
- */
311
-
312
- --trees-accent: var(--trees-accent-override, #009fff);
313
- --trees-fg: var(
314
- --trees-fg-override,
315
- var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1))
316
- );
317
- --trees-fg-muted: var(
318
- --trees-fg-muted-override,
319
- var(--trees-theme-sidebar-header-fg, light-dark(#84848a, #84848a))
320
- );
321
- --trees-bg: var(
322
- --trees-bg-override,
323
- var(--trees-theme-sidebar-bg, light-dark(#f8f8f8, #141415))
324
- );
325
- /* var(--trees-theme-list-hover-bg, light-dark(#dfebff59, #19283c59)) */
326
- --trees-bg-muted: var(
327
- --trees-bg-muted-override,
328
- var(
329
- --trees-theme-list-hover-bg,
330
- light-dark(
331
- color-mix(
332
- in lab,
333
- var(--trees-accent) var(--trees-bg-alpha-light, 8%),
334
- var(--trees-bg)
335
- ),
336
- color-mix(
337
- in lab,
338
- var(--trees-accent) var(--trees-bg-alpha-dark, 10%),
339
- var(--trees-bg)
340
- )
341
- )
342
- )
343
- );
344
- --trees-input-bg: var(
345
- --trees-input-bg-override,
346
- light-dark(#f8f8f8, #070707)
347
- );
348
-
349
- --trees-added-light: #16a994;
350
- --trees-added-dark: #00cab1;
351
- --trees-ignored-light: #adadb1;
352
- --trees-ignored-dark: #4a4a4e;
353
- --trees-modified-light: #1ca1c7;
354
- --trees-modified-dark: #08c0ef;
355
- --trees-renamed-light: #d5a910;
356
- --trees-renamed-dark: #ffd452;
357
- --trees-untracked-light: #16a994;
358
- --trees-untracked-dark: #00cab1;
359
- --trees-deleted-light: #ff2e3f;
360
- --trees-deleted-dark: #ff6762;
361
-
362
- --trees-border-color: var(
363
- --trees-border-color-override,
364
- var(--trees-theme-sidebar-border, light-dark(#eeeeef, #070707))
365
- );
366
- --trees-indent-guide-bg: var(
367
- --trees-indent-guide-bg-override,
368
- color-mix(in lab, var(--trees-fg-muted) 25%, transparent)
369
- );
370
- --trees-density: var(--trees-density-override, 1);
371
- --trees-border-radius: var(
372
- --trees-border-radius-override,
373
- calc(6px * var(--trees-density))
374
- );
375
-
376
- --trees-font-family: var(--trees-font-family-override, system-ui);
377
- --trees-font-size: var(--trees-font-size-override, 13px);
378
- --trees-font-weight-regular: var(--trees-font-weight-regular-override, 400);
379
- --trees-font-weight-semibold: var(
380
- --trees-font-weight-semibold-override,
381
- 600
382
- );
383
-
384
- --trees-focus-ring-color: var(
385
- --trees-focus-ring-color-override,
386
- var(--trees-theme-focus-ring, var(--trees-accent))
387
- );
388
- --trees-focus-ring-width: var(--trees-focus-ring-width-override, 1px);
389
- --trees-focus-ring-offset: var(--trees-focus-ring-offset-override, -1px);
390
-
391
- --trees-search-fg: var(
392
- --trees-search-fg-override,
393
- var(--trees-theme-input-fg, var(--trees-fg))
394
- );
395
- --trees-search-font-weight: var(--trees-search-font-weight-override, 600);
396
- --trees-search-bg: var(
397
- --trees-search-bg-override,
398
- var(--trees-theme-input-bg, var(--trees-input-bg))
399
- );
400
-
401
- --trees-scrollbar-thumb: var(
402
- --trees-scrollbar-thumb-override,
403
- var(
404
- --trees-theme-scrollbar-thumb,
405
- color-mix(in lab, var(--trees-fg) 25%, var(--trees-bg))
406
- )
407
- );
408
-
409
- --trees-selected-fg: var(
410
- --trees-selected-fg-override,
411
- var(--trees-theme-list-active-selection-fg, var(--trees-fg))
412
- );
413
- --trees-selected-bg: var(
414
- --trees-selected-bg-override,
415
- var(
416
- --trees-theme-list-active-selection-bg,
417
- light-dark(
418
- color-mix(in lab, var(--trees-accent) 12%, var(--trees-bg)),
419
- color-mix(in lab, var(--trees-accent) 15%, var(--trees-bg))
420
- )
421
- )
422
- );
423
- --trees-selected-focused-border-color: var(
424
- --trees-selected-focused-border-color-override,
425
- var(--trees-theme-focus-ring, var(--trees-accent))
426
- );
427
-
428
- /* Git status (e.g. from Shiki theme gitDecoration.*) */
429
- --trees-status-added: var(
430
- --trees-status-added-override,
431
- var(
432
- --trees-theme-git-added-fg,
433
- light-dark(var(--trees-added-light), var(--trees-added-dark))
434
- )
435
- );
436
- --trees-status-ignored: var(
437
- --trees-status-ignored-override,
438
- var(
439
- --trees-theme-git-ignored-fg,
440
- light-dark(var(--trees-ignored-light), var(--trees-ignored-dark))
441
- )
442
- );
443
- --trees-status-modified: var(
444
- --trees-status-modified-override,
445
- var(
446
- --trees-theme-git-modified-fg,
447
- light-dark(var(--trees-modified-light), var(--trees-modified-dark))
448
- )
449
- );
450
- --trees-status-renamed: var(
451
- --trees-status-renamed-override,
452
- var(
453
- --trees-theme-git-renamed-fg,
454
- light-dark(var(--trees-renamed-light), var(--trees-renamed-dark))
455
- )
456
- );
457
- --trees-status-untracked: var(
458
- --trees-status-untracked-override,
459
- var(
460
- --trees-theme-git-untracked-fg,
461
- light-dark(var(--trees-untracked-light), var(--trees-untracked-dark))
462
- )
463
- );
464
- --trees-status-deleted: var(
465
- --trees-status-deleted-override,
466
- var(
467
- --trees-theme-git-deleted-fg,
468
- light-dark(var(--trees-deleted-light), var(--trees-deleted-dark))
469
- )
470
- );
471
- --trees-git-modified-color: var(
472
- --trees-git-modified-color-override,
473
- var(--trees-status-modified)
474
- );
475
- --trees-git-added-color: var(
476
- --trees-git-added-color-override,
477
- var(--trees-status-added)
478
- );
479
- --trees-git-ignored-color: var(
480
- --trees-git-ignored-color-override,
481
- var(--trees-status-ignored)
482
- );
483
- --trees-git-deleted-color: var(
484
- --trees-git-deleted-color-override,
485
- var(--trees-status-deleted)
486
- );
487
- --trees-git-renamed-color: var(
488
- --trees-git-renamed-color-override,
489
- var(--trees-status-renamed)
490
- );
491
- --trees-git-untracked-color: var(
492
- --trees-git-untracked-color-override,
493
- var(--trees-status-untracked)
494
- );
495
-
496
- --trees-icon-gray: light-dark(#84848a, #adadb1);
497
- --trees-icon-red: light-dark(#d52c36, #ff6762);
498
- --trees-icon-vermilion: light-dark(#ff8c5b, #d5512f);
499
- --trees-icon-orange: light-dark(#d47628, #ffa359);
500
- --trees-icon-yellow: light-dark(#d5a910, #ffd452);
501
- --trees-icon-green: light-dark(#199f43, #5ecc71);
502
- --trees-icon-teal: light-dark(#17a5af, #64d1db);
503
- --trees-icon-cyan: light-dark(#1ca1c7, #68cdf2);
504
- --trees-icon-blue: light-dark(#1a85d4, #69b1ff);
505
- --trees-icon-indigo: light-dark(#693acf, #9d6afb);
506
- --trees-icon-purple: light-dark(#a631be, #d568ea);
507
- --trees-icon-pink: light-dark(#d32a61, #ff678d);
508
- --trees-icon-mauve: light-dark(#594c5b, #79697b);
509
-
510
- --trees-file-icon-color-default: var(
511
- --trees-file-icon-color,
512
- var(--trees-icon-gray)
513
- );
514
- --trees-file-icon-color-astro: var(
515
- --trees-file-icon-color,
516
- var(--trees-icon-purple)
517
- );
518
- --trees-file-icon-color-babel: var(
519
- --trees-file-icon-color,
520
- var(--trees-icon-yellow)
521
- );
522
- --trees-file-icon-color-bash: var(
523
- --trees-file-icon-color,
524
- var(--trees-icon-green)
525
- );
526
- --trees-file-icon-color-biome: var(
527
- --trees-file-icon-color,
528
- var(--trees-icon-blue)
529
- );
530
- --trees-file-icon-color-bootstrap: var(
531
- --trees-file-icon-color,
532
- var(--trees-icon-indigo)
533
- );
534
- --trees-file-icon-color-browserslist: var(
535
- --trees-file-icon-color,
536
- var(--trees-icon-yellow)
537
- );
538
- --trees-file-icon-color-bun: var(
539
- --trees-file-icon-color,
540
- var(--trees-icon-mauve)
541
- );
542
- --trees-file-icon-color-c: var(
543
- --trees-file-icon-color,
544
- var(--trees-icon-blue)
545
- );
546
- --trees-file-icon-color-cpp: var(
547
- --trees-file-icon-color,
548
- var(--trees-icon-blue)
549
- );
550
- --trees-file-icon-color-claude: var(
551
- --trees-file-icon-color,
552
- var(--trees-icon-orange)
553
- );
554
- --trees-file-icon-color-css: var(
555
- --trees-file-icon-color,
556
- var(--trees-icon-indigo)
557
- );
558
- --trees-file-icon-color-database: var(
559
- --trees-file-icon-color,
560
- var(--trees-icon-purple)
561
- );
562
- --trees-file-icon-color-docker: var(
563
- --trees-file-icon-color,
564
- var(--trees-icon-blue)
565
- );
566
- --trees-file-icon-color-eslint: var(
567
- --trees-file-icon-color,
568
- var(--trees-icon-indigo)
569
- );
570
- --trees-file-icon-color-git: var(
571
- --trees-file-icon-vermilion,
572
- var(--trees-icon-vermilion)
573
- );
574
- --trees-file-icon-color-go: var(
575
- --trees-file-icon-color,
576
- var(--trees-icon-cyan)
577
- );
578
- --trees-file-icon-color-graphql: var(
579
- --trees-file-icon-color,
580
- var(--trees-icon-pink)
581
- );
582
- --trees-file-icon-color-html: var(
583
- --trees-file-icon-color,
584
- var(--trees-icon-orange)
585
- );
586
- --trees-file-icon-color-image: var(
587
- --trees-file-icon-color,
588
- var(--trees-icon-pink)
589
- );
590
- --trees-file-icon-color-javascript: var(
591
- --trees-file-icon-color,
592
- var(--trees-icon-yellow)
593
- );
594
- --trees-file-icon-color-json: var(
595
- --trees-file-icon-color,
596
- var(--trees-icon-orange)
597
- );
598
- --trees-file-icon-color-markdown: var(
599
- --trees-file-icon-color,
600
- var(--trees-icon-green)
601
- );
602
- --trees-file-icon-color-mcp: var(
603
- --trees-file-icon-color,
604
- var(--trees-icon-teal)
605
- );
606
- --trees-file-icon-color-npm: var(
607
- --trees-file-icon-color,
608
- var(--trees-icon-red)
609
- );
610
- --trees-file-icon-color-oxc: var(
611
- --trees-file-icon-cyan,
612
- var(--trees-icon-cyan)
613
- );
614
- --trees-file-icon-color-postcss: var(
615
- --trees-file-icon-color,
616
- var(--trees-icon-red)
617
- );
618
- --trees-file-icon-color-prettier: var(
619
- --trees-file-icon-color,
620
- var(--trees-icon-teal)
621
- );
622
- --trees-file-icon-color-python: var(
623
- --trees-file-icon-color,
624
- var(--trees-icon-blue)
625
- );
626
- --trees-file-icon-color-react: var(
627
- --trees-file-icon-color,
628
- var(--trees-icon-cyan)
629
- );
630
- --trees-file-icon-color-ruby: var(
631
- --trees-file-icon-color,
632
- var(--trees-icon-red)
633
- );
634
- --trees-file-icon-color-rust: var(
635
- --trees-file-icon-color,
636
- var(--trees-icon-orange)
637
- );
638
- --trees-file-icon-color-sass: var(
639
- --trees-file-icon-color,
640
- var(--trees-icon-pink)
641
- );
642
- --trees-file-icon-color-svg: var(
643
- --trees-file-icon-color,
644
- var(--trees-icon-orange)
645
- );
646
- --trees-file-icon-color-svelte: var(
647
- --trees-file-icon-color,
648
- var(--trees-icon-red)
649
- );
650
- --trees-file-icon-color-svgo: var(
651
- --trees-file-icon-color,
652
- var(--trees-icon-green)
653
- );
654
- --trees-file-icon-color-swift: var(
655
- --trees-file-icon-color,
656
- var(--trees-icon-orange)
657
- );
658
- --trees-file-icon-color-table: var(
659
- --trees-file-icon-color,
660
- var(--trees-icon-teal)
661
- );
662
- --trees-file-icon-color-text: var(
663
- --trees-file-icon-color,
664
- var(--trees-icon-gray)
665
- );
666
- --trees-file-icon-color-tailwind: var(
667
- --trees-file-icon-color,
668
- var(--trees-icon-cyan)
669
- );
670
- --trees-file-icon-color-terraform: var(
671
- --trees-file-icon-color,
672
- var(--trees-icon-indigo)
673
- );
674
- --trees-file-icon-color-typescript: var(
675
- --trees-file-icon-color,
676
- var(--trees-icon-blue)
677
- );
678
- --trees-file-icon-color-vite: var(
679
- --trees-file-icon-color,
680
- var(--trees-icon-purple)
681
- );
682
- --trees-file-icon-color-vscode: var(
683
- --trees-file-icon-color,
684
- var(--trees-icon-blue)
685
- );
686
- --trees-file-icon-color-vue: var(
687
- --trees-file-icon-color,
688
- var(--trees-icon-green)
689
- );
690
- --trees-file-icon-color-wasm: var(
691
- --trees-file-icon-color,
692
- var(--trees-icon-indigo)
693
- );
694
- --trees-file-icon-color-webpack: var(
695
- --trees-file-icon-color,
696
- var(--trees-icon-blue)
697
- );
698
- --trees-file-icon-color-yml: var(
699
- --trees-file-icon-color,
700
- var(--trees-icon-red)
701
- );
702
- --trees-file-icon-color-zig: var(
703
- --trees-file-icon-color,
704
- var(--trees-icon-orange)
705
- );
706
- --trees-file-icon-color-zip: var(
707
- --trees-file-icon-color,
708
- var(--trees-icon-orange)
709
- );
710
-
711
- --trees-level-gap: var(
712
- --trees-level-gap-override,
713
- calc(8px * var(--trees-density))
714
- );
715
- --trees-item-padding-x: var(
716
- --trees-item-padding-x-override,
717
- calc(8px * var(--trees-density))
718
- );
719
- --trees-item-margin-x: var(
720
- --trees-item-margin-x-override,
721
- calc(2px * var(--trees-density))
722
- );
723
- --trees-item-row-gap: var(
724
- --trees-item-row-gap-override,
725
- calc(6px * var(--trees-density))
726
- );
727
- --trees-icon-width: var(--trees-icon-width-override, 16px);
728
- --trees-icon-nudge: var(
729
- --trees-icon-nudge-override,
730
- calc(1px * var(--trees-density))
731
- );
732
- --trees-row-height: var(--trees-item-height, 30px);
733
- --trees-git-lane-width: var(--trees-git-lane-width-override, 12px);
734
- --trees-action-lane-width: var(
735
- --trees-action-lane-width-override,
736
- calc(var(--trees-icon-width) + 2px)
737
- );
738
- /* Keep the floating trigger aligned with the row's action lane. Going in
739
- from the root's right edge: the scroll container reserves
740
- \`--trees-padding-inline\` of effective inset on each side (its asymmetric
741
- padding formula cancels the scrollbar gutter on the right), the row
742
- sits inside that inset, and its trailing \`--trees-item-padding-x\` is the
743
- action lane itself. The trigger's own focus-ring margin then trims one
744
- pixel back so the button's visible right edge lines up with the lane. */
745
- --trees-context-menu-trigger-inline-offset: calc(
746
- var(--trees-padding-inline) + var(--trees-item-padding-x) -
747
- var(--trees-focus-ring-width)
748
- );
749
-
750
- --trees-scrollbar-gutter: var(--trees-scrollbar-gutter-override, 6px);
751
- --trees-padding-inline: var(--trees-padding-inline-override, 16px);
752
-
753
- color-scheme: light dark;
754
- display: flex;
755
- flex-direction: column;
756
- font-size: var(--trees-font-size);
757
- color: var(--trees-fg);
758
- background-color: var(--trees-bg);
759
- --truncate-marker-background-color: var(--trees-bg);
760
- --truncate-marker-background-overlay-color: transparent;
761
- font-family: var(--trees-font-family);
762
- font-weight: var(--trees-font-weight-regular);
763
- }
764
-
765
- :host([data-file-tree-virtualized='true']) {
766
- height: 100%;
767
- overflow: hidden;
768
- }
769
-
770
- [data-file-tree-virtualized-wrapper='true'] {
771
- height: 100%;
772
- overflow: hidden;
773
- display: flex;
774
- flex-direction: column;
775
- }
776
-
777
- [data-file-tree-virtualized-root='true'] {
778
- height: 100%;
779
- display: flex;
780
- flex-direction: column;
781
- overflow: hidden;
782
- }
783
-
784
- [data-file-tree-virtualized-scroll='true'],
785
- [data-file-tree-scrollbar-measure='true'] {
786
- --trees-scrollbar-thumb-current: transparent;
787
- overflow-y: auto;
788
- scrollbar-gutter: stable;
789
-
790
- &:hover {
791
- --trees-scrollbar-thumb-current: var(--trees-scrollbar-thumb);
792
- }
793
-
794
- &::-webkit-scrollbar {
795
- width: var(--trees-scrollbar-gutter);
796
- height: var(--trees-scrollbar-gutter);
797
- }
798
-
799
- &::-webkit-scrollbar-track {
800
- background: transparent;
801
- }
802
-
803
- &::-webkit-scrollbar-thumb {
804
- background-color: var(--trees-scrollbar-thumb-current);
805
- border: 1px solid transparent;
806
- background-clip: content-box;
807
- border-radius: calc(var(--trees-scrollbar-gutter) / 2);
808
- }
809
-
810
- &::-webkit-scrollbar-corner {
811
- background-color: transparent;
812
- }
813
- }
814
-
815
- /* These are styles for a temporarily generated element to measure the size
816
- * of the scrollbar. It's intended to be somewhat similar in scrollbar style
817
- * scope to the scrollable tree so \`--trees-scrollbar-gutter-measured\` is an
818
- * accurate reflection of the size the scrollbar gutter takes up. */
819
- [data-file-tree-scrollbar-measure='true'] {
820
- position: absolute;
821
- top: 0;
822
- left: 0;
823
- visibility: hidden;
824
- pointer-events: none;
825
- width: 100px;
826
- height: 100px;
827
- }
828
-
829
- @supports (-moz-appearance: none) {
830
- [data-file-tree-virtualized-scroll='true'],
831
- [data-file-tree-scrollbar-measure='true'] {
832
- scrollbar-width: thin;
833
- scrollbar-color: var(--trees-scrollbar-thumb-current) transparent;
834
- }
835
- }
836
-
837
- [data-file-tree-virtualized-scroll='true'] {
838
- position: relative;
839
- overflow-y: auto;
840
- flex: 1 1 0;
841
- min-height: 0;
842
- padding-inline: max(
843
- calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
844
- 0px
845
- )
846
- /* NOTE(amadeus): We can assume that all Webkit based browser gutters
847
- * will align to the value of '--trees-scrollbar-gutter', however if not, then
848
- * \`--trees-scrollbar-gutter-measured\` should correct it. Mostly we are
849
- * hoping to avoid SSR alignment jumps if possible. In non-SSR'd environments
850
- * \`--trees-scrollbar-gutter-measured\` should always be immediately available.
851
- */
852
- max(
853
- calc(
854
- var(--trees-padding-inline) - var(--trees-item-margin-x) -
855
- var(
856
- --trees-scrollbar-gutter-measured,
857
- var(--trees-scrollbar-gutter)
858
- )
859
- ),
860
- 0px
861
- );
862
- }
863
-
864
- @supports (-moz-appearance: none) {
865
- [data-file-tree-virtualized-scroll='true'] {
866
- padding-inline: max(
867
- calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
868
- 0px
869
- )
870
- /* NOTE(amadeus): However on Firefox it can vary a little bit, but most
871
- * likely the majority of cases will default to a 0px width scrollbar lets
872
- * inherit that first to avoid SSR jumps. In non-SSR'd environments
873
- * \`--trees-scrollbar-gutter-measured\` should always be immediately available.
874
- */
875
- max(
876
- calc(
877
- var(--trees-padding-inline) - var(--trees-item-margin-x) -
878
- var(--trees-scrollbar-gutter-measured, 0px)
879
- ),
880
- 0px
881
- );
882
- }
883
- }
884
-
885
- [data-file-tree-sticky-overlay='true'] {
886
- position: sticky;
887
- top: 0;
888
- height: 0;
889
- z-index: 4;
890
- overflow: visible;
891
- pointer-events: none;
892
- }
893
-
894
- /* The overlay DOM is kept populated even at scrollTop=0 so the browser has
895
- * the rendered rows on hand the moment scrolling begins — otherwise the
896
- * compositor paints a scrolled frame before React can mount the overlay,
897
- * and the topmost sticky folder jumps up by a couple of pixels before it
898
- * "snaps" into its pinned position. We hide it via CSS whenever the scroll
899
- * is at the top and no scroll is in progress, so the preview doesn't leak
900
- * through at rest. \`data-overlay-reveal\` is stamped on the root only when
901
- * the user initiates a scroll while already at the top — exactly the case
902
- * where we need the pre-mounted overlay to be visible through the first
903
- * compositor frame. It is deliberately distinct from the general
904
- * \`data-is-scrolling\` flag so a scroll that ends at the top (e.g. ArrowUp
905
- * navigation) re-hides the overlay the instant the scroll lands, rather
906
- * than waiting for the hover-suppression timer to elapse. */
907
- [data-file-tree-virtualized-root='true'][data-scroll-at-top='true']:not(
908
- [data-overlay-reveal]
909
- )
910
- [data-file-tree-sticky-overlay='true'] {
911
- visibility: hidden;
912
- }
913
-
914
- [data-file-tree-sticky-overlay-content='true'] {
915
- background-color: var(--trees-bg);
916
- position: relative;
917
- pointer-events: none;
918
- }
919
-
920
- [data-file-tree-virtualized-list='true'] {
921
- background-color: var(--trees-bg);
922
- position: relative;
923
- min-height: 100%;
924
- width: 100%;
925
- overflow-anchor: none;
926
-
927
- &[data-is-scrolling] {
928
- pointer-events: none;
929
- }
930
- }
931
-
932
- [data-file-tree-virtualized-sticky-offset='true'] {
933
- contain: layout size;
934
- }
935
-
936
- [data-file-tree-virtualized-sticky='true'] {
937
- position: sticky;
938
- top: 0;
939
- width: 100%;
940
- display: flex;
941
- flex-direction: column;
942
- isolation: isolate;
943
- /* Promote to its own compositor layer so text inside the window is
944
- * rasterized once and GPU-translated during scroll. Without this, the
945
- * browser re-paints the window (and its text) at every scroll frame,
946
- * which produces visible 1px shake / character tearing. */
947
- will-change: transform;
948
- }
949
-
950
- [data-file-tree-search-container] {
951
- display: flex;
952
- padding: 0;
953
- padding-inline: var(--trees-padding-inline);
954
- margin-bottom: var(--trees-item-row-gap);
955
- }
956
-
957
- [data-file-tree-search-input] {
958
- --trees-focus-ring-width: 2px;
959
- font-family: var(--trees-font-family);
960
- font-size: var(--trees-font-size);
961
- flex: 1;
962
- height: var(--trees-row-height);
963
- /* 1px breathing room so the focus-visible outline isn't clipped when the
964
- * input sits flush against the top of the scroll container. */
965
- margin-block: 1px;
966
- padding-inline: var(--trees-item-padding-x);
967
- line-height: var(--trees-row-height);
968
- color: var(--trees-search-fg);
969
- background-color: var(--trees-search-bg);
970
- border: 1px solid var(--trees-border-color);
971
- border-radius: var(--trees-border-radius);
972
- outline: none;
973
-
974
- &::placeholder {
975
- color: color-mix(
976
- in lab,
977
- var(--trees-search-fg) 65%,
978
- var(--trees-search-bg)
979
- );
980
- }
981
-
982
- &:focus-visible,
983
- &[data-file-tree-search-input-fake-focus='true'] {
984
- outline: var(--trees-focus-ring-width) solid var(--trees-focus-ring-color);
985
- outline-offset: var(--trees-focus-ring-offset);
986
- }
987
- }
988
-
989
- /* The wrapper for the tree items */
990
- [role='tree'] {
991
- position: relative;
992
- display: flex;
993
- flex-direction: column;
994
- gap: var(--trees-gap-override, 0);
995
- }
996
-
997
- /* LIST ITEM */
998
- [data-type='item'] {
999
- color: inherit;
1000
- font-family: var(--trees-font-family);
1001
- font-size: var(--trees-font-size);
1002
- text-align: start;
1003
- outline: none;
1004
- background-color: var(--trees-bg);
1005
- border: none;
1006
- position: relative;
1007
-
1008
- padding: 0 var(--trees-item-padding-x);
1009
- margin: 0 var(--trees-item-margin-x);
1010
- cursor: pointer;
1011
- -webkit-user-select: none;
1012
- user-select: none;
1013
- -webkit-touch-callout: none;
1014
- touch-action: manipulation;
1015
- display: flex;
1016
- flex: 0 0 var(--trees-row-height);
1017
- align-items: center;
1018
- height: var(--trees-row-height);
1019
- line-height: var(--trees-row-height);
1020
- gap: var(--trees-item-row-gap);
1021
- border-radius: var(--trees-border-radius);
1022
- /* Row states may be translucent, so markers paint the tree background first
1023
- * and then the state color on top to avoid compositing the same alpha twice. */
1024
- --truncate-marker-background-color: var(--trees-bg);
1025
- --truncate-marker-background-overlay-color: transparent;
1026
- --truncate-marker-block-inset: 0px;
1027
-
1028
- &:hover,
1029
- &[data-item-context-hover='true'] {
1030
- background-color: var(--trees-bg-muted);
1031
- --truncate-marker-background-overlay-color: var(--trees-bg-muted);
1032
- }
1033
-
1034
- &[data-item-focused='true'],
1035
- &:focus-visible {
1036
- z-index: 2;
1037
-
1038
- /* Flattened segment markers sit high enough to cover the row outline unless
1039
- * their painted background is inset by the focus ring width. */
1040
- [data-item-flattened-subitems] {
1041
- --truncate-marker-block-inset: var(--trees-focus-ring-width);
1042
- }
1043
-
1044
- &::before {
1045
- position: absolute;
1046
- inset: 0;
1047
- content: '';
1048
- display: block;
1049
- border-radius: var(--trees-border-radius);
1050
- outline: var(--trees-focus-ring-width) solid
1051
- var(--trees-focus-ring-color);
1052
- outline-offset: var(--trees-focus-ring-offset);
1053
- pointer-events: none;
1054
- }
1055
-
1056
- &[data-item-selected='true']::before {
1057
- outline-color: var(--trees-selected-focused-border-color);
1058
- }
1059
- }
1060
-
1061
- &[data-item-selected='true'] {
1062
- color: var(--trees-selected-fg);
1063
- background-color: var(--trees-selected-bg);
1064
- --truncate-marker-background-overlay-color: var(--trees-selected-bg);
1065
- z-index: 3;
1066
-
1067
- [data-item-section='icon'] {
1068
- color: var(--trees-selected-fg);
1069
- }
1070
- }
1071
-
1072
- &[data-item-search-match='true'] {
1073
- font-weight: var(--trees-search-font-weight);
1074
- }
1075
- }
1076
-
1077
- [data-type='item'][data-file-tree-sticky-row='true'] {
1078
- pointer-events: auto;
1079
- }
1080
-
1081
- /* Sticky rows opt back into pointer events because the overlay wrapper is
1082
- * inert. During scroll, put them back under the same hover suppression as
1083
- * the virtualized list so translucent hover states and menu triggers do not
1084
- * paint over rows moving beneath the sticky stack. */
1085
- [data-file-tree-virtualized-root='true'][data-is-scrolling]
1086
- [data-type='item'][data-file-tree-sticky-row='true'] {
1087
- pointer-events: none;
1088
- }
1089
-
1090
- [data-file-tree-virtualized-root='true'][data-is-scrolling]
1091
- [data-type='item'][data-file-tree-sticky-row='true']:hover:not(
1092
- [data-item-selected='true']
1093
- ),
1094
- [data-file-tree-virtualized-root='true'][data-is-scrolling]
1095
- [data-type='item'][data-file-tree-sticky-row='true'][data-item-context-hover='true']:not(
1096
- [data-item-selected='true']
1097
- ) {
1098
- background-color: var(--trees-bg);
1099
- --truncate-marker-background-overlay-color: transparent;
1100
- }
1101
-
1102
- [data-item-selected='true']:has(+ [data-item-selected='true']) {
1103
- border-bottom-left-radius: 0;
1104
- border-bottom-right-radius: 0;
1105
- }
1106
-
1107
- [data-item-selected='true'] + [data-item-selected='true'] {
1108
- border-top-left-radius: 0;
1109
- border-top-right-radius: 0;
1110
- }
1111
-
1112
- /* Flattened Directory Parts */
1113
- [data-item-flattened-subitems] {
1114
- display: inline-flex;
1115
- align-items: center;
1116
- gap: 2px;
1117
- }
1118
- [data-item-flattened-subitem]:hover,
1119
- [data-item-flattened-subitem-drag-target='true'] {
1120
- text-decoration: underline;
1121
- }
1122
-
1123
- /* Icon for each item */
1124
- [data-item-section='icon'] {
1125
- flex-shrink: 0;
1126
- display: flex;
1127
- align-items: center;
1128
- justify-content: center;
1129
- color: var(--trees-fg-muted);
1130
- fill: currentColor;
1131
- width: var(--trees-icon-width);
1132
- }
1133
-
1134
- :where([data-item-section='icon'] > [data-icon-token]) {
1135
- color: var(--trees-fg-muted);
1136
- }
1137
-
1138
- [data-file-tree-colored-icons='true'] {
1139
- [data-icon-token='astro'] {
1140
- color: var(--trees-file-icon-color-astro);
1141
- }
1142
- [data-icon-token='babel'] {
1143
- color: var(--trees-file-icon-color-babel);
1144
- }
1145
- [data-icon-token='bash'] {
1146
- color: var(--trees-file-icon-color-bash);
1147
- }
1148
- [data-icon-token='biome'] {
1149
- color: var(--trees-file-icon-color-biome);
1150
- }
1151
- [data-icon-token='bootstrap'] {
1152
- color: var(--trees-file-icon-color-bootstrap);
1153
- }
1154
- [data-icon-token='browserslist'] {
1155
- color: var(--trees-file-icon-color-browserslist);
1156
- }
1157
- [data-icon-token='bun'] {
1158
- color: var(--trees-file-icon-color-bun);
1159
- }
1160
- [data-icon-token='c'] {
1161
- color: var(--trees-file-icon-color-c);
1162
- }
1163
- [data-icon-token='cpp'] {
1164
- color: var(--trees-file-icon-color-cpp);
1165
- }
1166
- [data-icon-token='claude'] {
1167
- color: var(--trees-file-icon-color-claude);
1168
- }
1169
- [data-icon-token='css'] {
1170
- color: var(--trees-file-icon-color-css);
1171
- }
1172
- [data-icon-token='database'] {
1173
- color: var(--trees-file-icon-color-database);
1174
- }
1175
- [data-icon-token='default'] {
1176
- color: var(--trees-file-icon-color-default);
1177
- }
1178
- [data-icon-token='docker'] {
1179
- color: var(--trees-file-icon-color-docker);
1180
- }
1181
- [data-icon-token='eslint'] {
1182
- color: var(--trees-file-icon-color-eslint);
1183
- }
1184
- [data-icon-token='git'] {
1185
- color: var(--trees-file-icon-color-git);
1186
- }
1187
- [data-icon-token='go'] {
1188
- color: var(--trees-file-icon-color-go);
1189
- }
1190
- [data-icon-token='graphql'] {
1191
- color: var(--trees-file-icon-color-graphql);
1192
- }
1193
- [data-icon-token='html'] {
1194
- color: var(--trees-file-icon-color-html);
1195
- }
1196
- [data-icon-token='image'] {
1197
- color: var(--trees-file-icon-color-image);
1198
- }
1199
- [data-icon-token='javascript'] {
1200
- color: var(--trees-file-icon-color-javascript);
1201
- }
1202
- [data-icon-token='json'] {
1203
- color: var(--trees-file-icon-color-json);
1204
- }
1205
- [data-icon-token='markdown'] {
1206
- color: var(--trees-file-icon-color-markdown);
1207
- }
1208
- [data-icon-token='mcp'] {
1209
- color: var(--trees-file-icon-color-mcp);
1210
- }
1211
- [data-icon-token='npm'] {
1212
- color: var(--trees-file-icon-color-npm);
1213
- }
1214
- [data-icon-token='oxc'] {
1215
- color: var(--trees-file-icon-color-oxc);
1216
- }
1217
- [data-icon-token='postcss'] {
1218
- color: var(--trees-file-icon-color-postcss);
1219
- }
1220
- [data-icon-token='prettier'] {
1221
- color: var(--trees-file-icon-color-prettier);
1222
- }
1223
- [data-icon-token='python'] {
1224
- color: var(--trees-file-icon-color-python);
1225
- }
1226
- [data-icon-token='react'] {
1227
- color: var(--trees-file-icon-color-react);
1228
- }
1229
- [data-icon-token='ruby'] {
1230
- color: var(--trees-file-icon-color-ruby);
1231
- }
1232
- [data-icon-token='rust'] {
1233
- color: var(--trees-file-icon-color-rust);
1234
- }
1235
- [data-icon-token='sass'] {
1236
- color: var(--trees-file-icon-color-sass);
1237
- }
1238
- [data-icon-token='svg'] {
1239
- color: var(--trees-file-icon-color-svg);
1240
- }
1241
- [data-icon-token='svelte'] {
1242
- color: var(--trees-file-icon-color-svelte);
1243
- }
1244
- [data-icon-token='svgo'] {
1245
- color: var(--trees-file-icon-color-svgo);
1246
- }
1247
- [data-icon-token='swift'] {
1248
- color: var(--trees-file-icon-color-swift);
1249
- }
1250
- [data-icon-token='table'] {
1251
- color: var(--trees-file-icon-color-table);
1252
- }
1253
- [data-icon-token='text'] {
1254
- color: var(--trees-file-icon-color-text);
1255
- }
1256
- [data-icon-token='tailwind'] {
1257
- color: var(--trees-file-icon-color-tailwind);
1258
- }
1259
- [data-icon-token='terraform'] {
1260
- color: var(--trees-file-icon-color-terraform);
1261
- }
1262
- [data-icon-token='typescript'] {
1263
- color: var(--trees-file-icon-color-typescript);
1264
- }
1265
- [data-icon-token='vite'] {
1266
- color: var(--trees-file-icon-color-vite);
1267
- }
1268
- [data-icon-token='vscode'] {
1269
- color: var(--trees-file-icon-color-vscode);
1270
- }
1271
- [data-icon-token='vue'] {
1272
- color: var(--trees-file-icon-color-vue);
1273
- }
1274
- [data-icon-token='wasm'] {
1275
- color: var(--trees-file-icon-color-wasm);
1276
- }
1277
- [data-icon-token='webpack'] {
1278
- color: var(--trees-file-icon-color-webpack);
1279
- }
1280
- [data-icon-token='yml'] {
1281
- color: var(--trees-file-icon-color-yml);
1282
- }
1283
- [data-icon-token='zig'] {
1284
- color: var(--trees-file-icon-color-zig);
1285
- }
1286
- [data-icon-token='zip'] {
1287
- color: var(--trees-file-icon-color-zip);
1288
- }
1289
- }
1290
-
1291
- /* Chevron rotation and visual alignment */
1292
- /* Chevron pointing down */
1293
- [data-icon-name='file-tree-icon-chevron'] {
1294
- &[data-align-capitals='false'] {
1295
- transform: translate(0, var(--trees-icon-nudge));
1296
- }
1297
- &[data-align-capitals='true'] {
1298
- transform: translate(0, 0);
1299
- }
1300
- }
1301
-
1302
- [data-item-section='content'] {
1303
- flex: 0 1 auto;
1304
- text-align: start;
1305
- min-width: 0;
1306
- max-width: 100%;
1307
- overflow: hidden;
1308
- text-overflow: ellipsis;
1309
- /* Breaks middle truncate component to also set this */
1310
- /* white-space: nowrap; */
1311
- }
1312
-
1313
- [data-item-section='decoration'] {
1314
- flex: 1 1 0;
1315
- min-width: 0;
1316
- display: flex;
1317
- justify-content: flex-end;
1318
- text-align: end;
1319
- overflow: hidden;
1320
- color: var(--trees-fg-muted);
1321
- }
1322
-
1323
- [data-item-section='decoration'] > span {
1324
- min-width: 0;
1325
- max-width: 100%;
1326
- display: inline-flex;
1327
- align-items: center;
1328
- justify-content: flex-end;
1329
- overflow: hidden;
1330
- text-overflow: ellipsis;
1331
- white-space: nowrap;
1332
- }
1333
-
1334
- [data-item-section='git'],
1335
- [data-item-section='action'] {
1336
- flex: 0 0 auto;
1337
- display: flex;
1338
- align-items: center;
1339
- justify-content: center;
1340
- }
1341
-
1342
- [data-item-section='git'] {
1343
- width: var(--trees-git-lane-width);
1344
- }
1345
-
1346
- [data-item-section='action'] {
1347
- width: var(--trees-action-lane-width);
1348
- color: var(--trees-fg-muted);
1349
- fill: currentColor;
1350
- pointer-events: none;
1351
- }
1352
-
1353
- [data-item-section='git'] > span,
1354
- [data-item-section='action'] > span {
1355
- width: 100%;
1356
- display: inline-flex;
1357
- align-items: center;
1358
- justify-content: center;
1359
- }
1360
-
1361
- [data-item-action-affordance='decorative'] {
1362
- opacity: 0.85;
1363
- }
1364
-
1365
- [data-item-rename-input] {
1366
- appearance: none;
1367
- width: 100%;
1368
- min-width: 0;
1369
- height: calc(var(--trees-row-height) - 4px);
1370
- font-family: inherit;
1371
- font-size: inherit;
1372
- /* line-height: calc(var(--trees-row-height) - 8px); */
1373
- color: inherit;
1374
- background-color: transparent;
1375
- border: 0;
1376
- padding-inline: 6px;
1377
- outline: none;
1378
- box-sizing: border-box;
1379
- }
1380
-
1381
- [data-item-section='content']:has([data-item-rename-input])
1382
- ~ [data-item-section='action'],
1383
- [data-item-section='content']:has([data-item-rename-input])
1384
- ~ [data-item-section='decoration'] {
1385
- display: none;
1386
- }
1387
-
1388
- /* Chevron pointing right */
1389
- [aria-expanded='false'][data-item-type='folder']
1390
- > [data-item-section='icon']
1391
- > [data-icon-name='file-tree-icon-chevron'] {
1392
- &[data-align-capitals='true'] {
1393
- transform: rotate(-90deg)
1394
- translate(
1395
- calc(var(--trees-icon-nudge) / 2),
1396
- calc(var(--trees-icon-nudge) / 2)
1397
- );
1398
- }
1399
- &[data-align-capitals='false'] {
1400
- transform: rotate(-90deg)
1401
- translate(
1402
- calc(var(--trees-icon-nudge) / 2 * -1),
1403
- calc(var(--trees-icon-nudge) / 2)
1404
- );
1405
- }
1406
- }
1407
-
1408
- /* LIST IDENTATION */
1409
- /* Spacing container */
1410
- [data-item-section='spacing'] {
1411
- display: flex;
1412
- flex-direction: row;
1413
- align-items: center;
1414
- justify-content: center;
1415
- height: var(--trees-row-height);
1416
- padding-left: calc(calc(var(--trees-icon-width) / 2) - 0.5px);
1417
-
1418
- &:empty {
1419
- padding-left: 0;
1420
- }
1421
- }
1422
-
1423
- /* Spacing per level */
1424
- [data-item-section='spacing-item'] {
1425
- transform: translateX(-0.25px);
1426
- display: inline-block;
1427
- border-left: 1px solid var(--trees-indent-guide-bg);
1428
- height: 100%;
1429
- margin-right: calc(var(--trees-level-gap) - 1px);
1430
- opacity: 0;
1431
- transition: opacity 150ms ease;
1432
-
1433
- & + & {
1434
- margin-left: calc(
1435
- var(--trees-item-row-gap) + calc(var(--trees-icon-width) / 2) - 0.5px
1436
- );
1437
- }
1438
- }
1439
-
1440
- :host(:hover) [data-item-section='spacing-item'] {
1441
- opacity: 0.75;
1442
- }
1443
-
1444
- /* Git status indicator */
1445
-
1446
- /* This is a folder that contains a git change */
1447
- [data-item-contains-git-change='true'] > [data-item-section='git'] {
1448
- color: var(--trees-git-modified-color);
1449
- opacity: 0.5;
1450
- fill: currentColor;
1451
- }
1452
-
1453
- /* These are files that have a git change */
1454
- [data-item-git-status] {
1455
- &
1456
- > :where([data-item-section='icon'])
1457
- > :where(:not([data-icon-name='file-tree-icon-chevron'])) {
1458
- color: var(--trees-item-git-status-color);
1459
- }
1460
- & > [data-item-section='content'] {
1461
- color: var(--trees-item-git-status-color);
1462
- }
1463
- & > [data-item-section='git'] {
1464
- color: var(--trees-item-git-status-color);
1465
- font-weight: var(--trees-font-weight-semibold);
1466
- }
1467
- }
1468
-
1469
- [data-item-git-status='added'] {
1470
- --trees-item-git-status-color: var(--trees-git-added-color);
1471
- }
1472
-
1473
- [data-item-git-status='deleted'] {
1474
- --trees-item-git-status-color: var(--trees-git-deleted-color);
1475
- }
1476
-
1477
- [data-item-git-status='ignored'] {
1478
- --trees-item-git-status-color: var(--trees-git-ignored-color);
1479
-
1480
- & > [data-item-section='icon'] {
1481
- opacity: 0.5;
1482
- }
1483
- }
1484
-
1485
- [data-item-section='git'] [data-icon-name='file-tree-icon-dot'] {
1486
- /* this is a nudge to align the dot with the likely lowercase text. it's slightly
1487
- generalizable, but other fonts are gonna need other nudges i assume */
1488
- transform: translateY(calc(0.65ex - 50%));
1489
- }
1490
-
1491
- [data-item-git-status='modified'] {
1492
- --trees-item-git-status-color: var(--trees-git-modified-color);
1493
- }
1494
-
1495
- [data-item-git-status='renamed'] {
1496
- --trees-item-git-status-color: var(--trees-git-renamed-color);
1497
- }
1498
-
1499
- [data-item-git-status='untracked'] {
1500
- --trees-item-git-status-color: var(--trees-git-untracked-color);
1501
- }
1502
-
1503
- /* Drag and drop */
1504
- [data-item-drag-target='true'] {
1505
- background-color: var(--trees-selected-bg);
1506
- }
1507
-
1508
- [data-item-dragging='true'] {
1509
- opacity: 0.5;
1510
- }
1511
-
1512
- /* Lock icon for locked paths (sibling of content) */
1513
- [data-item-section='lock'] {
1514
- flex: 0 0 auto;
1515
- margin-left: auto;
1516
- display: flex;
1517
- align-items: center;
1518
- color: var(--trees-fg-muted);
1519
- }
1520
- [data-item-section='lock'] svg {
1521
- display: block;
1522
- }
1523
-
1524
- [data-type='header-slot'] {
1525
- display: block;
1526
- flex: 0 0 auto;
1527
- }
1528
-
1529
- [data-type='context-menu-wash'] {
1530
- position: absolute;
1531
- inset: 0;
1532
- z-index: 3;
1533
- background-color: transparent;
1534
- touch-action: none;
1535
- }
1536
-
1537
- [data-type='context-menu-anchor'] {
1538
- position: absolute;
1539
- top: 0;
1540
- right: var(--trees-context-menu-trigger-inline-offset);
1541
- z-index: 4;
1542
- display: none;
1543
- align-items: center;
1544
-
1545
- &[data-visible='true'] {
1546
- display: flex;
1547
- }
1548
- }
1549
-
1550
- /* Hide the floating trigger while the scroll container is actively moving.
1551
- * The anchor is positioned against the root, not the scroll content, so its
1552
- * \`top\` follows the row via a React state update — one frame behind the
1553
- * compositor. That delay is visible as the trigger hovering over the wrong
1554
- * row during the first frame of a scroll. The \`data-is-scrolling\` flag on
1555
- * the root is flipped synchronously on \`wheel\`/\`touchmove\`/\`keydown\` before
1556
- * the compositor commits the next paint, so this selector hides the anchor
1557
- * in the same frame the scroll begins. */
1558
- [data-file-tree-virtualized-root='true'][data-is-scrolling]
1559
- [data-type='context-menu-anchor'] {
1560
- display: none;
1561
- }
1562
-
1563
- [data-type='context-menu-anchor'] > slot[name='context-menu'] {
1564
- display: block;
1565
- width: 0;
1566
- min-width: 0;
1567
- flex: 0 0 0;
1568
- overflow: visible;
1569
- }
1570
-
1571
- /* Single floating context menu trigger */
1572
- [data-type='context-menu-trigger'] {
1573
- all: unset;
1574
- align-items: center;
1575
- justify-content: center;
1576
- width: var(--trees-action-lane-width);
1577
- color: var(--trees-fg-muted);
1578
- fill: currentColor;
1579
- cursor: pointer;
1580
- font-family: var(--trees-font-family);
1581
- font-size: var(--trees-font-size);
1582
- border-top-right-radius: var(--trees-border-radius);
1583
- border-bottom-right-radius: var(--trees-border-radius);
1584
- margin: var(--trees-focus-ring-width);
1585
- height: calc(var(--trees-row-height) - var(--trees-focus-ring-width) * 2);
1586
- border-width: 0;
1587
- transition: color 120ms ease;
1588
-
1589
- display: flex;
1590
- }
1591
-
1592
- [data-type='context-menu-trigger']:hover,
1593
- [data-type='context-menu-trigger'][aria-expanded='true'] {
1594
- color: var(--trees-fg);
1595
- }
1596
-
1597
- /** @pierre/truncate css here, manually copy pasted for now */
1598
- [data-truncate-container] {
1599
- /* CUSTOM TO TREES, TO SUPPORT THE OUTLINE */
1600
- margin-top: -1px;
1601
- margin-bottom: -1px;
1602
-
1603
- /* Width of the fade from default marker to text */
1604
- --truncate-internal-marker-fade-width: var(
1605
- --truncate-marker-fade-width,
1606
- 2px
1607
- );
1608
- /* Width of the solid color between the fade from the default marker to the text */
1609
- --truncate-internal-marker-gap: var(--truncate-marker-gap, 0px);
1610
- /* Opacity of the marker 'color' property, not of the element itself */
1611
- --truncate-internal-marker-opacity: var(--truncate-marker-opacity, 50%);
1612
- /* Opacity of the marker 'color' property specifically for the middle truncate, not opacity of the element itself */
1613
- --truncate-internal-middle-marker-opacity: var(
1614
- --truncate-middle-marker-opacity,
1615
- 80%
1616
- );
1617
- /* Background color of the default marker */
1618
- --truncate-internal-marker-background-color: var(
1619
- --truncate-marker-background-color,
1620
- light-dark(white, black)
1621
- );
1622
- --truncate-internal-marker-background-overlay-color: var(
1623
- --truncate-marker-background-overlay-color,
1624
- transparent
1625
- );
1626
- --truncate-internal-marker-block-inset: var(
1627
- --truncate-marker-block-inset,
1628
- 0px
1629
- );
1630
- /* Duration of the fade out animation for the marker */
1631
- --truncate-internal-marker-fade-out-duration: var(
1632
- --truncate-marker-fade-out-duration,
1633
- 0ms
1634
- );
1635
- /* Duration of the fade in animation for the marker */
1636
- --truncate-internal-marker-fade-in-duration: var(
1637
- --truncate-marker-fade-in-duration,
1638
- 100ms
1639
- );
1640
-
1641
- /* FADE Variant specifics */
1642
- --truncate-internal-fade-marker-color: var(
1643
- --truncate-fade-marker-color,
1644
- #000
1645
- );
1646
- --truncate-internal-fade-marker-width: var(
1647
- --truncate-fade-marker-width,
1648
- 0.2lh
1649
- );
1650
-
1651
- /*
1652
- In some special cases people might be adding spacing in other ways
1653
- that would benefit from being able to override this, however the container
1654
- query below can't use this and would need to be redeclared with the overridden
1655
- value. It's a bad time, but better than nothing.
1656
- */
1657
- --truncate-internal-single-line-height: 1lh;
1658
-
1659
- height: var(--truncate-internal-single-line-height);
1660
- min-width: 0;
1661
- overflow: hidden;
1662
- }
1663
-
1664
- [data-truncate-marker] {
1665
- display: flex;
1666
- position: absolute;
1667
- height: var(--truncate-internal-single-line-height);
1668
- padding-block: var(--truncate-internal-marker-block-inset);
1669
- box-sizing: border-box;
1670
- align-items: center;
1671
- background-clip: content-box;
1672
- z-index: 2;
1673
- color: color-mix(
1674
- in srgb,
1675
- currentColor var(--truncate-internal-marker-opacity),
1676
- transparent
1677
- );
1678
-
1679
- /* Core trick for hiding the marker until overflow occurs */
1680
- opacity: 0;
1681
- transition: opacity var(--truncate-internal-marker-fade-out-duration)
1682
- ease-in-out;
1683
- }
1684
-
1685
- @container measure (height > 1lh) {
1686
- [data-truncate-marker] {
1687
- opacity: 1;
1688
- transition: opacity var(--truncate-internal-marker-fade-in-duration)
1689
- ease-in-out;
1690
- }
1691
- }
1692
-
1693
- [data-truncate-grid] {
1694
- display: grid;
1695
- position: relative;
1696
- }
1697
-
1698
- [data-truncate-content='visible'] {
1699
- white-space: nowrap;
1700
- }
1701
-
1702
- [data-truncate-content='overflow'] {
1703
- opacity: 0;
1704
- pointer-events: none;
1705
- -webkit-user-select: none;
1706
- user-select: none;
1707
- word-break: break-all;
1708
- margin-top: calc(-1 * var(--truncate-internal-single-line-height));
1709
- }
1710
-
1711
- [data-truncate-marker-cell] {
1712
- container: measure / size;
1713
- overflow: visible;
1714
- -webkit-user-select: none;
1715
- user-select: none;
1716
- pointer-events: none;
1717
- }
1718
-
1719
- [data-truncate-container='truncate'] {
1720
- & [data-truncate-grid] {
1721
- grid-template-columns: minmax(0, max-content) 0;
1722
- }
1723
- & [data-truncate-marker] {
1724
- right: 0;
1725
- }
1726
- & [data-truncate-fade] {
1727
- margin-right: calc(-2 * var(--truncate-internal-fade-marker-width));
1728
- }
1729
- }
1730
-
1731
- [data-truncate-container='fruncate'] {
1732
- & [data-truncate-grid] {
1733
- grid-template-columns: 0 minmax(0, max-content) auto;
1734
- }
1735
- & [data-truncate-content] {
1736
- direction: rtl;
1737
- }
1738
- & [data-truncate-content] > span {
1739
- unicode-bidi: plaintext;
1740
- }
1741
- & [data-truncate-fade] {
1742
- margin-left: calc(-2 * var(--truncate-internal-fade-marker-width));
1743
- }
1744
- }
1745
-
1746
- [data-truncate-variant='default'] {
1747
- & [data-truncate-marker] {
1748
- background-color: var(--truncate-internal-marker-background-color);
1749
- background-image: linear-gradient(
1750
- var(--truncate-internal-marker-background-overlay-color),
1751
- var(--truncate-internal-marker-background-overlay-color)
1752
- );
1753
- }
1754
- & [data-truncate-marker]::after,
1755
- & [data-truncate-marker]::before {
1756
- content: '';
1757
- position: absolute;
1758
- width: calc(
1759
- var(--truncate-internal-marker-fade-width) +
1760
- var(--truncate-internal-marker-gap)
1761
- );
1762
- inset-block-start: var(--truncate-internal-marker-block-inset);
1763
- height: max(
1764
- 0px,
1765
- calc(
1766
- var(--truncate-internal-single-line-height) -
1767
- var(--truncate-internal-marker-block-inset) * 2
1768
- )
1769
- );
1770
- background-color: var(--truncate-internal-marker-background-color);
1771
- background-image: linear-gradient(
1772
- var(--truncate-internal-marker-background-overlay-color),
1773
- var(--truncate-internal-marker-background-overlay-color)
1774
- );
1775
- mask-image: linear-gradient(
1776
- var(--truncate-internal-fade-dir),
1777
- #000 0%,
1778
- #000 var(--truncate-internal-marker-gap),
1779
- transparent 100%
1780
- );
1781
- }
1782
- & [data-truncate-marker]::after {
1783
- --truncate-internal-fade-dir: to right;
1784
- right: calc(
1785
- -1 *
1786
- (
1787
- var(--truncate-internal-marker-fade-width) +
1788
- var(--truncate-internal-marker-gap)
1789
- )
1790
- );
1791
- }
1792
- & [data-truncate-marker]::before {
1793
- --truncate-internal-fade-dir: to left;
1794
- left: calc(
1795
- -1 *
1796
- (
1797
- var(--truncate-internal-marker-fade-width) +
1798
- var(--truncate-internal-marker-gap)
1799
- )
1800
- );
1801
- }
1802
- }
1803
-
1804
- [data-truncate-variant='fade'] {
1805
- & [data-truncate-marker] {
1806
- background: transparent;
1807
- }
1808
- }
1809
-
1810
- [data-truncate-fade] {
1811
- box-shadow:
1812
- 0 0 calc(var(--truncate-internal-fade-marker-width) / 2)
1813
- var(--truncate-internal-fade-marker-color),
1814
- 0 0 var(--truncate-internal-fade-marker-width)
1815
- var(--truncate-internal-fade-marker-color);
1816
- width: calc(var(--truncate-internal-fade-marker-width) * 2);
1817
- height: calc(
1818
- var(--truncate-internal-single-line-height) -
1819
- (var(--truncate-internal-fade-marker-width) * 2)
1820
- );
1821
- margin: var(--truncate-internal-fade-marker-width) 0;
1822
- }
1823
-
1824
- [data-truncate-group-container='middle'] {
1825
- & [data-truncate-container] {
1826
- --truncate-marker-opacity: var(--truncate-internal-middle-marker-opacity);
1827
- }
1828
-
1829
- display: flex;
1830
- min-width: 0;
1831
-
1832
- & > div {
1833
- min-width: 0;
1834
- }
1835
-
1836
- & > div[data-truncate-segment-priority='1'] {
1837
- flex: 0 1 max-content;
1838
- }
1839
- & > div[data-truncate-segment-priority='2'] {
1840
- flex: 0 999999 max-content;
1841
- }
1842
- }
1843
- }
1844
- `,kq=`@layer base, unsafe;`;function Aq(e){return`${kq}
1845
- @layer base {
1846
- ${e}
1847
- }`}function jq(e){return`${kq}
1848
- @layer unsafe {
1849
- ${e}
1850
- }`}var Mq=new WeakMap;function Nq(e){let t=Mq.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(EU,`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(),Mq.set(e,i),i}function Pq(e,t){if(!e.isConnected)return;let n=Nq(t);if(n==null)return;let r=t.querySelector(`style[${DU}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(DU,``),t.appendChild(i)),i.textContent=`:host { ${OU}: ${n}px; }`}var Fq;function Iq(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){Fq??(Fq=new CSSStyleSheet,Fq.replaceSync(Aq(Oq)));let t=!1;try{e.adoptedStyleSheets=[Fq],t=!0}catch{}if(t){e.querySelector(`style[${wU}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(wU,``),t.textContent=Aq(Oq),e.prepend(t)}}function Lq(e,t){Rq(e,t),Iq(t),Pq(e,t)}function Rq(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`});Lq(this,e)}}if(customElements.define(CU,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(CU)))e instanceof HTMLElement&&Lq(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var zq=e=>e.startsWith(`f::`)?e.slice(3):e;function Bq(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function Vq(e,t){return e===``?t:`${e}/${t}`}function Hq({files:e,path:t,isFolder:n,nextBasename:r}){let i=zq(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}=Bq(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=Vq(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 Uq(e){return e.endsWith(`/`)}function Wq(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 Gq(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 Kq(e,t){return t.includes(e)?Gq(t):[e]}function qq(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 Jq(e,t){return{draggedPaths:e,target:t}}function Yq(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Uq(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function Xq(e,t){return t.kind===`root`||t.directoryPath==null?Wq(e):t.directoryPath}function Zq(e,t){let n=e.map(e=>{let n=Xq(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 Qq(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 $q(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(!Qq(Cq.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 eJ(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function tJ(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 nJ(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function rJ(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 nJ(e,t.path)?n?e:null:e;case`move`:return tJ(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=rJ(r,e,n),r==null)return null;return r}}}function iJ(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function aJ(e){switch(e.operation){case`add`:return{...iJ(e),operation:`add`,path:e.path};case`remove`:return{...iJ(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...iJ(e),from:e.from,operation:`move`,to:e.to}}}function oJ(e){return{...iJ(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>aJ(e)),operation:`batch`}}function sJ(e){switch(e.operation){case`add`:case`remove`:case`move`:return aJ(e);case`batch`:return oJ(e);default:return null}}function cJ(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function lJ(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 uJ(e){return lJ(e).at(-1)??null}function dJ(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function fJ(e){return e.endsWith(`/`)}var pJ=e=>e.toLowerCase();function mJ(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function hJ(e){return e.endsWith(`/`)?e.slice(0,-1):e}function gJ(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var _J=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},vJ=Symbol(`FILE_TREE_RENAME_VIEW`),yJ=512,bJ=512;function xJ(e){return e===`top`||e===`center`?e:`nearest`}function SJ(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=lJ(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 CJ(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:SJ(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var wJ=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=$q({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=uJ(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:xJ(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<=bJ){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=Kq(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=Jq(t.draggedPaths,n);(Yq(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}qq(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=Jq(e.draggedPaths,t);if(Yq(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=Zq(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=fJ(r),a=hJ(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of lJ(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=mJ(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[vJ](){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,fJ(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,fJ(e)?{recursive:!0}:void 0);return}let t=fJ(e),n=Hq({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:hJ(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(gJ(n.sourcePath,t),gJ(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=$q({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=!cJ(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=uJ(e),n=dJ(e,t),r=null,i=null;for(let e of this.#be()){if(uJ(e)!==t)continue;let a=dJ(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=lJ(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=!cJ(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 Cq({...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 lJ(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(pJ),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(pJ),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 lJ(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:_J(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 lJ(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 lJ(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=CJ(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,yJ)),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=rJ(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=rJ(this.#c,e,!0),r=[...this.#B].map(t=>rJ(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=rJ(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return cJ(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&&eJ(e)&&(this.#i=null);let t=eJ(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=sJ(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},TJ=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 EJ(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 DJ(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 OJ(e,t){return t?`${e}/`:e}function kJ(e,t=null){let n=TJ(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=EJ(t.path);if(e==null)continue;let n=OJ(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 DJ(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var AJ,jJ,MJ,NJ,PJ,FJ,IJ,LJ,RJ,zJ,BJ={},VJ=[],HJ=Array.isArray,UJ=VJ.slice,WJ=Object.assign;function GJ(e){e&&e.parentNode&&e.remove()}function KJ(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?UJ.call(arguments,2):n),qJ(e,o,r,i,null)}function qJ(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??++jJ,__i:-1,__u:0};return i==null&&AJ.vnode!=null&&AJ.vnode(a),a}function JJ(e){return e.children}function YJ(e,t){this.props=e,this.context=t,this.__g=0}function XJ(e,t){if(t==null)return e.__?XJ(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`?XJ(e):null}function ZJ(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 ZJ(e)}}function QJ(e){(8&e.__g||!(e.__g|=8)||!MJ.push(e)||PJ++)&&NJ==AJ.debounceRendering||((NJ=AJ.debounceRendering)||queueMicrotask)($J)}function $J(){for(var e,t,n,r,i,a,o,s,c=1;MJ.length;)MJ.length>c&&MJ.sort(FJ),e=MJ.shift(),c=MJ.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=WJ({},r)).__v=r.__v+1,AJ.vnode&&AJ.vnode(n),sY(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??XJ(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,lY(a,n,o),n.__e!=i&&ZJ(n)));PJ=0}function eY(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||VJ,b=t.length;for(c=tY(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?BJ:y[m.__i]||BJ,m.__i=f,_=sY(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&fY(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=nY(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function tY(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?qJ(null,o,null,null,null):HJ(o)?qJ(JJ,{children:o},null,null,null):o.constructor==null&&o.__b>0?qJ(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=rY(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=XJ(s)),pY(s,s));return r}function nY(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=nY(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=XJ(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function rY(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 iY(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function aY(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||iY(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||iY(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(IJ,`$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=LJ,e.addEventListener(t,a?zJ:RJ,a)):e.removeEventListener(t,a?zJ:RJ,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 oY(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=LJ++;else if(t.u<n.l)return;return n(AJ.event?AJ.event(t):t)}}}function sY(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=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=AJ.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.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 M(v,x):(t.__c=f=new YJ(v,x),f.constructor=M,f.render=mY),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&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=WJ({},f.__s)),WJ(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.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=AJ.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);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&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=WJ({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===JJ&&d.key==null&&(E=uY(d.props.children)),s=eY(e,HJ(E)?E:[E],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(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)GJ(a[j]);cY(t)}else t.__e=n.__e,t.__k=n.__k,e.then||cY(t);AJ.__e(e,t,n)}else s=t.__e=dY(n.__e,t,n,r,i,a,o,c,l,u);return(d=AJ.diffed)&&d(t),128&t.__u?void 0:s}function cY(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(cY)}function lY(e,t,n){for(var r=0;r<n.length;r++)fY(n[r],n[++r],n[++r]);AJ.__c&&AJ.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){AJ.__e(e,t.__v)}})}function uY(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:HJ(e)?e.map(uY):WJ({},e)}function dY(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&&=(AJ.__m&&AJ.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=UJ.call(e.childNodes),v=n.props||BJ,!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;aY(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&&!_||aY(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=``),eY(b==`template`?e.content:e,HJ(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&XJ(n,0),s,c,l),a!=null)for(u=a.length;u--;)GJ(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||aY(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&aY(e,u,g,v[u],i))}return e}function fY(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){AJ.__e(e,n)}}function pY(e,t,n){var r,i;if(AJ.unmount&&AJ.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||fY(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){AJ.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&pY(r[i],t,n||typeof e.type!=`function`);n||GJ(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function mY(e,t,n){return this.constructor(e,n)}function hY(e,t){var n,r,i,a;t==document&&(t=document.documentElement),AJ.__&&AJ.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=KJ(JJ,null,[e]),i=[],a=[],sY(t,e,r||BJ,BJ,t.namespaceURI,r?null:t.firstChild?UJ.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),lY(i,e,a)}function gY(e,t){e.__u|=32,hY(e,t)}AJ={__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 PJ=0,e}},jJ=0,YJ.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=WJ({},this.state);typeof e==`function`&&(e=e(WJ({},n),this.props)),e&&WJ(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),QJ(this))},YJ.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),QJ(this))},YJ.prototype.render=JJ,MJ=[],PJ=0,FJ=function(e,t){return e.__v.__b-t.__v.__b},IJ=/(PointerCapture)$|Capture$/i,LJ=0,RJ=oY(!1),zJ=oY(!0);var _Y=0;Array.isArray;function vY(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:--_Y,__i:-1,__u:0,__source:i,__self:a};return AJ.vnode&&AJ.vnode(l),l}var yY=16,bY=16,xY={};function SY({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}=xY[e]??{width:yY,height:bY},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return vY(`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:vY(`use`,{href:c})})}var CY=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},wY=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)]},TY=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)]},EY=(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)]},DY=(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)]},OY=(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 kY({children:e,marker:t,variant:n=`default`}){"use no memo";return vY(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:vY(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?vY(`span`,{"data-truncate-fade":!0}):t})})}function AY(e){"use no memo";let{mode:t,children:n}=e;return vY(`div`,{children:[vY(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?vY(`span`,{children:n}):n}),vY(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?vY(`span`,{children:n}):n})]})}function jY({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=vY(AY,{mode:t,children:e},`content`),o=vY(kY,{marker:n,mode:t,variant:r},`marker`),s=vY(`div`,{"data-truncate-fill":!0},`fill`);return vY(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:vY(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function MY({children:e,...t}){"use no memo";return vY(jY,{mode:`truncate`,...t,children:e})}function NY({children:e,...t}){"use no memo";return vY(jY,{mode:`fruncate`,...t,children:e})}function PY({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=vY(MY,{...s,children:t[0]}),l=vY(NY,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return vY(`div`,{className:a,style:o});if(e.length<i)return vY(n===`end`?NY:MY,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=CY:r===`extension`?t=wY:r===`leaf-path`&&(t=TY);else if(typeof r==`number`)t=EY,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=DY:e===`first`&&(t=OY)}else typeof r==`function`&&(t=r);t??=CY;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=vY(MY,{...s,..._,children:f}),l=vY(NY,{...s,...v,children:p})}return vY(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[vY(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),vY(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var FY={endIndex:-1,startIndex:-1};function IY(e,t,n){return Math.min(Math.max(e,t),n)}function LY(e,t){return e<0||t<e?FY:{endIndex:t,startIndex:e}}function RY(e){return e.startIndex<0||e.endIndex<e.startIndex}function zY(e,t){return RY(e)?0:(e.endIndex-e.startIndex+1)*t}function BY(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function VY(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function HY(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 UY(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 WY(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 GY(e,t,n){if(e.length===0||t<=0)return[];let r=WY(e),i=HY(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=UY(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 KY(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=IY(t.scrollTop,0,o),c=t.stickyRows??GY(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=BY(s,n,t.itemHeight),m=BY(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?FY:LY(m,VY(u+d,n,t.itemHeight)),y=g+1,b=RY(v)?FY:LY(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=zY(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:RY(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var qY={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},JY={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},YY=`Contains git status items`;function XY(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 ZY(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return XY({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 QY(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 $Y(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 eX(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 tX(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function nX(e,t){return e!=null&&e>0?e:t}function rX(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 iX(e,t,n,r,i=0){let a=XY({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function aX(e,t,n,r,i,a,o=0){let s=ZY({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function oX(e,t,n,r,i,a){let o=QY({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function sX(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function cX(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function lX({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return vY(`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 uX(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 dX(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 fX,pX,mX,hX,gX=Object.is,_X=0,vX=[],yX=AJ,bX=yX.__b,xX=yX.__r,SX=yX.diffed,CX=yX.__c,wX=yX.unmount,TX=yX.__;function EX(e,t){yX.__h&&yX.__h(pX,e,_X||t),_X=0;var n=pX.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function DX(e){return _X=1,OX(BX,e)}function OX(e,t,n){var r=EX(fX++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):BX(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);gX(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=pX,!pX.__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,gX(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};pX.__f=!0;var a=pX.shouldComponentUpdate,o=pX.componentWillUpdate;pX.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)},pX.shouldComponentUpdate=i}return r.__N||r.__}function kX(e,t){var n=EX(fX++,3);!yX.__s&&zX(n.__H,t)&&(n.__=e,n.u=t,pX.__H.__h.push(n))}function AX(e,t){var n=EX(fX++,4);!yX.__s&&zX(n.__H,t)&&(n.__=e,n.u=t,pX.__h.push(n))}function jX(e){return _X=5,MX(function(){return{current:e}},[])}function MX(e,t){var n=EX(fX++,7);return zX(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function NX(e,t){return _X=8,MX(function(){return e},t)}function PX(){for(var e;e=vX.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(LX),e.__H.__h.forEach(RX),e.__H.__h=[]}catch(t){e.__H.__h=[],yX.__e(t,e.__v)}}yX.__b=function(e){pX=null,bX&&bX(e)},yX.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),TX&&TX(e,t)},yX.__r=function(e){xX&&xX(e),fX=0;var t=(pX=e.__c).__H;t&&(mX===pX?(t.__h=[],pX.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(LX),t.__h.forEach(RX),t.__h=[],fX=0)),mX=pX},yX.diffed=function(e){SX&&SX(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(vX.push(t)!==1&&hX===yX.requestAnimationFrame||((hX=yX.requestAnimationFrame)||IX)(PX)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),mX=pX=null},yX.__c=function(e,t){t.some(function(e){try{e.__h.forEach(LX),e.__h=e.__h.filter(function(e){return!e.__||RX(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],yX.__e(n,e.__v)}}),CX&&CX(e,t)},yX.unmount=function(e){wX&&wX(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{LX(e)}catch(e){t=e}}),n.__H=void 0,t&&yX.__e(t,n.__v))};var FX=typeof requestAnimationFrame==`function`;function IX(e){var t,n=function(){clearTimeout(r),FX&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);FX&&(t=requestAnimationFrame(n))}function LX(e){var t=pX,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),pX=t}function RX(e){var t=pX;e.__c=e.__(),pX=t}function zX(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!gX(t,e[n])})}function BX(e,t){return typeof t==`function`?t(e):t}function VX(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:vY(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return vY(JJ,{children:[vY(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:vY(MY,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function HX(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function UX(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function WX(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 GX({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=KY(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:WX(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?WX(u,1,t,o):i&&r<=0&&c.length>0?GY(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 KX=400,qX=10,JX=40,YX=18;function XX(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))?ZX(e,t,n):a instanceof HTMLElement?a:null}function ZX(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 QX(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return e?.closest?.(`[data-file-tree-virtualized-scroll]`)instanceof HTMLElement?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:null,kind:`root`}: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 $X(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 eZ(){return navigator.vendor!==`Apple Computer, Inc.`}function tZ(e,t){let n=e-t.top;if(n<JX)return-Math.ceil((JX-Math.max(0,n))/JX*YX);let r=t.bottom-e;return r<JX?Math.ceil((JX-Math.max(0,r))/JX*YX):0}function nZ(e,t){if(e!=null){let t=qY[e];return t==null?null:{text:t,title:JY[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:YY}:null}function rZ(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 iZ(e){return e!=null&&`toggle`in e}function aZ(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function oZ(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function sZ(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function cZ(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function lZ(e,t){return t&&cZ(e)||(e.ctrlKey||e.metaKey)&&aZ(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var uZ=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function dZ(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 fZ(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 pZ(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function mZ(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function hZ(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function gZ(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 _Z(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 vZ(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 yZ(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=vZ(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 bZ(e,t){return{kind:e.kind,name:UX(e),path:t}}function xZ(e){return e==null?void 0:`${e}__tree`}function SZ(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function CZ(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function wZ(e,t){if(e==null)return null;if(`text`in e)return vY(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?CZ(e.icon)?t(e.icon):{name:e.icon}:CZ(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return vY(`span`,{title:e.title,children:vY(SY,{...n})})}function TZ(e){e!=null&&$Y(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function EZ(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=HX(e);return vY(JJ,{children:[e.depth>0?vY(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>vY(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,vY(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?vY(SY,{...t(`file-tree-icon-chevron`)}):vY(SY,{...t(`file-tree-icon-file`,u)})}),vY(`div`,{"data-item-section":`content`,children:e.isFlattened?VX(e,c,a):c??vY(PY,{minimumLength:5,split:`extension`,children:e.name})}),i?vY(`div`,{"data-item-section":`decoration`,children:r==null?null:wZ(r,t)}):null,s?vY(`div`,{"data-item-section":`git`,children:wZ(o,t)}):null,n?vY(`div`,{"data-item-section":`action`,children:l?vY(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:vY(SY,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function DZ(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:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=HX(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??rZ(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=nZ(z,B),U=S&&w,ee=V!=null||x||U,W=U&&T===`always`,te=a.getPath()===P,G=te?a.getValue():``,ne=R||!te?null:vY(lX,{ref:D,ariaLabel:`Rename ${UX(t)}`,isFlattened:t.isFlattened,value:G,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),K=EZ(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:ee,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:ne,showDecorativeActionAffordance:W}),q={...uX({ariaLabel:UX(t),domId:t.isFocused?SZ(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:U,contextMenuButtonVisibility:U?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:B,effectiveGitStatus:z,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(P),j(t,P,{anchorRect:pZ(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&te?vY(`div`,{...q,children:K}):vY(`button`,{...q,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:K})}function OZ(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(HX(e))).map((n,r)=>DZ(e,n,t.start+r))}function kZ({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Dq,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 _=jX(null),v=jX(null),y=jX(!1),b=jX(null),x=jX(null),S=jX(null),C=jX(null),w=jX(null),T=jX(new Map),E=jX(new Map),D=jX(()=>{}),O=jX(null),k=jX(0),A=jX(!1),j=jX(null);j.current!==t&&(A.current=!1,j.current=t);let M=jX(!1),N=jX(null),P=jX(null),F=jX(!1),I=jX(null),L=jX(null),R=jX(null),z=jX(null),B=jX(null),V=jX(null),H=jX(null),U=jX(null),ee=jX(!1),W=jX(null),te=jX(null),G=jX(null),ne=jX(null),K=MX(()=>new Map,[]),[,q]=DX(0),[re,ie]=DX(null),[ae,oe]=DX(null),[se,ce]=DX(null),[le,ue]=DX(null),[de,fe]=DX(0),[pe,me]=DX(null),he=jX(pe);he.current=pe;let ge=jX(null),_e=jX(null),ve=jX(null),ye=jX(null),be=jX(null),xe=jX(!1),Se=()=>{_e.current=null,ve.current=null,ye.current=null},Ce=(e,t)=>{_e.current=e,ve.current=null,ye.current=t==null?null:{path:e,scrollTop:t}},we=(e,t)=>{_e.current=null,ve.current={path:e,viewportOffset:t},ye.current=null},Te=jX(d===`retain`&&t.isSearchOpen()),[Ee,De]=DX(p);kX(()=>{p||De(!1)},[p]);let Oe=jX(!1),ke=NX(()=>{Oe.current=!0,De(e=>e&&!1)},[]),[Ae,je]=DX(()=>GX({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Me,Ne]=DX(!1);kX(()=>{Ne(!0)},[]);let Pe=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Fe=e?.contextMenu?.triggerMode??(Pe?`right-click`:`both`),Ie=Fe===`both`||Fe===`button`,Le=e?.contextMenu?.buttonVisibility??`when-needed`,Re=Fe===`both`||Fe===`right-click`;AX(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;be.current=t,oe(t),ue(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(xe.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 ze=NX((e,t)=>{hZ(T.current,e,t)},[]),Be=NX((e,t)=>{hZ(E.current,e,t)},[]),Ve=NX(e=>{x.current=e},[]),He=NX(e=>gZ(e,E.current,T.current),[]),Ue=n!=null||r!=null||i!=null,{resolveIcon:We}=MX(()=>RU(a),[a]),Ge=t[vJ](),Ke=Ge.getPath(),qe=Ke!=null,Je=t.isSearchOpen(),Ye=t.getSearchValue(),Xe=t.getFocusedPath(),Ze=t.getFocusedIndex(),Qe=t.getScrollRequest(),$e=t.isDragAndDropEnabled(),et=t.getDragSession(),tt=MX(()=>et==null?null:new Set(et.draggedPaths),[et]),nt=et?.target??null,rt=et?.primaryPath??null,it=xZ(o),{overlayHeight:at,overlayRows:ot,snapshot:st,visibleRows:ct}=Ae,lt=st.physical.viewportHeight,ut=MX(()=>({end:st.window.endIndex,start:st.window.startIndex}),[st.window.endIndex,st.window.startIndex]),dt=ot,ft=st.sticky.rows,pt=st.physical.totalHeight,mt=st.sticky.height,ht=MX(()=>new Set(ft.map(e=>HX(e.row))),[ft]),gt=Ze>=0&&Ze>=ut.start&&Ze<=ut.end,_t=NX((e,t)=>u?.({item:bZ(e,t),row:e})??null,[u]),vt=NX(e=>$Y(e==null?null:T.current.get(e)??null)?!0:$Y(S.current),[]),yt=NX(e=>{vt(t.focusNearestPath(e))},[t,vt]),bt=jX(yt);bt.current=yt;let xt=jX(!0),St=jX(()=>{}),Ct=NX((t=!0)=>{let n=he.current;n!=null&&(xt.current=xt.current&&t,me(null),e?.contextMenu?.onClose?.(),xt.current&&yt(n.path))},[e?.contextMenu,yt]);St.current=Ct;let wt=NX(e=>{let t=e==null?null:mZ(S.current,e);ce(e=>e===t?e:t)},[]),Tt=NX((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=He(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Ce(n,e?.scrollTop??null),M.current=!0,ie(e=>e===n?e:n)}i.focus(),wt(a),xt.current=!0,me({anchorRect:r?.anchorRect??null,item:bZ(e,n),path:n,source:r?.source??`keyboard`})},[t,He,wt]),Et=NX(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=tX(e,lt);I.current=Ze<0||e==null?null:Math.max(0,Math.min(Ze*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(ue(`focus`),q(e=>e+1))}},[t,Ze,s,l,lt]),J=NX((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=tX(i,lt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:GX({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,oX(i,a,s,l,u,d),D.current(),ge.current=n?e:null,!0},[t,s,c,lt,h]),Dt=()=>y.current===!0||ne.current!=null||ee.current===!0,Ot=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),kt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},At=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},jt=()=>{V.current?.remove(),V.current=null},Mt=()=>{kt(L.current),L.current=null,B.current=null},Nt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Pt=()=>{U.current?.(),U.current=null,ne.current!=null&&(clearTimeout(ne.current),ne.current=null),ee.current=!1,W.current=null,G.current=null,te.current!=null&&(te.current.setAttribute(`draggable`,`true`),te.current.style.removeProperty(`touch-action`),te.current=null),jt(),At(),Mt(),H.current=null},Ft=(e,n)=>{let r=S.current?.getRootNode(),i=QX(XX(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},It=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){At();return}let r=t.getItem(e.directoryPath),i=iZ(r)?r:null;if(i==null||i.isExpanded()){At();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(At(),R.current=a,z.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Lt=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=tZ(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,D.current()),It(Ft(e.clientX,e.clientY)),L.current=Ot(Lt)},Rt=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=Ot(Lt)},zt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Pt(),jt(),At(),Mt(),t.startDrag(r)===!1){e.preventDefault();return}if(H.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),eZ())){let t=$X(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Nt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Bt=()=>{jt(),At(),Mt(),H.current=null,t.cancelDrag()},Vt=(e,n,r)=>{if(ne.current!=null||ee.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;G.current={clientX:i.clientX,clientY:i.clientY},te.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!ee.current;ne.current!=null&&(clearTimeout(ne.current),ne.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),U.current===o&&(U.current=null),t&&(a.setAttribute(`draggable`,`true`),te.current===a&&(te.current=null),G.current=null)},s=e=>{let t=e.touches[0],n=G.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=qX*qX||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,ne.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),te.current===a&&(te.current=null),G.current=null;return}ee.current=!0,te.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),H.current=n;let e=a.getBoundingClientRect(),s=$X(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`}),Nt(s),V.current=s,W.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=W.current;n!=null&&V.current!=null&&(V.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),It(Ft(t.clientX,t.clientY)),Rt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Ft(n.clientX,n.clientY),t.completeDrag(),Pt()},u=()=>{t.cancelDrag(),Pt()};U.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)},KX)},Ht=e=>{if(pe!=null){if(e.key===`Escape`){Ct(),e.preventDefault(),e.stopPropagation();return}uZ.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ge.isActive()){if(e.key===`Escape`)Ge.cancel();else if(e.key===`Enter`)Ge.commit();else return;ue(`focus`),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Et(Xe??void 0),e.preventDefault(),e.stopPropagation();return}if(Je){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=tX(n,lt);I.current=Ze<0||n==null?null:Math.max(0,Math.min(Ze*s-n.scrollTop,Math.max(0,r-s))),F.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;ue(`focus`),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&oZ(e)){t.openSearch(e.key),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Pe&&cZ(e),r=lZ(e,Pe),i=r&&S.current!=null?eX(S.current):null,a=r?new Set(_Z(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Xe&&a.has(o)){let e=C.current;Ce(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=iZ(p)?p:null,h=u!=null&&(ht.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=gZ(u,E.current,T.current);e==null||n==null?y=!1:Tt(e,u)}else if((e.ctrlKey||e.metaKey)&&aZ(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;ue(`focus`);let b=t.getFocusedPath(),x=b!=null&&(ht.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Ce(b,v?.scrollTop??null),M.current=!0,ie(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(we(b,yZ(S.current,v,i,u,s,mt,lt)),M.current=!0,ie(e=>e===b?e:b)):Se()}q(e=>e+1),e.preventDefault(),e.stopPropagation()};AX(()=>{if(!(!f||!Je)){if(Te.current){Te.current=!1;return}$Y(w.current)}},[Je,f]),AX(()=>{let e=x.current;switch(cX({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:Ke})){case`reset`:P.current=null;return;case`reveal-canonical`:Ke!=null&&J(Ke,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(ge.current=null,P.current=Ke,$Y(e),e.select());return}},[ut.end,ut.start,Ke,J,ht]),AX(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=eX(e)?.dataset.itemPath??null;ie(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,eX(e)!=null){r();return}M.current=!1,ie(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,ie(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;ie(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),AX(()=>{let e=S.current;e!=null&&(st.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[st.physical.scrollTop]),AX(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=tX(n,g);let a=()=>{let e=t.getVisibleCount(),r=nX(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),je(GX({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=nX(O.current,g),i=t.getVisibleRows(e,e)[0]??null;iX(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=!1,l=t.subscribe(()=>{o?q(e=>e+1):o=!0,a()}),u=()=>{xe.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,fe(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||xe.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),he.current!=null&&y.current&&St.current(),xe.current===!0){y.current=!1;return}oe(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 w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:rX(e[0]))??tX(n,g),a()}):null;return w?.observe(n),()=>{D.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,O.current=null,w?.disconnect()}},[t,g,s,c,h]),AX(()=>{Pe||pe==null||Ct(!1)},[Ct,Pe,pe]);let Ut=MX(()=>pe==null?null:`${pe.path}::${pe.source}`,[pe]);AX(()=>{if(Ut==null){m?.clearSlotContent(AU);return}let t=he.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??fZ(n.getBoundingClientRect()),close:e=>{St.current(e?.restoreFocus??!0)},restoreFocus:()=>{xt.current&&bt.current(he.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(AU,i),e?.contextMenu?.onOpen?.(t.item,r),TZ(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&TZ(i)}),()=>{m?.clearSlotContent(AU)}},[Ut,e?.contextMenu,m]),AX(()=>{pe!=null&&t.getItem(pe.path)==null&&Ct()},[Ct,pe,t]),AX(()=>{if(pe==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(dZ(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Ct())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Ct())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Ct,pe]),AX(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=Xe;return}let r=Xe==null?null:T.current.get(Xe)??null,i=eX(n),a=i?.dataset.itemPath??null,o=qe&&x.current===i,c=f&&w.current===i,l=F.current&&!Je,u=I.current??0,d=ge.current,p=_e.current,m=ve.current,g=ye.current,_=i!=null,v=M.current||_,y=N.current!==Xe,b=p!=null&&p===Xe&&Xe!=null,E=!1,O=!1;if(Qe!=null&&Qe.id!==k.current){k.current=Qe.id;let n=Qe.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,lt-s))):mt;E=!0,O=aX(e,n,s,lt,pt,Qe.offset,t)}t.clearScrollRequest(Qe.id)}let A=!E&&l&&oX(e,Ze,s,lt,pt,u),j=!E&&d!=null&&d===Xe&&oX(e,Ze,s,lt,pt,mt),P=!E&&m!=null&&m.path===Xe&&oX(e,Ze,s,lt,pt,m.viewportOffset),L=!E&&g!=null&&g.path===Xe&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==Xe&&!b&&iX(e,Ze,s,lt,mt))&&D.current(),E){N.current=Xe;return}if(!v){N.current=Xe;return}if(o){N.current=Xe;return}if(c&&!l){N.current=Xe;return}if(r==null){l&&Ze>=0&&(oX(e,Ze,s,lt,pt,u),D.current()),N.current=Xe;return}(y||l||d===Xe||p===Xe||m?.path===Xe||g?.path===Xe||a==null||a!==Xe)&&($Y(r),d===Xe&&(ge.current=null),p===Xe&&(_e.current=null),m?.path===Xe&&(ve.current=null),g?.path===Xe&&(ye.current=null),F.current=!1,I.current=null),N.current=Xe},[t,Ze,Xe,gt,s,qe,Je,ut,lt,f,Qe,h,mt,pt,ct]);let Wt=Ze>=0&&Ze>=st.visible.startIndex&&Ze<=st.visible.endIndex,Gt=Xe!=null&&dt.some(e=>HX(e.row)===Xe),Kt=Wt||Gt,qt=Ie&&M.current===!0&&Kt?Xe:null,Jt=le===`pointer`?ae:null,Yt=pe?.path??be.current??Jt??qt??ae,Xt=pe?.source===`right-click`;AX(()=>{y.current&&pe==null||wt(He(Yt))},[pe,He,ut,lt,de,dt,Yt,wt,ct]);let Zt=NX(e=>{if(y.current||dZ(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&&ue(e=>e===`pointer`?e:`pointer`),oe(e=>e===i?e:i)},[]),Qt=NX(()=>{oe(null)},[]);AX(()=>{if(!$e)return;let e=()=>{Pt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Pt(),t.cancelDrag()}},[t,$e]);let $t=e=>{if(!$e||t.getDragSession()==null||ee.current)return;let n=QX(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),It(t.getDragSession()?.target??null),Rt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},en=e=>{if(!$e||t.getDragSession()==null||ee.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(At(),Mt(),t.setDragTarget(null))},tn=e=>{!$e||t.getDragSession()==null||ee.current||(e.preventDefault(),Ft(e.clientX,e.clientY),t.completeDrag(),jt(),At(),Mt(),H.current=null)},nn=st.window.height,rn=st.window.offsetTop,an=Math.min(0,lt-nn),on=Math.min(0,lt-nn-mt),sn=re===Xe||F.current,cn=Xe!=null&&sn&&!gt&&Ze>=0?ct[Ze]??t.getVisibleRows(Ze,Ze)[0]??null:null,Y=cn==null?null:sX(Ze,s,ut,nn),ln=H.current,un=rt!=null&&ln!=null&&ln.path===rt&&ln.index>=ut.start&&ln.index<=ut.end,dn=rt!=null&&ln!=null&&ln.path===rt&&!un&&ln.path!==cn?.path?ln:null,X=dn==null?null:sX(dn.index,s,ut,nn),fn=sZ((Ze>=0?ct[Ze]??t.getVisibleRows(Ze,Ze)[0]??null:null)?.ancestorPaths.at(-1)??null),pn=Je&&Xe!=null?SZ(o,Xe,!gt):void 0,mn=pe?.path??(Je?Xe:re),hn=pe?.path??ae,gn=He(Yt),_n=Pe&&Ie&&!Xt&&!qe&&gn!=null&&se!=null&&Yt!=null,vn=Pe&&(_n||pe!=null),yn=pe?.anchorRect,bn=yn==null&&gn!=null&&se!=null&&(pe!=null||_n)?se:null,xn=yn==null?bn==null?void 0:{top:`${bn}px`}:{left:`${yn.left}px`,position:`fixed`,right:`auto`,top:`${yn.top}px`},Sn=Xt?{opacity:`0`}:void 0,Cn=NX((e,n,r,i)=>{let a=dX({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:Je,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>=st.visible.startIndex&&n.index<=st.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,ie(e=>e===c?e:c),ue(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&J(c,{targetOffset:`sticky-parents`})},[t,Je,st.visible.endIndex,st.visible.startIndex,J]),wn=()=>{if(y.current||!Ie||Yt==null||gn==null)return;let e=t.getItem(Yt);e!=null&&(wt(gn),xt.current=!0,me({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:gn.getAttribute(`aria-label`)??Yt,path:e.getPath()},path:e.getPath(),source:`button`}))},Tn={contextHoverPath:hn,contextMenuButtonTriggerEnabled:Ie,contextMenuButtonVisibility:Le,contextMenuEnabled:Pe,contextMenuRightClickEnabled:Re,contextMenuTriggerMode:Fe,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:$e,draggedPathSet:tt,dragTarget:nt,gitLaneActive:Ue,gitStatusByPath:n,handleRowDragEnd:Bt,handleRowDragStart:zt,handleRowTouchStart:Vt,ignoredGitDirectories:r,ignoredInheritanceCache:K,instanceId:o,itemHeight:s,onKeyDown:Ht,onRowClick:Cn,openContextMenuForRow:Tt,registerButton:ze,registerRenameInput:Ve,renameView:Ge,renderDecorationForRow:_t,resolveIcon:We,shouldSuppressContextMenu:Dt,visualFocusPath:mn},En={...Tn,registerButton:Be};return vY(`div`,{ref:S,id:it,"data-file-tree-context-menu-button-visibility":Pe&&Ie?Le:void 0,"data-file-tree-context-menu-trigger-mode":Pe?Fe:void 0,"data-file-tree-has-context-menu-action-lane":Pe&&Ie?`true`:void 0,"data-file-tree-has-git-lane":Ue?`true`:void 0,"data-file-tree-virtualized-root":`true`,"data-file-tree-root-drag-target":nt?.kind===`root`?`true`:void 0,onDragLeave:$e?en:void 0,onDragOver:$e?$t:void 0,onDrop:$e?tn:void 0,onKeyDown:Ht,onPointerLeave:Pe?Qt:void 0,onPointerOver:Pe?Zt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[vY(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:fn}}),vY(`slot`,{name:kU,"data-type":`header-slot`}),f?vY(`div`,{"data-file-tree-search-container":!0,"data-open":Je?`true`:`false`,children:vY(`input`,{ref:w,"aria-activedescendant":pn,"aria-controls":it,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ee?`true`:void 0,value:Ye,onBlur:()=>{d===`retain`&&!Oe.current||t.closeSearch()},onFocus:ke,onPointerDown:ke,onInput:e=>{ke();let n=e.currentTarget;t.setSearch(n.value)}})}):null,vY(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Me&&dt.length>0?vY(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:vY(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${at}px`},children:dt.map((e,t)=>DZ(En,e.row,`sticky:${HX(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${dt.length-t}`}}))})}):null,vY(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${pt}px`},children:[vY(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${rn}px`}}),vY(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${nn}px`,top:`${an}px`,bottom:`${on}px`},children:[OZ(Tn,ut,ht),cn!=null&&Y!=null?DZ(Tn,cn,`parked:${cn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:rt===cn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${Y}px`}}):null,dn!=null&&X!=null?DZ(Tn,dn,`parked-drag:${dn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${X}px`}}):null]})]})]}),Pe?vY(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":vn?`true`:`false`,style:xn,children:[vY(`button`,{ref:v,type:`button`,"data-type":jU,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":pe==null?`false`:`true`,"data-visible":_n?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),pe!=null){Ct();return}wn()},tabIndex:-1,style:Sn,children:vY(SY,{...We(`file-tree-icon-ellipsis`)})}),pe==null?null:vY(`slot`,{name:AU})]}):null,pe==null?null:vY(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Ct()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Ct()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var AZ={hydrateRoot:(e,t)=>{gY(KJ(kZ,t),e)},renderRoot:(e,t)=>{hY(KJ(kZ,t),e)},unmountRoot:e=>{hY(null,e)}};function jZ(e,t){AZ.renderRoot(e,t)}function MZ(e,t){AZ.hydrateRoot(e,t)}function NZ(e){AZ.unmountRoot(e)}var PZ=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)}}},FZ=`__c`,IZ=`__k`,LZ=`__d`,RZ=`__s`,zZ=/[\s\n\\/='"\0<>]/,BZ=/^(xlink|xmlns|xml)([A-Z])/,VZ=/^(?: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])/,HZ=/^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/,UZ=new Set([`draggable`,`spellcheck`]);function WZ(e){e.__g===void 0?e[LZ]=!0:e.__g|=8}function GZ(e){e.__g===void 0?e[LZ]=!1:e.__g&=-9}function KZ(e){return e.__g===void 0?!0===e[LZ]:!!(8&e.__g)}var qZ=/["&<]/;function JZ(e){if(e.length===0||!1===qZ.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 YZ={},XZ=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(`.`)),ZZ=/[A-Z]/g;function QZ(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:YZ[n]||(YZ[n]=n.replace(ZZ,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||XZ.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function $Z(){this.__d=!0}function eQ(e,t){return{__v:e,context:t,props:e.props,setState:$Z,forceUpdate:$Z,__d:!0,__h:[]}}function tQ(e,t,n){if(!e.s){if(n instanceof nQ){if(!n.s)return void(n.o=tQ.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(tQ.bind(null,e,t),tQ.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var nQ=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{tQ(r,1,a(this.v))}catch(e){tQ(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?tQ(r,1,t?t(i):i):n?tQ(r,1,n(i)):tQ(r,2,i)}catch(e){tQ(r,2,e)}},r},e}(),rQ,iQ,aQ,oQ,sQ={},cQ=Array.isArray,lQ=Object.assign,uQ=``,dQ=`<!--$s-->`,fQ=`<!--/$s-->`;function pQ(e,t){var n,r=e.type,i=!0;return e[FZ]?(i=!1,(n=e[FZ]).state=n[RZ]):n=new r(e.props,t),e[FZ]=n,n.__v=e,n.props=e.props,n.context=t,WZ(n),n.state??=sQ,n[RZ]??(n[RZ]=n.state),r.getDerivedStateFromProps?n.state=lQ({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[RZ]===n.state?n.state:n[RZ]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),aQ&&aQ(e),n.render(n.props,n.state,t)}function mQ(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===uQ)return uQ;var s=typeof e;if(s!=`object`)return s==`function`?uQ:s==`string`?JZ(e):e+uQ;if(cQ(e)){var c,l=uQ;i[IZ]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=mQ(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=uQ,cQ(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return uQ;e.__=i,rQ&&rQ(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===JJ){if(`tpl`in g){for(var x=uQ,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&&!cQ(C)?x+=C:x+=mQ(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+JZ(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=pQ(e,b),y=e[FZ];else{e[FZ]=y=eQ(e,b);for(var E=0;KZ(y)&&E++<25;){GZ(y),aQ&&aQ(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}WZ(y)}if(y.getChildContext!=null&&(t=lQ({},t,y.getChildContext())),T&&AJ.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===JJ&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return mQ(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[RZ]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,sQ),KZ(y)?(v=pQ(e,t),(y=e[FZ]).getChildContext!=null&&(t=lQ({},t,y.getChildContext())),mQ(v=v!=null&&v.type===JJ&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):uQ}finally{iQ&&iQ(e),oQ&&oQ(e)}}}v=v!=null&&v.type===JJ&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=mQ(v,t,n,r,e,a,o);return iQ&&iQ(e),AJ.unmount&&AJ.unmount(e),e._suspended?typeof D==`string`?dQ+D+fQ:cQ(D)?(D.unshift(dQ),D.push(fQ),D):D.then(function(e){return dQ+e+fQ}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return mQ(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=AJ.__e;return k&&k(i,e),uQ}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=mQ(v,t,n,r,e,a,o);return e._suspended?dQ+s+fQ:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=uQ;for(var N in g){var P=g[N];if(typeof(P=gQ(P)?P.value:P)!=`function`||N===`class`||N===`className`){switch(N){case`children`:A=P;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;N=`for`;break;case`className`:if(`class`in g)continue;N=`class`;break;case`defaultChecked`:N=`checked`;break;case`defaultSelected`:N=`selected`;break;case`defaultValue`:case`value`:switch(N=`value`,h){case`textarea`:A=P;continue;case`select`:r=P;continue;case`option`:r!=P||`selected`in g||(j+=` selected`)}break;case`dangerouslySetInnerHTML`:M=P&&P.__html;continue;case`style`:typeof P==`object`&&(P=QZ(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(BZ.test(N))N=N.replace(BZ,`$1:$2`).toLowerCase();else{if(zZ.test(N))continue;N[4]!==`-`&&!UZ.has(N)||P==null?n?HZ.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):VZ.test(N)&&(N=N.toLowerCase()):P+=uQ}}P!=null&&!1!==P&&(j=!0===P||P===uQ?j+` `+N:j+` `+N+`="`+(typeof P==`string`?JZ(P):P+uQ)+`"`)}}if(zZ.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=JZ(A):A!=null&&!1!==A&&!0!==A&&(M=mQ(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),iQ&&iQ(e),oQ&&oQ(e),!M&&hQ.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return cQ(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var hQ=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function gQ(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var _Q=0;function vQ(e){return e!=null&&e.length>0?e:(_Q+=1,`pst_ft_${_Q}`)}function yQ({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Dq)}function bQ(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 xQ(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 SQ(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var CQ=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new PZ;#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=vQ(a),this.#p=kJ(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=Eq(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new wJ({...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&&(NZ(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(),jZ(t.wrapper,this.#w()))}setGitStatus(e){this.#p=kJ(e,this.#p);let t=this.#T();t!=null&&jZ(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),jZ(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),MZ(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),jZ(r,this.#w())}#C(){return{initialViewportHeight:yQ({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(kU,e());return}this.#l.setSlotHtml(kU,this.#e?.header?.html??null)}#k(e){let t=SQ(e).find(e=>xQ(e)),n=bQ(yU(NU(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=SQ(e),n=t.find(e=>xQ(e)),r=t.filter(e=>e!==n),i=NU(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=bQ(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=NU(this.#m);t.colored&&xU(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${TU}]`);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(TU,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=jq(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 Lq(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)}},wQ=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function TQ(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:kU,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:AU,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function EQ(e,t){return typeof window>`u`&&t!=null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,Z.jsx)(Z.Fragment,{children:e})}function DQ(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 OQ(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 kQ({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(n.getComposition()),d=(0,Q.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,Q.useCallback)(()=>{s(null)},[]),m=(0,Q.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,Q.useMemo)(()=>OQ(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),wQ(()=>{n.setComposition(g)},[g,n]),wQ(()=>{if(c!=null)return r!=null&&DQ(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=EQ(TQ(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,Z.jsx)(CU,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function AQ(e){let[t]=(0,Q.useState)(()=>new CQ(e)),n=(0,Q.useRef)({timeout:null,model:t});return(0,Q.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 jQ(){let e=(0,$.c)(16),{_:t}=Dt(),{projectLocalBinding:n}=wf(),r;e[0]!==t||e[1]!==n?(r=()=>{if(n===null)return;let e=n.patch({appearance:{sidebar:{showHiddenFiles:!1,showOnlyMarkdownFiles:!1,showOkFolders:!1}}});e.ok||(console.warn(`[FileTreeFilteredToZeroNotice] view-filter reset rejected:`,fa(e.error)),Mu.error(t({id:`P47EWZ`}),{description:fa(e.error)}))},e[0]=t,e[1]=n,e[2]=r):r=e[2];let i=r,a;e[3]===t?a=e[4]:(a=t({id:`WHPvOb`}),e[3]=t,e[4]=a);let o;e[5]===a?o=e[6]:(o=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:a}),e[5]=a,e[6]=o);let s=n===null,c;e[7]===t?c=e[8]:(c=t({id:`jC8LSZ`}),e[7]=t,e[8]=c);let l;e[9]!==i||e[10]!==s||e[11]!==c?(l=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`font-mono uppercase`,disabled:s,onClick:i,"data-testid":`reset-view-filters`,children:c}),e[9]=i,e[10]=s,e[11]=c,e[12]=l):l=e[12];let u;return e[13]!==o||e[14]!==l?(u=(0,Z.jsxs)(`div`,{"data-testid":`file-tree-filtered-to-zero`,className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[o,l]}),e[13]=o,e[14]=l,e[15]=u):u=e[15],u}var MQ={density:`compact`,itemHeight:26,flattenEmptyDirectories:!1},NQ={"--trees-level-gap-override":`4px`,"--trees-item-row-gap-override":`4px`,"--trees-icon-width-override":`14px`,"--trees-item-height":`${MQ.itemHeight}px`,"--trees-indent-guide-bg-override":`color-mix(in oklab, var(--trees-fg-muted) 30%, transparent)`},PQ=`
1851
- [data-item-section='spacing-item'] {
1852
- opacity: 0.5;
1853
- }
1854
- :host(:hover) [data-item-section='spacing-item'] {
1855
- opacity: 0.85;
1856
- }
1857
- `,FQ=`
1858
- [data-file-tree-sticky-overlay-content='true'] {
1859
- --trees-bg: color-mix(in oklab, var(--sidebar) 92%, var(--sidebar-foreground) 8%);
1860
- box-shadow: 0 1px 0 0 var(--sidebar-border);
1861
- }
1862
- /* Forced-colors mode suppresses box-shadow and overrides color-mix tints,
1863
- so the divider above would vanish and the pinned region would read as
1864
- part of scrolling content. Borders survive forced-colors — mirror the
1865
- fallback pattern used by FILE_TREE_ROOT_DROP_CSS. */
1866
- @media (forced-colors: active) {
1867
- [data-file-tree-sticky-overlay-content='true'] {
1868
- border-bottom: 1px solid CanvasText;
1869
- }
1870
- }
1871
- `;function IQ(e){return{...WU({type:e===`dark`?`dark`:`light`,colors:{"sideBar.background":`var(--sidebar)`,"sideBar.foreground":`var(--sidebar-foreground)`,"sideBar.border":`var(--sidebar-border)`,"list.activeSelectionBackground":`var(--sidebar-accent)`,"list.activeSelectionForeground":`var(--sidebar-accent-foreground)`,"list.hoverBackground":`var(--sidebar-hover)`,focusBorder:`var(--color-primary)`,"input.background":`var(--input)`,"input.border":`var(--border)`}}),"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`0.875rem`,"--trees-item-padding-x-override":`0.5rem`,"--trees-padding-inline-override":`0.5rem`,"--trees-border-radius-override":`0.375rem`,"--trees-selected-fg":`var(--color-primary)`,"--truncate-marker-fade-in-duration":`0s`,"--trees-file-icon-color-markdown":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`,...NQ}}var LQ=`data-ok-ext-badge`,RQ=`data-ok-ext-row`,zQ=`data-ok-fullname-row`,BQ=`
1872
- [data-item-selected='true'] [data-icon-token='markdown'] {
1873
- color: var(--trees-selected-fg);
1874
- }
1875
- [data-type='item'][${RQ}] [data-truncate-segment-priority]:last-child {
1876
- display: none;
1877
- }
1878
- [data-type='item'][${zQ}] [data-truncate-segment-priority]:last-child {
1879
- display: none;
1880
- }
1881
- [${LQ}] {
1882
- display: inline-block;
1883
- margin-left: 0.375rem;
1884
- margin-right: 0.25rem;
1885
- align-self: center;
1886
- color: color-mix(in oklab, var(--muted-foreground) 60%, transparent);
1887
- font-size: 0.75rem;
1888
- text-transform: uppercase;
1889
- flex-shrink: 0;
1890
- pointer-events: none;
1891
- user-select: none;
1892
- }
1893
- `;function VQ(e){let t=e.querySelectorAll(`[data-type="item"][data-item-path]`);for(let e of t){let t=e.dataset.itemPath;if(!t){UQ(e);continue}if(t.endsWith(`/`)){GQ(e,t);continue}let n=td(t);if(!n){UQ(e);continue}let r=WQ(e);if(r){if(e.setAttribute(RQ,``),e.removeAttribute(zQ),YQ(r),n.toLowerCase()===`.md`){HQ(e);continue}XQ(e,n.slice(1).toUpperCase())}}}function HQ(e){let t=e.querySelector(`[${LQ}]`);t&&t.remove()}function UQ(e){e.removeAttribute(RQ),e.removeAttribute(zQ),HQ(e)}function WQ(e){let t=e.querySelector(`[data-truncate-group-container="middle"]`);if(!t)return null;let n=t.querySelectorAll(`[data-truncate-segment-priority]`);return n.length<2?null:n[0]??null}function GQ(e,t){e.removeAttribute(RQ),HQ(e);let n=WQ(e),r=KQ(t);if(!n||!r){e.removeAttribute(zQ);return}JQ(n,r),e.setAttribute(zQ,``)}function KQ(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>=0?t.slice(n+1):t}function qQ(e,t){let n=e.querySelectorAll(`[data-truncate-content]`);for(let e of n){let n=e.firstChild;if(!n||n.nodeType!==Node.TEXT_NODE)continue;let r=n.textContent??``,i=t(r);i!==r&&(n.textContent=i)}}function JQ(e,t){qQ(e,()=>t)}function YQ(e){qQ(e,e=>e.replace(/\.+$/,``))}function XQ(e,t){let n=e.querySelector(`[${LQ}]`);if(!n){n=e.ownerDocument.createElement(`span`),n.setAttribute(LQ,``),n.setAttribute(`aria-hidden`,`true`);let t=e.querySelector(`[data-item-section="action"]`);t?t.before(n):e.appendChild(n)}n.textContent!==t&&(n.textContent=t)}var ZQ=`ok-file-tree-link-decoration`,QQ=`ok-file-tree-agent-decoration`,$Q=`ok-file-tree-markdown`,e$=`<symbol id="${$Q}" viewBox="${ht}" fill="currentColor"><path d="${qe}"/></symbol>`;function t$(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function n$(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${t$(t)}</symbol>`}var r$=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1894
- ${n$(ZQ,_)}
1895
- ${n$(QQ,No)}
1896
- ${e$}
1897
- </svg>`;function i$(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function a$(e){let t=i$(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}var o$=/\.(md|mdx)$/i;function s$(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function c$(e){let t=e.match(o$);return t?t[0]:null}var l$=new Set([`agents`,`agent`,`claude`,`skill`]);function u$(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&l$.has(t)}function d$(e,t){return fm({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function f$(e){let t=e.match(/\.(md|mdx)$/i);if(!t)return null;let n=t[0].toLowerCase()===`.md`?`.mdx`:`.md`;return`${e.slice(0,-t[0].length)}${n}`}function p$(e,t){let n=f$(e);return n?t.includes(n):!1}function m$(e,t){return e!==t&&e.startsWith(t)}function h$(e,t){let n=[...new Set(e)].filter(e=>!cd(e)),r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>m$(e,t))).map(e=>d$(e,t))}function g$(e,t){let n=e.getItem(t)??e.getItem(Om(t));return n?.isDirectory()?Om(Im(n.getPath())):t}function _$(e){let t=e.getFocusedPath()??e.getSelectedPaths()[0]??null;return t?g$(e,t):null}function v$(e,t,n){let r=_$(e);return!r||n.has(r)||cd(r)?null:d$(r,t)}function y$(e,t){let n=e.getSelectedPaths(),r=_$(e);return h$(n.length>0?n.map(t=>g$(e,t)):r?[r]:[],t)}function b$(e,t){return e===t||e.startsWith(`${t}/`)}function x$(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function S$(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)rd(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):ld(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=Im(e);b$(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function C$(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:b$(t.createdPath,e.path)}function w$(e){let t=new Map,n=new Map;for(let r of e)if(rd(r)){let e=Am(r.docName,r.docExt);t.has(e)||t.set(e,r)}else if(od(r)){let e=Om(r.path);n.has(e)||n.set(e,r)}return{docsByTreePath:t,foldersByTreeDirectoryPath:n}}var T$=`data-ok-problem`,E$=`data-ok-problem-badge`,D$=`
1898
- [data-type='item'][${T$}='warning'] [data-item-section='content'] {
1899
- color: var(--ok-tree-problem-warning, oklch(70% 0.15 75));
1900
- }
1901
- [data-type='item'][${T$}='error'] [data-item-section='content'] {
1902
- color: var(--ok-tree-problem-error, oklch(55% 0.15 25));
1903
- }
1904
- [${E$}] {
1905
- display: inline-block;
1906
- margin-left: 0.375rem;
1907
- margin-right: 0.25rem;
1908
- align-self: center;
1909
- font-size: 0.6875rem;
1910
- line-height: 1rem;
1911
- min-width: 1rem;
1912
- text-align: center;
1913
- border-radius: 0.5rem;
1914
- padding: 0 0.25rem;
1915
- flex-shrink: 0;
1916
- pointer-events: none;
1917
- user-select: none;
1918
- color: var(--ok-tree-problem-warning, oklch(70% 0.15 75));
1919
- background: color-mix(in oklab, currentColor 14%, transparent);
1920
- }
1921
- [data-type='item'][${T$}='error'] [${E$}] {
1922
- color: var(--ok-tree-problem-error, oklch(55% 0.15 25));
1923
- }
1924
- `;function O$(e,t){let n=e.querySelectorAll(`[data-type="item"][data-item-path]`);for(let e of n){let n=e.dataset.itemPath;if(!n||n.endsWith(`/`)){k$(e);continue}let r=t.get(kd(n));if(r===void 0||r.errorCount===0&&r.warningCount===0){k$(e);continue}let i=r.errorCount>0?`error`:`warning`;e.getAttribute(`data-ok-problem`)!==i&&e.setAttribute(T$,i),A$(e,r.errorCount+r.warningCount)}}function k$(e){e.hasAttribute(`data-ok-problem`)&&e.removeAttribute(T$),e.querySelector(`[${E$}]`)?.remove()}function A$(e,t){let n=t>99?`99+`:String(t),r=e.querySelector(`[${E$}]`);if(!r){r=e.ownerDocument.createElement(`span`),r.setAttribute(E$,``),r.setAttribute(`aria-hidden`,`true`);let t=e.querySelector(`[data-item-section="action"]`);t?t.before(r):e.appendChild(r)}r.textContent!==n&&(r.textContent=n)}var j$=`data-ok-renaming`,M$=`data-ok-rename-selection-applied`,N$=null,P$=null,F$=5e3,I$=`
1925
- /* Pierre's icon decoration keys off the row's data-item-path. If the user
1926
- deletes the extension before commit, Pierre can temporarily key the row
1927
- by an extensionless path and swap [data-icon-token] from 'markdown' to
1928
- 'default' until the disk-truth refresh restores .md.
1929
- Cover the wrong icon with a CSS-rendered markdown glyph for the duration.
1930
- applyRenameInputAffordance records the in-flight markdown extension when
1931
- the input mounts; the sweep stamps the marker only if Pierre later moves
1932
- the row to an extensionless path, then clears it when the path next
1933
- includes the saved extension (settle / cancel / row recycle to a settled
1934
- file). */
1935
- [${j$}='.md'] [data-item-section="icon"],
1936
- [${j$}='.mdx'] [data-item-section="icon"] {
1937
- position: relative;
1938
- }
1939
- [${j$}='.md'] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']),
1940
- [${j$}='.mdx'] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']) {
1941
- visibility: hidden;
1942
- }
1943
- [${j$}='.md'] [data-item-section="icon"]::before,
1944
- [${j$}='.mdx'] [data-item-section="icon"]::before {
1945
- content: '';
1946
- display: block;
1947
- position: absolute;
1948
- inset: 0;
1949
- margin: auto;
1950
- width: 16px;
1951
- height: 16px;
1952
- background-color: currentColor;
1953
- mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z'/></svg>") center / contain no-repeat;
1954
- pointer-events: none;
1955
- }
1956
- `;function L$(e){B$(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-type="item"]`);if(!n)return;let r=n.dataset.itemPath??``;if(r.endsWith(`/`))return;let i=td(r);$u(r)&&R$(i),!t.hasAttribute(M$)&&(V$(t),t.setAttribute(M$,``))}function R$(e){N$=e,P$!==null&&clearTimeout(P$),P$=setTimeout(z$,F$)}function z$(){N$=null,P$!==null&&(clearTimeout(P$),P$=null)}function B$(e){let t=e.querySelectorAll(`[${j$}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(j$);if(!t){e.removeAttribute(j$);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(j$);continue}let r=td(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(j$)}if(N$===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||td(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==N$&&e.setAttribute(j$,N$))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&z$()}function V$(e){let t=td(e.value),n=t?e.value.length-t.length:e.value.length;e.setSelectionRange(0,n)}function H$(e,t){e.getFocusedPath()===t&&e.scrollToPath(t,{offset:`nearest`,focus:!1})}function U$(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function W$(e,t,n={}){if(!e)return U$(t);let r=pd(e);if(t&&r!==t)return U$(t);switch(e.kind){case`doc`:return U$(t??e.docName);case`large-file`:return U$(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?U$(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:case`skill-file`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function G$(e,t){if(!e)return{kind:`none`};let n=t.find(t=>vm(t)===e),r=Pm(e),i=e.endsWith(`/`)?r:Fm(e,t);return i===r?n&&ld(n)?n.mediaKind===`mermaid`?{kind:`document`,path:n.path}:{kind:`asset`,path:n.path,hash:Ld(n.path),mediaKind:n.mediaKind}:n&&rd(n)?{kind:`document`,path:n.docName}:e.endsWith(`/`)?t.some(e=>od(e)?e.path===r||e.path.startsWith(`${r}/`):(ld(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>rd(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}:{kind:`document`,path:i}}var K$=`You can restore this file from the Trash.`;function q$(e){let t=K$,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function J$(e,t){return e===`web`?null:q$(t)}function Y$(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function X$(e,t,n){let r=G$(e,t);if(r.kind===`none`)return null;if(r.kind===`asset`)return{v:1,kind:`asset`,assetPath:r.path,mediaKind:r.mediaKind};if(r.kind===`folder`)return{v:1,kind:`folder`,folderPath:r.path};let i=t.find(e=>rd(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var Z$=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function Q$(e){return typeof e==`string`&&Z$.includes(e)?e:`system-error`}function $$(e){switch(e){case`not-found`:return zu._({id:`v41fCm`});case`permission-denied`:return zu._({id:`sJK6pq`});case`system-error`:return zu._({id:`Jqqevv`});case`path-escape`:return zu._({id:`WL6puM`})}}function e1(e){let t=$$(e.reason),n=e.detail;return n?zu._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):zu._({id:`dTaauv`,values:{reason:t}})}function t1(e){return e.kind===`folder`?`${e.name}/`:e.name}function n1(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,s=n.length>1,c=n[0],l=n.length,u;if(t[0]!==l||t[1]!==s||t[2]!==c){let e=c?t1(c):``;u=s?zu._({id:`5qNxOe`,values:{count:l}}):c?`${zu._({id:`E_BHoD`,values:{targetName:e}})}\n${e1(c)}`:zu._({id:`kolRU1`}),t[0]=l,t[1]=s,t[2]=c,t[3]=u}else u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Tn,{children:(0,Z.jsx)(J,{id:`aOp3hw`})}),t[4]=f):f=t[4];let p;t[5]===d?p=t[6]:(p=(0,Z.jsxs)(kn,{children:[f,(0,Z.jsx)(wn,{className:`whitespace-pre-wrap`,children:d})]}),t[5]=d,t[6]=p);let m;t[7]!==n||t[8]!==s?(m=s?(0,Z.jsx)(Dn,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(r1)})}):null,t[7]=n,t[8]=s,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(J,{id:`dEgA5A`}),t[10]=h):h=t[10];let g;t[11]!==r||t[12]!==o?(g=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:h}),t[11]=r,t[12]=o,t[13]=g):g=t[13];let _;t[14]===r?_=t[15]:(_=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ll,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(J,{id:`mf37rL`})]}):(0,Z.jsx)(J,{id:`6gRgw8`}),t[14]=r,t[15]=_);let v;t[16]!==r||t[17]!==a||t[18]!==_?(v=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:_}),t[16]=r,t[17]=a,t[18]=_,t[19]=v):v=t[19];let y;t[20]===r?y=t[21]:(y=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ll,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(J,{id:`s3caR3`})]}):(0,Z.jsx)(J,{id:`UBv8UK`}),t[20]=r,t[21]=y);let b;t[22]!==r||t[23]!==i||t[24]!==y?(b=(0,Z.jsx)(X,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:y}),t[22]=r,t[23]=i,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==g||t[28]!==v?(x=(0,Z.jsxs)(On,{children:[g,v,b]}),t[26]=b,t[27]=g,t[28]=v,t[29]=x):x=t[29];let S;return t[30]!==x||t[31]!==p||t[32]!==m?(S=(0,Z.jsxs)(En,{className:`sm:max-w-md`,children:[p,m,x]}),t[30]=x,t[31]=p,t[32]=m,t[33]=S):S=t[33],S}function r1(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:t1(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:e1(e)})]},e.path)}function i1(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=Ws(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(J,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(J,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,s;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){s=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=Ey(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(J,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),s=n;break bb0}let c;t[16]!==i||t[17]!==r?(c=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=c):c=t[18],o=n.map(c)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=s}else o=t[9],s=t[10];if(s!==Symbol.for(`react.early_return_sentinel`))return s;let c;return t[19]===o?c=t[20]:(c=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=c),c}function a1(e){return e?.isDirectory()?e:null}function o1(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function s1(e){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect()}function c1(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){s1(e),i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=a1(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){s1(e),i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}o1(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}var l1=`open-knowledge:file-tree-menu-action-delete`,u1=`open-knowledge:file-tree-menu-action-rename`,d1=`open-knowledge:file-tree-menu-action-duplicate`;function f1(e){window.dispatchEvent(new CustomEvent(l1,{detail:{target:e}}))}function p1(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(l1,t),()=>window.removeEventListener(l1,t)}function m1(e){window.dispatchEvent(new CustomEvent(u1,{detail:{target:e}}))}function h1(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(u1,t),()=>window.removeEventListener(u1,t)}function g1(e){window.dispatchEvent(new CustomEvent(d1,{detail:{target:e}}))}function _1(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(d1,t),()=>window.removeEventListener(d1,t)}var v1={Accept:`application/x-ndjson, application/json`};function y1(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var b1=class extends Error{};function x1(e){return typeof e==`object`&&!!e&&`type`in e}async function S1(e,t={}){let n=e.body;if(!n)throw new b1(`Show All Files stream had no response body.`);let{onBatch:r}=t,i=n.getReader(),a=new TextDecoder,o=[],s=[],c=!1,l=``,u=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,t.slice(0,200)),!1}if(x1(n)){if(n.type===`error`)throw new b1(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return c=n.truncated===!0,!0}let r=Fi.safeParse(n);return r.success?(o.push(r.data),s.push(r.data)):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1},d=()=>{if(!r||s.length===0)return;let e=s;s=[],r(e)};try{let e=!1;for(;!e;){let t=await i.read();if(t.done)break;l+=a.decode(t.value,{stream:!0});let n=l.indexOf(`
1957
- `);for(;n!==-1;){let t=u(l.slice(0,n));if(l=l.slice(n+1),t){e=!0;break}n=l.indexOf(`
1958
- `)}d()}l+=a.decode(),l.includes(`
1959
- `)||u(l),d()}finally{i.releaseLock()}return{entries:o,truncated:c}}function C1(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>vm(e))),a=[];for(let e of t){let t=vm(e);if(i.has(t)){n.delete(t);continue}let o=n.get(t);if(o!==void 0){if(r-o>5e3){n.delete(t);continue}a.push(e)}}return a.length===0?[...e]:[...e,...a]}function w1(e,t){if(t.length===0)return[...e];let n=new Set(e.map(e=>vm(e))),r=[...e];for(let e of t){let t=vm(e);n.has(t)||(n.add(t),r.push(e))}return r}function T1(e,t,n,r,i=Date.now()){if(t!==``&&!e.some(e=>vm(e)===t))return[...e];let a=[],o=[];for(let n of e)E1(t,vm(n))?a.push(n):o.push(n);let s=C1(n,a,r,i),c=new Set(s.map(e=>vm(e)).filter(e=>e.endsWith(`/`)));return[...o.filter(e=>{let n=vm(e);if(!n.startsWith(t))return!0;let r=n.slice(t.length),i=r.indexOf(`/`);return i===-1?!0:c.has(t+r.slice(0,i+1))}),...s]}function E1(e,t){if(!t.startsWith(e))return!1;let n=t.slice(e.length);if(n===``)return!1;let r=n.endsWith(`/`)?n.slice(0,-1):n;return r!==``&&!r.includes(`/`)}var D1=Od(`HOVER_INTENT_MS`,80),O1=3,k1=20,A1=new Map,j1=new Set,M1=[],N1=new Map;function P1(e){for(N1.delete(e),N1.set(e,!0);N1.size>k1;){let e=N1.keys().next().value;if(e===void 0)break;N1.delete(e)}}function F1(e){j1.delete(e),L1()}function I1(e,t){let n=Date.now();Ed(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),de(e,t,n)}function L1(){for(;j1.size<O1&&M1.length>0;){let e=M1.shift();if(!e)break;if(!N1.has(e.docName)){j1.add(e.docName),P1(e.docName);try{let t=e.prewarm(e.docName);t&&I1(e.docName,t)}catch(t){Ed(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{F1(e.docName)}}}}function R1(e,t){if(nt(e)||N1.has(e))return;let n=A1.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(A1.delete(e),j1.size>=O1){M1.push({docName:e,prewarm:t});return}P1(e),j1.add(e);try{let n=t(e);n&&I1(e,n)}catch(t){Ed(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{F1(e)}},D1);A1.set(e,{timer:r,prewarm:t})}function z1(e){let t=A1.get(e);t&&(clearTimeout(t.timer),A1.delete(e))}function B1(e){window.requestAnimationFrame(()=>{let t=se(e);if(!(!t||t.isDestroyed))try{t.commands.focus()}catch{}})}function V1(e){let t=e.current;t.row?.removeAttribute(G1),t.root?.removeAttribute(K1),e.current={row:null,root:null}}function H1(e,t){let n=e.current;n.row===t.row&&n.root===t.root||(V1(e),t.row?.setAttribute(G1,`true`),t.root?.setAttribute(K1,`true`),e.current={row:t.row,root:t.root})}async function U1(e,t){try{await navigator.clipboard.writeText(e),Mu.success(t===`full`?zu._({id:`6_ZOw4`}):zu._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),Mu.error(t===`full`?zu._({id:`vfRlCI`}):zu._({id:`5QGTaA`}))}}var W1=`
1960
- [data-file-tree-virtualized-root][data-file-tree-root-drag-target="true"] {
1961
- position: relative;
1962
- }
1963
- [data-file-tree-virtualized-root][data-file-tree-root-drag-target="true"]::after {
1964
- content: "";
1965
- position: absolute;
1966
- inset: 0;
1967
- z-index: 20;
1968
- border-radius: 0.375rem;
1969
- box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--color-primary) 80%, transparent);
1970
- background: color-mix(in oklab, var(--color-primary) 6%, transparent);
1971
- pointer-events: none;
1972
- }
1973
- /* Forced-colors (Windows High Contrast) suppresses box-shadow and overrides
1974
- color-mix backgrounds, so the ring above would vanish. Borders survive
1975
- forced-colors — fall back to a system Highlight border (mirrors the JSX
1976
- in-range halo fallback in globals.css). */
1977
- @media (forced-colors: active) {
1978
- [data-file-tree-virtualized-root][data-file-tree-root-drag-target="true"]::after {
1979
- border: 2px solid Highlight;
1980
- }
1981
- }
1982
- `,G1=`data-ok-external-file-drop-target`,K1=`data-ok-external-file-drop-root-target`,q1=`__external-file-drop__`,J1=2e3,Y1=`
1983
- [data-type="item"][${G1}="true"] {
1984
- background: color-mix(in oklab, var(--color-primary) 10%, transparent);
1985
- box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--color-primary) 72%, transparent);
1986
- }
1987
- [data-file-tree-virtualized-root][${K1}="true"] {
1988
- position: relative;
1989
- }
1990
- [data-file-tree-virtualized-root][${K1}="true"]::after {
1991
- content: "";
1992
- position: absolute;
1993
- inset: 0;
1994
- z-index: 20;
1995
- border-radius: 0.375rem;
1996
- box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--color-primary) 80%, transparent);
1997
- background: color-mix(in oklab, var(--color-primary) 6%, transparent);
1998
- pointer-events: none;
1999
- }
2000
- @media (forced-colors: active) {
2001
- [data-type="item"][${G1}="true"] {
2002
- outline: 2px solid Highlight;
2003
- outline-offset: -2px;
2004
- }
2005
- [data-file-tree-virtualized-root][${K1}="true"]::after {
2006
- border: 2px solid Highlight;
2007
- }
2008
- }
2009
- `,X1=`data-ok-creation-cleared`,Z1=`${BQ}\n${D$}\n${I$}\n${W1}\n${Y1}\n${`
2010
- :host([${X1}]) [data-item-focused="true"] {
2011
- --trees-focus-ring-color: transparent;
2012
- }
2013
- `}\n${PQ}\n${FQ}`;function Q1(e){return e===`darwin`?zu._({id:`LtSYdi`}):e===`win32`?zu._({id:`qi1F96`}):zu._({id:`e1Rn_k`})}function $1(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:i}=e,{_:a}=Dt(),o=typeof window<`u`?window.okDesktop:void 0;if(!o)return null;let s=o.platform,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=Q1(s),t[0]=c):c=t[0];let l=c,u,d;t[1]!==a||t[2]!==r?(u=r?null:a({id:`wTcjov`}),d=a(s===`darwin`?u?{id:`FvpFSZ`,values:{hint:u}}:{id:`LtSYdi`}:s===`win32`?u?{id:`o4dcAf`,values:{hint:u}}:{id:`qi1F96`}:u?{id:`zUhPuR`,values:{hint:u}}:{id:`e1Rn_k`}),t[1]=a,t[2]=r,t[3]=u,t[4]=d):(u=t[3],d=t[4]);let f=d,p=!r,m;t[5]!==n||t[6]!==i||t[7]!==r?(m=()=>{if(!r)return;i();let e=uc(r.contentDir,mm(n),r.pathSeparator);o.shell.showItemInFolder(e)},t[5]=n,t[6]=i,t[7]=r,t[8]=m):m=t[8];let h,g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Dc,{"aria-hidden":`true`}),g=(0,Z.jsx)(`span`,{className:`flex-1`,children:l}),t[9]=h,t[10]=g):(h=t[9],g=t[10]);let _;t[11]===u?_=t[12]:(_=u?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:u}):null,t[11]=u,t[12]=_);let v;return t[13]!==f||t[14]!==p||t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(Ir,{disabled:p,onSelect:m,"aria-label":f,children:[h,g,_]}),t[13]=f,t[14]=p,t[15]=m,t[16]=_,t[17]=v):v=t[17],v}function e0(e){let t=(0,$.c)(69),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,onStartCreating:l,onCreateFromTemplate:u,onDuplicate:d,onImportTemplate:f,onDelete:p,onExpandSubtree:m,onCollapseSubtree:h,folderTreePaths:g,isAsset:_,documents:v}=e,{_:y}=Dt(),b=fm(n,v),x=n.kind===`directory`,S;t[0]===n.path?S=t[1]:(S=cd(n.path),t[0]=n.path,t[1]=S);let C=S,w=b.kind===`asset`?null:b,T=w!==null&&c!==null,E;t[2]!==y||t[3]!==x?(E=y(x?{id:`5D3Ior`}:{id:`dbhUX1`}),t[2]=y,t[3]=x,t[4]=E):E=t[4];let D=E,O;t[5]!==x||t[6]!==n.path?(O=x?Im(n.path):null,t[5]=x,t[6]=n.path,t[7]=O):O=t[7];let k=Ws(O),A=k.state.status===`ready`?(k.state.data.folder.templates_available?.length??0)>0:!0,j=s.getSelectedPaths(),M=j.includes(b.treePath)?h$(j,v):[],N=M.length>1?M:[b],P=N.length,F=zu._({id:`djjdjr`,values:{deleteCount:P}}),I;t[8]!==v||t[9]!==_||t[10]!==x||t[11]!==n||t[12]!==a?(I=_?null:x?ms({folderRelativePath:mm(n),workspace:a}):xs({docName:Fm(n.path,v),workspace:a}),t[8]=v,t[9]=_,t[10]=x,t[11]=n,t[12]=a,t[13]=I):I=t[13];let L=I,R;t[14]===r?R=t[15]:(R=()=>r.close({restoreFocus:!1}),t[14]=r,t[15]=R);let z=R,B;t[16]===r?B=t[17]:(B=()=>r.close(),t[16]=r,t[17]=B);let V=B,{status:H}=Oo(),U=H?.hasRemote===!0,ee;t[18]!==v||t[19]!==_||t[20]!==x||t[21]!==n.path||t[22]!==b?(ee=_||b.kind===`asset`?null:x?Us(Im(n.path)):ic(Fm(n.path,v)),t[18]=v,t[19]=_,t[20]=x,t[21]=n.path,t[22]=b,t[23]=ee):ee=t[23];let W=ee,te=U&&W!==null,G;t[24]!==y||t[25]!==U||t[26]!==W?(G=()=>{W&&As({...W,hasRemote:U,onClickWhenNoRemote:()=>{Mu.error(y({id:`WyQxwa`}))}},{clipboardWrite:qp,toastSuccess:r0,toastError:n0,logEvent:t0})},t[24]=y,t[25]=U,t[26]=W,t[27]=G):G=t[27];let ne=G,K;t[28]!==te||t[29]!==V||t[30]!==ne?(K=te?(0,Z.jsxs)(Ir,{"data-testid":`file-tree-menu-share`,onSelect:()=>{V(),ne()},children:[(0,Z.jsx)(q_,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Z8lGw6`})]}):null,t[28]=te,t[29]=V,t[30]=ne,t[31]=K):K=t[31];let q=K,re=0,ie=0;if(x){let e=Om(n.path);for(let t of g)(t===e||t.startsWith(e))&&(re++,a1(s.getItem(t))?.isExpanded()&&ie++)}let ae=x&&ie<re,oe=x&&ie>0,se;t[32]===V?se=t[33]:(se=e=>{e||V()},t[32]=V,t[33]=se);let ce;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[34]=ce):ce=t[34];let le;t[35]!==y||t[36]!==i||t[37]!==T||t[38]!==V||t[39]!==z||t[40]!==F||t[41]!==N||t[42]!==A||t[43]!==o||t[44]!==L||t[45]!==D||t[46]!==_||t[47]!==x||t[48]!==C||t[49]!==n||t[50]!==s||t[51]!==c||t[52]!==w||t[53]!==h||t[54]!==u||t[55]!==p||t[56]!==d||t[57]!==m||t[58]!==f||t[59]!==l||t[60]!==q||t[61]!==oe||t[62]!==ae||t[63]!==b||t[64]!==a?(le=(0,Z.jsx)(Wr,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[C?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ir,{disabled:i,onSelect:()=>{z(),l(`file`,Im(n.path))},children:[(0,Z.jsx)(vc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`HdkSiO`})]}),A?(0,Z.jsxs)(Lr,{children:[(0,Z.jsxs)(Ur,{disabled:i,children:[(0,Z.jsx)(Ks,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Uuj_R4`})]}),(0,Z.jsx)(Rr,{children:(0,Z.jsx)(i1,{parentDir:Im(n.path),onSelectTemplate:e=>{z(),u(Im(n.path),e)},ItemComponent:Ir})})]}):null,(0,Z.jsxs)(Ir,{disabled:i,onSelect:()=>{z(),l(`folder`,Im(n.path))},children:[(0,Z.jsx)(x_,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`96G6Re`})]}),(0,Z.jsx)(qr,{})]}),(0,Z.jsx)($1,{item:n,workspace:a,onClose:V}),(0,Z.jsx)(us,{input:L,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch,onBeforeLaunch:V}),q,(0,Z.jsxs)(Lr,{children:[(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(gc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`oCZkaG`})]}),(0,Z.jsxs)(Rr,{children:[(0,Z.jsx)(Ir,{disabled:!a,onSelect:()=>{a&&(V(),U1(uc(a.contentDir,mm(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(J,{id:`oQA-cA`})}),(0,Z.jsx)(Ir,{onSelect:()=>{V(),U1(mm(n),`relative`)},children:(0,Z.jsx)(J,{id:`s061i4`})})]})]}),ae||oe?(0,Z.jsx)(qr,{}):null,ae?(0,Z.jsxs)(Ir,{onSelect:()=>{V(),m(n.path)},children:[(0,Z.jsx)(fv,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,oe?(0,Z.jsxs)(Ir,{onSelect:()=>{V(),h(n.path)},children:[(0,Z.jsx)(y_,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,C?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qr,{}),(0,Z.jsxs)(Ir,{disabled:i,onSelect:()=>{b.kind!==`asset`&&(V(),d(b))},children:[(0,Z.jsx)(sc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`euc6Ns`})]}),(0,Z.jsxs)(Ir,{disabled:i,onSelect:()=>{z(),s.startRenaming(n.path)},children:[(0,Z.jsx)(hc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`2wxgft`})]}),(0,Z.jsxs)(Ir,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c||!w)return;V();let e=a$(w),t=Qs(c.current()),n=nc(t,e);if(n===t)return;c.patch(qs(n));let r=w.path.split(`/`).pop()||w.path;Mu.success(y({id:`4xtLTl`,values:{basename:r}}),{description:y({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Xr,{"aria-hidden":`true`}),D]}),(0,Z.jsxs)(Ir,{variant:`destructive`,disabled:i,onSelect:()=>{V(),p(N)},children:[(0,Z.jsx)(Tu,{"aria-hidden":`true`}),F]})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($1,{item:n,workspace:a,onClose:V}),!_&&(0,Z.jsx)(us,{input:L,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch,onBeforeLaunch:V}),q,(0,Z.jsxs)(Lr,{children:[(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(gc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`oCZkaG`})]}),(0,Z.jsxs)(Rr,{children:[(0,Z.jsx)(Ir,{disabled:!a,onSelect:()=>{a&&(V(),U1(uc(a.contentDir,mm(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(J,{id:`oQA-cA`})}),(0,Z.jsx)(Ir,{onSelect:()=>{V(),U1(mm(n),`relative`)},children:(0,Z.jsx)(J,{id:`s061i4`})})]})]}),C?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qr,{}),_?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Lr,{children:[(0,Z.jsxs)(Ur,{disabled:i,children:[(0,Z.jsx)(__,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`PYmp-0`})]}),(0,Z.jsxs)(Rr,{children:[(0,Z.jsx)(Ir,{disabled:i,onSelect:()=>{V(),f(b,!1)},children:(0,Z.jsx)(J,{id:`-FeyRg`})}),(0,Z.jsx)(Ir,{disabled:i,onSelect:()=>{V(),f(b,!0)},children:(0,Z.jsx)(J,{id:`dQHSCs`})})]})]}),(0,Z.jsxs)(Ir,{disabled:i,onSelect:()=>{V(),d(b)},children:[(0,Z.jsx)(sc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`euc6Ns`})]})]}),(0,Z.jsxs)(Ir,{disabled:i,onSelect:()=>{z(),s.startRenaming(n.path)},children:[(0,Z.jsx)(hc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`2wxgft`})]}),w?(0,Z.jsxs)(Ir,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c)return;V();let e=a$(w),t=Qs(c.current()),n=nc(t,e);if(n===t)return;c.patch(qs(n));let r=w.path.split(`/`).pop()||w.path;Mu.success(y({id:`OD0FCX`,values:{basename:r}}),{description:y({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Xr,{"aria-hidden":`true`}),D]}):null,(0,Z.jsxs)(Ir,{variant:`destructive`,disabled:i,onSelect:()=>{V(),p(N)},children:[(0,Z.jsx)(Tu,{"aria-hidden":`true`}),F]})]})]})}),t[35]=y,t[36]=i,t[37]=T,t[38]=V,t[39]=z,t[40]=F,t[41]=N,t[42]=A,t[43]=o,t[44]=L,t[45]=D,t[46]=_,t[47]=x,t[48]=C,t[49]=n,t[50]=s,t[51]=c,t[52]=w,t[53]=h,t[54]=u,t[55]=p,t[56]=d,t[57]=m,t[58]=f,t[59]=l,t[60]=q,t[61]=oe,t[62]=ae,t[63]=b,t[64]=a,t[65]=le):le=t[65];let ue;return t[66]!==se||t[67]!==le?(ue=(0,Z.jsxs)(Kr,{open:!0,modal:!1,onOpenChange:se,children:[ce,le]}),t[66]=se,t[67]=le,t[68]=ue):ue=t[68],ue}function t0(e){return console.log(e)}function n0(e){return Mu.error(e)}function r0(e){return Mu.success(e)}function i0(e,t){return`/api/documents?showAll=true${t?`&showOk=true`:``}&dir=${encodeURIComponent(e)}&depth=1`}async function a0(e,t,n,r,i){try{let a=await fetch(i0(e,t),{signal:n,headers:v1});if(y1(a)){let e=await S1(a);return{kind:`entries`,entries:id(e.entries),truncated:e.truncated}}let o=await pe(a,r);if(!o.ok)return{kind:`http-error`,title:o.title};let s=Vi.safeParse(o.body);return s.success?{kind:`entries`,entries:id(s.data.documents),truncated:s.data.truncated===!0}:{kind:`http-error`,title:i}}catch(e){return e instanceof b1?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function o0(e){let t=(0,$.c)(367),{ref:n,onContentHeightChange:r}=e,{_:a,i18n:o}=Dt(),{activeDocName:s,activeTarget:c,closeTabs:l,closeDocument:u,isNewTabActive:d,openTarget:f,prewarm:p,reconcileLocalRemoval:m,reconcileLocalRename:h}=ot(),{notifySidebarFileSelected:g}=TI(),{resolvedTheme:_}=Jt(),{addPage:v,pageMeta:y,pages:b}=rs(),x;t[0]===y?x=t[1]:(x=function(e,t){return fd(e,t??y.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=y,t[1]=x);let S=x,C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[2]=C):C=t[2];let[w,T]=(0,Q.useState)(C),[E,D]=(0,Q.useState)(!0),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),M=fR(),N=(0,Q.useRef)(null),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(0),[R,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(null),[H,U]=(0,Q.useState)(null),[W,te]=(0,Q.useState)(null),{conflicts:G}=zs(),[ne,K]=(0,Q.useState)(null),[q,re]=(0,Q.useState)(null),[ie,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(ie),se;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(se=new Set,t[3]=se):se=t[3];let ce=(0,Q.useRef)(se),le=(0,Q.useRef)(w),ue=(0,Q.useRef)(y),de=(0,Q.useRef)(null),me;t[4]!==v||t[5]!==S||t[6]!==g||t[7]!==f?(me=function(e){if(e.kind===`doc`)e.registerPage&&v(e.docName),f(S(e.docName,e.size),{tabBehavior:`replace-active`}),Rd(Bd(e.docName));else if(e.kind===`folder`)f({kind:`folder`,target:e.folderPath,folderPath:e.folderPath},{tabBehavior:`replace-active`}),Rd(Ad(e.folderPath));else{let t=(e.entries??le.current).find(t=>ld(t)&&t.path===e.assetPath);f({kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:t?.mediaKind??null},{tabBehavior:`replace-active`}),Rd(Ld(e.assetPath))}g()},t[4]=v,t[5]=S,t[6]=g,t[7]=f,t[8]=me):me=t[8];let he=me,ge;t[9]!==w||t[10]!==he||t[11]!==g||t[12]!==f||t[13]!==b?(ge=function(e,t){let n=t===void 0?w:t,r=G$(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,Pm(e));return}if(r.kind===`asset`){f({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),Rd(r.hash),g();return}if(r.kind===`folder`){he({kind:`folder`,folderPath:r.path});return}let i=n.find(e=>rd(e)&&e.docName===r.path),a=dd(r.path,{pages:b,docExt:i?.docExt});if(a?.kind===`asset`){f(a,{tabBehavior:`replace-active`}),Rd(Ld(a.assetPath)),g();return}if(a?.kind===`doc`){he({kind:`doc`,docName:a.docName});return}he({kind:`doc`,docName:r.path,size:i?.size,registerPage:$u(r.path)})},t[9]=w,t[10]=he,t[11]=g,t[12]=f,t[13]=b,t[14]=ge):ge=t[14];let _e=ge,ve=(0,Q.useRef)(s),ye;t[15]===w?ye=t[16]:(ye=new Set(w.filter(ld).map(P0)),t[15]=w,t[16]=ye);let be=ye,xe=(0,Q.useRef)(be),Se;t[17]===w?Se=t[18]:(Se=w$(w),t[17]=w,t[18]=Se);let Ce=Se,we=(0,Q.useRef)(Ce),Te;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(Te=[],t[19]=Te):Te=t[19];let Ee=(0,Q.useRef)(Te),De=(0,Q.useRef)(null),Oe=(0,Q.useRef)(N0),ke=(0,Q.useRef)(null),Ae=(0,Q.useRef)(null),je=(0,Q.useRef)(!1),Me=(0,Q.useRef)(!1),Ne=(0,Q.useRef)(null),Pe;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Pe={row:null,root:null},t[20]=Pe):Pe=t[20];let Fe=(0,Q.useRef)(Pe),Ie=(0,Q.useRef)(M0),Le=(0,Q.useRef)(null),Re=(0,Q.useRef)(null),ze;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ze=new Map,t[21]=ze):ze=t[21];let Be=(0,Q.useRef)(ze),Ve;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=new Set,t[22]=Ve):Ve=t[22];let He=(0,Q.useRef)(Ve),Ue;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=new Map,t[23]=Ue):Ue=t[23];let We=(0,Q.useRef)(Ue),Ge=(0,Q.useRef)(0),Ke;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=new Set,t[24]=Ke):Ke=t[24];let qe=(0,Q.useRef)(Ke),Je=(0,Q.useRef)(j0),Ye=(0,Q.useRef)(A0),Xe=(0,Q.useRef)(!1),Ze=(0,Q.useRef)(!1),Qe=(0,Q.useRef)(!1),$e;t[25]===Symbol.for(`react.memo_cache_sentinel`)?($e=()=>({showHiddenFiles:Xe.current,showOnlyMarkdownFiles:Ze.current,showOkFolders:Qe.current}),t[25]=$e):$e=t[25];let et=$e,tt=(0,Q.useRef)(null),nt=(0,Q.useRef)(null),rt=(0,Q.useRef)(k0),it=(0,Q.useRef)(O0),at=(0,Q.useRef)(D0),st=(0,Q.useRef)(E0),ct=(0,Q.useRef)(c),[lt,ut]=(0,Q.useState)(!1),dt;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(dt=function(){N.current!==null&&(clearTimeout(N.current),N.current=null)},t[26]=dt):dt=t[26];let ft=dt,pt;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(pt=function(){ft(),j(!1)},t[27]=pt):pt=t[27];let mt=pt,gt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(gt=function(e){mt(),k(e)},t[28]=gt):gt=t[28];let _t=gt,vt;t[29]===a?vt=t[30]:(vt=function(){if(ft(),cR()){k(null),j(!0),N.current=setTimeout(()=>{N.current=null,tt.current?.()},J1);return}j(!1),k(a({id:`34qyH5`}))},t[29]=a,t[30]=vt);let yt=vt,bt=(0,Q.useRef)(!0),xt;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(xt=()=>{if(bt.current){bt.current=!1;return}tt.current?.()},t[31]=xt):xt=t[31];let St;t[32]===M?St=t[33]:(St=[M],t[32]=M,t[33]=St),(0,Q.useEffect)(xt,St);let Ct,wt;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=()=>ft,wt=[],t[34]=Ct,t[35]=wt):(Ct=t[34],wt=t[35]),(0,Q.useEffect)(Ct,wt);let Tt,Et;t[36]!==w.length||t[37]!==E?(Tt=()=>{if(E||w.length===0)return;let e=nt.current?.querySelector(CU)?.shadowRoot;if(!e)return;let t=e,n=function(){Ne.current!==null&&clearTimeout(Ne.current),Ne.current=setTimeout(()=>{Me.current=!1,Ne.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=I0(e),n=t?.dataset.itemPath;if(!n)return;let r=X$(t.dataset.itemType===`folder`?Om(n):n,le.current,ue.current);r&&(Ne.current!==null&&(clearTimeout(Ne.current),Ne.current=null),Me.current=!0,e.dataTransfer?.setData(um,Cm(r)))},i=function(e){if(!(e instanceof DragEvent)||!Tm(e))return;let t=R0(e);if(!t){V1(Fe);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),H1(Fe,t)},a=function(e){if(!(e instanceof DragEvent)||!Tm(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||V1(Fe)},o=function(e){if(!(e instanceof DragEvent)||!Tm(e))return;let t=R0(e),n=ym(e);if(!t||n.length===0){V1(Fe);return}e.preventDefault(),e.stopPropagation(),V1(Fe),Ie.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragover`,i,{capture:!0}),e.addEventListener(`dragleave`,a,{capture:!0}),e.addEventListener(`drop`,o,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragover`,i,{capture:!0}),e.removeEventListener(`dragleave`,a,{capture:!0}),e.removeEventListener(`drop`,o,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),V1(Fe),Ne.current!==null&&(clearTimeout(Ne.current),Ne.current=null),Me.current=!1}},Et=[w.length,E],t[36]=w.length,t[37]=E,t[38]=Tt,t[39]=Et):(Tt=t[38],Et=t[39]),(0,Q.useEffect)(Tt,Et);let{selectedFilePath:Ot,selectedFolderPath:kt,navigationPath:At}=W$(c,d?null:s),jt=Ot?Am(Ot,w.find(e=>rd(e)&&e.docName===Ot)?.docExt):kt?Om(kt):c?.kind===`asset`?c.assetPath:null,Mt=ie?null:jt,Nt=_s().states,{dispatch:Pt}=ds(),Ft;t[40]!==Pt||t[41]!==Nt?(Ft={installStates:Nt,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Pt},t[40]=Pt,t[41]=Nt,t[42]=Ft):Ft=t[42];let It=Ft,{okignoreBinding:Lt,merged:Rt}=wf(),zt=Rt?.appearance?.sidebar?.showHiddenFiles??!1,Bt=Rt?.appearance?.sidebar?.showOnlyMarkdownFiles??!1,Vt=Rt?.appearance?.sidebar?.showOkFolders??!1,Ht;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ht=()=>Le.current===null,t[43]=Ht):Ht=t[43];let Ut=Ht,Wt;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(Wt=[],t[44]=Wt):Wt=t[44];let Gt;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Gt={set:`complete`,spriteSheet:r$,byFileExtension:{md:{name:$Q,viewBox:ht},mdx:{name:$Q,viewBox:ht}}},t[45]=Gt):Gt=t[45];let Kt;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Kt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[46]=Kt):Kt=t[46];let qt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(qt={canDrag:Ut,canDrop:Ut,onDropComplete:e=>st.current(e),onDropError:T0},t[47]=qt):qt=t[47];let Yt,Xt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Yt={canRename:Ut,onRename:e=>it.current(e),onError:e=>at.current(e)},Xt=e=>rt.current(e),t[48]=Yt,t[49]=Xt):(Yt=t[48],Xt=t[49]);let Zt;t[50]===a?Zt=t[51]:(Zt={paths:Wt,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...MQ,icons:Gt,unsafeCSS:Z1,composition:Kt,dragAndDrop:qt,renaming:Yt,onSelectionChange:Xt,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=we.current.docsByTreePath.get(t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:ZQ,title:a(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return u$(t.path)?{icon:QQ,title:a({id:`i9toLO`})}:null}let n=we.current.foldersByTreeDirectoryPath.get(Om(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:ZQ,title:a(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[50]=a,t[51]=Zt);let{model:Qt}=AQ(Zt),$t;t[52]===Qt?$t=t[53]:($t=function(e){let t=Qt.getItem(e)??Qt.getItem(Om(e));return t?.isDirectory()?Om(Im(t.getPath())):e},t[52]=Qt,t[53]=$t);let en=$t,tn,nn;t[54]===w?(tn=t[55],nn=t[56]):(nn=_m(w),tn=cm(nn),t[54]=w,t[55]=tn,t[56]=nn);let rn=tn,an=(0,Q.useRef)(nn),on;t[57]!==w||t[58]!==Vt?(on=Em(w,{includeOkFolders:Vt}),t[57]=w,t[58]=Vt,t[59]=on):on=t[59];let sn=on,cn=(0,Q.useRef)(sn),ln=kt?km(Om(kt)).slice(0,-1):km(Mt??At),un=ln.join(`\0`),dn;t[60]===Qt?dn=t[61]:(dn=()=>{let e=new Set;for(let t of cn.current)a1(Qt.getItem(t))?.isExpanded()&&e.add(t);return e},t[60]=Qt,t[61]=dn);let fn=dn,pn;t[62]===fn?pn=t[63]:(pn=e=>{let t=new Set(Em(e??le.current,{includeOkFolders:Qe.current})),n=fn();for(let e of Ee.current)n.add(e);return[...n].filter(e=>t.has(e))},t[62]=fn,t[63]=pn);let mn=pn,hn;t[64]!==mn||t[65]!==Qt?(hn=e=>{let t=_m(e??le.current);Qt.resetPaths(t,{initialExpandedPaths:mn(e)})},t[64]=mn,t[65]=Qt,t[66]=hn):hn=t[66];let gn=hn,_n;t[67]!==a||t[68]!==yt?(_n=async function(e){let t=Ge.current,n=new AbortController;We.current.set(e,n);let r=await a0(Im(e),Qe.current,n.signal,a({id:`8RtNI0`}),a({id:`HlmZBk`}));if(We.current.get(e)===n&&We.current.delete(e),n.signal.aborted||t!==Ge.current)return;if(r.kind===`network-error`){yt(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,r.cause);return}if(r.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,r.title),_t(r.title);return}let i=nd(r.entries,et());He.current.add(e),T(t=>T1(t,e,i,Be.current)),k(null),mt(),r.truncated&&F(r.entries.length)},t[67]=a,t[68]=yt,t[69]=_n):_n=t[69];let vn=_n,yn;t[70]!==fn||t[71]!==vn?(yn=()=>{let e=fn(),t=qe.current;qe.current=e;for(let n of e){if(t.has(n)||He.current.has(n)||We.current.has(n))continue;let e=Im(n);le.current.find(t=>od(t)&&t.path===e)?.hasChildren!==!1&&vn(n)}},t[70]=fn,t[71]=vn,t[72]=yn):yn=t[72];let bn=yn,xn;t[73]!==fn||t[74]!==vn?(xn=()=>{for(let e of fn())He.current.has(e)||We.current.has(e)||vn(e)},t[73]=fn,t[74]=vn,t[75]=xn):xn=t[75];let Sn=xn,Cn;t[76]!==Qt||t[77]!==gn?(Cn=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>rd(e)&&e.docName===r);if(n==null||Qt.getItem(i)==null)continue;let s=Am(i,t.find(e=>rd(e)&&e.docName===i)?.docExt??n.docExt);Qt.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=td(e);if(t===``)continue;let n=e.slice(0,-t.length);Qt.getItem(n)!=null&&(Qt.getItem(e)??Qt.move(n,e),o=e,a+=1)}a!==0&&(gn(t),o!=null&&Qt.focusPath(o))},t[76]=Qt,t[77]=gn,t[78]=Cn):Cn=t[78];let wn=Cn,Tn;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Tn=e=>{ke.current=wm(e)},t[79]=Tn):Tn=t[79];let En=Tn,Dn;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Dn=e=>xe.current.has(e),t[80]=Dn):Dn=t[80];let On=Dn,kn;t[81]!==a||t[82]!==v||t[83]!==he||t[84]!==gn?(kn=async function(e){if(e.kind===`asset`||Le.current!==null)return;let t=()=>{z(null),Le.current=null};Le.current=e.path,z(e.path),k(null);try{let n=await pe(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),a({id:`dw_dUJ`}));if(!n.ok){Mu.error(n.title),gn(),t();return}let r=ee(ea,n.body,`duplicate-path`,null);if(r===null){let e=a({id:`67f-3g`});Mu.error(e),k(e),Sd([`files`,`backlinks`,`graph`]),gn(),t();return}for(let e of r.duplicatedDocNames)v(e);T(t=>{let n=RR(t,e,r);return gn(n),En(n),n}),Sd([`files`,`backlinks`,`graph`]),r.path!==e.path&&(r.kind===`folder`?he({kind:`folder`,folderPath:r.path}):he({kind:`doc`,docName:r.path})),Mu.success(r.kind===`folder`?a({id:`iilQXA`}):a({id:`A6h5b-`}),{description:r.path}),t()}catch(e){let n=e,r=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),Mu.error(a({id:`EBVbtP`}),{description:r}),gn(),t()}},t[81]=a,t[82]=v,t[83]=he,t[84]=gn,t[85]=kn):kn=t[85];let jn=kn,Mn=(0,Q.useRef)(jn),Nn;t[86]===jn?Nn=t[87]:(Nn=()=>{Mn.current=jn},t[86]=jn,t[87]=Nn),(0,Q.useEffect)(Nn);let Pn=async function(e,t){if(e.kind===`file`){if(t){U(e);return}await Fn(e,!1)}};async function Fn(e,t){if(Le.current!==null)return;let n=()=>{z(null),Le.current=null,U(null)};Le.current=e.path,z(e.path),k(null);let r=e.path,i=r.lastIndexOf(`/`),o=i===-1?``:r.slice(0,i),s=await Oc({sourcePath:e.path,targetFolder:o,deleteSource:t});if(!s.ok){Mu.error(a({id:`rDOuNw`}),{description:s.error}),n();return}t&&(await Jr([e],[e.path],[]),T(t=>{let n=t.filter(t=>!(rd(t)&&t.docName===e.path));return gn(n),En(n),n}),Sd([`files`,`backlinks`,`graph`])),Mu.success(a({id:`Ba4D2x`}),{description:s.path}),n()}let In=function(e){let t=s$(e);if(!t||c$(t))return!1;let n=Qt.getFocusedPath()??Qt.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||On(n))return!1;let r=c$(n);if(!r)return!1;let i=Om(t);if(!cn.current.includes(i))return!1;let a=`${t}${r}`;return an.current.includes(a)?!1:(mr({sourcePath:n,destinationPath:a,isFolder:!1}),Qt.move(n,a),!0)},Ln;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Ln=e=>{let t=e??De.current;!t||De.current!==t||(t.disposeCommitListener(),De.current=null)},t[88]=Ln):Ln=t[88];let Rn=Ln,zn;t[89]!==a||t[90]!==Rn||t[91]!==u||t[92]!==l||t[93]!==gn?(zn=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,i=n.restoreLocation??r;Rn(e),r&&z(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,i=e.createdPath,o=await pe(t,a({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=a({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:i}});r?Mu.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),r&&(z(null),gn());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),r){let t=e.kind,n=e.createdPath;Mu.error(a({id:`_TDESN`,values:{kind:t,createdPath:n}}))}r&&(z(null),gn());return}r&&(e.kind===`file`?u(e.createdPath):l([fe(e.createdPath)],{force:!0})),r&&T(t=>{let n=IR(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return En(n),n}),Sd([`files`,`backlinks`,`graph`]),i&&(window.location.hash=e.previousHash),r&&z(null)},t[89]=a,t[90]=Rn,t[91]=u,t[92]=l,t[93]=gn,t[94]=zn):zn=t[94];let Bn=zn,Vn,Hn;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Vn=()=>()=>{let e=De.current;e&&Oe.current(e,{restoreLocation:!1,updateUi:!1}).catch(w0)},Hn=[],t[95]=Vn,t[96]=Hn):(Vn=t[95],Hn=t[96]),(0,Q.useEffect)(Vn,Hn);let Un;t[97]!==a||t[98]!==yt?(Un=()=>{let e=!0,t=null,n=ns(async function(){t?.abort();let n=new AbortController;t=n,Ge.current+=1;for(let e of We.current.values())e.abort();We.current.clear(),He.current.clear();try{let t=await fetch(i0(``,Qe.current),{signal:n.signal,headers:v1});if(y1(t)){let r=et(),i=!1,{entries:a,truncated:o}=await S1(t,{onBatch:t=>{if(!e||n.signal.aborted)return;let a=nd(id(t),r);a.length!==0&&(T(e=>w1(e,a)),i||(i=!0,k(null),mt(),D(!1)))}});if(!e)return;let s=id(a),c=nd(s,r);T(e=>T1(e,``,c,Be.current)),k(null),mt(),F(o?a.length:null),L(s.length),Ye.current()}else{let n=await pe(t,a({id:`8RtNI0`}));if(!e)return;if(!n.ok)_t(n.title),F(null);else{let e=Vi.safeParse(n.body);if(!e.success)_t(a({id:`HlmZBk`})),F(null);else{let t=id(e.data.documents),n=nd(t,et());T(e=>T1(e,``,n,Be.current)),k(null),mt(),F(e.data.truncated===!0?e.data.documents.length:null),L(t.length),Ye.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof b1?_t(r.message):yt()),console.warn(`[FileTree] fetch failed:`,r)}e&&D(!1)},()=>t?.abort());tt.current=()=>n.request(),n.request();let r=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,r),window.addEventListener(`visibilitychange`,r);let i=_d(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,tt.current=null,n.dispose();for(let e of We.current.values())e.abort();We.current.clear(),window.removeEventListener(`focus`,r),window.removeEventListener(`visibilitychange`,r),i()}},t[97]=a,t[98]=yt,t[99]=Un):Un=t[99];let Wn;t[100]===a?Wn=t[101]:(Wn=[a],t[100]=a,t[101]=Wn),(0,Q.useEffect)(Un,Wn);let Gn=(0,Q.useRef)(!0),Kn;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(Kn=()=>{if(Gn.current){Gn.current=!1;return}tt.current?.()},t[102]=Kn):Kn=t[102];let qn;t[103]!==zt||t[104]!==Vt||t[105]!==Bt?(qn=[zt,Bt,Vt],t[103]=zt,t[104]=Vt,t[105]=Bt,t[106]=qn):qn=t[106],(0,Q.useEffect)(Kn,qn);let Jn,Yn;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Jn=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=ee(ao,n,`workspace`,null);r&&re({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(C0),()=>{e=!1}},Yn=[],t[107]=Jn,t[108]=Yn):(Jn=t[107],Yn=t[108]),(0,Q.useEffect)(Jn,Yn);let Xn;t[109]!==mn||t[110]!==Qt||t[111]!==rn?(Xn=()=>{if(ke.current===rn){ke.current=null;return}Qt.resetPaths(an.current,{initialExpandedPaths:mn()})},t[109]=mn,t[110]=Qt,t[111]=rn,t[112]=Xn):Xn=t[112];let Zn;t[113]!==Qt||t[114]!==rn?(Zn=[Qt,rn],t[113]=Qt,t[114]=rn,t[115]=Zn):Zn=t[115],(0,Q.useEffect)(Xn,Zn),c1(Qt,Mt,un,je,rn);let Qn,$n;t[116]!==Qt||t[117]!==r?(Qn=()=>{if(!r)return;let e=0,t=0,n=()=>nt.current?.querySelector(`file-tree-container`)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-list]`)??null,i=()=>{let e=n();if(!e)return;let t=Number.parseFloat(e.style.height);Number.isFinite(t)&&r(t)},a=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(i)},o=new MutationObserver(i),s=()=>{let e=n();e?(o.observe(e,{attributes:!0,attributeFilter:[`style`]}),i()):t=requestAnimationFrame(s)};s();let c=Qt.subscribe(a);return window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t),o.disconnect(),c(),window.removeEventListener(`resize`,a)}},$n=[r,Qt],t[116]=Qt,t[117]=r,t[118]=Qn,t[119]=$n):(Qn=t[118],$n=t[119]),(0,Q.useEffect)(Qn,$n);let er;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(er=()=>{ae(!1)},t[120]=er):er=t[120];let tr;t[121]===jt?tr=t[122]:(tr=[jt],t[121]=jt,t[122]=tr),(0,Q.useEffect)(er,tr);let nr,rr;t[123]===ie?(nr=t[124],rr=t[125]):(nr=()=>{oe.current=ie;for(let e of ce.current)e()},rr=[ie],t[123]=ie,t[124]=nr,t[125]=rr),(0,Q.useEffect)(nr,rr);let ir;t[126]!==Mt||t[127]!==E||t[128]!==Qt?(ir=()=>{E||!Mt||H$(Qt,Mt)},t[126]=Mt,t[127]=E,t[128]=Qt,t[129]=ir):ir=t[129];let ar;t[130]!==un||t[131]!==Mt||t[132]!==E||t[133]!==Qt||t[134]!==rn?(ar=[Mt,un,rn,E,Qt],t[130]=un,t[131]=Mt,t[132]=E,t[133]=Qt,t[134]=rn,t[135]=ar):ar=t[135],(0,Q.useEffect)(ir,ar);let or,sr;t[136]===Qt?(or=t[137],sr=t[138]):(or=()=>Qt.subscribe(()=>{if(!Qt.isSearchOpen())for(let e of Ee.current){let t=a1(Qt.getItem(e));t&&!t.isExpanded()&&t.expand()}}),sr=[Qt],t[136]=Qt,t[137]=or,t[138]=sr),(0,Q.useEffect)(or,sr);let cr,lr;t[139]===Qt?(cr=t[140],lr=t[141]):(cr=()=>Qt.subscribe(()=>Je.current()),lr=[Qt],t[139]=Qt,t[140]=cr,t[141]=lr),(0,Q.useEffect)(cr,lr);let ur,dr;t[142]===Qt?(ur=t[143],dr=t[144]):(ur=()=>Qt.onMutation(`remove`,e=>{let t=De.current;!t||e.path!==t.renamePath||Oe.current(t)}),dr=[Qt],t[142]=Qt,t[143]=ur,t[144]=dr),(0,Q.useEffect)(ur,dr);let fr;t[145]!==v||t[146]!==he||t[147]!==h||t[148]!==wn?(fr=async(e,t,n,r,a)=>{let o=t===void 0?[]:t,s=n===void 0?[]:n,c=a===void 0?[]:a,l=r?.docName??ve.current,u=new Map,d=new Map;for(let e of le.current){if(rd(e)){let t=s.find(t=>t.fromPath===Am(e.docName,e.docExt))?.toPath;t&&u.set(e.docName,t);continue}if(ld(e)){let t=s.find(t=>t.fromPath===e.path)?.toPath;t&&$u(t)&&d.set(e.path,gm(t))}}let f=l?u.get(l)??null:null,p=r?.folderPath??(ct.current?.kind===`folder`?ct.current.folderPath:null),m=p?i(p,o):null,g=r?.assetPath??(ct.current?.kind===`asset`?ct.current.assetPath:null),_=g?d.get(g)??null:null,y=f?null:_??zR(l,e),b=f??(g?_?null:s.find(e=>e.fromPath===g)?.toPath??i(g,o):null);await h({renamed:e,renamedFolders:o,renamedAssets:s,additionalRemovedDocNames:[...u.keys()]});for(let t of e)v(t.toDocName);for(let e of d.values())v(e);let x=null;T(t=>{let n=FR(t,e,o,s,c);return x=n,wn(t,n,e,s),En(n),n}),p&&m&&m!==p?he({kind:`folder`,folderPath:m}):y&&y!==l?(he({kind:`doc`,docName:y}),B1(y)):b&&(f||b!==g)&&he({kind:`asset`,assetPath:b,entries:x??le.current}),Sd([`files`,`backlinks`,`graph`])},t[145]=v,t[146]=he,t[147]=h,t[148]=wn,t[149]=fr):fr=t[149];let pr=fr;async function mr(e){let t=!e.isFolder&&On(e.sourcePath),n=t?e.sourcePath:xm(e.sourcePath,e.isFolder);z(n),k(null);try{let r=ed(e.sourcePath,e.destinationPath,e.isFolder),i=!e.isFolder&&!t&&!$u(r.destinationPath),o=t||i?r.destinationPath:xm(r.destinationPath,e.isFolder),s=e.isFolder?{kind:`folder`,fromPath:Im(n),toPath:Im(o)}:t||i?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:Fm(n,le.current),toPath:o},c={docName:ve.current,folderPath:ct.current?.kind===`folder`?ct.current.folderPath:null,assetPath:ct.current?.kind===`asset`?ct.current.assetPath:null},l=await pe(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),a({id:`gijbne`}));if(!l.ok){Mu.error(l.title),gn();let e=De.current;e&&e.renamePath===n?await Bn(e):Rn(),z(null);return}let u=ee(Oi,l.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await pr(u.renamed,e.isFolder?[{fromPath:Im(n),toPath:Im(o)}]:[],u.renamedAssets,c,!e.isFolder&&!t&&!i?u.renamed.flatMap(e=>{let t=td(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:u.renamed.length,renamedAssetCount:u.renamedAssets.length}),Mu.error(a({id:`dDpCOp`}))}Rn(),z(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=a({id:`HIb0vl`});Mu.error(t),k(t),gn();let r=De.current;r&&r.renamePath===n?await Bn(r):Rn(),z(null)}}let hr;t[150]!==a||t[151]!==pr||t[152]!==gn?(hr=async function(e){let t=e.draggedPaths.map(t=>{let n=Sm(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(S0);if(t.length!==0){z(t[0]?.sourcePath??null),k(null);try{let e=[],n=[],r=[],i={docName:ve.current,folderPath:ct.current?.kind===`folder`?ct.current.folderPath:null,assetPath:ct.current?.kind===`asset`?ct.current.assetPath:null};for(let i of t){let t=i.sourcePath.endsWith(`/`),o=!t&&On(i.sourcePath),s=o?null:Fm(i.sourcePath,le.current),c=t?{kind:`folder`,fromPath:Im(i.sourcePath),toPath:Im(i.destinationTreePath)}:o?{kind:`asset`,fromPath:i.sourcePath,toPath:i.destinationTreePath}:{kind:`file`,fromPath:s??gm(i.sourcePath),toPath:s&&$u(s)?i.destinationTreePath:gm(i.destinationTreePath)},l=await pe(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),a({id:`dOHMA0`}));if(!l.ok){Mu.error(l.title),gn(),z(null);return}let u=ee(Oi,l.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(u.renamed),n=n.concat(u.renamedAssets),t&&r.push({fromPath:Im(i.sourcePath),toPath:Im(i.destinationTreePath)})}try{await pr(e,r,n,i)}catch(r){console.warn(`[FileTree] post-move reconciliation failed`,{err:r,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),Mu.error(a({id:`8OxKZy`}))}z(null)}catch(e){console.warn(`[FileTree] move failed:`,e),Mu.error(a({id:`HIb0vl`})),gn(),z(null)}}},t[150]=a,t[151]=pr,t[152]=gn,t[153]=hr):hr=t[153];let gr=hr,_r;t[154]!==a||t[155]!==v||t[156]!==gn?(_r=async function(e,t,n){if(e.length===0||Le.current!==null)return;let r=()=>{Le.current=null,z(null)};Le.current=n,z(n),k(null);let i=[],o=0,s=0;for(let n of e){let e=new FormData;e.append(`file`,n),jm(e,t,n.name||`upload`);try{let r=await pe(await fetch(`/api/upload`,{method:`POST`,body:e}),a({id:`4Gz2wC`}));if(!r.ok){s+=1,Mu.error(r.title,{description:n.name});continue}let c=ee($i,r.body,`upload:drop`,null);if(c===null){s+=1,Mu.error(a({id:`4Gz2wC`}),{description:n.name});continue}let l=pm(t,c);if(c.deduped===!0){s+=1,Mu.error(a({id:`4sKwf6`}),{description:l});continue}o+=1;let u=Mm(l,n);u&&i.push(u)}catch(e){let t=e;s+=1,console.warn(`[FileTree] external file upload failed:`,t),Mu.error(t instanceof TypeError?a({id:`HIb0vl`}):a({id:`4Gz2wC`}),{description:n.name})}}try{if(i.length>0){for(let e of i)rd(e)&&v(e.docName);T(e=>{let t=new Set(e.map(vm)),n=!1,r=[...e];for(let e of i){let i=vm(e);Be.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(gn(r),En(r),r):e})}o>0&&(Sd([`files`,`backlinks`,`graph`]),tt.current?.(),Mu.success(zu._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||a({id:`RSqaSd`})})),s>0&&k(o>0?zu._({id:`yH7T4q`,values:{failedCount:s}}):a({id:`4Gz2wC`})),r()}catch(e){let t=e,n=a({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),Mu.error(n),k(n),r()}},t[154]=a,t[155]=v,t[156]=gn,t[157]=_r):_r=t[157];let vr=_r,yr;t[158]===Symbol.for(`react.memo_cache_sentinel`)?(yr=function(e){K({parentDir:e})},t[158]=yr):yr=t[158];let br=yr,xr;t[159]!==a||t[160]!==v||t[161]!==Bn||t[162]!==Rn||t[163]!==Qt||t[164]!==he||t[165]!==gn||t[166]!==nn?(xr=async function(e,t,n){if(Le.current)return;let r=De.current;r&&Rn(r);try{let r=Dm(e,t,[...nn,...cn.current]);z(r.renamePath),Le.current=r.renamePath;let i=window.location.hash,o;if(e===`file`){let e=hm(`file`,r.addPath),t={path:e};n?.template&&(t.template=n.template);let i=await pe(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),a({id:`fJgQHX`}));if(!i.ok){Mu.error(i.title),z(null),Le.current=null;return}let s=gm(e),c=ee(Ra,i.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};v(c),T(e=>{if(e.some(e=>rd(e)&&e.docName===c))return e;let t=[...e,l];return En(t),Be.current.set(vm(l),Date.now()),t}),Sd([`files`,`backlinks`,`graph`]),he({kind:`doc`,docName:c})}else{let e=Im(r.addPath),t=await pe(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),a({id:`K1ckLX`}));if(!t.ok){Mu.error(t.title),z(null),Le.current=null;return}o=ee(Xi,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};T(e=>{if(e.some(e=>od(e)&&e.path===o))return e;let t=[...e,n];return En(t),Be.current.set(vm(n),Date.now()),t}),Sd([`files`]),he({kind:`folder`,folderPath:o})}let s=!1,c=e=>{if(e.key!==`Enter`||Af())return;let t=De.current;!t||t.renamePath!==r.renamePath||queueMicrotask(()=>Rn(t))};document.addEventListener(`keydown`,c,!0),De.current={kind:e,renamePath:r.renamePath,createdPath:o,previousHash:i,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},z(null),Le.current=null,Qt.add(r.addPath),Qt.startRenaming(r.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),Mu.error(a({id:`S6l5dv`}));let t=De.current;t?await Bn(t):Rn(),z(null),Le.current=null,gn()}},t[159]=a,t[160]=v,t[161]=Bn,t[162]=Rn,t[163]=Qt,t[164]=he,t[165]=gn,t[166]=nn,t[167]=xr):xr=t[167];let Sr=xr,Cr;t[168]===Qt?Cr=t[169]:(Cr=function(e){let t=Om(e);(0,Q.startTransition)(()=>{for(let e of cn.current)if(e===t||e.startsWith(t)){let t=a1(Qt.getItem(e));t&&t.expand()}})},t[168]=Qt,t[169]=Cr);let wr=Cr,Tr;t[170]===Qt?Tr=t[171]:(Tr=function(e){let t=Om(e),n=new Set(Ee.current);(0,Q.startTransition)(()=>{for(let e of[...cn.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=a1(Qt.getItem(e));t&&t.collapse()}})},t[170]=Qt,t[171]=Tr);let Er=Tr,Dr;t[172]===Symbol.for(`react.memo_cache_sentinel`)?(Dr=function(){return((nt.current?.querySelector(`file-tree-container`)?.shadowRoot)?.querySelector(`[aria-selected="true"][data-item-path]`))?.dataset.itemPath??null},t[172]=Dr):Dr=t[172];let Or=Dr,kr;t[173]!==_e||t[174]!==ln||t[175]!==s||t[176]!==c||t[177]!==be||t[178]!==R||t[179]!==Bn||t[180]!==bn||t[181]!==w||t[182]!==sn||t[183]!==gr||t[184]!==mr||t[185]!==en||t[186]!==y||t[187]!==In||t[188]!==Sn||t[189]!==Ce||t[190]!==zt||t[191]!==Vt||t[192]!==Bt||t[193]!==nn||t[194]!==vr?(kr=()=>{le.current=w,we.current=Ce,ue.current=y,ve.current=s,ct.current=c,xe.current=be,Le.current=R,Xe.current=zt,Ze.current=Bt,Qe.current=Vt,an.current=nn,cn.current=sn,Ee.current=ln,Je.current=bn,Ye.current=Sn,Oe.current=Bn,Ie.current=(e,t,n)=>{vr(e,t,n)},rt.current=e=>{if(je.current||Me.current||e.length!==1)return;let t=e[0];if(t){ae(!1);let e=en(t),n=de.current,r=n!==null&&gm(n)===gm(e),i=r?n:e;de.current=null,queueMicrotask(()=>{_e(en((r?null:Or())??i),le.current)})}},at.current=e=>{In(e)||Mu.error(e)},it.current=mr,st.current=gr},t[173]=_e,t[174]=ln,t[175]=s,t[176]=c,t[177]=be,t[178]=R,t[179]=Bn,t[180]=bn,t[181]=w,t[182]=sn,t[183]=gr,t[184]=mr,t[185]=en,t[186]=y,t[187]=In,t[188]=Sn,t[189]=Ce,t[190]=zt,t[191]=Vt,t[192]=Bt,t[193]=nn,t[194]=vr,t[195]=kr):kr=t[195],(0,Q.useLayoutEffect)(kr);let Ar,jr;t[196]===Qt?(Ar=t[197],jr=t[198]):(Ar=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`,a=t&&!e.shiftKey&&n===`c`,o=t&&!e.shiftKey&&n===`v`,s=!e.altKey&&!e.shiftKey&&(e.metaKey&&!e.ctrlKey&&n===`backspace`||!e.metaKey&&!e.ctrlKey&&n===`delete`);if(!r&&!i&&!a&&!o&&!s||x$(e.target))return;let c=nt.current,l=e.target,u=document.activeElement,d=l instanceof Node&&c?.contains(l),f=u instanceof Node&&c?.contains(u);if(!d&&!f)return;if(a){let t=v$(Qt,le.current,xe.current);if(!t)return;Re.current=t,e.preventDefault(),e.stopPropagation();return}if(o){let t=Re.current;if(!t)return;Mn.current(t),e.preventDefault(),e.stopPropagation();return}if(i){let t=v$(Qt,le.current,xe.current);if(!t)return;Mn.current(t),e.preventDefault(),e.stopPropagation();return}if(s){if(Le.current!==null)return;let t=y$(Qt,le.current);if(t.length===0)return;V({targets:t}),e.preventDefault(),e.stopPropagation();return}let p=new Set([...cn.current,...an.current]);je.current=!0;for(let e of p)e&&Qt.getItem(e)?.select();queueMicrotask(()=>{je.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},jr=[Qt],t[196]=Qt,t[197]=Ar,t[198]=jr),(0,Q.useEffect)(Ar,jr);let Mr,Nr;t[199]!==w.length||t[200]!==E?(Mr=()=>{if(E||w.length===0)return;let e=nt.current?.querySelector(CU)?.shadowRoot;if(!e)return;let t=x0,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},Nr=[E,w.length],t[199]=w.length,t[200]=E,t[201]=Mr,t[202]=Nr):(Mr=t[201],Nr=t[202]),(0,Q.useEffect)(Mr,Nr);let Pr,Fr;t[203]!==w.length||t[204]!==E?(Pr=()=>{if(E||w.length===0)return;let e=nt.current?.querySelector(CU)?.shadowRoot;if(!e)return;let t=()=>VQ(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Fr=[E,w.length],t[203]=w.length,t[204]=E,t[205]=Pr,t[206]=Fr):(Pr=t[205],Fr=t[206]),(0,Q.useEffect)(Pr,Fr);let Ir=Rt?.validation?.fileTreeIndicators!==!1,Lr,Rr;t[207]!==w.length||t[208]!==E||t[209]!==Ir?(Lr=()=>{if(E||w.length===0)return;let e=nt.current?.querySelector(CU)?.shadowRoot;if(!e)return;if(!Ir){O$(e,new Map);return}let t=()=>O$(e,op());t();let n=new MutationObserver(t);n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]});let r=ep(t);return()=>{n.disconnect(),r()}},Rr=[E,w.length,Ir],t[207]=w.length,t[208]=E,t[209]=Ir,t[210]=Lr,t[211]=Rr):(Lr=t[210],Rr=t[211]),(0,Q.useEffect)(Lr,Rr);let zr,Br;t[212]!==w.length||t[213]!==E?(zr=()=>{if(E||w.length===0)return;let e=nt.current?.querySelector(CU)?.shadowRoot;if(!e)return;let t=()=>L$(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Br=[E,w.length],t[212]=w.length,t[213]=E,t[214]=zr,t[215]=Br):(zr=t[214],Br=t[215]),(0,Q.useEffect)(zr,Br);let Vr;t[216]===Symbol.for(`react.memo_cache_sentinel`)?(Vr={folderCount:0,expandedCount:0},t[216]=Vr):Vr=t[216];let Hr=(0,Q.useRef)(Vr),Ur=(0,Q.useRef)(Sr),Wr=(0,Q.useRef)(br),Gr;t[217]===Sr?Gr=t[218]:(Gr=()=>{Ur.current=Sr,Wr.current=br},t[217]=Sr,t[218]=Gr),(0,Q.useEffect)(Gr);let Kr,qr;t[219]===Qt?(Kr=t[220],qr=t[221]):(Kr=()=>({startCreating(e,t){Ur.current(e,t)},startCreatingFromTemplate(e){Wr.current(e)},createFromTemplate(e,t){Ur.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of cn.current){let t=a1(Qt.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(Ee.current);(0,Q.startTransition)(()=>{for(let t of[...cn.current].reverse()){if(e.has(t))continue;let n=a1(Qt.getItem(t));n&&n.collapse()}})},getFolderState(){let e=cn.current,t=0;for(let n of e)a1(Qt.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Hr.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Hr.current=i,i},isCreationTargetCleared(){return oe.current},clearCreationTarget(){ae(!0)},subscribe(e){ce.current.add(e);let t=Qt.subscribe(e);return()=>{ce.current.delete(e),t()}}}),qr=[Qt],t[219]=Qt,t[220]=Kr,t[221]=qr),(0,Q.useImperativeHandle)(n,Kr,qr);async function Jr(e,t,n){let r=S$(e,le.current,cn.current),i=De.current;i&&e.some(e=>C$(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Rn(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(b0).map(y0)]);await m({tabIdsToClose:[...[...a].map(v0),...[...o].map(_0),...[...s].map(g0)],docNamesToClear:[...a]});for(let t of e){let e=t.kind===`folder`?Om(t.path):t.kind===`asset`?t.path:Am(t.path,t.docExt);Qt.getItem(e)&&Qt.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}T(e=>{let t=IR(e,[...a],void 0,[...s]);for(let e of o)t=IR(t,[],e);return En(t),t}),Sd([`files`,`backlinks`,`graph`])}let Yr;t[222]!==a||t[223]!==Jr?(Yr=async function(e){let t=[],n=[],r=[];for(let i of e){let e=i.kind;z(i.path);let o=await pe(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:i.path})}),a({id:`7JtSLi`}));if(!o.ok)return r.length>0&&await Jr(r,t,n),Mu.error(o.title),!1;let s=ee(Ki,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(i.path),r.push(i)}return await Jr(r,t,n),!0},t[222]=a,t[223]=Jr,t[224]=Yr):Yr=t[224];let Xr=Yr,Zr;t[225]===Symbol.for(`react.memo_cache_sentinel`)?(Zr=async function(e,t,n){let r=[],i=[];for(let a of e){z(a.path);let e=BR(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:Q$(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[225]=Zr):Zr=t[225];let Qr=Zr,$r;t[226]===a?$r=t[227]:($r=async function(e){let t=[],n=[],r=[];for(let i of e){let e=i.kind;try{let o=await pe(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:i.path})}),a({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${i.kind}:${i.path}`,reason:o.title}),r.push({target:i,reason:o.title});continue}let s=ee(da,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(i.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${i.kind}:${i.path}`,err:t}),r.push({target:i,reason:a({id:`r4R7AZ`})})}}if(r.length>0){let e=r.length;Mu.error(a({id:`IrB5AK`,values:{failedCount:e}}),{description:a({id:`vEJDlt`})})}return r.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[226]=a,t[227]=$r);let ei=$r,ti;t[228]!==a||t[229]!==G||t[230]!==Jr||t[231]!==Xr||t[232]!==ei||t[233]!==gn||t[234]!==q?(ti=async function(e){let t=e.filter(h0).map(e=>LR(e,le.current)),n=t[0];if(!n)return;let r=G.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(r.length>0){let e=r.slice(0,3).map(m0),t=r.length>e.length?`, +${r.length-e.length} more`:``;Mu.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}z(n.path),V(null);let i=typeof window<`u`?window.okDesktop:void 0;try{if(i&&q){let{trashed:e,failed:n}=await Qr(t,i,q);if(e.length>0){let t=await ei(e);t?await Jr(e,t.deletedDocNames,t.deletedFolderPaths):await Jr(e,e.filter(p0).map(f0),e.filter(d0).map(u0))}n.length>0&&te({failed:n,originalTargets:[...t]}),z(null)}else{let e=await Xr(t);z(null),e||gn()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),Mu.error(a({id:`0eHrMb`}),{description:n}),z(null),gn()}},t[228]=a,t[229]=G,t[230]=Jr,t[231]=Xr,t[232]=ei,t[233]=gn,t[234]=q,t[235]=ti):ti=t[235];let ni=ti,ri;t[236]!==a||t[237]!==Xr||t[238]!==gn||t[239]!==W?(ri=async function(){if(!W)return;let e=new Set(W.failed.map(l0)),t=W.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(te(null),t.length!==0){z(t[0]?.path??null);try{let e=await Xr(t);z(null),e||gn()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),Mu.error(a({id:`0eHrMb`}),{description:n}),z(null),gn()}}},t[236]=a,t[237]=Xr,t[238]=gn,t[239]=W,t[240]=ri):ri=t[240];let ii=ri,ai;t[241]!==ni||t[242]!==W?(ai=async function(){if(!W)return;let e=new Set(W.failed.map(c0)),t=W.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));te(null),await ni(t)},t[241]=ni,t[242]=W,t[243]=ai):ai=t[243];let oi=ai,si=(0,Q.useRef)(ni),ci;t[244]===ni?ci=t[245]:(ci=()=>{si.current=ni},t[244]=ni,t[245]=ci),(0,Q.useEffect)(ci);let li,ui;t[246]===Symbol.for(`react.memo_cache_sentinel`)?(li=()=>p1(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=le.current.find(e=>rd(e)&&e.docName===t);si.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){si.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){si.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),ui=[],t[246]=li,t[247]=ui):(li=t[246],ui=t[247]),(0,Q.useEffect)(li,ui);let di,fi;t[248]===Symbol.for(`react.memo_cache_sentinel`)?(di=()=>_1(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=le.current.find(e=>rd(e)&&e.docName===t);Mn.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){Mn.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),fi=[],t[248]=di,t[249]=fi):(di=t[248],fi=t[249]),(0,Q.useEffect)(di,fi);let pi,mi;t[250]===Qt?(pi=t[251],mi=t[252]):(pi=()=>h1(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=Am(t,le.current.find(e=>rd(e)&&e.docName===t)?.docExt);Qt.startRenaming(n);return}if(e.kind===`folder`){Qt.startRenaming(e.folderPath);return}if(e.kind===`asset`){Qt.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),mi=[Qt],t[250]=Qt,t[251]=pi,t[252]=mi),(0,Q.useEffect)(pi,mi);let hi;t[253]===Symbol.for(`react.memo_cache_sentinel`)?(hi=function(){let e=Ae.current;e&&z1(e),Ae.current=null},t[253]=hi):hi=t[253];let gi=hi,_i;t[254]===Symbol.for(`react.memo_cache_sentinel`)?(_i=function(e){let t=f$(e);if(!t)return!1;let n=nt.current?.querySelector(CU)?.shadowRoot;if(!n)return!1;for(let e of n.querySelectorAll(`[data-item-path]`))if(e.dataset.itemPath===t)return!0;return!1},t[254]=_i):_i=t[254];let vi=_i,yi;t[255]===p?yi=t[256]:(yi=function(e){let t=F0(e.nativeEvent);if(!t||t.endsWith(`/`)){gi();return}let n=le.current.find(e=>vm(e)===t);if(n&&ld(n)){gi();return}let r=n&&rd(n)?n.docName:Fm(t,le.current);if(n&&rd(n)&&vo(n.size)){gi();return}Ae.current!==r&&(gi(),Ae.current=r,R1(r,e=>p(e)))},t[255]=p,t[256]=yi);let bi=yi,xi;t[257]!==_e||t[258]!==Qt||t[259]!==he?(xi=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=I0(e.nativeEvent);if(!t){z0(e.nativeEvent)&&ae(!0);return}let n=t.getAttribute(`aria-selected`)===`true`,r=t.dataset.itemPath;if(!r)return;let i=t.dataset.itemType===`folder`?Om(r):r;if(t.dataset.itemType===`folder`){let t=Im(i),r=a1(Qt.getItem(i));if(!n){e.preventDefault(),e.stopPropagation(),r&&!r.isExpanded()&&r.expand(),queueMicrotask(()=>he({kind:`folder`,folderPath:t}));return}if(Qt.getSelectedPaths().length!==1||window.location.hash===Ad(t))return;e.preventDefault(),e.stopPropagation(),r&&!r.isExpanded()&&r.expand(),queueMicrotask(()=>he({kind:`folder`,folderPath:t}));return}if(!n){if(p$(i,an.current)||vi(i)){de.current=i,setTimeout(()=>he({kind:`doc`,docName:i,registerPage:!0}),0);return}queueMicrotask(()=>_e(i));return}let a=Fm(i,le.current);Qt.getSelectedPaths().length===1&&window.location.hash!==Bd(a)&&queueMicrotask(()=>_e(i))},t[257]=_e,t[258]=Qt,t[259]=he,t[260]=xi):xi=t[260];let Si=xi,Ci;t[261]===Symbol.for(`react.memo_cache_sentinel`)?(Ci=function(e){Tm(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,ut(!0))},t[261]=Ci):Ci=t[261];let wi=Ci,Ti;t[262]===Symbol.for(`react.memo_cache_sentinel`)?(Ti=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||ut(!1)},t[262]=Ti):Ti=t[262];let Ei=Ti,Di;t[263]===vr?Di=t[264]:(Di=function(e){if(!Tm(e.nativeEvent))return;let t=ym(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),ut(!1),vr(t,``,q1))},t[263]=vr,t[264]=Di);let ki=Di;if(E){let e;return t[265]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(V0,{}),t[265]=e):e=t[265],e}let Ai;t[266]!==a||t[267]!==A||t[268]!==M?(Ai=A?a(M?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[266]=a,t[267]=A,t[268]=M,t[269]=Ai):Ai=t[269];let ji=Ai;if(w.length===0){if(ji!==null){let e;return t[270]===ji?e=t[271]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:ji})}),t[270]=ji,t[271]=e),e}if(O){let e;return t[272]===O?e=t[273]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:O})}),t[272]=O,t[273]=e),e}if(sd({visibility:{showHiddenFiles:zt,showOnlyMarkdownFiles:Bt},unfilteredRootEntryCount:I,knownPageCount:b.size})===`filtered-to-zero`){let e;return t[274]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(jQ,{}),t[274]=e):e=t[274],e}let e;t[275]===a?e=t[276]:(e=a({id:`5ZB7XC`}),t[275]=a,t[276]=e);let n=lt&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,r;t[277]===n?r=t[278]:(r=Y(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[277]=n,t[278]=r);let i;t[279]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(J,{id:`xiv-dW`})}),t[279]=i):i=t[279];let o;t[280]===Sr?o=t[281]:(o=()=>Sr(`file`,``),t[280]=Sr,t[281]=o);let s;t[282]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(J,{id:`6ibbCg`}),t[282]=s):s=t[282];let c;t[283]===o?c=t[284]:(c=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:s}),t[283]=o,t[284]=c);let l;return t[285]!==ki||t[286]!==e||t[287]!==r||t[288]!==c?(l=(0,Z.jsxs)(`section`,{"aria-label":e,className:r,onDragOver:wi,onDragLeave:Ei,onDrop:ki,children:[i,c]}),t[285]=ki,t[286]=e,t[287]=r,t[288]=c,t[289]=l):l=t[289],l}let Mi=R!==null,Ni=B?.targets[0]??null,Pi=null;if(P!==null){let e;if(t[290]!==o.locale||t[291]!==P){let n=new Intl.NumberFormat(o.locale).format(P);e=zu._({id:`LuoJWu`,values:{truncatedShownCount:P,formattedCount:n}}),t[290]=o.locale,t[291]=P,t[292]=e}else e=t[292];Pi=e}let Fi;t[293]!==O||t[294]!==ji||t[295]!==Pi?(Fi=(O||ji!==null||Pi!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[ji===null?O&&(0,Z.jsx)(U0,{kind:`error`,children:O}):(0,Z.jsx)(U0,{kind:`reconnecting`,children:ji}),Pi!==null&&(0,Z.jsx)(U0,{kind:`info`,children:Pi})]}),t[293]=O,t[294]=ji,t[295]=Pi,t[296]=Fi):Fi=t[296];let Ii;t[297]===_?Ii=t[298]:(Ii=IQ(_),t[297]=_,t[298]=Ii);let Li=ie?``:void 0,Ri;t[299]===Li?Ri=t[300]:(Ri={[X1]:Li},t[299]=Li,t[300]=Ri);let zi;t[301]!==Mi||t[302]!==be||t[303]!==Er||t[304]!==w||t[305]!==wr||t[306]!==sn||t[307]!==jn||t[308]!==Pn||t[309]!==It||t[310]!==Qt||t[311]!==Lt||t[312]!==Sr||t[313]!==q?(zi=(e,t)=>(0,Z.jsx)(e0,{item:e,context:t,anyActionBusy:Mi,workspace:q,handoff:It,model:Qt,okignoreBinding:Lt,onStartCreating:Sr,onCreateFromTemplate:(e,t)=>Sr(`file`,e,{template:t}),onDuplicate:jn,onImportTemplate:Pn,onDelete:e=>V({targets:e}),onExpandSubtree:wr,onCollapseSubtree:Er,folderTreePaths:sn,isAsset:be.has(e.path),documents:w}),t[301]=Mi,t[302]=be,t[303]=Er,t[304]=w,t[305]=wr,t[306]=sn,t[307]=jn,t[308]=Pn,t[309]=It,t[310]=Qt,t[311]=Lt,t[312]=Sr,t[313]=q,t[314]=zi):zi=t[314];let Bi;t[315]!==Si||t[316]!==bi||t[317]!==Qt||t[318]!==Fi||t[319]!==Ii||t[320]!==Ri||t[321]!==zi?(Bi=(0,Z.jsx)(`div`,{ref:nt,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(kQ,{header:Fi,model:Qt,style:Ii,...Ri,onClickCapture:Si,onMouseMove:bi,onMouseLeave:gi,renderContextMenu:zi})}),t[315]=Si,t[316]=bi,t[317]=Qt,t[318]=Fi,t[319]=Ii,t[320]=Ri,t[321]=zi,t[322]=Bi):Bi=t[322];let Hi=!!B,Ui;t[323]===R?Ui=t[324]:(Ui=e=>{!e&&!R&&V(null)},t[323]=R,t[324]=Ui);let Wi;t[325]!==a||t[326]!==R||t[327]!==B||t[328]!==ni||t[329]!==Ni?(Wi=B&&Ni&&(0,Z.jsx)(bs,{...(()=>{let e=J$(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,B.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(s0)}):null};let t=B.targets.length,n=Ni.name;return{itemName:t===1?Ni.kind===`folder`?`${Ni.name}/`:Ni.kind===`file`?`${Ni.name}${Ni.docExt??`.md`}`:Ni.name:void 0,customTitle:t>1?a({id:`abiHje`}):void 0,customDescription:t>1?a({id:`WMIKXK`,values:{targetCount:t}}):Ni.kind===`folder`?a({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:R!==null,onDelete:()=>ni(B.targets)}),t[325]=a,t[326]=R,t[327]=B,t[328]=ni,t[329]=Ni,t[330]=Wi):Wi=t[330];let Gi;t[331]!==Hi||t[332]!==Ui||t[333]!==Wi?(Gi=(0,Z.jsx)(An,{open:Hi,onOpenChange:Ui,children:Wi}),t[331]=Hi,t[332]=Ui,t[333]=Wi,t[334]=Gi):Gi=t[334];let qi=!!H,Ji;t[335]===R?Ji=t[336]:(Ji=e=>{!e&&!R&&U(null)},t[335]=R,t[336]=Ji);let Yi;t[337]!==a||t[338]!==R||t[339]!==Fn||t[340]!==H?(Yi=H&&(0,Z.jsx)(bs,{itemName:H.name+(H.kind===`file`?H.docExt??`.md`:`.md`),customTitle:a({id:`hLod4_`}),customDescription:a({id:`RMQe3p`}),customConfirmLabel:a({id:`hvZwVx`}),customConfirmLabelBusy:a({id:`ul1Atu`}),isSubmitting:R!==null,onDelete:()=>Fn(H,!0)}),t[337]=a,t[338]=R,t[339]=Fn,t[340]=H,t[341]=Yi):Yi=t[341];let Zi;t[342]!==qi||t[343]!==Ji||t[344]!==Yi?(Zi=(0,Z.jsx)(An,{open:qi,onOpenChange:Ji,children:Yi}),t[342]=qi,t[343]=Ji,t[344]=Yi,t[345]=Zi):Zi=t[345];let Qi=!!W,ta;t[346]===R?ta=t[347]:(ta=e=>{!e&&!R&&te(null)},t[346]=R,t[347]=ta);let na;t[348]!==R||t[349]!==ii||t[350]!==oi||t[351]!==W?(na=W&&(0,Z.jsx)(n1,{failedTargets:W.failed,isSubmitting:R!==null,onDeletePermanently:ii,onRetry:oi,onCancel:()=>te(null)}),t[348]=R,t[349]=ii,t[350]=oi,t[351]=W,t[352]=na):na=t[352];let ra;t[353]!==Qi||t[354]!==ta||t[355]!==na?(ra=(0,Z.jsx)(An,{open:Qi,onOpenChange:ta,children:na}),t[353]=Qi,t[354]=ta,t[355]=na,t[356]=ra):ra=t[356];let ia=ne!==null,aa;t[357]===Symbol.for(`react.memo_cache_sentinel`)?(aa=e=>{e||K(null)},t[357]=aa):aa=t[357];let oa=ne?.parentDir??``,sa;t[358]!==ia||t[359]!==oa?(sa=(0,Z.jsx)(Ny,{open:ia,onOpenChange:aa,kind:`file`,initialDir:oa,defaultToTemplate:!0}),t[358]=ia,t[359]=oa,t[360]=sa):sa=t[360];let ca;return t[361]!==Bi||t[362]!==Gi||t[363]!==Zi||t[364]!==ra||t[365]!==sa?(ca=(0,Z.jsxs)(Z.Fragment,{children:[Bi,Gi,Zi,ra,sa]}),t[361]=Bi,t[362]=Gi,t[363]=Zi,t[364]=ra,t[365]=sa,t[366]=ca):ca=t[366],ca}function s0(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:Y$(e)},`${e.kind}:${e.path}`)}function c0(e){return`${e.kind}:${e.path}`}function l0(e){return`${e.kind}:${e.path}`}function u0(e){return e.path}function d0(e){return e.kind===`folder`}function f0(e){return e.path}function p0(e){return e.kind===`file`}function m0(e){return e.file}function h0(e){return!cd(e.path)}function g0(e){return D(e)}function _0(e){return fe(e)}function v0(e){return ue(e)}function y0(e){return e.path}function b0(e){return e.kind===`asset`}function x0(e){return e.endsWith(`/`)?e.slice(0,-1):e}function S0(e){return!!e}function C0(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function w0(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function T0(e){Mu.error(e)}function E0(){}function D0(e){return Mu.error(e)}function O0(){}function k0(){}function A0(){}function j0(){}function M0(){}async function N0(){}function P0(e){return vm(e)}function F0(e){return I0(e)?.dataset.itemPath??null}function I0(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function L0(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function R0(e){let t=I0(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=bm(e,n);return{parentDir:r,row:t,root:null,busyPath:n?Om(r):e}}return z0(e)?{parentDir:``,row:null,root:L0(e),busyPath:q1}:null}function z0(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var B0=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function V0(){let e=(0,$.c)(5),{_:t}=Dt(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=B0.map(H0),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function H0(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(jp,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(jp,{className:`h-3 ${e}`})]},t)}function U0(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?Eu:n===`reconnecting`?_u:cl,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=Y(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c=n===`reconnecting`&&`animate-spin motion-reduce:animate-none`,l;t[2]===c?l=t[3]:(l=Y(`mt-0.5 size-3.5 shrink-0`,c),t[2]=c,t[3]=l);let u;t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(i,{"aria-hidden":`true`,className:l}),t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[7]=r,t[8]=d);let f;return t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`span`,{role:a,className:s,children:[u,d]}),t[9]=a,t[10]=s,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function W0(e){return e?zu._({id:`wTcjov`}):null}function G0(e){let t=(0,$.c)(46),{_:n}=Dt(),r=fc(),i=fs(),a=ri(),o=ci();if(r)return null;let{input:s,installStates:c,dispatch:l}=e,u=s===null,d,f,p,m,h,g,_,v,y,b,x;if(t[0]!==n||t[1]!==l||t[2]!==s||t[3]!==u||t[4]!==c||t[5]!==o||t[6]!==a||t[7]!==i){let e=W0(u),r;t[19]===o?r=t[20]:(r=e=>mi(o,e.id),t[19]=o,t[20]=r);let S=li.filter(r),C;t[21]===o?C=t[22]:(C=e=>ui(o,e.source,e.id,!0,e.supported),t[21]=o,t[22]=C);let w=a.filter(C),T=i?Wi.filter(e=>fi(o,e,i.installedClis)):[];p=S.length>0,m=i!==null&&T.length>0,h=w.length>0,f=Ab,t[23]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsxs)(Nb,{children:[(0,Z.jsx)(lc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`O7_W_a`})]}),t[23]=x):x=t[23],d=Pb,g=`max-h-80`,_=h?(0,Z.jsxs)(kb,{"aria-label":n({id:`vPKX2i`}),children:[(0,Z.jsxs)(Ib,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(J,{id:`RXEbZy`}),(0,Z.jsx)(pi,{})]}),w.map(t=>{let r=t.name;return(0,Z.jsxs)(Mb,{onSelect:()=>{s!==null&&Ds(s,{agent:{source:t.source,id:t.id}})},disabled:u,"data-testid":`empty-space-open-in-thread-${t.id}`,"aria-label":e?n({id:`gtGQ9S`,values:{agentName:r,hint:e}}):void 0,children:[(0,Z.jsx)(Po,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`5PrrYw`,values:{agentName:r}})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[24]!==p||t[25]!==m||t[26]!==h?(v=h&&(m||p)?(0,Z.jsx)(Lb,{}):null,t[24]=p,t[25]=m,t[26]=h,t[27]=v):v=t[27],y=m?(0,Z.jsxs)(kb,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(Ib,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),T.map(t=>{let{displayName:r}=Ri[t];return(0,Z.jsxs)(Mb,{onSelect:()=>{s!==null&&i.launchInTerminal(s,t)},disabled:u,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(di,{id:ai(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,b=p?(0,Z.jsxs)(Z.Fragment,{children:[m?(0,Z.jsx)(Lb,{}):null,(0,Z.jsxs)(kb,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(Ib,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),S.map(t=>{let r=!u,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(Mb,{disabled:!r,onSelect:()=>{if(s){if(c[t.id]?.installed!==!0){Ts(t);return}l(t.id,s)}},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(di,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=l,t[2]=s,t[3]=u,t[4]=c,t[5]=o,t[6]=a,t[7]=i,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x}else d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18];let S;t[28]!==p||t[29]!==m||t[30]!==h?(S=h||m||p?(0,Z.jsx)(Lb,{}):null,t[28]=p,t[29]=m,t[30]=h,t[31]=S):S=t[31];let C;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(wu,{"aria-hidden":`true`}),t[32]=C):C=t[32];let w;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(Mb,{onSelect:Wu,"data-testid":`empty-space-open-in-settings`,children:[C,(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`jRAGrQ`})})]}),t[33]=w):w=t[33];let T;t[34]!==d||t[35]!==g||t[36]!==_||t[37]!==v||t[38]!==y||t[39]!==b||t[40]!==S?(T=(0,Z.jsxs)(d,{className:g,children:[_,v,y,b,S,w]}),t[34]=d,t[35]=g,t[36]=_,t[37]=v,t[38]=y,t[39]=b,t[40]=S,t[41]=T):T=t[41];let E;return t[42]!==f||t[43]!==x||t[44]!==T?(E=(0,Z.jsxs)(f,{children:[x,T]}),t[42]=f,t[43]=x,t[44]=T,t[45]=E):E=t[45],E}async function K0(e){try{let t=await e.project.listRecent(),n=e.config.projectPath;if(t.some(e=>e.path!==n))return null;let r=await JO();return e.config.freshlyCreated?r:r===0?0:null}catch(e){return console.warn(`[onboarding-card-visible] fresh-project probe failed; suppressing card`,e),null}}function q0(e){let t=(0,$.c)(4),n=e===void 0?WO:e,{initialized:r,dismissed:i,completed:a}=(0,Q.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),o=i||a,s=!r&&!o,c,l;return t[0]!==s||t[1]!==n?(c=()=>{if(!s)return;let e=window.okDesktop;if(e==null)return;let t=!1;return K0(e).then(e=>{!t&&e!==null&&n.activate(e)}),()=>{t=!0}},l=[s,n],t[0]=s,t[1]=n,t[2]=c,t[3]=l):(c=t[2],l=t[3]),(0,Q.useEffect)(c,l),r&&!o}function J0(e){let t=(0,$.c)(3),n=e===void 0?WO:e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=()=>{if(n.getSnapshot().steps.file)return;let e=_d(e=>{e.includes(`files`)&&YO(n)});return YO(n),e},i=[n],t[0]=n,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i)}var Y0=3,X0=5200,Z0=1500,Q0=220;function $0(e){let t=(0,$.c)(14),{complete:n,label:r,shortcutId:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(cr,{checked:n,disabled:!0,"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none opacity-100 disabled:opacity-100`}),t[0]=n,t[1]=a);let o=n?`flex-1 text-muted-foreground/60`:`flex-1`,s;t[2]===n?s=t[3]:(s=n?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[(0,Z.jsx)(J,{id:`Qj4RL5`}),` `]}):null,t[2]=n,t[3]=s);let c;t[4]!==r||t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(`span`,{className:o,children:[s,r]}),t[4]=r,t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===i?l=t[9]:(l=i?(0,Z.jsx)(le,{children:Hu(i)}):null,t[8]=i,t[9]=l);let u;return t[10]!==a||t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`li`,{className:`flex items-center gap-2 py-0.5 text-sm`,children:[a,c,l]}),t[10]=a,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function e2(e){let t=(0,$.c)(24),{store:n,lingerMs:r}=e,i=n===void 0?WO:n,a=r===void 0?X0:r,{_:o}=Dt(),{steps:s}=GO(i);J0(i);let[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(!1),f=1+ +!!s.file+ +!!s.askedAi,p=f===Y0,m,h;t[0]!==p||t[1]!==a?(m=()=>{if(!p)return;l(n2);let e=setInterval(()=>l(t2),Z0),t=setTimeout(()=>{clearInterval(e),d(!0)},a);return()=>{clearInterval(e),clearTimeout(t)}},h=[p,a],t[0]=p,t[1]=a,t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g,_;t[4]!==u||t[5]!==i?(g=()=>{if(!u)return;let e=setTimeout(()=>i.markCompleted(),Q0);return()=>clearTimeout(e)},_=[u,i],t[4]=u,t[5]=i,t[6]=g,t[7]=_):(g=t[6],_=t[7]),(0,Q.useEffect)(g,_);let v;t[8]!==o||t[9]!==p?(v=p?o({id:`7jIIFX`}):``,t[8]=o,t[9]=p,t[10]=v):v=t[10];let y;t[11]===v?y=t[12]:(y=(0,Z.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:v}),t[11]=v,t[12]=y);let b;t[13]!==p||t[14]!==c||t[15]!==f||t[16]!==u||t[17]!==s.askedAi||t[18]!==s.file||t[19]!==i?(b=p?(0,Z.jsxs)(`section`,{"aria-hidden":!0,className:Y(`mx-2 mb-1 flex items-center gap-3 rounded-lg border bg-card px-4 py-3 text-card-foreground`,`motion-reduce:animate-none motion-reduce:duration-0`,u?`animate-out fade-out-0 zoom-out-95 fill-mode-forwards duration-200`:`animate-in fade-in-0 zoom-in-95 duration-300`),children:[(0,Z.jsx)(Nh,{size:36,celebrateSignal:c}),(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:(0,Z.jsx)(J,{id:`7jIIFX`})})]}):(0,Z.jsxs)(`section`,{"aria-labelledby":`onboarding-card-heading`,className:`mx-2 mb-1 rounded-lg border bg-card px-4 py-3 text-card-foreground`,children:[(0,Z.jsxs)(`header`,{className:`mb-3 flex items-center justify-between`,children:[(0,Z.jsx)(`h2`,{id:`onboarding-card-heading`,className:`font-medium text-sm`,children:(0,Z.jsx)(J,{id:`Y1QMlM`})}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/60 text-xs tabular-nums`,children:`${f} / ${Y0}`})]}),(0,Z.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($0,{complete:!0,label:(0,Z.jsx)(J,{id:`4E9jPa`})}),(0,Z.jsx)($0,{complete:s.file,label:(0,Z.jsx)(J,{id:`6ibbCg`}),shortcutId:`new-item`}),(0,Z.jsx)($0,{complete:s.askedAi,label:(0,Z.jsx)(J,{id:`xWEvuo`}),shortcutId:`open-ask-ai`})]}),(0,Z.jsx)(`footer`,{className:`-mb-1 mt-2 flex justify-end`,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto px-2 py-1 text-muted-foreground text-xs`,onClick:()=>i.dismiss(),children:(0,Z.jsx)(J,{id:`1QfxQT`})})})]}),t[13]=p,t[14]=c,t[15]=f,t[16]=u,t[17]=s.askedAi,t[18]=s.file,t[19]=i,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(Z.Fragment,{children:[y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function t2(e){return e+1}function n2(e){return e+1}function r2(){let e=(0,$.c)(1);if(!q0())return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(e2,{}),e[0]=t):t=e[0],t}function i2(e){return e===null?null:e.kind===`local`?e.name:e.ref}function a2(e,t){if(e.length===0)return null;let n=`origin/${e}`;return t.includes(n)?n:t.find(t=>pa(t)===e)??null}function o2(e){switch(e){case`branch-exists`:return{id:`wzq9Rv`};case`already-checked-out`:return{id:`ljHjfg`};case`path-exists`:return{id:`mYzDD_`};case`invalid-branch`:return{id:`r-OJYm`};case`no-git`:return{id:`CFnavk`};case`helper-not-found`:return{id:`HqOPpj`};default:return{id:`-zA2E7`}}}function s2(e){let t=(0,$.c)(71),{open:n,onOpenChange:r,bridge:i,currentBranch:a,branches:o,existingWorktreeBranches:s,remoteBranches:c,behindByBranch:l,initialBranchName:u}=e,d=o===void 0?[]:o,f=c===void 0?[]:c,p=u===void 0?``:u,{_:m}=Dt(),h=(0,Q.useId)(),g=(0,Q.useId)(),_=(0,Q.useId)(),v=(0,Q.useId)(),y=(0,Q.useId)(),b=(0,Q.useId)(),[x,S]=(0,Q.useState)(``),C;t[0]===a?C=t[1]:(C=a===null?null:{kind:`local`,name:a},t[0]=a,t[1]=C);let[w,T]=(0,Q.useState)(C),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I,L;t[2]!==a||t[3]!==p||t[4]!==n?(I=()=>{if(!n)return;S(p),T(a===null?null:{kind:`local`,name:a}),D(!1),k(``),j(!1),N(null);let e=requestAnimationFrame(()=>P.current?.focus());return()=>cancelAnimationFrame(e)},L=[n,a,p],t[2]=a,t[3]=p,t[4]=n,t[5]=I,t[6]=L):(I=t[5],L=t[6]),(0,Q.useEffect)(I,L);let R=x.trim(),z=!A&&R.length>0,B=R.length>0&&d.includes(R),V=B?null:a2(R,f),H=V!==null,U=B||H,ee=B&&(s?.has(R)??!1),W=d.filter(e=>e.toLowerCase().startsWith(R.toLowerCase())),te=!A&&W.length>0&&!U,G=(a!==null&&!d.includes(a)?[a,...d]:d).map(f2),ne=f.map(d2),K=i2(w),q=O.trim().toLowerCase(),re=q===``?G:G.filter(e=>e.name.toLowerCase().includes(q)),ie=q===``?ne:ne.filter(e=>e.ref.toLowerCase().includes(q)),ae=q!==``&&re.length===0&&ie.length===0,oe=async function(e){if(e.preventDefault(),z){j(!0),N(null);try{let e=H?{branch:R,createBranch:!0,remoteRef:V}:B?{branch:R,createBranch:!1}:{branch:R,createBranch:!0,baseBranch:w?.kind===`local`?w.name:void 0,baseRef:w?.kind===`remote`?w.ref:void 0},t=await i.worktree.create(e);if(!t.ok){N(o2(t.reason)),j(!1);return}Df(),r(!1),await i.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[NewWorktreeDialog] worktree create/open failed:`,e),Mu.error(m({id:`vAYoCZ`})),j(!1)}}},se=An,ce;t[7]!==A||t[8]!==r?(ce=e=>{A||r(e)},t[7]=A,t[8]=r,t[9]=ce):ce=t[9];let le=En,ue;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(Tn,{children:(0,Z.jsx)(J,{id:`DXd9LM`})}),t[10]=ue):ue=t[10];let de;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsxs)(kn,{children:[ue,(0,Z.jsx)(wn,{children:(0,Z.jsx)(J,{id:`NEzPEh`})})]}),t[11]=de):de=t[11];let fe=Dn,pe;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(J,{id:`ng2Ibo`}),t[12]=pe):pe=t[12];let me;t[13]===g?me=t[14]:(me=(0,Z.jsx)(Jr,{htmlFor:g,children:pe}),t[13]=g,t[14]=me);let he;t[15]===m?he=t[16]:(he=m({id:`IX_uXB`}),t[15]=m,t[16]=he);let ge;t[17]===M?ge=t[18]:(ge=e=>{S(e.target.value),M!==null&&N(null)},t[17]=M,t[18]=ge);let _e=M!==null,ve=M===null?y:`${y} ${b}`,ye;t[19]!==x||t[20]!==A||t[21]!==g||t[22]!==he||t[23]!==ge||t[24]!==_e||t[25]!==ve?(ye=(0,Z.jsx)(Ru,{id:g,ref:P,value:x,placeholder:he,onChange:ge,disabled:A,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-invalid":_e,"aria-describedby":ve,"data-testid":`new-worktree-branch`}),t[19]=x,t[20]=A,t[21]=g,t[22]=he,t[23]=ge,t[24]=_e,t[25]=ve,t[26]=ye):ye=t[26];let be=R.length>0?(0,Z.jsxs)(`p`,{id:y,className:`flex items-start gap-1.5 text-1sm text-muted-foreground`,"data-testid":ee?`new-worktree-mode-existing-worktree`:H?`new-worktree-mode-remote-checkout`:B?`new-worktree-mode-checkout`:`new-worktree-mode-create`,children:[ee?(0,Z.jsx)(Dc,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`}):H?(0,Z.jsx)(Fs,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-400`}):B?(0,Z.jsx)(Zo,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-blue-600 dark:text-blue-400`}):(0,Z.jsx)(tn,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-green-600 dark:text-green-400`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:ee?(0,Z.jsx)(J,{id:`QAi7Q9`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`})}}):H?(0,Z.jsx)(J,{id:`oAGN8p`,values:{remoteCheckoutRef:V,trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}}):B?(0,Z.jsx)(J,{id:`b4VvP-`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):K===null?(0,Z.jsx)(J,{id:`t4sFKC`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):(0,Z.jsx)(J,{id:`dGAdpH`,values:{trimmed:R,currentBaseLabel:K},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}})})]}):null,xe=te?(0,Z.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded-md border bg-popover p-1 shadow-xs`,"data-testid":`new-worktree-branch-list`,children:W.map(e=>(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,tabIndex:-1,onClick:()=>{S(e),M!==null&&N(null),P.current?.focus()},"data-testid":`new-worktree-branch-option-${e}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(To,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e})]},e))}):null,Se=U?null:(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2`,children:[(0,Z.jsx)(Jr,{id:v,htmlFor:_,children:(0,Z.jsx)(J,{id:`ZWwYwM`})}),(0,Z.jsxs)(Qt,{open:E,onOpenChange:e=>{D(e),e||k(``)},children:[(0,Z.jsx)($t,{asChild:!0,children:(0,Z.jsxs)(X,{id:_,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":E,"aria-haspopup":`listbox`,"aria-labelledby":`${v} ${_}`,"aria-label":m({id:`ZWwYwM`}),disabled:A,"data-testid":`new-worktree-base-trigger`,className:`w-full justify-between font-normal`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[w?.kind===`remote`?(0,Z.jsx)(Fs,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):(0,Z.jsx)(To,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-left`,children:K===null?(0,Z.jsx)(J,{id:`EbjWsS`}):K})]}),(0,Z.jsx)(a_,{"aria-hidden":`true`,className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,Z.jsxs)(an,{align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,onWheel:u2,onTouchMove:l2,onOpenAutoFocus:e=>{e.preventDefault(),F.current?.focus()},children:[(0,Z.jsxs)(Kc,{className:`mb-1 h-8`,children:[(0,Z.jsx)(zc,{ref:F,"aria-label":m({id:`fuJZKk`}),placeholder:m({id:`hQXiDc`}),value:O,onChange:e=>k(e.target.value),onKeyDown:c2,"data-testid":`new-worktree-base-search`}),(0,Z.jsx)(Gc,{children:(0,Z.jsx)(Ct,{"aria-hidden":`true`})})]}),(0,Z.jsxs)(`div`,{role:`listbox`,"aria-label":m({id:`ZWwYwM`}),className:`max-h-56 overflow-y-auto`,"data-testid":`new-worktree-base-list`,children:[ae?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Sh3Qkg`})}):null,re.map(e=>{let t=e.name,n=l?.get(t);return(0,Z.jsxs)(X,{type:`button`,role:`option`,"aria-selected":w?.kind===`local`&&w.name===t,variant:`ghost`,size:`sm`,onClick:()=>{T(e),D(!1),k(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(To,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),n!==void 0&&n>0?(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-amber-600 dark:text-amber-400`,"data-testid":`new-worktree-base-behind-${t}`,children:(0,Z.jsx)(J,{id:`6-wLTJ`,values:{behind:n}})}):null]},`local:${t}`)}),ie.map(e=>{let t=e.ref;return(0,Z.jsxs)(X,{type:`button`,role:`option`,"aria-selected":w?.kind===`remote`&&w.ref===t,variant:`ghost`,size:`sm`,onClick:()=>{T(e),D(!1),k(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(Fs,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`dIYSqk`})})]},`remote:${t}`)})]})]})]})]}),Ce;t[27]!==m||t[28]!==M||t[29]!==b?(Ce=M===null?null:(0,Z.jsx)(`p`,{id:b,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`new-worktree-error`,children:m(M)}),t[27]=m,t[28]=M,t[29]=b,t[30]=Ce):Ce=t[30];let we;t[31]!==h||t[32]!==oe||t[33]!==me||t[34]!==ye||t[35]!==be||t[36]!==xe||t[37]!==Se||t[38]!==Ce?(we=(0,Z.jsxs)(`form`,{id:h,onSubmit:oe,className:`flex flex-col gap-2`,children:[me,ye,be,xe,Se,Ce]}),t[31]=h,t[32]=oe,t[33]=me,t[34]=ye,t[35]=be,t[36]=xe,t[37]=Se,t[38]=Ce,t[39]=we):we=t[39];let Te;t[40]!==fe||t[41]!==we?(Te=(0,Z.jsx)(fe,{children:we}),t[40]=fe,t[41]=we,t[42]=Te):Te=t[42];let Ee;t[43]===r?Ee=t[44]:(Ee=()=>r(!1),t[43]=r,t[44]=Ee);let De;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(J,{id:`dEgA5A`}),t[45]=De):De=t[45];let Oe;t[46]!==A||t[47]!==Ee?(Oe=(0,Z.jsx)(X,{type:`button`,variant:`outline`,onClick:Ee,disabled:A,"data-testid":`new-worktree-cancel`,children:De}),t[46]=A,t[47]=Ee,t[48]=Oe):Oe=t[48];let ke=!z,Ae;t[49]!==A||t[50]!==ee||t[51]!==B||t[52]!==H?(Ae=A?(0,Z.jsx)(J,{id:`b4itZn`}):ee?(0,Z.jsx)(J,{id:`XV5sC0`}):H?(0,Z.jsx)(J,{id:`XAyxsa`}):B?(0,Z.jsx)(J,{id:`uGaIIS`}):(0,Z.jsx)(J,{id:`iO8V-7`}),t[49]=A,t[50]=ee,t[51]=B,t[52]=H,t[53]=Ae):Ae=t[53];let je;t[54]!==h||t[55]!==ke||t[56]!==Ae?(je=(0,Z.jsx)(X,{type:`submit`,form:h,disabled:ke,"data-testid":`new-worktree-create`,children:Ae}),t[54]=h,t[55]=ke,t[56]=Ae,t[57]=je):je=t[57];let Me;t[58]!==Oe||t[59]!==je?(Me=(0,Z.jsxs)(On,{children:[Oe,je]}),t[58]=Oe,t[59]=je,t[60]=Me):Me=t[60];let Ne;t[61]!==le||t[62]!==de||t[63]!==Te||t[64]!==Me?(Ne=(0,Z.jsxs)(le,{className:`sm:max-w-md`,"data-testid":`new-worktree-dialog`,children:[de,Te,Me]}),t[61]=le,t[62]=de,t[63]=Te,t[64]=Me,t[65]=Ne):Ne=t[65];let Pe;return t[66]!==se||t[67]!==n||t[68]!==Ne||t[69]!==ce?(Pe=(0,Z.jsx)(se,{open:n,onOpenChange:ce,children:Ne}),t[66]=se,t[67]=n,t[68]=Ne,t[69]=ce,t[70]=Pe):Pe=t[70],Pe}function c2(e){return e.stopPropagation()}function l2(e){e.stopPropagation()}function u2(e){e.stopPropagation()}function d2(e){return{kind:`remote`,ref:e}}function f2(e){return{kind:`local`,name:e}}function p2(e){let t=(0,$.c)(54),{bridge:n,recents:r,currentPath:i,query:a,worktreeModel:o,closeMenu:s,guardStaleSelect:c,onRemoveRecent:l,flyoutPath:u,setFlyoutPath:d,openNewWorktreeWith:f}=e,{_:p}=Dt(),m;t[0]!==p||t[1]!==n.project||t[2]!==s?(m=function(e,t){s(),n.project.open({path:e,target:`new-window`,entryPoint:t}).catch(e=>{console.warn(`[RecentProjectsMenu] project.open failed:`,e),Mu.error(p({id:`6HCOwA`}))})},t[0]=p,t[1]=n.project,t[2]=s,t[3]=m):m=t[3];let h=m,g;t[4]!==p||t[5]!==n.project||t[6]!==n.worktree?(g=async function(e){try{let t=await n.worktree.create({branch:e,createBranch:!1});if(!t.ok){Mu.error(p({id:`teD0H9`}));return}Df(),await n.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[RecentProjectsMenu] create/open branch failed:`,e),Mu.error(p({id:`LwMxXg`}))}},t[4]=p,t[5]=n.project,t[6]=n.worktree,t[7]=g):g=t[7];let _=g,v;t[8]!==s||t[9]!==i||t[10]!==h?(v=function(e){if(e.path===i){s();return}h(e.path,e.isLinkedWorktree?`worktree`:`recents`)},t[8]=s,t[9]=i,t[10]=h,t[11]=v):v=t[11];let y=v,b;t[12]!==s||t[13]!==_||t[14]!==i||t[15]!==h?(b=function(e){if(e.path!==null){if(e.path===i){s();return}h(e.path,e.isMain?`recents`:`worktree`);return}e.branch!==null&&(s(),_(e.branch))},t[12]=s,t[13]=_,t[14]=i,t[15]=h,t[16]=b):b=t[16];let x=b;if(a!==``){let e;t[17]!==s||t[18]!==_?(e=e=>{s(),_(e)},t[17]=s,t[18]=_,t[19]=e):e=t[19];let n;return t[20]!==i||t[21]!==c||t[22]!==y||t[23]!==l||t[24]!==a||t[25]!==r||t[26]!==e||t[27]!==o?(n=(0,Z.jsx)(v2,{recents:r,currentPath:i,query:a,worktreeModel:o,onPickEntry:y,onPickBranch:e,guardStaleSelect:c,onRemoveRecent:l}),t[20]=i,t[21]=c,t[22]=y,t[23]=l,t[24]=a,t[25]=r,t[26]=e,t[27]=o,t[28]=n):n=t[28],n}let S;if(t[29]!==s||t[30]!==i||t[31]!==u||t[32]!==c||t[33]!==x||t[34]!==l||t[35]!==f||t[36]!==h||t[37]!==r||t[38]!==d||t[39]!==o){let e=Eb(r),n;t[41]!==s||t[42]!==i||t[43]!==u||t[44]!==c||t[45]!==x||t[46]!==l||t[47]!==f||t[48]!==h||t[49]!==d||t[50]!==o?(n=e=>(0,Z.jsx)(m2,{group:e,currentPath:i,worktreeModel:o,flyoutOpen:u===e.project.path,setFlyoutOpen:t=>d(n=>t?e.project.path:n===e.project.path?null:n),onPickProject:()=>{if(e.project.path===i){s();return}h(e.project.path,`recents`)},onPickFlyoutEntry:x,guardStaleSelect:c,onRemoveRecent:l,openNewWorktreeWith:f},e.project.path),t[41]=s,t[42]=i,t[43]=u,t[44]=c,t[45]=x,t[46]=l,t[47]=f,t[48]=h,t[49]=d,t[50]=o,t[51]=n):n=t[51],S=e.map(n),t[29]=s,t[30]=i,t[31]=u,t[32]=c,t[33]=x,t[34]=l,t[35]=f,t[36]=h,t[37]=r,t[38]=d,t[39]=o,t[40]=S}else S=t[40];let C;return t[52]===S?C=t[53]:(C=(0,Z.jsx)(Z.Fragment,{children:S}),t[52]=S,t[53]=C),C}function m2(e){let t=(0,$.c)(45),{group:n,currentPath:r,worktreeModel:i,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,onRemoveRecent:u,openNewWorktreeWith:d}=e,f=n.project.path===r,p,m;t[0]!==r||t[1]!==n||t[2]!==i?(p=Cb(n,i,r),m=p.filter(h2),t[0]=r,t[1]=n,t[2]=i,t[3]=p,t[4]=m):(p=t[3],m=t[4]);let h=m.length;if(h===0){let e;t[5]!==l||t[6]!==s?(e=e=>{l(e)||s()},t[5]=l,t[6]=s,t[7]=e):e=t[7];let r=`project-switcher-recent-${n.project.path}`,i=f?`true`:void 0,a;t[8]!==n.project.name||t[9]!==n.project.path||t[10]!==f?(a=(0,Z.jsx)(x2,{name:n.project.name,path:n.project.path,current:f}),t[8]=n.project.name,t[9]=n.project.path,t[10]=f,t[11]=a):a=t[11];let o;t[12]!==e||t[13]!==r||t[14]!==i||t[15]!==a?(o=(0,Z.jsx)(Ir,{onSelect:e,className:`flex w-full min-w-0 flex-col items-start gap-0.5 pr-8`,"data-testid":r,"data-current":i,children:a}),t[12]=e,t[13]=r,t[14]=i,t[15]=a,t[16]=o):o=t[16];let c;t[17]!==n.project.name||t[18]!==n.project.path||t[19]!==u?(c=(0,Z.jsx)(Rb,{path:n.project.path,name:n.project.name,onRemoveRecent:u,testIdPrefix:`project-switcher-recent`}),t[17]=n.project.name,t[18]=n.project.path,t[19]=u,t[20]=c):c=t[20];let d;t[21]!==o||t[22]!==c?(d=(0,Z.jsxs)(`div`,{className:`group/recent relative flex items-center`,children:[o,c]}),t[21]=o,t[22]=c,t[23]=d):d=t[23];let p;return t[24]!==n.project.path||t[25]!==u||t[26]!==d?(p=(0,Z.jsx)(zb,{path:n.project.path,onRemoveRecent:u,testIdPrefix:`project-switcher-recent`,children:d}),t[24]=n.project.path,t[25]=u,t[26]=d,t[27]=p):p=t[27],p}let g;t[28]!==r||t[29]!==n.worktrees||t[30]!==f?(g=f||n.worktrees.some(e=>e.path===r),t[28]=r,t[29]=n.worktrees,t[30]=f,t[31]=g):g=t[31];let _=g,v;return t[32]!==_||t[33]!==r||t[34]!==p||t[35]!==a||t[36]!==n||t[37]!==l||t[38]!==c||t[39]!==s||t[40]!==d||t[41]!==h||t[42]!==o||t[43]!==i?(v=(0,Z.jsx)(g2,{group:n,currentPath:r,containsCurrent:_,worktreeModel:i,flyoutEntries:p,openedWorktreeCount:h,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:d}),t[32]=_,t[33]=r,t[34]=p,t[35]=a,t[36]=n,t[37]=l,t[38]=c,t[39]=s,t[40]=d,t[41]=h,t[42]=o,t[43]=i,t[44]=v):v=t[44],v}function h2(e){return e.opened&&!e.isMain}function g2(e){let t=(0,$.c)(46),{group:n,currentPath:r,containsCurrent:i,worktreeModel:a,flyoutEntries:o,openedWorktreeCount:s,flyoutOpen:c,setFlyoutOpen:l,onPickProject:u,onPickFlyoutEntry:d,guardStaleSelect:f,openNewWorktreeWith:p}=e,{_:m}=Dt(),h=n.project.path===r,g;t[0]!==f||t[1]!==u?(g=e=>{f(e)||u()},t[0]=f,t[1]=u,t[2]=g):g=t[2];let _=g,v,y;t[3]===_?(v=t[4],y=t[5]):(v=e=>{e.target.closest(`[data-project-open]`)!==null&&(e.preventDefault(),_(e.nativeEvent))},y=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_(e.nativeEvent))},t[3]=_,t[4]=v,t[5]=y);let b=`project-switcher-group-${n.project.path}`,x=c?`true`:void 0,S=i?`true`:void 0,C;t[6]===n.project.name?C=t[7]:(C=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,"data-project-open":``,title:n.project.name,children:n.project.name}),t[6]=n.project.name,t[7]=C);let w;t[8]===n.project.path?w=t[9]:(w=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:n.project.path,children:n.project.path}),t[8]=n.project.path,t[9]=w);let T;t[10]!==C||t[11]!==w?(T=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[C,w]}),t[10]=C,t[11]=w,t[12]=T):T=t[12];let E;t[13]!==m||t[14]!==h?(E=h?(0,Z.jsx)(Zo,{"aria-label":m({id:`Hp1l6f`}),className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}):null,t[13]=m,t[14]=h,t[15]=E):E=t[15];let D=`project-switcher-toggle-${n.project.path}`,O;t[16]===s?O=t[17]:(O=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:s}),t[16]=s,t[17]=O);let k;t[18]===s?k=t[19]:(k=(0,Z.jsx)(J,{id:`AKxFtn`,values:{openedWorktreeCount:s}}),t[18]=s,t[19]=k);let A;t[20]!==D||t[21]!==O||t[22]!==k?(A=(0,Z.jsxs)(`span`,{className:`mt-0.5 shrink-0 text-muted-foreground text-xs`,"data-testid":D,children:[O,` `,k]}),t[20]=D,t[21]=O,t[22]=k,t[23]=A):A=t[23];let j;t[24]!==E||t[25]!==A||t[26]!==v||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==T?(j=(0,Z.jsxs)(Ur,{onClick:v,onKeyDown:y,className:`flex w-full min-w-0 items-start gap-2`,"data-testid":b,"data-flyout-open":x,"data-current":S,children:[T,E,A]}),t[24]=E,t[25]=A,t[26]=v,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=T,t[32]=j):j=t[32];let M;t[33]!==o||t[34]!==c||t[35]!==n||t[36]!==f||t[37]!==d||t[38]!==p||t[39]!==a?(M=(0,Z.jsx)(_2,{group:n,open:c,worktreeModel:a,entries:o,onPickFlyoutEntry:d,guardStaleSelect:f,openNewWorktreeWith:p}),t[33]=o,t[34]=c,t[35]=n,t[36]=f,t[37]=d,t[38]=p,t[39]=a,t[40]=M):M=t[40];let N;return t[41]!==c||t[42]!==l||t[43]!==j||t[44]!==M?(N=(0,Z.jsxs)(Lr,{open:c,onOpenChange:l,children:[j,M]}),t[41]=c,t[42]=l,t[43]=j,t[44]=M,t[45]=N):N=t[45],N}function _2(e){let t=(0,$.c)(15),{group:n,open:r,worktreeModel:i,entries:a,onPickFlyoutEntry:o,guardStaleSelect:s,openNewWorktreeWith:c}=e,{_:l}=Dt(),[u,d]=(0,Q.useState)(``),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m,h;t[0]===r?(m=t[1],h=t[2]):(m=()=>{r&&f.current?.focus({preventScroll:!0})},h=[r],t[0]=r,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g=function(){let e=p.current;return e===null?[]:[...e.querySelectorAll(`[role="menuitem"]`)]},_=function(e){g()[e]?.focus()},v=function(e,t){if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation();let t=g(),n=t.indexOf(e.currentTarget);_(Math.min(n+1,t.length-1))}else if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=g().indexOf(e.currentTarget);t<=0?f.current?.focus():_(t-1)}else e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t())},y;if(t[3]!==a||t[4]!==u){let e=u.trim().toLowerCase();y=e===``?a:a.filter(t=>(t.branch??``).toLowerCase().includes(e)),t[3]=a,t[4]=u,t[5]=y}else y=t[5];let b=y,x=i!==null&&i.mainRoot===n.project.mainRoot,S=u.trim(),C=x&&S.length>0,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Gc,{align:`inline-start`,children:(0,Z.jsx)(Ct,{"aria-hidden":`true`})}),t[6]=w):w=t[6];let T;t[7]===l?T=t[8]:(T=l({id:`bSD4im`}),t[7]=l,t[8]=T);let E;t[9]===l?E=t[10]:(E=l({id:`Skr_7L`}),t[9]=l,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>d(e.target.value),t[11]=D):D=t[11];let O=b.length===0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Hr,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:l({id:`-uaQnI`})}),C?(0,Z.jsxs)(Ir,{onSelect:e=>{s(e)||c(S)},onKeyDown:e=>v(e,()=>c(S)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-create`,children:[(0,Z.jsx)(tn,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:S,children:(0,Z.jsx)(J,{id:`gHSAWT`,values:{typedName:S},components:{0:(0,Z.jsx)(`span`,{className:`font-medium`}),1:(0,Z.jsx)(`span`,{className:`font-mono`})}})})]}):null]}):b.map(e=>{let t=e.path??`branch:${e.branch}`,n=e.branch??l({id:`D12vtS`});return(0,Z.jsxs)(Ir,{onSelect:t=>{s(t)||o(e)},onKeyDown:t=>v(t,()=>o(e)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-entry-${t}`,"data-current":e.isCurrent?`true`:void 0,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:n,children:n}),e.isMain?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:l({id:`Bn9-El`})}):e.opened?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,title:l({id:`Dvwa0U`}),children:l({id:`nfoduq`})}),e.isCurrent?(0,Z.jsx)(S2,{}):null]},t)}),k;return t[12]!==p||t[13]!==O?(k=(0,Z.jsx)(`div`,{ref:p,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar`,children:O}),t[12]=p,t[13]=O,t[14]=k):k=t[14],(0,Z.jsx)(Gr,{children:(0,Z.jsxs)(Rr,{avoidCollisions:!1,sideOffset:-8,className:`flex max-h-80 w-96 flex-col gap-1 overflow-hidden p-1`,"data-testid":`project-switcher-flyout-${n.project.path}`,children:[(0,Z.jsxs)(Kc,{className:`mb-1 h-8 shrink-0`,children:[w,(0,Z.jsx)(zc,{ref:f,"aria-label":T,placeholder:E,value:u,onChange:D,onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),_(0)),e.stopPropagation()},"data-testid":`project-switcher-flyout-search-${n.project.path}`})]}),k]})})}function v2(e){let t=(0,$.c)(43),{recents:n,currentPath:r,query:i,worktreeModel:a,onPickEntry:o,onPickBranch:s,guardStaleSelect:c,onRemoveRecent:l}=e,{_:u}=Dt(),d;t[0]===i?d=t[1]:(d=e=>e.toLowerCase().includes(i),t[0]=i,t[1]=d);let f=d,p,m,h,g;if(t[2]!==u||t[3]!==r||t[4]!==c||t[5]!==f||t[6]!==s||t[7]!==o||t[8]!==l||t[9]!==n||t[10]!==a){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[15]===f?e=t[16]:(e=e=>!e.isLinkedWorktree&&(f(e.name)||f(e.path)),t[15]=f,t[16]=e);let i=n.filter(e),d;t[17]===f?d=t[18]:(d=e=>e.isLinkedWorktree===!0&&(f(e.branch??``)||f(e.path)),t[17]=f,t[18]=d);let _=n.filter(d),v=new Set(_.map(y2)),y;t[19]===a?.entries?y=t[20]:(y=a?.entries??[],t[19]=a?.entries,t[20]=y);let b=y.filter(e=>e.branch!==null&&f(e.branch)&&(e.worktreePath===null||!v.has(e.worktreePath))&&e.worktreePath!==r);if(i.length===0&&_.length===0&&b.length===0){let e;t[21]===u?e=t[22]:(e=u({id:`pEQFsW`}),t[21]=u,t[22]=e);let n;t[23]===e?n=t[24]:(n=(0,Z.jsx)(Hr,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:e}),t[23]=e,t[24]=n),g=n;break bb0}let x;t[25]!==r||t[26]!==c||t[27]!==o||t[28]!==l?(x=e=>(0,Z.jsx)(zb,{path:e.path,onRemoveRecent:l,testIdPrefix:`project-switcher-recent`,children:(0,Z.jsxs)(`div`,{className:`group/recent relative flex items-center`,children:[(0,Z.jsx)(Ir,{onSelect:t=>{c(t)||o(e)},className:`flex w-full min-w-0 flex-col items-start gap-0.5 pr-8`,"data-testid":`project-switcher-recent-${e.path}`,children:(0,Z.jsx)(x2,{name:e.name,path:e.path,current:e.path===r})}),(0,Z.jsx)(Rb,{path:e.path,name:e.name,onRemoveRecent:l,testIdPrefix:`project-switcher-recent`})]})},e.path),t[25]=r,t[26]=c,t[27]=o,t[28]=l,t[29]=x):x=t[29],p=i.map(x);let S;t[30]!==r||t[31]!==c||t[32]!==o?(S=e=>(0,Z.jsxs)(Ir,{onSelect:t=>{c(t)||o(e)},className:`flex items-start gap-2`,"data-testid":`project-switcher-worktree-${e.path}`,"data-current":e.path===r?`true`:void 0,children:[(0,Z.jsx)(To,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Z.jsx)(b2,{branch:e.branch??e.name,project:e.mainRoot===void 0?null:Tb(e.mainRoot)})]},e.path),t[30]=r,t[31]=c,t[32]=o,t[33]=S):S=t[33],m=_.map(S);let C;t[34]!==u||t[35]!==c||t[36]!==s||t[37]!==a?(C=e=>(0,Z.jsxs)(Ir,{onSelect:t=>{c(t)||e.branch!==null&&s(e.branch)},className:`flex items-start gap-2`,"data-testid":`project-switcher-branch-${e.branch}`,children:[(0,Z.jsx)(To,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 opacity-40`}),(0,Z.jsx)(b2,{branch:e.branch??``,project:a===null?null:Tb(a.mainRoot),hint:u({id:`nfoduq`})})]},`branch:${e.branch}`),t[34]=u,t[35]=c,t[36]=s,t[37]=a,t[38]=C):C=t[38],h=b.map(C)}t[2]=u,t[3]=r,t[4]=c,t[5]=f,t[6]=s,t[7]=o,t[8]=l,t[9]=n,t[10]=a,t[11]=p,t[12]=m,t[13]=h,t[14]=g}else p=t[11],m=t[12],h=t[13],g=t[14];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;return t[39]!==p||t[40]!==m||t[41]!==h?(_=(0,Z.jsxs)(Z.Fragment,{children:[p,m,h]}),t[39]=p,t[40]=m,t[41]=h,t[42]=_):_=t[42],_}function y2(e){return e.path}function b2(e){let t=(0,$.c)(12),{branch:n,project:r,hint:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i===void 0?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:i}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=r===null?null:(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:r,children:r}),t[7]=r,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function x2(e){let t=(0,$.c)(15),{name:n,path:r,current:i}=e,a=i&&`font-medium`,o;t[0]===a?o=t[1]:(o=Y(`flex w-full items-center gap-1.5`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,title:n,children:n}),t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=i?(0,Z.jsx)(Zo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):null,t[4]=i,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Z.jsxs)(`span`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=(0,Z.jsx)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:r,children:r}),t[10]=r,t[11]=u);let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 flex-col gap-0.5`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function S2(){let e=(0,$.c)(4),{_:t}=Dt(),n;e[0]===t?n=e[1]:(n=t({id:`Hp1l6f`}),e[0]=t,e[1]=n);let r;return e[2]===n?r=e[3]:(r=(0,Z.jsx)(Zo,{"aria-label":n,className:`size-3.5 shrink-0 text-muted-foreground`}),e[2]=n,e[3]=r),r}var C2=(e,t,n)=>_b(e,t,n,`ProjectSwitcher`),w2=350;function T2(e){let t=(0,$.c)(121),{bridge:n}=e,{_:r}=Dt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(null),y=$I(),b=mb(),x=typeof window<`u`&&window.okDesktop!=null,S=(0,Q.useRef)(!1),C=(0,Q.useRef)(!1),w=(0,Q.useRef)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e&&(C.current=!0,w.current!==null&&clearTimeout(w.current),w.current=setTimeout(()=>{C.current=!1},w2)),s(e),e||(l(``),v(null))},t[0]=T):T=t[0];let E=T,D;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>!x||!C.current?!1:(e.preventDefault(),!0),t[1]=D):D=t[1];let O=D,k;t[2]!==r||t[3]!==n.project||t[4]!==o?(k=()=>{if(!o)return;let e=!1;return C2(async()=>{let t=await n.project.listRecent();e||a(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=o,t[5]=k):k=t[5];let A;t[6]!==r||t[7]!==n||t[8]!==o?(A=[o,n,r],t[6]=r,t[7]=n,t[8]=o,t[9]=A):A=t[9],(0,Q.useEffect)(k,A);let j,M;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>en(e=>{e===`new-worktree`?(s(!1),v(null),g(``),p(!0)):e===`switch-worktree`&&s(!0)}),M=[],t[10]=j,t[11]=M):(j=t[10],M=t[11]),(0,Q.useEffect)(j,M);let N;t[12]!==r||t[13]!==n.dialog||t[14]!==n.project?(N=()=>{E(!1),C2(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[12]=r,t[13]=n.dialog,t[14]=n.project,t[15]=N):N=t[15];let P=N,F;t[16]!==r||t[17]!==n.project?(F=()=>{E(!1),C2(()=>n.project.openFile(),r({id:`8vCZcs`}))},t[16]=r,t[17]=n.project,t[18]=F):F=t[18];let I=F,L;t[19]!==r||t[20]!==n.navigator?(L=()=>{E(!1),C2(()=>n.navigator.open(),r({id:`jol95m`}))},t[19]=r,t[20]=n.navigator,t[21]=L):L=t[21];let R=L,z;t[22]!==r||t[23]!==n.project?(z=e=>C2(async()=>{await n.project.removeRecent(e),a(t=>t===null?t:t.filter(t=>t.path!==e))},r({id:`viwC-K`})),t[22]=r,t[23]=n.project,t[24]=z):z=t[24];let B=z,V;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{E(!1),d(!0)},t[25]=V):V=t[25];let H=V,U;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{E(!1),g(e),p(!0)},t[26]=U):U=t[26];let ee=U,W=n.config.projectPath,te;t[27]===c?te=t[28]:(te=c.trim().toLowerCase(),t[27]=c,t[28]=te);let G=te,ne=G!==``,K;t[29]===i?K=t[30]:(K=i??[],t[29]=i,t[30]=K);let q=K,re;t[31]!==ne||t[32]!==q?(re=ne?q.filter(N2):q,t[31]=ne,t[32]=q,t[33]=re):re=t[33];let ie=re,ae=ne?null:b,oe=y!==null&&`h-auto py-1.5`,se;t[34]===oe?se=t[35]:(se=Y(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,oe),t[34]=oe,t[35]=se);let ce;t[36]===r?ce=t[37]:(ce=r({id:`zZ_I5K`}),t[36]=r,t[37]=ce);let le;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(le=x?()=>{S.current=!0}:void 0,t[38]=le):le=t[38];let ue;t[39]===o?ue=t[40]:(ue=x?()=>{if(S.current){S.current=!1;return}E(!o)}:void 0,t[39]=o,t[40]=ue);let de;t[41]===n.config.projectName?de=t[42]:(de=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[41]=n.config.projectName,t[42]=de);let fe;t[43]===y?fe=t[44]:(fe=y===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(To,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:y})]}),t[43]=y,t[44]=fe);let pe;t[45]!==de||t[46]!==fe?(pe=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[de,fe]}),t[45]=de,t[46]=fe,t[47]=pe):pe=t[47];let me;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(a_,{"aria-hidden":`true`,className:`opacity-60`}),t[48]=me):me=t[48];let he;t[49]!==n.config.projectPath||t[50]!==se||t[51]!==ce||t[52]!==ue||t[53]!==pe?(he=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsxs)(UI,{className:se,"data-testid":`project-switcher-trigger`,"aria-label":ce,title:n.config.projectPath,onPointerDown:le,onClick:ue,children:[pe,me]})}),t[49]=n.config.projectPath,t[50]=se,t[51]=ce,t[52]=ue,t[53]=pe,t[54]=he):he=t[54];let ge;t[55]!==r||t[56]!==n||t[57]!==W||t[58]!==_||t[59]!==ie||t[60]!==ae||t[61]!==B||t[62]!==G||t[63]!==i||t[64]!==c?(ge=i===null?null:i.length===0?(0,Z.jsx)(Hr,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`MUrVEo`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Kc,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(zc,{"aria-label":r({id:`blFttG`}),placeholder:r({id:`RVZJWQ`}),value:c,onChange:e=>{e.target.value!==``&&v(null),l(e.target.value)},onKeyDown:M2,"data-testid":`project-switcher-search`}),(0,Z.jsx)(Gc,{children:(0,Z.jsx)(Ct,{"aria-hidden":`true`})})]}),(0,Z.jsx)(qr,{}),(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,"data-testid":`project-switcher-scroll`,onScroll:()=>{_!==null&&v(null)},children:(0,Z.jsx)(p2,{bridge:n,recents:ie,currentPath:W,query:G,worktreeModel:ae,closeMenu:()=>E(!1),guardStaleSelect:O,onRemoveRecent:B,flyoutPath:_,setFlyoutPath:v,openNewWorktreeWith:ee})})]}),t[55]=r,t[56]=n,t[57]=W,t[58]=_,t[59]=ie,t[60]=ae,t[61]=B,t[62]=G,t[63]=i,t[64]=c,t[65]=ge):ge=t[65];let _e;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(qr,{}),t[66]=_e):_e=t[66];let ve;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>{O(e)||H()},t[67]=ve):ve=t[67];let ye;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Z.jsxs)(Ir,{onSelect:ve,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(tn,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(J,{id:`gKi-a_`})]}),t[68]=ye):ye=t[68];let be;t[69]===R?be=t[70]:(be=e=>{O(e)||R()},t[69]=R,t[70]=be);let xe,Se;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(h,{"aria-hidden":`true`,className:`text-muted-foreground`}),Se=(0,Z.jsx)(J,{id:`xaDWAI`}),t[71]=xe,t[72]=Se):(xe=t[71],Se=t[72]);let Ce;t[73]===be?Ce=t[74]:(Ce=(0,Z.jsxs)(Ir,{onSelect:be,"data-testid":`project-switcher-switch-project`,children:[xe,Se]}),t[73]=be,t[74]=Ce);let we;t[75]===P?we=t[76]:(we=e=>{O(e)||P()},t[75]=P,t[76]=we);let Te,Ee;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(Dc,{"aria-hidden":`true`,className:`text-muted-foreground`}),Ee=(0,Z.jsx)(J,{id:`PVUn_c`}),t[77]=Te,t[78]=Ee):(Te=t[77],Ee=t[78]);let De;t[79]===we?De=t[80]:(De=(0,Z.jsxs)(Ir,{onSelect:we,"data-testid":`project-switcher-open-folder`,children:[Te,Ee]}),t[79]=we,t[80]=De);let Oe;t[81]===I?Oe=t[82]:(Oe=e=>{O(e)||I()},t[81]=I,t[82]=Oe);let ke,Ae;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Z.jsx)(qn,{"aria-hidden":`true`,className:`text-muted-foreground`}),Ae=(0,Z.jsx)(J,{id:`9npOH9`}),t[83]=ke,t[84]=Ae):(ke=t[83],Ae=t[84]);let je;t[85]===Oe?je=t[86]:(je=(0,Z.jsxs)(Ir,{onSelect:Oe,"data-testid":`project-switcher-open-file`,children:[ke,Ae]}),t[85]=Oe,t[86]=je);let Me;t[87]===y?Me=t[88]:(Me=y===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qr,{}),(0,Z.jsxs)(Ir,{onSelect:e=>{O(e)||(E(!1),g(``),p(!0))},"data-testid":`project-switcher-new-worktree`,children:[(0,Z.jsx)(To,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(J,{id:`DXd9LM`})]})]}),t[87]=y,t[88]=Me);let Ne;t[89]!==ge||t[90]!==Ce||t[91]!==De||t[92]!==je||t[93]!==Me?(Ne=(0,Z.jsxs)(Wr,{align:`start`,side:`top`,className:`min-w-[260px]`,"data-testid":`project-switcher-menu`,children:[ge,_e,ye,Ce,De,je,Me]}),t[89]=ge,t[90]=Ce,t[91]=De,t[92]=je,t[93]=Me,t[94]=Ne):Ne=t[94];let Pe;t[95]!==o||t[96]!==he||t[97]!==Ne?(Pe=(0,Z.jsxs)(Kr,{open:o,onOpenChange:E,modal:!1,children:[he,Ne]}),t[95]=o,t[96]=he,t[97]=Ne,t[98]=Pe):Pe=t[98];let Fe;t[99]!==n||t[100]!==u?(Fe=(0,Z.jsx)(Sv,{open:u,onOpenChange:d,bridge:n}),t[99]=n,t[100]=u,t[101]=Fe):Fe=t[101];let Ie;t[102]===b?.entries?Ie=t[103]:(Ie=b?.entries.map(j2).filter(A2),t[102]=b?.entries,t[103]=Ie);let Le;t[104]===b?.entries?Le=t[105]:(Le=new Set(b?.entries.filter(k2).map(O2)),t[104]=b?.entries,t[105]=Le);let Re=b?.remoteBranches,ze;t[106]===b?.entries?ze=t[107]:(ze=new Map(b?.entries.filter(D2).map(E2)),t[106]=b?.entries,t[107]=ze);let Be;t[108]!==y||t[109]!==n||t[110]!==m||t[111]!==f||t[112]!==Ie||t[113]!==Le||t[114]!==Re||t[115]!==ze?(Be=(0,Z.jsx)(s2,{open:f,onOpenChange:p,bridge:n,currentBranch:y,initialBranchName:m,branches:Ie,existingWorktreeBranches:Le,remoteBranches:Re,behindByBranch:ze}),t[108]=y,t[109]=n,t[110]=m,t[111]=f,t[112]=Ie,t[113]=Le,t[114]=Re,t[115]=ze,t[116]=Be):Be=t[116];let Ve;return t[117]!==Pe||t[118]!==Fe||t[119]!==Be?(Ve=(0,Z.jsxs)(Z.Fragment,{children:[Pe,Fe,Be]}),t[117]=Pe,t[118]=Fe,t[119]=Be,t[120]=Ve):Ve=t[120],Ve}function E2(e){return[e.branch,e.behind]}function D2(e){return e.branch!==null&&e.behind!==void 0}function O2(e){return e.branch}function k2(e){return e.branch!==null&&e.worktreePath!==null}function A2(e){return e!==null}function j2(e){return e.branch}function M2(e){return e.stopPropagation()}function N2(e){return!e.isLinkedWorktree}function P2(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),So(`sidebarSearchPill`)}function F2(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Y(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Ct,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(J,{id:`A1taO8`})}),t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(le,{className:`text-foreground/70`,children:Hu(`command-palette`)}),t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsxs)(X,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,s]}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c}function I2(){let e=(0,$.c)(36),{_:t}=Dt(),n=gs(),{activeDocName:r}=ot(),[i,a]=(0,Q.useState)(!1),o=Ss(),s;e[0]!==n.data||e[1]!==n.status?(s=n.status===`ready`?n.data:[],e[0]=n.data,e[1]=n.status,e[2]=s):s=e[2];let c=s,l;e[3]===c?l=e[4]:(l=dc(c),e[3]=c,e[4]=l);let u=l,d=pc(),f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f={},e[5]=f):f=e[5];let[p,m]=(0,Q.useState)(f),h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(LI,{asChild:!0,children:(0,Z.jsxs)(Sn,{className:`flex w-full items-center gap-1.5`,children:[(0,Z.jsx)(T_,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`PCSkw2`}),(0,Z.jsx)(es,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skills:rotate-90`})]})}),e[6]=h):h=e[6];let g;e[7]===t?g=e[8]:(g=t({id:`MdpSC1`}),e[7]=t,e[8]=g);let _,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>a(!0),v=(0,Z.jsx)(tn,{}),e[9]=_,e[10]=v):(_=e[9],v=e[10]);let y;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`MdpSC1`})}),e[11]=y):y=e[11];let b;e[12]===g?b=e[13]:(b=(0,Z.jsxs)(RI,{title:g,onClick:_,children:[v,y]}),e[12]=g,e[13]=b);let x;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(K2,{}),e[14]=x):x=e[14];let S;e[15]===c?S=e[16]:(S=c.some(R2),e[15]=c,e[16]=S);let C;e[17]===S?C=e[18]:(C=(0,Z.jsx)(W2,{hasProjectSkills:S}),e[17]=S,e[18]=C);let w;e[19]!==o||e[20]!==r||e[21]!==u||e[22]!==p||e[23]!==d||e[24]!==c?(w=c.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`PdJZ5p`})}):cc.filter(e=>c.some(t=>t.scope===e)).map(e=>(0,Z.jsxs)(Cn,{className:`group/scope`,open:c.some(t=>t.scope===e&&Ka(t.scope,t.name)===r)||(p[e]??!1),onOpenChange:t=>m(n=>({...n,[e]:t})),children:[(0,Z.jsxs)(Sn,{className:`flex w-full items-center gap-1 px-2 pt-1 pb-0.5 text-[11px] text-muted-foreground/70 hover:text-muted-foreground`,children:[(0,Z.jsx)(es,{className:`size-3 shrink-0 transition-transform group-data-[state=open]/scope:rotate-90`}),(0,Z.jsx)(`span`,{className:`truncate`,children:d[e]})]}),(0,Z.jsx)(xn,{children:(0,Z.jsx)(BI,{className:`pl-2`,children:c.filter(t=>t.scope===e).map(e=>(0,Z.jsx)(z2,{skill:e,activeDocName:r,actions:o,existingNames:u[e.scope]},`${e.scope}::${e.name}`))})})]},e)),e[19]=o,e[20]=r,e[21]=u,e[22]=p,e[23]=d,e[24]=c,e[25]=w):w=e[25];let T;e[26]!==C||e[27]!==w?(T=(0,Z.jsx)(xn,{children:(0,Z.jsxs)(zI,{children:[x,C,w]})}),e[26]=C,e[27]=w,e[28]=T):T=e[28];let E;e[29]===i?E=e[30]:(E=(0,Z.jsx)(Zs,{defaultScope:`project`,open:i,onOpenChange:a,onCreated:L2}),e[29]=i,e[30]=E);let D;return e[31]!==o.dialogs||e[32]!==T||e[33]!==E||e[34]!==b?(D=(0,Z.jsx)(Cn,{className:`group/skills shrink-0`,children:(0,Z.jsxs)(II,{className:`px-0`,children:[h,b,T,o.dialogs,E]})}),e[31]=o.dialogs,e[32]=T,e[33]=E,e[34]=b,e[35]=D):D=e[35],D}function L2(e){let{scope:t,name:n}=e;return Ac(Ka(t,n))}function R2(e){return e.scope===`project`&&!e.managed}function z2(e){let t=(0,$.c)(52),{skill:n,activeDocName:r,actions:i,existingNames:a}=e,{_:o}=Dt(),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),d;t[0]!==n.name||t[1]!==n.scope?(d=Ka(n.scope,n.name),t[0]=n.name,t[1]=n.scope,t[2]=d):d=t[2];let f=r===d,p,m,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e.preventDefault(),u(!0)},m=(0,Z.jsx)(es,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skill:rotate-90`}),h=(0,Z.jsx)(T_,{className:`size-3 shrink-0 text-muted-foreground`}),t[3]=p,t[4]=m,t[5]=h):(p=t[3],m=t[4],h=t[5]);let g=n.name,_;t[6]===n.name?_=t[7]:(_=oc(n.name),t[6]=n.name,t[7]=_);let v;t[8]!==n.name||t[9]!==_?(v=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:g,children:_}),t[8]=n.name,t[9]=_,t[10]=v):v=t[10];let y;t[11]!==o||t[12]!==n.bundledVersion||t[13]!==n.updateAvailable?(y=n.updateAvailable?(0,Z.jsx)(`span`,{title:o({id:`1YJ4Yg`,values:{0:n.bundledVersion?` (${n.bundledVersion})`:``}}),className:`flex items-center`,children:(0,Z.jsx)(_u,{className:`size-3 text-primary`,"aria-label":o({id:`CifUuG`})})}):null,t[11]=o,t[12]=n.bundledVersion,t[13]=n.updateAvailable,t[14]=y):y=t[14];let b;t[15]!==o||t[16]!==n.installed||t[17]!==n.managed?(b=n.managed?(0,Z.jsx)(`span`,{title:o({id:`U7HJ4y`}),className:`flex items-center`,children:(0,Z.jsx)(cs,{className:`size-3 text-muted-foreground`,"aria-label":o({id:`U7HJ4y`})})}):(0,Z.jsx)(Ys,{installed:n.installed,subtle:!0,className:`shrink-0`}),t[15]=o,t[16]=n.installed,t[17]=n.managed,t[18]=b):b=t[18];let x;t[19]!==y||t[20]!==b?(x=(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]!==f||t[23]!==x||t[24]!==v?(S=(0,Z.jsx)(Sn,{asChild:!0,children:(0,Z.jsxs)(UI,{size:`sm`,isActive:f,className:`h-6 text-[11px]`,onContextMenu:p,children:[m,h,v,x]})}),t[22]=f,t[23]=x,t[24]=v,t[25]=S):S=t[25];let C;t[26]!==o||t[27]!==n.name?(C=o({id:`RlLl3G`,values:{0:n.name}}),t[26]=o,t[27]=n.name,t[28]=C):C=t[28];let w;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(f_,{}),t[29]=w):w=t[29];let T;t[30]===C?T=t[31]:(T=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(WI,{showOnHover:!0,"aria-label":C,children:w})}),t[30]=C,t[31]=T);let E;t[32]!==i||t[33]!==a||t[34]!==n?(E=(0,Z.jsx)(Wr,{side:`right`,align:`start`,className:`min-w-52`,children:(0,Z.jsx)(ys,{skill:n,actions:i,existingNames:a})}),t[32]=i,t[33]=a,t[34]=n,t[35]=E):E=t[35];let D;t[36]!==l||t[37]!==T||t[38]!==E?(D=(0,Z.jsxs)(Kr,{open:l,onOpenChange:u,children:[T,E]}),t[36]=l,t[37]=T,t[38]=E,t[39]=D):D=t[39];let O;t[40]!==s||t[41]!==n?(O=s?(0,Z.jsx)(H2,{skill:n}):null,t[40]=s,t[41]=n,t[42]=O):O=t[42];let k;t[43]===O?k=t[44]:(k=(0,Z.jsx)(xn,{children:O}),t[43]=O,t[44]=k);let A;t[45]!==S||t[46]!==D||t[47]!==k?(A=(0,Z.jsxs)(VI,{children:[S,D,k]}),t[45]=S,t[46]=D,t[47]=k,t[48]=A):A=t[48];let j;return t[49]!==s||t[50]!==A?(j=(0,Z.jsx)(Cn,{open:s,onOpenChange:c,className:`group/skill`,children:A}),t[49]=s,t[50]=A,t[51]=j):j=t[51],j}function B2(e){let t=[];for(let n of e){let e=n.path.split(`/`),r=t;e.forEach((t,i)=>{let a=i===e.length-1,o=r.find(e=>e.name===t);o||(o=a?{name:t,path:n.path,text:n.text}:{name:t,path:e.slice(0,i+1).join(`/`),children:[]},r.push(o)),!a&&o.children&&(r=o.children)})}return V2(t),t}function V2(e){e.sort((e,t)=>{let n=+!e.children,r=+!t.children;return n===r?e.name.localeCompare(t.name):n-r});for(let t of e)t.children&&V2(t.children)}function H2(e){let t=(0,$.c)(36),{skill:n}=e,{_:r}=Dt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),{openTarget:c}=ot(),l;t[0]===c?l=t[1]:(l=function(e){c({kind:`doc`,target:e,docName:e},{tabBehavior:`append`}),Rd(Bd(e))},t[0]=c,t[1]=l);let u=l,d;t[2]!==c||t[3]!==n.name||t[4]!==n.scope?(d=function(e){c({kind:`skill-file`,target:`${n.scope}/${n.name}/${e}`,scope:n.scope,name:n.name,path:e},{tabBehavior:`replace-active`}),Rd(Fd({scope:n.scope,name:n.name,path:e}))},t[2]=c,t[3]=n.name,t[4]=n.scope,t[5]=d):d=t[5];let f=d,p;t[6]!==u||t[7]!==f||t[8]!==n.managed||t[9]!==n.name||t[10]!==n.scope?(p=function(e){if(n.managed){f(e);return}let t=e.lastIndexOf(`.`),r=t>=0?e.slice(t+1).toLowerCase():``;if(n.scope===`project`&&(r===`md`||r===`mdx`)){u(ct(n.name,e.replace(/\.mdx?$/i,``)));return}f(e)},t[6]=u,t[7]=f,t[8]=n.managed,t[9]=n.name,t[10]=n.scope,t[11]=p):p=t[11];let m=p,h,g;t[12]!==n.name||t[13]!==n.scope?(h=()=>{let e=!0,t=()=>{om(n.scope,n.name).then(t=>{e&&(t.ok?(a(t.files),s(!1)):(a([]),s(!0)))})};t();let r=yd(t);return()=>{e=!1,r()}},g=[n.scope,n.name],t[12]=n.name,t[13]=n.scope,t[14]=h,t[15]=g):(h=t[14],g=t[15]),(0,Q.useEffect)(h,g);let _;if(t[16]!==r||t[17]!==i||t[18]!==o||t[19]!==m||t[20]!==u||t[21]!==f||t[22]!==n.managed||t[23]!==n.name||t[24]!==n.scope){let e=i?B2(i):[],a;t[26]!==u||t[27]!==f||t[28]!==n.managed||t[29]!==n.name||t[30]!==n.scope?(a=()=>n.managed?f(`SKILL.md`):n.scope===`project`?u(lo(n.name)):Ac(Ka(n.scope,n.name)),t[26]=u,t[27]=f,t[28]=n.managed,t[29]=n.name,t[30]=n.scope,t[31]=a):a=t[31];let s,c;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(qn,{className:`size-3 shrink-0 text-muted-foreground`}),c=(0,Z.jsx)(`span`,{className:`truncate`,children:`SKILL.md`}),t[32]=s,t[33]=c):(s=t[32],c=t[33]);let l;t[34]===a?l=t[35]:(l=(0,Z.jsx)(KI,{children:(0,Z.jsxs)(qI,{size:`sm`,onClick:a,className:`text-[11px]`,children:[s,c]})}),t[34]=a,t[35]=l),_=(0,Z.jsxs)(GI,{className:`mr-0 pr-0`,children:[l,i===null?(0,Z.jsx)(KI,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,children:(0,Z.jsx)(J,{id:`yQE2r9`})})}):o?(0,Z.jsx)(KI,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,title:r({id:`3Ijjy1`}),children:(0,Z.jsx)(J,{id:`ZARuZJ`})})}):e.map(e=>(0,Z.jsx)(U2,{node:e,depth:0,onOpenFile:m},e.path))]}),t[16]=r,t[17]=i,t[18]=o,t[19]=m,t[20]=u,t[21]=f,t[22]=n.managed,t[23]=n.name,t[24]=n.scope,t[25]=_}else _=t[25];return _}function U2(e){let t=(0,$.c)(34),{node:n,depth:r,onOpenFile:i}=e,[a,o]=(0,Q.useState)(!1),s=`${r*.6}rem`,c;t[0]===s?c=t[1]:(c={paddingLeft:s},t[0]=s,t[1]=c);let l=c;if(n.children){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(es,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/dir:rotate-90`}),t[2]=e):e=t[2];let s;t[3]===n.name?s=t[4]:(s=(0,Z.jsxs)(`span`,{className:`truncate`,children:[n.name,`/`]}),t[3]=n.name,t[4]=s);let c;t[5]!==l||t[6]!==s?(c=(0,Z.jsx)(Sn,{asChild:!0,children:(0,Z.jsxs)(qI,{size:`sm`,className:`text-[11px]`,style:l,children:[e,s]})}),t[5]=l,t[6]=s,t[7]=c):c=t[7];let u;if(t[8]!==r||t[9]!==n.children||t[10]!==i){let e;t[12]!==r||t[13]!==i?(e=e=>(0,Z.jsx)(U2,{node:e,depth:r+1,onOpenFile:i},e.path),t[12]=r,t[13]=i,t[14]=e):e=t[14],u=n.children.map(e),t[8]=r,t[9]=n.children,t[10]=i,t[11]=u}else u=t[11];let d;t[15]===u?d=t[16]:(d=(0,Z.jsx)(xn,{children:u}),t[15]=u,t[16]=d);let f;t[17]!==c||t[18]!==d?(f=(0,Z.jsxs)(KI,{children:[c,d]}),t[17]=c,t[18]=d,t[19]=f):f=t[19];let p;return t[20]!==a||t[21]!==f?(p=(0,Z.jsx)(Cn,{open:a,onOpenChange:o,className:`group/dir`,children:f}),t[20]=a,t[21]=f,t[22]=p):p=t[22],p}let u=`skill-file-${n.path}`,d;t[23]!==n.path||t[24]!==i?(d=()=>i(n.path),t[23]=n.path,t[24]=i,t[25]=d):d=t[25];let f;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(h_,{className:`size-3 shrink-0 text-muted-foreground`}),t[26]=f):f=t[26];let p;t[27]===n.name?p=t[28]:(p=(0,Z.jsx)(`span`,{className:`truncate`,children:n.name}),t[27]=n.name,t[28]=p);let m;return t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==p?(m=(0,Z.jsx)(KI,{children:(0,Z.jsxs)(qI,{size:`sm`,className:`text-[11px]`,style:l,"data-testid":u,onClick:d,children:[f,p]})}),t[29]=l,t[30]=u,t[31]=d,t[32]=p,t[33]=m):m=t[33],m}function W2(e){let t=(0,$.c)(12),{hasProjectSkills:n}=e,{_:r}=Dt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),c,l;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=window.okDesktop?.sharing;if(!e)return;let t=!1,n=()=>{e.status().then(e=>{t||a(e.mode===`local-only`&&!e.skillsShared)}).catch(G2)};return n(),window.addEventListener(`focus`,n),()=>{t=!0,window.removeEventListener(`focus`,n)}},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,Q.useEffect)(c,l),!n||i!==!0)return null;let u;t[2]!==r||t[3]!==o?(u=async()=>{let e=window.okDesktop?.sharing;if(!e||o)return;s(!0);let t=null,n=null;try{t=await e.setSkillsShared(!0)}catch(e){n=e}if(s(!1),n!==null){let e=n instanceof Error?n.message:``;Mu.error(e.startsWith(`ok:sharing:dispatch:`)?r({id:`qXN416`}):e||r({id:`K2v7QF`}));return}if(t!==null){if(t.kind===`applied`)Mu.success(r({id:`Q7cNKe`})),a(!1);else if(t.kind===`no-exclude`){let e=t.reason===`no-git`?r({id:`Xwump4`}):t.reason===`inaccessible`?r({id:`PlGC6r`}):r({id:`zcmYx4`});Mu.warning(r({id:`EARn6h`,values:{detail:e}}))}}},t[2]=r,t[3]=o,t[4]=u):u=t[4];let d=u,f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`p`,{className:`mb-2 text-amber-900 dark:text-amber-200`,children:(0,Z.jsx)(J,{id:`Bh9671`})}),t[5]=f):f=t[5];let p;t[6]===d?p=t[7]:(p=()=>void d(),t[6]=d,t[7]=p);let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(J,{id:`TUzThQ`}),t[8]=m):m=t[8];let h;return t[9]!==o||t[10]!==p?(h=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-amber-300 bg-amber-50 p-2 text-xs dark:border-amber-700 dark:bg-amber-950`,children:[f,(0,Z.jsx)(X,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:o,onClick:p,children:m})]}),t[9]=o,t[10]=p,t[11]=h):h=t[11],h}function G2(e){console.warn(JSON.stringify({event:`skills-share-status-read-failed`,error:e instanceof Error?e.message:String(e)}))}function K2(){let e=(0,$.c)(19),[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1),a,o;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=!1;return im().then(t=>{e||n(t)}),()=>{e=!0}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Q.useEffect)(a,o),!t||t.managed!==null||t.importable===0)return null;let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=async e=>{if(i(!0),!await sm(e)){i(!1);return}n({managed:e,importable:0})},e[2]=s):s=e[2];let c=s,l;e[3]===t.importable?l=e[4]:(l=(0,Z.jsx)(`p`,{className:`mb-2 text-muted-foreground`,children:(0,Z.jsx)(J,{id:`mu1O0q`,values:{0:t.importable}})}),e[3]=t.importable,e[4]=l);let u,d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>c(!0),d=(0,Z.jsx)(J,{id:`l3s5ri`}),e[5]=u,e[6]=d):(u=e[5],d=e[6]);let f;e[7]===r?f=e[8]:(f=(0,Z.jsx)(X,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:r,onClick:u,children:d}),e[7]=r,e[8]=f);let p,m;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>c(!1),m=(0,Z.jsx)(J,{id:`PBxg_E`}),e[9]=p,e[10]=m):(p=e[9],m=e[10]);let h;e[11]===r?h=e[12]:(h=(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs`,disabled:r,onClick:p,children:m}),e[11]=r,e[12]=h);let g;e[13]!==f||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[f,h]}),e[13]=f,e[14]=h,e[15]=g):g=e[15];let _;return e[16]!==g||e[17]!==l?(_=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-border/60 bg-muted/40 p-2 text-xs`,children:[l,g]}),e[16]=g,e[17]=l,e[18]=_):_=e[18],_}var q2=6e4,J2=e=>{let t=(0,$.c)(11),{href:n,label:r,icon:i}=e,a,o;t[0]===n?(a=t[1],o=t[2]):(a=e=>Ef(e,n),o=e=>Ef(e,n),t[0]=n,t[1]=a,t[2]=o);let s;t[3]===i?s=t[4]:(s=(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=i,t[4]=s);let c;return t[5]!==n||t[6]!==r||t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:a,onAuxClick:o,"aria-label":r,className:`rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:s}),t[5]=n,t[6]=r,t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c};function Y2(e){let t=(0,$.c)(34),{version:n,onOpenReleaseNotes:r,onClose:i,store:a,autoDismissMs:o}=e,s=a===void 0?Xz:a,c=o===void 0?q2:o,{_:l}=Dt(),[u,d]=(0,Q.useState)(!1),f,p;t[0]!==c||t[1]!==i||t[2]!==u?(f=()=>{if(!u)return;let e=setTimeout(i,c);return()=>clearTimeout(e)},p=[u,i,c],t[0]=c,t[1]=i,t[2]=u,t[3]=f,t[4]=p):(f=t[3],p=t[4]),(0,Q.useEffect)(f,p);let m;t[5]===l?m=t[6]:(m=l({id:`GzPQ2f`}),t[5]=l,t[6]=m);let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(J,{id:`yLEyuq`}),t[7]=h):h=t[7];let g;t[8]===s?g=t[9]:(g=()=>{s.markSubscribed(),d(!0)},t[8]=s,t[9]=g);let _;t[10]!==i||t[11]!==s?(_=()=>{s.dismiss(),i()},t[10]=i,t[11]=s,t[12]=_):_=t[12];let v;t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(Tz,{source:`post_update_card`,compactSubmit:!0,description:h,onSuccess:g,onDismiss:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==l||t[17]!==u?(y=u?null:(0,Z.jsxs)(`nav`,{"aria-label":l({id:`dbapvC`}),className:`mt-3 flex items-center gap-1.5 text-muted-foreground text-xs`,children:[(0,Z.jsx)(`span`,{className:`mr-0.5`,children:(0,Z.jsx)(J,{id:`9sBe85`})}),(0,Z.jsx)(J2,{href:Bz,label:l({id:`I7Exsw`}),icon:$z}),(0,Z.jsx)(J2,{href:Rz,label:l({id:`zyKa-I`}),icon:jv}),(0,Z.jsx)(J2,{href:zz,label:l({id:`36aWJD`}),icon:Qz})]}),t[16]=l,t[17]=u,t[18]=y):y=t[18];let b;t[19]!==y||t[20]!==v?(b=(0,Z.jsxs)(`div`,{className:`px-3 py-2.5`,children:[v,y]}),t[19]=y,t[20]=v,t[21]=b):b=t[21];let x;t[22]===n?x=t[23]:(x=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hLy8b1`,values:{version:n}})}),t[22]=n,t[23]=x);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(J,{id:`_PACVa`}),t[24]=S):S=t[24];let C;t[25]===r?C=t[26]:(C=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`h-auto p-0 text-muted-foreground text-xs hover:text-foreground`,onClick:r,children:S}),t[25]=r,t[26]=C);let w;t[27]!==x||t[28]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-t bg-muted/30 px-3 py-2.5 space-x-2`,children:[x,C]}),t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==b||t[31]!==w||t[32]!==m?(T=(0,Z.jsxs)(`section`,{"aria-label":m,className:`mx-1 mb-1 overflow-hidden rounded-lg border bg-card text-card-foreground`,children:[b,w]}),t[30]=b,t[31]=w,t[32]=m,t[33]=T):T=t[33],T}function X2(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:i}=Dt(),a=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,o;t[0]!==i||t[1]!==n.dismissible||t[2]!==r?(o=n.dismissible===!1?null:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":i({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(ju,{"aria-hidden":`true`,className:`size-3`})}),t[0]=i,t[1]=n.dismissible,t[2]=r,t[3]=o):o=t[3];let s=o,c=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${a}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let o;t[6]!==s||t[7]!==i?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,s]}),t[6]=s,t[7]=i,t[8]=o):o=t[8];let l;t[9]!==c||t[10]!==n.action?(l=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=c,t[10]=n.action,t[11]=l):l=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==c||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:u,children:n.secondaryAction.label}),t[14]=c,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==l||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[l,d]}),t[18]=l,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==o||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,f]}),t[21]=e,t[22]=r,t[23]=o,t[24]=f,t[25]=p):p=t[25],p}let l=`update-notice-${n.id}`,u=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${a}`,d;t[26]===n.body?d=t[27]:(d=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=d);let f;t[28]!==c||t[29]!==n.action?(f=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=c,t[29]=n.action,t[30]=f):f=t[30];let p;return t[31]!==s||t[32]!==l||t[33]!==u||t[34]!==d||t[35]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":l,className:u,children:[d,f,s]}),t[31]=s,t[32]=l,t[33]=u,t[34]=d,t[35]=f,t[36]=p):p=t[36],p}function Z2(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function Q2(){let e=(0,$.c)(15),t=(0,Q.useSyncExternalStore)(OV,DV,DV),n;e[0]===t?n=e[1]:(n=Z2(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;if(r.combinedSubscribe&&r.whatsNew){let t;e[2]===r.action?t=e[3]:(t=()=>r.action?.onClick(),e[2]=r.action,e[3]=t);let n;e[4]===r.id?n=e[5]:(n=()=>EV(r.id),e[4]=r.id,e[5]=n);let i;return e[6]!==r.whatsNew.version||e[7]!==t||e[8]!==n?(i=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(Y2,{version:r.whatsNew.version,onOpenReleaseNotes:t,onClose:n})}),e[6]=r.whatsNew.version,e[7]=t,e[8]=n,e[9]=i):i=e[9],i}let i;e[10]===r?i=e[11]:(i=()=>{r.onDismiss?.(),EV(r.id)},e[10]=r,e[11]=i);let a;return e[12]!==r||e[13]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(X2,{notice:r,onDismiss:i})}),e[12]=r,e[13]=i,e[14]=a):a=e[14],a}function $2(e,t){return e?.kind===`doc`||e?.kind===`folder-index`?uc(t.contentDir,mc(e.docName),t.pathSeparator):e?.kind===`folder`?uc(t.contentDir,e.folderPath,t.pathSeparator):e?.kind===`asset`?uc(t.contentDir,e.assetPath,t.pathSeparator):t.contentDir}function e4(e){return e?.kind===`doc`||e?.kind===`folder-index`?mc(e.docName):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function t4(e,t){return e===null?vs({workspace:t}):e.kind===`folder`?t?ms({folderRelativePath:e.folderPath,workspace:t}):null:e.kind===`doc`||e.kind===`folder-index`?xs({docName:e.docName,workspace:t}):null}var n4={folderCount:0,expandedCount:0},r4=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function i4(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(r4)!==null}function a4(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Dd,{name:`file-sidebar`,children:(0,Z.jsx)(u4,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var o4=`[&_svg:not([class*='size-'])]:size-3.5`,s4=e=>{let t=(0,$.c)(7),{label:n,shortcutId:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsx)(le,{"aria-label":Uu(r),children:Hu(r)})]}):null,t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(vn,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o},c4=e=>{let t=(0,$.c)(21),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,icon:n,label:i,shortcutId:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=Y(o4,r),t[6]=r,t[7]=s);let c;t[8]===n?c=t[9]:(c=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[8]=n,t[9]=c);let l;t[10]!==i||t[11]!==a||t[12]!==s||t[13]!==c?(l=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":i,className:s,...a,children:c})}),t[10]=i,t[11]=a,t[12]=s,t[13]=c,t[14]=l):l=t[14];let u;t[15]!==i||t[16]!==o?(u=(0,Z.jsx)(s4,{label:i,shortcutId:o}),t[15]=i,t[16]=o,t[17]=u):u=t[17];let d;return t[18]!==l||t[19]!==u?(d=(0,Z.jsxs)(bn,{children:[l,u]}),t[18]=l,t[19]=u,t[20]=d):d=t[20],d},l4=e=>{let t=(0,$.c)(21),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,icon:n,label:i,shortcutId:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=Y(o4,r),t[6]=r,t[7]=s);let c;t[8]===n?c=t[9]:(c=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[8]=n,t[9]=c);let l;t[10]!==i||t[11]!==a||t[12]!==s||t[13]!==c?(l=(0,Z.jsx)(_n,{asChild:!0,children:(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":i,className:s,...a,children:c})})}),t[10]=i,t[11]=a,t[12]=s,t[13]=c,t[14]=l):l=t[14];let u;t[15]!==i||t[16]!==o?(u=(0,Z.jsx)(s4,{label:i,shortcutId:o}),t[15]=i,t[16]=o,t[17]=u):u=t[17];let d;return t[18]!==l||t[19]!==u?(d=(0,Z.jsxs)(bn,{children:[l,u]}),t[18]=l,t[19]=u,t[20]=d):d=t[20],d};function u4(e){let t=(0,$.c)(317),{onOpenSearch:n}=e,{_:r}=Dt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=ot(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:ad(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,f;t[3]===d?f=t[4]:(f=cd(d)?``:d,t[3]=d,t[4]=f);let p=f,[m,h]=(0,Q.useState)(!1),g=m?``:p,_=typeof window<`u`&&window.okDesktop!=null,{state:v,toggleSidebar:y}=TI(),b=fc(),x=v===`expanded`,S=_&&v===`collapsed`,[C,w]=(0,Q.useState)(n4),T,E;t[5]===i?(T=t[6],E=t[7]):(T=()=>{if(i===null)return;let e=()=>{w(i.getFolderState()),h(i.isCreationTargetCleared())};return e(),i.subscribe(e)},E=[i],t[5]=i,t[6]=T,t[7]=E),(0,Q.useEffect)(T,E);let D,O;t[8]===i?(D=t[9],O=t[10]):(D=()=>{if(i!==null)return hE(e=>{let t=e.initialDir??``;if(e.template){i.createFromTemplate(e.template.folder,e.template.name);return}i.startCreating(`file`,t)})},O=[i],t[8]=i,t[9]=D,t[10]=O),(0,Q.useEffect)(D,O);let k=C.folderCount>0,A=k&&C.expandedCount===C.folderCount,j=C.expandedCount===0,M=Ws(``),N=Ws(g===``?null:g),P=g===``?M:N,F=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,I=P.state.status===`ready`?(P.state.data.folder.templates_available?.length??0)>0:!0,L=typeof window<`u`?window.okDesktop:void 0,R=jf(),{status:z}=Oo(),B=z?.hasRemote===!0,V;t[11]!==r||t[12]!==R?.contentDir?(V=L?.config?.projectName||R?.contentDir.split(`/`).filter(Boolean).pop()||r({id:`sER-bs`}),t[11]=r,t[12]=R?.contentDir,t[13]=V):V=t[13];let H=V,U=_s().states,{dispatch:ee}=ds(),W;t[14]===R?W=t[15]:(W=vs({workspace:R}),t[14]=R,t[15]=W);let te=W,{projectLocalBinding:G,merged:ne}=wf(),K=ne?.appearance?.sidebar?.showHiddenFiles??!1,q=ne?.appearance?.sidebar?.showOkFolders??!1,re=ne?.appearance?.sidebar?.showOnlyMarkdownFiles??!1,ie=ne?.appearance?.sidebar?.showSkillsSection??!0,ae=k&&!A,oe=k&&!j,se=ae||oe,ce=(0,Q.useRef)(!1),le;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(le=e=>{ce.current&&(ce.current=!1,e.preventDefault())},t[16]=le):le=t[16];let ue=le,de=h4,fe;t[17]!==i||t[18]!==R?(fe=()=>{R&&(ce.current=!0,i?.startCreating(`file`,``))},t[17]=i,t[18]=R,t[19]=fe):fe=t[19];let pe=fe,me;t[20]!==i||t[21]!==R?(me=e=>{R&&(ce.current=!0,i?.createFromTemplate(``,e))},t[20]=i,t[21]=R,t[22]=me):me=t[22];let he=me,ge;t[23]!==i||t[24]!==R?(ge=()=>{R&&(ce.current=!0,i?.startCreating(`folder`,``))},t[23]=i,t[24]=R,t[25]=ge):ge=t[25];let _e=ge,ve;t[26]===R?ve=t[27]:(ve=()=>{!R||!L||L.shell.showItemInFolder(R.contentDir)},t[26]=R,t[27]=ve);let ye=ve,be;t[28]!==r||t[29]!==R?(be=async()=>{if(R)try{await navigator.clipboard.writeText(R.contentDir),Mu.success(r({id:`6_ZOw4`}),{description:R.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),Mu.error(r({id:`vfRlCI`}))}},t[28]=r,t[29]=R,t[30]=be):be=t[30];let xe=be,Se;t[31]!==r||t[32]!==B?(Se=()=>{As({...Us(``),hasRemote:B,onClickWhenNoRemote:()=>{Mu.error(r({id:`WyQxwa`}))}},{clipboardWrite:qp,toastSuccess:m4,toastError:p4,logEvent:f4})},t[31]=r,t[32]=B,t[33]=Se):Se=t[33];let Ce=Se,we;t[34]!==r||t[35]!==G?(we=e=>{if(G===null)return;let t=G.patch({appearance:{sidebar:e}});t.ok||(console.warn(`[FileSidebar] sidebar visibility toggle rejected:`,fa(t.error)),Mu.error(r({id:`P47EWZ`}),{description:fa(t.error)}))},t[34]=r,t[35]=G,t[36]=we):we=t[36];let Te=we,Ee;t[37]===i?Ee=t[38]:(Ee=()=>{i?.expandAll()},t[37]=i,t[38]=Ee);let De=Ee,Oe;t[39]===i?Oe=t[40]:(Oe=()=>{i?.collapseAll()},t[39]=i,t[40]=Oe);let ke=Oe,Ae,je;t[41]!==oe||t[42]!==ae||t[43]!==K||t[44]!==q||t[45]!==re||t[46]!==ie||t[47]!==v?(Ae=()=>{let e={showHiddenFiles:K,showOkFolders:q,showOnlyMarkdownFiles:re,showSkillsSection:ie,canExpandAll:ae,canCollapseAll:oe,sidebarVisible:v===`expanded`};Jc(e),L&&L.editor.notifyViewMenuStateChanged(e)},je=[L,K,q,re,ie,ae,oe,v],t[41]=oe,t[42]=ae,t[43]=K,t[44]=q,t[45]=re,t[46]=ie,t[47]=v,t[48]=Ae,t[49]=je):(Ae=t[48],je=t[49]),(0,Q.useEffect)(Ae,je);let Me;t[50]!==r||t[51]!==l||t[52]!==ee||t[53]!==U||t[54]!==g||t[55]!==Te||t[56]!==K||t[57]!==q||t[58]!==re||t[59]!==ie||t[60]!==y||t[61]!==i||t[62]!==R?(Me=()=>en(e=>{let t=l!==null&&cd(e4(l));switch(e){case`new-doc`:if(!R||!i)return;i.startCreating(`file`,g);return;case`new-folder`:if(!R||!i)return;i.startCreating(`folder`,g);return;case`new-from-template`:if(!R||!i)return;i.startCreatingFromTemplate(g);return;case`rename`:if(!l||t)return;m1(l);return;case`duplicate`:if(!l||t)return;g1(l);return;case`move-to-trash`:if(!l||t)return;f1(l);return;case`reveal-in-finder`:{if(!L||!R)return;let e=$2(l,R);L.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=li.filter(e=>U[e.id]?.installed===!0);if(e.length===0){Mu.error(r({id:`LKOLNn`}));return}let t=t4(l,R);if(!t)return;let[n]=e;if(!n)return;ee(n.id,t);return}case`copy-full-path`:{if(!R)return;let e=$2(l,R);navigator.clipboard.writeText(e).then(()=>Mu.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Mu.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=e4(l);if(e===``){Mu.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>Mu.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Mu.error(r({id:`5QGTaA`}))});return}case`toggle-show-ok-folders`:Te({showOkFolders:!q});return;case`toggle-show-hidden-files`:Te({showHiddenFiles:!K});return;case`toggle-show-only-markdown-files`:Te({showOnlyMarkdownFiles:!re});return;case`toggle-show-skills-section`:Te({showSkillsSection:!ie});return;case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`toggle-sidebar`:y();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}}),t[50]=r,t[51]=l,t[52]=ee,t[53]=U,t[54]=g,t[55]=Te,t[56]=K,t[57]=q,t[58]=re,t[59]=ie,t[60]=y,t[61]=i,t[62]=R,t[63]=Me):Me=t[63];let Ne;t[64]!==r||t[65]!==l||t[66]!==ee||t[67]!==U||t[68]!==g||t[69]!==G||t[70]!==K||t[71]!==q||t[72]!==re||t[73]!==ie||t[74]!==y||t[75]!==i||t[76]!==R?(Ne=[L,i,R,l,g,G,K,q,re,ie,U,ee,y,r],t[64]=r,t[65]=l,t[66]=ee,t[67]=U,t[68]=g,t[69]=G,t[70]=K,t[71]=q,t[72]=re,t[73]=ie,t[74]=y,t[75]=i,t[76]=R,t[77]=Ne):Ne=t[77],(0,Q.useEffect)(Me,Ne);let Pe=_&&x&&`motion-safe:delay-100`,Fe=S&&`opacity-0`,Ie;t[78]!==Pe||t[79]!==Fe?(Ie=Y(`flex-row h-12 items-center py-0 px-3`,`justify-between`,_&&`overflow-x-clip`,_&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Pe,Fe,_&&`[-webkit-app-region:drag]`),t[78]=Pe,t[79]=Fe,t[80]=Ie):Ie=t[80];let Le;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(Le=_?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[81]=Le):Le=t[81];let Re;t[82]===x?Re=t[83]:(Re=x&&!_?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(J,{id:`sER-bs`})}):null,t[82]=x,t[83]=Re);let ze;t[84]===x?ze=t[85]:(ze=_&&x?(0,Z.jsx)(vB,{}):null,t[84]=x,t[85]=ze);let Be;t[86]!==Ie||t[87]!==Re||t[88]!==ze?(Be=(0,Z.jsxs)(NI,{"data-electron-drag":_?``:void 0,className:Ie,children:[Le,Re,ze]}),t[86]=Ie,t[87]=Re,t[88]=ze,t[89]=Be):Be=t[89];let Ve=_&&x&&`motion-safe:delay-100`,He=S&&`opacity-0`,Ue;t[90]!==Ve||t[91]!==He?(Ue=Y(`px-2 pb-2`,_&&`[-webkit-app-region:no-drag]`,_&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ve,He),t[90]=Ve,t[91]=He,t[92]=Ue):Ue=t[92];let We;t[93]===v?We=t[94]:(We=[v],t[93]=v,t[94]=We);let Ge;t[95]===n?Ge=t[96]:(Ge=(0,Z.jsx)(F2,{onClick:n}),t[95]=n,t[96]=Ge);let Ke;t[97]!==We||t[98]!==Ge?(Ke=(0,Z.jsx)(sn,{fallbackRender:d4,onError:P2,resetKeys:We,children:Ge}),t[97]=We,t[98]=Ge,t[99]=Ke):Ke=t[99];let qe;t[100]!==Ue||t[101]!==Ke?(qe=(0,Z.jsx)(`div`,{className:Ue,children:Ke}),t[100]=Ue,t[101]=Ke,t[102]=qe):qe=t[102];let Je;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsx)(KB,{}),t[103]=Je):Je=t[103];let Ye;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(Dc,{className:`size-3.5 shrink-0`}),t[104]=Ye):Ye=t[104];let Xe;t[105]===H?Xe=t[106]:(Xe=(0,Z.jsx)(`span`,{className:`truncate`,children:H}),t[105]=H,t[106]=Xe);let Ze;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,Z.jsx)(es,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/files:rotate-90`}),t[107]=Ze):Ze=t[107];let Qe;t[108]===Xe?Qe=t[109]:(Qe=(0,Z.jsxs)(Sn,{"data-sidebar-root-context":!0,className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[Ye,Xe,Ze]}),t[108]=Xe,t[109]=Qe);let $e;t[110]===r?$e=t[111]:($e=r({id:`eaHUxx`}),t[110]=r,t[111]=$e);let et;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(et=Y(_&&`*:[-webkit-app-region:no-drag]`),t[112]=et):et=t[112];let tt;t[113]===r?tt=t[114]:(tt=r({id:`Rq1vFD`}),t[113]=r,t[114]=tt);let nt;t[115]===tt?nt=t[116]:(nt=(0,Z.jsx)(l4,{icon:A_,label:tt}),t[115]=tt,t[116]=nt);let rt;t[117]!==ae||t[118]!==i?(rt=ae?(0,Z.jsxs)(Ir,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(fv,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,t[117]=ae,t[118]=i,t[119]=rt):rt=t[119];let it;t[120]!==oe||t[121]!==i?(it=oe?(0,Z.jsxs)(Ir,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(y_,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,t[120]=oe,t[121]=i,t[122]=it):it=t[122];let at;t[123]===se?at=t[124]:(at=se?(0,Z.jsx)(qr,{}):null,t[123]=se,t[124]=at);let st;t[125]===r?st=t[126]:(st=r({id:`8vETh9`}),t[125]=r,t[126]=st);let ct;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(Hr,{children:(0,Z.jsx)(J,{id:`8vETh9`})}),t[127]=ct):ct=t[127];let lt;t[128]===Te?lt=t[129]:(lt=e=>Te({showHiddenFiles:e}),t[128]=Te,t[129]=lt);let ut=G===null,dt;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,Z.jsx)(J,{id:`6KCH4m`}),t[130]=dt):dt=t[130];let ft;t[131]!==K||t[132]!==lt||t[133]!==ut?(ft=(0,Z.jsx)(Vr,{checked:K,onCheckedChange:lt,disabled:ut,"data-testid":`tree-options-show-hidden-files`,children:dt}),t[131]=K,t[132]=lt,t[133]=ut,t[134]=ft):ft=t[134];let pt;t[135]===Te?pt=t[136]:(pt=e=>Te({showOkFolders:e}),t[135]=Te,t[136]=pt);let mt=G===null,ht;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(ht=(0,Z.jsx)(J,{id:`ELYtNJ`}),t[137]=ht):ht=t[137];let gt;t[138]!==q||t[139]!==pt||t[140]!==mt?(gt=(0,Z.jsx)(Vr,{checked:q,onCheckedChange:pt,disabled:mt,"data-testid":`tree-options-show-ok-folders`,children:ht}),t[138]=q,t[139]=pt,t[140]=mt,t[141]=gt):gt=t[141];let _t;t[142]===Te?_t=t[143]:(_t=e=>Te({showOnlyMarkdownFiles:e}),t[142]=Te,t[143]=_t);let vt=G===null,yt;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(yt=(0,Z.jsx)(J,{id:`5-o4kO`}),t[144]=yt):yt=t[144];let bt;t[145]!==re||t[146]!==_t||t[147]!==vt?(bt=(0,Z.jsx)(Vr,{checked:re,onCheckedChange:_t,disabled:vt,"data-testid":`tree-options-show-only-markdown-files`,children:yt}),t[145]=re,t[146]=_t,t[147]=vt,t[148]=bt):bt=t[148];let xt;t[149]===Te?xt=t[150]:(xt=e=>Te({showSkillsSection:e}),t[149]=Te,t[150]=xt);let St=G===null,Ct;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,Z.jsx)(J,{id:`PCSkw2`}),t[151]=Ct):Ct=t[151];let wt;t[152]!==ie||t[153]!==xt||t[154]!==St?(wt=(0,Z.jsx)(Vr,{checked:ie,onCheckedChange:xt,disabled:St,"data-testid":`tree-options-show-skills`,children:Ct}),t[152]=ie,t[153]=xt,t[154]=St,t[155]=wt):wt=t[155];let Tt;t[156]!==st||t[157]!==ft||t[158]!==gt||t[159]!==bt||t[160]!==wt?(Tt=(0,Z.jsxs)(zr,{"aria-label":st,children:[ct,ft,gt,bt,wt]}),t[156]=st,t[157]=ft,t[158]=gt,t[159]=bt,t[160]=wt,t[161]=Tt):Tt=t[161];let Et;t[162]!==rt||t[163]!==it||t[164]!==at||t[165]!==Tt?(Et=(0,Z.jsxs)(Wr,{align:`end`,className:`min-w-52`,"data-testid":`tree-options-menu`,children:[rt,it,at,Tt]}),t[162]=rt,t[163]=it,t[164]=at,t[165]=Tt,t[166]=Et):Et=t[166];let Ot;t[167]!==nt||t[168]!==Et?(Ot=(0,Z.jsxs)(Kr,{children:[nt,Et]}),t[167]=nt,t[168]=Et,t[169]=Ot):Ot=t[169];let kt;t[170]===r?kt=t[171]:(kt=r({id:`HdkSiO`}),t[170]=r,t[171]=kt);let At;t[172]!==g||t[173]!==i?(At=()=>i?.startCreating(`file`,g),t[172]=g,t[173]=i,t[174]=At):At=t[174];let jt;t[175]!==kt||t[176]!==At?(jt=(0,Z.jsx)(c4,{icon:vc,label:kt,onClick:At,shortcutId:`new-item`}),t[175]=kt,t[176]=At,t[177]=jt):jt=t[177];let Mt;t[178]!==r||t[179]!==I||t[180]!==g||t[181]!==i?(Mt=I?(0,Z.jsxs)(Kr,{children:[(0,Z.jsx)(l4,{icon:Ks,label:r({id:`Uuj_R4`})}),(0,Z.jsx)(Wr,{align:`end`,className:`min-w-52`,onCloseAutoFocus:ue,children:(0,Z.jsx)(i1,{parentDir:g,onSelectTemplate:e=>{ce.current=!0,i?.createFromTemplate(g,e)},ItemComponent:Ir})})]}):null,t[178]=r,t[179]=I,t[180]=g,t[181]=i,t[182]=Mt):Mt=t[182];let Nt;t[183]===r?Nt=t[184]:(Nt=r({id:`96G6Re`}),t[183]=r,t[184]=Nt);let Pt;t[185]!==g||t[186]!==i?(Pt=()=>i?.startCreating(`folder`,g),t[185]=g,t[186]=i,t[187]=Pt):Pt=t[187];let Ft;t[188]!==Nt||t[189]!==Pt?(Ft=(0,Z.jsx)(c4,{icon:x_,label:Nt,onClick:Pt,shortcutId:_?`new-folder`:void 0}),t[188]=Nt,t[189]=Pt,t[190]=Ft):Ft=t[190];let It;t[191]!==$e||t[192]!==Ot||t[193]!==jt||t[194]!==Mt||t[195]!==Ft?(It=(0,Z.jsxs)(yp,{"aria-label":$e,"data-testid":`sidebar-toolbar`,className:et,children:[Ot,jt,Mt,Ft]}),t[191]=$e,t[192]=Ot,t[193]=jt,t[194]=Mt,t[195]=Ft,t[196]=It):It=t[196];let Lt;t[197]!==Qe||t[198]!==It?(Lt=(0,Z.jsxs)(LI,{className:`shrink-0 gap-1`,children:[Qe,It]}),t[197]=Qe,t[198]=It,t[199]=Lt):Lt=t[199];let Rt=o==null?`50vh`:`${o}px`,zt;t[200]===Rt?zt=t[201]:(zt={height:Rt},t[200]=Rt,t[201]=zt);let Bt;t[202]===Symbol.for(`react.memo_cache_sentinel`)?(Bt=(0,Z.jsx)(o0,{ref:a,onContentHeightChange:s}),t[202]=Bt):Bt=t[202];let Vt;t[203]===zt?Vt=t[204]:(Vt=(0,Z.jsx)(xn,{className:`flex max-h-[70vh] flex-col overflow-hidden`,style:zt,children:Bt}),t[203]=zt,t[204]=Vt);let Ht;t[205]!==Lt||t[206]!==Vt?(Ht=(0,Z.jsx)(Cn,{defaultOpen:!0,className:`group/files flex shrink-0 flex-col`,children:(0,Z.jsxs)(II,{className:`min-h-0 px-0`,children:[Lt,Vt]})}),t[205]=Lt,t[206]=Vt,t[207]=Ht):Ht=t[207];let Ut;t[208]===ie?Ut=t[209]:(Ut=ie?(0,Z.jsx)(I2,{}):null,t[208]=ie,t[209]=Ut);let Wt;t[210]===i?Wt=t[211]:(Wt=(0,Z.jsx)(`div`,{"aria-hidden":!0,"data-sidebar-empty-deselect":!0,className:`min-h-8 flex-1 cursor-default`,onClick:()=>i?.clearCreationTarget()}),t[210]=i,t[211]=Wt);let Gt;t[212]!==Ht||t[213]!==Ut||t[214]!==Wt?(Gt=(0,Z.jsxs)(FI,{children:[Je,Ht,Ut,Wt]}),t[212]=Ht,t[213]=Ut,t[214]=Wt,t[215]=Gt):Gt=t[215];let Kt;t[216]===Symbol.for(`react.memo_cache_sentinel`)?(Kt=(0,Z.jsxs)(PI,{className:`px-0`,children:[(0,Z.jsx)(r2,{}),(0,Z.jsx)(Q2,{}),(0,Z.jsx)(cH,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(BI,{children:(0,Z.jsx)(VI,{children:(0,Z.jsx)(T2,{bridge:window.okDesktop})})}):null]}),t[216]=Kt):Kt=t[216];let qt=!(b&&v===`collapsed`),Jt;t[217]===qt?Jt=t[218]:(Jt=(0,Z.jsx)(jI,{enableToggle:!1,enableDrag:qt}),t[217]=qt,t[218]=Jt);let Yt;t[219]!==Be||t[220]!==qe||t[221]!==Gt||t[222]!==Jt?(Yt=(0,Z.jsx)(Ob,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:de,children:[Be,qe,Gt,Kt,Jt]})}),t[219]=Be,t[220]=qe,t[221]=Gt,t[222]=Jt,t[223]=Yt):Yt=t[223];let Xt=!R,Zt,Qt;t[224]===Symbol.for(`react.memo_cache_sentinel`)?(Zt=(0,Z.jsx)(vc,{"aria-hidden":`true`}),Qt=(0,Z.jsx)(J,{id:`HdkSiO`}),t[224]=Zt,t[225]=Qt):(Zt=t[224],Qt=t[225]);let $t;t[226]!==pe||t[227]!==Xt?($t=(0,Z.jsxs)(Mb,{disabled:Xt,onSelect:pe,"data-testid":`empty-space-menu-new-file`,children:[Zt,Qt]}),t[226]=pe,t[227]=Xt,t[228]=$t):$t=t[228];let tn;t[229]!==he||t[230]!==F||t[231]!==R?(tn=F?(0,Z.jsxs)(Ab,{children:[(0,Z.jsxs)(Nb,{disabled:!R,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(Ks,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Uuj_R4`})]}),(0,Z.jsx)(Pb,{children:(0,Z.jsx)(i1,{parentDir:``,onSelectTemplate:he,ItemComponent:Mb})})]}):null,t[229]=he,t[230]=F,t[231]=R,t[232]=tn):tn=t[232];let nn=!R,rn,an;t[233]===Symbol.for(`react.memo_cache_sentinel`)?(rn=(0,Z.jsx)(x_,{"aria-hidden":`true`}),an=(0,Z.jsx)(J,{id:`96G6Re`}),t[233]=rn,t[234]=an):(rn=t[233],an=t[234]);let on;t[235]!==_e||t[236]!==nn?(on=(0,Z.jsxs)(Mb,{disabled:nn,onSelect:_e,"data-testid":`empty-space-menu-new-folder`,children:[rn,an]}),t[235]=_e,t[236]=nn,t[237]=on):on=t[237];let cn;t[238]===Symbol.for(`react.memo_cache_sentinel`)?(cn=(0,Z.jsx)(Lb,{}),t[238]=cn):cn=t[238];let ln;t[239]!==r||t[240]!==ye||t[241]!==R?(ln=L?(0,Z.jsxs)(Mb,{disabled:!R,onSelect:ye,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(R?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(Dc,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`LtSYdi`})}),R?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})})]}):null,t[239]=r,t[240]=ye,t[241]=R,t[242]=ln):ln=t[242];let un;t[243]!==ee||t[244]!==te||t[245]!==U?(un=(0,Z.jsx)(G0,{input:te,installStates:U,dispatch:ee}),t[243]=ee,t[244]=te,t[245]=U,t[246]=un):un=t[246];let dn;t[247]!==Ce||t[248]!==B?(dn=B?(0,Z.jsxs)(Mb,{onSelect:Ce,"data-testid":`empty-space-menu-share`,children:[(0,Z.jsx)(q_,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Z8lGw6`})]}):null,t[247]=Ce,t[248]=B,t[249]=dn):dn=t[249];let X=!R,fn;t[250]!==r||t[251]!==R?(fn=r(R?{id:`Up2_7p`}:{id:`U8CD-l`}),t[250]=r,t[251]=R,t[252]=fn):fn=t[252];let pn;t[253]===Symbol.for(`react.memo_cache_sentinel`)?(pn=(0,Z.jsx)(gc,{"aria-hidden":`true`}),t[253]=pn):pn=t[253];let mn;t[254]===Symbol.for(`react.memo_cache_sentinel`)?(mn=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`Up2_7p`})}),t[254]=mn):mn=t[254];let hn;t[255]===R?hn=t[256]:(hn=R?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})}),t[255]=R,t[256]=hn);let gn;t[257]!==xe||t[258]!==X||t[259]!==fn||t[260]!==hn?(gn=(0,Z.jsxs)(Mb,{disabled:X,onSelect:xe,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":fn,children:[pn,mn,hn]}),t[257]=xe,t[258]=X,t[259]=fn,t[260]=hn,t[261]=gn):gn=t[261];let _n;t[262]===Symbol.for(`react.memo_cache_sentinel`)?(_n=(0,Z.jsx)(Lb,{}),t[262]=_n):_n=t[262];let vn;t[263]===Te?vn=t[264]:(vn=e=>Te({showHiddenFiles:e}),t[263]=Te,t[264]=vn);let yn=G===null,bn;t[265]===Symbol.for(`react.memo_cache_sentinel`)?(bn=(0,Z.jsx)(J,{id:`XcGbim`}),t[265]=bn):bn=t[265];let wn;t[266]!==K||t[267]!==vn||t[268]!==yn?(wn=(0,Z.jsx)(Fb,{checked:K,onCheckedChange:vn,disabled:yn,"data-testid":`empty-space-menu-show-hidden-files`,children:bn}),t[266]=K,t[267]=vn,t[268]=yn,t[269]=wn):wn=t[269];let Tn;t[270]===Te?Tn=t[271]:(Tn=e=>Te({showOkFolders:e}),t[270]=Te,t[271]=Tn);let En=G===null,Dn;t[272]===Symbol.for(`react.memo_cache_sentinel`)?(Dn=(0,Z.jsx)(J,{id:`GHsJb8`}),t[272]=Dn):Dn=t[272];let On;t[273]!==q||t[274]!==Tn||t[275]!==En?(On=(0,Z.jsx)(Fb,{checked:q,onCheckedChange:Tn,disabled:En,"data-testid":`empty-space-menu-show-ok-folders`,children:Dn}),t[273]=q,t[274]=Tn,t[275]=En,t[276]=On):On=t[276];let kn;t[277]===Te?kn=t[278]:(kn=e=>Te({showOnlyMarkdownFiles:e}),t[277]=Te,t[278]=kn);let An=G===null,jn;t[279]===Symbol.for(`react.memo_cache_sentinel`)?(jn=(0,Z.jsx)(J,{id:`WkTLN7`}),t[279]=jn):jn=t[279];let Mn;t[280]!==re||t[281]!==kn||t[282]!==An?(Mn=(0,Z.jsx)(Fb,{checked:re,onCheckedChange:kn,disabled:An,"data-testid":`empty-space-menu-show-only-markdown-files`,children:jn}),t[280]=re,t[281]=kn,t[282]=An,t[283]=Mn):Mn=t[283];let Nn;t[284]===Te?Nn=t[285]:(Nn=e=>Te({showSkillsSection:e}),t[284]=Te,t[285]=Nn);let Pn=G===null,Fn;t[286]===Symbol.for(`react.memo_cache_sentinel`)?(Fn=(0,Z.jsx)(J,{id:`NF_Wcg`}),t[286]=Fn):Fn=t[286];let In;t[287]!==ie||t[288]!==Nn||t[289]!==Pn?(In=(0,Z.jsx)(Fb,{checked:ie,onCheckedChange:Nn,disabled:Pn,"data-testid":`empty-space-menu-show-skills-section`,children:Fn}),t[287]=ie,t[288]=Nn,t[289]=Pn,t[290]=In):In=t[290];let Ln;t[291]===se?Ln=t[292]:(Ln=se?(0,Z.jsx)(Lb,{}):null,t[291]=se,t[292]=Ln);let Rn;t[293]!==De||t[294]!==ae?(Rn=ae?(0,Z.jsxs)(Mb,{onSelect:De,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(fv,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,t[293]=De,t[294]=ae,t[295]=Rn):Rn=t[295];let zn;t[296]!==ke||t[297]!==oe?(zn=oe?(0,Z.jsxs)(Mb,{onSelect:ke,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(y_,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,t[296]=ke,t[297]=oe,t[298]=zn):zn=t[298];let Bn;t[299]!==ln||t[300]!==un||t[301]!==dn||t[302]!==gn||t[303]!==wn||t[304]!==On||t[305]!==Mn||t[306]!==In||t[307]!==Ln||t[308]!==Rn||t[309]!==zn||t[310]!==$t||t[311]!==tn||t[312]!==on?(Bn=(0,Z.jsxs)(jb,{className:`min-w-52`,onCloseAutoFocus:ue,children:[$t,tn,on,cn,ln,un,dn,gn,_n,wn,On,Mn,In,Ln,Rn,zn]}),t[299]=ln,t[300]=un,t[301]=dn,t[302]=gn,t[303]=wn,t[304]=On,t[305]=Mn,t[306]=In,t[307]=Ln,t[308]=Rn,t[309]=zn,t[310]=$t,t[311]=tn,t[312]=on,t[313]=Bn):Bn=t[313];let Vn;return t[314]!==Bn||t[315]!==Yt?(Vn=(0,Z.jsx)(kI,{variant:`inset`,children:(0,Z.jsxs)(Db,{children:[Yt,Bn]})}),t[314]=Bn,t[315]=Yt,t[316]=Vn):Vn=t[316],Vn}function d4(){return null}function f4(e){return console.log(e)}function p4(e){return Mu.error(e)}function m4(e){return Mu.success(e)}function h4(e){e.target instanceof Element&&e.target.closest(`[data-sidebar-root-context]`)||i4(e.target)&&(e.preventDefault(),e.stopPropagation())}var g4=(0,Q.lazy)(()=>n(()=>import(`./McpConsentDialogBody-CHmK7aXE.js`),__vite__mapDeps([170,1,6,2,3,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,115,29,30,31,59,97,100,43,171]),import.meta.url));function _4(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Qm.subscribe,y4,v4))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(g4,{})}),e[0]=t):t=e[0],t}function v4(){return!1}function y4(){return Qm.getSnapshot()!==null}function b4(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(!1),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>en(e=>{e===`report-bug`&&n(!0)}),i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a=(0,Z.jsx)(Hh,{open:t,onOpenChange:n}),e[2]=t,e[3]=a),a}function x4(){let e=(0,$.c)(17),t=Ht(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=ot(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Wd,i=new Gd({url:n,name:Ii,document:e,onStateless:e=>{let{payload:t}=e;Yd(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv),bd(e.docName)},onDerivedView:D4,onConfigValidationRejected:E4,onConfigIgnoreNestedError:T4,onUnknown:w4})},onClose:C4,onDisconnect:S4}),a=_d(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]})),e.includes(`lint-config`)&&Fp()}),o=O(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Sd([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function S4(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function C4(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function w4(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function T4(e){Js(e)}function E4(e){ec(e)}function D4(e){Sd([e.ch])}var O4=500,k4=750,A4=1200,j4=3,M4=1500;function N4(e){return!e.startsWith(`__`)&&!/\.(mmd|mermaid)$/i.test(e)}async function P4(e){let t=await Wf({kind:`project`},e);return e.aborted||t===null||t===`audit-superseded`?!1:(rp(t.files),!0)}function F4(){let e=(0,$.c)(10),{merged:t}=wf(),n=t?.validation?.fileTreeIndicators!==!1,r=os()?.pages.size??0,i=(0,Q.useRef)(!1),a,o;e[0]===n?(a=e[1],o=e[2]):(a=()=>{if(!n)return;let e=new Map,t=!1,r=e=>{Xf({kind:`doc`,docName:e}).then(n=>{t||n===null||n===`audit-superseded`||Jf(e,n.files.filter(t=>kd(t.file)===e).flatMap(I4))})},i=Cd(t=>{if(!N4(t))return;let n=e.get(t);n!==void 0&&clearTimeout(n),e.set(t,setTimeout(()=>{e.delete(t),r(t)},O4))});return()=>{t=!0,i();for(let t of e.values())clearTimeout(t);e.clear()}},o=[n],e[0]=n,e[1]=a,e[2]=o),(0,Q.useEffect)(a,o);let s,c;e[3]===n?(s=e[4],c=e[5]):(s=()=>{if(!n)return;let e=null,t=null,r=()=>{t?.abort();let e=new AbortController;t=e,P4(e.signal).finally(()=>{t===e&&(t=null)})},i=()=>{e!==null&&clearTimeout(e),e=setTimeout(()=>{e=null,r()},k4)},a=[Mp(i),xd(i)];return()=>{for(let e of a)e();e!==null&&clearTimeout(e),t?.abort()}},c=[n],e[3]=n,e[4]=s,e[5]=c),(0,Q.useEffect)(s,c);let l,u;return e[6]!==n||e[7]!==r?(l=()=>{if(!n||r===0||i.current)return;let e=new AbortController,t=null,a=0,o=()=>{t=null,P4(e.signal).then(n=>{if(n){i.current=!0;return}if(!e.signal.aborted){if(a+=1,a>=j4){console.warn(`[audit] on-open audit exhausted retries; file-tree counts unavailable`);return}t=setTimeout(o,M4*2**(a-1))}})};return t=setTimeout(o,A4),()=>{t!==null&&clearTimeout(t),e.abort()}},u=[n,r],e[6]=n,e[7]=r,e[8]=l,e[9]=u):(l=e[8],u=e[9]),(0,Q.useEffect)(l,u),null}function I4(e){return e.diagnostics}function L4(e){let t=null,n=()=>{let n=e.hasAnyUnsyncedWork();n!==t&&(t=n,e.report({hasPendingWork:n,enabled:e.enabled}))};return n(),e.addUnsyncedWorkListener(n)}function R4(){let e=(0,$.c)(4),{collabUrl:t}=ot(),{projectConfig:n}=wf(),r=n?.bridge?.backgroundThrottle?.enabled??!0,i,a;return e[0]!==t||e[1]!==r?(i=()=>{if(t===null)return;let e=window.okDesktop?.editor?.notifyBackgroundThrottle;if(typeof e!=`function`)return;let n=Ze(t);return L4({enabled:r,hasAnyUnsyncedWork:()=>n.hasAnyUnsyncedWork(),addUnsyncedWorkListener:e=>n.addUnsyncedWorkListener(e),report:t=>e(t)})},a=[t,r],e[0]=t,e[1]=r,e[2]=i,e[3]=a):(i=e[2],a=e[3]),(0,Q.useEffect)(i,a),null}function z4(e){let t=e.win??(typeof window<`u`?window:void 0),n=e.doc??(typeof document<`u`?document:void 0);if(t===void 0||n===void 0)return()=>{};let r=!1,i=()=>{r||(r=!0,e.onHide())},a=()=>i(),o=()=>{n.visibilityState===`hidden`?i():n.visibilityState===`visible`&&(r=!1,e.onVisible())};return t.addEventListener(`pagehide`,a),n.addEventListener(`visibilitychange`,o),()=>{t.removeEventListener(`pagehide`,a),n.removeEventListener(`visibilitychange`,o)}}function B4(){let e=(0,$.c)(4),{collabUrl:t}=ot(),{projectConfig:n}=wf(),r=n?.bridge?.flushOnHide?.enabled??!0,i,a;return e[0]!==t||e[1]!==r?(i=()=>{if(t===null)return;let e=Ze(t);return e.setFlushOnHideEnabled(r),z4({onHide:()=>e.flushOnHide(),onVisible:()=>e.resyncOnVisible()})},a=[t,r],e[0]=t,e[1]=r,e[2]=i,e[3]=a):(i=e[2],a=e[3]),(0,Q.useEffect)(i,a),null}function V4(e){let t=$e(e);if(t)return{scope:`project`,name:t};let n=ua(e);return n?.kind===`skill`?{scope:n.scope,name:n.name}:null}function H4(e,t){let n=new Set(t.map(e=>`${e.scope}\u0000${e.name}`)),r=[];for(let t of e){let e=V4(t);if(!e||n.has(`${e.scope}\u0000${e.name}`))continue;let i=e.scope===`project`?`global`:`project`;n.has(`${i}\u0000${e.name}`)?r.push({kind:`retarget`,fromDocName:t,toDocName:Ka(i,e.name)}):r.push({kind:`close`,docName:t})}return r}function U4(){let e=(0,$.c)(13),{openTabs:t,closeDocument:n}=ot(),r;e[0]===t?r=e[1]:(r=t.some(G4),e[0]=t,e[1]=r);let i=r,a;e[2]===i?a=e[3]:(a={enabled:i},e[2]=i,e[3]=a);let o=gs(a),s=(0,Q.useRef)(null),c;e[4]!==n||e[5]!==t||e[6]!==o.data||e[7]!==o.status?(c=()=>{if(o.status!==`ready`)return;let e=o.data,r=`${t.join(``)}\u0002${e.map(W4).sort().join(``)}`;if(s.current===r)return;s.current=r;let i=H4(t,e);for(let e of i)e.kind===`retarget`?(Ac(e.toDocName),n(e.fromDocName)):n(e.docName)},e[4]=n,e[5]=t,e[6]=o.data,e[7]=o.status,e[8]=c):c=e[8];let l;e[9]!==n||e[10]!==t||e[11]!==o?(l=[o,t,n],e[9]=n,e[10]=t,e[11]=o,e[12]=l):l=e[12],(0,Q.useEffect)(c,l)}function W4(e){return`${e.scope}\u0000${e.name}`}function G4(e){return V4(e)!==null}var K4=1e3,q4=3e4;function J4(e){let t=e.scheduler??{setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)},n=e.initialBackoffMs??K4,r=e.maxBackoffMs??q4,i=e.rng??Math.random,a=e.createWebSocket??(e=>new WebSocket(e)),o=e.logger??null,s=e.log,c=null,l=null,u=!1,d=n;function f(e,t,n){try{o?o[e](t,n):s?.(t)}catch{}}function p(){if(u)return;l!==null&&t.clearTimeout(l);let e=d;d=Math.min(d*2,r);let n=i(),a=Math.max(1,Math.floor(e*(1-n/2)));f(`debug`,`scheduling reconnect`,{backoffMs:a,ceilMs:e}),l=t.setTimeout(()=>{l=null,m().catch(e=>f(`warn`,`reconnect failed`,{error:String(e)}))},a)}async function m(){if(u)return;let t;try{t=await e.resolveWsUrl()}catch(e){f(`warn`,`resolveWsUrl threw`,{error:String(e)}),p();return}if(!t){p();return}let r=[];e.pid!==void 0&&r.push(`pid=${encodeURIComponent(String(e.pid))}`),e.connectionId&&r.push(`connectionId=${encodeURIComponent(e.connectionId)}`),e.connectionId&&e.displayName!==void 0&&e.clientName!==void 0&&e.colorSeed!==void 0&&(r.push(`displayName=${encodeURIComponent(e.displayName)}`),r.push(`clientName=${encodeURIComponent(e.clientName)}`),r.push(`colorSeed=${encodeURIComponent(e.colorSeed)}`));let i=r.length>0?`?${r.join(`&`)}`:``,o=`${t}/collab/keepalive${i}`;try{c=a(o)}catch(e){f(`warn`,`WebSocket constructor failed`,{url:o,error:String(e)}),c=null,p();return}c.addEventListener(`open`,()=>{f(`info`,`connected`,{url:t}),d=n}),c.addEventListener(`close`,()=>{u||(f(`info`,`disconnected`,{url:t}),c=null,p())}),c.addEventListener(`error`,()=>{f(`debug`,`websocket error observed`,{url:t,readyState:c?.readyState,reason:`error-event`})})}return queueMicrotask(()=>{m().catch(e=>f(`warn`,`initial connect failed`,{error:String(e)}))}),{close:()=>{if(!u&&(u=!0,l!==null&&(t.clearTimeout(l),l=null),c)){try{c.close()}catch{}c=null}},isConnected:()=>c!==null&&c.readyState===1}}function Y4(e){if(e)return e.replace(/\/collab\/?$/,``)}function X4(){return Xd(window)!==null}function Z4(e,t){let n=(0,$.c)(5),r=(0,Q.useRef)(e),i=(0,Q.useRef)(t),a,o;n[0]===e?(a=n[1],o=n[2]):(a=()=>{r.current=e},o=[e],n[0]=e,n[1]=a,n[2]=o),(0,Q.useEffect)(a,o);let s,c;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=i.current?.startKeepalive??J4;if((i.current?.isElectronHost??X4)())return;let t=e({resolveWsUrl:async()=>Y4(r.current)});return()=>t.close()},c=[],n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,Q.useEffect)(s,c)}var Q4=(0,Q.lazy)(()=>n(()=>import(`./ShareBranchSwitchDialog-jGb4KF7T.js`).then(e=>({default:e.ShareBranchSwitchDialog})),__vite__mapDeps([172,1,10,11,12,23,14,15,16,17,24,25,26,22,27,92,33,173,100,174,175,176,6,2,3,7,8,9,177]),import.meta.url)),$4=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveMissDialog-Dv1nzqQa.js`).then(e=>({default:e.ShareReceiveMissDialog})),__vite__mapDeps([178,1,23,10,11,12,14,15,16,17,24,25,26,22,27,179,118,6,2,3,7,8,9,85,68,86,87,88,95,100,64,59,20,37,97,33,173,121,40,43,63]),import.meta.url)),e3=`#install-claude-desktop`,t3=/\.(md|mdx)$/i;function n3(e){return Ku(e)||e===e3}function r3(e,t){if(!t3.test(e))return null;for(let n of t){let t=U(n);if(t.kind===`doc`&&t.docName===e)return{kind:`doc`,target:e,docName:e}}return null}function i3(e,t,n,r){return[e,t,n,r].map(e=>[...e].sort().join(`\0`)).join(``)}function a3(){let e=(0,$.c)(27),{clearTarget:t,openTabs:n,syncOpenTabsWithKnownTargets:r,tabSessionLoaded:i}=ot(),{openTargetTransition:a}=Le();U4();let{assetPaths:o,filePaths:s,folderPaths:c,loading:l,pageMeta:u,pages:d,pagesBySlug:f,pagesByBasename:p}=rs(),m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g;e[0]!==o||e[1]!==s||e[2]!==c||e[3]!==d?(g=i3(d,c,o,s),e[0]=o,e[1]=s,e[2]=c,e[3]=d,e[4]=g):g=e[4];let _=g,v;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],e[5]=v):v=e[5],(0,Q.useEffect)(o3,v);let y,b;e[6]!==o||e[7]!==s||e[8]!==c||e[9]!==l||e[10]!==d||e[11]!==r||e[12]!==i||e[13]!==_?(y=()=>{l||!i||m.current===_||(m.current=_,r({pages:d,folderPaths:c,assetPaths:o,filePaths:s}))},b=[o,s,c,l,d,r,i,_],e[6]=o,e[7]=s,e[8]=c,e[9]=l,e[10]=d,e[11]=r,e[12]=i,e[13]=_,e[14]=y,e[15]=b):(y=e[14],b=e[15]),(0,Q.useEffect)(y,b);let x,S;return e[16]!==t||e[17]!==c||e[18]!==l||e[19]!==n||e[20]!==a||e[21]!==u||e[22]!==d||e[23]!==p||e[24]!==f?(x=()=>{r();let e=function(e){h.current=jd(e.state)?window.location.href:null};function r(){let e=h.current===window.location.href;h.current=null,Md();let r=t=>{if(e){a(t,{tabBehavior:`replace-active`});return}a(t)};if(n3(window.location.hash))return;let i=Id(window.location.hash);if(i){let e=oo(i.split(`.`).pop()??``);Ed(`ok/nav/hash-change`,{docName:null,kind:`asset`}),r({kind:`asset`,target:i,assetPath:i,mediaKind:e});return}let o=Nd(window.location.hash);if(o){Ed(`ok/nav/hash-change`,{docName:null,kind:`skill-file`}),r({kind:`skill-file`,target:`${o.scope}/${o.name}/${o.path}`,scope:o.scope,name:o.name,path:o.path});return}if(Hd(window.location.hash)){Ed(`ok/nav/hash-change`,{docName:null,kind:`folder`}),r({kind:`folder`,target:``,folderPath:``});return}let s=zd(window.location.hash);if(!s){Ed(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(l){Ed(`ok/nav/hash-change`,{docName:s,kind:`deferred-loading`});return}let m=r3(s,n)??md(s,{pages:d,folderPaths:c,pagesBySlug:f,pagesByBasename:p});if(m.kind===`missing`&&/\/+$/.test(s.trim())){Ed(`ok/nav/hash-change`,{docName:s,kind:`deferred-missing-folder`});return}let g=gd(hd(m),u);Ed(`ok/nav/hash-change`,{docName:s,kind:g.kind}),r(g)}return window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,r),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,r)}},S=[t,c,l,a,n,u,d,f,p],e[16]=t,e[17]=c,e[18]=l,e[19]=n,e[20]=a,e[21]=u,e[22]=d,e[23]=p,e[24]=f,e[25]=x,e[26]=S):(x=e[25],S=e[26]),(0,Q.useEffect)(x,S),null}function o3(){return en(s3)}function s3(e){e===`navigate-back`&&window.history.back(),e===`navigate-forward`&&window.history.forward()}function c3(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(l3,t),null}function l3(){let e=function(e){if(Af())return;let t=e.target;Ju({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Xu))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function u3(){let e=(0,$.c)(4),{activeTarget:t}=ot(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function d3(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=ot(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:ad(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){if(Af())return;let t=e.target;jy({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(Ny,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function f3(e){let t=(0,$.c)(5),{children:n}=e,{collabUrl:r}=ot();Z4(r);let i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(B4,{}),a=(0,Z.jsx)(R4,{}),t[0]=i,t[1]=a):(i=t[0],a=t[1]);let o;return t[2]!==n||t[3]!==r?(o=(0,Z.jsxs)(qd,{collabUrl:r,children:[i,a,n]}),t[2]=n,t[3]=r,t[4]=o):o=t[4],o}function p3(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Dd,{name:`app`,children:(0,Z.jsx)(dt,{children:(0,Z.jsx)(f3,{children:(0,Z.jsx)(yb,{children:(0,Z.jsx)(m3,{})})})})}),e[0]=t):t=e[0],t}function m3(){let e=(0,$.c)(32),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=Sb(),o=gp(),s;e[0]===o?s=e[1]:(s=t&&t.config.ptyAvailable===!0?{launchInTerminal:h3,installedClis:o}:null,e[0]=o,e[1]=s);let c=s,l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(lx,{}),e[2]=l):l=e[2];let u,d,f,p,m;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(x4,{}),d=(0,Z.jsx)(F4,{}),f=(0,Z.jsx)(a3,{}),p=(0,Z.jsx)(u3,{}),m=(0,Z.jsx)(d3,{}),e[3]=u,e[4]=d,e[5]=f,e[6]=p,e[7]=m):(u=e[3],d=e[4],f=e[5],p=e[6],m=e[7]);let h;e[8]===a?h=e[9]:(h=!a&&(0,Z.jsx)(c3,{}),e[8]=a,e[9]=h);let g,_,v,y,b,x,S;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=!1,S=t?(0,Z.jsx)(ux,{bridge:t}):null,g=t?(0,Z.jsx)(vx,{}):null,_=t?(0,Z.jsx)(b4,{}):null,v=t?(0,Z.jsx)(WB,{}):null,y=(0,Z.jsx)(_4,{}),b=t?(0,Z.jsxs)(Q.Suspense,{fallback:null,children:[(0,Z.jsx)(Q4,{bridge:t}),(0,Z.jsx)($4,{})]}):null,e[10]=g,e[11]=_,e[12]=v,e[13]=y,e[14]=b,e[15]=x,e[16]=S):(g=e[10],_=e[11],v=e[12],y=e[13],b=e[14],x=e[15],S=e[16]);let C;e[17]===r?C=e[18]:(C=(0,Z.jsx)(Qb,{bridge:t,open:r,onOpenChange:i}),e[17]=r,e[18]=C);let w;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(w=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[19]=w):w=e[19];let T;e[20]===a?T=e[21]:(T=!a&&(0,Z.jsx)(a4,{onOpenSearch:()=>i(!0)}),e[20]=a,e[21]=T);let E;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(MI,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(BB,{onOpenSearch:()=>i(!0)})}),e[22]=E):E=e[22];let D;e[23]===T?D=e[24]:(D=(0,Z.jsxs)(EI,{className:`h-screen overflow-hidden`,children:[T,E]}),e[23]=T,e[24]=D);let O;e[25]!==D||e[26]!==c?(O=(0,Z.jsx)(Cs,{value:c,children:D}),e[25]=D,e[26]=c,e[27]=O):O=e[27];let k;return e[28]!==C||e[29]!==O||e[30]!==h?(k=(0,Z.jsxs)(Z.Fragment,{children:[l,(0,Z.jsxs)(is,{children:[u,d,f,p,m,h,x,S,g,_,v,y,b,C,w,O]})]}),e[28]=C,e[29]=O,e[30]=h,e[31]=k):k=e[31],k}function h3(e,t){nl(hs(e,t),t)}function g3(e){let t=/\/([^/]+?)(?:\.git)?\/?$/.exec(e);return t?t[1]:`repo`}function _3(e){return{async getAuthStatus(t){return e.authQueryTransport.status(t?{host:t}:void 0)},async startSignIn(){return e.openSignIn()},async runClone({url:t,branch:n}){let r=await e.bridge.dialog.openFolder();if(!r)return{kind:`cancelled`};let i=g3(t),a=`${r.replace(/\/$/,``)}/${i}`,o=Mu.loading(zu._({id:`GXf9hG`,values:{repoName:i}}),{duration:1/0}),s=typeof n==`string`&&n.length>0?n:null;try{let n=e.cloneTransport.start({url:t,dir:a,branch:s});for await(let e of n.events){if(e.type===`progress`){let t=e.phase,n=Math.round(e.pct);Mu.loading(zu._({id:`GXf9hG`,values:{repoName:i}}),{id:o,description:zu._({id:`SCzAbA`,values:{phase:t,pct:n}}),duration:1/0});continue}if(e.type===`branch-fallback`){console.log(eh({branch_action:`fallback`,branch:e.branch})),Mu.info(zu._({id:`3JYy1p`,values:{0:e.branch}}),{duration:8e3});continue}if(e.type===`complete`)return Mu.success(zu._({id:`IRv9cH`,values:{repoName:i}}),{id:o,duration:4e3}),{kind:`ok`,dir:e.dir};if(e.type===`error`)return Mu.dismiss(o),{kind:`error`,detail:e.message}}return Mu.dismiss(o),{kind:`error`,detail:`Clone ended unexpectedly.`}}catch(e){console.warn(`[clone-controller] clone transport threw`,e);let t=e instanceof Error?e.message:`Unknown error`;return Mu.dismiss(o),{kind:`error`,detail:t}}}}}function v3(){return{start(e){return Vs((t,n)=>{(async()=>{try{let r=await fetch(`/api/local-op/clone`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e.url,dir:e.dir||void 0,branch:typeof e.branch==`string`&&e.branch.length>0?e.branch:void 0}),signal:n});if(!r.ok){let e=`Clone failed — check the URL and try again (${r.status})`;try{let t=await r.json(),n=ji.safeParse(t);n.success&&(e=`Clone failed: ${n.data.title}`)}catch{}t({type:`error`,message:e});return}if(!r.body){t({type:`error`,message:`Clone failed — empty response body`});return}let i=r.body.getReader(),a=new TextDecoder,o=``;for(;;){let{done:e,value:r}=await i.read();if(e)break;o+=a.decode(r,{stream:!0});let s=o.split(`
2014
- `);o=s.pop()??``;for(let e of s){if(!e.trim())continue;let n;try{n=JSON.parse(e)}catch{console.warn(`[clone-transport] Dropped unparseable NDJSON line:`,e.slice(0,100));continue}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let e=n.problem;t({type:`error`,message:e?.detail||e?.title||`Unknown error`});break}t(n)}if(n.aborted)break}n.aborted||t({type:`error`,message:`Clone stream ended unexpectedly — check if the clone completed`})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;t({type:`error`,message:`Clone failed — connection error`})}})()})}}}function y3(e){return{start(t){let n=typeof t.branch==`string`&&t.branch.length>0?t.branch:null;return e.localOp.clone.start({url:t.url,dir:t.dir,branch:n})}}}function b3(e){switch(e){case`receiving`:return{id:`qbfj1f`};case`resolving`:return{id:`adsMWO`};case`checking`:return{id:`1HBhDS`};case`init`:return{id:`LlHqdU`};case`done`:return{id:`bD8I7O`};default:return{id:`25Pw6a`}}}function x3(e){let t=e.trim();if(/^[\w.-]+\/[\w.-]+$/.test(t))return t.split(`/`)[1];try{return new URL(t.replace(/^git@([^:]+):/,`https://$1/`)).pathname.replace(/\.git$/,``).split(`/`).pop()??`repo`}catch{return t.split(`/`).pop()?.replace(/\.git$/,``)??`repo`}}function S3(e){let t=(0,$.c)(100),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c,initialUrl:l}=e,{_:u}=Dt(),d;t[0]===o?d=t[1]:(d=o??v3(),t[0]=o,t[1]=d);let f=d,p;t[2]===s?p=t[3]:(p=s??ac(),t[2]=s,t[3]=p);let m=p,h=c!==void 0,[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),w;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=tc(),t[4]=w):w=t[4];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(-1),N=(0,Q.useRef)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I=(0,Q.useId)(),L;t[5]!==n||t[6]!==m?(L=()=>{if(!n)return;let e=!1;return m.status().then(t=>{$s(t.authenticated),e||E(t.authenticated)}).catch(()=>{e||E(!1)}),()=>{e=!0}},t[5]=n,t[6]=m,t[7]=L):L=t[7];let R;t[8]===n?R=t[9]:(R=[n],t[8]=n,t[9]=R),(0,Q.useEffect)(L,R);let z;t[10]!==T||t[11]!==n||t[12]!==m?(z=()=>{if(!T||!n)return;let e=!1;return C(!0),m.repos().then(t=>{e||(x(t.ok?t.repos:[]),C(!1))}).catch(()=>{e||(x([]),C(!1))}),()=>{e=!0}},t[10]=T,t[11]=n,t[12]=m,t[13]=z):z=t[13];let B;t[14]!==T||t[15]!==n?(B=[T,n],t[14]=T,t[15]=n,t[16]=B):B=t[16],(0,Q.useEffect)(z,B);let V,H;t[17]!==l||t[18]!==n||t[19]!==h?(V=()=>{if(!n||!l||(_(l),h))return;let e=x3(l);e&&y(`~/Documents/${e}`)},H=[n,l,h],t[17]=l,t[18]=n,t[19]=h,t[20]=V,t[21]=H):(V=t[20],H=t[21]),(0,Q.useEffect)(V,H);let U,ee;t[22]!==j||t[23]!==I?(U=()=>{j<0||document.getElementById(`${I}-opt-${j}`)?.scrollIntoView({block:`nearest`})},ee=[j,I],t[22]=j,t[23]=I,t[24]=U,t[25]=ee):(U=t[24],ee=t[25]),(0,Q.useEffect)(U,ee);let W;t[26]===h?W=t[27]:(W=function(e){if(_(e),A(!0),M(-1),h)return;let t=x3(e);t&&y(`~/Documents/${t}`)},t[26]=h,t[27]=W);let te=W,G;t[28]===h?G=t[29]:(G=function(e){if(_(e.clone_url),h)return;let t=e.full_name.split(`/`)[1];y(`~/Documents/${t}`)},t[28]=h,t[29]=G);let ne=G,K;t[30]!==u||t[31]!==v||t[32]!==a||t[33]!==r||t[34]!==c||t[35]!==f||t[36]!==g?(K=async function(){let e=g.trim();if(!e){Mu.error(u({id:`FTUGgh`}));return}let t=v||``;if(c){O(!0);let n=await c();if(!n){O(!1);return}let r=x3(e);t=`${n.replace(/\/$/,``)}/${r}`}else O(!0);let n=Mu.loading(u({id:`2tgFCe`}),{duration:1/0});P.current=n;let i=f.start({url:e,dir:t});N.current=i.cancel;try{let e=i.events[Symbol.asyncIterator](),t=await e.next();for(;!t.done;){let i=t.value;if(i.type===`progress`){let e=u(b3(i.phase));Mu.loading(`${e} — ${i.pct}%`,{id:n})}else if(i.type===`complete`){Mu.success(u({id:`u_lS4C`}),{id:n}),r(!1),O(!1),N.current=null;let e=`port`in i?i.port:void 0;a?a({port:e,dir:i.dir}):e!==void 0&&(window.location.href=`http://localhost:${e}`);return}else if(i.type===`error`){let e=i.message;Mu.error(u({id:`eFJkVt`,values:{cloneError:e}}),{id:n}),O(!1),N.current=null;return}t=await e.next()}Mu.error(u({id:`Tz9pJB`}),{id:n}),O(!1),N.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),Mu.error(u({id:`K9J00P`}),{id:n}),O(!1),N.current=null}},t[30]=u,t[31]=v,t[32]=a,t[33]=r,t[34]=c,t[35]=f,t[36]=g,t[37]=K):K=t[37];let q=K,re;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){N.current?.(),N.current=null,O(!1),Mu.dismiss(P.current??void 0)},t[38]=re):re=t[38];let ie=re,ae;t[39]!==D||t[40]!==r||t[41]!==h?(ae=function(e){D||(r(e),e||(_(``),h||y(``),A(!1),M(-1)))},t[39]=D,t[40]=r,t[41]=h,t[42]=ae):ae=t[42];let oe=ae,se;t[43]===ne?se=t[44]:(se=function(e){ne(e),A(!1),M(-1),F.current?.focus()},t[43]=ne,t[44]=se);let ce=se,le=T===null||S&&b===null,ue;if(t[45]!==b||t[46]!==g){let e=g.trim().toLowerCase(),n;t[48]===b?n=t[49]:(n=b??[],t[48]=b,t[49]=n),ue=n.filter(t=>`${t.full_name} ${t.clone_url}`.toLowerCase().includes(e)),t[45]=b,t[46]=g,t[47]=ue}else ue=t[47];let de=ue,fe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(fe=/:\/\/|^git@|\.git$/i,t[50]=fe):fe=t[50];let pe;t[51]===g?pe=t[52]:(pe=fe.test(g.trim()),t[51]=g,t[52]=pe);let me=pe,he=T===!0&&b!==null&&de.length===0&&!me,ge=k&&T!==!1&&!D&&(le||de.length>0||he),_e=de.length,ve=`${I}-loading`,ye,be;t[53]===_e?(ye=t[54],be=t[55]):(ye=()=>{M(e=>e>=_e?_e-1:e)},be=[_e],t[53]=_e,t[54]=ye,t[55]=be),(0,Q.useEffect)(ye,be);let xe;t[56]!==j||t[57]!==D||t[58]!==ge||t[59]!==ce||t[60]!==de?(xe=function(e){if(!D)if(e.key===`ArrowDown`){if(e.preventDefault(),!ge){A(!0);return}M(e=>Math.min(e+1,de.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),M(O3)):e.key===`Enter`?ge&&j>=0&&j<de.length&&(e.preventDefault(),ce(de[j])):e.key===`Escape`&&ge&&(e.preventDefault(),e.stopPropagation(),A(!1),M(-1))},t[56]=j,t[57]=D,t[58]=ge,t[59]=ce,t[60]=de,t[61]=xe):xe=t[61];let Se=xe,Ce;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(kn,{children:(0,Z.jsx)(Tn,{children:(0,Z.jsx)(J,{id:`VdXv4D`})})}),t[62]=Ce):Ce=t[62];let we;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(`label`,{htmlFor:`clone-source`,className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`IreQBq`})}),t[63]=we):we=t[63];let Te;t[64]!==u||t[65]!==j||t[66]!==D||t[67]!==Se||t[68]!==te||t[69]!==T||t[70]!==I||t[71]!==ve||t[72]!==i||t[73]!==ge||t[74]!==le||t[75]!==b||t[76]!==ce||t[77]!==de||t[78]!==g?(Te=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[we,T===!1?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ru,{id:`clone-source`,placeholder:u({id:`Xv_ijG`}),value:g,onChange:e=>te(e.target.value),disabled:D}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-1sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`9oE4C3`})}),(0,Z.jsx)(X,{variant:`link`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:D,children:(0,Z.jsx)(J,{id:`3jod3l`})})]})]}):(0,Z.jsxs)(Qt,{open:ge,onOpenChange:A,children:[(0,Z.jsx)(nn,{asChild:!0,children:(0,Z.jsx)(Ru,{id:`clone-source`,ref:F,role:`combobox`,"aria-expanded":ge,"aria-controls":ge?le?ve:I:void 0,"aria-activedescendant":j>=0?`${I}-opt-${j}`:void 0,"aria-autocomplete":`list`,autoComplete:`off`,placeholder:u({id:`R0jJzV`}),value:g,onChange:e=>te(e.target.value),onFocus:()=>A(!0),onKeyDown:Se,disabled:D})}),(0,Z.jsx)(an,{align:`start`,sideOffset:4,className:`w-(--radix-popover-trigger-width) max-h-56 overflow-y-auto overscroll-y-contain subtle-scrollbar p-0`,"data-ok-declines-keyboard":``,onOpenAutoFocus:D3,onCloseAutoFocus:E3,onInteractOutside:e=>{F.current?.contains(e.target)&&e.preventDefault()},onWheel:T3,onTouchMove:w3,children:le?(0,Z.jsxs)(`output`,{id:ve,className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":u({id:`8XQRON`}),children:[(0,Z.jsx)(jp,{className:`h-4 w-2/3`}),(0,Z.jsx)(jp,{className:`h-4 w-1/2`}),(0,Z.jsx)(jp,{className:`h-4 w-3/4`}),(0,Z.jsx)(jp,{className:`h-4 w-2/5`})]}):(0,Z.jsx)(`div`,{id:I,role:`listbox`,"aria-label":u({id:`KX1MZR`}),className:`py-1`,children:de.length===0?(0,Z.jsx)(`div`,{role:`presentation`,className:`px-3 py-2 text-xs text-muted-foreground`,children:b&&b.length===0?(0,Z.jsx)(J,{id:`cOSAfL`}):(0,Z.jsx)(J,{id:`8eW0WQ`})}):de.map((e,t)=>(0,Z.jsxs)(`div`,{id:`${I}-opt-${t}`,role:`option`,tabIndex:-1,"aria-selected":t===j,onMouseDown:C3,onMouseEnter:()=>M(t),onClick:()=>ce(e),className:Y(`flex cursor-default items-center gap-2 px-3 py-1.5 text-sm`,t===j&&`bg-accent text-accent-foreground`),children:[e.private?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(cs,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`n5n_vi`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(as,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`NuH1jp`})})]}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.full_name})]},e.full_name))})})]})]}),t[64]=u,t[65]=j,t[66]=D,t[67]=Se,t[68]=te,t[69]=T,t[70]=I,t[71]=ve,t[72]=i,t[73]=ge,t[74]=le,t[75]=b,t[76]=ce,t[77]=de,t[78]=g,t[79]=Te):Te=t[79];let Ee;t[80]!==D||t[81]!==v||t[82]!==h?(Ee=!h&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`Gp_twO`})}),(0,Z.jsx)(Ru,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:v,onChange:e=>y(e.target.value),disabled:D})]}),t[80]=D,t[81]=v,t[82]=h,t[83]=Ee):Ee=t[83];let De;t[84]!==Te||t[85]!==Ee?(De=(0,Z.jsx)(Dn,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[Te,Ee]})}),t[84]=Te,t[85]=Ee,t[86]=De):De=t[86];let Oe;t[87]!==D||t[88]!==q||t[89]!==oe||t[90]!==g||t[91]!==h?(Oe=(0,Z.jsx)(On,{children:D?(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:ie,children:(0,Z.jsx)(J,{id:`dEgA5A`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>oe(!1),children:(0,Z.jsx)(J,{id:`dEgA5A`})}),(0,Z.jsx)(X,{onClick:()=>void q(),disabled:!g.trim(),"aria-describedby":h?`clone-picker-hint`:void 0,children:(0,Z.jsx)(J,{id:`9UQ730`})}),h&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:(0,Z.jsx)(J,{id:`EvPX7f`})})]})}),t[87]=D,t[88]=q,t[89]=oe,t[90]=g,t[91]=h,t[92]=Oe):Oe=t[92];let ke;t[93]!==De||t[94]!==Oe?(ke=(0,Z.jsxs)(En,{className:`sm:max-w-lg`,children:[Ce,De,Oe]}),t[93]=De,t[94]=Oe,t[95]=ke):ke=t[95];let Ae;return t[96]!==oe||t[97]!==n||t[98]!==ke?(Ae=(0,Z.jsx)(An,{open:n,onOpenChange:oe,children:ke}),t[96]=oe,t[97]=n,t[98]=ke,t[99]=Ae):Ae=t[99],Ae}function C3(e){return e.preventDefault()}function w3(e){return e.stopPropagation()}function T3(e){return e.stopPropagation()}function E3(e){return e.preventDefault()}function D3(e){return e.preventDefault()}function O3(e){return Math.max(e-1,-1)}var k3=(0,Q.lazy)(()=>n(()=>import(`./ConsentDialogBody-DWXqUhzJ.js`),__vite__mapDeps([180,1,10,11,12,13,14,15,16,17,18,19,20,21,22,35,23,24,25,26,27,93,100,181,115,116,49,50,131,29,30,31,97,41,42]),import.meta.url));function A3(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Lu.subscribe,M3,j3))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(k3,{})}),e[0]=t):t=e[0],t}function j3(){return!1}function M3(){return Lu.getSnapshot()!==null}function N3(e){let t=(0,$.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`OpenKnowledge icon`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`g`,{filter:`url(#filter0_d_ok)`,children:[(0,Z.jsx)(`path`,{d:`M66.8902 16.1017C58.2694 3.86669 46.1739 -0.690239 29.9182 2.17749C21.3995 3.67813 13.4602 9.555 8.67934 17.9009C3.93974 26.1701 2.98514 35.6533 6.05714 43.9166C9.31574 52.6868 16.7168 58.4752 24.2299 63.4231C25.7973 64.4562 26.1351 65.7172 26.3551 68.9896C26.5221 71.4625 26.799 75.6011 30.6842 77.7204C31.8176 78.3372 33.0648 78.6515 34.3946 78.6515C37.0796 78.6515 39.4033 77.3649 40.5189 76.7482C47.1049 73.1046 68.8878 59.7147 72.6453 40.4027C74.3444 31.6679 70.9797 21.9019 66.8922 16.1017H66.8902Z`,fill:`white`}),(0,Z.jsx)(`path`,{d:`M37.4214 71.154C28.7888 75.929 36.787 64.0397 27.7458 58.0843C21.6372 54.0616 14.788 49.0568 12.0499 41.6911C6.74463 27.4192 17.5438 10.8473 31.028 8.47262C45.1977 5.97613 54.6946 9.8947 61.6635 19.7844C65.2089 24.8167 67.6013 32.8365 66.3658 39.1828C63.6906 52.9341 49.073 64.7075 37.4214 71.154Z`,fill:`#69A3FF`}),(0,Z.jsx)(`path`,{d:`M52.7244 29.2638C53.4665 28.5217 54.6697 28.5217 55.4119 29.2638V29.2638C56.154 30.0059 56.154 31.2091 55.4119 31.9513L49.2589 38.1042L46.5715 35.4167L52.7244 29.2638Z`,fill:`#D5E5FF`}),(0,Z.jsx)(`path`,{d:`M55.4119 38.8821C56.154 39.6242 56.154 40.8274 55.4119 41.5696V41.5696C54.6698 42.3117 53.4665 42.3117 52.7244 41.5696L46.5715 35.4166L49.259 32.7292L55.4119 38.8821Z`,fill:`#D5E5FF`})]}),t[1]=r):r=t[1];let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`defs`,{children:(0,Z.jsxs)(`filter`,{id:`filter0_d_ok`,x:`-9.53674e-07`,y:`-0.0799994`,width:`77.3817`,height:`85.8743`,filterUnits:`userSpaceOnUse`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feFlood`,{floodOpacity:`0`,result:`BackgroundImageFix`}),(0,Z.jsx)(`feColorMatrix`,{in:`SourceAlpha`,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0`,result:`hardAlpha`}),(0,Z.jsx)(`feOffset`,{dy:`2.85714`}),(0,Z.jsx)(`feGaussianBlur`,{stdDeviation:`2.14286`}),(0,Z.jsx)(`feComposite`,{in2:`hardAlpha`,operator:`out`}),(0,Z.jsx)(`feColorMatrix`,{type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in2:`BackgroundImageFix`,result:`effect1_dropShadow_ok`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in:`SourceGraphic`,in2:`effect1_dropShadow_ok`,result:`shape`})]})}),t[2]=i):i=t[2];let a;return t[3]===e?a=t[4]:(a=(0,Z.jsxs)(`svg`,{role:`img`,"aria-label":`OpenKnowledge icon`,fill:`none`,height:24,width:24,viewBox:`0 0 78 80`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r,i]}),t[3]=e,t[4]=a),a}var P3=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveDialog-C7_nVZOF.js`).then(e=>({default:e.ShareReceiveDialog})),__vite__mapDeps([182,1,6,2,3,7,8,9,10,11,12,23,14,15,16,17,24,25,26,22,27,33,100,174,175,176]),import.meta.url)),F3=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-DHWqgWXl.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([164,1,10,11,12,14,15,16,17,49,114,30,31,19,24,25,50,20,93,22]),import.meta.url)),I3=(e,t,n)=>gb(e,t,n,`NavigatorApp`);function L3(e,t){return e.filter(e=>e.path!==t)}function R3(e){let t=(0,$.c)(153),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=new Map,t[1]=o):o=t[1];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(!0),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(void 0),[D,O]=(0,Q.useState)(void 0),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(null),F=typeof window<`u`&&window.okDesktop!=null,[I,L]=(0,Q.useState)(`auth`),{theme:R}=Jt(),{_:z}=Dt();Kd(n,R??`system`);let B;t[2]!==z||t[3]!==n.project?(B=()=>{let e=!1;return n.project.listRecent().then(async t=>{if(e)return;a(t);let r=t.filter(z3),i=await Promise.all(r.map(async e=>{try{let{currentBranch:t}=await n.project.readHeadBranch(e.path);return[e.path,t]}catch{return[e.path,null]}}));e||c(e=>{let t=new Map(e);for(let[e,n]of i)t.set(e,n);return t})}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||(m(t instanceof Error?t.message:z({id:`fYKgzG`})),f(!0))}).finally(()=>{e||u(!1)}),()=>{e=!0}},t[2]=z,t[3]=n.project,t[4]=B):B=t[4];let V;t[5]!==z||t[6]!==n?(V=[n,z],t[5]=z,t[6]=n,t[7]=V):V=t[7],(0,Q.useEffect)(B,V);let H,U;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>en(e=>{e===`new-project`&&b(!0),e===`report-bug`&&S(!0),e===`send-feedback`&&w(!0),e===`close-active-tab-or-window`&&window.close()}),U=[],t[8]=H,t[9]=U):(H=t[8],U=t[9]),(0,Q.useEffect)(H,U);let ee,W;t[10]===n?(ee=t[11],W=t[12]):(ee=()=>n.onRecentRemovedMissing(e=>{let{path:t}=e;a(e=>L3(e,t)),c(e=>{if(!e.has(t))return e;let n=new Map(e);return n.delete(t),n})}),W=[n],t[10]=n,t[11]=ee,t[12]=W),(0,Q.useEffect)(ee,W);let te;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(te=(e,t)=>I3(e,t,m),t[13]=te):te=t[13];let G=te,ne;t[14]!==z||t[15]!==n?(ne=(e,t,r)=>G(()=>(g(r),W3(n,e,t).finally(()=>g(null))),z({id:`SUOoXn`})),t[14]=z,t[15]=n,t[16]=ne):ne=t[16];let K=ne,q;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(q=()=>v(!0),t[17]=q):q=t[17];let re=q,ie;t[18]!==z||t[19]!==n?(ie=()=>G(async()=>{let e=await n.dialog.openFolder();e&&(g(G3(e)),await W3(n,e,`pick-existing`).finally(()=>g(null)))},z({id:`gmJ0An`})),t[18]=z,t[19]=n,t[20]=ie):ie=t[20];let ae=ie,oe;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>b(!0),t[21]=oe):oe=t[21];let se=oe,ce;t[22]!==z||t[23]!==n.project?(ce=()=>G(()=>n.project.openFile(),z({id:`8vCZcs`})),t[22]=z,t[23]=n.project,t[24]=ce):ce=t[24];let le=ce,ue;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(e,t)=>{E(e),O(t),b(!0)},t[25]=ue):ue=t[25];let de=ue,fe;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>{b(e),e||(E(void 0),O(void 0))},t[26]=fe):fe=t[26];let pe=fe,me;t[27]===K?me=t[28]:(me=e=>K(e,`recents`,G3(e)),t[27]=K,t[28]=me);let he=me,ge;t[29]!==z||t[30]!==n.project?(ge=e=>G(async()=>{await n.project.removeRecent(e),a(t=>L3(t,e)),c(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},z({id:`viwC-K`})),t[29]=z,t[30]=n.project,t[31]=ge):ge=t[31];let _e=ge,ve;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-9 ${F?`[-webkit-app-region:drag]`:``}`,"data-electron-drag":F?``:void 0,"data-testid":`nav-chrome-row`,children:YL()&&(0,Z.jsx)(`div`,{className:`pointer-events-auto flex h-full items-center px-2`,children:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(F3,{})})})}),t[32]=ve):ve=t[32];let ye;t[33]!==z||t[34]!==h?(ye=h===null?null:(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-primary-foreground/85 dark:bg-background/85 backdrop-blur-sm`,"data-testid":`nav-opening-overlay`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(ll,{className:`size-6 animate-spin text-muted-foreground`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:z({id:`s0_GnA`,values:{openingLabel:h}})})]}),t[33]=z,t[34]=h,t[35]=ye):ye=t[35];let be;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(N3,{className:`size-12 shrink-0`}),t[36]=be):be=t[36];let xe;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`OpenKnowledge`}),(0,Z.jsx)(jR,{})]}),t[37]=xe):xe=t[37];let Se;t[38]===n.appVersion?Se=t[39]:(Se=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[be,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[xe,(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[38]=n.appVersion,t[39]=Se);let Ce;t[40]===z?Ce=t[41]:(Ce=z({id:`wbv9xO`}),t[40]=z,t[41]=Ce);let we;t[42]===z?we=t[43]:(we=z({id:`0uTHCg`}),t[42]=z,t[43]=we);let Te;t[44]!==Ce||t[45]!==we?(Te=(0,Z.jsx)(B3,{title:Ce,description:we,onClick:se,dataTestId:`nav-create-new`,Icon:tn}),t[44]=Ce,t[45]=we,t[46]=Te):Te=t[46];let Ee;t[47]===z?Ee=t[48]:(Ee=z({id:`WPwDin`}),t[47]=z,t[48]=Ee);let De;t[49]===z?De=t[50]:(De=z({id:`tUvUfp`}),t[49]=z,t[50]=De);let Oe;t[51]!==ae||t[52]!==Ee||t[53]!==De?(Oe=(0,Z.jsx)(B3,{title:Ee,description:De,onClick:ae,dataTestId:`nav-open`,Icon:Dc}),t[51]=ae,t[52]=Ee,t[53]=De,t[54]=Oe):Oe=t[54];let ke;t[55]===z?ke=t[56]:(ke=z({id:`ka6Eke`}),t[55]=z,t[56]=ke);let Ae;t[57]===z?Ae=t[58]:(Ae=z({id:`gOD68k`}),t[57]=z,t[58]=Ae);let je;t[59]!==le||t[60]!==ke||t[61]!==Ae?(je=(0,Z.jsx)(B3,{title:ke,description:Ae,onClick:le,dataTestId:`nav-open-file`,Icon:qn}),t[59]=le,t[60]=ke,t[61]=Ae,t[62]=je):je=t[62];let Me;t[63]===z?Me=t[64]:(Me=z({id:`VdXv4D`}),t[63]=z,t[64]=Me);let Ne;t[65]===z?Ne=t[66]:(Ne=z({id:`JOcPqH`}),t[65]=z,t[66]=Ne);let Pe;t[67]!==Me||t[68]!==Ne?(Pe=(0,Z.jsx)(B3,{title:Me,description:Ne,onClick:re,dataTestId:`nav-clone`,Icon:jv}),t[67]=Me,t[68]=Ne,t[69]=Pe):Pe=t[69];let Fe;t[70]!==Te||t[71]!==Oe||t[72]!==je||t[73]!==Pe?(Fe=(0,Z.jsxs)(`section`,{className:`grid sm:grid-cols-2 gap-3`,children:[Te,Oe,je,Pe]}),t[70]=Te,t[71]=Oe,t[72]=je,t[73]=Pe,t[74]=Fe):Fe=t[74];let Ie;t[75]!==l||t[76]!==i||t[77]!==d?(Ie=!l&&!d&&i.length===0?(0,Z.jsx)(H3,{onPackSelect:de}):null,t[75]=l,t[76]=i,t[77]=d,t[78]=Ie):Ie=t[78];let Le;t[79]!==Fe||t[80]!==Ie?(Le=(0,Z.jsxs)(`div`,{className:`shrink-0 space-y-6`,children:[Fe,Ie]}),t[79]=Fe,t[80]=Ie,t[81]=Le):Le=t[81];let Re;t[82]===p?Re=t[83]:(Re=p===null?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2`,"data-testid":`nav-error-banner`,role:`alert`,children:[(0,Z.jsx)(`span`,{className:`text-red-700 text-xs dark:text-red-300`,children:p}),(0,Z.jsx)(X,{type:`button`,variant:`link`,size:`sm`,onClick:()=>m(null),className:`h-auto p-0 text-red-700 text-xs dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:(0,Z.jsx)(J,{id:`1QfxQT`})})]}),t[82]=p,t[83]=Re);let ze;t[84]!==l||t[85]!==he||t[86]!==_e||t[87]!==s||t[88]!==i?(ze=l?(0,Z.jsx)(`section`,{className:`flex shrink-0 flex-col items-center`,children:(0,Z.jsx)(ll,{className:`size-4 animate-spin text-muted-foreground/60`})}):i.length>0?(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-col`,children:[(0,Z.jsx)(`h2`,{className:`mb-2 shrink-0 font-medium text-muted-foreground font-mono text-xs uppercase tracking-wide`,children:(0,Z.jsx)(J,{id:`CCTop_`})}),(0,Z.jsx)(`ul`,{className:`min-h-0 max-h-48 subtle-scrollbar scroll-fade-mask overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:i.map(e=>(0,Z.jsx)(U3,{project:e,branch:s.get(e.path)??null,onOpen:()=>he(e.path),onRemove:()=>_e(e.path)},e.path))})]}):null,t[84]=l,t[85]=he,t[86]=_e,t[87]=s,t[88]=i,t[89]=ze):ze=t[89];let Be;t[90]!==Se||t[91]!==Le||t[92]!==Re||t[93]!==ze?(Be=(0,Z.jsx)(`div`,{className:`mx-auto flex h-full w-full max-w-5xl flex-col overflow-hidden px-12 py-12`,children:(0,Z.jsxs)(`div`,{className:`my-auto flex min-h-0 flex-col space-y-10`,children:[Se,Le,Re,ze]})}),t[90]=Se,t[91]=Le,t[92]=Re,t[93]=ze,t[94]=Be):Be=t[94];let Ve,He;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,Z.jsx)(_4,{}),He=(0,Z.jsx)(A3,{}),t[95]=Ve,t[96]=He):(Ve=t[95],He=t[96]);let Ue;t[97]!==n||t[98]!==y||t[99]!==T||t[100]!==D?(Ue=(0,Z.jsx)(Sv,{open:y,onOpenChange:pe,bridge:n,initialPackId:T,packs:D}),t[97]=n,t[98]=y,t[99]=T,t[100]=D,t[101]=Ue):Ue=t[101];let We;t[102]===x?We=t[103]:(We=(0,Z.jsx)(Hh,{open:x,onOpenChange:S,systemWide:!0}),t[102]=x,t[103]=We);let Ge;t[104]===C?Ge=t[105]:(Ge=(0,Z.jsx)(Sy,{open:C,onOpenChange:w,source:`help_menu`}),t[104]=C,t[105]=Ge);let Ke;t[106]===N?Ke=t[107]:(Ke=e=>{A(e),e||(M(!1),N&&(N(null),P(null)))},t[106]=N,t[107]=Ke);let qe;t[108]===n?qe=t[109]:(qe=Is(n),t[108]=n,t[109]=qe);let Je;t[110]===n?Je=t[111]:(Je=Os(n),t[110]=n,t[111]=Je);let Ye=I===`identity`,Xe;t[112]!==j||t[113]!==N?(Xe=e=>{A(!1),j&&(M(!1),v(!0)),N&&(N({authenticated:!0,host:`github.com`,login:e.login}),P(null))},t[112]=j,t[113]=N,t[114]=Xe):Xe=t[114];let Ze;t[115]!==k||t[116]!==Ke||t[117]!==qe||t[118]!==Je||t[119]!==Ye||t[120]!==Xe?(Ze=(0,Z.jsx)(Ps,{open:k,onOpenChange:Ke,transport:qe,queryTransport:Je,identityPrompt:Ye,onSuccess:Xe}),t[115]=k,t[116]=Ke,t[117]=qe,t[118]=Je,t[119]=Ye,t[120]=Xe,t[121]=Ze):Ze=t[121];let Qe;t[122]===n?Qe=t[123]:(Qe=y3(n),t[122]=n,t[123]=Qe);let $e;t[124]===n?$e=t[125]:($e=Os(n),t[124]=n,t[125]=$e);let et;t[126]===n.dialog?et=t[127]:(et=()=>n.dialog.openFolder(),t[126]=n.dialog,t[127]=et);let tt;t[128]===Symbol.for(`react.memo_cache_sentinel`)?(tt=()=>{v(!1),L(`auth`),M(!0),A(!0)},t[128]=tt):tt=t[128];let nt;t[129]!==z||t[130]!==n?(nt=e=>{let{dir:t}=e;G(()=>(g(G3(t)),W3(n,t,`pick-existing`).finally(()=>g(null))),z({id:`iSnkwB`}))},t[129]=z,t[130]=n,t[131]=nt):nt=t[131];let rt;t[132]!==_||t[133]!==Qe||t[134]!==$e||t[135]!==et||t[136]!==nt?(rt=(0,Z.jsx)(S3,{open:_,onOpenChange:v,transport:Qe,authQueryTransport:$e,pickParentFolder:et,onSignIn:tt,onCloneComplete:nt}),t[132]=_,t[133]=Qe,t[134]=$e,t[135]=et,t[136]=nt,t[137]=rt):rt=t[137];let it;if(t[138]!==n){let e;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>new Promise(e=>{P(()=>e),A(!0)}),t[140]=e):e=t[140],it=_3({bridge:n,authQueryTransport:Os(n),cloneTransport:y3(n),openSignIn:e}),t[138]=n,t[139]=it}else it=t[139];let at;t[141]!==n||t[142]!==it?(at=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(P3,{bridge:n,cloneController:it})}),t[141]=n,t[142]=it,t[143]=at):at=t[143];let ot;return t[144]!==ye||t[145]!==Be||t[146]!==Ue||t[147]!==We||t[148]!==Ge||t[149]!==Ze||t[150]!==rt||t[151]!==at?(ot=(0,Z.jsxs)(`div`,{className:`relative flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[ve,ye,Be,Ve,He,Ue,We,Ge,Ze,rt,at]}),t[144]=ye,t[145]=Be,t[146]=Ue,t[147]=We,t[148]=Ge,t[149]=Ze,t[150]=rt,t[151]=at,t[152]=ot):ot=t[152],ot}function z3(e){return!e.missing}function B3(e){let t=(0,$.c)(14),{title:n,description:r,onClick:i,dataTestId:a,Icon:o}=e,s;t[0]===o?s=t[1]:(s=o?(0,Z.jsx)(o,{className:`size-4 shrink-0 text-muted-foreground`}):null,t[0]=o,t[1]=s);let c;t[2]===n?c=t[3]:(c=(0,Z.jsx)(`span`,{className:`font-medium text-foreground text-sm`,children:n}),t[2]=n,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(`span`,{className:`line-clamp-2 text-muted-foreground text-xs leading-snug`,children:r}),t[7]=r,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(X,{type:`button`,variant:`outline`,onClick:i,"data-testid":a,className:`h-auto flex-col items-start justify-start gap-1.5 whitespace-normal bg-card px-4 py-3.5 text-left`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}var V3=3;function H3(e){let t=(0,$.c)(36),{onPackSelect:n}=e,{_:r}=Dt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),c,l;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return(async()=>{try{let t=await Qy().listPacks();if(e)return;t.ok?a(t.packs):(console.error(`[NavigatorApp] listPacks returned error:`,t),a([]))}catch(t){let n=t;if(e)return;console.error(`[NavigatorApp] listPacks failed:`,n),a([])}})(),()=>{e=!0}},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,Q.useEffect)(c,l),i===null||i.length===0)return null;let u,d,f,p,m,h,g;if(t[2]!==n||t[3]!==i){let e=i.slice(0,V3);u=i.length-e.length,d=e=>{s(!1),n(e,i)},m=`flex flex-wrap items-center gap-x-3 gap-y-2`,h=`nav-starter-packs`,t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(J,{id:`C-xgad`})}),t[11]=g):g=t[11],f=`flex flex-wrap items-center gap-2`;let r;t[12]===d?r=t[13]:(r=e=>{let t=eb(e.id);return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,className:`rounded-full`,onClick:()=>d(e.id),"data-testid":`nav-pack-pill-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5 text-muted-foreground`}),e.name]},e.id)},t[12]=d,t[13]=r),p=e.map(r),t[2]=n,t[3]=i,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g}else u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10];let _;t[14]!==r||t[15]!==u||t[16]!==i.length?(_=u>0?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`rounded-full`,onClick:()=>s(!0),"aria-label":r({id:`e4FxjG`,values:{0:i.length}}),"data-testid":`nav-pack-more`,children:(0,Z.jsx)(J,{id:`B6Lac2`,values:{overflowCount:u}})}):null,t[14]=r,t[15]=u,t[16]=i.length,t[17]=_):_=t[17];let v;t[18]!==f||t[19]!==p||t[20]!==_?(v=(0,Z.jsxs)(`div`,{className:f,children:[p,_]}),t[18]=f,t[19]=p,t[20]=_,t[21]=v):v=t[21];let y;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Tn,{children:(0,Z.jsx)(J,{id:`tcjTlU`})}),t[22]=y):y=t[22];let b;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsxs)(kn,{children:[y,(0,Z.jsx)(wn,{children:(0,Z.jsx)(J,{id:`b6Fgpe`})})]}),t[23]=b):b=t[23];let x;t[24]!==i||t[25]!==d?(x=(0,Z.jsxs)(En,{className:`sm:max-w-3xl`,"data-testid":`nav-pack-picker`,children:[b,(0,Z.jsx)(Dn,{children:(0,Z.jsx)(tb,{packs:i,onPackSelect:d})})]}),t[24]=i,t[25]=d,t[26]=x):x=t[26];let S;t[27]!==o||t[28]!==x?(S=(0,Z.jsx)(An,{open:o,onOpenChange:s,children:x}),t[27]=o,t[28]=x,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==m||t[32]!==h||t[33]!==g||t[34]!==v?(C=(0,Z.jsxs)(`section`,{className:m,"data-testid":h,children:[g,v,S]}),t[30]=S,t[31]=m,t[32]=h,t[33]=g,t[34]=v,t[35]=C):C=t[35],C}function U3(e){let t=(0,$.c)(43),{project:n,branch:r,onOpen:i,onRemove:a}=e,{_:o}=Dt(),{name:s}=n,c=n.isLinkedWorktree===!0,l=c?n.branch??r:r,u=n.path,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(S_,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-muted-foreground`}),t[0]=d):d=t[0];let f;t[1]===n.name?f=t[2]:(f=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[1]=n.name,t[2]=f);let p;t[3]===c?p=t[4]:(p=c?(0,Z.jsxs)(Ud,{variant:`secondary`,className:`shrink-0 gap-1 rounded-full border-transparent bg-green-600/10 px-2 py-0 font-medium text-2xs text-green-800 dark:bg-green-400/10 dark:text-green-400`,children:[(0,Z.jsx)(To,{"aria-hidden":`true`,className:`size-2.5`}),(0,Z.jsx)(J,{id:`z-lawV`})]}):null,t[3]=c,t[4]=p);let m;t[5]!==f||t[6]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[f,p]}),t[5]=f,t[6]=p,t[7]=m):m=t[7];let h=c?n.mainRoot??``:n.path,g;t[8]!==c||t[9]!==n.mainRoot||t[10]!==n.path?(g=c?(0,Z.jsx)(J,{id:`PRnH8G`,values:{0:Tb(n.mainRoot??``)}}):n.path,t[8]=c,t[9]=n.mainRoot,t[10]=n.path,t[11]=g):g=t[11];let _;t[12]!==h||t[13]!==g?(_=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,title:h,children:g}),t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[d,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 truncate`,children:[m,_]})]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==n.path||t[19]!==l?(y=l==null?null:(0,Z.jsxs)(`span`,{className:`flex max-w-[40%] items-center gap-1 text-muted-foreground text-xs`,"data-testid":`nav-recent-branch-${n.path}`,children:[(0,Z.jsx)(To,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate font-mono`,children:l})]}),t[18]=n.path,t[19]=l,t[20]=y):y=t[20];let b;t[21]!==i||t[22]!==y||t[23]!==v?(b=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,onClick:i,className:`h-auto min-w-0 flex-1 justify-between gap-3 py-3.5 pl-4 pr-2 text-left hover:bg-transparent`,children:[v,y]}),t[21]=i,t[22]=y,t[23]=v,t[24]=b):b=t[24];let x;t[25]!==o||t[26]!==s?(x=o({id:`hDoLrm`,values:{projectName:s}}),t[25]=o,t[26]=s,t[27]=x):x=t[27];let S;t[28]===o?S=t[29]:(S=o({id:`Es-eZU`}),t[28]=o,t[29]=S);let C=`nav-recent-remove-${n.path}`,w;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(ju,{"aria-hidden":`true`}),t[30]=w):w=t[30];let T;t[31]!==a||t[32]!==x||t[33]!==S||t[34]!==C?(T=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":x,title:S,className:`pointer-events-none mr-2 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,"data-testid":C,children:w}),t[31]=a,t[32]=x,t[33]=S,t[34]=C,t[35]=T):T=t[35];let E;t[36]!==b||t[37]!==T?(E=(0,Z.jsxs)(`li`,{className:`group flex items-center justify-between rounded-lg hover:bg-accent`,children:[b,T]}),t[36]=b,t[37]=T,t[38]=E):E=t[38];let D;return t[39]!==a||t[40]!==n.path||t[41]!==E?(D=(0,Z.jsx)(zb,{path:u,onRemoveRecent:a,testIdPrefix:`nav-recent`,children:E}),t[39]=a,t[40]=n.path,t[41]=E,t[42]=D):D=t[42],D}async function W3(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}function G3(e){let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}var K3=(0,Q.lazy)(()=>n(()=>import(`./TerminalWindowApp-CntBjoWb.js`).then(e=>({default:e.TerminalWindowApp})),__vite__mapDeps([183,1,85,6,2,3,7,8,9,68,12,22,11,86,87,88,167,112,17,47,10,14,15,16,49,113,114,30,31,19,24,25,50,20,93,90,29,51,26,119,106,36,168,122,107,39,41,42,33,99,38,27,100,138,139,166,169,123,71,184,185]),import.meta.url));function q3(e){return e?.config.mode===`terminal`?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(K3,{bridge:e})}):e?.config.mode===`navigator`?(0,Z.jsx)(R3,{bridge:e}):(0,Z.jsx)(p3,{})}function J3(){let e=null,t=new Set,n=!1,r=null;function i(){for(let e of t)e()}function a(){e!==null&&(e=null,i())}return{install({bridge:t}){let o=t?.bugReport?.onCrashDetected;if(typeof o==`function`)return n?r??void 0:(n=!0,r=o(t=>{e=t,i()}),()=>{r?.(),r=null,n=!1,a()})},getSnapshot(){return e},subscribe(e){return t.add(e),()=>{t.delete(e)}},dismiss(){a()}}}var Y3=J3();function X3(e){return Y3.install(e)}function Z3(e){let t=(0,$.c)(7),{bridge:n}=e,r=(0,Q.useSyncExternalStore)(Y3.subscribe,Y3.getSnapshot);if(r===null)return null;let i;t[0]!==n.bugReport||t[1]!==r?(i=e=>{e||(n.bugReport.crashAck({eventId:r.eventId}),Y3.dismiss())},t[0]=n.bugReport,t[1]=r,t[2]=i):i=t[2];let a=n.config.mode===`navigator`,o;return t[3]!==r||t[4]!==i||t[5]!==a?(o=(0,Z.jsx)(Hh,{open:!0,onOpenChange:i,systemWide:a,crashInvite:r}),t[3]=r,t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var Q3=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=Jt(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(ss,{className:`size-4`}),info:(0,Z.jsx)(cl,{className:`size-4`}),warning:(0,Z.jsx)(Eu,{className:`size-4`}),error:(0,Z.jsx)(I_,{className:`size-4`}),loading:(0,Z.jsx)(ll,{className:`size-4 animate-spin`})},o={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={classNames:{toast:`cn-toast`}},t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsx)(Nu,{theme:i,className:`toaster group`,icons:a,style:o,toastOptions:s,...n}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c},$3=Symbol.for(`ok.client.fetchWrapper`);function e6(e={}){if(typeof window>`u`)return;let t=e.apiOrigin&&e.apiOrigin.length>0?e.apiOrigin:void 0;if(window.fetch[$3])return;let n=window.fetch.bind(window),r=Zd(),i=((e,i)=>{let a=n6(e,t);if(!a.isApi)return n(e,i);if(e instanceof Request){let t=t6(e.headers,r);return n(new Request(a.url,e),{headers:t})}let o=t6(i?.headers,r);return n(a.url,{...i,headers:o})});i[$3]=!0,window.fetch=i}function t6(e,t){let n=new Headers(e);for(let[e,r]of Object.entries(t))n.set(e,r);return n}function n6(e,t){if(typeof e==`string`){if(e.startsWith(`/api/`))return{isApi:!0,url:t?t+e:e};let n=r6(e);return n&&i6(n,t)?{isApi:!0,url:e}:{isApi:!1,url:e}}let n=e instanceof URL?e:r6(e.url,window.location.origin);if(n&&i6(n,t)){let r=e instanceof URL?e.href:e.url;return t&&(n.origin===window.location.origin||n.protocol===`file:`)?{isApi:!0,url:t+n.pathname+n.search+n.hash}:{isApi:!0,url:r}}return{isApi:!1,url:e instanceof URL?e.href:e.url}}function r6(e,t){try{return new URL(e,t)}catch{return null}}function i6(e,t){if(!e.pathname.startsWith(`/api/`))return!1;if(e.origin===window.location.origin||e.protocol===`file:`)return!0;if(t){let n=r6(t);if(n&&e.origin===n.origin)return!0}return!1}var a6=Symbol.for(`ok.client.logForwarder`),o6=2e3,s6=[`log`,`info`,`warn`,`error`],c6={log:`info`,info:`info`,warn:`warn`,error:`error`};function l6(e){if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function u6(e){let t=e.message.length+80;if(e.event&&(t+=e.event.length),e.fields)try{t+=JSON.stringify(e.fields).length}catch{}return t}function d6(e={}){let t=e.windowObj??(typeof window<`u`?window:void 0);if(!t||t.okDesktop)return;let n=t;if(n[a6])return;n[a6]=!0;let r=e.consoleObj??console,i=e.documentObj===void 0?typeof document<`u`?document:null:e.documentObj,a=e.flushIntervalMs??o6,o=e.fetchImpl??n.fetch.bind(n),s=e.now??Date.now,c=[],l=0,u=null,d=!1,f=0,p={log:r.log.bind(r),info:r.info.bind(r),warn:r.warn.bind(r),error:r.error.bind(r)};function m(){if(u!==null&&(clearTimeout(u),u=null),c.length===0)return;let e=c.splice(0,100);l=0;let t=f;d=!0;try{o(`/api/client-logs`,{method:`POST`,headers:{"content-type":`application/json`},keepalive:!0,body:JSON.stringify(t>0?{entries:e,droppedSinceLastFlush:t}:{entries:e})}).then(n=>{n.ok?f=Math.max(0,f-t):f+=e.length},()=>{f+=e.length})}catch{f+=e.length}finally{d=!1}}function h(e){if(c.push(e),l+=u6(e),c.length>100){let e=c.shift();e&&(l-=u6(e),f+=1)}if(c.length>=100||l>=32768){m();return}u===null&&(u=setTimeout(m,a))}function g(e,t){if(!d)try{let n=ra(_a(t.map(l6).join(` `))),r=t[0],i=typeof r==`string`&&r.length<=32768?r:void 0,a=i?Qi(i):null,o=a?.fields;if(o)try{JSON.stringify(o).length>8192&&(o=void 0)}catch{o=void 0}h({level:e,message:n,ts:s(),...a?.event?{event:a.event}:{},...o?{fields:o}:{}})}catch{}}for(let e of s6)r[e]=(...t)=>{p[e](...t),g(c6[e],t)};let _=e=>{if(d)return;let t=e;g(`error`,[`uncaught error: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`])},v=e=>{d||g(`error`,[`unhandledrejection: ${l6(e.reason)}`])},y=()=>m(),b=()=>{i&&i.visibilityState===`hidden`&&m()};n.addEventListener(`error`,_),n.addEventListener(`unhandledrejection`,v),n.addEventListener(`pagehide`,y),i&&i.addEventListener(`visibilitychange`,b);function x(){for(let e of s6)r[e]=p[e];n.removeEventListener(`error`,_),n.removeEventListener(`unhandledrejection`,v),n.removeEventListener(`pagehide`,y),i&&i.removeEventListener(`visibilitychange`,b),u!==null&&(clearTimeout(u),u=null),c.length=0,delete n[a6]}return{flushNow:m,uninstall:x}}function f6(e,t){return e.branch===void 0||e.branch===null||e.branch===``||t===``||e.multiCandidate!==!0?null:{message:`Opened on branch ${e.branch}`,description:t}}function p6(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e}),r=e.emitToast??((e,t)=>{Mu(e,t)});return t.onDeepLink(e=>{let i=e.kind??`doc`,a={kind:i,path:e.doc,branch:e.branch??null};if(e.targetMissing===!0){dl.arm(a);return}Sc.arm(a),n(Pd(i,e.doc,i===`doc`?e.branch:void 0));let o=f6(e,t.config.projectPath);o!==null&&r(o.message,{description:o.description,duration:3e3})})}var m6=4e3,h6=1440*60*1e3;function g6(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){Mu.success(`Opened existing OpenKnowledge project at ${e.ancestorPath}`,{duration:m6});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>Co[e]??e).join(`, `);t.push(`repaired ${n} MCP integration`)}else e.mcp.status===`failed`&&t.push(`MCP auto-repair failed`);e.path.status===`installed`&&t.push(e.path.summary),e.path.status===`failed`&&t.push(`PATH install failed: ${e.path.summary}`);let n=t.length>0?t.join(`; `):`OpenKnowledge integrations checked.`,r=e.mcp.status===`failed`||e.path.status===`failed`,i=e.path.status!==`none`;Mu[r?`error`:`success`](n,{duration:r||i?h6:m6,position:`bottom-left`});return}if(e.kind===`sharing-refused-tracked`){Mu.error(`Config sharing unchanged: ${e.tracked.length} OK file(s) tracked upstream — see message below.`,{duration:h6,description:e.remediation});return}if(e.kind===`sharing-no-git`){Mu.warning(`Local-only requested but no git repository was created. Switch later via Settings → Config sharing once the project is in a git repo.`,{duration:m6});return}let t=Iu(e.gitRoot,e.pickedPath)??e.pickedPath;Mu.success(`Initialized OpenKnowledge at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:m6})})}function _6(e){return zu._({id:`wXw19Y`,values:{projectName:e}})}function v6(e){let t=e.bridge;if(t)return t.onRecentRemovedMissing(({projectName:e})=>{Mu(_6(e))})}function y6(e){let t=(0,$.c)(18),{body:n,warning:r,restartLabel:i,cancelLabel:a,onRestart:o,onDismiss:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Eu,{className:`mt-0.5 size-4 shrink-0 text-amber-500`}),t[0]=c):c=t[0];let l;t[1]===n?l=t[2]:(l=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:n}),t[1]=n,t[2]=l);let u;t[3]===r?u=t[4]:(u=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r}),t[3]=r,t[4]=u);let d;t[5]!==o||t[6]!==i?(d=(0,Z.jsx)(X,{size:`sm`,onClick:o,children:i}),t[5]=o,t[6]=i,t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==s?(f=(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:s,children:a}),t[8]=a,t[9]=s,t[10]=f):f=t[10];let p;t[11]!==d||t[12]!==f?(p=(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==l||t[15]!==u||t[16]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex w-full gap-3 rounded-lg border bg-popover p-4 text-popover-foreground shadow-lg`,children:[c,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[l,u,p]})]}),t[14]=l,t[15]=u,t[16]=p,t[17]=m):m=t[17],m}function b6(){return zu._({id:`f_PkYv`})}function x6(e){return e.serverRuntime===e.appRuntime?zu._({id:`FWQuPE`,values:{0:e.appRuntime}}):e.relation===`older`?zu._({id:`LhQlGR`,values:{0:e.serverRuntime,1:e.appRuntime}}):zu._({id:`yZmvQ4`,values:{0:e.serverRuntime,1:e.appRuntime}})}function S6(e){return zu._({id:`2YOwme`,values:{appRuntime:e}})}function C6(e){return e===`eperm`?zu._({id:`uQewpR`}):zu._({id:`PqYWiC`})}async function w6(e){let t=Mu.loading(zu._({id:`Kf7GG5`}),{duration:1/0}),n;try{n=await e.restartServer(e.config.projectPath)}catch{return}Mu.dismiss(t),n.ok===!1&&Mu.error(C6(n.reason),{duration:1/0})}function T6(e){let t=e.bridge;if(!t)return;let n=t.onServerVersionDrift(e=>{Mu.custom(n=>(0,Q.createElement)(y6,{body:x6(e),warning:b6(),restartLabel:zu._({id:`ppDgFi`}),cancelLabel:zu._({id:`PBxg_E`}),onRestart:()=>{Mu.dismiss(n),w6(t)},onDismiss:()=>Mu.dismiss(n)}),{duration:1/0})}),r=t.onServerRestarted(e=>{Mu.success(S6(e.appRuntime))});return()=>{n(),r()}}async function E6(e=typeof navigator<`u`?navigator:void 0){try{let t=e?.storage;return t===void 0||typeof t.persist!=`function`?!1:await t.persist()}catch{return!1}}function D6(e){let{initialDoc:t}=e;if(!t)return;let n=e.getHash();n!==``&&n!==`#`&&n!==`#/`||e.setHash(Bd(t))}function O6(){typeof window>`u`||!window.okDesktop||D6({initialDoc:window.okDesktop.config.initialDoc,getHash:()=>window.location.hash,setHash:e=>{window.location.hash=e}})}nh(),n(()=>import(`./telemetry-startup-Cy1VVosp.js`).then(e=>e.initStartupTrace()),__vite__mapDeps([186,0,1,2,3,4,67,22,12,11]),import.meta.url),e6({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),d6(),E6(),dA()&&_A(),kV(),KO(),Zz(),Lz(),dR(),typeof window<`u`&&p6({bridge:window.okDesktop}),typeof window<`u`&&T6({bridge:window.okDesktop}),typeof window<`u`&&v6({bridge:window.okDesktop}),typeof window<`u`&&$m({bridge:window.okDesktop}),typeof window<`u`&&Fu({bridge:window.okDesktop}),typeof window<`u`&&g6({bridge:window.okDesktop}),typeof window<`u`&&th({bridge:window.okDesktop}),typeof window<`u`&&X3({bridge:window.okDesktop}),O6();var k6=new ch({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),A6=document.getElementById(`root`);if(!A6)throw Error(`Root element not found`);var j6=typeof window>`u`?void 0:window.okDesktop;function M6(){return vi(),null}(0,lh.createRoot)(A6).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(Ot,{i18n:zu,children:(0,Z.jsxs)(zt,{client:k6,children:[(0,Z.jsx)(Jg,{}),(0,Z.jsxs)(Yt,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(M6,{}),(0,Z.jsxs)(yn,{children:[(0,Z.jsx)(Wg,{children:q3(j6)}),j6!==void 0&&(0,Z.jsx)(Kg,{children:(0,Z.jsx)(Z3,{bridge:j6})})]}),(0,Z.jsx)(Q3,{richColors:!0,closeButton:!0})]})]})})}));export{eH as t};