@inkeep/open-knowledge 0.53.0-beta.0 → 0.53.0

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 (228) hide show
  1. package/dist/{acp-harness-probe-DvXLWBwm.mjs → acp-harness-probe-B5_ar7rl.mjs} +2 -2
  2. package/dist/assets/skills/project/references/linking.md +1 -1
  3. package/dist/cli.mjs +62 -62
  4. package/dist/constants-BGKDDuS6.mjs +2 -0
  5. package/dist/{git-handle-VuHcNtS4.mjs → git-handle-CH1DpBYP.mjs} +2 -2
  6. package/dist/git-handle-D_uW8fTU.mjs +1 -0
  7. package/dist/index.mjs +1 -1
  8. package/dist/{init-ja0T-etx.mjs → init-BGPdBpY7.mjs} +4 -4
  9. package/dist/init-CJLXPIkG.mjs +1 -0
  10. package/dist/{launch-json-removal-DaMY_ELf.mjs → launch-json-removal-BYbu5C86.mjs} +2 -2
  11. package/dist/{loader-CZJtDyW1.mjs → loader-ejjX_n1a.mjs} +2 -2
  12. package/dist/loader-gRh8KR8b.mjs +1 -0
  13. package/dist/md-manager-CUGZ0GRt.mjs +2 -0
  14. package/dist/{open-browser-BfbWvPXH.mjs → open-browser-CtVpc_8x.mjs} +2 -2
  15. package/dist/parse-worker.mjs +1 -1
  16. package/dist/preview-Ddz36Ink.mjs +1 -0
  17. package/dist/{preview-DZFeEN5M.mjs → preview-R6iAeACo.mjs} +2 -2
  18. package/dist/public/assets/{ActivityModeContent-BMqdsZEQ.js → ActivityModeContent-rgEhhGgw.js} +1 -1
  19. package/dist/public/assets/{AgentDiffPane-D_ubtipg.js → AgentDiffPane-DtG18o1u.js} +1 -1
  20. package/dist/public/assets/{AgentThreadClientBinder-B7pwGsKU.js → AgentThreadClientBinder-DkD2M_dd.js} +1 -1
  21. package/dist/public/assets/{BugReportHistory-CDRTpJV0.js → BugReportHistory-C59fSH13.js} +1 -1
  22. package/dist/public/assets/{BugReportHistoryDialog--YdGm_GJ.js → BugReportHistoryDialog-C2b4xA3d.js} +1 -1
  23. package/dist/public/assets/{ChangedOutsideBadge-4TgQdQOf.js → ChangedOutsideBadge-DdpCQcxq.js} +1 -1
  24. package/dist/public/assets/CodeMirrorPropInput-Cydg0jHr.js +3 -0
  25. package/dist/public/assets/{ConfigSharingInfoTooltip-CuqrTakc.js → ConfigSharingInfoTooltip-4T5uhyyt.js} +1 -1
  26. package/dist/public/assets/{ConsentDialogBody-CmMu4IpT.js → ConsentDialogBody-DfhGpXdb.js} +1 -1
  27. package/dist/public/assets/{DiffView-BcZip7m3.js → DiffView-C-imhjB8.js} +1 -1
  28. package/dist/public/assets/DocumentContext-BN8gSwJ-.js +38 -0
  29. package/dist/public/assets/{EditorModeToggle-CFFhQhHA.js → EditorModeToggle-CrnEz11k.js} +1 -1
  30. package/dist/public/assets/{EnableSyncConfirmDialog-BiThAkoH.js → EnableSyncConfirmDialog-623sSYbd.js} +1 -1
  31. package/dist/public/assets/FeedbackForm-CiQQiFp-.js +1 -0
  32. package/dist/public/assets/{GraphPanel-CsRKre3D.js → GraphPanel-C-3KrSdC.js} +1 -1
  33. package/dist/public/assets/{ImportSkillDialog-DcZoBHf-.js → ImportSkillDialog-B7gKx_GY.js} +1 -1
  34. package/dist/public/assets/{LintConfigEditor--yFdaWpg.js → LintConfigEditor-B-XaVu0m.js} +1 -1
  35. package/dist/public/assets/ManagedArtifactProperties-CUMQh4tz.js +1 -0
  36. package/dist/public/assets/{ManagedArtifactProperties-CIVfnd15.js → ManagedArtifactProperties-iclZPRJv.js} +1 -1
  37. package/dist/public/assets/{McpConsentDialogBody-DEhSeOSg.js → McpConsentDialogBody-BS3RE3LY.js} +1 -1
  38. package/dist/public/assets/{Mermaid-mUyEEsA0.js → Mermaid-BHfANkja.js} +1 -1
  39. package/dist/public/assets/{MermaidDocEditor-civq6mkL.js → MermaidDocEditor-CI90q10w.js} +1 -1
  40. package/dist/public/assets/{RegisteredAgentIcon-BxpJAHOj.js → RegisteredAgentIcon-gjOJZp_B.js} +1 -1
  41. package/dist/public/assets/{ReportBugDialogBody-DO7eotFd.js → ReportBugDialogBody-BWXO0gto.js} +1 -1
  42. package/dist/public/assets/{SchemaConfigEditor-NxaI-Jdd.js → SchemaConfigEditor-eh-ijdLu.js} +1 -1
  43. package/dist/public/assets/{SessionsHost-PjSsebux.js → SessionsHost-BOgQOcv6.js} +2 -2
  44. package/dist/public/assets/SettingsDialogBody-BaYDHshm.js +12 -0
  45. package/dist/public/assets/{ShareBranchSwitchDialog-B7Bl6qR0.js → ShareBranchSwitchDialog-DpmQmmrq.js} +1 -1
  46. package/dist/public/assets/{ShareReceiveDialog-BmMkjWTr.js → ShareReceiveDialog-C3fS1Ax2.js} +1 -1
  47. package/dist/public/assets/{ShareReceiveMissDialog-R20sy2ia.js → ShareReceiveMissDialog-DzeOwnyS.js} +1 -1
  48. package/dist/public/assets/{SkillEditBanner-B2U7UdOB.js → SkillEditBanner-DGB_nnDm.js} +1 -1
  49. package/dist/public/assets/{SkillOriginInline-B3wOLT3t.js → SkillOriginInline-C4x3nMIH.js} +1 -1
  50. package/dist/public/assets/{SkillToolbarControls-B_RJpm5V.js → SkillToolbarControls-DXBGIWug.js} +1 -1
  51. package/dist/public/assets/{SlidesToolbarControls-56-P71vE.js → SlidesToolbarControls-Buv-SEot.js} +1 -1
  52. package/dist/public/assets/{SourceEditor-BW7yuIvG.js → SourceEditor-B64VJl_F.js} +1 -1
  53. package/dist/public/assets/{TerminalPanel-Clr6j-jo.js → TerminalPanel-Bch10p1r.js} +3 -3
  54. package/dist/public/assets/{TerminalWindowApp-DRbYHuvS.js → TerminalWindowApp-s4mNyUki.js} +1 -1
  55. package/dist/public/assets/{TextDocEditor-Bwwrrcn5.js → TextDocEditor-DtDvo7eF.js} +1 -1
  56. package/dist/public/assets/{ThreadView-BA7gxPI6.js → ThreadView-CGOz1ms_.js} +2 -2
  57. package/dist/public/assets/{TimelineDiffPane-CTJnk9me.js → TimelineDiffPane-B7aD7QN-.js} +1 -1
  58. package/dist/public/assets/{agent-diff-store-BvxTke2d.js → agent-diff-store-BJiYj2BI.js} +1 -1
  59. package/dist/public/assets/{auth-state-cache-DrAhOPTB.js → auth-state-cache-5wocICj2.js} +3 -3
  60. package/dist/public/assets/{checkbox-Bxl4H4lV.js → checkbox-vidgONxv.js} +1 -1
  61. package/dist/public/assets/client-version---DsZj2h.js +1 -0
  62. package/dist/public/assets/{cm-theme-BygK2tYf.js → cm-theme-DZT10ikr.js} +1 -1
  63. package/dist/public/assets/{comment-chips-W2ozPSpm.js → comment-chips-BjkVSykR.js} +1 -1
  64. package/dist/public/assets/{config-provider-DamFbxl8.js → config-provider-DGQwNZtP.js} +3 -3
  65. package/dist/public/assets/{dialog-R8GugqUq.js → dialog-DztIj-ZS.js} +1 -1
  66. package/dist/public/assets/{dist-BZW14CKf.js → dist-BRmJz2fY.js} +1 -1
  67. package/dist/public/assets/{dist-DRufJFR7.js → dist-BVpMlVG3.js} +1 -1
  68. package/dist/public/assets/{dist-BE8rPie-.js → dist-BgBcg3TP.js} +1 -1
  69. package/dist/public/assets/{dist-Dm-VLxvd.js → dist-BiwzWInZ.js} +1 -1
  70. package/dist/public/assets/{dist-BR5M-SiF.js → dist-CkFATl39.js} +1 -1
  71. package/dist/public/assets/{dist-Cfmj7R4I.js → dist-DM6osNK2.js} +1 -1
  72. package/dist/public/assets/{dist-DBhufbLS.js → dist-DQyQPRvE.js} +1 -1
  73. package/dist/public/assets/{dist-BTo1AB3U.js → dist-DfLFtHzK.js} +1 -1
  74. package/dist/public/assets/{dist-CUhsr-gg.js → dist-DsH7eETa.js} +1 -1
  75. package/dist/public/assets/{dist-ILlrHFKs.js → dist-GenOktAv.js} +183 -183
  76. package/dist/public/assets/{dist-CcIAtWVJ.js → dist-dO0W-CVt.js} +1 -1
  77. package/dist/public/assets/{dist-D7MIhDGJ.js → dist-ofeGnIBD.js} +1 -1
  78. package/dist/public/assets/{dist-CElLQlwI.js → dist-z-y_5Bgj.js} +1 -1
  79. package/dist/public/assets/{doc-paths-DAh95jxf.js → doc-paths-CB3USVY1.js} +1 -1
  80. package/dist/public/assets/{documents-events-CCW6R-r2.js → documents-events-rgFBXE2Z.js} +1 -1
  81. package/dist/public/assets/{file-tree-adapter-Bf1ZqkPA.js → file-tree-adapter-4JTjxhHS.js} +1 -1
  82. package/dist/public/assets/{file-tree-utils-CgJ4lrP9.js → file-tree-utils-CYn1f82_.js} +1 -1
  83. package/dist/public/assets/{folder-config-api-CKV5STj1.js → folder-config-api-ByqyyP9w.js} +1 -1
  84. package/dist/public/assets/follow-file-kuGZjRsi.js +4 -0
  85. package/dist/public/assets/globals-tIUZlcbW.css +1 -0
  86. package/dist/public/assets/i18n-CrYaxckE.js +1 -0
  87. package/dist/public/assets/{index-qtxLhYJO.js → index-DmXrGqKD.js} +17 -17
  88. package/dist/public/assets/{input-group-ClrIuhWi.js → input-group-BiaQ-rIw.js} +1 -1
  89. package/dist/public/assets/{lint-config-client-xawAT1mQ.js → lint-config-client-DydgEnDK.js} +1 -1
  90. package/dist/public/assets/lint-plugin-meta-FPoTE-0t.js +1 -0
  91. package/dist/public/assets/{markdownlint-rule-browser-B3UPVPG_.js → markdownlint-rule-browser-DwEGxp2H.js} +1 -1
  92. package/dist/public/assets/messages-7cAk2vbZ.js +1 -0
  93. package/dist/public/assets/messages-BNv51jKY.js +1 -0
  94. package/dist/public/assets/messages-BS_zCLy8.js +1 -0
  95. package/dist/public/assets/messages-BmYExk_R.js +1 -0
  96. package/dist/public/assets/messages-C3vvvgBK.js +1 -0
  97. package/dist/public/assets/messages-CmD7dBQ3.js +1 -0
  98. package/dist/public/assets/messages-CpVNkvrj.js +1 -0
  99. package/dist/public/assets/messages-CxF28E4J.js +1 -0
  100. package/dist/public/assets/messages-D9UyuwOS.js +1 -0
  101. package/dist/public/assets/messages-DQ5yKIrs.js +1 -0
  102. package/dist/public/assets/messages-DdBrUUBf.js +1 -0
  103. package/dist/public/assets/navigation-targets-iVnea4YK.js +1 -0
  104. package/dist/public/assets/{open-managed-artifact-tab-G7xdjHph.js → open-managed-artifact-tab-DpfEVLG-.js} +1 -1
  105. package/dist/public/assets/{pending-receive-nav-store-CpVItLnx.js → pending-receive-nav-store-BHeTqy0Z.js} +1 -1
  106. package/dist/public/assets/{project-paths-DOOtPmjl.js → project-paths-_w2mRvRX.js} +1 -1
  107. package/dist/public/assets/prop-types-ClS-DLuz.js +1 -0
  108. package/dist/public/assets/{receive-store-BrOspwat.js → receive-store-R5sEQn80.js} +1 -1
  109. package/dist/public/assets/{schema-fields-view-intent-D0jz38_6.js → schema-fields-view-intent-DiE8NL9y.js} +1 -1
  110. package/dist/public/assets/{selection-context-nm7zlSXJ.js → selection-context-CHJ-gfRx.js} +1 -1
  111. package/dist/public/assets/{skill-actions-e3PRoOA3.js → skill-actions-B9BGbzJZ.js} +2 -2
  112. package/dist/public/assets/{skill-scope-8PP6d5Gw.js → skill-scope-CFwClOyk.js} +1 -1
  113. package/dist/public/assets/{skills-api-DQ0PK-8O.js → skills-api-B41p5sp3.js} +1 -1
  114. package/dist/public/assets/{src-BKQkpwCc.js → src-gXOrH5MP.js} +1 -1
  115. package/dist/public/assets/{tag-pill-input-BHj2SAnj.js → tag-pill-input-BTKlFD92.js} +1 -1
  116. package/dist/public/assets/{target-navigation-intent-DpIU3fe6.js → target-navigation-intent-CIjVZTkZ.js} +1 -1
  117. package/dist/public/assets/{telemetry-impl-Byic_ID0.js → telemetry-impl-Bvv5kEhb.js} +1 -1
  118. package/dist/public/assets/{telemetry-startup-D_ttbNLC.js → telemetry-startup-C8JOSRcr.js} +1 -1
  119. package/dist/public/assets/{terminal-cli-display-CgJpdKCI.js → terminal-cli-display-CW7j5kqb.js} +1 -1
  120. package/dist/public/assets/{terminal-launch-events-DQ0KtteM.js → terminal-launch-events-CW7Dk9L6.js} +1 -1
  121. package/dist/public/assets/{terminal-telemetry-CE1yzjKD.js → terminal-telemetry-CxkpCpp5.js} +1 -1
  122. package/dist/public/assets/{text-viewer-languages-epnUVwhY.js → text-viewer-languages-oVDGEYYY.js} +2 -2
  123. package/dist/public/assets/{typing-burst-detector-B6UhFT8T.js → typing-burst-detector-fIHJv2J1.js} +4 -4
  124. package/dist/public/assets/{uninstall-BE8yLKij.js → uninstall-CYpAgTNE.js} +1 -1
  125. package/dist/public/assets/{use-activity-panel-CF6Guvjl.js → use-activity-panel-BEnqyFcJ.js} +1 -1
  126. package/dist/public/assets/{use-apply-config-color-theme-BatIDUX7.js → use-apply-config-color-theme-Dw8J4H8Z.js} +1 -1
  127. package/dist/public/assets/{use-collab-url-7XE2_0_k.js → use-collab-url-CbdhvhFJ.js} +1 -1
  128. package/dist/public/assets/{use-live-xterm-theme-DS89T4Os.js → use-live-xterm-theme-B_qB957b.js} +1 -1
  129. package/dist/public/assets/{use-open-skill-CtzMj-sg.js → use-open-skill-Ca4D1I53.js} +1 -1
  130. package/dist/public/assets/{use-popular-skills-BY0ulPzk.js → use-popular-skills-ByV4BHXd.js} +1 -1
  131. package/dist/public/assets/{use-settings-route-DN0TWdfX.js → use-settings-route-4qI--CpZ.js} +1 -1
  132. package/dist/public/assets/{use-skill-origin-COh1_mOK.js → use-skill-origin-DGj0sj4C.js} +1 -1
  133. package/dist/public/assets/{use-skills-C_HuRxth.js → use-skills-WWbAKl3q.js} +1 -1
  134. package/dist/public/assets/{use-terminal-enabled-CIQB6jgW.js → use-terminal-enabled-Dz_qAFuD.js} +1 -1
  135. package/dist/public/assets/use-timeline-entry-diff-RrvwSA9l.js +6 -0
  136. package/dist/public/assets/{use-workspace-CNCW4CS8.js → use-workspace-BRfhPAI8.js} +1 -1
  137. package/dist/public/index.html +104 -104
  138. package/dist/public/uninstall.html +12 -12
  139. package/dist/{repair-launch-json-D0g7JIQF.mjs → repair-launch-json-D4L6s57C.mjs} +2 -2
  140. package/dist/{repair-mcp-configs-hbX7fywV.mjs → repair-mcp-configs-1m14wb_8.mjs} +2 -2
  141. package/dist/{repair-skills-BVCJQr-D.mjs → repair-skills-Dn9wtbHi.mjs} +2 -2
  142. package/dist/repair-skills-cJ41S9pk.mjs +1 -0
  143. package/dist/server-lock-CTrzO_5l.mjs +1 -0
  144. package/dist/{server-lock-CeKMy65H.mjs → server-lock-D8tFCW-G.mjs} +2 -2
  145. package/dist/{skill-teardown-CybJJo-5.mjs → skill-teardown-riJHlPak.mjs} +2 -2
  146. package/dist/{src--OhnhRml.mjs → src-BVxZYLJj.mjs} +328 -328
  147. package/dist/src-CclRwMug.mjs +1 -0
  148. package/dist/{src-3gxGmFyn.mjs → src-CeMQBLDa.mjs} +1 -1
  149. package/dist/{src-DNgZpbWL.mjs → src-ISYL0cXX.mjs} +4 -4
  150. package/dist/{src-Dj6UxpKM.mjs → src-RGB2pEts.mjs} +124 -124
  151. package/dist/start-8PynebPz.mjs +1 -0
  152. package/dist/start-DqsRiUST.mjs +12 -0
  153. package/dist/{ui-DXs7IMUP.mjs → ui-CyO6JCpp.mjs} +3 -3
  154. package/dist/{write-project-skill-B4M4CzQe.mjs → write-project-skill-Bx22NW0a.mjs} +3 -3
  155. package/package.json +5 -5
  156. package/dist/constants-GVvlP0F1.mjs +0 -2
  157. package/dist/git-handle-CEoe8TIl.mjs +0 -1
  158. package/dist/init-CXnCnSQu.mjs +0 -1
  159. package/dist/loader-zzsiCoMM.mjs +0 -1
  160. package/dist/md-manager-45eVlaBq.mjs +0 -2
  161. package/dist/preview-BqJFFDSI.mjs +0 -1
  162. package/dist/public/assets/CodeMirrorPropInput-CjgqNZXo.js +0 -3
  163. package/dist/public/assets/DocumentContext-tOm4SkOp.js +0 -38
  164. package/dist/public/assets/FeedbackForm-tTwFtkKO.js +0 -1
  165. package/dist/public/assets/ManagedArtifactProperties-Bb9ghWb1.js +0 -1
  166. package/dist/public/assets/SettingsDialogBody-BNYz-D4X.js +0 -12
  167. package/dist/public/assets/client-version-DFQNNQh_.js +0 -1
  168. package/dist/public/assets/follow-file-D0HdtSlc.js +0 -4
  169. package/dist/public/assets/globals-CZFxK0Rt.css +0 -1
  170. package/dist/public/assets/i18n-CUKvPzxt.js +0 -1
  171. package/dist/public/assets/lint-plugin-meta-CsGPauME.js +0 -1
  172. package/dist/public/assets/messages-BD6xU0hl.js +0 -1
  173. package/dist/public/assets/messages-BrOihCC2.js +0 -1
  174. package/dist/public/assets/messages-CeGZ3qGI.js +0 -1
  175. package/dist/public/assets/messages-DLAxD4Ea.js +0 -1
  176. package/dist/public/assets/messages-DiRAd1Pa.js +0 -1
  177. package/dist/public/assets/messages-DoSs73jK.js +0 -1
  178. package/dist/public/assets/messages-FGGtYX0Z.js +0 -1
  179. package/dist/public/assets/messages-QNJusJtV.js +0 -1
  180. package/dist/public/assets/messages-T7J7xjCi.js +0 -1
  181. package/dist/public/assets/messages-rE7VifgH.js +0 -1
  182. package/dist/public/assets/messages-zscDryNK.js +0 -1
  183. package/dist/public/assets/navigation-targets-C1boWExT.js +0 -1
  184. package/dist/public/assets/prop-types-BIrEWnOv.js +0 -1
  185. package/dist/public/assets/use-timeline-entry-diff-CDFU16yg.js +0 -6
  186. package/dist/repair-skills-BmAntgZP.mjs +0 -1
  187. package/dist/server-lock-CDm0H6LS.mjs +0 -1
  188. package/dist/src-BqNFscyh.mjs +0 -1
  189. package/dist/start-DYelgMjm.mjs +0 -1
  190. package/dist/start-xJV4Y-0A.mjs +0 -12
  191. /package/dist/public/assets/{CopyButton-CKyZY1PL.js → CopyButton-ByR_1gcU.js} +0 -0
  192. /package/dist/public/assets/{asset-dispatch-Ccnji1rt.js → asset-dispatch-Cz1weVX3.js} +0 -0
  193. /package/dist/public/assets/{auth-prompt-store-C4YJf5De.js → auth-prompt-store-BYOv6_8O.js} +0 -0
  194. /package/dist/public/assets/{badge-BYteLKha.js → badge-DFX4S3a5.js} +0 -0
  195. /package/dist/public/assets/{copilot-CmkvU8CH.js → copilot-Dh1BU6kS.js} +0 -0
  196. /package/dist/public/assets/{cursor-CIl_AjI1.js → cursor-B6reg1lS.js} +0 -0
  197. /package/dist/public/assets/{dist-sSZdzHur.js → dist-DAqA-GDU.js} +0 -0
  198. /package/dist/public/assets/{documents-fetch-DnpUYK4R.js → documents-fetch-CV8lWh8v.js} +0 -0
  199. /package/dist/public/assets/{download-Dn5ulvxm.js → download-C3PYuI1f.js} +0 -0
  200. /package/dist/public/assets/{external-link-3El87eIe.js → external-link-BIMZpgNa.js} +0 -0
  201. /package/dist/public/assets/{eye-DmhHKPNd.js → eye-CSz7ogHo.js} +0 -0
  202. /package/dist/public/assets/{field-CvwbVfuf.js → field-CtVP3IIV.js} +0 -0
  203. /package/dist/public/assets/{file-tree-rename-validation-C2Ibtqn6.js → file-tree-rename-validation-CCqiFGp1.js} +0 -0
  204. /package/dist/public/assets/{folder-CWlDik9N.js → folder-CopDpuy5.js} +0 -0
  205. /package/dist/public/assets/{folder-open-BTTec8yg.js → folder-open-DUSc8NL8.js} +0 -0
  206. /package/dist/public/assets/{globals-CfOSCw3_.js → globals-CLY_4Hw9.js} +0 -0
  207. /package/dist/public/assets/{hash-PyoMEEnH.js → hash-DI30zEBt.js} +0 -0
  208. /package/dist/public/assets/{info-w0kv2CeC.js → info-CV59RycV.js} +0 -0
  209. /package/dist/public/assets/{input-BFt4qZaV.js → input-BYiOK210.js} +0 -0
  210. /package/dist/public/assets/{list-plus-2r7_ATZj.js → list-plus-DBdmIc6v.js} +0 -0
  211. /package/dist/public/assets/{minus-DNhR60ON.js → minus-D07ZsfDZ.js} +0 -0
  212. /package/dist/public/assets/{miss-dialog-store-DzXIxgCB.js → miss-dialog-store-sSyy54tn.js} +0 -0
  213. /package/dist/public/assets/{panel-D2VXQC58.js → panel-CbGx_cRv.js} +0 -0
  214. /package/dist/public/assets/{panel-right-open-DAyUhiQN.js → panel-right-open-B66oA9M1.js} +0 -0
  215. /package/dist/public/assets/{paperclip-B6sgPA4f.js → paperclip-BlKB6Xwa.js} +0 -0
  216. /package/dist/public/assets/{refresh-cw-CR2QWccs.js → refresh-cw-DQervzDZ.js} +0 -0
  217. /package/dist/public/assets/{spinner-CHTY-VE-.js → spinner-BqySY7qY.js} +0 -0
  218. /package/dist/public/assets/{square-pen-DdAKbKU7.js → square-pen-Cb57Y3fg.js} +0 -0
  219. /package/dist/public/assets/{startup-marks-CTM7uDIJ.js → startup-marks-Cdkh8q3E.js} +0 -0
  220. /package/dist/public/assets/{stex-s_JxeNEZ.js → stex-PMopVeEZ.js} +0 -0
  221. /package/dist/public/assets/{terminal-DRi0ugpC.js → terminal-Cvoe7pfU.js} +0 -0
  222. /package/dist/public/assets/{textarea-CzW0aR0j.js → textarea-yZk4yd9U.js} +0 -0
  223. /package/dist/public/assets/{trash-2-BWJWOK8-.js → trash-2-N0ilsnnr.js} +0 -0
  224. /package/dist/public/assets/{triangle-alert-DV20-jn9.js → triangle-alert-COo6wbUK.js} +0 -0
  225. /package/dist/public/assets/{undo-2-CMyZc9mZ.js → undo-2-WGCwknr8.js} +0 -0
  226. /package/dist/public/assets/{use-installed-clis-DmyaQmU9.js → use-installed-clis-Cydpb5jd.js} +0 -0
  227. /package/dist/public/assets/{wrench-C3BL-uHg.js → wrench-CP2MIQHF.js} +0 -0
  228. /package/dist/public/assets/{x-BaJrHZK_.js → x-DS57FvHW.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{r as e}from"./chunk-CYidjpOJ.js";import{E as t,F as n,H as r,I as i,J as a,K as o,Mt as s,Ot as c,R as l,S as u,U as d,Ut as f,W as p,Z as m,a as h,ft as g,i as ee,j as te,k as ne,kt as re,o as ie,p as ae,q as _,s as oe,x as se,z as v}from"./dist-sSZdzHur.js";import{n as ce,r as le}from"./dist-BR5M-SiF.js";import{t as ue}from"./dist-D7MIhDGJ.js";var de=class e{static create(t,n,r,i,a){return new e(t,n,r,i+(i<<8)+t+(n<<4)|0,a,[],[])}constructor(e,t,n,i,a,o,s){this.type=e,this.value=t,this.from=n,this.hash=i,this.end=a,this.children=o,this.positions=s,this.hashProp=[[r.contextHash,i]]}addChild(e,t){e.prop(r.contextHash)!=this.hash&&(e=new _(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new _(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(e,t,n)=>new _(p.none,e,t,n,this.hashProp)})}},y;(function(e){e[e.Document=1]=`Document`,e[e.CodeBlock=2]=`CodeBlock`,e[e.FencedCode=3]=`FencedCode`,e[e.Blockquote=4]=`Blockquote`,e[e.HorizontalRule=5]=`HorizontalRule`,e[e.BulletList=6]=`BulletList`,e[e.OrderedList=7]=`OrderedList`,e[e.ListItem=8]=`ListItem`,e[e.ATXHeading1=9]=`ATXHeading1`,e[e.ATXHeading2=10]=`ATXHeading2`,e[e.ATXHeading3=11]=`ATXHeading3`,e[e.ATXHeading4=12]=`ATXHeading4`,e[e.ATXHeading5=13]=`ATXHeading5`,e[e.ATXHeading6=14]=`ATXHeading6`,e[e.SetextHeading1=15]=`SetextHeading1`,e[e.SetextHeading2=16]=`SetextHeading2`,e[e.HTMLBlock=17]=`HTMLBlock`,e[e.LinkReference=18]=`LinkReference`,e[e.Paragraph=19]=`Paragraph`,e[e.CommentBlock=20]=`CommentBlock`,e[e.ProcessingInstructionBlock=21]=`ProcessingInstructionBlock`,e[e.Escape=22]=`Escape`,e[e.Entity=23]=`Entity`,e[e.HardBreak=24]=`HardBreak`,e[e.Emphasis=25]=`Emphasis`,e[e.StrongEmphasis=26]=`StrongEmphasis`,e[e.Link=27]=`Link`,e[e.Image=28]=`Image`,e[e.InlineCode=29]=`InlineCode`,e[e.HTMLTag=30]=`HTMLTag`,e[e.Comment=31]=`Comment`,e[e.ProcessingInstruction=32]=`ProcessingInstruction`,e[e.Autolink=33]=`Autolink`,e[e.HeaderMark=34]=`HeaderMark`,e[e.QuoteMark=35]=`QuoteMark`,e[e.ListMark=36]=`ListMark`,e[e.LinkMark=37]=`LinkMark`,e[e.EmphasisMark=38]=`EmphasisMark`,e[e.CodeMark=39]=`CodeMark`,e[e.CodeText=40]=`CodeText`,e[e.CodeInfo=41]=`CodeInfo`,e[e.LinkTitle=42]=`LinkTitle`,e[e.LinkLabel=43]=`LinkLabel`,e[e.URL=44]=`URL`})(y||={});var fe=class{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}},pe=class{constructor(){this.text=``,this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return S(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let r=t;r<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=this.text.charCodeAt(t)==9?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e=``;for(let t=0;t<this.basePos;t++)e+=` `;return e+this.text.slice(this.basePos)}};function b(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==y.OrderedList?E:T)(n,t,!1);return r>0&&(e.type!=y.BulletList||w(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}var me={[y.Blockquote](e,t,n){return n.next==62?(n.markers.push(L(y.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(x(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0):!1},[y.ListItem](e,t,n){return n.indent<n.baseIndent+e.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[y.OrderedList]:b,[y.BulletList]:b,[y.Document](){return!0}};function x(e){return e==32||e==9||e==10||e==13}function S(e,t=0){for(;t<e.length&&x(e.charCodeAt(t));)t++;return t}function he(e,t,n){for(;t>n&&x(e.charCodeAt(t-1));)t--;return t}function C(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(e.next==96){for(let n=t;n<e.text.length;n++)if(e.text.charCodeAt(n)==96)return-1}return t}function ge(e){return e.next==62?e.text.charCodeAt(e.pos+1)==32?2:1:-1}function w(e,t,n){if(e.next!=42&&e.next!=45&&e.next!=95)return-1;let r=1;for(let t=e.pos+1;t<e.text.length;t++){let n=e.text.charCodeAt(t);if(n==e.next)r++;else if(!x(n))return-1}return n&&e.next==45&&ye(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(Ee.SetextHeading)>-1||r<3?-1:1}function _e(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function T(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||x(e.text.charCodeAt(e.pos+1)))&&(!n||_e(t,y.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function E(e,t,n){let r=e.pos,i=e.next;for(;i>=48&&i<=57;){if(r++,r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||r<e.text.length-1&&!x(e.text.charCodeAt(r+1))||n&&!_e(t,y.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function ve(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==35;)t++;if(t<e.text.length&&e.text.charCodeAt(t)!=32)return-1;let n=t-e.pos;return n>6?-1:n}function ye(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&x(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}var D=/^[ \t]*$/,be=/-->/,xe=/\?>/,O=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,be],[/^\s*<\?/,xe],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,D],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,D]];function Se(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let e=0,t=O.length-+!!n;e<t;e++)if(O[e][0].test(r))return e;return-1}function Ce(e,t){let n=e.countIndent(t,e.pos,e.indent),r=e.countIndent(e.skipSpace(t),t,n);return r>=n+5?n+1:r}function k(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==y.CodeText?e[r].to=n:e.push(L(y.CodeText,t,n))}var A={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let r=t.findColumn(n),i=e.lineStart+r,a=e.lineStart+t.text.length,o=[],s=[];for(k(o,i,a);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){k(s,e.lineStart-1,e.lineStart);for(let e of t.markers)s.push(e)}else if(t.indent<n)break;else{if(s.length){for(let e of s)e.type==y.CodeText?k(o,e.from,e.to):o.push(e);s=[]}k(o,e.lineStart-1,e.lineStart);for(let e of t.markers)o.push(e);a=e.lineStart+t.text.length;let n=e.lineStart+t.findColumn(t.baseIndent+4);n<a&&k(o,n,a)}return s.length&&(s=s.filter(e=>e.type!=y.CodeText),s.length&&(t.markers=s.concat(t.markers))),e.addNode(e.buffer.writeElements(o,-i).finish(y.CodeBlock,a-i),i),!0},FencedCode(e,t){let n=C(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,a=n-t.pos,o=t.skipSpace(n),s=he(t.text,t.text.length,o),c=[L(y.CodeMark,r,r+a)];o<s&&c.push(L(y.CodeInfo,e.lineStart+o,e.lineStart+s));for(let n=!0,r=!0,o=!1;e.nextLine()&&t.depth>=e.stack.length;n=!1){let s=t.pos;if(t.indent-t.baseIndent<4)for(;s<t.text.length&&t.text.charCodeAt(s)==i;)s++;if(s-t.pos>=a&&t.skipSpace(s)==t.text.length){for(let e of t.markers)c.push(e);r&&o&&k(c,e.lineStart-1,e.lineStart),c.push(L(y.CodeMark,e.lineStart+t.pos,e.lineStart+s)),e.nextLine();break}else{o=!0,n||(k(c,e.lineStart-1,e.lineStart),r=!1);for(let e of t.markers)c.push(e);let i=e.lineStart+t.basePos,a=e.lineStart+t.text.length;i<a&&(k(c,i,a),r=!1)}}return e.addNode(e.buffer.writeElements(c,-r).finish(y.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=ge(t);return n<0?!1:(e.startContext(y.Blockquote,t.pos),e.addNode(y.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(w(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(y.HorizontalRule,n),!0},BulletList(e,t){let n=T(t,e,!1);if(n<0)return!1;e.block.type!=y.BulletList&&e.startContext(y.BulletList,t.basePos,t.next);let r=Ce(t,t.pos+1);return e.startContext(y.ListItem,t.basePos,r-t.baseIndent),e.addNode(y.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},OrderedList(e,t){let n=E(t,e,!1);if(n<0)return!1;e.block.type!=y.OrderedList&&e.startContext(y.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=Ce(t,t.pos+n);return e.startContext(y.ListItem,t.basePos,r-t.baseIndent),e.addNode(y.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},ATXHeading(e,t){let n=ve(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,a=he(t.text,t.text.length,r),o=a;for(;o>r&&t.text.charCodeAt(o-1)==t.next;)o--;(o==a||o==r||!x(t.text.charCodeAt(o-1)))&&(o=t.text.length);let s=e.buffer.write(y.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,o),i+n+1),-i);o<t.text.length&&s.write(y.HeaderMark,o-r,a-r);let c=s.finish(y.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(c,i),!0},HTMLBlock(e,t){let n=Se(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=O[n][1],a=[],o=i!=D;for(;!i.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){o=!1;break}for(let e of t.markers)a.push(e)}o&&e.nextLine();let s=i==be?y.CommentBlock:i==xe?y.ProcessingInstructionBlock:y.HTMLBlock,c=e.prevLineEnd();return e.addNode(e.buffer.writeElements(a,-r).finish(s,c-r),r),!0},SetextHeading:void 0},we=class{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(this.stage==-1)return!1;let r=n.content+`
1
+ import{r as e}from"./chunk-CYidjpOJ.js";import{E as t,F as n,H as r,I as i,J as a,K as o,Mt as s,Ot as c,R as l,S as u,U as d,Ut as f,W as p,Z as m,a as h,ft as g,i as ee,j as te,k as ne,kt as re,o as ie,p as ae,q as _,s as oe,x as se,z as v}from"./dist-DAqA-GDU.js";import{n as ce,r as le}from"./dist-CkFATl39.js";import{t as ue}from"./dist-ofeGnIBD.js";var de=class e{static create(t,n,r,i,a){return new e(t,n,r,i+(i<<8)+t+(n<<4)|0,a,[],[])}constructor(e,t,n,i,a,o,s){this.type=e,this.value=t,this.from=n,this.hash=i,this.end=a,this.children=o,this.positions=s,this.hashProp=[[r.contextHash,i]]}addChild(e,t){e.prop(r.contextHash)!=this.hash&&(e=new _(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new _(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(e,t,n)=>new _(p.none,e,t,n,this.hashProp)})}},y;(function(e){e[e.Document=1]=`Document`,e[e.CodeBlock=2]=`CodeBlock`,e[e.FencedCode=3]=`FencedCode`,e[e.Blockquote=4]=`Blockquote`,e[e.HorizontalRule=5]=`HorizontalRule`,e[e.BulletList=6]=`BulletList`,e[e.OrderedList=7]=`OrderedList`,e[e.ListItem=8]=`ListItem`,e[e.ATXHeading1=9]=`ATXHeading1`,e[e.ATXHeading2=10]=`ATXHeading2`,e[e.ATXHeading3=11]=`ATXHeading3`,e[e.ATXHeading4=12]=`ATXHeading4`,e[e.ATXHeading5=13]=`ATXHeading5`,e[e.ATXHeading6=14]=`ATXHeading6`,e[e.SetextHeading1=15]=`SetextHeading1`,e[e.SetextHeading2=16]=`SetextHeading2`,e[e.HTMLBlock=17]=`HTMLBlock`,e[e.LinkReference=18]=`LinkReference`,e[e.Paragraph=19]=`Paragraph`,e[e.CommentBlock=20]=`CommentBlock`,e[e.ProcessingInstructionBlock=21]=`ProcessingInstructionBlock`,e[e.Escape=22]=`Escape`,e[e.Entity=23]=`Entity`,e[e.HardBreak=24]=`HardBreak`,e[e.Emphasis=25]=`Emphasis`,e[e.StrongEmphasis=26]=`StrongEmphasis`,e[e.Link=27]=`Link`,e[e.Image=28]=`Image`,e[e.InlineCode=29]=`InlineCode`,e[e.HTMLTag=30]=`HTMLTag`,e[e.Comment=31]=`Comment`,e[e.ProcessingInstruction=32]=`ProcessingInstruction`,e[e.Autolink=33]=`Autolink`,e[e.HeaderMark=34]=`HeaderMark`,e[e.QuoteMark=35]=`QuoteMark`,e[e.ListMark=36]=`ListMark`,e[e.LinkMark=37]=`LinkMark`,e[e.EmphasisMark=38]=`EmphasisMark`,e[e.CodeMark=39]=`CodeMark`,e[e.CodeText=40]=`CodeText`,e[e.CodeInfo=41]=`CodeInfo`,e[e.LinkTitle=42]=`LinkTitle`,e[e.LinkLabel=43]=`LinkLabel`,e[e.URL=44]=`URL`})(y||={});var fe=class{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}},pe=class{constructor(){this.text=``,this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return S(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let r=t;r<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=this.text.charCodeAt(t)==9?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e=``;for(let t=0;t<this.basePos;t++)e+=` `;return e+this.text.slice(this.basePos)}};function b(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==y.OrderedList?E:T)(n,t,!1);return r>0&&(e.type!=y.BulletList||w(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}var me={[y.Blockquote](e,t,n){return n.next==62?(n.markers.push(L(y.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(x(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0):!1},[y.ListItem](e,t,n){return n.indent<n.baseIndent+e.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[y.OrderedList]:b,[y.BulletList]:b,[y.Document](){return!0}};function x(e){return e==32||e==9||e==10||e==13}function S(e,t=0){for(;t<e.length&&x(e.charCodeAt(t));)t++;return t}function he(e,t,n){for(;t>n&&x(e.charCodeAt(t-1));)t--;return t}function C(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(e.next==96){for(let n=t;n<e.text.length;n++)if(e.text.charCodeAt(n)==96)return-1}return t}function ge(e){return e.next==62?e.text.charCodeAt(e.pos+1)==32?2:1:-1}function w(e,t,n){if(e.next!=42&&e.next!=45&&e.next!=95)return-1;let r=1;for(let t=e.pos+1;t<e.text.length;t++){let n=e.text.charCodeAt(t);if(n==e.next)r++;else if(!x(n))return-1}return n&&e.next==45&&ye(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(Ee.SetextHeading)>-1||r<3?-1:1}function _e(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function T(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||x(e.text.charCodeAt(e.pos+1)))&&(!n||_e(t,y.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function E(e,t,n){let r=e.pos,i=e.next;for(;i>=48&&i<=57;){if(r++,r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||r<e.text.length-1&&!x(e.text.charCodeAt(r+1))||n&&!_e(t,y.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function ve(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==35;)t++;if(t<e.text.length&&e.text.charCodeAt(t)!=32)return-1;let n=t-e.pos;return n>6?-1:n}function ye(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&x(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}var D=/^[ \t]*$/,be=/-->/,xe=/\?>/,O=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,be],[/^\s*<\?/,xe],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,D],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,D]];function Se(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let e=0,t=O.length-+!!n;e<t;e++)if(O[e][0].test(r))return e;return-1}function Ce(e,t){let n=e.countIndent(t,e.pos,e.indent),r=e.countIndent(e.skipSpace(t),t,n);return r>=n+5?n+1:r}function k(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==y.CodeText?e[r].to=n:e.push(L(y.CodeText,t,n))}var A={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let r=t.findColumn(n),i=e.lineStart+r,a=e.lineStart+t.text.length,o=[],s=[];for(k(o,i,a);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){k(s,e.lineStart-1,e.lineStart);for(let e of t.markers)s.push(e)}else if(t.indent<n)break;else{if(s.length){for(let e of s)e.type==y.CodeText?k(o,e.from,e.to):o.push(e);s=[]}k(o,e.lineStart-1,e.lineStart);for(let e of t.markers)o.push(e);a=e.lineStart+t.text.length;let n=e.lineStart+t.findColumn(t.baseIndent+4);n<a&&k(o,n,a)}return s.length&&(s=s.filter(e=>e.type!=y.CodeText),s.length&&(t.markers=s.concat(t.markers))),e.addNode(e.buffer.writeElements(o,-i).finish(y.CodeBlock,a-i),i),!0},FencedCode(e,t){let n=C(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,a=n-t.pos,o=t.skipSpace(n),s=he(t.text,t.text.length,o),c=[L(y.CodeMark,r,r+a)];o<s&&c.push(L(y.CodeInfo,e.lineStart+o,e.lineStart+s));for(let n=!0,r=!0,o=!1;e.nextLine()&&t.depth>=e.stack.length;n=!1){let s=t.pos;if(t.indent-t.baseIndent<4)for(;s<t.text.length&&t.text.charCodeAt(s)==i;)s++;if(s-t.pos>=a&&t.skipSpace(s)==t.text.length){for(let e of t.markers)c.push(e);r&&o&&k(c,e.lineStart-1,e.lineStart),c.push(L(y.CodeMark,e.lineStart+t.pos,e.lineStart+s)),e.nextLine();break}else{o=!0,n||(k(c,e.lineStart-1,e.lineStart),r=!1);for(let e of t.markers)c.push(e);let i=e.lineStart+t.basePos,a=e.lineStart+t.text.length;i<a&&(k(c,i,a),r=!1)}}return e.addNode(e.buffer.writeElements(c,-r).finish(y.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=ge(t);return n<0?!1:(e.startContext(y.Blockquote,t.pos),e.addNode(y.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(w(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(y.HorizontalRule,n),!0},BulletList(e,t){let n=T(t,e,!1);if(n<0)return!1;e.block.type!=y.BulletList&&e.startContext(y.BulletList,t.basePos,t.next);let r=Ce(t,t.pos+1);return e.startContext(y.ListItem,t.basePos,r-t.baseIndent),e.addNode(y.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},OrderedList(e,t){let n=E(t,e,!1);if(n<0)return!1;e.block.type!=y.OrderedList&&e.startContext(y.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=Ce(t,t.pos+n);return e.startContext(y.ListItem,t.basePos,r-t.baseIndent),e.addNode(y.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},ATXHeading(e,t){let n=ve(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,a=he(t.text,t.text.length,r),o=a;for(;o>r&&t.text.charCodeAt(o-1)==t.next;)o--;(o==a||o==r||!x(t.text.charCodeAt(o-1)))&&(o=t.text.length);let s=e.buffer.write(y.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,o),i+n+1),-i);o<t.text.length&&s.write(y.HeaderMark,o-r,a-r);let c=s.finish(y.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(c,i),!0},HTMLBlock(e,t){let n=Se(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=O[n][1],a=[],o=i!=D;for(;!i.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){o=!1;break}for(let e of t.markers)a.push(e)}o&&e.nextLine();let s=i==be?y.CommentBlock:i==xe?y.ProcessingInstructionBlock:y.HTMLBlock,c=e.prevLineEnd();return e.addNode(e.buffer.writeElements(a,-r).finish(s,c-r),r),!0},SetextHeading:void 0},we=class{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(this.stage==-1)return!1;let r=n.content+`
2
2
  `+t.scrub(),i=this.advance(r);return i>-1&&i<r.length?this.complete(e,n,i):!1}finish(e,t){return(this.stage==2||this.stage==3)&&S(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,n){return e.addLeafElement(t,L(y.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;)if(this.stage==-1)return-1;else if(this.stage==0){if(!this.nextStage(Ve(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(L(y.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(ze(e,S(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=S(e,this.pos),n=0;if(t>this.pos){let r=Be(e,t,this.start);if(r){let t=j(e,r.to-this.start);t>0&&(this.nextStage(r),n=t)}}return n||=j(e,this.pos),n>0&&n<e.length?n:-1}else return j(e,this.pos)}};function j(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(n==10)break;if(!x(n))return-1}return t}var Te=class{nextLine(e,t,n){let r=t.depth<e.stack.length?-1:ye(t),i=t.next;if(r<0)return!1;let a=L(y.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,L(i==61?y.SetextHeading1:y.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),a])),!0}finish(){return!1}},Ee={LinkReference(e,t){return t.content.charCodeAt(0)==91?new we(t):null},SetextHeading(){return new Te}},De=[(e,t)=>ve(t)>=0,(e,t)=>C(t)>=0,(e,t)=>ge(t)>=0,(e,t)=>T(t,e,!0)>=0,(e,t)=>E(t,e,!0)>=0,(e,t)=>w(t,e,!0)>=0,(e,t)=>Se(t,e,!0)>=0],Oe={text:``,end:0},ke=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.line=new pe,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=de.create(y.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new Ue(n,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let t=0;;){let n=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;t<e.markers.length&&(!n||e.markers[t].from<n.end);){let n=e.markers[t++];this.addNode(n.type,n.from,n.to)}if(!n)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;start:for(;;){for(let t of this.parser.blockParsers)if(t){let n=t(this,e);if(n!=0){if(n==1)return null;e.forward();continue start}}break}let t=new fe(this.lineStart+e.pos,e.text.slice(e.pos));for(let e of this.parser.leafBlockParsers)if(e){let n=e(this,t);n&&t.parsers.push(n)}lines:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,t))break lines}for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+=`
3
3
  `+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=We(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=Oe;if(t.end=e,e>=this.to)t.text=``;else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let e=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<t.end;){n++;let r=this.ranges[n].from,i=this.lineChunkAt(r);t.end=r+i.length,t.text=t.text.slice(0,this.ranges[n-1].to-e)+i,e=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let t=this.stack[e.depth],n=this.parser.skipContextMarkup[t.type];if(!n)throw Error(`Unhandled block context `+y[t.type]);let r=this.line.markers.length;if(!n(t,this,e)){this.line.markers.length>r&&(t.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
4
4
  `?``:t;else{let e=t.indexOf(`
@@ -1 +1 @@
1
- import{$ as e,At as t,Bt as n,Ct as r,Et as i,F as a,Ft as o,Gt as s,Ht as c,It as l,Lt as u,Mt as d,Nt as f,Ot as p,Rt as m,Vt as h,X as g,Y as _,Z as v,bt as y,et as b,ft as x,jt as S,k as ee,mt as C,ot as w,zt as te}from"./dist-sSZdzHur.js";var T=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=a(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(se(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function ne(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function re(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=ne(t)+ne(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function ie(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:re(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function ae(e,t){return n=>{for(let t=a(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}var oe=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function E(e){return e.selection.main.from}function se(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var D=r.define();function ce(e,t,n,r){let{main:i}=e.selection,a=n-i.from,o=r-i.from;return{...e.changeByRange(s=>{if(s!=i&&n!=r&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(n,r))return{range:s};let c=e.toText(t);return{changes:{from:s.from+a,to:r==i.from?s.to:s.from+o,insert:c},range:p.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var O=new WeakMap;function le(e){if(!Array.isArray(e))return e;let t=O.get(e);return t||O.set(e,t=ie(e)),t}var k=l.define(),A=l.define(),ue=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let r=n(e,t),i=h(r);this.chars.push(r);let a=e.slice(t,t+i),o=a.toUpperCase();this.folded.push(n(o==a?a.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:r,any:i,precise:a,byWord:o}=this;if(t.length==1){let i=n(e,0),a=h(i),o=a==e.length?0:-100;if(i!=t[0])if(i==r[0])o+=-200;else return null;return this.ret(o,[0,a])}let c=e.indexOf(this.pattern);if(c==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,u=0;if(c<0){for(let a=0,o=Math.min(e.length,200);a<o&&u<l;){let o=n(e,a);(o==t[u]||o==r[u])&&(i[u++]=a),a+=h(o)}if(u<l)return null}let d=0,f=0,p=!1,m=0,g=-1,_=-1,v=/[a-z]/.test(e),y=!0;for(let i=0,u=Math.min(e.length,200),b=0;i<u&&f<l;){let u=n(e,i);c<0&&(d<l&&u==t[d]&&(a[d++]=i),m<l&&(u==t[m]||u==r[m]?(m==0&&(g=i),_=i+1,m++):m=0));let x,S=u<255?u>=48&&u<=57||u>=97&&u<=122?2:+(u>=65&&u<=90):(x=s(u))==x.toLowerCase()?x==x.toUpperCase()?0:2:1;(!i||S==1&&v||b==0&&S!=0)&&(t[f]==u||r[f]==u&&(p=!0)?o[f++]=i:o.length&&(y=!1)),b=S,i+=h(u)}return f==l&&o[0]==0&&y?this.result(-100+(p?-200:0),o,e):m==l&&g==0?this.ret(-200-e.length+(_==e.length?0:-100),[0,_]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):m==l?this.ret(-900-e.length,[g,_]):f==l?this.result(-100+(p?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,r){let i=[],a=0;for(let e of t){let t=e+(this.astral?h(n(r,e)):1);a&&i[a-1]==e?i[a-1]=t:(i[a++]=e,i[a++]=t)}return this.ret(e-r.length,i)}},de=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},j=t.define({combine(e){return c(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:fe,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>M(e(n),t(n)),optionClass:(e,t)=>n=>M(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function M(e,t){return e?t?e+` `+t:e:t}function fe(e,t,n,r,i,a){let o=e.textDirection==g.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let _=(t.bottom-t.top)/a.offsetHeight,v=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/_}px; max-width: ${d/v}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var N=l.define();function pe(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function P(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var me=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(j);this.optionContent=pe(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=P(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:N.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(j).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:A.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener(`scroll`,()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;(!n.open||n.open.options!=r)&&(this.range=P(r.length,i,e.state.facet(j).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=P(t.options.length,t.selected,this.view.state.facet(j).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>C(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&ge(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(j).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0))if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function he(e,t){return n=>new me(n,e,t)}function ge(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function F(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function _e(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(j);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new oe(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new de(n):new ue(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new oe(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):F(e.completion)>F(c)&&(s[s.length-1]=e),c=e.completion}return s}var ve=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,I(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=_e(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(j).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,I(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:Te,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},ye=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(Ce,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(j),i=(r.override||n.languageDataAt(`autocomplete`,E(n)).map(le)).map(e=>(this.active.find(t=>t.source==e)||new R(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(B));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!be(i,this.active)||o?a=ve.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new R(e.source,0):e));for(let e of t.effects)e.is(N)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?xe:Se}};function be(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var xe={"aria-autocomplete":`list`},Se={};function I(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var Ce=[];function L(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(D);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var R=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=L(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(k))i=new e(i.source,1,n.value);else if(n.is(A))i=new e(i.source,0);else if(n.is(B))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(E(e.state))}},z=class e extends R{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=E(t.state);if(o>a||!r||n&2&&(E(t.startState)==this.from||o<this.limit))return new R(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return we(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new T(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??E(t.state)):new R(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new R(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function we(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):se(e,!0).test(i)}var B=l.define({map(e,t){return e.map(e=>e.map(t))}}),V=u.define({create(){return ye.start()},update(e,t){return e.update(t)},provide:e=>[y.from(e,e=>e.tooltip),v.contentAttributes.from(e,e=>e.attrs)]});function H(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(V).active.find(e=>e.source==t.source);return r instanceof z?(typeof n==`string`?e.dispatch({...ce(e.state,n,r.from,r.to),annotations:D.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}var Te=he(V,H);function U(e,t=`option`){return n=>{let r=n.state.field(V,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(j).interactionDelay)return!1;let i=1,a;t==`page`&&(a=w(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector(`li`).offsetHeight)-1));let{length:o}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t==`page`?0:o-1:s>=o&&(s=t==`page`?o-1:0),n.dispatch({effects:N.of(s)}),!0}}var Ee=e=>{let t=e.state.field(V,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(j).interactionDelay?!1:H(e,t.open.options[t.open.selected])},W=e=>e.state.field(V,!1)?(e.dispatch({effects:k.of(!0)}),!0):!1,De=e=>{let t=e.state.field(V,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:A.of(null)}),!0)},Oe=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},ke=50,Ae=1e3,je=e.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(V).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(V),n=e.state.facet(j);if(!e.selectionSet&&!e.docChanged&&e.startState.field(V)==t)return;let r=e.transactions.some(e=>{let t=L(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>ke&&Date.now()-n.time>Ae){for(let e of n.context.abortListeners)try{e()}catch(e){C(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(k)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(V);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(j).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new T(t,E(t),e.explicit,this.view),r=new Oe(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:A.of(null)}),C(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(j).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(j),n=this.view.state.field(V);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=E(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new z(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending)if(i.done==null){let n=new R(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:B.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(V,!1);if(t&&t.tooltip&&this.view.state.facet(j).closeOnBlur){let n=t.open&&w(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:A.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:k.of(!1)}),20),this.composing=0}}}),Me=typeof navigator==`object`&&/Win/.test(navigator.platform),Ne=d.highest(v.domEventHandlers({keydown(e,t){let n=t.state.field(V,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Me&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&H(t,r),!1}})),G=v.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),Pe=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},Fe=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,S.TrackDel),r=t.mapPos(this.to,1,S.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},Ie=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(ee);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new Fe(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new Pe(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},Le=_.widget({widget:new class extends b{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),Re=_.mark({class:`cm-snippetField`}),K=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=_.set(e.map(e=>(e.from==e.to?Le:Re).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},q=l.define({map(e,t){return e&&e.map(t)}}),ze=l.define(),J=u.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(q))return n.value;if(n.is(ze)&&e)return new K(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>v.decorations.from(e,e=>e?e.deco:_.none)});function Y(e,t){return p.create(e.filter(e=>e.field==t).map(e=>p.range(e.from,e.to)))}function Be(e){let t=Ie.parse(e);return(e,n,r,i)=>{let{text:a,ranges:o}=t.instantiate(e.state,r),{main:s}=e.state.selection,c={changes:{from:r,to:i==s.from?s.to:i,insert:m.of(a)},scrollIntoView:!0,annotations:n?[D.of(n),te.userEvent.of(`input.complete`)]:void 0};if(o.length&&(c.selection=Y(o,0)),o.some(e=>e.field>0)){let t=new K(o,0),n=c.effects=[q.of(t)];e.state.field(J,!1)===void 0&&n.push(l.appendConfig.of([J,We,Ke,G]))}e.dispatch(e.state.update(c))}}function Ve(e){return({state:t,dispatch:n})=>{let r=t.field(J,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:Y(r.ranges,i),effects:q.of(a?null:new K(r.ranges,i)),scrollIntoView:!0})),!0}}var He=[{key:`Tab`,run:Ve(1),shift:Ve(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(J,!1)?(t(e.update({effects:q.of(null)})),!0):!1}],Ue=t.define({combine(e){return e.length?e[0]:He}}),We=d.highest(x.compute([Ue],e=>e.facet(Ue)));function Ge(e,t){return{...t,apply:Be(e)}}var Ke=v.domEventHandlers({mousedown(e,t){let n=t.state.field(J,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:Y(n.ranges,i.field),effects:q.of(n.ranges.some(e=>e.field>i.field)?new K(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),X={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},Z=l.define({map(e,t){return t.mapPos(e,-1,S.TrackAfter)??void 0}}),Q=new class extends o{};Q.startSide=1,Q.endSide=-1;var qe=u.define({create(){return f.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(Z)&&(e=e.update({add:[Q.range(n.value,n.value+1)]}));return e}});function Je(){return[$e,qe]}var Ye=`()[]{}<>«»»«[]{}`;function Xe(e){for(let t=0;t<16;t+=2)if(Ye.charCodeAt(t)==e)return Ye.charAt(t+1);return s(e<128?e:e+1)}function Ze(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||X}var Qe=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),$e=v.inputHandler.of((e,t,r,i)=>{if((Qe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let a=e.state.selection.main;if(i.length>2||i.length==2&&h(n(i,0))==1||t!=a.from||r!=a.to)return!1;let o=tt(e.state,i);return o?(e.dispatch(o),!0):!1}),et=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Ze(e,e.selection.main.head).brackets||X.brackets,i=null,a=e.changeByRange(t=>{if(t.empty){let i=rt(e.doc,t.head);for(let a of r)if(a==i&&$(e.doc,t.head)==Xe(n(a,0)))return{changes:{from:t.head-a.length,to:t.head+a.length},range:p.cursor(t.head-a.length)}}return{range:i=t}});return i||t(e.update(a,{scrollIntoView:!0,userEvent:`delete.backward`})),!i}}];function tt(e,t){let r=Ze(e,e.selection.main.head),i=r.brackets||X.brackets;for(let a of i){let o=Xe(n(a,0));if(t==a)return o==a?ot(e,a,i.indexOf(a+a+a)>-1,r):it(e,a,o,r.before||X.before);if(t==o&&nt(e,e.selection.main.from))return at(e,a,o)}return null}function nt(e,t){let n=!1;return e.field(qe).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function $(e,t){let r=e.sliceString(t,t+2);return r.slice(0,h(n(r,0)))}function rt(e,t){let r=e.sliceString(t-2,t);return h(n(r,0))==r.length?r:r.slice(1)}function it(e,t,n,r){let i=null,a=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:Z.of(a.to+t.length),range:p.range(a.anchor+t.length,a.head+t.length)};let o=$(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:Z.of(a.head+t.length),range:p.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function at(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&$(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:p.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function ot(e,t,n,r){let a=r.stringPrefixes||X.stringPrefixes,o=null,s=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:Z.of(r.to+t.length),range:p.range(r.anchor+t.length,r.head+t.length)};let s=r.head,c=$(e.doc,s),l;if(c==t){if(st(e,s))return{changes:{insert:t+t,from:s},effects:Z.of(s+t.length),range:p.cursor(s+t.length)};if(nt(e,s)){let r=n&&e.sliceDoc(s,s+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:s,to:s+r.length,insert:r},range:p.cursor(s+r.length)}}}else if(n&&e.sliceDoc(s-2*t.length,s)==t+t&&(l=lt(e,s-2*t.length,a))>-1&&st(e,l))return{changes:{insert:t+t+t+t,from:s},effects:Z.of(s+t.length),range:p.cursor(s+t.length)};else if(e.charCategorizer(s)(c)!=i.Word&&lt(e,s,a)>-1&&!ct(e,s,t,a))return{changes:{insert:t+t,from:s},effects:Z.of(s+t.length),range:p.cursor(s+t.length)};return{range:o=r}});return o?null:e.update(s,{scrollIntoView:!0,userEvent:`input.type`})}function st(e,t){let n=a(e).resolveInner(t+1);return n.parent&&n.from==t}function ct(e,t,n,r){let i=a(e).resolveInner(t,-1),o=r.reduce((e,t)=>Math.max(e,t.length),0);for(let a=0;a<5;a++){let a=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+o)),s=a.indexOf(n);if(!s||s>-1&&r.indexOf(a.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function lt(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=i.Word)return t;for(let a of n){let n=t-a.length;if(e.sliceDoc(n,t)==a&&r(e.sliceDoc(n-1,n))!=i.Word)return n}return-1}function ut(e={}){return[Ne,V,j.of(e),je,ft,G]}var dt=[{key:`Ctrl-Space`,run:W},{mac:"Alt-`",run:W},{mac:`Alt-i`,run:W},{key:`Escape`,run:De},{key:`ArrowDown`,run:U(!0)},{key:`ArrowUp`,run:U(!1)},{key:`PageDown`,run:U(!0,`page`)},{key:`PageUp`,run:U(!1,`page`)},{key:`Enter`,run:Ee}],ft=d.highest(x.computeN([j],e=>e.facet(j).defaultKeymap?[dt]:[]));export{ie as a,Ge as c,et as i,ut as n,dt as o,Je as r,ae as s,T as t};
1
+ import{$ as e,At as t,Bt as n,Ct as r,Et as i,F as a,Ft as o,Gt as s,Ht as c,It as l,Lt as u,Mt as d,Nt as f,Ot as p,Rt as m,Vt as h,X as g,Y as _,Z as v,bt as y,et as b,ft as x,jt as S,k as ee,mt as C,ot as w,zt as te}from"./dist-DAqA-GDU.js";var T=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=a(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(se(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function ne(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function re(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=ne(t)+ne(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function ie(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:re(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function ae(e,t){return n=>{for(let t=a(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}var oe=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function E(e){return e.selection.main.from}function se(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var D=r.define();function ce(e,t,n,r){let{main:i}=e.selection,a=n-i.from,o=r-i.from;return{...e.changeByRange(s=>{if(s!=i&&n!=r&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(n,r))return{range:s};let c=e.toText(t);return{changes:{from:s.from+a,to:r==i.from?s.to:s.from+o,insert:c},range:p.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var O=new WeakMap;function le(e){if(!Array.isArray(e))return e;let t=O.get(e);return t||O.set(e,t=ie(e)),t}var k=l.define(),A=l.define(),ue=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let r=n(e,t),i=h(r);this.chars.push(r);let a=e.slice(t,t+i),o=a.toUpperCase();this.folded.push(n(o==a?a.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:r,any:i,precise:a,byWord:o}=this;if(t.length==1){let i=n(e,0),a=h(i),o=a==e.length?0:-100;if(i!=t[0])if(i==r[0])o+=-200;else return null;return this.ret(o,[0,a])}let c=e.indexOf(this.pattern);if(c==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,u=0;if(c<0){for(let a=0,o=Math.min(e.length,200);a<o&&u<l;){let o=n(e,a);(o==t[u]||o==r[u])&&(i[u++]=a),a+=h(o)}if(u<l)return null}let d=0,f=0,p=!1,m=0,g=-1,_=-1,v=/[a-z]/.test(e),y=!0;for(let i=0,u=Math.min(e.length,200),b=0;i<u&&f<l;){let u=n(e,i);c<0&&(d<l&&u==t[d]&&(a[d++]=i),m<l&&(u==t[m]||u==r[m]?(m==0&&(g=i),_=i+1,m++):m=0));let x,S=u<255?u>=48&&u<=57||u>=97&&u<=122?2:+(u>=65&&u<=90):(x=s(u))==x.toLowerCase()?x==x.toUpperCase()?0:2:1;(!i||S==1&&v||b==0&&S!=0)&&(t[f]==u||r[f]==u&&(p=!0)?o[f++]=i:o.length&&(y=!1)),b=S,i+=h(u)}return f==l&&o[0]==0&&y?this.result(-100+(p?-200:0),o,e):m==l&&g==0?this.ret(-200-e.length+(_==e.length?0:-100),[0,_]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):m==l?this.ret(-900-e.length,[g,_]):f==l?this.result(-100+(p?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,r){let i=[],a=0;for(let e of t){let t=e+(this.astral?h(n(r,e)):1);a&&i[a-1]==e?i[a-1]=t:(i[a++]=e,i[a++]=t)}return this.ret(e-r.length,i)}},de=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},j=t.define({combine(e){return c(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:fe,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>M(e(n),t(n)),optionClass:(e,t)=>n=>M(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function M(e,t){return e?t?e+` `+t:e:t}function fe(e,t,n,r,i,a){let o=e.textDirection==g.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let _=(t.bottom-t.top)/a.offsetHeight,v=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/_}px; max-width: ${d/v}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var N=l.define();function pe(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function P(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var me=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(j);this.optionContent=pe(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=P(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:N.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(j).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:A.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener(`scroll`,()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;(!n.open||n.open.options!=r)&&(this.range=P(r.length,i,e.state.facet(j).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=P(t.options.length,t.selected,this.view.state.facet(j).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>C(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&ge(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(j).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0))if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function he(e,t){return n=>new me(n,e,t)}function ge(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function F(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function _e(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(j);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new oe(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new de(n):new ue(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new oe(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):F(e.completion)>F(c)&&(s[s.length-1]=e),c=e.completion}return s}var ve=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,I(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=_e(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(j).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,I(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:Te,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},ye=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(Ce,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(j),i=(r.override||n.languageDataAt(`autocomplete`,E(n)).map(le)).map(e=>(this.active.find(t=>t.source==e)||new R(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(B));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!be(i,this.active)||o?a=ve.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new R(e.source,0):e));for(let e of t.effects)e.is(N)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?xe:Se}};function be(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var xe={"aria-autocomplete":`list`},Se={};function I(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var Ce=[];function L(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(D);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var R=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=L(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(k))i=new e(i.source,1,n.value);else if(n.is(A))i=new e(i.source,0);else if(n.is(B))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(E(e.state))}},z=class e extends R{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=E(t.state);if(o>a||!r||n&2&&(E(t.startState)==this.from||o<this.limit))return new R(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return we(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new T(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??E(t.state)):new R(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new R(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function we(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):se(e,!0).test(i)}var B=l.define({map(e,t){return e.map(e=>e.map(t))}}),V=u.define({create(){return ye.start()},update(e,t){return e.update(t)},provide:e=>[y.from(e,e=>e.tooltip),v.contentAttributes.from(e,e=>e.attrs)]});function H(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(V).active.find(e=>e.source==t.source);return r instanceof z?(typeof n==`string`?e.dispatch({...ce(e.state,n,r.from,r.to),annotations:D.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}var Te=he(V,H);function U(e,t=`option`){return n=>{let r=n.state.field(V,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(j).interactionDelay)return!1;let i=1,a;t==`page`&&(a=w(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector(`li`).offsetHeight)-1));let{length:o}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t==`page`?0:o-1:s>=o&&(s=t==`page`?o-1:0),n.dispatch({effects:N.of(s)}),!0}}var Ee=e=>{let t=e.state.field(V,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(j).interactionDelay?!1:H(e,t.open.options[t.open.selected])},W=e=>e.state.field(V,!1)?(e.dispatch({effects:k.of(!0)}),!0):!1,De=e=>{let t=e.state.field(V,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:A.of(null)}),!0)},Oe=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},ke=50,Ae=1e3,je=e.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(V).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(V),n=e.state.facet(j);if(!e.selectionSet&&!e.docChanged&&e.startState.field(V)==t)return;let r=e.transactions.some(e=>{let t=L(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>ke&&Date.now()-n.time>Ae){for(let e of n.context.abortListeners)try{e()}catch(e){C(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(k)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(V);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(j).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new T(t,E(t),e.explicit,this.view),r=new Oe(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:A.of(null)}),C(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(j).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(j),n=this.view.state.field(V);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=E(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new z(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending)if(i.done==null){let n=new R(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:B.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(V,!1);if(t&&t.tooltip&&this.view.state.facet(j).closeOnBlur){let n=t.open&&w(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:A.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:k.of(!1)}),20),this.composing=0}}}),Me=typeof navigator==`object`&&/Win/.test(navigator.platform),Ne=d.highest(v.domEventHandlers({keydown(e,t){let n=t.state.field(V,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Me&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&H(t,r),!1}})),G=v.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),Pe=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},Fe=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,S.TrackDel),r=t.mapPos(this.to,1,S.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},Ie=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(ee);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new Fe(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new Pe(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},Le=_.widget({widget:new class extends b{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),Re=_.mark({class:`cm-snippetField`}),K=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=_.set(e.map(e=>(e.from==e.to?Le:Re).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},q=l.define({map(e,t){return e&&e.map(t)}}),ze=l.define(),J=u.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(q))return n.value;if(n.is(ze)&&e)return new K(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>v.decorations.from(e,e=>e?e.deco:_.none)});function Y(e,t){return p.create(e.filter(e=>e.field==t).map(e=>p.range(e.from,e.to)))}function Be(e){let t=Ie.parse(e);return(e,n,r,i)=>{let{text:a,ranges:o}=t.instantiate(e.state,r),{main:s}=e.state.selection,c={changes:{from:r,to:i==s.from?s.to:i,insert:m.of(a)},scrollIntoView:!0,annotations:n?[D.of(n),te.userEvent.of(`input.complete`)]:void 0};if(o.length&&(c.selection=Y(o,0)),o.some(e=>e.field>0)){let t=new K(o,0),n=c.effects=[q.of(t)];e.state.field(J,!1)===void 0&&n.push(l.appendConfig.of([J,We,Ke,G]))}e.dispatch(e.state.update(c))}}function Ve(e){return({state:t,dispatch:n})=>{let r=t.field(J,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:Y(r.ranges,i),effects:q.of(a?null:new K(r.ranges,i)),scrollIntoView:!0})),!0}}var He=[{key:`Tab`,run:Ve(1),shift:Ve(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(J,!1)?(t(e.update({effects:q.of(null)})),!0):!1}],Ue=t.define({combine(e){return e.length?e[0]:He}}),We=d.highest(x.compute([Ue],e=>e.facet(Ue)));function Ge(e,t){return{...t,apply:Be(e)}}var Ke=v.domEventHandlers({mousedown(e,t){let n=t.state.field(J,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:Y(n.ranges,i.field),effects:q.of(n.ranges.some(e=>e.field>i.field)?new K(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),X={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},Z=l.define({map(e,t){return t.mapPos(e,-1,S.TrackAfter)??void 0}}),Q=new class extends o{};Q.startSide=1,Q.endSide=-1;var qe=u.define({create(){return f.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(Z)&&(e=e.update({add:[Q.range(n.value,n.value+1)]}));return e}});function Je(){return[$e,qe]}var Ye=`()[]{}<>«»»«[]{}`;function Xe(e){for(let t=0;t<16;t+=2)if(Ye.charCodeAt(t)==e)return Ye.charAt(t+1);return s(e<128?e:e+1)}function Ze(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||X}var Qe=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),$e=v.inputHandler.of((e,t,r,i)=>{if((Qe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let a=e.state.selection.main;if(i.length>2||i.length==2&&h(n(i,0))==1||t!=a.from||r!=a.to)return!1;let o=tt(e.state,i);return o?(e.dispatch(o),!0):!1}),et=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Ze(e,e.selection.main.head).brackets||X.brackets,i=null,a=e.changeByRange(t=>{if(t.empty){let i=rt(e.doc,t.head);for(let a of r)if(a==i&&$(e.doc,t.head)==Xe(n(a,0)))return{changes:{from:t.head-a.length,to:t.head+a.length},range:p.cursor(t.head-a.length)}}return{range:i=t}});return i||t(e.update(a,{scrollIntoView:!0,userEvent:`delete.backward`})),!i}}];function tt(e,t){let r=Ze(e,e.selection.main.head),i=r.brackets||X.brackets;for(let a of i){let o=Xe(n(a,0));if(t==a)return o==a?ot(e,a,i.indexOf(a+a+a)>-1,r):it(e,a,o,r.before||X.before);if(t==o&&nt(e,e.selection.main.from))return at(e,a,o)}return null}function nt(e,t){let n=!1;return e.field(qe).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function $(e,t){let r=e.sliceString(t,t+2);return r.slice(0,h(n(r,0)))}function rt(e,t){let r=e.sliceString(t-2,t);return h(n(r,0))==r.length?r:r.slice(1)}function it(e,t,n,r){let i=null,a=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:Z.of(a.to+t.length),range:p.range(a.anchor+t.length,a.head+t.length)};let o=$(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:Z.of(a.head+t.length),range:p.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function at(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&$(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:p.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function ot(e,t,n,r){let a=r.stringPrefixes||X.stringPrefixes,o=null,s=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:Z.of(r.to+t.length),range:p.range(r.anchor+t.length,r.head+t.length)};let s=r.head,c=$(e.doc,s),l;if(c==t){if(st(e,s))return{changes:{insert:t+t,from:s},effects:Z.of(s+t.length),range:p.cursor(s+t.length)};if(nt(e,s)){let r=n&&e.sliceDoc(s,s+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:s,to:s+r.length,insert:r},range:p.cursor(s+r.length)}}}else if(n&&e.sliceDoc(s-2*t.length,s)==t+t&&(l=lt(e,s-2*t.length,a))>-1&&st(e,l))return{changes:{insert:t+t+t+t,from:s},effects:Z.of(s+t.length),range:p.cursor(s+t.length)};else if(e.charCategorizer(s)(c)!=i.Word&&lt(e,s,a)>-1&&!ct(e,s,t,a))return{changes:{insert:t+t,from:s},effects:Z.of(s+t.length),range:p.cursor(s+t.length)};return{range:o=r}});return o?null:e.update(s,{scrollIntoView:!0,userEvent:`input.type`})}function st(e,t){let n=a(e).resolveInner(t+1);return n.parent&&n.from==t}function ct(e,t,n,r){let i=a(e).resolveInner(t,-1),o=r.reduce((e,t)=>Math.max(e,t.length),0);for(let a=0;a<5;a++){let a=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+o)),s=a.indexOf(n);if(!s||s>-1&&r.indexOf(a.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function lt(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=i.Word)return t;for(let a of n){let n=t-a.length;if(e.sliceDoc(n,t)==a&&r(e.sliceDoc(n-1,n))!=i.Word)return n}return-1}function ut(e={}){return[Ne,V,j.of(e),je,ft,G]}var dt=[{key:`Ctrl-Space`,run:W},{mac:"Alt-`",run:W},{mac:`Alt-i`,run:W},{key:`Escape`,run:De},{key:`ArrowDown`,run:U(!0)},{key:`ArrowUp`,run:U(!1)},{key:`PageDown`,run:U(!0,`page`)},{key:`PageUp`,run:U(!1,`page`)},{key:`Enter`,run:Ee}],ft=d.highest(x.computeN([j],e=>e.facet(j).defaultKeymap?[dt]:[]));export{ie as a,Ge as c,et as i,ut as n,dt as o,Je as r,ae as s,T as t};
@@ -1,2 +1,2 @@
1
- import{$ as e,At as t,Bt as n,Et as r,Gt as i,Ht as a,It as o,Lt as s,Mt as c,Nt as l,Ot as u,Pt as d,Q as f,Vt as p,Wt as m,Y as h,Z as g,_t as ee,at as _,bt as te,dt as ne,et as re,kt as ie,mt as ae,st as oe,tt as se,vt as ce,xt as v,yt as le}from"./dist-sSZdzHur.js";var ue=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,y=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(ue(e)):ue,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return n(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=i(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=p(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(y.prototype[Symbol.iterator]=function(){return this});var de={from:-1,to:-1,match:/.*/.exec(``),precise:!0},b=`gm`+(/x/.unicode==null?``:`u`),fe=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=de,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new me(e,t,n,r,i);this.re=new RegExp(t,b+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=S(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=S(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},x=new WeakMap,pe=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=x.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return x.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),x.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},me=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=de,this.matchPos=S(e,r),this.re=new RegExp(t,b+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=pe.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=S(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=pe.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(fe.prototype[Symbol.iterator]=me.prototype[Symbol.iterator]=function(){return this});function he(e){try{return new RegExp(e,b),!0}catch{return!1}}function S(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var ge=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=ce(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,d=c?+c.slice(1):0,f=s?+s:a.number;if(s&&l){let e=f/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),f=Math.round(t.doc.lines*e)}else s&&o&&(f=f*(o==`-`?-1:1)+a.number);let p=t.doc.line(Math.max(1,Math.min(t.doc.lines,f))),m=u.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[r,g.scrollIntoView(m.from,{y:`center`})],selection:m})}),!0},_e={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ve=t.define({combine(e){return a(e,_e,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function ye(e){let t=[Te,we];return e&&t.push(ve.of(e)),t}var be=h.mark({class:`cm-selectionMatch`}),xe=h.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function Se(e,t,n,i){return(n==0||e(t.sliceDoc(n-1,n))!=r.Word)&&(i==t.doc.length||e(t.sliceDoc(i,i+1))!=r.Word)}function Ce(e,t,n,i){return e(t.sliceDoc(n,n+1))==r.Word&&e(t.sliceDoc(i-1,i))==r.Word}var we=e.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(ve),{state:n}=e,r=n.selection;if(r.ranges.length>1)return h.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return h.none;let e=n.wordAt(i.head);if(!e)return h.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return h.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(Se(o,n,i.from,i.to)&&Ce(o,n,i.from,i.to)))return h.none}else if(a=n.sliceDoc(i.from,i.to),!a)return h.none}let s=[];for(let r of e.visibleRanges){let e=new y(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||Se(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(xe.range(r,a)):(r>=i.to||a<=i.from)&&s.push(be.range(r,a)),s.length>t.maxMatches))return h.none}}return h.set(s)}},{decorations:e=>e.decorations}),Te=g.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),Ee=({state:e,dispatch:t})=>{let{selection:n}=e,r=u.create(n.ranges.map(t=>e.wordAt(t.head)||u.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function De(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new y(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new y(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var Oe=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return Ee({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=De(e,r);return i?(t(e.update({selection:e.selection.addRange(u.range(i.from,i.to),!1),effects:g.scrollIntoView(i.to)})),!0):!1},C=t.define({combine(e){return a(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Xe(e),scrollToMatch:e=>g.scrollIntoView(e)})}});function ke(e){return e?[C.of(e),V]:V}var Ae=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||he(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
1
+ import{$ as e,At as t,Bt as n,Et as r,Gt as i,Ht as a,It as o,Lt as s,Mt as c,Nt as l,Ot as u,Pt as d,Q as f,Vt as p,Wt as m,Y as h,Z as g,_t as ee,at as _,bt as te,dt as ne,et as re,kt as ie,mt as ae,st as oe,tt as se,vt as ce,xt as v,yt as le}from"./dist-DAqA-GDU.js";var ue=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,y=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(ue(e)):ue,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return n(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=i(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=p(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(y.prototype[Symbol.iterator]=function(){return this});var de={from:-1,to:-1,match:/.*/.exec(``),precise:!0},b=`gm`+(/x/.unicode==null?``:`u`),fe=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=de,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new me(e,t,n,r,i);this.re=new RegExp(t,b+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=S(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=S(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},x=new WeakMap,pe=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=x.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return x.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),x.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},me=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=de,this.matchPos=S(e,r),this.re=new RegExp(t,b+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=pe.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=S(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=pe.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(fe.prototype[Symbol.iterator]=me.prototype[Symbol.iterator]=function(){return this});function he(e){try{return new RegExp(e,b),!0}catch{return!1}}function S(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var ge=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=ce(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,d=c?+c.slice(1):0,f=s?+s:a.number;if(s&&l){let e=f/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),f=Math.round(t.doc.lines*e)}else s&&o&&(f=f*(o==`-`?-1:1)+a.number);let p=t.doc.line(Math.max(1,Math.min(t.doc.lines,f))),m=u.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[r,g.scrollIntoView(m.from,{y:`center`})],selection:m})}),!0},_e={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ve=t.define({combine(e){return a(e,_e,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function ye(e){let t=[Te,we];return e&&t.push(ve.of(e)),t}var be=h.mark({class:`cm-selectionMatch`}),xe=h.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function Se(e,t,n,i){return(n==0||e(t.sliceDoc(n-1,n))!=r.Word)&&(i==t.doc.length||e(t.sliceDoc(i,i+1))!=r.Word)}function Ce(e,t,n,i){return e(t.sliceDoc(n,n+1))==r.Word&&e(t.sliceDoc(i-1,i))==r.Word}var we=e.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(ve),{state:n}=e,r=n.selection;if(r.ranges.length>1)return h.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return h.none;let e=n.wordAt(i.head);if(!e)return h.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return h.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(Se(o,n,i.from,i.to)&&Ce(o,n,i.from,i.to)))return h.none}else if(a=n.sliceDoc(i.from,i.to),!a)return h.none}let s=[];for(let r of e.visibleRanges){let e=new y(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||Se(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(xe.range(r,a)):(r>=i.to||a<=i.from)&&s.push(be.range(r,a)),s.length>t.maxMatches))return h.none}}return h.set(s)}},{decorations:e=>e.decorations}),Te=g.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),Ee=({state:e,dispatch:t})=>{let{selection:n}=e,r=u.create(n.ranges.map(t=>e.wordAt(t.head)||u.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function De(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new y(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new y(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var Oe=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return Ee({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=De(e,r);return i?(t(e.update({selection:e.selection.addRange(u.range(i.from,i.to),!1),effects:g.scrollIntoView(i.to)})),!0):!1},C=t.define({combine(e){return a(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Xe(e),scrollToMatch:e=>g.scrollIntoView(e)})}});function ke(e){return e?[C.of(e),V]:V}var Ae=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||he(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
2
2
  `:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Le(this):new Pe(this)}getCursor(e,t=0,n){let r=e.doc?e:ie.create({doc:e});return n??=r.doc.length,this.regexp?T(this,r,t,n):w(this,r,t,n)}},je=class{constructor(e){this.spec=e}};function Me(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function w(e,t,n,r){let i;return e.wholeWord&&(i=Ne(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=Me(e.test,t,i)),new y(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function Ne(e,t){return(n,i,a,o)=>((o>n||o+a.length<i)&&(o=Math.max(0,n-2),a=e.sliceString(o,Math.min(e.length,i+2))),(t(E(a,n-o))!=r.Word||t(D(a,n-o))!=r.Word)&&(t(D(a,i-o))!=r.Word||t(E(a,i-o))!=r.Word))}var Pe=class extends je{constructor(e){super(e)}nextMatch(e,t,n){let r=w(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=w(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=w(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=w(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=w(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function Fe(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function T(e,t,n,r){let i;return e.wholeWord&&(i=Ie(t.charCategorizer(t.selection.main.head))),e.test&&(i=Fe(e.test,t,i)),new fe(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function E(e,t){return e.slice(m(e,t,!1),t)}function D(e,t){return e.slice(t,m(e,t))}function Ie(e){return(t,n,i)=>!i[0].length||(e(E(i.input,i.index))!=r.Word||e(D(i.input,i.index))!=r.Word)&&(e(D(i.input,i.index+i[0].length))!=r.Word||e(E(i.input,i.index+i[0].length))!=r.Word)}var Le=class extends je{nextMatch(e,t,n){let r=T(this.spec,e,n,e.doc.length).next();return r.done&&(r=T(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=T(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=T(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=T(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},O=o.define(),k=o.define(),A=s.define({create(e){return new j(I(e).create(),null)},update(e,t){for(let n of t.effects)n.is(O)?e=new j(n.value.create(),e.panel):n.is(k)&&(e=new j(e.query,n.value?F:null));return e},provide:e=>le.from(e,e=>e.panel)}),j=class{constructor(e,t){this.query=e,this.panel=t}},Re=h.mark({class:`cm-searchMatch`}),ze=h.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Be=e.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(A))}update(e){let t=e.state.field(A);(t!=e.startState.field(A)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return h.none;let{view:n}=this,r=new d;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?ze:Re)})}return r.finish()}},{decorations:e=>e.decorations});function M(e){return t=>{let n=t.state.field(A,!1);return n&&n.query.spec.valid?e(t,n):qe(t)}}var N=M((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=u.single(r.from,r.to),a=e.state.facet(C);return e.dispatch({selection:i,effects:[B(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Ke(e),!0}),P=M((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=u.single(i.from,i.to),o=e.state.facet(C);return e.dispatch({selection:a,effects:[B(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Ke(e),!0}),Ve=M((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:u.create(n.map(e=>u.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),He=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new y(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(u.range(t.value.from,t.value.to))}return t(e.update({selection:u.create(a,o),userEvent:`select.search.matches`})),!0},Ue=M((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,d=[];o.precise?o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),d.push(g.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let f=e.state.changes(s);return o&&(c=u.single(o.from,o.to).map(f),d.push(B(e,o)),d.push(n.facet(C).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:`input.replace`}),!0}),We=M((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:g.announce.of(r),userEvent:`input.replace.all`}),!0});function F(e){return e.state.facet(C).createPanel(e)}function I(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(C);return new Ae({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function Ge(e){let t=_(e,F);return t&&t.dom.querySelector(`[main-field]`)}function Ke(e){let t=Ge(e);t&&t==e.root.activeElement&&t.select()}var qe=e=>{let t=e.state.field(A,!1);if(t&&t.panel){let n=Ge(e);if(n&&n!=e.root.activeElement){let r=I(e.state,t.query.spec);r.valid&&e.dispatch({effects:O.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[k.of(!0),t?O.of(I(e.state,t.query.spec)):o.appendConfig.of(V)]});return!0},Je=e=>{let t=e.state.field(A,!1);if(!t||!t.panel)return!1;let n=_(e,F);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:k.of(!1)}),!0},Ye=[{key:`Mod-f`,run:qe,scope:`editor search-panel`},{key:`F3`,run:N,shift:P,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:N,shift:P,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Je,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:He},{key:`Mod-Alt-g`,run:ge},{key:`Mod-d`,run:Oe,preventDefault:!0}],Xe=class{constructor(e){this.view=e;let t=this.query=e.state.field(A).query.spec;this.commit=this.commit.bind(this),this.searchField=v(`input`,{value:t.search,placeholder:L(e,`Find`),"aria-label":L(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=v(`input`,{value:t.replace,placeholder:L(e,`Replace`),"aria-label":L(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=v(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=v(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=v(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return v(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=v(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>N(e),[L(e,`next`)]),n(`prev`,()=>P(e),[L(e,`previous`)]),n(`select`,()=>Ve(e),[L(e,`all`)]),v(`label`,null,[this.caseField,L(e,`match case`)]),v(`label`,null,[this.reField,L(e,`regexp`)]),v(`label`,null,[this.wordField,L(e,`by word`)]),...e.state.readOnly?[]:[v(`br`),this.replaceField,n(`replace`,()=>Ue(e),[L(e,`replace`)]),n(`replaceAll`,()=>We(e),[L(e,`replace all`)])],v(`button`,{name:`close`,onclick:()=>Je(e),"aria-label":L(e,`close`),type:`button`},[`×`])])}commit(){let e=new Ae({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:O.of(e)}))}keydown(e){ee(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?P:N)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Ue(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(O)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(C).top}};function L(e,t){return e.state.phrase(t)}var R=30,z=/[\s\.,:;?!]/;function B(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-R),o=Math.min(i,n+R),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<R;e++)if(!z.test(s[e+1])&&z.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-R;e--)if(!z.test(s[e-1])&&z.test(s[e])){s=s.slice(0,e);break}}return g.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Ze=g.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),V=[A,c.low(Be),Ze],Qe=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},H=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(q).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new d,s=[],c=0,l=r.doc.iter(),u=0,f=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>f)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,f);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==f))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let d=bt(s);if(i)o.add(n,n,h.widget({widget:new gt(d),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,h.mark({class:`cm-lintRange cm-lintRange-`+d+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==f)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let p=o.finish();return new e(p,n,U(p))}};function U(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new Qe(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new Qe(r.from,n,r.diagnostic)}),r}function $e(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(q).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(W))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function et(e,t){return e.field(K,!1)?t:t.concat(o.appendConfig.of(kt))}function tt(e,t){return{effects:et(e,[W.of(t)])}}var W=o.define(),G=o.define(),nt=o.define(),K=s.define({create(){return new H(h.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=U(n,e.selected.diagnostic,i)||U(n,null,i)}!n.size&&i&&t.state.facet(q).autoPanel&&(i=null),e=new H(n,i,r)}for(let n of t.effects)if(n.is(W)){let r=t.state.facet(q).autoPanel?n.value.length?J.open:null:e.panel;e=H.init(n.value,r,t.state)}else n.is(G)?e=new H(e.diagnostics,n.value?J.open:null,e.selected):n.is(nt)&&(e=new H(e.diagnostics,e.panel,n.value));return e},provide:e=>[le.from(e,e=>e.panel),g.decorations.from(e,e=>e.diagnostics)]}),rt=h.mark({class:`cm-lintRange cm-lintRange-active`});function it(e,t,n){let{diagnostics:r}=e.state.field(K),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(q).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:!0,create(){return{dom:at(e,i)}}}:null}function at(e,t){return v(`ul`,{class:`cm-tooltip-lint`},t.map(t=>ht(e,t,!1)))}var ot=e=>{let t=e.state.field(K,!1);(!t||!t.panel)&&e.dispatch({effects:et(e.state,[G.of(!0)])});let n=_(e,J.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},st=e=>{let t=e.state.field(K,!1);return!t||!t.panel?!1:(e.dispatch({effects:G.of(!1)}),!0)},ct=[{key:`Mod-Shift-m`,run:ot,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(K,!1);if(!t)return!1;let n=e.state.selection.main,r=U(t.diagnostics,null,n.to+1);return!r&&(r=U(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),se(e,r.from,1,{tooltip:Ot,until:e=>e.docChanged||e.newSelection.main.head<r.from||e.newSelection.main.head>r.to}),!0)}}],lt=e.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(q);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(q);t.length&&ut(t.map(e=>Promise.resolve(e(this.view))),t=>{this.view.state.doc==e.doc&&this.view.dispatch(tt(this.view.state,t.reduce((e,t)=>e.concat(t))))},e=>{ae(this.view.state,e)})}}update(e){let t=e.state.facet(q);(e.docChanged||t!=e.startState.facet(q)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function ut(e,t,n){let r=[],i=-1;for(let a of e)a.then(n=>{r.push(n),clearTimeout(i),r.length==e.length?t(r):i=setTimeout(()=>t(r),200)},n)}var q=t.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...a(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:dt,tooltipFilter:dt,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function dt(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function ft(e,t={}){return[q.of({source:e,config:t}),lt,kt]}function pt(e){let t=e.plugin(lt);t&&t.force()}function mt(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function ht(e,t,n){let r=n?mt(t.actions):[];return v(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},v(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=U(e.state.field(K).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),v(`u`,s.slice(c,c+1)),s.slice(c+1)];return v(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&v(`div`,{class:`cm-diagnosticSource`},t.source))}var gt=class extends re{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return v(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},_t=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=ht(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},J=class e{constructor(e){this.view=e,this.items=[],this.list=v(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)st(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=mt(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=U(this.view.state.field(K).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=v(`div`,{class:`cm-panel-lint`},this.list,v(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>st(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(K).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(K),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new _t(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new _t(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=U(this.view.state.field(K).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:nt.of(t)})}static open(t){return new e(t)}};function Y(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function X(e){return Y(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var vt=g.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:X(`#f11`)},".cm-lintRange-warning":{backgroundImage:X(`orange`)},".cm-lintRange-info":{backgroundImage:X(`#999`)},".cm-lintRange-hint":{backgroundImage:X(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function yt(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function bt(e){let t=`hint`,n=1;for(let r of e){let e=yt(r.severity);e>n&&(n=e,t=r.severity)}return t}var xt=class extends f{constructor(e){super(),this.diagnostics=e,this.severity=bt(e)}toDOM(e){let t=document.createElement(`div`);t.className=`cm-lint-marker cm-lint-marker-`+this.severity;let n=this.diagnostics,r=e.state.facet($).tooltipFilter;return r&&(n=r(n,e.state)),n.length&&(t.onmouseover=()=>Ct(e,t,n)),t}};function St(e,t){let n=r=>{let i=t.getBoundingClientRect();if(!(r.clientX>i.left-10&&r.clientX<i.right+10&&r.clientY>i.top-10&&r.clientY<i.bottom+10)){for(let e=r.target;e;e=e.parentNode)if(e.nodeType==1&&e.classList.contains(`cm-tooltip-lint`))return;window.removeEventListener(`mousemove`,n),e.state.field(Et)&&e.dispatch({effects:Q.of(null)})}};window.addEventListener(`mousemove`,n)}function Ct(e,t,n){function r(){let r=e.elementAtHeight(t.getBoundingClientRect().top+5-e.documentTop);e.coordsAtPos(r.from)&&e.dispatch({effects:Q.of({pos:r.from,above:!1,clip:!1,create(){return{dom:at(e,n),getCoords:()=>t.getBoundingClientRect()}}})}),t.onmouseout=t.onmousemove=null,St(e,t)}let{hoverTime:i}=e.state.facet($),a=setTimeout(r,i);t.onmouseout=()=>{clearTimeout(a),t.onmouseout=t.onmousemove=null},t.onmousemove=()=>{clearTimeout(a),a=setTimeout(r,i)}}function wt(e,t){let n=Object.create(null);for(let r of t){let t=e.lineAt(r.from);(n[t.from]||(n[t.from]=[])).push(r)}let r=[];for(let e in n)r.push(new xt(n[e]).range(+e));return l.of(r,!0)}var Tt=oe({class:`cm-gutter-lint`,markers:e=>e.state.field(Z),widgetMarker:(e,t,n)=>{let r=[];return e.state.field(Z).between(n.from,n.to,(e,t,i)=>{e>n.from&&e<n.to&&r.push(...i.diagnostics)}),r.length?new xt(r):null}}),Z=s.define({create(){return l.empty},update(e,t){e=e.map(t.changes);let n=t.state.facet($).markerFilter;for(let r of t.effects)if(r.is(W)){let i=r.value;n&&(i=n(i||[],t.state)),e=wt(t.state.doc,i.slice(0))}return e}}),Q=o.define(),Et=s.define({create(){return null},update(e,t){return e&&t.docChanged&&(e=$e(t,e)?null:{...e,pos:t.changes.mapPos(e.pos)}),t.effects.reduce((e,t)=>t.is(Q)?t.value:e,e)},provide:e=>te.from(e)}),Dt=g.baseTheme({".cm-gutter-lint":{width:`1.4em`,"& .cm-gutterElement":{padding:`.2em`}},".cm-lint-marker":{width:`1em`,height:`1em`},".cm-lint-marker-info":{content:Y(`<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>`)},".cm-lint-marker-warning":{content:Y(`<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>`)},".cm-lint-marker-error":{content:Y(`<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>`)}}),Ot=ne(it,{hideOn:$e}),kt=[K,g.decorations.compute([K],e=>{let{selected:t,panel:n}=e.field(K);return!t||!n||t.from==t.to?h.none:h.set([rt.range(t.from,t.to)])}),Ot,vt],$=t.define({combine(e){return a(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function At(e={}){return[$.of(e),Z,Tt,Dt,Et]}export{ye as a,ft as i,At as n,ke as o,ct as r,Ye as s,pt as t};
@@ -1 +1 @@
1
- import{$a as e}from"./dist-ILlrHFKs.js";function t(t){return e.includes(t)}function n(e){if(e.startsWith(_)||e.startsWith(x)||e.startsWith(S)||e.startsWith(T)||!e.startsWith(`#/`))return null;let t=e.slice(2),n=v(t),r=n>=0?t.slice(0,n):t;if(!r)return null;try{return r.split(`/`).map(decodeURIComponent).join(`/`)}catch{return r}}function r(e){if(e.startsWith(_)||!e.startsWith(`#/`))return null;let t=e.slice(2),n=t.indexOf(`#`);if(n<0)return null;let r=t.slice(n+1);if(!r)return null;try{return decodeURIComponent(r)}catch{return r}}function i(e,t){let n=`#/${e}`;return t?`${n}#${encodeURIComponent(t)}`:n}function a(e,t){return e===t||o(e)===o(t)}function o(e){try{return decodeURIComponent(e)}catch{return e}}var s=`__okHashHistoryEntry`;function c(e){return{...typeof e==`object`&&e?e:{},[s]:!0}}function l(e){return typeof e==`object`&&!!e&&e[s]===!0}function u(){l(window.history.state)||window.history.replaceState(c(window.history.state),``)}function d(e){let{pathname:t,search:n}=window.location;window.history.replaceState(c(window.history.state),``,`${t}${n}${e}`)}function f(e){if(a(window.location.hash,e))return;let{pathname:t,search:n}=window.location;window.history.pushState(c(window.history.state),``,`${t}${n}${e}`)}function p(e){return e.endsWith(`.mdx`)?e.slice(0,-4):e.endsWith(`.md`)?e.slice(0,-3):e}function m(e,t){let n=e.replace(/^\/+|\/+$/g,``),r=n?`#/${n}/`:`#/`;return t?`${r}#${encodeURIComponent(t)}`:r}function h(e,t,n){if(e===`folder`)return m(t);let r=`#/${encodeURIComponent(t)}`;return n==null||n===``?r:`${r}?branch=${encodeURIComponent(n)}`}function g(e){if(e===`#/`)return!0;if(!e.startsWith(`#/`))return!1;let t=e.slice(2);return t.length>0&&t[0]===`?`}var _=`#/__asset__/`;function v(e){let t=e.indexOf(`?`),n=e.indexOf(`#`);return t<0?n:n<0?t:Math.min(t,n)}function y(e){if(!e.startsWith(_))return null;let t=e.slice(12);if(!t)return null;try{return t.split(`/`).map(decodeURIComponent).join(`/`)}catch{return t}}function b(e){return`${_}${e.split(`/`).map(encodeURIComponent).join(`/`)}`}var x=`#/__skill-file__/`,S=`#/__skills__`;function C(){return S}function w(e){return e===S||e.startsWith(`${S}/`)}var T=`#/__skill-preview__/`,E=[`explore`,`detected`,`builtin`,`foreign`];function D(e){return e!==void 0&&E.includes(e)}var O=`project`;function k(e){return[e.flavor,e.source,e.name,e.subtitle,e.level??O].map(encodeURIComponent).join(`/`)}function A(e){if(!e)return null;let n;try{n=e.split(`/`).map(decodeURIComponent)}catch{return null}if(n.length<4||n.length>6)return null;let[r,i,a,o,s,c]=n;return!D(r)||!i||!a?null:{flavor:r,source:i,name:a,subtitle:o??``,...s&&t(s)?{level:s}:{},...c?{path:c}:{}}}function j(e){let t=k(e);return e.path&&(t+=`/${encodeURIComponent(e.path)}`),`${T}${t}`}function M(e){return e.startsWith(T)?A(e.slice(20)):null}var N=`:`;function P(e){let t=e.host===void 0?e.name:`${e.name}${N}${e.host}`;return`${x}${[e.scope,t].map(encodeURIComponent).join(`/`)}/${e.path.split(`/`).map(encodeURIComponent).join(`/`)}`}function F(e){if(!e.startsWith(x))return null;let n=e.slice(17);if(!n)return null;let r;try{r=n.split(`/`).map(decodeURIComponent)}catch{return null}if(r.length<3)return null;let[i,a,...o]=r,s=o.join(`/`);if(!i||!a||!s||!t(i))return null;let c=a.indexOf(N),l=c===-1?a:a.slice(0,c),u=c===-1?void 0:a.slice(c+1);return l?{scope:i,name:l,path:s,...u?{host:u}:{}}:null}var I=/\.(md|mdx)$/i;function L(e){return e.trim().replace(/^\.\/+/,``).replace(/^\/+/,``)}function R(e){return L(e).replace(I,``)}function z(e){let t=L(e);return t?I.test(t)?t:`${t}.md`:`untitled.md`}function B(e){let t=R(e),n=t.lastIndexOf(`/`);return{initialDir:n>0?t.slice(0,n):``,suggestedName:`${n>=0?t.slice(n+1):t||`untitled`}.md`}}export{M as C,F as S,g as _,y as a,f as b,h as c,b as d,i as f,C as g,j as h,r as i,k as l,P as m,z as n,A as o,m as p,R as r,n as s,B as t,p as u,a as v,w,d as x,u as y};
1
+ import{Ga as e}from"./dist-GenOktAv.js";function t(t){return e.includes(t)}function n(e){if(e.startsWith(_)||e.startsWith(x)||e.startsWith(S)||e.startsWith(T)||!e.startsWith(`#/`))return null;let t=e.slice(2),n=v(t),r=n>=0?t.slice(0,n):t;if(!r)return null;try{return r.split(`/`).map(decodeURIComponent).join(`/`)}catch{return r}}function r(e){if(e.startsWith(_)||!e.startsWith(`#/`))return null;let t=e.slice(2),n=t.indexOf(`#`);if(n<0)return null;let r=t.slice(n+1);if(!r)return null;try{return decodeURIComponent(r)}catch{return r}}function i(e,t){let n=`#/${e}`;return t?`${n}#${encodeURIComponent(t)}`:n}function a(e,t){return e===t||o(e)===o(t)}function o(e){try{return decodeURIComponent(e)}catch{return e}}var s=`__okHashHistoryEntry`;function c(e){return{...typeof e==`object`&&e?e:{},[s]:!0}}function l(e){return typeof e==`object`&&!!e&&e[s]===!0}function u(){l(window.history.state)||window.history.replaceState(c(window.history.state),``)}function d(e){let{pathname:t,search:n}=window.location;window.history.replaceState(c(window.history.state),``,`${t}${n}${e}`)}function f(e){if(a(window.location.hash,e))return;let{pathname:t,search:n}=window.location;window.history.pushState(c(window.history.state),``,`${t}${n}${e}`)}function p(e){return e.endsWith(`.mdx`)?e.slice(0,-4):e.endsWith(`.md`)?e.slice(0,-3):e}function m(e,t){let n=e.replace(/^\/+|\/+$/g,``),r=n?`#/${n}/`:`#/`;return t?`${r}#${encodeURIComponent(t)}`:r}function h(e,t,n){if(e===`folder`)return m(t);let r=`#/${encodeURIComponent(t)}`;return n==null||n===``?r:`${r}?branch=${encodeURIComponent(n)}`}function g(e){if(e===`#/`)return!0;if(!e.startsWith(`#/`))return!1;let t=e.slice(2);return t.length>0&&t[0]===`?`}var _=`#/__asset__/`;function v(e){let t=e.indexOf(`?`),n=e.indexOf(`#`);return t<0?n:n<0?t:Math.min(t,n)}function y(e){if(!e.startsWith(_))return null;let t=e.slice(12);if(!t)return null;try{return t.split(`/`).map(decodeURIComponent).join(`/`)}catch{return t}}function b(e){return`${_}${e.split(`/`).map(encodeURIComponent).join(`/`)}`}var x=`#/__skill-file__/`,S=`#/__skills__`;function C(){return S}function w(e){return e===S||e.startsWith(`${S}/`)}var T=`#/__skill-preview__/`,E=[`explore`,`detected`,`builtin`,`foreign`];function D(e){return e!==void 0&&E.includes(e)}var O=`project`;function k(e){return[e.flavor,e.source,e.name,e.subtitle,e.level??O].map(encodeURIComponent).join(`/`)}function A(e){if(!e)return null;let n;try{n=e.split(`/`).map(decodeURIComponent)}catch{return null}if(n.length<4||n.length>6)return null;let[r,i,a,o,s,c]=n;return!D(r)||!i||!a?null:{flavor:r,source:i,name:a,subtitle:o??``,...s&&t(s)?{level:s}:{},...c?{path:c}:{}}}function j(e){let t=k(e);return e.path&&(t+=`/${encodeURIComponent(e.path)}`),`${T}${t}`}function M(e){return e.startsWith(T)?A(e.slice(20)):null}var N=`:`;function P(e){let t=e.host===void 0?e.name:`${e.name}${N}${e.host}`;return`${x}${[e.scope,t].map(encodeURIComponent).join(`/`)}/${e.path.split(`/`).map(encodeURIComponent).join(`/`)}`}function F(e){if(!e.startsWith(x))return null;let n=e.slice(17);if(!n)return null;let r;try{r=n.split(`/`).map(decodeURIComponent)}catch{return null}if(r.length<3)return null;let[i,a,...o]=r,s=o.join(`/`);if(!i||!a||!s||!t(i))return null;let c=a.indexOf(N),l=c===-1?a:a.slice(0,c),u=c===-1?void 0:a.slice(c+1);return l?{scope:i,name:l,path:s,...u?{host:u}:{}}:null}var I=/\.(md|mdx)$/i;function L(e){return e.trim().replace(/^\.\/+/,``).replace(/^\/+/,``)}function R(e){return L(e).replace(I,``)}function z(e){let t=L(e);return t?I.test(t)?t:`${t}.md`:`untitled.md`}function B(e){let t=R(e),n=t.lastIndexOf(`/`);return{initialDir:n>0?t.slice(0,n):``,suggestedName:`${n>=0?t.slice(n+1):t||`untitled`}.md`}}export{M as C,F as S,g as _,y as a,f as b,h as c,b as d,i as f,C as g,j as h,r as i,k as l,P as m,z as n,A as o,m as p,R as r,n as s,B as t,p as u,a as v,w,d as x,u as y};
@@ -1 +1 @@
1
- import{A as e}from"./dist-ILlrHFKs.js";var t=`open-knowledge:documents-changed`,n=new Set(e.options);function r(e){return e===void 0||!Array.isArray(e)?[`files`]:[...new Set(e.filter(e=>n.has(e)))]}function i(e=[`files`]){window.dispatchEvent(new CustomEvent(t,{detail:{channels:r(e)}}))}function a(e){let n=t=>{e(r(t instanceof CustomEvent?t.detail?.channels:void 0))};return window.addEventListener(t,n),()=>window.removeEventListener(t,n)}function o(e){return e.includes(`local-targets`)||e.includes(`files`)}var s=`open-knowledge:doc-persisted`;function c(e){window.dispatchEvent(new CustomEvent(s,{detail:{docName:e}}))}function l(e){let t=t=>{if(!(t instanceof CustomEvent))return;let n=t.detail?.docName;typeof n==`string`&&n.length>0&&e(n)};return window.addEventListener(s,t),()=>window.removeEventListener(s,t)}var u=`open-knowledge:branch-changed`;function d(e){window.dispatchEvent(new CustomEvent(u,{detail:{branch:e}}))}function f(e){let t=t=>{if(!(t instanceof CustomEvent))return;let n=t.detail;e(n?.branch??null)};return window.addEventListener(u,t),()=>window.removeEventListener(u,t)}var p=`open-knowledge:templates-changed`;function m(){window.dispatchEvent(new CustomEvent(p))}function h(e){let t=()=>e();return window.addEventListener(p,t),()=>window.removeEventListener(p,t)}var g=`open-knowledge:skills-changed`;function _(){window.dispatchEvent(new CustomEvent(g))}function v(e){let t=()=>e();return window.addEventListener(g,t),()=>window.removeEventListener(g,t)}var y=new Set,b=(e,t)=>`${e}\u0000${t}`;function x(e,t){y.add(b(e,t)),_()}function S(e,t){y.delete(b(e,t))&&_()}var C=new Set;function w(e,t){C.add(b(e,t)),_()}function T(e,t){C.delete(b(e,t))&&_()}function E(e,t){return C.has(b(e,t))}function D(){return[...C].sort().join(``)}function O(e,t){return y.has(b(e,t))}function k(e){return y.size===0?e:e.filter(e=>!y.has(b(e.scope,e.name)))}export{a as _,c as a,m as c,o as d,O as f,l as g,f as h,d as i,S as l,D as m,x as n,i as o,E as p,w as r,_ as s,k as t,T as u,v,h as y};
1
+ import{A as e}from"./dist-GenOktAv.js";var t=`open-knowledge:documents-changed`,n=new Set(e.options);function r(e){return e===void 0||!Array.isArray(e)?[`files`]:[...new Set(e.filter(e=>n.has(e)))]}function i(e=[`files`]){window.dispatchEvent(new CustomEvent(t,{detail:{channels:r(e)}}))}function a(e){let n=t=>{e(r(t instanceof CustomEvent?t.detail?.channels:void 0))};return window.addEventListener(t,n),()=>window.removeEventListener(t,n)}function o(e){return e.includes(`local-targets`)||e.includes(`files`)}var s=`open-knowledge:doc-persisted`;function c(e){window.dispatchEvent(new CustomEvent(s,{detail:{docName:e}}))}function l(e){let t=t=>{if(!(t instanceof CustomEvent))return;let n=t.detail?.docName;typeof n==`string`&&n.length>0&&e(n)};return window.addEventListener(s,t),()=>window.removeEventListener(s,t)}var u=`open-knowledge:branch-changed`;function d(e){window.dispatchEvent(new CustomEvent(u,{detail:{branch:e}}))}function f(e){let t=t=>{if(!(t instanceof CustomEvent))return;let n=t.detail;e(n?.branch??null)};return window.addEventListener(u,t),()=>window.removeEventListener(u,t)}var p=`open-knowledge:templates-changed`;function m(){window.dispatchEvent(new CustomEvent(p))}function h(e){let t=()=>e();return window.addEventListener(p,t),()=>window.removeEventListener(p,t)}var g=`open-knowledge:skills-changed`;function _(){window.dispatchEvent(new CustomEvent(g))}function v(e){let t=()=>e();return window.addEventListener(g,t),()=>window.removeEventListener(g,t)}var y=new Set,b=(e,t)=>`${e}\u0000${t}`;function x(e,t){y.add(b(e,t)),_()}function S(e,t){y.delete(b(e,t))&&_()}var C=new Set;function w(e,t){C.add(b(e,t)),_()}function T(e,t){C.delete(b(e,t))&&_()}function E(e,t){return C.has(b(e,t))}function D(){return[...C].sort().join(``)}function O(e,t){return y.has(b(e,t))}function k(e){return y.size===0?e:e.filter(e=>!y.has(b(e.scope,e.name)))}export{a as _,c as a,m as c,o as d,O as f,l as g,f as h,d as i,S as l,D as m,x as n,i as o,E as p,w as r,_ as s,k as t,T as u,v,h as y};
@@ -1 +1 @@
1
- import{as as e,ds as t,ss as n}from"./dist-ILlrHFKs.js";import{d as r,f as i,p as a}from"./doc-paths-DAh95jxf.js";import{t as o}from"./file-tree-rename-validation-C2Ibtqn6.js";import{c as s,l as c,s as l}from"./file-tree-utils-CgJ4lrP9.js";import{a as u}from"./navigation-targets-C1boWExT.js";var d=`application/x-open-knowledge-sidebar-item+json`,f={image:!0,video:!0,audio:!0,pdf:!0,text:!0,mermaid:!0};function p(e){return JSON.stringify(e)}function m(e){return e?Array.from(e.types).includes(d):!1}function ee(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:a(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:r(e.assetPath)}:{target:u(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:i(e.docName)}}function h(e){if(!e||!m(e))return null;let t=e.getData(d);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!g(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!_(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _(e){return typeof e==`string`&&Object.hasOwn(f,e)}var v=`.md`,y=/\.(md|mdx)$/i;function b(t,r=v){return y.test(t)||n(t)||e(t)?t:`${t}${r}`}function x(e){return $(e).replace(y,``)}function S(e,t){let n=$(e),r=k(t),i=t.find(e=>s(e)&&A(e,r)===n)??t.find(e=>s(e)&&w(e)===n);if(i)return i.docName;let a=x(n);return t.find(e=>{let t=w(e);return t!==n&&y.test(t)&&x(t)===a})&&y.test(n)?n:a}function C(e,t){let n=k(t);return t.find(t=>A(t,n)===e)??t.find(t=>w(t)===e)}function w(e){return c(e)?D(e.path):l(e)?e.path:b(e.docName,e.docExt)}function T(e){let t=$(e).match(y);return t?`.${t[1].toLowerCase()}`:void 0}function E(e){return $(e)}function D(e){let t=$(e.trim());return t?`${t}/`:``}function O(e){return e.endsWith(`/`)?E(e):x(e)}function k(e){let t=new Map;for(let n of e){if(!s(n))continue;let e=n.docName.match(y);if(!e)continue;let r=n.docName.slice(0,-e[0].length),i=t.get(r);i?i.add(e[0]):t.set(r,new Set([e[0]]))}return t}function A(e,t){let n=w(e);if(!s(e))return n;let r=e.docName.match(y);if(!r)return n;let i=e.docName.slice(0,-r[0].length);return(t.get(i)?.size??0)>1?n:`${e.docName}${e.docExt??v}`}function j(e){let t=k(e),n=new Set,r=[];for(let i of e){let e=A(i,t);n.has(e)||(n.add(e),r.push(e))}return r}function M(e){return[...e].sort().join(`\0`)}function N(e){return M(j(e))}function P(e,t={}){let n=new Set;for(let r of e){let e=(c(r)||l(r)?r.path:r.docName).split(`/`).filter(Boolean);if(!t.includeOkFolders&&e.includes(`.ok`))continue;if(c(r)){let e=D(r.path);e&&n.add(e)}let i=c(r)?e.length:e.length-1;for(let t=1;t<=i;t++)n.add(`${e.slice(0,t).join(`/`)}/`)}return[...n].sort()}function F(e){if(!e)return[];let t=$(e.replace(y,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function I(e,t,n){let r=T(e);if(r)return r;let i=n.find(e=>s(e)&&e.docName===t);return i?i.docExt??v:Q(e).includes(`.`)?void 0:v}function L(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!l(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function R(e,t,n){if(T(e))return null;let r=n.find(e=>l(e)&&e.path===t);return r?r.path:Q(e).includes(`.`)?t:L(t,n)}function z(e,t){let n=e.kind===`directory`,r=n?E(e.path):S(e.path,t);if(n)return{kind:`folder`,name:$(Q(e.path)).replace(y,``),path:r,treePath:V(e.path,!0)};let i=R(e.path,r,t);if(i)return{kind:`asset`,name:$(Q(i)),path:i,treePath:i};let a=I(e.path,r,t);return{kind:`file`,name:$(Q(e.path)).replace(y,``),path:r,treePath:V(e.path,!1),docExt:a}}function B(e){return e.kind===`directory`?E(e.path):e.path}function V(e,t){return t?D(e):y.test(e)?e:`${e}${v}`}function H(e,t,n){let r=D(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${v}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function U(e,t){return e===`file`?V(t,!1):`${E(t)}/index${v}`}function W(e,t){return t.kind===`root`||t.directoryPath==null?Q(e):`${t.directoryPath}${Q(e)}`}function G(e,t){if(t)return E(D(e));let n=x(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function K(e,t){let n=E(D(e));return n?`${n}/${t}`:t}function q(e,t,n){e.append(`parentDocName`,K(t,n)),e.append(`placement`,`parent-dir`)}function J(e,t){return(t.path??K(e,t.src)).replace(/^\/+/,``)}function Y(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function X(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function Z(e,n){let r=o(e).toLowerCase();if(r===``)return null;let i=new Date().toISOString();if(r===`.md`||r===`.mdx`)return{kind:`document`,docName:x(e),docExt:r,modified:i,size:n.size};let a=r.startsWith(`.`)?r.slice(1):r;return{kind:`asset`,path:e,assetExt:a,mediaKind:t(a),modified:i,size:n.size}}function Q(e){let t=$(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function $(e){return e.endsWith(`/`)?e.slice(0,-1):e}export{h as A,z as C,d as D,J as E,m as O,S,O as T,G as _,U as a,E as b,j as c,w as d,X as f,V as g,Y as h,W as i,p as j,ee as k,N as l,D as m,P as n,H as o,C as p,F as r,b as s,q as t,Z as u,B as v,M as w,x,L as y};
1
+ import{$o as e,Zo as t,rs as n}from"./dist-GenOktAv.js";import{d as r,f as i,p as a}from"./doc-paths-CB3USVY1.js";import{t as o}from"./file-tree-rename-validation-CCqiFGp1.js";import{c as s,l as c,s as l}from"./file-tree-utils-CYn1f82_.js";import{a as u}from"./navigation-targets-iVnea4YK.js";var d=`application/x-open-knowledge-sidebar-item+json`,f={image:!0,video:!0,audio:!0,pdf:!0,text:!0,mermaid:!0};function p(e){return JSON.stringify(e)}function m(e){return e?Array.from(e.types).includes(d):!1}function ee(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:a(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:r(e.assetPath)}:{target:u(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:i(e.docName)}}function h(e){if(!e||!m(e))return null;let t=e.getData(d);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!g(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!_(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _(e){return typeof e==`string`&&Object.hasOwn(f,e)}var v=`.md`,y=/\.(md|mdx)$/i;function b(n,r=v){return y.test(n)||e(n)||t(n)?n:`${n}${r}`}function x(e){return $(e).replace(y,``)}function S(e,t){let n=$(e),r=k(t),i=t.find(e=>s(e)&&A(e,r)===n)??t.find(e=>s(e)&&w(e)===n);if(i)return i.docName;let a=x(n);return t.find(e=>{let t=w(e);return t!==n&&y.test(t)&&x(t)===a})&&y.test(n)?n:a}function C(e,t){let n=k(t);return t.find(t=>A(t,n)===e)??t.find(t=>w(t)===e)}function w(e){return c(e)?D(e.path):l(e)?e.path:b(e.docName,e.docExt)}function T(e){let t=$(e).match(y);return t?`.${t[1].toLowerCase()}`:void 0}function E(e){return $(e)}function D(e){let t=$(e.trim());return t?`${t}/`:``}function O(e){return e.endsWith(`/`)?E(e):x(e)}function k(e){let t=new Map;for(let n of e){if(!s(n))continue;let e=n.docName.match(y);if(!e)continue;let r=n.docName.slice(0,-e[0].length),i=t.get(r);i?i.add(e[0]):t.set(r,new Set([e[0]]))}return t}function A(e,t){let n=w(e);if(!s(e))return n;let r=e.docName.match(y);if(!r)return n;let i=e.docName.slice(0,-r[0].length);return(t.get(i)?.size??0)>1?n:`${e.docName}${e.docExt??v}`}function j(e){let t=k(e),n=new Set,r=[];for(let i of e){let e=A(i,t);n.has(e)||(n.add(e),r.push(e))}return r}function M(e){return[...e].sort().join(`\0`)}function N(e){return M(j(e))}function P(e,t={}){let n=new Set;for(let r of e){let e=(c(r)||l(r)?r.path:r.docName).split(`/`).filter(Boolean);if(!t.includeOkFolders&&e.includes(`.ok`))continue;if(c(r)){let e=D(r.path);e&&n.add(e)}let i=c(r)?e.length:e.length-1;for(let t=1;t<=i;t++)n.add(`${e.slice(0,t).join(`/`)}/`)}return[...n].sort()}function F(e){if(!e)return[];let t=$(e.replace(y,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function I(e,t,n){let r=T(e);if(r)return r;let i=n.find(e=>s(e)&&e.docName===t);return i?i.docExt??v:Q(e).includes(`.`)?void 0:v}function L(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!l(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function R(e,t,n){if(T(e))return null;let r=n.find(e=>l(e)&&e.path===t);return r?r.path:Q(e).includes(`.`)?t:L(t,n)}function z(e,t){let n=e.kind===`directory`,r=n?E(e.path):S(e.path,t);if(n)return{kind:`folder`,name:$(Q(e.path)).replace(y,``),path:r,treePath:V(e.path,!0)};let i=R(e.path,r,t);if(i)return{kind:`asset`,name:$(Q(i)),path:i,treePath:i};let a=I(e.path,r,t);return{kind:`file`,name:$(Q(e.path)).replace(y,``),path:r,treePath:V(e.path,!1),docExt:a}}function B(e){return e.kind===`directory`?E(e.path):e.path}function V(e,t){return t?D(e):y.test(e)?e:`${e}${v}`}function H(e,t,n){let r=D(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${v}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function U(e,t){return e===`file`?V(t,!1):`${E(t)}/index${v}`}function W(e,t){return t.kind===`root`||t.directoryPath==null?Q(e):`${t.directoryPath}${Q(e)}`}function G(e,t){if(t)return E(D(e));let n=x(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function K(e,t){let n=E(D(e));return n?`${n}/${t}`:t}function q(e,t,n){e.append(`parentDocName`,K(t,n)),e.append(`placement`,`parent-dir`)}function J(e,t){return(t.path??K(e,t.src)).replace(/^\/+/,``)}function Y(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function X(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function Z(e,t){let r=o(e).toLowerCase();if(r===``)return null;let i=new Date().toISOString();if(r===`.md`||r===`.mdx`)return{kind:`document`,docName:x(e),docExt:r,modified:i,size:t.size};let a=r.startsWith(`.`)?r.slice(1):r;return{kind:`asset`,path:e,assetExt:a,mediaKind:n(a),modified:i,size:t.size}}function Q(e){let t=$(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function $(e){return e.endsWith(`/`)?e.slice(0,-1):e}export{h as A,z as C,d as D,J as E,m as O,S,O as T,G as _,U as a,E as b,j as c,w as d,X as f,V as g,Y as h,W as i,p as j,ee as k,N as l,D as m,P as n,H as o,C as p,F as r,b as s,q as t,Z as u,B as v,M as w,x,L as y};
@@ -1 +1 @@
1
- import{Nr as e,Rr as t,po as n}from"./dist-ILlrHFKs.js";function r(e){return e.kind===`asset`}function i(e){return e.kind===`document`}function a(e){return e.kind===`folder`}function o(e){let t=[],n=0;for(let r of e)switch(r.kind){case`document`:if(r.docName===void 0){n+=1;break}t.push({kind:`document`,docName:r.docName,docExt:r.docExt,size:r.size,modified:r.modified,isSymlink:r.isSymlink,canonicalDocName:r.canonicalDocName,targetPath:r.targetPath});break;case`asset`:if(r.path===void 0||r.assetExt===void 0){n+=1;break}t.push({kind:`asset`,path:r.path,assetExt:r.assetExt,mediaKind:r.mediaKind??null,size:r.size,modified:r.modified,referencedBy:r.referencedBy});break;case`file`:if(r.path===void 0){n+=1;break}t.push({kind:`asset`,path:r.path,assetExt:r.assetExt??s(r.path),mediaKind:null,size:r.size,modified:r.modified,referencedBy:[]});break;case`folder`:if(r.path===void 0){n+=1;break}t.push({kind:`folder`,path:r.path,size:r.size,modified:r.modified,hasChildren:r.hasChildren,isSymlink:r.isSymlink,targetPath:r.targetPath});break;default:r.kind;break}return n>0&&console.warn(`[file-tree-utils] dropped ${n} listing entries missing variant identity fields`),t}function s(e){let t=e.includes(`/`)?e.split(`/`).pop()??e:e,n=t.lastIndexOf(`.`);return n>0&&n<t.length-1?t.slice(n+1).toLowerCase():t.startsWith(`.`)&&t.length>1?t.slice(1).toLowerCase():`file`}function c(e){if(!e)return[];let t=e.split(`/`).filter(Boolean),n=[];for(let e=1;e<t.length;e++)n.push(t.slice(0,e).join(`/`));return n}function l(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):``}function u(e){return e.split(`/`).some(e=>e.toLowerCase()===`.ok`)}function d(e,t){return t&&e!==`document`&&e!==`folder`}function f(t,n){return!n&&e(t)}function p(n,r={}){let{showHiddenFiles:i=!1,showOnlyMarkdownFiles:a=!1,showOkFolders:o=!1}=r;return n.filter(n=>{let r=n.docName??n.path??``;if(r===``||d(n.kind,a))return!1;let s=r.split(`/`),c=s.indexOf(`.ok`);if(c!==-1){if(!o)return!1;let t=s.slice(0,c).join(`/`);return i||t===``||!e(t)}return t(r)?!1:!f(r,i)})}function m(e,r={}){let{showHiddenFiles:i=!1,showOnlyMarkdownFiles:a=!1}=r,o=e.docName??e.path??``;return o===``||n(o)||t(o)||u(o)?{hiddenFiles:!1,onlyMarkdownFiles:!1}:{hiddenFiles:f(o,i),onlyMarkdownFiles:d(e.kind,a)}}function h(e){let{visibility:t={},unfilteredRootEntryCount:n,knownPageCount:r}=e;return(n>0||r>0)&&(t.showOnlyMarkdownFiles??!1)?`filtered-to-zero`:`true-empty`}export{p as a,i as c,o as d,l as i,a as l,h as n,u as o,c as r,r as s,m as t,s as u};
1
+ import{Pr as e,ao as t,kr as n}from"./dist-GenOktAv.js";function r(e){return e.kind===`asset`}function i(e){return e.kind===`document`}function a(e){return e.kind===`folder`}function o(e){let t=[],n=0;for(let r of e)switch(r.kind){case`document`:if(r.docName===void 0){n+=1;break}t.push({kind:`document`,docName:r.docName,docExt:r.docExt,size:r.size,modified:r.modified,isSymlink:r.isSymlink,canonicalDocName:r.canonicalDocName,targetPath:r.targetPath});break;case`asset`:if(r.path===void 0||r.assetExt===void 0){n+=1;break}t.push({kind:`asset`,path:r.path,assetExt:r.assetExt,mediaKind:r.mediaKind??null,size:r.size,modified:r.modified,referencedBy:r.referencedBy});break;case`file`:if(r.path===void 0){n+=1;break}t.push({kind:`asset`,path:r.path,assetExt:r.assetExt??s(r.path),mediaKind:null,size:r.size,modified:r.modified,referencedBy:[]});break;case`folder`:if(r.path===void 0){n+=1;break}t.push({kind:`folder`,path:r.path,size:r.size,modified:r.modified,hasChildren:r.hasChildren,isSymlink:r.isSymlink,targetPath:r.targetPath});break;default:r.kind;break}return n>0&&console.warn(`[file-tree-utils] dropped ${n} listing entries missing variant identity fields`),t}function s(e){let t=e.includes(`/`)?e.split(`/`).pop()??e:e,n=t.lastIndexOf(`.`);return n>0&&n<t.length-1?t.slice(n+1).toLowerCase():t.startsWith(`.`)&&t.length>1?t.slice(1).toLowerCase():`file`}function c(e){if(!e)return[];let t=e.split(`/`).filter(Boolean),n=[];for(let e=1;e<t.length;e++)n.push(t.slice(0,e).join(`/`));return n}function l(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):``}function u(e){return e.split(`/`).some(e=>e.toLowerCase()===`.ok`)}function d(e,t){return t&&e!==`document`&&e!==`folder`}function f(e,t){return!t&&n(e)}function p(t,r={}){let{showHiddenFiles:i=!1,showOnlyMarkdownFiles:a=!1,showOkFolders:o=!1}=r;return t.filter(t=>{let r=t.docName??t.path??``;if(r===``||d(t.kind,a))return!1;let s=r.split(`/`),c=s.indexOf(`.ok`);if(c!==-1){if(!o)return!1;let e=s.slice(0,c).join(`/`);return i||e===``||!n(e)}return e(r)?!1:!f(r,i)})}function m(n,r={}){let{showHiddenFiles:i=!1,showOnlyMarkdownFiles:a=!1}=r,o=n.docName??n.path??``;return o===``||t(o)||e(o)||u(o)?{hiddenFiles:!1,onlyMarkdownFiles:!1}:{hiddenFiles:f(o,i),onlyMarkdownFiles:d(n.kind,a)}}function h(e){let{visibility:t={},unfilteredRootEntryCount:n,knownPageCount:r}=e;return(n>0||r>0)&&(t.showOnlyMarkdownFiles??!1)?`filtered-to-zero`:`true-empty`}export{p as a,i as c,o as d,l as i,a as l,h as n,u as o,c as r,r as s,m as t,s as u};
@@ -1 +1 @@
1
- import{c as e}from"./documents-events-CCW6R-r2.js";import{t}from"./parse-api-error-DfesE4Y7.js";import{t as n}from"./createLucideIcon-Bhw2PmPp.js";var r=n(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]);async function i(e){return t(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function a(e,t){try{let n=await fetch(`/api/folder-config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,frontmatter:t})});return n.ok?{ok:!0}:{ok:!1,error:await i(n)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function o(t){try{let n=await fetch(`/api/template`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)return{ok:!1,error:await i(n)};let r=await n.json().catch(()=>null);return e(),{ok:!0,created:r?.created??!1,warnings:r?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function s(t,n){try{let r=`?folder=${encodeURIComponent(t)}&name=${encodeURIComponent(n)}`,a=await fetch(`/api/template${r}`,{method:`DELETE`});if(!a.ok)return{ok:!1,error:await i(a)};let o=await a.json().catch(()=>null);return e(),{ok:!0,existed:o?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function c(t){try{let n=await fetch(`/api/template`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)return{ok:!1,error:await i(n)};let r=await n.json().catch(()=>null);return e(),{ok:!0,committed:r?.committed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function l(t){try{let n=await fetch(`/api/template/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)return{ok:!1,error:await i(n)};let r=await n.json().catch(()=>null);return e(),{ok:!0,path:r?.path??``,created:r?.created??!1,warnings:r?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}export{o as a,a as i,l as n,r as o,c as r,s as t};
1
+ import{c as e}from"./documents-events-rgFBXE2Z.js";import{t}from"./parse-api-error-DfesE4Y7.js";import{t as n}from"./createLucideIcon-Bhw2PmPp.js";var r=n(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]);async function i(e){return t(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function a(e,t){try{let n=await fetch(`/api/folder-config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,frontmatter:t})});return n.ok?{ok:!0}:{ok:!1,error:await i(n)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function o(t){try{let n=await fetch(`/api/template`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)return{ok:!1,error:await i(n)};let r=await n.json().catch(()=>null);return e(),{ok:!0,created:r?.created??!1,warnings:r?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function s(t,n){try{let r=`?folder=${encodeURIComponent(t)}&name=${encodeURIComponent(n)}`,a=await fetch(`/api/template${r}`,{method:`DELETE`});if(!a.ok)return{ok:!1,error:await i(a)};let o=await a.json().catch(()=>null);return e(),{ok:!0,existed:o?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function c(t){try{let n=await fetch(`/api/template`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)return{ok:!1,error:await i(n)};let r=await n.json().catch(()=>null);return e(),{ok:!0,committed:r?.committed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function l(t){try{let n=await fetch(`/api/template/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)return{ok:!1,error:await i(n)};let r=await n.json().catch(()=>null);return e(),{ok:!0,path:r?.path??``,created:r?.created??!1,warnings:r?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}export{o as a,a as i,l as n,r as o,c as r,s as t};
@@ -0,0 +1,4 @@
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{mn as n,pn as r,un as i}from"./DocumentContext-BN8gSwJ-.js";import{t as a}from"./react-f2sANaYj.js";import{r as o}from"./dist-Nvb76hAm.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{t as c}from"./utils-CPqDy6Hr.js";import{r as l,t as u}from"./button-CA0dewJJ.js";import{$ as d,H as f,J as p,V as m,f as h,l as g,q as _,tt as v,u as y}from"./CodeMirrorPropInput-Cydg0jHr.js";import{t as b}from"./separator-vdmCepR4.js";import{Gi as x,Hi as S,Mi as C,Ni as w,Pi as T,ca as E,fa as D,ji as O,ya as k}from"./dist-GenOktAv.js";import{t as A}from"./dist-DUfEoSbR.js";import{t as j}from"./workspace-paths-CKUFX0v6.js";import{t as M}from"./createLucideIcon-Bhw2PmPp.js";import{t as N}from"./x-DS57FvHW.js";var P=M(`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`}]]),F=s(),I=t(),L=l(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function R(e){let t=(0,F.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=c(L({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,I.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":r,className:a,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}function z(e){let t=(0,F.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]===n?o=t[5]:(o=c(`relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,I.jsx)(b,{"data-slot":`button-group-separator`,orientation:a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var B=e(a(),1),V=`ok-ask-ai-draft-v2`,H={doc:null,dismissed:!1};function U(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var W=null,G=new Set;function K(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 ee(){let e=U();if(!e)return H;try{let t=e.getItem(V);if(!t)return H;let n=JSON.parse(t);return typeof n!=`object`||!n||Array.isArray(n)?H:{doc:n,dismissed:!1}}catch(e){return console.warn(`failed to parse stored draft — clearing`,e),H}}function te(){return W===null&&(W=ee()),W}function ne(e){let t=U();if(t)try{e&&!K(e)?t.setItem(V,JSON.stringify(e)):t.removeItem(V)}catch{}}function re(){for(let e of G)e()}function ie(){return te()}function ae(e){let t=e&&!K(e)?e:null;W={...te(),doc:t},ne(t),re()}function oe(){ae(null)}var se=`button, a[href], [role="menuitem"], [role="button"], input, textarea, select, [contenteditable="true"]`;function ce(e,t){e.target instanceof HTMLElement&&(!(e.currentTarget instanceof HTMLElement)||!e.currentTarget.contains(e.target)||e.target.closest(se)||(e.preventDefault(),t.current?.focus()))}var le=O;function ue(e){let t=h(e).kind;return t===`folder`||t===`asset`?t:`page`}function de(e){let t=(0,F.c)(14),{items:n,query:r,selectedIndex:a,onSelect:s,loading:c,error:l,hasMore:u}=e,d=c===void 0?!1:c,f=l===void 0?!1:l,p=u===void 0?!1:u,{_:m}=o(),h=(0,B.useId)(),g=(0,B.useRef)(null),_,v;t[0]===a?(_=t[1],v=t[2]):(_=()=>{(g.current?.querySelectorAll(`[role="option"]`))?.item(a)?.scrollIntoView({block:`nearest`})},v=[a],t[0]=a,t[1]=_,t[2]=v),(0,B.useEffect)(_,v);let y=a>=0&&a<n.length?n[a]:null,b;return t[3]!==m||t[4]!==f||t[5]!==p||t[6]!==n||t[7]!==h||t[8]!==d||t[9]!==s||t[10]!==r||t[11]!==a||t[12]!==y?(b=(0,I.jsx)(`div`,{ref:g,className:`w-80 max-w-[min(28rem,90vw)] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:d?(0,I.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:m({id:`3m2GBo`})}):f?(0,I.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`assertive`,children:m({id:`weP6me`})}):n.length===0?(0,I.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:r.trim()===``?m({id:`0E9DR6`}):m({id:`yQyglE`})}):(0,I.jsxs)(`div`,{role:`listbox`,id:h,"aria-label":m({id:`05n5wS`}),tabIndex:-1,className:`max-h-64 overflow-y-auto subtle-scrollbar`,children:[(0,I.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:y?y.title:``}),n.map((e,t)=>{let n=t===a,r=ue(e.path),o=r===`folder`,c=o?`${e.path}/`:e.path;return(0,I.jsxs)(`button`,{id:`${h}-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(),s(e)},children:[(0,I.jsx)(i,{path:e.path,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,I.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,I.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),o?(0,I.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:m({id:`kNqMMd`})}):null]}),(0,I.jsx)(`span`,{className:`line-clamp-2 break-all text-xs text-muted-foreground`,children:c})]})]},e.docName)}),p?(0,I.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,"aria-hidden":!0,children:m({id:`F1T9y_`})}):null]})}),t[3]=m,t[4]=f,t[5]=p,t[6]=n,t[7]=h,t[8]=d,t[9]=s,t[10]=r,t[11]=a,t[12]=y,t[13]=b):b=t[13],b}var fe=8,q=new k(`composerMentionSuggestion`);function pe(e){return e.kind===`asset`?e.docName.replace(/^\//,``):e.kind===`folder`?e.docName:j(e.docName)}var me=x.create({name:`doc`,topNode:!0,content:`paragraph+`}),he=x.create({name:`paragraph`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML(){return[`p`,0]}}),ge=x.create({name:`text`,group:`inline`}),_e=x.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`})}}}),ve=S.create({name:`composerHistory`,addProseMirrorPlugins(){return[C(),D({"Mod-z":T,"Mod-y":w,"Shift-Mod-z":w})]}}),ye=x.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`,E(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:i})=>{let a=String(e.attrs.path??``),o=String(e.attrs.label||e.attrs.path),s=document.createElement(`span`);s.className=`composer-mention-chip group/mention`,s.setAttribute(`data-composer-mention`,a),s.title=o;let c=document.createElement(`button`);c.type=`button`,c.className=`composer-mention-icon`,c.setAttribute(`aria-label`,A._({id:`Xzy0s0`,values:{fullLabel:o}}));let l=document.createElement(`span`);l.className=`composer-mention-glyph composer-mention-glyph-icon`,l.setAttribute(`aria-hidden`,`true`),l.innerHTML=r(a),c.appendChild(l);let u=document.createElement(`span`);u.className=`composer-mention-glyph composer-mention-glyph-x`,u.setAttribute(`aria-hidden`,`true`),u.innerHTML=n(N),c.appendChild(u),c.addEventListener(`mousedown`,e=>e.preventDefault()),c.addEventListener(`click`,n=>{n.preventDefault();let r=typeof i==`function`?i():null;r!=null&&t.chain().focus().deleteRange({from:r,to:r+e.nodeSize}).run()}),s.appendChild(c);let d=document.createElement(`span`);return d.className=`composer-mention-label`,d.textContent=o,s.appendChild(d),{dom:s}}},addProseMirrorPlugins(){return[Se(this.editor)]}});function be(e){return[me,he,ge,_e,ve,ye,...e?.placeholder?[le.configure({placeholder:e.placeholder,showOnlyWhenEditable:!1})]:[]]}function xe(e=g){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 y(t,a).map(e=>({docName:e.docName,title:e.title,path:pe(e)})).filter(e=>e.path!==``)},reset(){t=[],n=!1,r=null,i=!1}}}function Se(e){let t=xe();return _({editor:e,pluginKey:q,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>=fe}},l=()=>{!e||!n||e.updateProps(c(n))};return{onBeforeStart(t){n=t,r=0;let s=m(()=>n,`composer-mention`);i.popup=s.popup,a=s.doPosition,o=s.reveal,e=new d(de,{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(){f(i),a=null,o=null,e?.destroy(),e=null,n=null,r=0,t.reset()}}}})}function J(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+=`
2
+ `)}),r.push(i)}),{instruction:r.join(`
3
+ `).trim(),mentions:t}}function Y(e){let{instruction:t,mentions:n}=J(e);return t===``&&n.length===0}function Ce(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 we(e){return e.split(`
4
+ `).map(e=>({type:`paragraph`,content:e===``?[]:[{type:`text`,text:e}]}))}function Te(e){let t=(0,F.c)(43),{ref:n,ariaLabel:r,onEmptyChange:i,onContentChange:a,onMentionsChange:o,onSubmit:s,onEscape:l,className:u,placeholder:d,initialDoc:f,disabled:m,testId:h}=e,g=m===void 0?!1:m,_=(0,B.useRef)(i),y=(0,B.useRef)(a),b=(0,B.useRef)(o),x=(0,B.useRef)(s),S=(0,B.useRef)(l),C;t[0]!==a||t[1]!==i||t[2]!==l||t[3]!==o||t[4]!==s?(C=()=>{_.current=i,y.current=a,b.current=o,x.current=s,S.current=l},t[0]=a,t[1]=i,t[2]=l,t[3]=o,t[4]=s,t[5]=C):C=t[5],(0,B.useEffect)(C);let w;t[6]===d?w=t[7]:(w=be({placeholder:d}),t[6]=d,t[7]=w);let T=f??void 0,E=!g,D;t[8]===h?D=t[9]:(D=h===void 0?{}:{"data-testid":h},t[8]=h,t[9]=D);let O;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=c(`composer-prosemirror py-1 outline-none`),t[10]=O):O=t[10];let k;t[11]!==r||t[12]!==D?(k={role:`textbox`,"aria-label":r,"aria-multiline":`true`,...D,class:O},t[11]=r,t[12]=D,t[13]=k):k=t[13];let A;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(A=(e,t)=>t.key===`Escape`?q.getState(e.state)?.active?!1:S.current===void 0?(e.dom.blur(),!0):(S.current(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?q.getState(e.state)?.active?!1:(x.current(),!0):!1,t[14]=A):A=t[14];let j;t[15]===k?j=t[16]:(j={attributes:k,handleKeyDown:A},t[15]=k,t[16]=j);let M;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{let{editor:t}=e;_.current(Y(t)),y.current?.(t.getJSON()),b.current?.(J(t).mentions)},t[17]=M):M=t[17];let N;t[18]!==j||t[19]!==w||t[20]!==T||t[21]!==E?(N={extensions:w,content:T,immediatelyRender:!0,editable:E,editorProps:j,onUpdate:M},t[18]=j,t[19]=w,t[20]=T,t[21]=E,t[22]=N):N=t[22];let P=v(N),L,R;t[23]!==r||t[24]!==P||t[25]!==d?(L=()=>{if(!P||P.isDestroyed)return;let e=P.extensionManager.extensions.find(Ee);e&&(e.options.placeholder=d??``);let t=P.editorView;t&&(t.dom.setAttribute(`aria-label`,r??``),t.dispatch(P.state.tr.setMeta(`addToHistory`,!1)))},R=[P,d,r],t[23]=r,t[24]=P,t[25]=d,t[26]=L,t[27]=R):(L=t[26],R=t[27]),(0,B.useEffect)(L,R);let z,V;t[28]!==g||t[29]!==P?(z=()=>{if(!P||P.isDestroyed)return;let e=!g;P.isEditable!==e&&P.setEditable(e,!1);let t=P.editorView;t&&(g?t.dom.setAttribute(`aria-disabled`,`true`):t.dom.removeAttribute(`aria-disabled`))},V=[P,g],t[28]=g,t[29]=P,t[30]=z,t[31]=V):(z=t[30],V=t[31]),(0,B.useEffect)(z,V);let H;t[32]!==P||t[33]!==f?(H=()=>{P&&(Y(P)&&Ce(f)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),oe()),_.current(Y(P)),b.current?.(J(P).mentions))},t[32]=P,t[33]=f,t[34]=H):H=t[34];let U;t[35]===P?U=t[36]:(U=[P],t[35]=P,t[36]=U),(0,B.useEffect)(H,U);let W,G;t[37]===P?(W=t[38],G=t[39]):(W=()=>({focus:()=>P?.commands.focus(),blur:()=>P?.commands.blur(),clear:()=>P?.commands.clearContent(!0),setText:e=>{P&&(P.commands.setContent(e),y.current?.(P.getJSON()),b.current?.(J(P).mentions))},appendText:e=>{!P||e===``||(Y(P)?P.commands.setContent(we(e)):P.commands.insertContentAt(P.state.doc.content.size,[{type:`paragraph`,content:[]},...we(e)]),_.current(Y(P)),y.current?.(P.getJSON()),b.current?.(J(P).mentions))},getContent:()=>P?J(P):{instruction:``,mentions:[]}}),G=[P],t[37]=P,t[38]=W,t[39]=G),(0,B.useImperativeHandle)(n,W,G);let K;return t[40]!==u||t[41]!==P?(K=(0,I.jsx)(p,{editor:P,className:u}),t[40]=u,t[41]=P,t[42]=K):K=t[42],K}function Ee(e){return e.name===`placeholder`}function De(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function Oe(e){let t=(0,F.c)(21),{path:n,onRemove:r}=e,{_:a}=o(),s,c;t[0]!==a||t[1]!==n?(s=De(n),c=a({id:`hnq8fP`,values:{label:s}}),t[0]=a,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]);let l=c,d=`composer-context-chip-file-${n}`,f;t[4]===r?f=t[5]:(f=e=>{(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),r())},t[4]=r,t[5]=f);let p;t[6]===n?p=t[7]:(p=(0,I.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,I.jsx)(i,{path:n,className:`size-3`,showExtensionBadge:!1})}),t[6]=n,t[7]=p);let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,I.jsx)(N,{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]=m):m=t[8];let h;t[9]!==r||t[10]!==l||t[11]!==f||t[12]!==p?(h=(0,I.jsxs)(u,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":l,onClick:r,onKeyDown:f,className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[p,m]}),t[9]=r,t[10]=l,t[11]=f,t[12]=p,t[13]=h):h=t[13];let g;t[14]===s?g=t[15]:(g=(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:s}),t[14]=s,t[15]=g);let _;return t[16]!==n||t[17]!==d||t[18]!==h||t[19]!==g?(_=(0,I.jsxs)(`span`,{"data-testid":d,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:[h,g]}),t[16]=n,t[17]=d,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function ke(e){let t=(0,F.c)(13),{files:n,onRemoveFile:r,className:i,children:a}=e,o;t[0]===n?o=t[1]:(o=n===void 0?[]:n,t[0]=n,t[1]=o);let s=o;if(s.length===0&&B.Children.toArray(a).length===0)return null;let l;t[2]===i?l=t[3]:(l=c(`flex flex-wrap items-center gap-1`,i),t[2]=i,t[3]=l);let u;if(t[4]!==s||t[5]!==r){let e;t[7]===r?e=t[8]:(e=e=>(0,I.jsx)(Oe,{path:e,onRemove:()=>r?.(e)},e),t[7]=r,t[8]=e),u=s.map(e),t[4]=s,t[5]=r,t[6]=u}else u=t[6];let d;return t[9]!==a||t[10]!==l||t[11]!==u?(d=(0,I.jsxs)(`div`,{className:l,"data-testid":`composer-context-chips`,children:[u,a]}),t[9]=a,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function Ae(){let e=(0,F.c)(2),[t,n]=(0,B.useState)(je),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,B.useEffect)(r,i),t}function je(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function X(e,t){let n=e[t];return typeof n==`string`&&n!==``?n:null}function Me(e){if(typeof e!=`object`||!e)return null;let t=e,n=X(t,`tool`)??X(t,`name`),r=t;if(typeof t.arguments==`object`&&t.arguments!==null)r=t.arguments;else if(typeof t.arguments==`string`)try{let e=JSON.parse(t.arguments);typeof e==`object`&&e&&(r=e)}catch{}return{tool:n,args:r}}var Z=`ok-acp-follow-file-v1`;function Ne(){try{return localStorage.getItem(Z)!==`0`}catch{return!0}}function Pe(e){try{localStorage.setItem(Z,e?`1`:`0`)}catch{}}function Q(e){return e===``||e.startsWith(`/`)||e.startsWith(`\\`)||e.split(`/`).some(e=>e===``||e.startsWith(`.`))?null:e}function $(e,t){let n=t.pathSeparator,r=e=>n===`\\`?e.replaceAll(`\\`,`/`):e,i=r(t.contentDir).replace(/\/$/,``),a=r(e);if(!a.startsWith(`${i}/`))return null;let o=a.slice(i.length+1),s=/\.(md|mdx)$/.exec(o);return s===null?null:Q(o.slice(0,-s[0].length))}var Fe=new Set([`cat`,`ls`,`grep`,`rg`,`find`,`head`,`tail`,`wc`,`sort`,`uniq`,`cut`,`sed`,`awk`,`bat`,`less`,`more`]);function Ie(e,t){let n=[],r=/"([^"]*)"|'([^']*)'|(\S+)/g,i=r.exec(e);for(;i!==null;)n.push(i[1]??i[2]??i[3]??``),i=r.exec(e);let a=n[0];if(a===void 0||!Fe.has(a))return null;for(let e of n.slice(1)){if(e.startsWith(`-`)||/[*?[\]]/.test(e))continue;let n=/\.(md|mdx)$/i.exec(e);if(n===null)continue;if(e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)){if(t!==null){let n=$(e,t);if(n!==null)return n}continue}let r=Q(e.replace(/^\.\//,``).slice(0,-n[0].length));if(r!==null)return r}return null}function Le(e){if(e===null||e.loading||e.error!==null)return{};let t=e.pages;return{docExists:e=>t.has(e)}}function Re(e,t,n,r){let i=Me(e);if(i===null)return null;let{tool:a,args:o}=i;if(a===`delete`||a===null&&/\bdelete\b/i.test(t))return null;let s=typeof o.document==`object`&&o.document!==null?o.document:null,c=null;if(Array.isArray(o.documents))for(let e=o.documents.length-1;e>=0;e--){let t=o.documents[e];if(typeof t==`object`&&t){c=t;break}}let l=(s===null?null:X(s,`path`))??(c===null?null:X(c,`path`))??X(o,`to`)??X(o,`docName`);if(l!==null)return Q(l.replace(/\.(md|mdx)$/,``));let u=X(o,`command`);if(u!==null){let e=Ie(u,n);return e!==null&&r.docExists!==void 0&&!r.docExists(e)?null:e}return null}function ze(e,t,n={}){if(e.toolKind===`delete`)return null;let r=Re(e.rawInput,e.title,t,n);if(r!==null)return r;if(t===null)return null;let i=e.toolKind!==`edit`&&e.toolKind!==`move`&&n.docExists!==void 0;for(let r=e.locations.length-1;r>=0;r--){let a=e.locations[r];if(a===void 0)continue;let o=$(a.path,t);if(o!==null)return i&&!n.docExists?.(o)?null:o}return null}var Be={lastFollowed:null,yielded:!1,reArmed:!1};function Ve(e,t,n){if(e===null||n.lastFollowed===e)return{navigateTo:null,state:n};if(n.lastFollowed!==null&&t!==null&&t!==n.lastFollowed&&t!==e&&!n.reArmed)return{navigateTo:null,state:{...n,yielded:!0}};if(n.yielded&&!n.reArmed)return{navigateTo:null,state:n};let r={lastFollowed:e,yielded:!1,reArmed:!1};return t===e?{navigateTo:null,state:r}:{navigateTo:e,state:r}}function He(e,t,n={}){let r=null;for(let i of e){if(i.kind!==`tool_call`)continue;let e=ze(i,t,n);e!==null&&(r=e)}return r}export{ae as _,Le as a,P as b,X as c,ke as d,Te as f,ie as g,oe as h,Ne as i,Me as l,ce as m,Ve as n,Q as o,le as p,He as r,Pe as s,Be as t,Ae as u,R as v,z as y};