@carbon/ai-chat-components 0.6.2 → 0.7.0-rc.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.
- package/custom-elements.json +2611 -3856
- package/dist/16-BZMv8BLP.js +91 -0
- package/dist/16-DTIyOew7.js +91 -0
- package/dist/button-VYkJ5dwm.js +157 -0
- package/dist/button-skeleton-C44ojFOx.js +131 -0
- package/dist/card.min.js +193 -0
- package/dist/chain-of-thought.min.js +173 -155
- package/dist/chat-button.min.js +23 -23
- package/dist/checkbox-skeleton-B1dsTlWl.js +166 -0
- package/dist/{lit-element-DibNdm1l.js → class-map-CAQcKAyP.js} +38 -22
- package/dist/code-snippet.min.js +21 -21
- package/dist/codemirror-runtime-DjJTvK74.js +173 -0
- package/dist/{dockerfile-CKwmNxGw.js → dockerfile-C5Ju62-g.js} +21 -21
- package/dist/{factor-PwV725w2.js → factor-BLzOdeEw.js} +21 -21
- package/dist/feedback.min.js +68 -87
- package/dist/{icon-button-Ddd1Ihho.js → icon-button-B9XqYdUx.js} +33 -33
- package/dist/{icon-loader-DuM8rfP3.js → icon-loader-tzlfALFt.js} +23 -23
- package/dist/{if-defined-CbQ0hWcL.js → if-defined-DvPtK2Df.js} +22 -22
- package/dist/index--QAAkyqA.js +91 -0
- package/dist/{index-B1YAtZGR.js → index-1zAoDu0L.js} +21 -21
- package/dist/{index-BtI1vT4z.js → index-B6ll86Y6.js} +21 -21
- package/dist/index-B9DVtGsv.js +278 -0
- package/dist/index-BPU5uHmK.js +91 -0
- package/dist/index-BbWtDXd9.js +91 -0
- package/dist/index-BjsxSbgO.js +91 -0
- package/dist/index-BwI8x9E4.js +91 -0
- package/dist/index-C3KNlXVv.js +168 -0
- package/dist/index-CAdio42O.js +91 -0
- package/dist/index-CSMhs9Fm.js +91 -0
- package/dist/index-CU0IEHyz.js +91 -0
- package/dist/index-Cj-ZmC-W.js +91 -0
- package/dist/index-Ctl66nQF.js +91 -0
- package/dist/index-D7MLs7w5.js +91 -0
- package/dist/index-DH8wnvUn.js +91 -0
- package/dist/index-DWn_nnHo.js +91 -0
- package/dist/index-DpqlVRJ7.js +91 -0
- package/dist/index-Dx9Ms_uJ.js +91 -0
- package/dist/index-EwTPqhmw.js +91 -0
- package/dist/index-P1vutKel.js +91 -0
- package/dist/index-WQxGinYJ.js +91 -0
- package/dist/index-cK4rXRw-.js +91 -0
- package/dist/index-o-THaGga.js +91 -0
- package/dist/loading-icon-CRrLjNZH.js +106 -0
- package/dist/markdown.min.js +72 -70
- package/dist/{nsis-CWLatKhG.js → nsis-Biw-VyZu.js} +21 -21
- package/dist/processing.min.js +23 -23
- package/dist/{pug-DiwBvjDI.js → pug-BuYdIlne.js} +21 -21
- package/dist/reasoning-steps.min.js +69 -38
- package/dist/{state-B20s9hJU.js → state-CBq0UPBm.js} +21 -21
- package/dist/{table-runtime-CzipYmcB.js → table-runtime-CzXXhWmg.js} +86 -86
- package/dist/table.min.js +21 -21
- package/dist/text-input-VC8mmTlR.js +158 -0
- package/dist/toolbar.min.js +54 -56
- package/dist/workspace-shell.min.js +46 -51
- package/es/components/card/index.d.ts +11 -0
- package/es/components/{tile-container → card}/index.js +3 -1
- package/es/components/{tile-container → card}/index.js.map +1 -1
- package/es/components/card/src/card-footer.d.ts +43 -0
- package/es/components/card/src/card-footer.js +140 -0
- package/es/components/card/src/card-footer.js.map +1 -0
- package/es/components/card/src/card-footer.scss.js +13 -0
- package/es/components/card/src/card-footer.scss.js.map +1 -0
- package/es/components/card/src/card-steps.d.ts +28 -0
- package/es/components/card/src/card-steps.js +90 -0
- package/es/components/card/src/card-steps.js.map +1 -0
- package/es/components/{tile-container/src/tile-container.scss.js → card/src/card-steps.scss.js} +2 -2
- package/es/components/card/src/card-steps.scss.js.map +1 -0
- package/es/components/card/src/card.d.ts +27 -0
- package/es/components/card/src/card.js +65 -0
- package/es/components/card/src/card.js.map +1 -0
- package/es/components/card/src/card.scss.js +13 -0
- package/es/components/card/src/card.scss.js.map +1 -0
- package/es/components/chain-of-thought/defs.d.ts +54 -0
- package/es/components/chain-of-thought/{src/types.js → defs.js} +10 -1
- package/es/components/chain-of-thought/defs.js.map +1 -0
- package/es/components/chain-of-thought/index.d.ts +10 -4
- package/es/components/chain-of-thought/index.js +5 -3
- package/es/components/chain-of-thought/index.js.map +1 -1
- package/es/components/chain-of-thought/src/chain-of-thought-step.d.ts +43 -0
- package/es/components/chain-of-thought/src/chain-of-thought-step.js +351 -0
- package/es/components/chain-of-thought/src/chain-of-thought-step.js.map +1 -0
- package/es/components/chain-of-thought/src/chain-of-thought-step.scss.js +13 -0
- package/es/components/chain-of-thought/src/chain-of-thought-step.scss.js.map +1 -0
- package/es/components/chain-of-thought/src/chain-of-thought-toggle.d.ts +33 -0
- package/es/components/chain-of-thought/src/chain-of-thought-toggle.js +107 -0
- package/es/components/chain-of-thought/src/chain-of-thought-toggle.js.map +1 -0
- package/es/components/chain-of-thought/src/chain-of-thought-toggle.scss.js +13 -0
- package/es/components/chain-of-thought/src/chain-of-thought-toggle.scss.js.map +1 -0
- package/es/components/chain-of-thought/src/chain-of-thought.d.ts +23 -69
- package/es/components/chain-of-thought/src/chain-of-thought.js +88 -145
- package/es/components/chain-of-thought/src/chain-of-thought.js.map +1 -1
- package/es/components/chain-of-thought/src/chain-of-thought.scss.js +1 -1
- package/es/components/chain-of-thought/src/tool-call-data.d.ts +33 -0
- package/es/components/chain-of-thought/src/tool-call-data.js +179 -0
- package/es/components/chain-of-thought/src/tool-call-data.js.map +1 -0
- package/es/components/chain-of-thought/src/tool-call-data.scss.js +13 -0
- package/es/components/chain-of-thought/src/tool-call-data.scss.js.map +1 -0
- package/es/components/chat-button/src/chat-button.d.ts +11 -3
- package/es/components/chat-button/src/chat-button.js +15 -11
- package/es/components/chat-button/src/chat-button.js.map +1 -1
- package/es/components/code-snippet/index.d.ts +2 -2
- package/es/components/code-snippet/index.js +1 -1
- package/es/components/code-snippet/src/code-snippet-card.d.ts +63 -0
- package/es/components/code-snippet/src/code-snippet-card.js +186 -0
- package/es/components/code-snippet/src/code-snippet-card.js.map +1 -0
- package/es/components/code-snippet/src/code-snippet.d.ts +32 -31
- package/es/components/code-snippet/src/code-snippet.js +115 -29
- package/es/components/code-snippet/src/code-snippet.js.map +1 -1
- package/es/components/code-snippet/src/code-snippet.scss.js +1 -1
- package/es/components/feedback/index.d.ts +4 -7
- package/es/components/feedback/index.js +2 -4
- package/es/components/feedback/index.js.map +1 -1
- package/es/components/feedback/src/feedback-buttons.d.ts +9 -2
- package/es/components/feedback/src/feedback-buttons.js +24 -15
- package/es/components/feedback/src/feedback-buttons.js.map +1 -1
- package/es/components/feedback/src/feedback-buttons.template.d.ts +2 -2
- package/es/components/feedback/src/feedback-buttons.template.js.map +1 -1
- package/es/components/feedback/src/feedback.d.ts +9 -10
- package/es/components/feedback/src/feedback.js +35 -22
- package/es/components/feedback/src/feedback.js.map +1 -1
- package/es/components/feedback/src/feedback.scss.js +1 -1
- package/es/components/feedback/src/feedback.template.d.ts +2 -2
- package/es/components/feedback/src/feedback.template.js +4 -4
- package/es/components/feedback/src/feedback.template.js.map +1 -1
- package/es/components/markdown/index.d.ts +2 -2
- package/es/components/markdown/index.js +1 -1
- package/es/components/markdown/src/markdown-renderer.d.ts +4 -0
- package/es/components/markdown/src/markdown-renderer.js +16 -11
- package/es/components/markdown/src/markdown-renderer.js.map +1 -1
- package/es/components/markdown/src/markdown.d.ts +42 -14
- package/es/components/markdown/src/markdown.js +146 -42
- package/es/components/markdown/src/markdown.js.map +1 -1
- package/es/components/markdown/src/markdown.scss.js +1 -1
- package/es/components/markdown/src/markdown.template.d.ts +5 -2
- package/es/components/markdown/src/markdown.template.js +8 -3
- package/es/components/markdown/src/markdown.template.js.map +1 -1
- package/es/components/processing/src/processing.d.ts +8 -1
- package/es/components/processing/src/processing.js +7 -10
- package/es/components/processing/src/processing.js.map +1 -1
- package/es/components/processing/src/processing.scss.js +1 -1
- package/es/components/reasoning-steps/index.d.ts +4 -2
- package/es/components/reasoning-steps/index.js +3 -2
- package/es/components/reasoning-steps/index.js.map +1 -1
- package/es/components/reasoning-steps/src/{cds-aichat-reasoning-step.d.ts → reasoning-step.d.ts} +6 -7
- package/es/components/reasoning-steps/src/{cds-aichat-reasoning-step.js → reasoning-step.js} +24 -26
- package/es/components/reasoning-steps/src/reasoning-step.js.map +1 -0
- package/es/components/reasoning-steps/src/{cds-aichat-reasoning-step.scss.js → reasoning-step.scss.js} +1 -1
- package/es/components/reasoning-steps/src/reasoning-step.scss.js.map +1 -0
- package/es/components/reasoning-steps/src/reasoning-steps-toggle.d.ts +36 -0
- package/es/components/reasoning-steps/src/reasoning-steps-toggle.js +81 -0
- package/es/components/reasoning-steps/src/reasoning-steps-toggle.js.map +1 -0
- package/es/components/reasoning-steps/src/reasoning-steps-toggle.scss.js +13 -0
- package/es/components/reasoning-steps/src/reasoning-steps-toggle.scss.js.map +1 -0
- package/es/components/reasoning-steps/src/reasoning-steps-toggle.template.d.ts +3 -0
- package/es/components/reasoning-steps/src/reasoning-steps-toggle.template.js +43 -0
- package/es/components/reasoning-steps/src/reasoning-steps-toggle.template.js.map +1 -0
- package/es/components/reasoning-steps/src/{cds-aichat-reasoning-steps.d.ts → reasoning-steps.d.ts} +6 -1
- package/es/components/reasoning-steps/src/{cds-aichat-reasoning-steps.js → reasoning-steps.js} +9 -6
- package/es/components/reasoning-steps/src/reasoning-steps.js.map +1 -0
- package/es/components/reasoning-steps/src/{cds-aichat-reasoning-steps.scss.js → reasoning-steps.scss.js} +1 -1
- package/es/components/reasoning-steps/src/reasoning-steps.scss.js.map +1 -0
- package/es/components/table/index.d.ts +2 -2
- package/es/components/table/index.js +1 -1
- package/es/components/table/src/table-pagination.template.d.ts +1 -1
- package/es/components/table/src/{cds-aichat-table.d.ts → table.d.ts} +12 -90
- package/es/components/table/src/{cds-aichat-table.js → table.js} +69 -37
- package/es/components/table/src/table.js.map +1 -0
- package/es/components/table/src/table.template.d.ts +2 -2
- package/es/components/table/src/table.template.js +2 -2
- package/es/components/table/src/table.template.js.map +1 -1
- package/es/components/toolbar/src/toolbar.d.ts +4 -5
- package/es/components/toolbar/src/toolbar.js +51 -40
- package/es/components/toolbar/src/toolbar.js.map +1 -1
- package/es/components/toolbar/src/toolbar.scss.js +1 -1
- package/es/components/workspace-shell/index.d.ts +0 -1
- package/es/components/workspace-shell/index.js +0 -1
- package/es/components/workspace-shell/index.js.map +1 -1
- package/es/components/workspace-shell/src/workspace-shell-body.d.ts +1 -0
- package/es/components/workspace-shell/src/workspace-shell-body.js +3 -4
- package/es/components/workspace-shell/src/workspace-shell-body.js.map +1 -1
- package/es/components/workspace-shell/src/workspace-shell-footer.d.ts +26 -5
- package/es/components/workspace-shell/src/workspace-shell-footer.js +101 -11
- package/es/components/workspace-shell/src/workspace-shell-footer.js.map +1 -1
- package/es/components/workspace-shell/src/workspace-shell-footer.scss.js +13 -0
- package/es/components/workspace-shell/src/workspace-shell-footer.scss.js.map +1 -0
- package/es/components/workspace-shell/src/workspace-shell-header.d.ts +1 -0
- package/es/components/workspace-shell/src/workspace-shell-header.js +4 -4
- package/es/components/workspace-shell/src/workspace-shell-header.js.map +1 -1
- package/es/components/workspace-shell/src/workspace-shell-header.scss.js +13 -0
- package/es/components/workspace-shell/src/workspace-shell-header.scss.js.map +1 -0
- package/es/components/workspace-shell/src/workspace-shell.d.ts +1 -2
- package/es/components/workspace-shell/src/workspace-shell.js +3 -30
- package/es/components/workspace-shell/src/workspace-shell.js.map +1 -1
- package/es/components/workspace-shell/src/workspace-shell.scss.js +1 -1
- package/es/react/card.d.ts +9 -0
- package/es/react/card.js +43 -0
- package/es/react/card.js.map +1 -0
- package/es/react/chain-of-thought-step.d.ts +4 -0
- package/es/react/chain-of-thought-step.js +32 -0
- package/es/react/chain-of-thought-step.js.map +1 -0
- package/es/react/chain-of-thought-toggle.d.ts +6 -0
- package/es/react/chain-of-thought-toggle.js +31 -0
- package/es/react/chain-of-thought-toggle.js.map +1 -0
- package/es/react/chain-of-thought.d.ts +4 -4
- package/es/react/chain-of-thought.js +7 -3
- package/es/react/chain-of-thought.js.map +1 -1
- package/es/react/code-snippet-card.d.ts +4 -0
- package/es/react/{code-snippet-tile-container.js → code-snippet-card.js} +8 -7
- package/es/react/code-snippet-card.js.map +1 -0
- package/es/react/feedback-buttons.d.ts +2 -2
- package/es/react/feedback-buttons.js +2 -2
- package/es/react/feedback-buttons.js.map +1 -1
- package/es/react/feedback.d.ts +2 -2
- package/es/react/feedback.js +2 -2
- package/es/react/feedback.js.map +1 -1
- package/es/react/inline-notification.d.ts +4 -0
- package/es/react/inline-notification.js +28 -0
- package/es/react/inline-notification.js.map +1 -0
- package/es/react/markdown.d.ts +1 -1
- package/es/react/markdown.js +1 -1
- package/es/react/reasoning-step.d.ts +3 -5
- package/es/react/reasoning-step.js +6 -5
- package/es/react/reasoning-step.js.map +1 -1
- package/es/react/reasoning-steps-toggle.d.ts +6 -0
- package/es/react/reasoning-steps-toggle.js +31 -0
- package/es/react/reasoning-steps-toggle.js.map +1 -0
- package/es/react/reasoning-steps.d.ts +3 -2
- package/es/react/reasoning-steps.js +4 -3
- package/es/react/reasoning-steps.js.map +1 -1
- package/es/react/tag.d.ts +4 -0
- package/es/react/{tile-container.js → tag.js} +6 -6
- package/es/react/tag.js.map +1 -0
- package/es/react/tile.js +2 -2
- package/es/react/tile.js.map +1 -1
- package/es/react/tool-call-data.d.ts +4 -0
- package/es/react/tool-call-data.js +28 -0
- package/es/react/tool-call-data.js.map +1 -0
- package/es/react/workspace-shell.d.ts +11 -0
- package/es/react/workspace-shell.js +49 -0
- package/es/react/workspace-shell.js.map +1 -0
- package/package.json +3 -3
- package/dist/button-D0B6NYRE.js +0 -157
- package/dist/button-skeleton-DtWa12gC.js +0 -116
- package/dist/checkbox-skeleton-BRqpmcmn.js +0 -166
- package/dist/class-map-BFgXCWx_.js +0 -106
- package/dist/codemirror-runtime-DCCflgzA.js +0 -173
- package/dist/index-B6_FOiFX.js +0 -91
- package/dist/index-BBF0opyU.js +0 -91
- package/dist/index-BIpfdWsb.js +0 -91
- package/dist/index-BamxlG85.js +0 -91
- package/dist/index-BnJifpJy.js +0 -91
- package/dist/index-BychCoXU.js +0 -91
- package/dist/index-CBCqx8Ps.js +0 -91
- package/dist/index-CBqFie3c.js +0 -91
- package/dist/index-CDTaA9BR.js +0 -91
- package/dist/index-CQp4LKsc.js +0 -91
- package/dist/index-CmBp-bbC.js +0 -168
- package/dist/index-D0SnJ7Ma.js +0 -91
- package/dist/index-D4zxQxf2.js +0 -91
- package/dist/index-DMzbawFt.js +0 -91
- package/dist/index-DTqHKU78.js +0 -91
- package/dist/index-Dj8jVVfA.js +0 -91
- package/dist/index-DqC-5dY5.js +0 -91
- package/dist/index-LHYDalJY.js +0 -91
- package/dist/index-MyumuXWu.js +0 -91
- package/dist/index-hvhxkyxb.js +0 -91
- package/dist/index-tpV6AVN_.js +0 -91
- package/dist/index-zZ0xfJxK.js +0 -367
- package/dist/query-Sqf3k5tK.js +0 -101
- package/dist/radio-group-manager-BqksDnno.js +0 -91
- package/dist/repeat-Cu9vY9y8.js +0 -96
- package/dist/text-input-BlvU8QGo.js +0 -158
- package/dist/tile-container.min.js +0 -100
- package/es/components/chain-of-thought/src/cds-aichat-chain-of-thought.d.ts +0 -15
- package/es/components/chain-of-thought/src/cds-aichat-chain-of-thought.js +0 -36
- package/es/components/chain-of-thought/src/cds-aichat-chain-of-thought.js.map +0 -1
- package/es/components/chain-of-thought/src/chain-of-thought.template.d.ts +0 -5
- package/es/components/chain-of-thought/src/chain-of-thought.template.js +0 -206
- package/es/components/chain-of-thought/src/chain-of-thought.template.js.map +0 -1
- package/es/components/chain-of-thought/src/parse-unknown-data-to-markdown.d.ts +0 -10
- package/es/components/chain-of-thought/src/parse-unknown-data-to-markdown.js +0 -50
- package/es/components/chain-of-thought/src/parse-unknown-data-to-markdown.js.map +0 -1
- package/es/components/chain-of-thought/src/types.d.ts +0 -73
- package/es/components/chain-of-thought/src/types.js.map +0 -1
- package/es/components/code-snippet/src/code-snippet-tile-container.d.ts +0 -32
- package/es/components/code-snippet/src/code-snippet-tile-container.js +0 -143
- package/es/components/code-snippet/src/code-snippet-tile-container.js.map +0 -1
- package/es/components/feedback/src/cds-aichat-feedback-buttons.d.ts +0 -15
- package/es/components/feedback/src/cds-aichat-feedback-buttons.js +0 -36
- package/es/components/feedback/src/cds-aichat-feedback-buttons.js.map +0 -1
- package/es/components/feedback/src/cds-aichat-feedback.d.ts +0 -15
- package/es/components/feedback/src/cds-aichat-feedback.js +0 -36
- package/es/components/feedback/src/cds-aichat-feedback.js.map +0 -1
- package/es/components/markdown/src/cds-aichat-markdown.d.ts +0 -13
- package/es/components/markdown/src/cds-aichat-markdown.js +0 -35
- package/es/components/markdown/src/cds-aichat-markdown.js.map +0 -1
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.js.map +0 -1
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.scss.js.map +0 -1
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.js.map +0 -1
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.scss.js.map +0 -1
- package/es/components/table/src/cds-aichat-table.js.map +0 -1
- package/es/components/tile-container/index.d.ts +0 -1
- package/es/components/tile-container/src/styles.scss.js +0 -13
- package/es/components/tile-container/src/styles.scss.js.map +0 -1
- package/es/components/tile-container/src/tile-container.d.ts +0 -12
- package/es/components/tile-container/src/tile-container.js +0 -85
- package/es/components/tile-container/src/tile-container.js.map +0 -1
- package/es/components/tile-container/src/tile-container.scss.js.map +0 -1
- package/es/components/workspace-shell/src/styles.scss.js +0 -13
- package/es/components/workspace-shell/src/styles.scss.js.map +0 -1
- package/es/components/workspace-shell/src/workspace-shell-toolbar.d.ts +0 -22
- package/es/components/workspace-shell/src/workspace-shell-toolbar.js +0 -61
- package/es/components/workspace-shell/src/workspace-shell-toolbar.js.map +0 -1
- package/es/react/code-snippet-tile-container.d.ts +0 -5
- package/es/react/code-snippet-tile-container.js.map +0 -1
- package/es/react/tile-container.d.ts +0 -4
- package/es/react/tile-container.js.map +0 -1
- package/dist/{16-Qupth_aH.js → 16-D66oSSKJ.js} +20 -20
- package/dist/{apl-BgtIAmDL.js → apl-Cq2qnGBp.js} +20 -20
- package/dist/{asciiarmor-tEIRKlaD.js → asciiarmor-Cb5hNJXm.js} +20 -20
- package/dist/{asn1-sXfvlwbA.js → asn1-ObfPhj90.js} +20 -20
- package/dist/{asterisk-CkP9KBn_.js → asterisk-CGEdhmtE.js} +20 -20
- package/dist/{carbon-element-CMnOQRY8.js → carbon-element-BHXvTuS8.js} +20 -20
- package/dist/{carbon-element-B18tSkZ6.js → carbon-element-CY_4MezR.js} +20 -20
- package/dist/{clike-Dz7-b3Bs.js → clike-D-W_e6Lj.js} +20 -20
- package/dist/{clojure-Cv2VjSR-.js → clojure-BKr3NaqS.js} +20 -20
- package/dist/{cmake-B7mApY_A.js → cmake-CCO4hHlz.js} +20 -20
- package/dist/{cobol-CLpo2wzU.js → cobol-BP7APbz-.js} +20 -20
- package/dist/{coffeescript-Cp4m_frl.js → coffeescript-DAdmYC08.js} +20 -20
- package/dist/{collection-helpers-CVjseChk.js → collection-helpers-CeBujCju.js} +20 -20
- package/dist/{commonlisp-DGHzJz_w.js → commonlisp-Bo8JYmEV.js} +20 -20
- package/dist/{crystal-D8zlcNoF.js → crystal-Bm8pGIh6.js} +20 -20
- package/dist/{css-gJR1aLn3.js → css-BJk1lVKu.js} +20 -20
- package/dist/{custom-element-Clzn_oL-.js → custom-element-DRG4IpGT.js} +20 -20
- package/dist/{cypher-CM68cGds.js → cypher-D-eVDQC7.js} +20 -20
- package/dist/{d-DS7hYUri.js → d-D9LdG4k3.js} +20 -20
- package/dist/{diff-BchMez5u.js → diff-DZtMXlRt.js} +20 -20
- package/dist/{dtd-B4jYcQ7M.js → dtd-BkbtUIcB.js} +20 -20
- package/dist/{dylan-DK2Dyib7.js → dylan-CCohaM4H.js} +20 -20
- package/dist/{ebnf-Cn6Vnzxw.js → ebnf-DtT6UrMv.js} +20 -20
- package/dist/{ecl-9PhKPFNU.js → ecl-C2GNxTt8.js} +20 -20
- package/dist/{eiffel-CqAx-iZ-.js → eiffel-BW4n6uyg.js} +20 -20
- package/dist/{elm-Cw3MFe2J.js → elm-B9lXrM6D.js} +20 -20
- package/dist/{erlang-DeNh2sjw.js → erlang-BKwBedv4.js} +20 -20
- package/dist/{fcl-Dku8gwKl.js → fcl-BGYmKRZe.js} +20 -20
- package/dist/{forth-ccFEopc8.js → forth-DTbOVELu.js} +20 -20
- package/dist/{fortran-C0Pd1bYf.js → fortran-Dr7q8x3V.js} +20 -20
- package/dist/{gas-C9KeMzH-.js → gas-CsCwQ5DC.js} +20 -20
- package/dist/{gherkin-CTd3ycq1.js → gherkin-CAJyZEc1.js} +20 -20
- package/dist/{groovy-C2OuB7B3.js → groovy-CpFdbfFQ.js} +20 -20
- package/dist/{haskell-CGuEw9Yh.js → haskell-V36thOn1.js} +20 -20
- package/dist/{haxe-Bpicn7Ma.js → haxe-CeQWqhmF.js} +20 -20
- package/dist/{http-C2Dl8BK6.js → http-Cm3L1exf.js} +20 -20
- package/dist/{idl-D0DUTXQY.js → idl-DyN-eyoA.js} +20 -20
- package/dist/{javascript-vBL1foWi.js → javascript-B7L-ezNz.js} +20 -20
- package/dist/{julia-YTKmImms.js → julia-B_bgxt8f.js} +20 -20
- package/dist/{livescript-BqlKQjy2.js → livescript-B0UjDUzz.js} +20 -20
- package/dist/{lua-DlwCIvBO.js → lua-Bs-1T_TR.js} +20 -20
- package/dist/{mathematica-Dv2FPQ3c.js → mathematica-QbiSkUw_.js} +20 -20
- package/dist/{mbox-BRYTWZIN.js → mbox-IxVDt6G7.js} +20 -20
- package/dist/{mirc-Bfe4ByuU.js → mirc--MFZdywV.js} +20 -20
- package/dist/{mllike-jcboaTW3.js → mllike-s7nUnXIp.js} +20 -20
- package/dist/{modelica-DyjAoT58.js → modelica-BCpZ0s1C.js} +20 -20
- package/dist/{mscgen-cDZZxW92.js → mscgen-Br8J94Pi.js} +20 -20
- package/dist/{mumps-BHJOz0VL.js → mumps-BsSCi6Lf.js} +20 -20
- package/dist/{nginx-C7Xm6ldH.js → nginx-ZiZlz_Vj.js} +20 -20
- package/dist/{ntriples-WgSzAP5x.js → ntriples-1fM-fgdb.js} +20 -20
- package/dist/{octave-D4LNKBtY.js → octave-nXauetiK.js} +20 -20
- package/dist/{oz-BoqKtF9D.js → oz-B13mLmyp.js} +20 -20
- package/dist/{pascal-Di4a6U4m.js → pascal-B_W4OXqj.js} +20 -20
- package/dist/{perl-DidNKejT.js → perl-a1VQ4XvC.js} +20 -20
- package/dist/{pig-BNb2vBfH.js → pig-BtQy1wID.js} +20 -20
- package/dist/{powershell-BKZXxjKi.js → powershell-uO49D63Q.js} +20 -20
- package/dist/{properties-DGvo0ocD.js → properties-BhuX6-mY.js} +20 -20
- package/dist/{protobuf-CO4RB5i_.js → protobuf-CNIIc7zI.js} +20 -20
- package/dist/{puppet-BuoIdj3c.js → puppet-ByObhsu2.js} +20 -20
- package/dist/{python-D0eLBtFd.js → python-PHhd4JZq.js} +20 -20
- package/dist/{q-C5wfDOE6.js → q-qVcarjaG.js} +20 -20
- package/dist/{r-B2NBzJ7Q.js → r-Cd28Rn61.js} +20 -20
- package/dist/{rpm-bppY7Ljs.js → rpm-tHd62SNx.js} +20 -20
- package/dist/{ruby-1BC0cOBU.js → ruby-BWVi67xq.js} +20 -20
- package/dist/{sas-BeMF8yJO.js → sas-BwjQFPr2.js} +20 -20
- package/dist/{scheme-CIQ0ih8s.js → scheme-Czr-sVIy.js} +20 -20
- package/dist/{settings-DtiFDQAJ.js → settings-C6RJ_X7P.js} +20 -20
- package/dist/{shell-Aikfsln6.js → shell-BetDWStl.js} +20 -20
- package/dist/{sieve-AcrCVYff.js → sieve-rrPKwsBh.js} +20 -20
- package/dist/{simple-mode-pAhBuoYJ.js → simple-mode-C8-rTa2M.js} +20 -20
- package/dist/{smalltalk-B2nQQuEp.js → smalltalk-YAI5xh7_.js} +20 -20
- package/dist/{solr-dRPr0Biz.js → solr-VDOKdk1b.js} +20 -20
- package/dist/{sparql-Cj99XEDx.js → sparql-zO1kYCog.js} +20 -20
- package/dist/{spreadsheet-sgTJtcQB.js → spreadsheet-6g8nHE2j.js} +20 -20
- package/dist/{sql-C8kOX3sr.js → sql-Biw9poPQ.js} +20 -20
- package/dist/{stex-7QvUJU5I.js → stex-THaXVwNW.js} +20 -20
- package/dist/{stylus-DkIl6udx.js → stylus-RHXL_HsJ.js} +20 -20
- package/dist/{swift-BjpHlYuP.js → swift-lfFyPRRo.js} +20 -20
- package/dist/{sync-CTB9Fa1m.js → sync-D5E2V6_l.js} +20 -20
- package/dist/{tcl-C1Yvc7pn.js → tcl-C4Tb2U0q.js} +20 -20
- package/dist/{textile-DKmSRPjM.js → textile-CnQDonvJ.js} +20 -20
- package/dist/{throttle-Bas3c59v.js → throttle-B7gS0Tg4.js} +20 -20
- package/dist/{tiddlywiki-DN1bYf4c.js → tiddlywiki-BPc4WZCH.js} +20 -20
- package/dist/{tiki-F3wxU3m-.js → tiki-D4dz8j1V.js} +20 -20
- package/dist/{toml-KiNov0Ms.js → toml-88vYtIh1.js} +20 -20
- package/dist/{troff-BZvX0oqw.js → troff-BgVjEoT-.js} +20 -20
- package/dist/{ttcn-BiJT56Tu.js → ttcn-DdYulzch.js} +20 -20
- package/dist/{ttcn-cfg-3VvAFBAY.js → ttcn-cfg-LwcHiYmJ.js} +20 -20
- package/dist/{turtle-BvExPgO5.js → turtle-CgiVr9yq.js} +20 -20
- package/dist/{vb-D2uTYiVC.js → vb-BWY0HckZ.js} +20 -20
- package/dist/{vbscript-DpTTELsB.js → vbscript-BBJV-ooB.js} +20 -20
- package/dist/{velocity-jIy5jhYQ.js → velocity-wom_bhlv.js} +20 -20
- package/dist/{verilog-CXOzQ6Od.js → verilog-BCY2xdlY.js} +20 -20
- package/dist/{vhdl-Dg-0Ynfd.js → vhdl-BjJYRa0a.js} +20 -20
- package/dist/{webidl-Elhmuz8r.js → webidl-KE8LT1tN.js} +20 -20
- package/dist/{xquery-EKuNgB1T.js → xquery-Ca5C9BJw.js} +20 -20
- package/dist/{yacas-CirFB63Y.js → yacas-DGeGvU7X.js} +20 -20
- package/dist/{z80-D_iQ-043.js → z80-CEYQTt8_.js} +20 -20
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright IBM Corp. 2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @license
|
|
11
|
+
*
|
|
12
|
+
* This bundle contains the following third-party dependencies:
|
|
13
|
+
*
|
|
14
|
+
* Also refer to the following links for the license of other third-party dependencies:
|
|
15
|
+
*
|
|
16
|
+
* https://www.npmjs.com/package/tslib
|
|
17
|
+
* https://www.npmjs.com/package/lit
|
|
18
|
+
* https://www.npmjs.com/package/markdown-it
|
|
19
|
+
* https://www.npmjs.com/package/lodash-es
|
|
20
|
+
* https://www.npmjs.com/package/dompurify
|
|
21
|
+
* https://www.npmjs.com/package/@codemirror/state
|
|
22
|
+
* https://www.npmjs.com/package/csv-stringify
|
|
23
|
+
* https://www.npmjs.com/package/lit-html
|
|
24
|
+
* https://www.npmjs.com/package/@carbon/web-components
|
|
25
|
+
* https://www.npmjs.com/package/codemirror
|
|
26
|
+
* https://www.npmjs.com/package/@codemirror/language
|
|
27
|
+
* https://www.npmjs.com/package/@codemirror/commands
|
|
28
|
+
* https://www.npmjs.com/package/@codemirror/view
|
|
29
|
+
* https://www.npmjs.com/package/@codemirror/autocomplete
|
|
30
|
+
* https://www.npmjs.com/package/@codemirror/lint
|
|
31
|
+
* https://www.npmjs.com/package/@lezer/highlight
|
|
32
|
+
* https://www.npmjs.com/package/@codemirror/lang-sql
|
|
33
|
+
* https://www.npmjs.com/package/@codemirror/lang-go
|
|
34
|
+
* https://www.npmjs.com/package/@codemirror/lang-cpp
|
|
35
|
+
* https://www.npmjs.com/package/@codemirror/lang-css
|
|
36
|
+
* https://www.npmjs.com/package/@codemirror/lang-html
|
|
37
|
+
* https://www.npmjs.com/package/@codemirror/lang-java
|
|
38
|
+
* https://www.npmjs.com/package/@codemirror/lang-javascript
|
|
39
|
+
* https://www.npmjs.com/package/@codemirror/lang-jinja
|
|
40
|
+
* https://www.npmjs.com/package/@codemirror/lang-json
|
|
41
|
+
* https://www.npmjs.com/package/@codemirror/lang-less
|
|
42
|
+
* https://www.npmjs.com/package/@codemirror/lang-liquid
|
|
43
|
+
* https://www.npmjs.com/package/@codemirror/lang-php
|
|
44
|
+
* https://www.npmjs.com/package/@codemirror/lang-markdown
|
|
45
|
+
* https://www.npmjs.com/package/@codemirror/lang-wast
|
|
46
|
+
* https://www.npmjs.com/package/@codemirror/lang-rust
|
|
47
|
+
* https://www.npmjs.com/package/@codemirror/lang-yaml
|
|
48
|
+
* https://www.npmjs.com/package/@codemirror/lang-python
|
|
49
|
+
* https://www.npmjs.com/package/@codemirror/lang-sass
|
|
50
|
+
* https://www.npmjs.com/package/@codemirror/legacy-modes
|
|
51
|
+
* https://www.npmjs.com/package/@codemirror/lang-vue
|
|
52
|
+
* https://www.npmjs.com/package/@codemirror/lang-angular
|
|
53
|
+
* https://www.npmjs.com/package/@codemirror/lang-xml
|
|
54
|
+
* https://www.npmjs.com/package/@carbon/icons
|
|
55
|
+
* https://www.npmjs.com/package/@carbon/utilities
|
|
56
|
+
* https://www.npmjs.com/package/@carbon/icon-helpers
|
|
57
|
+
* https://www.npmjs.com/package/program-language-detector
|
|
58
|
+
* https://www.npmjs.com/package/lit-element
|
|
59
|
+
* https://www.npmjs.com/package/@lit/reactive-element
|
|
60
|
+
* https://www.npmjs.com/package/@marijn/find-cluster-break
|
|
61
|
+
* https://www.npmjs.com/package/@codemirror/search
|
|
62
|
+
* https://www.npmjs.com/package/crelt
|
|
63
|
+
* https://www.npmjs.com/package/w3c-keyname
|
|
64
|
+
* https://www.npmjs.com/package/style-mod
|
|
65
|
+
* https://www.npmjs.com/package/@lezer/common
|
|
66
|
+
* https://www.npmjs.com/package/@lezer/go
|
|
67
|
+
* https://www.npmjs.com/package/@lezer/lr
|
|
68
|
+
* https://www.npmjs.com/package/@lezer/cpp
|
|
69
|
+
* https://www.npmjs.com/package/@lezer/java
|
|
70
|
+
* https://www.npmjs.com/package/@lezer/css
|
|
71
|
+
* https://www.npmjs.com/package/@lezer/html
|
|
72
|
+
* https://www.npmjs.com/package/@lezer/javascript
|
|
73
|
+
* https://www.npmjs.com/package/@lezer/php
|
|
74
|
+
* https://www.npmjs.com/package/@lezer/json
|
|
75
|
+
* https://www.npmjs.com/package/@lezer/yaml
|
|
76
|
+
* https://www.npmjs.com/package/@lezer/rust
|
|
77
|
+
* https://www.npmjs.com/package/@lezer/python
|
|
78
|
+
* https://www.npmjs.com/package/@lezer/sass
|
|
79
|
+
* https://www.npmjs.com/package/@lezer/markdown
|
|
80
|
+
* https://www.npmjs.com/package/@lezer/xml
|
|
81
|
+
* https://www.npmjs.com/package/@internationalized/number
|
|
82
|
+
* https://www.npmjs.com/package/mdurl
|
|
83
|
+
* https://www.npmjs.com/package/linkify-it
|
|
84
|
+
* https://www.npmjs.com/package/punycode.js
|
|
85
|
+
* https://www.npmjs.com/package/uc.micro
|
|
86
|
+
* https://www.npmjs.com/package/@floating-ui/dom
|
|
87
|
+
* https://www.npmjs.com/package/@floating-ui/core
|
|
88
|
+
* https://www.npmjs.com/package/@floating-ui/utils
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
import{a as t,S as e,F as i,T as n,A as o,E as s,P as r,b as l,C as a,R as h,f as c,d,e as f,g as u,M as p,h as m,i as g,j as w,k as v,l as b,c as y,m as x,n as k}from"./index-B9DVtGsv.js";import{t as S}from"./throttle-B7gS0Tg4.js";import{_ as C}from"./16-DTIyOew7.js";const A=1024;let M=0;class D{constructor(t,e){this.from=t,this.to=e}}class T{constructor(t={}){this.id=M++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=B.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}T.closedBy=new T({deserialize:t=>t.split(" ")}),T.openedBy=new T({deserialize:t=>t.split(" ")}),T.group=new T({deserialize:t=>t.split(" ")}),T.isolate=new T({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),T.contextHash=new T({perNode:!0}),T.lookAhead=new T({perNode:!0}),T.mounted=new T({perNode:!0});class O{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}static get(t){return t&&t.props&&t.props[T.mounted.id]}}const L=Object.create(null);class B{constructor(t,e,i,n=0){this.name=t,this.props=e,this.id=i,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):L,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new B(t.name||"",e,t.id,i);if(t.props)for(let i of t.props)if(Array.isArray(i)||(i=i(n)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[i[0].id]=i[1]}return n}prop(t){return this.props[t.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(t){if("string"==typeof t){if(this.name==t)return!0;let e=this.prop(T.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let n of i.split(" "))e[n]=t[i];return t=>{for(let i=t.prop(T.group),n=-1;n<(i?i.length:0);n++){let o=e[n<0?t.name:i[n]];if(o)return o}}}}B.none=new B("",Object.create(null),0,8);class E{constructor(t){this.types=t;for(let e=0;e<t.length;e++)if(t[e].id!=e)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let e=[];for(let i of this.types){let n=null;for(let e of t){let t=e(i);if(t){n||(n=Object.assign({},i.props));let e=t[1],o=t[0];o.combine&&o.id in n&&(e=o.combine(n[o.id],e)),n[o.id]=e}}e.push(n?new B(i.name,n,i.id,i.flags):i)}return new E(e)}}const P=new WeakMap,R=new WeakMap;var N;!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(N||(N={}));class j{constructor(t,e,i,n,o){if(this.type=t,this.children=e,this.positions=i,this.length=n,this.props=null,o&&o.length){this.props=Object.create(null);for(let[t,e]of o)this.props["number"==typeof t?t:t.id]=e}}toString(){let t=O.get(this);if(t&&!t.overlay)return t.tree.toString();let e="";for(let t of this.children){let i=t.toString();i&&(e&&(e+=","),e+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e}cursor(t=0){return new Y(this.topNode,t)}cursorAt(t,e=0,i=0){let n=P.get(this)||this.topNode,o=new Y(n);return o.moveTo(t,e),P.set(this,o._tree),o}get topNode(){return new W(this,0,0,null)}resolve(t,e=0){let i=F(P.get(this)||this.topNode,t,e,!1);return P.set(this,i),i}resolveInner(t,e=0){let i=F(R.get(this)||this.topNode,t,e,!0);return R.set(this,i),i}resolveStack(t,e=0){return function(t,e,i){let n=t.resolveInner(e,i),o=null;for(let t=n instanceof W?n:n.context.parent;t;t=t.parent)if(t.index<0){let s=t.parent;(o||(o=[n])).push(s.resolve(e,i)),t=s}else{let s=O.get(t.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let r=new W(s.tree,s.overlay[0].from+t.from,-1,t);(o||(o=[n])).push(F(r,e,i,!1))}}return o?U(o):n}(this,t,e)}iterate(t){let{enter:e,leave:i,from:n=0,to:o=this.length}=t,s=t.mode||0,r=(s&N.IncludeAnonymous)>0;for(let t=this.cursor(s|N.IncludeAnonymous);;){let s=!1;if(t.from<=o&&t.to>=n&&(!r&&t.type.isAnonymous||!1!==e(t))){if(t.firstChild())continue;s=!0}for(;s&&i&&(r||!t.type.isAnonymous)&&i(t),!t.nextSibling();){if(!t.parent())return;s=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Z(B.none,this.children,this.positions,0,this.children.length,0,this.length,(t,e,i)=>new j(this.type,t,e,i,this.propValues),t.makeTree||((t,e,i)=>new j(B.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:o=A,reused:s=[],minRepeatType:r=n.types.length}=t,l=Array.isArray(i)?new H(i,i.length):i,a=n.types,h=0,c=0;function d(t,e,i,v,b,y){let{id:x,start:k,end:S,size:C}=l,A=c,M=h;if(C<0){if(l.next(),-1==C){let e=s[x];return i.push(e),void v.push(k-t)}if(-3==C)return void(h=x);if(-4==C)return void(c=x);throw new RangeError(`Unrecognized record size: ${C}`)}let D,T,O=a[x],L=k-t;if(S-k<=o&&(T=g(l.pos-e,b))){let e=new Uint16Array(T.size-T.skip),i=l.pos-T.size,o=e.length;for(;l.pos>i;)o=w(T.start,e,o);D=new I(e,S-T.start,n),L=T.start-t}else{let t=l.pos-C;l.next();let e=[],i=[],n=x>=r?x:-1,s=0,a=S;for(;l.pos>t;)n>=0&&l.id==n&&l.size>=0?(l.end<=a-o&&(p(e,i,k,s,l.end,a,n,A,M),s=e.length,a=l.end),l.next()):y>2500?f(k,t,e,i):d(k,t,e,i,n,y+1);if(n>=0&&s>0&&s<e.length&&p(e,i,k,s,k,a,n,A,M),e.reverse(),i.reverse(),n>-1&&s>0){let t=u(O,M);D=Z(O,e,i,0,e.length,0,S-k,t,t)}else D=m(O,e,i,S-k,A-S,M)}i.push(D),v.push(L)}function f(t,e,i,s){let r=[],a=0,h=-1;for(;l.pos>e;){let{id:t,start:e,end:i,size:n}=l;if(n>4)l.next();else{if(h>-1&&e<h)break;h<0&&(h=i-o),r.push(t,e,i),a++,l.next()}}if(a){let e=new Uint16Array(4*a),o=r[r.length-2];for(let t=r.length-3,i=0;t>=0;t-=3)e[i++]=r[t],e[i++]=r[t+1]-o,e[i++]=r[t+2]-o,e[i++]=i;i.push(new I(e,r[2]-o,n)),s.push(o-t)}}function u(t,e){return(i,n,o)=>{let s,r,l=0,a=i.length-1;if(a>=0&&(s=i[a])instanceof j){if(!a&&s.type==t&&s.length==o)return s;(r=s.prop(T.lookAhead))&&(l=n[a]+s.length+r)}return m(t,i,n,o,l,e)}}function p(t,e,i,o,s,r,l,a,h){let c=[],d=[];for(;t.length>o;)c.push(t.pop()),d.push(e.pop()+i-s);t.push(m(n.types[l],c,d,r-s,a-r,h)),e.push(s-i)}function m(t,e,i,n,o,s,r){if(s){let t=[T.contextHash,s];r=r?[t].concat(r):[t]}if(o>25){let t=[T.lookAhead,o];r=r?[t].concat(r):[t]}return new j(t,e,i,n,r)}function g(t,e){let i=l.fork(),n=0,s=0,a=0,h=i.end-o,c={size:0,start:0,skip:0};t:for(let o=i.pos-t;i.pos>o;){let t=i.size;if(i.id==e&&t>=0){c.size=n,c.start=s,c.skip=a,a+=4,n+=4,i.next();continue}let l=i.pos-t;if(t<0||l<o||i.start<h)break;let d=i.id>=r?4:0,f=i.start;for(i.next();i.pos>l;){if(i.size<0){if(-3!=i.size&&-4!=i.size)break t;d+=4}else i.id>=r&&(d+=4);i.next()}s=f,n+=t,a+=d}return(e<0||n==t)&&(c.size=n,c.start=s,c.skip=a),c.size>4?c:void 0}function w(t,e,i){let{id:n,start:o,end:s,size:a}=l;if(l.next(),a>=0&&n<r){let r=i;if(a>4){let n=l.pos-(a-4);for(;l.pos>n;)i=w(t,e,i)}e[--i]=r,e[--i]=s-t,e[--i]=o-t,e[--i]=n}else-3==a?h=n:-4==a&&(c=n);return i}let v=[],b=[];for(;l.pos>0;)d(t.start||0,t.bufferStart||0,v,b,-1,0);let y=null!==(e=t.length)&&void 0!==e?e:v.length?b[0]+v[0].length:0;return new j(a[t.topID],v.reverse(),b.reverse(),y)}(t)}}j.empty=new j(B.none,[],[],0);class H{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new H(this.buffer,this.index)}}class I{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return B.none}toString(){let t=[];for(let e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}childString(t){let e=this.buffer[t],i=this.buffer[t+3],n=this.set.types[e],o=n.name;if(/\W/.test(o)&&!n.isError&&(o=JSON.stringify(o)),i==(t+=4))return o;let s=[];for(;t<i;)s.push(this.childString(t)),t=this.buffer[t+3];return o+"("+s.join(",")+")"}findChild(t,e,i,n,o){let{buffer:s}=this,r=-1;for(let l=t;l!=e&&!(V(o,n,s[l+1],s[l+2])&&(r=l,i>0));l=s[l+3]);return r}slice(t,e,i){let n=this.buffer,o=new Uint16Array(e-t),s=0;for(let r=t,l=0;r<e;){o[l++]=n[r++],o[l++]=n[r++]-i;let e=o[l++]=n[r++]-i;o[l++]=n[r++]-t,s=Math.max(s,e)}return new I(o,s,this.set)}}function V(t,e,i,n){switch(t){case-2:return i<e;case-1:return n>=e&&i<e;case 0:return i<e&&n>e;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function F(t,e,i,n){for(var o;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to<e);){let e=!n&&t instanceof W&&t.index<0?null:t.parent;if(!e)return t;t=e}let s=n?0:N.IgnoreOverlays;if(n)for(let n=t,r=n.parent;r;n=r,r=n.parent)n instanceof W&&n.index<0&&(null===(o=r.enter(e,i,s))||void 0===o?void 0:o.from)!=n.from&&(t=r);for(;;){let n=t.enter(e,i,s);if(!n)return t;t=n}}class z{cursor(t=0){return new Y(this,t)}getChild(t,e=null,i=null){let n=q(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return q(this,t,e,i)}resolve(t,e=0){return F(this,t,e,!1)}resolveInner(t,e=0){return F(this,t,e,!0)}matchContext(t){return _(this.parent,t)}enterUnfinishedNodesBefore(t){let e=this.childBefore(t),i=this;for(;e;){let t=e.lastChild;if(!t||t.to!=e.to)break;t.type.isError&&t.from==t.to?(i=e,e=t.prevSibling):e=t}return i}get node(){return this}get next(){return this.parent}}class W extends z{constructor(t,e,i,n){super(),this._tree=t,this.from=e,this.index=i,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,e,i,n,o=0){for(let s=this;;){for(let{children:r,positions:l}=s._tree,a=e>0?r.length:-1;t!=a;t+=e){let a=r[t],h=l[t]+s.from;if(V(n,i,h,h+a.length))if(a instanceof I){if(o&N.ExcludeBuffers)continue;let r=a.findChild(0,a.buffer.length,e,i-h,n);if(r>-1)return new $(new K(s,a,t,h),null,r)}else if(o&N.IncludeAnonymous||!a.type.isAnonymous||X(a)){let r;if(!(o&N.IgnoreMounts)&&(r=O.get(a))&&!r.overlay)return new W(r.tree,h,t,s);let l=new W(a,h,t,s);return o&N.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(e<0?a.children.length-1:0,e,i,n)}}if(o&N.IncludeAnonymous||!s.type.isAnonymous)return null;if(t=s.index>=0?s.index+e:e<0?-1:s._parent._tree.children.length,s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,e,i=0){let n;if(!(i&N.IgnoreOverlays)&&(n=O.get(this._tree))&&n.overlay){let i=t-this.from;for(let{from:t,to:o}of n.overlay)if((e>0?t<=i:t<i)&&(e<0?o>=i:o>i))return new W(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function q(t,e,i,n){let o=t.cursor(),s=[];if(!o.firstChild())return s;if(null!=i)for(let t=!1;!t;)if(t=o.type.is(i),!o.nextSibling())return s;for(;;){if(null!=n&&o.type.is(n))return s;if(o.type.is(e)&&s.push(o.node),!o.nextSibling())return null==n?s:[]}}function _(t,e,i=e.length-1){for(let n=t;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[i]&&e[i]!=n.name)return!1;i--}}return!0}class K{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class $ extends z{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,i){super(),this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,e,i){let{buffer:n}=this.context,o=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,i);return o<0?null:new $(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,e,i=0){if(i&N.ExcludeBuffers)return null;let{buffer:n}=this.context,o=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return o<0?null:new $(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new $(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new $(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,n=this.index+4,o=i.buffer[this.index+3];if(o>n){let s=i.buffer[this.index+1];t.push(i.slice(n,o,s)),e.push(0)}return new j(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function U(t){if(!t.length)return null;let e=0,i=t[0];for(let n=1;n<t.length;n++){let o=t[n];(o.from>i.from||o.to<i.to)&&(i=o,e=n)}let n=i instanceof W&&i.index<0?null:i.parent,o=t.slice();return n?o[e]=n:o.splice(e,1),new G(o,i)}class G{constructor(t,e){this.heads=t,this.node=e}get next(){return U(this.heads)}}class Y{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof W)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof W?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,o=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(o<0)&&(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&N.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&N.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&N.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){if(this.index<n.buffer.buffer.length)return!1}else for(let t=0;t<this.index;t++)if(n.buffer.buffer[t+3]<this.index)return!1;({index:e,parent:i}=n)}else({index:e,_parent:i}=this._tree);for(;i;({index:e,_parent:i}=i))if(e>-1)for(let n=e+t,o=t<0?-1:i._tree.children.length;n!=o;n+=t){let t=i._tree.children[n];if(this.mode&N.IncludeAnonymous||t instanceof I||!t.type.isAnonymous||X(t))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,e=null,i=0;if(t&&t.context==this.buffer)t:for(let n=this.index,o=this.stack.length;o>=0;){for(let s=t;s;s=s._parent)if(s.index==n){if(n==this.index)return s;e=s,i=o+1;break t}n=this.stack[--o]}for(let t=i;t<this.stack.length;t++)e=new $(this.buffer,e,this.stack[t]);return this.bufferNode=new $(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,e){for(let i=0;;){let n=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){i++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&e&&e(this),n=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,n=!0}}}matchContext(t){if(!this.buffer)return _(this.node.parent,t);let{buffer:e}=this.buffer,{types:i}=e.set;for(let n=t.length-1,o=this.stack.length-1;n>=0;o--){if(o<0)return _(this._tree,t,n);let s=i[e.buffer[this.stack[o]]];if(!s.isAnonymous){if(t[n]&&t[n]!=s.name)return!1;n--}}return!0}}function X(t){return t.children.some(t=>t instanceof I||!t.type.isAnonymous||X(t))}const Q=new WeakMap;function J(t,e){if(!t.isAnonymous||e instanceof I||e.type!=t)return 1;let i=Q.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof j)){i=1;break}i+=J(t,n)}Q.set(e,i)}return i}function Z(t,e,i,n,o,s,r,l,a){let h=0;for(let i=n;i<o;i++)h+=J(t,e[i]);let c=Math.ceil(1.5*h/8),d=[],f=[];return function e(i,n,o,r,l){for(let h=o;h<r;){let o=h,u=n[h],p=J(t,i[h]);for(h++;h<r;h++){let e=J(t,i[h]);if(p+e>=c)break;p+=e}if(h==o+1){if(p>c){let t=i[o];e(t.children,t.positions,0,t.children.length,n[o]+l);continue}d.push(i[o])}else{let e=n[h-1]+i[h-1].length-u;d.push(Z(t,i,n,o,h,u,e,null,a))}f.push(u+l-s)}}(e,i,n,o,0),(l||a)(d,f,r)}class tt{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof $?this.setBuffer(t.context.buffer,t.index,e):t instanceof W&&this.map.set(t.tree,e)}get(t){return t instanceof $?this.getBuffer(t.context.buffer,t.index):t instanceof W?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class et{constructor(t,e,i,n,o=!1,s=!1){this.from=t,this.to=e,this.tree=i,this.offset=n,this.open=(o?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(t,e=[],i=!1){let n=[new et(0,t.length,t,0,!1,i)];for(let i of e)i.to>t.length&&n.push(i);return n}static applyChanges(t,e,i=128){if(!e.length)return t;let n=[],o=1,s=t.length?t[0]:null;for(let r=0,l=0,a=0;;r++){let h=r<e.length?e[r]:null,c=h?h.fromA:1e9;if(c-l>=i)for(;s&&s.from<c;){let e=s;if(l>=e.from||c<=e.to||a){let t=Math.max(e.from,l)-a,i=Math.min(e.to,c)-a;e=t>=i?null:new et(t,i,e.tree,e.offset+a,r>0,!!h)}if(e&&n.push(e),s.to>c)break;s=o<t.length?t[o++]:null}if(!h)break;l=h.toA,a=h.toA-h.toB}return n}}class it{startParse(t,e,i){return"string"==typeof t&&(t=new nt(t)),i=i?i.length?i.map(t=>new D(t.from,t.to)):[new D(0,0)]:[new D(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let n=this.startParse(t,e,i);for(;;){let t=n.advance();if(t)return t}}}class nt{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}function ot(t){return(e,i,n,o)=>new ht(e,t,i,n,o)}class st{constructor(t,e,i,n,o){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.from=o}}function rt(t){if(!t.length||t.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class lt{constructor(t,e,i,n,o,s,r){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=o,this.target=s,this.prev=r,this.depth=0,this.ranges=[]}}const at=new T({perNode:!0});class ht{constructor(t,e,i,n,o){this.nest=e,this.input=i,this.fragments=n,this.ranges=o,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new j(t.type,t.children,t.positions,t.length,t.propValues.concat([[at,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[T.mounted.id]=new O(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;e<this.inner.length;e++)this.inner[e].from<t&&(t=Math.min(t,this.inner[e].parse.parsedPos));return t}stopAt(t){if(this.stoppedAt=t,this.baseParse)this.baseParse.stopAt(t);else for(let e=this.innerDone;e<this.inner.length;e++)this.inner[e].parse.stopAt(t)}startInner(){let t=new pt(this.fragments),e=null,i=null,n=new Y(new W(this.baseTree,this.ranges[0].from,0,null),N.IncludeAnonymous|N.IgnoreMounts);t:for(let o,s;;){let r,l=!0;if(null!=this.stoppedAt&&n.from>=this.stoppedAt)l=!1;else if(t.hasNode(n)){if(e){let t=e.mounts.find(t=>t.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay);if(t)for(let i of t.mount.overlay){let o=i.from+t.pos,s=i.to+t.pos;o>=n.from&&s<=n.to&&!e.ranges.some(t=>t.from<s&&t.to>o)&&e.ranges.push({from:o,to:s})}}l=!1}else if(i&&(s=ct(i.ranges,n.from,n.to)))l=2!=s;else if(!n.type.isAnonymous&&(o=this.nest(n,this.input))&&(n.from<n.to||!o.overlay)){n.tree||(ft(n),e&&e.depth++,i&&i.depth++);let s=t.findMounts(n.from,o.parser);if("function"==typeof o.overlay)e=new lt(o.parser,o.overlay,s,this.inner.length,n.from,n.tree,e);else{let t=mt(this.ranges,o.overlay||(n.from<n.to?[new D(n.from,n.to)]:[]));t.length&&rt(t),!t.length&&o.overlay||this.inner.push(new st(o.parser,t.length?o.parser.startParse(this.input,wt(s,t),t):o.parser.startParse(""),o.overlay?o.overlay.map(t=>new D(t.from-n.from,t.to-n.from)):null,n.tree,t.length?t[0].from:n.from)),o.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):l=!1}}else if(e&&(r=e.predicate(n))&&(!0===r&&(r=new D(n.from,n.to)),r.from<r.to)){let t=e.ranges.length-1;t>=0&&e.ranges[t].to==r.from?e.ranges[t]={from:e.ranges[t].from,to:r.to}:e.ranges.push(r)}if(l&&n.firstChild())e&&e.depth++,i&&i.depth++;else for(;!n.nextSibling();){if(!n.parent())break t;if(e&&! --e.depth){let t=mt(this.ranges,e.ranges);t.length&&(rt(t),this.inner.splice(e.index,0,new st(e.parser,e.parser.startParse(this.input,wt(e.mounts,t),t),e.ranges.map(t=>new D(t.from-e.start,t.to-e.start)),e.target,t[0].from))),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function ct(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function dt(t,e,i,n,o,s){if(e<i){let r=t.buffer[e+1];n.push(t.slice(e,i,r)),o.push(r-s)}}function ft(t){let{node:e}=t,i=[],n=e.context.buffer;do{i.push(t.index),t.parent()}while(!t.tree);let o=t.tree,s=o.children.indexOf(n),r=o.children[s],l=r.buffer,a=[s];o.children[s]=function t(n,o,s,h,c,d){let f=i[d],u=[],p=[];dt(r,n,f,u,p,h);let m=l[f+1],g=l[f+2];a.push(u.length);let w=d?t(f+4,l[f+3],r.set.types[l[f]],m,g-m,d-1):e.toTree();return u.push(w),p.push(m-h),dt(r,l[f+3],o,u,p,h),new j(s,u,p,c)}(0,l.length,B.none,0,r.length,i.length-1);for(let e of a){let i=t.tree.children[e],n=t.tree.positions[e];t.yield(new W(i,n+t.from,e,t._tree))}}class ut{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(N.IncludeAnonymous|N.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from<i;)e.to>=t&&e.enter(i,1,N.IgnoreOverlays|N.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof j))break;e=e.children[0]}return!1}}class pt{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(at))&&void 0!==e?e:i.to,this.inner=new ut(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(at))&&void 0!==t?t:e.to,this.inner=new ut(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let o=null===(i=t.tree)||void 0===i?void 0:i.prop(T.mounted);if(o&&o.parser==e)for(let e=this.fragI;e<this.fragments.length;e++){let i=this.fragments[e];if(i.from>=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:o})}}}return n}}function mt(t,e){let i=null,n=e;for(let o=1,s=0;o<t.length;o++){let r=t[o-1].to,l=t[o].from;for(;s<n.length;s++){let t=n[s];if(t.from>=l)break;t.to<=r||(i||(n=i=e.slice()),t.from<r?(i[s]=new D(t.from,r),t.to>l&&i.splice(s+1,0,new D(l,t.to))):t.to>l?i[s--]=new D(l,t.to):i.splice(s--,1))}}return n}function gt(t,e,i,n){let o=0,s=0,r=!1,l=!1,a=-1e9,h=[];for(;;){let c=o==t.length?1e9:r?t[o].to:t[o].from,d=s==e.length?1e9:l?e[s].to:e[s].from;if(r!=l){let t=Math.max(a,i),e=Math.min(c,d,n);t<e&&h.push(new D(t,e))}if(a=Math.min(c,d),1e9==a)break;c==a&&(r?(r=!1,o++):r=!0),d==a&&(l?(l=!1,s++):l=!0)}return h}function wt(t,e){let i=[];for(let{pos:n,mount:o,frag:s}of t){let t=n+(o.overlay?o.overlay[0].from:0),r=t+o.tree.length,l=Math.max(s.from,t),a=Math.min(s.to,r);if(o.overlay){let r=gt(e,o.overlay.map(t=>new D(t.from+n,t.to+n)),l,a);for(let e=0,n=l;;e++){let l=e==r.length,h=l?a:r[e].from;if(h>n&&i.push(new et(n,h,o.tree,-t,s.from>=n||s.openStart,s.to<=h||s.openEnd)),l)break;n=r[e].to}}else i.push(new et(l,a,o.tree,-t,s.from>=t||s.openStart,s.to<=r||s.openEnd))}return i}const vt="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),bt="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),yt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class xt{constructor(t,e){this.rules=[];let{finish:i}=e||{};function n(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function o(t,e,s,r){let l=[],a=/^@(\w+)\b/.exec(t[0]),h=a&&"keyframes"==a[1];if(a&&null==e)return s.push(t[0]+";");for(let i in e){let r=e[i];if(/&/.test(i))o(i.split(/,\s*/).map(e=>t.map(t=>e.replace(/&/,t))).reduce((t,e)=>t.concat(e)),r,s);else if(r&&"object"==typeof r){if(!a)throw new RangeError("The value of a property ("+i+") should be a primitive value.");o(n(i),r,l,h)}else null!=r&&l.push(i.replace(/_.*/,"").replace(/[A-Z]/g,t=>"-"+t.toLowerCase())+": "+r+";")}(l.length||h)&&s.push((!i||a||r?t:t.map(i)).join(", ")+" {"+l.join(" ")+"}")}for(let e in t)o(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=yt[vt]||1;return yt[vt]=t+1,"ͼ"+t.toString(36)}static mount(t,e,i){let n=t[bt],o=i&&i.nonce;n?o&&n.setNonce(o):n=new St(t,o),n.mount(Array.isArray(e)?e:[e],t)}}let kt=new Map;class St{constructor(t,e){let i=t.ownerDocument||t,n=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let e=kt.get(i);if(e)return t[bt]=e;this.sheet=new n.CSSStyleSheet,kt.set(i,this)}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[bt]=this}mount(t,e){let i=this.sheet,n=0,o=0;for(let e=0;e<t.length;e++){let s=t[e],r=this.modules.indexOf(s);if(r<o&&r>-1&&(this.modules.splice(r,1),o--,r=-1),-1==r){if(this.modules.splice(o++,0,s),i)for(let t=0;t<s.rules.length;t++)i.insertRule(s.rules[t],n++)}else{for(;o<r;)n+=this.modules[o++].rules.length;n+=s.rules.length,o++}}if(i)e.adoptedStyleSheets.indexOf(this.sheet)<0&&(e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets]);else{let t="";for(let e=0;e<this.modules.length;e++)t+=this.modules[e].getRules()+"\n";this.styleTag.textContent=t;let i=e.head||e;this.styleTag.parentNode!=i&&i.insertBefore(this.styleTag,i.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}for(var Ct={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},At={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Mt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Dt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Tt=0;Tt<10;Tt++)Ct[48+Tt]=Ct[96+Tt]=String(Tt);for(Tt=1;Tt<=24;Tt++)Ct[Tt+111]="F"+Tt;for(Tt=65;Tt<=90;Tt++)Ct[Tt]=String.fromCharCode(Tt+32),At[Tt]=String.fromCharCode(Tt);for(var Ot in Ct)At.hasOwnProperty(Ot)||(At[Ot]=Ct[Ot]);function Lt(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&"object"==typeof i&&null==i.nodeType&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var o=i[n];"string"==typeof o?t.setAttribute(n,o):null!=o&&(t[n]=o)}e++}for(;e<arguments.length;e++)Bt(t,arguments[e]);return t}function Bt(t,e){if("string"==typeof e)t.appendChild(document.createTextNode(e));else if(null==e);else if(null!=e.nodeType)t.appendChild(e);else{if(!Array.isArray(e))throw new RangeError("Unsupported child node: "+e);for(var i=0;i<e.length;i++)Bt(t,e[i])}}let Et="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},Pt="undefined"!=typeof document?document:{documentElement:{style:{}}};const Rt=/Edge\/(\d+)/.exec(Et.userAgent),Nt=/MSIE \d/.test(Et.userAgent),jt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Et.userAgent),Ht=!!(Nt||jt||Rt),It=!Ht&&/gecko\/(\d+)/i.test(Et.userAgent),Vt=!Ht&&/Chrome\/(\d+)/.exec(Et.userAgent),Ft="webkitFontSmoothing"in Pt.documentElement.style,zt=!Ht&&/Apple Computer/.test(Et.vendor),Wt=zt&&(/Mobile\/\w+/.test(Et.userAgent)||Et.maxTouchPoints>2);var qt={mac:Wt||/Mac/.test(Et.platform),windows:/Win/.test(Et.platform),linux:/Linux|X11/.test(Et.platform),ie:Ht,ie_version:Nt?Pt.documentMode||6:jt?+jt[1]:Rt?+Rt[1]:0,gecko:It,gecko_version:It?+(/Firefox\/(\d+)/.exec(Et.userAgent)||[0,0])[1]:0,chrome:!!Vt,chrome_version:Vt?+Vt[1]:0,ios:Wt,android:/Android\b/.test(Et.userAgent),webkit_version:Ft?+(/\bAppleWebKit\/(\d+)/.exec(Et.userAgent)||[0,0])[1]:0,safari:zt,safari_version:zt?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Et.userAgent)||[0,0])[1]:0,tabSize:null!=Pt.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function _t(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function Kt(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function $t(t,e){if(!e.anchorNode)return!1;try{return Kt(t,e.anchorNode)}catch(t){return!1}}function Ut(t){return 3==t.nodeType?re(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function Gt(t,e,i,n){return!!i&&(Qt(t,e,i,n,-1)||Qt(t,e,i,n,1))}function Yt(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function Xt(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Qt(t,e,i,n,o){for(;;){if(t==i&&e==n)return!0;if(e==(o<0?0:Jt(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=Yt(t)+(o<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(o<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=o<0?Jt(t):0}}}function Jt(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Zt(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function te(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function ee(t,e){let i=e.width/t.offsetWidth,n=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-t.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}class ie{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:i}=t;this.set(e,Math.min(t.anchorOffset,e?Jt(e):0),i,Math.min(t.focusOffset,i?Jt(i):0))}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let ne,oe=null;function se(t){if(t.setActive)return t.setActive();if(oe)return t.focus(oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==oe?{get preventScroll(){return oe={preventScroll:!0},!0}}:void 0),!oe){oe=!1;for(let t=0;t<e.length;){let i=e[t++],n=e[t++],o=e[t++];i.scrollTop!=n&&(i.scrollTop=n),i.scrollLeft!=o&&(i.scrollLeft=o)}}}function re(t,e,i=e){let n=ne||(ne=document.createRange());return n.setEnd(t,i),n.setStart(t,e),n}function le(t,e,i,n){let o={key:e,code:e,keyCode:i,which:i,cancelable:!0};n&&({altKey:o.altKey,ctrlKey:o.ctrlKey,shiftKey:o.shiftKey,metaKey:o.metaKey}=n);let s=new KeyboardEvent("keydown",o);s.synthetic=!0,t.dispatchEvent(s);let r=new KeyboardEvent("keyup",o);return r.synthetic=!0,t.dispatchEvent(r),s.defaultPrevented||r.defaultPrevented}function ae(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function he(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function ce(t,e){for(let i=t,n=e;;){if(3==i.nodeType&&n>0)return{node:i,offset:n};if(1==i.nodeType&&n>0){if("false"==i.contentEditable)return null;i=i.childNodes[n-1],n=Jt(i)}else{if(!i.parentNode||Xt(i))return null;n=Yt(i),i=i.parentNode}}}function de(t,e){for(let i=t,n=e;;){if(3==i.nodeType&&n<i.nodeValue.length)return{node:i,offset:n};if(1==i.nodeType&&n<i.childNodes.length){if("false"==i.contentEditable)return null;i=i.childNodes[n],n=0}else{if(!i.parentNode||Xt(i))return null;n=Yt(i)+1,i=i.parentNode}}}qt.safari&&qt.safari_version>=26&&(oe=!1);class fe{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new fe(t.parentNode,Yt(t),e)}static after(t,e){return new fe(t.parentNode,Yt(t)+1,e)}}const ue=[];class pe{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t){let e=this.posAtStart;for(let i of this.children){if(i==t)return e;e+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(2&this.flags){let i,n=this.dom,o=null;for(let s of this.children){if(7&s.flags){if(!s.dom&&(i=o?o.nextSibling:n.firstChild)){let t=pe.get(i);(!t||!t.parent&&t.canReuseDOM(s))&&s.reuseDOM(i)}s.sync(t,e),s.flags&=-8}if(i=o?o.nextSibling:n.firstChild,e&&!e.written&&e.node==n&&i!=s.dom&&(e.written=!0),s.dom.parentNode==n)for(;i&&i!=s.dom;)i=me(i);else n.insertBefore(s.dom,i);o=s.dom}for(i=o?o.nextSibling:n.firstChild,i&&e&&e.node==n&&(e.written=!0);i;)i=me(i)}else if(1&this.flags)for(let i of this.children)7&i.flags&&(i.sync(t,e),i.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let i;if(t==this.dom)i=this.dom.childNodes[e];else{let n=0==Jt(t)?0:0==e?-1:1;for(;;){let e=t.parentNode;if(e==this.dom)break;0==n&&e.firstChild!=e.lastChild&&(n=t==e.firstChild?-1:1),t=e}i=n<0?t:t.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!pe.get(i);)i=i.nextSibling;if(!i)return this.length;for(let t=0,e=0;;t++){let n=this.children[t];if(n.dom==i)return e;e+=n.length+n.breakAfter}}domBoundsAround(t,e,i=0){let n=-1,o=-1,s=-1,r=-1;for(let l=0,a=i,h=i;l<this.children.length;l++){let i=this.children[l],c=a+i.length;if(a<t&&c>e)return i.domBoundsAround(t,e,a);if(c>=t&&-1==n&&(n=l,o=a),a>e&&i.dom.parentNode==this.dom){s=l,r=h;break}h=c,a=c+i.breakAfter}return{from:o,to:r<0?i+this.length:r,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s<this.children.length&&s>=0?this.children[s].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),1&e.flags)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,i=ue){this.markDirty();for(let n=t;n<e;n++){let t=this.children[n];t.parent==this&&i.indexOf(t)<0&&t.destroy()}i.length<250?this.children.splice(t,e-t,...i):this.children=[].concat(this.children.slice(0,t),i,this.children.slice(e));for(let t=0;t<i.length;t++)i[t].setParent(this)}ignoreMutation(t){return!1}ignoreEvent(t){return!1}childCursor(t=this.length){return new ge(this.children,t,this.children.length)}childPos(t,e=1){return this.childCursor().findPos(t,e)}toString(){let t=this.constructor.name.replace("View","");return t+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==t?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(t){return t.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(t,e,i,n,o,s){return!1}become(t){return!1}canReuseDOM(t){return t.constructor==this.constructor&&!(8&(this.flags|t.flags))}getSide(){return 0}destroy(){for(let t of this.children)t.parent==this&&t.destroy();this.parent=null}}function me(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}pe.prototype.breakAfter=0;class ge{constructor(t,e,i){this.children=t,this.pos=e,this.i=i,this.off=0}findPos(t,e=1){for(;;){if(t>this.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function we(t,e,i,n,o,s,r,l,a){let{children:h}=t,c=h.length?h[e]:null,d=s.length?s[s.length-1]:null,f=d?d.breakAfter:r;if(!(e==n&&c&&!r&&!f&&s.length<2&&c.merge(i,o,s.length?d:null,0==i,l,a))){if(n<h.length){let t=h[n];t&&(o<t.length||t.breakAfter&&(null==d?void 0:d.breakAfter))?(e==n&&(t=t.split(o),o=0),!f&&d&&t.merge(0,o,d,!0,0,a)?s[s.length-1]=t:((o||t.children.length&&!t.children[0].length)&&t.merge(0,o,null,!1,0,a),s.push(t))):(null==t?void 0:t.breakAfter)&&(d?d.breakAfter=1:r=1),n++}for(c&&(c.breakAfter=r,i>0&&(!r&&s.length&&c.merge(i,c.length,s[0],!1,l,0)?c.breakAfter=s.shift().breakAfter:(i<c.length||c.children.length&&0==c.children[c.children.length-1].length)&&c.merge(i,c.length,null,!1,l,0),e++));e<n&&s.length;)if(h[n-1].become(s[s.length-1]))n--,s.pop(),a=s.length?0:l;else{if(!h[e].become(s[0]))break;e++,s.shift(),l=s.length?0:a}!s.length&&e&&n<h.length&&!h[e-1].breakAfter&&h[n].merge(0,0,h[e-1],!1,l,a)&&e--,(e<n||s.length)&&t.replaceChildren(e,n,s)}}function ve(t,e,i,n,o,s){let r=t.childCursor(),{i:l,off:a}=r.findPos(i,1),{i:h,off:c}=r.findPos(e,-1),d=e-i;for(let t of n)d+=t.length;t.length+=d,we(t,h,c,l,a,n,0,o,s)}class be extends pe{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){3==t.nodeType&&this.createDOM(t)}merge(t,e,i){return!(8&this.flags||i&&(!(i instanceof be)||this.length-(e-t)+i.length>256||8&i.flags))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new be(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=8&this.flags,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new fe(this.dom,t)}domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return function(t,e,i){let n=t.nodeValue.length;e>n&&(e=n);let o=e,s=e,r=0;0==e&&i<0||e==n&&i>=0?qt.chrome||qt.gecko||(e?(o--,r=1):s<n&&(s++,r=-1)):i<0?o--:s<n&&s++;let l=re(t,o,s).getClientRects();if(!l.length)return null;let a=l[(r?r<0:i>=0)?0:l.length-1];qt.safari&&!r&&0==a.width&&(a=Array.prototype.find.call(l,t=>t.width)||a);return r?Zt(a,r<0):a||null}(this.dom,t,e)}}class ye extends pe{constructor(t,e=[],i=0){super(),this.mark=t,this.children=e,this.length=i;for(let t of e)t.setParent(this)}setAttrs(t){if(ae(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!(8&(this.flags|t.flags))}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,i,n,o,s){return(!i||!(!(i instanceof ye&&i.mark.eq(this.mark))||t&&o<=0||e<this.length&&s<=0))&&(ve(this,t,e,i?i.children.slice():[],o-1,s-1),this.markDirty(),!0)}split(t){let e=[],i=0,n=-1,o=0;for(let s of this.children){let r=i+s.length;r>t&&e.push(i<t?s.split(t-i):s),n<0&&i>=t&&(n=o),i=r,o++}let s=this.length-t;return this.length=t,n>-1&&(this.children.length=n,this.markDirty()),new ye(this.mark,e,s)}domAtPos(t){return Se(this,t)}coordsAt(t,e){return Ae(this,t,e)}}class xe extends pe{static create(t,e,i){return new xe(t,e,i)}constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}split(t){let e=xe.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(t,e,i,n,o,s){return!(i&&(!(i instanceof xe&&this.widget.compare(i.widget))||t>0&&o<=0||e<this.length&&s<=0))&&(this.length=t+(i?i.length:0)+(this.length-e),!0)}become(t){return t instanceof xe&&t.side==this.side&&this.widget.constructor==t.widget.constructor&&(this.widget.compare(t.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,!0)}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}get overrideDOMText(){if(0==this.length)return l.empty;let t=this;for(;t.parent;)t=t.parent;let{view:e}=t,i=e&&e.state.doc,n=this.posAtStart;return i?i.slice(n,n+this.length):l.empty}domAtPos(t){return(this.length?0==t:this.side>0)?fe.before(this.dom):fe.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.widget.coordsAt(this.dom,t,e);if(i)return i;let n=this.dom.getClientRects(),o=null;if(!n.length)return null;let s=this.side?this.side<0:t>0;for(let e=s?n.length-1:0;o=n[e],!(t>0?0==e:e==n.length-1||o.top<o.bottom);e+=s?-1:1);return Zt(o,!s)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class ke extends pe{constructor(t){super(),this.side=t}get length(){return 0}merge(){return!1}become(t){return t instanceof ke&&t.side==this.side}split(){return new ke(this.side)}sync(){if(!this.dom){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),this.setDOM(t)}}getSide(){return this.side}domAtPos(t){return this.side>0?fe.before(this.dom):fe.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return l.empty}get isHidden(){return!0}}function Se(t,e){let i=t.dom,{children:n}=t,o=0;for(let t=0;o<n.length;o++){let s=n[o],r=t+s.length;if(!(r==t&&s.getSide()<=0)){if(e>t&&e<r&&s.dom.parentNode==i)return s.domAtPos(e-t);if(e<=t)break;t=r}}for(let t=o;t>0;t--){let e=n[t-1];if(e.dom.parentNode==i)return e.domAtPos(e.length)}for(let t=o;t<n.length;t++){let e=n[t];if(e.dom.parentNode==i)return e.domAtPos(0)}return new fe(i,0)}function Ce(t,e,i){let n,{children:o}=t;i>0&&e instanceof ye&&o.length&&(n=o[o.length-1])instanceof ye&&n.mark.eq(e.mark)?Ce(n,e.children[0],i-1):(o.push(e),e.setParent(t)),t.length+=e.length}function Ae(t,e,i){let n=null,o=-1,s=null,r=-1;!function t(e,l){for(let a=0,h=0;a<e.children.length&&h<=l;a++){let c=e.children[a],d=h+c.length;d>=l&&(c.children.length?t(c,l-h):(!s||s.isHidden&&(i>0||Me(s,c)))&&(d>l||h==d&&c.getSide()>0)?(s=c,r=l-h):(h<l||h==d&&c.getSide()<0&&!c.isHidden)&&(n=c,o=l-h)),h=d}}(t,e);let l=(i<0?n:s)||n||s;return l?l.coordsAt(Math.max(0,l==n?o:r),i):function(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let i=Ut(e);return i[i.length-1]||null}(t)}function Me(t,e){let i=t.coordsAt(0,1),n=e.coordsAt(0,1);return i&&n&&n.top<i.bottom}function De(t,e){for(let i in t)"class"==i&&e.class?e.class+=" "+t.class:"style"==i&&e.style?e.style+=";"+t.style:e[i]=t[i];return e}be.prototype.children=xe.prototype.children=ke.prototype.children=ue;const Te=Object.create(null);function Oe(t,e,i){if(t==e)return!0;t||(t=Te),e||(e=Te);let n=Object.keys(t),o=Object.keys(e);if(n.length-(i&&n.indexOf(i)>-1?1:0)!=o.length-(i&&o.indexOf(i)>-1?1:0))return!1;for(let s of n)if(s!=i&&(-1==o.indexOf(s)||t[s]!==e[s]))return!1;return!0}function Le(t,e,i){let n=!1;if(e)for(let o in e)i&&o in i||(n=!0,"style"==o?t.style.cssText="":t.removeAttribute(o));if(i)for(let o in i)e&&e[o]==i[o]||(n=!0,"style"==o?t.style.cssText=i[o]:t.setAttribute(o,i[o]));return n}function Be(t){let e=Object.create(null);for(let i=0;i<t.attributes.length;i++){let n=t.attributes[i];e[n.name]=n.value}return e}class Ee{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var Pe=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Pe||(Pe={}));class Re extends d{constructor(t,e,i,n){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(t){return new Ne(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),i=!!t.block;return e+=i&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new He(t,e,e,i,t.widget||null,!1)}static replace(t){let e,i,n=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{let{start:o,end:s}=Ie(t,n);e=(o?n?-3e8:-1:5e8)-1,i=1+(s?n?2e8:1:-6e8)}return new He(t,e,i,n,t.widget||null,!0)}static line(t){return new je(t)}static set(t,e=!1){return h.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}Re.none=h.empty;class Ne extends Re{constructor(t){let{start:e,end:i}=Ie(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var e,i;return this==t||t instanceof Ne&&this.tagName==t.tagName&&(this.class||(null===(e=this.attrs)||void 0===e?void 0:e.class))==(t.class||(null===(i=t.attrs)||void 0===i?void 0:i.class))&&Oe(this.attrs,t.attrs,"class")}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}Ne.prototype.point=!1;class je extends Re{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof je&&this.spec.class==t.spec.class&&Oe(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}je.prototype.mapMode=p.TrackBefore,je.prototype.point=!0;class He extends Re{constructor(t,e,i,n,o,s){super(e,i,o,t),this.block=n,this.isReplace=s,this.mapMode=n?e<=0?p.TrackBefore:p.TrackAfter:p.TrackDel}get type(){return this.startSide!=this.endSide?Pe.WidgetRange:this.startSide<=0?Pe.WidgetBefore:Pe.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof He&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}function Ie(t,e=!1){let{inclusiveStart:i,inclusiveEnd:n}=t;return null==i&&(i=t.inclusive),null==n&&(n=t.inclusive),{start:null!=i?i:e,end:null!=n?n:e}}function Ve(t,e,i,n=0){let o=i.length-1;o>=0&&i[o]+n>=t?i[o]=Math.max(i[o],e):i.push(t,e)}He.prototype.point=!0;class Fe extends pe{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,i,n,o,s){if(i){if(!(i instanceof Fe))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),ve(this,t,e,i?i.children.slice():[],o,s),!0}split(t){let e=new Fe;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i:i,off:n}=this.childPos(t);n&&(e.append(this.children[i].split(n),0),this.children[i].merge(n,this.children[i].length,null,!1,0,0),i++);for(let t=i;t<this.children.length;t++)e.append(this.children[t],0);for(;i>0&&0==this.children[i-1].length;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){Oe(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Ce(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=De(e,this.attrs||{})),i&&(this.attrs=De({class:i},this.attrs||{}))}domAtPos(t){return Se(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6)}sync(t,e){var i;this.dom?4&this.flags&&(ae(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(Le(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let n=this.dom.lastChild;for(;n&&pe.get(n)instanceof ye;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=pe.get(n))||void 0===i?void 0:i.isEditable)||qt.ios&&this.children.some(t=>t instanceof be)))){let t=document.createElement("BR");t.cmIgnore=!0,this.dom.appendChild(t)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let t,e=0;for(let i of this.children){if(!(i instanceof be)||/[^ -~]/.test(i.text))return null;let n=Ut(i.dom);if(1!=n.length)return null;e+=n[0].width,t=n[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(t,e){let i=Ae(this,t,e);if(!this.children.length&&i&&this.parent){let{heightOracle:t}=this.parent.view.viewState,e=i.bottom-i.top;if(Math.abs(e-t.lineHeight)<2&&t.textHeight<e){let n=(e-t.textHeight)/2;return{top:i.top+n,bottom:i.bottom-n,left:i.left,right:i.left}}}return i}become(t){return t instanceof Fe&&0==this.children.length&&0==t.children.length&&Oe(this.attrs,t.attrs)&&this.breakAfter==t.breakAfter}covers(){return!0}static find(t,e){for(let i=0,n=0;i<t.children.length;i++){let o=t.children[i],s=n+o.length;if(s>=e){if(o instanceof Fe)return o;if(s>e)break}n=s+o.breakAfter}return null}}class ze extends pe{constructor(t,e,i){super(),this.widget=t,this.length=e,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,n,o,s){return!(i&&(!(i instanceof ze&&this.widget.compare(i.widget))||t>0&&o<=0||e<this.length&&s<=0))&&(this.length=t+(i?i.length:0)+(this.length-e),!0)}domAtPos(t){return 0==t?fe.before(this.dom):fe.after(this.dom,t==this.length)}split(t){let e=this.length-t;this.length=t;let i=new ze(this.widget,e,this.deco);return i.breakAfter=this.breakAfter,i}get children(){return ue}sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):l.empty}domBoundsAround(){return null}become(t){return t instanceof ze&&t.widget.constructor==this.widget.constructor&&(t.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,this.deco=t.deco,this.breakAfter=t.breakAfter,!0)}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(t,e){let i=this.widget.coordsAt(this.dom,t,e);return i||(this.widget instanceof We?null:Zt(this.dom.getBoundingClientRect(),this.length?0==t:e<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(t){let{startSide:e,endSide:i}=this.deco;return e!=i&&(t<0?e<0:i>0)}}class We extends Ee{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class qe{constructor(t,e,i,n){this.doc=t,this.pos=e,this.end=i,this.disallowBlockEffectsFor=n,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=e}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof ze&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Fe),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(_e(new ke(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||t&&this.content.length&&this.content[this.content.length-1]instanceof ze||this.getLine()}buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){let{value:e,lineBreak:i,done:n}=this.cursor.next(this.skip);if(this.skip=0,n)throw new Error("Ran out of text content when drawing inline views");if(i){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}this.text=e,this.textOff=0}let n=Math.min(this.text.length-this.textOff,t),o=Math.min(n,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(_e(new be(this.text.slice(this.textOff,this.textOff+o)),e),i),this.atCursorPos=!0,this.textOff+=o,t-=o,i=n<=o?0:e.length}}span(t,e,i,n){this.buildText(e-t,i,n),this.pos=e,this.openStart<0&&(this.openStart=n)}point(t,e,i,n,o,s){if(this.disallowBlockEffectsFor[s]&&i instanceof He){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let r=e-t;if(i instanceof He)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ze(i.widget||Ke.block,r,i));else{let s=xe.create(i.widget||Ke.inline,r,r?0:i.startSide),l=this.atCursorPos&&!s.isEditable&&o<=n.length&&(t<e||i.startSide>0),a=!s.isEditable&&(t<e||o>n.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||l||s.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),l&&(h.append(_e(new ke(1),n),o),o=n.length+Math.max(0,o-n.length)),h.append(_e(s,n),o),this.atCursorPos=a,this.pendingBuffer=a?t<e||o>n.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);r&&(this.textOff+r<=this.text.length?this.textOff+=r:(this.skip+=r-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=o)}static build(t,e,i,n,o){let s=new qe(t,e,i,o);return s.openEnd=h.spans(n,e,i,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function _e(t,e){for(let i of e)t=new ye(i,[t],t.length);return t}class Ke extends Ee{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Ke.inline=new Ke("span"),Ke.block=new Ke("div");var $e=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}($e||($e={}));const Ue=$e.LTR,Ge=$e.RTL;function Ye(t){let e=[];for(let i=0;i<t.length;i++)e.push(1<<+t[i]);return e}const Xe=Ye("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Qe=Ye("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Je=Object.create(null),Ze=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),i=t.charCodeAt(1);Je[e]=i,Je[i]=-e}function ti(t){return t<=247?Xe[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Qe[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const ei=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ii{get dir(){return this.level%2?Ge:Ue}constructor(t,e,i){this.from=t,this.to=e,this.level=i}side(t,e){return this.dir==e==t?this.to:this.from}forward(t,e){return t==(this.dir==e)}static find(t,e,i,n){let o=-1;for(let s=0;s<t.length;s++){let r=t[s];if(r.from<=e&&r.to>=e){if(r.level==i)return s;(o<0||(0!=n?n<0?r.from<e:r.to>e:t[o].level>r.level))&&(o=s)}}if(o<0)throw new RangeError("Index out of range");return o}}function ni(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let n=t[i],o=e[i];if(n.from!=o.from||n.to!=o.to||n.direction!=o.direction||!ni(n.inner,o.inner))return!1}return!0}const oi=[];function si(t,e,i,n,o,s,r){let l=n%2?2:1;if(n%2==o%2)for(let a=e,h=0;a<i;){let e=!0,c=!1;if(h==s.length||a<s[h].from){let t=oi[a];t!=l&&(e=!1,c=16==t)}let d=e||1!=l?null:[],f=e?n:n+1,u=a;t:for(;;)if(h<s.length&&u==s[h].from){if(c)break t;let p=s[h];if(!e)for(let t=p.to,e=h+1;;){if(t==i)break t;if(!(e<s.length&&s[e].from==t)){if(oi[t]==l)break t;break}t=s[e++].to}if(h++,d)d.push(p);else{p.from>a&&r.push(new ii(a,p.from,f)),ri(t,p.direction==Ue!=!(f%2)?n+1:n,o,p.inner,p.from,p.to,r),a=p.to}u=p.to}else{if(u==i||(e?oi[u]!=l:oi[u]==l))break;u++}d?si(t,a,u,n+1,o,d,r):a<u&&r.push(new ii(a,u,f)),a=u}else for(let a=i,h=s.length;a>e;){let i=!0,c=!1;if(!h||a>s[h-1].to){let t=oi[a-1];t!=l&&(i=!1,c=16==t)}let d=i||1!=l?null:[],f=i?n:n+1,u=a;t:for(;;)if(h&&u==s[h-1].to){if(c)break t;let p=s[--h];if(!i)for(let t=p.from,i=h;;){if(t==e)break t;if(!i||s[i-1].to!=t){if(oi[t-1]==l)break t;break}t=s[--i].from}if(d)d.push(p);else{p.to<a&&r.push(new ii(p.to,a,f)),ri(t,p.direction==Ue!=!(f%2)?n+1:n,o,p.inner,p.from,p.to,r),a=p.from}u=p.from}else{if(u==e||(i?oi[u-1]!=l:oi[u-1]==l))break;u--}d?si(t,u,a,n+1,o,d,r):u<a&&r.push(new ii(u,a,f)),a=u}}function ri(t,e,i,n,o,s,r){let l=e%2?2:1;!function(t,e,i,n,o){for(let s=0;s<=n.length;s++){let r=s?n[s-1].to:e,l=s<n.length?n[s].from:i,a=s?256:o;for(let e=r,i=a,n=a;e<l;e++){let o=ti(t.charCodeAt(e));512==o?o=i:8==o&&4==n&&(o=16),oi[e]=4==o?2:o,7&o&&(n=o),i=o}for(let t=r,e=a,n=a;t<l;t++){let o=oi[t];if(128==o)t<l-1&&e==oi[t+1]&&24&e?o=oi[t]=e:oi[t]=256;else if(64==o){let o=t+1;for(;o<l&&64==oi[o];)o++;let s=t&&8==e||o<i&&8==oi[o]?1==n?1:8:256;for(let e=t;e<o;e++)oi[e]=s;t=o-1}else 8==o&&1==n&&(oi[t]=1);e=o,7&o&&(n=o)}}}(t,o,s,n,l),function(t,e,i,n,o){let s=1==o?2:1;for(let r=0,l=0,a=0;r<=n.length;r++){let h=r?n[r-1].to:e,c=r<n.length?n[r].from:i;for(let e,i,n,r=h;r<c;r++)if(i=Je[e=t.charCodeAt(r)])if(i<0){for(let t=l-3;t>=0;t-=3)if(Ze[t+1]==-i){let e=Ze[t+2],i=2&e?o:4&e?1&e?s:o:0;i&&(oi[r]=oi[Ze[t]]=i),l=t;break}}else{if(189==Ze.length)break;Ze[l++]=r,Ze[l++]=e,Ze[l++]=a}else if(2==(n=oi[r])||1==n){let t=n==o;a=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Ze[e+2];if(2&i)break;if(t)Ze[e+2]|=2;else{if(4&i)break;Ze[e+2]|=4}}}}}(t,o,s,n,l),function(t,e,i,n){for(let o=0,s=n;o<=i.length;o++){let r=o?i[o-1].to:t,l=o<i.length?i[o].from:e;for(let a=r;a<l;){let r=oi[a];if(256==r){let r=a+1;for(;;)if(r==l){if(o==i.length)break;r=i[o++].to,l=o<i.length?i[o].from:e}else{if(256!=oi[r])break;r++}let h=1==s,c=h==(1==(r<e?oi[r]:n))?h?1:2:n;for(let e=r,n=o,s=n?i[n-1].to:t;e>a;)e==s&&(e=i[--n].from,s=n?i[n-1].to:t),oi[--e]=c;a=r}else s=r,a++}}}(o,s,n,l),si(t,o,s,e,i,n,r)}function li(t){return[new ii(0,t,0)]}let ai="";function hi(t,e,i,n,o){var r;let l=n.head-t.from,a=ii.find(e,l,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc),h=e[a],d=h.side(o,i);if(l==d){let t=a+=o?1:-1;if(t<0||t>=e.length)return null;h=e[a=t],l=h.side(!o,i),d=h.side(o,i)}let f=c(t.text,l,h.forward(o,i));(f<h.from||f>h.to)&&(f=d),ai=t.text.slice(Math.min(l,f),Math.max(l,f));let u=a==(o?e.length-1:0)?null:e[a+(o?1:-1)];return u&&f==d&&u.level+(o?0:1)<h.level?s.cursor(u.side(!o,i)+t.from,u.forward(o,i)?1:-1,u.level):s.cursor(f+t.from,h.forward(o,i)?-1:1,h.level)}function ci(t,e,i){for(let n=e;n<i;n++){let e=ti(t.charCodeAt(n));if(1==e)return Ue;if(2==e||4==e)return Ge}return Ue}const di=i.define(),fi=i.define(),ui=i.define(),pi=i.define(),mi=i.define(),gi=i.define(),wi=i.define(),vi=i.define(),bi=i.define(),yi=i.define({combine:t=>t.some(t=>t)}),xi=i.define({combine:t=>t.some(t=>t)}),ki=i.define();class Si{constructor(t,e="nearest",i="nearest",n=5,o=5,s=!1){this.range=t,this.y=e,this.x=i,this.yMargin=n,this.xMargin=o,this.isSnapshot=s}map(t){return t.empty?this:new Si(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new Si(s.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Ci=e.define({map:(t,e)=>t.map(e)}),Ai=e.define();function Mi(t,e,i){let n=t.facet(pi);n.length?n[0](e):window.onerror&&window.onerror(String(e),i,void 0,void 0,e)||(i?console.error(i+":",e):console.error(e))}const Di=i.define({combine:t=>!t.length||t[0]});let Ti=0;const Oi=i.define({combine:t=>t.filter((e,i)=>{for(let n=0;n<i;n++)if(t[n].plugin==e.plugin)return!1;return!0})});class Li{constructor(t,e,i,n,o){this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=n,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(Oi.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(Oi.of({plugin:this,arg:t}))}static define(t,e){const{eventHandlers:i,eventObservers:n,provide:o,decorations:s}=e||{};return new Li(Ti++,t,i,n,t=>{let e=[];return s&&e.push(Ri.of(e=>{let i=e.plugin(t);return i?s(i):Re.none})),o&&e.push(o(t)),e})}static fromClass(t,e){return Li.define((e,i)=>new t(e,i),e)}}class Bi{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(e){if(Mi(t.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(e){Mi(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(e){Mi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Ei=i.define(),Pi=i.define(),Ri=i.define(),Ni=i.define(),ji=i.define(),Hi=i.define();function Ii(t,e){let i=t.state.facet(Hi);if(!i.length)return i;let n=i.map(e=>e instanceof Function?e(t):e),o=[];return h.spans(n,e.from,e.to,{point(){},span(t,i,n,s){let r=t-e.from,l=i-e.from,a=o;for(let t=n.length-1;t>=0;t--,s--){let i,o=n[t].spec.bidiIsolate;if(null==o&&(o=ci(e.text,r,l)),s>0&&a.length&&(i=a[a.length-1]).to==r&&i.direction==o)i.to=l,a=i.inner;else{let t={from:r,to:l,direction:o,inner:[]};a.push(t),a=t.inner}}}}),o}const Vi=i.define();function Fi(t){let e=0,i=0,n=0,o=0;for(let s of t.state.facet(Vi)){let r=s(t);r&&(null!=r.left&&(e=Math.max(e,r.left)),null!=r.right&&(i=Math.max(i,r.right)),null!=r.top&&(n=Math.max(n,r.top)),null!=r.bottom&&(o=Math.max(o,r.bottom)))}return{left:e,right:i,top:n,bottom:o}}const zi=i.define();class Wi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Wi(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>i.toA)){if(n.toA<i.fromA)break;i=i.join(n),t.splice(e-1,1)}}return t.splice(e,0,i),t}static extendWithRanges(t,e){if(0==e.length)return t;let i=[];for(let n=0,o=0,s=0,r=0;;n++){let l=n==t.length?null:t[n],a=s-r,h=l?l.fromB:1e9;for(;o<e.length&&e[o]<h;){let t=e[o],n=e[o+1],s=Math.max(r,t),l=Math.min(h,n);if(s<=l&&new Wi(s+a,l+a,s,l).addToSet(i),n>h)break;o+=2}if(!l)return i;new Wi(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),s=l.toA,r=l.toB}}}class qi{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=a.empty(this.startState.doc.length);for(let t of i)this.changes=this.changes.compose(t.changes);let n=[];this.changes.iterChangedRanges((t,e,i,o)=>n.push(new Wi(t,e,i,o))),this.changedRanges=n}static create(t,e,i){return new qi(t,e,i)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}class _i extends pe{get length(){return this.view.state.doc.length}constructor(t){super(),this.view=t,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Re.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new Fe],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Wi(0,0,0,t.state.doc.length)],0,null)}update(t){var e;let i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:t,toA:e})=>e<this.minWidthFrom||t>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?n=this.domChanged.newSel.head:function(t,e){let i=!1;e&&t.iterChangedRanges((t,n)=>{t<e.to&&n>e.from&&(i=!0)});return i}(t.changes,this.hasComposition)||t.selectionSet||(n=t.state.selection.main.head));let o=n>-1?function(t,e,i){let n=Ki(t,i);if(!n)return null;let{node:o,from:s,to:r}=n,l=o.nodeValue;if(/[\n\r]/.test(l))return null;if(t.state.doc.sliceString(n.from,n.to)!=l)return null;let a=e.invertedDesc,h=new Wi(a.mapPos(s),a.mapPos(r),s,r),c=[];for(let e=o.parentNode;;e=e.parentNode){let i=pe.get(e);if(i instanceof ye)c.push({node:e,deco:i.mark});else{if(i instanceof Fe||"DIV"==e.nodeName&&e.parentNode==t.contentDOM)return{range:h,text:o,marks:c,line:e};if(e==t.contentDOM)return null;c.push({node:e,deco:new Ne({inclusive:!0,attributes:Be(e),tagName:e.tagName.toLowerCase()})})}}}(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:e,to:n}=this.hasComposition;i=new Wi(e,n,t.changes.mapPos(e,-1),t.changes.mapPos(n,1)).addToSet(i.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(qt.ie||qt.chrome)&&!o&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let s=function(t,e,i){let n=new $i;return h.compare(t,e,i,n),n.changes}(this.decorations,this.updateDeco(),t.changes);return i=Wi.extendWithRanges(i,s),!!(7&this.flags||0!=i.length)&&(this.updateInner(i,t.startState.doc.length,o),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,i);let{observer:n}=this.view;n.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=qt.chrome||qt.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.flags&=-8,t&&(t.written||n.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(t=>t.flags&=-9);let o=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let t of this.children)t instanceof ze&&t.widget instanceof We&&o.push(t.dom);n.updateGaps(o)}updateChildren(t,e,i){let n=i?i.range.addToSet(t.slice()):t,o=this.childCursor(e);for(let t=n.length-1;;t--){let e=t>=0?n[t]:null;if(!e)break;let s,r,l,a,{fromA:h,toA:c,fromB:d,toB:f}=e;if(i&&i.range.fromB<f&&i.range.toB>d){let t=qe.build(this.view.state.doc,d,i.range.fromB,this.decorations,this.dynamicDecorationMap),e=qe.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);r=t.breakAtStart,l=t.openStart,a=e.openEnd;let n=this.compositionView(i);e.breakAtStart?n.breakAfter=1:e.content.length&&n.merge(n.length,n.length,e.content[0],!1,e.openStart,0)&&(n.breakAfter=e.content[0].breakAfter,e.content.shift()),t.content.length&&n.merge(0,0,t.content[t.content.length-1],!0,0,t.openEnd)&&t.content.pop(),s=t.content.concat(n).concat(e.content)}else({content:s,breakAtStart:r,openStart:l,openEnd:a}=qe.build(this.view.state.doc,d,f,this.decorations,this.dynamicDecorationMap));let{i:u,off:p}=o.findPos(c,1),{i:m,off:g}=o.findPos(h,-1);we(this,m,g,u,p,s,r,l,a)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let e of t.transactions)for(let t of e.effects)t.is(Ai)&&(this.editContextFormatting=t.value)}compositionView(t){let e=new be(t.text.nodeValue);e.flags|=8;for(let{deco:i}of t.marks)e=new ye(i,[e],e.length);let i=new Fe;return i.append(e,0),i}fixCompositionDOM(t){let e=(t,e)=>{e.flags|=8|(e.children.some(t=>7&t.flags)?1:0),this.markedForComposition.add(e);let i=pe.get(t);i&&i!=e&&(i.dom=null),e.setDOM(t)},i=this.childPos(t.range.fromB,1),n=this.children[i.i];e(t.line,n);for(let o=t.marks.length-1;o>=-1;o--)i=n.childPos(i.off,1),n=n.children[i.i],e(o>=0?t.marks[o].node:t.text,n)}updateSelection(t=!1,e=!1){!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let i=this.view.root.activeElement,n=i==this.dom,o=!n&&!(this.view.state.facet(Di)||this.dom.tabIndex>-1)&&$t(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(n||e||o))return;let s=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(r.anchor)),a=r.empty?l:this.moveToLine(this.domAtPos(r.head));if(qt.gecko&&r.empty&&!this.hasComposition&&(1==(h=l).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable))){let t=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(t,l.node.childNodes[l.offset]||null)),l=a=new fe(t,0),s=!0}var h;let c=this.view.observer.selectionRange;!s&&c.focusNode&&(Gt(l.node,l.offset,c.anchorNode,c.anchorOffset)&&Gt(a.node,a.offset,c.focusNode,c.focusOffset)||this.suppressWidgetCursorChange(c,r))||(this.view.observer.ignore(()=>{qt.android&&qt.chrome&&this.dom.contains(c.focusNode)&&function(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let t=_t(this.view.root);if(t)if(r.empty){if(qt.gecko){let t=(e=l.node,n=l.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(n<e.childNodes.length&&"false"==e.childNodes[n].contentEditable?2:0));if(t&&3!=t){let e=(1==t?ce:de)(l.node,l.offset);e&&(l=new fe(e.node,e.offset))}}t.collapse(l.node,l.offset),null!=r.bidiLevel&&void 0!==t.caretBidiLevel&&(t.caretBidiLevel=r.bidiLevel)}else if(t.extend){t.collapse(l.node,l.offset);try{t.extend(a.node,a.offset)}catch(t){}}else{let e=document.createRange();r.anchor>r.head&&([l,a]=[a,l]),e.setEnd(a.node,a.offset),e.setStart(l.node,l.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(l,a)),this.impreciseAnchor=l.precise?null:new fe(c.anchorNode,c.anchorOffset),this.impreciseHead=a.precise?null:new fe(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Gt(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,i=_t(t.root),{anchorNode:n,anchorOffset:o}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let s=Fe.find(this,e.head);if(!s)return;let r=s.posAtStart;if(e.head==r||e.head==r+s.length)return;let l=this.coordsAt(e.head,-1),a=this.coordsAt(e.head,1);if(!l||!a||l.bottom>a.top)return;let h=this.domAtPos(e.head+e.assoc);i.collapse(h.node,h.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&i.collapse(n,o)}moveToLine(t){let e,i=this.dom;if(t.node!=i)return t;for(let n=t.offset;!e&&n<i.childNodes.length;n++){let t=pe.get(i.childNodes[n]);t instanceof Fe&&(e=t.domAtPos(0))}for(let n=t.offset-1;!e&&n>=0;n--){let t=pe.get(i.childNodes[n]);t instanceof Fe&&(e=t.domAtPos(t.length))}return e?new fe(e.node,e.offset,!0):t}nearest(t){for(let e=t;e;){let t=pe.get(e);if(t&&t.rootView==this)return t;e=e.parentNode}return null}posFromDOM(t,e){let i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}domAtPos(t){let{i:e,off:i}=this.childCursor().findPos(t,-1);for(;e<this.children.length-1;){let t=this.children[e];if(i<t.length||t instanceof Fe)break;e++,i=0}return this.children[e].domAtPos(i)}coordsAt(t,e){let i=null,n=0;for(let o=this.length,s=this.children.length-1;s>=0;s--){let r=this.children[s],l=o-r.breakAfter,a=l-r.length;if(l<t)break;if(a<=t&&(a<t||r.covers(-1))&&(l>t||r.covers(1))&&(!i||r instanceof Fe&&!(i instanceof Fe&&e>=0)))i=r,n=a;else if(i&&a==t&&l==t&&r instanceof ze&&Math.abs(e)<2){if(r.deco.startSide<0)break;s&&(i=null)}o=a}return i?i.coordsAt(t-n,e):null}coordsForChar(t){let{i:e,off:i}=this.childPos(t,1),n=this.children[e];if(!(n instanceof Fe))return null;for(;n.children.length;){let{i:t,off:e}=n.childPos(i,1);for(;;t++){if(t==n.children.length)return null;if((n=n.children[t]).length)break}i=e}if(!(n instanceof be))return null;let o=c(n.text,i);if(o==i)return null;let s=re(n.dom,i,o).getClientRects();for(let t=0;t<s.length;t++){let e=s[t];if(t==s.length-1||e.top<e.bottom&&e.left<e.right)return e}return null}measureVisibleLineHeights(t){let e=[],{from:i,to:n}=t,o=this.view.contentDOM.clientWidth,s=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,l=this.view.textDirection==$e.LTR;for(let t=0,a=0;a<this.children.length;a++){let h=this.children[a],c=t+h.length;if(c>n)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),s){let e=h.dom.lastChild,n=e?Ut(e):[];if(n.length){let e=n[n.length-1],s=l?e.right-i.left:i.right-e.left;s>r&&(r=s,this.minWidth=o,this.minWidthFrom=t,this.minWidthTo=c)}}}t=c+h.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return"rtl"==getComputedStyle(this.children[e].dom).direction?$e.RTL:$e.LTR}measureTextSize(){for(let t of this.children)if(t instanceof Fe){let e=t.measureTextSize();if(e)return e}let t,e,i,n=document.createElement("div");return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(n);let o=Ut(n.firstChild)[0];t=n.getBoundingClientRect().height,e=o?o.width/27:7,i=o?o.height:t,n.remove()}),{lineHeight:t,charWidth:e,textHeight:i}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new ge(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,n=0;;n++){let o=n==e.viewports.length?null:e.viewports[n],s=o?o.from-1:this.length;if(s>i){let n=(e.lineBlockAt(s).bottom-e.lineBlockAt(i).top)/this.view.scaleY;t.push(Re.replace({widget:new We(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,s))}if(!o)break;i=o.to+1}return Re.set(t)}updateDeco(){let t=1,e=this.view.state.facet(Ri).map(e=>(this.dynamicDecorationMap[t++]="function"==typeof e)?e(this.view):e),i=!1,n=this.view.state.facet(Ni).map((t,e)=>{let n="function"==typeof t;return n&&(i=!0),n?t(this.view):t});for(n.length&&(this.dynamicDecorationMap[t++]=i,e.push(h.join(n))),this.decorations=[this.editContextFormatting,...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;return this.decorations}scrollIntoView(t){if(t.isSnapshot){let e=this.view.viewState.lineBlockAt(t.range.head);return this.view.scrollDOM.scrollTop=e.top-t.yMargin,void(this.view.scrollDOM.scrollLeft=t.xMargin)}for(let e of this.view.state.facet(ki))try{if(e(this.view,t.range,t))return!0}catch(t){Mi(this.view.state,t,"scroll handler")}let e,{range:i}=t,n=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1);if(!n)return;!i.empty&&(e=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(n={left:Math.min(n.left,e.left),top:Math.min(n.top,e.top),right:Math.max(n.right,e.right),bottom:Math.max(n.bottom,e.bottom)});let o=Fi(this.view),s={left:n.left-o.left,top:n.top-o.top,right:n.right+o.right,bottom:n.bottom+o.bottom},{offsetWidth:r,offsetHeight:l}=this.view.scrollDOM;!function(t,e,i,n,o,s,r,l){let a=t.ownerDocument,h=a.defaultView||window;for(let c=t,d=!1;c&&!d;)if(1==c.nodeType){let t,f=c==a.body,u=1,p=1;if(f)t=te(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(d=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();({scaleX:u,scaleY:p}=ee(c,e)),t={left:e.left,right:e.left+c.clientWidth*u,top:e.top,bottom:e.top+c.clientHeight*p}}let m=0,g=0;if("nearest"==o)e.top<t.top?(g=e.top-(t.top+r),i>0&&e.bottom>t.bottom+g&&(g=e.bottom-t.bottom+r)):e.bottom>t.bottom&&(g=e.bottom-t.bottom+r,i<0&&e.top-g<t.top&&(g=e.top-(t.top+r)));else{let n=e.bottom-e.top,s=t.bottom-t.top;g=("center"==o&&n<=s?e.top+n/2-s/2:"start"==o||"center"==o&&i<0?e.top-r:e.bottom-s+r)-t.top}if("nearest"==n?e.left<t.left?(m=e.left-(t.left+s),i>0&&e.right>t.right+m&&(m=e.right-t.right+s)):e.right>t.right&&(m=e.right-t.right+s,i<0&&e.left<t.left+m&&(m=e.left-(t.left+s))):m=("center"==n?e.left+(e.right-e.left)/2-(t.right-t.left)/2:"start"==n==l?e.left-s:e.right-(t.right-t.left)+s)-t.left,m||g)if(f)h.scrollBy(m,g);else{let t=0,i=0;if(g){let t=c.scrollTop;c.scrollTop+=g/p,i=(c.scrollTop-t)*p}if(m){let e=c.scrollLeft;c.scrollLeft+=m/u,t=(c.scrollLeft-e)*u}e={left:e.left-t,top:e.top-i,right:e.right-t,bottom:e.bottom-i},t&&Math.abs(t-m)<1&&(n="nearest"),i&&Math.abs(i-g)<1&&(o="nearest")}if(f)break;(e.top<t.top||e.bottom>t.bottom||e.left<t.left||e.right>t.right)&&(e={left:Math.max(e.left,t.left),right:Math.min(e.right,t.right),top:Math.max(e.top,t.top),bottom:Math.min(e.bottom,t.bottom)}),c=c.assignedSlot||c.parentNode}else{if(11!=c.nodeType)break;c=c.host}}(this.view.scrollDOM,s,i.head<i.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,r),-r),Math.max(Math.min(t.yMargin,l),-l),this.view.textDirection==$e.LTR)}lineHasWidget(t){let{i:e}=this.childCursor().findPos(t);if(e==this.children.length)return!1;let i=t=>t instanceof xe||t.children.some(i);return i(this.children[e])}}function Ki(t,e){let i=t.observer.selectionRange;if(!i.focusNode)return null;let n=ce(i.focusNode,i.focusOffset),o=de(i.focusNode,i.focusOffset),s=n||o;if(o&&n&&o.node!=n.node){let e=pe.get(o.node);if(!e||e instanceof be&&e.text!=o.node.nodeValue)s=o;else if(t.docView.lastCompositionAfterCursor){let t=pe.get(n.node);!t||t instanceof be&&t.text!=n.node.nodeValue||(s=o)}}if(t.docView.lastCompositionAfterCursor=s!=n,!s)return null;let r=e-s.offset;return{from:r,to:r+s.node.nodeValue.length,node:s.node}}let $i=class{constructor(){this.changes=[]}compareRange(t,e){Ve(t,e,this.changes)}comparePoint(t,e){Ve(t,e,this.changes)}boundChange(t){Ve(t,t,this.changes)}};function Ui(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function Gi(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function Yi(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function Xi(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function Qi(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function Ji(t,e,i){let n,o,s,r,l,a,h,c,d=!1;for(let f=t.firstChild;f;f=f.nextSibling){let t=Ut(f);for(let u=0;u<t.length;u++){let p=t[u];o&&Yi(o,p)&&(p=Xi(Qi(p,o.bottom),o.top));let m=Ui(e,p),g=Gi(i,p);if(0==m&&0==g)return 3==f.nodeType?Zi(f,e,i):Ji(f,e,i);(!n||r>g||r==g&&s>m)&&(n=f,o=p,s=m,r=g,d=!m||(e<p.left?u>0:u<t.length-1)),0==m?i>p.bottom&&(!h||h.bottom<p.bottom)?(l=f,h=p):i<p.top&&(!c||c.top>p.top)&&(a=f,c=p):h&&Yi(h,p)?h=Qi(h,p.bottom):c&&Yi(c,p)&&(c=Xi(c,p.top))}}if(h&&h.bottom>=i?(n=l,o=h):c&&c.top<=i&&(n=a,o=c),!n)return{node:t,offset:0};let f=Math.max(o.left,Math.min(o.right,e));return 3==n.nodeType?Zi(n,f,i):d&&"false"!=n.contentEditable?Ji(n,f,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(o.left+o.right)/2?1:0)}}function Zi(t,e,i){let n=t.nodeValue.length,o=-1,s=1e9,r=0;for(let l=0;l<n;l++){let n=re(t,l,l+1).getClientRects();for(let a=0;a<n.length;a++){let h=n[a];if(h.top==h.bottom)continue;r||(r=e-h.left);let c=(h.top>i?h.top-i:i-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&c<s){let i=e>=(h.left+h.right)/2,n=i;if(qt.chrome||qt.gecko){let e=re(t,l).getBoundingClientRect();Math.abs(e.left-h.right)<.1&&(n=!i)}if(c<=0)return{node:t,offset:l+(n?1:0)};o=l+(n?1:0),s=c}}}return{node:t,offset:o>-1?o:r>0?t.nodeValue.length:0}}function tn(t,e,i,n=-1){var o,s;let r,l=t.contentDOM.getBoundingClientRect(),a=l.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:d}=e,f=d-a;if(f<0)return 0;if(f>h)return t.state.doc.length;for(let e=t.viewState.heightOracle.textHeight/2,o=!1;r=t.elementAtHeight(f),r.type!=Pe.Text;)for(;f=n>0?r.bottom+e:r.top-e,!(f>=0&&f<=h);){if(o)return i?null:0;o=!0,n=-n}d=a+f;let u=r.from;if(u<t.viewport.from)return 0==t.viewport.from?0:i?null:en(t,l,r,c,d);if(u>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:en(t,l,r,c,d);let p=t.dom.ownerDocument,m=t.root.elementFromPoint?t.root:p,g=m.elementFromPoint(c,d);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(l.left+1,Math.min(l.right-1,c)),g=m.elementFromPoint(c,d),g&&!t.contentDOM.contains(g)&&(g=null));let w,v=-1;if(g&&0!=(null===(o=t.docView.nearest(g))||void 0===o?void 0:o.isEditable)){if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,d);t&&({offsetNode:w,offset:v}=t)}else if(p.caretRangeFromPoint){let t=p.caretRangeFromPoint(c,d);t&&({startContainer:w,startOffset:v}=t)}w&&(!t.contentDOM.contains(w)||qt.safari&&function(t,e,i){return nn(t,e,i)}(w,v,c)||qt.chrome&&function(t,e,i){if(0!=e)return nn(t,e,i);for(let e=t;;){let t=e.parentNode;if(!t||1!=t.nodeType||t.firstChild!=e)return!1;if(t.classList.contains("cm-line"))break;e=t}let n=1==t.nodeType?t.getBoundingClientRect():re(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(w,v,c))&&(w=void 0),w&&(v=Math.min(Jt(w),v))}if(!w||!t.docView.dom.contains(w)){let e=Fe.find(t.docView,u);if(!e)return f>r.top+r.height/2?r.to:r.from;({node:w,offset:v}=Ji(e.dom,c,d))}let b=t.docView.nearest(w);if(!b)return null;if(b.isWidget&&1==(null===(s=b.dom)||void 0===s?void 0:s.nodeType)){let t=b.dom.getBoundingClientRect();return e.y<t.top||e.y<=t.bottom&&e.x<=(t.left+t.right)/2?b.posAtStart:b.posAtEnd}return b.localPosFromDOM(w,v)+b.posAtStart}function en(t,e,i,n,o){let s=Math.round((n-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&i.height>1.5*t.defaultLineHeight){let e=t.viewState.heightOracle.textHeight;s+=Math.floor((o-i.top-.5*(t.defaultLineHeight-e))/e)*t.viewState.heightOracle.lineLength}let r=t.state.sliceDoc(i.from,i.to);return i.from+f(r,s,t.state.tabSize)}function nn(t,e,i){let n,o=t;if(3!=t.nodeType||e!=(n=t.nodeValue.length))return!1;for(;;){let t=o.nextSibling;if(t){if("BR"==t.nodeName)break;return!1}{let t=o.parentNode;if(!t||"DIV"==t.nodeName)break;o=t}}return re(t,n-1,n).getBoundingClientRect().right>i}function on(t,e,i){let n=t.lineBlockAt(e);if(Array.isArray(n.type)){let t;for(let o of n.type){if(o.from>e)break;if(!(o.to<e)){if(o.from<e&&o.to>e)return o;t&&(o.type!=Pe.Text||t.type==o.type&&!(i<0?o.from<e:o.to>e))||(t=o)}}return t||n}return n}function sn(t,e,i,n){let o=t.state.doc.lineAt(e.head),s=t.bidiSpans(o),r=t.textDirectionAt(o.from);for(let l=e,a=null;;){let e=hi(o,s,r,l,i),h=ai;if(!e){if(o.number==(i?t.state.doc.lines:1))return l;h="\n",o=t.state.doc.line(o.number+(i?1:-1)),s=t.bidiSpans(o),e=t.visualLineSide(o,!i)}if(a){if(!a(h))return l}else{if(!n)return e;a=n(h)}l=e}}function rn(t,e,i){for(;;){let n=0;for(let o of t)o.between(e-1,e+1,(t,o,s)=>{if(e>t&&e<o){let s=n||i||(e-t<o-e?-1:1);e=s<0?t:o,n=s}});if(!n)return e}}function ln(t,e){let i=null;for(let n=0;n<e.ranges.length;n++){let o=e.ranges[n],r=null;if(o.empty){let e=rn(t,o.from,0);e!=o.from&&(r=s.cursor(e,-1))}else{let e=rn(t,o.from,-1),i=rn(t,o.to,1);e==o.from&&i==o.to||(r=s.range(o.from==o.anchor?e:i,o.from==o.head?e:i))}r&&(i||(i=e.ranges.slice()),i[n]=r)}return i?s.create(i,e.mainIndex):e}function an(t,e,i){let n=rn(t.state.facet(ji).map(e=>e(t)),i.from,e.head>i.from?-1:1);return n==i.from?i:s.cursor(n,n<i.from?1:-1)}const hn="";class cn{constructor(e,i){this.points=e,this.text="",this.lineSeparator=i.facet(t.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=hn}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let n=t;;){this.findPointBefore(i,n);let t=this.text.length;this.readNode(n);let o=n.nextSibling;if(o==e)break;let s=pe.get(n),r=pe.get(o);(s&&r?s.breakAfter:(s?s.breakAfter:Xt(n))||Xt(o)&&("BR"!=n.nodeName||n.cmIgnore)&&this.text.length>t)&&!fn(o,e)&&this.lineBreak(),n=o}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let o,s=-1,r=1;if(this.lineSeparator?(s=e.indexOf(this.lineSeparator,i),r=this.lineSeparator.length):(o=n.exec(e))&&(s=o.index,r=o[0].length),this.append(e.slice(i,s<0?e.length:s)),s<0)break;if(this.lineBreak(),r>1)for(let e of this.points)e.node==t&&e.pos>this.text.length&&(e.pos-=r-1);i=s+r}}readNode(t){if(t.cmIgnore)return;let e=pe.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(let t=i.iter();!t.next().done;)t.lineBreak?this.lineBreak():this.append(t.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(3==t.nodeType?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+(dn(t,i.node,i.offset)?e:0))}}function dn(t,e,i){for(;;){if(!e||i<Jt(e))return!1;if(e==t)return!0;i=Yt(e)+1,e=e.parentNode}}function fn(t,e){let i;for(;t!=e&&t;t=t.nextSibling){let e=pe.get(t);if(!(null==e?void 0:e.isWidget)&&!t.cmIgnore)return!1;e&&(i||(i=[])).push(e)}if(i)for(let t of i){let e=t.overrideDOMText;if(null==e?void 0:e.length)return!1}return!0}class un{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class pn{constructor(t,e,i,n){this.typeOver=n,this.bounds=null,this.text="",this.domChanged=e>-1;let{impreciseHead:o,impreciseAnchor:r}=t.docView;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){let e=o||r?[]:function(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:o,focusOffset:s}=t.observer.selectionRange;i&&(e.push(new un(i,n)),o==i&&s==n||e.push(new un(o,s)));return e}(t),i=new cn(e,t.state);i.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=i.text,this.newSel=function(t,e){if(0==t.length)return null;let i=t[0].pos,n=2==t.length?t[1].pos:i;return i>-1&&n>-1?s.single(i+e,n+e):null}(e,this.bounds.from)}else{let e=t.observer.selectionRange,i=o&&o.node==e.focusNode&&o.offset==e.focusOffset||!Kt(t.contentDOM,e.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(e.focusNode,e.focusOffset),n=r&&r.node==e.anchorNode&&r.offset==e.anchorOffset||!Kt(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset),l=t.viewport;if((qt.ios||qt.chrome)&&t.state.selection.main.empty&&i!=n&&(l.from>0||l.to<t.state.doc.length)){let e=Math.min(i,n),o=Math.max(i,n),s=l.from-e,r=l.to-o;0!=s&&1!=s&&0!=e||0!=r&&-1!=r&&o!=t.state.doc.length||(i=0,n=t.state.doc.length)}t.inputState.composing>-1&&t.state.selection.ranges.length>1?this.newSel=t.state.selection.replaceRange(s.range(n,i)):this.newSel=s.single(n,i)}}}function mn(t,e){let i,{newSel:n}=e,o=t.state.selection.main,r=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:n,to:s}=e.bounds,a=o.from,h=null;(8===r||qt.android&&e.text.length<s-n)&&(a=o.to,h="end");let c=wn(t.state.doc.sliceString(n,s,hn),e.text,a-n,h);c&&(qt.chrome&&13==r&&c.toB==c.from+2&&e.text.slice(c.from,c.toB)==hn+hn&&c.toB--,i={from:n+c.from,to:n+c.toA,insert:l.of(e.text.slice(c.from,c.toB).split(hn))})}else n&&(!t.hasFocus&&t.state.facet(Di)||n.main.eq(o))&&(n=null);if(!i&&!n)return!1;if(!i&&e.typeOver&&!o.empty&&n&&n.main.empty?i={from:o.from,to:o.to,insert:t.state.doc.slice(o.from,o.to)}:(qt.mac||qt.android)&&i&&i.from==i.to&&i.from==o.head-1&&/^\. ?$/.test(i.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(n&&2==i.insert.length&&(n=s.single(n.main.anchor-1,n.main.head-1)),i={from:i.from,to:i.to,insert:l.of([i.insert.toString().replace("."," ")])}):i&&i.from>=o.from&&i.to<=o.to&&(i.from!=o.from||i.to!=o.to)&&o.to-o.from-(i.to-i.from)<=4?i={from:o.from,to:o.to,insert:t.state.doc.slice(o.from,i.from).append(i.insert).append(t.state.doc.slice(i.to,o.to))}:t.state.doc.lineAt(o.from).to<o.to&&t.docView.lineHasWidget(o.to)&&t.inputState.insertingTextAt>Date.now()-50?i={from:o.from,to:o.to,insert:t.state.toText(t.inputState.insertingText)}:qt.chrome&&i&&i.from==i.to&&i.from==o.head&&"\n "==i.insert.toString()&&t.lineWrapping&&(n&&(n=s.single(n.main.anchor-1,n.main.head-1)),i={from:o.from,to:o.to,insert:l.of([" "])}),i)return gn(t,i,n,r);if(n&&!n.main.eq(o)){let e=!1,i="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(e=!0),i=t.inputState.lastSelectionOrigin,"select.pointer"==i&&(n=ln(t.state.facet(ji).map(e=>e(t)),n))),t.dispatch({selection:n,scrollIntoView:e,userEvent:i}),!0}return!1}function gn(t,e,i,n=-1){if(qt.ios&&t.inputState.flushIOSKey(e))return!0;let o=t.state.selection.main;if(qt.android&&(e.to==o.to&&(e.from==o.from||e.from==o.from-1&&" "==t.state.sliceDoc(e.from,o.from))&&1==e.insert.length&&2==e.insert.lines&&le(t.contentDOM,"Enter",13)||(e.from==o.from-1&&e.to==o.to&&0==e.insert.length||8==n&&e.insert.length<e.to-e.from&&e.to>o.head)&&le(t.contentDOM,"Backspace",8)||e.from==o.from&&e.to==o.to+1&&0==e.insert.length&&le(t.contentDOM,"Delete",46)))return!0;let r,l=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a=()=>r||(r=function(t,e,i){let n,o=t.state,r=o.selection.main,l=-1;if(e.from==e.to&&e.from<r.from||e.from>r.to){let i=e.from<r.from?-1:1,n=i<0?r.from:r.to,s=rn(o.facet(ji).map(e=>e(t)),n,i);e.from==s&&(l=s)}if(l>-1)n={changes:e,selection:s.cursor(e.from+e.insert.length,-1)};else if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let i=r.from<e.from?o.sliceDoc(r.from,e.from):"",s=r.to>e.to?o.sliceDoc(e.to,r.to):"";n=o.replaceSelection(t.state.toText(i+e.insert.sliceString(0,void 0,t.state.lineBreak)+s))}else{let l=o.changes(e),a=i&&i.main.to<=l.newLength?i.main:void 0;if(o.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=r.to+10&&e.to>=r.to-10){let h,c=t.state.sliceDoc(e.from,e.to),d=i&&Ki(t,i.main.head);if(d){let t=e.insert.length-(e.to-e.from);h={from:d.from,to:d.to-t}}else h=t.state.doc.lineAt(r.head);let f=r.to-e.to;n=o.changeByRange(i=>{if(i.from==r.from&&i.to==r.to)return{changes:l,range:a||i.map(l)};let n=i.to-f,d=n-c.length;if(t.state.sliceDoc(d,n)!=c||n>=h.from&&d<=h.to)return{range:i};let u=o.changes({from:d,to:n,insert:e.insert}),p=i.to-r.to;return{changes:u,range:a?s.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(u)}})}else n={changes:l,selection:a&&o.selection.replaceRange(a)}}let a="input.type";(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,a+=".compose",t.inputState.compositionFirstChange&&(a+=".start",t.inputState.compositionFirstChange=!1));return o.update(n,{userEvent:a,scrollIntoView:!0})}(t,e,i));return t.state.facet(gi).some(i=>i(t,e.from,e.to,l,a))||t.dispatch(a()),!0}function wn(t,e,i,n){let o=Math.min(t.length,e.length),s=0;for(;s<o&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==o&&t.length==e.length)return null;let r=t.length,l=e.length;for(;r>0&&l>0&&t.charCodeAt(r-1)==e.charCodeAt(l-1);)r--,l--;if("end"==n){i-=r+Math.max(0,s-Math.min(r,l))-s}if(r<s&&t.length<e.length){s-=i<=s&&i>=r?s-i:0,l=s+(l-r),r=s}else if(l<s){s-=i<=s&&i>=l?s-i:0,r=s+(r-l),l=s}return{from:s,toA:r,toB:l}}class vn{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,qt.safari&&t.contentDOM.addEventListener("input",()=>null),qt.gecko&&function(t){Kn.has(t)||(Kn.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}(t.contentDOM.ownerDocument)}handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i,n=e.target;n!=t.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(i=pe.get(n))&&i.ignoreEvent(e))return!1;return!0})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t)))}runHandlers(t,e){let i=this.handlers[t];if(i){for(let t of i.observers)t(this.view,e);for(let t of i.handlers){if(e.defaultPrevented)break;if(t(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=yn(t),i=this.handlers,n=this.view.contentDOM;for(let t in e)if("scroll"!=t){let o=!e[t].handlers.length,s=i[t];s&&o!=!s.handlers.length&&(n.removeEventListener(t,this.handleEvent),s=null),s||n.addEventListener(t,this.handleEvent,{passive:o})}for(let t in i)"scroll"==t||e[t]||n.removeEventListener(t,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=t.keyCode&&Sn.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),qt.android&&qt.chrome&&!t.synthetic&&(13==t.keyCode||8==t.keyCode))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return!qt.ios||t.synthetic||t.altKey||t.metaKey||!((e=xn.find(e=>e.keyCode==t.keyCode))&&!t.ctrlKey||kn.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0)}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&(!("Enter"==e.key&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString()))&&(this.pendingIOSKey=void 0,le(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0)))}ignoreDuringComposition(t){return!(!/^key/.test(t.type)||t.synthetic)&&(this.composing>0||!!(qt.safari&&!qt.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function bn(t,e){return(i,n)=>{try{return e.call(t,n,i)}catch(t){Mi(i.state,t)}}}function yn(t){let e=Object.create(null);function i(t){return e[t]||(e[t]={observers:[],handlers:[]})}for(let e of t){let t=e.spec,n=t&&t.plugin.domEventHandlers,o=t&&t.plugin.domEventObservers;if(n)for(let t in n){let o=n[t];o&&i(t).handlers.push(bn(e.value,o))}if(o)for(let t in o){let n=o[t];n&&i(t).observers.push(bn(e.value,n))}}for(let t in Mn)i(t).handlers.push(Mn[t]);for(let t in Dn)i(t).observers.push(Dn[t]);return e}const xn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],kn="dthko",Sn=[16,17,18,20,91,92,224,225];function Cn(t){return.7*Math.max(0,t)+8}class An{constructor(e,i,n,o){this.view=e,this.startEvent=i,this.style=n,this.mustSelect=o,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=i,this.scrollParents=function(t){let e,i,n=t.ownerDocument;for(let o=t.parentNode;o&&!(o==n.body||e&&i);)if(1==o.nodeType)!i&&o.scrollHeight>o.clientHeight&&(i=o),!e&&o.scrollWidth>o.clientWidth&&(e=o),o=o.assignedSlot||o.parentNode;else{if(11!=o.nodeType)break;o=o.host}return{x:e,y:i}}(e.contentDOM),this.atoms=e.state.facet(ji).map(t=>t(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=i.shiftKey,this.multiple=e.state.facet(t.allowMultipleSelections)&&function(t,e){let i=t.state.facet(di);return i.length?i[0](e):qt.mac?e.metaKey:e.ctrlKey}(e,i),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=_t(t.root);if(!n||0==n.rangeCount)return!0;let o=n.getRangeAt(0).getClientRects();for(let t=0;t<o.length;t++){let i=o[t];if(i.left<=e.clientX&&i.right>=e.clientX&&i.top<=e.clientY&&i.bottom>=e.clientY)return!0}return!1}(e,i)||1!=Vn(i))&&null}start(t){!1===this.dragging&&this.select(t)}move(t){if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(e=this.startEvent,i=t,Math.max(Math.abs(e.clientX-i.clientX),Math.abs(e.clientY-i.clientY))<10))return;var e,i;this.select(this.lastEvent=t);let n=0,o=0,s=0,r=0,l=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:a}=this.scrollParents.y.getBoundingClientRect());let h=Fi(this.view);t.clientX-h.left<=s+6?n=-Cn(s-t.clientX):t.clientX+h.right>=l-6&&(n=Cn(t.clientX-l)),t.clientY-h.top<=r+6?o=-Cn(r-t.clientY):t.clientY+h.bottom>=a-6&&(o=Cn(t.clientY-a)),this.setScrollSpeed(n,o)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:e}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),e&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=e,e=0),(t||e)&&this.view.win.scrollBy(t,e),!1===this.dragging&&this.select(this.lastEvent)}select(t){let{view:e}=this,i=ln(this.atoms,this.style.get(t,this.extend,this.multiple));!this.mustSelect&&i.eq(e.state.selection,!1===this.dragging)||this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}const Mn=Object.create(null),Dn=Object.create(null),Tn=qt.ie&&qt.ie_version<15||qt.ios&&qt.webkit_version<604;function On(t,e,i){for(let n of t.facet(e))i=n(i,t);return i}function Ln(t,e){e=On(t.state,vi,e);let i,{state:n}=t,o=1,r=n.toText(e),l=r.lines==n.selection.ranges.length;if(null!=zn&&n.selection.ranges.every(t=>t.empty)&&zn==r.toString()){let t=-1;i=n.changeByRange(i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let h=n.toText((l?r.line(o++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:h},range:s.cursor(i.from+h.length)}})}else i=l?n.changeByRange(t=>{let e=r.line(o++);return{changes:{from:t.from,to:t.to,insert:e.text},range:s.cursor(t.from+e.length)}}):n.replaceSelection(r);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function Bn(t,e,i,n){if(1==n)return s.cursor(e,i);if(2==n)return function(t,e,i=1){let n=t.charCategorizer(e),o=t.doc.lineAt(e),r=e-o.from;if(0==o.length)return s.cursor(e);0==r?i=1:r==o.length&&(i=-1);let l=r,a=r;i<0?l=c(o.text,r,!1):a=c(o.text,r);let h=n(o.text.slice(l,a));for(;l>0;){let t=c(o.text,l,!1);if(n(o.text.slice(t,l))!=h)break;l=t}for(;a<o.length;){let t=c(o.text,a);if(n(o.text.slice(a,t))!=h)break;a=t}return s.range(l+o.from,a+o.from)}(t.state,e,i);{let i=Fe.find(t.docView,e),n=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:n.from,r=i?i.posAtEnd:n.to;return r<t.state.doc.length&&r==n.to&&r++,s.range(o,r)}}Dn.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},Mn.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),27==e.keyCode&&0!=t.inputState.tabFocusMode&&(t.inputState.tabFocusMode=Date.now()+2e3),!1),Dn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Dn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},Mn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let n of t.state.facet(ui))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Rn(t,e),n=Vn(e),o=t.state.selection;return{update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),o=o.map(t.changes))},get(e,r,l){let a,h=Rn(t,e),c=Bn(t,h.pos,h.bias,n);if(i.pos!=h.pos&&!r){let e=Bn(t,i.pos,i.bias,n),o=Math.min(e.from,c.from),r=Math.max(e.to,c.to);c=o<c.from?s.range(o,r):s.range(r,o)}return r?o.replaceRange(o.main.extend(c.from,c.to)):l&&1==n&&o.ranges.length>1&&(a=function(t,e){for(let i=0;i<t.ranges.length;i++){let{from:n,to:o}=t.ranges[i];if(n<=e&&o>=e)return s.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}(o,h.pos))?a:l?o.addRange(c):s.create([c])}}}(t,e)),i){let n=!t.hasFocus;t.inputState.startMouseSelection(new An(t,e,i,n)),n&&t.observer.ignore(()=>{se(t.contentDOM);let e=t.root.activeElement;e&&!e.contains(t.contentDOM)&&e.blur()});let o=t.inputState.mouseSelection;if(o)return o.start(e),!1===o.dragging}else t.inputState.setSelectionOrigin("select.pointer");return!1};let En=(t,e,i)=>e>=i.top&&e<=i.bottom&&t>=i.left&&t<=i.right;function Pn(t,e,i,n){let o=Fe.find(t.docView,e);if(!o)return 1;let s=e-o.posAtStart;if(0==s)return 1;if(s==o.length)return-1;let r=o.coordsAt(s,-1);if(r&&En(i,n,r))return-1;let l=o.coordsAt(s,1);return l&&En(i,n,l)?1:r&&r.bottom>=n?-1:1}function Rn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:Pn(t,i,e.clientX,e.clientY)}}const Nn=qt.ie&&qt.ie_version<=11;let jn=null,Hn=0,In=0;function Vn(t){if(!Nn)return t.detail;let e=jn,i=In;return jn=t,In=Date.now(),Hn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Hn+1)%3:1}function Fn(t,e,i,n){if(!(i=On(t.state,vi,i)))return;let o=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,r=n&&s&&function(t,e){let i=t.state.facet(fi);return i.length?i[0](e):qt.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:s.from,to:s.to}:null,l={from:o,insert:i},a=t.state.changes(r?[r,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(o,-1),head:a.mapPos(o,1)},userEvent:r?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Mn.dragstart=(t,e)=>{let{selection:{main:i}}=t.state;if(e.target.draggable){let n=t.docView.nearest(e.target);if(n&&n.isWidget){let t=n.posAtStart,e=t+n.length;(t>=i.to||e<=i.from)&&(i=s.range(t,e))}}let{inputState:n}=t;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",On(t.state,bi,t.state.sliceDoc(i.from,i.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Mn.dragend=t=>(t.inputState.draggedContent=null,!1),Mn.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let n=Array(i.length),o=0,s=()=>{++o==i.length&&Fn(t,e,n.filter(t=>null!=t).join(t.state.lineBreak),!1)};for(let t=0;t<i.length;t++){let e=new FileReader;e.onerror=s,e.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(n[t]=e.result),s()},e.readAsText(i[t])}return!0}{let i=e.dataTransfer.getData("Text");if(i)return Fn(t,e,i,!0),!0}return!1},Mn.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=Tn?null:e.clipboardData;return i?(Ln(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(function(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(()=>{t.focus(),i.remove(),Ln(t,i.value)},50)}(t),!1)};let zn=null;Mn.copy=Mn.cut=(t,e)=>{let{text:i,ranges:n,linewise:o}=function(t){let e=[],i=[],n=!1;for(let n of t.selection.ranges)n.empty||(e.push(t.sliceDoc(n.from,n.to)),i.push(n));if(!e.length){let o=-1;for(let{from:n}of t.selection.ranges){let s=t.doc.lineAt(n);s.number>o&&(e.push(s.text),i.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),o=s.number}n=!0}return{text:On(t,bi,e.join(t.lineBreak)),ranges:i,linewise:n}}(t.state);if(!i&&!o)return!1;zn=o?i:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let s=Tn?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",i),!0):(function(t,e){let i=t.dom.parentNode;if(!i)return;let n=i.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),t.focus()},50)}(t,i),!1)};const Wn=o.define();function qn(t,e){let i=[];for(let n of t.facet(wi)){let o=n(t,e);o&&i.push(o)}return i.length?t.update({effects:i,annotations:Wn.of(!0)}):null}function _n(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=qn(t.state,e);i?t.dispatch(i):t.update([])}},10)}Dn.focus=t=>{t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),_n(t)},Dn.blur=t=>{t.observer.clearSelectionRange(),_n(t)},Dn.compositionstart=Dn.compositionupdate=t=>{t.observer.editContext||(null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))},Dn.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,qt.chrome&&qt.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))},Dn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Mn.beforeinput=(t,e)=>{var i,n;if("insertText"!=e.inputType&&"insertCompositionText"!=e.inputType||(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),"insertReplacementText"==e.inputType&&t.observer.editContext){let n=null===(i=e.dataTransfer)||void 0===i?void 0:i.getData("text/plain"),o=e.getTargetRanges();if(n&&o.length){let e=o[0],i=t.posAtDOM(e.startContainer,e.startOffset),s=t.posAtDOM(e.endContainer,e.endOffset);return gn(t,{from:i,to:s,insert:t.state.toText(n)},null),!0}}let o;if(qt.chrome&&qt.android&&(o=xn.find(t=>t.inputType==e.inputType))&&(t.observer.delayAndroidKey(o.key,o.keyCode),"Backspace"==o.key||"Delete"==o.key)){let e=(null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0;setTimeout(()=>{var i;((null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0)>e+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return qt.ios&&"deleteContentForward"==e.inputType&&t.observer.flushSoon(),qt.safari&&"insertText"==e.inputType&&t.inputState.composing>=0&&setTimeout(()=>Dn.compositionend(t,e),20),!1};const Kn=new Set;const $n=["pre-wrap","normal","pre-line","break-spaces"];let Un=!1;function Gn(){Un=!1}class Yn{constructor(t){this.lineWrapping=t,this.doc=l.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return $n.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i<t.length;i++){let n=t[i];n<0?i++:this.heightSamples[Math.floor(10*n)]||(e=!0,this.heightSamples[Math.floor(10*n)]=!0)}return e}refresh(t,e,i,n,o,s){let r=$n.indexOf(t)>-1,l=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=e,this.charWidth=i,this.textHeight=n,this.lineLength=o,l){this.heightSamples={};for(let t=0;t<s.length;t++){let e=s[t];e<0?t++:this.heightSamples[Math.floor(10*e)]=!0}}return l}}class Xn{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}}class Qn{constructor(t,e,i,n,o){this.from=t,this.length=e,this.top=i,this.height=n,this._content=o}get type(){return"number"==typeof this._content?Pe.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof He?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(t){let e=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new Qn(this.from,this.length+t.length,this.top,this.height+t.height,e)}}var Jn=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Jn||(Jn={}));const Zn=.001;class to{constructor(t,e,i=2){this.length=t,this.height=e,this.flags=i}get outdated(){return(2&this.flags)>0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>Zn&&(Un=!0),this.height=t)}replace(t,e,i){return to.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,n){let o=this,s=i.doc;for(let r=n.length-1;r>=0;r--){let{fromA:l,toA:a,fromB:h,toB:c}=n[r],d=o.lineAt(l,Jn.ByPosNoHeight,i.setDoc(e),0,0),f=d.to>=a?d:o.lineAt(a,Jn.ByPosNoHeight,i,0,0);for(c+=f.to-a,a=f.to;r>0&&d.from<=n[r-1].toA;)l=n[r-1].fromA,h=n[r-1].fromB,r--,l<d.from&&(d=o.lineAt(l,Jn.ByPosNoHeight,i,0,0));h+=d.from-l,l=d.from;let u=lo.build(i.setDoc(s),t,h,c);o=eo(o,o.replace(l,a,u))}return o.updateHeight(i,0)}static empty(){return new no(0,0)}static of(t){if(1==t.length)return t[0];let e=0,i=t.length,n=0,o=0;for(;;)if(e==i)if(n>2*o){let o=t[e-1];o.break?t.splice(--e,1,o.left,null,o.right):t.splice(--e,1,o.left,o.right),i+=1+o.break,n-=o.size}else{if(!(o>2*n))break;{let e=t[i];e.break?t.splice(i,1,e.left,null,e.right):t.splice(i,1,e.left,e.right),i+=2+e.break,o-=e.size}}else if(n<o){let i=t[e++];i&&(n+=i.size)}else{let e=t[--i];e&&(o+=e.size)}let s=0;return null==t[e-1]?(s=1,e--):null==t[e]&&(s=1,i++),new so(to.of(t.slice(0,e)),s,to.of(t.slice(i)))}}function eo(t,e){return t==e?t:(t.constructor!=e.constructor&&(Un=!0),e)}to.prototype.size=1;class io extends to{constructor(t,e,i){super(t,e),this.deco=i}blockAt(t,e,i,n){return new Qn(n,this.length,i,this.height,this.deco||0)}lineAt(t,e,i,n,o){return this.blockAt(0,i,n,o)}forEachLine(t,e,i,n,o,s){t<=o+this.length&&e>=o&&s(this.blockAt(0,i,n,o))}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more&&this.setHeight(n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class no extends io{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,i,n){return new Qn(n,this.length,i,this.height,this.breaks)}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof no||n instanceof oo&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof oo?n=new no(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):to.of(i)}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more?this.setHeight(n.heights[n.index++]):(i||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class oo extends to{constructor(t){super(t,0)}heightMetrics(t,e){let i,n=t.doc.lineAt(e).number,o=t.doc.lineAt(e+this.length).number,s=o-n+1,r=0;if(t.lineWrapping){let e=Math.min(this.height,t.lineHeight*s);i=e/s,this.length>s+1&&(r=(this.height-e)/(this.length-s-1))}else i=this.height/s;return{firstLine:n,lastLine:o,perLine:i,perChar:r}}blockAt(t,e,i,n){let{firstLine:o,lastLine:s,perLine:r,perChar:l}=this.heightMetrics(e,n);if(e.lineWrapping){let o=n+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length)),s=e.doc.lineAt(o),a=r+s.length*l,h=Math.max(i,t-a/2);return new Qn(s.from,s.length,h,a,0)}{let n=Math.max(0,Math.min(s-o,Math.floor((t-i)/r))),{from:l,length:a}=e.doc.line(o+n);return new Qn(l,a,i+r*n,r,0)}}lineAt(t,e,i,n,o){if(e==Jn.ByHeight)return this.blockAt(t,i,n,o);if(e==Jn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Qn(e,n-e,0,0,0)}let{firstLine:s,perLine:r,perChar:l}=this.heightMetrics(i,o),a=i.doc.lineAt(t),h=r+a.length*l,c=a.number-s,d=n+r*c+l*(a.from-o-c);return new Qn(a.from,a.length,Math.max(n,Math.min(d,n+this.height-h)),h,0)}forEachLine(t,e,i,n,o,s){t=Math.max(t,o),e=Math.min(e,o+this.length);let{firstLine:r,perLine:l,perChar:a}=this.heightMetrics(i,o);for(let h=t,c=n;h<=e;){let e=i.doc.lineAt(h);if(h==t){let i=e.number-r;c+=l*i+a*(t-o-i)}let n=l+a*e.length;s(new Qn(e.from,e.length,c,n,0)),c+=n,h=e.to+1}}replace(t,e,i){let n=this.length-e;if(n>0){let t=i[i.length-1];t instanceof oo?i[i.length-1]=new oo(t.length+n):i.push(null,new oo(n-1))}if(t>0){let e=i[0];e instanceof oo?i[0]=new oo(t+e.length):i.unshift(new oo(t-1),null)}return to.of(i)}decomposeLeft(t,e){e.push(new oo(t-1),null)}decomposeRight(t,e){e.push(null,new oo(this.length-t-1))}updateHeight(t,e=0,i=!1,n){let o=e+this.length;if(n&&n.from<=e+this.length&&n.more){let i=[],s=Math.max(e,n.from),r=-1;for(n.from>e&&i.push(new oo(n.from-e-1).updateHeight(t,e));s<=o&&n.more;){let e=t.doc.lineAt(s).length;i.length&&i.push(null);let o=n.heights[n.index++];-1==r?r=o:Math.abs(o-r)>=Zn&&(r=-2);let l=new no(e,o);l.outdated=!1,i.push(l),s+=e+1}s<=o&&i.push(null,new oo(o-s).updateHeight(t,s));let l=to.of(i);return(r<0||Math.abs(l.height-this.height)>=Zn||Math.abs(r-this.heightMetrics(t,e).perLine)>=Zn)&&(Un=!0),eo(this,l)}return(i||this.outdated)&&(this.setHeight(t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class so extends to{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return 1&this.flags}blockAt(t,e,i,n){let o=i+this.left.height;return t<o?this.left.blockAt(t,e,i,n):this.right.blockAt(t,e,o,n+this.left.length+this.break)}lineAt(t,e,i,n,o){let s=n+this.left.height,r=o+this.left.length+this.break,l=e==Jn.ByHeight?t<s:t<r,a=l?this.left.lineAt(t,e,i,n,o):this.right.lineAt(t,e,i,s,r);if(this.break||(l?a.to<r:a.from>r))return a;let h=e==Jn.ByPosNoHeight?Jn.ByPosNoHeight:Jn.ByPos;return l?a.join(this.right.lineAt(r,h,i,s,r)):this.left.lineAt(r,h,i,n,o).join(a)}forEachLine(t,e,i,n,o,s){let r=n+this.left.height,l=o+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,e,i,n,o,s),e>=l&&this.right.forEachLine(t,e,i,r,l,s);else{let a=this.lineAt(l,Jn.ByPos,i,n,o);t<a.from&&this.left.forEachLine(t,a.from-1,i,n,o,s),a.to>=t&&a.from<=e&&s(a),e>a.to&&this.right.forEachLine(a.to+1,e,i,r,l,s)}}replace(t,e,i){let n=this.left.length+this.break;if(e<n)return this.balanced(this.left.replace(t,e,i),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,i));let o=[];t>0&&this.decomposeLeft(t,o);let s=o.length;for(let t of i)o.push(t);if(t>0&&ro(o,s-1),e<this.length){let t=o.length;this.decomposeRight(e,o),ro(o,t)}return to.of(o)}decomposeLeft(t,e){let i=this.left.length;if(t<=i)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&(i++,t>=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,n=i+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t<i&&this.left.decomposeRight(t,e),this.break&&t<n&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?to.of(this.break?[t,null,e]:[t,e]):(this.left=eo(this.left,t),this.right=eo(this.right,e),this.setHeight(t.height+e.height),this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,n){let{left:o,right:s}=this,r=e+o.length+this.break,l=null;return n&&n.from<=e+o.length&&n.more?l=o=o.updateHeight(t,e,i,n):o.updateHeight(t,e,i),n&&n.from<=r+s.length&&n.more?l=s=s.updateHeight(t,r,i,n):s.updateHeight(t,r,i),l?this.balanced(o,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function ro(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof oo&&(n=t[e+1])instanceof oo&&t.splice(e-1,3,new oo(i.length+1+n.length))}class lo{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let t=Math.min(e,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof no?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new no(t-this.pos,-1)),this.writtenTo=t,e>t&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t<e||i.heightRelevant){let n=i.widget?i.widget.estimatedHeight:0,o=i.widget?i.widget.lineBreaks:0;n<0&&(n=this.oracle.lineHeight);let s=e-t;i.block?this.addBlock(new io(s,n,i)):(s||o||n>=5)&&this.addLineDeco(n,o,s)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTo<t&&((this.writtenTo<t-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new no(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new oo(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof no)return t;let e=new no(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+i}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof no||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new no(0,-1));let i=t;for(let t of this.nodes)t instanceof no&&t.updateHeight(this.oracle,i),i+=t?t.length:1;return this.nodes}static build(t,e,i,n){let o=new lo(i,t);return h.spans(e,i,n,o,0),o.finish(i)}}class ao{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,i,n){(t<e||i&&i.heightRelevant||n&&n.heightRelevant)&&Ve(t,e,this.changes,5)}}function ho(t,e){let i=t.getBoundingClientRect(),n=t.ownerDocument,o=n.defaultView||window,s=Math.max(0,i.left),r=Math.min(o.innerWidth,i.right),l=Math.max(0,i.top),a=Math.min(o.innerHeight,i.bottom);for(let e=t.parentNode;e&&e!=n.body;)if(1==e.nodeType){let i=e,n=window.getComputedStyle(i);if((i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)&&"visible"!=n.overflow){let n=i.getBoundingClientRect();s=Math.max(s,n.left),r=Math.min(r,n.right),l=Math.max(l,n.top),a=Math.min(e==t.parentNode?o.innerHeight:a,n.bottom)}e="absolute"==n.position||"fixed"==n.position?i.offsetParent:i.parentNode}else{if(11!=e.nodeType)break;e=e.host}return{left:s-i.left,right:Math.max(s,r)-i.left,top:l-(i.top+e),bottom:Math.max(l,a)-(i.top+e)}}function co(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class fo{constructor(t,e,i,n){this.from=t,this.to=e,this.size=i,this.displaySize=n}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let n=t[i],o=e[i];if(n.from!=o.from||n.to!=o.to||n.size!=o.size)return!1}return!0}draw(t,e){return Re.replace({widget:new uo(this.displaySize*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}}class uo extends Ee{constructor(t,e){super(),this.size=t,this.vertical=e}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}}class po{constructor(t){this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=vo,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=$e.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let e=t.facet(Pi).some(t=>"function"!=typeof t&&"cm-lineWrapping"==t.class);this.heightOracle=new Yn(e),this.stateDeco=t.facet(Ri).filter(t=>"function"!=typeof t),this.heightMap=to.empty().applyChanges(this.stateDeco,l.empty,this.heightOracle.setDoc(t.doc),[new Wi(0,0,0,t.doc.length)]);for(let t=0;t<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());t++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Re.set(this.lineGaps.map(t=>t.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let n=i?e.head:e.anchor;if(!t.some(({from:t,to:e})=>n>=t&&n<=e)){let{from:e,to:i}=this.lineBlockAt(n);t.push(new mo(e,i))}}return this.viewports=t.sort((t,e)=>t.from-e.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?vo:new bo(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(yo(t,this.scaler))})}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ri).filter(t=>"function"!=typeof t);let n=t.changedRanges,o=Wi.extendWithRanges(n,function(t,e,i){let n=new ao;return h.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:a.empty(this.state.doc.length))),s=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Gn(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=s||Un)&&(t.flags|=2),r?(this.scrollAnchorPos=t.changes.mapPos(r.from,-1),this.scrollAnchorHeight=r.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=s);let l=o.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<l.from||e.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,t.flags|=this.updateForViewport(),(c||!t.changes.empty||2&t.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(xi)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,i=window.getComputedStyle(e),n=this.heightOracle,o=i.whiteSpace;this.defaultTextDirection="rtl"==i.direction?$e.RTL:$e.LTR;let s=this.heightOracle.mustRefreshForWrapping(o),r=e.getBoundingClientRect(),a=s||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let h=0,c=0;if(r.width&&r.height){let{scaleX:t,scaleY:i}=ee(e,r);(t>.005&&Math.abs(this.scaleX-t)>.005||i>.005&&Math.abs(this.scaleY-i)>.005)&&(this.scaleX=t,this.scaleY=i,h|=16,s=a=!0)}let d=(parseInt(i.paddingTop)||0)*this.scaleY,f=(parseInt(i.paddingBottom)||0)*this.scaleY;this.paddingTop==d&&this.paddingBottom==f||(this.paddingTop=d,this.paddingBottom=f,h|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(n.lineWrapping&&(a=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=16);let u=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=u&&(this.scrollAnchorHeight=-1,this.scrollTop=u),this.scrolledToBottom=he(t.scrollDOM);let p=(this.printing?co:ho)(e,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(a=!0)),!this.inView&&!this.scrollTarget&&!function(t){let e=t.getBoundingClientRect(),i=t.ownerDocument.defaultView||window;return e.left<i.innerWidth&&e.right>0&&e.top<i.innerHeight&&e.bottom>0}(t.dom))return 0;let v=r.width;if(this.contentDOMWidth==v&&this.editorHeight==t.scrollDOM.clientHeight||(this.contentDOMWidth=r.width,this.editorHeight=t.scrollDOM.clientHeight,h|=16),a){let e=t.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(e)&&(s=!0),s||n.lineWrapping&&Math.abs(v-this.contentDOMWidth)>n.charWidth){let{lineHeight:i,charWidth:r,textHeight:l}=t.docView.measureTextSize();s=i>0&&n.refresh(o,i,r,l,Math.max(5,v/r),e),s&&(t.docView.minWidth=0,h|=16)}m>0&&g>0?c=Math.max(m,g):m<0&&g<0&&(c=Math.min(m,g)),Gn();for(let i of this.viewports){let o=i.from==this.viewport.from?e:t.docView.measureVisibleLineHeights(i);this.heightMap=(s?to.empty().applyChanges(this.stateDeco,l.empty,this.heightOracle,[new Wi(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(n,0,s,new Xn(i.from,o))}Un&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return b&&(2&h&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(2&h||b)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,o=this.heightOracle,{visibleTop:s,visibleBottom:r}=this,l=new mo(n.lineAt(s-1e3*i,Jn.ByHeight,o,0,0).from,n.lineAt(r+1e3*(1-i),Jn.ByHeight,o,0,0).to);if(e){let{head:t}=e.range;if(t<l.from||t>l.to){let i,s=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),r=n.lineAt(t,Jn.ByPos,o,0,0);i="center"==e.y?(r.top+r.bottom)/2-s/2:"start"==e.y||"nearest"==e.y&&t<l.from?r.top:r.bottom-s,l=new mo(n.lineAt(i-500,Jn.ByHeight,o,0,0).from,n.lineAt(i+s+500,Jn.ByHeight,o,0,0).to)}}return l}mapViewport(t,e){let i=e.mapPos(t.from,-1),n=e.mapPos(t.to,1);return new mo(this.heightMap.lineAt(i,Jn.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(n,Jn.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:e},i=0){if(!this.inView)return!0;let{top:n}=this.heightMap.lineAt(t,Jn.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(e,Jn.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:r}=this;return(0==t||n<=s-Math.max(10,Math.min(-i,250)))&&(e==this.state.doc.length||o>=r+Math.max(10,Math.min(i,250)))&&n>s-2e3&&o<r+2e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let i=[];for(let n of t)e.touchesRange(n.from,n.to)||i.push(new fo(e.mapPos(n.from),e.mapPos(n.to),n.size,n.displaySize));return i}ensureLineGaps(t,e){let i=this.heightOracle.lineWrapping,n=i?1e4:2e3,o=n>>1,r=n<<1;if(this.defaultTextDirection!=$e.LTR&&!i)return[];let l=[],a=(n,r,h,c)=>{if(r-n<o)return;let d=this.state.selection.main,f=[d.from];d.empty||f.push(d.to);for(let t of f)if(t>n&&t<r)return a(n,t-10,h,c),void a(t+10,r,h,c);let u=function(t,e){for(let i of t)if(e(i))return i;return}(t,t=>t.from>=h.from&&t.to<=h.to&&Math.abs(t.from-n)<o&&Math.abs(t.to-r)<o&&!f.some(e=>t.from<e&&t.to>e));if(!u){if(r<h.to&&e&&i&&e.visibleRanges.some(t=>t.from<=r&&t.to>=r)){let t=e.moveToLineBoundary(s.cursor(r),!1,!0).head;t>n&&(r=t)}let t=this.gapSize(h,n,r,c);u=new fo(n,r,t,i||t<2e6?t:2e6)}l.push(u)},c=e=>{if(e.length<r||e.type!=Pe.Text)return;let o=function(t,e,i){let n=[],o=t,s=0;h.spans(i,t,e,{span(){},point(t,e){t>o&&(n.push({from:o,to:t}),s+=t-o),o=e}},20),o<e&&(n.push({from:o,to:e}),s+=e-o);return{total:s,ranges:n}}(e.from,e.to,this.stateDeco);if(o.total<r)return;let s,l,c=this.scrollTarget?this.scrollTarget.range.head:null;if(i){let t,i,r=n/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=c){let n=wo(o,c),s=((this.visibleBottom-this.visibleTop)/2+r)/e.height;t=n-s,i=n+s}else t=(this.visibleTop-e.top-r)/e.height,i=(this.visibleBottom-e.top+r)/e.height;s=go(o,t),l=go(o,i)}else{let i=o.total*this.heightOracle.charWidth,r=n*this.heightOracle.charWidth,a=0;if(i>2e6)for(let i of t)i.from>=e.from&&i.from<e.to&&i.size!=i.displaySize&&i.from*this.heightOracle.charWidth+a<this.pixelViewport.left&&(a=i.size-i.displaySize);let h,d,f=this.pixelViewport.left+a,u=this.pixelViewport.right+a;if(null!=c){let t=wo(o,c),e=((u-f)/2+r)/i;h=t-e,d=t+e}else h=(f-r)/i,d=(u+r)/i;s=go(o,h),l=go(o,d)}s>e.from&&a(e.from,s,e,o),l<e.to&&a(l,e.to,e,o)};for(let t of this.viewportLines)Array.isArray(t.type)?t.type.forEach(c):c(t);return l}gapSize(t,e,i,n){let o=wo(n,i)-wo(n,e);return this.heightOracle.lineWrapping?t.height*o:n.total*this.heightOracle.charWidth*o}updateLineGaps(t){fo.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=Re.set(t.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let i=[];h.spans(e,this.viewport.from,this.viewport.to,{span(t,e){i.push({from:t,to:e})},point(){}},20);let n=0;if(i.length!=this.visibleRanges.length)n=12;else for(let e=0;e<i.length&&!(8&n);e++){let o=this.visibleRanges[e],s=i[e];o.from==s.from&&o.to==s.to||(n|=4,t&&t.mapPos(o.from,-1)==s.from&&t.mapPos(o.to,1)==s.to||(n|=8))}return this.visibleRanges=i,n}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||yo(this.heightMap.lineAt(t,Jn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(e=>e.top<=t&&e.bottom>=t)||yo(this.heightMap.lineAt(this.scaler.fromDOM(t),Jn.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return yo(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class mo{constructor(t,e){this.from=t,this.to=e}}function go({total:t,ranges:e},i){if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;let n=Math.floor(t*i);for(let t=0;;t++){let{from:i,to:o}=e[t],s=o-i;if(n<=s)return i+n;n-=s}}function wo(t,e){let i=0;for(let{from:n,to:o}of t.ranges){if(e<=o){i+=e-n;break}i+=o-n}return i/t.total}const vo={toDOM:t=>t,fromDOM:t=>t,scale:1,eq(t){return t==this}};class bo{constructor(t,e,i){let n=0,o=0,s=0;this.viewports=i.map(({from:i,to:o})=>{let s=e.lineAt(i,Jn.ByPos,t,0,0).top,r=e.lineAt(o,Jn.ByPos,t,0,0).bottom;return n+=r-s,{from:i,to:o,top:s,bottom:r,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(e.height-n);for(let t of this.viewports)t.domTop=s+(t.top-o)*this.scale,s=t.domBottom=t.domTop+(t.bottom-t.top),o=t.bottom}toDOM(t){for(let e=0,i=0,n=0;;e++){let o=e<this.viewports.length?this.viewports[e]:null;if(!o||t<o.top)return n+(t-i)*this.scale;if(t<=o.bottom)return o.domTop+(t-o.top);i=o.bottom,n=o.domBottom}}fromDOM(t){for(let e=0,i=0,n=0;;e++){let o=e<this.viewports.length?this.viewports[e]:null;if(!o||t<o.domTop)return i+(t-n)/this.scale;if(t<=o.domBottom)return o.top+(t-o.domTop);i=o.bottom,n=o.domBottom}}eq(t){return t instanceof bo&&(this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,i)=>e.from==t.viewports[i].from&&e.to==t.viewports[i].to))}}function yo(t,e){if(1==e.scale)return t;let i=e.toDOM(t.top),n=e.toDOM(t.bottom);return new Qn(t.from,t.length,i,n-i,Array.isArray(t._content)?t._content.map(t=>yo(t,e)):t._content)}const xo=i.define({combine:t=>t.join(" ")}),ko=i.define({combine:t=>t.indexOf(!0)>-1}),So=xt.newName(),Co=xt.newName(),Ao=xt.newName(),Mo={"&light":"."+Co,"&dark":"."+Ao};function Do(t,e,i){return new xt(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,e=>{if("&"==e)return t;if(!i||!i[e])throw new RangeError(`Unsupported selector: ${e}`);return i[e]}):t+" "+e})}const To=Do("."+So,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Mo),Oo={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Lo=qt.ie&&qt.ie_version<=11;class Bo{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new ie,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let t of e)this.queue.push(t);(qt.ie&&qt.ie_version<=11||qt.ios&&t.composing)&&e.some(t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length)?this.flushSoon():this.flush()}),!window.EditContext||!qt.android||!1===t.constructor.EDIT_CONTEXT||qt.chrome&&qt.chrome_version<126||(this.editContext=new Ro(t),t.state.facet(Di)&&(t.contentDOM.editContext=this.editContext.editContext)),Lo&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){("change"!=t.type&&t.type||t.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,i)=>e!=t[i]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(Di)?i.root.activeElement!=this.dom:!$t(this.dom,n))return;let o=n.anchorNode&&i.docView.nearest(n.anchorNode);o&&o.ignoreEvent(t)?e||(this.selectionChanged=!1):(qt.ie&&qt.ie_version<=11||qt.android&&qt.chrome)&&!i.state.selection.main.empty&&n.focusNode&&Gt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=_t(t.root);if(!e)return!1;let i=qt.safari&&11==t.root.nodeType&&t.root.activeElement==this.dom&&function(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Po(t,i)}let i=null;function n(t){t.preventDefault(),t.stopImmediatePropagation(),i=t.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",n,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",n,!0),i?Po(t,i):null}(this.view,e)||e;if(!i||this.selectionRange.eq(i))return!1;let n=$t(this.dom,i);return n&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&function(t,e){let i=e.focusNode,n=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=n)return!1;for(n=Math.min(n,Jt(i));;)if(n){if(1!=i.nodeType)return!1;let t=i.childNodes[n-1];"false"==t.contentEditable?n--:(i=t,n=Jt(i))}else{if(i==t)return!0;n=Yt(i),i=i.parentNode}}(this.dom,i)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(i),n&&(this.selectionChanged=!0),!0)}setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,e=null;for(let i=this.dom;i;)if(1==i.nodeType)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==i?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(i),i=i.assignedSlot||i.parentNode;else{if(11!=i.nodeType)break;i=i.host}if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);for(let t of this.scrollTargets=e)t.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Oo),Lo&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Lo&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,e){var i;if(!this.delayedAndroidKey){let t=()=>{let t=this.delayedAndroidKey;if(t){this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=t.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&t.force&&le(this.dom,t.key,t.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(t)}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(null===(i=this.delayedAndroidKey)||void 0===i?void 0:i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,i=-1,n=!1;for(let o of t){let t=this.readMutation(o);t&&(t.typeOver&&(n=!0),-1==e?({from:e,to:i}=t):(e=Math.min(t.from,e),i=Math.max(t.to,i)))}return{from:e,to:i,typeOver:n}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),n=this.selectionChanged&&$t(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new pn(this.view,t,e,i);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let i=this.view.state,n=mn(this.view,e);return this.view.state==i&&(e.domChanged||e.newSel&&!e.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),n}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.flags|=4),"childList"==t.type){let i=Eo(e,t.previousSibling||t.target.previousSibling,-1),n=Eo(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(Di)!=t.state.facet(Di)&&(t.view.contentDOM.editContext=t.state.facet(Di)?this.editContext.editContext:null))}destroy(){var t,e,i;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect();for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Eo(t,e,i){for(;e;){let n=pe.get(e);if(n&&n.parent==t)return n;let o=e.parentNode;e=o!=t.dom?o:i>0?e.nextSibling:e.previousSibling}return null}function Po(t,e){let i=e.startContainer,n=e.startOffset,o=e.endContainer,s=e.endOffset,r=t.docView.domAtPos(t.state.selection.main.anchor);return Gt(r.node,r.offset,o,s)&&([i,n,o,s]=[o,s,i,n]),{anchorNode:i,anchorOffset:n,focusNode:o,focusOffset:s}}class Ro{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let e=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=i=>{let n=t.state.selection.main,{anchor:o,head:r}=n,a=this.toEditorPos(i.updateRangeStart),h=this.toEditorPos(i.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:a,drifted:!1});let c=h-a>i.text.length;a==this.from&&o<this.from?a=o:h==this.to&&o>this.to&&(h=o);let d=wn(t.state.sliceDoc(a,h),i.text,(c?n.from:n.to)-a,c?"end":null);if(!d){let e=s.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));return void(e.main.eq(n)||t.dispatch({selection:e,userEvent:"select"}))}let f={from:d.from+a,to:d.toA+a,insert:l.of(i.text.slice(d.from,d.toB).split("\n"))};if((qt.mac||qt.android)&&f.from==r-1&&/^\. ?$/.test(i.text)&&"off"==t.contentDOM.getAttribute("autocorrect")&&(f={from:a,to:h,insert:l.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!t.state.readOnly){let e=this.to-this.from+(f.to-f.from+f.insert.length);gn(t,f,s.single(this.toEditorPos(i.selectionStart,e),this.toEditorPos(i.selectionEnd,e)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),f.from<f.to&&!f.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(e.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(e.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let n=[],o=null;for(let e=this.toEditorPos(i.rangeStart),s=this.toEditorPos(i.rangeEnd);e<s;e++){let i=t.coordsForChar(e);o=i&&new DOMRect(i.left,i.top,i.right-i.left,i.bottom-i.top)||o||new DOMRect,n.push(o)}e.updateCharacterBounds(i.rangeStart,n)},this.handlers.textformatupdate=e=>{let i=[];for(let t of e.getTextFormats()){let e=t.underlineStyle,n=t.underlineThickness;if(!/none/i.test(e)&&!/none/i.test(n)){let o=this.toEditorPos(t.rangeStart),s=this.toEditorPos(t.rangeEnd);if(o<s){let t=`text-decoration: underline ${/^[a-z]/.test(e)?e+" ":"Dashed"==e?"dashed ":"Squiggle"==e?"wavy ":""}${/thin/i.test(n)?1:2}px`;i.push(Re.mark({attributes:{style:t}}).range(o,s))}}}t.dispatch({effects:Ai.of(Re.set(i))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:e}=this.composing;this.composing=null,e&&this.reset(t.state)}};for(let t in this.handlers)e.addEventListener(t,this.handlers[t]);this.measureReq={read:t=>{this.editContext.updateControlBounds(t.contentDOM.getBoundingClientRect());let e=_t(t.root);e&&e.rangeCount&&this.editContext.updateSelectionBounds(e.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,i=!1,n=this.pendingContextChange;return t.changes.iterChanges((o,s,r,l,a)=>{if(i)return;let h=a.length-(s-o);if(n&&s>=n.to){if(n.from==o&&n.to==s&&n.insert.eq(a))return n=this.pendingContextChange=null,e+=h,void(this.to+=h);n=null,this.revertPending(t.state)}if(o+=e,(s+=e)<=this.from)this.from+=h,this.to+=h;else if(o<this.to){if(o<this.from||s>this.to||this.to-this.from+a.length>3e4)return void(i=!0);this.editContext.updateText(this.toContextPos(o),this.toContextPos(s),a.toString()),this.to+=h}e+=h}),n&&!i&&this.revertPending(t.state),!i}update(t){let e=this.pendingContextChange,i=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(i.from,i.to)&&t.transactions.some(t=>!t.isUserEvent("input.type")&&t.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):this.applyEdits(t)&&this.rangeIsValid(t.state)?(t.docChanged||t.selectionSet||e)&&this.setSelection(t.state):(this.pendingContextChange=null,this.reset(t.state)),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:e}=t.selection.main;this.from=Math.max(0,e-1e4),this.to=Math.min(t.doc.length,e+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let e=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(e.from),this.toContextPos(e.from+e.insert.length),t.doc.sliceString(e.from,e.to))}setSelection(t){let{main:e}=t.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,e.anchor))),n=this.toContextPos(e.head);this.editContext.selectionStart==i&&this.editContext.selectionEnd==n||this.editContext.updateSelection(i,n)}rangeIsValid(t){let{head:e}=t.selection.main;return!(this.from>0&&e-this.from<500||this.to<t.doc.length&&this.to-e<500||this.to-this.from>3e4)}toEditorPos(t,e=this.to-this.from){t=Math.min(t,e);let i=this.composing;return i&&i.drifted?i.editorBase+(t-i.contextBase):t+this.from}toContextPos(t){let e=this.composing;return e&&e.drifted?e.contextBase+(t-e.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class No{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var i;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(t=>t.forEach(t=>n(t,this)))||(t=>this.update(t)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(e.parent)||document,this.viewState=new po(e.state||t.create(e)),e.scrollTo&&e.scrollTo.is(Ci)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Oi).map(t=>new Bi(t));for(let t of this.plugins)t.update(this);this.observer=new Bo(this),this.inputState=new vn(this),this.inputState.ensureHandlers(this.plugins),this.docView=new _i(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(i=document.fonts)||void 0===i?void 0:i.ready)&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...t){let e=1==t.length&&t[0]instanceof n?t:1==t.length&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let i,n=!1,o=!1,r=this.state;for(let t of e){if(t.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=t.state}if(this.destroyed)return void(this.viewState.state=r);let l=this.hasFocus,a=0,h=null;e.some(t=>t.annotation(Wn))?(this.inputState.notifiedFocused=l,a=1):l!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=l,h=qn(r,l),h||(a=1));let c=this.observer.delayedAndroidKey,d=null;if(c?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(d=null)):this.observer.clear(),r.facet(t.phrases)!=this.state.facet(t.phrases))return this.setState(r);i=qi.create(this,r,e),i.flags|=a;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(f&&(f=f.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;f=new Si(e.empty?e:s.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(Ci)&&(f=e.value.clip(this.state))}this.viewState.update(i,f),this.bidiCache=Io.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(zi)!=this.styleModules&&this.mountStyles(),o=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(t=>t.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(xo)!=i.state.facet(xo)&&(this.viewState.mustMeasureContent=!0),(n||o||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let t of this.state.facet(mi))try{t(i)}catch(t){Mi(this.state,t,"update listener")}(h||d)&&Promise.resolve().then(()=>{h&&this.state==h.startState&&this.dispatch(h),d&&!mn(this,d)&&c.force&&le(this.contentDOM,c.key,c.keyCode)})}setState(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=t);this.updateState=2;let e=this.hasFocus;try{for(let t of this.plugins)t.destroy(this);this.viewState=new po(t),this.plugins=t.facet(Oi).map(t=>new Bi(t)),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView.destroy(),this.docView=new _i(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Oi),i=t.state.facet(Oi);if(e!=i){let n=[];for(let o of i){let i=e.indexOf(o);if(i<0)n.push(new Bi(o));else{let e=this.plugins[i];e.mustUpdate=t,n.push(e)}}for(let e of this.plugins)e.mustUpdate!=t&&e.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let e of this.plugins)e.mustUpdate=t;for(let t=0;t<this.plugins.length;t++)this.plugins[t].update(this);e!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let e=t.value;if(e&&e.docViewUpdate)try{e.docViewUpdate(this)}catch(t){Mi(this.state,t,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,i=this.scrollDOM,n=i.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:s}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let t=0;;t++){if(s<0)if(he(i))o=-1,s=this.viewState.heightMap.height;else{let t=this.viewState.scrollAnchorAt(n);o=t.from,s=t.top}this.updateState=1;let r=this.viewState.measure(this);if(!r&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(t>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];4&r||([this.measureRequests,l]=[l,this.measureRequests]);let a=l.map(t=>{try{return t.read(this)}catch(t){return Mi(this.state,t),Ho}}),h=qi.create(this,this.state,[]),c=!1;h.flags|=r,e?e.flags|=r:e=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),c=this.docView.update(h),c&&this.docViewUpdate());for(let t=0;t<l.length;t++)if(a[t]!=Ho)try{let e=l[t];e.write&&e.write(a[t],this)}catch(t){Mi(this.state,t)}if(c&&this.docView.updateSelection(!0),!h.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}{let t=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-s;if(t>1||t<-1){n+=t,i.scrollTop=n/this.scaleY,s=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(mi))t(e)}get themeClasses(){return So+" "+(this.state.facet(ko)?Ao:Co)+" "+this.state.facet(xo)}updateAttrs(){let t=Vo(this,Ei,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Di)?"true":"false",class:"cm-content",style:`${qt.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Vo(this,Pi,e);let i=this.observer.ignore(()=>{let i=Le(this.contentDOM,this.contentAttrs,e),n=Le(this.dom,this.editorAttrs,t);return i||n});return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let t of i.effects)if(t.is(No.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(zi);let t=this.state.facet(No.cspNonce);xt.mount(this.root,this.styleModules.concat(To).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(let e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===t.key)return void(this.measureRequests[e]=t);this.measureRequests.push(t)}}plugin(t){let e=this.pluginMap.get(t);return(void 0===e||e&&e.plugin!=t)&&this.pluginMap.set(t,e=this.plugins.find(e=>e.plugin==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return an(this,t,sn(this,t,e,i))}moveByGroup(t,e){return an(this,t,sn(this,t,e,e=>function(t,e,i){let n=t.state.charCategorizer(e),o=n(i);return t=>{let e=n(t);return o==v.Space&&(o=e),o==e}}(this,t.head,e)))}visualLineSide(t,e){let i=this.bidiSpans(t),n=this.textDirectionAt(t.from),o=i[e?i.length-1:0];return s.cursor(o.side(e,n)+t.from,o.forward(!e,n)?1:-1)}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let o=on(t,e.head,e.assoc||-1),r=n&&o.type==Pe.Text&&(t.lineWrapping||o.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>o.from?e.head-1:e.head):null;if(r){let e=t.dom.getBoundingClientRect(),n=t.textDirectionAt(o.from),l=t.posAtCoords({x:i==(n==$e.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=l)return s.cursor(l,i?-1:1)}return s.cursor(i?o.to:o.from,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return an(this,t,function(t,e,i,n){let o=e.head,r=i?1:-1;if(o==(i?t.state.doc.length:0))return s.cursor(o,e.assoc);let l,a=e.goalColumn,h=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(o,e.assoc||-1),d=t.documentTop;if(c)null==a&&(a=c.left-h.left),l=r<0?c.top:c.bottom;else{let e=t.viewState.lineBlockAt(o);null==a&&(a=Math.min(h.right-h.left,t.defaultCharacterWidth*(o-e.from))),l=(r<0?e.top:e.bottom)+d}let f=h.left+a,u=null!=n?n:t.viewState.heightOracle.textHeight>>1;for(let e=0;;e+=10){let i=l+(u+e)*r,n=tn(t,{x:f,y:i},!1,r);if(i<h.top||i>h.bottom||(r<0?n<o:n>o)){let e=t.docView.coordsForChar(n),o=!e||i<e.top?-1:1;return s.cursor(n,o,void 0,a)}}}(this,t,e,i))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),tn(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let n=this.state.doc.lineAt(t),o=this.bidiSpans(n);return Zt(i,o[ii.find(o,t-n.from,-1,e)].dir==$e.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(yi)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>jo)return li(t.length);let e,i=this.textDirectionAt(t.from);for(let n of this.bidiCache)if(n.from==t.from&&n.dir==i&&(n.fresh||ni(n.isolates,e=Ii(this,t))))return n.order;e||(e=Ii(this,t));let n=function(t,e,i){if(!t)return[new ii(0,0,e==Ge?1:0)];if(e==Ue&&!i.length&&!ei.test(t))return li(t.length);if(i.length)for(;t.length>oi.length;)oi[oi.length]=256;let n=[],o=e==Ue?0:1;return ri(t,o,o,i,0,t.length,n),n}(t.text,i,e);return this.bidiCache.push(new Io(t.from,t.to,i,e,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||qt.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{se(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return Ci.of(new Si("number"==typeof t?s.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return Ci.of(new Si(s.cursor(i.from),"start","start",i.top-t,e,!0))}setTabFocusMode(t){null==t?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof t?this.inputState.tabFocusMode=t?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return Li.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Li.define(()=>({}),{eventObservers:t})}static theme(t,e){let i=xt.newName(),n=[xo.of(i),zi.of(Do(`.${i}`,t))];return e&&e.dark&&n.push(ko.of(!0)),n}static baseTheme(t){return r.lowest(zi.of(Do("."+So,t,Mo)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&pe.get(i)||pe.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}No.styleModule=zi,No.inputHandler=gi,No.clipboardInputFilter=vi,No.clipboardOutputFilter=bi,No.scrollHandler=ki,No.focusChangeEffect=wi,No.perLineTextDirection=yi,No.exceptionSink=pi,No.updateListener=mi,No.editable=Di,No.mouseSelectionStyle=ui,No.dragMovesSelection=fi,No.clickAddsSelectionRange=di,No.decorations=Ri,No.outerDecorations=Ni,No.atomicRanges=ji,No.bidiIsolatedRanges=Hi,No.scrollMargins=Vi,No.darkTheme=ko,No.cspNonce=i.define({combine:t=>t.length?t[0]:""}),No.contentAttributes=Pi,No.editorAttributes=Ei,No.lineWrapping=No.contentAttributes.of({class:"cm-lineWrapping"}),No.announce=e.define();const jo=4096,Ho={};class Io{constructor(t,e,i,n,o,s){this.from=t,this.to=e,this.dir=i,this.isolates=n,this.fresh=o,this.order=s}static update(t,e){if(e.empty&&!t.some(t=>t.fresh))return t;let i=[],n=t.length?t[t.length-1].dir:$e.LTR;for(let o=Math.max(0,t.length-10);o<t.length;o++){let s=t[o];s.dir!=n||e.touchesRange(s.from,s.to)||i.push(new Io(e.mapPos(s.from,1),e.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return i}}function Vo(t,e,i){for(let n=t.state.facet(e),o=n.length-1;o>=0;o--){let e=n[o],s="function"==typeof e?e(t):e;s&&De(s,i)}return i}const Fo=qt.mac?"mac":qt.windows?"win":qt.linux?"linux":"key";function zo(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t}const Wo=r.default(No.domEventHandlers({keydown:(t,e)=>function(t,e,i,n){Uo=e;let o=function(t){var e=!(Mt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Dt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?At:Ct)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(e),s=m(o,0),r=g(s)==o.length&&" "!=o,l="",a=!1,h=!1,c=!1;Ko&&Ko.view==i&&Ko.scope==n&&(l=Ko.prefix+" ",Sn.indexOf(e.keyCode)<0&&(h=!0,Ko=null));let d,f,u=new Set,p=t=>{if(t){for(let e of t.run)if(!u.has(e)&&(u.add(e),e(i)))return t.stopPropagation&&(c=!0),!0;t.preventDefault&&(t.stopPropagation&&(c=!0),h=!0)}return!1},w=t[n];w&&(p(w[l+zo(o,e,!r)])?a=!0:!r||!(e.altKey||e.metaKey||e.ctrlKey)||qt.windows&&e.ctrlKey&&e.altKey||qt.mac&&e.altKey&&!e.ctrlKey&&!e.metaKey||!(d=Ct[e.keyCode])||d==o?r&&e.shiftKey&&p(w[l+zo(o,e,!0)])&&(a=!0):(p(w[l+zo(d,e,!0)])||e.shiftKey&&(f=At[e.keyCode])!=o&&f!=d&&p(w[l+zo(f,e,!1)]))&&(a=!0),!a&&p(w._any)&&(a=!0));h&&(a=!0);a&&c&&e.stopPropagation();return Uo=null,a}(function(t){let e=t.facet(qo),i=_o.get(e);i||_o.set(e,i=function(t,e=Fo){let i=Object.create(null),n=Object.create(null),o=(t,e)=>{let i=n[t];if(null==i)n[t]=e;else if(i!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},s=(t,n,s,r,l)=>{var a,h;let c=i[t]||(i[t]=Object.create(null)),d=n.split(/ (?!$)/).map(t=>function(t,e){const i=t.split(/-(?!$)/);let n,o,s,r,l=i[i.length-1];"Space"==l&&(l=" ");for(let t=0;t<i.length-1;++t){const l=i[t];if(/^(cmd|meta|m)$/i.test(l))r=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))s=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);"mac"==e?r=!0:o=!0}}return n&&(l="Alt-"+l),o&&(l="Ctrl-"+l),r&&(l="Meta-"+l),s&&(l="Shift-"+l),l}(t,e));for(let e=1;e<d.length;e++){let i=d.slice(0,e).join(" ");o(i,!0),c[i]||(c[i]={preventDefault:!0,stopPropagation:!1,run:[e=>{let n=Ko={view:e,prefix:i,scope:t};return setTimeout(()=>{Ko==n&&(Ko=null)},$o),!0}]})}let f=d.join(" ");o(f,!1);let u=c[f]||(c[f]={preventDefault:!1,stopPropagation:!1,run:(null===(h=null===(a=c._any)||void 0===a?void 0:a.run)||void 0===h?void 0:h.slice())||[]});s&&u.run.push(s),r&&(u.preventDefault=!0),l&&(u.stopPropagation=!0)};for(let n of t){let t=n.scope?n.scope.split(" "):["editor"];if(n.any)for(let e of t){let t=i[e]||(i[e]=Object.create(null));t._any||(t._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:o}=n;for(let e in t)t[e].run.push(t=>o(t,Uo))}let o=n[e]||n.key;if(o)for(let e of t)s(e,o,n.run,n.preventDefault,n.stopPropagation),n.shift&&s(e,"Shift-"+o,n.shift,n.preventDefault,n.stopPropagation)}return i}(e.reduce((t,e)=>t.concat(e),[])));return i}(e.state),t,e,"editor")})),qo=i.define({enables:Wo}),_o=new WeakMap;let Ko=null;const $o=4e3;let Uo=null;class Go{constructor(t,e,i,n,o){this.className=t,this.left=e,this.top=i,this.width=n,this.height=o}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let o=Yo(t);return[new Go(e,n.left-o.left,n.top-o.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),o=Math.min(i.to,t.viewport.to),s=t.textDirection==$e.LTR,r=t.contentDOM,l=r.getBoundingClientRect(),a=Yo(t),h=r.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),d=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),f=l.right-(c?parseInt(c.paddingRight):0),u=on(t,n,1),p=on(t,o,-1),m=u.type==Pe.Text?u:null,g=p.type==Pe.Text?p:null;m&&(t.lineWrapping||u.widgetLineBreaks)&&(m=Xo(t,n,1,m));g&&(t.lineWrapping||p.widgetLineBreaks)&&(g=Xo(t,o,-1,g));if(m&&g&&m.from==g.from&&m.to==g.to)return v(b(i.from,i.to,m));{let e=m?b(i.from,null,m):y(u,!1),n=g?b(null,i.to,g):y(p,!0),o=[];return(m||u).to<(g||p).from-(m&&g?1:0)||u.widgetLineBreaks>1&&e.bottom+t.defaultLineHeight/2<n.top?o.push(w(d,e.bottom,f,n.top)):e.bottom<n.top&&t.elementAtHeight((e.bottom+n.top)/2).type==Pe.Text&&(e.bottom=n.top=(e.bottom+n.top)/2),v(e).concat(o).concat(v(n))}function w(t,i,n,o){return new Go(e,t-a.left,i-a.top,n-t,o-i)}function v({top:t,bottom:e,horizontal:i}){let n=[];for(let o=0;o<i.length;o+=2)n.push(w(i[o],t,i[o+1],e));return n}function b(e,i,n){let o=1e9,r=-1e9,l=[];function a(e,i,a,h,c){let u=t.coordsAtPos(e,e==n.to?-2:2),p=t.coordsAtPos(a,a==n.from?2:-2);u&&p&&(o=Math.min(u.top,p.top,o),r=Math.max(u.bottom,p.bottom,r),c==$e.LTR?l.push(s&&i?d:u.left,s&&h?f:p.right):l.push(!s&&h?d:p.left,!s&&i?f:u.right))}let h=null!=e?e:n.from,c=null!=i?i:n.to;for(let n of t.visibleRanges)if(n.to>h&&n.from<c)for(let o=Math.max(n.from,h),s=Math.min(n.to,c);;){let n=t.state.doc.lineAt(o);for(let r of t.bidiSpans(n)){let t=r.from+n.from,l=r.to+n.from;if(t>=s)break;l>o&&a(Math.max(t,o),null==e&&t<=h,Math.min(l,s),null==i&&l>=c,r.dir)}if(o=n.to+1,o>=s)break}return 0==l.length&&a(h,null==e,c,null==i,t.textDirection),{top:o,bottom:r,horizontal:l}}function y(t,e){let i=l.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Yo(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==$e.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function Xo(t,e,i,n){let o=t.coordsAtPos(e,2*i);if(!o)return n;let s=t.dom.getBoundingClientRect(),r=(o.top+o.bottom)/2,l=t.posAtCoords({x:s.left+1,y:r}),a=t.posAtCoords({x:s.right-1,y:r});return null==l||null==a?n:{from:Math.max(n.from,Math.min(l,a)),to:Math.min(n.to,Math.max(l,a))}}class Qo{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Jo)!=t.state.facet(Jo)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){!1!==this.layer.updateOnDocViewUpdate&&t.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Jo);for(;e<i.length&&i[e]!=this.layer;)e++;this.dom.style.zIndex=String((this.layer.above?150:-1)-e)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:t,scaleY:e}=this.view;t==this.scaleX&&e==this.scaleY||(this.scaleX=t,this.scaleY=e,this.dom.style.transform=`scale(${1/t}, ${1/e})`)}draw(t){if(t.length!=this.drawn.length||t.some((t,e)=>{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n})){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t,qt.safari&&qt.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Jo=i.define();function Zo(t){return[Li.define(e=>new Qo(e,t)),Jo.of(t)]}const ts=i.define({combine:t=>u(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function es(t={}){return[ts.of(t),ns,ss,rs,xi.of(!0)]}function is(t){return t.startState.facet(ts)!=t.state.facet(ts)}const ns=Zo({above:!0,markers(t){let{state:e}=t,i=e.facet(ts),n=[];for(let o of e.selection.ranges){let r=o==e.selection.main;if(o.empty||i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=o.empty?o:s.cursor(o.head,o.head>o.anchor?-1:1);for(let o of Go.forRange(t,e,i))n.push(o)}}return n},update(t,e){t.transactions.some(t=>t.selection)&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=is(t);return i&&os(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){os(e.state,t)},class:"cm-cursorLayer"});function os(t,e){e.style.animationDuration=t.facet(ts).cursorBlinkRate+"ms"}const ss=Zo({above:!1,markers:t=>t.state.selection.ranges.map(e=>e.empty?[]:Go.forRange(t,"cm-selectionBackground",e)).reduce((t,e)=>t.concat(e)),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||is(t),class:"cm-selectionLayer"}),rs=r.highest(No.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),ls="-10000px";class as{constructor(t,e,i,n){this.facet=e,this.createTooltipView=i,this.removeTooltipView=n,this.input=t.state.facet(e),this.tooltips=this.input.filter(t=>t);let o=null;this.tooltipViews=this.tooltips.map(t=>o=i(t,o))}update(t,e){var i;let n=t.state.facet(this.facet),o=n.filter(t=>t);if(n===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[],r=e?[]:null;for(let i=0;i<o.length;i++){let n=o[i],l=-1;if(n){for(let t=0;t<this.tooltips.length;t++){let e=this.tooltips[t];e&&e.create==n.create&&(l=t)}if(l<0)s[i]=this.createTooltipView(n,i?s[i-1]:null),r&&(r[i]=!!n.above);else{let n=s[i]=this.tooltipViews[l];r&&(r[i]=e[l]),n.update&&n.update(t)}}}for(let t of this.tooltipViews)s.indexOf(t)<0&&(this.removeTooltipView(t),null===(i=t.destroy)||void 0===i||i.call(t));return e&&(r.forEach((t,i)=>e[i]=t),e.length=r.length),this.input=n,this.tooltips=o,this.tooltipViews=s,!0}}function hs(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const cs=i.define({combine:t=>{var e,i,n;return{position:qt.ios?"absolute":(null===(e=t.find(t=>t.position))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find(t=>t.parent))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find(t=>t.tooltipSpace))||void 0===n?void 0:n.tooltipSpace)||hs}}}),ds=new WeakMap,fs=Li.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(cs);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new as(t,gs,(t,e)=>this.createTooltip(t,e),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(cs);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t,e){let i=t.create(this.view),n=e?e.dom:null;if(i.dom.classList.add("cm-tooltip"),t.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",i.dom.appendChild(t)}return i.dom.style.position=this.position,i.dom.style.top=ls,i.dom.style.left="0px",this.container.insertBefore(i.dom,n),i.mount&&i.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(i.dom),i}destroy(){var t,e,i;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);this.parent&&this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(i=this.intersectionObserver)||void 0===i||i.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,i=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:t}=this.manager.tooltipViews[0];if(qt.safari){let e=t.getBoundingClientRect();i=Math.abs(e.top+1e4)>1||Math.abs(e.left)>1}else i=!!t.offsetParent&&t.offsetParent!=this.container.ownerDocument.body}if(i||"absolute"==this.position)if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let n=this.view.scrollDOM.getBoundingClientRect(),o=Fi(this.view);return{visible:{left:n.left+o.left,top:n.top+o.top,right:n.right-o.right,bottom:n.bottom-o.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)}),size:this.manager.tooltipViews.map(({dom:t})=>t.getBoundingClientRect()),space:this.view.state.facet(cs).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:i}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let t of this.manager.tooltipViews)t.dom.style.position="absolute"}let{visible:i,space:n,scaleX:o,scaleY:s}=t,r=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],h=this.manager.tooltipViews[l],{dom:c}=h,d=t.pos[l],f=t.size[l];if(!d||!1!==a.clip&&(d.bottom<=Math.max(i.top,n.top)||d.top>=Math.min(i.bottom,n.bottom)||d.right<Math.max(i.left,n.left)-.1||d.left>Math.min(i.right,n.right)+.1)){c.style.top=ls;continue}let u=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=u?7:0,m=f.right-f.left,g=null!==(e=ds.get(h))&&void 0!==e?e:f.bottom-f.top,w=h.offset||ms,v=this.view.textDirection==$e.LTR,b=f.width>n.right-n.left?v?n.left:n.right-f.width:v?Math.max(n.left,Math.min(d.left-(u?14:0)+w.x,n.right-m)):Math.min(Math.max(n.left,d.left-m+(u?14:0)-w.x),n.right-m),y=this.above[l];!a.strictSide&&(y?d.top-g-p-w.y<n.top:d.bottom+g+p+w.y>n.bottom)&&y==n.bottom-d.bottom>d.top-n.top&&(y=this.above[l]=!y);let x=(y?d.top-n.top:n.bottom-d.bottom)-p;if(x<g&&!1!==h.resize){if(x<this.view.defaultLineHeight){c.style.top=ls;continue}ds.set(h,g),c.style.height=(g=x)/s+"px"}else c.style.height&&(c.style.height="");let k=y?d.top-g-p-w.y:d.bottom+p+w.y,S=b+m;if(!0!==h.overlap)for(let t of r)t.left<S&&t.right>b&&t.top<k+g&&t.bottom>k&&(k=y?t.top-g-2-p:t.bottom+p+2);if("absolute"==this.position?(c.style.top=(k-t.parent.top)/s+"px",us(c,(b-t.parent.left)/o)):(c.style.top=k/s+"px",us(c,b/o)),u){let t=d.left+(v?w.x:-w.x)-(b+14-7);u.style.left=t/o+"px"}!0!==h.overlap&&r.push({left:b,top:k,right:S,bottom:k+g}),c.classList.toggle("cm-tooltip-above",y),c.classList.toggle("cm-tooltip-below",!y),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=ls}},{eventObservers:{scroll(){this.maybeMeasure()}}});function us(t,e){let i=parseInt(t.style.left,10);(isNaN(i)||Math.abs(e-i)>1)&&(t.style.left=e+"px")}const ps=No.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),ms={x:0,y:0},gs=i.define({enables:[fs,ps]}),ws=i.define({combine:t=>t.reduce((t,e)=>t.concat(e),[])});class vs{static create(t){return new vs(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new as(t,ws,(t,e)=>this.createHostedView(t,e),t=>t.dom.remove())}createHostedView(t,e){let i=t.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)null===(t=e.destroy)||void 0===t||t.call(e)}passProp(t){let e;for(let i of this.manager.tooltipViews){let n=i[t];if(void 0!==n)if(void 0===e)e=n;else if(e!==n)return}return e}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const bs=gs.compute([ws],t=>{let e=t.facet(ws);return 0===e.length?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var e;return null!==(e=t.end)&&void 0!==e?e:t.pos})),create:vs.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class ys{constructor(t,e,i,n,o){this.view=t,this.source=e,this.field=i,this.setHover=n,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:t,lastMove:e}=this,i=t.docView.nearest(e.target);if(!i)return;let n,o=1;if(i instanceof xe)n=i.posAtStart;else{if(n=t.posAtCoords(e),null==n)return;let i=t.coordsAtPos(n);if(!i||e.y<i.top||e.y>i.bottom||e.x<i.left-t.defaultCharacterWidth||e.x>i.right+t.defaultCharacterWidth)return;let s=t.bidiSpans(t.state.doc.lineAt(n)).find(t=>t.from<=n&&t.to>=n),r=s&&s.dir==$e.RTL?-1:1;o=e.x<i.left?-r:r}let s=this.source(t,n,o);if(null==s?void 0:s.then){let e=this.pending={pos:n};s.then(i=>{this.pending==e&&(this.pending=null,!i||Array.isArray(i)&&!i.length||t.dispatch({effects:this.setHover.of(Array.isArray(i)?i:[i])}))},e=>Mi(t.state,e,"hover tooltip"))}else!s||Array.isArray(s)&&!s.length||t.dispatch({effects:this.setHover.of(Array.isArray(s)?s:[s])})}get tooltip(){let t=this.view.plugin(fs),e=t?t.manager.tooltips.findIndex(t=>t.create==vs.create):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,i;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:o}=this;if(n.length&&o&&!function(t,e){let i,{left:n,right:o,top:s,bottom:r}=t.getBoundingClientRect();if(i=t.querySelector(".cm-tooltip-arrow")){let t=i.getBoundingClientRect();s=Math.min(t.top,s),r=Math.max(t.bottom,r)}return e.clientX>=n-xs&&e.clientX<=o+xs&&e.clientY>=s-xs&&e.clientY<=r+xs}(o.dom,t)||this.pending){let{pos:o}=n[0]||this.pending,s=null!==(i=null===(e=n[0])||void 0===e?void 0:e.end)&&void 0!==i?i:o;(o==s?this.view.posAtCoords(this.lastMove)==o:function(t,e,i,n,o){let s=t.scrollDOM.getBoundingClientRect(),r=t.documentTop+t.documentPadding.top+t.contentHeight;if(s.left>n||s.right<n||s.top>o||Math.min(s.bottom,r)<o)return!1;let l=t.posAtCoords({x:n,y:o},!1);return l>=e&&l<=i}(this.view,o,s,t.clientX,t.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:e}=this;e&&e.dom.contains(t.relatedTarget)?this.watchTooltipLeave(e.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=i=>{t.removeEventListener("mouseleave",e),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",e)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const xs=4;function ks(t,i={}){let n=e.define(),o=w.define({create:()=>[],update(t,e){if(t.length&&(i.hideOnChange&&(e.docChanged||e.selection)?t=[]:i.hideOn&&(t=t.filter(t=>!i.hideOn(e,t))),e.docChanged)){let i=[];for(let n of t){let t=e.changes.mapPos(n.pos,-1,p.TrackDel);if(null!=t){let o=Object.assign(Object.create(null),n);o.pos=t,null!=o.end&&(o.end=e.changes.mapPos(o.end)),i.push(o)}}t=i}for(let i of e.effects)i.is(n)&&(t=i.value),i.is(Ss)&&(t=[]);return t},provide:t=>ws.from(t)});return{active:o,extension:[o,Li.define(e=>new ys(e,t,o,n,i.hoverTime||300)),bs]}}const Ss=e.define(),Cs=i.define({combine(t){let e,i;for(let n of t)e=e||n.topContainer,i=i||n.bottomContainer;return{topContainer:e,bottomContainer:i}}});const As=Li.fromClass(class{constructor(t){this.input=t.state.facet(Ts),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(e=>e(t));let e=t.state.facet(Cs);this.top=new Ms(t,!0,e.topContainer),this.bottom=new Ms(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(t){let e=t.state.facet(Cs);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ms(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ms(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ts);if(i!=this.input){let e=i.filter(t=>t),n=[],o=[],s=[],r=[];for(let i of e){let e,l=this.specs.indexOf(i);l<0?(e=i(t.view),r.push(e)):(e=this.panels[l],e.update&&e.update(t)),n.push(e),(e.top?o:s).push(e)}this.specs=e,this.panels=n,this.top.sync(o),this.bottom.sync(s);for(let t of r)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}else for(let e of this.panels)e.update&&e.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>No.scrollMargins.of(e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}})});class Ms{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Ds(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Ds(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function Ds(t){let e=t.nextSibling;return t.remove(),e}const Ts=i.define({enables:As});class Os extends d{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Os.prototype.elementClass="",Os.prototype.toDOM=void 0,Os.prototype.mapMode=p.TrackBefore,Os.prototype.startSide=Os.prototype.endSide=-1,Os.prototype.point=!0;const Ls=i.define(),Bs=i.define(),Es={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>h.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Ps=i.define();function Rs(t){return[js(),Ps.of({...Es,...t})]}const Ns=i.define({combine:t=>t.some(t=>t)});function js(t){return[Hs]}const Hs=Li.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Ps).map(e=>new zs(t,e)),this.fixed=!t.state.facet(Ns);for(let t of this.gutters)"after"==t.config.side?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,i=t.view.viewport,n=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(n<.8*(i.to-i.from))}if(t.geometryChanged){let t=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=t,this.domAfter&&(this.domAfter.style.minHeight=t)}this.view.state.facet(Ns)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let i=h.iter(this.view.state.facet(Ls),this.view.viewport.from),n=[],o=this.gutters.map(t=>new Fs(t,this.view.viewport,-this.view.documentPadding.top));for(let t of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(t.type)){let e=!0;for(let s of t.type)if(s.type==Pe.Text&&e){Vs(i,n,s.from);for(let t of o)t.line(this.view,s,n);e=!1}else if(s.widget)for(let t of o)t.widget(this.view,s)}else if(t.type==Pe.Text){Vs(i,n,t.from);for(let e of o)e.line(this.view,t,n)}else if(t.widget)for(let e of o)e.widget(this.view,t);for(let t of o)t.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(Ps),i=t.state.facet(Ps),n=t.docChanged||t.heightChanged||t.viewportChanged||!h.eq(t.startState.facet(Ls),t.state.facet(Ls),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let e of this.gutters)e.update(t)&&(n=!0);else{n=!0;let o=[];for(let n of i){let i=e.indexOf(n);i<0?o.push(new zs(this.view,n)):(this.gutters[i].update(t),o.push(this.gutters[i]))}for(let t of this.gutters)t.dom.remove(),o.indexOf(t)<0&&t.destroy();for(let t of o)"after"==t.config.side?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.gutters=o}return n}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>No.scrollMargins.of(e=>{let i=e.plugin(t);if(!i||0==i.gutters.length||!i.fixed)return null;let n=i.dom.offsetWidth*e.scaleX,o=i.domAfter?i.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==$e.LTR?{left:n,right:o}:{right:n,left:o}})});function Is(t){return Array.isArray(t)?t:[t]}function Vs(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Fs{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=h.iter(t.markers,e.from)}addElement(t,e,i){let{gutter:n}=this,o=(e.top-this.height)/t.scaleY,s=e.height/t.scaleY;if(this.i==n.elements.length){let e=new Ws(t,s,o,i);n.elements.push(e),n.dom.appendChild(e.dom)}else n.elements[this.i].update(t,s,o,i);this.height=e.bottom,this.i++}line(t,e,i){let n=[];Vs(this.cursor,n,e.from),i.length&&(n=n.concat(i));let o=this.gutter.config.lineMarker(t,e,n);o&&n.unshift(o);let s=this.gutter;(0!=n.length||s.config.renderEmptyElements)&&this.addElement(t,e,n)}widget(t,e){let i=this.gutter.config.widgetMarker(t,e.widget,e),n=i?[i]:null;for(let i of t.state.facet(Bs)){let o=i(t,e.widget,e);o&&(n||(n=[])).push(o)}n&&this.addElement(t,e,n)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class zs{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in e.domEventHandlers)this.dom.addEventListener(i,n=>{let o,s=n.target;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let t=s.getBoundingClientRect();o=(t.top+t.bottom)/2}else o=n.clientY;let r=t.lineBlockAtHeight(o-t.documentTop);e.domEventHandlers[i](t,r,n)&&n.preventDefault()});this.markers=Is(e.markers(t)),e.initialSpacer&&(this.spacer=new Ws(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=Is(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let e=this.config.updateSpacer(this.spacer.markers[0],t);e!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[e])}let i=t.view.viewport;return!h.eq(this.markers,e,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t)}destroy(){for(let t of this.elements)t.destroy()}}class Ws{constructor(t,e,i,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,n)}update(t,e,i,n){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!t[i].compare(e[i]))return!1;return!0}(this.markers,n)||this.setMarkers(t,n)}setMarkers(t,e){let i="cm-gutterElement",n=this.dom.firstChild;for(let o=0,s=0;;){let r=s,l=o<e.length?e[o++]:null,a=!1;if(l){let t=l.elementClass;t&&(i+=" "+t);for(let t=s;t<this.markers.length;t++)if(this.markers[t].compare(l)){r=t,a=!0;break}}else r=this.markers.length;for(;s<r;){let t=this.markers[s++];if(t.toDOM){t.destroy(n);let e=n.nextSibling;n.remove(),n=e}}if(!l)break;l.toDOM&&(a?n=n.nextSibling:this.dom.insertBefore(l.toDOM(t),n)),a&&s++}this.dom.className=i,this.markers=e}destroy(){this.setMarkers(null,[])}}const qs=i.define(),_s=i.define(),Ks=i.define({combine:t=>u(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let t in e){let n=i[t],o=e[t];i[t]=n?(t,e,i)=>n(t,e,i)||o(t,e,i):o}return i}})});class $s extends Os{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function Us(t,e){return t.state.facet(Ks).formatNumber(e,t.state)}const Gs=Ps.compute([Ks],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(qs),lineMarker:(t,e,i)=>i.some(t=>t.toDOM)?null:new $s(Us(t,t.state.doc.lineAt(e.from).number)),widgetMarker:(t,e,i)=>{for(let n of t.state.facet(_s)){let o=n(t,e,i);if(o)return o}return null},lineMarkerChange:t=>t.startState.facet(Ks)!=t.state.facet(Ks),initialSpacer:t=>new $s(Us(t,Xs(t.state.doc.lines))),updateSpacer(t,e){let i=Us(e.view,Xs(e.view.state.doc.lines));return i==t.number?t:new $s(i)},domEventHandlers:t.facet(Ks).domEventHandlers,side:"before"}));function Ys(t={}){return[Ks.of(t),js(),Gs]}function Xs(t){let e=9;for(;e<t;)e=10*e+9;return e}let Qs=0;class Js{constructor(t,e,i,n){this.name=t,this.set=e,this.base=i,this.modified=n,this.id=Qs++}toString(){let{name:t}=this;for(let e of this.modified)e.name&&(t=`${e.name}(${t})`);return t}static define(t,e){let i="string"==typeof t?t:"?";if(t instanceof Js&&(e=t),null==e?void 0:e.base)throw new Error("Can not derive from a modified tag");let n=new Js(i,[],null,[]);if(n.set.push(n),e)for(let t of e.set)n.set.push(t);return n}static defineModifier(t){let e=new tr(t);return t=>t.modified.indexOf(e)>-1?t:tr.get(t.base||t,t.modified.concat(e).sort((t,e)=>t.id-e.id))}}let Zs=0;class tr{constructor(t){this.name=t,this.instances=[],this.id=Zs++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find(i=>{return i.base==t&&(n=e,o=i.modified,n.length==o.length&&n.every((t,e)=>t==o[e]));var n,o});if(i)return i;let n=[],o=new Js(t.name,n,t,e);for(let t of e)t.instances.push(o);let s=function(t){let e=[[]];for(let i=0;i<t.length;i++)for(let n=0,o=e.length;n<o;n++)e.push(e[n].concat(t[i]));return e.sort((t,e)=>e.length-t.length)}(e);for(let e of t.set)if(!e.modified.length)for(let t of s)n.push(tr.get(e,t));return o}}function er(t){let e=Object.create(null);for(let i in t){let n=t[i];Array.isArray(n)||(n=[n]);for(let t of i.split(" "))if(t){let i=[],o=2,s=t;for(let e=0;;){if("..."==s&&e>0&&e+3==t.length){o=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!n)throw new RangeError("Invalid path: "+t);if(i.push("*"==n[0]?"":'"'==n[0][0]?JSON.parse(n[0]):n[0]),e+=n[0].length,e==t.length)break;let r=t[e++];if(e==t.length&&"!"==r){o=0;break}if("/"!=r)throw new RangeError("Invalid path: "+t);s=t.slice(e)}let r=i.length-1,l=i[r];if(!l)throw new RangeError("Invalid path: "+t);let a=new nr(n,o,r>0?i.slice(0,r):null);e[l]=a.sort(e[l])}}return ir.add(e)}const ir=new T({combine(t,e){let i,n,o;for(;t||e;){if(!t||e&&t.depth>=e.depth?(o=e,e=e.next):(o=t,t=t.next),i&&i.mode==o.mode&&!o.context&&!i.context)continue;let s=new nr(o.tags,o.mode,o.context);i?i.next=s:n=s,i=s}return n}});class nr{constructor(t,e,i,n){this.tags=t,this.mode=e,this.context=i,this.next=n}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}}function or(t,e){let i=Object.create(null);for(let e of t)if(Array.isArray(e.tag))for(let t of e.tag)i[t.id]=e.class;else i[e.tag.id]=e.class;let{scope:n,all:o=null}=e||{};return{style:t=>{let e=o;for(let n of t)for(let t of n.set){let n=i[t.id];if(n){e=e?e+" "+n:n;break}}return e},scope:n}}function sr(t,e,i,n=0,o=t.length){let s=new rr(n,Array.isArray(e)?e:[e],i);s.highlightRange(t.cursor(),n,o,"",s.highlighters),s.flush(o)}nr.empty=new nr([],2,null);class rr{constructor(t,e,i){this.at=t,this.highlighters=e,this.span=i,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,i,n,o){let{type:s,from:r,to:l}=t;if(r>=i||l<=e)return;s.isTop&&(o=this.highlighters.filter(t=>!t.scope||t.scope(s)));let a=n,h=function(t){let e=t.type.prop(ir);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||nr.empty,c=function(t,e){let i=null;for(let n of t){let t=n.style(e);t&&(i=i?i+" "+t:t)}return i}(o,h.tags);if(c&&(a&&(a+=" "),a+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(Math.max(e,r),a),h.opaque)return;let d=t.tree&&t.tree.prop(T.mounted);if(d&&d.overlay){let s=t.node.enter(d.overlay[0].from+r,1),h=this.highlighters.filter(t=>!t.scope||t.scope(d.tree.type)),c=t.firstChild();for(let f=0,u=r;;f++){let p=f<d.overlay.length?d.overlay[f]:null,m=p?p.from+r:l,g=Math.max(e,u),w=Math.min(i,m);if(g<w&&c)for(;t.from<w&&(this.highlightRange(t,g,w,n,o),this.startSpan(Math.min(w,t.to),a),!(t.to>=m)&&t.nextSibling()););if(!p||m>i)break;u=p.to+r,u>e&&(this.highlightRange(s.cursor(),Math.max(e,p.from+r),Math.min(i,u),"",h),this.startSpan(Math.min(i,u),a))}c&&t.parent()}else if(t.firstChild()){d&&(n="");do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,o),this.startSpan(Math.min(i,t.to),a)}}while(t.nextSibling());t.parent()}}}const lr=Js.define,ar=lr(),hr=lr(),cr=lr(hr),dr=lr(hr),fr=lr(),ur=lr(fr),pr=lr(fr),mr=lr(),gr=lr(mr),wr=lr(),vr=lr(),br=lr(),yr=lr(br),xr=lr(),kr={comment:ar,lineComment:lr(ar),blockComment:lr(ar),docComment:lr(ar),name:hr,variableName:lr(hr),typeName:cr,tagName:lr(cr),propertyName:dr,attributeName:lr(dr),className:lr(hr),labelName:lr(hr),namespace:lr(hr),macroName:lr(hr),literal:fr,string:ur,docString:lr(ur),character:lr(ur),attributeValue:lr(ur),number:pr,integer:lr(pr),float:lr(pr),bool:lr(fr),regexp:lr(fr),escape:lr(fr),color:lr(fr),url:lr(fr),keyword:wr,self:lr(wr),null:lr(wr),atom:lr(wr),unit:lr(wr),modifier:lr(wr),operatorKeyword:lr(wr),controlKeyword:lr(wr),definitionKeyword:lr(wr),moduleKeyword:lr(wr),operator:vr,derefOperator:lr(vr),arithmeticOperator:lr(vr),logicOperator:lr(vr),bitwiseOperator:lr(vr),compareOperator:lr(vr),updateOperator:lr(vr),definitionOperator:lr(vr),typeOperator:lr(vr),controlOperator:lr(vr),punctuation:br,separator:lr(br),bracket:yr,angleBracket:lr(yr),squareBracket:lr(yr),paren:lr(yr),brace:lr(yr),content:mr,heading:gr,heading1:lr(gr),heading2:lr(gr),heading3:lr(gr),heading4:lr(gr),heading5:lr(gr),heading6:lr(gr),contentSeparator:lr(mr),list:lr(mr),quote:lr(mr),emphasis:lr(mr),strong:lr(mr),link:lr(mr),monospace:lr(mr),strikethrough:lr(mr),inserted:lr(),deleted:lr(),changed:lr(),invalid:lr(),meta:xr,documentMeta:lr(xr),annotation:lr(xr),processingInstruction:lr(xr),definition:Js.defineModifier("definition"),constant:Js.defineModifier("constant"),function:Js.defineModifier("function"),standard:Js.defineModifier("standard"),local:Js.defineModifier("local"),special:Js.defineModifier("special")};for(let t in kr){let e=kr[t];e instanceof Js&&(e.name=t)}var Sr;or([{tag:kr.link,class:"tok-link"},{tag:kr.heading,class:"tok-heading"},{tag:kr.emphasis,class:"tok-emphasis"},{tag:kr.strong,class:"tok-strong"},{tag:kr.keyword,class:"tok-keyword"},{tag:kr.atom,class:"tok-atom"},{tag:kr.bool,class:"tok-bool"},{tag:kr.url,class:"tok-url"},{tag:kr.labelName,class:"tok-labelName"},{tag:kr.inserted,class:"tok-inserted"},{tag:kr.deleted,class:"tok-deleted"},{tag:kr.literal,class:"tok-literal"},{tag:kr.string,class:"tok-string"},{tag:kr.number,class:"tok-number"},{tag:[kr.regexp,kr.escape,kr.special(kr.string)],class:"tok-string2"},{tag:kr.variableName,class:"tok-variableName"},{tag:kr.local(kr.variableName),class:"tok-variableName tok-local"},{tag:kr.definition(kr.variableName),class:"tok-variableName tok-definition"},{tag:kr.special(kr.variableName),class:"tok-variableName2"},{tag:kr.definition(kr.propertyName),class:"tok-propertyName tok-definition"},{tag:kr.typeName,class:"tok-typeName"},{tag:kr.namespace,class:"tok-namespace"},{tag:kr.className,class:"tok-className"},{tag:kr.macroName,class:"tok-macroName"},{tag:kr.propertyName,class:"tok-propertyName"},{tag:kr.operator,class:"tok-operator"},{tag:kr.comment,class:"tok-comment"},{tag:kr.meta,class:"tok-meta"},{tag:kr.invalid,class:"tok-invalid"},{tag:kr.punctuation,class:"tok-punctuation"}]);const Cr=new T;function Ar(t){return i.define({combine:t?e=>e.concat(t):void 0})}const Mr=new T;class Dr{constructor(e,i,n=[],o=""){this.data=e,this.name=o,t.prototype.hasOwnProperty("tree")||Object.defineProperty(t.prototype,"tree",{get(){return Lr(this)}}),this.parser=i,this.extension=[Vr.of(this),t.languageData.of((t,e,i)=>{let n=Tr(t,e,i),o=n.type.prop(Cr);if(!o)return[];let s=t.facet(o),r=n.type.prop(Mr);if(r){let o=n.resolve(e-n.from,i);for(let e of r)if(e.test(o,t)){let i=t.facet(e.facet);return"replace"==e.type?i:i.concat(s)}}return s})].concat(n)}isActiveAt(t,e,i=-1){return Tr(t,e,i).type.prop(Cr)==this.data}findRegions(t){let e=t.facet(Vr);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[],n=(t,e)=>{if(t.prop(Cr)==this.data)return void i.push({from:e,to:e+t.length});let o=t.prop(T.mounted);if(o){if(o.tree.prop(Cr)==this.data){if(o.overlay)for(let t of o.overlay)i.push({from:t.from+e,to:t.to+e});else i.push({from:e,to:e+t.length});return}if(o.overlay){let t=i.length;if(n(o.tree,o.overlay[0].from+e),i.length>t)return}}for(let i=0;i<t.children.length;i++){let o=t.children[i];o instanceof j&&n(o,t.positions[i]+e)}};return n(Lr(t),0),i}get allowsNesting(){return!0}}function Tr(t,e,i){let n=t.facet(Vr),o=Lr(t).topNode;if(!n||n.allowsNesting)for(let t=o;t;t=t.enter(e,i,N.ExcludeBuffers))t.type.isTop&&(o=t);return o}Dr.setState=e.define();class Or extends Dr{constructor(t,e,i){super(t,e,[],i),this.parser=e}static define(t){let e=Ar(t.languageData);return new Or(e,t.parser.configure({props:[Cr.add(t=>t.isTop?e:void 0)]}),t.name)}configure(t,e){return new Or(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Lr(t){let e=t.field(Dr.state,!1);return e?e.tree:j.empty}class Br{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t<i||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Er=null;class Pr{constructor(t,e,i=[],n,o,s,r,l){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=o,this.viewport=s,this.skipped=r,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Pr(t,e,[],j.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Br(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=j.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if("number"==typeof t){let e=Date.now()+t;t=()=>Date.now()>e}for(this.parse||(this.parse=this.startParse()),null!=e&&(null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&e<this.state.doc.length&&this.parse.stopAt(e);;){let n=this.parse.advance();if(n){if(this.fragments=this.withoutTempSkipped(et.addTree(n,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(i=this.parse.stoppedAt)&&void 0!==i?i:this.state.doc.length,this.tree=n,this.parse=null,!(this.treeLen<(null!=e?e:this.state.doc.length)))return!0;this.parse=this.startParse()}if(t())return!1}})}takeTree(){let t,e;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(et.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Er;Er=this;try{return t()}finally{Er=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Rr(t,e.from,e.to);return t}changes(t,e){let{fragments:i,tree:n,treeLen:o,viewport:s,skipped:r}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,i,n,o)=>e.push({fromA:t,toA:i,fromB:n,toB:o})),i=et.applyChanges(i,e),n=j.empty,o=0,s={from:t.mapPos(s.from,-1),to:t.mapPos(s.to,1)},this.skipped.length){r=[];for(let e of this.skipped){let i=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);i<n&&r.push({from:i,to:n})}}}return new Pr(this.parser,e,i,n,o,s,r,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let e=this.skipped.length;for(let e=0;e<this.skipped.length;e++){let{from:i,to:n}=this.skipped[e];i<t.to&&n>t.from&&(this.fragments=Rr(this.fragments,i,n),this.skipped.splice(e--,1))}return!(this.skipped.length>=e)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends it{createParse(e,i,n){let o=n[0].from,s=n[n.length-1].to;return{parsedPos:o,advance(){let e=Er;if(e){for(let t of n)e.tempSkipped.push(t);t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=s,new j(B.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t}static get(){return Er}}function Rr(t,e,i){return et.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Nr{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new Nr(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Pr.create(t.facet(Vr).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Nr(i)}}Dr.state=w.define({create:Nr.init,update(t,e){for(let t of e.effects)if(t.is(Dr.setState))return t.value;return e.startState.facet(Vr)!=e.state.facet(Vr)?Nr.init(e.state):t.apply(e)}});let jr=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(jr=t=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Hr="undefined"!=typeof navigator&&(null===(Sr=navigator.scheduling)||void 0===Sr?void 0:Sr.isInputPending)?()=>navigator.scheduling.isInputPending():null,Ir=Li.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(Dr.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Dr.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=jr(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEnd<e&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=e+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:n}}=this.view,o=i.field(Dr.state);if(o.tree==o.context.tree&&o.context.isDone(n+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,t&&!Hr?Math.max(25,t.timeRemaining()-5):1e9),r=o.context.treeLen<n&&i.doc.length>n+1e3,l=o.context.work(()=>Hr&&Hr()||Date.now()>s,n+(r?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Dr.setState.of(new Nr(o.context))})),this.chunkBudget>0&&(!l||r)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Mi(this.view.state,t)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Vr=i.define({combine:t=>t.length?t[0]:null,enables:t=>[Dr.state,Ir,No.contentAttributes.compute([t],e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}})]});class Fr{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class zr{constructor(t,e,i,n,o,s=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=o,this.support=s,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(t=>this.support=t,t=>{throw this.loading=null,t}))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new zr(t.name,(t.alias||[]).concat(t.name).map(t=>t.toLowerCase()),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some(t=>t==e))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const Wr=i.define(),qr=i.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function _r(t){let e=t.facet(qr);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Kr(t,e){let i="",n=t.tabSize,o=t.facet(qr)[0];if("\t"==o){for(;e>=n;)i+="\t",e-=n;o=" "}for(let t=0;t<e;t++)i+=o;return i}function $r(e,i){e instanceof t&&(e=new Ur(e));for(let t of e.state.facet(Wr)){let n=t(e,i);if(void 0!==n)return n}let n=Lr(e.state);return n.length>=i?function(t,e,i){let n=e.resolveStack(i),o=e.resolveInner(i,-1).resolve(i,0).enterUnfinishedNodesBefore(i);if(o!=n.node){let t=[];for(let e=o;e&&!(e.from<n.node.from||e.to>n.node.to||e.from==n.node.from&&e.type==n.node.type);e=e.parent)t.push(e);for(let e=t.length-1;e>=0;e--)n={node:t[e],next:n}}return Yr(n,t,i)}(e,n,i):null}class Ur{constructor(t,e={}){this.state=t,this.options=e,this.unit=_r(t)}lineAt(t,e=1){let i=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:o}=this.options;return null!=n&&n>=i.from&&n<=i.to?o&&n==t?{text:"",from:t}:(e<0?n<t:n<=t)?{text:i.text.slice(n-i.from),from:n}:{text:i.text.slice(0,n-i.from),from:i.from}:i}textAfterPos(t,e=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:i,from:n}=this.lineAt(t,e);return i.slice(t-n,Math.min(i.length,t+100-n))}column(t,e=1){let{text:i,from:n}=this.lineAt(t,e),o=this.countColumn(i,t-n),s=this.options.overrideIndentation?this.options.overrideIndentation(n):-1;return s>-1&&(o+=s-this.countColumn(i,i.search(/\S|$/))),o}countColumn(t,e=t.length){return y(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:i,from:n}=this.lineAt(t,e),o=this.options.overrideIndentation;if(o){let t=o(n);if(t>-1)return t}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Gr=new T;function Yr(t,e,i){for(let n=t;n;n=n.next){let t=Xr(n.node);if(t)return t(Jr.create(e,i,n))}return 0}function Xr(t){let e=t.type.prop(Gr);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(T.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Qr:null}function Qr(){return 0}class Jr extends Ur{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.context=i}get node(){return this.context.node}static create(t,e,i){return new Jr(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let i=t.resolve(e.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(Zr(i,t))break;e=this.state.doc.lineAt(i.from)}return this.lineIndent(e.from)}continue(){return Yr(this.context.next,this.base,this.pos)}}function Zr(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,o){let s=t.textAfter,r=s.match(/^\s*/)[0].length,l=n&&s.slice(r,r+n.length)==n||o==t.pos+r,a=e?function(t){let e=t.node,i=e.childAfter(e.from),n=e.lastChild;if(!i)return null;let o=t.options.simulateBreak,s=t.state.doc.lineAt(i.from),r=null==o||o<=s.from?s.to:Math.min(s.to,o);for(let t=i.to;;){let o=e.childAfter(t);if(!o||o==n)return null;if(!o.type.isSkipped){if(o.from>=r)return null;let t=/^ */.exec(s.text.slice(i.to-s.from))[0].length;return{from:i.from,to:i.to+t}}t=o.to}}(t):null;return a?l?t.column(a.from):t.column(a.to):t.baseIndent+(l?0:t.unit*i)}const il=t=>t.baseIndent;function nl({except:t,units:e=1}={}){return i=>{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}const ol=i.define(),sl=new T;function rl(t){let e=t.firstChild,i=t.lastChild;return e&&e.to<i.from?{from:e.to,to:i.type.isError?t.to:i.from}:null}function ll(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function al(t,e,i){for(let n of t.facet(ol)){let o=n(t,e,i);if(o)return o}return function(t,e,i){let n=Lr(t);if(n.length<i)return null;let o=null;for(let s=n.resolveStack(i,1);s;s=s.next){let r=s.node;if(r.to<=i||r.from>i)continue;if(o&&r.from<e)break;let l=r.type.prop(sl);if(l&&(r.to<n.length-50||n.length==t.doc.length||!ll(r))){let n=l(r,t);n&&n.from<=i&&n.from>=e&&n.to>i&&(o=n)}}return o}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=e.define({map:hl}),dl=e.define({map:hl});function fl(t){let e=[];for(let{head:i}of t.state.selection.ranges)e.some(t=>t.from<=i&&t.to>=i)||e.push(t.lineBlockAt(i));return e}const ul=w.define({create:()=>Re.none,update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((e,i)=>t=pl(t,e,i)),t=t.map(e.changes);for(let i of e.effects)if(i.is(cl)&&!gl(t,i.value.from,i.value.to)){let{preparePlaceholder:n}=e.state.facet(xl),o=n?Re.replace({widget:new Al(n(e.state,i.value))}):Cl;t=t.update({add:[o.range(i.value.from,i.value.to)]})}else i.is(dl)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));return e.selection&&(t=pl(t,e.selection.main.head)),t},provide:t=>No.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,(t,e)=>{i.push(t,e)}),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i<t.length;){let n=t[i++],o=t[i++];if("number"!=typeof n||"number"!=typeof o)throw new RangeError("Invalid JSON for fold state");e.push(Cl.range(n,o))}return Re.set(e,!0)}});function pl(t,e,i=e){let n=!1;return t.between(e,i,(t,o)=>{t<i&&o>e&&(n=!0)}),n?t.update({filterFrom:e,filterTo:i,filter:(t,n)=>t>=i||n<=e}):t}function ml(t,e,i){var n;let o=null;return null===(n=t.field(ul,!1))||void 0===n||n.between(e,i,(t,e)=>{(!o||o.from>t)&&(o={from:t,to:e})}),o}function gl(t,e,i){let n=!1;return t.between(e,e,(t,o)=>{t==e&&o==i&&(n=!0)}),n}function wl(t,i){return t.field(ul,!1)?i:i.concat(e.appendConfig.of(kl()))}function vl(t,e,i=!0){let n=t.state.doc.lineAt(e.from).number,o=t.state.doc.lineAt(e.to).number;return No.announce.of(`${t.state.phrase(i?"Folded lines":"Unfolded lines")} ${n} ${t.state.phrase("to")} ${o}.`)}const bl=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:t=>{for(let e of fl(t)){let i=al(t.state,e.from,e.to);if(i)return t.dispatch({effects:wl(t.state,[cl.of(i),vl(t,i)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:t=>{if(!t.state.field(ul,!1))return!1;let e=[];for(let i of fl(t)){let n=ml(t.state,i.from,i.to);n&&e.push(dl.of(n),vl(t,n,!1))}return e.length&&t.dispatch({effects:e}),e.length>0}},{key:"Ctrl-Alt-[",run:t=>{let{state:e}=t,i=[];for(let n=0;n<e.doc.length;){let o=t.lineBlockAt(n),s=al(e,o.from,o.to);s&&i.push(cl.of(s)),n=(s?t.lineBlockAt(s.to):o).to+1}return i.length&&t.dispatch({effects:wl(t.state,i)}),!!i.length}},{key:"Ctrl-Alt-]",run:t=>{let e=t.state.field(ul,!1);if(!e||!e.size)return!1;let i=[];return e.between(0,t.state.doc.length,(t,e)=>{i.push(dl.of({from:t,to:e}))}),t.dispatch({effects:i}),!0}}],yl={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},xl=i.define({combine:t=>u(t,yl)});function kl(t){return[ul,Ol]}function Sl(t,e){let{state:i}=t,n=i.facet(xl),o=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=ml(t.state,i.from,i.to);n&&t.dispatch({effects:dl.of(n)}),e.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,o,e);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",i.phrase("folded code")),s.title=i.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=o,s}const Cl=Re.replace({widget:new class extends Ee{toDOM(t){return Sl(t,null)}}});class Al extends Ee{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return Sl(t,this.value)}}const Ml={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Dl extends Os{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}function Tl(t={}){let e={...Ml,...t},i=new Dl(e,!0),n=new Dl(e,!1),o=Li.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Vr)!=t.state.facet(Vr)||t.startState.field(ul,!1)!=t.state.field(ul,!1)||Lr(t.startState)!=Lr(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new b;for(let o of t.viewportLineBlocks){let s=ml(t.state,o.from,o.to)?n:al(t.state,o.from,o.to)?i:null;s&&e.add(o.from,o.from,s)}return e.finish()}}),{domEventHandlers:s}=e;return[o,Rs({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(o))||void 0===e?void 0:e.markers)||h.empty},initialSpacer:()=>new Dl(e,!1),domEventHandlers:{...s,click:(t,e,i)=>{if(s.click&&s.click(t,e,i))return!0;let n=ml(t.state,e.from,e.to);if(n)return t.dispatch({effects:dl.of(n)}),!0;let o=al(t.state,e.from,e.to);return!!o&&(t.dispatch({effects:cl.of(o)}),!0)}}}),kl()]}const Ol=No.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Ll{constructor(t,e){let i;function n(t){let e=xt.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const o="string"==typeof e.all?e.all:e.all?n(e.all):void 0,s=e.scope;this.scope=s instanceof Dr?t=>t.prop(Cr)==s.data:s?t=>t==s:void 0,this.style=or(t.map(t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))})),{all:o}).style,this.module=i?new xt(i):null,this.themeType=e.themeType}static define(t,e){return new Ll(t,e||{})}}const Bl=i.define(),El=i.define({combine:t=>t.length?[t[0]]:null});function Pl(t){let e=t.facet(Bl);return e.length?e:t.facet(El)}function Rl(t,e){let i,n=[jl];return t instanceof Ll&&(t.module&&n.push(No.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(El.of(t)):i?n.push(Bl.computeN([No.darkTheme],e=>e.facet(No.darkTheme)==("dark"==i)?[t]:[])):n.push(Bl.of(t)),n}class Nl{constructor(t){this.markCache=Object.create(null),this.tree=Lr(t.state),this.decorations=this.buildDeco(t,Pl(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=Lr(t.state),i=Pl(t.state),n=i!=Pl(t.startState),{viewport:o}=t.view,s=t.changes.mapPos(this.decoratedTo,1);e.length<o.to&&!n&&e.type==this.tree.type&&s>=o.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=s):(e!=this.tree||t.viewportChanged||n)&&(this.tree=e,this.decorations=this.buildDeco(t.view,i),this.decoratedTo=o.to)}buildDeco(t,e){if(!e||!this.tree.length)return Re.none;let i=new b;for(let{from:n,to:o}of t.visibleRanges)sr(this.tree,e,(t,e,n)=>{i.add(t,e,this.markCache[n]||(this.markCache[n]=Re.mark({class:n})))},n,o);return i.finish()}}const jl=r.high(Li.fromClass(Nl,{decorations:t=>t.decorations})),Hl=Ll.define([{tag:kr.meta,color:"#404740"},{tag:kr.link,textDecoration:"underline"},{tag:kr.heading,textDecoration:"underline",fontWeight:"bold"},{tag:kr.emphasis,fontStyle:"italic"},{tag:kr.strong,fontWeight:"bold"},{tag:kr.strikethrough,textDecoration:"line-through"},{tag:kr.keyword,color:"#708"},{tag:[kr.atom,kr.bool,kr.url,kr.contentSeparator,kr.labelName],color:"#219"},{tag:[kr.literal,kr.inserted],color:"#164"},{tag:[kr.string,kr.deleted],color:"#a11"},{tag:[kr.regexp,kr.escape,kr.special(kr.string)],color:"#e40"},{tag:kr.definition(kr.variableName),color:"#00f"},{tag:kr.local(kr.variableName),color:"#30a"},{tag:[kr.typeName,kr.namespace],color:"#085"},{tag:kr.className,color:"#167"},{tag:[kr.special(kr.variableName),kr.macroName],color:"#256"},{tag:kr.definition(kr.propertyName),color:"#00c"},{tag:kr.comment,color:"#940"},{tag:kr.invalid,color:"#f00"}]),Il=new T;function Vl(t,e,i){let n=t.prop(e<0?T.openedBy:T.closedBy);if(n)return n;if(1==t.name.length){let n=i.indexOf(t.name);if(n>-1&&n%2==(e<0?1:0))return[i[n+e]]}return null}function Fl(t){let e=t.type.prop(Il);return e?e(t.node):t}function zl(t,e,i,n={}){let o=n.maxScanDistance||1e4,s=n.brackets||"()[]{}",r=Lr(t),l=r.resolveInner(e,i);for(let n=l;n;n=n.parent){let o=Vl(n.type,i,s);if(o&&n.from<n.to){let r=Fl(n);if(r&&(i>0?e>=r.from&&e<r.to:e>r.from&&e<=r.to))return Wl(t,e,i,n,r,o,s)}}return function(t,e,i,n,o,s,r){let l=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),a=r.indexOf(l);if(a<0||a%2==0!=i>0)return null;let h={from:i<0?e-1:e,to:i>0?e+1:e},c=t.doc.iterRange(e,i>0?t.doc.length:0),d=0;for(let t=0;!c.next().done&&t<=s;){let s=c.value;i<0&&(t+=s.length);let l=e+t*i;for(let t=i>0?0:s.length-1,e=i>0?s.length:-1;t!=e;t+=i){let e=r.indexOf(s[t]);if(!(e<0||n.resolveInner(l+t,1).type!=o))if(e%2==0==i>0)d++;else{if(1==d)return{start:h,end:{from:l+t,to:l+t+1},matched:e>>1==a>>1};d--}}i>0&&(t+=s.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,r,l.type,o,s)}function Wl(t,e,i,n,o,s,r){let l=n.parent,a={from:o.from,to:o.to},h=0,c=null==l?void 0:l.cursor();if(c&&(i<0?c.childBefore(n.from):c.childAfter(n.to)))do{if(i<0?c.to<=n.from:c.from>=n.to){if(0==h&&s.indexOf(c.type.name)>-1&&c.from<c.to){let t=Fl(c);return{start:a,end:t?{from:t.from,to:t.to}:void 0,matched:!0}}if(Vl(c.type,i,r))h++;else if(Vl(c.type,-i,r)){if(0==h){let t=Fl(c);return{start:a,end:t&&t.from<t.to?{from:t.from,to:t.to}:void 0,matched:!1}}h--}}}while(i<0?c.prevSibling():c.nextSibling());return{start:a,matched:!1}}function ql(t,e,i,n=0,o=0){null==e&&-1==(e=t.search(/[^\s\u00a0]/))&&(e=t.length);let s=o;for(let o=n;o<e;o++)9==t.charCodeAt(o)?s+=i-s%i:s++;return s}class _l{constructor(t,e,i,n){this.string=t,this.tabSize=e,this.indentUnit=i,this.overrideIndent=n,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return 0==this.pos}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(t){let e,i=this.string.charAt(this.pos);if(e="string"==typeof t?i==t:i&&(t instanceof RegExp?t.test(i):t(i)),e)return++this.pos,i}eatWhile(t){let e=this.pos;for(;this.eat(t););return this.pos>e}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ql(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var t;return null!==(t=this.overrideIndent)&&void 0!==t?t:ql(this.string,null,this.tabSize)}match(t,e,i){if("string"==typeof t){let n=t=>i?t.toLowerCase():t;return n(this.string.substr(this.pos,t.length))==n(t)?(!1!==e&&(this.pos+=t.length),!0):null}{let i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&!1!==e&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function Kl(t){if("object"!=typeof t)return t;let e={};for(let i in t){let n=t[i];e[i]=n instanceof Array?n.slice():n}return e}const $l=new WeakMap;class Ul extends Dr{constructor(t){let e,i=Ar(t.languageData),n={name:(o=t).name||"",token:o.token,blankLine:o.blankLine||(()=>{}),startState:o.startState||(()=>!0),copyState:o.copyState||Kl,indent:o.indent||(()=>null),languageData:o.languageData||{},tokenTable:o.tokenTable||Jl,mergeTokens:!1!==o.mergeTokens};var o;super(i,new class extends it{createParse(t,i,n){return new Xl(e,t,i,n)}},[],t.name),this.topNode=function(t,e){let i=B.define({id:Zl.length,name:"Document",props:[Cr.add(()=>t),Gr.add(()=>t=>e.getIndent(t))],top:!0});return Zl.push(i),i}(i,this),e=this,this.streamParser=n,this.stateAfter=new T({perNode:!0}),this.tokenTable=t.tokenTable?new oa(n.tokenTable):sa}static define(t){return new Ul(t)}getIndent(t){let e,{overrideIndentation:i}=t.options;i&&(e=$l.get(t.state),null!=e&&e<t.pos-1e4&&(e=void 0));let n,o,s=Gl(this,t.node.tree,t.node.from,t.node.from,null!=e?e:t.pos);if(s?(o=s.state,n=s.pos+1):(o=this.streamParser.startState(t.unit),n=t.node.from),t.pos-n>1e4)return null;for(;n<t.pos;){let e=t.state.doc.lineAt(n),s=Math.min(t.pos,e.to);if(e.length){let n=i?i(e.from):-1,r=new _l(e.text,t.state.tabSize,t.unit,n<0?void 0:n);for(;r.pos<s-e.from;)Ql(this.streamParser.token,r,o)}else this.streamParser.blankLine(o,t.unit);if(s==t.pos)break;n=e.to+1}let r=t.lineAt(t.pos);return i&&null==e&&$l.set(t.state,r.from),this.streamParser.indent(o,/^\s*(.*)/.exec(r.text)[1],t)}get allowsNesting(){return!1}}function Gl(t,e,i,n,o){let s=i>=n&&i+e.length<=o&&e.prop(t.stateAfter);if(s)return{state:t.streamParser.copyState(s),pos:i+e.length};for(let s=e.children.length-1;s>=0;s--){let r=e.children[s],l=i+e.positions[s],a=r instanceof j&&l<o&&Gl(t,r,l,n,o);if(a)return a}return null}function Yl(t,e,i,n,o){if(o&&i<=0&&n>=e.length)return e;o||0!=i||e.type!=t.topNode||(o=!0);for(let s=e.children.length-1;s>=0;s--){let r,l=e.positions[s],a=e.children[s];if(l<n&&a instanceof j){if(!(r=Yl(t,a,i-l,n-l,o)))break;return o?new j(e.type,e.children.slice(0,s).concat(r),e.positions.slice(0,s+1),l+r.length):r}}return null}class Xl{constructor(t,e,i,n){this.lang=t,this.input=e,this.fragments=i,this.ranges=n,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=n[n.length-1].to;let o=Pr.get(),s=n[0].from,{state:r,tree:l}=function(t,e,i,n,o){for(let o of e){let e,s=o.from+(o.openStart?25:0),r=o.to-(o.openEnd?25:0),l=s<=i&&r>i&&Gl(t,o.tree,0-o.offset,i,r);if(l&&l.pos<=n&&(e=Yl(t,o.tree,i+o.offset,l.pos+o.offset,!1)))return{state:l.state,tree:e}}return{state:t.streamParser.startState(o?_r(o):4),tree:j.empty}}(t,i,s,this.to,null==o?void 0:o.state);this.state=r,this.parsedPos=this.chunkStart=s+l.length;for(let t=0;t<l.children.length;t++)this.chunks.push(l.children[t]),this.chunkPos.push(l.positions[t]);o&&this.parsedPos<o.viewport.from-1e5&&n.some(t=>t.from<=o.viewport.from&&t.to>=o.viewport.from)&&(this.state=this.lang.streamParser.startState(_r(o.state)),o.skipUntilInView(this.parsedPos,o.viewport.from),this.parsedPos=o.viewport.from),this.moveRangeIndex()}advance(){let t=Pr.get(),e=null==this.stoppedAt?this.to:Math.min(this.to,this.stoppedAt),i=Math.min(e,this.chunkStart+512);for(t&&(i=Math.min(i,t.viewport.to));this.parsedPos<i;)this.parseLine(t);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=e?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,e),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let e=this.input.chunk(t);if(this.input.lineChunks)"\n"==e&&(e="");else{let t=e.indexOf("\n");t>-1&&(e=e.slice(0,t))}return t+e.length<=this.to?e:e.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,e=this.lineAfter(t),i=t+e.length;for(let t=this.rangeIndex;;){let n=this.ranges[t].to;if(n>=i)break;if(e=e.slice(0,n-(i-e.length)),t++,t==this.ranges.length)break;let o=this.ranges[t].from,s=this.lineAfter(o);e+=s,i=o+s.length}return{line:e,end:i}}skipGapsTo(t,e,i){for(;;){let n=this.ranges[this.rangeIndex].to,o=t+e;if(i>0?n>o:n>=o)break;e+=this.ranges[++this.rangeIndex].from-n}return e}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(t,e,i,n){let o=4;if(this.ranges.length>1){e+=n=this.skipGapsTo(e,n,1);let t=this.chunk.length;i+=n=this.skipGapsTo(i,n,-1),o+=this.chunk.length-t}let s=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&4==o&&s>=0&&this.chunk[s]==t&&this.chunk[s+2]==e?this.chunk[s+2]=i:this.chunk.push(t,e,i,o),n}parseLine(t){let{line:e,end:i}=this.nextLine(),n=0,{streamParser:o}=this.lang,s=new _l(e,t?t.state.tabSize:4,t?_r(t.state):2);if(s.eol())o.blankLine(this.state,s.indentUnit);else for(;!s.eol();){let t=Ql(o.token,s,this.state);if(t&&(n=this.emitToken(this.lang.tokenTable.resolve(t),this.parsedPos+s.start,this.parsedPos+s.pos,n)),s.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let t=j.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:ta,topID:0,maxBufferLength:512,reused:this.chunkReused});t=new j(t.type,t.children,t.positions,t.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(t),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new j(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function Ql(t,e,i){e.start=e.pos;for(let n=0;n<10;n++){let n=t(e,i);if(e.pos>e.start)return n}throw new Error("Stream parser failed to advance stream.")}const Jl=Object.create(null),Zl=[B.none],ta=new E(Zl),ea=[],ia=Object.create(null),na=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])na[t]=la(Jl,e);class oa{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),na)}resolve(t){return t?this.table[t]||(this.table[t]=la(this.extra,t)):0}}const sa=new oa(Jl);function ra(t,e){ea.indexOf(t)>-1||(ea.push(t),console.warn(e))}function la(t,e){let i=[];for(let n of e.split(" ")){let e=[];for(let i of n.split(".")){let n=t[i]||kr[i];n?"function"==typeof n?e.length?e=e.map(n):ra(i,`Modifier ${i} used at start of tag`):e.length?ra(i,`Tag ${i} used as modifier`):e=Array.isArray(n)?n:[n]:ra(i,`Unknown highlighting tag ${i}`)}for(let t of e)i.push(t)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),o=n+" "+i.map(t=>t.id),s=ia[o];if(s)return s.id;let r=ia[o]=B.define({id:Zl.length,name:n,props:[er({[n]:i})]});return Zl.push(r),r.id}
|
|
92
|
+
/*
|
|
93
|
+
* Copyright IBM Corp. 2025
|
|
94
|
+
*
|
|
95
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
96
|
+
* LICENSE file in the root directory of this source tree.
|
|
97
|
+
*
|
|
98
|
+
* @license
|
|
99
|
+
*/
|
|
100
|
+
function aa(t){return new Fr(Ul.define(t))}function ha(t){return import("./index-WQxGinYJ.js").then(e=>e.sql({dialect:e[t]}))}$e.RTL,$e.LTR;const ca=[zr.of({name:"C",extensions:["c","h","ino"],load:()=>import("./index-CU0IEHyz.js").then(t=>t.cpp())}),zr.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load:()=>import("./index-CU0IEHyz.js").then(t=>t.cpp())}),zr.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load:()=>ha("Cassandra")}),zr.of({name:"CSS",extensions:["css"],load:()=>import("./index-Ctl66nQF.js").then(t=>t.css())}),zr.of({name:"Go",extensions:["go"],load:()=>import("./index-CAdio42O.js").then(t=>t.go())}),zr.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load:()=>import("./index-D7MLs7w5.js").then(t=>t.html())}),zr.of({name:"Java",extensions:["java"],load:()=>import("./index-CSMhs9Fm.js").then(t=>t.java())}),zr.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load:()=>import("./index-P1vutKel.js").then(t=>t.javascript())}),zr.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load:()=>import("./index-o-THaGga.js").then(t=>t.jinja())}),zr.of({name:"JSON",alias:["json5"],extensions:["json","map"],load:()=>import("./index-Dx9Ms_uJ.js").then(t=>t.json())}),zr.of({name:"JSX",extensions:["jsx"],load:()=>import("./index-P1vutKel.js").then(t=>t.javascript({jsx:!0}))}),zr.of({name:"LESS",extensions:["less"],load:()=>import("./index--QAAkyqA.js").then(t=>t.less())}),zr.of({name:"Liquid",extensions:["liquid"],load:()=>import("./index-BPU5uHmK.js").then(t=>t.liquid())}),zr.of({name:"MariaDB SQL",load:()=>ha("MariaSQL")}),zr.of({name:"Markdown",extensions:["md","markdown","mkd"],load:()=>import("./index-EwTPqhmw.js").then(t=>t.markdown())}),zr.of({name:"MS SQL",load:()=>ha("MSSQL")}),zr.of({name:"MySQL",load:()=>ha("MySQL")}),zr.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load:()=>import("./index-DpqlVRJ7.js").then(t=>t.php())}),zr.of({name:"PLSQL",extensions:["pls"],load:()=>ha("PLSQL")}),zr.of({name:"PostgreSQL",load:()=>ha("PostgreSQL")}),zr.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load:()=>import("./index-cK4rXRw-.js").then(t=>t.python())}),zr.of({name:"Rust",extensions:["rs"],load:()=>import("./index-BbWtDXd9.js").then(t=>t.rust())}),zr.of({name:"Sass",extensions:["sass"],load:()=>import("./index-Cj-ZmC-W.js").then(t=>t.sass({indented:!0}))}),zr.of({name:"SCSS",extensions:["scss"],load:()=>import("./index-Cj-ZmC-W.js").then(t=>t.sass())}),zr.of({name:"SQL",extensions:["sql"],load:()=>ha("StandardSQL")}),zr.of({name:"SQLite",load:()=>ha("SQLite")}),zr.of({name:"TSX",extensions:["tsx"],load:()=>import("./index-P1vutKel.js").then(t=>t.javascript({jsx:!0,typescript:!0}))}),zr.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load:()=>import("./index-P1vutKel.js").then(t=>t.javascript({typescript:!0}))}),zr.of({name:"WebAssembly",extensions:["wat","wast"],load:()=>import("./index-BwI8x9E4.js").then(t=>t.wast())}),zr.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load:()=>import("./index-DH8wnvUn.js").then(t=>t.xml())}),zr.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load:()=>import("./index-BjsxSbgO.js").then(t=>t.yaml())}),zr.of({name:"APL",extensions:["dyalog","apl"],load:()=>import("./apl-Cq2qnGBp.js").then(t=>aa(t.apl))}),zr.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load:()=>import("./asciiarmor-Cb5hNJXm.js").then(t=>aa(t.asciiArmor))}),zr.of({name:"ASN.1",extensions:["asn","asn1"],load:()=>import("./asn1-ObfPhj90.js").then(t=>aa(t.asn1({})))}),zr.of({name:"Asterisk",filename:/^extensions\.conf$/i,load:()=>import("./asterisk-CGEdhmtE.js").then(t=>aa(t.asterisk))}),zr.of({name:"Cobol",extensions:["cob","cpy"],load:()=>import("./cobol-BP7APbz-.js").then(t=>aa(t.cobol))}),zr.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load:()=>import("./clike-D-W_e6Lj.js").then(t=>aa(t.csharp))}),zr.of({name:"Clojure",extensions:["clj","cljc","cljx"],load:()=>import("./clojure-BKr3NaqS.js").then(t=>aa(t.clojure))}),zr.of({name:"ClojureScript",extensions:["cljs"],load:()=>import("./clojure-BKr3NaqS.js").then(t=>aa(t.clojure))}),zr.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load:()=>import("./css-BJk1lVKu.js").then(t=>aa(t.gss))}),zr.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load:()=>import("./cmake-CCO4hHlz.js").then(t=>aa(t.cmake))}),zr.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load:()=>import("./coffeescript-DAdmYC08.js").then(t=>aa(t.coffeeScript))}),zr.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load:()=>import("./commonlisp-Bo8JYmEV.js").then(t=>aa(t.commonLisp))}),zr.of({name:"Cypher",extensions:["cyp","cypher"],load:()=>import("./cypher-D-eVDQC7.js").then(t=>aa(t.cypher))}),zr.of({name:"Cython",extensions:["pyx","pxd","pxi"],load:()=>import("./python-PHhd4JZq.js").then(t=>aa(t.cython))}),zr.of({name:"Crystal",extensions:["cr"],load:()=>import("./crystal-Bm8pGIh6.js").then(t=>aa(t.crystal))}),zr.of({name:"D",extensions:["d"],load:()=>import("./d-D9LdG4k3.js").then(t=>aa(t.d))}),zr.of({name:"Dart",extensions:["dart"],load:()=>import("./clike-D-W_e6Lj.js").then(t=>aa(t.dart))}),zr.of({name:"diff",extensions:["diff","patch"],load:()=>import("./diff-DZtMXlRt.js").then(t=>aa(t.diff))}),zr.of({name:"Dockerfile",filename:/^Dockerfile$/,load:()=>import("./dockerfile-C5Ju62-g.js").then(t=>aa(t.dockerFile))}),zr.of({name:"DTD",extensions:["dtd"],load:()=>import("./dtd-BkbtUIcB.js").then(t=>aa(t.dtd))}),zr.of({name:"Dylan",extensions:["dylan","dyl","intr"],load:()=>import("./dylan-CCohaM4H.js").then(t=>aa(t.dylan))}),zr.of({name:"EBNF",load:()=>import("./ebnf-DtT6UrMv.js").then(t=>aa(t.ebnf))}),zr.of({name:"ECL",extensions:["ecl"],load:()=>import("./ecl-C2GNxTt8.js").then(t=>aa(t.ecl))}),zr.of({name:"edn",extensions:["edn"],load:()=>import("./clojure-BKr3NaqS.js").then(t=>aa(t.clojure))}),zr.of({name:"Eiffel",extensions:["e"],load:()=>import("./eiffel-BW4n6uyg.js").then(t=>aa(t.eiffel))}),zr.of({name:"Elm",extensions:["elm"],load:()=>import("./elm-B9lXrM6D.js").then(t=>aa(t.elm))}),zr.of({name:"Erlang",extensions:["erl"],load:()=>import("./erlang-BKwBedv4.js").then(t=>aa(t.erlang))}),zr.of({name:"Esper",load:()=>import("./sql-Biw9poPQ.js").then(t=>aa(t.esper))}),zr.of({name:"Factor",extensions:["factor"],load:()=>import("./factor-BLzOdeEw.js").then(t=>aa(t.factor))}),zr.of({name:"FCL",load:()=>import("./fcl-BGYmKRZe.js").then(t=>aa(t.fcl))}),zr.of({name:"Forth",extensions:["forth","fth","4th"],load:()=>import("./forth-DTbOVELu.js").then(t=>aa(t.forth))}),zr.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load:()=>import("./fortran-Dr7q8x3V.js").then(t=>aa(t.fortran))}),zr.of({name:"F#",alias:["fsharp"],extensions:["fs"],load:()=>import("./mllike-s7nUnXIp.js").then(t=>aa(t.fSharp))}),zr.of({name:"Gas",extensions:["s"],load:()=>import("./gas-CsCwQ5DC.js").then(t=>aa(t.gas))}),zr.of({name:"Gherkin",extensions:["feature"],load:()=>import("./gherkin-CAJyZEc1.js").then(t=>aa(t.gherkin))}),zr.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load:()=>import("./groovy-CpFdbfFQ.js").then(t=>aa(t.groovy))}),zr.of({name:"Haskell",extensions:["hs"],load:()=>import("./haskell-V36thOn1.js").then(t=>aa(t.haskell))}),zr.of({name:"Haxe",extensions:["hx"],load:()=>import("./haxe-CeQWqhmF.js").then(t=>aa(t.haxe))}),zr.of({name:"HXML",extensions:["hxml"],load:()=>import("./haxe-CeQWqhmF.js").then(t=>aa(t.hxml))}),zr.of({name:"HTTP",load:()=>import("./http-Cm3L1exf.js").then(t=>aa(t.http))}),zr.of({name:"IDL",extensions:["pro"],load:()=>import("./idl-DyN-eyoA.js").then(t=>aa(t.idl))}),zr.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load:()=>import("./javascript-B7L-ezNz.js").then(t=>aa(t.jsonld))}),zr.of({name:"Julia",extensions:["jl"],load:()=>import("./julia-B_bgxt8f.js").then(t=>aa(t.julia))}),zr.of({name:"Kotlin",extensions:["kt","kts"],load:()=>import("./clike-D-W_e6Lj.js").then(t=>aa(t.kotlin))}),zr.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load:()=>import("./livescript-B0UjDUzz.js").then(t=>aa(t.liveScript))}),zr.of({name:"Lua",extensions:["lua"],load:()=>import("./lua-Bs-1T_TR.js").then(t=>aa(t.lua))}),zr.of({name:"mIRC",extensions:["mrc"],load:()=>import("./mirc--MFZdywV.js").then(t=>aa(t.mirc))}),zr.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load:()=>import("./mathematica-QbiSkUw_.js").then(t=>aa(t.mathematica))}),zr.of({name:"Modelica",extensions:["mo"],load:()=>import("./modelica-BCpZ0s1C.js").then(t=>aa(t.modelica))}),zr.of({name:"MUMPS",extensions:["mps"],load:()=>import("./mumps-BsSCi6Lf.js").then(t=>aa(t.mumps))}),zr.of({name:"Mbox",extensions:["mbox"],load:()=>import("./mbox-IxVDt6G7.js").then(t=>aa(t.mbox))}),zr.of({name:"Nginx",filename:/nginx.*\.conf$/i,load:()=>import("./nginx-ZiZlz_Vj.js").then(t=>aa(t.nginx))}),zr.of({name:"NSIS",extensions:["nsh","nsi"],load:()=>import("./nsis-Biw-VyZu.js").then(t=>aa(t.nsis))}),zr.of({name:"NTriples",extensions:["nt","nq"],load:()=>import("./ntriples-1fM-fgdb.js").then(t=>aa(t.ntriples))}),zr.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load:()=>import("./clike-D-W_e6Lj.js").then(t=>aa(t.objectiveC))}),zr.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load:()=>import("./clike-D-W_e6Lj.js").then(t=>aa(t.objectiveCpp))}),zr.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load:()=>import("./mllike-s7nUnXIp.js").then(t=>aa(t.oCaml))}),zr.of({name:"Octave",extensions:["m"],load:()=>import("./octave-nXauetiK.js").then(t=>aa(t.octave))}),zr.of({name:"Oz",extensions:["oz"],load:()=>import("./oz-B13mLmyp.js").then(t=>aa(t.oz))}),zr.of({name:"Pascal",extensions:["p","pas"],load:()=>import("./pascal-B_W4OXqj.js").then(t=>aa(t.pascal))}),zr.of({name:"Perl",extensions:["pl","pm"],load:()=>import("./perl-a1VQ4XvC.js").then(t=>aa(t.perl))}),zr.of({name:"Pig",extensions:["pig"],load:()=>import("./pig-BtQy1wID.js").then(t=>aa(t.pig))}),zr.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load:()=>import("./powershell-uO49D63Q.js").then(t=>aa(t.powerShell))}),zr.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load:()=>import("./properties-BhuX6-mY.js").then(t=>aa(t.properties))}),zr.of({name:"ProtoBuf",extensions:["proto"],load:()=>import("./protobuf-CNIIc7zI.js").then(t=>aa(t.protobuf))}),zr.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load:()=>import("./pug-BuYdIlne.js").then(t=>aa(t.pug))}),zr.of({name:"Puppet",extensions:["pp"],load:()=>import("./puppet-ByObhsu2.js").then(t=>aa(t.puppet))}),zr.of({name:"Q",extensions:["q"],load:()=>import("./q-qVcarjaG.js").then(t=>aa(t.q))}),zr.of({name:"R",alias:["rscript"],extensions:["r","R"],load:()=>import("./r-Cd28Rn61.js").then(t=>aa(t.r))}),zr.of({name:"RPM Changes",load:()=>import("./rpm-tHd62SNx.js").then(t=>aa(t.rpmChanges))}),zr.of({name:"RPM Spec",extensions:["spec"],load:()=>import("./rpm-tHd62SNx.js").then(t=>aa(t.rpmSpec))}),zr.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load:()=>import("./ruby-BWVi67xq.js").then(t=>aa(t.ruby))}),zr.of({name:"SAS",extensions:["sas"],load:()=>import("./sas-BwjQFPr2.js").then(t=>aa(t.sas))}),zr.of({name:"Scala",extensions:["scala"],load:()=>import("./clike-D-W_e6Lj.js").then(t=>aa(t.scala))}),zr.of({name:"Scheme",extensions:["scm","ss"],load:()=>import("./scheme-Czr-sVIy.js").then(t=>aa(t.scheme))}),zr.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load:()=>import("./shell-BetDWStl.js").then(t=>aa(t.shell))}),zr.of({name:"Sieve",extensions:["siv","sieve"],load:()=>import("./sieve-rrPKwsBh.js").then(t=>aa(t.sieve))}),zr.of({name:"Smalltalk",extensions:["st"],load:()=>import("./smalltalk-YAI5xh7_.js").then(t=>aa(t.smalltalk))}),zr.of({name:"Solr",load:()=>import("./solr-VDOKdk1b.js").then(t=>aa(t.solr))}),zr.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load:()=>import("./mllike-s7nUnXIp.js").then(t=>aa(t.sml))}),zr.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load:()=>import("./sparql-zO1kYCog.js").then(t=>aa(t.sparql))}),zr.of({name:"Spreadsheet",alias:["excel","formula"],load:()=>import("./spreadsheet-6g8nHE2j.js").then(t=>aa(t.spreadsheet))}),zr.of({name:"Squirrel",extensions:["nut"],load:()=>import("./clike-D-W_e6Lj.js").then(t=>aa(t.squirrel))}),zr.of({name:"Stylus",extensions:["styl"],load:()=>import("./stylus-RHXL_HsJ.js").then(t=>aa(t.stylus))}),zr.of({name:"Swift",extensions:["swift"],load:()=>import("./swift-lfFyPRRo.js").then(t=>aa(t.swift))}),zr.of({name:"sTeX",load:()=>import("./stex-THaXVwNW.js").then(t=>aa(t.stex))}),zr.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load:()=>import("./stex-THaXVwNW.js").then(t=>aa(t.stex))}),zr.of({name:"SystemVerilog",extensions:["v","sv","svh"],load:()=>import("./verilog-BCY2xdlY.js").then(t=>aa(t.verilog))}),zr.of({name:"Tcl",extensions:["tcl"],load:()=>import("./tcl-C4Tb2U0q.js").then(t=>aa(t.tcl))}),zr.of({name:"Textile",extensions:["textile"],load:()=>import("./textile-CnQDonvJ.js").then(t=>aa(t.textile))}),zr.of({name:"TiddlyWiki",load:()=>import("./tiddlywiki-BPc4WZCH.js").then(t=>aa(t.tiddlyWiki))}),zr.of({name:"Tiki wiki",load:()=>import("./tiki-D4dz8j1V.js").then(t=>aa(t.tiki))}),zr.of({name:"TOML",extensions:["toml"],load:()=>import("./toml-88vYtIh1.js").then(t=>aa(t.toml))}),zr.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load:()=>import("./troff-BgVjEoT-.js").then(t=>aa(t.troff))}),zr.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load:()=>import("./ttcn-DdYulzch.js").then(t=>aa(t.ttcn))}),zr.of({name:"TTCN_CFG",extensions:["cfg"],load:()=>import("./ttcn-cfg-LwcHiYmJ.js").then(t=>aa(t.ttcnCfg))}),zr.of({name:"Turtle",extensions:["ttl"],load:()=>import("./turtle-CgiVr9yq.js").then(t=>aa(t.turtle))}),zr.of({name:"Web IDL",extensions:["webidl"],load:()=>import("./webidl-KE8LT1tN.js").then(t=>aa(t.webIDL))}),zr.of({name:"VB.NET",extensions:["vb"],load:()=>import("./vb-BWY0HckZ.js").then(t=>aa(t.vb))}),zr.of({name:"VBScript",extensions:["vbs"],load:()=>import("./vbscript-BBJV-ooB.js").then(t=>aa(t.vbScript))}),zr.of({name:"Velocity",extensions:["vtl"],load:()=>import("./velocity-wom_bhlv.js").then(t=>aa(t.velocity))}),zr.of({name:"Verilog",extensions:["v"],load:()=>import("./verilog-BCY2xdlY.js").then(t=>aa(t.verilog))}),zr.of({name:"VHDL",extensions:["vhd","vhdl"],load:()=>import("./vhdl-BjJYRa0a.js").then(t=>aa(t.vhdl))}),zr.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load:()=>import("./xquery-Ca5C9BJw.js").then(t=>aa(t.xQuery))}),zr.of({name:"Yacas",extensions:["ys"],load:()=>import("./yacas-DGeGvU7X.js").then(t=>aa(t.yacas))}),zr.of({name:"Z80",extensions:["z80"],load:()=>import("./z80-CEYQTt8_.js").then(t=>aa(t.z80))}),zr.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load:()=>import("./mscgen-Br8J94Pi.js").then(t=>aa(t.mscgen))}),zr.of({name:"Xù",extensions:["xu"],load:()=>import("./mscgen-Br8J94Pi.js").then(t=>aa(t.xu))}),zr.of({name:"MsGenny",extensions:["msgenny"],load:()=>import("./mscgen-Br8J94Pi.js").then(t=>aa(t.msgenny))}),zr.of({name:"Vue",extensions:["vue"],load:()=>import("./index-1zAoDu0L.js").then(t=>t.vue())}),zr.of({name:"Angular Template",load:()=>import("./index-DWn_nnHo.js").then(t=>t.angular())})];
|
|
101
|
+
/*!
|
|
102
|
+
* program-language-detector v0.0.12
|
|
103
|
+
* (c) 2018-present ULIVZ <chl814@foxmail.com>
|
|
104
|
+
* Released under the MIT License.
|
|
105
|
+
*/var da={JavaScript:[{pattern:/undefined/g,points:2},{pattern:/console\.log( )*\(/,points:2},{pattern:/(var|const|let)( )+\w+( )*=?/,points:2},{pattern:/(('|").+('|")( )*|\w+):( )*[{\[]/,points:2},{pattern:/\===/g,points:1},{pattern:/!==/g,points:1},{pattern:/function\*?(( )+[\$\w]+( )*\(.*\)|( )*\(.*\))/g,points:1},{pattern:/null/g,points:1},{pattern:/\(.*\)( )*=>( )*.+/,points:1},{pattern:/(else )?if( )+\(.+\)/,points:1},{pattern:/while( )+\(.+\)/,points:1},{pattern:/(^|\s)(char|long|int|float|double)( )+\w+( )*=?/,points:-1},{pattern:/(\w+)( )*\*( )*\w+/,points:-1},{pattern:/<(\/)?script( type=('|")text\/javascript('|"))?>/,points:-50},{pattern:/(import|export(\s+)default)\s+({\s+[\w\s,]+\s+}|\w+)\s+from\s/,points:2},{pattern:/\([^\(\)]{0,}\)\s+=>(\s+{)?/,points:3}],C:[{pattern:/(char|long|int|float|double)( )+\w+( )*=?/,points:2},{pattern:/malloc\(.+\)/,points:2},{pattern:/#include (<|")\w+\.h(>|")/,points:2,nearTop:!0},{pattern:/(\w+)( )*\*( )*\w+/,points:2},{pattern:/(\w+)( )+\w+(;|( )*=)/,points:1},{pattern:/(\w+)( )+\w+\[.+\]/,points:1},{pattern:/#define( )+.+/,points:1},{pattern:/NULL/,points:1},{pattern:/void/g,points:1},{pattern:/(else )?if( )*\(.+\)/,points:1},{pattern:/while( )+\(.+\)/,points:1},{pattern:/(printf|puts)( )*\(.+\)/,points:1},{pattern:/new \w+/,points:-1},{pattern:/'.{2,}'/,points:-1},{pattern:/var( )+\w+( )*=?/,points:-1}],"C++":[{pattern:/(char|long|int|float|double)( )+\w+( )*=?/,points:2},{pattern:/#include( )*(<|")\w+(\.h)?(>|")/,points:2,nearTop:!0},{pattern:/using( )+namespace( )+.+( )*;/,points:2},{pattern:/template( )*<.*>/,points:2},{pattern:/std::\w+/g,points:2},{pattern:/(cout|cin|endl)/g,points:2},{pattern:/(public|protected|private):/,points:2},{pattern:/nullptr/,points:2},{pattern:/new \w+(\(.*\))?/,points:1},{pattern:/#define( )+.+/,points:1},{pattern:/\w+<\w+>/,points:1},{pattern:/class( )+\w+/,points:1},{pattern:/void/g,points:1},{pattern:/(else )?if( )*\(.+\)/,points:1},{pattern:/while( )+\(.+\)/,points:1},{pattern:/\w*::\w+/,points:1},{pattern:/'.{2,}'/,points:-1},{pattern:/(List<\w+>|ArrayList<\w*>( )*\(.*\))(( )+[\w]+|;)/,points:-1}],Python:[{pattern:/def( )+\w+\(.*\)( )*:/,points:2},{pattern:/while (.+):/,points:2},{pattern:/from [\w\.]+ import (\w+|\*)/,points:2},{pattern:/class( )*\w+(\(( )*\w+( )*\))?( )*:/,points:2},{pattern:/if( )+(.+)( )*:/,points:2},{pattern:/elif( )+(.+)( )*:/,points:2},{pattern:/else:/,points:2},{pattern:/for (\w+|\(?\w+,( )*\w+\)?) in (.+):/,points:2},{pattern:/\w+( )*=( )*\w+(?!;)(\n|$)/,points:1},{pattern:/import ([[^\.]\w])+/,points:1,nearTop:!0},{pattern:/print((( )*\(.+\))|( )+.+)/,points:1},{pattern:/(&{2}|\|{2})/,points:-1}],Java:[{pattern:/System\.(in|out)\.\w+/,points:2},{pattern:/(private|protected|public)( )*\w+( )*\w+(( )*=( )*[\w])?/,points:2},{pattern:/(private|protected|public)( )*\w+( )*[\w]+\(.+\)/,points:2},{pattern:/(^|\s)(String)( )+[\w]+( )*=?/,points:2},{pattern:/(List<\w+>|ArrayList<\w*>( )*\(.*\))(( )+[\w]+|;)/,points:2},{pattern:/(public( )*)?class( )*\w+/,points:2},{pattern:/(\w+)(\[( )*\])+( )+\w+/,points:2},{pattern:/final( )*\w+/,points:2},{pattern:/\w+\.(get|set)\(.+\)/,points:2},{pattern:/new [A-Z]\w*( )*\(.+\)/,points:2},{pattern:/(^|\s)(char|long|int|float|double)( )+[\w]+( )*=?/,points:1},{pattern:/(extends|implements)/,points:2,nearTop:!0},{pattern:/null/g,points:1},{pattern:/(else )?if( )*\(.+\)/,points:1},{pattern:/while( )+\(.+\)/,points:1},{pattern:/void/g,points:1},{pattern:/const( )*\w+/,points:-1},{pattern:/(\w+)( )*\*( )*\w+/,points:-1},{pattern:/'.{2,}'/,points:-1},{pattern:/#include( )*(<|")\w+(\.h)?(>|")/,points:-1,nearTop:!0}],HTML:[{pattern:/<!DOCTYPE (html|HTML PUBLIC .+)>/,points:2,nearTop:!0},{pattern:/<[a-z0-9]+(( )*[\w]+=('|").+('|")( )*)?>.*<\/[a-z0-9]+>/g,points:2},{pattern:/[a-z\-]+=("|').+("|')/g,points:2},{pattern:/<\?php/,points:-50}],CSS:[{pattern:/[a-z\-]+:(?!:).+;/,points:2},{pattern:/<(\/)?style>/,points:-50}],Ruby:[{pattern:/(require|include)( )+'\w+(\.rb)?'/,points:2,nearTop:!0},{pattern:/def( )+\w+( )*(\(.+\))?( )*\n/,points:2},{pattern:/@\w+/,points:2},{pattern:/\.\w+\?/,points:2},{pattern:/puts( )+("|').+("|')/,points:2},{pattern:/class [A-Z]\w*( )*<( )*([A-Z]\w*(::)?)+/,points:2},{pattern:/attr_accessor( )+(:\w+(,( )*)?)+/,points:2},{pattern:/\w+\.new( )+/,points:2},{pattern:/elsif/,points:2},{pattern:/do( )*\|(\w+(,( )*\w+)?)+\|/,points:2},{pattern:/for (\w+|\(?\w+,( )*\w+\)?) in (.+)/,points:1},{pattern:/nil/,points:1},{pattern:/[A-Z]\w*::[A-Z]\w*/,points:1}],Go:[{pattern:/package( )+[a-z]+\n/,points:2,nearTop:!0},{pattern:/(import( )*\(( )*\n)|(import( )+"[a-z0-9\/\.]+")/,points:2,nearTop:!0},{pattern:/if.+err( )*!=( )*nil.+{/,points:2},{pattern:/fmt\.Print(f|ln)?\(.*\)/,points:2},{pattern:/func(( )+\w+( )*)?\(.*\).*{/,points:2},{pattern:/\w+( )*:=( )*.+[^;\n]/,points:2},{pattern:/(}( )*else( )*)?if[^\(\)]+{/,points:2},{pattern:/(var|const)( )+\w+( )+[\w\*]+(\n|( )*=|$)/,points:2},{pattern:/[a-z]+\.[A-Z]\w*/,points:1},{pattern:/nil/,points:1},{pattern:/'.{2,}'/,points:-1}],PHP:[{pattern:/<\?php/,points:2},{pattern:/\$\w+/,points:2},{pattern:/use( )+\w+(\\\w+)+( )*;/,points:2,nearTop:!0},{pattern:/\$\w+\->\w+/,points:2},{pattern:/(require|include)(_once)?( )*\(?( )*('|").+\.php('|")( )*\)?( )*;/,points:2},{pattern:/echo( )+('|").+('|")( )*;/,points:1},{pattern:/NULL/,points:1},{pattern:/new( )+((\\\w+)+|\w+)(\(.*\))?/,points:1},{pattern:/function(( )+[\$\w]+\(.*\)|( )*\(.*\))/g,points:1},{pattern:/(else)?if( )+\(.+\)/,points:1},{pattern:/\w+::\w+/,points:1},{pattern:/\===/g,points:1},{pattern:/!==/g,points:1},{pattern:/(^|\s)(var|char|long|int|float|double)( )+\w+( )*=?/,points:-1}],Unknown:[]};function fa(t,e,i){return i.map(function(t){return t.pattern.test(e)?t.points:0}).reduce(function(t,e){return t+e},0)}Object.keys(da).forEach(function(t){});
|
|
106
|
+
/*
|
|
107
|
+
* Copyright IBM Corp. 2025
|
|
108
|
+
*
|
|
109
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
110
|
+
* LICENSE file in the root directory of this source tree.
|
|
111
|
+
*
|
|
112
|
+
* @license
|
|
113
|
+
*/
|
|
114
|
+
const ua={javascript:"JavaScript",js:"JavaScript",node:"JavaScript",nodejs:"JavaScript",typescript:"TypeScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",json:"JSON",jsonld:"JSON-LD",yaml:"YAML",yml:"YAML",html:"HTML",htm:"HTML",xml:"XML",css:"CSS",scss:"SCSS",sass:"Sass",less:"LESS",markdown:"Markdown",md:"Markdown",diff:"diff",patch:"diff",shell:"Shell",bash:"Shell",sh:"Shell",zsh:"Shell",powershell:"PowerShell",ps1:"PowerShell",python:"Python",py:"Python",ruby:"Ruby",rb:"Ruby",go:"Go",golang:"Go",php:"PHP",java:"Java",c:"C","c++":"C++",cpp:"C++","c#":"C#",csharp:"C#",cs:"C#",graphql:"GraphQL",gql:"GraphQL"},pa=/(^|\n)#{1,6}\s|(^|\n)>|(^|\n)(?:-|\d+\.)\s|```|!\[[^\]]*\]\([^)]+\)/,ma=/(^|\n)(diff --|@@|\+\+\+|---|\+[^\n]*|-[^\n]*)/,ga=/^#!\/bin\//,wa=/\b(interface|type|enum)\s+\w+|\bimplements\s+[A-Z]|\breadonly\b|import\s+type\b|:\s*(?:string|number|boolean|unknown|any|void)(?=\s|,|;|\)|$)|<\w+\s*(?:extends\s+\w+)?\s*>/;function va(t){return pa.test(t)?"Markdown":ma.test(t)?"diff":ga.test(t.trim())?"Shell":function(t){if(!t.trim().startsWith("{")&&!t.trim().startsWith("["))return!1;try{return JSON.parse(t),!0}catch{return!1}}(t)?"JSON":null}function ba(t){if(!t)return null;const e=function(t){return t.trim().toLowerCase()}(t);return e&&"unknown"!==e&&"plaintext"!==e?ua[e]??t:null}function ya(t){if(!t)return null;const e=t.trim();if(!e)return null;const i=va(e);if(i)return i;try{const t=function(t){var e=Object.assign({heuristic:!0,statistics:!1},{}),i=t.replace(/\r\n?/g,"\n").replace(/\n{2,}/g,"\n").split("\n");function n(t){return i.length<=10||t<i.length/10}e.heuristic&&i.length>500&&(i=i.filter(function(t,e){return!!n(e)||e%Math.ceil(i.length/500)===0}));var o=Object.keys(da).map(function(t){return{language:t,checkers:da[t]}}).map(function(t){var e=t.language,o=t.checkers;return"Unknown"===e?{language:"Unknown",points:1}:{language:e,points:i.map(function(t,e){return n(e)?fa(0,t,o):fa(0,t,o.filter(function(t){return!t.nearTop}))}).reduce(function(t,e){return t+e})}}),s=o.sort(function(t,e){return t.points-e.points}),r=s[s.length-1];if(e.statistics){var l={};return o.forEach(function(t){l[t.language]=t.points}),{detected:r.language,statistics:l}}return r.language}(e),i=ba(t);return function(t,e){return"JavaScript"!==t&&"CSS"!==t||!wa.test(e)?!t&&wa.test(e)?"TypeScript":t:"TypeScript"}(i,e)??i??null}catch{return i}}
|
|
115
|
+
/*
|
|
116
|
+
* Copyright IBM Corp. 2025
|
|
117
|
+
*
|
|
118
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
119
|
+
* LICENSE file in the root directory of this source tree.
|
|
120
|
+
*
|
|
121
|
+
* @license
|
|
122
|
+
*/function xa(t){return t.load()}function ka(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let o=t(e,i);return!!o&&(n(i.update(o)),!0)}}const Sa=ka(Oa,0),Ca=ka(Ta,0),Aa=ka((t,e)=>Ta(t,e,function(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),o=i.to<=n.to?n:t.doc.lineAt(i.to);o.from>n.from&&o.from==i.to&&(o=i.to==n.to+1?n:t.doc.lineAt(i.to-1));let s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=o.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:o.to})}return e}(e)),0);function Ma(t,e){let i=t.languageDataAt("commentTokens",e,1);return i.length?i[0]:{}}const Da=50;function Ta(t,e,i=e.selection.ranges){let n=i.map(t=>Ma(e,t.from).block);if(!n.every(t=>t))return null;let o=i.map((t,i)=>function(t,{open:e,close:i},n,o){let s,r,l=t.sliceDoc(n-Da,n),a=t.sliceDoc(o,o+Da),h=/\s*$/.exec(l)[0].length,c=/^\s*/.exec(a)[0].length,d=l.length-h;if(l.slice(d-e.length,d)==e&&a.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:o+c,margin:c&&1}};o-n<=2*Da?s=r=t.sliceDoc(n,o):(s=t.sliceDoc(n,n+Da),r=t.sliceDoc(o-Da,o));let f=/^\s*/.exec(s)[0].length,u=/\s*$/.exec(r)[0].length,p=r.length-u-i.length;return s.slice(f,f+e.length)==e&&r.slice(p,p+i.length)==i?{open:{pos:n+f+e.length,margin:/\s/.test(s.charAt(f+e.length))?1:0},close:{pos:o-u-i.length,margin:/\s/.test(r.charAt(p-1))?1:0}}:null}(e,n[i],t.from,t.to));if(2!=t&&!o.every(t=>t))return{changes:e.changes(i.map((t,e)=>o[e]?[]:[{from:t.from,insert:n[e].open+" "},{from:t.to,insert:" "+n[e].close}]))};if(1!=t&&o.some(t=>t)){let t=[];for(let e,i=0;i<o.length;i++)if(e=o[i]){let o=n[i],{open:s,close:r}=e;t.push({from:s.pos-o.open.length,to:s.pos+s.margin},{from:r.pos-r.margin,to:r.pos+o.close.length})}return{changes:t}}return null}function Oa(t,e,i=e.selection.ranges){let n=[],o=-1;for(let{from:t,to:s}of i){let i=n.length,r=1e9,l=Ma(e,t).line;if(l){for(let i=t;i<=s;){let a=e.doc.lineAt(i);if(a.from>o&&(t==s||s>a.from)){o=a.from;let t=/^\s*/.exec(a.text)[0].length,e=t==a.length,i=a.text.slice(t,t+l.length)==l?t:-1;t<a.text.length&&t<r&&(r=t),n.push({line:a,comment:i,token:l,indent:t,empty:e,single:!1})}i=a.to+1}if(r<1e9)for(let t=i;t<n.length;t++)n[t].indent<n[t].line.text.length&&(n[t].indent=r);n.length==i+1&&(n[i].single=!0)}}if(2!=t&&n.some(t=>t.comment<0&&(!t.empty||t.single))){let t=[];for(let{line:e,token:i,indent:o,empty:s,single:r}of n)!r&&s||t.push({from:e.from+o,insert:i+" "});let i=e.changes(t);return{changes:i,selection:e.selection.map(i,1)}}if(1!=t&&n.some(t=>t.comment>=0)){let t=[];for(let{line:e,comment:i,token:o}of n)if(i>=0){let n=e.from+i,s=n+o.length;" "==e.text[s-e.from]&&s++,t.push({from:n,to:s})}return{changes:t}}return null}function La(t,e){return s.create(t.ranges.map(e),t.mainIndex)}function Ba(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Ea({state:t,dispatch:e},i){let n=La(t.selection,i);return!n.eq(t.selection,!0)&&(e(Ba(t,n)),!0)}function Pa(t,e){return s.cursor(e?t.to:t.from)}function Ra(t,e){return Ea(t,i=>i.empty?t.moveByChar(i,e):Pa(i,e))}function Na(t){return t.textDirectionAt(t.state.selection.main.head)==$e.LTR}const ja=t=>Ra(t,!Na(t)),Ha=t=>Ra(t,Na(t));function Ia(t,e){return Ea(t,i=>i.empty?t.moveByGroup(i,e):Pa(i,e))}function Va(t,e,i){if(e.type.prop(i))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Fa(t,e,i){let n,o,r=Lr(t).resolveInner(e.head),l=i?T.closedBy:T.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Va(t,e,l)?r=e:n=i?e.to:e.from}return o=r.type.prop(l)&&(n=i?zl(t,r.from,1):zl(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,s.cursor(o,i?-1:1)}function za(t,e){return Ea(t,i=>{if(!i.empty)return Pa(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)})}const Wa=t=>za(t,!1),qa=t=>za(t,!0);function _a(t){let e,i=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,o=0;if(i){for(let e of t.state.facet(No.scrollMargins)){let i=e(t);(null==i?void 0:i.top)&&(n=Math.max(null==i?void 0:i.top,n)),(null==i?void 0:i.bottom)&&(o=Math.max(null==i?void 0:i.bottom,o))}e=t.scrollDOM.clientHeight-n-o}else e=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:o,selfScroll:i,height:Math.max(t.defaultLineHeight,e-5)}}function Ka(t,e){let i,n=_a(t),{state:o}=t,s=La(o.selection,i=>i.empty?t.moveVertically(i,e,n.height):Pa(i,e));if(s.eq(o.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(o.selection.main.head),r=t.scrollDOM.getBoundingClientRect(),l=r.top+n.marginTop,a=r.bottom-n.marginBottom;e&&e.top>l&&e.bottom<a&&(i=No.scrollIntoView(s.main.head,{y:"start",yMargin:e.top-l}))}return t.dispatch(Ba(o,s),{effects:i}),!0}const $a=t=>Ka(t,!1),Ua=t=>Ka(t,!0);function Ga(t,e,i){let n=t.lineBlockAt(e.head),o=t.moveToLineBoundary(e,i);if(o.head==e.head&&o.head!=(i?n.to:n.from)&&(o=t.moveToLineBoundary(e,i,!1)),!i&&o.head==n.from&&n.length){let i=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;i&&e.head!=n.from+i&&(o=s.cursor(n.from+i))}return o}function Ya(t,e){let i=La(t.state.selection,t=>{let i=e(t);return s.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return!i.eq(t.state.selection)&&(t.dispatch(Ba(t.state,i)),!0)}function Xa(t,e){return Ya(t,i=>t.moveByChar(i,e))}const Qa=t=>Xa(t,!Na(t)),Ja=t=>Xa(t,Na(t));function Za(t,e){return Ya(t,i=>t.moveByGroup(i,e))}function th(t,e){return Ya(t,i=>t.moveVertically(i,e))}const eh=t=>th(t,!1),ih=t=>th(t,!0);function nh(t,e){return Ya(t,i=>t.moveVertically(i,e,_a(t).height))}const oh=t=>nh(t,!1),sh=t=>nh(t,!0),rh=({state:t,dispatch:e})=>(e(Ba(t,{anchor:0})),!0),lh=({state:t,dispatch:e})=>(e(Ba(t,{anchor:t.doc.length})),!0),ah=({state:t,dispatch:e})=>(e(Ba(t,{anchor:t.selection.main.anchor,head:0})),!0),hh=({state:t,dispatch:e})=>(e(Ba(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function ch(t,e){let{state:i}=t,n=i.selection,o=i.selection.ranges.slice();for(let n of i.selection.ranges){let s=i.doc.lineAt(n.head);if(e?s.to<t.state.doc.length:s.from>0)for(let i=n;;){let n=t.moveVertically(i,e);if(n.head<s.from||n.head>s.to){o.some(t=>t.head==n.head)||o.push(n);break}if(n.head==i.head)break;i=n}}return o.length!=n.ranges.length&&(t.dispatch(Ba(i,s.create(o,o.length-1))),!0)}function dh(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,o=n.changeByRange(n=>{let{from:o,to:r}=n;if(o==r){let s=e(n);s<o?(i="delete.backward",s=fh(t,s,!1)):s>o&&(i="delete.forward",s=fh(t,s,!0)),o=Math.min(o,s),r=Math.max(r,s)}else o=fh(t,o,!1),r=fh(t,r,!0);return o==r?{range:n}:{changes:{from:o,to:r},range:s.cursor(o,o<n.head?-1:1)}});return!o.changes.empty&&(t.dispatch(n.update(o,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?No.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function fh(t,e,i){if(t instanceof No)for(let n of t.state.facet(No.atomicRanges).map(e=>e(t)))n.between(e,e,(t,n)=>{t<e&&n>e&&(e=i?n:t)});return e}const uh=(t,e,i)=>dh(t,n=>{let o,s,r=n.from,{state:l}=t,a=l.doc.lineAt(r);if(i&&!e&&r>a.from&&r<a.from+200&&!/[^ \t]/.test(o=a.text.slice(0,r-a.from))){if("\t"==o[o.length-1])return r-1;let t=y(o,l.tabSize)%_r(l)||_r(l);for(let e=0;e<t&&" "==o[o.length-1-e];e++)r--;s=r}else s=c(a.text,r-a.from,e,e)+a.from,s==r&&a.number!=(e?l.doc.lines:1)?s+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(s-a.from,r-a.from))&&(s=c(a.text,s-a.from,!1,!1)+a.from);return s}),ph=t=>uh(t,!1,!0),mh=t=>uh(t,!0,!1),gh=(t,e)=>dh(t,i=>{let n=i.head,{state:o}=t,s=o.doc.lineAt(n),r=o.charCategorizer(n);for(let t=null;;){if(n==(e?s.to:s.from)){n==i.head&&s.number!=(e?o.doc.lines:1)&&(n+=e?1:-1);break}let l=c(s.text,n-s.from,e)+s.from,a=s.text.slice(Math.min(n,l)-s.from,Math.max(n,l)-s.from),h=r(a);if(null!=t&&h!=t)break;" "==a&&n==i.head||(t=h),n=l}return n}),wh=t=>gh(t,!1);function vh(t){let e=[],i=-1;for(let n of t.selection.ranges){let o=t.doc.lineAt(n.from),s=t.doc.lineAt(n.to);if(n.empty||n.to!=s.from||(s=t.doc.lineAt(n.to-1)),i>=o.number){let t=e[e.length-1];t.to=s.to,t.ranges.push(n)}else e.push({from:o.from,to:s.to,ranges:[n]});i=s.number+1}return e}function bh(t,e,i){if(t.readOnly)return!1;let n=[],o=[];for(let e of vh(t)){if(i?e.to==t.doc.length:0==e.from)continue;let r=t.doc.lineAt(i?e.to+1:e.from-1),l=r.length+1;if(i){n.push({from:e.to,to:r.to},{from:e.from,insert:r.text+t.lineBreak});for(let i of e.ranges)o.push(s.range(Math.min(t.doc.length,i.anchor+l),Math.min(t.doc.length,i.head+l)))}else{n.push({from:r.from,to:e.from},{from:e.to,insert:t.lineBreak+r.text});for(let t of e.ranges)o.push(s.range(t.anchor-l,t.head-l))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:s.create(o,t.selection.mainIndex),userEvent:"move.line"})),!0)}function yh(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of vh(t))i?n.push({from:e.from,insert:t.doc.slice(e.from,e.to)+t.lineBreak}):n.push({from:e.to,insert:t.lineBreak+t.doc.slice(e.from,e.to)});return e(t.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const xh=kh(!1);function kh(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>{let{from:n,to:o}=i,r=e.doc.lineAt(n),a=!t&&n==o&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Lr(t).resolveInner(e),o=n.childBefore(e),s=n.childAfter(e);return o&&s&&o.to<=e&&s.from>=e&&(i=o.type.prop(T.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(o.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(o.to,s.from))?{from:o.to,to:s.from}:null}(e,n);t&&(n=o=(o<=r.to?r:e.doc.lineAt(o)).to);let h=new Ur(e,{simulateBreak:n,simulateDoubleBreak:!!a}),c=$r(h,n);for(null==c&&(c=y(/^\s*/.exec(e.doc.lineAt(n).text)[0],e.tabSize));o<r.to&&/\s/.test(r.text[o-r.from]);)o++;a?({from:n,to:o}=a):n>r.from&&n<r.from+100&&!/\S/.test(r.text.slice(0,n))&&(n=r.from);let d=["",Kr(e,c)];return a&&d.push(Kr(e,h.lineIndent(r.from,-1))),{changes:{from:n,to:o,insert:l.of(d)},range:s.cursor(n+1+d[1].length)}});return i(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Sh(t,e){let i=-1;return t.changeByRange(n=>{let o=[];for(let s=n.from;s<=n.to;){let r=t.doc.lineAt(s);r.number>i&&(n.empty||n.to>r.from)&&(e(r,o,n),i=r.number),s=r.to+1}let r=t.changes(o);return{changes:o,range:s.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}})}const Ch=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:t=>Ea(t,e=>Fa(t.state,e,!Na(t))),shift:t=>Ya(t,e=>Fa(t.state,e,!Na(t)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>Ea(t,e=>Fa(t.state,e,Na(t))),shift:t=>Ya(t,e=>Fa(t.state,e,Na(t)))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>bh(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>yh(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>bh(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>yh(t,e,!0)},{key:"Mod-Alt-ArrowUp",run:t=>ch(t,!1)},{key:"Mod-Alt-ArrowDown",run:t=>ch(t,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=s.create([i.main]):i.main.empty||(n=s.create([s.cursor(i.main.head)])),!!n&&(e(Ba(t,n)),!0)}},{key:"Mod-Enter",run:kh(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=vh(t).map(({from:e,to:i})=>s.range(e,Math.min(i+1,t.doc.length)));return e(t.update({selection:s.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=La(t.selection,e=>{let i=Lr(t),n=i.resolveStack(e.from,1);if(e.empty){let t=i.resolveStack(e.from,-1);t.node.from>=n.node.from&&t.node.to<=n.node.to&&(n=t)}for(let t=n;t;t=t.next){let{node:i}=t;if((i.from<e.from&&i.to>=e.to||i.to>e.to&&i.from<=e.from)&&t.next)return s.range(i.to,i.from)}return e});return!i.eq(t.selection)&&(e(Ba(t,i)),!0)},preventDefault:!0},{key:"Mod-[",run:({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Sh(t,(e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let o=y(n,t.tabSize),s=0,r=Kr(t,Math.max(0,o-_r(t)));for(;s<n.length&&s<r.length&&n.charCodeAt(s)==r.charCodeAt(s);)s++;i.push({from:e.from+s,to:e.from+n.length,insert:r.slice(s)})}),{userEvent:"delete.dedent"})),!0)},{key:"Mod-]",run:({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Sh(t,(e,i)=>{i.push({from:e.from,insert:t.facet(qr)})}),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new Ur(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),o=Sh(t,(e,o,s)=>{let r=$r(n,e.from);if(null==r)return;/\S/.test(e.text)||(r=0);let l=/^\s*/.exec(e.text)[0],a=Kr(t,r);(l!=a||s.from<e.from+l.length)&&(i[e.from]=r,o.push({from:e.from,to:e.from+l.length,insert:a}))});return o.changes.empty||e(t.update(o,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(vh(e).map(({from:t,to:i})=>(t>0?t--:i<e.doc.length&&i++,{from:t,to:i}))),n=La(e.selection,e=>{let i;if(t.lineWrapping){let n=t.lineBlockAt(e.head),o=t.coordsAtPos(e.head,e.assoc||1);o&&(i=n.bottom+t.documentTop-o.bottom+t.defaultLineHeight/2)}return t.moveVertically(e,!0,i)}).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:t,dispatch:e})=>function(t,e){let i=!1,n=La(t.selection,e=>{let n=zl(t,e.head,-1)||zl(t,e.head,1)||e.head>0&&zl(t,e.head-1,1)||e.head<t.doc.length&&zl(t,e.head+1,-1);if(!n||!n.end)return e;i=!0;let o=n.start.from==e.head?n.end.to:n.end.from;return s.cursor(o)});return!!i&&(e(Ba(t,n)),!0)}(t,e)},{key:"Mod-/",run:t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=Ma(t.state,i.from);return n.line?Sa(t):!!n.block&&Aa(t)}},{key:"Alt-A",run:Ca},{key:"Ctrl-m",mac:"Shift-Alt-m",run:t=>(t.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:ja,shift:Qa,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Ia(t,!Na(t)),shift:t=>Za(t,!Na(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>Ea(t,e=>Ga(t,e,!Na(t))),shift:t=>Ya(t,e=>Ga(t,e,!Na(t))),preventDefault:!0},{key:"ArrowRight",run:Ha,shift:Ja,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Ia(t,Na(t)),shift:t=>Za(t,Na(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>Ea(t,e=>Ga(t,e,Na(t))),shift:t=>Ya(t,e=>Ga(t,e,Na(t))),preventDefault:!0},{key:"ArrowUp",run:Wa,shift:eh,preventDefault:!0},{mac:"Cmd-ArrowUp",run:rh,shift:ah},{mac:"Ctrl-ArrowUp",run:$a,shift:oh},{key:"ArrowDown",run:qa,shift:ih,preventDefault:!0},{mac:"Cmd-ArrowDown",run:lh,shift:hh},{mac:"Ctrl-ArrowDown",run:Ua,shift:sh},{key:"PageUp",run:$a,shift:oh},{key:"PageDown",run:Ua,shift:sh},{key:"Home",run:t=>Ea(t,e=>Ga(t,e,!1)),shift:t=>Ya(t,e=>Ga(t,e,!1)),preventDefault:!0},{key:"Mod-Home",run:rh,shift:ah},{key:"End",run:t=>Ea(t,e=>Ga(t,e,!0)),shift:t=>Ya(t,e=>Ga(t,e,!0)),preventDefault:!0},{key:"Mod-End",run:lh,shift:hh},{key:"Enter",run:xh,shift:xh},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:ph,shift:ph,preventDefault:!0},{key:"Delete",run:mh,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:wh,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>gh(t,!0),preventDefault:!0},{mac:"Mod-Backspace",run:t=>dh(t,e=>{let i=t.moveToLineBoundary(e,!1).head;return e.head>i?i:Math.max(0,e.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:t=>dh(t,e=>{let i=t.moveToLineBoundary(e,!0).head;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}),preventDefault:!0}].concat([{key:"Ctrl-b",run:ja,shift:Qa,preventDefault:!0},{key:"Ctrl-f",run:Ha,shift:Ja},{key:"Ctrl-p",run:Wa,shift:eh},{key:"Ctrl-n",run:qa,shift:ih},{key:"Ctrl-a",run:t=>Ea(t,e=>s.cursor(t.lineBlockAt(e.head).from,1)),shift:t=>Ya(t,e=>s.cursor(t.lineBlockAt(e.head).from))},{key:"Ctrl-e",run:t=>Ea(t,e=>s.cursor(t.lineBlockAt(e.head).to,-1)),shift:t=>Ya(t,e=>s.cursor(t.lineBlockAt(e.head).to))},{key:"Ctrl-d",run:mh},{key:"Ctrl-h",run:ph},{key:"Ctrl-k",run:t=>dh(t,e=>{let i=t.lineBlockAt(e.head).to;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)})},{key:"Ctrl-Alt-h",run:wh},{key:"Ctrl-o",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:l.of(["",""])},range:s.cursor(t.from)}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(e=>{if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};let i=e.from,n=t.doc.lineAt(i),o=i==n.from?i-1:c(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:c(n.text,i-n.from,!0)+n.from;return{changes:{from:o,to:r,insert:t.doc.slice(i,r).append(t.doc.slice(o,i))},range:s.cursor(r)}});return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:Ua}].map(t=>({mac:t.key,run:t.run,shift:t.shift}))));class Ah{constructor(t,e,i,n){this.state=t,this.pos=e,this.explicit=i,this.view=n,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let e=Lr(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),o=n.search(function(t){var e;let{source:i}=t,n="$"!=i[i.length-1];return n?new RegExp(`(?:${i})${n?"$":""}`,null!==(e=t.flags)&&void 0!==e?e:t.ignoreCase?"i":""):t}(t));return o<0?null:{from:i+o,to:this.pos,text:n.slice(o)}}get aborted(){return null==this.abortListeners}addEventListener(t,e,i){"abort"==t&&this.abortListeners&&(this.abortListeners.push(e),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function Mh(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Dh(t){let e=t.map(t=>"string"==typeof t?{label:t}:t),[i,n]=e.every(t=>/^\w+$/.test(t.label))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t<n.length;t++)i[n[t]]=!0}let n=Mh(e)+Mh(i)+"*$";return[new RegExp("^"+n),new RegExp(n)]}(e);return t=>{let o=t.matchBefore(n);return o||t.explicit?{from:o?o.from:t.pos,options:e,validFor:i}:null}}function Th(t,e){return i=>{for(let e=Lr(i.state).resolveInner(i.pos,-1);e;e=e.parent){if(t.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return e(i)}}const Oh=o.define(),Lh=No.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"},".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"}}});class Bh{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class Eh{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,p.TrackDel),i=t.mapPos(this.to,1,p.TrackDel);return null==e||null==i?null:new Eh(this.field,e,i)}}class Ph{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],o=t.doc.lineAt(e),s=/^\s*/.exec(o.text)[0];for(let o of this.lines){if(i.length){let i=s,r=/^\t*/.exec(o)[0].length;for(let e=0;e<r;e++)i+=t.facet(qr);n.push(e+i.length-r),o=i+o.slice(r)}i.push(o),e+=o.length+1}let r=this.fieldPositions.map(t=>new Eh(t.field,n[t.line]+t.from,n[t.line]+t.to));return{text:i,ranges:r}}static parse(t){let e,i=[],n=[],o=[];for(let s of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(s);){let t=e[1]?+e[1]:null,r=e[2]||e[3]||"",l=-1,a=r.replace(/\\[{}]/g,t=>t[1]);for(let e=0;e<i.length;e++)(null!=t?i[e].seq==t:a&&i[e].name==a)&&(l=e);if(l<0){let e=0;for(;e<i.length&&(null==t||null!=i[e].seq&&i[e].seq<t);)e++;i.splice(e,0,{seq:t,name:a}),l=e;for(let t of o)t.field>=l&&t.field++}for(let t of o)if(t.line==n.length&&t.from>e.index){let i=e[2]?3+(e[1]||"").length:2;t.from-=i,t.to-=i}o.push(new Bh(l,n.length,e.index,e.index+a.length)),s=s.slice(0,e.index)+r+s.slice(e.index+e[0].length)}s=s.replace(/\\([{}])/g,(t,e,i)=>{for(let t of o)t.line==n.length&&t.from>i&&(t.from--,t.to--);return e}),n.push(s)}return new Ph(n,o)}}let Rh=Re.widget({widget:new class extends Ee{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Nh=Re.mark({class:"cm-snippetField"});class jh{constructor(t,e){this.ranges=t,this.active=e,this.deco=Re.set(t.map(t=>(t.from==t.to?Rh:Nh).range(t.from,t.to)),!0)}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new jh(e,this.active)}selectionInsideField(t){return t.ranges.every(t=>this.ranges.some(e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))}}const Hh=e.define({map:(t,e)=>t&&t.map(e)}),Ih=e.define(),Vh=w.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(Hh))return i.value;if(i.is(Ih)&&t)return new jh(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>No.decorations.from(t,t=>t?t.deco:Re.none)});function Fh(t,e){return s.create(t.filter(t=>t.field==e).map(t=>s.range(t.from,t.to)))}function zh(t){let i=Ph.parse(t);return(t,o,s,r)=>{let{text:a,ranges:h}=i.instantiate(t.state,s),{main:c}=t.state.selection,d={changes:{from:s,to:r==c.from?c.to:r,insert:l.of(a)},scrollIntoView:!0,annotations:o?[Oh.of(o),n.userEvent.of("input.complete")]:void 0};if(h.length&&(d.selection=Fh(h,0)),h.some(t=>t.field>0)){let i=new jh(h,0),n=d.effects=[Hh.of(i)];void 0===t.state.field(Vh,!1)&&n.push(e.appendConfig.of([Vh,Kh,Uh,Lh]))}t.dispatch(t.state.update(d))}}function Wh(t){return({state:e,dispatch:i})=>{let n=e.field(Vh,!1);if(!n||t<0&&0==n.active)return!1;let o=n.active+t,s=t>0&&!n.ranges.some(e=>e.field==o+t);return i(e.update({selection:Fh(n.ranges,o),effects:Hh.of(s?null:new jh(n.ranges,o)),scrollIntoView:!0})),!0}}const qh=[{key:"Tab",run:Wh(1),shift:Wh(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Vh,!1)&&(e(t.update({effects:Hh.of(null)})),!0)}],_h=i.define({combine:t=>t.length?t[0]:qh}),Kh=r.highest(qo.compute([_h],t=>t.facet(_h)));function $h(t,e){return{...e,apply:zh(t)}}const Uh=No.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Vh,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let o=n.ranges.find(t=>t.from<=i&&t.to>=i);return!(!o||o.field==n.active)&&(e.dispatch({selection:Fh(n.ranges,o.field),effects:Hh.of(n.ranges.some(t=>t.field>o.field)?new jh(n.ranges,o.field):null),scrollIntoView:!0}),!0)}}),Gh={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Yh=e.define({map(t,e){let i=e.mapPos(t,-1,p.TrackAfter);return null==i?void 0:i}}),Xh=new class extends d{};Xh.startSide=1,Xh.endSide=-1;const Qh=w.define({create:()=>h.empty,update(t,e){if(t=t.map(e.changes),e.selection){let i=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:t=>t>=i.from&&t<=i.to})}for(let i of e.effects)i.is(Yh)&&(t=t.update({add:[Xh.range(i.value,i.value+1)]}));return t}});const Jh="()[]{}<>«»»«[]{}";function Zh(t){for(let e=0;e<16;e+=2)if(Jh.charCodeAt(e)==t)return Jh.charAt(e+1);return x(t<128?t:t+1)}function tc(t,e){return t.languageDataAt("closeBrackets",e)[0]||Gh}const ec="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),ic=No.inputHandler.of((t,e,i,n)=>{if((ec?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let o=t.state.selection.main;if(n.length>2||2==n.length&&1==g(m(n,0))||e!=o.from||i!=o.to)return!1;let s=function(t,e){let i=tc(t,t.selection.main.head),n=i.brackets||Gh.brackets;for(let o of n){let s=Zh(m(o,0));if(e==o)return s==o?ac(t,o,n.indexOf(o+o+o)>-1,i):rc(t,o,s,i.before||Gh.before);if(e==s&&oc(t,t.selection.main.from))return lc(t,o,s)}return null}(t.state,n);return!!s&&(t.dispatch(s),!0)}),nc=[{key:"Backspace",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=tc(t,t.selection.main.head).brackets||Gh.brackets,n=null,o=t.changeByRange(e=>{if(e.empty){let n=function(t,e){let i=t.sliceString(e-2,e);return g(m(i,0))==i.length?i:i.slice(1)}(t.doc,e.head);for(let o of i)if(o==n&&sc(t.doc,e.head)==Zh(m(o,0)))return{changes:{from:e.head-o.length,to:e.head+o.length},range:s.cursor(e.head-o.length)}}return{range:n=e}});return n||e(t.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!n}}];function oc(t,e){let i=!1;return t.field(Qh).between(0,t.doc.length,t=>{t==e&&(i=!0)}),i}function sc(t,e){let i=t.sliceString(e,e+2);return i.slice(0,g(m(i,0)))}function rc(t,e,i,n){let o=null,r=t.changeByRange(r=>{if(!r.empty)return{changes:[{insert:e,from:r.from},{insert:i,from:r.to}],effects:Yh.of(r.to+e.length),range:s.range(r.anchor+e.length,r.head+e.length)};let l=sc(t.doc,r.head);return!l||/\s/.test(l)||n.indexOf(l)>-1?{changes:{insert:e+i,from:r.head},effects:Yh.of(r.head+e.length),range:s.cursor(r.head+e.length)}:{range:o=r}});return o?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function lc(t,e,i){let n=null,o=t.changeByRange(e=>e.empty&&sc(t.doc,e.head)==i?{changes:{from:e.head,to:e.head+i.length,insert:i},range:s.cursor(e.head+i.length)}:n={range:e});return n?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function ac(t,e,i,n){let o=n.stringPrefixes||Gh.stringPrefixes,r=null,l=t.changeByRange(n=>{if(!n.empty)return{changes:[{insert:e,from:n.from},{insert:e,from:n.to}],effects:Yh.of(n.to+e.length),range:s.range(n.anchor+e.length,n.head+e.length)};let l,a=n.head,h=sc(t.doc,a);if(h==e){if(hc(t,a))return{changes:{insert:e+e,from:a},effects:Yh.of(a+e.length),range:s.cursor(a+e.length)};if(oc(t,a)){let n=i&&t.sliceDoc(a,a+3*e.length)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+n.length,insert:n},range:s.cursor(a+n.length)}}}else{if(i&&t.sliceDoc(a-2*e.length,a)==e+e&&(l=cc(t,a-2*e.length,o))>-1&&hc(t,l))return{changes:{insert:e+e+e+e,from:a},effects:Yh.of(a+e.length),range:s.cursor(a+e.length)};if(t.charCategorizer(a)(h)!=v.Word&&cc(t,a,o)>-1&&!function(t,e,i,n){let o=Lr(t).resolveInner(e,-1),s=n.reduce((t,e)=>Math.max(t,e.length),0);for(let r=0;r<5;r++){let r=t.sliceDoc(o.from,Math.min(o.to,o.from+i.length+s)),l=r.indexOf(i);if(!l||l>-1&&n.indexOf(r.slice(0,l))>-1){let e=o.firstChild;for(;e&&e.from==o.from&&e.to-e.from>i.length+l;){if(t.sliceDoc(e.to-i.length,e.to)==i)return!1;e=e.firstChild}return!0}let a=o.to==e&&o.parent;if(!a)break;o=a}return!1}(t,a,e,o))return{changes:{insert:e+e,from:a},effects:Yh.of(a+e.length),range:s.cursor(a+e.length)}}return{range:r=n}});return r?null:t.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function hc(t,e){let i=Lr(t).resolveInner(e+1);return i.parent&&i.from==e}function cc(t,e,i){let n=t.charCategorizer(e);if(n(t.sliceDoc(e-1,e))!=v.Word)return e;for(let o of i){let i=e-o.length;if(t.sliceDoc(i,e)==o&&n(t.sliceDoc(i-1,i))!=v.Word)return i}return-1}class dc{constructor(t,e,i){this.from=t,this.to=e,this.diagnostic=i}}class fc{constructor(t,e,i){this.diagnostics=t,this.panel=e,this.selected=i}static init(t,e,i){let n=i.facet(Sc).markerFilter;n&&(t=n(t,i));let o=t.slice().sort((t,e)=>t.from-e.from||t.to-e.to),s=new b,r=[],l=0,a=i.doc.iter(),h=0,c=i.doc.length;for(let t=0;;){let e,i,n=t==o.length?null:o[t];if(!n&&!r.length)break;if(r.length)e=l,i=r.reduce((t,e)=>Math.min(t,e.to),n&&n.from>e?n.from:1e8);else{if(e=n.from,e>c)break;i=n.to,r.push(n),t++}for(;t<o.length;){let n=o[t];if(n.from!=e||!(n.to>n.from||n.to==e)){i=Math.min(n.from,i);break}r.push(n),t++,i=Math.min(n.to,i)}i=Math.min(i,c);let d=!1;if(r.some(t=>t.from==e&&(t.to==i||i==c))&&(d=e==i,!d&&i-e<10)){let t=e-(h+a.value.length);t>0&&(a.next(t),h=e);for(let t=e;;){if(t>=i){d=!0;break}if(!a.lineBreak&&h+a.value.length>t)break;t=h+a.value.length,h+=a.value.length,a.next()}}let f=Pc(r);if(d)s.add(e,e,Re.widget({widget:new Dc(f),diagnostics:r.slice()}));else{let t=r.reduce((t,e)=>e.markClass?t+" "+e.markClass:t,"");s.add(e,i,Re.mark({class:"cm-lintRange cm-lintRange-"+f+t,diagnostics:r.slice(),inclusiveEnd:r.some(t=>t.to>i)}))}if(l=i,l==c)break;for(let t=0;t<r.length;t++)r[t].to<=l&&r.splice(t--,1)}let d=s.finish();return new fc(d,e,uc(d))}}function uc(t,e=null,i=0){let n=null;return t.between(i,1e9,(t,i,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(n){if(o.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new dc(n.from,i,n.diagnostic)}else n=new dc(t,i,e||o.diagnostics[0])}),n}const pc=e.define(),mc=e.define(),gc=e.define(),wc=w.define({create:()=>new fc(Re.none,null,null),update(t,e){if(e.docChanged&&t.diagnostics.size){let i=t.diagnostics.map(e.changes),n=null,o=t.panel;if(t.selected){let o=e.changes.mapPos(t.selected.from,1);n=uc(i,t.selected.diagnostic,o)||uc(i,null,o)}!i.size&&o&&e.state.facet(Sc).autoPanel&&(o=null),t=new fc(i,o,n)}for(let i of e.effects)if(i.is(pc)){let n=e.state.facet(Sc).autoPanel?i.value.length?Oc.open:null:t.panel;t=fc.init(i.value,n,e.state)}else i.is(mc)?t=new fc(t.diagnostics,i.value?Oc.open:null,t.selected):i.is(gc)&&(t=new fc(t.diagnostics,t.panel,i.value));return t},provide:t=>[Ts.from(t,t=>t.panel),No.decorations.from(t,t=>t.diagnostics)]}),vc=Re.mark({class:"cm-lintRange cm-lintRange-active"});function bc(t,e,i){let n,{diagnostics:o}=t.state.field(wc),s=-1,r=-1;o.between(e-(i<0?1:0),e+(i>0?1:0),(t,o,{spec:l})=>{if(e>=t&&e<=o&&(t==o||(e>t||i>0)&&(e<o||i<0)))return n=l.diagnostics,s=t,r=o,!1});let l=t.state.facet(Sc).tooltipFilter;return n&&l&&(n=l(n,t.state)),n?{pos:s,end:r,above:t.state.doc.lineAt(s).to<r,create:()=>({dom:yc(t,n)})}:null}function yc(t,e){return Lt("ul",{class:"cm-tooltip-lint"},e.map(e=>Mc(t,e,!1)))}const xc=t=>{let e=t.state.field(wc,!1);return!(!e||!e.panel)&&(t.dispatch({effects:mc.of(!1)}),!0)},kc=[{key:"Mod-Shift-m",run:t=>{let i=t.state.field(wc,!1);var n,o;i&&i.panel||t.dispatch({effects:(n=t.state,o=[mc.of(!0)],n.field(wc,!1)?o:o.concat(e.appendConfig.of(Rc)))});let s=function(t,e){let i=t.plugin(As),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}(t,Oc.open);return s&&s.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:t=>{let e=t.state.field(wc,!1);if(!e)return!1;let i=t.state.selection.main,n=e.diagnostics.iter(i.to+1);return!(!n.value&&(n=e.diagnostics.iter(0),!n.value||n.from==i.from&&n.to==i.to))&&(t.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)}}],Sc=i.define({combine:t=>({sources:t.map(t=>t.source).filter(t=>null!=t),...u(t.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Cc,tooltipFilter:Cc,needsRefresh:(t,e)=>t?e?i=>t(i)||e(i):t:e,hideOn:(t,e)=>t?e?(i,n,o)=>t(i,n,o)||e(i,n,o):t:e,autoPanel:(t,e)=>t||e})})});function Cc(t,e){return t?e?(i,n)=>e(t(i,n),n):t:e}function Ac(t){let e=[];if(t)t:for(let{name:i}of t){for(let t=0;t<i.length;t++){let n=i[t];if(/[a-zA-Z]/.test(n)&&!e.some(t=>t.toLowerCase()==n.toLowerCase())){e.push(n);continue t}}e.push("")}return e}function Mc(t,e,i){var n;let o=i?Ac(e.actions):[];return Lt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Lt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),null===(n=e.actions)||void 0===n?void 0:n.map((i,n)=>{let s=!1,r=n=>{if(n.preventDefault(),s)return;s=!0;let o=uc(t.state.field(wc).diagnostics,e);o&&i.apply(t,o.from,o.to)},{name:l}=i,a=o[n]?l.indexOf(o[n]):-1,h=a<0?l:[l.slice(0,a),Lt("u",l.slice(a,a+1)),l.slice(a+1)];return Lt("button",{type:"button",class:"cm-diagnosticAction"+(i.markClass?" "+i.markClass:""),onclick:r,onmousedown:r,"aria-label":` Action: ${l}${a<0?"":` (access key "${o[n]})"`}.`},h)}),e.source&&Lt("div",{class:"cm-diagnosticSource"},e.source))}class Dc extends Ee{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return Lt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Tc{constructor(t,e){this.diagnostic=e,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=Mc(t,e,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Oc{constructor(t){this.view=t,this.items=[];this.list=Lt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:e=>{if(27==e.keyCode)xc(this.view),this.view.focus();else if(38==e.keyCode||33==e.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==e.keyCode||34==e.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==e.keyCode)this.moveSelection(0);else if(35==e.keyCode)this.moveSelection(this.items.length-1);else if(13==e.keyCode)this.view.focus();else{if(!(e.keyCode>=65&&e.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:i}=this.items[this.selectedIndex],n=Ac(i.actions);for(let o=0;o<n.length;o++)if(n[o].toUpperCase().charCodeAt(0)==e.keyCode){let e=uc(this.view.state.field(wc).diagnostics,i);e&&i.actions[o].apply(t,e.from,e.to)}}}e.preventDefault()},onclick:t=>{for(let e=0;e<this.items.length;e++)this.items[e].dom.contains(t.target)&&this.moveSelection(e)}}),this.dom=Lt("div",{class:"cm-panel-lint"},this.list,Lt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>xc(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(wc).selected;if(!t)return-1;for(let e=0;e<this.items.length;e++)if(this.items[e].diagnostic==t.diagnostic)return e;return-1}update(){let{diagnostics:t,selected:e}=this.view.state.field(wc),i=0,n=!1,o=null,s=new Set;for(t.between(0,this.view.state.doc.length,(t,r,{spec:l})=>{for(let t of l.diagnostics){if(s.has(t))continue;s.add(t);let r,l=-1;for(let e=i;e<this.items.length;e++)if(this.items[e].diagnostic==t){l=e;break}l<0?(r=new Tc(this.view,t),this.items.splice(i,0,r),n=!0):(r=this.items[l],l>i&&(this.items.splice(i,l-i),n=!0)),e&&r.diagnostic==e.diagnostic?r.dom.hasAttribute("aria-selected")||(r.dom.setAttribute("aria-selected","true"),o=r):r.dom.hasAttribute("aria-selected")&&r.dom.removeAttribute("aria-selected"),i++}});i<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)n=!0,this.items.pop();0==this.items.length&&(this.items.push(new Tc(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),n=!0),o?(this.list.setAttribute("aria-activedescendant",o.id),this.view.requestMeasure({key:this,read:()=>({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:t,panel:e})=>{let i=e.height/this.list.offsetHeight;t.top<e.top?this.list.scrollTop-=(e.top-t.top)/i:t.bottom>e.bottom&&(this.list.scrollTop+=(t.bottom-e.bottom)/i)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),n&&this.sync()}sync(){let t=this.list.firstChild;function e(){let e=t;t=e.nextSibling,e.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;t!=i.dom;)e();t=i.dom.nextSibling}else this.list.insertBefore(i.dom,t);for(;t;)e()}moveSelection(t){if(this.selectedIndex<0)return;let e=uc(this.view.state.field(wc).diagnostics,this.items[t].diagnostic);e&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:gc.of(e)})}static open(t){return new Oc(t)}}function Lc(t){return function(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Bc=No.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:Lc("#d11")},".cm-lintRange-warning":{backgroundImage:Lc("orange")},".cm-lintRange-info":{backgroundImage:Lc("#999")},".cm-lintRange-hint":{backgroundImage:Lc("#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}}});function Ec(t){return"error"==t?4:"warning"==t?3:"info"==t?2:1}function Pc(t){let e="hint",i=1;for(let n of t){let t=Ec(n.severity);t>i&&(i=t,e=n.severity)}return e}const Rc=[wc,No.decorations.compute([wc],t=>{let{selected:e,panel:i}=t.field(wc);return e&&i&&e.from!=e.to?Re.set([vc.range(e.from,e.to)]):Re.none}),ks(bc,{hideOn:function(t,e){let i=e.pos,n=e.end||i,o=t.state.facet(Sc).hideOn(t,i,n);if(null!=o)return o;let s=t.startState.doc.lineAt(e.pos);return!(!t.effects.some(t=>t.is(pc))&&!t.changes.touchesRange(s.from,Math.max(s.to,n)))}}),Bc];
|
|
123
|
+
/*
|
|
124
|
+
* Copyright IBM Corp. 2025
|
|
125
|
+
*
|
|
126
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
127
|
+
* LICENSE file in the root directory of this source tree.
|
|
128
|
+
*
|
|
129
|
+
* @license
|
|
130
|
+
*/const Nc=kr,jc=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Za-z])([0-9])/g,"$1-$2").toLowerCase(),Hc=t=>`var(--cds-syntax-${t}, var(--cds-text-primary, #161616))`,Ic=t=>Nc[t],Vc=[...["heading","heading1","heading2","heading3","heading4","heading5","heading6"].map(t=>({tagName:t,style:{fontWeight:"bold",textDecoration:"underline"}})),{tagName:"link",style:{textDecoration:"underline"}},{tagName:"emphasis",style:{fontStyle:"italic"}},{tagName:"strong",style:{fontWeight:"bold"}},{tagName:"strikethrough",style:{textDecoration:"line-through"}}],Fc=new Set(Vc.map(({tagName:t})=>t)),zc=Vc.map(({tagName:t,style:e})=>{const i=Ic(t);return i?{tag:i,color:Hc(jc(t)),...e}:null}).filter(Boolean),Wc=["comment","lineComment","blockComment","docComment","name","variableName","typeName","tagName","propertyName","attributeName","className","labelName","namespace","macroName","literal","string","docString","character","attributeValue","number","integer","float","bool","regexp","escape","color","url","keyword","self","null","atom","unit","modifier","operatorKeyword","controlKeyword","definitionKeyword","moduleKeyword","operator","derefOperator","arithmeticOperator","logicOperator","bitwiseOperator","compareOperator","updateOperator","definitionOperator","typeOperator","controlOperator","punctuation","separator","bracket","angleBracket","squareBracket","paren","brace","content","heading","heading1","heading2","heading3","heading4","heading5","heading6","contentSeparator","list","quote","emphasis","strong","link","monospace","strikethrough","invalid","meta","documentMeta","annotation","processingInstruction"].filter(t=>!Fc.has(t)).map(t=>{const e=Ic(t);return e?{tag:e,color:Hc(jc(t))}:null}).filter(Boolean),qc=[{tag:kr.definition(kr.variableName),color:Hc("definition")},{tag:kr.definition(kr.propertyName),color:Hc("definition")},{tag:kr.definition(kr.typeName),color:Hc("definition")},{tag:kr.definition(kr.className),color:Hc("definition")},{tag:kr.constant(kr.variableName),color:Hc("constant")},{tag:kr.constant(kr.propertyName),color:Hc("constant")},{tag:kr.constant(kr.typeName),color:Hc("constant")},{tag:kr.function(kr.variableName),color:Hc("function")},{tag:kr.function(kr.propertyName),color:Hc("function")},{tag:kr.function(kr.typeName),color:Hc("function")},{tag:kr.standard(kr.variableName),color:Hc("standard")},{tag:kr.standard(kr.propertyName),color:Hc("standard")},{tag:kr.local(kr.variableName),color:Hc("local")},{tag:kr.local(kr.propertyName),color:Hc("local")},{tag:kr.special(kr.variableName),color:Hc("special")},{tag:kr.special(kr.propertyName),color:Hc("special")},{tag:kr.special(kr.string),color:Hc("special-string")}],_c=Ll.define([...qc,...zc,...Wc]);function Kc(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function $c(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Uc(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?$c(Object(i),!0).forEach(function(e){Kc(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):$c(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function Gc(t,e){if(null==t)return{};var i,n,o=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(n=0;n<s.length;n++)i=s[n],-1===e.indexOf(i)&&{}.propertyIsEnumerable.call(t,i)&&(o[i]=t[i])}return o}var Yc=["width","height","viewBox"],Xc=["tabindex"],Qc={focusable:"false",preserveAspectRatio:"xMidYMid meet"};
|
|
131
|
+
/*
|
|
132
|
+
* Copyright IBM Corp. 2025
|
|
133
|
+
*
|
|
134
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
135
|
+
* LICENSE file in the root directory of this source tree.
|
|
136
|
+
*
|
|
137
|
+
* @license
|
|
138
|
+
*/
|
|
139
|
+
function Jc(t={}){const{collapseLabel:e="Collapse code block",expandLabel:i="Expand code block"}=t;return t=>{const n=document.createElementNS("http://www.w3.org/2000/svg","svg"),o=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.width,i=t.height,n=t.viewBox,o=void 0===n?"0 0 ".concat(e," ").concat(i):n,s=Gc(t,Yc),r=s.tabindex,l=Gc(s,Xc),a=Uc(Uc(Uc({},Qc),l),{},{width:e,height:i,viewBox:o});return a["aria-label"]||a["aria-labelledby"]||a.title?(a.role="img",null!=r&&(a.focusable="true",a.tabindex=r)):a["aria-hidden"]=!0,a}(C.attrs);return Object.entries(o).forEach(([t,e])=>{void 0!==e&&"undefined"!==e&&null!==e&&"undefined"!==String(e)&&n.setAttribute(t,String(e))}),C.content.forEach(t=>{if("path"===t.elem){const e=document.createElementNS("http://www.w3.org/2000/svg","path");Object.entries(t.attrs).forEach(([t,i])=>{e.setAttribute(t,String(i))}),n.appendChild(e)}}),n.setAttribute("role","button"),n.setAttribute("aria-label",t?e:i),n.setAttribute("aria-expanded",String(t)),n.setAttribute("tabindex","0"),n}}
|
|
140
|
+
/*
|
|
141
|
+
* Copyright IBM Corp. 2025
|
|
142
|
+
*
|
|
143
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
144
|
+
* LICENSE file in the root directory of this source tree.
|
|
145
|
+
*
|
|
146
|
+
* @license
|
|
147
|
+
*/
|
|
148
|
+
function Zc(e={}){const{foldCollapseLabel:i="Collapse code block",foldExpandLabel:n="Expand code block"}=e;return[Ys(),No.domEventHandlers({keydown(t,e){const i=t.target;if("svg"===i.tagName&&"button"===i.getAttribute("role")&&i.hasAttribute("aria-expanded")&&("Enter"===t.key||" "===t.key)){t.preventDefault();const e=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0});return i.dispatchEvent(e),!0}return!1}}),Tl({markerDOM:Jc({collapseLabel:i,expandLabel:n})}),es(),t.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,o=i.lineAt(n);if(n>o.from+200)return t;let s=i.sliceString(o.from,n);if(!e.some(t=>t.test(s)))return t;let{state:r}=t,l=-1,a=[];for(let{head:t}of r.selection.ranges){let e=r.doc.lineAt(t);if(e.from==l)continue;l=e.from;let i=$r(r,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],o=Kr(r,i);n!=o&&a.push({from:e.from,to:e.from+n.length,insert:o})}return a.length?[t,{changes:a,sequential:!0}]:t}),Rl(Hl,{fallback:!0}),Rl(_c),[ic,Qh],qo.of([...nc,...Ch,...bl,...kc])]}
|
|
149
|
+
/*
|
|
150
|
+
* Copyright IBM Corp. 2025
|
|
151
|
+
*
|
|
152
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
153
|
+
* LICENSE file in the root directory of this source tree.
|
|
154
|
+
*
|
|
155
|
+
* @license
|
|
156
|
+
*/const td=[];
|
|
157
|
+
/*
|
|
158
|
+
* Copyright IBM Corp. 2025
|
|
159
|
+
*
|
|
160
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
161
|
+
* LICENSE file in the root directory of this source tree.
|
|
162
|
+
*
|
|
163
|
+
* @license
|
|
164
|
+
*/
|
|
165
|
+
var ed=Object.freeze({__proto__:null,Compartment:k,EditorView:No,LanguageController:class{constructor(t){this.config=t,this.pendingLanguageLoad=null,this.languageDetectionTimeout=null,this.highlightingDetectionTimeout=null,this.editableLanguageDetectionTimeout=null,this.canDetectForHighlighting=!0}async resolveLanguageSupport(){const t=this.config.getLanguageAttribute(),e=this.config.getContent();let i=t?ba(t)??t:"";if(!i&&e){const t=e.trim();if(t){i=ya(t)??""}}if(!i&&this.config.getDefaultLanguage()){e.trim()||(i=this.config.getDefaultLanguage())}if(!i)return this.config.updateState({detectedLanguage:null,lockLabel:!1}),null;const n=zr.matchLanguageName(ca,i,!0),o=n?i:null;if(this.config.updateState({detectedLanguage:o,lockLabel:Boolean(t&&o)}),!this.config.isHighlightEnabled()||!n)return null;try{return await xa(n)}catch(t){return console.warn(`Failed to load language support for "${i}"`),null}}async handleStreamingLanguageDetection(){if(this.config.getLanguageAttribute())return;const t=this.config.getContent().trim();if(t){if(!this.config.isLanguageLabelLocked()&&this.config.isHighlightEnabled()&&this.canDetectForHighlighting){const e=ya(t);if(e){const t=zr.matchLanguageName(ca,e,!0);t&&!this.pendingLanguageLoad&&(this.pendingLanguageLoad=xa(t).then(t=>{const e=this.config.getEditorView();e&&e.dispatch({effects:this.config.getLanguageCompartment().reconfigure([t])})}).catch(t=>{console.warn(`Failed to load language support for "${e}"`)}).finally(()=>{this.pendingLanguageLoad=null}),this.canDetectForHighlighting=!1,this.scheduleHighlightingDetectionReset())}}this.clearLanguageDetectionTimeout(),this.config.isLanguageLabelLocked()||(this.languageDetectionTimeout=window.setTimeout(()=>{this.languageDetectionTimeout=null,this.lockDetectedLanguageFromContent()},200))}}detectLanguageForEditable(t){if(this.config.getLanguageAttribute())return;const e=t.trim();e?(this.clearEditableDetectionTimeout(),this.editableLanguageDetectionTimeout=window.setTimeout(()=>{this.editableLanguageDetectionTimeout=null;const t=ya(e);if(!t)return;const i=zr.matchLanguageName(ca,t,!0);i&&(this.config.updateState({detectedLanguage:t,lockLabel:!0}),this.config.isHighlightEnabled()&&!this.pendingLanguageLoad&&(this.pendingLanguageLoad=xa(i).then(t=>{const e=this.config.getEditorView();e&&e.dispatch({effects:this.config.getLanguageCompartment().reconfigure([t])})}).catch(e=>{console.warn(`Failed to load language support for "${t}"`)}).finally(()=>{this.pendingLanguageLoad=null})))},200)):this.config.updateState({detectedLanguage:null,lockLabel:!1})}reset(){this.disposeTimers(),this.pendingLanguageLoad=null,this.canDetectForHighlighting=!0,this.config.updateState({detectedLanguage:null,lockLabel:!1})}dispose(){this.disposeTimers(),this.pendingLanguageLoad=null}lockDetectedLanguageFromContent(){if(this.config.getLanguageAttribute()||this.config.isLanguageLabelLocked())return;const t=this.config.getContent().trim();if(!t)return;const e=ya(t);e&&this.config.updateState({detectedLanguage:e,lockLabel:!0})}scheduleHighlightingDetectionReset(){this.clearHighlightingDetectionTimeout(),this.highlightingDetectionTimeout=window.setTimeout(()=>{this.canDetectForHighlighting=!0,this.highlightingDetectionTimeout=null},200)}clearLanguageDetectionTimeout(){null!==this.languageDetectionTimeout&&(window.clearTimeout(this.languageDetectionTimeout),this.languageDetectionTimeout=null)}clearHighlightingDetectionTimeout(){null!==this.highlightingDetectionTimeout&&(window.clearTimeout(this.highlightingDetectionTimeout),this.highlightingDetectionTimeout=null)}clearEditableDetectionTimeout(){null!==this.editableLanguageDetectionTimeout&&(window.clearTimeout(this.editableLanguageDetectionTimeout),this.editableLanguageDetectionTimeout=null)}disposeTimers(){this.clearLanguageDetectionTimeout(),this.clearHighlightingDetectionTimeout(),this.clearEditableDetectionTimeout()}}
|
|
166
|
+
/*
|
|
167
|
+
* Copyright IBM Corp. 2025
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
170
|
+
* LICENSE file in the root directory of this source tree.
|
|
171
|
+
*
|
|
172
|
+
* @license
|
|
173
|
+
*/,applyLanguageSupport:function(t,e,i){if(!t)return;const n=i?[i]:td;t.dispatch({effects:e.reconfigure(n)})},createContentSync:function({getEditorView:t,onAfterApply:e,throttleMs:i=200}){const n=S(i=>{const n=t();if(!n)return;const o=n.state.doc.toString();if(i!==o){if(i.startsWith(o)){const t=i.slice(o.length);if(!t.length)return;n.dispatch({changes:{from:o.length,to:o.length,insert:t}})}else o.startsWith(i)?n.dispatch({changes:{from:i.length,to:o.length,insert:""}}):n.dispatch({changes:{from:0,to:o.length,insert:i}});e&&requestAnimationFrame(()=>{e()})}},i,{leading:!0,trailing:!0});return{update:t=>n(t),cancel:()=>n.cancel()}},createEditorView:function({container:e,doc:i,languageSupport:n,languageCompartment:o,readOnlyCompartment:s,wrapCompartment:r,editable:l,disabled:a,onDocChanged:h,setupOptions:c}){const d=n?[n]:td,f=[t.readOnly.of(!l||a),No.editable.of(l&&!a)],u=No.theme({".cm-editor":{fontFamily:"var(--cds-code-01-font-family, 'IBM Plex Mono', monospace)",fontSize:"var(--cds-code-01-font-size, 0.875rem)",fontWeight:"var(--cds-code-01-font-weight, 400)",letterSpacing:"var(--cds-code-01-letter-spacing, 0.16px)",lineHeight:"var(--cds-code-01-line-height, 1.5)",background:"var(--cds-layer, #ffffff)",color:"var(--cds-text-primary, #161616)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--cds-text-primary, #161616)"},".cm-gutters":{backgroundColor:"var(--cds-background, #ffffff)",color:"var(--cds-text-helper, #6f6f6f)",border:"none"},".cm-gutterElement .cm-lineNumbers":{textAlign:"end"},".cm-foldGutter":{paddingInlineEnd:"0.25rem"},".cm-content":{flexBasis:"0 !important",caretColor:"var(--cds-text-primary, #161616)"},".cm-scroller":{maxBlockSize:"var(--cds-snippet-max-height, 16rem)",minBlockSize:"var(--cds-snippet-min-height, 3rem)"},".cm-foldGutter .cm-gutterElement":{display:"flex",justifyContent:"center",alignItems:"center",width:"16px"},".cm-foldGutter svg":{width:"12px",height:"12px",cursor:"pointer",transition:"transform 0.11s cubic-bezier(0.2, 0, 0.38, 0.9)",fill:"var(--cds-icon-primary, #161616)"},".cm-foldGutter svg[aria-expanded='true']":{transform:"rotate(0deg)"},".cm-foldGutter svg[aria-expanded='false']":{transform:"rotate(-90deg)"},".cm-foldGutter svg:focus":{outline:"2px solid var(--cds-focus, #0f62fe)"},".cm-searchMatch":{backgroundColor:"var(--cds-highlight, #d0e2ff)"},".cm-searchMatch-selected":{backgroundColor:"var(--cds-highlight, #d0e2ff)"},".cm-selectionBackground":{backgroundColor:"var(--cds-highlight, #d0e2ff)"},".cm-selectionMatch":{backgroundColor:"var(--cds-highlight, #d0e2ff)"},"&.cm-focused .cm-selectionBackground":{backgroundColor:"var(--cds-highlight, #d0e2ff) !important"},"&.cm-focused .cm-selectionMatch":{backgroundColor:"var(--cds-highlight, #d0e2ff) !important"},".cm-content ::selection":{backgroundColor:"var(--cds-highlight, #d0e2ff) !important"},"&.cm-focused .cm-content ::selection":{backgroundColor:"var(--cds-highlight, #d0e2ff) !important"}}),p=t.create({doc:i,extensions:[Zc(c),o.of(d),s.of(f),r.of(u),No.updateListener.of(t=>{t.docChanged&&h&&h({content:t.state.doc.toString(),lineCount:t.state.doc.lines})})]});return new No({state:p,parent:e})},updateReadOnlyConfiguration:function(e,i,{editable:n,disabled:o}){e&&e.dispatch({effects:i.reconfigure([t.readOnly.of(!n||o),No.editable.of(n&&!o)])})}});export{Il as A,Mr as B,Ah as C,A as D,No as E,ed as F,N as I,Fr as L,E as N,it as P,j as T,Or as a,Th as b,nl as c,Dh as d,Lr as e,sl as f,tl as g,rl as h,Gr as i,B as j,T as k,il as l,$h as m,tt as n,Js as o,ot as p,ol as q,qo as r,er as s,kr as t,Dr as u,Ar as v,qr as w,Cr as x,zr as y,Pr as z};
|