@inkeep/open-knowledge 0.87.6 → 0.87.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 (188) hide show
  1. package/dist/assets/skills/project/SKILL.md +1 -1
  2. package/dist/assets/skills/project/references/conflict-resolution.md +1 -1
  3. package/dist/assets/skills/project/references/doc-editing.md +1 -1
  4. package/dist/cli.mjs +72 -72
  5. package/dist/constants-BrcY9KEq.mjs +1 -0
  6. package/dist/dist-Be8q4E8P.mjs +2224 -0
  7. package/dist/{dist-Bahmzpn7.mjs → dist-CAVfTttU.mjs} +1 -1
  8. package/dist/index.mjs +248 -248
  9. package/dist/{init-CMq3nWYa.mjs → init-BezWk0T8.mjs} +41 -41
  10. package/dist/init-CoOXWehu.mjs +1 -0
  11. package/dist/{launch-json-removal-nTBFtHl-.mjs → launch-json-removal-qxuwihGl.mjs} +1 -1
  12. package/dist/{loader-3RybSKD0.mjs → loader-CZbIslv_.mjs} +1 -1
  13. package/dist/loader-D9-GaZET.mjs +1 -0
  14. package/dist/{md-manager-BGnqyqi1-BeOFzphu.mjs → md-manager-BGnqyqi1-CU8xHS4D.mjs} +169 -169
  15. package/dist/{open-browser-CtoHi9I1.mjs → open-browser-BBYzWw_v.mjs} +1 -1
  16. package/dist/parse-worker.mjs +1 -1
  17. package/dist/preview-DRHbqMtM.mjs +1 -0
  18. package/dist/{preview-DM8Y8VM9.mjs → preview-j1VO7kT-.mjs} +1 -1
  19. package/dist/public/assets/{AccountSection-BoccBfx6.js → AccountSection-BC8vWAp1.js} +1 -1
  20. package/dist/public/assets/{ActivityModeContent-CNPnra1u.js → ActivityModeContent-B37mdeyp.js} +1 -1
  21. package/dist/public/assets/{AddPropertiesButton-DBmLjAsi.js → AddPropertiesButton-BHdiLVFW.js} +2 -2
  22. package/dist/public/assets/{AgentConnectionsSection-CFTMQXUz.js → AgentConnectionsSection-CIV6IvM9.js} +1 -1
  23. package/dist/public/assets/{AgentDiffPane-CwXg1_JA.js → AgentDiffPane-Dx5xGTXw.js} +1 -1
  24. package/dist/public/assets/{AttachmentsSection-Cb-AQ8gb.js → AttachmentsSection-tQg6H924.js} +1 -1
  25. package/dist/public/assets/{AuthModal-CDv9Ka9d.js → AuthModal-BF2Z7OJL.js} +1 -1
  26. package/dist/public/assets/{CodeMirrorPropInput-BylEaDRS.js → CodeMirrorPropInput-D-R5m5uK.js} +2 -2
  27. package/dist/public/assets/{ContentRulesSection-CybFuqi0.js → ContentRulesSection-BatV3WIb.js} +1 -1
  28. package/dist/public/assets/{DiffViewBoundary-DS5sFg8l.js → DiffViewBoundary-Ct8EAcvE.js} +1 -1
  29. package/dist/public/assets/{DocumentContext-CUqscNM0.js → DocumentContext-Cd2rvAGk.js} +3 -3
  30. package/dist/public/assets/{EditorModeToggle-Dkkd8RQ0.js → EditorModeToggle-B0P_UWwo.js} +1 -1
  31. package/dist/public/assets/{ExcalidrawDocEditor--5ZtW451.js → ExcalidrawDocEditor-BxgWr5MA.js} +1 -1
  32. package/dist/public/assets/FeedbackForm-Cpl9YQGV.js +1 -0
  33. package/dist/public/assets/{GraphPanel-BqNuC1PH.js → GraphPanel-Cjjh0X-I.js} +2 -2
  34. package/dist/public/assets/{ImportSkillDialog-3UdvnRCe.js → ImportSkillDialog-ClWgRmf0.js} +1 -1
  35. package/dist/public/assets/{LinkPreviewsSection-BTDA2atC.js → LinkPreviewsSection-LV_2P8LT.js} +1 -1
  36. package/dist/public/assets/{LintConfigEditor-Bd8kaAgh.js → LintConfigEditor-B6LUeaZb.js} +1 -1
  37. package/dist/public/assets/{LintingSection-DUMuHerm.js → LintingSection-BKrL48Dz.js} +1 -1
  38. package/dist/public/assets/ManagedArtifactProperties-1FTS2_7Z.js +1 -0
  39. package/dist/public/assets/ManagedArtifactProperties-DiQvC3oG.js +1 -0
  40. package/dist/public/assets/{McpConsentDialogBody-xbsziJ8M.js → McpConsentDialogBody-T-AsMqAM.js} +1 -1
  41. package/dist/public/assets/{MermaidDocEditor-CqqLk_Mh.js → MermaidDocEditor-G-4SHjdp.js} +1 -1
  42. package/dist/public/assets/{NetworkAccessSection-BFSyRt3w.js → NetworkAccessSection-C1tHGCJv.js} +1 -1
  43. package/dist/public/assets/{OkignoreSection-CQywQkmc.js → OkignoreSection-CRFoJuYb.js} +1 -1
  44. package/dist/public/assets/{ProjectTemplatesSection-BtUwaSYs.js → ProjectTemplatesSection-WddJ1lhc.js} +1 -1
  45. package/dist/public/assets/{PropertyDisplayRow-B2fYD10U.js → PropertyDisplayRow-BqggxEaP.js} +2 -2
  46. package/dist/public/assets/{PublishToGitHubDialog-D3zz0mDr.js → PublishToGitHubDialog--6tR_4M4.js} +1 -1
  47. package/dist/public/assets/{RegisteredAgentIcon-B0qjAvei.js → RegisteredAgentIcon-Bq2z3oRf.js} +1 -1
  48. package/dist/public/assets/{SchemaConfigEditor-BPwXrf5p.js → SchemaConfigEditor-BsSLbnJv.js} +1 -1
  49. package/dist/public/assets/{SearchSection-DtTQQspB.js → SearchSection-NI0n3J72.js} +1 -1
  50. package/dist/public/assets/{SessionsHost-FipBtqUM.js → SessionsHost-DsikeGuj.js} +2 -2
  51. package/dist/public/assets/{SettingsDialogBody-1SBj7m-H.js → SettingsDialogBody-4FNAhHR9.js} +2 -2
  52. package/dist/public/assets/{ShareReceiveMissDialog-BbsAB4Zm.js → ShareReceiveMissDialog-CMuF7vzy.js} +1 -1
  53. package/dist/public/assets/{SkillCostValue-DK-VfwfI.js → SkillCostValue-DDhTa5Kn.js} +1 -1
  54. package/dist/public/assets/{SkillEditBanner-BYQhRIjd.js → SkillEditBanner-1xI4AWZN.js} +1 -1
  55. package/dist/public/assets/{SkillForkDialog-Cp2VfBKT.js → SkillForkDialog-BcgrUab0.js} +1 -1
  56. package/dist/public/assets/{SkillInstallMenu-CsSIF4d7.js → SkillInstallMenu-f08QXFO6.js} +1 -1
  57. package/dist/public/assets/SkillModeBanner-DJo427go.js +1 -0
  58. package/dist/public/assets/{SkillOriginInline-DXmcEqEw.js → SkillOriginInline-BQhnp-U4.js} +1 -1
  59. package/dist/public/assets/{SkillPluginBundleDialog-D8f_Pygy.js → SkillPluginBundleDialog-AajGslYO.js} +1 -1
  60. package/dist/public/assets/{SkillToolbarControls-BqMhdWz_.js → SkillToolbarControls-CuHFgseT.js} +1 -1
  61. package/dist/public/assets/{SkillsManagerSection-BQ6eCTsP.js → SkillsManagerSection-cOVbfp1s.js} +1 -1
  62. package/dist/public/assets/{SlidesPluginSection-dXy1hGNp.js → SlidesPluginSection-CayFA0zh.js} +1 -1
  63. package/dist/public/assets/{SlidesToolbarControls-DXn_DkWH.js → SlidesToolbarControls-BTg9RQ0D.js} +1 -1
  64. package/dist/public/assets/{SourceEditor-DolwFQ_n.js → SourceEditor-Bh7rDwRA.js} +1 -1
  65. package/dist/public/assets/{SpellingSettings-Bqz9pslj.js → SpellingSettings-C3gKNkGi.js} +1 -1
  66. package/dist/public/assets/{SyncSection-X92LOabz.js → SyncSection-ZuqAUuwo.js} +1 -1
  67. package/dist/public/assets/{SyncStatusBadge-MYUQfkav.js → SyncStatusBadge-CoVcDuOz.js} +1 -1
  68. package/dist/public/assets/{TemplateRow-CQTK4uJX.js → TemplateRow-B1g-a4Pw.js} +2 -2
  69. package/dist/public/assets/{TerminalLaunchContext-VC_1IQ2O.js → TerminalLaunchContext-CGtoVZtX.js} +1 -1
  70. package/dist/public/assets/{TerminalPanel-DYxs61YB.js → TerminalPanel-COTcQZbU.js} +1 -1
  71. package/dist/public/assets/{TerminalSection-DBkXMZL1.js → TerminalSection-cofgZ9pJ.js} +1 -1
  72. package/dist/public/assets/{TerminalWindowApp-gfW7MU1G.js → TerminalWindowApp-CEiPsUTe.js} +1 -1
  73. package/dist/public/assets/{TextDocEditor-BS99jSE3.js → TextDocEditor-CQ3aeIrD.js} +1 -1
  74. package/dist/public/assets/ThemePluginSection-Dhue16Q2.js +6 -0
  75. package/dist/public/assets/{ThreadView-Bxd_Y88x.js → ThreadView-BhXVLga9.js} +1 -1
  76. package/dist/public/assets/{TimelineDiffPane-CggwMmmO.js → TimelineDiffPane-NcJINcU8.js} +1 -1
  77. package/dist/public/assets/{_envelope-q8XHEv4O-C-Qnl5Tu.js → _envelope-aSbxdSNI-BbmN1FUH.js} +1 -1
  78. package/dist/public/assets/{agent-connections-BdU_6bUV.js → agent-connections-DOlRC9J4.js} +1 -1
  79. package/dist/public/assets/{agent-registry-BdHe0AEQ.js → agent-registry-Dw7Mum0u.js} +1 -1
  80. package/dist/public/assets/{bridge-BMIee44l.js → bridge-C-lLcgzt.js} +3 -3
  81. package/dist/public/assets/{calendar-B0urmsQ1.js → calendar-aomRwj8d.js} +1 -1
  82. package/dist/public/assets/{catalog-CEXii1s5.js → catalog-BNmmHvVJ.js} +1 -1
  83. package/dist/public/assets/{client-version-t-JbjjxV.js → client-version-Cuk7lASh.js} +1 -1
  84. package/dist/public/assets/{comment-chips-DlClgeJp.js → comment-chips-CtNOFJws.js} +1 -1
  85. package/dist/public/assets/{config-provider-Czqe_ZMN.js → config-provider-D1SI9gJy.js} +1 -1
  86. package/dist/public/assets/config-schema-GlF078Yz.js +1 -0
  87. package/dist/public/assets/{css-color-to-hex-Csde6-Qs.js → css-color-to-hex-Cnqvo0uF.js} +1 -1
  88. package/dist/public/assets/{doc-undo-manager-CbhM5c-w.js → doc-undo-manager-DiIW3uXv.js} +1 -1
  89. package/dist/public/assets/{field-controls-D31F23S8.js → field-controls-BwRnSCqe.js} +1 -1
  90. package/dist/public/assets/field-controls-OOVz_aSI.js +1 -0
  91. package/dist/public/assets/{handoff-DzPPe6fp.js → handoff-BDTTOcb6.js} +1 -1
  92. package/dist/public/assets/{ime-composition-B56Lnl92.js → ime-composition-C6RElBur.js} +1 -1
  93. package/dist/public/assets/index-8aCY7EBp.js +2209 -0
  94. package/dist/public/assets/{lint-config-client-CLttd-hM.js → lint-config-client-CkU0vqu3.js} +1 -1
  95. package/dist/public/assets/{lint-plugins-CGhNlBxc.js → lint-plugins-DVmKLhH2.js} +1 -1
  96. package/dist/public/assets/{markdown-lint-wCP_bSbs.js → markdown-lint-BDbIoz4f.js} +3 -3
  97. package/dist/public/assets/{markdownlint-rule-browser-nIryvJXe.js → markdownlint-rule-browser-B7stW6Oh.js} +1 -1
  98. package/dist/public/assets/messages--ehzGEyL.js +1 -0
  99. package/dist/public/assets/messages-BY8vnrN5.js +1 -0
  100. package/dist/public/assets/messages-BsaUfgyT.js +1 -0
  101. package/dist/public/assets/messages-C3jyZ-tQ.js +1 -0
  102. package/dist/public/assets/messages-CRaWmTK3.js +1 -0
  103. package/dist/public/assets/messages-CjxzZ_an.js +1 -0
  104. package/dist/public/assets/messages-D9Q_Zb27.js +1 -0
  105. package/dist/public/assets/messages-Di5PZudR.js +1 -0
  106. package/dist/public/assets/messages-Dt7AN68O.js +1 -0
  107. package/dist/public/assets/messages-SQ_HVqr-.js +1 -0
  108. package/dist/public/assets/messages-VFA4QUBO.js +1 -0
  109. package/dist/public/assets/messages-kSFbJVg5.js +1 -0
  110. package/dist/public/assets/messages-mX7CV8Xh.js +1 -0
  111. package/dist/public/assets/{pending-receive-nav-store-D3GdSDoW.js → pending-receive-nav-store-CBBjDNkd.js} +1 -1
  112. package/dist/public/assets/{preferred-session-events-CgmuJluh.js → preferred-session-events-BgwYtkI6.js} +1 -1
  113. package/dist/public/assets/{progress-DSTt93jH.js → progress-BxLURPwv.js} +1 -1
  114. package/dist/public/assets/{saved-themes-client-BPWMEtsb.js → saved-themes-client-B3RNutYm.js} +1 -1
  115. package/dist/public/assets/{schema-section-Ceiv9_HZ.js → schema-section-B7Ec9YkJ.js} +1 -1
  116. package/dist/public/assets/{schemas-api-CL5ZXlEj.js → schemas-api-DYoYU1Zh.js} +2 -2
  117. package/dist/public/assets/{selection-context-DDzIsV4R.js → selection-context-BEBCUDdv.js} +1 -1
  118. package/dist/public/assets/{skills-api-DjykKWn7.js → skills-api-DPNzK8ks.js} +1 -1
  119. package/dist/public/assets/{src-WuWF2bZL.js → src-CtGzYG_O.js} +1 -1
  120. package/dist/public/assets/storage-scope-D82mTrBx.js +1 -0
  121. package/dist/public/assets/{tag-pill-input-D_fe_Zbo.js → tag-pill-input-CHT8aIYs.js} +1 -1
  122. package/dist/public/assets/{telemetry-impl-wSSCAdRc.js → telemetry-impl-sLhzQJdK.js} +1 -1
  123. package/dist/public/assets/{telemetry-startup-Cgub3Wcm.js → telemetry-startup-Cm52AVbe.js} +1 -1
  124. package/dist/public/assets/terminal-cli-display-B__FxqFM.js +1 -0
  125. package/dist/public/assets/{terminal-command-events-h-p66odT.js → terminal-command-events-DEYKqKZt.js} +1 -1
  126. package/dist/public/assets/{terminal-launch-events-3vnER_eI.js → terminal-launch-events-Bg7uGfvu.js} +1 -1
  127. package/dist/public/assets/{typing-burst-detector-BBhFoOzd.js → typing-burst-detector-Bhb9juM1.js} +1 -1
  128. package/dist/public/assets/{uninstall-DyYmGM9i.js → uninstall-DizefbDX.js} +1 -1
  129. package/dist/public/assets/{use-activity-panel-qHwa4JTF.js → use-activity-panel-B75oeFRc.js} +1 -1
  130. package/dist/public/assets/{use-apply-config-color-theme-Bpi7AD0s.js → use-apply-config-color-theme-KcqN_kbT.js} +2 -2
  131. package/dist/public/assets/{use-apply-config-language-DlSviEmN.js → use-apply-config-language-CbiUoguW.js} +2 -2
  132. package/dist/public/assets/{use-conflicts-CIjDyM9c.js → use-conflicts-2mx0_ZrI.js} +1 -1
  133. package/dist/public/assets/{use-live-xterm-theme-BJbDRXxo.js → use-live-xterm-theme-BD2co7eQ.js} +1 -1
  134. package/dist/public/assets/{use-open-skill-3tDIxH_z.js → use-open-skill-CHWiVY7J.js} +1 -1
  135. package/dist/public/assets/{use-semantic-search-status-D9HCPCCa.js → use-semantic-search-status-DdF3HjO-.js} +1 -1
  136. package/dist/public/assets/{use-skill-origin-CiJpOXFq.js → use-skill-origin-DKeppfSH.js} +1 -1
  137. package/dist/public/assets/{use-skill-targets-EVebu2kh.js → use-skill-targets-DuCl3F30.js} +1 -1
  138. package/dist/public/assets/{use-skills-BWAh3dDS.js → use-skills-BxAjFPL9.js} +1 -1
  139. package/dist/public/assets/{use-terminal-enabled-DodRuzTa.js → use-terminal-enabled-DNrizf3g.js} +1 -1
  140. package/dist/public/assets/{use-timeline-entry-diff-Bc_-dfRX.js → use-timeline-entry-diff-BdEsfiuE.js} +1 -1
  141. package/dist/public/assets/{use-workspace-h2j0Puyv.js → use-workspace-CFQdH1aL.js} +1 -1
  142. package/dist/public/index.html +60 -60
  143. package/dist/public/uninstall.html +3 -3
  144. package/dist/{registry-probes-BPfJ5Mbm.mjs → registry-probes-DofBspPH.mjs} +7 -7
  145. package/dist/{removal-file-path-BPtBJty1.mjs → removal-file-path-BIGm6W-u.mjs} +1 -1
  146. package/dist/{repair-launch-json-CJiDy3Uu.mjs → repair-launch-json-CsWnJUor.mjs} +1 -1
  147. package/dist/{repair-mcp-configs-B06-_Z2n.mjs → repair-mcp-configs-BNISibbr.mjs} +1 -1
  148. package/dist/src-CFxG8xiN.mjs +1 -0
  149. package/dist/{src-BMqbglGv.mjs → src-GWKoGWtT.mjs} +6 -6
  150. package/dist/{start-CfKiNaO-.mjs → start-Cj4MmnfB.mjs} +3 -3
  151. package/dist/start-SYFsRNxh.mjs +1 -0
  152. package/package.json +4 -4
  153. package/dist/constants-CL8sDEOf.mjs +0 -1
  154. package/dist/dist-BCgS3tMP.mjs +0 -2220
  155. package/dist/init-CoLgNutq.mjs +0 -1
  156. package/dist/loader-DdkMZk2A.mjs +0 -1
  157. package/dist/preview-lYuQVTsq.mjs +0 -1
  158. package/dist/public/assets/FeedbackForm-a6rCXxKK.js +0 -1
  159. package/dist/public/assets/ManagedArtifactProperties-BS1cxvbW.js +0 -1
  160. package/dist/public/assets/ManagedArtifactProperties-CmyuawfQ.js +0 -1
  161. package/dist/public/assets/SkillModeBanner-CmfPlHVL.js +0 -1
  162. package/dist/public/assets/ThemePluginSection-DyuaEmFe.js +0 -6
  163. package/dist/public/assets/config-schema-gPKGwQR7.js +0 -1
  164. package/dist/public/assets/field-controls-BpWrodXJ.js +0 -1
  165. package/dist/public/assets/index-Cg57di3n.js +0 -2209
  166. package/dist/public/assets/messages-BDCxJPx2.js +0 -1
  167. package/dist/public/assets/messages-BEW0uPVX.js +0 -1
  168. package/dist/public/assets/messages-BO-eBk9m.js +0 -1
  169. package/dist/public/assets/messages-BaDp2_Fp.js +0 -1
  170. package/dist/public/assets/messages-CDO-xexo.js +0 -1
  171. package/dist/public/assets/messages-CRHWN_nJ.js +0 -1
  172. package/dist/public/assets/messages-CVuWmrbN.js +0 -1
  173. package/dist/public/assets/messages-C_w7Btlk.js +0 -1
  174. package/dist/public/assets/messages-CtVlTdzP.js +0 -1
  175. package/dist/public/assets/messages-Cz11LTJA.js +0 -1
  176. package/dist/public/assets/messages-D3qz2TwL.js +0 -1
  177. package/dist/public/assets/messages-DHXe_6Gj.js +0 -1
  178. package/dist/public/assets/messages-DKWtuhsU.js +0 -1
  179. package/dist/public/assets/storage-scope-GPc8n3Ml.js +0 -1
  180. package/dist/public/assets/terminal-cli-display-nVuidfOl.js +0 -1
  181. package/dist/src-BzIV2zM8.mjs +0 -1
  182. package/dist/start-CCX8sVBo.mjs +0 -1
  183. /package/dist/public/assets/{DeleteConfirmationDialog-B0lltyMh.js → DeleteConfirmationDialog-BsTU-OWm.js} +0 -0
  184. /package/dist/public/assets/{alert-RmVFIy8D.js → alert-Bb4K23ol.js} +0 -0
  185. /package/dist/public/assets/{folder-config-api-BDhEYA86.js → folder-config-api-oMYXBtrq.js} +0 -0
  186. /package/dist/public/assets/{format-CJ1bI5np.js → format-eyy9pWAn.js} +0 -0
  187. /package/dist/public/assets/{settings-section-labels-VKfUFuEe.js → settings-section-labels-DX7VF2VJ.js} +0 -0
  188. /package/dist/public/assets/{sortable.esm-CFAacZUM.js → sortable.esm-CtrUfCv8.js} +0 -0
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t,r as n}from"./dist-Nvb76hAm.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{t as i}from"./label-CvMpFFbN.js";import{i as a,n as o,o as s,s as c,t as l}from"./select-pACXgFe2.js";import{t as u}from"./switch-BKZTXkzu.js";import{n as d}from"./dist-BGzUo_18.js";import{n as f}from"./config-errors-DDAH9fqy.js";import{i as p}from"./use-apply-config-theme-CYFG76sS.js";import"./config-provider-Czqe_ZMN.js";import"./saved-themes-client-BPWMEtsb.js";import"./markdown-lint-wCP_bSbs.js";import{t as m}from"./SettingsSectionHeader-BKhNIRp2.js";var h=r(),g=e();function _(){let e=(0,h.c)(40),{_:r}=n(),{projectConfig:_,projectSynced:v,projectBinding:y}=p(),b=v&&y!==null,x=_?.validation?.links??`warning`,S=_?.validation?.fileTreeIndicators!==!1,C=_?.validation?.suppressLogLinkAdvisories??!0,w;e[0]!==r||e[1]!==y?(w=function(e){if(y===null){d.error(r({id:`dVaXnv`}));return}let t=y.patch({validation:e});t.ok||d.error(r({id:`NrFwux`,values:{0:f(t.error)}}))},e[0]=r,e[1]=y,e[2]=w):w=e[2];let T=w,E;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,g.jsx)(t,{id:`OPOiKn`}),e[3]=E):E=e[3];let D;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,g.jsx)(m,{titleId:`settings-content-rules-title`,title:E,scope:`project`,level:`block`,children:(0,g.jsx)(t,{id:`ge05IJ`})}),e[4]=D):D=e[4];let O;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,g.jsx)(i,{htmlFor:`settings-content-rules-links`,className:`text-sm font-medium`,children:(0,g.jsx)(t,{id:`8ruqQi`})}),e[5]=O):O=e[5];let k;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,g.jsxs)(`div`,{className:`min-w-0`,children:[O,(0,g.jsx)(`p`,{id:`settings-content-rules-links-description`,className:`text-1sm text-muted-foreground`,children:(0,g.jsx)(t,{id:`iqr14Z`})})]}),e[6]=k):k=e[6];let A;e[7]===T?A=e[8]:(A=e=>T({links:e}),e[7]=T,e[8]=A);let j=!b,M;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,g.jsx)(s,{id:`settings-content-rules-links`,"aria-describedby":`settings-content-rules-links-description`,className:`w-36 shrink-0`,"data-testid":`settings-content-rules-links`,children:(0,g.jsx)(c,{})}),e[9]=M):M=e[9];let N;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,g.jsx)(a,{value:`off`,children:(0,g.jsx)(t,{id:`Nwbs0q`})}),e[10]=N):N=e[10];let P;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,g.jsx)(a,{value:`warning`,children:(0,g.jsx)(t,{id:`r6y-jM`})}),e[11]=P):P=e[11];let F;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,g.jsxs)(o,{children:[N,P,(0,g.jsx)(a,{value:`error`,children:(0,g.jsx)(t,{id:`SlfejT`})})]}),e[12]=F):F=e[12];let I;e[13]!==x||e[14]!==A||e[15]!==j?(I=(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-3`,children:[k,(0,g.jsxs)(l,{value:x,onValueChange:A,disabled:j,children:[M,F]})]}),e[13]=x,e[14]=A,e[15]=j,e[16]=I):I=e[16];let L;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,g.jsx)(i,{htmlFor:`settings-content-rules-log-links`,className:`text-sm font-medium`,children:(0,g.jsx)(t,{id:`ea7AYn`})}),e[17]=L):L=e[17];let R;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,g.jsxs)(`div`,{className:`min-w-0`,children:[L,(0,g.jsx)(`p`,{id:`settings-content-rules-log-links-description`,className:`text-1sm text-muted-foreground`,children:(0,g.jsx)(t,{id:`nnhrHd`})})]}),e[18]=R):R=e[18];let z=!b,B;e[19]===T?B=e[20]:(B=e=>T({suppressLogLinkAdvisories:e}),e[19]=T,e[20]=B);let V;e[21]!==C||e[22]!==z||e[23]!==B?(V=(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-3`,children:[R,(0,g.jsx)(u,{id:`settings-content-rules-log-links`,"aria-describedby":`settings-content-rules-log-links-description`,checked:C,disabled:z,onCheckedChange:B,"data-testid":`settings-content-rules-log-links`})]}),e[21]=C,e[22]=z,e[23]=B,e[24]=V):V=e[24];let H;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,g.jsx)(i,{htmlFor:`settings-content-rules-indicators`,className:`text-sm font-medium`,children:(0,g.jsx)(t,{id:`x3kWeu`})}),e[25]=H):H=e[25];let U;e[26]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,g.jsxs)(`div`,{className:`min-w-0`,children:[H,(0,g.jsx)(`p`,{id:`settings-content-rules-indicators-description`,className:`text-1sm text-muted-foreground`,children:(0,g.jsx)(t,{id:`ktspdq`})})]}),e[26]=U):U=e[26];let W=!b,G;e[27]===T?G=e[28]:(G=e=>T({fileTreeIndicators:e}),e[27]=T,e[28]=G);let K;e[29]!==S||e[30]!==W||e[31]!==G?(K=(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-3`,children:[U,(0,g.jsx)(u,{id:`settings-content-rules-indicators`,"aria-describedby":`settings-content-rules-indicators-description`,checked:S,disabled:W,onCheckedChange:G,"data-testid":`settings-content-rules-indicators`})]}),e[29]=S,e[30]=W,e[31]=G,e[32]=K):K=e[32];let q;e[33]!==I||e[34]!==V||e[35]!==K?(q=(0,g.jsxs)(`div`,{className:`divide-y rounded-md border`,children:[I,V,K]}),e[33]=I,e[34]=V,e[35]=K,e[36]=q):q=e[36];let J;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`settings-content-rules-plugins-note`,children:(0,g.jsx)(t,{id:`YDL7N6`})}),e[37]=J):J=e[37];let Y;return e[38]===q?Y=e[39]:(Y=(0,g.jsxs)(`section`,{"aria-labelledby":`settings-content-rules-title`,className:`space-y-4`,"data-testid":`settings-content-rules`,"data-field":`section:content-rules`,children:[D,q,J]}),e[38]=q,e[39]=Y),Y}export{_ as ContentRulesSection};
1
+ import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t,r as n}from"./dist-Nvb76hAm.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{t as i}from"./label-CvMpFFbN.js";import{i as a,n as o,o as s,s as c,t as l}from"./select-pACXgFe2.js";import{t as u}from"./switch-BKZTXkzu.js";import{n as d}from"./dist-BGzUo_18.js";import{n as f}from"./config-errors-DDAH9fqy.js";import{i as p}from"./use-apply-config-theme-CYFG76sS.js";import"./config-provider-D1SI9gJy.js";import"./saved-themes-client-B3RNutYm.js";import"./markdown-lint-BDbIoz4f.js";import{t as m}from"./SettingsSectionHeader-BKhNIRp2.js";var h=r(),g=e();function _(){let e=(0,h.c)(40),{_:r}=n(),{projectConfig:_,projectSynced:v,projectBinding:y}=p(),b=v&&y!==null,x=_?.validation?.links??`warning`,S=_?.validation?.fileTreeIndicators!==!1,C=_?.validation?.suppressLogLinkAdvisories??!0,w;e[0]!==r||e[1]!==y?(w=function(e){if(y===null){d.error(r({id:`dVaXnv`}));return}let t=y.patch({validation:e});t.ok||d.error(r({id:`NrFwux`,values:{0:f(t.error)}}))},e[0]=r,e[1]=y,e[2]=w):w=e[2];let T=w,E;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,g.jsx)(t,{id:`OPOiKn`}),e[3]=E):E=e[3];let D;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,g.jsx)(m,{titleId:`settings-content-rules-title`,title:E,scope:`project`,level:`block`,children:(0,g.jsx)(t,{id:`ge05IJ`})}),e[4]=D):D=e[4];let O;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,g.jsx)(i,{htmlFor:`settings-content-rules-links`,className:`text-sm font-medium`,children:(0,g.jsx)(t,{id:`8ruqQi`})}),e[5]=O):O=e[5];let k;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,g.jsxs)(`div`,{className:`min-w-0`,children:[O,(0,g.jsx)(`p`,{id:`settings-content-rules-links-description`,className:`text-1sm text-muted-foreground`,children:(0,g.jsx)(t,{id:`iqr14Z`})})]}),e[6]=k):k=e[6];let A;e[7]===T?A=e[8]:(A=e=>T({links:e}),e[7]=T,e[8]=A);let j=!b,M;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,g.jsx)(s,{id:`settings-content-rules-links`,"aria-describedby":`settings-content-rules-links-description`,className:`w-36 shrink-0`,"data-testid":`settings-content-rules-links`,children:(0,g.jsx)(c,{})}),e[9]=M):M=e[9];let N;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,g.jsx)(a,{value:`off`,children:(0,g.jsx)(t,{id:`Nwbs0q`})}),e[10]=N):N=e[10];let P;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,g.jsx)(a,{value:`warning`,children:(0,g.jsx)(t,{id:`r6y-jM`})}),e[11]=P):P=e[11];let F;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,g.jsxs)(o,{children:[N,P,(0,g.jsx)(a,{value:`error`,children:(0,g.jsx)(t,{id:`SlfejT`})})]}),e[12]=F):F=e[12];let I;e[13]!==x||e[14]!==A||e[15]!==j?(I=(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-3`,children:[k,(0,g.jsxs)(l,{value:x,onValueChange:A,disabled:j,children:[M,F]})]}),e[13]=x,e[14]=A,e[15]=j,e[16]=I):I=e[16];let L;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,g.jsx)(i,{htmlFor:`settings-content-rules-log-links`,className:`text-sm font-medium`,children:(0,g.jsx)(t,{id:`ea7AYn`})}),e[17]=L):L=e[17];let R;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,g.jsxs)(`div`,{className:`min-w-0`,children:[L,(0,g.jsx)(`p`,{id:`settings-content-rules-log-links-description`,className:`text-1sm text-muted-foreground`,children:(0,g.jsx)(t,{id:`nnhrHd`})})]}),e[18]=R):R=e[18];let z=!b,B;e[19]===T?B=e[20]:(B=e=>T({suppressLogLinkAdvisories:e}),e[19]=T,e[20]=B);let V;e[21]!==C||e[22]!==z||e[23]!==B?(V=(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-3`,children:[R,(0,g.jsx)(u,{id:`settings-content-rules-log-links`,"aria-describedby":`settings-content-rules-log-links-description`,checked:C,disabled:z,onCheckedChange:B,"data-testid":`settings-content-rules-log-links`})]}),e[21]=C,e[22]=z,e[23]=B,e[24]=V):V=e[24];let H;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,g.jsx)(i,{htmlFor:`settings-content-rules-indicators`,className:`text-sm font-medium`,children:(0,g.jsx)(t,{id:`x3kWeu`})}),e[25]=H):H=e[25];let U;e[26]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,g.jsxs)(`div`,{className:`min-w-0`,children:[H,(0,g.jsx)(`p`,{id:`settings-content-rules-indicators-description`,className:`text-1sm text-muted-foreground`,children:(0,g.jsx)(t,{id:`ktspdq`})})]}),e[26]=U):U=e[26];let W=!b,G;e[27]===T?G=e[28]:(G=e=>T({fileTreeIndicators:e}),e[27]=T,e[28]=G);let K;e[29]!==S||e[30]!==W||e[31]!==G?(K=(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-3`,children:[U,(0,g.jsx)(u,{id:`settings-content-rules-indicators`,"aria-describedby":`settings-content-rules-indicators-description`,checked:S,disabled:W,onCheckedChange:G,"data-testid":`settings-content-rules-indicators`})]}),e[29]=S,e[30]=W,e[31]=G,e[32]=K):K=e[32];let q;e[33]!==I||e[34]!==V||e[35]!==K?(q=(0,g.jsxs)(`div`,{className:`divide-y rounded-md border`,children:[I,V,K]}),e[33]=I,e[34]=V,e[35]=K,e[36]=q):q=e[36];let J;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`settings-content-rules-plugins-note`,children:(0,g.jsx)(t,{id:`YDL7N6`})}),e[37]=J):J=e[37];let Y;return e[38]===q?Y=e[39]:(Y=(0,g.jsxs)(`section`,{"aria-labelledby":`settings-content-rules-title`,className:`space-y-4`,"data-testid":`settings-content-rules`,"data-field":`section:content-rules`,children:[D,q,J]}),e[38]=q,e[39]=Y),Y}export{_ as ContentRulesSection};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./react-dom-DPxgxlDT.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-DzgjsZzC.js";import{n as c}from"./dist-BGzUo_18.js";import{a as l}from"./share-D-LUU2aX-B7Yg0G_m.js";import{n as u}from"./_envelope-q8XHEv4O-C-Qnl5Tu.js";import"./schemas-api-CL5ZXlEj.js";import{a as d}from"./bridge-BMIee44l.js";import{n as f}from"./use-conflicts-CIjDyM9c.js";import{t as p}from"./lib-BZo-U1ex.js";import{n as m,t as h}from"./alert-RmVFIy8D.js";import{$ as g,A as _,B as v,C as ee,Ct as y,D as b,Dt as x,E as S,Et as C,F as w,L as te,M as T,N as E,O as D,Ot as O,P as k,Q as A,S as j,St as M,T as N,Tt as ne,_ as re,_t as ie,a as ae,at as P,b as oe,bt as F,c as se,ct as ce,d as le,dt as ue,et as de,f as fe,ft as I,g as L,gt as R,h as z,ht as B,it as pe,j as me,k as V,l as H,lt as he,m as ge,mt as U,n as W,nt as G,ot as K,p as q,pt as J,r as Y,rt as X,st as Z,t as _e,tt as ve,u as ye,ut as be,v as xe,vt as Se,w as Ce,x as we,xt as Te,y as Ee,yt as De,z as Oe}from"./pierre-theme-BcjBYmHp.js";function ke(e){return ue.hasResolvedThemes(e)}function Ae(e,t){return J(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function je(e){return(e.lang??Z(e.name))===`text`}var Me=10,Ne=13,Pe=4,Fe=40;function Ie(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./react-dom-DPxgxlDT.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-DzgjsZzC.js";import{n as c}from"./dist-BGzUo_18.js";import{a as l}from"./share-D-LUU2aX-B7Yg0G_m.js";import{n as u}from"./_envelope-aSbxdSNI-BbmN1FUH.js";import"./schemas-api-DYoYU1Zh.js";import{a as d}from"./bridge-C-lLcgzt.js";import{n as f}from"./use-conflicts-2mx0_ZrI.js";import{t as p}from"./lib-BZo-U1ex.js";import{n as m,t as h}from"./alert-Bb4K23ol.js";import{$ as g,A as _,B as v,C as ee,Ct as y,D as b,Dt as x,E as S,Et as C,F as w,L as te,M as T,N as E,O as D,Ot as O,P as k,Q as A,S as j,St as M,T as N,Tt as ne,_ as re,_t as ie,a as ae,at as P,b as oe,bt as F,c as se,ct as ce,d as le,dt as ue,et as de,f as fe,ft as I,g as L,gt as R,h as z,ht as B,it as pe,j as me,k as V,l as H,lt as he,m as ge,mt as U,n as W,nt as G,ot as K,p as q,pt as J,r as Y,rt as X,st as Z,t as _e,tt as ve,u as ye,ut as be,v as xe,vt as Se,w as Ce,x as we,xt as Te,y as Ee,yt as De,z as Oe}from"./pierre-theme-BcjBYmHp.js";function ke(e){return ue.hasResolvedThemes(e)}function Ae(e,t){return J(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function je(e){return(e.lang??Z(e.name))===`text`}var Me=10,Ne=13,Pe=4,Fe=40;function Ie(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(`
2
2
  `),i=0,a=0;for(;n!==-1||r!==-1;){let o;if(n!==-1&&(r===-1||n<r)?r===n+1?(o=r+1,n=e.indexOf(`\r`,o),r=e.indexOf(`
3
3
  `,o)):(o=n+1,n=e.indexOf(`\r`,o)):(o=r+1,r=e.indexOf(`
4
4
  `,o)),t.push(o),++a===Pe){if(o-i<=Fe){for(let n=o;n<e.length;n++){let r=e.charCodeAt(n);(r===Me||r===Ne)&&(r===Ne&&n+1<e.length&&e.charCodeAt(n+1)===Me&&n++,t.push(n+1))}return t}i=o,a=0}}return t}function Le(e){let t=Ie(e);return Array.from({length:t.length},(n,r)=>{let i=t[r],a=t[r+1]??e.length;return e.slice(i,a)})}var Re={forcePlainText:!1};function ze(e,t,{theme:n=y,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=Re){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=ve(i),f=a?`text`:e.lang??Z(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=g({theme:n,highlighter:t});u.lineInfo=e=>({type:`context`,lineIndex:e-1+o,lineNumber:e+o});let h=typeof n==`string`?{lang:f,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:de(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:de(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},_=A(t.codeToHast(l?Be(c??Le(e.contents),o,s):e.contents,h)),v=l?Array(o):_;return l&&v.push(..._),{code:v,themeStyles:m,baseThemeType:p}}function Be(e,t,n){if(e.length===0)return``;let r=Math.min(t+n,e.length);return e.slice(t,r).join(``)}function Ve(e,t){return t.cacheKey==null?e.file===t&&e.sourceContents===t.contents:e.cacheKey===t.cacheKey}var He=-1,Ue=class{options;onRenderUpdate;workerManager;__id=`file-renderer:${++He}`;highlighter;renderCache;computedLang=`text`;lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;constructor(e={theme:y},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=_(e.theme??y)?he():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}beginEditSession(){this.editSessionActive=!0}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0,this.endEditSession(),this.textDocumentCache=new WeakMap}syncEditedContentsToFile(){let{renderCache:e,lineCache:t}=this;e?.isDirty!==!0||t==null||!Ve(t,e.file)||(e.file.contents=t.lines.join(``))}hasUnkeyedFileContentsChanged(e){let{lineCache:t}=this;return e.cacheKey==null&&t!=null&&t.file===e&&t.sourceContents!==e.contents}invalidateChangedUnkeyedFile(e){this.hasUnkeyedFileContentsChanged(e)&&(this.workerManager?.cleanUpTasks(this),this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap)}clearRenderCache(){this.syncEditedContentsToFile(),this.pendingStructuralRows=void 0;let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.file.cacheKey!=null&&this.workerManager?.evictFileFromCache(e.file.cacheKey)}hydrate(e){let{options:t}=this.getRenderOptions(e),n=We(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!Ae(t,r.options)&&(r=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!je(e),result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??Z(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??y}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getFileRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getFileRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{tokenizeMaxLineLength:e=1e3}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:e}})(),{renderCache:n}=this;return n?.result==null||!I(e,n.file)||!Ae(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){this.invalidateChangedUnkeyedFile(e);let{lineCache:t}=this;return(t==null||!Ve(t,e))&&(t={cacheKey:e.cacheKey,file:e,sourceContents:e.contents,lines:Le(e.contents)}),this.lineCache=t,t.lines}getLineCount(e){let t=this.getOrCreateLineCache(e);return this.textDocumentCache.get(e)?.lineCount??t.length}updateRenderCache(e,t,n=!1){if(this.pendingStructuralRows=void 0,this.renderCache==null)return;let{file:r,result:i}=this.renderCache;if(i==null)return;let a=n?new Map:void 0;this.pendingStructuralRows=a;let o=this.lineCache!=null&&Ve(this.lineCache,r)?this.lineCache:void 0;for(let[t,n]of e){if(a===void 0&&o!=null&&t<o.lines.length){let e=n.map(e=>e[2]).join(``);o.lines[t]=V(o.lines[t]??``,e)}let e={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};a===void 0?i.code[t]=e:a.set(t,e)}i.baseThemeType=t,this.renderCache.isDirty=!0}applyDocumentChange(e){let t=this.pendingStructuralRows;if(this.pendingStructuralRows=void 0,this.renderCache==null)return;let{file:n,result:r}=this.renderCache;if(r==null)return;let i=this.lineCache!=null&&Ve(this.lineCache,n)?this.lineCache.lines:Le(n.contents),a=Le(e.getText());if(i.length!==a.length){let n=Math.min(i.length,a.length),o=0;for(;o<n&&i[o]===a[o];)o++;let s=0;for(;s<n-o&&i[i.length-1-s]===a[a.length-1-s];)s++;let c=r.code;r.code=Array(a.length);for(let e=0;e<o;e++)r.code[e]=c[e];for(let e=0;e<s;e++)r.code[a.length-1-e]=c[i.length-1-e];if(t!==void 0)for(let[e,n]of t)e<a.length&&(r.code[e]=n);for(let t=o;t<a.length-s;t++)r.code[t]??={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:e.getLineText(t)}]}]};for(let e=0;e<r.code.length;e++){let t=r.code[e];t?.type===`element`&&(t.properties[`data-line`]=e+1,t.properties[`data-line-index`]=e)}this.renderCache.isDirty=!0}this.lineCache={cacheKey:n.cacheKey,file:n,sourceContents:n.contents,lines:a},this.textDocumentCache.set(n,e)}renderFile(e=this.renderCache?.file,t=M){if(e==null)return;this.invalidateChangedUnkeyedFile(e),this.renderCache?.isDirty===!0&&!I(e,this.renderCache.file)&&(this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap);let{options:n,forceHighlight:r}=this.getRenderOptions(e);this.renderCache?.isDirty===!0&&!Ae(n,this.renderCache.options)&&this.clearRenderCache();let i=this.getMatchingWorkerResultCache(e,n);i!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...i},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||je(e)||We(a.length,this.getTokenizeMaxLength()),c=!I(e,this.renderCache.file),l=!T(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0)(s||this.renderCache.result==null||!this.renderCache.highlighted&&(c||l))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||c||l||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??Z(e.name);let t=this.highlighter!=null&&_(n.theme),i=this.highlighter!=null&&me(this.computedLang),a=!s&&i;if(this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.applyHighlightResult(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=M){let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=We(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Z(e.name);let n=this.highlighter!=null&&ke(ce(this.getLocalHighlightTheme())),r=t||this.highlighter!=null&&me(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:ze(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let a=this.getLineCount(e),{disableFileHeader:o=!1}=this.options,s=[],c=pe(),l=Math.min(t.startingLine+t.totalLines,a),u=0,d=Oe(t)?te(this.lineAnnotations):void 0;d!=null&&(c.children.push(G(`context`,`annotation`,1)),s.push(D({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d.map(e=>F(e))})),u++);for(let r=t.startingLine;r<l;r++){let t=r+1,i=n[r];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:r,lineNumber:t}),Error(n)}c.children.push(X(`context`,t,`${r}`)),s.push(i),u++;let a=this.lineAnnotations[t];a!=null&&(c.children.push(G(`context`,`annotation`,1)),s.push(D({type:`annotation`,hunkIndex:0,lineIndex:t,annotations:a.map(e=>F(e))})),u++)}return c.properties.style=`grid-row: span ${u}`,{gutterAST:c.children??[],contentAST:s,preAST:this.createPreElement(a),headerAST:o?void 0:this.renderHeader(e),totalLines:a,rowCount:u,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return S({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return p(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(P({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=pe();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,b(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return p(t?P({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await be(Ce(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){if(this.renderCache==null)return;let i=!I(e,this.renderCache.file)||!this.renderCache.highlighted||!Ae(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getFileResultCache(e);if(!(n==null||!Ae(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&I(e,n.file)&&Ae(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return N({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function We(e,t){return e>t}function Ge(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function Ke(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:ge(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}var qe=[``],Je=-1,Ye=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++Je}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;renderRange;enabled=!0;editor;constructor(e={theme:y},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new Ue(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new E,this.interactionManager=new k(`file`,w(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){!this.enabled||this.file==null||this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}__getCurrentFile(){return this.file}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(w(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!J(this.appliedThemeCSS.theme,this.options.theme??y)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(e){this.code!=null&&(this.code.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`}),this.managersDirty=!1}shouldApplyColumnVariables(e){return e===`scroll`&&this.lineAnnotations.length>0}cleanUp(e=!1){this.emitPostRender(!0),this.editor?.cleanUp(e),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n),Xe(this.pre,i,this.options.collapsed)||Ze(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),H(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(Ke(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.file){return e==null?qe:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.file,r=this.lineAnnotations,i=this.renderRange;e!=null&&t!=null&&n!=null&&this.fileRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.file!==n||e.__syncRenderView(a,t,n,r,i)})}attachEditor(e){this.editor?.cleanUp(),this.editor=e,this.fileRenderer.beginEditSession();let t=this.file==null?void 0:e.__prepareFile?.(this.file);return t!==void 0&&t!==this.file?this.renderPreparedFile({file:t,forceRender:!0,preventEmit:!0,renderRange:this.renderRange}):this.fileRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),()=>{this.editor=void 0,this.fileRenderer.endEditSession()}}applyDocumentChange(e,t){this.fileRenderer.applyDocumentChange(e),t!=null&&t!==this.lineAnnotations&&this.file!=null&&(this.setLineAnnotations(t),this.fileRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations())}updateRenderCache(e,t,n){this.fileRenderer.updateRenderCache(e,t,n?.lineCountChangeInFlight)}render(e){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);let t=this.editor?.__prepareFile?.(e.file)??e.file;return this.renderPreparedFile(t===e.file?e:{...e,file:t})}renderPreparedFile({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.lineAnnotations.length>0)?o!==this.lineAnnotations:!1,m=!I(this.file,e)||this.fileRenderer.hasUnkeyedFileContentsChanged(e);if(!c&&!n&&T(u,this.renderRange)&&!m&&!p&&!f)return this.applyCachedThemeState(l);this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(Ke(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:h=!1,disableFileHeader:g=!1}=this.options;if(g&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let n=this.fileRenderer.renderFile(e,ne);n!=null&&this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n?.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.injectUnsafeCSS()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}try{let r=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f)||!this.applyPartialRender(d,u)){let n=this.fileRenderer.renderFile(e,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.applyFullRender(n,r)}this.applyBuffers(r,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.file){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||je(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getOrCreateLineCache(e).length>n||await t.primeFileHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${F(r)}`,a=this.annotationCache.get(i);if(a==null||!Ge(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:we(F(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=oe();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===t&&this.appliedUnsafeCSS===e||(this.unsafeCSSStyle??=Ee(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=re(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??y,s=typeof o==`string`?o:{...o},c=xe(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=le({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:L(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=z(this.themeCSSStyle.textContent??``,xe(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&ye()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=q({code:this.code}),r=this.fileRenderer.renderCodeAST(e);this.editor?.__captureFocusForDOMReplacement();let i=()=>{if(n.childElementCount>=2)for(let e=0;e<2;e++){let t=n.children[e],i=r[e];t.innerHTML=p(i.children),t.style.cssText=i.properties.style}else n.innerHTML=p(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?fe(t,i):i(),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(e==null||t==null)return!1;let{file:n,code:r}=this,i=r==null?void 0:this.getColumns(r);if(n==null||r==null||i==null)return!1;let a=e.startingLine,o=t.startingLine,s=e.totalLines===1/0?1/0:a+e.totalLines,c=t.totalLines===1/0?1/0:o+t.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l)return!1;if(!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))throw Error(`File.applyPartialRender: failed to trim to overlap`);let{length:d}=i.content.children,f=(e,t)=>{if(!(t<=0))return this.fileRenderer.renderFile(n,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t){let{file:n}=this;if(n==null)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??p(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:a,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){let e=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Te,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=a?.(n)??void 0,o=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,O,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,C,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,x,o),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:v(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):v(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=ee;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};j(i,this.appliedPreAttributes)||(se(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Xe(e,t,n=!1){return!n&&e==null&&t!=null}function Ze(e,t,n=!1){return e==null&&t!=null&&!n}var Qe=class extends Y{pendingConflictActions=[];pendingMarkerRows=[];injectedRows=new Map;options;constructor(e={theme:y},t,n){super(void 0,t,n),this.options=e}setConflictState(e,t,n){this.pendingConflictActions=e,this.pendingMarkerRows=t,this.syncInjectedRows(e,t,n)}syncInjectedRows(e,t,n){this.injectedRows.clear();for(let t of e){let e=t==null?void 0:B(t,n);if(t==null||e==null)continue;let r={type:`actions`,hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:t.conflictIndex};this.addInjectedRow(r)}for(let e of t)this.addInjectedRow(e)}addInjectedRow(e){let t=`${e.hunkIndex}:${e.lineIndex}`,n=this.injectedRows.get(t);n==null?this.injectedRows.set(t,[e]):n.push(e)}renderDiff(e,t=M){return e!=null&&this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.renderDiff(e,t)}async asyncRender(e,t=M){return this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.asyncRender(e,t)}createPreElement(e,t){return super.createPreElement(e,t,{"data-has-merge-conflict":``})}getUnifiedLineDecoration({type:e,lineType:t}){let n=e===`change`?t===`change-deletion`?`current`:`incoming`:void 0;return{gutterLineType:e===`change`?`context`:t,gutterProperties:$e(n),contentProperties:et(e,n)}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`current`:`incoming`:void 0;return{gutterLineType:t===`change`?`context`:t,gutterProperties:$e(n),contentProperties:et(t,n)}}getUnifiedInjectedRowsForLine=e=>{let t=this.injectedRows.get(`${e.hunkIndex}:${e.lineIndex}`);if(t==null||t.length===0)return;let{mergeConflictActionsType:n}=this.getOptionsWithDefaults(),r=[],i=[];for(let e of t){if(e.type===`actions`){r.push({content:nt({row:e,includeDefaultActions:n===`default`,includeSlot:!0}),gutter:tt(`action`)});continue}(e.type===`marker-end`?i:r).push({content:rt(e),gutter:tt(`marker`,e.type)})}return{before:r.length>0?r:void 0,after:i.length>0?i:void 0}};getOptionsWithDefaults(){let e=super.getOptionsWithDefaults();return e.diffStyle=`unified`,e.lineDiffType=this.options.lineDiffType??`none`,e.mergeConflictActionsType=this.options.mergeConflictActionsType??`default`,e}};function $e(e){return e==null?void 0:{"data-merge-conflict":e}}function et(e,t){if(t!=null){if(e===`change`)return t===`current`||t===`incoming`?{"data-line-type":`context`,"data-merge-conflict":t}:void 0;if(t===`marker-start`||t===`marker-base`||t===`marker-separator`||t===`marker-end`)return{"data-merge-conflict":t}}}function tt(e,t){let n=G(void 0,`annotation`,1);return n.properties[`data-gutter-buffer`]=e===`action`?`merge-conflict-action`:`merge-conflict-${t??`marker`}`,n}function nt({row:e,includeDefaultActions:t,includeSlot:n}){let r=t?it(e.conflictIndex):[];return n&&r.push(P({tagName:`slot`,properties:{name:De({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:e.conflictIndex}),"data-merge-conflict-action-slot":``}})),P({tagName:`div`,properties:{"data-merge-conflict-actions":``},children:[P({tagName:`div`,properties:{"data-merge-conflict-actions-content":``},children:r})]})}function rt(e){return P({tagName:`div`,properties:{"data-merge-conflict":e.type,"data-merge-conflict-marker-row":``},children:[K(e.lineText.replace(/(?:\r\n|\n|\r)$/,``))]})}function it(e){return[at({resolution:`current`,label:`Accept current change`,conflictIndex:e}),ot(),at({resolution:`incoming`,label:`Accept incoming change`,conflictIndex:e}),ot(),at({resolution:`both`,label:`Accept both`,conflictIndex:e})]}function at({resolution:e,label:t,conflictIndex:n}){return P({tagName:`button`,properties:{type:`button`,"data-merge-conflict-action":e,"data-merge-conflict-conflict-index":`${n}`},children:[K(t)]})}function ot(){return P({tagName:`span`,properties:{"data-merge-conflict-action-separator":``},children:[K(`|`)]})}function st(e,t){return e.hunkIndex===t.hunkIndex&&e.startContentIndex===t.startContentIndex&&e.endContentIndex===t.endContentIndex&&e.currentContentIndex===t.currentContentIndex&&e.baseContentIndex===t.baseContentIndex&&e.incomingContentIndex===t.incomingContentIndex&&e.endMarkerContentIndex===t.endMarkerContentIndex&&e.conflictIndex===t.conflictIndex&&ct(e.conflict,t.conflict)}function ct(e,t){return e.conflictIndex===t.conflictIndex&&e.startLineIndex===t.startLineIndex&&e.startLineNumber===t.startLineNumber&&e.separatorLineIndex===t.separatorLineIndex&&e.separatorLineNumber===t.separatorLineNumber&&e.endLineIndex===t.endLineIndex&&e.endLineNumber===t.endLineNumber&&e.baseMarkerLineIndex===t.baseMarkerLineIndex&&e.baseMarkerLineNumber===t.baseMarkerLineNumber}function lt(e){let t=typeof e==`string`?e:e.type;return t===`accept`||t===`incoming`?`additions`:t===`reject`||t===`current`?`deletions`:`both`}function ut(e,t){let{resolution:n,hunkIndex:r,startContentIndex:i,endContentIndex:a,indexesToDelete:o=new Set}=t,s=e.hunks[r];if(s==null)throw console.error({diff:e,hunkIndex:r}),Error(`resolveRegion: Invalid hunk index: ${r}`);if(i<0||a>=s.hunkContent.length||i>a)throw Error(`resolveRegion: Invalid content range, ${i}, ${a}`);let{hunks:c,additionLines:l,deletionLines:u}=e,d={...e,hunks:[],deletionLines:[],additionLines:[],splitLineCount:0,unifiedLineCount:0,cacheKey:e.cacheKey==null?void 0:`${e.cacheKey}:${n[0]}-${r}:${i}-${a}`},f={nextAdditionLineIndex:0,nextDeletionLineIndex:0,nextAdditionStart:1,nextDeletionStart:1,splitLineCount:0,unifiedLineCount:0},p=r===c.length-1&&a===s.hunkContent.length-1,m=!e.isPartial;for(let[t,s]of c.entries()){ft(e,d,f,Se(s.deletionStart,s.deletionCount)-s.collapsedBefore,Se(s.additionStart,s.additionCount)-s.collapsedBefore,s.collapsedBefore,m);let c={...s,hunkContent:[],additionStart:f.nextAdditionStart,deletionStart:f.nextDeletionStart,additionLineIndex:f.nextAdditionLineIndex,deletionLineIndex:f.nextDeletionLineIndex,additionCount:0,deletionCount:0,deletionLines:0,additionLines:0,splitLineStart:f.splitLineCount,unifiedLineStart:f.unifiedLineCount,splitLineCount:0,unifiedLineCount:0};for(let[e,p]of s.hunkContent.entries())if(t!==r||e<i||e>a){pt(p,d,u,l);let e={...p,additionLineIndex:f.nextAdditionLineIndex,deletionLineIndex:f.nextDeletionLineIndex};c.hunkContent.push(e),ht(e,f,c)}else if(o.has(e))c.hunkContent.push({type:`context`,lines:0,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex});else if(p.type===`context`){pt(p,d,u,l);let e={...p,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex};c.hunkContent.push(e),ht(e,f,c)}else{mt(n,p,d,u,l);let e={type:`context`,lines:n===`deletions`?p.deletions:n===`additions`?p.additions:p.deletions+p.additions,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex};c.hunkContent.push(e),ht(e,f,c)}if(t===r&&p){let e=n===`deletions`?s.noEOFCRDeletions:s.noEOFCRAdditions;c.noEOFCRAdditions=e,c.noEOFCRDeletions=e}c.additionCount===0&&(c.additionStart--,e.isPartial||c.additionLineIndex--),c.deletionCount===0&&(c.deletionStart--,e.isPartial||c.deletionLineIndex--),d.hunks.push(c)}let h=c.at(-1);if(h!=null&&!e.isPartial){let e=ie(h.deletionStart,h.deletionCount),t=ie(h.additionStart,h.additionCount),n=Math.min(u.length-e,l.length-t);dt(d,u,l,e,t,n),f.splitLineCount+=n,f.unifiedLineCount+=n}return d.splitLineCount=f.splitLineCount,d.unifiedLineCount=f.unifiedLineCount,d}function dt(e,t,n,r,i,a){for(let o=0;o<a;o++){let a=t[r+o],s=n[i+o];if(a==null||s==null)throw Error(`pushCollapsedContextLines: missing collapsed context line`);e.deletionLines.push(a),e.additionLines.push(s)}}function ft(e,t,n,r,i,a,o){a<=0||(o&&(dt(t,e.deletionLines,e.additionLines,r,i,a),n.nextAdditionLineIndex+=a,n.nextDeletionLineIndex+=a),n.nextAdditionStart+=a,n.nextDeletionStart+=a,n.splitLineCount+=a,n.unifiedLineCount+=a)}function pt(e,t,n,r){if(e.type===`context`)for(let n=0;n<e.lines;n++){let i=r[e.additionLineIndex+n];if(i==null)throw console.error({additionLines:r,content:e,i:n}),Error(`pushContentLinesToDiff: Context line does not exist`);t.deletionLines.push(i),t.additionLines.push(i)}else{let i=Math.max(e.deletions,e.additions);for(let a=0;a<i;a++){if(a<e.deletions){let r=n[e.deletionLineIndex+a];if(r==null)throw console.error({deletionLines:n,content:e,i:a}),Error(`pushContentLinesToDiff: Deletion line does not exist`);t.deletionLines.push(r)}if(a<e.additions){let n=r[e.additionLineIndex+a];if(n==null)throw console.error({additionLines:r,content:e,i:a}),Error(`pushContentLinesToDiff: Addition line does not exist`);t.additionLines.push(n)}}}}function mt(e,t,n,r,i){if(e===`deletions`||e===`both`)for(let e=0;e<t.deletions;e++){let i=r[t.deletionLineIndex+e];if(i==null)throw console.error({deletionLines:r,content:t,i:e}),Error(`pushResolveLinesToDiff: Deletion line does not exist`);n.deletionLines.push(i),n.additionLines.push(i)}if(e===`additions`||e===`both`)for(let e=0;e<t.additions;e++){let r=i[t.additionLineIndex+e];if(r==null)throw console.error({additionLines:i,content:t,i:e}),Error(`pushResolveLinesToDiff: Addition line does not exist`);n.deletionLines.push(r),n.additionLines.push(r)}}function ht(e,t,n){e.type===`context`?(t.nextAdditionLineIndex+=e.lines,t.nextDeletionLineIndex+=e.lines,t.nextAdditionStart+=e.lines,t.nextDeletionStart+=e.lines,t.splitLineCount+=e.lines,t.unifiedLineCount+=e.lines,n.additionCount+=e.lines,n.deletionCount+=e.lines,n.splitLineCount+=e.lines,n.unifiedLineCount+=e.lines):(t.nextAdditionLineIndex+=e.additions,t.nextDeletionLineIndex+=e.deletions,t.nextAdditionStart+=e.additions,t.nextDeletionStart+=e.deletions,t.splitLineCount+=Math.max(e.deletions,e.additions),t.unifiedLineCount+=e.deletions+e.additions,n.deletionCount+=e.deletions,n.deletionLines+=e.deletions,n.additionCount+=e.additions,n.additionLines+=e.additions,n.splitLineCount+=Math.max(e.deletions,e.additions),n.unifiedLineCount+=e.deletions+e.additions)}function gt(e,t,n){return ut(e,{resolution:lt(n),hunkIndex:t.hunkIndex,startContentIndex:t.startContentIndex,endContentIndex:t.endContentIndex,indexesToDelete:_t(t)})}function _t(e){let t=new Set;return e.baseContentIndex!=null&&t.add(e.baseContentIndex),e.endMarkerContentIndex!==e.endContentIndex&&t.add(e.endMarkerContentIndex),t}var vt=-1,yt=class extends W{options;__id=`unresolved-file:${++vt}`;type=`unresolved-file`;computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0};conflictActions=[];markerRows=[];conflictActionCache=new Map;constructor(e={theme:y},t,n=!1){super(void 0,t,n),this.options=e,this.setOptions(e)}setOptions(e){if(e!=null){if(e.onMergeConflictAction!=null&&e.onMergeConflictResolve!=null)throw Error(`UnresolvedFile: onMergeConflictAction and onMergeConflictResolve are mutually exclusive. Use only one callback.`);this.options=e,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions()}}syncInteractionOptions(){this.interactionManager.setOptions(w(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex,this.handleMergeConflictActionClick))}createHunksRenderer(e){return new Qe(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getHunksRendererOptions(e){return Ot(e,this.options)}applyPreNodeAttributes(e,t){super.applyPreNodeAttributes(e,t,{"data-has-merge-conflict":``})}cleanUp(){this.emitPostRender(!0),this.clearMergeConflictActionCache(),this.computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0},this.conflictActions=[],super.cleanUp()}getOrComputeDiff({file:e,fileDiff:t,actions:n,markerRows:r}){let{maxContextLines:i,onMergeConflictAction:a}=this.options;wrapper:if(a!=null){let a=t!=null;if(a!==(n!=null)||a!==(r!=null))throw Error(`UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows must be passed together`);if(t!=null&&n!=null&&r!=null){this.computedCache={file:e??this.computedCache.file,fileDiff:t,actions:n,markerRows:r};break wrapper}else if(e!=null||this.computedCache.file!=null){if(e!=null&&this.computedCache.file!=null&&!I(e,this.computedCache.file)&&this.computedCache.fileDiff!=null&&this.computedCache.actions!=null)throw Error(`UnresolvedFile.getOrComputeDiff: file can only be used to initialize unresolved state once. Pass fileDiff and actions for subsequent updates.`);if(e??=this.computedCache.file,e==null)throw Error(`UnresolvedFile.getOrComputeDiff: file is null, should be impossible`);if(!I(e,this.computedCache.file)||this.computedCache.fileDiff==null||this.computedCache.actions==null){let t=R(e,i);this.computedCache={file:e,fileDiff:t.fileDiff,actions:t.actions,markerRows:t.markerRows}}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}else{t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}}else{if(t!=null||n!=null||r!=null)throw Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows are only usable in controlled mode, you must pass in `onMergeConflictAction`");if(e!=null&&this.computedCache.file!=null&&!I(e,this.computedCache.file))throw Error(`UnresolvedFile.getOrComputeDiff: uncontrolled unresolved files parse the file only once. Later updates must come from the cached diff state.`);if(this.computedCache.file??=e,this.computedCache.fileDiff==null&&this.computedCache.file!=null){let e=R(this.computedCache.file,i);this.computedCache.fileDiff=e.fileDiff,this.computedCache.actions=e.actions,this.computedCache.markerRows=e.markerRows}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}if(!(t==null||n==null||r==null))return{fileDiff:t,actions:n,markerRows:r}}hydrate(e){let{file:t,fileDiff:n,actions:r,markerRows:i,lineAnnotations:a,fileContainer:o,prerenderedHTML:s,preventEmit:c=!1}=e,l=this.getOrComputeDiff({file:t,fileDiff:n,actions:r,markerRows:i});l!=null&&(this.hydrateElements(o,s),this.setActiveMergeConflictState(l.actions,l.markerRows),Et(this.pre,l.fileDiff,this.options.collapsed)||Dt(this.headerElement,l.fileDiff,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):(this.hydrationSetup({fileDiff:l.fileDiff,lineAnnotations:a}),this.pre!=null&&this.renderMergeConflictActionSlots()),c||this.emitPostRender())}rerender(){!this.enabled||this.fileDiff==null||this.render({forceRender:!0,renderRange:this.renderRange})}render(e={}){let{file:t,fileDiff:n,actions:r,markerRows:i,lineAnnotations:a,preventEmit:o=!1,...s}=e,c=this.getOrComputeDiff({file:t,fileDiff:n,actions:r,markerRows:i});if(c==null)return!1;this.setActiveMergeConflictState(c.actions,c.markerRows);let l=super.render({...s,fileDiff:c.fileDiff,lineAnnotations:a,preventEmit:!0});return l&&(this.renderMergeConflictActionSlots(),o||this.emitPostRender()),l}resolveConflict(e,t,n=this.computedCache.fileDiff){let r=this.conflictActions[e];if(n==null||r==null)return;if(r.conflictIndex!==e)throw console.error({conflictIndex:e,action:r}),Error(`UnresolvedFile.resolveConflict: conflictIndex and conflictAction don't match`);let i=gt(n,r,t),a=this.computedCache.file,{file:o,actions:s,markerRows:c}=bt({fileDiff:i,previousActions:this.conflictActions,resolvedConflictIndex:e,previousFile:a,resolution:t});return{file:o,fileDiff:i,actions:s,markerRows:c}}resolveConflictAndRender(e,t){let n=this.conflictActions[e];if(n==null)return;if(n.conflictIndex!==e)throw console.error({conflictIndex:e,action:n}),Error(`UnresolvedFile.resolveConflictAndRender: conflictIndex and conflictAction don't match`);let r={resolution:t,conflict:n.conflict},{file:i,fileDiff:a,actions:o,markerRows:s}=this.resolveConflict(e,t)??{};i==null||a==null||o==null||s==null||(this.computedCache={file:i,fileDiff:a,actions:o,markerRows:s},this.setActiveMergeConflictState(o,s),this.workerManager==null?this.render({forceRender:!0}):this.hunksRenderer.renderDiff(a),this.options.onMergeConflictResolve?.(i,r))}setActiveMergeConflictState(e=this.conflictActions,t=this.markerRows){this.conflictActions=e,this.markerRows=t,this.computedCache.fileDiff!=null&&this.hunksRenderer instanceof Qe&&this.hunksRenderer.setConflictState(this.options.mergeConflictActionsType===`none`?[]:e,t,this.computedCache.fileDiff)}handleMergeConflictActionClick=e=>{let t=this.conflictActions[e.conflictIndex];if(t==null)return;if(t.conflictIndex!==e.conflictIndex)throw console.error({conflictIndex:e.conflictIndex,action:t}),Error(`UnresolvedFile.handleMergeConflictActionClick: conflictIndex and conflictAction don't match`);let n={resolution:e.resolution,conflict:t.conflict};if(this.options.onMergeConflictAction!=null){this.options.onMergeConflictAction(n,this);return}this.resolveConflictAndRender(e.conflictIndex,e.resolution)};renderMergeConflictActionSlots(){let{fileDiff:e}=this.computedCache;if(this.isContainerManaged||this.fileContainer==null||typeof this.options.mergeConflictActionsType!=`function`||this.conflictActions.length===0||e==null){this.clearMergeConflictActionCache();return}let t=new Map(this.conflictActionCache);for(let n=0;n<this.conflictActions.length;n++){let r=this.conflictActions[n];if(r==null)continue;if(r.conflictIndex!==n)throw console.error({conflictIndex:n,action:r}),Error(`UnresolvedFile.renderMergeConflictActionSlots: conflictIndex and conflictAction don't match`);let i=B(r,e);if(i==null)continue;let a=r.conflictIndex,o=De({hunkIndex:i.hunkIndex,lineIndex:i.lineIndex,conflictIndex:a}),s=`${n}-${o}`,c=this.conflictActionCache.get(s);if(c==null||!st(c.action,r)){c?.element.remove();let e=this.renderMergeConflictAction(r);if(e==null)continue;let t=we(o);t.appendChild(e),this.fileContainer.appendChild(t),c={element:t,action:r},this.conflictActionCache.set(s,c)}t.delete(s)}for(let[e,{element:n}]of t.entries())this.conflictActionCache.delete(e),n.remove()}renderMergeConflictAction(e){if(typeof this.options.mergeConflictActionsType!=`function`)return;let t=this.options.mergeConflictActionsType(e,this);if(t!=null){if(t instanceof HTMLElement)return t;if(typeof DocumentFragment<`u`&&t instanceof DocumentFragment){let e=document.createElement(`div`);return e.style.display=`contents`,e.appendChild(t),e}}}clearMergeConflictActionCache(){for(let{element:e}of this.conflictActionCache.values())e.remove();this.conflictActionCache.clear()}};function bt({fileDiff:e,previousActions:t,resolvedConflictIndex:n,previousFile:r,resolution:i}){let a=t[n];if(a==null)throw Error(`rebuildFileAndActions: missing resolved action for unresolved file rebuild`);let o=Ct(t,n,a,i),s=U(e,o);return{file:xt({fileDiff:e,resolvedAction:a,resolvedConflictIndex:n,previousFile:r,resolution:i}),actions:o,markerRows:s}}function xt({resolvedAction:e,resolvedConflictIndex:t,previousFile:n,fileDiff:r,resolution:i}){let a=ae(n?.contents??``),{conflict:o}=e,s=St(a,o,i),c=[...a.slice(0,o.startLineIndex),...s,...a.slice(o.endLineIndex+1)].join(``);return{name:n?.name??r.name,contents:c,cacheKey:n?.cacheKey==null?void 0:`${n.cacheKey}:mc-${t}-${i}`}}function St(e,t,n){let r=e.slice(t.startLineIndex+1,t.baseMarkerLineIndex??t.separatorLineIndex),i=e.slice(t.separatorLineIndex+1,t.endLineIndex);return n===`current`?r:n===`incoming`?i:[...r,...i]}function Ct(e,t,n,r){let i=wt(n.conflict,r);return e.map((e,r)=>{if(r!==t&&e!=null)return e.conflict.startLineIndex>n.conflict.endLineIndex?{...e,conflict:Tt(e.conflict,i)}:e})}function wt(e,t){let n=(e.baseMarkerLineIndex??e.separatorLineIndex)-e.startLineIndex-1,r=e.endLineIndex-e.separatorLineIndex-1;return(t===`current`?n:t===`incoming`?r:n+r)-(e.endLineIndex-e.startLineIndex+1)}function Tt(e,t){return{...e,startLineIndex:e.startLineIndex+t,startLineNumber:e.startLineNumber+t,separatorLineIndex:e.separatorLineIndex+t,separatorLineNumber:e.separatorLineNumber+t,endLineIndex:e.endLineIndex+t,endLineNumber:e.endLineNumber+t,baseMarkerLineIndex:e.baseMarkerLineIndex==null?void 0:e.baseMarkerLineIndex+t,baseMarkerLineNumber:e.baseMarkerLineNumber==null?void 0:e.baseMarkerLineNumber+t}}function Et(e,t,n=!1){return!n&&e==null&&t!=null}function Dt(e,t,n=!1){return e==null&&t!=null&&!n}function Ot(e,t){let n={...t,...e};return{...n,useTokenTransformer:ge(n),hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,mergeConflictActionsType:typeof e?.mergeConflictActionsType==`function`?`custom`:e?.mergeConflictActionsType}}var kt=o(),Q=e(n(),1),At=null;function jt(e){let t=(0,kt.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={};At=r;let i=document.documentElement,a=null,o=()=>{if(At!==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(),At===r&&(At=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 $=t();function Mt(e){let t=(0,kt.c)(9),{filename:n,content:r}=e,{_:a}=i(),o=(0,Q.useRef)(null),s,c;t[0]!==r||t[1]!==n?(s=()=>{let e=o.current;if(!e)return;let t=new Ye({overflow:`wrap`,theme:_e()});return t.render({file:{name:n,contents:r},containerWrapper:e}),()=>{t.cleanUp()}},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;t[4]!==a||t[5]!==n?(l=a({id:`wXFalZ`,values:{filename:n}}),t[4]=a,t[5]=n,t[6]=l):l=t[6];let u;return t[7]===l?u=t[8]:(u=(0,$.jsx)(`section`,{ref:o,tabIndex:0,"aria-label":l,className:`conflict-view h-full overflow-y-auto subtle-scrollbar`}),t[7]=l,t[8]=u),u}var Nt=e(a(),1),Pt=50,Ft=class{stack;idx;constructor(e){this.stack=[e],this.idx=0}get current(){let e=this.stack[this.idx];if(!e)throw Error(`ConflictHistory: stack is empty — invariant violated`);return e}get canUndo(){return this.idx>0}get canRedo(){return this.idx<this.stack.length-1}push(e){this.stack.splice(this.idx+1),this.stack.push(e),this.idx++,this.stack.length>Pt+1&&(this.stack.splice(1,this.stack.length-Pt-1),this.idx=this.stack.length-1)}reset(e){this.stack[0]=e}undo(){return this.canUndo?(this.idx--,this.stack[this.idx]??null):null}redo(){return this.canRedo?(this.idx++,this.stack[this.idx]??null):null}},It=`