@marimo-team/frontend 0.24.1-dev41 → 0.24.1-dev43
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/dist/assets/{CellStatus-CfNQG_fZ.js → CellStatus-B6CWKORY.js} +1 -1
- package/dist/assets/ConnectedDataExplorerComponent-DZnvpjue.js +1 -0
- package/dist/assets/JsonOutput-BI2qFHVr.js +50 -0
- package/dist/assets/MarimoErrorOutput-BXh29HCp.js +6 -0
- package/dist/assets/RenderHTML-COTZYPO7.js +1 -0
- package/dist/assets/RunButton-DTUzITFm.js +1 -0
- package/dist/assets/VisuallyHidden-DurJ_JBW.js +1 -0
- package/dist/assets/{add-cell-with-ai-CGBEoX6T.js → add-cell-with-ai-B0RdHenk.js} +19 -19
- package/dist/assets/add-connection-dialog-CcnJ2LkX.js +166 -0
- package/dist/assets/agent-panel-PB0I1dIC.js +286 -0
- package/dist/assets/ai-model-dropdown-DjQy2bo-.js +3 -0
- package/dist/assets/app-config-button-COFLeJCU.js +1 -0
- package/dist/assets/{blob-ChElOQvm.js → blob-BBiZd3vX.js} +1 -1
- package/dist/assets/{cache-panel-CLfGxru6.js → cache-panel-MAXVmKkG.js} +1 -1
- package/dist/assets/cell-editor-5wcJHF0s.js +24 -0
- package/dist/assets/cell-link-BbAJokoX.js +1 -0
- package/dist/assets/cells-B1S_6FG3.js +227 -0
- package/dist/assets/chat-display-ClG9MRI_.js +1 -0
- package/dist/assets/chat-panel-BRoqCSCR.js +4 -0
- package/dist/assets/chat-ui-CNvkb287.js +4 -0
- package/dist/assets/circle--ysFeW9z.js +1 -0
- package/dist/assets/column-preview-D6cIOnWQ.js +1 -0
- package/dist/assets/command-palette-DtZy0Am-.js +1 -0
- package/dist/assets/common-BGLbVHCS.js +1 -0
- package/dist/assets/components-BAvTsivu.js +1 -0
- package/dist/assets/config-DcB2swfZ.js +1 -0
- package/dist/assets/context-Do8M9TDF.js +1 -0
- package/dist/assets/{datasource-C0_eJO-0.js → datasource-BrSYgi6C.js} +2 -2
- package/dist/assets/dependency-graph-panel-C13q-nga.js +5 -0
- package/dist/assets/{documentation-panel-CxjnCPq6.js → documentation-panel-CtQqNEQw.js} +1 -1
- package/dist/assets/{download-CxzOE8FX.js → download-CIdXYNHv.js} +1 -1
- package/dist/assets/dropdown-menu-CqNabM1f.js +1 -0
- package/dist/assets/edit-page-jAyDC21z.js +9 -0
- package/dist/assets/{error-entries-DCRQWi_N.js → error-entries-DEjvzkum.js} +1 -1
- package/dist/assets/{error-panel-Bx5cPw6N.js → error-panel-BvrDwUv8.js} +1 -1
- package/dist/assets/file-explorer-panel-DYujxxK-.js +1 -0
- package/dist/assets/{file-icons-DxXY84Jn.js → file-icons-Bo1Ewf1W.js} +1 -1
- package/dist/assets/file-name-input-BDGq0-ac.js +3 -0
- package/dist/assets/{floating-outline-gjfcwmyU.js → floating-outline-CNsG18LK.js} +1 -1
- package/dist/assets/{gallery-page-BI3aTl8u.js → gallery-page-4dZlIWMe.js} +1 -1
- package/dist/assets/{glide-data-editor-CrWGp7DP.js → glide-data-editor-BQNVc0zc.js} +2 -2
- package/dist/assets/home-page-CFAldshJ.js +4 -0
- package/dist/assets/html-to-image-DMn_7CCA.js +2 -0
- package/dist/assets/index-0VrRpta0.css +2 -0
- package/dist/assets/index-BBPHmHdW.js +29 -0
- package/dist/assets/input-DeyycFtq.js +7 -0
- package/dist/assets/{layout-BQjGHHu-.js → layout-Ddsz1eHh.js} +5 -5
- package/dist/assets/{logs-panel-D1RUMXL1.js → logs-panel-BSD1GETR.js} +1 -1
- package/dist/assets/markdown-renderer-DIXiKP4m.js +2 -0
- package/dist/assets/{mermaid-DtNubw9S.js → mermaid-CwvTqKGz.js} +2 -2
- package/dist/assets/{name-cell-input-DSKoNRk3.js → name-cell-input-zqypwqoZ.js} +1 -1
- package/dist/assets/{outline-panel-UIygpaO3.js → outline-panel-C5GAyqII.js} +1 -1
- package/dist/assets/packages-panel-CYLyGihe.js +1 -0
- package/dist/assets/{pair-with-agent-modal-Pl5cv7Gv.js → pair-with-agent-modal-CBIL9_6g.js} +2 -2
- package/dist/assets/panel-accordion-state-DmV3OgfX.js +1 -0
- package/dist/assets/panels-D53vWR00.js +4 -0
- package/dist/assets/{process-output-BWDSbk5d.js → process-output-DNhz9LLW.js} +1 -1
- package/dist/assets/{readonly-code-display-Bbnq-khe.js → readonly-code-display-CKT-gv1m.js} +1 -1
- package/dist/assets/readonly-python-code-De0vvuWh.js +1 -0
- package/dist/assets/{renderShortcut-Dj3NbkoC.js → renderShortcut-D9XYVNe3.js} +1 -1
- package/dist/assets/{reveal-component-Bgmfon3f.js → reveal-component-C0L5MU2W.js} +4 -4
- package/dist/assets/run-page-DXZapRtY.js +1 -0
- package/dist/assets/scratchpad-panel-ja6doGoa.js +1 -0
- package/dist/assets/secrets-panel-B7Rcwc2I.js +1 -0
- package/dist/assets/select-BUEX2Vfl.js +1 -0
- package/dist/assets/session-panel-ftyqfsYy.js +1 -0
- package/dist/assets/{skeleton-DGs-LrlZ.js → skeleton-CxFczTPo.js} +1 -1
- package/dist/assets/snippets-panel-BZ254lxN.js +1 -0
- package/dist/assets/{state-WVnIPIsw.js → state-MlBpc9qi.js} +3 -3
- package/dist/assets/{state-N_csMEH1.js → state-llVv0lIh.js} +1 -1
- package/dist/assets/switch-CBR-ykv3.js +1 -0
- package/dist/assets/tabs-c6mpccpH.js +1 -0
- package/dist/assets/{terminal-aLrVlOf6.js → terminal-OC_FnEas.js} +3 -3
- package/dist/assets/tracing-C0FGWieO.js +1 -0
- package/dist/assets/tracing-panel-LeIOi1Tv.js +2 -0
- package/dist/assets/{tree-actions-Ctf5W0DR.js → tree-actions-CrWpuExP.js} +1 -1
- package/dist/assets/useAddCell-DIdbaU70.js +1 -0
- package/dist/assets/useCellActionButton-DXyUqFdJ.js +1 -0
- package/dist/assets/{useDateFormatter-CfPcCT-J.js → useDateFormatter-BiqAQ-zI.js} +1 -1
- package/dist/assets/{useDeleteCell-6wcjnAMK.js → useDeleteCell-CSCMg7Up.js} +1 -1
- package/dist/assets/useDependencyPanelTab-Bt7aBDpS.js +1 -0
- package/dist/assets/useNotebookActions-ClT4GmnB.js +10 -0
- package/dist/assets/useNumberFormatter-DHJ9s6Vk.js +1 -0
- package/dist/assets/useRunCells-DHnbXALT.js +1 -0
- package/dist/assets/{useSplitCell-oIRu7Qlj.js → useSplitCell-CxlsGCB_.js} +1 -1
- package/dist/assets/{vega-component-D4OKyVdb.js → vega-component-CzgE5HEs.js} +1 -1
- package/dist/assets/write-secret-modal-BG_B6y1P.js +2 -0
- package/dist/index.html +57 -71
- package/package.json +1 -1
- package/src/components/chat/acp/agent-panel.tsx +4 -6
- package/src/components/data-table/columns.tsx +130 -132
- package/src/components/datasources/datasources.tsx +16 -17
- package/src/components/editor/actions/useNotebookActions.tsx +50 -0
- package/src/components/editor/chrome/panels/components.tsx +1 -1
- package/src/components/editor/connections/__tests__/add-connection-button.test.tsx +129 -0
- package/src/components/editor/connections/add-connection-button.tsx +132 -0
- package/src/components/editor/connections/components.tsx +11 -0
- package/src/components/editor/connections/quick-add-data-sources.tsx +11 -11
- package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +109 -1
- package/src/components/storage/storage-inspector.tsx +15 -17
- package/src/core/codemirror/language/panel/sql.test.tsx +69 -0
- package/src/core/codemirror/language/panel/sql.tsx +81 -4
- package/src/core/codemirror/markdown/commands.ts +1 -1
- package/src/core/codemirror/markdown/completions.ts +15 -17
- package/dist/assets/ConnectedDataExplorerComponent-88Ojqyhx.js +0 -1
- package/dist/assets/DeferredRequestRegistry-C-SpvRCH.js +0 -1
- package/dist/assets/ImperativeModal-68zj0lxy.js +0 -1
- package/dist/assets/JsonOutput-pCdkYz4X.js +0 -50
- package/dist/assets/MarimoErrorOutput-b7bFhjgD.js +0 -6
- package/dist/assets/RSPContexts-D2JcYZo2.js +0 -1
- package/dist/assets/RenderHTML-BUuDW4yZ.js +0 -1
- package/dist/assets/RunButton-4MKgVYXU.js +0 -1
- package/dist/assets/SSRProvider-C_WMmqnS.js +0 -1
- package/dist/assets/add-connection-dialog-BcLKuMHt.js +0 -166
- package/dist/assets/agent-panel-BVyaNGyG.js +0 -286
- package/dist/assets/ai-model-dropdown-C_IoSmhR.js +0 -3
- package/dist/assets/app-config-button-BvpunAmJ.js +0 -1
- package/dist/assets/cell-editor-pKuytlrm.js +0 -24
- package/dist/assets/cell-link-D9d1y67_.js +0 -1
- package/dist/assets/cells-BdoPd1mK.js +0 -226
- package/dist/assets/chat-display-CbsB82vm.js +0 -1
- package/dist/assets/chat-panel-DCPKH1gP.js +0 -4
- package/dist/assets/chat-ui-BwLG6iSS.js +0 -4
- package/dist/assets/circle-plus-cm-FRu9O.js +0 -1
- package/dist/assets/column-preview-fku2dKeP.js +0 -1
- package/dist/assets/command-Cvmdzx0n.js +0 -1
- package/dist/assets/command-palette-BJFR8wKv.js +0 -1
- package/dist/assets/common-CQ9OqrFS.js +0 -1
- package/dist/assets/components-CaOG3LOY.js +0 -1
- package/dist/assets/config-xlrIxOZJ.js +0 -1
- package/dist/assets/context-Bf2wPdef.js +0 -1
- package/dist/assets/data-source-discovery-BsrDlL04.js +0 -1
- package/dist/assets/dependency-graph-panel-CxZJ5e7D.js +0 -5
- package/dist/assets/dialog-EjSc4yoH.js +0 -1
- package/dist/assets/dropdown-menu-BpI5klSq.js +0 -1
- package/dist/assets/edit-page-DwKN7vIP.js +0 -9
- package/dist/assets/field-YoG_gQAY.js +0 -1
- package/dist/assets/file-explorer-panel-CRrPqu3s.js +0 -1
- package/dist/assets/file-name-input-uFNWUWCc.js +0 -3
- package/dist/assets/focus-DgNLvj0o.js +0 -1
- package/dist/assets/form-CD2uATFu.js +0 -2
- package/dist/assets/form-GIq5QCAI.js +0 -1
- package/dist/assets/home-page-CYg3rQCB.js +0 -4
- package/dist/assets/html-to-image-Bt7Ld74W.js +0 -2
- package/dist/assets/index-CrsPwq0f.js +0 -29
- package/dist/assets/index-H2TMW127.css +0 -2
- package/dist/assets/input-BuOxQ3Wy.js +0 -1
- package/dist/assets/label-B67m1YH7.js +0 -1
- package/dist/assets/links-C7oaxPJK.js +0 -1
- package/dist/assets/markdown-renderer-C8IbrNw3.js +0 -2
- package/dist/assets/packages-panel-CIwyYf45.js +0 -1
- package/dist/assets/panel-accordion-state-DAAi8MPY.js +0 -1
- package/dist/assets/panels-DcguQKjE.js +0 -4
- package/dist/assets/popover-CgOo22ko.js +0 -1
- package/dist/assets/radio-group-DZoEgN7k.js +0 -1
- package/dist/assets/readonly-python-code-CyfabMFb.js +0 -1
- package/dist/assets/refresh-ccw-DrVG5f2L.js +0 -1
- package/dist/assets/request-registry-mNu7sXOU.js +0 -1
- package/dist/assets/run-page-Buh6gERG.js +0 -1
- package/dist/assets/scratchpad-panel-soCf5igY.js +0 -1
- package/dist/assets/secrets-panel-CCb8F6PC.js +0 -1
- package/dist/assets/select-DwqnFsyg.js +0 -1
- package/dist/assets/session-panel-BO4lOJc-.js +0 -1
- package/dist/assets/snippets-panel-CulFiQ0V.js +0 -1
- package/dist/assets/sparkles-30wHhAF5.js +0 -1
- package/dist/assets/state-B-K0k6lb.js +0 -1
- package/dist/assets/switch-VzdUoXkf.js +0 -1
- package/dist/assets/textarea-mD3C73jw.js +0 -1
- package/dist/assets/tracing-B_Qlv38-.js +0 -1
- package/dist/assets/tracing-panel--KVMPYqh.js +0 -2
- package/dist/assets/useCellActionButton-BDVM-sW-.js +0 -1
- package/dist/assets/useDependencyPanelTab-D4TnSeLa.js +0 -1
- package/dist/assets/useNotebookActions-gEpi1TfO.js +0 -10
- package/dist/assets/useNumberFormatter-BmUQe2Pf.js +0 -1
- package/dist/assets/usePress-CwOqeEX3.js +0 -7
- package/dist/assets/useRunCells-DP6cAHq0.js +0 -1
- package/dist/assets/write-secret-modal-dplU5PG8.js +0 -2
- package/dist/assets/x-BgkoSHM-.js +0 -1
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./esm-ChMklRTi.js","./rolldown-runtime-B0Z9INg1.js","./dist-CXmhxecl.js","./dist-B97dKQGP.js","./dist-PIe1xcZo.js","./dist-Dz_04liz.js","./dist-Bke0Ybxy.js","./dist-BcfF-rkl.js","./dist-DdPuhs_-.js","./dist-BO5c5n_b.js","./dist-CLi0j3bw.js","./dist-fxnYzq-R.js","./dist-mY1j_5eA.js","./dist-7qdHLg-L.js","./dist-CO1Hfv5H.js","./dist-D7aYPqs9.js","./dist-CEeRVpMD.js","./dist-CMIyXejt.js","./dist-BwmO3SSk.js","./dist-CidBzUqR.js","./dist-DKCF5R0T.js","./dist-DkCO0b-0.js","./dist-tg3aVnpD.js","./dist-DoAjHgMj.js","./dist-2oRmY-BC.js","./dist-CxxZaSme.js","./dist-C3KxgR0m.js","./dist-DCc0VfiO.js","./dist-CpgfIIzU.js","./dist-BcYW-EJk.js","./dist-DkfdZExz.js","./dist-DzAWvPVK.js","./dist-DbFa9cik.js","./dist-DIkuvChK.js","./dist-Bw8CAY5i.js","./dist-Cqm1W-Zm.js","./dist-hOh6JBwi.js","./dist-Dbu5sPgR.js","./dist-B4QaGCvF.js","./dist-BKx0MLbb.js","./dist-B_ABJVTW.js","./dist-DL1Thauf.js","./apl-gw27yJ2n.js","./apl-CYIAEF37.js","./asciiarmor-Cor5STs8.js","./asciiarmor-CF6FHpQl.js","./asn1-CPEENLyz.js","./asn1-CmtZ6NID.js","./brainfuck-a_fzgFtj.js","./brainfuck-vE42J6oQ.js","./cobol-BYACvGhO.js","./cobol-ttQu-eUm.js","./clike-DZROJv43.js","./clike-Bo1_pR8B.js","./clojure-sW2N62b5.js","./clojure-1zb6N0Kd.js","./css-CbZNFbVv.js","./css-aD3t-znF.js","./cmake-DA9yMhzJ.js","./cmake-DSEb40G9.js","./coffeescript-73GxLNLH.js","./coffeescript-CcHmp8ZW.js","./commonlisp-BAY0IMda.js","./commonlisp-DHrixoxv.js","./cypher-CpQ0ACJl.js","./cypher-q6-coHOK.js","./python-xiYauDc4.js","./python-C4CVWZ7v.js","./crystal-DLlr59il.js","./crystal-fOwNIMzy.js","./d-BFwRCF-p.js","./d-Drt6ZXrF.js","./diff-Ib_BKd8h.js","./diff-CYBnW6ZU.js","./dockerfile-DJkHQgkl.js","./simple-mode-DXiLM1-G.js","./dtd-DgBHwr-e.js","./dtd-DqGG8R4P.js","./dylan-fdbf6J3T.js","./dylan-BTCYgsmh.js","./ecl-K_KNI3_u.js","./ecl-BPsxRGqR.js","./eiffel-DatcW1fL.js","./eiffel-BCguJEP-.js","./elm-DbcUgz-o.js","./elm-DnNeI1M2.js","./erlang-BistxQAs.js","./erlang-DkHPV6ru.js","./factor-DwQNJbiW.js","./factor-ZZBBZpXK.js","./forth-B-tqi4f_.js","./forth-DUDizG3o.js","./fortran-C9M6nI39.js","./fortran-BarbOvgW.js","./mllike-DHDLWZl9.js","./mllike-BKN6OcTc.js","./gas-DJ-ntEw0.js","./gas-mybzrfIH.js","./gherkin-Co7qm0Mt.js","./gherkin-BlnXaZZf.js","./groovy-DkYAhc5g.js","./groovy-cYuFC_ot.js","./haskell-QbTWCmtk.js","./haskell-CuLp9g3a.js","./haxe-CmR2u-6B.js","./haxe-CiIUZbdX.js","./idl-DY5VfUGL.js","./idl-BHq7WyPV.js","./javascript-BWjar7HY.js","./javascript-D-FtdkNC.js","./julia-CBfVM-ng.js","./julia-CoYYMTcZ.js","./livescript-CC7i4CEo.js","./livescript-C1gEZ5Hk.js","./lua-_4wuYo1j.js","./lua-CRIS5afH.js","./mirc-BASUkO3C.js","./mirc-CTGUd79I.js","./mathematica-DWMBVyLs.js","./mathematica-CwlrU_TQ.js","./modelica-C2NfUrdY.js","./modelica-DZs5SjV_.js","./mumps-DwVYUX8b.js","./mumps-BNg2Yq-1.js","./mbox-DvNfx9hX.js","./mbox-skR0V6cu.js","./nsis-CSHYJZux.js","./nsis-8kQdxo7f.js","./ntriples-CSqEHNgf.js","./ntriples-Ck5rp6GE.js","./octave-ImTMIie9.js","./octave-BRpd3hBF.js","./oz-BuYcBdKy.js","./oz-BUEZmvHT.js","./pascal-B50DmceL.js","./pascal-DBfxUwpj.js","./perl-DmFVAwdF.js","./perl-v9vsztCj.js","./pig-BnQuru9N.js","./pig-CrKTIB-m.js","./powershell-B1pJyAAD.js","./powershell-89xdb5K_.js","./properties-Ci7guRqV.js","./properties-DaUFoXFR.js","./protobuf-CoqP8wM5.js","./protobuf-Ci5XvpF4.js","./pug-CJsoo9v0.js","./pug-DPY-Ajan.js","./puppet-C9UYpvtZ.js","./puppet-Da8ZxG7z.js","./q-CKkOe1xA.js","./q-BjtI5Irp.js","./r-Bwc-y-iL.js","./r-vSi6pWDr.js","./rpm-UQSdNQr2.js","./rpm-Cv5HmAkX.js","./ruby-Bbksypm5.js","./ruby-UyKn0rKt.js","./sas-CssadkTB.js","./sas-D3-6PWmJ.js","./scheme-CkJWoRmu.js","./scheme-DqTb0ELD.js","./shell-FgUEpLdy.js","./shell-DySzVBqR.js","./sieve-BLxcNk7A.js","./sieve-CoBbN2aF.js","./smalltalk-d1Dbk6V4.js","./smalltalk-CJJAzHnb.js","./sparql-CUZhKeRb.js","./sparql-CjwbV0fX.js","./stylus-BvudHrj4.js","./stylus-uh0Gd-Iz.js","./swift-CUIczYYb.js","./swift-D5IK5OrP.js","./stex-3SJlFZg3.js","./stex-Dc5bKD4z.js","./verilog-DH7aBYt7.js","./verilog-DPWRmpYS.js","./tcl-SjROh4xB.js","./tcl-BvqzOD3a.js","./textile-DgW6fC9R.js","./textile--JQHE1pJ.js","./toml-BcC_uO4q.js","./toml-lWmHdWv5.js","./troff-BMlKH74u.js","./troff-r7W702V9.js","./ttcn-P2iYmK_j.js","./ttcn-1CwPIugQ.js","./ttcn-cfg-2bl9aE98.js","./ttcn-cfg-CHYEAF6D.js","./turtle-DDf6uD3p.js","./turtle-D_5eCUwg.js","./webidl-dw5if_Lv.js","./webidl-CNY2gQL0.js","./vb-CrfmF706.js","./vb-Vd6lTutg.js","./vbscript-Cpiv2llq.js","./vbscript-CcW6E3ma.js","./velocity-5N54agTA.js","./velocity-CuSicjhq.js","./vhdl-BmegRbqn.js","./vhdl-sLYad3YP.js","./xquery-CuDTgW6S.js","./xquery-d3Qdoigy.js","./yacas-Dn2coKff.js","./yacas-BjDXhrkW.js","./z80-ByJO5ysu.js","./z80-z4BkVl0y.js","./mscgen-C7woTLsY.js","./mscgen-Bo5N9WUj.js","./dist-CLE562nZ.js","./dist-DeuWxYVk.js","./dist-DTM7BAUu.js","./node-sql-parser-gD9ga-kL.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e,i as t,n,r,t as i}from"./rolldown-runtime-B0Z9INg1.js";import{c as a,f as o,l as s,n as c,o as l,r as u,s as d}from"./useEvent-xfs0Sn4r.js";import{t as f}from"./react-CBDbhulC.js";import{t as p}from"./react-dom-BQrReHnR.js";import{Cn as m,In as h,Jn as g,Sn as _,Tt as v,kt as y,ln as b}from"./schemas-aTUejmFi.js";import{t as x}from"./compiler-runtime-CYIjoINj.js";import{t as S}from"./debounce-aFmHgJZY.js";import{d as C,f as w,g as T,o as E}from"./useEventListener-D27Dii_l.js";import{t as D}from"./objects-snlMn4yk.js";import{t as O}from"./invariant-Ci2dTZ72.js";import{b as k,g as ee,h as te,t as ne}from"./utils-R_pHe-RB.js";import{D as re,N as A,O as j,P as M,S as ie,r as ae}from"./config-CUBl5qBg.js";import{n as N,t as oe}from"./cn-ldLVeaqm.js";import{t as P}from"./jsx-runtime-B74pBk57.js";import{C as F,T as se,b as ce,d as le,g as ue,h as de,p as fe,v as pe,w as me,x as he,y as ge}from"./fullscreen-0EEPR7uc.js";import{l as _e,o as ve}from"./dist-BgL43w5r.js";import{d as ye}from"./menu-items-BSVrMleU.js";import{a as be,c as xe,i as Se,m as Ce,n as we,o as Te,r as Ee,s as De,t as Oe}from"./select-DwqnFsyg.js";import{i as ke,t as Ae}from"./tooltip-D7dq6bnc.js";import{t as je}from"./button-BMBznEru.js";import{$t as Me,A as Ne,C as Pe,D as Fe,Gt as I,H as Ie,Ht as L,I as R,Jt as Le,K as Re,Kt as ze,Nt as Be,Pt as Ve,Qt as He,Rt as Ue,S as We,T as Ge,Tt as Ke,U as qe,Ut as Je,W as Ye,Wt as Xe,X as Ze,Yt as Qe,Zt as $e,_t as et,at as z,b as tt,bt as nt,ct as rt,dt as it,en as at,f as ot,it as st,jt as ct,k as lt,kt as ut,l as B,ot as dt,p as ft,pt,q as mt,qt as ht,st as V,u as gt,ut as _t,wt as vt,z as yt}from"./dist-PIe1xcZo.js";import{A as bt,C as xt,D as St,E as Ct,S as wt,T as Tt,_ as Et,d as Dt,h as Ot,j as kt,k as At,m as jt,n as Mt,o as Nt,s as Pt,t as Ft,u as It,v as Lt,z as Rt}from"./dist-CbQrIaPV.js";import{a as zt,i as Bt,l as Vt,n as Ht,p as Ut,r as Wt}from"./arrays-BqUx5USx.js";import{n as Gt}from"./once-Haz_uxEL.js";import{t as Kt}from"./capabilities-LWzb3E3M.js";import{t as qt}from"./cjs-C49f7GXV.js";import{t as Jt}from"./createReducer-Bq-nQJiK.js";import{d as Yt,l as Xt,n as Zt,o as Qt,p as $t,r as en}from"./dist-Dz_04liz.js";import{n as tn,t as nn}from"./useNonce-BTM6-ANi.js";import{i as rn,r as an,t as on}from"./strings-CpYReX2Q.js";import{t as sn}from"./requests-C6_IaFh7.js";import{a as cn,c as ln,d as un,f as dn,i as fn,l as pn,n as mn,o as hn,r as gn,s as _n,t as vn,u as yn}from"./dist-B97dKQGP.js";import{t as bn}from"./createLucideIcon-B7HeEoG2.js";import{a as xn,i as Sn,o as Cn,r as wn,t as Tn}from"./useLifecycle-BUaJcygz.js";import{t as En}from"./check-BoA6XBpj.js";import{t as Dn}from"./x-BgkoSHM-.js";import{t as On,u as kn}from"./toDate-hGYJX0Ha.js";import{t as An}from"./database-zap-CloO6gbw.js";import{n as jn,t as Mn}from"./DeferredRequestRegistry-C-SpvRCH.js";import{t as Nn}from"./badge-D_-uqy2N.js";import{t as H}from"./preload-helper-HclGiUj8.js";import{a as Pn,s as Fn}from"./dist-DCc0VfiO.js";import{a as In,i as Ln,n as Rn,r as zn,t as Bn}from"./dist-DzAWvPVK.js";import{n as Vn}from"./stex-Dc5bKD4z.js";import{t as Hn}from"./use-toast-DpWHUGuF.js";import{n as Un}from"./paths-zcL04qUW.js";import{n as Wn}from"./useTheme-BRnykVDX.js";import{t as Gn}from"./purify.es-DrVcFY1Q.js";var Kn=i((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&te(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&te(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function te(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,te(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),qn=i(((e,t)=>{t.exports=Kn()})),Jn=i((e=>{var t=qn(),n=f(),r=p();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,h=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),ee=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var ne=Symbol.for(`react.client.reference`);function re(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ne?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?re(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return re(e(t))}catch{}}return null}var A=Array.isArray,j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},ae=[],N=-1;function oe(e){return{current:e}}function P(e){0>N||(e.current=ae[N],ae[N]=null,N--)}function F(e,t){N++,ae[N]=e.current,e.current=t}var se=oe(null),ce=oe(null),le=oe(null),ue=oe(null);function de(e,t){switch(F(le,t),F(ce,e),F(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Wd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Wd(t),e=Gd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}P(se),F(se,e)}function fe(){P(se),P(ce),P(le)}function pe(e){e.memoizedState!==null&&F(ue,e);var t=se.current,n=Gd(t,e.type);t!==n&&(F(ce,e),F(se,n))}function me(e){ce.current===e&&(P(se),P(ce)),ue.current===e&&(P(ue),ep._currentValue=ie)}var he,ge;function _e(e){if(he===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);he=t&&t[1]||``,ge=-1<e.stack.indexOf(`
|
|
3
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
-
`+he+e+ge}var ve=!1;function ye(e,t){if(!e||ve)return``;ve=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
|
-
`),l=s.split(`
|
|
6
|
-
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
7
|
-
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ve=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?_e(n):``}function be(e,t){switch(e.tag){case 26:case 27:case 5:return _e(e.type);case 16:return _e(`Lazy`);case 13:return e.child!==t&&t!==null?_e(`Suspense Fallback`):_e(`Suspense`);case 19:return _e(`SuspenseList`);case 0:case 15:return ye(e.type,!1);case 11:return ye(e.type.render,!1);case 1:return ye(e.type,!0);case 31:return _e(`Activity`);default:return``}}function xe(e){try{var t=``,n=null;do t+=be(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
-
Error generating stack: `+e.message+`
|
|
9
|
-
`+e.stack}}var Se=Object.prototype.hasOwnProperty,Ce=t.unstable_scheduleCallback,we=t.unstable_cancelCallback,Te=t.unstable_shouldYield,Ee=t.unstable_requestPaint,De=t.unstable_now,Oe=t.unstable_getCurrentPriorityLevel,ke=t.unstable_ImmediatePriority,Ae=t.unstable_UserBlockingPriority,je=t.unstable_NormalPriority,Me=t.unstable_LowPriority,Ne=t.unstable_IdlePriority,Pe=t.log,Fe=t.unstable_setDisableYieldValue,I=null,Ie=null;function L(e){if(typeof Pe==`function`&&Fe(e),Ie&&typeof Ie.setStrictMode==`function`)try{Ie.setStrictMode(I,e)}catch{}}var R=Math.clz32?Math.clz32:ze,Le=Math.log,Re=Math.LN2;function ze(e){return e>>>=0,e===0?32:31-(Le(e)/Re|0)|0}var Be=256,Ve=262144,He=4194304;function Ue(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function We(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ue(n))):i=Ue(o):i=Ue(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ue(n))):i=Ue(o)):i=Ue(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ge(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ke(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qe(){var e=He;return He<<=1,!(He&62914560)&&(He=4194304),e}function Je(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ye(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Xe(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-R(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ze(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ze(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-R(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Qe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-R(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function $e(e,t){var n=t&-t;return n=n&42?1:et(n),(n&(e.suspendedLanes|t))===0?n:0}function et(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function z(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function tt(){var e=M.p;return e===0?(e=window.event,e===void 0?32:gp(e.type)):e}function nt(e,t){var n=M.p;try{return M.p=e,t()}finally{M.p=n}}var rt=Math.random().toString(36).slice(2),it=`__reactFiber$`+rt,at=`__reactProps$`+rt,ot=`__reactContainer$`+rt,st=`__reactEvents$`+rt,ct=`__reactListeners$`+rt,lt=`__reactHandles$`+rt,ut=`__reactResources$`+rt,B=`__reactMarker$`+rt;function dt(e){delete e[it],delete e[at],delete e[st],delete e[ct],delete e[lt]}function ft(e){var t=e[it];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ot]||n[it]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=mf(e);e!==null;){if(n=e[it])return n;e=mf(e)}return t}e=n,n=e.parentNode}return null}function pt(e){if(e=e[it]||e[ot]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function mt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ht(e){var t=e[ut];return t||=e[ut]={hoistableStyles:new Map,hoistableScripts:new Map},t}function V(e){e[B]=!0}var gt=new Set,_t={};function vt(e,t){yt(e,t),yt(e+`Capture`,t)}function yt(e,t){for(_t[e]=t,e=0;e<t.length;e++)gt.add(t[e])}var bt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),xt={},St={};function Ct(e){return Se.call(St,e)?!0:Se.call(xt,e)?!1:bt.test(e)?St[e]=!0:(xt[e]=!0,!1)}function wt(e,t,n){if(Ct(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function Tt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Et(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Dt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Ot(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function kt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function At(e){if(!e._valueTracker){var t=Ot(e)?`checked`:`value`;e._valueTracker=kt(e,t,``+e[t])}}function jt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Ot(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Mt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Nt=/[\n"\\]/g;function Pt(e){return e.replace(Nt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Ft(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Dt(t)):e.value!==``+Dt(t)&&(e.value=``+Dt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Lt(e,o,Dt(n)):Lt(e,o,Dt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Dt(s):e.removeAttribute(`name`)}function It(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){At(e);return}n=n==null?``:``+Dt(n),t=t==null?n:``+Dt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),At(e)}function Lt(e,t,n){t===`number`&&Mt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Rt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Dt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function zt(e,t,n){if(t!=null&&(t=``+Dt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Dt(n)}function Bt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(A(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Dt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),At(e)}function Vt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ht=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Ut(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Ht.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Wt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Ut(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Ut(e,o,t[o])}function Gt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Kt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),qt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Jt(e){return qt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Yt(){}var Xt=null;function Zt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Qt=null,$t=null;function en(e){var t=pt(e);if(t&&(e=t.stateNode)){var n=e[at]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Ft(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Pt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[at]||null;if(!a)throw Error(i(90));Ft(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&jt(r)}break a;case`textarea`:zt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Rt(e,!!n.multiple,t,!1)}}}var tn=!1;function nn(e,t,n){if(tn)return e(t,n);tn=!0;try{return e(t)}finally{if(tn=!1,(Qt!==null||$t!==null)&&(xu(),Qt&&(t=Qt,e=$t,$t=Qt=null,en(t),e)))for(t=0;t<e.length;t++)en(e[t])}}function rn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[at]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var an=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),on=!1;if(an)try{var sn={};Object.defineProperty(sn,"passive",{get:function(){on=!0}}),window.addEventListener(`test`,sn,sn),window.removeEventListener(`test`,sn,sn)}catch{on=!1}var cn=null,ln=null,un=null;function dn(){if(un)return un;var e,t=ln,n=t.length,r,i=`value`in cn?cn.value:cn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return un=i.slice(e,1<r?1-r:void 0)}function fn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function pn(){return!0}function mn(){return!1}function hn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?pn:mn,this.isPropagationStopped=mn,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=pn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=pn)},persist:function(){},isPersistent:pn}),t}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_n=hn(gn),vn=m({},gn,{view:0,detail:0}),yn=hn(vn),bn,xn,Sn,Cn=m({},vn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:H,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Sn&&(Sn&&e.type===`mousemove`?(bn=e.screenX-Sn.screenX,xn=e.screenY-Sn.screenY):xn=bn=0,Sn=e),bn)},movementY:function(e){return`movementY`in e?e.movementY:xn}}),wn=hn(Cn),Tn=hn(m({},Cn,{dataTransfer:0})),En=hn(m({},vn,{relatedTarget:0})),Dn=hn(m({},gn,{animationName:0,elapsedTime:0,pseudoElement:0})),On=hn(m({},gn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),kn=hn(m({},gn,{data:0})),An={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},jn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Mn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Nn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Mn[e])?!!t[e]:!1}function H(){return Nn}var Pn=hn(m({},vn,{key:function(e){if(e.key){var t=An[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=fn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?jn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:H,charCode:function(e){return e.type===`keypress`?fn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?fn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Fn=hn(m({},Cn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),In=hn(m({},vn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:H})),Ln=hn(m({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Rn=hn(m({},Cn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),zn=hn(m({},gn,{newState:0,oldState:0})),Bn=[9,13,27,32],Vn=an&&`CompositionEvent`in window,Hn=null;an&&`documentMode`in document&&(Hn=document.documentMode);var Un=an&&`TextEvent`in window&&!Hn,Wn=an&&(!Vn||Hn&&8<Hn&&11>=Hn),Gn=` `,Kn=!1;function Jn(e,t){switch(e){case`keyup`:return Bn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Yn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Xn=!1;function Zn(e,t){switch(e){case`compositionend`:return Yn(t);case`keypress`:return t.which===32?(Kn=!0,Gn):null;case`textInput`:return e=t.data,e===Gn&&Kn?null:e;default:return null}}function Qn(e,t){if(Xn)return e===`compositionend`||!Vn&&Jn(e,t)?(e=dn(),un=ln=cn=null,Xn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Wn&&t.locale!==`ko`?null:t.data;default:return null}}var $n={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function er(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!$n[e.type]:t===`textarea`}function tr(e,t,n,r){Qt?$t?$t.push(r):$t=[r]:Qt=r,t=Od(t,`onChange`),0<t.length&&(n=new _n(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var nr=null,rr=null;function ir(e){xd(e,0)}function ar(e){if(jt(mt(e)))return e}function or(e,t){if(e===`change`)return t}var sr=!1;if(an){var cr;if(an){var lr=`oninput`in document;if(!lr){var ur=document.createElement(`div`);ur.setAttribute(`oninput`,`return;`),lr=typeof ur.oninput==`function`}cr=lr}else cr=!1;sr=cr&&(!document.documentMode||9<document.documentMode)}function dr(){nr&&(nr.detachEvent(`onpropertychange`,fr),rr=nr=null)}function fr(e){if(e.propertyName===`value`&&ar(rr)){var t=[];tr(t,rr,e,Zt(e)),nn(ir,t)}}function pr(e,t,n){e===`focusin`?(dr(),nr=t,rr=n,nr.attachEvent(`onpropertychange`,fr)):e===`focusout`&&dr()}function mr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return ar(rr)}function hr(e,t){if(e===`click`)return ar(t)}function gr(e,t){if(e===`input`||e===`change`)return ar(t)}function _r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var vr=typeof Object.is==`function`?Object.is:_r;function yr(e,t){if(vr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Se.call(t,i)||!vr(e[i],t[i]))return!1}return!0}function br(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function xr(e,t){var n=br(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=br(n)}}function Sr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function U(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Mt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Mt(e.document)}return t}function W(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Cr=an&&`documentMode`in document&&11>=document.documentMode,wr=null,Tr=null,Er=null,Dr=!1;function Or(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Dr||wr==null||wr!==Mt(r)||(r=wr,`selectionStart`in r&&W(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Er&&yr(Er,r)||(Er=r,r=Od(Tr,`onSelect`),0<r.length&&(t=new _n(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=wr)))}function kr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ar={animationend:kr(`Animation`,`AnimationEnd`),animationiteration:kr(`Animation`,`AnimationIteration`),animationstart:kr(`Animation`,`AnimationStart`),transitionrun:kr(`Transition`,`TransitionRun`),transitionstart:kr(`Transition`,`TransitionStart`),transitioncancel:kr(`Transition`,`TransitionCancel`),transitionend:kr(`Transition`,`TransitionEnd`)},jr={},Mr={};an&&(Mr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ar.animationend.animation,delete Ar.animationiteration.animation,delete Ar.animationstart.animation),`TransitionEvent`in window||delete Ar.transitionend.transition);function Nr(e){if(jr[e])return jr[e];if(!Ar[e])return e;var t=Ar[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Mr)return jr[e]=t[n];return e}var Pr=Nr(`animationend`),Fr=Nr(`animationiteration`),Ir=Nr(`animationstart`),Lr=Nr(`transitionrun`),Rr=Nr(`transitionstart`),zr=Nr(`transitioncancel`),Br=Nr(`transitionend`),Vr=new Map,Hr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Hr.push(`scrollEnd`);function Ur(e,t){Vr.set(e,t),vt(t,[e])}var Wr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Gr=[],Kr=0,qr=0;function Jr(){for(var e=Kr,t=qr=Kr=0;t<e;){var n=Gr[t];Gr[t++]=null;var r=Gr[t];Gr[t++]=null;var i=Gr[t];Gr[t++]=null;var a=Gr[t];if(Gr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Qr(n,i,a)}}function Yr(e,t,n,r){Gr[Kr++]=e,Gr[Kr++]=t,Gr[Kr++]=n,Gr[Kr++]=r,qr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Xr(e,t,n,r){return Yr(e,t,n,r),$r(e)}function Zr(e,t){return Yr(e,null,null,t),$r(e)}function Qr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-R(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function $r(e){if(50<fu)throw fu=0,pu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ei={};function ti(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ni(e,t,n,r){return new ti(e,t,n,r)}function ri(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ii(e,t){var n=e.alternate;return n===null?(n=ni(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ai(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function oi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ri(e)&&(s=1);else if(typeof e==`string`)s=Gf(e,n,se.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case O:return e=ni(31,n,t,a),e.elementType=O,e.lanes=o,e;case v:return si(n.children,a,o,t);case y:s=8,a|=24;break;case b:return e=ni(12,n,t,a|2),e.elementType=b,e.lanes=o,e;case w:return e=ni(13,n,t,a),e.elementType=w,e.lanes=o,e;case T:return e=ni(19,n,t,a),e.elementType=T,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case S:s=10;break a;case x:s=9;break a;case C:s=11;break a;case E:s=14;break a;case D:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ni(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function si(e,t,n,r){return e=ni(7,e,r,t),e.lanes=n,e}function ci(e,t,n){return e=ni(6,e,null,t),e.lanes=n,e}function li(e){var t=ni(18,null,null,0);return t.stateNode=e,t}function ui(e,t,n){return t=ni(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var di=new WeakMap;function fi(e,t){if(typeof e==`object`&&e){var n=di.get(e);return n===void 0?(t={value:e,source:t,stack:xe(t)},di.set(e,t),t):n}return{value:e,source:t,stack:xe(t)}}var pi=[],mi=0,hi=null,gi=0,_i=[],vi=0,yi=null,bi=1,xi=``;function Si(e,t){pi[mi++]=gi,pi[mi++]=hi,hi=e,gi=t}function Ci(e,t,n){_i[vi++]=bi,_i[vi++]=xi,_i[vi++]=yi,yi=e;var r=bi;e=xi;var i=32-R(r)-1;r&=~(1<<i),n+=1;var a=32-R(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,bi=1<<32-R(t)+i|n<<i|r,xi=a+e}else bi=1<<a|n<<i|r,xi=e}function wi(e){e.return!==null&&(Si(e,1),Ci(e,1,0))}function Ti(e){for(;e===hi;)hi=pi[--mi],pi[mi]=null,gi=pi[--mi],pi[mi]=null;for(;e===yi;)yi=_i[--vi],_i[vi]=null,xi=_i[--vi],_i[vi]=null,bi=_i[--vi],_i[vi]=null}function Ei(e,t){_i[vi++]=bi,_i[vi++]=xi,_i[vi++]=yi,bi=t.id,xi=t.overflow,yi=e}var Di=null,Oi=null,G=!1,ki=null,Ai=!1,ji=Error(i(519));function Mi(e){throw Ri(fi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ji}function Ni(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[it]=e,t[at]=r,n){case`dialog`:X(`cancel`,t),X(`close`,t);break;case`iframe`:case`object`:case`embed`:X(`load`,t);break;case`video`:case`audio`:for(n=0;n<yd.length;n++)X(yd[n],t);break;case`source`:X(`error`,t);break;case`img`:case`image`:case`link`:X(`error`,t),X(`load`,t);break;case`details`:X(`toggle`,t);break;case`input`:X(`invalid`,t),It(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:X(`invalid`,t);break;case`textarea`:X(`invalid`,t),Bt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Pd(t.textContent,n)?(r.popover!=null&&(X(`beforetoggle`,t),X(`toggle`,t)),r.onScroll!=null&&X(`scroll`,t),r.onScrollEnd!=null&&X(`scrollend`,t),r.onClick!=null&&(t.onclick=Yt),t=!0):t=!1,t||Mi(e,!0)}function Pi(e){for(Di=e.return;Di;)switch(Di.tag){case 5:case 31:case 13:Ai=!1;return;case 27:case 3:Ai=!0;return;default:Di=Di.return}}function Fi(e){if(e!==Di)return!1;if(!G)return Pi(e),G=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Kd(e.type,e.memoizedProps)),n=!n),n&&Oi&&Mi(e),Pi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Oi=pf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Oi=pf(e)}else t===27?(t=Oi,ef(e.type)?(e=ff,ff=null,Oi=e):Oi=t):Oi=Di?df(e.stateNode.nextSibling):null;return!0}function Ii(){Oi=Di=null,G=!1}function Li(){var e=ki;return e!==null&&(Ql===null?Ql=e:Ql.push.apply(Ql,e),ki=null),e}function Ri(e){ki===null?ki=[e]:ki.push(e)}var zi=oe(null),Bi=null,Vi=null;function Hi(e,t,n){F(zi,t._currentValue),t._currentValue=n}function Ui(e){e._currentValue=zi.current,P(zi)}function Wi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Gi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Wi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Wi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Ki(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;vr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ue.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[ep]:e.push(ep))}a=a.return}e!==null&&Gi(t,e,n,r),t.flags|=262144}function qi(e){for(e=e.firstContext;e!==null;){if(!vr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ji(e){Bi=e,Vi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yi(e){return Zi(Bi,e)}function Xi(e,t){return Bi===null&&Ji(e),Zi(e,t)}function Zi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Vi===null){if(e===null)throw Error(i(308));Vi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Vi=Vi.next=t;return n}var Qi=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},$i=t.unstable_scheduleCallback,ea=t.unstable_NormalPriority,ta={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function na(){return{controller:new Qi,data:new Map,refCount:0}}function ra(e){e.refCount--,e.refCount===0&&$i(ea,function(){e.controller.abort()})}var ia=null,aa=0,oa=0,sa=null;function ca(e,t){if(ia===null){var n=ia=[];aa=0,oa=pd(),sa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return aa++,t.then(la,la),t}function la(){if(--aa===0&&ia!==null){sa!==null&&(sa.status=`fulfilled`);var e=ia;ia=null,oa=0,sa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ua(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var da=j.S;j.S=function(e,t){tu=De(),typeof t==`object`&&t&&typeof t.then==`function`&&ca(e,t),da!==null&&da(e,t)};var fa=oe(null);function pa(){var e=fa.current;return e===null?Ll.pooledCache:e}function ma(e,t){t===null?F(fa,fa.current):F(fa,t.pool)}function ha(){var e=pa();return e===null?null:{parent:ta._currentValue,pool:e}}var ga=Error(i(460)),_a=Error(i(474)),va=Error(i(542)),ya={then:function(){}};function ba(e){return e=e.status,e===`fulfilled`||e===`rejected`}function xa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Yt,Yt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ta(e),e;default:if(typeof t.status==`string`)t.then(Yt,Yt);else{if(e=Ll,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ta(e),e}throw Ca=t,ga}}function Sa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ca=e,ga):e}}var Ca=null;function wa(){if(Ca===null)throw Error(i(459));var e=Ca;return Ca=null,e}function Ta(e){if(e===ga||e===va)throw Error(i(483))}var Ea=null,Da=0;function Oa(e){var t=Da;return Da+=1,Ea===null&&(Ea=[]),xa(Ea,e,t)}function ka(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Aa(e,t){throw t.$$typeof===h?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function ja(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ii(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ci(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===v?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===D&&Sa(i)===t.type)?(t=a(t,n.props),ka(t,n),t.return=e,t):(t=oi(n.type,n.key,n.props,null,e.mode,r),ka(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ui(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=si(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ci(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case g:return n=oi(t.type,t.key,t.props,null,e.mode,n),ka(n,t),n.return=e,n;case _:return t=ui(t,e.mode,n),t.return=e,t;case D:return t=Sa(t),f(e,t,n)}if(A(t)||te(t))return t=si(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Oa(t),n);if(t.$$typeof===S)return f(e,Xi(e,t),n);Aa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case g:return n.key===i?l(e,t,n,r):null;case _:return n.key===i?u(e,t,n,r):null;case D:return n=Sa(n),p(e,t,n,r)}if(A(n)||te(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Oa(n),r);if(n.$$typeof===S)return p(e,t,Xi(e,n),r);Aa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case g:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case _:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case D:return r=Sa(r),m(e,t,n,r,i)}if(A(r)||te(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Oa(r),i);if(r.$$typeof===S)return m(e,t,n,Xi(t,r),i);Aa(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),G&&Si(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return G&&Si(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),G&&Si(i,h),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),G&&Si(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return G&&Si(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),G&&Si(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===v&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case g:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===v){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===D&&Sa(l)===r.type){n(e,r.sibling),c=a(r,o.props),ka(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===v?(c=si(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=oi(o.type,o.key,o.props,null,e.mode,c),ka(c,o),c.return=e,e=c)}return s(e);case _:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=ui(o,e.mode,c),c.return=e,e=c}return s(e);case D:return o=Sa(o),b(e,r,o,c)}if(A(o))return h(e,r,o,c);if(te(o)){if(l=te(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Oa(o),c);if(o.$$typeof===S)return b(e,r,Xi(e,o),c);Aa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ci(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Da=0;var i=b(e,t,n,r);return Ea=null,i}catch(t){if(t===ga||t===va)throw t;var a=ni(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ma=ja(!0),Na=ja(!1),Pa=!1;function Fa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ia(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function La(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ra(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Il&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=$r(e),Qr(e,null,n),t}return Yr(e,r,t,n),$r(e)}function za(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Qe(e,n)}}function Ba(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Va=!1;function Ha(){if(Va){var e=sa;if(e!==null)throw e}}function Ua(e,t,n,r){Va=!1;var i=e.updateQueue;Pa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Rl&f)===f:(r&f)===f){f!==0&&f===oa&&(Va=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Pa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Kl|=o,e.lanes=o,e.memoizedState=d}}function Wa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ga(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Wa(n[e],t)}var Ka=oe(null),qa=oe(0);function Ja(e,t){e=Wl,F(qa,e),F(Ka,t),Wl=e|t.baseLanes}function Ya(){F(qa,Wl),F(Ka,Ka.current)}function Xa(){Wl=qa.current,P(Ka),P(qa)}var Za=oe(null),Qa=null;function $a(e){var t=e.alternate;F(io,io.current&1),F(Za,e),Qa===null&&(t===null||Ka.current!==null||t.memoizedState!==null)&&(Qa=e)}function eo(e){F(io,io.current),F(Za,e),Qa===null&&(Qa=e)}function to(e){e.tag===22?(F(io,io.current),F(Za,e),Qa===null&&(Qa=e)):no(e)}function no(){F(io,io.current),F(Za,Za.current)}function ro(e){P(Za),Qa===e&&(Qa=null),P(io)}var io=oe(0);function ao(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||cf(n)||lf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var oo=0,K=null,so=null,co=null,lo=!1,uo=!1,fo=!1,po=0,mo=0,ho=null,go=0;function _o(){throw Error(i(321))}function vo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!vr(e[n],t[n]))return!1;return!0}function yo(e,t,n,r,i,a){return oo=a,K=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,j.H=e===null||e.memoizedState===null?J:Fs,fo=!1,a=n(r,i),fo=!1,uo&&(a=xo(t,n,r,i)),bo(e),a}function bo(e){j.H=Ps;var t=so!==null&&so.next!==null;if(oo=0,co=so=K=null,lo=!1,mo=0,ho=null,t)throw Error(i(300));e===null||Qs||(e=e.dependencies,e!==null&&qi(e)&&(Qs=!0))}function xo(e,t,n,r){K=e;var a=0;do{if(uo&&(ho=null),mo=0,uo=!1,25<=a)throw Error(i(301));if(a+=1,co=so=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}j.H=Is,o=t(n,r)}while(uo);return o}function So(){var e=j.H,t=e.useState()[0];return t=typeof t.then==`function`?Oo(t):t,e=e.useState()[0],(so===null?null:so.memoizedState)!==e&&(K.flags|=1024),t}function Co(){var e=po!==0;return po=0,e}function wo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function To(e){if(lo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}lo=!1}oo=0,co=so=K=null,uo=!1,mo=po=0,ho=null}function Eo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return co===null?K.memoizedState=co=e:co=co.next=e,co}function q(){if(so===null){var e=K.alternate;e=e===null?null:e.memoizedState}else e=so.next;var t=co===null?K.memoizedState:co.next;if(t!==null)co=t,so=e;else{if(e===null)throw K.alternate===null?Error(i(467)):Error(i(310));so=e,e={memoizedState:so.memoizedState,baseState:so.baseState,baseQueue:so.baseQueue,queue:so.queue,next:null},co===null?K.memoizedState=co=e:co=co.next=e}return co}function Do(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Oo(e){var t=mo;return mo+=1,ho===null&&(ho=[]),e=xa(ho,e,t),t=K,(co===null?t.memoizedState:co.next)===null&&(t=t.alternate,j.H=t===null||t.memoizedState===null?J:Fs),e}function ko(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Oo(e);if(e.$$typeof===S)return Yi(e)}throw Error(i(438,String(e)))}function Ao(e){var t=null,n=K.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=K.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Do(),K.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=k;return t.index++,n}function jo(e,t){return typeof t==`function`?t(e):t}function Mo(e){return No(q(),so,e)}function No(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(oo&f)===f:(Rl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===oa&&(d=!0);else if((oo&p)===p){u=u.next,p===oa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,K.lanes|=p,Kl|=p;f=u.action,fo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,K.lanes|=f,Kl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!vr(o,e.memoizedState)&&(Qs=!0,d&&(n=sa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Po(e){var t=q(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);vr(o,t.memoizedState)||(Qs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Fo(e,t,n){var r=K,a=q(),o=G;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!vr((so||a).memoizedState,n);if(s&&(a.memoizedState=n,Qs=!0),a=a.queue,os(Ro.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||co!==null&&co.memoizedState.tag&1){if(r.flags|=2048,ts(9,{destroy:void 0},Lo.bind(null,r,a,n,t),null),Ll===null)throw Error(i(349));o||oo&127||Io(r,t,n)}return n}function Io(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=K.updateQueue,t===null?(t=Do(),K.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Lo(e,t,n,r){t.value=n,t.getSnapshot=r,zo(t)&&Bo(e)}function Ro(e,t,n){return n(function(){zo(t)&&Bo(e)})}function zo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!vr(e,n)}catch{return!0}}function Bo(e){var t=Zr(e,2);t!==null&&gu(t,e,2)}function Vo(e){var t=Eo();if(typeof e==`function`){var n=e;if(e=n(),fo){L(!0);try{n()}finally{L(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:e},t}function Ho(e,t,n,r){return e.baseState=n,No(e,so,typeof r==`function`?r:jo)}function Uo(e,t,n,r,a){if(js(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};j.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Wo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Wo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=j.T,o={};j.T=o;try{var s=n(i,r),c=j.S;c!==null&&c(o,s),Go(e,t,s)}catch(n){qo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),j.T=a}}else try{a=n(i,r),Go(e,t,a)}catch(n){qo(e,t,n)}}function Go(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Ko(e,t,n)},function(n){return qo(e,t,n)}):Ko(e,t,n)}function Ko(e,t,n){t.status=`fulfilled`,t.value=n,Jo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Wo(e,n)))}function qo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Jo(t),t=t.next;while(t!==r)}e.action=null}function Jo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Yo(e,t){return t}function Xo(e,t){if(G){var n=Ll.formState;if(n!==null){a:{var r=K;if(G){if(Oi){b:{for(var i=Oi,a=Ai;i.nodeType!==8;){if(!a){i=null;break b}if(i=df(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Oi=df(i.nextSibling),r=i.data===`F!`;break a}}Mi(r)}r=!1}r&&(t=n[0])}}return n=Eo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:t},n.queue=r,n=Os.bind(null,K,r),r.dispatch=n,r=Vo(!1),a=As.bind(null,K,!1,r.queue),r=Eo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Uo.bind(null,K,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Zo(e){return Qo(q(),so,e)}function Qo(e,t,n){if(t=No(e,t,Yo)[0],e=Mo(jo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Oo(t)}catch(e){throw e===ga?va:e}else r=t;t=q();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(K.flags|=2048,ts(9,{destroy:void 0},$o.bind(null,i,n),null)),[r,a,e]}function $o(e,t){e.action=t}function es(e){var t=q(),n=so;if(n!==null)return Qo(t,n,e);q(),t=t.memoizedState,n=q();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ts(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=K.updateQueue,t===null&&(t=Do(),K.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ns(){return q().memoizedState}function rs(e,t,n,r){var i=Eo();K.flags|=e,i.memoizedState=ts(1|t,{destroy:void 0},n,r===void 0?null:r)}function is(e,t,n,r){var i=q();r=r===void 0?null:r;var a=i.memoizedState.inst;so!==null&&r!==null&&vo(r,so.memoizedState.deps)?i.memoizedState=ts(t,a,n,r):(K.flags|=e,i.memoizedState=ts(1|t,a,n,r))}function as(e,t){rs(8390656,8,e,t)}function os(e,t){is(2048,8,e,t)}function ss(e){K.flags|=4;var t=K.updateQueue;if(t===null)t=Do(),K.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function cs(e){var t=q().memoizedState;return ss({ref:t,nextImpl:e}),function(){if(Il&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ls(e,t){return is(4,2,e,t)}function us(e,t){return is(4,4,e,t)}function ds(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function fs(e,t,n){n=n==null?null:n.concat([e]),is(4,4,ds.bind(null,t,e),n)}function ps(){}function ms(e,t){var n=q();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&vo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function hs(e,t){var n=q();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&vo(t,r[1]))return r[0];if(r=e(),fo){L(!0);try{e()}finally{L(!1)}}return n.memoizedState=[r,t],r}function gs(e,t,n){return n===void 0||oo&1073741824&&!(Rl&261930)?e.memoizedState=t:(e.memoizedState=n,e=hu(),K.lanes|=e,Kl|=e,n)}function _s(e,t,n,r){return vr(n,t)?n:Ka.current===null?!(oo&42)||oo&1073741824&&!(Rl&261930)?(Qs=!0,e.memoizedState=n):(e=hu(),K.lanes|=e,Kl|=e,t):(e=gs(e,n,r),vr(e,t)||(Qs=!0),e)}function vs(e,t,n,r,i){var a=M.p;M.p=a!==0&&8>a?a:8;var o=j.T,s={};j.T=s,As(e,!1,t,n);try{var c=i(),l=j.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ks(e,t,ua(c,r),mu(e)):ks(e,t,r,mu(e))}catch(n){ks(e,t,{then:function(){},status:`rejected`,reason:n},mu())}finally{M.p=a,o!==null&&s.types!==null&&(o.types=s.types),j.T=o}}function ys(){}function bs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=xs(e).queue;vs(e,a,t,ie,n===null?ys:function(){return Ss(e),n(r)})}function xs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:ie},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ss(e){var t=xs(e);t.next===null&&(t=e.alternate.memoizedState),ks(e,t.next.queue,{},mu())}function Cs(){return Yi(ep)}function ws(){return q().memoizedState}function Ts(){return q().memoizedState}function Es(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=mu();e=La(n);var r=Ra(t,e,n);r!==null&&(gu(r,t,n),za(r,t,n)),t={cache:na()},e.payload=t;return}t=t.return}}function Ds(e,t,n){var r=mu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},js(e)?Ms(t,n):(n=Xr(e,t,n,r),n!==null&&(gu(n,e,r),Ns(n,t,r)))}function Os(e,t,n){ks(e,t,n,mu())}function ks(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(js(e))Ms(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,vr(s,o))return Yr(e,t,i,0),Ll===null&&Jr(),!1}catch{}if(n=Xr(e,t,i,r),n!==null)return gu(n,e,r),Ns(n,t,r),!0}return!1}function As(e,t,n,r){if(r={lane:2,revertLane:pd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},js(e)){if(t)throw Error(i(479))}else t=Xr(e,n,r,2),t!==null&&gu(t,e,2)}function js(e){var t=e.alternate;return e===K||t!==null&&t===K}function Ms(e,t){uo=lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ns(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Qe(e,n)}}var Ps={readContext:Yi,use:ko,useCallback:_o,useContext:_o,useEffect:_o,useImperativeHandle:_o,useLayoutEffect:_o,useInsertionEffect:_o,useMemo:_o,useReducer:_o,useRef:_o,useState:_o,useDebugValue:_o,useDeferredValue:_o,useTransition:_o,useSyncExternalStore:_o,useId:_o,useHostTransitionStatus:_o,useFormState:_o,useActionState:_o,useOptimistic:_o,useMemoCache:_o,useCacheRefresh:_o};Ps.useEffectEvent=_o;var J={readContext:Yi,use:ko,useCallback:function(e,t){return Eo().memoizedState=[e,t===void 0?null:t],e},useContext:Yi,useEffect:as,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),rs(4194308,4,ds.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){rs(4,2,e,t)},useMemo:function(e,t){var n=Eo();t=t===void 0?null:t;var r=e();if(fo){L(!0);try{e()}finally{L(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Eo();if(n!==void 0){var i=n(t);if(fo){L(!0);try{n(t)}finally{L(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ds.bind(null,K,e),[r.memoizedState,e]},useRef:function(e){var t=Eo();return e={current:e},t.memoizedState=e},useState:function(e){e=Vo(e);var t=e.queue,n=Os.bind(null,K,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ps,useDeferredValue:function(e,t){return gs(Eo(),e,t)},useTransition:function(){var e=Vo(!1);return e=vs.bind(null,K,e.queue,!0,!1),Eo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=K,a=Eo();if(G){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ll===null)throw Error(i(349));Rl&127||Io(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,as(Ro.bind(null,r,o,e),[e]),r.flags|=2048,ts(9,{destroy:void 0},Lo.bind(null,r,o,n,t),null),n},useId:function(){var e=Eo(),t=Ll.identifierPrefix;if(G){var n=xi,r=bi;n=(r&~(1<<32-R(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=po++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=go++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Cs,useFormState:Xo,useActionState:Xo,useOptimistic:function(e){var t=Eo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=As.bind(null,K,!0,n),n.dispatch=t,[e,t]},useMemoCache:Ao,useCacheRefresh:function(){return Eo().memoizedState=Es.bind(null,K)},useEffectEvent:function(e){var t=Eo(),n={impl:e};return t.memoizedState=n,function(){if(Il&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Fs={readContext:Yi,use:ko,useCallback:ms,useContext:Yi,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Mo,useRef:ns,useState:function(){return Mo(jo)},useDebugValue:ps,useDeferredValue:function(e,t){return _s(q(),so.memoizedState,e,t)},useTransition:function(){var e=Mo(jo)[0],t=q().memoizedState;return[typeof e==`boolean`?e:Oo(e),t]},useSyncExternalStore:Fo,useId:ws,useHostTransitionStatus:Cs,useFormState:Zo,useActionState:Zo,useOptimistic:function(e,t){return Ho(q(),so,e,t)},useMemoCache:Ao,useCacheRefresh:Ts};Fs.useEffectEvent=cs;var Is={readContext:Yi,use:ko,useCallback:ms,useContext:Yi,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Po,useRef:ns,useState:function(){return Po(jo)},useDebugValue:ps,useDeferredValue:function(e,t){var n=q();return so===null?gs(n,e,t):_s(n,so.memoizedState,e,t)},useTransition:function(){var e=Po(jo)[0],t=q().memoizedState;return[typeof e==`boolean`?e:Oo(e),t]},useSyncExternalStore:Fo,useId:ws,useHostTransitionStatus:Cs,useFormState:es,useActionState:es,useOptimistic:function(e,t){var n=q();return so===null?(n.baseState=e,[e,n.queue.dispatch]):Ho(n,so,e,t)},useMemoCache:Ao,useCacheRefresh:Ts};Is.useEffectEvent=cs;function Ls(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Rs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=mu(),i=La(r);i.payload=t,n!=null&&(i.callback=n),t=Ra(e,i,r),t!==null&&(gu(t,e,r),za(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=mu(),i=La(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ra(e,i,r),t!==null&&(gu(t,e,r),za(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=mu(),r=La(n);r.tag=2,t!=null&&(r.callback=t),t=Ra(e,r,n),t!==null&&(gu(t,e,n),za(t,e,n))}};function zs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!yr(n,r)||!yr(i,a):!0}function Bs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Rs.enqueueReplaceState(t,t.state,null)}function Vs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Hs(e){Wr(e)}function Us(e){console.error(e)}function Ws(e){Wr(e)}function Gs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ks(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function qs(e,t,n){return n=La(n),n.tag=3,n.payload={element:null},n.callback=function(){Gs(e,t)},n}function Js(e){return e=La(e),e.tag=3,e}function Ys(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ks(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ks(t,n,r),typeof i!=`function`&&(iu===null?iu=new Set([this]):iu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Xs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ki(t,n,a,!0),n=Za.current,n!==null){switch(n.tag){case 31:case 13:return Qa===null?Ou():n.alternate===null&&Gl===0&&(Gl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ya?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),qu(e,r,a)),!1;case 22:return n.flags|=65536,r===ya?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),qu(e,r,a)),!1}throw Error(i(435,n.tag))}return qu(e,r,a),Ou(),!1}if(G)return t=Za.current,t===null?(r!==ji&&(t=Error(i(423),{cause:r}),Ri(fi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=fi(r,n),a=qs(e.stateNode,r,a),Ba(e,a),Gl!==4&&(Gl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ji&&(e=Error(i(422),{cause:r}),Ri(fi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=fi(o,n),Zl===null?Zl=[o]:Zl.push(o),Gl!==4&&(Gl=2),t===null)return!0;r=fi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=qs(n.stateNode,r,e),Ba(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(iu===null||!iu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Js(a),Ys(a,e,n,r),Ba(n,a),!1}n=n.return}while(n!==null);return!1}var Zs=Error(i(461)),Qs=!1;function $s(e,t,n,r){t.child=e===null?Na(t,null,n,r):Ma(t,e.child,n,r)}function ec(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Ji(t),r=yo(e,t,n,o,a,i),s=Co(),e!==null&&!Qs?(wo(e,t,i),wc(e,t,i)):(G&&s&&wi(t),t.flags|=1,$s(e,t,r,i),t.child)}function tc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ri(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,nc(e,t,a,r,i)):(e=oi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Tc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?yr:n,n(o,r)&&e.ref===t.ref)return wc(e,t,i)}return t.flags|=1,e=ii(a,r),e.ref=t.ref,e.return=t,t.child=e}function nc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(yr(a,r)&&e.ref===t.ref){if(Qs=!1,t.pendingProps=r=a,Tc(e,i))e.flags&131072&&(Qs=!0);else return t.lanes=e.lanes,wc(e,t,i)}}return uc(e,t,n,r,i)}function rc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return ac(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ma(t,a===null?null:a.cachePool),a===null?Ya():Ja(t,a),to(t);else return r=t.lanes=536870912,ac(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ma(t,null),Ya(),no(t)):(ma(t,a.cachePool),Ja(t,a),no(t),t.memoizedState=null);return $s(e,t,i,n),t.child}function ic(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ac(e,t,n,r,i){var a=pa();return a=a===null?null:{parent:ta._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ma(t,null),Ya(),to(t),e!==null&&Ki(e,t,r,!0),t.childLanes=i,null}function oc(e,t){return t=yc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function sc(e,t,n){return Ma(t,e.child,null,n),e=oc(t,t.pendingProps),e.flags|=2,ro(t),t.memoizedState=null,e}function cc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(G){if(r.mode===`hidden`)return e=oc(t,r),t.lanes=536870912,ic(null,e);if(eo(t),(e=Oi)?(e=sf(e,Ai),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:yi===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=li(e),n.return=t,t.child=n,Di=t,Oi=null)):e=null,e===null)throw Mi(t);return t.lanes=536870912,null}return oc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(eo(t),a){if(t.flags&256)t.flags&=-257,t=sc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Qs||Ki(e,t,n,!1),a=(n&e.childLanes)!==0,Qs||a){if(r=Ll,r!==null&&(s=$e(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Zr(e,s),gu(r,e,s),Zs;Ou(),t=sc(e,t,n)}else e=o.treeContext,Oi=df(s.nextSibling),Di=t,G=!0,ki=null,Ai=!1,e!==null&&Ei(t,e),t=oc(t,r),t.flags|=4096;return t}return e=ii(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function lc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function uc(e,t,n,r,i){return Ji(t),n=yo(e,t,n,r,void 0,i),r=Co(),e!==null&&!Qs?(wo(e,t,i),wc(e,t,i)):(G&&r&&wi(t),t.flags|=1,$s(e,t,n,i),t.child)}function dc(e,t,n,r,i,a){return Ji(t),t.updateQueue=null,n=xo(t,r,n,i),bo(e),r=Co(),e!==null&&!Qs?(wo(e,t,a),wc(e,t,a)):(G&&r&&wi(t),t.flags|=1,$s(e,t,n,a),t.child)}function fc(e,t,n,r,i){if(Ji(t),t.stateNode===null){var a=ei,o=n.contextType;typeof o==`object`&&o&&(a=Yi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Rs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Fa(t),o=n.contextType,a.context=typeof o==`object`&&o?Yi(o):ei,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ls(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Rs.enqueueReplaceState(a,a.state,null),Ua(t,r,a,i),Ha(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Vs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ei,typeof u==`object`&&u&&(o=Yi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Bs(t,a,r,o),Pa=!1;var f=t.memoizedState;a.state=f,Ua(t,r,a,i),Ha(),l=t.memoizedState,s||f!==l||Pa?(typeof d==`function`&&(Ls(t,n,d,r),l=t.memoizedState),(c=Pa||zs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ia(e,t),o=t.memoizedProps,u=Vs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ei,typeof l==`object`&&l&&(c=Yi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Bs(t,a,r,c),Pa=!1,f=t.memoizedState,a.state=f,Ua(t,r,a,i),Ha();var p=t.memoizedState;o!==d||f!==p||Pa||e!==null&&e.dependencies!==null&&qi(e.dependencies)?(typeof s==`function`&&(Ls(t,n,s,r),p=t.memoizedState),(u=Pa||zs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&qi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,lc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ma(t,e.child,null,i),t.child=Ma(t,null,n,i)):$s(e,t,n,i),t.memoizedState=a.state,e=t.child):e=wc(e,t,i),e}function pc(e,t,n,r){return Ii(),t.flags|=256,$s(e,t,n,r),t.child}var mc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hc(e){return{baseLanes:e,cachePool:ha()}}function gc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Yl),e}function _c(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(io.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(G){if(a?$a(t):no(t),(e=Oi)?(e=sf(e,Ai),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:yi===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=li(e),n.return=t,t.child=n,Di=t,Oi=null)):e=null,e===null)throw Mi(t);return lf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(no(t),a=t.mode,c=yc({mode:`hidden`,children:c},a),r=si(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(null,r)):($a(t),vc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?($a(t),t.flags&=-257,t=bc(e,t,n)):t.memoizedState===null?(no(t),c=r.fallback,a=t.mode,r=yc({mode:`visible`,children:r.children},a),c=si(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ma(t,e.child,null,n),r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,t=ic(null,r)):(no(t),t.child=e.child,t.flags|=128,t=null);else if($a(t),lf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ri({value:r,source:null,stack:null}),t=bc(e,t,n)}else if(Qs||Ki(e,t,n,!1),s=(n&e.childLanes)!==0,Qs||s){if(s=Ll,s!==null&&(r=$e(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Zr(e,r),gu(s,e,r),Zs;cf(c)||Ou(),t=bc(e,t,n)}else cf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Oi=df(c.nextSibling),Di=t,G=!0,ki=null,Ai=!1,e!==null&&Ei(t,e),t=vc(t,r.children),t.flags|=4096);return t}return a?(no(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ii(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=si(c,a,n,null),c.flags|=2):c=ii(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ic(null,r),r=t.child,c=e.child.memoizedState,c===null?c=hc(n):(a=c.cachePool,a===null?a=ha():(l=ta._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(e.child,r)):($a(t),n=e.child,e=n.sibling,n=ii(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function vc(e,t){return t=yc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function yc(e,t){return e=ni(22,e,null,t),e.lanes=0,e}function bc(e,t,n){return Ma(t,e.child,null,n),e=vc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Wi(e.return,t,n)}function Sc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Cc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=io.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,F(io,o),$s(e,t,r,n),r=G?gi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xc(e,n,t);else if(e.tag===19)xc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ao(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Sc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ao(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Sc(t,!0,n,null,a,r);break;case`together`:Sc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function wc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Kl|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Ki(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ii(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ii(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Tc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&qi(e)))}function Ec(e,t,n){switch(t.tag){case 3:de(t,t.stateNode.containerInfo),Hi(t,ta,e.memoizedState.cache),Ii();break;case 27:case 5:pe(t);break;case 4:de(t,t.stateNode.containerInfo);break;case 10:Hi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,eo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?($a(t),e=wc(e,t,n),e===null?null:e.sibling):_c(e,t,n):($a(t),t.flags|=128,null);$a(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Ki(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Cc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),F(io,io.current),r)break;return null;case 22:return t.lanes=0,rc(e,t,n,t.pendingProps);case 24:Hi(t,ta,e.memoizedState.cache)}return wc(e,t,n)}function Dc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Qs=!0;else{if(!Tc(e,n)&&!(t.flags&128))return Qs=!1,Ec(e,t,n);Qs=!!(e.flags&131072)}}else Qs=!1,G&&t.flags&1048576&&Ci(t,gi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Sa(t.elementType),t.type=e,typeof e==`function`)ri(e)?(r=Vs(e,r),t.tag=1,t=fc(null,t,e,r,n)):(t.tag=0,t=uc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===C){t.tag=11,t=ec(null,t,e,r,n);break a}if(a===E){t.tag=14,t=tc(null,t,e,r,n);break a}}throw t=re(e)||e,Error(i(306,t,``))}}return t;case 0:return uc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Vs(r,t.pendingProps),fc(e,t,r,a,n);case 3:a:{if(de(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ia(e,t),Ua(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Hi(t,ta,r),r!==o.cache&&Gi(t,[ta],n,!0),Ha(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=pc(e,t,r,n);break a}if(r!==a){a=fi(Error(i(424)),t),Ri(a),t=pc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Oi=df(e.firstChild),Di=t,G=!0,ki=null,Ai=!0,n=Na(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ii(),r===a){t=wc(e,t,n);break a}$s(e,t,r,n)}t=t.child}return t;case 26:return lc(e,t),e===null?(n=Mf(t.type,null,t.pendingProps,null))?t.memoizedState=n:G||(n=t.type,e=t.pendingProps,r=Ud(le.current).createElement(n),r[it]=t,r[at]=e,Ld(r,n,e),V(r),t.stateNode=r):t.memoizedState=Mf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return pe(t),e===null&&G&&(r=t.stateNode=hf(t.type,t.pendingProps,le.current),Di=t,Ai=!0,a=Oi,ef(t.type)?(ff=a,Oi=df(r.firstChild)):Oi=a),$s(e,t,t.pendingProps.children,n),lc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&G&&((a=r=Oi)&&(r=af(r,t.type,t.pendingProps,Ai),r===null?a=!1:(t.stateNode=r,Di=t,Oi=df(r.firstChild),Ai=!1,a=!0)),a||Mi(t)),pe(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Kd(a,o)?r=null:s!==null&&Kd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=yo(e,t,So,null,null,n),ep._currentValue=a),lc(e,t),$s(e,t,r,n),t.child;case 6:return e===null&&G&&((e=n=Oi)&&(n=of(n,t.pendingProps,Ai),n===null?e=!1:(t.stateNode=n,Di=t,Oi=null,e=!0)),e||Mi(t)),null;case 13:return _c(e,t,n);case 4:return de(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ma(t,null,r,n):$s(e,t,r,n),t.child;case 11:return ec(e,t,t.type,t.pendingProps,n);case 7:return $s(e,t,t.pendingProps,n),t.child;case 8:return $s(e,t,t.pendingProps.children,n),t.child;case 12:return $s(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Hi(t,t.type,r.value),$s(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Ji(t),a=Yi(a),r=r(a),t.flags|=1,$s(e,t,r,n),t.child;case 14:return tc(e,t,t.type,t.pendingProps,n);case 15:return nc(e,t,t.type,t.pendingProps,n);case 19:return Cc(e,t,n);case 31:return cc(e,t,n);case 22:return rc(e,t,n,t.pendingProps);case 24:return Ji(t),r=Yi(ta),e===null?(a=pa(),a===null&&(a=Ll,o=na(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Fa(t),Hi(t,ta,a)):((e.lanes&n)!==0&&(Ia(e,t),Ua(t,null,null,n),Ha()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Hi(t,ta,r),r!==a.cache&&Gi(t,[ta],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Hi(t,ta,r))),$s(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Oc(e){e.flags|=4}function kc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Tu())e.flags|=8192;else throw Ca=ya,_a}}else e.flags&=-16777217}function Ac(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Kf(t)){if(Tu())e.flags|=8192;else throw Ca=ya,_a}}function jc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:qe(),e.lanes|=t,Xl|=t)}function Mc(e,t){if(!G)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Nc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Pc(e,t,n){var r=t.pendingProps;switch(Ti(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nc(t),null;case 1:return Nc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ui(ta),fe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Fi(t)?Oc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Li())),Nc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Oc(t),o===null?(Nc(t),kc(t,a,null,r,n)):(Nc(t),Ac(t,o))):o?o===e.memoizedState?(Nc(t),t.flags&=-16777217):(Oc(t),Nc(t),Ac(t,o)):(e=e.memoizedProps,e!==r&&Oc(t),Nc(t),kc(t,a,e,r,n)),null;case 27:if(me(t),n=le.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Nc(t),null}e=se.current,Fi(t)?Ni(t,e):(e=hf(a,r,n),t.stateNode=e,Oc(t))}return Nc(t),null;case 5:if(me(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Nc(t),null}if(o=se.current,Fi(t))Ni(t,o);else{var s=Ud(le.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[it]=t,o[at]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Ld(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Oc(t)}}return Nc(t),kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=le.current,Fi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Di,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[it]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Pd(e.nodeValue,n)),e||Mi(t,!0)}else e=Ud(e).createTextNode(r),e[it]=t,t.stateNode=e}return Nc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Fi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[it]=t}else Ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),e=!1}else n=Li(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ro(t),t):(ro(t),null);if(t.flags&128)throw Error(i(558))}return Nc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Fi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[it]=t}else Ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),a=!1}else a=Li(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ro(t),t):(ro(t),null)}return ro(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),jc(t,t.updateQueue),Nc(t),null);case 4:return fe(),e===null&&wd(t.stateNode.containerInfo),Nc(t),null;case 10:return Ui(t.type),Nc(t),null;case 19:if(P(io),r=t.memoizedState,r===null)return Nc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Mc(r,!1);else{if(Gl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ao(e),o!==null){for(t.flags|=128,Mc(r,!1),e=o.updateQueue,t.updateQueue=e,jc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ai(n,e),n=n.sibling;return F(io,io.current&1|2),G&&Si(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&De()>nu&&(t.flags|=128,a=!0,Mc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=ao(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,jc(t,e),Mc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!G)return Nc(t),null}else 2*De()-r.renderingStartTime>nu&&n!==536870912&&(t.flags|=128,a=!0,Mc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Nc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=De(),e.sibling=null,n=io.current,F(io,a?n&1|2:n&1),G&&Si(t,r.treeForkCount),e);case 22:case 23:return ro(t),Xa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Nc(t),t.subtreeFlags&6&&(t.flags|=8192)):Nc(t),n=t.updateQueue,n!==null&&jc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&P(fa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ui(ta),Nc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Fc(e,t){switch(Ti(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ui(ta),fe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return me(t),null;case 31:if(t.memoizedState!==null){if(ro(t),t.alternate===null)throw Error(i(340));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ro(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return P(io),null;case 4:return fe(),null;case 10:return Ui(t.type),null;case 22:case 23:return ro(t),Xa(),e!==null&&P(fa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ui(ta),null;case 25:return null;default:return null}}function Ic(e,t){switch(Ti(t),t.tag){case 3:Ui(ta),fe();break;case 26:case 27:case 5:me(t);break;case 4:fe();break;case 31:t.memoizedState!==null&&ro(t);break;case 13:ro(t);break;case 19:P(io);break;case 10:Ui(t.type);break;case 22:case 23:ro(t),Xa(),e!==null&&P(fa);break;case 24:Ui(ta)}}function Lc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Ku(t,t.return,e)}}function Rc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Ku(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ku(t,t.return,e)}}function zc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ga(t,n)}catch(t){Ku(e,e.return,t)}}}function Bc(e,t,n){n.props=Vs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ku(e,t,n)}}function Vc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Ku(e,t,n)}}function Hc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Ku(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Ku(e,t,n)}else n.current=null}}function Uc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Ku(e,e.return,t)}}function Wc(e,t,n){try{var r=e.stateNode;Rd(r,e.type,n,t),r[at]=t}catch(t){Ku(e,e.return,t)}}function Gc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ef(e.type)||e.tag===4}function Kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Gc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ef(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yt));else if(r!==4&&(r===27&&ef(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&ef(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ld(t,r,n),t[it]=e,t[at]=n}catch(t){Ku(e,e.return,t)}}var Xc=!1,Zc=!1,Qc=!1,$c=typeof WeakSet==`function`?WeakSet:Set,el=null;function tl(e,t){if(e=e.containerInfo,Vd=lp,e=U(e),W(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Hd={focusedElem:e,selectionRange:n},lp=!1,el=t;el!==null;)if(t=el,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,el=e;else for(;el!==null;){switch(t=el,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Vs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ku(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)rf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:rf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,el=e;break}el=t.return}}function nl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:_l(e,n),r&4&&Lc(5,n);break;case 1:if(_l(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ku(n,n.return,e)}else{var i=Vs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ku(n,n.return,e)}}}r&64&&zc(n),r&512&&Vc(n,n.return);break;case 3:if(_l(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ga(e,t)}catch(e){Ku(n,n.return,e)}}break;case 27:t===null&&r&4&&Yc(n);case 26:case 5:_l(e,n),t===null&&r&4&&Uc(n),r&512&&Vc(n,n.return);break;case 12:_l(e,n);break;case 31:_l(e,n),r&4&&cl(e,n);break;case 13:_l(e,n),r&4&&ll(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Xu.bind(null,n),uf(e,n))));break;case 22:if(r=n.memoizedState!==null||Xc,!r){t=t!==null&&t.memoizedState!==null||Zc,i=Xc;var a=Zc;Xc=r,(Zc=t)&&!a?yl(e,n,!!(n.subtreeFlags&8772)):_l(e,n),Xc=i,Zc=a}break;case 30:break;default:_l(e,n)}}function rl(e){var t=e.alternate;t!==null&&(e.alternate=null,rl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&dt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var il=null,al=!1;function ol(e,t,n){for(n=n.child;n!==null;)sl(e,t,n),n=n.sibling}function sl(e,t,n){if(Ie&&typeof Ie.onCommitFiberUnmount==`function`)try{Ie.onCommitFiberUnmount(I,n)}catch{}switch(n.tag){case 26:Zc||Hc(n,t),ol(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Zc||Hc(n,t);var r=il,i=al;ef(n.type)&&(il=n.stateNode,al=!1),ol(e,t,n),gf(n.stateNode),il=r,al=i;break;case 5:Zc||Hc(n,t);case 6:if(r=il,i=al,il=null,ol(e,t,n),il=r,al=i,il!==null){if(al)try{(il.nodeType===9?il.body:il.nodeName===`HTML`?il.ownerDocument.body:il).removeChild(n.stateNode)}catch(e){Ku(n,t,e)}else try{il.removeChild(n.stateNode)}catch(e){Ku(n,t,e)}}break;case 18:il!==null&&(al?(e=il,tf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Fp(e)):tf(il,n.stateNode));break;case 4:r=il,i=al,il=n.stateNode.containerInfo,al=!0,ol(e,t,n),il=r,al=i;break;case 0:case 11:case 14:case 15:Rc(2,n,t),Zc||Rc(4,n,t),ol(e,t,n);break;case 1:Zc||(Hc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Bc(n,t,r)),ol(e,t,n);break;case 21:ol(e,t,n);break;case 22:Zc=(r=Zc)||n.memoizedState!==null,ol(e,t,n),Zc=r;break;default:ol(e,t,n)}}function cl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Fp(e)}catch(e){Ku(t,t.return,e)}}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Fp(e)}catch(e){Ku(t,t.return,e)}}function ul(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $c),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $c),t;default:throw Error(i(435,e.tag))}}function dl(e,t){var n=ul(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Zu.bind(null,e,t);t.then(r,r)}})}function fl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(ef(c.type)){il=c.stateNode,al=!1;break a}break;case 5:il=c.stateNode,al=!1;break a;case 3:case 4:il=c.stateNode.containerInfo,al=!0;break a}c=c.return}if(il===null)throw Error(i(160));sl(o,s,a),il=null,al=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ml(t,e),t=t.sibling}var pl=null;function ml(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:fl(t,e),hl(e),r&4&&(Rc(3,e,e.return),Lc(3,e),Rc(5,e,e.return));break;case 1:fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),r&64&&Xc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=pl;if(fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[B]||o[it]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Ld(o,r,n),o[it]=e,V(o),r=o;break a;case`link`:var s=Uf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Ld(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Uf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Ld(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[it]=e,V(o),r=o}e.stateNode=r}else Wf(a,e.type,e.stateNode)}else e.stateNode=Z(a,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&Wc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Wf(a,e.type,e.stateNode):Z(a,r,e.memoizedProps))}break;case 27:fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),n!==null&&r&4&&Wc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),e.flags&32){a=e.stateNode;try{Vt(a,``)}catch(t){Ku(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Wc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Qc=!0);break;case 6:if(fl(t,e),hl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ku(e,e.return,t)}}break;case 3:if(Hf=null,a=pl,pl=yf(t.containerInfo),fl(t,e),pl=a,hl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Fp(t.containerInfo)}catch(t){Ku(e,e.return,t)}Qc&&(Qc=!1,gl(e));break;case 4:r=pl,pl=yf(e.stateNode.containerInfo),fl(t,e),hl(e),pl=r;break;case 12:fl(t,e),hl(e);break;case 31:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 13:fl(t,e),hl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(eu=De()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Xc,d=Zc;if(Xc=u||a,Zc=d||l,fl(t,e),Zc=d,Xc=u,hl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Xc||Zc||vl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Ku(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Ku(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?nf(m,!0):nf(l.stateNode,!1)}catch(e){Ku(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,dl(e,n))));break;case 19:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 30:break;case 21:break;default:fl(t,e),hl(e)}}function hl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Gc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Jc(e,Kc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Vt(o,``),n.flags&=-33),Jc(e,Kc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;qc(e,Kc(e),s);break;default:throw Error(i(161))}}catch(t){Ku(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function gl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;gl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function _l(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)nl(e,t.alternate,t),t=t.sibling}function vl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Rc(4,t,t.return),vl(t);break;case 1:Hc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Bc(t,t.return,n),vl(t);break;case 27:gf(t.stateNode);case 26:case 5:Hc(t,t.return),vl(t);break;case 22:t.memoizedState===null&&vl(t);break;case 30:vl(t);break;default:vl(t)}e=e.sibling}}function yl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:yl(i,a,n),Lc(4,a);break;case 1:if(yl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ku(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Wa(c[i],s)}catch(e){Ku(r,r.return,e)}}n&&o&64&&zc(a),Vc(a,a.return);break;case 27:Yc(a);case 26:case 5:yl(i,a,n),n&&r===null&&o&4&&Uc(a),Vc(a,a.return);break;case 12:yl(i,a,n);break;case 31:yl(i,a,n),n&&o&4&&cl(i,a);break;case 13:yl(i,a,n),n&&o&4&&ll(i,a);break;case 22:a.memoizedState===null&&yl(i,a,n),Vc(a,a.return);break;case 30:break;default:yl(i,a,n)}t=t.sibling}}function bl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ra(n))}function xl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ra(e))}function Sl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Cl(e,t,n,r),t=t.sibling}function Cl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Sl(e,t,n,r),i&2048&&Lc(9,t);break;case 1:Sl(e,t,n,r);break;case 3:Sl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ra(e)));break;case 12:if(i&2048){Sl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Ku(t,t.return,e)}}else Sl(e,t,n,r);break;case 31:Sl(e,t,n,r);break;case 13:Sl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Sl(e,t,n,r):(a._visibility|=2,wl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?Sl(e,t,n,r):Tl(e,t),i&2048&&bl(o,t);break;case 24:Sl(e,t,n,r),i&2048&&xl(t.alternate,t);break;default:Sl(e,t,n,r)}}function wl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:wl(a,o,s,c,i),Lc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,wl(a,o,s,c,i)):u._visibility&2?wl(a,o,s,c,i):Tl(a,o),i&&l&2048&&bl(o.alternate,o);break;case 24:wl(a,o,s,c,i),i&&l&2048&&xl(o.alternate,o);break;default:wl(a,o,s,c,i)}t=t.sibling}}function Tl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Tl(n,r),i&2048&&bl(r.alternate,r);break;case 24:Tl(n,r),i&2048&&xl(r.alternate,r);break;default:Tl(n,r)}t=t.sibling}}var El=8192;function Dl(e,t,n){if(e.subtreeFlags&El)for(e=e.child;e!==null;)Ol(e,t,n),e=e.sibling}function Ol(e,t,n){switch(e.tag){case 26:Dl(e,t,n),e.flags&El&&e.memoizedState!==null&&qf(n,pl,e.memoizedState,e.memoizedProps);break;case 5:Dl(e,t,n);break;case 3:case 4:var r=pl;pl=yf(e.stateNode.containerInfo),Dl(e,t,n),pl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=El,El=16777216,Dl(e,t,n),El=r):Dl(e,t,n));break;default:Dl(e,t,n)}}function kl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];el=r,Nl(r,e)}kl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jl(e),e=e.sibling}function jl(e){switch(e.tag){case 0:case 11:case 15:Al(e),e.flags&2048&&Rc(9,e,e.return);break;case 3:Al(e);break;case 12:Al(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ml(e)):Al(e);break;default:Al(e)}}function Ml(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];el=r,Nl(r,e)}kl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Rc(8,t,t.return),Ml(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ml(t));break;default:Ml(t)}e=e.sibling}}function Nl(e,t){for(;el!==null;){var n=el;switch(n.tag){case 0:case 11:case 15:Rc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ra(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,el=r;else a:for(n=e;el!==null;){r=el;var i=r.sibling,a=r.return;if(rl(r),r===n){el=null;break a}if(i!==null){i.return=a,el=i;break a}el=a}}}var Pl={getCacheForType:function(e){var t=Yi(ta),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Yi(ta).controller.signal}},Fl=typeof WeakMap==`function`?WeakMap:Map,Il=0,Ll=null,Y=null,Rl=0,zl=0,Bl=null,Vl=!1,Hl=!1,Ul=!1,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=null,Ql=null,$l=!1,eu=0,tu=0,nu=1/0,ru=null,iu=null,au=0,ou=null,su=null,cu=0,lu=0,uu=null,du=null,fu=0,pu=null;function mu(){return Il&2&&Rl!==0?Rl&-Rl:j.T===null?tt():pd()}function hu(){if(Yl===0){if(!(Rl&536870912)||G){var e=Ve;Ve<<=1,!(Ve&3932160)&&(Ve=262144),Yl=e}else Yl=536870912}return e=Za.current,e!==null&&(e.flags|=32),Yl}function gu(e,t,n){(e===Ll&&(zl===2||zl===9)||e.cancelPendingCommit!==null)&&(Cu(e,0),bu(e,Rl,Yl,!1)),Ye(e,n),(!(Il&2)||e!==Ll)&&(e===Ll&&(!(Il&2)&&(ql|=n),Gl===4&&bu(e,Rl,Yl,!1)),ad(e))}function _u(e,t,n){if(Il&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Ge(e,t),a=r?ju(e,t):ku(e,t,!0),o=r;do{if(a===0){Hl&&!r&&bu(e,t,0,!1);break}if(n=e.current.alternate,o&&!yu(n)){a=ku(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Zl;var l=c.current.memoizedState.isDehydrated;if(l&&(Cu(c,s).flags|=256),s=ku(c,s,!1),s!==2){if(Ul&&!l){c.errorRecoveryDisabledLanes|=o,ql|=o,a=4;break a}o=Ql,Ql=a,o!==null&&(Ql===null?Ql=o:Ql.push.apply(Ql,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Cu(e,0),bu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:bu(r,t,Yl,!Vl);break a;case 2:Ql=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=eu+300-De(),10<a)){if(bu(r,t,Yl,!Vl),We(r,0,!0)!==0)break a;cu=t,r.timeoutHandle=Yd(vu.bind(null,r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,o,`Throttled`,-0,0),a);break a}vu(r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,o,null,-0,0)}break}while(1);ad(e)}function vu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Yt},Ol(t,a,d);var m=(a&62914560)===a?eu-De():(a&4194048)===a?tu-De():0;if(m=Yf(d,m),m!==null){cu=a,e.cancelPendingCommit=m(Ru.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),bu(e,a,o,!l);return}}Ru(e,t,a,n,r,i,o,s,c)}function yu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!vr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function bu(e,t,n,r){t&=~Jl,t&=~ql,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-R(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ze(e,n,t)}function xu(){return Il&6?!0:(od(0,!1),!1)}function Su(){if(Y!==null){if(zl===0)var e=Y.return;else e=Y,Vi=Bi=null,To(e),Ea=null,Da=0,e=Y;for(;e!==null;)Ic(e.alternate,e),e=e.return;Y=null}}function Cu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Xd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),cu=0,Su(),Ll=e,Y=n=ii(e.current,null),Rl=t,zl=0,Bl=null,Vl=!1,Hl=Ge(e,t),Ul=!1,Xl=Yl=Jl=ql=Kl=Gl=0,Ql=Zl=null,$l=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-R(r),a=1<<i;t|=e[i],r&=~a}return Wl=t,Jr(),n}function wu(e,t){K=null,j.H=Ps,t===ga||t===va?(t=wa(),zl=3):t===_a?(t=wa(),zl=4):zl=t===Zs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Bl=t,Y===null&&(Gl=1,Gs(e,fi(t,e.current)))}function Tu(){var e=Za.current;return e===null?!0:(Rl&4194048)===Rl?Qa===null:(Rl&62914560)===Rl||Rl&536870912?e===Qa:!1}function Eu(){var e=j.H;return j.H=Ps,e===null?Ps:e}function Du(){var e=j.A;return j.A=Pl,e}function Ou(){Gl=4,Vl||(Rl&4194048)!==Rl&&Za.current!==null||(Hl=!0),!(Kl&134217727)&&!(ql&134217727)||Ll===null||bu(Ll,Rl,Yl,!1)}function ku(e,t,n){var r=Il;Il|=2;var i=Eu(),a=Du();(Ll!==e||Rl!==t)&&(ru=null,Cu(e,t)),t=!1;var o=Gl;a:do try{if(zl!==0&&Y!==null){var s=Y,c=Bl;switch(zl){case 8:Su(),o=6;break a;case 3:case 2:case 9:case 6:Za.current===null&&(t=!0);var l=zl;if(zl=0,Bl=null,Fu(e,s,c,l),n&&Hl){o=0;break a}break;default:l=zl,zl=0,Bl=null,Fu(e,s,c,l)}}Au(),o=Gl;break}catch(t){wu(e,t)}while(1);return t&&e.shellSuspendCounter++,Vi=Bi=null,Il=r,j.H=i,j.A=a,Y===null&&(Ll=null,Rl=0,Jr()),o}function Au(){for(;Y!==null;)Nu(Y)}function ju(e,t){var n=Il;Il|=2;var r=Eu(),a=Du();Ll!==e||Rl!==t?(ru=null,nu=De()+500,Cu(e,t)):Hl=Ge(e,t);a:do try{if(zl!==0&&Y!==null){t=Y;var o=Bl;b:switch(zl){case 1:zl=0,Bl=null,Fu(e,t,o,1);break;case 2:case 9:if(ba(o)){zl=0,Bl=null,Pu(t);break}t=function(){zl!==2&&zl!==9||Ll!==e||(zl=7),ad(e)},o.then(t,t);break a;case 3:zl=7;break a;case 4:zl=5;break a;case 7:ba(o)?(zl=0,Bl=null,Pu(t)):(zl=0,Bl=null,Fu(e,t,o,7));break;case 5:var s=null;switch(Y.tag){case 26:s=Y.memoizedState;case 5:case 27:var c=Y;if(s?Kf(s):c.stateNode.complete){zl=0,Bl=null;var l=c.sibling;if(l!==null)Y=l;else{var u=c.return;u===null?Y=null:(Y=u,Iu(u))}break b}}zl=0,Bl=null,Fu(e,t,o,5);break;case 6:zl=0,Bl=null,Fu(e,t,o,6);break;case 8:Su(),Gl=6;break a;default:throw Error(i(462))}}Mu();break}catch(t){wu(e,t)}while(1);return Vi=Bi=null,j.H=r,j.A=a,Il=n,Y===null?(Ll=null,Rl=0,Jr(),Gl):0}function Mu(){for(;Y!==null&&!Te();)Nu(Y)}function Nu(e){var t=Dc(e.alternate,e,Wl);e.memoizedProps=e.pendingProps,t===null?Iu(e):Y=t}function Pu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=dc(n,t,t.pendingProps,t.type,void 0,Rl);break;case 11:t=dc(n,t,t.pendingProps,t.type.render,t.ref,Rl);break;case 5:To(t);default:Ic(n,t),t=Y=ai(t,Wl),t=Dc(n,t,Wl)}e.memoizedProps=e.pendingProps,t===null?Iu(e):Y=t}function Fu(e,t,n,r){Vi=Bi=null,To(t),Ea=null,Da=0;var i=t.return;try{if(Xs(e,i,t,n,Rl)){Gl=1,Gs(e,fi(n,e.current)),Y=null;return}}catch(t){if(i!==null)throw Y=i,t;Gl=1,Gs(e,fi(n,e.current)),Y=null;return}t.flags&32768?(G||r===1?e=!0:Hl||Rl&536870912?e=!1:(Vl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Za.current,r!==null&&r.tag===13&&(r.flags|=16384))),Lu(t,e)):Iu(t)}function Iu(e){var t=e;do{if(t.flags&32768){Lu(t,Vl);return}e=t.return;var n=Pc(t.alternate,t,Wl);if(n!==null){Y=n;return}if(t=t.sibling,t!==null){Y=t;return}Y=t=e}while(t!==null);Gl===0&&(Gl=5)}function Lu(e,t){do{var n=Fc(e.alternate,e);if(n!==null){n.flags&=32767,Y=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Y=e;return}Y=e=n}while(e!==null);Gl=6,Y=null}function Ru(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Uu();while(au!==0);if(Il&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=qr,Xe(e,n,o,s,c,l),e===Ll&&(Y=Ll=null,Rl=0),su=t,ou=e,cu=n,lu=o,uu=a,du=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Qu(je,function(){return Wu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=j.T,j.T=null,a=M.p,M.p=2,s=Il,Il|=4;try{tl(e,t,n)}finally{Il=s,M.p=a,j.T=r}}au=1,zu(),Bu(),Vu()}}function zu(){if(au===1){au=0;var e=ou,t=su,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=j.T,j.T=null;var r=M.p;M.p=2;var i=Il;Il|=4;try{ml(t,e);var a=Hd,o=U(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Sr(s.ownerDocument.documentElement,s)){if(c!==null&&W(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=xr(s,h),v=xr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}lp=!!Vd,Hd=Vd=null}finally{Il=i,M.p=r,j.T=n}}e.current=t,au=2}}function Bu(){if(au===2){au=0;var e=ou,t=su,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=j.T,j.T=null;var r=M.p;M.p=2;var i=Il;Il|=4;try{nl(e,t.alternate,t)}finally{Il=i,M.p=r,j.T=n}}au=3}}function Vu(){if(au===4||au===3){au=0,Ee();var e=ou,t=su,n=cu,r=du;t.subtreeFlags&10256||t.flags&10256?au=5:(au=0,su=ou=null,Hu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(iu=null),z(n),t=t.stateNode,Ie&&typeof Ie.onCommitFiberRoot==`function`)try{Ie.onCommitFiberRoot(I,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=j.T,i=M.p,M.p=2,j.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{j.T=t,M.p=i}}cu&3&&Uu(),ad(e),i=e.pendingLanes,n&261930&&i&42?e===pu?fu++:(fu=0,pu=e):fu=0,od(0,!1)}}function Hu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ra(t)))}function Uu(){return zu(),Bu(),Vu(),Wu()}function Wu(){if(au!==5)return!1;var e=ou,t=lu;lu=0;var n=z(cu),r=j.T,a=M.p;try{M.p=32>n?32:n,j.T=null,n=uu,uu=null;var o=ou,s=cu;if(au=0,su=ou=null,cu=0,Il&6)throw Error(i(331));var c=Il;if(Il|=4,jl(o.current),Cl(o,o.current,s,n),Il=c,od(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot==`function`)try{Ie.onPostCommitFiberRoot(I,o)}catch{}return!0}finally{M.p=a,j.T=r,Hu(e,t)}}function Gu(e,t,n){t=fi(n,t),t=qs(e.stateNode,t,2),e=Ra(e,t,2),e!==null&&(Ye(e,2),ad(e))}function Ku(e,t,n){if(e.tag===3)Gu(e,e,n);else for(;t!==null;){if(t.tag===3){Gu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(iu===null||!iu.has(r))){e=fi(n,e),n=Js(2),r=Ra(t,n,2),r!==null&&(Ys(n,r,t,e),Ye(r,2),ad(r));break}}t=t.return}}function qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ul=!0,i.add(n),e=Ju.bind(null,e,t,n),t.then(e,e))}function Ju(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ll===e&&(Rl&n)===n&&(Gl===4||Gl===3&&(Rl&62914560)===Rl&&300>De()-eu?!(Il&2)&&Cu(e,0):Jl|=n,Xl===Rl&&(Xl=0)),ad(e)}function Yu(e,t){t===0&&(t=qe()),e=Zr(e,t),e!==null&&(Ye(e,t),ad(e))}function Xu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yu(e,n)}function Zu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Yu(e,n)}function Qu(e,t){return Ce(e,t)}var $u=null,ed=null,td=!1,nd=!1,rd=!1,id=0;function ad(e){e!==ed&&e.next===null&&(ed===null?$u=ed=e:ed=ed.next=e),nd=!0,td||(td=!0,fd())}function od(e,t){if(!rd&&nd){rd=!0;do for(var n=!1,r=$u;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-R(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,dd(r,a))}else a=Rl,a=We(r,r===Ll?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ge(r,a)||(n=!0,dd(r,a))}r=r.next}while(n);rd=!1}}function sd(){cd()}function cd(){nd=td=!1;var e=0;id!==0&&Jd()&&(e=id);for(var t=De(),n=null,r=$u;r!==null;){var i=r.next,a=ld(r,t);a===0?(r.next=null,n===null?$u=i:n.next=i,i===null&&(ed=n)):(n=r,(e!==0||a&3)&&(nd=!0)),r=i}au!==0&&au!==5||od(e,!1),id!==0&&(id=0)}function ld(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-R(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ke(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ll,n=Rl,n=We(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(zl===2||zl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&we(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ge(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&we(r),z(n)){case 2:case 8:n=Ae;break;case 32:n=je;break;case 268435456:n=Ne;break;default:n=je}return r=ud.bind(null,e),n=Ce(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&we(r),e.callbackPriority=2,e.callbackNode=null,2}function ud(e,t){if(au!==0&&au!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Uu()&&e.callbackNode!==n)return null;var r=Rl;return r=We(e,e===Ll?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(_u(e,r,t),ld(e,De()),e.callbackNode!=null&&e.callbackNode===n?ud.bind(null,e):null)}function dd(e,t){if(Uu())return null;_u(e,t,!0)}function fd(){Qd(function(){Il&6?Ce(ke,sd):cd()})}function pd(){if(id===0){var e=oa;e===0&&(e=Be,Be<<=1,!(Be&261888)&&(Be=256)),id=e}return id}function md(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Jt(``+e)}function hd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function gd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=md((i[at]||null).action),o=r.submitter;o&&(t=(t=o[at]||null)?md(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new _n(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(id!==0){var e=o?hd(i,o):new FormData(i);bs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?hd(i,o):new FormData(i),bs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var _d=0;_d<Hr.length;_d++){var vd=Hr[_d];Ur(vd.toLowerCase(),`on`+(vd[0].toUpperCase()+vd.slice(1)))}Ur(Pr,`onAnimationEnd`),Ur(Fr,`onAnimationIteration`),Ur(Ir,`onAnimationStart`),Ur(`dblclick`,`onDoubleClick`),Ur(`focusin`,`onFocus`),Ur(`focusout`,`onBlur`),Ur(Lr,`onTransitionRun`),Ur(Rr,`onTransitionStart`),Ur(zr,`onTransitionCancel`),Ur(Br,`onTransitionEnd`),yt(`onMouseEnter`,[`mouseout`,`mouseover`]),yt(`onMouseLeave`,[`mouseout`,`mouseover`]),yt(`onPointerEnter`,[`pointerout`,`pointerover`]),yt(`onPointerLeave`,[`pointerout`,`pointerover`]),vt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),vt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),vt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),vt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),vt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),vt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var yd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),bd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(yd));function xd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Wr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Wr(e)}i.currentTarget=null,a=c}}}}function X(e,t){var n=t[st];n===void 0&&(n=t[st]=new Set);var r=e+`__bubble`;n.has(r)||(Td(t,e,2,!1),n.add(r))}function Sd(e,t,n){var r=0;t&&(r|=4),Td(n,e,r,t)}var Cd=`_reactListening`+Math.random().toString(36).slice(2);function wd(e){if(!e[Cd]){e[Cd]=!0,gt.forEach(function(t){t!==`selectionchange`&&(bd.has(t)||Sd(t,!1,e),Sd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Cd]||(t[Cd]=!0,Sd(`selectionchange`,!1,t))}}function Td(e,t,n,r){switch(gp(t)){case 2:var i=up;break;case 8:i=dp;break;default:i=fp}n=i.bind(null,t,n,e),i=void 0,!on||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Ed(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=ft(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}nn(function(){var r=a,i=Zt(n),s=[];a:{var c=Vr.get(e);if(c!==void 0){var l=_n,u=e;switch(e){case`keypress`:if(fn(n)===0)break a;case`keydown`:case`keyup`:l=Pn;break;case`focusin`:u=`focus`,l=En;break;case`focusout`:u=`blur`,l=En;break;case`beforeblur`:case`afterblur`:l=En;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=wn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Tn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=In;break;case Pr:case Fr:case Ir:l=Dn;break;case Br:l=Ln;break;case`scroll`:case`scrollend`:l=yn;break;case`wheel`:l=Rn;break;case`copy`:case`cut`:case`paste`:l=On;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Fn;break;case`toggle`:case`beforetoggle`:l=zn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=rn(m,p),g!=null&&d.push(Dd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Xt&&(u=n.relatedTarget||n.fromElement)&&(ft(u)||u[ot]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?ft(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=wn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Fn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:mt(l),h=u==null?c:mt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ft(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=kd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Ad(s,c,l,d,!1),u!==null&&f!==null&&Ad(s,f,u,d,!0)}}a:{if(c=r?mt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=or;else if(er(c)){if(sr)v=gr;else{v=mr;var y=pr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Gt(r.elementType)&&(v=or):v=hr;if(v&&=v(e,r)){tr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Lt(c,`number`,c.value)}switch(y=r?mt(r):window,e){case`focusin`:(er(y)||y.contentEditable===`true`)&&(wr=y,Tr=r,Er=null);break;case`focusout`:Er=Tr=wr=null;break;case`mousedown`:Dr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Dr=!1,Or(s,n,i);break;case`selectionchange`:if(Cr)break;case`keydown`:case`keyup`:Or(s,n,i)}var b;if(Vn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Xn?Jn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Wn&&n.locale!==`ko`&&(Xn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Xn&&(b=dn()):(cn=i,ln=`value`in cn?cn.value:cn.textContent,Xn=!0)),y=Od(r,x),0<y.length&&(x=new kn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Yn(n),b!==null&&(x.data=b)))),(b=Un?Zn(e,n):Qn(e,n))&&(x=Od(r,`onBeforeInput`),0<x.length&&(y=new kn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),gd(s,e,r,n,i)}xd(s,t)})}function Dd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Od(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=rn(e,n),i!=null&&r.unshift(Dd(e,i,a)),i=rn(e,t),i!=null&&r.push(Dd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function kd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ad(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=rn(n,a),l!=null&&o.unshift(Dd(n,l,c))):i||(l=rn(n,a),l!=null&&o.push(Dd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var jd=/\r\n?/g,Md=/\u0000|\uFFFD/g;function Nd(e){return(typeof e==`string`?e:``+e).replace(jd,`
|
|
10
|
-
`).replace(Md,``)}function Pd(e,t){return t=Nd(t),Nd(e)===t}function Fd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Vt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Vt(e,``+r);break;case`className`:Tt(e,`class`,r);break;case`tabIndex`:Tt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Tt(e,n,r);break;case`style`:Wt(e,r,o);break;case`data`:if(t!==`object`){Tt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Fd(e,t,`name`,a.name,a,null),Fd(e,t,`formEncType`,a.formEncType,a,null),Fd(e,t,`formMethod`,a.formMethod,a,null),Fd(e,t,`formTarget`,a.formTarget,a,null)):(Fd(e,t,`encType`,a.encType,a,null),Fd(e,t,`method`,a.method,a,null),Fd(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`onScroll`:r!=null&&X(`scroll`,e);break;case`onScrollEnd`:r!=null&&X(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Jt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:X(`beforetoggle`,e),X(`toggle`,e),wt(e,`popover`,r);break;case`xlinkActuate`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Et(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Et(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:wt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Kt.get(n)||n,wt(e,n,r))}}function Id(e,t,n,r,a,o){switch(n){case`style`:Wt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Vt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Vt(e,``+r);break;case`onScroll`:r!=null&&X(`scroll`,e);break;case`onScrollEnd`:r!=null&&X(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!_t.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[at]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):wt(e,n,r)}}}function Ld(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:X(`error`,e),X(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Fd(e,t,o,s,n,null)}}a&&Fd(e,t,`srcSet`,n.srcSet,n,null),r&&Fd(e,t,`src`,n.src,n,null);return;case`input`:X(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Fd(e,t,r,d,n,null)}}It(e,o,c,l,u,s,a,!1);return;case`select`:for(a in X(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Fd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Rt(e,!!r,n,!0):Rt(e,!!r,t,!1);return;case`textarea`:for(s in X(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Fd(e,t,s,c,n,null)}Bt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Fd(e,t,l,r,n,null)}return;case`dialog`:X(`beforetoggle`,e),X(`toggle`,e),X(`cancel`,e),X(`close`,e);break;case`iframe`:case`object`:X(`load`,e);break;case`video`:case`audio`:for(r=0;r<yd.length;r++)X(yd[r],e);break;case`image`:X(`error`,e),X(`load`,e);break;case`details`:X(`toggle`,e);break;case`embed`:case`source`:case`link`:X(`error`,e),X(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Fd(e,t,u,r,n,null)}return;default:if(Gt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Id(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Fd(e,t,c,r,n,null))}function Rd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Fd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Fd(e,t,p,m,r,f)}}Ft(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Fd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Fd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Rt(e,!!n,n?[]:``,!1):Rt(e,!!n,t,!0)):Rt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Fd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Fd(e,t,s,a,r,o)}zt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Fd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Fd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Fd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Fd(e,t,u,p,r,m)}return;default:if(Gt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Id(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Id(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Fd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Fd(e,t,f,p,r,m)}function zd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Bd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&zd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&zd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Vd=null,Hd=null;function Ud(e){return e.nodeType===9?e:e.ownerDocument}function Wd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Gd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Kd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var qd=null;function Jd(){var e=window.event;return e&&e.type===`popstate`?e!==qd&&(qd=e,!0):(qd=null,!1)}var Yd=typeof setTimeout==`function`?setTimeout:void 0,Xd=typeof clearTimeout==`function`?clearTimeout:void 0,Zd=typeof Promise==`function`?Promise:void 0,Qd=typeof queueMicrotask==`function`?queueMicrotask:Zd===void 0?Yd:function(e){return Zd.resolve(null).then(e).catch($d)};function $d(e){setTimeout(function(){throw e})}function ef(e){return e===`head`}function tf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Fp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)gf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,gf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[B]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&gf(e.ownerDocument.body)}n=i}while(n);Fp(t)}function nf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function rf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:rf(n),dt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function af(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[B])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=df(e.nextSibling),e===null)break}return null}function of(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=df(e.nextSibling),e===null))return null;return e}function sf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=df(e.nextSibling),e===null))return null;return e}function cf(e){return e.data===`$?`||e.data===`$~`}function lf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function uf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function df(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var ff=null;function pf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return df(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function mf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function hf(e,t,n){switch(t=Ud(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function gf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);dt(e)}var _f=new Map,vf=new Set;function yf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var bf=M.d;M.d={f:xf,r:Sf,D:Tf,C:Ef,L:Df,m:Of,X:Af,S:kf,M:jf};function xf(){var e=bf.f(),t=xu();return e||t}function Sf(e){var t=pt(e);t!==null&&t.tag===5&&t.type===`form`?Ss(t):bf.r(e)}var Cf=typeof document>`u`?null:document;function wf(e,t,n){var r=Cf;if(r&&typeof t==`string`&&t){var i=Pt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),vf.has(i)||(vf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Ld(t,`link`,e),V(t),r.head.appendChild(t)))}}function Tf(e){bf.D(e),wf(`dns-prefetch`,e,null)}function Ef(e,t){bf.C(e,t),wf(`preconnect`,e,t)}function Df(e,t,n){bf.L(e,t,n);var r=Cf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Pt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Pt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Pt(n.imageSizes)+`"]`)):i+=`[href="`+Pt(e)+`"]`;var a=i;switch(t){case`style`:a=Nf(e);break;case`script`:a=Lf(e)}_f.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),_f.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Pf(a))||t===`script`&&r.querySelector(Rf(a))||(t=r.createElement(`link`),Ld(t,`link`,e),V(t),r.head.appendChild(t)))}}function Of(e,t){bf.m(e,t);var n=Cf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Pt(r)+`"][href="`+Pt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Lf(e)}if(!_f.has(a)&&(e=m({rel:`modulepreload`,href:e},t),_f.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Rf(a)))return}r=n.createElement(`link`),Ld(r,`link`,e),V(r),n.head.appendChild(r)}}}function kf(e,t,n){bf.S(e,t,n);var r=Cf;if(r&&e){var i=ht(r).hoistableStyles,a=Nf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Pf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=_f.get(a))&&Bf(e,n);var c=o=r.createElement(`link`);V(c),Ld(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,zf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Af(e,t){bf.X(e,t);var n=Cf;if(n&&e){var r=ht(n).hoistableScripts,i=Lf(e),a=r.get(i);a||(a=n.querySelector(Rf(i)),a||(e=m({src:e,async:!0},t),(t=_f.get(i))&&Vf(e,t),a=n.createElement(`script`),V(a),Ld(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function jf(e,t){bf.M(e,t);var n=Cf;if(n&&e){var r=ht(n).hoistableScripts,i=Lf(e),a=r.get(i);a||(a=n.querySelector(Rf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=_f.get(i))&&Vf(e,t),a=n.createElement(`script`),V(a),Ld(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t,n,r){var a=(a=le.current)?yf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Nf(n.href),n=ht(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Nf(n.href);var o=ht(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Pf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),_f.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},_f.set(e,n),o||If(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Lf(n),n=ht(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Nf(e){return`href="`+Pt(e)+`"`}function Pf(e){return`link[rel="stylesheet"][`+e+`]`}function Ff(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function If(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Ld(t,`link`,n),V(t),e.head.appendChild(t))}function Lf(e){return`[src="`+Pt(e)+`"]`}function Rf(e){return`script[async]`+e}function Z(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Pt(n.href)+`"]`);if(r)return t.instance=r,V(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),V(r),Ld(r,`style`,a),zf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Nf(n.href);var o=e.querySelector(Pf(a));if(o)return t.state.loading|=4,t.instance=o,V(o),o;r=Ff(n),(a=_f.get(a))&&Bf(r,a),o=(e.ownerDocument||e).createElement(`link`),V(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Ld(o,`link`,r),t.state.loading|=4,zf(o,n.precedence,e),t.instance=o;case`script`:return o=Lf(n.src),(a=e.querySelector(Rf(o)))?(t.instance=a,V(a),a):(r=n,(a=_f.get(o))&&(r=m({},n),Vf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),V(a),Ld(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,zf(r,n.precedence,e));return t.instance}function zf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Bf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Vf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Hf=null;function Uf(e,t,n){if(Hf===null){var r=new Map,i=Hf=new Map;i.set(n,r)}else i=Hf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[B]||a[it]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Wf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Gf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Kf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function qf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Nf(r.href),a=t.querySelector(Pf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Xf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,V(a);return}a=t.ownerDocument||t,r=Ff(r),(i=_f.get(i))&&Bf(r,i),a=a.createElement(`link`),V(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Ld(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Xf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Jf=0;function Yf(e,t){return e.stylesheets&&e.count===0&&Qf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Qf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Jf===0&&(Jf=62500*Bd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Qf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Jf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Xf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Zf=null;function Qf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Zf=new Map,t.forEach($f,e),Zf=null,Xf.call(e))}function $f(e,t){if(!(t.state.loading&4)){var n=Zf.get(e);if(n)var r=n.get(null);else{n=new Map,Zf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Xf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var ep={$$typeof:S,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function tp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Je(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Je(0),this.hiddenUpdates=Je(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function np(e,t,n,r,i,a,o,s,c,l,u,d){return e=new tp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ni(3,null,null,t),e.current=a,a.stateNode=e,t=na(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Fa(a),e}function rp(e){return e?(e=ei,e):ei}function ip(e,t,n,r,i,a){i=rp(i),r.context===null?r.context=i:r.pendingContext=i,r=La(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ra(e,r,t),n!==null&&(gu(n,e,t),za(n,e,t))}function ap(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function op(e,t){ap(e,t),(e=e.alternate)&&ap(e,t)}function sp(e){if(e.tag===13||e.tag===31){var t=Zr(e,67108864);t!==null&&gu(t,e,67108864),op(e,67108864)}}function cp(e){if(e.tag===13||e.tag===31){var t=mu();t=et(t);var n=Zr(e,t);n!==null&&gu(n,e,t),op(e,t)}}var lp=!0;function up(e,t,n,r){var i=j.T;j.T=null;var a=M.p;try{M.p=2,fp(e,t,n,r)}finally{M.p=a,j.T=i}}function dp(e,t,n,r){var i=j.T;j.T=null;var a=M.p;try{M.p=8,fp(e,t,n,r)}finally{M.p=a,j.T=i}}function fp(e,t,n,r){if(lp){var i=pp(r);if(i===null)Ed(e,t,r,mp,n),Tp(e,r);else if(Dp(i,e,t,n,r))r.stopPropagation();else if(Tp(e,r),t&4&&-1<wp.indexOf(e)){for(;i!==null;){var a=pt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ue(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-R(o);s.entanglements[1]|=c,o&=~c}ad(a),!(Il&6)&&(nu=De()+500,od(0,!1))}}break;case 31:case 13:s=Zr(a,2),s!==null&&gu(s,a,2),xu(),op(a,2)}if(a=pp(r),a===null&&Ed(e,t,r,mp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Ed(e,t,r,null,n)}}function pp(e){return e=Zt(e),hp(e)}var mp=null;function hp(e){if(mp=null,e=ft(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return mp=e,null}function gp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Oe()){case ke:return 2;case Ae:return 8;case je:case Me:return 32;case Ne:return 268435456;default:return 32}default:return 32}}var _p=!1,vp=null,yp=null,bp=null,xp=new Map,Sp=new Map,Cp=[],wp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Tp(e,t){switch(e){case`focusin`:case`focusout`:vp=null;break;case`dragenter`:case`dragleave`:yp=null;break;case`mouseover`:case`mouseout`:bp=null;break;case`pointerover`:case`pointerout`:xp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Sp.delete(t.pointerId)}}function Ep(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=pt(t),t!==null&&sp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Dp(e,t,n,r,i){switch(t){case`focusin`:return vp=Ep(vp,e,t,n,r,i),!0;case`dragenter`:return yp=Ep(yp,e,t,n,r,i),!0;case`mouseover`:return bp=Ep(bp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return xp.set(a,Ep(xp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Sp.set(a,Ep(Sp.get(a)||null,e,t,n,r,i)),!0}return!1}function Op(e){var t=ft(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,nt(e.priority,function(){cp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,nt(e.priority,function(){cp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function kp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=pp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Xt=r,n.target.dispatchEvent(r),Xt=null}else return t=pt(n),t!==null&&sp(t),e.blockedOn=n,!1;t.shift()}return!0}function Ap(e,t,n){kp(e)&&n.delete(t)}function jp(){_p=!1,vp!==null&&kp(vp)&&(vp=null),yp!==null&&kp(yp)&&(yp=null),bp!==null&&kp(bp)&&(bp=null),xp.forEach(Ap),Sp.forEach(Ap)}function Mp(e,n){e.blockedOn===n&&(e.blockedOn=null,_p||(_p=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,jp)))}var Np=null;function Pp(e){Np!==e&&(Np=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Np===e&&(Np=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(hp(r||n)===null)continue;break}var a=pt(n);a!==null&&(e.splice(t,3),t-=3,bs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Fp(e){function t(t){return Mp(t,e)}vp!==null&&Mp(vp,e),yp!==null&&Mp(yp,e),bp!==null&&Mp(bp,e),xp.forEach(t),Sp.forEach(t);for(var n=0;n<Cp.length;n++){var r=Cp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Cp.length&&(n=Cp[0],n.blockedOn===null);)Op(n),n.blockedOn===null&&Cp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[at]||null;if(typeof a==`function`)o||Pp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[at]||null)s=o.formAction;else if(hp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Pp(n)}}}function Ip(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Lp(e){this._internalRoot=e}Rp.prototype.render=Lp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;ip(n,mu(),e,t,null,null)},Rp.prototype.unmount=Lp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ip(e.current,2,null,e,null,null),xu(),t[ot]=null}};function Rp(e){this._internalRoot=e}Rp.prototype.unstable_scheduleHydration=function(e){if(e){var t=tt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Cp.length&&t!==0&&t<Cp[n].priority;n++);Cp.splice(n,0,e),n===0&&Op(e)}};var zp=n.version;if(zp!==`19.2.4`)throw Error(i(527,zp,`19.2.4`));M.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Bp={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:j,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Vp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vp.isDisabled&&Vp.supportsFiber)try{I=Vp.inject(Bp),Ie=Vp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Hs,s=Us,c=Ws;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=np(e,1,!1,null,null,n,r,null,o,s,c,Ip),e[ot]=t.current,wd(e),new Lp(t)}})),Yn=i(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Jn()})),Xn=/(https?:\/\/[^\s"<>`{}|\\^]+)/,Zn=/\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i,Qn=/^data:image\//i,$n=[`avatars.githubusercontent.com`];function er(e){return Qn.test(e)?[{type:`image`,url:e}]:e.split(Xn).filter(e=>e!==``).map(e=>Xn.test(e)?Zn.test(e)||Qn.test(e)||$n.some(t=>e.includes(t))?{type:`image`,url:e}:{type:`url`,url:e}:{type:`text`,value:e})}var tr=new RegExp(Xn.source,`g`);BigInt.prototype.toJSON=function(){return JSON.rawJSON(this.toString())};function nr(e){try{return JSON.parse(e,(e,t)=>or(t))}catch{}if(e==null||e===``)return{};try{return e??=``,e=e.replaceAll(/(?<=\s|^|\[|,|:)(NaN|-Infinity|Infinity)(?=(?:[^"'\\]*(\\.|'([^'\\]*\\.)*[^'\\]*'|"([^"\\]*\\.)*[^"\\]*"))*[^"']*$)/g,`"◐$1◐"`),JSON.parse(e,(e,t)=>typeof t==`string`?t===`◐NaN◐`?NaN:t===`◐Infinity◐`?1/0:t===`◐-Infinity◐`?-1/0:or(t):or(t))}catch{return{}}}function rr(e){if(e.length===0)return``;let t=Object.keys(e[0]);return[`| ${t.join(` | `)} |`,`|${t.map(()=>`---`).join(`|`)}|`,...e.map(e=>`| ${t.map(t=>ir(e[t])).join(` | `)} |`)].join(`
|
|
11
|
-
`)}function ir(e){if(e==null)return``;if(Array.isArray(e)||typeof e==`object`)return ar(JSON.stringify(e));let t=String(e),n=/\[([^\]]+)]\((https?:\/\/[^)]+)\)/g,r=new Map,i=0;t=t.replaceAll(n,e=>{let t=`__MDLINK_${i++}__`;return r.set(t,e),t}),t=t.replaceAll(tr,`[$1]($1)`);for(let[e,n]of r)t=t.replace(e,n);return ar(t)}function ar(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`|`,`\\|`).replaceAll(`
|
|
12
|
-
`,` `).replaceAll(`\r`,``)}function or(e){return typeof e==`object`&&e&&`$bigint`in e&&typeof e.$bigint==`string`?BigInt(e.$bigint):e}var sr=`object-id`,cr=`random-id`,lr=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`,ur=new Set,dr=`__scratch__`,fr=`setup`,pr={create(){let e=0,t;do{let n=``;for(let e=0;e<4;e++)n+=lr[Math.floor(Math.random()*52)];t=n,e++}while(ur.has(t)&&e<100);if(e>=100)throw Error(`Failed to generate unique CellId after 100 attempts`);return ur.add(t),t}},mr={create(e){return O(e!=null,`cellId is required`),`cell-${e}`},parse(e){return e.slice(5)},findElement(e){return e.closest(`div[id^="cell-"]`)},findElementThroughShadowDOMs(e){let t=e;for(;t;){let e=mr.findElement(t);if(e)return e;let n=t.getRootNode();if(t=n instanceof ShadowRoot?n.host:t.parentElement,t===n)break}return null}};function hr(e){let t=null,n=mr.findElementThroughShadowDOMs(e);return n&&(t=mr.parse(n.id)),t}var gr={parse(e){return e.getAttribute(sr)},parseOrThrow(e){let t=gr.parse(e);return O(t,`<marimo-ui-element/> missing object-id attribute`),t}},_r={create(e){return`output-${e}`}},vr=new class{getFilename(){return this.getSearchParam(`filename`)}setFilename(e){this.setSearchParam(`filename`,e)}getCodeFromSearchParam(){return this.getSearchParam(`code`)}getCodeFromHash(){let e=window.location.hash;return e.startsWith(`#code/`)?e.slice(6):null}setCodeForHash(e){window.location.hash=`#code/${e}`}setSearchParam(e,t){let n=new URL(window.location.href);n.searchParams.set(e,t),window.history.replaceState({},``,n.toString())}getSearchParam(e){return new URL(window.location.href).searchParams.get(e)}};function yr(e){return nr(e??``)}function br(e){return D.mapValues(e.dataset,e=>typeof e==`string`?yr(e):e)}function xr(e,t){let n=e.parentElement?gr.parse(e.parentElement):void 0;return n&&t.has(n)?t.lookupValue(n):yr(e.dataset.initialValue)}function Sr(){if(ne())return document.title||null;if(A()){let e=vr.getFilename();if(e)return e}let e=document.querySelector(`marimo-filename`);M(e,`marimo-filename tag not found`);let t=e.innerHTML;return t.length===0?null:t}var U=e(f(),1),W=P(),Cr=`Checkbox`,[wr,Tr]=F(Cr),[Er,Dr]=wr(Cr);function Or(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=ge({prop:n,defaultProp:i??!1,onChange:c,caller:Cr}),[m,h]=U.useState(null),[g,_]=U.useState(null),v=U.useRef(!1),y=!m||!!o||!!m.closest(`form`),b={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:!Lr(i)&&i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,W.jsx)(Er,{scope:t,...b,children:Ir(d)?d(b):r})}var kr=`CheckboxTrigger`,Ar=U.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=Dr(kr,e),h=E(i,u),g=U.useRef(c);return U.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,W.jsx)(me.button,{type:`button`,role:`checkbox`,"aria-checked":Lr(c)?`mixed`:c,"aria-required":l,"data-state":Rr(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:he(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:he(n,e=>{d(e=>Lr(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});Ar.displayName=kr;var jr=U.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,W.jsx)(Or,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Ar,{...d,ref:t,__scopeCheckbox:n}),e&&(0,W.jsx)(Fr,{__scopeCheckbox:n})]})})});jr.displayName=Cr;var Mr=`CheckboxIndicator`,Nr=U.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Dr(Mr,n);return(0,W.jsx)(pe,{present:r||Lr(a.checked)||a.checked===!0,children:(0,W.jsx)(me.span,{"data-state":Rr(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});Nr.displayName=Mr;var Pr=`CheckboxBubbleInput`,Fr=U.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=Dr(Pr,e),m=E(n,p),h=Ce(a),g=ve(r);U.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Lr(a),n.call(e,!Lr(a)&&a),e.dispatchEvent(t)}},[f,h,a,i]);let _=U.useRef(!Lr(a)&&a);return(0,W.jsx)(me.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Fr.displayName=Pr;function Ir(e){return typeof e==`function`}function Lr(e){return e===`indeterminate`}function Rr(e){return Lr(e)?`indeterminate`:e?`checked`:`unchecked`}var zr=e(p(),1),Br=`ToastProvider`,[Vr,Hr,Ur]=ye(`Toast`),[Wr,Gr]=F(`Toast`,[Ur]),[Kr,qr]=Wr(Br),Jr=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=U.useState(null),[l,u]=U.useState(0),d=U.useRef(!1),f=U.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Br}\`. Expected non-empty \`string\`.`),(0,W.jsx)(Vr.Provider,{scope:t,children:(0,W.jsx)(Kr,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:U.useCallback(()=>u(e=>e+1),[]),onToastRemove:U.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};Jr.displayName=Br;var Yr=`ToastViewport`,Xr=[`F8`],Zr=`toast.viewportPause`,Qr=`toast.viewportResume`,$r=U.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=Xr,label:i=`Notifications ({hotkey})`,...a}=e,o=qr(Yr,n),s=Hr(n),c=U.useRef(null),l=U.useRef(null),u=U.useRef(null),d=U.useRef(null),f=E(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;U.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),U.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(Zr);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(Qr);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=U.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...Ei(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return U.useEffect(()=>{let e=d.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);Di(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,W.jsxs)(fe,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,W.jsx)(ti,{ref:l,onFocusFromOutsideViewport:()=>{Di(h({tabbingDirection:`forwards`}))}}),(0,W.jsx)(Vr.Slot,{scope:n,children:(0,W.jsx)(me.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,W.jsx)(ti,{ref:u,onFocusFromOutsideViewport:()=>{Di(h({tabbingDirection:`backwards`}))}})]})});$r.displayName=Yr;var ei=`ToastFocusProxy`,ti=U.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=qr(ei,n);return(0,W.jsx)(_e,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});ti.displayName=ei;var ni=`Toast`,ri=`toast.swipeStart`,ii=`toast.swipeMove`,ai=`toast.swipeCancel`,oi=`toast.swipeEnd`,si=U.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=ge({prop:r,defaultProp:i??!0,onChange:a,caller:ni});return(0,W.jsx)(pe,{present:n||s,children:(0,W.jsx)(ui,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:ue(e.onPause),onResume:ue(e.onResume),onSwipeStart:he(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:he(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:he(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:he(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});si.displayName=ni;var[ci,li]=Wr(ni,{onClose(){}}),ui=U.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=qr(ni,n),[g,_]=U.useState(null),v=E(t,e=>_(e)),y=U.useRef(null),b=U.useRef(null),x=i||h.duration,S=U.useRef(0),C=U.useRef(x),w=U.useRef(0),{onToastAdd:T,onToastRemove:D}=h,O=ue(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),o()}),k=U.useCallback(e=>{!e||e===1/0||(window.clearTimeout(w.current),S.current=new Date().getTime(),w.current=window.setTimeout(O,e))},[O]);U.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{k(C.current),l?.()},n=()=>{let e=new Date().getTime()-S.current;C.current-=e,window.clearTimeout(w.current),c?.()};return e.addEventListener(Zr,n),e.addEventListener(Qr,t),()=>{e.removeEventListener(Zr,n),e.removeEventListener(Qr,t)}}},[h.viewport,x,c,l,k]),U.useEffect(()=>{a&&!h.isClosePausedRef.current&&k(x)},[a,x,h.isClosePausedRef,k]),U.useEffect(()=>(T(),()=>D()),[T,D]);let ee=U.useMemo(()=>g?xi(g):null,[g]);return h.viewport?(0,W.jsxs)(W.Fragment,{children:[ee&&(0,W.jsx)(di,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:ee}),(0,W.jsx)(ci,{scope:n,onClose:O,children:zr.createPortal((0,W.jsx)(Vr.ItemSlot,{scope:n,children:(0,W.jsx)(de,{asChild:!0,onEscapeKeyDown:he(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||O(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,W.jsx)(me.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:v,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:he(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,O()))}),onPointerDown:he(e.onPointerDown,e=>{e.button===0&&(y.current={x:e.clientX,y:e.clientY})}),onPointerMove:he(e.onPointerMove,e=>{if(!y.current)return;let t=e.clientX-y.current.x,n=e.clientY-y.current.y,r=!!b.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(b.current=l,Si(ii,d,f,{discrete:!1})):Ci(l,h.swipeDirection,c)?(b.current=l,Si(ri,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(y.current=null)}),onPointerUp:he(e.onPointerUp,e=>{let t=b.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),b.current=null,y.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};Ci(t,h.swipeDirection,h.swipeThreshold)?Si(oi,p,r,{discrete:!0}):Si(ai,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),di=e=>{let{__scopeToast:t,children:n,...r}=e,i=qr(ni,t),[a,o]=U.useState(!1),[s,c]=U.useState(!1);return wi(()=>o(!0)),U.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,W.jsx)(le,{asChild:!0,children:(0,W.jsx)(_e,{...r,children:a&&(0,W.jsxs)(W.Fragment,{children:[i.label,` `,n]})})})},fi=`ToastTitle`,pi=U.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,W.jsx)(me.div,{...r,ref:t})});pi.displayName=fi;var mi=`ToastDescription`,hi=U.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,W.jsx)(me.div,{...r,ref:t})});hi.displayName=mi;var gi=`ToastAction`,_i=U.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,W.jsx)(bi,{altText:n,asChild:!0,children:(0,W.jsx)(yi,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${gi}\`. Expected non-empty \`string\`.`),null)});_i.displayName=gi;var vi=`ToastClose`,yi=U.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=li(vi,n);return(0,W.jsx)(bi,{asChild:!0,children:(0,W.jsx)(me.button,{type:`button`,...r,ref:t,onClick:he(e.onClick,i.onClose)})})});yi.displayName=vi;var bi=U.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,W.jsx)(me.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function xi(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),Ti(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n){if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...xi(e))}}}),t}function Si(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?se(i,a):i.dispatchEvent(a)}var Ci=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function wi(e=()=>{}){let t=ue(e);ce(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function Ti(e){return e.nodeType===e.ELEMENT_NODE}function Ei(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Di(e){let t=document.activeElement;return e.some(e=>e===t||(e.focus(),document.activeElement!==t))}var Oi=Jr,G=$r,ki=si,Ai=pi,ji=hi,Mi=_i,Ni=yi,Pi=Symbol(``);function Fi(e,t){return o(e,function(e,n,r){n(this,t(e(this),r))})}function Ii(e,t){let n=null,r=new Map,i=new Set,a=i=>{let s;if(t===void 0)s=r.get(i);else for(let[e,n]of r)if(t(e,i)){s=n;break}if(s!==void 0){if(n?.(s[1],i))a.remove(i);else return s[0]}let c=e(i);return r.set(i,[c,Date.now()]),o(`CREATE`,i,c),c},o=(e,t,n)=>{for(let r of i)r({type:e,param:t,atom:n})};return a.unstable_listen=e=>(i.add(e),()=>{i.delete(e)}),a.getParams=()=>r.keys(),a.remove=e=>{if(t===void 0){if(!r.has(e))return;let[t]=r.get(e);r.delete(e),o(`REMOVE`,e,t)}else for(let[n,[i]]of r)if(t(n,e)){r.delete(n),o(`REMOVE`,n,i);break}},a.setShouldRemove=e=>{if(n=e,n)for(let[e,[t,i]]of r)n(i,e)&&(r.delete(e),o(`REMOVE`,e,t))},a}var Li=(e,t,n)=>(t.has(n)?t:t.set(n,e())).get(n),Ri=new WeakMap,zi=(e,t,n,r)=>Li(e,Li(()=>new WeakMap,Li(()=>new WeakMap,Ri,t),n),r);function Bi(e,t,n=Object.is){return zi(()=>{let r=Symbol(),i=([e,i])=>{if(i===r)return t(e);let a=t(e,i);return n(i,a)?i:a},a=o(t=>{let n=t(a),r=t(e);return i([r,n])});return a.init=r,a},e,t,n)}var Vi=(e,t,n)=>(t.has(n)?t:t.set(n,e())).get(n),Hi=new WeakMap,Ui=(e,t,n)=>Vi(e,Vi(()=>new WeakMap,Hi,t),n),Wi={},Gi=e=>!!e.write,Ki=e=>typeof e==`function`;function qi(e,t){return Ui(()=>{let n=new WeakMap,r=(a,s)=>{let c=n.get(a);if(c)return c;let l=s&&n.get(s),u=[],d=[];return a.forEach((n,s)=>{let c=t?t(n):s;d[s]=c;let f=l&&l.atomList[l.keyList.indexOf(c)];if(f){u[s]=f;return}let p=t=>{let n=t(i),o=t(e),s=r(o,n?.arr).keyList.indexOf(c);if(s<0||s>=o.length){let e=a[r(a).keyList.indexOf(c)];if(e)return e;throw Error(`splitAtom: index out of bounds for read`)}return o[s]};u[s]=Gi(e)?o(p,(t,n,a)=>{let o=t(i),s=t(e),l=r(s,o?.arr).keyList.indexOf(c);if(l<0||l>=s.length)throw Error(`splitAtom: index out of bounds for write`);let u=Ki(a)?a(s[l]):a;Object.is(s[l],u)||n(e,[...s.slice(0,l),u,...s.slice(l+1)])}):o(p)}),c=l&&l.keyList.length===d.length&&l.keyList.every((e,t)=>e===d[t])?l:{arr:a,atomList:u,keyList:d},n.set(a,c),c},i=o(t=>{let n=t(i),a=t(e);return r(a,n?.arr)});i.init=void 0;let a=Gi(e)?o(e=>e(i).atomList,(t,n,r)=>{switch(r.type){case`remove`:{let i=t(a).indexOf(r.atom);if(i>=0){let r=t(e);n(e,[...r.slice(0,i),...r.slice(i+1)])}break}case`insert`:{let i=r.before?t(a).indexOf(r.before):t(a).length;if(i>=0){let a=t(e);n(e,[...a.slice(0,i),r.value,...a.slice(i)])}break}case`move`:{let i=t(a).indexOf(r.atom),o=r.before?t(a).indexOf(r.before):t(a).length;if(i>=0&&o>=0){let r=t(e);i<o?n(e,[...r.slice(0,i),...r.slice(i+1,o),r[i],...r.slice(o)]):n(e,[...r.slice(0,o),r[i],...r.slice(o,i),...r.slice(i+1)])}break}}}):o(e=>e(i).atomList);return a},e,t||Wi)}var Ji=e=>typeof e?.then==`function`;function Yi(e=()=>{try{return window.localStorage}catch{return}},t){let n,r,i={getItem:(i,a)=>{let o=e=>{if(e||=``,n!==e){try{r=JSON.parse(e,t?.reviver)}catch{return a}n=e}return r},s=e()?.getItem(i)??null;return Ji(s)?s.then(o):o(s)},setItem:(n,r)=>e()?.setItem(n,JSON.stringify(r,t?.replacer)),removeItem:t=>e()?.removeItem(t)},a=e=>(t,n,r)=>e(t,e=>{let t;try{t=JSON.parse(e||``)}catch{t=r}n(t)}),o;try{o=e()?.subscribe}catch{}return!o&&typeof window<`u`&&typeof window.addEventListener==`function`&&window.Storage&&(o=(t,n)=>{if(!(e()instanceof window.Storage))return()=>{};let r=r=>{r.storageArea===e()&&r.key===t&&n(r.newValue)};return window.addEventListener(`storage`,r),()=>{window.removeEventListener(`storage`,r)}}),o&&(i.subscribe=a(o)),i}var Xi=Yi();function Zi(e,t,n=Xi,r){let i=r?.getOnInit,a=o(i?n.getItem(e,t):t);return a.onMount=r=>{r(n.getItem(e,t));let i;return n.subscribe&&(i=n.subscribe(e,r,t)),i},o(e=>e(a),(r,i,o)=>{let s=typeof o==`function`?o(r(a)):o;return s===Pi?(i(a,t),n.removeItem(e)):Ji(s)?s.then(t=>(i(a,t),n.setItem(e,t))):(i(a,s),n.setItem(e,s))})}function Qi(e){let t,n,r;return typeof e==`object`?(t=e.hashFunction,n=e.expiring,r=e.tags):t=e,(e,i,a)=>{if(a.value!=null)a.value=ea(a.value,t,n,r);else if(a.get!=null)a.get=ea(a.get,t,n,r);else throw`Only put a Memoize() decorator on a method or get accessor.`}}var $i=new Map;function ea(e,t,n=0,r){let i=Symbol(`__memoized_map__`);return function(...a){let o;this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let s=this[i];if(Array.isArray(r))for(let e of r)$i.has(e)?$i.get(e).push(s):$i.set(e,[s]);if(t||a.length>0||n>0){let r;r=t===!0?a.map(e=>e.toString()).join(`!`):t?t.apply(this,a):a[0];let i=`${r}__timestamp`,c=!1;if(n>0){if(!s.has(i))c=!0;else{let e=s.get(i);c=Date.now()-e>n}}s.has(r)&&!c?o=s.get(r):(o=e.apply(this,a),s.set(r,o),n>0&&s.set(i,Date.now()))}else{let t=this;s.has(t)?o=s.get(t):(o=e.apply(this,a),s.set(t,o))}return o}}var ta=o(Sr()),na=o(null),ra=o(null),ia=o(void 0),aa=class{store=new Map;get length(){return this.store.size}clear(){this.store.clear()}getItem(e){return this.store.get(e)||null}key(e){return[...this.store.keys()][e]||null}removeItem(e){this.store.delete(e)}setItem(e,t){this.store.set(e,t)}};function oa(){let{hasLocalStorage:e,hasSessionStorage:t}=Kt();return e?window.localStorage:t?window.sessionStorage:new aa}var sa=oa(),ca=class{defaultValue;storage;constructor(e,t=sa){this.defaultValue=e,this.storage=t}get(e){try{let t=this.storage.getItem(e);return t?JSON.parse(t):this.defaultValue}catch{return this.defaultValue}}set(e,t){this.storage.setItem(e,JSON.stringify(t))}remove(e){this.storage.removeItem(e)}},la=class{schema;getDefaultValue;storage;constructor(e,t,n=sa){this.schema=e,this.getDefaultValue=t,this.storage=n}get(e){try{let t=this.storage.getItem(e);if(t==null)return this.getDefaultValue();let n=this.schema.safeParse(JSON.parse(t));return n.success?n.data:(T.warn(`Error parsing zod local storage`,n.error),this.getDefaultValue())}catch(e){return T.warn(`Error getting zod local storage`,e),this.getDefaultValue()}}set(e,t){this.storage.setItem(e,JSON.stringify(t))}remove(e){this.storage.removeItem(e)}},ua=class extends la{filename;unsubscribeFromFilename;constructor(e,t,n){let r=u.get(ta);super(t,n),this.filename=r;try{this.unsubscribeFromFilename=u.sub(ta,()=>{let t=u.get(ta);this.handleFilenameChange(e,t)})}catch{this.unsubscribeFromFilename=null}}get(e){return super.get(this.createScopedKey(e,this.filename))}set(e,t){super.set(this.createScopedKey(e,this.filename),t)}remove(e){super.remove(this.createScopedKey(e,this.filename))}createScopedKey(e,t){return t?`${e}:${t}`:e}handleFilenameChange(e,t){if(t&&t!==this.filename){let n=this.get(e);this.remove(e),this.filename=t,this.set(e,n)}}dispose(){this.unsubscribeFromFilename&&=(this.unsubscribeFromFilename(),null)}},da=`marimo:notebook-col-sizes`;function fa(){return{widths:[]}}var pa=new ua(da,m({widths:v(g([_(),b(`contentWidth`)]).default(`contentWidth`))}),fa),ma={getColumnWidth:e=>pa.get(da).widths[e]??`contentWidth`,saveColumnWidth:(e,t)=>{let n=pa.get(da).widths;if(n[e])n[e]=t;else{for(;n.length<=e;)n.push(`contentWidth`);n[e]=t}pa.set(da,{widths:n})},clearStorage:()=>{pa.remove(da)}};function ha(e,t){let n=pa.get(da).widths,r=zt(n,e,t);pa.set(da,{widths:r})}function ga(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var _a=class{value;isCollapsed;children;constructor(e,t,n){this.value=e,this.isCollapsed=t,this.children=n}geDescendantCount(){let e=0,t=[...this.children];for(;t.length>0;){let n=t.pop();e++;for(let e=n.children.length-1;e>=0;e--)t.push(n.children[e])}return e}getDescendants(){let e=[],t=[...this.children];for(;t.length>0;){let n=t.pop();e.push(n.value);for(let e=n.children.length-1;e>=0;e--)t.push(n.children[e])}return e}get inOrderIds(){let e=[],t=n=>{e.push(n.value);for(let e of n.children)t(e)};for(let e of this.children)t(e);return e}toString(){return this.isCollapsed?`${this.value} (collapsed)`:String(this.value)}equals(e){return this.value===e.value}};ga([Qi()],_a.prototype,`geDescendantCount`,null),ga([Qi()],_a.prototype,`getDescendants`,null),ga([Qi()],_a.prototype,`inOrderIds`,null);var va=0,ya=class e{nodes;id;constructor(e,t){this.nodes=e,this.id=t}static from(t){let n=`tree_${va++}`;return new e(t.map(e=>new _a(e,!1,[])),n)}static fromWithPreviousShape(t,n){if(!n)return e.from(t);let r=n.id,i=new e(t.map(e=>new _a(e,!1,[])),r);for(let e of t)if(n.isCollapsed(e)){let t=n._nodeMap.get(e)?.children??[];for(let n=t.length-1;n>=0;n--){let r=t[n];if(i._nodeMap.has(r.value)){i=i.collapse(e,r.value);break}}}return i}withNodes(t){return new e(t,this.id)}get topLevelIds(){return this.nodes.map(e=>e.value)}get inOrderIds(){return this.nodes.flatMap(e=>[e.value,...e.inOrderIds])}get idSet(){return new Set(this.inOrderIds)}get length(){return this.nodes.length}get _nodeMap(){let e=new Map;for(let t of this.nodes)e.set(t.value,t);return e}getDescendants(e){let t=this._nodeMap.get(e);return t?t.getDescendants():(T.warn(`Node ${e} not found in tree. Valid ids: ${this.topLevelIds}`),[])}isCollapsed(e){let t=this._nodeMap.get(e);return t?t.isCollapsed:(T.warn(`Node ${e} not found in tree. Valid ids: ${this.topLevelIds}`),!1)}indexOfOrThrow(e){let t=this.nodes.findIndex(t=>t.value===e);if(t===-1)throw Error(`Node ${e} not found in tree. Valid ids: ${this.topLevelIds}`);return t}slice(e,t){return this.nodes.slice(e,t).map(e=>e.value)}moveToFront(e){let t=this.indexOfOrThrow(e);return this.withNodes(zt(this.nodes,t,0))}moveToBack(e){let t=this.indexOfOrThrow(e);return this.withNodes(zt(this.nodes,t,this.nodes.length-1))}collapse(e,t){let n=this.nodes.findIndex(t=>t.value===e);if(n===-1)throw Error(`Node ${e} not found in tree. Valid ids: ${this.topLevelIds}`);let r=t===void 0?this.nodes.length:this.nodes.findIndex(e=>e.value===t);if(r===-1)throw Error(`Node ${t} not found in tree`);if(r<n)throw Error(`Node ${t} is before node ${e}`);let i=[...this.nodes],a=i[n];if(a.isCollapsed)throw Error(`Node ${e} is already collapsed`);let o=i.splice(n+1,r-n);return i[n]=new _a(a.value,!0,o),this.withNodes(i)}collapseAll(e){let t=[...this.nodes];if(e.length===0)throw Error(`No collapse ranges provided`);if(e.length!==t.length)throw Error(`Collapse ranges length ${e.length} does not match tree length ${t.length}`);let n=t.length-1;for(;n>=0;){let r=t[n],i=e[n];if(!r.isCollapsed&&i){let{id:e,until:a}=i;if(e!==r.value)throw Error(`Node ${r.value} does not match collapse range id ${e}`);let o=a===void 0?t.length:t.findIndex(e=>e.value===a);if(o===-1)throw Error(`Node ${a} not found in tree`);if(o<n)throw Error(`Node ${a} is before node ${e}`);let s=t.splice(n+1,o-n);t[n]=new _a(r.value,!0,s),n--}else n--}return this.withNodes(t)}expand(e){let t=this.nodes.findIndex(t=>t.value===e);if(t===-1)throw Error(`Node ${e} not found in tree. Valid ids: ${this.topLevelIds}`);let n=[...this.nodes],r=n[t];return r.isCollapsed?(n[t]=new _a(r.value,!1,[]),n=Bt(n,t+1,r.children),this.withNodes(n)):this}expandAll(){let e=[...this.nodes],t=0;for(;t<e.length;){let n=e[t];n.isCollapsed?(e[t]=new _a(n.value,!1,[]),e=Bt(e,t+1,n.children),t++):t++}return this.withNodes(e)}move(e,t){return this.withNodes(zt(this.nodes,e,t))}at(e){return this.nodes.at(e)?.value}atOrThrow(e){let t=this.nodes.at(e);if(t===void 0)throw Error(`Node at index ${e} not found in tree`);return t.value}first(){return this.atOrThrow(0)}last(){return this.atOrThrow(this.nodes.length-1)}after(e){let t=this.indexOfOrThrow(e);if(t!==this.nodes.length-1)return this.at(t+1)}before(e){let t=this.indexOfOrThrow(e);if(t!==0)return this.at(t-1)}insert(e,t){return this.withNodes(Wt(this.nodes,t,new _a(e,!1,[])))}insertAtEnd(e){return this.insert(e,this.nodes.length)}insertAtStart(e){return this.insert(e,0)}deleteAtIndex(e){let t=this.atOrThrow(e),n=this.expand(t);return n.withNodes(Ht(n.nodes,e))}delete(e){let t=this.indexOfOrThrow(e);return this.deleteAtIndex(t)}getCount(e){return this._nodeMap.get(e)?.geDescendantCount()??0}findAndExpandDeep(e){let t=this.find(e);return t.length===0?this:t.reduce((e,t)=>e.expand(t),this)}find(e){function t(n,r){for(let i of n){if(i.value===e)return[...r,e];let n=t(i.children,[...r,i.value]);if(n.length>0)return n}return[]}return t(this.nodes,[])}split(t){let n=this.nodes.findIndex(e=>e.value===t);if(n===-1)throw Error(`Node ${t} not found in tree`);let r=this.nodes.slice(0,n),i=this.nodes.slice(n);return r.length===0?[e.from([]),this.withNodes(i)]:[this.withNodes(r),e.from([]).withNodes(i)]}equals(e){return this.nodes.length===e.nodes.length&&this.nodes.every((t,n)=>t.value===e.nodes[n].value)}toString(){let e=0,t=``,n=r=>{for(let i of r)t+=`${` `.repeat(e*2)}${i.toString()}\n`,e+=1,n(i.children),--e};return n(this.nodes),t}};ga([Qi()],ya.prototype,`topLevelIds`,null),ga([Qi()],ya.prototype,`inOrderIds`,null),ga([Qi()],ya.prototype,`idSet`,null),ga([Qi()],ya.prototype,`_nodeMap`,null);var ba=class e{columns;constructor(e){this.columns=e,e.length===0&&(this.columns=[ya.from([])])}static from(t){return new e(t.map(e=>ya.from(e)))}static fromWithPreviousShape(t,n){if(!n)return e.from([t]);let r=n.getColumns(),i=Array.from({length:r.length},()=>[]),a=0;for(let e of t){let t=r.findIndex(t=>t.idSet.has(e));t===-1?i[a].push(e):(a=t,i[t].push(e))}let o=i.map((e,t)=>ya.fromWithPreviousShape(e,r[t]));return new e(o)}isEmpty(){return this.columns.length===0||this.columns.every(e=>e.nodes.length===0)}static fromIdsAndColumns(t){let n=Math.max(1,...t.map(([,e])=>(e??0)+1)),r=Array.from({length:n},()=>[]),i=0;for(let[e,n]of t)n==null||n<0?r[i].push(e):(r[n].push(e),i=n);return e.from(r)}get topLevelIds(){return this.columns.map(e=>e.topLevelIds)}get iterateTopLevelIds(){let e=this.columns;function*t(){for(let t of e)for(let e of t.topLevelIds)yield e}return t()}get inOrderIds(){return this.columns.flatMap(e=>e.inOrderIds)}get colLength(){return this.columns.length}get idLength(){return this.columns.reduce((e,t)=>e+t.nodes.length,0)}get _columnMap(){return new Map(this.columns.map(e=>[e.id,e]))}at(e){return this.columns[e]}get(e){return this._columnMap.get(e)}atOrThrow(e){let t=this.columns[e];if(!t)throw Error(`Column ${e} not found`);return t}hasOnlyOneColumn(){return this.columns.length===1}getColumns(){return this.columns}hasOnlyOneId(){return this.idLength===1}getColumnIds(){return this.columns.map(e=>e.id)}indexOf(e){return this.columns.indexOf(e)}addColumn(t,n=[]){return new e(this.columns.flatMap(e=>e.id===t?[e,ya.from(n)]:[e]))}insertBreakpoint(t){let n=this.findWithId(t),[r,i]=n.split(t),a=this.columns.flatMap(e=>e===n?[r,i].filter(Boolean):[e]);return new e(a)}delete(t){if(this.columns.length<=1)return this;let n=this.indexOfOrThrow(t),r=n===0?1:n-1,i=[...this.columns],a=i[n];return i[r]=a.withNodes([...i[r].nodes,...a.nodes]),i.splice(n,1),new e(i)}mergeAllColumns(){if(this.columns.length<=1)return this;let t=this.columns.flatMap(e=>e.nodes),n=this.columns[0];return new e([n.withNodes(t)])}moveWithinColumn(e,t,n){return this.transform(e,e=>e.move(t,n))}moveAcrossColumns(t,n,r,i){let a=this.indexOfOrThrow(t),o=this.indexOfOrThrow(r),s=[...this.columns],c=s[a],l=c.nodes.findIndex(e=>e.value===n);if(l===-1)throw Error(`Node ${n} not found in column ${t}`);let u=c.nodes[l];s[a]=c.withNodes(c.nodes.filter((e,t)=>t!==l));let d=s[o];if(i){let e=d.indexOfOrThrow(i);s[o]=d.withNodes(Wt(d.nodes,e,u))}else s[o]=d.withNodes([u,...d.nodes]);return new e(s)}moveCellsRelativeTo(t,n,r){if(t.length===0)return this;let i=new Set(t),a=this.findWithId(n),o=this.indexOfOrThrow(a.id),s=[];for(let e of t){let t=this.findWithId(e),n=t.nodes.find(t=>t.value===e);if(!n)throw Error(`Node ${e} not found in column ${t.id}`);s.push(n)}let c=this.columns.map(e=>e.withNodes(e.nodes.filter(e=>!i.has(e.value)))),l=c[o],u=l.nodes.findIndex(e=>e.value===n);u===-1?u=l.nodes.length:r===`after`&&(u+=1);let d=Bt(l.nodes,u,s);return c[o]=l.withNodes(d),new e(c)}indexOfOrThrow(e){let t=this.columns.findIndex(t=>t.id===e);if(t===-1)throw Error(`Column ${e} not found. Possible values: ${this.getColumnIds().join(`, `)}`);return t}moveColumn(t,n){if(t===n)return this;let r=this.indexOfOrThrow(t),i=n===`_left_`?r-1:n===`_right_`?r+1:this.indexOfOrThrow(n);return ha(r,i),new e(zt([...this.columns],r,i))}moveToNewColumn(t){let n=this.findWithId(t),r=this.columns.map(e=>e.id===n.id?e.delete(t):e),i=ya.from([t]);return new e([...r,i])}findWithId(e){let t=this.columns.find(t=>t.inOrderIds.includes(e));if(!t)throw T.log(`Possible values: ${this.columns.map(e=>e.inOrderIds).join(`, `)}`),Error(`Cell ${e} not found in any column`);return t}transformWithCellId(t,n){let r=!1,i=this.columns.map(e=>{if(e.inOrderIds.includes(t)){let t=n(e);return e!==t&&(r=!0),t}return e});return r?new e(i):this}setupCellExists(){return this.columns.some(e=>e.topLevelIds.includes(fr))}insertId(e,t,n){return this.transform(t,t=>t.insert(e,n))}deleteById(e){return this.transformWithCellId(e,t=>t.delete(e))}placeCells(e){if(e.length===0)return this;let t=this.deleteById(e[0].id);for(let{id:n}of e.slice(1))t=t.deleteById(n);let n=[...e].toSorted((e,t)=>e.columnId===t.columnId?e.index-t.index:e.columnId.localeCompare(t.columnId));for(let{id:e,columnId:r,index:i}of n)t=t.insertId(e,r,i);return t}compact(){return this.columns.length===1||!this.columns.some(e=>e.nodes.length===0)?this:new e(this.columns.filter(e=>e.nodes.length>0))}transform(t,n){let r=this._columnMap.get(t);if(!r)return T.warn(`Column ${t} not found`),this;let i=n(r);if(r===i)return this;let a=this.columns.map(e=>e.id===t?i:e);return new e(a)}transformAll(t){let n=!1,r=this.columns.map(e=>{let r=t(e);return e.equals(r)||(n=!0),r});return n?new e(r):this}};ga([Qi()],ba.prototype,`isEmpty`,null),ga([Qi()],ba.prototype,`topLevelIds`,null),ga([Qi()],ba.prototype,`inOrderIds`,null),ga([Qi()],ba.prototype,`idLength`,null),ga([Qi()],ba.prototype,`_columnMap`,null),ga([Qi()],ba.prototype,`getColumnIds`,null);var xa=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Doctype=e.CDATA=e.Tag=e.Style=e.Script=e.Comment=e.Directive=e.Text=e.Root=e.isTag=e.ElementType=void 0;var t;(function(e){e.Root=`root`,e.Text=`text`,e.Directive=`directive`,e.Comment=`comment`,e.Script=`script`,e.Style=`style`,e.Tag=`tag`,e.CDATA=`cdata`,e.Doctype=`doctype`})(t=e.ElementType||={});function n(e){return e.type===t.Tag||e.type===t.Script||e.type===t.Style}e.isTag=n,e.Root=t.Root,e.Text=t.Text,e.Directive=t.Directive,e.Comment=t.Comment,e.Script=t.Script,e.Style=t.Style,e.Tag=t.Tag,e.CDATA=t.CDATA,e.Doctype=t.Doctype})),Sa=i((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),n=e&&e.__assign||function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.cloneNode=e.hasChildren=e.isDocument=e.isDirective=e.isComment=e.isText=e.isCDATA=e.isTag=e.Element=e.Document=e.CDATA=e.NodeWithChildren=e.ProcessingInstruction=e.Comment=e.Text=e.DataNode=e.Node=void 0;var r=xa(),i=function(){function e(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent},set:function(e){this.parent=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this.prev},set:function(e){this.prev=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this.next},set:function(e){this.next=e},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(e){return e===void 0&&(e=!1),b(this,e)},e}();e.Node=i;var a=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.data=t,n}return Object.defineProperty(n.prototype,"nodeValue",{get:function(){return this.data},set:function(e){this.data=e},enumerable:!1,configurable:!0}),n}(i);e.DataNode=a;var o=function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=r.ElementType.Text,t}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),n}(a);e.Text=o;var s=function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=r.ElementType.Comment,t}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),n}(a);e.Comment=s;var c=function(e){t(n,e);function n(t,n){var i=e.call(this,n)||this;return i.name=t,i.type=r.ElementType.Directive,i}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),n}(a);e.ProcessingInstruction=c;var l=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.children=t,n}return Object.defineProperty(n.prototype,"firstChild",{get:function(){return this.children[0]??null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!1,configurable:!0}),n}(i);e.NodeWithChildren=l;var u=function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=r.ElementType.CDATA,t}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),n}(l);e.CDATA=u;var d=function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=r.ElementType.Root,t}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),n}(l);e.Document=d;var f=function(e){t(n,e);function n(t,n,i,a){i===void 0&&(i=[]),a===void 0&&(a=t===`script`?r.ElementType.Script:t===`style`?r.ElementType.Style:r.ElementType.Tag);var o=e.call(this,i)||this;return o.name=t,o.attribs=n,o.type=a,o}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"attributes",{get:function(){var e=this;return Object.keys(this.attribs).map(function(t){return{name:t,value:e.attribs[t],namespace:e[`x-attribsNamespace`]?.[t],prefix:e[`x-attribsPrefix`]?.[t]}})},enumerable:!1,configurable:!0}),n}(l);e.Element=f;function p(e){return(0,r.isTag)(e)}e.isTag=p;function m(e){return e.type===r.ElementType.CDATA}e.isCDATA=m;function h(e){return e.type===r.ElementType.Text}e.isText=h;function g(e){return e.type===r.ElementType.Comment}e.isComment=g;function _(e){return e.type===r.ElementType.Directive}e.isDirective=_;function v(e){return e.type===r.ElementType.Root}e.isDocument=v;function y(e){return Object.prototype.hasOwnProperty.call(e,`children`)}e.hasChildren=y;function b(e,t){t===void 0&&(t=!1);var r;if(h(e))r=new o(e.data);else if(g(e))r=new s(e.data);else if(p(e)){var i=t?x(e.children):[],a=new f(e.name,n({},e.attribs),i);i.forEach(function(e){return e.parent=a}),e.namespace!=null&&(a.namespace=e.namespace),e[`x-attribsNamespace`]&&(a[`x-attribsNamespace`]=n({},e[`x-attribsNamespace`])),e[`x-attribsPrefix`]&&(a[`x-attribsPrefix`]=n({},e[`x-attribsPrefix`])),r=a}else if(m(e)){var i=t?x(e.children):[],l=new u(i);i.forEach(function(e){return e.parent=l}),r=l}else if(v(e)){var i=t?x(e.children):[],y=new d(i);i.forEach(function(e){return e.parent=y}),e[`x-mode`]&&(y[`x-mode`]=e[`x-mode`]),r=y}else if(_(e)){var b=new c(e.name,e.data);e[`x-name`]!=null&&(b[`x-name`]=e[`x-name`],b[`x-publicId`]=e[`x-publicId`],b[`x-systemId`]=e[`x-systemId`]),r=b}else throw Error(`Not implemented yet: ${e.type}`);return r.startIndex=e.startIndex,r.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(r.sourceCodeLocation=e.sourceCodeLocation),r}e.cloneNode=b;function x(e){for(var t=e.map(function(e){return b(e,!0)}),n=1;n<t.length;n++)t[n].prev=t[n-1],t[n-1].next=t[n];return t}})),Ca=i((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.DomHandler=void 0;var r=xa(),i=Sa();n(Sa(),e);var a={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},o=function(){function e(e,t,n){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof t==`function`&&(n=t,t=a),typeof e==`object`&&(t=e,e=void 0),this.callback=e??null,this.options=t??a,this.elementCB=n??null}return e.prototype.onparserinit=function(e){this.parser=e},e.prototype.onreset=function(){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},e.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},e.prototype.onerror=function(e){this.handleCallback(e)},e.prototype.onclosetag=function(){this.lastNode=null;var e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)},e.prototype.onopentag=function(e,t){var n=this.options.xmlMode?r.ElementType.Tag:void 0,a=new i.Element(e,t,void 0,n);this.addNode(a),this.tagStack.push(a)},e.prototype.ontext=function(e){var t=this.lastNode;if(t&&t.type===r.ElementType.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{var n=new i.Text(e);this.addNode(n),this.lastNode=n}},e.prototype.oncomment=function(e){if(this.lastNode&&this.lastNode.type===r.ElementType.Comment){this.lastNode.data+=e;return}var t=new i.Comment(e);this.addNode(t),this.lastNode=t},e.prototype.oncommentend=function(){this.lastNode=null},e.prototype.oncdatastart=function(){var e=new i.Text(``),t=new i.CDATA([e]);this.addNode(t),e.parent=t,this.lastNode=e},e.prototype.oncdataend=function(){this.lastNode=null},e.prototype.onprocessinginstruction=function(e,t){var n=new i.ProcessingInstruction(e,t);this.addNode(n)},e.prototype.handleCallback=function(e){if(typeof this.callback==`function`)this.callback(e,this.dom);else if(e)throw e},e.prototype.addNode=function(e){var t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null},e}();e.DomHandler=o,e.default=o})),wa=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=e.CARRIAGE_RETURN_PLACEHOLDER=e.CARRIAGE_RETURN_REGEX=e.CARRIAGE_RETURN=e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES=void 0,e.CASE_SENSITIVE_TAG_NAMES=`animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.linearGradient.radialGradient.textPath`.split(`.`),e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES.reduce(function(e,t){return e[t.toLowerCase()]=t,e},{}),e.CARRIAGE_RETURN=`\r`,e.CARRIAGE_RETURN_REGEX=new RegExp(e.CARRIAGE_RETURN,`g`),e.CARRIAGE_RETURN_PLACEHOLDER=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now()}__`,e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=new RegExp(e.CARRIAGE_RETURN_PLACEHOLDER,`g`)})),Ta=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatAttributes=i,e.escapeSpecialCharacters=o,e.revertEscapedCharacters=s,e.formatDOM=c;var t=Ca(),n=wa();function r(e){return n.CASE_SENSITIVE_TAG_NAMES_MAP[e]}function i(e){for(var t={},n=0,r=e.length;n<r;n++){var i=e[n];t[i.name]=i.value}return t}function a(e){return e=e.toLowerCase(),r(e)||e}function o(e){return e.replace(n.CARRIAGE_RETURN_REGEX,n.CARRIAGE_RETURN_PLACEHOLDER)}function s(e){return e.replace(n.CARRIAGE_RETURN_PLACEHOLDER_REGEX,n.CARRIAGE_RETURN)}function c(e,n,r){n===void 0&&(n=null);for(var o=[],l,u=0,d=e.length;u<d;u++){var f=e[u];switch(f.nodeType){case 1:var p=a(f.nodeName);l=new t.Element(p,i(f.attributes)),l.children=c(p===`template`?f.content.childNodes:f.childNodes,l);break;case 3:l=new t.Text(s(f.nodeValue));break;case 8:l=new t.Comment(f.nodeValue);break;default:continue}var m=o[u-1]||null;m&&(m.next=l),l.parent=n,l.prev=m,l.next=null,o.push(l)}return r&&(l=new t.ProcessingInstruction(r.substring(0,r.indexOf(` `)).toLowerCase(),r),l.next=o[0]||null,l.parent=n,o.unshift(l),o[1]&&(o[1].prev=o[0])),o}})),Ea=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=g;var t=Ta(),n=`html`,r=`head`,i=`body`,a=/<([a-zA-Z]+[0-9]?)/,o=/<head[^]*>/i,s=/<body[^]*>/i,c=function(e,t){throw Error("This browser does not support `document.implementation.createHTMLDocument`")},l=function(e,t){throw Error("This browser does not support `DOMParser.prototype.parseFromString`")},u=typeof window==`object`&&window.DOMParser;if(typeof u==`function`){var d=new u,f=`text/html`;l=function(e,t){return t&&(e=`<${t}>${e}</${t}>`),d.parseFromString(e,f)},c=l}if(typeof document==`object`&&document.implementation){var p=document.implementation.createHTMLDocument();c=function(e,t){if(t){var n=p.documentElement.querySelector(t);return n&&(n.innerHTML=e),p}return p.documentElement.innerHTML=e,p}}var m=typeof document==`object`&&document.createElement(`template`),h;m&&m.content&&(h=function(e){return m.innerHTML=e,m.content.childNodes});function g(e){var u,d;e=(0,t.escapeSpecialCharacters)(e);var f=e.match(a),p=f&&f[1]?f[1].toLowerCase():``;switch(p){case n:var m=l(e);if(!o.test(e)){var g=m.querySelector(r);(u=g?.parentNode)==null||u.removeChild(g)}if(!s.test(e)){var g=m.querySelector(i);(d=g?.parentNode)==null||d.removeChild(g)}return m.querySelectorAll(n);case r:case i:var _=c(e).querySelectorAll(p);return s.test(e)&&o.test(e)?_[0].parentNode.childNodes:_;default:if(h)return h(e);var g=c(e,i).querySelector(i);return g.childNodes}}})),Da=i((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var n=t(Ea()),r=Ta(),i=/<(![a-zA-Z\s]+)>/;function a(e){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];var t=e.match(i),a=t?t[1]:void 0;return(0,r.formatDOM)((0,n.default)(e),null,a)}})),Oa=i((e=>{e.SAME=0,e.CAMELCASE=1,e.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":`acceptCharset`,accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:`className`,classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:`htmlFor`,form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":`httpEquiv`,icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":`accentHeight`,accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":`alignmentBaseline`,allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":`arabicForm`,ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":`baselineShift`,baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":`capHeight`,clip:0,clipPath:1,"clip-path":`clipPath`,clipPathUnits:1,clipRule:1,"clip-rule":`clipRule`,color:0,colorInterpolation:1,"color-interpolation":`colorInterpolation`,colorInterpolationFilters:1,"color-interpolation-filters":`colorInterpolationFilters`,colorProfile:1,"color-profile":`colorProfile`,colorRendering:1,"color-rendering":`colorRendering`,contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":`dominantBaseline`,dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":`enableBackground`,end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":`fillOpacity`,fillRule:1,"fill-rule":`fillRule`,filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":`floodOpacity`,floodColor:1,"flood-color":`floodColor`,focusable:0,fontFamily:1,"font-family":`fontFamily`,fontSize:1,"font-size":`fontSize`,fontSizeAdjust:1,"font-size-adjust":`fontSizeAdjust`,fontStretch:1,"font-stretch":`fontStretch`,fontStyle:1,"font-style":`fontStyle`,fontVariant:1,"font-variant":`fontVariant`,fontWeight:1,"font-weight":`fontWeight`,format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":`glyphName`,glyphOrientationHorizontal:1,"glyph-orientation-horizontal":`glyphOrientationHorizontal`,glyphOrientationVertical:1,"glyph-orientation-vertical":`glyphOrientationVertical`,glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":`horizAdvX`,horizOriginX:1,"horiz-origin-x":`horizOriginX`,ideographic:0,imageRendering:1,"image-rendering":`imageRendering`,in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":`letterSpacing`,lightingColor:1,"lighting-color":`lightingColor`,limitingConeAngle:1,local:0,markerEnd:1,"marker-end":`markerEnd`,markerHeight:1,markerMid:1,"marker-mid":`markerMid`,markerStart:1,"marker-start":`markerStart`,markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":`overlinePosition`,overlineThickness:1,"overline-thickness":`overlineThickness`,paintOrder:1,"paint-order":`paintOrder`,panose1:0,"panose-1":`panose1`,pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":`pointerEvents`,points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":`renderingIntent`,repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":`shapeRendering`,slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":`stopColor`,stopOpacity:1,"stop-opacity":`stopOpacity`,strikethroughPosition:1,"strikethrough-position":`strikethroughPosition`,strikethroughThickness:1,"strikethrough-thickness":`strikethroughThickness`,string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":`strokeDasharray`,strokeDashoffset:1,"stroke-dashoffset":`strokeDashoffset`,strokeLinecap:1,"stroke-linecap":`strokeLinecap`,strokeLinejoin:1,"stroke-linejoin":`strokeLinejoin`,strokeMiterlimit:1,"stroke-miterlimit":`strokeMiterlimit`,strokeWidth:1,"stroke-width":`strokeWidth`,strokeOpacity:1,"stroke-opacity":`strokeOpacity`,suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":`textAnchor`,textDecoration:1,"text-decoration":`textDecoration`,textLength:1,textRendering:1,"text-rendering":`textRendering`,to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":`underlinePosition`,underlineThickness:1,"underline-thickness":`underlineThickness`,unicode:0,unicodeBidi:1,"unicode-bidi":`unicodeBidi`,unicodeRange:1,"unicode-range":`unicodeRange`,unitsPerEm:1,"units-per-em":`unitsPerEm`,unselectable:0,vAlphabetic:1,"v-alphabetic":`vAlphabetic`,values:0,vectorEffect:1,"vector-effect":`vectorEffect`,version:0,vertAdvY:1,"vert-adv-y":`vertAdvY`,vertOriginX:1,"vert-origin-x":`vertOriginX`,vertOriginY:1,"vert-origin-y":`vertOriginY`,vHanging:1,"v-hanging":`vHanging`,vIdeographic:1,"v-ideographic":`vIdeographic`,viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":`vMathematical`,vocab:0,widths:0,wordSpacing:1,"word-spacing":`wordSpacing`,writingMode:1,"writing-mode":`writingMode`,x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":`xHeight`,xlinkActuate:1,"xlink:actuate":`xlinkActuate`,xlinkArcrole:1,"xlink:arcrole":`xlinkArcrole`,xlinkHref:1,"xlink:href":`xlinkHref`,xlinkRole:1,"xlink:role":`xlinkRole`,xlinkShow:1,"xlink:show":`xlinkShow`,xlinkTitle:1,"xlink:title":`xlinkTitle`,xlinkType:1,"xlink:type":`xlinkType`,xmlBase:1,"xml:base":`xmlBase`,xmlLang:1,"xml:lang":`xmlLang`,xmlns:0,"xml:space":`xmlSpace`,xmlnsXlink:1,"xmlns:xlink":`xmlnsXlink`,xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1}})),ka=i((e=>{var t=0,n=1,r=2,i=3,a=4,o=5,s=6;function c(e){return u.hasOwnProperty(e)?u[e]:null}function l(e,t,n,o,s,c,l){this.acceptsBooleans=t===r||t===i||t===a,this.attributeName=o,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=c,this.removeEmptyString=l}var u={};[`children`,`dangerouslySetInnerHTML`,`defaultValue`,`defaultChecked`,`innerHTML`,`suppressContentEditableWarning`,`suppressHydrationWarning`,`style`].forEach(e=>{u[e]=new l(e,t,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(([e,t])=>{u[e]=new l(e,n,!1,t,null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(e=>{u[e]=new l(e,r,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(e=>{u[e]=new l(e,r,!1,e,null,!1,!1)}),[`allowFullScreen`,`async`,`autoFocus`,`autoPlay`,`controls`,`default`,`defer`,`disabled`,`disablePictureInPicture`,`disableRemotePlayback`,`formNoValidate`,`hidden`,`loop`,`noModule`,`noValidate`,`open`,`playsInline`,`readOnly`,`required`,`reversed`,`scoped`,`seamless`,`itemScope`].forEach(e=>{u[e]=new l(e,i,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(e=>{u[e]=new l(e,i,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(e=>{u[e]=new l(e,a,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(e=>{u[e]=new l(e,s,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(e=>{u[e]=new l(e,o,!1,e.toLowerCase(),null,!1,!1)});var d=/[\-\:]([a-z])/g,f=e=>e[1].toUpperCase();`accent-height.alignment-baseline.arabic-form.baseline-shift.cap-height.clip-path.clip-rule.color-interpolation.color-interpolation-filters.color-profile.color-rendering.dominant-baseline.enable-background.fill-opacity.fill-rule.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.glyph-name.glyph-orientation-horizontal.glyph-orientation-vertical.horiz-adv-x.horiz-origin-x.image-rendering.letter-spacing.lighting-color.marker-end.marker-mid.marker-start.overline-position.overline-thickness.paint-order.panose-1.pointer-events.rendering-intent.shape-rendering.stop-color.stop-opacity.strikethrough-position.strikethrough-thickness.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.text-anchor.text-decoration.text-rendering.underline-position.underline-thickness.unicode-bidi.unicode-range.units-per-em.v-alphabetic.v-hanging.v-ideographic.v-mathematical.vector-effect.vert-adv-y.vert-origin-x.vert-origin-y.word-spacing.writing-mode.xmlns:xlink.x-height`.split(`.`).forEach(e=>{let t=e.replace(d,f);u[t]=new l(t,n,!1,e,null,!1,!1)}),[`xlink:actuate`,`xlink:arcrole`,`xlink:role`,`xlink:show`,`xlink:title`,`xlink:type`].forEach(e=>{let t=e.replace(d,f);u[t]=new l(t,n,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(e=>{let t=e.replace(d,f);u[t]=new l(t,n,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(e=>{u[e]=new l(e,n,!1,e.toLowerCase(),null,!1,!1)});var p=`xlinkHref`;u[p]=new l(`xlinkHref`,n,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(e=>{u[e]=new l(e,n,!1,e.toLowerCase(),null,!0,!0)});var{CAMELCASE:m,SAME:h,possibleStandardNames:g}=Oa(),_=RegExp.prototype.test.bind(RegExp(`^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`)),v=Object.keys(g).reduce((e,t)=>{let n=g[t];return n===h?e[t]=t:n===m?e[t.toLowerCase()]=t:e[t]=n,e},{});e.BOOLEAN=i,e.BOOLEANISH_STRING=r,e.NUMERIC=o,e.OVERLOADED_BOOLEAN=a,e.POSITIVE_NUMERIC=s,e.RESERVED=t,e.STRING=n,e.getPropertyInfo=c,e.isCustomAttribute=_,e.possibleStandardNames=v})),Aa=i((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=a,e.setStyleProp=s;var n=f(),r=t(qt()),i=new Set([`annotation-xml`,`color-profile`,`font-face`,`font-face-src`,`font-face-uri`,`font-face-format`,`font-face-name`,`missing-glyph`]);function a(e,t){return e.includes(`-`)?!i.has(e):!!(t&&typeof t.is==`string`)}var o={reactCompat:!0};function s(e,t){if(typeof e==`string`){if(!e.trim()){t.style={};return}try{t.style=(0,r.default)(e,o)}catch{t.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(n.version.split(`.`)[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set([`tr`,`tbody`,`thead`,`tfoot`,`colgroup`,`table`,`head`,`html`,`frameset`]),e.canTextBeChildOfNode=function(t){return!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(t.name)},e.returnFirstArg=function(e){return e}})),ja=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=o;var t=ka(),n=Aa(),r=[`checked`,`value`],i=[`input`,`select`,`textarea`],a={reset:!0,submit:!0};function o(e,o){e===void 0&&(e={});var c={},l=!!(e.type&&a[e.type]);for(var u in e){var d=e[u];if((0,t.isCustomAttribute)(u)){c[u]=d;continue}var f=u.toLowerCase(),p=s(f);if(p){var m=(0,t.getPropertyInfo)(p);switch(r.includes(p)&&i.includes(o)&&!l&&(p=s(`default`+f)),c[p]=d,m&&m.type){case t.BOOLEAN:c[p]=!0;break;case t.OVERLOADED_BOOLEAN:d===``&&(c[p]=!0)}continue}n.PRESERVE_CUSTOM_ATTRIBUTES&&(c[u]=d)}return(0,n.setStyleProp)(e.style,c),c}function s(e){return t.possibleStandardNames[e]}})),Ma=i((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=o;var n=f(),r=t(ja()),i=Aa(),a={cloneElement:n.cloneElement,createElement:n.createElement,isValidElement:n.isValidElement};function o(e,t){t===void 0&&(t={});for(var n=[],c=typeof t.replace==`function`,l=t.transform||i.returnFirstArg,u=t.library||a,d=u.cloneElement,f=u.createElement,p=u.isValidElement,m=e.length,h=0;h<m;h++){var g=e[h];if(c){var _=t.replace(g,h);if(p(_)){m>1&&(_=d(_,{key:_.key||h})),n.push(l(_,g,h));continue}}if(g.type===`text`){var v=!g.data.trim().length;if(v&&g.parent&&!(0,i.canTextBeChildOfNode)(g.parent)||t.trim&&v)continue;n.push(l(g.data,g,h));continue}var y=g,b={};s(y)?((0,i.setStyleProp)(y.attribs.style,y.attribs),b=y.attribs):y.attribs&&(b=(0,r.default)(y.attribs,y.name));var x=void 0;switch(g.type){case`script`:case`style`:g.children[0]&&(b.dangerouslySetInnerHTML={__html:g.children[0].data});break;case`tag`:g.name===`textarea`&&g.children[0]?b.defaultValue=g.children[0].data:g.children&&g.children.length&&(x=o(g.children,t));break;default:continue}m>1&&(b.key=h),n.push(l(f(g.name,b,x),g,h))}return n.length===1?n[0]:n}function s(e){return i.PRESERVE_CUSTOM_ATTRIBUTES&&e.type===`tag`&&(0,i.isCustomComponent)(e.name,e.attribs)}})),Na=e(i((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=o;var n=t(Da());e.htmlToDOM=n.default,e.attributesToProps=t(ja()).default;var r=t(Ma());e.domToReact=r.default;var i=Ca();Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return i.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return i.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return i.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return i.Text}});var a={lowerCaseAttributeNames:!1};function o(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);return e?(0,r.default)((0,n.default)(e,t?.htmlparser2||a),t):[]}}))(),1),Pa=Na.default.default||Na.default,Fa=(e,t)=>{let[n,...r]=t.split(`.`),i=(e.attribs.class||``).split(` `);return e.tagName===n&&r.every(e=>i.includes(e))},Ia=e=>e&&Fa(e,`span.nb`)&&e.firstChild instanceof Na.Text&&e.firstChild.nodeValue?.includes(`__marimo__`);function La(e){if(e instanceof Na.Element&&e.firstChild instanceof Na.Text&&Fa(e,`span.nb`)){let t=e.next;if(t&&t instanceof Na.Text){let n=t.next;if(n&&n instanceof Na.Element&&n.firstChild instanceof Na.Text&&Fa(n,`span.m`)){let t=Number.parseInt(n.firstChild.nodeValue||`0`,10);if(e.firstChild.nodeValue?.includes(`__marimo__`)){let n=/__marimo__cell_(\w+)_/.exec(e.firstChild.nodeValue)?.[1];if(n&&t)return{kind:`cell`,cellId:n,lineNumber:t}}else{let n=/"(.+?)"/.exec(e.firstChild.nodeValue)?.[1];if(n&&t)return{kind:`file`,filePath:n,lineNumber:t}}}}}return null}function Ra(e){let t=[];return Pa(e,{replace:e=>{let n=La(e);if(n)return t.push(n),`dummy`}}),t}function za(e){return t=>{let n=!1;for(let r of t)r&&(n=e(r)||n);return n}}var Ba=za(We),Va=za(qe),Ha=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(e){return e===!0||e===!1}e.boolean=t;function n(e){return typeof e==`string`||e instanceof String}e.string=n;function r(e){return typeof e==`number`||e instanceof Number}e.number=r;function i(e){return e instanceof Error}e.error=i;function a(e){return typeof e==`function`}e.func=a;function o(e){return Array.isArray(e)}e.array=o;function s(e){return o(e)&&e.every(e=>n(e))}e.stringArray=s})),Ua=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Message=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType=e.RequestType0=e.AbstractMessageSignature=e.ParameterStructures=e.ResponseError=e.ErrorCodes=void 0;var t=Ha(),n;(function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=-32099,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.PendingResponseRejected=-32097,e.ConnectionInactive=-32096,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=-32e3})(n||(e.ErrorCodes=n={})),e.ResponseError=class e extends Error{constructor(r,i,a){super(i),this.code=t.number(r)?r:n.UnknownErrorCode,this.data=a,Object.setPrototypeOf(this,e.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};var r=class e{constructor(e){this.kind=e}static is(t){return t===e.auto||t===e.byName||t===e.byPosition}toString(){return this.kind}};e.ParameterStructures=r,r.auto=new r(`auto`),r.byPosition=new r(`byPosition`),r.byName=new r(`byName`);var i=class{constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return r.auto}};e.AbstractMessageSignature=i,e.RequestType0=class extends i{constructor(e){super(e,0)}},e.RequestType=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.RequestType1=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.RequestType2=class extends i{constructor(e){super(e,2)}},e.RequestType3=class extends i{constructor(e){super(e,3)}},e.RequestType4=class extends i{constructor(e){super(e,4)}},e.RequestType5=class extends i{constructor(e){super(e,5)}},e.RequestType6=class extends i{constructor(e){super(e,6)}},e.RequestType7=class extends i{constructor(e){super(e,7)}},e.RequestType8=class extends i{constructor(e){super(e,8)}},e.RequestType9=class extends i{constructor(e){super(e,9)}},e.NotificationType=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.NotificationType0=class extends i{constructor(e){super(e,0)}},e.NotificationType1=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.NotificationType2=class extends i{constructor(e){super(e,2)}},e.NotificationType3=class extends i{constructor(e){super(e,3)}},e.NotificationType4=class extends i{constructor(e){super(e,4)}},e.NotificationType5=class extends i{constructor(e){super(e,5)}},e.NotificationType6=class extends i{constructor(e){super(e,6)}},e.NotificationType7=class extends i{constructor(e){super(e,7)}},e.NotificationType8=class extends i{constructor(e){super(e,8)}},e.NotificationType9=class extends i{constructor(e){super(e,9)}};var a;(function(e){function n(e){let n=e;return n&&t.string(n.method)&&(t.string(n.id)||t.number(n.id))}e.isRequest=n;function r(e){let n=e;return n&&t.string(n.method)&&e.id===void 0}e.isNotification=r;function i(e){let n=e;return n&&(n.result!==void 0||!!n.error)&&(t.string(n.id)||t.number(n.id)||n.id===null)}e.isResponse=i})(a||(e.Message=a={}))})),Wa=i((e=>{var t;Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=e.LinkedMap=e.Touch=void 0;var n;(function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last})(n||(e.Touch=n={}));var r=class{constructor(){this[t]=`LinkedMap`,this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,t=n.None){let r=this._map.get(e);if(r)return t!==n.None&&this.touch(r,t),r.value}set(e,t,r=n.None){let i=this._map.get(e);if(i)i.value=t,r!==n.None&&this.touch(i,r);else{switch(i={key:e,value:t,next:void 0,previous:void 0},r){case n.None:this.addItemLast(i);break;case n.First:this.addItemFirst(i);break;case n.Last:this.addItemLast(i);break;default:this.addItemLast(i)}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw Error(`Invalid list`);let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){let n=this._state,r=this._head;for(;r;){if(t?e.bind(t)(r.value,r.key,this):e(r.value,r.key,this),this._state!==n)throw Error(`LinkedMap got modified during iteration.`);r=r.next}}keys(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw Error(`LinkedMap got modified during iteration.`);if(t){let e={value:t.key,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}values(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw Error(`LinkedMap got modified during iteration.`);if(t){let e={value:t.value,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}entries(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw Error(`LinkedMap got modified during iteration.`);if(t){let e={value:[t.key,t.value],done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}[(t=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.next,n--;this._head=t,this._size=n,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw Error(`Invalid list`);this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw Error(`Invalid list`);this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw Error(`Invalid list`);e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw Error(`Invalid list`);e.previous.next=void 0,this._tail=e.previous}else{let t=e.next,n=e.previous;if(!t||!n)throw Error(`Invalid list`);t.previous=n,n.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw Error(`Invalid list`);if(t===n.First||t===n.Last){if(t===n.First){if(e===this._head)return;let t=e.next,n=e.previous;e===this._tail?(n.next=void 0,this._tail=n):(t.previous=n,n.next=t),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===n.Last){if(e===this._tail)return;let t=e.next,n=e.previous;e===this._head?(t.previous=void 0,this._head=t):(t.previous=n,n.next=t),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((t,n)=>{e.push([n,t])}),e}fromJSON(e){this.clear();for(let[t,n]of e)this.set(t,n)}};e.LinkedMap=r,e.LRUCache=class extends r{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,t=n.AsNew){return super.get(e,t)}peek(e){return super.get(e,n.None)}set(e,t){return super.set(e,t,n.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}})),Ga=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Disposable=void 0;var t;(function(e){function t(e){return{dispose:e}}e.create=t})(t||(e.Disposable=t={}))})),Ka=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t;function n(){if(t===void 0)throw Error(`No runtime abstraction layer installed`);return t}(function(e){function n(e){if(e===void 0)throw Error(`No runtime abstraction layer provided`);t=e}e.install=n})(n||={}),e.default=n})),qa=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Emitter=e.Event=void 0;var t=Ka(),n;(function(e){let t={dispose(){}};e.None=function(){return t}})(n||(e.Event=n={}));var r=class{add(e,t=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let n=!1;for(let r=0,i=this._callbacks.length;r<i;r++)if(this._callbacks[r]===e){if(this._contexts[r]===t){this._callbacks.splice(r,1),this._contexts.splice(r,1);return}n=!0}if(n)throw Error(`When adding a listener with a context, you should remove it with the same context`)}invoke(...e){if(!this._callbacks)return[];let n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let a=0,o=r.length;a<o;a++)try{n.push(r[a].apply(i[a],e))}catch(e){(0,t.default)().console.error(e)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},i=class e{constructor(e){this._options=e}get event(){return this._event||=(t,n,i)=>{this._callbacks||=new r,this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(t,n);let a={dispose:()=>{this._callbacks&&(this._callbacks.remove(t,n),a.dispose=e._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(i)&&i.push(a),a},this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&=(this._callbacks.dispose(),void 0)}};e.Emitter=i,i._noop=function(){}})),Ja=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CancellationTokenSource=e.CancellationToken=void 0;var t=Ka(),n=Ha(),r=qa(),i;(function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:r.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:r.Event.None});function t(t){let r=t;return r&&(r===e.None||r===e.Cancelled||n.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}e.is=t})(i||(e.CancellationToken=i={}));var a=Object.freeze(function(e,n){let r=(0,t.default)().timer.setTimeout(e.bind(n),0);return{dispose(){r.dispose()}}}),o=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?a:(this._emitter||=new r.Emitter,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),void 0)}};e.CancellationTokenSource=class{get token(){return this._token||=new o,this._token}cancel(){this._token?this._token.cancel():this._token=i.Cancelled}dispose(){this._token?this._token instanceof o&&this._token.dispose():this._token=i.None}}})),Ya=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=void 0;var t=Ja(),n;(function(e){e.Continue=0,e.Cancelled=1})(n||={}),e.SharedArraySenderStrategy=class{constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let t=new SharedArrayBuffer(4),r=new Int32Array(t,0,1);r[0]=n.Continue,this.buffers.set(e.id,t),e.$cancellationData=t}async sendCancellation(e,t){let r=this.buffers.get(t);if(r===void 0)return;let i=new Int32Array(r,0,1);Atomics.store(i,0,n.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};var r=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===n.Cancelled}get onCancellationRequested(){throw Error(`Cancellation over SharedArrayBuffer doesn't support cancellation events`)}},i=class{constructor(e){this.token=new r(e)}cancel(){}dispose(){}};e.SharedArrayReceiverStrategy=class{constructor(){this.kind=`request`}createCancellationTokenSource(e){let n=e.$cancellationData;return n===void 0?new t.CancellationTokenSource:new i(n)}}})),Xa=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Semaphore=void 0;var t=Ka();e.Semaphore=class{constructor(e=1){if(e<=0)throw Error(`Capacity must be greater than 0`);this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length!==0&&this._active!==this._capacity&&(0,t.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw Error(`To many thunks active`);try{let t=e.thunk();t instanceof Promise?t.then(t=>{this._active--,e.resolve(t),this.runNext()},t=>{this._active--,e.reject(t),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}}})),Za=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=void 0;var t=Ka(),n=Ha(),r=qa(),i=Xa(),a;(function(e){function t(e){let t=e;return t&&n.func(t.listen)&&n.func(t.dispose)&&n.func(t.onError)&&n.func(t.onClose)&&n.func(t.onPartialMessage)}e.is=t})(a||(e.MessageReader=a={}));var o=class{constructor(){this.errorEmitter=new r.Emitter,this.closeEmitter=new r.Emitter,this.partialMessageEmitter=new r.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:Error(`Reader received error. Reason: ${n.string(e.message)?e.message:`unknown`}`)}};e.AbstractMessageReader=o;var s;(function(e){function n(e){let n,r,i=new Map,a,o=new Map;if(e===void 0||typeof e==`string`)n=e??`utf-8`;else{if(n=e.charset??`utf-8`,e.contentDecoder!==void 0&&(r=e.contentDecoder,i.set(r.name,r)),e.contentDecoders!==void 0)for(let t of e.contentDecoders)i.set(t.name,t);if(e.contentTypeDecoder!==void 0&&(a=e.contentTypeDecoder,o.set(a.name,a)),e.contentTypeDecoders!==void 0)for(let t of e.contentTypeDecoders)o.set(t.name,t)}return a===void 0&&(a=(0,t.default)().applicationJson.decoder,o.set(a.name,a)),{charset:n,contentDecoder:r,contentDecoders:i,contentTypeDecoder:a,contentTypeDecoders:o}}e.fromOptions=n})(s||={}),e.ReadableStreamMessageReader=class extends o{constructor(e,n){super(),this.readable=e,this.options=s.fromOptions(n),this.buffer=(0,t.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new i.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;let t=this.readable.onData(e=>{this.onData(e)});return this.readable.onError(e=>this.fireError(e)),this.readable.onClose(()=>this.fireClose()),t}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let e=this.buffer.tryReadHeaders(!0);if(!e)return;let t=e.get(`content-length`);if(!t){this.fireError(Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(e))}`));return}let n=parseInt(t);if(isNaN(n)){this.fireError(Error(`Content-Length value must be a number. Got ${t}`));return}this.nextMessageLength=n}let e=this.buffer.tryReadBody(this.nextMessageLength);if(e===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let t=this.options.contentDecoder===void 0?e:await this.options.contentDecoder.decode(e),n=await this.options.contentTypeDecoder.decode(t,this.options);this.callback(n)}).catch(e=>{this.fireError(e)})}}catch(e){this.fireError(e)}}clearPartialMessageTimer(){this.partialMessageTimer&&=(this.partialMessageTimer.dispose(),void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}})),Qa=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=void 0;var t=Ka(),n=Ha(),r=Xa(),i=qa(),a=`Content-Length: `,o=`\r
|
|
13
|
-
`,s;(function(e){function t(e){let t=e;return t&&n.func(t.dispose)&&n.func(t.onClose)&&n.func(t.onError)&&n.func(t.write)}e.is=t})(s||(e.MessageWriter=s={}));var c=class{constructor(){this.errorEmitter=new i.Emitter,this.closeEmitter=new i.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,t,n){this.errorEmitter.fire([this.asError(e),t,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:Error(`Writer received error. Reason: ${n.string(e.message)?e.message:`unknown`}`)}};e.AbstractMessageWriter=c;var l;(function(e){function n(e){return e===void 0||typeof e==`string`?{charset:e??`utf-8`,contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:e.charset??`utf-8`,contentEncoder:e.contentEncoder,contentTypeEncoder:e.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}e.fromOptions=n})(l||={}),e.WriteableStreamMessageWriter=class extends c{constructor(e,t){super(),this.writable=e,this.options=l.fromOptions(t),this.errorCount=0,this.writeSemaphore=new r.Semaphore(1),this.writable.onError(e=>this.fireError(e)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(e=>this.options.contentEncoder===void 0?e:this.options.contentEncoder.encode(e)).then(t=>{let n=[];return n.push(a,t.byteLength.toString(),o),n.push(o),this.doWrite(e,n,t)},e=>{throw this.fireError(e),e}))}async doWrite(e,t,n){try{return await this.writable.write(t.join(``),`ascii`),this.writable.write(n)}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}}})),$a=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractMessageBuffer=void 0;var t=13,n=10,r=`\r
|
|
14
|
-
`;e.AbstractMessageBuffer=class{constructor(e=`utf-8`){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let t=typeof e==`string`?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let i=0,a=0,o=0,s=0;row:for(;a<this._chunks.length;){let e=this._chunks[a];o=0;column:for(;o<e.length;){switch(e[o]){case t:switch(i){case 0:i=1;break;case 2:i=3;break;default:i=0}break;case n:switch(i){case 1:i=2;break;case 3:i=4,o++;break row;default:i=0}break;default:i=0}o++}s+=e.byteLength,a++}if(i!==4)return;let c=this._read(s+o),l=new Map,u=this.toString(c,`ascii`).split(r);if(u.length<2)return l;for(let t=0;t<u.length-2;t++){let n=u[t],r=n.indexOf(`:`);if(r===-1)throw Error(`Message header must separate key and value using ':'\n${n}`);let i=n.substr(0,r),a=n.substr(r+1).trim();l.set(e?i.toLowerCase():i,a)}return l}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(e===0)return this.emptyBuffer();if(e>this._totalLength)throw Error(`Cannot read so many bytes!`);if(this._chunks[0].byteLength===e){let t=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(t)}if(this._chunks[0].byteLength>e){let t=this._chunks[0],n=this.asNative(t,e);return this._chunks[0]=t.slice(e),this._totalLength-=e,n}let t=this.allocNative(e),n=0;for(;e>0;){let r=this._chunks[0];if(r.byteLength>e){let i=r.slice(0,e);t.set(i,n),n+=e,this._chunks[0]=r.slice(e),this._totalLength-=e,e-=e}else t.set(r,n),n+=r.byteLength,this._chunks.shift(),this._totalLength-=r.byteLength,e-=r.byteLength}return t}}})),eo=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.RequestCancellationReceiverStrategy=e.IdCancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;var t=Ka(),n=Ha(),r=Ua(),i=Wa(),a=qa(),o=Ja(),s;(function(e){e.type=new r.NotificationType(`$/cancelRequest`)})(s||={});var c;(function(e){function t(e){return typeof e==`string`||typeof e==`number`}e.is=t})(c||(e.ProgressToken=c={}));var l;(function(e){e.type=new r.NotificationType(`$/progress`)})(l||={}),e.ProgressType=class{constructor(){}};var u;(function(e){function t(e){return n.func(e)}e.is=t})(u||={}),e.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var d;(function(e){e[e.Off=0]=`Off`,e[e.Messages=1]=`Messages`,e[e.Compact=2]=`Compact`,e[e.Verbose=3]=`Verbose`})(d||(e.Trace=d={}));var f;(function(e){e.Off=`off`,e.Messages=`messages`,e.Compact=`compact`,e.Verbose=`verbose`})(f||(e.TraceValues=f={})),(function(e){function t(t){if(!n.string(t))return e.Off;switch(t=t.toLowerCase(),t){case`off`:return e.Off;case`messages`:return e.Messages;case`compact`:return e.Compact;case`verbose`:return e.Verbose;default:return e.Off}}e.fromString=t;function r(t){switch(t){case e.Off:return`off`;case e.Messages:return`messages`;case e.Compact:return`compact`;case e.Verbose:return`verbose`;default:return`off`}}e.toString=r})(d||(e.Trace=d={}));var p;(function(e){e.Text=`text`,e.JSON=`json`})(p||(e.TraceFormat=p={})),(function(e){function t(t){return n.string(t)?(t=t.toLowerCase(),t===`json`?e.JSON:e.Text):e.Text}e.fromString=t})(p||(e.TraceFormat=p={}));var m;(function(e){e.type=new r.NotificationType(`$/setTrace`)})(m||(e.SetTraceNotification=m={}));var h;(function(e){e.type=new r.NotificationType(`$/logTrace`)})(h||(e.LogTraceNotification=h={}));var g;(function(e){e[e.Closed=1]=`Closed`,e[e.Disposed=2]=`Disposed`,e[e.AlreadyListening=3]=`AlreadyListening`})(g||(e.ConnectionErrors=g={}));var _=class e extends Error{constructor(t,n){super(n),this.code=t,Object.setPrototypeOf(this,e.prototype)}};e.ConnectionError=_;var v;(function(e){function t(e){let t=e;return t&&n.func(t.cancelUndispatched)}e.is=t})(v||(e.ConnectionStrategy=v={}));var y;(function(e){function t(e){let t=e;return t&&(t.kind===void 0||t.kind===`id`)&&n.func(t.createCancellationTokenSource)&&(t.dispose===void 0||n.func(t.dispose))}e.is=t})(y||(e.IdCancellationReceiverStrategy=y={}));var b;(function(e){function t(e){let t=e;return t&&t.kind===`request`&&n.func(t.createCancellationTokenSource)&&(t.dispose===void 0||n.func(t.dispose))}e.is=t})(b||(e.RequestCancellationReceiverStrategy=b={}));var x;(function(e){e.Message=Object.freeze({createCancellationTokenSource(e){return new o.CancellationTokenSource}});function t(e){return y.is(e)||b.is(e)}e.is=t})(x||(e.CancellationReceiverStrategy=x={}));var S;(function(e){e.Message=Object.freeze({sendCancellation(e,t){return e.sendNotification(s.type,{id:t})},cleanup(e){}});function t(e){let t=e;return t&&n.func(t.sendCancellation)&&n.func(t.cleanup)}e.is=t})(S||(e.CancellationSenderStrategy=S={}));var C;(function(e){e.Message=Object.freeze({receiver:x.Message,sender:S.Message});function t(e){let t=e;return t&&x.is(t.receiver)&&S.is(t.sender)}e.is=t})(C||(e.CancellationStrategy=C={}));var w;(function(e){function t(e){let t=e;return t&&n.func(t.handleMessage)}e.is=t})(w||(e.MessageStrategy=w={}));var T;(function(e){function t(e){let t=e;return t&&(C.is(t.cancellationStrategy)||v.is(t.connectionStrategy)||w.is(t.messageStrategy))}e.is=t})(T||(e.ConnectionOptions=T={}));var E;(function(e){e[e.New=1]=`New`,e[e.Listening=2]=`Listening`,e[e.Closed=3]=`Closed`,e[e.Disposed=4]=`Disposed`})(E||={});function D(f,v,b,x){let S=b===void 0?e.NullLogger:b,T=0,D=0,O=0,k,ee=new Map,te,ne=new Map,re=new Map,A,j=new i.LinkedMap,M=new Map,ie=new Set,ae=new Map,N=d.Off,oe=p.Text,P,F=E.New,se=new a.Emitter,ce=new a.Emitter,le=new a.Emitter,ue=new a.Emitter,de=new a.Emitter,fe=x&&x.cancellationStrategy?x.cancellationStrategy:C.Message;function pe(e){if(e===null)throw Error(`Can't send requests with id null since the response can't be correlated.`);return`req-`+e.toString()}function me(e){return e===null?`res-unknown-`+(++O).toString():`res-`+e.toString()}function he(){return`not-`+(++D).toString()}function ge(e,t){r.Message.isRequest(t)?e.set(pe(t.id),t):r.Message.isResponse(t)?e.set(me(t.id),t):e.set(he(),t)}function _e(e){}function ve(){return F===E.Listening}function ye(){return F===E.Closed}function be(){return F===E.Disposed}function xe(){(F===E.New||F===E.Listening)&&(F=E.Closed,ce.fire(void 0))}function Se(e){se.fire([e,void 0,void 0])}function Ce(e){se.fire(e)}f.onClose(xe),f.onError(Se),v.onClose(xe),v.onError(Ce);function we(){A||j.size===0||(A=(0,t.default)().timer.setImmediate(()=>{A=void 0,Ee()}))}function Te(e){r.Message.isRequest(e)?Oe(e):r.Message.isNotification(e)?Ae(e):r.Message.isResponse(e)?ke(e):je(e)}function Ee(){if(j.size===0)return;let e=j.shift();try{let t=x?.messageStrategy;w.is(t)?t.handleMessage(e,Te):Te(e)}finally{we()}}let De=e=>{try{if(r.Message.isNotification(e)&&e.method===s.type.method){let t=e.params.id,n=pe(t),i=j.get(n);if(r.Message.isRequest(i)){let r=x?.connectionStrategy,a=r&&r.cancelUndispatched?r.cancelUndispatched(i,_e):void 0;if(a&&(a.error!==void 0||a.result!==void 0)){j.delete(n),ae.delete(t),a.id=i.id,Fe(a,e.method,Date.now()),v.write(a).catch(()=>S.error(`Sending response for canceled message failed.`));return}}let a=ae.get(t);if(a!==void 0){a.cancel(),Ie(e);return}ie.add(t)}ge(j,e)}finally{we()}};function Oe(e){if(be())return;function t(t,n,i){let a={jsonrpc:`2.0`,id:e.id};t instanceof r.ResponseError?a.error=t.toJson():a.result=t===void 0?null:t,Fe(a,n,i),v.write(a).catch(()=>S.error(`Sending response failed.`))}function i(t,n,r){let i={jsonrpc:`2.0`,id:e.id,error:t.toJson()};Fe(i,n,r),v.write(i).catch(()=>S.error(`Sending response failed.`))}function a(t,n,r){t===void 0&&(t=null);let i={jsonrpc:`2.0`,id:e.id,result:t};Fe(i,n,r),v.write(i).catch(()=>S.error(`Sending response failed.`))}I(e);let o=ee.get(e.method),s,c;o&&(s=o.type,c=o.handler);let l=Date.now();if(c||k){let o=e.id??String(Date.now()),u=y.is(fe.receiver)?fe.receiver.createCancellationTokenSource(o):fe.receiver.createCancellationTokenSource(e);e.id!==null&&ie.has(e.id)&&u.cancel(),e.id!==null&&ae.set(o,u);try{let d;if(c){if(e.params===void 0){if(s!==void 0&&s.numberOfParams!==0){i(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines ${s.numberOfParams} params but received none.`),e.method,l);return}d=c(u.token)}else if(Array.isArray(e.params)){if(s!==void 0&&s.parameterStructures===r.ParameterStructures.byName){i(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by name but received parameters by position`),e.method,l);return}d=c(...e.params,u.token)}else{if(s!==void 0&&s.parameterStructures===r.ParameterStructures.byPosition){i(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by position but received parameters by name`),e.method,l);return}d=c(e.params,u.token)}}else k&&(d=k(e.method,e.params,u.token));let f=d;d?f.then?f.then(n=>{ae.delete(o),t(n,e.method,l)},t=>{ae.delete(o),t instanceof r.ResponseError?i(t,e.method,l):t&&n.string(t.message)?i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${t.message}`),e.method,l):i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)}):(ae.delete(o),t(d,e.method,l)):(ae.delete(o),a(d,e.method,l))}catch(a){ae.delete(o),a instanceof r.ResponseError?t(a,e.method,l):a&&n.string(a.message)?i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${a.message}`),e.method,l):i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)}}else i(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${e.method}`),e.method,l)}function ke(e){if(!be()){if(e.id===null)e.error?S.error(`Received response message without id: Error is: \n${JSON.stringify(e.error,void 0,4)}`):S.error(`Received response message without id. No further error information provided.`);else{let t=e.id,n=M.get(t);if(L(e,n),n!==void 0){M.delete(t);try{if(e.error){let t=e.error;n.reject(new r.ResponseError(t.code,t.message,t.data))}else if(e.result!==void 0)n.resolve(e.result);else throw Error(`Should never happen.`)}catch(e){e.message?S.error(`Response handler '${n.method}' failed with message: ${e.message}`):S.error(`Response handler '${n.method}' failed unexpectedly.`)}}}}}function Ae(e){if(be())return;let t,n;if(e.method===s.type.method){let t=e.params.id;ie.delete(t),Ie(e);return}{let r=ne.get(e.method);r&&(n=r.handler,t=r.type)}if(n||te)try{if(Ie(e),n){if(e.params===void 0)t!==void 0&&t.numberOfParams!==0&&t.parameterStructures!==r.ParameterStructures.byName&&S.error(`Notification ${e.method} defines ${t.numberOfParams} params but received none.`),n();else if(Array.isArray(e.params)){let i=e.params;e.method===l.type.method&&i.length===2&&c.is(i[0])?n({token:i[0],value:i[1]}):(t!==void 0&&(t.parameterStructures===r.ParameterStructures.byName&&S.error(`Notification ${e.method} defines parameters by name but received parameters by position`),t.numberOfParams!==e.params.length&&S.error(`Notification ${e.method} defines ${t.numberOfParams} params but received ${i.length} arguments`)),n(...i))}else t!==void 0&&t.parameterStructures===r.ParameterStructures.byPosition&&S.error(`Notification ${e.method} defines parameters by position but received parameters by name`),n(e.params)}else te&&te(e.method,e.params)}catch(t){t.message?S.error(`Notification handler '${e.method}' failed with message: ${t.message}`):S.error(`Notification handler '${e.method}' failed unexpectedly.`)}else le.fire(e)}function je(e){if(!e){S.error(`Received empty message.`);return}S.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(e,null,4)}`);let t=e;if(n.string(t.id)||n.number(t.id)){let e=t.id,n=M.get(e);n&&n.reject(Error(`The received response has neither a result nor an error property.`))}}function Me(e){if(e!=null)switch(N){case d.Verbose:return JSON.stringify(e,null,4);case d.Compact:return JSON.stringify(e);default:return}}function Ne(e){if(!(N===d.Off||!P)){if(oe===p.Text){let t;(N===d.Verbose||N===d.Compact)&&e.params&&(t=`Params: ${Me(e.params)}\n\n`),P.log(`Sending request '${e.method} - (${e.id})'.`,t)}else R(`send-request`,e)}}function Pe(e){if(!(N===d.Off||!P)){if(oe===p.Text){let t;(N===d.Verbose||N===d.Compact)&&(t=e.params?`Params: ${Me(e.params)}\n\n`:`No parameters provided.
|
|
15
|
-
|
|
16
|
-
`),P.log(`Sending notification '${e.method}'.`,t)}else R(`send-notification`,e)}}function Fe(e,t,n){if(!(N===d.Off||!P)){if(oe===p.Text){let r;(N===d.Verbose||N===d.Compact)&&(e.error&&e.error.data?r=`Error data: ${Me(e.error.data)}\n\n`:e.result?r=`Result: ${Me(e.result)}\n\n`:e.error===void 0&&(r=`No result returned.
|
|
17
|
-
|
|
18
|
-
`)),P.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-n}ms`,r)}else R(`send-response`,e)}}function I(e){if(!(N===d.Off||!P)){if(oe===p.Text){let t;(N===d.Verbose||N===d.Compact)&&e.params&&(t=`Params: ${Me(e.params)}\n\n`),P.log(`Received request '${e.method} - (${e.id})'.`,t)}else R(`receive-request`,e)}}function Ie(e){if(!(N===d.Off||!P||e.method===h.type.method)){if(oe===p.Text){let t;(N===d.Verbose||N===d.Compact)&&(t=e.params?`Params: ${Me(e.params)}\n\n`:`No parameters provided.
|
|
19
|
-
|
|
20
|
-
`),P.log(`Received notification '${e.method}'.`,t)}else R(`receive-notification`,e)}}function L(e,t){if(!(N===d.Off||!P)){if(oe===p.Text){let n;if((N===d.Verbose||N===d.Compact)&&(e.error&&e.error.data?n=`Error data: ${Me(e.error.data)}\n\n`:e.result?n=`Result: ${Me(e.result)}\n\n`:e.error===void 0&&(n=`No result returned.
|
|
21
|
-
|
|
22
|
-
`)),t){let r=e.error?` Request failed: ${e.error.message} (${e.error.code}).`:``;P.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${r}`,n)}else P.log(`Received response ${e.id} without active response promise.`,n)}else R(`receive-response`,e)}}function R(e,t){if(!P||N===d.Off)return;let n={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};P.log(n)}function Le(){if(ye())throw new _(g.Closed,`Connection is closed.`);if(be())throw new _(g.Disposed,`Connection is disposed.`)}function Re(){if(ve())throw new _(g.AlreadyListening,`Connection is already listening`)}function ze(){if(!ve())throw Error(`Call listen() first.`)}function Be(e){return e===void 0?null:e}function Ve(e){if(e!==null)return e}function He(e){return e!=null&&!Array.isArray(e)&&typeof e==`object`}function Ue(e,t){switch(e){case r.ParameterStructures.auto:return He(t)?Ve(t):[Be(t)];case r.ParameterStructures.byName:if(!He(t))throw Error(`Received parameters by name but param is not an object literal.`);return Ve(t);case r.ParameterStructures.byPosition:return[Be(t)];default:throw Error(`Unknown parameter structure ${e.toString()}`)}}function We(e,t){let n,r=e.numberOfParams;switch(r){case 0:n=void 0;break;case 1:n=Ue(e.parameterStructures,t[0]);break;default:n=[];for(let e=0;e<t.length&&e<r;e++)n.push(Be(t[e]));if(t.length<r)for(let e=t.length;e<r;e++)n.push(null)}return n}let Ge={sendNotification:(e,...t)=>{Le();let i,a;if(n.string(e)){i=e;let n=t[0],o=0,s=r.ParameterStructures.auto;r.ParameterStructures.is(n)&&(o=1,s=n);let c=t.length,l=c-o;switch(l){case 0:a=void 0;break;case 1:a=Ue(s,t[o]);break;default:if(s===r.ParameterStructures.byName)throw Error(`Received ${l} parameters for 'by Name' notification parameter structure.`);a=t.slice(o,c).map(e=>Be(e))}}else{let n=t;i=e.method,a=We(e,n)}let o={jsonrpc:`2.0`,method:i,params:a};return Pe(o),v.write(o).catch(e=>{throw S.error(`Sending notification failed.`),e})},onNotification:(e,t)=>{Le();let r;return n.func(e)?te=e:t&&(n.string(e)?(r=e,ne.set(e,{type:void 0,handler:t})):(r=e.method,ne.set(e.method,{type:e,handler:t}))),{dispose:()=>{r===void 0?te=void 0:ne.delete(r)}}},onProgress:(e,t,n)=>{if(re.has(t))throw Error(`Progress handler for token ${t} already registered`);return re.set(t,n),{dispose:()=>{re.delete(t)}}},sendProgress:(e,t,n)=>Ge.sendNotification(l.type,{token:t,value:n}),onUnhandledProgress:ue.event,sendRequest:(e,...t)=>{Le(),ze();let i,a,s;if(n.string(e)){i=e;let n=t[0],c=t[t.length-1],l=0,u=r.ParameterStructures.auto;r.ParameterStructures.is(n)&&(l=1,u=n);let d=t.length;o.CancellationToken.is(c)&&(--d,s=c);let f=d-l;switch(f){case 0:a=void 0;break;case 1:a=Ue(u,t[l]);break;default:if(u===r.ParameterStructures.byName)throw Error(`Received ${f} parameters for 'by Name' request parameter structure.`);a=t.slice(l,d).map(e=>Be(e))}}else{let n=t;i=e.method,a=We(e,n);let r=e.numberOfParams;s=o.CancellationToken.is(n[r])?n[r]:void 0}let c=T++,l;s&&(l=s.onCancellationRequested(()=>{let e=fe.sender.sendCancellation(Ge,c);return e===void 0?(S.log(`Received no promise from cancellation strategy when cancelling id ${c}`),Promise.resolve()):e.catch(()=>{S.log(`Sending cancellation messages for id ${c} failed`)})}));let u={jsonrpc:`2.0`,id:c,method:i,params:a};return Ne(u),typeof fe.sender.enableCancellation==`function`&&fe.sender.enableCancellation(u),new Promise(async(e,t)=>{let n={method:i,timerStart:Date.now(),resolve:t=>{e(t),fe.sender.cleanup(c),l?.dispose()},reject:e=>{t(e),fe.sender.cleanup(c),l?.dispose()}};try{await v.write(u),M.set(c,n)}catch(e){throw S.error(`Sending request failed.`),n.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,e.message?e.message:`Unknown reason`)),e}})},onRequest:(e,t)=>{Le();let r=null;return u.is(e)?(r=void 0,k=e):n.string(e)?(r=null,t!==void 0&&(r=e,ee.set(e,{handler:t,type:void 0}))):t!==void 0&&(r=e.method,ee.set(e.method,{type:e,handler:t})),{dispose:()=>{r!==null&&(r===void 0?k=void 0:ee.delete(r))}}},hasPendingResponse:()=>M.size>0,trace:async(e,t,r)=>{let i=!1,a=p.Text;r!==void 0&&(n.boolean(r)?i=r:(i=r.sendNotification||!1,a=r.traceFormat||p.Text)),N=e,oe=a,P=N===d.Off?void 0:t,i&&!ye()&&!be()&&await Ge.sendNotification(m.type,{value:d.toString(e)})},onError:se.event,onClose:ce.event,onUnhandledNotification:le.event,onDispose:de.event,end:()=>{v.end()},dispose:()=>{if(be())return;F=E.Disposed,de.fire(void 0);let e=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,`Pending response rejected since connection got disposed`);for(let t of M.values())t.reject(e);M=new Map,ae=new Map,ie=new Set,j=new i.LinkedMap,n.func(v.dispose)&&v.dispose(),n.func(f.dispose)&&f.dispose()},listen:()=>{Le(),Re(),F=E.Listening,f.listen(De)},inspect:()=>{(0,t.default)().console.log(`inspect`)}};return Ge.onNotification(h.type,e=>{if(N===d.Off||!P)return;let t=N===d.Verbose||N===d.Compact;P.log(e.message,t?e.verbose:void 0)}),Ge.onNotification(l.type,e=>{let t=re.get(e.token);t?t(e.value):ue.fire(e)}),Ge}e.createMessageConnection=D})),to=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ProgressType=e.ProgressToken=e.createMessageConnection=e.NullLogger=e.ConnectionOptions=e.ConnectionStrategy=e.AbstractMessageBuffer=e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=e.CancellationToken=e.CancellationTokenSource=e.Emitter=e.Event=e.Disposable=e.LRUCache=e.Touch=e.LinkedMap=e.ParameterStructures=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.ErrorCodes=e.ResponseError=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType0=e.RequestType=e.Message=e.RAL=void 0,e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=void 0;var t=Ua();Object.defineProperty(e,"Message",{enumerable:!0,get:function(){return t.Message}}),Object.defineProperty(e,"RequestType",{enumerable:!0,get:function(){return t.RequestType}}),Object.defineProperty(e,"RequestType0",{enumerable:!0,get:function(){return t.RequestType0}}),Object.defineProperty(e,"RequestType1",{enumerable:!0,get:function(){return t.RequestType1}}),Object.defineProperty(e,"RequestType2",{enumerable:!0,get:function(){return t.RequestType2}}),Object.defineProperty(e,"RequestType3",{enumerable:!0,get:function(){return t.RequestType3}}),Object.defineProperty(e,"RequestType4",{enumerable:!0,get:function(){return t.RequestType4}}),Object.defineProperty(e,"RequestType5",{enumerable:!0,get:function(){return t.RequestType5}}),Object.defineProperty(e,"RequestType6",{enumerable:!0,get:function(){return t.RequestType6}}),Object.defineProperty(e,"RequestType7",{enumerable:!0,get:function(){return t.RequestType7}}),Object.defineProperty(e,"RequestType8",{enumerable:!0,get:function(){return t.RequestType8}}),Object.defineProperty(e,"RequestType9",{enumerable:!0,get:function(){return t.RequestType9}}),Object.defineProperty(e,"ResponseError",{enumerable:!0,get:function(){return t.ResponseError}}),Object.defineProperty(e,"ErrorCodes",{enumerable:!0,get:function(){return t.ErrorCodes}}),Object.defineProperty(e,"NotificationType",{enumerable:!0,get:function(){return t.NotificationType}}),Object.defineProperty(e,"NotificationType0",{enumerable:!0,get:function(){return t.NotificationType0}}),Object.defineProperty(e,"NotificationType1",{enumerable:!0,get:function(){return t.NotificationType1}}),Object.defineProperty(e,"NotificationType2",{enumerable:!0,get:function(){return t.NotificationType2}}),Object.defineProperty(e,"NotificationType3",{enumerable:!0,get:function(){return t.NotificationType3}}),Object.defineProperty(e,"NotificationType4",{enumerable:!0,get:function(){return t.NotificationType4}}),Object.defineProperty(e,"NotificationType5",{enumerable:!0,get:function(){return t.NotificationType5}}),Object.defineProperty(e,"NotificationType6",{enumerable:!0,get:function(){return t.NotificationType6}}),Object.defineProperty(e,"NotificationType7",{enumerable:!0,get:function(){return t.NotificationType7}}),Object.defineProperty(e,"NotificationType8",{enumerable:!0,get:function(){return t.NotificationType8}}),Object.defineProperty(e,"NotificationType9",{enumerable:!0,get:function(){return t.NotificationType9}}),Object.defineProperty(e,"ParameterStructures",{enumerable:!0,get:function(){return t.ParameterStructures}});var n=Wa();Object.defineProperty(e,"LinkedMap",{enumerable:!0,get:function(){return n.LinkedMap}}),Object.defineProperty(e,"LRUCache",{enumerable:!0,get:function(){return n.LRUCache}}),Object.defineProperty(e,"Touch",{enumerable:!0,get:function(){return n.Touch}});var r=Ga();Object.defineProperty(e,"Disposable",{enumerable:!0,get:function(){return r.Disposable}});var i=qa();Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return i.Event}}),Object.defineProperty(e,"Emitter",{enumerable:!0,get:function(){return i.Emitter}});var a=Ja();Object.defineProperty(e,"CancellationTokenSource",{enumerable:!0,get:function(){return a.CancellationTokenSource}}),Object.defineProperty(e,"CancellationToken",{enumerable:!0,get:function(){return a.CancellationToken}});var o=Ya();Object.defineProperty(e,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return o.SharedArraySenderStrategy}}),Object.defineProperty(e,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return o.SharedArrayReceiverStrategy}});var s=Za();Object.defineProperty(e,"MessageReader",{enumerable:!0,get:function(){return s.MessageReader}}),Object.defineProperty(e,"AbstractMessageReader",{enumerable:!0,get:function(){return s.AbstractMessageReader}}),Object.defineProperty(e,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return s.ReadableStreamMessageReader}});var c=Qa();Object.defineProperty(e,"MessageWriter",{enumerable:!0,get:function(){return c.MessageWriter}}),Object.defineProperty(e,"AbstractMessageWriter",{enumerable:!0,get:function(){return c.AbstractMessageWriter}}),Object.defineProperty(e,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return c.WriteableStreamMessageWriter}});var l=$a();Object.defineProperty(e,"AbstractMessageBuffer",{enumerable:!0,get:function(){return l.AbstractMessageBuffer}});var u=eo();Object.defineProperty(e,"ConnectionStrategy",{enumerable:!0,get:function(){return u.ConnectionStrategy}}),Object.defineProperty(e,"ConnectionOptions",{enumerable:!0,get:function(){return u.ConnectionOptions}}),Object.defineProperty(e,"NullLogger",{enumerable:!0,get:function(){return u.NullLogger}}),Object.defineProperty(e,"createMessageConnection",{enumerable:!0,get:function(){return u.createMessageConnection}}),Object.defineProperty(e,"ProgressToken",{enumerable:!0,get:function(){return u.ProgressToken}}),Object.defineProperty(e,"ProgressType",{enumerable:!0,get:function(){return u.ProgressType}}),Object.defineProperty(e,"Trace",{enumerable:!0,get:function(){return u.Trace}}),Object.defineProperty(e,"TraceValues",{enumerable:!0,get:function(){return u.TraceValues}}),Object.defineProperty(e,"TraceFormat",{enumerable:!0,get:function(){return u.TraceFormat}}),Object.defineProperty(e,"SetTraceNotification",{enumerable:!0,get:function(){return u.SetTraceNotification}}),Object.defineProperty(e,"LogTraceNotification",{enumerable:!0,get:function(){return u.LogTraceNotification}}),Object.defineProperty(e,"ConnectionErrors",{enumerable:!0,get:function(){return u.ConnectionErrors}}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:function(){return u.ConnectionError}}),Object.defineProperty(e,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return u.CancellationReceiverStrategy}}),Object.defineProperty(e,"CancellationSenderStrategy",{enumerable:!0,get:function(){return u.CancellationSenderStrategy}}),Object.defineProperty(e,"CancellationStrategy",{enumerable:!0,get:function(){return u.CancellationStrategy}}),Object.defineProperty(e,"MessageStrategy",{enumerable:!0,get:function(){return u.MessageStrategy}}),e.RAL=Ka().default})),no=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=to(),n=class e extends t.AbstractMessageBuffer{constructor(e=`utf-8`){super(e),this.asciiDecoder=new TextDecoder(`ascii`)}emptyBuffer(){return e.emptyBuffer}fromString(e,t){return new TextEncoder().encode(e)}toString(e,t){return t===`ascii`?this.asciiDecoder.decode(e):new TextDecoder(t).decode(e)}asNative(e,t){return t===void 0?e:e.slice(0,t)}allocNative(e){return new Uint8Array(e)}};n.emptyBuffer=new Uint8Array;var r=class{constructor(e){this.socket=e,this._onData=new t.Emitter,this._messageListener=e=>{e.data.arrayBuffer().then(e=>{this._onData.fire(new Uint8Array(e))},()=>{(0,t.RAL)().console.error(`Converting blob to array buffer failed.`)})},this.socket.addEventListener(`message`,this._messageListener)}onClose(e){return this.socket.addEventListener(`close`,e),t.Disposable.create(()=>this.socket.removeEventListener(`close`,e))}onError(e){return this.socket.addEventListener(`error`,e),t.Disposable.create(()=>this.socket.removeEventListener(`error`,e))}onEnd(e){return this.socket.addEventListener(`end`,e),t.Disposable.create(()=>this.socket.removeEventListener(`end`,e))}onData(e){return this._onData.event(e)}},i=class{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener(`close`,e),t.Disposable.create(()=>this.socket.removeEventListener(`close`,e))}onError(e){return this.socket.addEventListener(`error`,e),t.Disposable.create(()=>this.socket.removeEventListener(`error`,e))}onEnd(e){return this.socket.addEventListener(`end`,e),t.Disposable.create(()=>this.socket.removeEventListener(`end`,e))}write(e,t){if(typeof e==`string`){if(t!==void 0&&t!==`utf-8`)throw Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}},a=new TextEncoder,o=Object.freeze({messageBuffer:Object.freeze({create:e=>new n(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:`application/json`,encode:(e,t)=>{if(t.charset!==`utf-8`)throw Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t.charset}`);return Promise.resolve(a.encode(JSON.stringify(e,void 0,0)))}}),decoder:Object.freeze({name:`application/json`,decode:(e,t)=>{if(!(e instanceof Uint8Array))throw Error(`In a Browser environments only Uint8Arrays are supported.`);return Promise.resolve(JSON.parse(new TextDecoder(t.charset).decode(e)))}})}),stream:Object.freeze({asReadableStream:e=>new r(e),asWritableStream:e=>new i(e)}),console,timer:Object.freeze({setTimeout(e,t,...n){let r=setTimeout(e,t,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(e,...t){let n=setTimeout(e,0,...t);return{dispose:()=>clearTimeout(n)}},setInterval(e,t,...n){let r=setInterval(e,t,...n);return{dispose:()=>clearInterval(r)}}})});function s(){return o}(function(e){function n(){t.RAL.install(o)}e.install=n})(s||={}),e.default=s})),ro=i((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.BrowserMessageWriter=e.BrowserMessageReader=void 0,no().default.install();var r=to();n(to(),e),e.BrowserMessageReader=class extends r.AbstractMessageReader{constructor(e){super(),this._onData=new r.Emitter,this._messageListener=e=>{this._onData.fire(e.data)},e.addEventListener(`error`,e=>this.fireError(e)),e.onmessage=this._messageListener}listen(e){return this._onData.event(e)}},e.BrowserMessageWriter=class extends r.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.addEventListener(`error`,e=>this.fireError(e))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}};function i(e,t,n,i){return n===void 0&&(n=r.NullLogger),r.ConnectionStrategy.is(i)&&(i={connectionStrategy:i}),(0,r.createMessageConnection)(e,t,n,i)}e.createMessageConnection=i})),io=i(((e,t)=>{t.exports=ro()})),ao=r({AnnotatedTextEdit:()=>Do,ChangeAnnotation:()=>Eo,ChangeAnnotationIdentifier:()=>q,CodeAction:()=>us,CodeActionContext:()=>ls,CodeActionKind:()=>ss,CodeActionTriggerKind:()=>cs,CodeDescription:()=>So,CodeLens:()=>ds,Color:()=>mo,ColorInformation:()=>ho,ColorPresentation:()=>go,Command:()=>wo,CompletionItem:()=>Jo,CompletionItemKind:()=>Ho,CompletionItemLabelDetails:()=>qo,CompletionItemTag:()=>Wo,CompletionList:()=>Yo,CreateFile:()=>ko,DeleteFile:()=>jo,Diagnostic:()=>Co,DiagnosticRelatedInformation:()=>yo,DiagnosticSeverity:()=>bo,DiagnosticTag:()=>xo,DocumentHighlight:()=>ts,DocumentHighlightKind:()=>es,DocumentLink:()=>ps,DocumentSymbol:()=>os,DocumentUri:()=>oo,EOL:()=>Ms,FoldingRange:()=>vo,FoldingRangeKind:()=>_o,FormattingOptions:()=>fs,Hover:()=>Zo,InlayHint:()=>ws,InlayHintKind:()=>Ss,InlayHintLabelPart:()=>Cs,InlineCompletionContext:()=>As,InlineCompletionItem:()=>Es,InlineCompletionList:()=>Ds,InlineCompletionTriggerKind:()=>Os,InlineValueContext:()=>xs,InlineValueEvaluatableExpression:()=>bs,InlineValueText:()=>vs,InlineValueVariableLookup:()=>ys,InsertReplaceEdit:()=>Go,InsertTextFormat:()=>Uo,InsertTextMode:()=>Ko,Location:()=>fo,LocationLink:()=>po,MarkedString:()=>Xo,MarkupContent:()=>Vo,MarkupKind:()=>Bo,OptionalVersionedTextDocumentIdentifier:()=>Ro,ParameterInformation:()=>Qo,Position:()=>lo,Range:()=>uo,RenameFile:()=>Ao,SelectedCompletionInfo:()=>ks,SelectionRange:()=>ms,SemanticTokenModifiers:()=>gs,SemanticTokenTypes:()=>hs,SemanticTokens:()=>_s,SignatureInformation:()=>$o,StringValue:()=>Ts,SymbolInformation:()=>is,SymbolKind:()=>ns,SymbolTag:()=>rs,TextDocument:()=>Ns,TextDocumentEdit:()=>Oo,TextDocumentIdentifier:()=>Io,TextDocumentItem:()=>zo,TextEdit:()=>To,URI:()=>K,VersionedTextDocumentIdentifier:()=>Lo,WorkspaceChange:()=>Fo,WorkspaceEdit:()=>Mo,WorkspaceFolder:()=>js,WorkspaceSymbol:()=>as,integer:()=>so,uinteger:()=>co}),oo,K,so,co,lo,uo,fo,po,mo,ho,go,_o,vo,yo,bo,xo,So,Co,wo,To,Eo,q,Do,Oo,ko,Ao,jo,Mo,No,Po,Fo,Io,Lo,Ro,zo,Bo,Vo,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs,gs,_s,vs,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds,Os,ks,As,js,Ms,Ns,Ps,J,Fs=n((()=>{(function(e){function t(e){return typeof e==`string`}e.is=t})(oo||={}),(function(e){function t(e){return typeof e==`string`}e.is=t})(K||={}),(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(t){return typeof t==`number`&&e.MIN_VALUE<=t&&t<=e.MAX_VALUE}e.is=t})(so||={}),(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(t){return typeof t==`number`&&e.MIN_VALUE<=t&&t<=e.MAX_VALUE}e.is=t})(co||={}),(function(e){function t(e,t){return e===Number.MAX_VALUE&&(e=co.MAX_VALUE),t===Number.MAX_VALUE&&(t=co.MAX_VALUE),{line:e,character:t}}e.create=t;function n(e){let t=e;return J.objectLiteral(t)&&J.uinteger(t.line)&&J.uinteger(t.character)}e.is=n})(lo||={}),(function(e){function t(e,t,n,r){if(J.uinteger(e)&&J.uinteger(t)&&J.uinteger(n)&&J.uinteger(r))return{start:lo.create(e,t),end:lo.create(n,r)};if(lo.is(e)&&lo.is(t))return{start:e,end:t};throw Error(`Range#create called with invalid arguments[${e}, ${t}, ${n}, ${r}]`)}e.create=t;function n(e){let t=e;return J.objectLiteral(t)&&lo.is(t.start)&&lo.is(t.end)}e.is=n})(uo||={}),(function(e){function t(e,t){return{uri:e,range:t}}e.create=t;function n(e){let t=e;return J.objectLiteral(t)&&uo.is(t.range)&&(J.string(t.uri)||J.undefined(t.uri))}e.is=n})(fo||={}),(function(e){function t(e,t,n,r){return{targetUri:e,targetRange:t,targetSelectionRange:n,originSelectionRange:r}}e.create=t;function n(e){let t=e;return J.objectLiteral(t)&&uo.is(t.targetRange)&&J.string(t.targetUri)&&uo.is(t.targetSelectionRange)&&(uo.is(t.originSelectionRange)||J.undefined(t.originSelectionRange))}e.is=n})(po||={}),(function(e){function t(e,t,n,r){return{red:e,green:t,blue:n,alpha:r}}e.create=t;function n(e){let t=e;return J.objectLiteral(t)&&J.numberRange(t.red,0,1)&&J.numberRange(t.green,0,1)&&J.numberRange(t.blue,0,1)&&J.numberRange(t.alpha,0,1)}e.is=n})(mo||={}),(function(e){function t(e,t){return{range:e,color:t}}e.create=t;function n(e){let t=e;return J.objectLiteral(t)&&uo.is(t.range)&&mo.is(t.color)}e.is=n})(ho||={}),(function(e){function t(e,t,n){return{label:e,textEdit:t,additionalTextEdits:n}}e.create=t;function n(e){let t=e;return J.objectLiteral(t)&&J.string(t.label)&&(J.undefined(t.textEdit)||To.is(t))&&(J.undefined(t.additionalTextEdits)||J.typedArray(t.additionalTextEdits,To.is))}e.is=n})(go||={}),(function(e){e.Comment=`comment`,e.Imports=`imports`,e.Region=`region`})(_o||={}),(function(e){function t(e,t,n,r,i,a){let o={startLine:e,endLine:t};return J.defined(n)&&(o.startCharacter=n),J.defined(r)&&(o.endCharacter=r),J.defined(i)&&(o.kind=i),J.defined(a)&&(o.collapsedText=a),o}e.create=t;function n(e){let t=e;return J.objectLiteral(t)&&J.uinteger(t.startLine)&&J.uinteger(t.startLine)&&(J.undefined(t.startCharacter)||J.uinteger(t.startCharacter))&&(J.undefined(t.endCharacter)||J.uinteger(t.endCharacter))&&(J.undefined(t.kind)||J.string(t.kind))}e.is=n})(vo||={}),(function(e){function t(e,t){return{location:e,message:t}}e.create=t;function n(e){let t=e;return J.defined(t)&&fo.is(t.location)&&J.string(t.message)}e.is=n})(yo||={}),(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(bo||={}),(function(e){e.Unnecessary=1,e.Deprecated=2})(xo||={}),(function(e){function t(e){let t=e;return J.objectLiteral(t)&&J.string(t.href)}e.is=t})(So||={}),(function(e){function t(e,t,n,r,i,a){let o={range:e,message:t};return J.defined(n)&&(o.severity=n),J.defined(r)&&(o.code=r),J.defined(i)&&(o.source=i),J.defined(a)&&(o.relatedInformation=a),o}e.create=t;function n(e){let t=e;return J.defined(t)&&uo.is(t.range)&&J.string(t.message)&&(J.number(t.severity)||J.undefined(t.severity))&&(J.integer(t.code)||J.string(t.code)||J.undefined(t.code))&&(J.undefined(t.codeDescription)||J.string(t.codeDescription?.href))&&(J.string(t.source)||J.undefined(t.source))&&(J.undefined(t.relatedInformation)||J.typedArray(t.relatedInformation,yo.is))}e.is=n})(Co||={}),(function(e){function t(e,t,...n){let r={title:e,command:t};return J.defined(n)&&n.length>0&&(r.arguments=n),r}e.create=t;function n(e){let t=e;return J.defined(t)&&J.string(t.title)&&J.string(t.command)}e.is=n})(wo||={}),(function(e){function t(e,t){return{range:e,newText:t}}e.replace=t;function n(e,t){return{range:{start:e,end:e},newText:t}}e.insert=n;function r(e){return{range:e,newText:``}}e.del=r;function i(e){let t=e;return J.objectLiteral(t)&&J.string(t.newText)&&uo.is(t.range)}e.is=i})(To||={}),(function(e){function t(e,t,n){let r={label:e};return t!==void 0&&(r.needsConfirmation=t),n!==void 0&&(r.description=n),r}e.create=t;function n(e){let t=e;return J.objectLiteral(t)&&J.string(t.label)&&(J.boolean(t.needsConfirmation)||t.needsConfirmation===void 0)&&(J.string(t.description)||t.description===void 0)}e.is=n})(Eo||={}),(function(e){function t(e){let t=e;return J.string(t)}e.is=t})(q||={}),(function(e){function t(e,t,n){return{range:e,newText:t,annotationId:n}}e.replace=t;function n(e,t,n){return{range:{start:e,end:e},newText:t,annotationId:n}}e.insert=n;function r(e,t){return{range:e,newText:``,annotationId:t}}e.del=r;function i(e){let t=e;return To.is(t)&&(Eo.is(t.annotationId)||q.is(t.annotationId))}e.is=i})(Do||={}),(function(e){function t(e,t){return{textDocument:e,edits:t}}e.create=t;function n(e){let t=e;return J.defined(t)&&Ro.is(t.textDocument)&&Array.isArray(t.edits)}e.is=n})(Oo||={}),(function(e){function t(e,t,n){let r={kind:`create`,uri:e};return t!==void 0&&(t.overwrite!==void 0||t.ignoreIfExists!==void 0)&&(r.options=t),n!==void 0&&(r.annotationId=n),r}e.create=t;function n(e){let t=e;return t&&t.kind===`create`&&J.string(t.uri)&&(t.options===void 0||(t.options.overwrite===void 0||J.boolean(t.options.overwrite))&&(t.options.ignoreIfExists===void 0||J.boolean(t.options.ignoreIfExists)))&&(t.annotationId===void 0||q.is(t.annotationId))}e.is=n})(ko||={}),(function(e){function t(e,t,n,r){let i={kind:`rename`,oldUri:e,newUri:t};return n!==void 0&&(n.overwrite!==void 0||n.ignoreIfExists!==void 0)&&(i.options=n),r!==void 0&&(i.annotationId=r),i}e.create=t;function n(e){let t=e;return t&&t.kind===`rename`&&J.string(t.oldUri)&&J.string(t.newUri)&&(t.options===void 0||(t.options.overwrite===void 0||J.boolean(t.options.overwrite))&&(t.options.ignoreIfExists===void 0||J.boolean(t.options.ignoreIfExists)))&&(t.annotationId===void 0||q.is(t.annotationId))}e.is=n})(Ao||={}),(function(e){function t(e,t,n){let r={kind:`delete`,uri:e};return t!==void 0&&(t.recursive!==void 0||t.ignoreIfNotExists!==void 0)&&(r.options=t),n!==void 0&&(r.annotationId=n),r}e.create=t;function n(e){let t=e;return t&&t.kind===`delete`&&J.string(t.uri)&&(t.options===void 0||(t.options.recursive===void 0||J.boolean(t.options.recursive))&&(t.options.ignoreIfNotExists===void 0||J.boolean(t.options.ignoreIfNotExists)))&&(t.annotationId===void 0||q.is(t.annotationId))}e.is=n})(jo||={}),(function(e){function t(e){let t=e;return t&&(t.changes!==void 0||t.documentChanges!==void 0)&&(t.documentChanges===void 0||t.documentChanges.every(e=>J.string(e.kind)?ko.is(e)||Ao.is(e)||jo.is(e):Oo.is(e)))}e.is=t})(Mo||={}),No=class{constructor(e,t){this.edits=e,this.changeAnnotations=t}insert(e,t,n){let r,i;if(n===void 0?r=To.insert(e,t):q.is(n)?(i=n,r=Do.insert(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),r=Do.insert(e,t,i)),this.edits.push(r),i!==void 0)return i}replace(e,t,n){let r,i;if(n===void 0?r=To.replace(e,t):q.is(n)?(i=n,r=Do.replace(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),r=Do.replace(e,t,i)),this.edits.push(r),i!==void 0)return i}delete(e,t){let n,r;if(t===void 0?n=To.del(e):q.is(t)?(r=t,n=Do.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),r=this.changeAnnotations.manage(t),n=Do.del(e,r)),this.edits.push(n),r!==void 0)return r}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw Error(`Text edit change is not configured to manage change annotations.`)}},Po=class{constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,t){let n;if(q.is(e)?n=e:(n=this.nextId(),t=e),this._annotations[n]!==void 0)throw Error(`Id ${n} is already in use.`);if(t===void 0)throw Error(`No annotation provided for id ${n}`);return this._annotations[n]=t,this._size++,n}nextId(){return this._counter++,this._counter.toString()}},Fo=class{constructor(e){this._textEditChanges=Object.create(null),e===void 0?this._workspaceEdit={}:(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new Po(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(e=>{if(Oo.is(e)){let t=new No(e.edits,this._changeAnnotations);this._textEditChanges[e.textDocument.uri]=t}})):e.changes&&Object.keys(e.changes).forEach(t=>{let n=new No(e.changes[t]);this._textEditChanges[t]=n}))}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(Ro.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let t={uri:e.uri,version:e.version},n=this._textEditChanges[t.uri];if(!n){let e=[],r={textDocument:t,edits:e};this._workspaceEdit.documentChanges.push(r),n=new No(e,this._changeAnnotations),this._textEditChanges[t.uri]=n}return n}{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw Error(`Workspace edit is not configured for normal text edit changes.`);let t=this._textEditChanges[e];if(!t){let n=[];this._workspaceEdit.changes[e]=n,t=new No(n),this._textEditChanges[e]=t}return t}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Po,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,t,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let r;Eo.is(t)||q.is(t)?r=t:n=t;let i,a;if(r===void 0?i=ko.create(e,n):(a=q.is(r)?r:this._changeAnnotations.manage(r),i=ko.create(e,n,a)),this._workspaceEdit.documentChanges.push(i),a!==void 0)return a}renameFile(e,t,n,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let i;Eo.is(n)||q.is(n)?i=n:r=n;let a,o;if(i===void 0?a=Ao.create(e,t,r):(o=q.is(i)?i:this._changeAnnotations.manage(i),a=Ao.create(e,t,r,o)),this._workspaceEdit.documentChanges.push(a),o!==void 0)return o}deleteFile(e,t,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let r;Eo.is(t)||q.is(t)?r=t:n=t;let i,a;if(r===void 0?i=jo.create(e,n):(a=q.is(r)?r:this._changeAnnotations.manage(r),i=jo.create(e,n,a)),this._workspaceEdit.documentChanges.push(i),a!==void 0)return a}},(function(e){function t(e){return{uri:e}}e.create=t;function n(e){let t=e;return J.defined(t)&&J.string(t.uri)}e.is=n})(Io||={}),(function(e){function t(e,t){return{uri:e,version:t}}e.create=t;function n(e){let t=e;return J.defined(t)&&J.string(t.uri)&&J.integer(t.version)}e.is=n})(Lo||={}),(function(e){function t(e,t){return{uri:e,version:t}}e.create=t;function n(e){let t=e;return J.defined(t)&&J.string(t.uri)&&(t.version===null||J.integer(t.version))}e.is=n})(Ro||={}),(function(e){function t(e,t,n,r){return{uri:e,languageId:t,version:n,text:r}}e.create=t;function n(e){let t=e;return J.defined(t)&&J.string(t.uri)&&J.string(t.languageId)&&J.integer(t.version)&&J.string(t.text)}e.is=n})(zo||={}),(function(e){e.PlainText=`plaintext`,e.Markdown=`markdown`;function t(t){let n=t;return n===e.PlainText||n===e.Markdown}e.is=t})(Bo||={}),(function(e){function t(e){let t=e;return J.objectLiteral(e)&&Bo.is(t.kind)&&J.string(t.value)}e.is=t})(Vo||={}),(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(Ho||={}),(function(e){e.PlainText=1,e.Snippet=2})(Uo||={}),(function(e){e.Deprecated=1})(Wo||={}),(function(e){function t(e,t,n){return{newText:e,insert:t,replace:n}}e.create=t;function n(e){let t=e;return t&&J.string(t.newText)&&uo.is(t.insert)&&uo.is(t.replace)}e.is=n})(Go||={}),(function(e){e.asIs=1,e.adjustIndentation=2})(Ko||={}),(function(e){function t(e){let t=e;return t&&(J.string(t.detail)||t.detail===void 0)&&(J.string(t.description)||t.description===void 0)}e.is=t})(qo||={}),(function(e){function t(e){return{label:e}}e.create=t})(Jo||={}),(function(e){function t(e,t){return{items:e||[],isIncomplete:!!t}}e.create=t})(Yo||={}),(function(e){function t(e){return e.replace(/[\\`*_{}[\]()#+\-.!]/g,`\\$&`)}e.fromPlainText=t;function n(e){let t=e;return J.string(t)||J.objectLiteral(t)&&J.string(t.language)&&J.string(t.value)}e.is=n})(Xo||={}),(function(e){function t(e){let t=e;return!!t&&J.objectLiteral(t)&&(Vo.is(t.contents)||Xo.is(t.contents)||J.typedArray(t.contents,Xo.is))&&(e.range===void 0||uo.is(e.range))}e.is=t})(Zo||={}),(function(e){function t(e,t){return t?{label:e,documentation:t}:{label:e}}e.create=t})(Qo||={}),(function(e){function t(e,t,...n){let r={label:e};return J.defined(t)&&(r.documentation=t),r.parameters=J.defined(n)?n:[],r}e.create=t})($o||={}),(function(e){e.Text=1,e.Read=2,e.Write=3})(es||={}),(function(e){function t(e,t){let n={range:e};return J.number(t)&&(n.kind=t),n}e.create=t})(ts||={}),(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(ns||={}),(function(e){e.Deprecated=1})(rs||={}),(function(e){function t(e,t,n,r,i){let a={name:e,kind:t,location:{uri:r,range:n}};return i&&(a.containerName=i),a}e.create=t})(is||={}),(function(e){function t(e,t,n,r){return r===void 0?{name:e,kind:t,location:{uri:n}}:{name:e,kind:t,location:{uri:n,range:r}}}e.create=t})(as||={}),(function(e){function t(e,t,n,r,i,a){let o={name:e,detail:t,kind:n,range:r,selectionRange:i};return a!==void 0&&(o.children=a),o}e.create=t;function n(e){let t=e;return t&&J.string(t.name)&&J.number(t.kind)&&uo.is(t.range)&&uo.is(t.selectionRange)&&(t.detail===void 0||J.string(t.detail))&&(t.deprecated===void 0||J.boolean(t.deprecated))&&(t.children===void 0||Array.isArray(t.children))&&(t.tags===void 0||Array.isArray(t.tags))}e.is=n})(os||={}),(function(e){e.Empty=``,e.QuickFix=`quickfix`,e.Refactor=`refactor`,e.RefactorExtract=`refactor.extract`,e.RefactorInline=`refactor.inline`,e.RefactorRewrite=`refactor.rewrite`,e.Source=`source`,e.SourceOrganizeImports=`source.organizeImports`,e.SourceFixAll=`source.fixAll`})(ss||={}),(function(e){e.Invoked=1,e.Automatic=2})(cs||={}),(function(e){function t(e,t,n){let r={diagnostics:e};return t!=null&&(r.only=t),n!=null&&(r.triggerKind=n),r}e.create=t;function n(e){let t=e;return J.defined(t)&&J.typedArray(t.diagnostics,Co.is)&&(t.only===void 0||J.typedArray(t.only,J.string))&&(t.triggerKind===void 0||t.triggerKind===cs.Invoked||t.triggerKind===cs.Automatic)}e.is=n})(ls||={}),(function(e){function t(e,t,n){let r={title:e},i=!0;return typeof t==`string`?(i=!1,r.kind=t):wo.is(t)?r.command=t:r.edit=t,i&&n!==void 0&&(r.kind=n),r}e.create=t;function n(e){let t=e;return t&&J.string(t.title)&&(t.diagnostics===void 0||J.typedArray(t.diagnostics,Co.is))&&(t.kind===void 0||J.string(t.kind))&&(t.edit!==void 0||t.command!==void 0)&&(t.command===void 0||wo.is(t.command))&&(t.isPreferred===void 0||J.boolean(t.isPreferred))&&(t.edit===void 0||Mo.is(t.edit))}e.is=n})(us||={}),(function(e){function t(e,t){let n={range:e};return J.defined(t)&&(n.data=t),n}e.create=t;function n(e){let t=e;return J.defined(t)&&uo.is(t.range)&&(J.undefined(t.command)||wo.is(t.command))}e.is=n})(ds||={}),(function(e){function t(e,t){return{tabSize:e,insertSpaces:t}}e.create=t;function n(e){let t=e;return J.defined(t)&&J.uinteger(t.tabSize)&&J.boolean(t.insertSpaces)}e.is=n})(fs||={}),(function(e){function t(e,t,n){return{range:e,target:t,data:n}}e.create=t;function n(e){let t=e;return J.defined(t)&&uo.is(t.range)&&(J.undefined(t.target)||J.string(t.target))}e.is=n})(ps||={}),(function(e){function t(e,t){return{range:e,parent:t}}e.create=t;function n(t){let n=t;return J.objectLiteral(n)&&uo.is(n.range)&&(n.parent===void 0||e.is(n.parent))}e.is=n})(ms||={}),(function(e){e.namespace=`namespace`,e.type=`type`,e.class=`class`,e.enum=`enum`,e.interface=`interface`,e.struct=`struct`,e.typeParameter=`typeParameter`,e.parameter=`parameter`,e.variable=`variable`,e.property=`property`,e.enumMember=`enumMember`,e.event=`event`,e.function=`function`,e.method=`method`,e.macro=`macro`,e.keyword=`keyword`,e.modifier=`modifier`,e.comment=`comment`,e.string=`string`,e.number=`number`,e.regexp=`regexp`,e.operator=`operator`,e.decorator=`decorator`})(hs||={}),(function(e){e.declaration=`declaration`,e.definition=`definition`,e.readonly=`readonly`,e.static=`static`,e.deprecated=`deprecated`,e.abstract=`abstract`,e.async=`async`,e.modification=`modification`,e.documentation=`documentation`,e.defaultLibrary=`defaultLibrary`})(gs||={}),(function(e){function t(e){let t=e;return J.objectLiteral(t)&&(t.resultId===void 0||typeof t.resultId==`string`)&&Array.isArray(t.data)&&(t.data.length===0||typeof t.data[0]==`number`)}e.is=t})(_s||={}),(function(e){function t(e,t){return{range:e,text:t}}e.create=t;function n(e){let t=e;return t!=null&&uo.is(t.range)&&J.string(t.text)}e.is=n})(vs||={}),(function(e){function t(e,t,n){return{range:e,variableName:t,caseSensitiveLookup:n}}e.create=t;function n(e){let t=e;return t!=null&&uo.is(t.range)&&J.boolean(t.caseSensitiveLookup)&&(J.string(t.variableName)||t.variableName===void 0)}e.is=n})(ys||={}),(function(e){function t(e,t){return{range:e,expression:t}}e.create=t;function n(e){let t=e;return t!=null&&uo.is(t.range)&&(J.string(t.expression)||t.expression===void 0)}e.is=n})(bs||={}),(function(e){function t(e,t){return{frameId:e,stoppedLocation:t}}e.create=t;function n(e){let t=e;return J.defined(t)&&uo.is(e.stoppedLocation)}e.is=n})(xs||={}),(function(e){e.Type=1,e.Parameter=2;function t(e){return e===1||e===2}e.is=t})(Ss||={}),(function(e){function t(e){return{value:e}}e.create=t;function n(e){let t=e;return J.objectLiteral(t)&&(t.tooltip===void 0||J.string(t.tooltip)||Vo.is(t.tooltip))&&(t.location===void 0||fo.is(t.location))&&(t.command===void 0||wo.is(t.command))}e.is=n})(Cs||={}),(function(e){function t(e,t,n){let r={position:e,label:t};return n!==void 0&&(r.kind=n),r}e.create=t;function n(e){let t=e;return J.objectLiteral(t)&&lo.is(t.position)&&(J.string(t.label)||J.typedArray(t.label,Cs.is))&&(t.kind===void 0||Ss.is(t.kind))&&t.textEdits===void 0||J.typedArray(t.textEdits,To.is)&&(t.tooltip===void 0||J.string(t.tooltip)||Vo.is(t.tooltip))&&(t.paddingLeft===void 0||J.boolean(t.paddingLeft))&&(t.paddingRight===void 0||J.boolean(t.paddingRight))}e.is=n})(ws||={}),(function(e){function t(e){return{kind:`snippet`,value:e}}e.createSnippet=t})(Ts||={}),(function(e){function t(e,t,n,r){return{insertText:e,filterText:t,range:n,command:r}}e.create=t})(Es||={}),(function(e){function t(e){return{items:e}}e.create=t})(Ds||={}),(function(e){e.Invoked=0,e.Automatic=1})(Os||={}),(function(e){function t(e,t){return{range:e,text:t}}e.create=t})(ks||={}),(function(e){function t(e,t){return{triggerKind:e,selectedCompletionInfo:t}}e.create=t})(As||={}),(function(e){function t(e){let t=e;return J.objectLiteral(t)&&K.is(t.uri)&&J.string(t.name)}e.is=t})(js||={}),Ms=[`
|
|
23
|
-
`,`\r
|
|
24
|
-
`,`\r`],(function(e){function t(e,t,n,r){return new Ps(e,t,n,r)}e.create=t;function n(e){let t=e;return!!(J.defined(t)&&J.string(t.uri)&&(J.undefined(t.languageId)||J.string(t.languageId))&&J.uinteger(t.lineCount)&&J.func(t.getText)&&J.func(t.positionAt)&&J.func(t.offsetAt))}e.is=n;function r(e,t){let n=e.getText(),r=i(t,(e,t)=>{let n=e.range.start.line-t.range.start.line;return n===0?e.range.start.character-t.range.start.character:n}),a=n.length;for(let t=r.length-1;t>=0;t--){let i=r[t],o=e.offsetAt(i.range.start),s=e.offsetAt(i.range.end);if(s<=a)n=n.substring(0,o)+i.newText+n.substring(s,n.length);else throw Error(`Overlapping edit`);a=o}return n}e.applyEdits=r;function i(e,t){if(e.length<=1)return e;let n=e.length/2|0,r=e.slice(0,n),a=e.slice(n);i(r,t),i(a,t);let o=0,s=0,c=0;for(;o<r.length&&s<a.length;)t(r[o],a[s])<=0?e[c++]=r[o++]:e[c++]=a[s++];for(;o<r.length;)e[c++]=r[o++];for(;s<a.length;)e[c++]=a[s++];return e}})(Ns||={}),Ps=class{constructor(e,t,n,r){this._uri=e,this._languageId=t,this._version=n,this._content=r,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],t=this._content,n=!0;for(let r=0;r<t.length;r++){n&&=(e.push(r),!1);let i=t.charAt(r);n=i===`\r`||i===`
|
|
25
|
-
`,i===`\r`&&r+1<t.length&&t.charAt(r+1)===`
|
|
26
|
-
`&&r++}n&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),n=0,r=t.length;if(r===0)return lo.create(0,e);for(;n<r;){let i=Math.floor((n+r)/2);t[i]>e?r=i:n=i+1}let i=n-1;return lo.create(i,e-t[i])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let n=t[e.line],r=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,r),n)}get lineCount(){return this.getLineOffsets().length}},(function(e){let t=Object.prototype.toString;function n(e){return e!==void 0}e.defined=n;function r(e){return e===void 0}e.undefined=r;function i(e){return e===!0||e===!1}e.boolean=i;function a(e){return t.call(e)===`[object String]`}e.string=a;function o(e){return t.call(e)===`[object Number]`}e.number=o;function s(e,n,r){return t.call(e)===`[object Number]`&&n<=e&&e<=r}e.numberRange=s;function c(e){return t.call(e)===`[object Number]`&&-2147483648<=e&&e<=2147483647}e.integer=c;function l(e){return t.call(e)===`[object Number]`&&0<=e&&e<=2147483647}e.uinteger=l;function u(e){return t.call(e)===`[object Function]`}e.func=u;function d(e){return typeof e==`object`&&!!e}e.objectLiteral=d;function f(e,t){return Array.isArray(e)&&e.every(t)}e.typedArray=f})(J||={})})),Is=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ProtocolNotificationType=e.ProtocolNotificationType0=e.ProtocolRequestType=e.ProtocolRequestType0=e.RegistrationType=e.MessageDirection=void 0;var t=ro(),n;(function(e){e.clientToServer=`clientToServer`,e.serverToClient=`serverToClient`,e.both=`both`})(n||(e.MessageDirection=n={})),e.RegistrationType=class{constructor(e){this.method=e}},e.ProtocolRequestType0=class extends t.RequestType0{constructor(e){super(e)}},e.ProtocolRequestType=class extends t.RequestType{constructor(e){super(e,t.ParameterStructures.byName)}},e.ProtocolNotificationType0=class extends t.NotificationType0{constructor(e){super(e)}},e.ProtocolNotificationType=class extends t.NotificationType{constructor(e){super(e,t.ParameterStructures.byName)}}})),Ls=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.objectLiteral=e.typedArray=e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(e){return e===!0||e===!1}e.boolean=t;function n(e){return typeof e==`string`||e instanceof String}e.string=n;function r(e){return typeof e==`number`||e instanceof Number}e.number=r;function i(e){return e instanceof Error}e.error=i;function a(e){return typeof e==`function`}e.func=a;function o(e){return Array.isArray(e)}e.array=o;function s(e){return o(e)&&e.every(e=>n(e))}e.stringArray=s;function c(e,t){return Array.isArray(e)&&e.every(t)}e.typedArray=c;function l(e){return typeof e==`object`&&!!e}e.objectLiteral=l})),Rs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationRequest=void 0;var t=Is(),n;(function(e){e.method=`textDocument/implementation`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.ImplementationRequest=n={}))})),zs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TypeDefinitionRequest=void 0;var t=Is(),n;(function(e){e.method=`textDocument/typeDefinition`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.TypeDefinitionRequest=n={}))})),Bs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=void 0;var t=Is(),n;(function(e){e.method=`workspace/workspaceFolders`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(n||(e.WorkspaceFoldersRequest=n={}));var r;(function(e){e.method=`workspace/didChangeWorkspaceFolders`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(r||(e.DidChangeWorkspaceFoldersNotification=r={}))})),Vs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ConfigurationRequest=void 0;var t=Is(),n;(function(e){e.method=`workspace/configuration`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(n||(e.ConfigurationRequest=n={}))})),Hs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ColorPresentationRequest=e.DocumentColorRequest=void 0;var t=Is(),n;(function(e){e.method=`textDocument/documentColor`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.DocumentColorRequest=n={}));var r;(function(e){e.method=`textDocument/colorPresentation`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.ColorPresentationRequest=r={}))})),Us=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FoldingRangeRefreshRequest=e.FoldingRangeRequest=void 0;var t=Is(),n;(function(e){e.method=`textDocument/foldingRange`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.FoldingRangeRequest=n={}));var r;(function(e){e.method=`workspace/foldingRange/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(r||(e.FoldingRangeRefreshRequest=r={}))})),Ws=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DeclarationRequest=void 0;var t=Is(),n;(function(e){e.method=`textDocument/declaration`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.DeclarationRequest=n={}))})),Gs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SelectionRangeRequest=void 0;var t=Is(),n;(function(e){e.method=`textDocument/selectionRange`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.SelectionRangeRequest=n={}))})),Ks=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=void 0;var t=ro(),n=Is(),r;(function(e){e.type=new t.ProgressType;function n(t){return t===e.type}e.is=n})(r||(e.WorkDoneProgress=r={}));var i;(function(e){e.method=`window/workDoneProgress/create`,e.messageDirection=n.MessageDirection.serverToClient,e.type=new n.ProtocolRequestType(e.method)})(i||(e.WorkDoneProgressCreateRequest=i={}));var a;(function(e){e.method=`window/workDoneProgress/cancel`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolNotificationType(e.method)})(a||(e.WorkDoneProgressCancelNotification=a={}))})),qs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.CallHierarchyPrepareRequest=void 0;var t=Is(),n;(function(e){e.method=`textDocument/prepareCallHierarchy`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.CallHierarchyPrepareRequest=n={}));var r;(function(e){e.method=`callHierarchy/incomingCalls`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.CallHierarchyIncomingCallsRequest=r={}));var i;(function(e){e.method=`callHierarchy/outgoingCalls`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(i||(e.CallHierarchyOutgoingCallsRequest=i={}))})),Js=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.SemanticTokensRegistrationType=e.TokenFormat=void 0;var t=Is(),n;(function(e){e.Relative=`relative`})(n||(e.TokenFormat=n={}));var r;(function(e){e.method=`textDocument/semanticTokens`,e.type=new t.RegistrationType(e.method)})(r||(e.SemanticTokensRegistrationType=r={}));var i;(function(e){e.method=`textDocument/semanticTokens/full`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method),e.registrationMethod=r.method})(i||(e.SemanticTokensRequest=i={}));var a;(function(e){e.method=`textDocument/semanticTokens/full/delta`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method),e.registrationMethod=r.method})(a||(e.SemanticTokensDeltaRequest=a={}));var o;(function(e){e.method=`textDocument/semanticTokens/range`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method),e.registrationMethod=r.method})(o||(e.SemanticTokensRangeRequest=o={}));var s;(function(e){e.method=`workspace/semanticTokens/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(s||(e.SemanticTokensRefreshRequest=s={}))})),Ys=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ShowDocumentRequest=void 0;var t=Is(),n;(function(e){e.method=`window/showDocument`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(n||(e.ShowDocumentRequest=n={}))})),Xs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LinkedEditingRangeRequest=void 0;var t=Is(),n;(function(e){e.method=`textDocument/linkedEditingRange`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.LinkedEditingRangeRequest=n={}))})),Zs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WillDeleteFilesRequest=e.DidDeleteFilesNotification=e.DidRenameFilesNotification=e.WillRenameFilesRequest=e.DidCreateFilesNotification=e.WillCreateFilesRequest=e.FileOperationPatternKind=void 0;var t=Is(),n;(function(e){e.file=`file`,e.folder=`folder`})(n||(e.FileOperationPatternKind=n={}));var r;(function(e){e.method=`workspace/willCreateFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.WillCreateFilesRequest=r={}));var i;(function(e){e.method=`workspace/didCreateFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(i||(e.DidCreateFilesNotification=i={}));var a;(function(e){e.method=`workspace/willRenameFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(a||(e.WillRenameFilesRequest=a={}));var o;(function(e){e.method=`workspace/didRenameFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(o||(e.DidRenameFilesNotification=o={}));var s;(function(e){e.method=`workspace/didDeleteFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(s||(e.DidDeleteFilesNotification=s={}));var c;(function(e){e.method=`workspace/willDeleteFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(c||(e.WillDeleteFilesRequest=c={}))})),Qs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=void 0;var t=Is(),n;(function(e){e.document=`document`,e.project=`project`,e.group=`group`,e.scheme=`scheme`,e.global=`global`})(n||(e.UniquenessLevel=n={}));var r;(function(e){e.$import=`import`,e.$export=`export`,e.local=`local`})(r||(e.MonikerKind=r={}));var i;(function(e){e.method=`textDocument/moniker`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(i||(e.MonikerRequest=i={}))})),$s=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TypeHierarchySubtypesRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchyPrepareRequest=void 0;var t=Is(),n;(function(e){e.method=`textDocument/prepareTypeHierarchy`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.TypeHierarchyPrepareRequest=n={}));var r;(function(e){e.method=`typeHierarchy/supertypes`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.TypeHierarchySupertypesRequest=r={}));var i;(function(e){e.method=`typeHierarchy/subtypes`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(i||(e.TypeHierarchySubtypesRequest=i={}))})),ec=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.InlineValueRefreshRequest=e.InlineValueRequest=void 0;var t=Is(),n;(function(e){e.method=`textDocument/inlineValue`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.InlineValueRequest=n={}));var r;(function(e){e.method=`workspace/inlineValue/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(r||(e.InlineValueRefreshRequest=r={}))})),tc=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=void 0;var t=Is(),n;(function(e){e.method=`textDocument/inlayHint`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.InlayHintRequest=n={}));var r;(function(e){e.method=`inlayHint/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.InlayHintResolveRequest=r={}));var i;(function(e){e.method=`workspace/inlayHint/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(i||(e.InlayHintRefreshRequest=i={}))})),nc=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=void 0;var t=ro(),n=Ls(),r=Is(),i;(function(e){function t(e){let t=e;return t&&n.boolean(t.retriggerRequest)}e.is=t})(i||(e.DiagnosticServerCancellationData=i={}));var a;(function(e){e.Full=`full`,e.Unchanged=`unchanged`})(a||(e.DocumentDiagnosticReportKind=a={}));var o;(function(e){e.method=`textDocument/diagnostic`,e.messageDirection=r.MessageDirection.clientToServer,e.type=new r.ProtocolRequestType(e.method),e.partialResult=new t.ProgressType})(o||(e.DocumentDiagnosticRequest=o={}));var s;(function(e){e.method=`workspace/diagnostic`,e.messageDirection=r.MessageDirection.clientToServer,e.type=new r.ProtocolRequestType(e.method),e.partialResult=new t.ProgressType})(s||(e.WorkspaceDiagnosticRequest=s={}));var c;(function(e){e.method=`workspace/diagnostic/refresh`,e.messageDirection=r.MessageDirection.serverToClient,e.type=new r.ProtocolRequestType0(e.method)})(c||(e.DiagnosticRefreshRequest=c={}))})),rc=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DidCloseNotebookDocumentNotification=e.DidSaveNotebookDocumentNotification=e.DidChangeNotebookDocumentNotification=e.NotebookCellArrayChange=e.DidOpenNotebookDocumentNotification=e.NotebookDocumentSyncRegistrationType=e.NotebookDocument=e.NotebookCell=e.ExecutionSummary=e.NotebookCellKind=void 0;var n=(Fs(),t(ao)),r=Ls(),i=Is(),a;(function(e){e.Markup=1,e.Code=2;function t(e){return e===1||e===2}e.is=t})(a||(e.NotebookCellKind=a={}));var o;(function(e){function t(e,t){let n={executionOrder:e};return(t===!0||t===!1)&&(n.success=t),n}e.create=t;function i(e){let t=e;return r.objectLiteral(t)&&n.uinteger.is(t.executionOrder)&&(t.success===void 0||r.boolean(t.success))}e.is=i;function a(e,t){return e===t?!0:e==null||t==null?!1:e.executionOrder===t.executionOrder&&e.success===t.success}e.equals=a})(o||(e.ExecutionSummary=o={}));var s;(function(e){function t(e,t){return{kind:e,document:t}}e.create=t;function i(e){let t=e;return r.objectLiteral(t)&&a.is(t.kind)&&n.DocumentUri.is(t.document)&&(t.metadata===void 0||r.objectLiteral(t.metadata))}e.is=i;function s(e,t){let n=new Set;return e.document!==t.document&&n.add(`document`),e.kind!==t.kind&&n.add(`kind`),e.executionSummary!==t.executionSummary&&n.add(`executionSummary`),(e.metadata!==void 0||t.metadata!==void 0)&&!c(e.metadata,t.metadata)&&n.add(`metadata`),(e.executionSummary!==void 0||t.executionSummary!==void 0)&&!o.equals(e.executionSummary,t.executionSummary)&&n.add(`executionSummary`),n}e.diff=s;function c(e,t){if(e===t)return!0;if(e==null||t==null||typeof e!=typeof t||typeof e!=`object`)return!1;let n=Array.isArray(e),i=Array.isArray(t);if(n!==i)return!1;if(n&&i){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!c(e[n],t[n]))return!1}if(r.objectLiteral(e)&&r.objectLiteral(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||(n.sort(),r.sort(),!c(n,r)))return!1;for(let r=0;r<n.length;r++){let i=n[r];if(!c(e[i],t[i]))return!1}}return!0}})(s||(e.NotebookCell=s={}));var c;(function(e){function t(e,t,n,r){return{uri:e,notebookType:t,version:n,cells:r}}e.create=t;function i(e){let t=e;return r.objectLiteral(t)&&r.string(t.uri)&&n.integer.is(t.version)&&r.typedArray(t.cells,s.is)}e.is=i})(c||(e.NotebookDocument=c={}));var l;(function(e){e.method=`notebookDocument/sync`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.RegistrationType(e.method)})(l||(e.NotebookDocumentSyncRegistrationType=l={}));var u;(function(e){e.method=`notebookDocument/didOpen`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.ProtocolNotificationType(e.method),e.registrationMethod=l.method})(u||(e.DidOpenNotebookDocumentNotification=u={}));var d;(function(e){function t(e){let t=e;return r.objectLiteral(t)&&n.uinteger.is(t.start)&&n.uinteger.is(t.deleteCount)&&(t.cells===void 0||r.typedArray(t.cells,s.is))}e.is=t;function i(e,t,n){let r={start:e,deleteCount:t};return n!==void 0&&(r.cells=n),r}e.create=i})(d||(e.NotebookCellArrayChange=d={}));var f;(function(e){e.method=`notebookDocument/didChange`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.ProtocolNotificationType(e.method),e.registrationMethod=l.method})(f||(e.DidChangeNotebookDocumentNotification=f={}));var p;(function(e){e.method=`notebookDocument/didSave`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.ProtocolNotificationType(e.method),e.registrationMethod=l.method})(p||(e.DidSaveNotebookDocumentNotification=p={}));var m;(function(e){e.method=`notebookDocument/didClose`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.ProtocolNotificationType(e.method),e.registrationMethod=l.method})(m||(e.DidCloseNotebookDocumentNotification=m={}))})),ic=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.InlineCompletionRequest=void 0;var t=Is(),n;(function(e){e.method=`textDocument/inlineCompletion`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.InlineCompletionRequest=n={}))})),ac=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WorkspaceSymbolRequest=e.CodeActionResolveRequest=e.CodeActionRequest=e.DocumentSymbolRequest=e.DocumentHighlightRequest=e.ReferencesRequest=e.DefinitionRequest=e.SignatureHelpRequest=e.SignatureHelpTriggerKind=e.HoverRequest=e.CompletionResolveRequest=e.CompletionRequest=e.CompletionTriggerKind=e.PublishDiagnosticsNotification=e.WatchKind=e.RelativePattern=e.FileChangeType=e.DidChangeWatchedFilesNotification=e.WillSaveTextDocumentWaitUntilRequest=e.WillSaveTextDocumentNotification=e.TextDocumentSaveReason=e.DidSaveTextDocumentNotification=e.DidCloseTextDocumentNotification=e.DidChangeTextDocumentNotification=e.TextDocumentContentChangeEvent=e.DidOpenTextDocumentNotification=e.TextDocumentSyncKind=e.TelemetryEventNotification=e.LogMessageNotification=e.ShowMessageRequest=e.ShowMessageNotification=e.MessageType=e.DidChangeConfigurationNotification=e.ExitNotification=e.ShutdownRequest=e.InitializedNotification=e.InitializeErrorCodes=e.InitializeRequest=e.WorkDoneProgressOptions=e.TextDocumentRegistrationOptions=e.StaticRegistrationOptions=e.PositionEncodingKind=e.FailureHandlingKind=e.ResourceOperationKind=e.UnregistrationRequest=e.RegistrationRequest=e.DocumentSelector=e.NotebookCellTextDocumentFilter=e.NotebookDocumentFilter=e.TextDocumentFilter=void 0,e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=e.WillDeleteFilesRequest=e.DidDeleteFilesNotification=e.WillRenameFilesRequest=e.DidRenameFilesNotification=e.WillCreateFilesRequest=e.DidCreateFilesNotification=e.FileOperationPatternKind=e.LinkedEditingRangeRequest=e.ShowDocumentRequest=e.SemanticTokensRegistrationType=e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.TokenFormat=e.CallHierarchyPrepareRequest=e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=e.SelectionRangeRequest=e.DeclarationRequest=e.FoldingRangeRefreshRequest=e.FoldingRangeRequest=e.ColorPresentationRequest=e.DocumentColorRequest=e.ConfigurationRequest=e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=e.TypeDefinitionRequest=e.ImplementationRequest=e.ApplyWorkspaceEditRequest=e.ExecuteCommandRequest=e.PrepareRenameRequest=e.RenameRequest=e.PrepareSupportDefaultBehavior=e.DocumentOnTypeFormattingRequest=e.DocumentRangesFormattingRequest=e.DocumentRangeFormattingRequest=e.DocumentFormattingRequest=e.DocumentLinkResolveRequest=e.DocumentLinkRequest=e.CodeLensRefreshRequest=e.CodeLensResolveRequest=e.CodeLensRequest=e.WorkspaceSymbolResolveRequest=void 0,e.InlineCompletionRequest=e.DidCloseNotebookDocumentNotification=e.DidSaveNotebookDocumentNotification=e.DidChangeNotebookDocumentNotification=e.NotebookCellArrayChange=e.DidOpenNotebookDocumentNotification=e.NotebookDocumentSyncRegistrationType=e.NotebookDocument=e.NotebookCell=e.ExecutionSummary=e.NotebookCellKind=e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=e.InlineValueRefreshRequest=e.InlineValueRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchySubtypesRequest=e.TypeHierarchyPrepareRequest=void 0;var n=Is(),r=(Fs(),t(ao)),i=Ls(),a=Rs();Object.defineProperty(e,"ImplementationRequest",{enumerable:!0,get:function(){return a.ImplementationRequest}});var o=zs();Object.defineProperty(e,"TypeDefinitionRequest",{enumerable:!0,get:function(){return o.TypeDefinitionRequest}});var s=Bs();Object.defineProperty(e,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return s.WorkspaceFoldersRequest}}),Object.defineProperty(e,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return s.DidChangeWorkspaceFoldersNotification}});var c=Vs();Object.defineProperty(e,"ConfigurationRequest",{enumerable:!0,get:function(){return c.ConfigurationRequest}});var l=Hs();Object.defineProperty(e,"DocumentColorRequest",{enumerable:!0,get:function(){return l.DocumentColorRequest}}),Object.defineProperty(e,"ColorPresentationRequest",{enumerable:!0,get:function(){return l.ColorPresentationRequest}});var u=Us();Object.defineProperty(e,"FoldingRangeRequest",{enumerable:!0,get:function(){return u.FoldingRangeRequest}}),Object.defineProperty(e,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return u.FoldingRangeRefreshRequest}});var d=Ws();Object.defineProperty(e,"DeclarationRequest",{enumerable:!0,get:function(){return d.DeclarationRequest}});var f=Gs();Object.defineProperty(e,"SelectionRangeRequest",{enumerable:!0,get:function(){return f.SelectionRangeRequest}});var p=Ks();Object.defineProperty(e,"WorkDoneProgress",{enumerable:!0,get:function(){return p.WorkDoneProgress}}),Object.defineProperty(e,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return p.WorkDoneProgressCreateRequest}}),Object.defineProperty(e,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return p.WorkDoneProgressCancelNotification}});var m=qs();Object.defineProperty(e,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return m.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(e,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return m.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(e,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return m.CallHierarchyPrepareRequest}});var h=Js();Object.defineProperty(e,"TokenFormat",{enumerable:!0,get:function(){return h.TokenFormat}}),Object.defineProperty(e,"SemanticTokensRequest",{enumerable:!0,get:function(){return h.SemanticTokensRequest}}),Object.defineProperty(e,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return h.SemanticTokensDeltaRequest}}),Object.defineProperty(e,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return h.SemanticTokensRangeRequest}}),Object.defineProperty(e,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return h.SemanticTokensRefreshRequest}}),Object.defineProperty(e,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return h.SemanticTokensRegistrationType}});var g=Ys();Object.defineProperty(e,"ShowDocumentRequest",{enumerable:!0,get:function(){return g.ShowDocumentRequest}});var _=Xs();Object.defineProperty(e,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return _.LinkedEditingRangeRequest}});var v=Zs();Object.defineProperty(e,"FileOperationPatternKind",{enumerable:!0,get:function(){return v.FileOperationPatternKind}}),Object.defineProperty(e,"DidCreateFilesNotification",{enumerable:!0,get:function(){return v.DidCreateFilesNotification}}),Object.defineProperty(e,"WillCreateFilesRequest",{enumerable:!0,get:function(){return v.WillCreateFilesRequest}}),Object.defineProperty(e,"DidRenameFilesNotification",{enumerable:!0,get:function(){return v.DidRenameFilesNotification}}),Object.defineProperty(e,"WillRenameFilesRequest",{enumerable:!0,get:function(){return v.WillRenameFilesRequest}}),Object.defineProperty(e,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return v.DidDeleteFilesNotification}}),Object.defineProperty(e,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return v.WillDeleteFilesRequest}});var y=Qs();Object.defineProperty(e,"UniquenessLevel",{enumerable:!0,get:function(){return y.UniquenessLevel}}),Object.defineProperty(e,"MonikerKind",{enumerable:!0,get:function(){return y.MonikerKind}}),Object.defineProperty(e,"MonikerRequest",{enumerable:!0,get:function(){return y.MonikerRequest}});var b=$s();Object.defineProperty(e,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return b.TypeHierarchyPrepareRequest}}),Object.defineProperty(e,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return b.TypeHierarchySubtypesRequest}}),Object.defineProperty(e,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return b.TypeHierarchySupertypesRequest}});var x=ec();Object.defineProperty(e,"InlineValueRequest",{enumerable:!0,get:function(){return x.InlineValueRequest}}),Object.defineProperty(e,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return x.InlineValueRefreshRequest}});var S=tc();Object.defineProperty(e,"InlayHintRequest",{enumerable:!0,get:function(){return S.InlayHintRequest}}),Object.defineProperty(e,"InlayHintResolveRequest",{enumerable:!0,get:function(){return S.InlayHintResolveRequest}}),Object.defineProperty(e,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return S.InlayHintRefreshRequest}});var C=nc();Object.defineProperty(e,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return C.DiagnosticServerCancellationData}}),Object.defineProperty(e,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return C.DocumentDiagnosticReportKind}}),Object.defineProperty(e,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return C.DocumentDiagnosticRequest}}),Object.defineProperty(e,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return C.WorkspaceDiagnosticRequest}}),Object.defineProperty(e,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return C.DiagnosticRefreshRequest}});var w=rc();Object.defineProperty(e,"NotebookCellKind",{enumerable:!0,get:function(){return w.NotebookCellKind}}),Object.defineProperty(e,"ExecutionSummary",{enumerable:!0,get:function(){return w.ExecutionSummary}}),Object.defineProperty(e,"NotebookCell",{enumerable:!0,get:function(){return w.NotebookCell}}),Object.defineProperty(e,"NotebookDocument",{enumerable:!0,get:function(){return w.NotebookDocument}}),Object.defineProperty(e,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return w.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(e,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return w.DidOpenNotebookDocumentNotification}}),Object.defineProperty(e,"NotebookCellArrayChange",{enumerable:!0,get:function(){return w.NotebookCellArrayChange}}),Object.defineProperty(e,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return w.DidChangeNotebookDocumentNotification}}),Object.defineProperty(e,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return w.DidSaveNotebookDocumentNotification}}),Object.defineProperty(e,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return w.DidCloseNotebookDocumentNotification}});var T=ic();Object.defineProperty(e,"InlineCompletionRequest",{enumerable:!0,get:function(){return T.InlineCompletionRequest}});var E;(function(e){function t(e){let t=e;return i.string(t)||i.string(t.language)||i.string(t.scheme)||i.string(t.pattern)}e.is=t})(E||(e.TextDocumentFilter=E={}));var D;(function(e){function t(e){let t=e;return i.objectLiteral(t)&&(i.string(t.notebookType)||i.string(t.scheme)||i.string(t.pattern))}e.is=t})(D||(e.NotebookDocumentFilter=D={}));var O;(function(e){function t(e){let t=e;return i.objectLiteral(t)&&(i.string(t.notebook)||D.is(t.notebook))&&(t.language===void 0||i.string(t.language))}e.is=t})(O||(e.NotebookCellTextDocumentFilter=O={}));var k;(function(e){function t(e){if(!Array.isArray(e))return!1;for(let t of e)if(!i.string(t)&&!E.is(t)&&!O.is(t))return!1;return!0}e.is=t})(k||(e.DocumentSelector=k={}));var ee;(function(e){e.method=`client/registerCapability`,e.messageDirection=n.MessageDirection.serverToClient,e.type=new n.ProtocolRequestType(e.method)})(ee||(e.RegistrationRequest=ee={}));var te;(function(e){e.method=`client/unregisterCapability`,e.messageDirection=n.MessageDirection.serverToClient,e.type=new n.ProtocolRequestType(e.method)})(te||(e.UnregistrationRequest=te={}));var ne;(function(e){e.Create=`create`,e.Rename=`rename`,e.Delete=`delete`})(ne||(e.ResourceOperationKind=ne={}));var re;(function(e){e.Abort=`abort`,e.Transactional=`transactional`,e.TextOnlyTransactional=`textOnlyTransactional`,e.Undo=`undo`})(re||(e.FailureHandlingKind=re={}));var A;(function(e){e.UTF8=`utf-8`,e.UTF16=`utf-16`,e.UTF32=`utf-32`})(A||(e.PositionEncodingKind=A={}));var j;(function(e){function t(e){let t=e;return t&&i.string(t.id)&&t.id.length>0}e.hasId=t})(j||(e.StaticRegistrationOptions=j={}));var M;(function(e){function t(e){let t=e;return t&&(t.documentSelector===null||k.is(t.documentSelector))}e.is=t})(M||(e.TextDocumentRegistrationOptions=M={}));var ie;(function(e){function t(e){let t=e;return i.objectLiteral(t)&&(t.workDoneProgress===void 0||i.boolean(t.workDoneProgress))}e.is=t;function n(e){let t=e;return t&&i.boolean(t.workDoneProgress)}e.hasWorkDoneProgress=n})(ie||(e.WorkDoneProgressOptions=ie={}));var ae;(function(e){e.method=`initialize`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(ae||(e.InitializeRequest=ae={}));var N;(function(e){e.unknownProtocolVersion=1})(N||(e.InitializeErrorCodes=N={}));var oe;(function(e){e.method=`initialized`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolNotificationType(e.method)})(oe||(e.InitializedNotification=oe={}));var P;(function(e){e.method=`shutdown`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType0(e.method)})(P||(e.ShutdownRequest=P={}));var F;(function(e){e.method=`exit`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolNotificationType0(e.method)})(F||(e.ExitNotification=F={}));var se;(function(e){e.method=`workspace/didChangeConfiguration`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolNotificationType(e.method)})(se||(e.DidChangeConfigurationNotification=se={}));var ce;(function(e){e.Error=1,e.Warning=2,e.Info=3,e.Log=4,e.Debug=5})(ce||(e.MessageType=ce={}));var le;(function(e){e.method=`window/showMessage`,e.messageDirection=n.MessageDirection.serverToClient,e.type=new n.ProtocolNotificationType(e.method)})(le||(e.ShowMessageNotification=le={}));var ue;(function(e){e.method=`window/showMessageRequest`,e.messageDirection=n.MessageDirection.serverToClient,e.type=new n.ProtocolRequestType(e.method)})(ue||(e.ShowMessageRequest=ue={}));var de;(function(e){e.method=`window/logMessage`,e.messageDirection=n.MessageDirection.serverToClient,e.type=new n.ProtocolNotificationType(e.method)})(de||(e.LogMessageNotification=de={}));var fe;(function(e){e.method=`telemetry/event`,e.messageDirection=n.MessageDirection.serverToClient,e.type=new n.ProtocolNotificationType(e.method)})(fe||(e.TelemetryEventNotification=fe={}));var pe;(function(e){e.None=0,e.Full=1,e.Incremental=2})(pe||(e.TextDocumentSyncKind=pe={}));var me;(function(e){e.method=`textDocument/didOpen`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolNotificationType(e.method)})(me||(e.DidOpenTextDocumentNotification=me={}));var he;(function(e){function t(e){let t=e;return t!=null&&typeof t.text==`string`&&t.range!==void 0&&(t.rangeLength===void 0||typeof t.rangeLength==`number`)}e.isIncremental=t;function n(e){let t=e;return t!=null&&typeof t.text==`string`&&t.range===void 0&&t.rangeLength===void 0}e.isFull=n})(he||(e.TextDocumentContentChangeEvent=he={}));var ge;(function(e){e.method=`textDocument/didChange`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolNotificationType(e.method)})(ge||(e.DidChangeTextDocumentNotification=ge={}));var _e;(function(e){e.method=`textDocument/didClose`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolNotificationType(e.method)})(_e||(e.DidCloseTextDocumentNotification=_e={}));var ve;(function(e){e.method=`textDocument/didSave`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolNotificationType(e.method)})(ve||(e.DidSaveTextDocumentNotification=ve={}));var ye;(function(e){e.Manual=1,e.AfterDelay=2,e.FocusOut=3})(ye||(e.TextDocumentSaveReason=ye={}));var be;(function(e){e.method=`textDocument/willSave`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolNotificationType(e.method)})(be||(e.WillSaveTextDocumentNotification=be={}));var xe;(function(e){e.method=`textDocument/willSaveWaitUntil`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(xe||(e.WillSaveTextDocumentWaitUntilRequest=xe={}));var Se;(function(e){e.method=`workspace/didChangeWatchedFiles`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolNotificationType(e.method)})(Se||(e.DidChangeWatchedFilesNotification=Se={}));var Ce;(function(e){e.Created=1,e.Changed=2,e.Deleted=3})(Ce||(e.FileChangeType=Ce={}));var we;(function(e){function t(e){let t=e;return i.objectLiteral(t)&&(r.URI.is(t.baseUri)||r.WorkspaceFolder.is(t.baseUri))&&i.string(t.pattern)}e.is=t})(we||(e.RelativePattern=we={}));var Te;(function(e){e.Create=1,e.Change=2,e.Delete=4})(Te||(e.WatchKind=Te={}));var Ee;(function(e){e.method=`textDocument/publishDiagnostics`,e.messageDirection=n.MessageDirection.serverToClient,e.type=new n.ProtocolNotificationType(e.method)})(Ee||(e.PublishDiagnosticsNotification=Ee={}));var De;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.TriggerForIncompleteCompletions=3})(De||(e.CompletionTriggerKind=De={}));var Oe;(function(e){e.method=`textDocument/completion`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Oe||(e.CompletionRequest=Oe={}));var ke;(function(e){e.method=`completionItem/resolve`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(ke||(e.CompletionResolveRequest=ke={}));var Ae;(function(e){e.method=`textDocument/hover`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Ae||(e.HoverRequest=Ae={}));var je;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.ContentChange=3})(je||(e.SignatureHelpTriggerKind=je={}));var Me;(function(e){e.method=`textDocument/signatureHelp`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Me||(e.SignatureHelpRequest=Me={}));var Ne;(function(e){e.method=`textDocument/definition`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Ne||(e.DefinitionRequest=Ne={}));var Pe;(function(e){e.method=`textDocument/references`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Pe||(e.ReferencesRequest=Pe={}));var Fe;(function(e){e.method=`textDocument/documentHighlight`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Fe||(e.DocumentHighlightRequest=Fe={}));var I;(function(e){e.method=`textDocument/documentSymbol`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(I||(e.DocumentSymbolRequest=I={}));var Ie;(function(e){e.method=`textDocument/codeAction`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Ie||(e.CodeActionRequest=Ie={}));var L;(function(e){e.method=`codeAction/resolve`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(L||(e.CodeActionResolveRequest=L={}));var R;(function(e){e.method=`workspace/symbol`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(R||(e.WorkspaceSymbolRequest=R={}));var Le;(function(e){e.method=`workspaceSymbol/resolve`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Le||(e.WorkspaceSymbolResolveRequest=Le={}));var Re;(function(e){e.method=`textDocument/codeLens`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Re||(e.CodeLensRequest=Re={}));var ze;(function(e){e.method=`codeLens/resolve`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(ze||(e.CodeLensResolveRequest=ze={}));var Be;(function(e){e.method=`workspace/codeLens/refresh`,e.messageDirection=n.MessageDirection.serverToClient,e.type=new n.ProtocolRequestType0(e.method)})(Be||(e.CodeLensRefreshRequest=Be={}));var Ve;(function(e){e.method=`textDocument/documentLink`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Ve||(e.DocumentLinkRequest=Ve={}));var He;(function(e){e.method=`documentLink/resolve`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(He||(e.DocumentLinkResolveRequest=He={}));var Ue;(function(e){e.method=`textDocument/formatting`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Ue||(e.DocumentFormattingRequest=Ue={}));var We;(function(e){e.method=`textDocument/rangeFormatting`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(We||(e.DocumentRangeFormattingRequest=We={}));var Ge;(function(e){e.method=`textDocument/rangesFormatting`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Ge||(e.DocumentRangesFormattingRequest=Ge={}));var Ke;(function(e){e.method=`textDocument/onTypeFormatting`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Ke||(e.DocumentOnTypeFormattingRequest=Ke={}));var qe;(function(e){e.Identifier=1})(qe||(e.PrepareSupportDefaultBehavior=qe={}));var Je;(function(e){e.method=`textDocument/rename`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Je||(e.RenameRequest=Je={}));var Ye;(function(e){e.method=`textDocument/prepareRename`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Ye||(e.PrepareRenameRequest=Ye={}));var Xe;(function(e){e.method=`workspace/executeCommand`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolRequestType(e.method)})(Xe||(e.ExecuteCommandRequest=Xe={}));var Ze;(function(e){e.method=`workspace/applyEdit`,e.messageDirection=n.MessageDirection.serverToClient,e.type=new n.ProtocolRequestType(`workspace/applyEdit`)})(Ze||(e.ApplyWorkspaceEditRequest=Ze={}))})),oc=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createProtocolConnection=void 0;var t=ro();function n(e,n,r,i){return t.ConnectionStrategy.is(i)&&(i={connectionStrategy:i}),(0,t.createMessageConnection)(e,n,r,i)}e.createProtocolConnection=n})),sc=i((e=>{var n=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=e&&e.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&n(t,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.LSPErrorCodes=e.createProtocolConnection=void 0,r(ro(),e),r((Fs(),t(ao)),e),r(Is(),e),r(ac(),e);var i=oc();Object.defineProperty(e,"createProtocolConnection",{enumerable:!0,get:function(){return i.createProtocolConnection}});var a;(function(e){e.lspReservedErrorRangeStart=-32899,e.RequestFailed=-32803,e.ServerCancelled=-32802,e.ContentModified=-32801,e.RequestCancelled=-32800,e.lspReservedErrorRangeEnd=-32800})(a||(e.LSPErrorCodes=a={}))})),cc=i((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.createProtocolConnection=void 0;var r=io();n(io(),e),n(sc(),e);function i(e,t,n,i){return(0,r.createMessageConnection)(e,t,n,i)}e.createProtocolConnection=i})),lc=cc();function uc(e,t){if(!(Number.isInteger(t.line)&&Number.isInteger(t.character))||t.line<0||t.character<0)return;if(t.line>=e.lines)return t.line===e.lines&&t.character===0?e.length:void 0;let n=e.line(t.line+1);return Math.min(n.from+t.character,n.to)}function dc(e,t){let n=Number.isFinite(t)?Math.max(0,Math.min(t,e.length)):0,r=e.lineAt(n);return{character:n-r.from,line:r.number-1}}var fc=new tn.Renderer,pc=fc.code;fc.code=e=>e.text.trim()?pc.call(fc,e):``;function mc(e){return tn(e,{async:!1,gfm:!0,breaks:!0,renderer:fc})}function hc(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e]??e)}function gc(e){let t=e.trim();if(t.startsWith(`//`))return!1;try{let e=new URL(t,`https://codemirror.invalid/`);return e.protocol===`http:`||e.protocol===`https:`||e.protocol===`mailto:`}catch{return!1}}var _c=5;function vc(e,t){let n=e;for(let e=0;e<_c;e++){let e=n;for(let n of t)e=e.replace(n,``);if(e===n)return{html:n,stable:!0};n=e}return{html:n,stable:!1}}function yc(e){if(typeof document>`u`){let{html:t,stable:n}=vc(e,[/<\s*\/?\s*(?:script|style|iframe|object|embed|img)\b[^>]*>/gi,/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,/\s+srcdoc\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi]);return n?t.replace(/\s+((?:xlink:)?href|src)\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,(e,t,n)=>gc(n[0]===`"`||n[0]===`'`?n.slice(1,-1):n)?e:` ${t}=""`):hc(e)}let t=document.createElement(`template`);t.innerHTML=e;for(let e of t.content.querySelectorAll(`script, style, iframe, object, embed, img`))e.remove();for(let e of t.content.querySelectorAll(`*`))for(let t of[...e.attributes]){let n=t.name.toLowerCase();(n.startsWith(`on`)||n===`srcdoc`||(n===`href`||n===`src`||n===`xlink:href`)&&!gc(t.value))&&e.removeAttribute(t.name)}return t.innerHTML}function bc(e,t=mc){return xc(e,t,new WeakSet)}function xc(e,t,n){if(!e)return``;if(typeof e==`object`){if(n.has(e))return``;n.add(e)}if(kc(e)){let n=e.value;if(typeof n!=`string`)return``;let r=hc(n);return e.kind===`markdown`&&(r=t(n.trim())),r}return Array.isArray(e)?e.map(e=>xc(e,t,n)).filter(Boolean).join(`
|
|
27
|
-
|
|
28
|
-
`):typeof e==`string`?hc(e):jc(e)?t(`\`\`\`${typeof e.language==`string`?e.language.replace(/[^\w+-]/g,``):``}\n${e.value??``}\n\`\`\``):``}function Sc(e){return e?kc(e)?e.value:Array.isArray(e)?e.map(e=>Sc(e)).filter(Boolean).join(`
|
|
29
|
-
|
|
30
|
-
`):typeof e==`string`?e:jc(e)?e.value:``:``}function Cc(e,t,n){n.allowHTMLContent?e.innerHTML=yc(bc(t,n.markdownRenderer)):e.textContent=Sc(t)}function wc(e){if(e.length===0)return``;if(e.length===1)return e[0]||``;let t=[...e].sort(),n=t[0]||``,r=t[t.length-1]||``,i=0;for(;i<n.length&&n[i]===r[i];)i++;return n.substring(0,i)}function Tc(e){if(e.length===0)return;let t=wc(e.map(e=>e.textEdit?.newText??e.label));if(t===``)return;let n=[];for(let e=0;e<t.length;e++){let r=t.slice(0,e+1);if(r.length>0){let e=r.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);n.push(e)}}let r=n.join(`|`);return RegExp(`(${r})$`)}function Ec(e){return e?.range!==void 0}function Dc(e){return!Array.isArray(e)}function Oc(e){return e?.insert!==void 0&&e?.replace!==void 0}function kc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`kind`in e}function Ac(e){return typeof e==`string`?e:e.value}function jc(e){return typeof e==`object`&&!!e&&`language`in e&&`value`in e}function Mc(e,t){let n=document.createElement(`div`);n.className=`cm-error-message`,n.style.cssText=`
|
|
31
|
-
position: absolute;
|
|
32
|
-
padding: 8px;
|
|
33
|
-
background: #fee;
|
|
34
|
-
border: 1px solid #fcc;
|
|
35
|
-
border-radius: 4px;
|
|
36
|
-
color: #c00;
|
|
37
|
-
font-size: 14px;
|
|
38
|
-
z-index: 100;
|
|
39
|
-
max-width: 300px;
|
|
40
|
-
box-shadow: 0 2px 8px rgba(0,0,0,.15);
|
|
41
|
-
`,n.textContent=t;let r=e.coordsAtPos(e.state.selection.main.head);r&&(n.style.left=`${r.left}px`,n.style.top=`${r.bottom+5}px`),document.body.appendChild(n),setTimeout(()=>{n.style.opacity=`0`,n.style.transition=`opacity 0.2s`,setTimeout(()=>n.remove(),200)},3e3)}function Nc(e){return Pc(e,new WeakSet)}function Pc(e,t){if(e==null)return!0;if(Array.isArray(e))return t.has(e)?!0:(t.add(e),e.length===0||e.every(e=>Pc(e,t)));if(typeof e==`string`)return Fc(e);let n=e.value;return typeof n!=`string`||Fc(n)}function Fc(e){return e==null?!0:typeof e==`string`?e.trim()===``||/^[\s\n`]*$/.test(e):!1}function Ic(e,t){let n=[];return t.iterChanges((t,r,i,a,o)=>{let s=o.toString();if(t===0&&r===e.length){n.push({text:s});return}let c=dc(e,t),l=dc(e,r);n.push({range:{start:c,end:l},text:s})}),n.sort((e,t)=>{if(!e.range)return 1;if(!t.range)return-1;let n=e.range.start.line??-1,r=t.range.start.line??-1;if(n!==r)return r-n;let i=e.range.start.character??-1;return(t.range.start.character??-1)-i}),n}var Lc=Object.fromEntries(Object.entries(lc.CompletionItemKind).map(([e,t])=>[t,e]));function Rc(e){return!!(e.deprecated||e.tags?.includes(lc.CompletionItemTag.Deprecated))}function zc(e){return e.deprecated?`cm-deprecated`:``}function Bc(e){return`insert`in e}function Vc(e,t){if(!t)return e;let n={...e};if(n.commitCharacters??=t.commitCharacters,n.insertTextFormat??=t.insertTextFormat,n.insertTextMode??=t.insertTextMode,n.data===void 0&&(n.data=t.data),n.textEdit==null&&t.editRange){let e=n.textEditText??n.insertText??n.label;n.textEdit=Bc(t.editRange)?{newText:e,insert:t.editRange.insert,replace:t.editRange.replace}:{newText:e,range:t.editRange}}return n}function Hc(e,t,n,r){let{textEdit:i,insertText:a,label:o}=t,s=n,c=r,l=a||o;if(i){let t=Ec(i)?i.range:Oc(i)?i.replace:void 0;if(t){l=i.newText;let n=uc(e,t.start),r=uc(e,t.end);n!=null&&r!=null&&n<=r&&(s=n,c=r)}}return{from:s,to:c,newText:l}}function Uc(e,t,n,r){let i=[];for(let a of t){let t=uc(e,a.range.start),o=uc(e,a.range.end);t==null||o==null||t>o||o>n&&t<r||i.push({from:t,to:o,insert:a.newText})}return i}function Wc(e,t,n){return r=>r<=e?r:r-(t-e)+n}function Gc(e){let{view:t,originalDoc:n,mainFrom:r,mainTo:i,insertedLength:a,resolveItem:o}=e,s=t.state.doc,c=Wc(r,i,a);o().then(e=>{let a=e?.additionalTextEdits;if(!a?.length||t.state.doc!==s)return;let o=Uc(n,a,r,i).map(e=>({...e,from:c(e.from),to:c(e.to)}));o.length!==0&&t.dispatch({changes:o,userEvent:`input.complete`})}).catch(e=>{console.error(`Failed to resolve completion item:`,e)})}var Kc;(function(e){e.PlainText=1,e.Snippet=2})(Kc||={});var qc=/^\$\{(\d+)\|((?:\\.|[^\\}])*)\|\}/,Jc=/^\$\{([A-Za-z_][A-Za-z0-9_]*)(?::([^}]*))?\}/,Yc=/^\$[A-Za-z_][A-Za-z0-9_]*/,Xc=/^(?:\\.|[^,])*/,Zc=/^\{0(?=[:}])/;function Qc(e,t){let n=``,r=0;for(;r<e.length;){let i=e[r];if(i===`\\`&&r+1<e.length){n+=e.slice(r,r+2),r+=2;continue}if(i===`$`){let i=e.slice(r),a=qc.exec(i);if(a){let e=Xc.exec(a[2]??``)?.[0]??``;n+=t(a[1]??``,e),r+=a[0].length;continue}let o=Jc.exec(i);if(o){n+=o[2]??``,r+=o[0].length;continue}let s=Yc.exec(i);if(s){r+=s[0].length;continue}}n+=i,r+=1}return n}function $c(e){let t=0;for(let n of e.matchAll(/\$\{?(\d+)/g))t=Math.max(t,Number(n[1]));return String(t+1)}function el(e){let t=Qc(e,(e,t)=>`\${${e}:${t}}`),n=$c(t),r=``,i=0;for(;i<t.length;){let e=t[i];if(e===`\\`&&i+1<t.length){let e=t[i+1];e===`$`?t[i+2]===`{`?(r+=`$\\{`,i+=3):(r+=`$`,i+=2):e===`{`||e===`}`?(r+=`\\${e}`,i+=2):e===`\\`?(r+=`\\`,i+=2):(r+=e,i+=2)}else if(e===`$`){let a=t.slice(i+1),o=Zc.exec(a),s=/^\d+/.exec(a);if(o)r+=`\${${n}`,i+=1+o[0].length;else if(s){let e=s[0]===`0`?n:s[0];r+=`\${${e}}`,i+=1+s[0].length}else r+=e,i+=1}else e===`#`&&t[i+1]===`{`?(r+=`#\\{`,i+=2):(r+=e,i+=1)}return r}function tl(e){let t=Qc(e,(e,t)=>t),n=``,r=0;for(;r<t.length;){let e=t[r];if(e===`\\`&&r+1<t.length)n+=t[r+1],r+=2;else if(e===`$`){let i=/^\{(\d+)(?::([^}]*))?\}/.exec(t.slice(r+1));if(i)n+=i[2]??``,r+=1+i[0].length;else{let i=/^\d+/.exec(t.slice(r+1));i?r+=1+i[0].length:(n+=e,r+=1)}}else n+=e,r+=1}return n}function nl(e,t){let{detail:n,labelDetails:r,label:i,kind:a,documentation:o,additionalTextEdits:s,insertTextFormat:c,commitCharacters:l,filterText:u}=e,d=typeof i==`string`?i:``,f=null,p=()=>(f??=t.resolveItem(e),f),m={label:d,detail:r?.detail||n,apply(n,r,i,a){let o=n.state,{from:l,to:u,newText:d}=Hc(o.doc,e,i,a);(l>a||u<a)&&(l=i,u=a);let f=d,m=Uc(o.doc,s??[],l,u),h=e=>{s||!t.hasResolveProvider||Gc({view:n,originalDoc:o.doc,mainFrom:l,mainTo:u,insertedLength:e,resolveItem:p})};if(c===Kc.Snippet&&t.useSnippetOnCompletion){let e=l,t=u;if(m.length>0){let r=o.changes(m);n.dispatch({changes:r}),e=r.mapPos(e,1),t=r.mapPos(t,1)}let r=n.state.doc.length;$t(el(f))(n,null,e,t),h(n.state.doc.length-r+(t-e));return}if(c===Kc.Snippet&&(f=tl(f)),m.length===0){n.dispatch(Yt(o,f,l,u)),h(f.length);return}let g=o.changes([{from:l,to:u,insert:f},...m]);n.dispatch({changes:g,selection:{anchor:g.mapPos(l,-1)+f.length},userEvent:`input.complete`})},type:a?Lc[a]?.toLowerCase():void 0};u!=null&&u!==d&&(m.label=u,m.displayLabel=d),l?.length&&(m.commitCharacters=l),Rc(e)&&(m.deprecated=!0);let h=e=>{let n=document.createElement(`div`);return n.classList.add(`documentation`),Cc(n,e,{allowHTMLContent:t.allowHTMLContent,markdownRenderer:t.markdownRenderer}),n};return t.hasResolveProvider?m.info=async()=>{try{let e=(await p())?.documentation||o;return!e||Nc(e)?null:h(e)}catch(e){return console.error(`Failed to resolve completion item:`,e),!o||Nc(o)?null:h(o)}}:o&&(m.info=()=>h(o)),m}function rl(e,t,n,r=!0){let i=[t?il(t):al,n===`python`?ol:void 0].filter(Boolean),a=[...e];if(t&&r){let e=t.toLowerCase();/^\w+$/.test(e)&&(a=a.filter(({label:t,filterText:n})=>(typeof n==`string`?n:cl(t)).toLowerCase().startsWith(e)))}for(let e of i)a.sort(e);return a}function il(e){return(t,n)=>{let r=sl(t).startsWith(e),i=sl(n).startsWith(e);if(r&&!i)return-1;if(!r&&i)return 1;let a=typeof t.sortText==`string`?t.sortText:cl(t.label),o=typeof n.sortText==`string`?n.sortText:cl(n.label);return a.localeCompare(o)}}function al(e,t){let n=typeof e.sortText==`string`?e.sortText:cl(e.label),r=typeof t.sortText==`string`?t.sortText:cl(t.label);return n.localeCompare(r)}function ol(e,t){let n=cl(e.label).endsWith(`=`),r=cl(t.label).endsWith(`=`);return n&&!r?-1:!n&&r?1:0}function sl(e){return typeof e.filterText==`string`?e.filterText:cl(e.label)}function cl(e){return typeof e==`string`?e:``}function ll(e){let t=new Proxy({},{get(){throw Error(e)}});return function(e){return e[0]??t}}var ul=ll(`No document URI provided. Pass one to the extension or use documentUri.of().`),dl=ll(`No language ID provided. Pass one to the extension or use languageId.of().`);function fl(e){if(e!==e.trim())return!1;try{return!!new URL(e).protocol}catch{return!1}}var pl=I.define({combine(e){if(e.length===0)return ul(e);let t=ul(e);if(!(t&&fl(t)))throw Error(`Document URI must be a non-empty absolute URI`);return t}}),ml=I.define({combine(e){if(e.length===0)return dl(e);let t=dl(e);if(!t.trim())throw Error(`Language ID must be a non-empty string`);return t}}),hl={ParseError:-32700,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,RequestTimeout:-32001},gl=class extends Error{code;data;constructor(e,t,n){super(t),this.name=`RPCError`,this.code=e,this.data=n}},_l=1e4;function vl(e){return e.id!=null}function yl(e){return e instanceof Error?e:new gl(hl.InternalError,String(e))}var bl=class{transport;pending=new Map;disconnect;disconnectClose;connected;nextId=0;closed=!1;isConnected=!1;closeError;notificationHandler;requestHandler;constructor(e){this.transport=e,this.disconnect=e.onMessage(e=>this.receive(e)),this.disconnectClose=e.onClose?.(e=>{this.closeError??=e;for(let t of[...this.pending.keys()])this.settle(t,t=>t.reject(e))}),this.connected=e.connect(),this.connected.then(()=>{this.isConnected=!0},()=>{}),this.connected.catch(()=>{})}onNotification(e){this.notificationHandler=e}onRequest(e){this.requestHandler=e}request(e,t,n=_l){if(this.closed)return Promise.reject(new gl(hl.InternalError,`Client closed`));if(this.closeError)return Promise.reject(this.closeError);let r=this.nextId++;return new Promise((i,a)=>{let o=setTimeout(()=>{this.pending.delete(r),a(new gl(hl.RequestTimeout,`Request "${e}" timed out after ${n}ms`))},n);this.pending.set(r,{resolve:i,reject:a,timer:o});let s=()=>{if(this.pending.has(r))try{this.transport.send({jsonrpc:`2.0`,id:r,method:e,params:t})}catch(e){this.settle(r,t=>t.reject(yl(e)))}};if(this.isConnected){s();return}this.connected.then(s,e=>this.settle(r,t=>t.reject(yl(e))))})}notify(e,t){let n=this.dispatch({jsonrpc:`2.0`,method:e,params:t});return n.catch(()=>{}),n}respond(e){return this.dispatch(e)}close(){if(!this.closed){this.closed=!0;for(let e of this.pending.values())clearTimeout(e.timer),e.reject(new gl(hl.InternalError,`Client closed`));this.pending.clear(),this.disconnect(),this.disconnectClose?.(),this.transport.close()}}dispatch(e){if(this.closed)return Promise.resolve();if(this.isConnected)try{return this.transport.send(e),Promise.resolve()}catch(e){return Promise.reject(yl(e))}return this.connected.then(()=>{this.closed||this.transport.send(e)})}settle(e,t){let n=this.pending.get(e);n&&(clearTimeout(n.timer),this.pending.delete(e),t(n))}receive(e){if(this.closed||typeof e!=`object`||!e||Array.isArray(e)||e.jsonrpc!==`2.0`)return;if(typeof e.method==`string`){vl(e)?this.requestHandler?.(e):this.notificationHandler?.(e);return}if(!vl(e))return;let t=e,n=t.id;if(typeof n==`string`&&!this.pending.has(n)&&/^\d+$/.test(n)){let e=Number(n);this.pending.has(e)&&(n=e)}this.settle(n,e=>{if(`error`in t){let n=t.error;if(typeof n!=`object`||!n||typeof n.code!=`number`||typeof n.message!=`string`){e.reject(new gl(hl.InvalidRequest,`Malformed JSON-RPC error response`,n));return}e.reject(new gl(n.code,n.message,n.data))}else`result`in t?e.resolve(t.result):e.reject(new gl(hl.InvalidRequest,`Malformed JSON-RPC response: missing result or error`))})}},xl=1e4,Sl=`Language server: `,Cl={"textDocument/hover":`hoverProvider`,"textDocument/completion":`completionProvider`,"textDocument/definition":`definitionProvider`,"textDocument/declaration":`declarationProvider`,"textDocument/typeDefinition":`typeDefinitionProvider`,"textDocument/implementation":`implementationProvider`,"textDocument/references":`referencesProvider`,"textDocument/documentHighlight":`documentHighlightProvider`,"textDocument/documentSymbol":`documentSymbolProvider`,"textDocument/codeAction":`codeActionProvider`,"textDocument/codeLens":`codeLensProvider`,"textDocument/documentLink":`documentLinkProvider`,"textDocument/formatting":`documentFormattingProvider`,"textDocument/rangeFormatting":`documentRangeFormattingProvider`,"textDocument/onTypeFormatting":`documentOnTypeFormattingProvider`,"textDocument/rename":`renameProvider`,"textDocument/prepareRename":`renameProvider`,"textDocument/signatureHelp":`signatureHelpProvider`,"textDocument/foldingRange":`foldingRangeProvider`,"textDocument/selectionRange":`selectionRangeProvider`,"workspace/symbol":`workspaceSymbolProvider`,"workspace/executeCommand":`executeCommandProvider`},wl=class{ready;capabilities;advertisedCapabilities;initializePromise;rootUri;workspaceFolders;timeout;client;initializationOptions;clientCapabilities;notificationListeners=new Set;documentOpenCounts=new Map;serverRequestHandlers=new Map;dynamicCapabilities=new Map;isClosed=!1;constructor({rootUri:e,workspaceFolders:t,transport:n,initializationOptions:r,capabilities:i,timeout:a=xl,getWorkspaceConfiguration:o}){if(!e)throw Error(`rootUri must be a non-empty URI`);this.rootUri=e,this.workspaceFolders=t,this.initializationOptions=r,this.clientCapabilities=i,this.timeout=a,this.ready=!1,this.capabilities=null,this.client=new bl(n),this.client.onNotification(e=>{this.processNotification(e)}),this.client.onRequest(e=>{this.handleServerRequest(e)}),this.onRequest(`workspace/configuration`,e=>o?o(e):(e?.items??[]).map(()=>null)),this.onRequest(`client/registerCapability`,e=>{let t=e?.registrations;if(!Array.isArray(t))return null;for(let e of t)!e||typeof e.id!=`string`||e.id.length===0||typeof e.method!=`string`||this.dynamicCapabilities.has(e.id)||this.dynamicCapabilities.set(e.id,e);return null}),this.onRequest(`client/unregisterCapability`,e=>{let t=e?.unregisterations;if(!Array.isArray(t))return null;for(let e of t)this.dynamicCapabilities.delete(e.id);return null}),this.onRequest(`workspace/applyEdit`,()=>({applied:!1,failureReason:`workspace/applyEdit is not supported`})),this.onRequest(`window/showMessageRequest`,e=>{if(e?.message){let t=String(e.message).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,``).slice(0,2031);console.info(`${Sl}${t}`)}return null}),this.onRequest(`window/workDoneProgress/create`,()=>null),this.initializePromise=this.initialize(),this.initializePromise.catch(e=>{console.error(`Language server initialization failed`,e)})}getInitializationOptions(){let e={textDocument:{hover:{dynamicRegistration:!0,contentFormat:[`markdown`,`plaintext`]},moniker:{},synchronization:{dynamicRegistration:!1,willSave:!0,didSave:!0,willSaveWaitUntil:!0},codeAction:{dynamicRegistration:!0,codeActionLiteralSupport:{codeActionKind:{valueSet:[``,`quickfix`,`refactor`,`refactor.extract`,`refactor.inline`,`refactor.rewrite`,`source`,`source.organizeImports`]}},resolveSupport:{properties:[`edit`]}},completion:{dynamicRegistration:!1,completionItem:{snippetSupport:!0,commitCharactersSupport:!0,documentationFormat:[`markdown`,`plaintext`],deprecatedSupport:!0,preselectSupport:!1,insertReplaceSupport:!0,tagSupport:{valueSet:[1]},resolveSupport:{properties:[`documentation`,`detail`,`additionalTextEdits`]}},completionList:{itemDefaults:[`commitCharacters`,`editRange`,`insertTextFormat`,`insertTextMode`,`data`]},contextSupport:!1},signatureHelp:{dynamicRegistration:!1,signatureInformation:{documentationFormat:[`markdown`,`plaintext`]}},declaration:{dynamicRegistration:!1,linkSupport:!0},definition:{dynamicRegistration:!0,linkSupport:!0},typeDefinition:{dynamicRegistration:!1,linkSupport:!0},implementation:{dynamicRegistration:!1,linkSupport:!0},rename:{dynamicRegistration:!0,prepareSupport:!0},publishDiagnostics:{relatedInformation:!0,tagSupport:{valueSet:[1,2]},versionSupport:!0,codeDescriptionSupport:!0,dataSupport:!0}},workspace:{didChangeConfiguration:{dynamicRegistration:!1}}};return{capabilities:this.clientCapabilities?typeof this.clientCapabilities==`function`?this.clientCapabilities(e):this.clientCapabilities:e,initializationOptions:this.initializationOptions,processId:null,rootUri:this.rootUri,workspaceFolders:this.workspaceFolders}}async initialize(){let e=this.getInitializationOptions();this.advertisedCapabilities=e?.capabilities;let t=await this.request(`initialize`,e,this.timeout*3);if(!t||typeof t!=`object`||!(`capabilities`in t)||typeof t.capabilities!=`object`||t.capabilities===null)throw Error(`Invalid initialize response: missing server capabilities`);this.isClosed||(this.capabilities=t.capabilities,this.notify(`initialized`,{}),this.ready=!0)}close(){if(!this.isClosed){if(this.isClosed=!0,this.ready=!1,this.notificationListeners.clear(),this.serverRequestHandlers.clear(),this.dynamicCapabilities.clear(),this.documentOpenCounts.clear(),this.capabilities){this.client.request(`shutdown`,null,this.timeout).catch(()=>{}).then(()=>{this.client.notify(`exit`,void 0).catch(()=>{}),this.client.close()});return}this.client.close()}}onRequest(e,t){return this.serverRequestHandlers.set(e,t),()=>{this.serverRequestHandlers.get(e)===t&&this.serverRequestHandlers.delete(e)}}mayRegisterDynamically(e){let[t,n]=e.split(`/`);return t!==`textDocument`||!n?!1:(this.advertisedCapabilities?.textDocument)?.[n]?.dynamicRegistration===!0}hasCapability(e){for(let t of this.dynamicCapabilities.values())if(t.method===e)return!0;let t=Cl[e];return t?!!this.capabilities?.[t]:!1}async handleServerRequest(e){let t=this.serverRequestHandlers.get(e.method),n;if(!t)n={jsonrpc:`2.0`,id:e.id,error:{code:hl.MethodNotFound,message:`Method not found: ${e.method}`}};else try{let r=await t(e.params);n={jsonrpc:`2.0`,id:e.id,result:r===void 0?null:r}}catch(t){n={jsonrpc:`2.0`,id:e.id,error:{code:hl.InternalError,message:t instanceof Error?t.message:String(t)}}}this.isClosed||this.client.respond(n).catch(()=>{})}textDocumentDidOpen(e){let t=e.textDocument.uri,n=this.documentOpenCounts.get(t)??0;return this.documentOpenCounts.set(t,n+1),n>0?Promise.resolve(!1):this.notify(`textDocument/didOpen`,e).then(()=>!0)}textDocumentDidChange(e){return this.notify(`textDocument/didChange`,e)}textDocumentDidClose(e){let t=e.textDocument.uri,n=this.documentOpenCounts.get(t)??0;return n>1?(this.documentOpenCounts.set(t,n-1),Promise.resolve(void 0)):(this.documentOpenCounts.delete(t),this.notify(`textDocument/didClose`,e))}textDocumentWillSave(e){return this.notify(`textDocument/willSave`,e)}async textDocumentWillSaveWaitUntil(e){return await this.request(`textDocument/willSaveWaitUntil`,e,this.timeout)}textDocumentDidSave(e){return this.notify(`textDocument/didSave`,e)}async textDocumentHover(e){return await this.request(`textDocument/hover`,e,this.timeout)}async textDocumentCompletion(e){return await this.request(`textDocument/completion`,e,this.timeout)}async completionItemResolve(e){return await this.request(`completionItem/resolve`,e,this.timeout)}async textDocumentDefinition(e){return await this.request(`textDocument/definition`,e,this.timeout)}async textDocumentCodeAction(e){return await this.request(`textDocument/codeAction`,e,this.timeout)}async codeActionResolve(e){return await this.request(`codeAction/resolve`,e,this.timeout)}async textDocumentRename(e){return await this.request(`textDocument/rename`,e,this.timeout)}async textDocumentPrepareRename(e){return await this.request(`textDocument/prepareRename`,e,this.timeout)}async textDocumentSignatureHelp(e){return await this.request(`textDocument/signatureHelp`,e,this.timeout)}onNotification(e){return this.notificationListeners.add(e),()=>this.notificationListeners.delete(e)}request(e,t,n){if(e===`initialize`)return this.client.request(e,t,n);let r=this.hasCapability(e),i=!(this.ready||this.capabilities)&&this.mayRegisterDynamically(e);return this.initializePromise.then(()=>{if(this.isClosed)throw Error(`Language server client is closed`);if(Cl[e]&&!i&&!(r||this.hasCapability(e)))throw Error(`Language server does not support method ${e}`);return this.client.request(e,t,n)})}notify(e,t){return this.client.notify(e,t)}processNotification(e){for(let t of this.notificationListeners)try{Promise.resolve(t(e)).catch(e=>{console.error(`Notification listener failed`,e)})}catch(e){console.error(`Notification listener failed`,e)}}},Tl=class e{static OUTBOX_LIMIT=1e3;url;protocols;socket;opened=!1;closed=!1;rejectConnect;handlers=new Set;closeHandlers=new Set;outbox=[];constructor(e,t){this.url=e,this.protocols=t}connect(){return/^wss?:\/\//i.test(this.url)?(this.url.toLowerCase().startsWith(`ws://`)&&typeof location<`u`&&location.protocol===`https:`&&console.warn(`Insecure WebSocket ${this.url} may be blocked from an HTTPS page`),this.rejectConnect?.(Error(`WebSocket connection to ${this.url} was replaced`)),this.rejectConnect=void 0,this.socket?.close(),this.opened=!1,this.closed=!1,new Promise((e,t)=>{let n=new WebSocket(this.url,this.protocols);this.socket=n,this.rejectConnect=t,n.addEventListener(`open`,()=>{if(this.socket===n){this.opened=!0,this.rejectConnect=void 0;for(let e of this.outbox)n.send(e);this.outbox=[],e()}}),n.addEventListener(`message`,e=>{this.socket===n&&this.receiveFrame(e.data,n)}),n.addEventListener(`error`,()=>{if(this.socket!==n)return;let e=Error(`WebSocket connection to ${this.url} failed`);this.opened?this.emitClose(e):t(e)}),n.addEventListener(`close`,()=>{this.socket===n&&(this.opened?this.closed||this.emitClose(Error(`WebSocket connection to ${this.url} closed`)):t(Error(`WebSocket to ${this.url} closed before opening`)))})})):Promise.reject(Error(`Invalid WebSocket URL: ${this.url||`(empty)`}`))}send(t){if(this.closed)return;let n=JSON.stringify(t);this.socket&&this.socket.readyState===WebSocket.OPEN?this.socket.send(n):this.outbox.length<e.OUTBOX_LIMIT&&this.outbox.push(n)}onMessage(e){return this.handlers.add(e),()=>{this.handlers.delete(e)}}onClose(e){return this.closeHandlers.add(e),()=>{this.closeHandlers.delete(e)}}close(){this.rejectConnect?.(Error(`WebSocket to ${this.url} closed`)),this.rejectConnect=void 0,this.closed=!0,this.opened=!1,this.handlers.clear(),this.closeHandlers.clear(),this.outbox=[],this.socket?.close(),this.socket=void 0}receiveFrame(e,t){if(e instanceof ArrayBuffer||Object.prototype.toString.call(e)===`[object ArrayBuffer]`){this.dispatchFrame(new TextDecoder().decode(e));return}if(typeof Blob<`u`&&e instanceof Blob){e.text().then(e=>{this.socket===t&&this.dispatchFrame(e)});return}this.dispatchFrame(String(e))}dispatchFrame(e){if(this.closed)return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t;for(let e of this.handlers)try{e(n)}catch(e){console.error(`WebSocket message handler failed`,e)}}emitClose(e){this.opened=!1,this.closed=!0;for(let t of this.closeHandlers)try{t(e)}catch(e){console.error(`WebSocket close handler failed`,e)}}},El=console.log,Dl=2**31-1;function Ol(){return String(Date.now()+Math.random())}function kl(e){return e!=null&&typeof e.command==`string`}function Al(e,t){return e.line===t.line?e.character-t.character:e.line-t.line}function jl(e,t){let n=Al(e.start,e.end)===0,r=Al(t.start,t.end)===0;return n||r?Al(e.start,t.end)<=0&&Al(t.start,e.end)<=0:Al(e.start,t.end)<0&&Al(t.start,e.end)<0}function Ml(e,t){if(kl(e))return!0;let n=e.diagnostics;return!n||n.length===0||n.some(e=>jl(e.range,t.range))}function Nl(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol===`http:`||t.protocol===`https:`||t.protocol===`mailto:`}var Pl=$e.define(),Fl=He.define({create:()=>new Map,update(e,t){let n=e;for(let r of t.effects)if(r.is(Pl)){n===e&&(n=new Map(e));for(let e of[...n.keys()])e.startsWith(`${r.value.pluginId}:`)&&n.delete(e);for(let[e,t]of r.value.anchors)n.set(e,t)}if(t.docChanged&&n.size>0){n===e&&(n=new Map(e));for(let[e,r]of n)n.set(e,{from:t.changes.mapPos(r.from,1),to:t.changes.mapPos(r.to,r.from===r.to?1:-1)})}return n}}),Il=$e.define(),Ll=He.define({create:()=>null,update(e,t){for(let e of t.effects)if(e.is(Il))return e.value;if(e&&t.docChanged){let n=t.changes.mapPos(e.pos),r=e.end==null?void 0:t.changes.mapPos(e.end);return{...e,pos:n,end:r}}return e},provide:e=>Ve.from(e)}),Y=Ue.define(),Rl=20,zl=new WeakMap;function Bl(e,t){let n=zl.get(e);n?n.push(t):zl.set(e,[t])}function Vl(e,t){let n=zl.get(e);if(!n)return;let r=n.indexOf(t);r!==-1&&n.splice(r,1),n.length===0&&zl.delete(e)}var Hl=class{documentVersion;pluginId;pendingDocumentChanges=new Set;client;documentUri;languageId;view;allowHTMLContent;useSnippetOnCompletion;clientSideFiltering;sendIncrementalChanges;featureOptions;onGoToDefinition;onShowLocation;markdownRenderer;codeActionsConfig;disposeListener;destroyed=!1;documentOpened=!1;documentTextSnapshotted=!1;documentOpenCarriedText=!0;documentReady;signatureHelpRequestId=0;closeCodeActionMenu;closeRenamePopup;constructor(e){let{client:t,documentUri:n,languageId:r,view:i,featureOptions:a,sendIncrementalChanges:o=!0,allowHTMLContent:s=!1,useSnippetOnCompletion:c=!1,clientSideFiltering:l=!1,onGoToDefinition:u,onShowLocation:d,markdownRenderer:f=mc,codeActionsConfig:p}=e;this.documentVersion=0,this.pluginId=Ol(),this.client=t,this.documentUri=n,this.languageId=r,this.view=i,this.allowHTMLContent=s,this.useSnippetOnCompletion=c,this.clientSideFiltering=l,this.sendIncrementalChanges=o,this.featureOptions=a,this.onGoToDefinition=u,this.onShowLocation=d,this.markdownRenderer=f,this.codeActionsConfig=p,Bl(i,this),this.disposeListener=t.onNotification(this.processNotification.bind(this)),this.documentReady=this.initialize().catch(e=>{console.error(`Language server initialization failed`,e)})}update({state:e,docChanged:t,startState:{doc:n},changes:r}){if(!t)return;let i=this.resolveTextDocumentSyncKind();i!==lc.TextDocumentSyncKind.None&&(this.sendIncrementalChanges&&i===lc.TextDocumentSyncKind.Incremental?this.trackDocumentChanges(Ic(n,r)):this.trackDocumentChanges([{text:e.doc.toString()}]))}trackDocumentChanges(e){let t=this.sendChanges(e);this.pendingDocumentChanges.add(t),t.finally(()=>this.pendingDocumentChanges.delete(t))}destroy(){this.destroyed=!0,this.disposeListener?.(),this.disposeListener=void 0,this.closeCodeActionMenu?.(),this.closeRenamePopup?.(),this.view.state.field(Fl,!1)&&this.view.dispatch({effects:Pl.of({pluginId:this.pluginId,anchors:new Map})}),Vl(this.view,this),this.closeDocument()}closeDocument(){this.documentOpened&&this.client.ready&&(this.documentOpened=!1,Promise.resolve(this.client.textDocumentDidClose({textDocument:{uri:this.documentUri}})).catch(e=>{console.error(`Failed to send didClose`,e)}))}async initialize({documentText:e}={}){if(this.client.initializePromise&&await this.client.initializePromise,this.destroyed)return;let t=e??this.view.state.doc.toString();this.documentTextSnapshotted=!0;let n=await this.client.textDocumentDidOpen({textDocument:{uri:this.documentUri,languageId:this.languageId,text:t,version:this.documentVersion}});this.documentOpenCarriedText=n!==!1,this.documentOpened=!0,this.destroyed&&this.closeDocument()}resolveTextDocumentSyncKind(){let e=this.client.capabilities?.textDocumentSync;return e==null?this.sendIncrementalChanges?lc.TextDocumentSyncKind.Incremental:lc.TextDocumentSyncKind.Full:typeof e==`number`?e:e.change??lc.TextDocumentSyncKind.None}async sendChanges(e){let t=this.documentTextSnapshotted;if(!(!this.documentOpened&&(await this.documentReady,!t&&this.documentOpenCarriedText))&&this.client.ready)try{await this.client.textDocumentDidChange({textDocument:{uri:this.documentUri,version:++this.documentVersion},contentChanges:e})}catch(e){console.error(e)}}async documentDidSave(e=lc.TextDocumentSaveReason.Manual){if(!this.client.ready||(await Promise.all(this.pendingDocumentChanges),this.destroyed||!this.client.ready))return;let t=this.client.capabilities?.textDocumentSync,n=typeof t==`object`&&t?t:void 0;if(n?.willSave){try{await this.client.textDocumentWillSave({textDocument:{uri:this.documentUri},reason:e})}catch(e){console.error(`Failed to send willSave`,e)}if(this.destroyed||!this.client.ready)return}if(n?.willSaveWaitUntil){try{let t=await this.client.textDocumentWillSaveWaitUntil({textDocument:{uri:this.documentUri},reason:e});t&&t.length>0&&!this.destroyed&&(this.applyEdits(this.view,t),await Promise.all(this.pendingDocumentChanges))}catch(e){console.error(`Failed during willSaveWaitUntil`,e)}if(this.destroyed||!this.client.ready)return}let r=n?.save;if(r==null||r===!1)return;let i=typeof r==`object`&&r.includeText;try{await this.client.textDocumentDidSave({textDocument:{uri:this.documentUri},text:i?this.view.state.doc.toString():void 0})}catch(e){console.error(`Failed to send didSave`,e)}}requestDiagnostics(e){this.sendChanges([{text:e.state.doc.toString()}])}async requestHoverTooltip(e,{line:t,character:n}){if(!this.featureOptions.hoverEnabled||!(this.client.ready&&this.client.hasCapability(`textDocument/hover`)))return null;let r;try{r=await this.client.textDocumentHover({textDocument:{uri:this.documentUri},position:{line:t,character:n}})}catch{return null}if(!r)return null;let{contents:i,range:a}=r,o=uc(e.state.doc,{line:t,character:n}),s;if(a&&(o=uc(e.state.doc,a.start),s=uc(e.state.doc,a.end)),o==null||Nc(i))return null;let c=document.createElement(`div`);return c.classList.add(`documentation`,`cm-lsp-hover-tooltip`),Cc(c,i,{allowHTMLContent:this.allowHTMLContent,markdownRenderer:this.markdownRenderer}),{pos:o,end:s,create:e=>({dom:c}),above:!0}}async requestCompletion(e,{line:t,character:n},{triggerKind:r,triggerCharacter:i}){if(!this.featureOptions.completionEnabled||(await Promise.all(this.pendingDocumentChanges),!(this.client.ready&&this.client.hasCapability(`textDocument/completion`))))return null;let a;try{a=await this.client.textDocumentCompletion({textDocument:{uri:this.documentUri},position:{line:t,character:n},context:{triggerKind:r,triggerCharacter:i}})}catch{return null}if(!a)return null;let o=Dc(a)?a:{isIncomplete:!1,items:a};if(!Array.isArray(o.items))return null;let s=o.items.map(e=>Vc(e,o.itemDefaults)),c=this.clientSideFiltering&&!o.isIncomplete,l=Tc(s),u=l?e.matchBefore(l)??e.matchBefore(/[a-zA-Z0-9_]+/):e.matchBefore(/[a-zA-Z0-9_]+/),{pos:d}=e,f=rl(s,u?.text,this.languageId,!c);u&&(d=u.from);let p=f.map(e=>nl(e,{allowHTMLContent:this.allowHTMLContent,useSnippetOnCompletion:this.useSnippetOnCompletion,hasResolveProvider:this.client.capabilities?.completionProvider?.resolveProvider??!1,resolveItem:this.client.completionItemResolve.bind(this.client)}));return c?{from:d,options:p,validFor:/^\w*$/}:{from:d,options:p,filter:!1}}async requestDefinition(e,{line:t,character:n}){if(!this.featureOptions.definitionEnabled||!(this.client.ready&&this.client.hasCapability(`textDocument/definition`)))return;let r;try{r=await this.client.textDocumentDefinition({textDocument:{uri:this.documentUri},position:{line:t,character:n}})}catch{return}if(!r||this.destroyed)return;let i=Array.isArray(r)?r:[r];if(i.length===0)return;let a=i[0];if(!a||typeof a!=`object`)return;let o=`uri`in a&&typeof a.uri==`string`?a.uri:`targetUri`in a&&typeof a.targetUri==`string`?a.targetUri:void 0,s=`range`in a?a.range:`targetRange`in a?a.targetRange:void 0;if(!(o&&s?.start&&s.end))return;let c=o!==this.documentUri,l={uri:o,range:s,isExternalDocument:c};if(!c){let t=uc(e.state.doc,s.start),n=uc(e.state.doc,s.end);if(t==null||n==null||t>n)return;e.dispatch(e.state.update({selection:{anchor:t,head:n}}))}return this.onGoToDefinition&&this.onGoToDefinition(l),l}processNotification(e){try{e.method===`textDocument/publishDiagnostics`&&e.params&&this.processDiagnostics(e.params).catch(e=>El(e))}catch(e){El(e)}}lastSeenDiagnosticsVersion=null;async processDiagnostics(e){if(!e||e.uri!==this.documentUri||!Array.isArray(e.diagnostics))return;if(e.version!=null){if(typeof e.version!=`number`||!Number.isInteger(e.version)||e.version<0||e.version>Dl||this.lastSeenDiagnosticsVersion!=null&&e.version<this.lastSeenDiagnosticsVersion)return;this.lastSeenDiagnosticsVersion=e.version}else if(this.lastSeenDiagnosticsVersion!=null)return;if(!this.featureOptions.diagnosticsEnabled){this.clearDiagnostics();return}let t={[lc.DiagnosticSeverity.Error]:`error`,[lc.DiagnosticSeverity.Warning]:`warning`,[lc.DiagnosticSeverity.Information]:`info`,[lc.DiagnosticSeverity.Hint]:`hint`},n=this.view.state.doc,r=e.diagnostics.filter(e=>{if(!e||typeof e!=`object`||!e.range||typeof e.message!=`string`&&(typeof e.message!=`object`||e.message===null||typeof e.message.value!=`string`))return!1;let t=uc(n,e.range.start),r=uc(n,e.range.end);return t!=null&&r!=null&&t<=r});if(e.diagnostics.length>0&&r.length===0)return;let i=[];try{i=await this.requestCodeActionsForDiagnostics(r)??[]}catch(e){console.error(`Failed to fetch code actions`,e)}if(this.destroyed||e.version!=null&&this.lastSeenDiagnosticsVersion!=null&&e.version<this.lastSeenDiagnosticsVersion||this.view.state.doc!==n)return;let a=new Map,o=r.map((e,r)=>{let{range:o,message:s,severity:c,code:l,source:u,tags:d}=e,f=uc(n,o.start),p=uc(n,o.end);if(f==null||p==null||f>p)return null;e.relatedInformation?.forEach((e,t)=>{if(e.location.uri!==this.documentUri)return;let i=uc(n,e.location.range.start),o=uc(n,e.location.range.end);i!=null&&o!=null&&a.set(`${this.pluginId}:${r}:${t}`,{from:i,to:o})});let m=i.filter(t=>Ml(t,e)).map(e=>({name:`command`in e&&typeof e.command==`object`&&e.command?.title||e.title,apply:()=>{this.applyCodeAction(e)}})),h=u||this.languageId,g=l!=null&&l!==``?`${h}(${l})`:h,_=[this.pluginId];return d?.includes(lc.DiagnosticTag.Unnecessary)&&_.push(`cm-lsp-unnecessary`),d?.includes(lc.DiagnosticTag.Deprecated)&&_.push(`cm-lsp-deprecated`),{from:f,to:p,severity:t[c??lc.DiagnosticSeverity.Error]??`error`,message:Ac(s),renderMessage:t=>this.renderDiagnosticMessage(t,e,r),source:g,markClass:_.join(` `),actions:m.length>0?m:void 0,lspDiagnostic:e}});this.setOwnDiagnostics(o.filter(e=>e!=null),a)}setOwnDiagnostics(e,t=new Map){let n=this.view.state,r=[];Pt(n,(e,t,n)=>{this.ownsDiagnostic(e)||r.push({...e,from:t,to:n})});let i=Dt(n,[...r,...e]),a=i.effects,o=Array.isArray(a)?[...a]:a?[a]:[];o.push(Pl.of({pluginId:this.pluginId,anchors:t})),this.view.dispatch({...i,effects:o})}ownsDiagnostic(e){return e.markClass?.split(` `).includes(this.pluginId)??!1}renderDiagnosticMessage(e,t,n){let{message:r,code:i,source:a,codeDescription:o,relatedInformation:s}=t,c=document.createElement(`div`);c.classList.add(`cm-lsp-diagnostic-message`);let l=document.createElement(`div`);if(Cc(l,{kind:`markdown`,value:Ac(r)},{allowHTMLContent:this.allowHTMLContent,markdownRenderer:this.markdownRenderer}),c.appendChild(l),o?.href&&Nl(o.href)){let e=a||this.languageId,t=i!=null&&i!==``?`${e}(${i})`:e,n=document.createElement(`a`);n.className=`cm-diagnostic-code-link`,n.href=o.href,n.target=`_blank`,n.rel=`noopener noreferrer`,n.textContent=t,c.appendChild(n)}if(s&&s.length>0){let t=document.createElement(`div`);t.className=`cm-diagnostic-related`,s.forEach((r,i)=>{t.appendChild(this.renderRelatedInformation(e,r,`${this.pluginId}:${n}:${i}`))}),c.appendChild(t)}return c}renderRelatedInformation(e,t,n){let{location:r,message:i}=t,{uri:a,range:o}=r,s=a!==this.documentUri,c=()=>{if(s)return null;let t=e.state.field(Fl,!1)?.get(n);if(t)return t;let r=uc(e.state.doc,o.start);return r==null?null:{from:r,to:uc(e.state.doc,o.end)??r}},l=document.createElement(`div`);l.className=`cm-diagnostic-related-item`;let u=document.createElement(`span`);u.className=`cm-diagnostic-related-message`,u.textContent=i,l.appendChild(u);let d=c(),f=d&&!s?dc(e.state.doc,d.from):o.start,p=document.createElement(`span`);if(p.className=`cm-diagnostic-related-location`,p.textContent=` ${a}:${f.line+1}:${f.character+1}`,l.appendChild(p),!s||this.onShowLocation){l.classList.add(`cm-diagnostic-related-clickable`),l.setAttribute(`role`,`button`),l.tabIndex=0;let t=()=>{if(s){this.onShowLocation?.({uri:a,range:o,isExternalDocument:s});return}let t=c();t!=null&&e.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0})};l.addEventListener(`click`,t),l.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())})}return l}clearDiagnostics(){this.setOwnDiagnostics([])}async requestCodeActionsForDiagnostics(e){let t=e[0];if(!t||!this.featureOptions.codeActionsEnabled||!(this.client.ready&&this.client.hasCapability(`textDocument/codeAction`)))return null;let n=t.range.start,r=t.range.end;for(let t of e)Al(t.range.start,n)<0&&(n=t.range.start),Al(t.range.end,r)>0&&(r=t.range.end);return await this.client.textDocumentCodeAction({textDocument:{uri:this.documentUri},range:{start:n,end:r},context:{diagnostics:e}})}async requestCodeActions(e,t,n){return!this.featureOptions.codeActionsEnabled||!(this.client.ready&&this.client.hasCapability(`textDocument/codeAction`))?null:await this.client.textDocumentCodeAction({textDocument:{uri:this.documentUri},range:t,context:{diagnostics:this.diagnosticsInRange(e,t),...n?{only:n}:{}}})}async requestCodeActionsAtSelection(e){let{from:t,to:n}=e.state.selection.main;return await this.requestCodeActions(e,{start:dc(e.state.doc,t),end:dc(e.state.doc,n)})}diagnosticsInRange(e,t){let n=e.state.doc,r=uc(n,t.start),i=uc(n,t.end);if(r==null||i==null)return[];let a={error:lc.DiagnosticSeverity.Error,warning:lc.DiagnosticSeverity.Warning,info:lc.DiagnosticSeverity.Information,hint:lc.DiagnosticSeverity.Hint},o=[];return Pt(e.state,(e,t,s)=>{if(t>i||s<r)return;let c={start:dc(n,t),end:dc(n,s)},l=e.lspDiagnostic;l?o.push({...l,range:c}):o.push({range:c,message:e.message,severity:a[e.severity],source:e.source})}),o}async applyCodeAction(e){let t=await this.resolveCodeAction(e);if(!this.destroyed){if(kl(t)){El(`Executing command:`,t);return}t.edit&&await this.applyWorkspaceEdit(this.view,t.edit),t.command?El(`Executing command:`,t.command):t.edit||Mc(this.view,`Code action "${e.title}" has nothing to apply`)}}async resolveCodeAction(e){if(kl(e)||e.edit||e.command||!this.serverSupportsCodeActionResolve())return e;try{return await this.client.codeActionResolve(e)??e}catch(t){return console.error(`Failed to resolve code action`,t),e}}serverSupportsCodeActionResolve(){let e=this.client.capabilities?.codeActionProvider;if(typeof e==`object`&&e.resolveProvider)return!0;for(let e of this.client.dynamicCapabilities.values())if(e.method===`textDocument/codeAction`&&e.registerOptions?.resolveProvider)return!0;return!1}async showCodeActionsMenu(e){let t=e.state,n=await this.requestCodeActionsAtSelection(e);if(this.destroyed||e.state.doc!==t.doc||!e.state.selection.main.eq(t.selection.main))return!1;if(!n||n.length===0)return Mc(e,`No code actions available`),!1;let r=async e=>{await this.applyCodeAction(e)};return this.codeActionsConfig?.renderMenu?(this.codeActionsConfig.renderMenu(n,r),!0):(this.showDefaultCodeActionsMenu(e,n,r),!0)}showDefaultCodeActionsMenu(e,t,n){this.closeCodeActionMenu?.();let r=document.createElement(`div`);r.className=`cm-code-action-menu`,r.setAttribute(`role`,`listbox`),r.style.cssText=`position: absolute; display: flex; flex-direction: column; padding: 2px; background: white; border: 1px solid #ddd; box-shadow: 0 2px 8px rgba(0,0,0,.15); z-index: 99;`;let i=e=>{r.contains(e.target)||a()},a=()=>{this.closeCodeActionMenu===a&&(this.closeCodeActionMenu=void 0),r.remove(),document.removeEventListener(`mousedown`,i)};this.closeCodeActionMenu=a;let o=t.map(t=>{let i=document.createElement(`button`);i.type=`button`,i.className=`cm-code-action-item`,i.style.cssText=`display: flex; gap: 8px; align-items: baseline; padding: 4px 8px; border: none; background: none; text-align: left; cursor: pointer; font: inherit;`;let o=document.createElement(`span`);if(o.textContent=t.title,i.appendChild(o),!kl(t)&&t.kind){let e=document.createElement(`span`);e.className=`cm-code-action-kind`,e.style.cssText=`color: #888; font-size: 85%; margin-left: auto;`,e.textContent=t.kind,i.appendChild(e)}return!kl(t)&&t.disabled&&(i.disabled=!0,i.title=t.disabled.reason,i.style.opacity=`0.5`,i.style.cursor=`default`),i.addEventListener(`click`,()=>{a(),e.focus(),n(t)}),r.appendChild(i),i}),s=o.findIndex(e=>!e.disabled),c=e=>{s=e,o[e]?.focus()},l=e=>{for(let t=s+e;t>=0&&t<o.length;t+=e)if(!o[t]?.disabled){c(t);return}};r.tabIndex=-1,r.addEventListener(`keydown`,t=>{if(t.key===`Escape`)a(),e.focus();else if(t.key===`ArrowDown`)l(1);else if(t.key===`ArrowUp`)l(-1);else if(t.key===`Enter`){let e=o[s];e&&!e.disabled&&e.click()}else return;t.preventDefault(),t.stopPropagation()});let u=e.coordsAtPos(e.state.selection.main.from);u&&(r.style.left=`${u.left+window.scrollX}px`,r.style.top=`${u.bottom+window.scrollY+5}px`),document.addEventListener(`mousedown`,i),document.body.appendChild(r),s===-1?r.focus():c(s)}async requestRename(e,{line:t,character:n}){if(this.featureOptions.renameEnabled){if(!this.client.ready){Mc(e,`Language server not ready`);return}if(!this.client.hasCapability(`textDocument/rename`)){Mc(e,`Rename not supported by language server`);return}try{let r=await this.client.textDocumentPrepareRename({textDocument:{uri:this.documentUri},position:{line:t,character:n}}).catch(()=>this.prepareRenameFallback(e,{line:t,character:n}));if(!r){Mc(e,`Cannot rename this symbol`);return}let i;if(`defaultBehavior`in r){if(!r.defaultBehavior){Mc(e,`Cannot rename this symbol`);return}let a=this.prepareRenameFallback(e,{line:t,character:n});if(!a){Mc(e,`Cannot rename this symbol`);return}i=a}else i=r;let a=document.createElement(`div`);a.className=`cm-rename-popup`,a.style.cssText=`position: absolute; padding: 4px; background: white; border: 1px solid #ddd; box-shadow: 0 2px 8px rgba(0,0,0,.15); z-index: 99;`;let o=document.createElement(`input`);o.type=`text`,o.style.cssText=`width: 200px; padding: 4px; border: 1px solid #ddd;`;let s=`range`in i?i.range:i,c=uc(e.state.doc,s.start);if(c==null)return;let l=uc(e.state.doc,s.end);o.value=`placeholder`in i?i.placeholder:l==null?``:e.state.doc.sliceString(c,l);let u=o.value;a.appendChild(o);let d=e.coordsAtPos(c);if(!d)return;a.style.left=`${d.left}px`,a.style.top=`${d.bottom+5}px`;let f=e=>{a.contains(e.target)||p()},p=()=>{a.remove(),document.removeEventListener(`mousedown`,f),this.closeRenamePopup===p&&(this.closeRenamePopup=void 0)},m=async()=>{let r=o.value.trim();if(!r){Mc(e,`New name cannot be empty`),p();return}if(/[\r\n]/.test(r)){Mc(e,`New name must be a single line`),p();return}if(r===u){p();return}try{let i=e.state.doc,a=await this.client.textDocumentRename({textDocument:{uri:this.documentUri},position:{line:t,character:n},newName:r});if(this.destroyed||e.state.doc!==i)return;await this.applyRenameEdit(e,a)}catch(t){Mc(e,`Rename failed: ${t instanceof Error?t.message:`Unknown error`}`)}finally{p()}};o.addEventListener(`keydown`,e=>{e.key===`Enter`?m():e.key===`Escape`&&p(),e.stopPropagation()}),this.closeRenamePopup?.(),this.closeRenamePopup=p,document.addEventListener(`mousedown`,f),document.body.appendChild(a),o.focus(),o.select()}catch(t){Mc(e,`Rename failed: ${t instanceof Error?t.message:`Unknown error`}`)}}}async requestSignatureHelp(e,{line:t,character:n},r=void 0){if(!(this.featureOptions.signatureHelpEnabled&&this.client.ready&&this.client.hasCapability(`textDocument/signatureHelp`)))return null;try{let i=await this.client.textDocumentSignatureHelp({textDocument:{uri:this.documentUri},position:{line:t,character:n},context:{isRetrigger:!1,triggerKind:1,triggerCharacter:r}});if(!i?.signatures||i.signatures.length===0)return null;let a=this.createTooltipContainer(),o=i.activeSignature??0,s=i.signatures[o]||i.signatures[0];if(!s)return null;let c=i.activeParameter??s.activeParameter??0,l=this.createSignatureElement(s,c);a.appendChild(l),s.documentation&&a.appendChild(this.createDocumentationElement(s.documentation));let u=s.parameters?.[c];u?.documentation&&a.appendChild(this.createParameterDocElement(u.documentation));let d=uc(e.state.doc,{line:t,character:n});return d==null?null:{pos:d,end:d,create:e=>({dom:a}),above:this.featureOptions.signatureHelpOptions?.position===`above`}}catch(e){return console.error(`Signature help error:`,e),null}}async showSignatureHelpTooltip(e,t,n){let r=++this.signatureHelpRequestId,i=await this.requestSignatureHelp(e,dc(e.state.doc,t),n);this.destroyed||r!==this.signatureHelpRequestId||e.dispatch({effects:Il.of(i)})}createTooltipContainer(){let e=document.createElement(`div`);return e.classList.add(`cm-signature-help`),e.style.cssText=`padding: 6px; max-width: 400px;`,e}createSignatureElement(e,t){let n=document.createElement(`div`);if(n.classList.add(`cm-signature`),n.style.cssText=`font-family: monospace; margin-bottom: 4px;`,!e.label||typeof e.label!=`string`)return n.textContent=`Signature information unavailable`,n;let r=e.label,i=e.parameters||[];if(i.length===0||!i[t])return n.textContent=r,n;let a=i[t].label;if(typeof a==`string`){let e=r.indexOf(`(`)+1;for(let n=0;n<t;n++){let t=i[n]?.label;if(typeof t==`string`){let n=r.indexOf(t,e);n!==-1&&(e=n+t.length)}}let o=r.indexOf(a,e);o===-1?n.textContent=r:this.applyRangeHighlighting(n,r,o,o+a.length)}else Array.isArray(a)&&a.length===2?this.applyRangeHighlighting(n,r,a[0],a[1]):n.textContent=r;return n}applyRangeHighlighting(e,t,n,r){if(!(Number.isInteger(n)&&Number.isInteger(r))||n<0||r<0||n>t.length||r>t.length){e.textContent=t;return}let i=Math.min(n,r),a=Math.max(n,r);if(i===a){e.textContent=t;return}e.textContent=``;let o=t.substring(0,i),s=t.substring(i,a),c=t.substring(a);e.appendChild(document.createTextNode(o));let l=document.createElement(`span`);l.classList.add(`cm-signature-active-param`),l.style.cssText=`font-weight: bold; text-decoration: underline;`,l.textContent=s,e.appendChild(l),e.appendChild(document.createTextNode(c))}createDocumentationElement(e){let t=document.createElement(`div`);return t.classList.add(`cm-signature-docs`),t.style.cssText=`margin-top: 4px; color: #666;`,Cc(t,e,{allowHTMLContent:this.allowHTMLContent,markdownRenderer:this.markdownRenderer}),t}createParameterDocElement(e){let t=document.createElement(`div`);return t.classList.add(`cm-parameter-docs`),t.style.cssText=`margin-top: 4px; font-style: italic; border-top: 1px solid #eee; padding-top: 4px;`,Cc(t,e,{allowHTMLContent:this.allowHTMLContent,markdownRenderer:this.markdownRenderer}),t}prepareRenameFallback(e,{line:t,character:n}){let r=e.state.doc.line(t+1).text,i=/\w+/g,a,o=n,s=n;for(;(a=i.exec(r))!==null;){let e=a.index,t=a.index+a[0].length;if(n>=e&&n<=t){o=e,s=t;break}}return o===n&&s===n?null:{range:{start:{line:t,character:o},end:{line:t,character:s}},placeholder:r.slice(o,s)}}applyEdits(e,t){let n=e.state.doc,r=[];for(let e of t){if(!e||typeof e!=`object`||!e.range||typeof e.newText!=`string`)return!1;let t=uc(n,e.range.start),i=uc(n,e.range.end);if(t==null||i==null||t>i)return!1;r.push({from:t,to:i,insert:e.newText})}if(r.length===0)return!1;let i=[...r].sort((e,t)=>e.from-t.from||e.to-t.to);for(let t=1;t<i.length;t++){let n=i[t-1],r=i[t];if(n&&r&&(r.from<n.to||r.from===r.to&&n.from===n.to&&r.from===n.from))return Mc(e,`Workspace edit ranges overlap`),!1}return e.dispatch(e.state.update({changes:r})),!0}async applyWorkspaceEdit(e,t){if(!t)return Mc(e,`No edit returned from language server`),!1;let n=t.changes&&typeof t.changes==`object`?t.changes:{},r=Array.isArray(t.documentChanges)?t.documentChanges:[];if(Object.keys(n).length===0&&r.length===0)return Mc(e,`No changes to apply`),!1;if(r.length>0){let t=[];for(let n of r){if(typeof n!=`object`||!n||!(`textDocument`in n))return Mc(e,`File creation, deletion, or renaming operations not supported yet`),!1;if(typeof n.textDocument!=`object`||n.textDocument===null)return Mc(e,`Malformed workspace edit`),!1;if(n.textDocument.uri!==this.documentUri)return Mc(e,`Multi-file edits not supported yet`),!1;if(n.textDocument.version!=null&&n.textDocument.version!==this.documentVersion)return Mc(e,`Workspace edit is stale because the document changed`),!1;if(!Array.isArray(n.edits))return!1;for(let r of n.edits){if(typeof r!=`object`||!r||!(`newText`in r))return Mc(e,`Snippet edits not supported yet`),!1;t.push(r)}}return t.length!==0&&this.applyEdits(e,t)}let i=Object.entries(n);if(i.some(([e])=>e!==this.documentUri))return Mc(e,`Multi-file edits not supported yet`),!1;let a=i[0]?.[1];return Array.isArray(a)?this.applyEdits(e,a):!1}async applyRenameEdit(e,t){return this.applyWorkspaceEdit(e,t)}};function Ul(e){let t={rename:`F2`,goToDefinition:`F12`,signatureHelp:`Mod-Shift-Space`,codeActions:`Mod-.`,...e.keyboardShortcuts},n=e.client,r={diagnosticsEnabled:!0,hoverEnabled:!0,completionEnabled:!0,definitionEnabled:!0,renameEnabled:!0,codeActionsEnabled:!0,signatureHelpEnabled:!0,signatureActivateOnTyping:!1,signatureHelpOptions:{position:`below`},...e},i=_t.define(t=>new Hl({client:n,documentUri:e.documentUri??t.state.facet(pl),languageId:e.languageId??t.state.facet(ml),view:t,featureOptions:r,sendIncrementalChanges:e.sendIncrementalChanges,allowHTMLContent:e.allowHTMLContent,useSnippetOnCompletion:e.useSnippetOnCompletion,clientSideFiltering:e.clientSideFiltering,onGoToDefinition:e.onGoToDefinition,onShowLocation:e.onShowLocation,markdownRenderer:e.markdownRenderer,codeActionsConfig:e.codeActionsConfig})),a=e=>e.plugin(i),o=[i];if(r.diagnosticsEnabled&&o.push(Fl,V.baseTheme({".cm-lsp-unnecessary":{opacity:`0.6`},".cm-lsp-deprecated":{textDecoration:`line-through`},".cm-diagnostic-related":{marginTop:`4px`,display:`flex`,flexDirection:`column`,gap:`2px`},".cm-diagnostic-related-clickable":{cursor:`pointer`},".cm-diagnostic-related-location":{opacity:`0.7`},".cm-diagnostic-code-link":{display:`inline-block`,marginTop:`4px`}})),o.push(Ke.of([{key:t.signatureHelp,run:e=>{let t=a(e);if(!(t&&r.signatureHelpEnabled))return!1;let n=e.state.selection.main.head;return t.showSignatureHelpTooltip(e,n),!0}},{key:t.rename,run:e=>{let t=a(e);if(!(t&&r.renameEnabled))return!1;let n=e.state.selection.main.head;return t.requestRename(e,dc(e.state.doc,n)),!0}},{key:t.codeActions,run:e=>{let t=a(e);return t&&r.codeActionsEnabled?(t.showCodeActionsMenu(e).catch(t=>Mc(e,`Code actions failed: ${t instanceof Error?t.message:`Unknown error`}`)),!0):!1}},{key:t.goToDefinition,run:e=>{let t=a(e);if(!(t&&r.definitionEnabled))return!1;let n=e.state.selection.main.head;return t.requestDefinition(e,dc(e.state.doc,n)).catch(t=>Mc(e,`Go to definition failed: ${t instanceof Error?t.message:`Unknown error`}`)),!0}}])),r.hoverEnabled&&o.push(vt((e,t)=>{let n=a(e);return n==null?null:n.requestHoverTooltip(e,dc(e.state.doc,t))},e.hoverConfig)),r.signatureHelpEnabled){o.push(Ll);let e=e=>e.state.field(Ll)?(e.dispatch({effects:Il.of(null)}),!0):!1;o.push(V.domEventHandlers({mousedown:(t,n)=>(e(n),!1)})),o.push(Ke.of([{key:`)`,run:t=>(e(t),!1)},{key:`Escape`,run:t=>e(t)}])),o.push(V.updateListener.of(t=>{if(!(a(t.view)&&r.signatureActivateOnTyping)||!t.state.field(Ll)||!(t.selectionSet||t.docChanged))return;let n=t.state.selection.main.head;ql(t.state.doc,n)||queueMicrotask(()=>{e(t.view)})})),o.push(V.updateListener.of(async e=>{let t=a(e.view);if(!(t&&e.docChanged)||e.transactions.some(e=>e.annotation(Y))||!t.client.hasCapability(`textDocument/signatureHelp`)||!r.signatureActivateOnTyping)return;let n=t.client.capabilities?.signatureHelpProvider?.triggerCharacters||[`(`,`,`],i=e.changes,o=-1,s;i.iterChanges((e,t,r,i,a)=>{if(o>=0)return;let c=Gl(a.toString(),r,n);c&&(o=c.triggerPos,s=c.triggerCharacter)}),o>=0&&t.showSignatureHelpTooltip(e.view,o,s)}))}if(r.completionEnabled){let t=e.completionConfig?.optionClass;o.push(V.baseTheme({".cm-tooltip-autocomplete li.cm-deprecated .cm-completionLabel":{textDecoration:`line-through`}}),en({...e.completionConfig,optionClass:e=>[zc(e),t?.(e)??``].filter(Boolean).join(` `),override:[async t=>{let n=t.view?a(t.view):null;if(n==null)return null;let{state:r,pos:i}=t,o=Wl(t,n.client.capabilities?.completionProvider?.triggerCharacters??[],e.completionMatchBefore);return o==null?null:await n.requestCompletion(t,dc(r.doc,i),o)},...e.completionConfig?.override||[]]}))}return o.push(V.domEventHandlers({click:(e,n)=>{if(r.definitionEnabled&&t.goToDefinition===`ctrlcmd`&&(e.ctrlKey||e.metaKey)){let t=n.posAtCoords({x:e.clientX,y:e.clientY}),r=a(n);t&&r&&(r.requestDefinition(n,dc(n.state.doc,t)).catch(e=>Mc(n,`Go to definition failed: ${e instanceof Error?e.message:`Unknown error`}`)),e.preventDefault())}}})),o}function Wl(e,t,n){let{state:r,pos:i,explicit:a}=e,o=r.doc.lineAt(i),s=lc.CompletionTriggerKind.Invoked,c,l=o.text[i-o.from-1]||``,u=t?.includes(l);return!a&&u&&(s=lc.CompletionTriggerKind.TriggerCharacter,c=l),!a&&s===lc.CompletionTriggerKind.Invoked&&!e.matchBefore(n||/(\w+|\w+\.|\/|,)$/)?null:{triggerKind:s,triggerCharacter:c}}function Gl(e,t,n){if(!e)return null;for(let r of n){let n=e.indexOf(r);if(n!==-1)return{triggerPos:t+n+1,triggerCharacter:r}}return null}function Kl(e){let t=0;for(let n of e)n===`(`?t++:n===`)`&&t--;return t}function ql(e,t,n=Rl){let r=e.lineAt(t),i=Math.max(1,r.number-n),a=e.line(i).from;return Kl(e.sliceString(a,t))>0}function Jl(e,t,n={}){let{preserveCursor:r=!0,effects:i,userEvent:a}=n,o=e.state.doc;if(o.toString()!==t){if(r&&e.hasFocus){let n=e.state.selection.main.head,r=o.lineAt(n),s=r.number,c=n-r.from,l=e.state.update({changes:{from:0,to:o.length,insert:t}}).state.doc,u;if(s<=l.lines){let e=l.line(s),t=e.length;u=e.from+Math.min(c,t)}else u=l.line(l.lines).to;e.dispatch({changes:{from:0,to:o.length,insert:t},annotations:Y.of(!0),selection:{anchor:u},effects:i,userEvent:a})}else e.dispatch({changes:{from:0,to:o.length,insert:t},effects:i,userEvent:a})}}function Yl(){return I.define({combine:e=>e.find(e=>e!==void 0)})}var Xl=Yl(),Zl=Yl(),Ql=Yl(),$l=Yl(),eu=Yl();function tu({cellId:e,completionConfig:t,hotkeys:n,placeholderType:r,lspConfig:i,diagnosticsConfig:a}){return[$l.of(e),Xl.of(t),Zl.of(n),Ql.of(r),eu.of({...i,diagnostics:a})]}var nu=new L;function ru(e){return e===`application/vnd.marimo+error`}function iu(e){return e===`application/vnd.marimo+traceback`}function au(e){return ru(e)||iu(e)}function ou(e){return Object.values(e.cellRuntime).some(e=>e.status===`running`)}function su(e){return Object.values(e.cellRuntime).filter(e=>e.status===`running`||e.status===`queued`).length}function cu(e){return gu(e).length>0}function lu(e){return e.cellIds.inOrderIds.map(t=>e.cellData[t])}function uu({cellHandles:e}){let t={};for(let[n,r]of D.entries(e))r.current?.editorView&&(t[n]=r.current.editorView);return t}function du(e){let{cellIds:t,cellData:n}=e,r=[];for(let e of t.inOrderIds)n[e].config.disabled&&r.push(e);return r}function fu(e){let{cellIds:t,cellData:n}=e,r=[];for(let e of t.inOrderIds)n[e].config.disabled||r.push(e);return r}function pu(e){return e.history.length>0}function mu(e){let t=e.history[e.history.length-1];return t&&t.type===`move`?`Undo move`:`Undo cell deletion`}function hu(e,t){let n=e.cellIds.findWithId(t).getDescendants(t);return{stale:n.some(t=>e.cellRuntime[t]?.staleInputs||e.cellData[t]?.edited),errored:n.some(t=>e.cellRuntime[t]?.errored),runningOrQueued:n.some(t=>e.cellRuntime[t]?.status===`running`||e.cellRuntime[t]?.status===`queued`)}}function gu(e){let{cellIds:t,cellData:n,cellRuntime:r}=e;return t.inOrderIds.filter(e=>_u({executionTime:r[e].runElapsedTimeMs??n[e].lastExecutionTime,status:r[e].status,errored:r[e].errored,interrupted:r[e].interrupted,stopped:r[e].stopped})||n[e].edited||r[e].interrupted||r[e].staleInputs&&!(r[e].status===`disabled-transitively`||n[e].config.disabled))}function _u({executionTime:e,status:t,errored:n,interrupted:r,stopped:i}){return e===null&&t!==`queued`&&t!==`running`&&!(n||r||i)}function vu({edited:e,interrupted:t,staleInputs:n,disabled:r,status:i}){return e||t||n&&!(r||i===`disabled-transitively`)}function yu({needsRun:e,errored:t,stopped:n,disabled:r,status:i}){return{"needs-run":e,"has-error":t,stopped:n,disabled:r??!1,stale:i===`disabled-transitively`}}function bu({errored:e,stopped:t}){return{published:!0,"has-error":e,stopped:t}}function xu({errored:e,interrupted:t,stopped:n,output:r,showErrorTracebacks:i}){let a=au(r?.mimetype),o=i&&a&&Array.isArray(r?.data)&&r.data.some(e=>e.type===`exception`&&`traceback`in e&&e.traceback);return(e||t||n||a)&&!o}var Su=I.define({combine:e=>e[0]}),Cu=I.define({combine:e=>e[0]}),wu={...hn,caseInsensitiveIdentifiers:!0,identifierQuotes:"`"},Tu=_n.define(wu),Eu=_n.define({doubleQuotedStrings:!1,hashComments:!1,spaceAfterDashes:!1,identifierQuotes:`"`,caseInsensitiveIdentifiers:!0,keywords:`abs access acos aes_decrypt aggregate all allocate allow alter analyze and any approx_count_distinct approx_percentile are array array_avg array_cat array_compact array_contains array_generate_range array_max array_max_cardinality array_min array_position array_remove array_remove_at array_size array_sum array_to_string arrow as ascii asensitive asin assign asymmetric at atan atan2 atomic authorization auto avg avoid base64 batch begin begin_frame begin_partition between bigint bin bin_pack binary binary_string bit bit_and bit_length bit_or bitwise_and bitwise_not bitwise_or bitwise_xor blob bool_and bool_or boolean both branch bround btrim by cache call called cardinality cascaded case cast catalog cbrt ceil ceiling change char char_length character character_length check chr classifier clob close cloud coalesce col_like collate collect column columns commit commits_older_than compute concat concat_ws condition connect constraint contains convert convert_from convert_replaceutf8 convert_timezone convert_to copy corr corresponding cos cosh cot count covar_pop covar_samp crc32 create cross cube cume_dist current current_catalog current_date current_date_utc current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cycle data databases datasets date date_add date_diff date_format date_part date_sub date_trunc datediff datetype day dayofmonth dayofweek dayofyear deallocate dec decimal declare dedupe_lookback_period default define degrees delete dense_rank deref describe deterministic dimensions disallow disconnect display distinct double drop dynamic e each element else empty empty_as_null encode end end-exec end_frame end_partition ends_with engine equals escape escape_char every except exec execute exists exp expire explain extend external extract factorial false fetch field field_delimiter file_format files filter first_value flatten float floor folder for foreign frame_row free from from_hex full function fusion geo_beyond geo_distance geo_nearby get global grant grants greatest group grouping groups hash hash64 having hex history hold hour identity if ilike imindir import in include indicator initcap initial inner inout insensitive insert instr int integer intersect intersection interval into is is_bigint is_int is_member is_substr is_utf8 is_varchar isdate isnumeric job join json_array json_arrayagg json_exists json_object json_objectagg json_query json_value lag language large last_day last_query_id last_value lateral lazy lcase lead leading least left length levenshtein like like_regex limit listagg ln local localsort localtime localtimestamp locate log log10 logs lower lpad lshift ltrim manifests map_keys map_values mask mask_first_n mask_hash mask_last_n mask_show_first_n mask_show_last_n masking match match_number match_recognize matches max max_file_size_mb maxdir md5 measures median member merge metadata method min min_file_size_mb min_input_files mindir minus minute missing mod modifies module monitor month months_between more multiset national natural nchar nclob ndv new next next_day no none normalize normalize_string not notification_provider notification_queue_reference now nth_value ntile null null_if nullif numeric nvl occurrences_regex octet_length of offset old older_than omit on one only open operate optimize or order orphan out outer over overlaps overlay ownership parameter parse_url partition partitions pattern per percent percent_rank percentile_cont percentile_disc period permute pi pivot pmod policy portion position position_regex pow power precedes precision prepare prev primary procedure project promotion qualify quarter query query_user quote quote_char radians random range rank raw reads real record_delimiter recursive ref reference references referencing reflection reflections refresh regex regexp_col_like regexp_extract regexp_like regexp_matches regexp_replace regexp_split regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxy regr_syy release remove rename repeat repeatstr replace reset result retain_last retain_last_commits retain_last_snapshots return returns reverse revoke rewrite right role rollback rollup round route row row_number rows rpad rshift rtrim running savepoint schemas scope scroll search second seek select sensitive session_user set sha sha1 sha256 sha512 show sign similar similar_to sin sinh size skip smallint snapshot snapshots snapshots_older_than some soundex specific specifictype split_part sql sqlexception sqlstate sqlwarning sqrt st_fromgeohash st_geohash start starts_with static statistics stddev stddev_pop stddev_samp stream string_binary strpos submultiset subset substr substring substring_index substring_regex succeeds sum symmetric system system_time system_user table tables tablesample tag tan tanh target_file_size_mb tblproperties then time time_format timestamp timestamp_format timestampadd timestampdiff timestamptype timezone_hour timezone_minute tinyint to to_char to_date to_hex to_number to_time to_timestamp toascii trailing transaction_timestamp translate translate_regex translation treat trigger trim trim_array trim_space true truncate typeof ucase uescape unbase64 unhex union unique unix_timestamp unknown unnest unpivot unset update upper upsert usage use user using vacuum value value_of values var_pop var_samp varbinary varchar varying versioning view views week weekofyear when whenever where width_bucket window with within without write xor year`,types:`array bigint binary boolean char character date dec decimal double float int integer interval map numeric struct time timestamp uuid varbinary varchar variant`}),Du=_n.define({charSetCasts:!0,doubleQuotedStrings:!1,unquotedBitLiterals:!0,hashComments:!1,spaceAfterDashes:!1,specialVar:`@?`,identifierQuotes:`"`,caseInsensitiveIdentifiers:!0,keywords:`percentile_cont row_number rank dense_rank rank_dense percent_rank cume_dist ntile lag lead first_value last_value nth_value !__postfix !~~ !~~* % & && * ** + - ->> / // <-> << <=> <@ >> @ @> Calendar JSON TimeZone ^ ^@ abort abs absolute access access_mode acos acosh action add add_parquet_key admin after age aggregate alias all all_profiling_output allow_community_extensions allow_extensions_metadata_mismatch allow_persistent_secrets allow_unredacted_secrets allow_unsigned_extensions allowed_directories allowed_paths also alter always analyse analyze and anti any any_value apply approx_count_distinct approx_quantile approx_top_k arbitrary arg_max arg_max_null arg_min arg_min_null argmax argmin array array_agg array_aggr array_aggregate array_append array_apply array_cat array_concat array_contains array_cosine_distance array_cosine_similarity array_cross_product array_distance array_distinct array_dot_product array_extract array_filter array_grade_up array_has array_has_all array_has_any array_indexof array_inner_product array_intersect array_length array_negative_dot_product array_negative_inner_product array_pop_back array_pop_front array_position array_prepend array_push_back array_push_front array_reduce array_resize array_reverse array_reverse_sort array_select array_slice array_sort array_to_json array_to_string array_to_string_comma_default array_transform array_unique array_value array_where array_zip arrow_large_buffer_size arrow_lossless_conversion arrow_output_list_view arrow_output_version arrow_scan arrow_scan_dumb as asc ascii asin asinh asof asof_loop_join_threshold assertion assignment asymmetric at atan atan2 atanh attach attribute authorization autoinstall_extension_repository autoinstall_known_extensions autoload_known_extensions avg backward bar base64 before begin between bigint bin binary binary_as_string bit bit_and bit_count bit_length bit_or bit_position bit_xor bitstring bitstring_agg blob bool bool_and bool_or boolean both bpchar by bytea cache call called can_cast_implicitly cardinality cascade cascaded case cast cast_to_type catalog catalog_error_max_schemas cbrt ceil ceiling centuries century chain char char_length character character_length characteristics check checkpoint checkpoint_threshold chr class close cluster coalesce col_description collate collation collations column columns combine comment comments commit committed compression concat concat_ws concurrently configuration conflict connection constant_or_null constraint constraints contains content continue conversion copy copy_database corr cos cosh cost cot count count_if count_star countif covar_pop covar_samp create create_sort_key cross csv cube current current_catalog current_connection_id current_database current_date current_localtime current_localtimestamp current_query current_query_id current_role current_schema current_schemas current_setting current_transaction_id current_user currval cursor custom_extension_repository custom_profiling_settings custom_user_agent cycle damerau_levenshtein data database database_list database_size date date_add date_diff date_part date_sub date_trunc datediff datepart datesub datetime datetrunc day dayname dayofmonth dayofweek dayofyear days deallocate debug_asof_iejoin debug_checkpoint_abort debug_force_external debug_force_no_cross_product debug_skip_checkpoint_on_commit debug_verify_vector debug_window_mode dec decade decades decimal declare decode default default_block_size default_collation default_null_order default_order default_secret_storage defaults deferrable deferred definer degrees delete delimiter delimiters depends desc describe detach dictionary disable disable_checkpoint_on_shutdown disable_logging disable_object_cache disable_optimizer disable_parquet_prefetching disable_print_progress_bar disable_profile disable_profiling disable_progress_bar disable_timestamptz_casts disable_verification disable_verify_external disable_verify_fetch_row disable_verify_parallelism disable_verify_serializer disabled_compression_methods disabled_filesystems disabled_log_types disabled_optimizers discard distinct divide do document domain double drop duckdb_api duckdb_columns duckdb_constraints duckdb_databases duckdb_dependencies duckdb_extensions duckdb_external_file_cache duckdb_functions duckdb_indexes duckdb_keywords duckdb_log_contexts duckdb_logs duckdb_logs_parsed duckdb_memory duckdb_optimizers duckdb_prepared_statements duckdb_schemas duckdb_secret_types duckdb_secrets duckdb_sequences duckdb_settings duckdb_table_sample duckdb_tables duckdb_temporary_files duckdb_types duckdb_variables duckdb_views dynamic_or_filter_threshold each editdist3 element_at else enable enable_checkpoint_on_shutdown enable_external_access enable_external_file_cache enable_fsst_vectors enable_geoparquet_conversion enable_http_logging enable_http_metadata_cache enable_logging enable_macro_dependencies enable_object_cache enable_optimizer enable_print_progress_bar enable_profile enable_profiling enable_progress_bar enable_progress_bar_print enable_verification enable_view_dependencies enabled_log_types encode encoding encrypted end ends_with entropy enum enum_code enum_first enum_last enum_range enum_range_boundary epoch epoch_ms epoch_ns epoch_us equi_width_bins era error errors_as_json escape even event except exclude excluding exclusive execute exists exp explain explain_output export export_state extension extension_directory extension_versions extensions external external_threads extract factorial false family favg fdiv fetch file_search_path filter finalize first flatten float float4 float8 floor fmod following for force force_bitpacking_mode force_checkpoint force_compression foreign format formatReadableDecimalSize formatReadableSize format_bytes format_pg_type format_type forward freeze from from_base64 from_binary from_hex from_json from_json_strict fsum full function functions gamma gcd gen_random_uuid generate_series generate_subscripts generated geomean geometric_mean get_bit get_block_size get_current_time get_current_timestamp getvariable glob global grade_up grant granted greatest greatest_common_divisor group group_concat grouping grouping_id groups guid hamming handler having header hex histogram histogram_exact histogram_values hold home_directory hour hours http_logging_output http_proxy http_proxy_password http_proxy_username hugeint identity ieee_floating_point_ops if ignore ilike ilike_escape immediate immediate_transaction_mode immutable implicit import import_database in in_search_path include including increment index index_scan_max_count index_scan_percentage indexes inet_client_addr inet_client_port inet_server_addr inet_server_port inherit inherits initially inline inner inout input insensitive insert install instead instr int int1 int128 int16 int2 int32 int4 int64 int8 integer integer_division integral intersect interval into invoker is is_histogram_other_bin isfinite isinf isnan isnull isodow isolation isoyear jaccard jaro_similarity jaro_winkler_similarity join json json_array json_array_length json_contains json_deserialize_sql json_each json_execute_serialized_sql json_exists json_extract json_extract_path json_extract_path_text json_extract_string json_group_array json_group_object json_group_structure json_keys json_merge_patch json_object json_pretty json_quote json_serialize_plan json_serialize_sql json_structure json_transform json_transform_strict json_tree json_type json_valid json_value julian kahan_sum key kurtosis kurtosis_pop label lambda lambda_syntax language large last last_day late_materialization_max_rows lateral lcase lcm leading leakproof least least_common_multiple left left_grapheme len length length_grapheme level levenshtein lgamma like like_escape limit list list_aggr list_aggregate list_any_value list_append list_apply list_approx_count_distinct list_avg list_bit_and list_bit_or list_bit_xor list_bool_and list_bool_or list_cat list_concat list_contains list_cosine_distance list_cosine_similarity list_count list_distance list_distinct list_dot_product list_element list_entropy list_extract list_filter list_first list_grade_up list_has list_has_all list_has_any list_histogram list_indexof list_inner_product list_intersect list_kurtosis list_kurtosis_pop list_last list_mad list_max list_median list_min list_mode list_negative_dot_product list_negative_inner_product list_pack list_position list_prepend list_product list_reduce list_resize list_reverse list_reverse_sort list_select list_sem list_skewness list_slice list_sort list_stddev_pop list_stddev_samp list_string_agg list_sum list_transform list_unique list_value list_var_pop list_var_samp list_where list_zip listagg listen ln load local location lock lock_configuration locked log log10 log2 log_query_path logged logging_level logging_mode logging_storage logical long lower lpad ltrim macro mad make_date make_time make_timestamp make_timestamp_ns make_timestamptz map map_concat map_contains map_contains_entry map_contains_value map_entries map_extract map_extract_value map_from_entries map_keys map_to_pg_oid map_values mapping match materialized max max_by max_expression_depth max_memory max_temp_directory_size max_vacuum_tasks maxvalue md5 md5_number md5_number_lower md5_number_upper mean median memory_limit merge_join_threshold metadata_info method microsecond microseconds millennia millennium millisecond milliseconds min min_by minute minutes minvalue mismatches mod mode month monthname months move multiply name names nanosecond national natural nchar nested_loop_join_threshold new next nextafter nextval nfc_normalize no none normalized_interval not not_ilike_escape not_like_escape nothing notify notnull now nowait null null_order nullif nulls numeric nvarchar obj_description object octet_length of off offset oid oids old old_implicit_casting on only operator option options or ord order order_by_non_integer_literal ordered_aggregate_threshold ordinality others out outer over overlaps overlay overriding owned owner pandas_analyze_sample pandas_scan parallel parquet_bloom_probe parquet_file_metadata parquet_kv_metadata parquet_metadata parquet_metadata_cache parquet_scan parquet_schema parse_dirname parse_dirpath parse_duckdb_log_message parse_filename parse_path parser partial partition partitioned partitioned_write_flush_threshold partitioned_write_max_open_files passing password percent perfect_ht_threshold persistent pi pivot pivot_filter_threshold pivot_limit pivot_longer pivot_wider placing plans platform policy position positional pow power pragma pragma_collations pragma_database_size pragma_metadata_info pragma_platform pragma_show pragma_storage_info pragma_table_info pragma_user_agent pragma_version preceding precision prefer_range_joins prefetch_all_parquet_files prefix prepare prepared preserve preserve_identifier_case preserve_insertion_order primary printf prior privileges procedural procedure produce_arrow_string_view product profile_output profiling_mode profiling_output program progress_bar_time publication python_enable_replacements python_map_function python_scan_all_frames qualify quantile quantile_cont quantile_disc quarter quarters query query_table quote radians random range read read_blob read_csv read_csv_auto read_json read_json_auto read_json_objects read_json_objects_auto read_ndjson read_ndjson_auto read_ndjson_objects read_parquet read_text real reassign recheck recursive reduce ref references referencing refresh regexp_escape regexp_extract regexp_extract_all regexp_full_match regexp_matches regexp_replace regexp_split_to_array regexp_split_to_table regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release remap_struct rename repeat repeat_row repeatable replace replica reservoir_quantile reset respect restart restrict returning returns reverse revoke right right_grapheme role rollback rollup round round_even roundbankers row row_to_json rows rpad rtrim rule sample savepoint scalar_subquery_error_on_multiple_rows scheduler_process_partial schema schemas scope scroll search search_path second seconds secret secret_directory security select sem semi seq_scan sequence sequences serializable server session session_user set set_bit setof sets setseed sha1 sha256 share shobj_description short show show_databases show_tables show_tables_expanded sign signbit signed similar simple sin sinh skewness skip smallint snapshot sniff_csv some sorted split split_part sql sqrt stable standalone start starts_with statement statistics stats stddev stddev_pop stddev_samp stdin stdout storage storage_compatibility_version storage_info stored str_split str_split_regex streaming_buffer_size strftime strict string string_agg string_split string_split_regex string_to_array strip strip_accents strlen strpos strptime struct struct_concat struct_extract struct_extract_at struct_insert struct_pack subscription substr substring substring_grapheme subtract suffix sum sum_no_overflow sumkahan summarize summary symmetric sysid system table table_info tables tablesample tablespace tan tanh temp temp_directory template temporary test_all_types test_vector_types text then threads ties time time_bucket timestamp timestamp_ms timestamp_ns timestamp_s timestamp_us timestamptz timetz timetz_byte_comparable timezone timezone_hour timezone_minute tinyint to to_base to_base64 to_binary to_centuries to_days to_decades to_hex to_hours to_json to_microseconds to_millennia to_milliseconds to_minutes to_months to_quarters to_seconds to_timestamp to_weeks to_years today trailing transaction transaction_timestamp transform translate treat trigger trim true trunc truncate truncate_duckdb_logs trusted try_cast try_strptime txid_current type typeof types ubigint ucase uhugeint uint128 uint16 uint32 uint64 uint8 uinteger unbin unbounded uncommitted unencrypted unhex unicode union union_extract union_tag union_value unique unknown unlisten unlogged unnest unpack unpivot unpivot_list until update upper url_decode url_encode use user user_agent username using usmallint utinyint uuid uuid_extract_timestamp uuid_extract_version uuidv4 uuidv7 vacuum valid validate validator value values var_pop var_samp varbinary varchar variable variadic variance varint varying vector_type verbose verify_external verify_fetch_row verify_parallelism verify_serializer version view views virtual volatile wal_autocheckpoint wavg week weekday weekofyear weeks weighted_avg when where which_secret whitespace window with within without work worker_threads wrapper write write_log xml xmlattributes xmlconcat xmlelement xmlexists xmlforest xmlnamespaces xmlparse xmlpi xmlroot xmlserialize xmltable xor year years yearweek yes zone zstd_min_string_length | || ~ ~~ ~~* ~~~`,types:`JSON bigint binary bit bitstring blob bool boolean bpchar bytea char date datetime dec decimal double enum float float4 float8 guid hugeint int int1 int128 int16 int2 int32 int4 int64 int8 integer integral interval list logical long map null numeric nvarchar oid real row short signed smallint string struct text time timestamp timestamp_ms timestamp_ns timestamp_s timestamp_us timestamptz timetz tinyint ubigint uhugeint uint128 uint16 uint32 uint64 uint8 uinteger union usmallint utinyint uuid varbinary varchar varint`}),Ou=new Set(`postgresql.postgres.couchbase.db2.db2i.tidb.mysql.sqlite.mssql.sqlserver.duckdb.mariadb.cassandra.noql.spark.awsathena.athena.bigquery.hive.redshift.snowflake.flink.mongodb.trino.oracle.oracledb.singlestoredb.timescaledb.databricks.datafusion.microsoft sql server.dremio`.split(`.`));function ku(e){return Ou.has(e)}function Au(e){let t=e.dialect;if(!ku(t))return T.debug(`Unknown dialect`,{dialect:t}),Mu;switch(t){case`postgresql`:case`postgres`:return hn;case`mysql`:return fn;case`sqlite`:return ln;case`mssql`:case`sqlserver`:case`microsoft sql server`:return mn;case`duckdb`:return Du;case`mariadb`:return gn;case`cassandra`:return vn;case`oracledb`:case`oracle`:return cn;case`bigquery`:return Tu;case`dremio`:return Eu;case`timescaledb`:return hn;case`awsathena`:case`athena`:case`db2i`:case`db2`:case`hive`:case`redshift`:case`snowflake`:case`flink`:case`mongodb`:case`noql`:case`couchbase`:case`trino`:case`tidb`:case`singlestoredb`:case`spark`:case`databricks`:case`datafusion`:return T.debug(`Unsupported dialect`,{dialect:t}),Mu;default:return rn(t),Mu}}var ju={...pn,caseInsensitiveIdentifiers:!0,identifierQuotes:`'`},Mu=_n.define(ju),Nu=`__marimo_duckdb`,Pu=new Set([Nu]);function Fu(e,t){if(!e)return t;let n=(e.schemaPath?.length?e.schemaPath:[e.schema]).filter(Boolean);return[e.database,...n,t].join(`.`)}function Iu(e){return e===``}function Lu(e){return e.schemas_resolved!==!1}function Ru(e){return e.tables_resolved!==!1}function zu(e){return e.child_schemas_resolved!==!1}function Bu(e,t){let n=t?.trim().toLowerCase();return n?Ru(e)&&e.tables.some(e=>e.name.toLowerCase().includes(n))?!0:zu(e)?(e.child_schemas??[]).some(e=>Bu(e,n)):!1:!1}function Vu(e,t){return!t?.trim()||!Lu(e)?!1:e.schemas.some(e=>Bu(e,t))}var Hu={formatTablePath:e=>e.join(`.`),formatSelectClause:(e,t)=>`SELECT ${e} FROM ${t} LIMIT 100`};function Uu(e){if(e=e.toLowerCase(),!ku(e))return Hu;switch(e){case`bigquery`:{let e=Tu.spec.identifierQuotes;return{formatTablePath:t=>`${e}${t.join(`.`)}${e}`,formatSelectClause:Hu.formatSelectClause}}case`mssql`:case`sqlserver`:case`microsoft sql server`:return{formatTablePath:Hu.formatTablePath,formatSelectClause:(e,t)=>`SELECT TOP 100 ${e} FROM ${t}`};case`timescaledb`:case`postgres`:case`postgresql`:case`duckdb`:case`dremio`:return{formatTablePath:e=>e.map(e=>`"${e}"`).join(`.`),formatSelectClause:(e,t)=>`SELECT ${e===`*`?`*`:`"${e}"`} FROM ${t} LIMIT 100`};case`db2`:case`db2i`:case`mysql`:case`sqlite`:case`mariadb`:case`cassandra`:case`noql`:case`awsathena`:case`athena`:case`hive`:case`redshift`:case`snowflake`:case`flink`:case`mongodb`:case`oracle`:case`oracledb`:case`couchbase`:case`tidb`:case`spark`:case`trino`:case`singlestoredb`:case`databricks`:case`datafusion`:return Hu;default:return rn(e),Hu}}function Wu({table:e,columnName:t,sqlTableContext:n}){if(n){let{engine:r,schema:i,defaultSchema:a,defaultDatabase:o,database:s,dialect:c}=n,l=[e.name];Iu(i)||i!==a&&l.unshift(i),s!==o&&l.unshift(s);let u=Uu(c),d=u.formatTablePath(l),f=u.formatSelectClause(t,d);return r===`__marimo_duckdb`?`_df = mo.sql(f"""\n${f}\n""")`:`_df = mo.sql(f"""\n${f}\n""", engine=${r})`}return`_df = mo.sql(f'SELECT "${t}" FROM ${e.name} LIMIT 100')`}function Gu(e,t){if(t===`date`||t===`datetime`||t===`time`){if(e===`min`)return`Earliest`;if(e===`max`)return`Latest`}return e}function Ku(){return{tables:[],expandedTables:new Set,expandedColumns:new Set,columnsPreviews:new Map}}var{reducer:qu,createActions:Ju,valueAtom:Yu,useActions:Xu}=Jt(Ku,{addDatasets:(e,t)=>{let{previewDatasetColumn:n}=sn();for(let r of t.tables)for(let t of r.columns){let i=`${r.name}:${t.name}`;e.expandedColumns.has(i)&&n({tableName:r.name,columnName:t.name,source:r.source,sourceType:r.source_type})}let r=e.tables;t.clear_channel&&(r=r.filter(e=>e.source!==t.clear_channel));let i=[...t.tables,...r],a=new Set,o=i.filter(e=>{let t=`${e.name}:${e.source}`;return!a.has(t)&&(a.add(t),!0)}).toSorted((e,t)=>e.name.localeCompare(t.name));return{...e,tables:o}},filterDatasetsFromVariables:(e,t)=>{let n=new Set(t),r=e.tables.filter(e=>!e.variable_name||n.has(e.variable_name));return{...e,tables:r}},toggleTable:(e,t)=>{let n=new Set(e.expandedTables);return n.has(t)?n.delete(t):n.add(t),{...e,expandedTables:n}},toggleColumn:(e,t)=>{let n=`${t.table}:${t.column}`,r=new Set(e.expandedColumns);return r.has(n)?r.delete(n):r.add(n),{...e,expandedColumns:r}},closeAllColumns:e=>({...e,expandedColumns:new Set}),addColumnPreview:(e,t)=>{let n=`${t.table_name}:${t.column_name}`,r=new Map(e.columnsPreviews);return r.set(n,t),{...e,columnsPreviews:r}}}),Zu=()=>s(Yu),Qu=o(e=>e(Yu).tables),$u=o(new Set),ed=o(!1);function td(){return Xu()}var nd=new Map([[Nu,{name:Nu,dialect:`duckdb`,source:`duckdb`,display_name:`DuckDB (In-Memory)`,databases:[]}]]);function rd(e,t,n){if(t.length===0)return e;let[r,...i]=t;return e.map(e=>e.name===r?i.length===0?n(e):{...e,child_schemas:rd(e.child_schemas??[],i,n)}:e)}function id(e){let{schemaPath:t,schema:n}=e;return t&&t.length>0?t:[n]}function ad(){return{latestEngineSelected:Nu,connectionsMap:nd}}var{reducer:od,createActions:sd,valueAtom:cd,useActions:ld}=Jt(ad,{addDataSourceConnection:(e,t)=>{if(t.connections.length===0)return e;let{latestEngineSelected:n,connectionsMap:r}=e,i=new Map(r);for(let e of t.connections)i.set(e.name,e);return{latestEngineSelected:n,connectionsMap:i}},filterDataSourcesFromVariables:(e,t)=>{let{latestEngineSelected:n,connectionsMap:r}=e,i=new Set(t),a=new Map([...r].filter(([e])=>Pu.has(e)?!0:i.has(e)));return{latestEngineSelected:a.has(n)?n:Nu,connectionsMap:a}},clearDataSourceConnections:()=>({latestEngineSelected:Nu,connectionsMap:new Map}),removeDataSourceConnection:(e,t)=>{let{latestEngineSelected:n,connectionsMap:r}=e,i=new Map(r);return i.delete(t),{latestEngineSelected:i.has(n)?n:Nu,connectionsMap:i}},addSchemaList:(e,t)=>{let{schemas:n,sqlSchemaContext:r}=t,{connectionsMap:i,latestEngineSelected:a}=e,o=r.engine,s=i.get(o);if(!s)return e;let c=r.schemaPath??[],l=new Map(i),u={...s,databases:s.databases.map(e=>e.name===r.database?c.length===0?{...e,schemas:n,schemas_resolved:!0}:{...e,schemas:rd(e.schemas,c,e=>({...e,child_schemas:n,child_schemas_resolved:!0}))}:e)};return l.set(o,u),{latestEngineSelected:a,connectionsMap:l}},addTableList:(e,t)=>{let{tables:n,sqlTableContext:r}=t,{connectionsMap:i,latestEngineSelected:a}=e,o=r.engine,s=i.get(o);if(!s)return e;let c=id(r),l=new Map(i),u={...s,databases:s.databases.map(e=>e.name===r.database?{...e,schemas:rd(e.schemas,c,e=>({...e,tables:n,tables_resolved:!0}))}:e)};return l.set(o,u),{latestEngineSelected:a,connectionsMap:l}},addTable:(e,t)=>{let{table:n,sqlTableContext:r}=t,{connectionsMap:i,latestEngineSelected:a}=e,o=r.engine,s=n.name,c=i.get(o);if(!c)return e;let l=id(r),u=new Map(i),d={...c,databases:c.databases.map(e=>e.name===r.database?{...e,schemas:rd(e.schemas,l,e=>{let t=e.tables.length===0?[n]:e.tables.map(e=>e.name===s?n:e);return{...e,tables:t}})}:e)};return u.set(o,d),{latestEngineSelected:a,connectionsMap:u}}}),ud=o(e=>e(cd).connectionsMap),dd=o(e=>{let t=new Map(e(ud));for(let e of Pu){let n=t.get(e);n&&(n.databases.length===0&&t.delete(e),n.databases.length===1&&n.databases[0].name===`memory`&&n.databases[0].schemas.length===0&&t.delete(e))}return Vt([...t.values()],e=>+!!Pu.has(e.name))});function fd(e){let t=u.get(cd);t.connectionsMap.has(e)&&u.set(cd,{...t,latestEngineSelected:e})}var pd=o(e=>{let t=u.get(Qu),n=e(cd).connectionsMap,r=new Map;for(let e of t)r.set(e.name,e);for(let e of n.values())for(let t of e.databases){let n=t.name===e.default_database||e.databases.length===1,i=(a,o)=>{let s=o.length===0,c=o.length===1&&o[0]===e.default_schema,l=o.join(`.`);for(let e of a.tables){let i;if(i=e.name,s){i=n?e.name:`${t.name}.${e.name}`,r.has(i)?T.warn(`Table name collision for ${i}. Skipping.`):r.set(i,e);continue}if(n&&c&&!r.has(i)){r.set(i,e);continue}if(i=`${l}.${e.name}`,n&&!r.has(i)){r.set(i,e);continue}i=`${t.name}.${l}.${e.name}`,r.has(i)?T.warn(`Table name collision for ${i}. Skipping.`):r.set(i,e)}for(let e of a.child_schemas??[])i(e,[...o,e.name])};for(let e of t.schemas)i(e,Iu(e.name)?[]:[e.name])}return r});function md(e){return e.variable_name?`dataframe`:`table`}var hd=class{maxSize;cache=new Map;options;constructor(e,t={}){this.maxSize=e,this.options=t}getOrCreate(e){O(this.options.create,`create function is required`);let t=this.cache.get(e);if(t!==void 0)return t;let n=this.options.create(e);return this.cache.set(e,n),n}get(e){let t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e)&&this.cache.delete(e),this.cache.set(e,t),this.cache.size>this.maxSize){let e=this.cache.keys().next().value;e!==void 0&&this.cache.delete(e)}}keys(){return this.cache.keys()}values(){return this.cache.values()}entries(){return this.cache.entries()}delete(e){this.cache.delete(e)}},gd=bn(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),_d=bn(`book-marked`,[[`path`,{d:`M10 2v8l3-3 3 3V2`,key:`sqw3rj`}],[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}]]),vd=bn(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),yd=bn(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),bd=bn(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),xd=bn(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),X=bn(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Sd=bn(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Cd=bn(`clock`,[[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),wd=bn(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),Td=bn(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),Ed=bn(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Dd=bn(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Od=bn(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),kd=bn(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Ad=bn(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),jd=bn(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Md=bn(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Nd=bn(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),Pd=bn(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Fd=bn(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Id=bn(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]),Ld=bn(`paint-roller`,[[`rect`,{width:`16`,height:`6`,x:`2`,y:`2`,rx:`2`,key:`jcyz7m`}],[`path`,{d:`M10 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2`,key:`1b9h7c`}],[`rect`,{width:`4`,height:`6`,x:`8`,y:`16`,rx:`1`,key:`d6e7yl`}]]),Rd=bn(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),zd=bn(`search-check`,[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),Bd=bn(`square-dashed-bottom-code`,[[`path`,{d:`M10 9.5 8 12l2 2.5`,key:`3mjy60`}],[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`m14 9.5 2 2.5-2 2.5`,key:`1bir2l`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2`,key:`as5y1o`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}]]),Vd=bn(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Hd=bn(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),Ud=bn(`text-search`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M10 12H3`,key:`1ulcyk`}],[`path`,{d:`M10 19H3`,key:`108z41`}],[`circle`,{cx:`17`,cy:`15`,r:`3`,key:`1upz2a`}],[`path`,{d:`m21 19-1.9-1.9`,key:`dwi7p8`}]]),Wd=bn(`variable`,[[`path`,{d:`M8 21s-4-3-4-9 4-9 4-9`,key:`uto9ud`}],[`path`,{d:`M16 3s4 3 4 9-4 9-4 9`,key:`4w2vsq`}],[`line`,{x1:`15`,x2:`9`,y1:`9`,y2:`15`,key:`f7djnv`}],[`line`,{x1:`9`,x2:`15`,y1:`9`,y2:`15`,key:`1shsy8`}]]);function Gd(e){switch(e){case`duckdb`:return`DuckDB`;case`motherduck`:return`MotherDuck`;case`sqlite`:return`SQLite`;case`postgres`:case`postgresql`:return`PostgreSQL`;case`mysql`:return`MySQL`;case`mariadb`:return`MariaDB`;case`mssql`:case`microsoft sql server`:return`Microsoft SQL Server`;case`oracle`:return`Oracle`;case`redshift`:return`Amazon Redshift`;case`snowflake`:return`Snowflake`;case`bigquery`:return`Google BigQuery`;case`clickhouse`:return`ClickHouse`;case`timeplus`:return`Timeplus`;case`databricks`:return`Databricks`;case`db2`:return`IBM Db2`;case`hive`:return`Apache Hive`;case`impala`:return`Apache Impala`;case`presto`:return`Presto`;case`trino`:return`Trino`;case`cockroachdb`:return`CockroachDB`;case`timescaledb`:return`TimescaleDB`;case`singlestore`:return`SingleStore`;case`cassandra`:return`Apache Cassandra`;case`mongodb`:return`MongoDB`;case`iceberg`:return`Apache Iceberg`;case`dremio`:return`Dremio`;default:return e}}function Kd(e){let[t,n]=e.split(` `);return n?`${Gd(t)} ${n}`:Gd(e)}var qd={boolean:Sn,date:Cn,time:Cd,datetime:xd,temporal:xd,number:xn,string:wn,integer:xn,geometry:Nd,unknown:bd};function Jd(e){return Object.hasOwn(qd,e)?e:`unknown`}function Yd(e){switch(e){case`boolean`:return`bg-(--orange-4)`;case`date`:case`time`:case`datetime`:case`temporal`:return`bg-(--grass-4) dark:bg-(--grass-5)`;case`number`:case`integer`:return`bg-(--purple-4)`;case`string`:return`bg-(--blue-4)`;case`geometry`:return`bg-(--cyan-4) dark:bg-(--cyan-5)`;case`unknown`:return`bg-(--slate-4) dark:bg-(--slate-6)`;default:return rn(e),`bg-(--slate-4) dark:bg-(--slate-6)`}}var Xd=class{singular;_plural;constructor(e,t){this.singular=e,this._plural=t}pluralize(e){return e===1?this.singular:this.plural}get plural(){return this._plural??`${this.singular}s`}},Zd=class e{words;constructor(e){this.words=e}static of(...t){return new e(t.map(e=>typeof e==`string`?new Xd(e):e))}join(e,t){return this.words.map(e=>e.pluralize(t)).join(e)}},Qd=x(),$d=5,ef={boolean:`bg-(--orange-4) text-(--orange-11)`,date:`bg-(--grass-4) text-(--grass-11)`,time:`bg-(--grass-4) text-(--grass-11)`,datetime:`bg-(--grass-4) text-(--grass-11)`,number:`bg-(--purple-4) text-(--purple-11)`,integer:`bg-(--purple-4) text-(--purple-11)`,string:`bg-(--blue-4) text-(--blue-11)`,geometry:`bg-(--cyan-4) text-(--cyan-11)`,unknown:`bg-(--slate-4) text-(--slate-11)`},tf={local:`bg-(--blue-4) text-(--blue-11)`,duckdb:`bg-(--amber-4) text-(--amber-11)`,connection:`bg-(--green-4) text-(--green-11)`,catalog:`bg-(--purple-4) text-(--purple-11)`},nf=`p-3 min-w-[250px] flex flex-col divide-y`,rf=new Xd(`column`,`columns`),af=new Xd(`row`,`rows`),of=new Xd(`schema`,`schemas`),sf=new Xd(`table`,`tables`),cf=new Xd(`database`,`databases`),lf=e=>{let t=(0,Qd.c)(6),{icon:n,title:r,badge:i}=e,a;t[0]===r?a=t[1]:(a=(0,W.jsx)(`h3`,{className:`font-semibold text-sm`,children:r}),t[0]=r,t[1]=a);let o;return t[2]!==i||t[3]!==n||t[4]!==a?(o=(0,W.jsxs)(`div`,{className:`flex items-center gap-2 pb-2`,children:[n,a,i]}),t[2]=i,t[3]=n,t[4]=a,t[5]=o):o=t[5],o},uf=e=>{let t=(0,Qd.c)(5),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,W.jsxs)(`span`,{className:`text-(--slate-11)`,children:[n,`:`]}),t[0]=n,t[1]=i);let a;return t[2]!==i||t[3]!==r?(a=(0,W.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[i,r]}),t[2]=i,t[3]=r,t[4]=a):a=t[4],a},df=e=>{let t=(0,Qd.c)(5),{icon:n,text:r}=e,i;t[0]===r?i=t[1]:(i=(0,W.jsx)(`span`,{className:`text-xs text-(--slate-11)`,children:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[n,i]}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},ff=e=>{let t=(0,Qd.c)(15),{title:n,items:r,totalCount:i,limit:a}=e,o=n===void 0?``:n,s=a===void 0?$d:a;if(r.length===0)return null;let c;t[0]!==r||t[1]!==s?(c=r.slice(0,s),t[0]=r,t[1]=s,t[2]=c):c=t[2];let l=c,u=i>s,d;t[3]===o?d=t[4]:(d=o&&(0,W.jsxs)(`h4`,{className:`text-xs font-medium text-(--slate-11) mb-2`,children:[o,`:`]}),t[3]=o,t[4]=d);let f;t[5]!==u||t[6]!==s||t[7]!==i?(f=u&&(0,W.jsxs)(`div`,{className:`text-xs text-(--slate-10) text-center py-1`,children:[`... and `,i-s,` more`]}),t[5]=u,t[6]=s,t[7]=i,t[8]=f):f=t[8];let p;t[9]!==f||t[10]!==l?(p=(0,W.jsxs)(`div`,{className:`flex flex-col gap-1 overflow-y-auto`,children:[l,f]}),t[9]=f,t[10]=l,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==p?(m=(0,W.jsxs)(`div`,{className:`py-2`,children:[d,p]}),t[12]=d,t[13]=p,t[14]=m):m=t[14],m},pf=e=>ef[e]||ef.unknown,mf=e=>{let t=e.type===`view`?(0,W.jsx)(Dd,{className:`w-4 h-4 text-(--blue-9)`}):(0,W.jsx)(Hd,{className:`w-4 h-4 text-(--green-9)`}),n=(0,W.jsx)(Nn,{variant:`secondary`,className:`text-xs ${e.type===`view`?`bg-(--blue-4) text-(--blue-11)`:`bg-(--green-4) text-(--green-11)`}`,children:e.type}),r=e.columns.map(e=>{let t=qd[Jd(e.type)];return(0,W.jsxs)(`div`,{className:`flex items-center justify-between text-xs rounded`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(t,{className:`w-3 h-3 text-(--slate-9)`}),(0,W.jsx)(`span`,{className:`font-mono`,children:e.name})]}),(0,W.jsx)(Nn,{variant:`outline`,className:`text-xs ${pf(e.type)}`,children:e.type})]},e.name)}),i=e.primary_keys&&e.primary_keys.length>0,a=e.indexes&&e.indexes.length>0;return(0,W.jsxs)(`div`,{className:`${nf} min-w-[300px]`,children:[(0,W.jsx)(lf,{icon:t,title:e.name,badge:n}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,W.jsx)(uf,{label:`Source`,value:(0,W.jsx)(Nn,{variant:`outline`,className:`text-xs ${tf[e.source_type]}`,children:e.source})}),e.variable_name&&(0,W.jsx)(uf,{label:`Variable`,value:(0,W.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:e.variable_name})}),e.engine&&(0,W.jsx)(uf,{label:`Engine`,value:(0,W.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:e.engine})})]}),(e.num_columns!=null||e.num_rows!=null)&&(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 py-2`,children:[e.num_columns!=null&&(0,W.jsx)(df,{icon:(0,W.jsx)(Td,{className:`w-3 h-3 text-(--slate-9)`}),text:`${e.num_columns} ${rf.pluralize(e.num_columns)}`}),e.num_rows!=null&&(0,W.jsx)(df,{icon:(0,W.jsx)(xn,{className:`w-3 h-3 text-(--slate-9)`}),text:`${e.num_rows} ${af.pluralize(e.num_rows)}`})]}),e.columns.length===0&&Sf(`column`),(i||a)&&(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[i&&(0,W.jsxs)(`div`,{className:`flex flex-row gap-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,W.jsx)(jn,{className:`w-3 h-3 text-(--amber-9)`}),(0,W.jsx)(`span`,{className:`text-xs font-medium text-(--slate-11)`,children:`Primary Keys:`})]}),e.primary_keys?.map(e=>(0,W.jsx)(Nn,{variant:`outline`,className:`text-xs text-(--slate-11)`,children:e},e))]}),a&&(0,W.jsxs)(`div`,{className:`flex flex-row gap-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1 mb-1`,children:[(0,W.jsx)(_d,{className:`w-3 h-3 text-(--purple-9)`}),(0,W.jsx)(`span`,{className:`text-xs font-medium text-(--slate-11)`,children:`Indexes:`})]}),e.indexes?.map(e=>(0,W.jsx)(Nn,{variant:`outline`,className:`text-xs text-(--slate-11)`,children:e},e))]})]}),e.columns.length>0&&(0,W.jsx)(ff,{items:r,totalCount:e.columns.length})]})},hf=e=>{let t=qd[Jd(e.type)],n=(0,W.jsx)(Nn,{variant:`outline`,className:`text-xs ${pf(e.type)}`,children:e.type}),r=e.sample_values?.map((e,t)=>(0,W.jsx)(`div`,{className:`text-xs bg-(--slate-3) rounded font-mono`,children:e==null?`null`:String(e)},t))||[];return(0,W.jsxs)(`div`,{className:nf,children:[(0,W.jsx)(lf,{icon:(0,W.jsx)(t,{className:`w-4 h-4 text-(--slate-9)`}),title:e.name,badge:n}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 mt-2`,children:[(0,W.jsx)(uf,{label:`Type`,value:(0,W.jsx)(`span`,{className:`font-medium`,children:e.type})}),(0,W.jsx)(uf,{label:`External Type`,value:(0,W.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:e.external_type})})]}),e.sample_values&&e.sample_values.length>0&&(0,W.jsx)(ff,{title:`Sample Values`,items:r,totalCount:e.sample_values.length})]})},gf=e=>{let t=(0,W.jsx)(Nn,{variant:`outline`,className:`text-xs bg-(--blue-4) text-(--blue-11)`,children:e.dialect}),n=e.schemas.map(e=>(0,W.jsxs)(`div`,{className:`flex items-center justify-between text-xs rounded hover:bg-(--slate-3)`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(Md,{className:`w-3 h-3 text-(--slate-9)`}),(0,W.jsx)(`span`,{children:e.name})]}),(0,W.jsxs)(Nn,{variant:`outline`,className:`text-xs`,children:[e.tables.length,` `,sf.pluralize(e.tables.length)]})]},e.name));return(0,W.jsxs)(`div`,{className:nf,children:[(0,W.jsx)(lf,{icon:(0,W.jsx)(Ed,{className:`w-4 h-4 text-(--blue-9)`}),title:e.name,badge:t}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,W.jsx)(uf,{label:`Dialect`,value:(0,W.jsx)(`span`,{className:`font-medium`,children:e.dialect})}),e.engine&&(0,W.jsx)(uf,{label:`Engine`,value:(0,W.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:e.engine})})]}),(0,W.jsx)(`div`,{className:`py-2`,children:(0,W.jsx)(df,{icon:(0,W.jsx)(Md,{className:`w-3 h-3 text-(--slate-9)`}),text:`${e.schemas.length} schema${e.schemas.length===1?``:`s`}`})}),e.schemas.length===0&&Sf(`schema`),e.schemas.length>0&&(0,W.jsx)(ff,{title:`Schemas`,items:n,totalCount:e.schemas.length})]})},_f=e=>{let t=(0,W.jsx)(Nn,{variant:`outline`,className:`text-xs bg-(--green-4) text-(--green-11)`,children:`Schema`}),n=e.tables.map(e=>(0,W.jsxs)(`div`,{className:`flex items-center justify-between text-xs rounded hover:bg-(--slate-3)`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.type===`view`?(0,W.jsx)(Dd,{className:`w-3 h-3 text-(--blue-9)`}):(0,W.jsx)(Hd,{className:`w-3 h-3 text-(--green-9)`}),(0,W.jsx)(`span`,{children:e.name})]}),(0,W.jsx)(Nn,{variant:`outline`,className:`text-xs ${e.type===`view`?`bg-(--blue-4) text-(--blue-11)`:`bg-(--green-4) text-(--green-11)`}`,children:e.type})]},e.name));return(0,W.jsxs)(`div`,{className:nf,children:[(0,W.jsx)(lf,{icon:(0,W.jsx)(Md,{className:`w-4 h-4 text-(--green-9)`}),title:e.name,badge:t}),(0,W.jsx)(`div`,{className:`py-2`,children:(0,W.jsx)(df,{icon:(0,W.jsx)(Hd,{className:`w-3 h-3 text-(--slate-9)`}),text:`${e.tables.length} table${e.tables.length===1?``:`s`}`})}),e.tables.length===0&&Sf(`table`),e.tables.length>0&&(0,W.jsx)(ff,{title:`Tables`,items:n,totalCount:e.tables.length})]})},vf=(0,W.jsx)(Nn,{variant:`outline`,children:`default`}),yf=8,bf=3,xf=(e,t)=>{let n=e.databases.length,r=e.databases.reduce((e,t)=>e+t.schemas.length,0),i=(t,n)=>{if(t.tables.length===0)return null;let i=t.name===e.default_schema&&n,a=[];return r<yf&&(a=t.tables.slice(0,4).map(e=>(0,W.jsxs)(`div`,{className:`flex items-center gap-2 ml-4`,children:[(0,W.jsx)(Hd,{className:`w-3 h-3 text-(--green-9)`}),(0,W.jsx)(`span`,{className:`text-xs`,children:e.name})]},e.name))),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-xs rounded hover:bg-(--slate-3) ml-2`,children:[(0,W.jsx)(Md,{className:`w-3 h-3 text-(--slate-9)`}),(0,W.jsx)(`span`,{children:t.name}),i&&vf,(0,W.jsxs)(Nn,{variant:`outline`,className:`text-xs ml-auto`,children:[t.tables.length,` tables`]})]}),(0,W.jsx)(ff,{items:a,totalCount:t.tables.length,limit:bf})]},t.name)},a=e.databases.map(t=>{let n=t.name===e.default_database||e.databases.length===1,r=t.schemas.map(e=>i(e,n));return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(Ed,{className:`w-3 h-3 text-(--blue-9)`}),(0,W.jsx)(`span`,{className:`text-xs`,children:t.name}),n&&vf]}),r&&(0,W.jsx)(ff,{items:r,totalCount:t.schemas.length})]},t.name)}),o=e.name;Pu.has(e.name)&&(o=`In-Memory`);let s=t?.map(e=>(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(Hd,{className:`w-3 h-3 text-(--blue-9)`}),(0,W.jsx)(`span`,{className:`text-xs`,children:e.name})]},e.name));return(0,W.jsxs)(`div`,{className:`${nf} px-1`,children:[(0,W.jsx)(lf,{icon:(0,W.jsx)(wd,{className:`w-4 h-4 text-(--purple-9)`}),title:o}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,W.jsx)(uf,{label:`Dialect`,value:(0,W.jsx)(`span`,{className:`font-medium`,children:Gd(e.dialect)})}),(0,W.jsx)(uf,{label:`Source`,value:(0,W.jsx)(Nn,{variant:`outline`,className:`text-xs bg-(--green-4) text-(--green-11)`,children:e.source})})]}),(0,W.jsxs)(`div`,{className:`flex flex-row justify-between py-2`,children:[(0,W.jsx)(df,{icon:(0,W.jsx)(Ed,{className:`w-3 h-3 text-(--slate-9)`}),text:`${n} ${cf.pluralize(n)}`}),(0,W.jsx)(df,{icon:(0,W.jsx)(Md,{className:`w-3 h-3 text-(--slate-9)`}),text:`${r} ${of.pluralize(r)}`})]}),n>0&&(0,W.jsx)(ff,{items:a,totalCount:n}),s&&s.length>0&&(0,W.jsx)(ff,{title:`Dataframes`,items:s,totalCount:s.length})]})},Sf=e=>(0,W.jsxs)(`div`,{className:`flex items-start gap-2 mt-3`,children:[(0,W.jsx)(Ad,{size:10,className:`mt-1 text-(--slate-10) shrink-0`}),(0,W.jsxs)(`span`,{className:`text-xs text-(--slate-11)`,children:[`No `,e,` information available.`,`
|
|
42
|
-
`,(0,W.jsx)(`span`,{className:`text-(--blue-10)`,children:`Introspect to see more details.`})]})]}),Cf=e(Yn(),1),wf=class{schema={};addTable(e,t){let n={self:Ef({table:t}),children:t.columns.map(e=>Tf({column:e}))};return this.setAt([...e,t.name],n),this}addSchema(e,t){let n={self:Df({namespace:t,path:e}),children:{}};return this.setAt(e,n),this}addDatabase(e,t){let n={self:Of({namespace:t,path:e}),children:{}};return this.setAt(e,n),this}setAt(e,t){let n=this.schema;for(let t of e.slice(0,-1))n[t]||(n[t]={children:{}}),n=n[t].children;n[e[e.length-1]]=t}build(){return this.schema}reset(){return this.schema={},this}};function Tf(e){return{label:e.column.name,type:`column`,info:()=>{let t=document.createElement(`div`);return(0,Cf.createRoot)(t).render(hf(e.column)),{dom:t}}}}function Ef(e){return{label:e.table.name,type:`table`,info:()=>{let t=document.createElement(`div`);return(0,Cf.createRoot)(t).render(mf(e.table)),{dom:t}}}}function Df(e){return{label:e.namespace.name,detail:e.path.join(`.`),type:`schema`,info:()=>{let t=document.createElement(`div`);return(0,Cf.createRoot)(t).render(_f(e.namespace)),{dom:t}}}}function Of(e){return{label:e.namespace.name,detail:e.path.join(`.`),type:`database`,info:()=>{let t=document.createElement(`div`);return(0,Cf.createRoot)(t).render(gf(e.namespace)),{dom:t}}}}var kf=o(e=>{let t=e(Qu),n=new wf;for(let e of t)n.addTable([],e);return n.build()}),Af=class{cache;constructor(){this.cache=new hd(10,{create:e=>this.getConnectionSchema(e)})}getConnection(e){return u.get(ud).get(e)}getConnectionSchema(e){let{default_database:t,databases:n,default_schema:r}=e,i=new wf,a=n.find(e=>e.name===t||n.length===1);if((a??n[0])?.schemas.some(e=>Iu(e.name))??!1){for(let e of n){let t=e.name===a?.name,n=e.schemas.flatMap(e=>e.tables);i.addDatabase([e.name],e);for(let r of n)t?i.addTable([],r):i.addTable([e.name],r)}return{shouldAddLocalTables:!1,schema:i.build(),defaultSchema:a?.name}}if(a)for(let e of a.schemas){i.addSchema([e.name],e);for(let t of e.tables)i.addTable([e.name],t)}for(let e of n){i.addDatabase([e.name],e);for(let t of e.schemas){i.addSchema([e.name,t.name],t);for(let n of t.tables)i.addTable([e.name,t.name],n)}}return{shouldAddLocalTables:!0,schema:i.build(),defaultSchema:r??(a?.schemas.length===1?a.schemas[0]?.name:void 0)}}getInternalDialect(e){let t=this.getConnection(e);return t?t.dialect.toLowerCase():null}getDialect(e){let t=this.getConnection(e);return t?Au(t):Mu}getCompletionSource(e){let t=this.getConnection(e);if(!t)return null;let n=()=>u.get(kf),r=this.cache.getOrCreate(t);return{dialect:Au(t),schema:r.shouldAddLocalTables?{...r.schema,...n()}:r.schema,defaultSchema:r.defaultSchema,defaultTable:jf(t)}}};function jf(e){if(e.databases.length!==1)return;let t=e.databases[0];if(t.schemas.length!==1)return;let n=t.schemas[0];if(n.tables.length===1)return n.tables[0].name}var Mf=new Af,Nf=$e.define();async function Pf(e){let{sendFormat:t}=sn(),n=D.mapValues(e,e=>UC(e)),r=await t({codes:n,lineLength:te().formatting.line_length});for(let[t,i]of D.entries(r.codes)){let r=t,a=n[r],o=e[r];o&&i!==a&&(o.state.facet(Su).updateCellCode({cellId:r,code:i,formattingChange:!0}),WC(o,i))}}function Ff(){return Pf(uu(iE()))}async function If(e,t){let{formatDialect:n}=await H(async()=>{let{formatDialect:e}=await import(`./esm-ChMklRTi.js`);return{formatDialect:e}},__vite__mapDeps([0,1]),import.meta.url),r=await Lf(Mf.getInternalDialect(t)),i=e.state.field(FC),a=Ne(e.state);if(i.type!==`sql`){T.error(`Language adapter is not SQL`);return}let o=e.state.doc.toString(),s;try{s=n(o,{dialect:r,tabWidth:a,useTabs:!1})}catch(e){T.error(`Error formatting SQL`,{error:e});return}let c=i.transformIn(s)[0],l=e.state.facet(Su),u=e.state.facet($l);l.updateCellCode({cellId:u,code:c,formattingChange:!0}),Jl(e,s,{effects:[Nf.of(!0)]})}async function Lf(e){let{bigquery:t,db2:n,db2i:r,duckdb:i,hive:a,mariadb:o,mysql:s,tidb:c,n1ql:l,plsql:u,postgresql:d,redshift:f,spark:p,sqlite:m,sql:h,trino:g,transactsql:_,singlestoredb:v,snowflake:y}=await H(async()=>{let{bigquery:e,db2:t,db2i:n,duckdb:r,hive:i,mariadb:a,mysql:o,tidb:s,n1ql:c,plsql:l,postgresql:u,redshift:d,spark:f,sqlite:p,sql:m,trino:h,transactsql:g,singlestoredb:_,snowflake:v}=await import(`./esm-ChMklRTi.js`);return{bigquery:e,db2:t,db2i:n,duckdb:r,hive:i,mariadb:a,mysql:o,tidb:s,n1ql:c,plsql:l,postgresql:u,redshift:d,spark:f,sqlite:p,sql:m,trino:h,transactsql:g,singlestoredb:_,snowflake:v}},__vite__mapDeps([0,1]),import.meta.url),b=h;if(!e||!ku(e))return b;switch(e){case`mysql`:return s;case`mariadb`:return o;case`postgres`:case`postgresql`:return d;case`sqlite`:return m;case`db2`:return n;case`db2i`:return r;case`hive`:return a;case`redshift`:return f;case`snowflake`:return y;case`trino`:return g;case`tidb`:return c;case`oracle`:case`oracledb`:return u;case`spark`:return p;case`singlestoredb`:return v;case`couchbase`:return l;case`bigquery`:return t;case`duckdb`:return i;case`mssql`:case`sqlserver`:case`microsoft sql server`:return _;case`athena`:case`awsathena`:case`cassandra`:case`noql`:case`flink`:case`mongodb`:case`timescaledb`:case`datafusion`:case`dremio`:return h;case`databricks`:return p;default:return rn(e),b}}function Rf(e,t){let n=document.createElement(`div`),r;return{dom:n,mount(){r=(0,Cf.createRoot)(n),r.render((0,W.jsx)(d,{store:u,children:(0,W.jsx)(t,{view:e})}))},update(){r?.render((0,W.jsx)(d,{store:u,children:(0,W.jsx)(t,{view:e})}))},destroy(){r?.unmount()}}}function Z(e){return new gt(ot.define(e))}function zf(e){return H(()=>import(`./dist-CXmhxecl.js`).then(t=>t.sql({dialect:t[e]})),__vite__mapDeps([2,3,4,5]),import.meta.url)}var Bf=[B.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return H(()=>import(`./dist-Bke0Ybxy.js`).then(e=>e.cpp()),__vite__mapDeps([6,7,4]),import.meta.url)}}),B.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return H(()=>import(`./dist-Bke0Ybxy.js`).then(e=>e.cpp()),__vite__mapDeps([6,7,4]),import.meta.url)}}),B.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return zf(`Cassandra`)}}),B.of({name:`CSS`,extensions:[`css`],load(){return H(()=>import(`./dist-DdPuhs_-.js`).then(e=>e.css()),__vite__mapDeps([8,9,4]),import.meta.url)}}),B.of({name:`Go`,extensions:[`go`],load(){return H(()=>import(`./dist-CLi0j3bw.js`).then(e=>e.go()),__vite__mapDeps([10,11,4,5]),import.meta.url)}}),B.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return H(()=>import(`./dist-mY1j_5eA.js`).then(e=>e.html()),__vite__mapDeps([12,13,4,9,14,5]),import.meta.url)}}),B.of({name:`Java`,extensions:[`java`],load(){return H(()=>import(`./dist-D7aYPqs9.js`).then(e=>e.java()),__vite__mapDeps([15,16,4]),import.meta.url)}}),B.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return H(()=>import(`./dist-CMIyXejt.js`).then(e=>e.javascript()),__vite__mapDeps([17,14,4,5]),import.meta.url)}}),B.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return H(()=>import(`./dist-BwmO3SSk.js`).then(e=>e.jinja()),__vite__mapDeps([18,19,4,13,9,14,5]),import.meta.url)}}),B.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return H(()=>import(`./dist-DKCF5R0T.js`).then(e=>e.json()),__vite__mapDeps([20,21,4]),import.meta.url)}}),B.of({name:`JSX`,extensions:[`jsx`],load(){return H(()=>import(`./dist-CMIyXejt.js`).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([17,14,4,5]),import.meta.url)}}),B.of({name:`LESS`,extensions:[`less`],load(){return H(()=>import(`./dist-tg3aVnpD.js`).then(e=>e.less()),__vite__mapDeps([22,23,4,9]),import.meta.url)}}),B.of({name:`Liquid`,extensions:[`liquid`],load(){return H(()=>import(`./dist-2oRmY-BC.js`).then(e=>e.liquid()),__vite__mapDeps([24,25,4,13,9,14,5]),import.meta.url)}}),B.of({name:`MariaDB SQL`,load(){return zf(`MariaSQL`)}}),B.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return H(()=>import(`./dist-C3KxgR0m.js`).then(e=>e.markdown()),__vite__mapDeps([26,27,4,5,13,9,14]),import.meta.url)}}),B.of({name:`MS SQL`,load(){return zf(`MSSQL`)}}),B.of({name:`MySQL`,load(){return zf(`MySQL`)}}),B.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return H(()=>import(`./dist-CpgfIIzU.js`).then(e=>e.php()),__vite__mapDeps([28,29,4,13,9,14,5]),import.meta.url)}}),B.of({name:`PLSQL`,extensions:[`pls`],load(){return zf(`PLSQL`)}}),B.of({name:`PostgreSQL`,load(){return zf(`PostgreSQL`)}}),B.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return H(()=>import(`./dist-DkfdZExz.js`).then(e=>e.python()),__vite__mapDeps([30,31,4,5]),import.meta.url)}}),B.of({name:`Rust`,extensions:[`rs`],load(){return H(()=>import(`./dist-DbFa9cik.js`).then(e=>e.rust()),__vite__mapDeps([32,33,4]),import.meta.url)}}),B.of({name:`Sass`,extensions:[`sass`],load(){return H(()=>import(`./dist-Bw8CAY5i.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([34,35,4,9]),import.meta.url)}}),B.of({name:`SCSS`,extensions:[`scss`],load(){return H(()=>import(`./dist-Bw8CAY5i.js`).then(e=>e.sass()),__vite__mapDeps([34,35,4,9]),import.meta.url)}}),B.of({name:`SQL`,extensions:[`sql`],load(){return zf(`StandardSQL`)}}),B.of({name:`SQLite`,load(){return zf(`SQLite`)}}),B.of({name:`TSX`,extensions:[`tsx`],load(){return H(()=>import(`./dist-CMIyXejt.js`).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([17,14,4,5]),import.meta.url)}}),B.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return H(()=>import(`./dist-CMIyXejt.js`).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([17,14,4,5]),import.meta.url)}}),B.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return H(()=>import(`./dist-hOh6JBwi.js`).then(e=>e.wast()),__vite__mapDeps([36,37,4]),import.meta.url)}}),B.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return H(()=>import(`./dist-B4QaGCvF.js`).then(e=>e.xml()),__vite__mapDeps([38,39,4]),import.meta.url)}}),B.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return H(()=>import(`./dist-B_ABJVTW.js`).then(e=>e.yaml()),__vite__mapDeps([40,41,4]),import.meta.url)}}),B.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return H(()=>import(`./apl-gw27yJ2n.js`).then(e=>Z(e.apl)),__vite__mapDeps([42,43]),import.meta.url)}}),B.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return H(()=>import(`./asciiarmor-Cor5STs8.js`).then(e=>Z(e.asciiArmor)),__vite__mapDeps([44,45]),import.meta.url)}}),B.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return H(()=>import(`./asn1-CPEENLyz.js`).then(e=>Z(e.asn1({}))),__vite__mapDeps([46,47]),import.meta.url)}}),B.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return H(()=>import(`./asterisk-BEn0Cwpx.js`).then(e=>Z(e.asterisk)),[],import.meta.url)}}),B.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return H(()=>import(`./brainfuck-a_fzgFtj.js`).then(e=>Z(e.brainfuck)),__vite__mapDeps([48,49]),import.meta.url)}}),B.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return H(()=>import(`./cobol-BYACvGhO.js`).then(e=>Z(e.cobol)),__vite__mapDeps([50,51]),import.meta.url)}}),B.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return H(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.csharp)),__vite__mapDeps([52,53]),import.meta.url)}}),B.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return H(()=>import(`./clojure-sW2N62b5.js`).then(e=>Z(e.clojure)),__vite__mapDeps([54,55]),import.meta.url)}}),B.of({name:`ClojureScript`,extensions:[`cljs`],load(){return H(()=>import(`./clojure-sW2N62b5.js`).then(e=>Z(e.clojure)),__vite__mapDeps([54,55]),import.meta.url)}}),B.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return H(()=>import(`./css-CbZNFbVv.js`).then(e=>Z(e.gss)),__vite__mapDeps([56,57]),import.meta.url)}}),B.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return H(()=>import(`./cmake-DA9yMhzJ.js`).then(e=>Z(e.cmake)),__vite__mapDeps([58,59]),import.meta.url)}}),B.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return H(()=>import(`./coffeescript-73GxLNLH.js`).then(e=>Z(e.coffeeScript)),__vite__mapDeps([60,61]),import.meta.url)}}),B.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return H(()=>import(`./commonlisp-BAY0IMda.js`).then(e=>Z(e.commonLisp)),__vite__mapDeps([62,63]),import.meta.url)}}),B.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return H(()=>import(`./cypher-CpQ0ACJl.js`).then(e=>Z(e.cypher)),__vite__mapDeps([64,65]),import.meta.url)}}),B.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return H(()=>import(`./python-xiYauDc4.js`).then(e=>Z(e.cython)),__vite__mapDeps([66,67]),import.meta.url)}}),B.of({name:`Crystal`,extensions:[`cr`],load(){return H(()=>import(`./crystal-DLlr59il.js`).then(e=>Z(e.crystal)),__vite__mapDeps([68,69]),import.meta.url)}}),B.of({name:`D`,extensions:[`d`],load(){return H(()=>import(`./d-BFwRCF-p.js`).then(e=>Z(e.d)),__vite__mapDeps([70,71]),import.meta.url)}}),B.of({name:`Dart`,extensions:[`dart`],load(){return H(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.dart)),__vite__mapDeps([52,53]),import.meta.url)}}),B.of({name:`diff`,extensions:[`diff`,`patch`],load(){return H(()=>import(`./diff-Ib_BKd8h.js`).then(e=>Z(e.diff)),__vite__mapDeps([72,73]),import.meta.url)}}),B.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return H(()=>import(`./dockerfile-DJkHQgkl.js`).then(e=>Z(e.dockerFile)),__vite__mapDeps([74,75]),import.meta.url)}}),B.of({name:`DTD`,extensions:[`dtd`],load(){return H(()=>import(`./dtd-DgBHwr-e.js`).then(e=>Z(e.dtd)),__vite__mapDeps([76,77]),import.meta.url)}}),B.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return H(()=>import(`./dylan-fdbf6J3T.js`).then(e=>Z(e.dylan)),__vite__mapDeps([78,79]),import.meta.url)}}),B.of({name:`EBNF`,load(){return H(()=>import(`./ebnf-D4c0_ac3.js`).then(e=>Z(e.ebnf)),[],import.meta.url)}}),B.of({name:`ECL`,extensions:[`ecl`],load(){return H(()=>import(`./ecl-K_KNI3_u.js`).then(e=>Z(e.ecl)),__vite__mapDeps([80,81]),import.meta.url)}}),B.of({name:`edn`,extensions:[`edn`],load(){return H(()=>import(`./clojure-sW2N62b5.js`).then(e=>Z(e.clojure)),__vite__mapDeps([54,55]),import.meta.url)}}),B.of({name:`Eiffel`,extensions:[`e`],load(){return H(()=>import(`./eiffel-DatcW1fL.js`).then(e=>Z(e.eiffel)),__vite__mapDeps([82,83]),import.meta.url)}}),B.of({name:`Elm`,extensions:[`elm`],load(){return H(()=>import(`./elm-DbcUgz-o.js`).then(e=>Z(e.elm)),__vite__mapDeps([84,85]),import.meta.url)}}),B.of({name:`Erlang`,extensions:[`erl`],load(){return H(()=>import(`./erlang-BistxQAs.js`).then(e=>Z(e.erlang)),__vite__mapDeps([86,87]),import.meta.url)}}),B.of({name:`Esper`,load(){return H(()=>import(`./sql-DuQMFDvy.js`).then(e=>Z(e.esper)),[],import.meta.url)}}),B.of({name:`Factor`,extensions:[`factor`],load(){return H(()=>import(`./factor-DwQNJbiW.js`).then(e=>Z(e.factor)),__vite__mapDeps([88,89,75]),import.meta.url)}}),B.of({name:`FCL`,load(){return H(()=>import(`./fcl-ClOhbFR7.js`).then(e=>Z(e.fcl)),[],import.meta.url)}}),B.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return H(()=>import(`./forth-B-tqi4f_.js`).then(e=>Z(e.forth)),__vite__mapDeps([90,91]),import.meta.url)}}),B.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return H(()=>import(`./fortran-C9M6nI39.js`).then(e=>Z(e.fortran)),__vite__mapDeps([92,93]),import.meta.url)}}),B.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return H(()=>import(`./mllike-DHDLWZl9.js`).then(e=>Z(e.fSharp)),__vite__mapDeps([94,95]),import.meta.url)}}),B.of({name:`Gas`,extensions:[`s`],load(){return H(()=>import(`./gas-DJ-ntEw0.js`).then(e=>Z(e.gas)),__vite__mapDeps([96,97]),import.meta.url)}}),B.of({name:`Gherkin`,extensions:[`feature`],load(){return H(()=>import(`./gherkin-Co7qm0Mt.js`).then(e=>Z(e.gherkin)),__vite__mapDeps([98,99]),import.meta.url)}}),B.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return H(()=>import(`./groovy-DkYAhc5g.js`).then(e=>Z(e.groovy)),__vite__mapDeps([100,101]),import.meta.url)}}),B.of({name:`Haskell`,extensions:[`hs`],load(){return H(()=>import(`./haskell-QbTWCmtk.js`).then(e=>Z(e.haskell)),__vite__mapDeps([102,103]),import.meta.url)}}),B.of({name:`Haxe`,extensions:[`hx`],load(){return H(()=>import(`./haxe-CmR2u-6B.js`).then(e=>Z(e.haxe)),__vite__mapDeps([104,105]),import.meta.url)}}),B.of({name:`HXML`,extensions:[`hxml`],load(){return H(()=>import(`./haxe-CmR2u-6B.js`).then(e=>Z(e.hxml)),__vite__mapDeps([104,105]),import.meta.url)}}),B.of({name:`HTTP`,load(){return H(()=>import(`./http-CLVgA2GD.js`).then(e=>Z(e.http)),[],import.meta.url)}}),B.of({name:`IDL`,extensions:[`pro`],load(){return H(()=>import(`./idl-DY5VfUGL.js`).then(e=>Z(e.idl)),__vite__mapDeps([106,107]),import.meta.url)}}),B.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return H(()=>import(`./javascript-BWjar7HY.js`).then(e=>Z(e.jsonld)),__vite__mapDeps([108,109]),import.meta.url)}}),B.of({name:`Julia`,extensions:[`jl`],load(){return H(()=>import(`./julia-CBfVM-ng.js`).then(e=>Z(e.julia)),__vite__mapDeps([110,111]),import.meta.url)}}),B.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return H(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.kotlin)),__vite__mapDeps([52,53]),import.meta.url)}}),B.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return H(()=>import(`./livescript-CC7i4CEo.js`).then(e=>Z(e.liveScript)),__vite__mapDeps([112,113]),import.meta.url)}}),B.of({name:`Lua`,extensions:[`lua`],load(){return H(()=>import(`./lua-_4wuYo1j.js`).then(e=>Z(e.lua)),__vite__mapDeps([114,115]),import.meta.url)}}),B.of({name:`mIRC`,extensions:[`mrc`],load(){return H(()=>import(`./mirc-BASUkO3C.js`).then(e=>Z(e.mirc)),__vite__mapDeps([116,117]),import.meta.url)}}),B.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return H(()=>import(`./mathematica-DWMBVyLs.js`).then(e=>Z(e.mathematica)),__vite__mapDeps([118,119]),import.meta.url)}}),B.of({name:`Modelica`,extensions:[`mo`],load(){return H(()=>import(`./modelica-C2NfUrdY.js`).then(e=>Z(e.modelica)),__vite__mapDeps([120,121]),import.meta.url)}}),B.of({name:`MUMPS`,extensions:[`mps`],load(){return H(()=>import(`./mumps-DwVYUX8b.js`).then(e=>Z(e.mumps)),__vite__mapDeps([122,123]),import.meta.url)}}),B.of({name:`Mbox`,extensions:[`mbox`],load(){return H(()=>import(`./mbox-DvNfx9hX.js`).then(e=>Z(e.mbox)),__vite__mapDeps([124,125]),import.meta.url)}}),B.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return H(()=>import(`./nginx-BMaDbqW3.js`).then(e=>Z(e.nginx)),[],import.meta.url)}}),B.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return H(()=>import(`./nsis-CSHYJZux.js`).then(e=>Z(e.nsis)),__vite__mapDeps([126,127,75]),import.meta.url)}}),B.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return H(()=>import(`./ntriples-CSqEHNgf.js`).then(e=>Z(e.ntriples)),__vite__mapDeps([128,129]),import.meta.url)}}),B.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return H(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.objectiveC)),__vite__mapDeps([52,53]),import.meta.url)}}),B.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return H(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.objectiveCpp)),__vite__mapDeps([52,53]),import.meta.url)}}),B.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return H(()=>import(`./mllike-DHDLWZl9.js`).then(e=>Z(e.oCaml)),__vite__mapDeps([94,95]),import.meta.url)}}),B.of({name:`Octave`,extensions:[`m`],load(){return H(()=>import(`./octave-ImTMIie9.js`).then(e=>Z(e.octave)),__vite__mapDeps([130,131]),import.meta.url)}}),B.of({name:`Oz`,extensions:[`oz`],load(){return H(()=>import(`./oz-BuYcBdKy.js`).then(e=>Z(e.oz)),__vite__mapDeps([132,133]),import.meta.url)}}),B.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return H(()=>import(`./pascal-B50DmceL.js`).then(e=>Z(e.pascal)),__vite__mapDeps([134,135]),import.meta.url)}}),B.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return H(()=>import(`./perl-DmFVAwdF.js`).then(e=>Z(e.perl)),__vite__mapDeps([136,137]),import.meta.url)}}),B.of({name:`Pig`,extensions:[`pig`],load(){return H(()=>import(`./pig-BnQuru9N.js`).then(e=>Z(e.pig)),__vite__mapDeps([138,139]),import.meta.url)}}),B.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return H(()=>import(`./powershell-B1pJyAAD.js`).then(e=>Z(e.powerShell)),__vite__mapDeps([140,141]),import.meta.url)}}),B.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return H(()=>import(`./properties-Ci7guRqV.js`).then(e=>Z(e.properties)),__vite__mapDeps([142,143]),import.meta.url)}}),B.of({name:`ProtoBuf`,extensions:[`proto`],load(){return H(()=>import(`./protobuf-CoqP8wM5.js`).then(e=>Z(e.protobuf)),__vite__mapDeps([144,145]),import.meta.url)}}),B.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return H(()=>import(`./pug-CJsoo9v0.js`).then(e=>Z(e.pug)),__vite__mapDeps([146,147,109]),import.meta.url)}}),B.of({name:`Puppet`,extensions:[`pp`],load(){return H(()=>import(`./puppet-C9UYpvtZ.js`).then(e=>Z(e.puppet)),__vite__mapDeps([148,149]),import.meta.url)}}),B.of({name:`Q`,extensions:[`q`],load(){return H(()=>import(`./q-CKkOe1xA.js`).then(e=>Z(e.q)),__vite__mapDeps([150,151]),import.meta.url)}}),B.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return H(()=>import(`./r-Bwc-y-iL.js`).then(e=>Z(e.r)),__vite__mapDeps([152,153]),import.meta.url)}}),B.of({name:`RPM Changes`,load(){return H(()=>import(`./rpm-UQSdNQr2.js`).then(e=>Z(e.rpmChanges)),__vite__mapDeps([154,155]),import.meta.url)}}),B.of({name:`RPM Spec`,extensions:[`spec`],load(){return H(()=>import(`./rpm-UQSdNQr2.js`).then(e=>Z(e.rpmSpec)),__vite__mapDeps([154,155]),import.meta.url)}}),B.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return H(()=>import(`./ruby-Bbksypm5.js`).then(e=>Z(e.ruby)),__vite__mapDeps([156,157]),import.meta.url)}}),B.of({name:`SAS`,extensions:[`sas`],load(){return H(()=>import(`./sas-CssadkTB.js`).then(e=>Z(e.sas)),__vite__mapDeps([158,159]),import.meta.url)}}),B.of({name:`Scala`,extensions:[`scala`],load(){return H(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.scala)),__vite__mapDeps([52,53]),import.meta.url)}}),B.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return H(()=>import(`./scheme-CkJWoRmu.js`).then(e=>Z(e.scheme)),__vite__mapDeps([160,161]),import.meta.url)}}),B.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return H(()=>import(`./shell-FgUEpLdy.js`).then(e=>Z(e.shell)),__vite__mapDeps([162,163]),import.meta.url)}}),B.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return H(()=>import(`./sieve-BLxcNk7A.js`).then(e=>Z(e.sieve)),__vite__mapDeps([164,165]),import.meta.url)}}),B.of({name:`Smalltalk`,extensions:[`st`],load(){return H(()=>import(`./smalltalk-d1Dbk6V4.js`).then(e=>Z(e.smalltalk)),__vite__mapDeps([166,167]),import.meta.url)}}),B.of({name:`Solr`,load(){return H(()=>import(`./solr-BBopId9w.js`).then(e=>Z(e.solr)),[],import.meta.url)}}),B.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return H(()=>import(`./mllike-DHDLWZl9.js`).then(e=>Z(e.sml)),__vite__mapDeps([94,95]),import.meta.url)}}),B.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return H(()=>import(`./sparql-CUZhKeRb.js`).then(e=>Z(e.sparql)),__vite__mapDeps([168,169]),import.meta.url)}}),B.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return H(()=>import(`./spreadsheet-CTIncYxj.js`).then(e=>Z(e.spreadsheet)),[],import.meta.url)}}),B.of({name:`Squirrel`,extensions:[`nut`],load(){return H(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.squirrel)),__vite__mapDeps([52,53]),import.meta.url)}}),B.of({name:`Stylus`,extensions:[`styl`],load(){return H(()=>import(`./stylus-BvudHrj4.js`).then(e=>Z(e.stylus)),__vite__mapDeps([170,171]),import.meta.url)}}),B.of({name:`Swift`,extensions:[`swift`],load(){return H(()=>import(`./swift-CUIczYYb.js`).then(e=>Z(e.swift)),__vite__mapDeps([172,173]),import.meta.url)}}),B.of({name:`sTeX`,load(){return H(()=>import(`./stex-3SJlFZg3.js`).then(e=>Z(e.stex)),__vite__mapDeps([174,175]),import.meta.url)}}),B.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return H(()=>import(`./stex-3SJlFZg3.js`).then(e=>Z(e.stex)),__vite__mapDeps([174,175]),import.meta.url)}}),B.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return H(()=>import(`./verilog-DH7aBYt7.js`).then(e=>Z(e.verilog)),__vite__mapDeps([176,177]),import.meta.url)}}),B.of({name:`Tcl`,extensions:[`tcl`],load(){return H(()=>import(`./tcl-SjROh4xB.js`).then(e=>Z(e.tcl)),__vite__mapDeps([178,179]),import.meta.url)}}),B.of({name:`Textile`,extensions:[`textile`],load(){return H(()=>import(`./textile-DgW6fC9R.js`).then(e=>Z(e.textile)),__vite__mapDeps([180,181]),import.meta.url)}}),B.of({name:`TiddlyWiki`,load(){return H(()=>import(`./tiddlywiki-VlUiK86J.js`).then(e=>Z(e.tiddlyWiki)),[],import.meta.url)}}),B.of({name:`Tiki wiki`,load(){return H(()=>import(`./tiki-AK6FwT8q.js`).then(e=>Z(e.tiki)),[],import.meta.url)}}),B.of({name:`TOML`,extensions:[`toml`],load(){return H(()=>import(`./toml-BcC_uO4q.js`).then(e=>Z(e.toml)),__vite__mapDeps([182,183]),import.meta.url)}}),B.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return H(()=>import(`./troff-BMlKH74u.js`).then(e=>Z(e.troff)),__vite__mapDeps([184,185]),import.meta.url)}}),B.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return H(()=>import(`./ttcn-P2iYmK_j.js`).then(e=>Z(e.ttcn)),__vite__mapDeps([186,187]),import.meta.url)}}),B.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return H(()=>import(`./ttcn-cfg-2bl9aE98.js`).then(e=>Z(e.ttcnCfg)),__vite__mapDeps([188,189]),import.meta.url)}}),B.of({name:`Turtle`,extensions:[`ttl`],load(){return H(()=>import(`./turtle-DDf6uD3p.js`).then(e=>Z(e.turtle)),__vite__mapDeps([190,191]),import.meta.url)}}),B.of({name:`Web IDL`,extensions:[`webidl`],load(){return H(()=>import(`./webidl-dw5if_Lv.js`).then(e=>Z(e.webIDL)),__vite__mapDeps([192,193]),import.meta.url)}}),B.of({name:`VB.NET`,extensions:[`vb`],load(){return H(()=>import(`./vb-CrfmF706.js`).then(e=>Z(e.vb)),__vite__mapDeps([194,195]),import.meta.url)}}),B.of({name:`VBScript`,extensions:[`vbs`],load(){return H(()=>import(`./vbscript-Cpiv2llq.js`).then(e=>Z(e.vbScript)),__vite__mapDeps([196,197]),import.meta.url)}}),B.of({name:`Velocity`,extensions:[`vtl`],load(){return H(()=>import(`./velocity-5N54agTA.js`).then(e=>Z(e.velocity)),__vite__mapDeps([198,199]),import.meta.url)}}),B.of({name:`Verilog`,extensions:[`v`],load(){return H(()=>import(`./verilog-DH7aBYt7.js`).then(e=>Z(e.verilog)),__vite__mapDeps([176,177]),import.meta.url)}}),B.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return H(()=>import(`./vhdl-BmegRbqn.js`).then(e=>Z(e.vhdl)),__vite__mapDeps([200,201]),import.meta.url)}}),B.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return H(()=>import(`./xquery-CuDTgW6S.js`).then(e=>Z(e.xQuery)),__vite__mapDeps([202,203]),import.meta.url)}}),B.of({name:`Yacas`,extensions:[`ys`],load(){return H(()=>import(`./yacas-Dn2coKff.js`).then(e=>Z(e.yacas)),__vite__mapDeps([204,205]),import.meta.url)}}),B.of({name:`Z80`,extensions:[`z80`],load(){return H(()=>import(`./z80-ByJO5ysu.js`).then(e=>Z(e.z80)),__vite__mapDeps([206,207]),import.meta.url)}}),B.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return H(()=>import(`./mscgen-C7woTLsY.js`).then(e=>Z(e.mscgen)),__vite__mapDeps([208,209]),import.meta.url)}}),B.of({name:`Xù`,extensions:[`xu`],load(){return H(()=>import(`./mscgen-C7woTLsY.js`).then(e=>Z(e.xu)),__vite__mapDeps([208,209]),import.meta.url)}}),B.of({name:`MsGenny`,extensions:[`msgenny`],load(){return H(()=>import(`./mscgen-C7woTLsY.js`).then(e=>Z(e.msgenny)),__vite__mapDeps([208,209]),import.meta.url)}}),B.of({name:`Vue`,extensions:[`vue`],load(){return H(()=>import(`./dist-CLE562nZ.js`).then(e=>e.vue()),__vite__mapDeps([210,211,4,13,9,14,5]),import.meta.url)}}),B.of({name:`Angular Template`,load(){return H(()=>import(`./dist-DTM7BAUu.js`).then(e=>e.angular()),__vite__mapDeps([212,4,13,9,14,5]),import.meta.url)}})],Vf=new WeakMap,Hf=/(\n|\r\n?|\u2028|\u2029)/g,Uf=/^\s*/,Wf=/\S/,Gf=Array.prototype.slice,Kf=48,qf=57,Jf=97,Yf=102,Xf=65,Zf=70;function Qf(e){if(typeof e==`string`)return tp([e])[0];if(typeof e==`function`)return function(){let t=Gf.call(arguments);return t[0]=ep(t[0]),e.apply(this,t)};let t=ep(e),n=$f(t,0);for(let e=1;e<t.length;e++)n+=arguments[e]+$f(t,e);return n}function $f(e,t){let n=e[t];if(n===void 0)throw TypeError(`invalid cooked string at index ${t}`);return n}function ep(e){let t=Vf.get(e);if(t)return t;let n=tp(e.raw),r=n.map(rp);return Object.defineProperty(r,"raw",{value:Object.freeze(n)}),Object.freeze(r),Vf.set(e,r),r}function tp(e){let t=e.map(e=>e.split(Hf)),n;for(let e=0;e<t.length;e++){let r=t[e],i=e===0,a=e+1===t.length;if(i){if(r.length===1||r[0].length>0)throw Error(`invalid content on opening line`);r[1]=``}if(a){if(r.length===1||Wf.test(r[r.length-1]))throw Error(`invalid content on closing line`);r[r.length-2]=``,r[r.length-1]=``}for(let e=2;e<r.length;e+=2){let t=r[e],i=e+1===r.length&&!a,o=Uf.exec(t)[0];if(!i&&o.length===t.length){r[e]=``;continue}n=np(o,n)}}let r=n?n.length:0;return t.map(e=>{let t=e[0];for(let n=1;n<e.length;n+=2){let i=e[n],a=e[n+1];t+=i+a.slice(r)}return t})}function np(e,t){if(t===void 0||e===t)return e;let n=0;for(let r=Math.min(e.length,t.length);n<r&&e[n]===t[n];n++);return e.slice(0,n)}function rp(e){let t=``,n=0,r=0;for(;(r=e.indexOf(`\\`,r))>-1;){if(t+=e.slice(n,r),++r===e.length)return;let i=e[r++];switch(i){case`b`:t+=`\b`;break;case`t`:t+=` `;break;case`n`:t+=`
|
|
43
|
-
`;break;case`v`:t+=`\v`;break;case`f`:t+=`\f`;break;case`r`:t+=`\r`;break;case`\r`:r<e.length&&e[r]===`
|
|
44
|
-
`&&++r;case`
|
|
45
|
-
`:case`\u2028`:case`\u2029`:break;case`0`:if(ip(e,r))return;t+=`\0`;break;case`x`:{let n=ap(e,r,r+2);if(n===-1)return;r+=2,t+=String.fromCharCode(n);break}case`u`:{let n;if(r<e.length&&e[r]===`{`){let t=e.indexOf(`}`,++r);if(t===-1)return;n=ap(e,r,t),r=t+1}else n=ap(e,r,r+4),r+=4;if(n===-1||n>1114111)return;t+=String.fromCodePoint(n);break}default:if(ip(i,0))return;t+=i}n=r}return t+e.slice(n)}function ip(e,t){let n=e.charCodeAt(t);return n>=Kf&&n<=qf}function ap(e,t,n){if(n>=e.length)return-1;let r=0;for(;t<n;t++){let n=op(e.charCodeAt(t));if(n===-1)return-1;r=r*16+n}return r}function op(e){return e>=Kf&&e<=qf?e-Kf:e>=Jf&&e<=Yf?e-Jf+10:e>=Xf&&e<=Zf?e-Xf+10:-1}var sp=[``,`f`,`r`,`fr`,`rf`];function cp(e){try{return Qf(`\n${e}\n`).trim()}catch{return e}}function lp(e){return In.parse(e)}var up=new Set([`(`,`[`,`{`,`,`,`)`,`]`,`}`]);function dp(e,t){return e.name===`ArgList`?{args:fp(e),kwargs:pp(e,t)}:(console.warn(`Not an ArgList, name: ${e.name}`),{args:[],kwargs:[]})}function fp(e){e.firstChild();let t=[],n=e.name;do if(n=e.name,!up.has(n)){if(n===`VariableName`&&e.node.nextSibling?.name===`AssignOp`){e.prev();break}t.push(e.node)}while(e.nextSibling());return t}function pp(e,t){let n=[],r=e.name;do if(r=e.name,r===`VariableName`){let r=t.slice(e.from,e.to),i=e.node.nextSibling;if(!i||i.name!==`AssignOp`)continue;let a=i.nextSibling;if(!a)continue;let o=t.slice(a.from,a.to).trim();n.push({key:r,value:o})}while(e.nextSibling());return n}function mp(e,t){if(e.name===`String`){let n=t.slice(e.from,e.to);return n.startsWith(`r"""`)||n.startsWith(`r'''`)?n.slice(4,-3):n.startsWith(`"""`)||n.startsWith(`'''`)?n.slice(3,-3):n.startsWith(`r"`)||n.startsWith(`r'`)?n.slice(2,-1):n.slice(1,-1)}if(e.name===`FormatString`){let n=t.slice(e.from,e.to);return n.startsWith(`f"""`)||n.startsWith(`f'''`)?n.slice(4,-3):n.startsWith(`rf"""`)||n.startsWith(`rf'''`)||n.startsWith(`fr"""`)||n.startsWith(`fr'''`)?n.slice(5,-3):n.startsWith(`r"""`)||n.startsWith(`r'''`)?n.slice(4,-3):n.startsWith(`f"`)||n.startsWith(`f'`)?n.slice(2,-1):n.startsWith(`rf"`)||n.startsWith(`rf'`)||n.startsWith(`fr"`)||n.startsWith(`fr'`)?n.slice(3,-1):(n.startsWith(`r"`)||n.startsWith(`r'`),n.slice(2,-1))}return null}function hp(e){return e===``?0:e.startsWith(`rf"""`)||e.startsWith(`rf'''`)||e.startsWith(`fr"""`)||e.startsWith(`fr'''`)?5:e.startsWith(`f"""`)||e.startsWith(`f'''`)||e.startsWith(`r"""`)||e.startsWith(`r'''`)?4:e.startsWith(`"""`)||e.startsWith(`'''`)||e.startsWith(`rf'`)||e.startsWith(`rf"`)||e.startsWith(`fr'`)||e.startsWith(`fr"`)?3:e.startsWith(`f'`)||e.startsWith(`f"`)||e.startsWith(`r'`)||e.startsWith(`r"`)?2:e.startsWith(`'`)||e.startsWith(`"`)?1:0}function gp(e){let t=[...sp].sort((e,t)=>t.length-e.length);for(let n of t)if(e.startsWith(n))return[n,e.slice(n.length)];return[``,e]}function _p(e,t){return e.replaceAll(`\\${t}`,t)}var vp=[[`"""`,`"""`],[`'''`,`'''`],[`"`,`"`],[`'`,`'`]],yp=sp.flatMap(e=>vp.map(([t,n])=>[e+t,n])).map(([e,t])=>[e,RegExp(`^mo\\.md\\(\\s*${bp(e)}(.*)${bp(t)}\\s*\\)$`,`s`)]);function bp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var xp=class{type=`markdown`;defaultCode=`mo.md(r"""
|
|
46
|
-
""")`;defaultMetadata={quotePrefix:`r`};static fromMarkdown(e){return`mo.md(r"""\n${e}\n""")`}transformIn(e){e=e.trim();let t={...this.defaultMetadata};if(e===``)return{code:``,offset:0,metadata:t};for(let[n,r]of yp){let i=e.match(r);if(i){let r=i[1],[a,o]=gp(n);t.quotePrefix=a;let s=_p(r,o),c=e.indexOf(r);return{code:Qf(`\n${s}\n`).trim(),offset:c,metadata:t}}}return{code:e,offset:0,metadata:t}}transformOut(e,t){e===``&&(e=` `);let{quotePrefix:n}=t,r=e.replaceAll(`""`,String.raw`"\"`),i=`mo.md(${n}"""\n`;return{code:i+r+`
|
|
47
|
-
""")`,offset:i.length+1}}isSupported(e){if(e=e.trim(),e===``)return!0;if(!e.startsWith(`mo.md(`))return!1;if(e===`mo.md()`)return!0;let t=Ln.parser.parse(e),n=[{match:`Script`},{match:`ExpressionStatement`},{match:`CallExpression`},{match:`MemberExpression`},{match:`VariableName`},{match:`.`},{match:`PropertyName`},{match:`ArgList`},{match:`(`},{match:/String|FormatString/,stop:!0},{match:`)`}],r=!0;return t.iterate({enter:e=>{let t=n.shift();if(t===void 0)return r=!1,!1;let i=t.match;return typeof i==`string`?(r&&=i===e.name,r&&!t.stop):(i.test(e.name)||(r=!1),r&&!t.stop)}}),r}},Sp=class{type=`python`;defaultCode=``;defaultMetadata={};transformIn(e){return{code:e,offset:0,metadata:{}}}transformOut(e,t){return{code:e,offset:0}}isSupported(e){return!0}},Cp=`__marimo_duckdb`,wp=class{type=`sql`;defaultMetadata={dataframeName:`_df`,quotePrefix:`f`,commentLines:[],showOutput:!0,engine:Cp};get defaultCode(){return`_df = mo.sql(f"""SELECT * FROM """)`}static fromQuery(e){return`_df = mo.sql(f"""${e.trim()}""")`}transformIn(e){e=e.trim();let t={...this.defaultMetadata,commentLines:this.extractCommentLines(e)};if(!this.isSupported(e))return{code:e,offset:0,metadata:t};if(e===``)return{code:``,offset:0,metadata:t};let n=Ep(e);return n?(t.dataframeName=n.dfName,t.showOutput=n.output??!0,t.engine=n.engine??Cp,{code:Qf(`\n${n.sqlString}\n`).trim(),offset:n.startPosition,metadata:t}):{code:e,offset:0,metadata:t}}transformOut(e,t){let{quotePrefix:n,commentLines:r,showOutput:i,engine:a,dataframeName:o}=t,s=`${o} = mo.sql(\n ${n}"""\n`,c=e.replaceAll(`"""`,String.raw`\"""`),l=`\n """${i?``:`,
|
|
48
|
-
output=False`}${a===Cp?``:`,\n engine=${a}`}\n)`;return{code:[...r,s].join(`
|
|
49
|
-
`)+Dp(c)+l,offset:s.length+1}}isSupported(e){return e.trim()===``?!0:!e.includes(`mo.sql`)||e.split(`mo.sql`).length>2?!1:Ep(e)!==null}extractCommentLines(e){let t=e.split(`
|
|
50
|
-
`),n=[];for(let e of t)if(e?.startsWith(`#`))n.push(e);else break;return n}};function Tp(e){do{if(e.name===`AssignStatement`)return e.node;if(e.name!==`Comment`)return null}while(e.next());return null}function Ep(e){try{let t=lp(e).cursor();t.name===`Script`&&t.next();let n=Tp(t);if(!n||e.slice(n.to).trim().length>0)return null;let r=null,i=null,a,o,s=0,c=n.cursor();if(c.firstChild(),c.name===`VariableName`&&(r=e.slice(c.from,c.to)),!r)return null;let l=!1,u=null;for(;c.nextSibling();)if(c.name===`AssignOp`)l=!0;else if(l&&!u){u=c.node;break}if(!u||u.name===`ConditionalExpression`||u.name===`BinaryExpression`||u.name===`UnaryExpression`)return null;let d=u.cursor(),f=null;if(d.name===`CallExpression`)f=d.node;else{d.firstChild();do if(d.name===`CallExpression`){f=d.node;break}while(d.nextSibling())}if(f){let t=f.cursor(),n=!1;if(t.firstChild(),t.name===`MemberExpression`&&(n=e.slice(t.from,t.to)===`mo.sql`),n){for(;t.next();)if(t.name===`ArgList`){let{args:n,kwargs:c}=dp(t.node.cursor(),e);n.length===1&&(i=mp(n[0],e),s=n[0].from+hp(e.slice(n[0].from,n[0].to)));for(let{key:e,value:t}of c)switch(e){case`engine`:a=t;break;case`output`:o=t===`True`}if(i===``)return{dfName:r,sqlString:``,engine:a,output:o,startPosition:s};break}}}return!r||!i?null:{dfName:r,sqlString:cp(i),engine:a,output:o,startPosition:s}}catch(e){return console.warn(`Failed to parse SQL statement`,e),null}}function Dp(e){return e.split(`
|
|
51
|
-
`).map(e=>e?.trim()?` ${e}`:e).join(`
|
|
52
|
-
`)}var Op=()=>({cellIds:new Set}),{valueAtom:kp,useActions:Ap}=Jt(Op,{markForCut:(e,t)=>({cellIds:new Set(t.cellIds)}),clear:()=>Op()}),jp=o(e=>e(kp).cellIds),Mp=o(null,(e,t)=>{t(kp,Op())});function Np(){return Ap()}function Pp(e){let t=(0,Qd.c)(3),n=s(jp),r;return t[0]!==e||t[1]!==n?(r=n.has(e),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function Fp(){return s(kp)}var Ip=(e,t,n)=>_t.define(r=>new Rp(r,e,t,n)),Lp=Ue.define(),Rp=class{sub;isInitDispatch=!1;view;doc;docPath;getTextFromDoc;constructor(e,t,n,r){this.view=e,this.doc=t,this.docPath=n,this.getTextFromDoc=r,this.sub=t.subscribe(this.onRemoteUpdate),Promise.resolve().then(()=>{this.isInitDispatch=!0;let t=this.view.state.doc.toString(),n=this.getTextFromDoc(this.doc);t!==n.toString()&&e.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:n.toString()}],annotations:[Lp.of(this)]})})}onRemoteUpdate=e=>{if(e.by!==`local`){if(e.by===`checkout`){this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[Lp.of(this)]});return}if(e.by===`import`){let t=[],n=0;for(let{diff:r,path:i}of e.events){if(i.join(`/`)!==this.docPath.join(`/`)||r.type!==`text`)continue;let e=r.diff;for(let r of e)r.insert?t.push({from:n,to:n,insert:r.insert}):r.delete?(t.push({from:n,to:n+r.delete}),n+=r.delete):r.retain!=null&&(n+=r.retain);t.length>0&&this.view.dispatch({changes:t,annotations:[Lp.of(this)]})}}}};update(e){if(this.isInitDispatch){this.isInitDispatch=!1;return}if(!e.docChanged||e.transactions.length>0&&(e.transactions[0].annotation(Lp)===this||e.transactions[0].annotation(Lp)===`undo`))return;let t=0;e.changes.iterChanges((e,n,r,i,a)=>{let o=a.sliceString(0,a.length,`
|
|
53
|
-
`);e!==n&&this.getTextFromDoc(this.doc).delete(e+t,n-e),o.length>0&&this.getTextFromDoc(this.doc).insert(e+t,o),t+=o.length-(n-e)}),this.doc.commit()}destroy(){this.sub?.(),this.sub=void 0}};function zp(e,t){if(typeof window>`u`)return;let n=`__marimo__${t}`;window[n]&&T.warn(`Overwriting existing debug object ${n}`),window[n]=e}var Bp={markdown:!0,wasm_layouts:!1,rtc_v2:!1,cache_panel:!1,external_agents:!1,debugger:!1,line_timing:!1};function Vp(e){return te()?.experimental?.[e]??Bp[e]}function Hp(e,t){sn().saveUserConfig({config:{experimental:{[e]:t}}})}zp(Hp,`setFeatureFlag`);function Up(e,t){return{get:()=>t.get(e),sub:n=>t.sub(e,()=>n(t.get(e)))}}function Wp(e,{offset:t,body:n=window,behavior:r=`smooth`}){let i=t?.top??0,a=t?.bottom??0,o=e.getBoundingClientRect();if(o.top<i){n.scrollBy({top:o.top-i,behavior:r});return}if(o.bottom>window.innerHeight-a){n.scrollBy({top:o.bottom-window.innerHeight+a,behavior:r});return}}function Gp(e){return e?e.state.field(FC).type:`python`}function Kp(e,t){return!e||Gp(e)===t?!1:e.state.doc.toString().trim()===``||YS[t].isSupported(UC(e))}function qp(e,t,n={}){return!n.force&&!Kp(e,t)?!1:(VC(e,{language:t}),t)}function Jp(e){return Ke.of([{key:e.getHotkey(`cell.format`).key,preventDefault:!0,run:e=>(Pf({[e.state.facet(Cu)]:e}),!0)},{key:e.getHotkey(`cell.viewAsMarkdown`).key,preventDefault:!0,run:e=>{let t=qp(e,Gp(e)===`markdown`?`python`:`markdown`,{force:!0});return t===`markdown`&&e.state.facet(Su).afterToggleMarkdown(),t!==!1}},{key:e.getHotkey(`cell.viewAsSQL`).key,preventDefault:!0,run:e=>{let t=qp(e,Gp(e)===`sql`?`python`:`sql`,{force:!0});return t===`sql`&&e.state.facet(Su).afterToggleSQL(),t!==!1}}])}function Yp(){return V.updateListener.of(e=>{if(e.view.hasFocus&&e.heightChanged&&e.docChanged){if(e.transactions.some(e=>e.effects.some(e=>e.is(Nf))))return;Xp(e.view,{behavior:`smooth`})}})}function Xp(e,t){let n=e.dom.getElementsByClassName(`cm-activeLine cm-line`);if(n.length===1){let e=n[0],r=document.getElementById(`App`);O(r,`App not found`),Wp(e,{offset:{top:30,bottom:150},body:r,behavior:t.behavior})}}function Zp(){return{}}var{reducer:Qp,createActions:$p,valueAtom:em,useActions:tm}=Jt(Zp,{setVariables:(e,t)=>{let n={...e},r={};for(let e of t)r[e.name]={...n[e.name],...e};return r},addVariables:(e,t)=>{let n={...e};for(let e of t)n[e.name]={...n[e.name],...e};return n},setMetadata:(e,t)=>{let n={...e};for(let{name:e,value:r,dataType:i}of t)n[e]&&(n[e]={...n[e],value:r,dataType:i});return n}}),nm=()=>s(em);function rm(){return tm()}function im(e){let t=e.storage||sa;return{getItem(n,r){try{let i=t.getItem(n);if(!i)return r;let a=JSON.parse(i);return e.fromSerializable(a)}catch(e){return T.warn(`Error getting ${n} from storage`,e),r}},setItem:(n,r)=>{t.setItem(n,JSON.stringify(e.toSerializable(r)))},removeItem:e=>{t.removeItem(e)}}}var am=Yi(()=>sa),om=[{type:`files`,Icon:kd,label:`Files`,tooltip:`View files`,defaultSection:`sidebar`,additionalKeywords:[`explorer`,`browser`,`directory`]},{type:`variables`,Icon:Wd,label:`Variables`,tooltip:`Explore variables and data sources`,defaultSection:`sidebar`,additionalKeywords:[`state`,`scope`,`inspector`]},{type:`packages`,Icon:yd,label:`Packages`,tooltip:`Manage packages`,defaultSection:`sidebar`,additionalKeywords:[`dependencies`,`pip`,`install`]},{type:`ai`,Icon:vd,label:`AI`,tooltip:`Chat & Agents`,defaultSection:`sidebar`,additionalKeywords:[`chat`,`copilot`,`assistant`]},{type:`outline`,Icon:Rd,label:`Outline`,tooltip:`View outline`,defaultSection:`sidebar`,additionalKeywords:[`toc`,`structure`,`headings`]},{type:`documentation`,Icon:Ud,label:`Docs`,tooltip:`View live docs`,defaultSection:`sidebar`,additionalKeywords:[`reference`,`api`]},{type:`dependencies`,Icon:Fd,label:`Dependencies`,tooltip:`Explore dependencies`,defaultSection:`sidebar`,additionalKeywords:[`graph`,`imports`]},{type:`errors`,Icon:Sd,label:`Errors`,tooltip:`View errors`,defaultSection:`developer-panel`,additionalKeywords:[`exceptions`,`problems`,`diagnostics`]},{type:`scratchpad`,Icon:Id,label:`Scratchpad`,tooltip:`Scratchpad`,defaultSection:`developer-panel`,additionalKeywords:[`scratch`,`draft`,`playground`]},{type:`tracing`,Icon:gd,label:`Tracing`,tooltip:`View tracing`,defaultSection:`developer-panel`,additionalKeywords:[`profiling`,`performance`]},{type:`secrets`,Icon:jd,label:`Secrets`,tooltip:`Manage secrets`,defaultSection:`developer-panel`,hidden:A(),additionalKeywords:[`env`,`environment`,`keys`,`credentials`]},{type:`logs`,Icon:Od,label:`Logs`,tooltip:`View logs`,defaultSection:`developer-panel`,additionalKeywords:[`console`,`stdout`]},{type:`terminal`,Icon:Vd,label:`Terminal`,tooltip:`Terminal`,hidden:A(),defaultSection:`developer-panel`,requiredCapability:`terminal`,additionalKeywords:[`shell`,`console`,`bash`,`command`]},{type:`snippets`,Icon:Bd,label:`Snippets`,tooltip:`Snippets`,defaultSection:`developer-panel`,additionalKeywords:[`templates`,`examples`]},{type:`cache`,Icon:An,label:`Cache`,tooltip:`View cache`,defaultSection:`developer-panel`,hidden:!Vp(`cache_panel`),additionalKeywords:[`memory`,`memoize`]}],sm=new Map(om.map(e=>[e.type,e]));function cm({panel:e,capabilities:t,aiEnabled:n}){return!!(e.hidden||e.type===`ai`&&!n||e.requiredCapability&&!t[e.requiredCapability])}var lm={sidebar:om.filter(e=>!e.hidden&&e.defaultSection===`sidebar`).map(e=>e.type),developerPanel:om.filter(e=>!e.hidden&&e.defaultSection===`developer-panel`).map(e=>e.type)};function um(e){let t=new Set([...e.sidebar,...e.developerPanel]);return{sidebar:[...e.sidebar,...lm.sidebar.filter(e=>!t.has(e))],developerPanel:[...e.developerPanel,...lm.developerPanel.filter(e=>!t.has(e))]}}var dm=Zi(`marimo:panel-layout`,lm,im({toSerializable:e=>e,fromSerializable:e=>um(e)}),{getOnInit:!0});function fm(e){let t=u.get(dm);return t.sidebar.includes(e)?`sidebar`:t.developerPanel.includes(e)?`developer-panel`:null}var pm=`marimo:sidebar`,mm=new la(m({selectedPanel:h().optional().transform(e=>e),isSidebarOpen:y(),isDeveloperPanelOpen:y().optional().default(!1),selectedDeveloperPanelTab:h().optional().default(`errors`).transform(e=>e)}),hm);function hm(){return{selectedPanel:`variables`,isSidebarOpen:!1,isDeveloperPanelOpen:!1,selectedDeveloperPanelTab:`errors`}}var{reducer:gm,createActions:_m,valueAtom:vm,useActions:ym}=Jt(()=>mm.get(pm),{openApplication:(e,t)=>{let n=fm(t);return n===`sidebar`?{...e,selectedPanel:t,isSidebarOpen:!0}:n===`developer-panel`?{...e,selectedDeveloperPanelTab:t,isDeveloperPanelOpen:!0}:e},toggleApplication:(e,t)=>{let n=fm(t);return n===`sidebar`?{...e,selectedPanel:t,isSidebarOpen:!e.isSidebarOpen||e.selectedPanel!==t}:n===`developer-panel`?{...e,selectedDeveloperPanelTab:t,isDeveloperPanelOpen:!e.isDeveloperPanelOpen||e.selectedDeveloperPanelTab!==t}:e},toggleSidebarPanel:e=>({...e,isSidebarOpen:!e.isSidebarOpen}),setIsSidebarOpen:(e,t)=>({...e,isSidebarOpen:t}),toggleDeveloperPanel:e=>({...e,isDeveloperPanelOpen:!e.isDeveloperPanelOpen}),setIsDeveloperPanelOpen:(e,t)=>({...e,isDeveloperPanelOpen:t})},[(e,t)=>mm.set(pm,t)]),bm=()=>{let e=(0,Qd.c)(2),t=s(vm);if(t.isSidebarOpen)return t;let n;return e[0]===t?n=e[1]:(n={...t,selectedPanel:void 0},e[0]=t,e[1]=n),n};function xm(){return ym()}function Sm(e){u.set(vm,t=>gm(t,{type:`openApplication`,payload:e}))}var Cm=o({terminal:!1,pylsp:!1,basedpyright:!1,ty:!1,pyrefly:!1});function wm(e){return u.get(Cm)?.[e]??!1}var Tm=o({documentation:null}),Q={VariableName:`VariableName`,FunctionDefinition:`FunctionDefinition`,ClassDefinition:`ClassDefinition`,LambdaExpression:`LambdaExpression`,ParamList:`ParamList`,Decorator:`Decorator`,AssignStatement:`AssignStatement`,ForStatement:`ForStatement`,ImportStatement:`ImportStatement`,TryStatement:`TryStatement`,WithStatement:`WithStatement`,TupleExpression:`TupleExpression`,ArrayExpression:`ArrayExpression`,ParenthesizedExpression:`ParenthesizedExpression`,CallExpression:`CallExpression`,ArgList:`ArgList`,AssignOp:`AssignOp`,ArrayComprehensionExpression:`ArrayComprehensionExpression`,SetComprehensionExpression:`SetComprehensionExpression`,DictionaryComprehensionExpression:`DictionaryComprehensionExpression`,ComprehensionExpression:`ComprehensionExpression`,Comment:`Comment`,String:`String`,FormatString:`FormatString`},Em={For:`for`,In:`in`,As:`as`,Import:`import`},Dm=new Set([Q.FunctionDefinition,Q.LambdaExpression,Q.ArrayComprehensionExpression,Q.SetComprehensionExpression,Q.DictionaryComprehensionExpression,Q.ComprehensionExpression,Q.ClassDefinition]),Om=new Set([Q.Comment,Q.String,Q.FormatString]);function km(e){let t=Ie(e.state);if(!t||Nm(t))return[];let n=new Set(Object.keys(e.variables).filter(t=>{let n=e.variables[t];return n.dataType!==`module`&&!n.declaredBy.includes(`setup`)&&!n.declaredBy.includes(e.cellId)}));if(n.size===0)return[];let r=[],i=new Map,a=new Map,o=new Map;function s(t,n){let r=t.cursor(),c=r.name,l=r.from,u=Dm.has(c),d=n;switch(u&&(d=[...n,l],i.set(l,new Set),a.set(l,c)),c){case Q.FunctionDefinition:{let r=t.cursor();r.firstChild();do if(r.name===Q.VariableName){let t=e.state.doc.sliceString(r.from,r.to),a=n[n.length-1]??-1;i.has(a)||i.set(a,new Set),i.get(a)?.add(t);break}while(r.nextSibling());let a=t.cursor();a.firstChild();do if(a.name===Q.ParamList){let t=a.node.cursor();t.firstChild();do if(t.name===Q.VariableName){let n=e.state.doc.sliceString(t.from,t.to);i.get(l)?.add(n)}while(t.nextSibling())}while(a.nextSibling());break}case Q.LambdaExpression:{let n=t.cursor();n.firstChild();do if(n.name===Q.ParamList){let t=n.node.cursor();t.firstChild();do if(t.name===Q.VariableName){let n=e.state.doc.sliceString(t.from,t.to);i.get(l)?.add(n)}while(t.nextSibling())}while(n.nextSibling());break}case Q.ArrayComprehensionExpression:case Q.DictionaryComprehensionExpression:case Q.SetComprehensionExpression:case Q.ComprehensionExpression:{let n=t.cursor();n.firstChild();let r=!1;do if(n.name===Em.For)r=!0;else if(r&&n.name===Q.VariableName){let t=e.state.doc.sliceString(n.from,n.to);i.get(l)?.add(t)}else if(r&&n.name===Q.TupleExpression){let t=n.node.cursor();t.firstChild();do if(t.name===Q.VariableName){let n=e.state.doc.sliceString(t.from,t.to);i.get(l)?.add(n)}while(t.nextSibling())}else r&&n.name===Em.In&&(r=!1);while(n.nextSibling());break}case Q.ClassDefinition:{let r=t.cursor();r.firstChild();do if(r.name===Q.VariableName){let t=e.state.doc.sliceString(r.from,r.to),a=n[n.length-1]??-1;i.has(a)||i.set(a,new Set),i.get(a)?.add(t);break}while(r.nextSibling());o.set(l,[]);break}case Q.AssignStatement:{let n=t.cursor(),s=[];n.firstChild();do n.name===Q.AssignOp&&s.push(n.from);while(n.nextSibling());let c=s[s.length-1],l=t.cursor();l.firstChild();let u=d[d.length-1]??-1;do l.from<c&&Pm(l,{currentScope:u,state:e.state,allDeclarations:i,scopeTypes:a,classLevelDeclarations:o,assignmentPosition:r.to});while(l.nextSibling());break}case Q.ForStatement:{let n=t.cursor();n.firstChild();let r=!1;do if(n.name===Em.For)r=!0;else if(r&&n.name===Q.VariableName){let t=e.state.doc.sliceString(n.from,n.to),r=d[d.length-1]??-1;i.has(r)||i.set(r,new Set),i.get(r)?.add(t)}else r&&n.name===Em.In&&(r=!1);while(n.nextSibling());break}case Q.ImportStatement:{let n=t.cursor();n.firstChild();let r=d[d.length-1]??-1;i.has(r)||i.set(r,new Set);let a=i.get(r),o=!1,s=null,c=()=>{s!==null&&a?.add(s),s=null};do{if(n.name===Em.Import){o=!0;continue}if(o){if(n.name===Em.As){s=null;continue}n.name===Q.VariableName?(c(),s=e.state.doc.sliceString(n.from,n.to)):n.name===`,`&&c()}}while(n.nextSibling());c();break}case Q.TryStatement:{let n=t.cursor();n.firstChild();let r=!1;do if(n.name===Em.As)r=!0;else if(r&&n.name===Q.VariableName){let t=e.state.doc.sliceString(n.from,n.to),a=d[d.length-1]??-1;i.has(a)||i.set(a,new Set),i.get(a)?.add(t),r=!1}while(n.nextSibling());break}case Q.WithStatement:{let n=t.cursor();n.firstChild();let r=!1;do if(n.name===Em.As)r=!0;else if(r&&n.name===Q.VariableName){let t=e.state.doc.sliceString(n.from,n.to),a=d[d.length-1]??-1;i.has(a)||i.set(a,new Set),i.get(a)?.add(t),r=!1}while(n.nextSibling());break}}f(r,e=>{s(e,d)})}function c(e,t,n){let r=o.get(t);return r?r.some(([t,r])=>t===e&&r<n):!1}function l(e,t,n){for(let r of t)if(a.get(r)===Q.ClassDefinition){if(c(e,r,n))return!0}else if(i.get(r)?.has(e))return!0;return i.get(-1)?.has(e)??!1}function u(t,n){let i=t.cursor(),a=i.name,o=i.from;if(a===Q.ImportStatement)return;let s=Dm.has(a),c=n;if(s&&(c=[...n,o]),a===Q.VariableName){let t=e.state.doc.sliceString(i.from,i.to);d(t,i)&&(l(t,c,i.from)||r.push({from:i.from,to:i.to,variableName:t}))}f(i,e=>{u(e,c)})}function d(e,t){return n.has(e)&&!Mm(t)&&!Am(t)&&!jm(t)}function f(e,t){if(e.firstChild())do t(e.node);while(e.nextSibling())}return s(t,[]),u(t,[]),r}function Am(e){let t=e.node.cursor();if(t.moveTo(e.from),t.parent()&&t.name===Q.CallExpression&&t.firstChild())do if(t.name===Q.ArgList&&t.firstChild()){do if(t.from===e.from&&t.to===e.to)return t.nextSibling()&&t.name===Q.AssignOp;while(t.nextSibling());break}while(t.nextSibling());return!1}function jm(e){let t=e.node.cursor();if(t.parent()&&t.name===Q.AssignStatement){let n=t.node.cursor();n.firstChild();let r=-1;do if(n.name===Q.AssignOp){r=n.from;break}while(n.nextSibling());return r!==-1&&e.from<r}return!1}function Mm(e){let t=e.node.cursor();return!!(t.prevSibling()&&t.name===`.`)}function Nm(e){let t=e.cursor();do if(t.name===`⚠`||t.type.isError)return!0;while(t.next());return!1}function Pm(e,t){switch(e.name){case Q.VariableName:{let n=t.state.doc.sliceString(e.from,e.to);if(t.currentScope!==-1&&t.scopeTypes.get(t.currentScope)===Q.ClassDefinition){let e=t.classLevelDeclarations.get(t.currentScope);e&&e.push([n,t.assignmentPosition])}else t.allDeclarations.has(t.currentScope)||t.allDeclarations.set(t.currentScope,new Set),t.allDeclarations.get(t.currentScope)?.add(n);break}case Q.TupleExpression:{let n=e.node.cursor();n.firstChild();do Pm(n,t);while(n.nextSibling());break}case Q.ArrayExpression:{let n=e.node.cursor();n.firstChild();do Pm(n,t);while(n.nextSibling());break}}}var Fm=z.mark({class:`mo-cm-reactive-reference`}),Im=z.mark({class:`mo-cm-reactive-reference-hover`}),Lm=$e.define(),Rm=class{view;cellId;variablesUnsubscribe;highlightDebounceMs=300;scheduleHighlighting;constructor(e,t){this.view=e,this.cellId=t,this.scheduleHighlighting=S(()=>{this.runHighlighting()},this.highlightDebounceMs),this.variablesUnsubscribe=u.sub(em,()=>{this.scheduleHighlighting()}),this.scheduleHighlighting()}update(e){(e.docChanged||e.focusChanged)&&this.scheduleHighlighting()}destroy(){this.scheduleHighlighting.cancel(),this.variablesUnsubscribe()}runHighlighting(){let e=km({state:this.view.state,cellId:this.cellId,variables:u.get(em)});e.length>0&&T.debug(`Found ${e.length} reactive variables in cell ${this.cellId}`),queueMicrotask(()=>{this.view.dispatch({effects:Lm.of(e)})})}},zm=He.define({create(){return{decorations:z.none,ranges:[]}},update(e,t){let n={decorations:e.decorations.map(t.changes),ranges:e.ranges};for(let e of t.effects)e.is(Lm)&&(n={decorations:z.set(e.value.map(e=>Fm.range(e.from,e.to))),ranges:e.value});return n},provide:e=>V.decorations.from(e,e=>e.decorations)});function Bm(e){return[zm,_t.define(t=>new Rm(t,e))]}function Vm(e,t){return t?Bm(e):[]}function Hm(e,t=!1){if(!e)return null;let n=document.createElement(`span`);if(n.classList.add(`mo-cm-tooltip`),n.classList.add(`docs-documentation`),t&&n.classList.add(`cm-tooltip-section`),n.style.display=`flex`,n.style.flexDirection=`column`,n.style.gap=`.8rem`,n.innerHTML=e,t){let e=document.createElement(`div`);e.classList.add(`text-xs`,`text-muted-foreground`,`font-medium`,`pt-1`,`-mt-2`,`border-t`,`border-border`);let t=document.createElement(`kbd`);t.className=`ml-1 rounded-md bg-muted/40 px-2 text-[0.75rem] font-prose center border border-foreground/20 text-muted-foreground inline whitespace-nowrap`,t.textContent=w()?`⌘`:`Ctrl`,e.append(document.createTextNode(`Jump to defining cell `)),e.append(t),e.append(document.createTextNode(` + Click`)),n.append(e)}return n}var Um=new Mn(`autocomplete-result`,async(e,t)=>{let{sendCodeCompletionRequest:n}=sn();await n({id:e,...t})}),Wm={param:3,property:2},Gm={asCompletionResult(e,t){return{from:e-t.prefix_length,options:t.options.map(e=>({label:e.name,type:e.type,boost:Wm[e.type]??1,info:()=>Hm(e.completion_info)})),validFor:/^\w*$/}},asHoverTooltip({position:e,message:t,limitToType:n,excludeTypes:r,exactName:i,showGoToDefinitionHint:a=!1}){let o=Km(t.options,i);if(!o)return;let s=e-t.prefix_length,c=Hm(o.completion_info,a);if(c&&!(n&&o.type!==n)&&!r?.includes(o.type))return{pos:s,html:o.completion_info,end:s+o.name.length,above:!0,create:()=>({dom:c,resize:!1})}}};function Km(e,t){if(e.length!==0){if(e.length===1)return e[0];if(t)return e.find(e=>e.name===t)}}function qm(e){return[e?.pylsp?.enabled&&wm(`pylsp`)||e?.ty?.enabled&&wm(`ty`)||e?.pyrefly?.enabled&&wm(`pyrefly`)||e?.basedpyright?.enabled&&wm(`basedpyright`)?[]:vt(async(e,t)=>{let n=await Jm({view:e,pos:t,excludeTypes:[`tooltip`]});return n===null||n===`cancelled`?null:n},{hideOnChange:!0}),Qm]}async function Jm({view:e,pos:t,excludeTypes:n}){let r=mr.findElement(e.dom);if(!r)return T.error(`Failed to find active cell.`),null;let i=mr.parse(r.id),{startToken:a,endToken:o}=Ym(e.state.doc,t),s=e.state.field(zm,!1)?.ranges.some(e=>t>=e.from&&t<=e.to)??!1,c=await Um.request({document:e.state.doc.slice(0,o).toString(),cellId:i});if(!c)return`cancelled`;let l=e.state.doc.slice(a,o).toString();return Gm.asHoverTooltip({position:o,message:c,exactName:l,excludeTypes:n,showGoToDefinitionHint:s})??null}function Ym(e,t){let n=t,r=n>0?e.sliceString(n-1,n):``,i=n<e.length?e.sliceString(n,n+1):``;r===`(`&&i===`)`&&--n;let a=n,o=n;for(;a>0;){let t=e.sliceString(a-1,a);if(!/\w/.test(t))break;a--}for(;o<e.length;){let t=e.sliceString(o,o+1);if(!/\w/.test(t))break;o++}return{startToken:a,endToken:o}}function Xm(e){let{head:t}=e.selection.main,n=e.doc.sliceString(t-1,t);return/\w/.test(n)}var Zm=S(async(e,t)=>{if(u.get(vm).selectedPanel!==`documentation`)return;let n=await Jm({view:e,pos:t});n!==`cancelled`&&u.set(Tm,{documentation:n?.html??null})},300),Qm=V.updateListener.of(e=>{if(e.selectionSet&&Xm(e.state)){let t=e.state.selection.main.head;Zm(e.view,t)}});function $m(e){var t=e.Pos;function n(e,t,n){if(t.line===n.line&&t.ch>=n.ch-1){var r=e.getLine(t.line).charCodeAt(t.ch);55296<=r&&r<=55551&&(n.ch+=1)}return{start:t,end:n}}var r=[{keys:`<Left>`,type:`keyToKey`,toKeys:`h`},{keys:`<Right>`,type:`keyToKey`,toKeys:`l`},{keys:`<Up>`,type:`keyToKey`,toKeys:`k`},{keys:`<Down>`,type:`keyToKey`,toKeys:`j`},{keys:`g<Up>`,type:`keyToKey`,toKeys:`gk`},{keys:`g<Down>`,type:`keyToKey`,toKeys:`gj`},{keys:`<Space>`,type:`keyToKey`,toKeys:`l`},{keys:`<BS>`,type:`keyToKey`,toKeys:`h`},{keys:`<Del>`,type:`keyToKey`,toKeys:`x`},{keys:`<C-Space>`,type:`keyToKey`,toKeys:`W`},{keys:`<C-BS>`,type:`keyToKey`,toKeys:`B`},{keys:`<S-Space>`,type:`keyToKey`,toKeys:`w`},{keys:`<S-BS>`,type:`keyToKey`,toKeys:`b`},{keys:`<C-n>`,type:`keyToKey`,toKeys:`j`},{keys:`<C-p>`,type:`keyToKey`,toKeys:`k`},{keys:`<C-[>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-c>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-[>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`<C-c>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`<C-Esc>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-Esc>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`s`,type:`keyToKey`,toKeys:`cl`,context:`normal`},{keys:`s`,type:`keyToKey`,toKeys:`c`,context:`visual`},{keys:`S`,type:`keyToKey`,toKeys:`cc`,context:`normal`},{keys:`S`,type:`keyToKey`,toKeys:`VdO`,context:`visual`},{keys:`<Home>`,type:`keyToKey`,toKeys:`0`},{keys:`<End>`,type:`keyToKey`,toKeys:`$`},{keys:`<PageUp>`,type:`keyToKey`,toKeys:`<C-b>`},{keys:`<PageDown>`,type:`keyToKey`,toKeys:`<C-f>`},{keys:`<CR>`,type:`keyToKey`,toKeys:`j^`,context:`normal`},{keys:`<Ins>`,type:`keyToKey`,toKeys:`i`,context:`normal`},{keys:`<Ins>`,type:`action`,action:`toggleOverwrite`,context:`insert`},{keys:`H`,type:`motion`,motion:`moveToTopLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`M`,type:`motion`,motion:`moveToMiddleLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`L`,type:`motion`,motion:`moveToBottomLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`h`,type:`motion`,motion:`moveByCharacters`,motionArgs:{forward:!1}},{keys:`l`,type:`motion`,motion:`moveByCharacters`,motionArgs:{forward:!0}},{keys:`j`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,linewise:!0}},{keys:`k`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!1,linewise:!0}},{keys:`gj`,type:`motion`,motion:`moveByDisplayLines`,motionArgs:{forward:!0}},{keys:`gk`,type:`motion`,motion:`moveByDisplayLines`,motionArgs:{forward:!1}},{keys:`w`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!1}},{keys:`W`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:`e`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:`E`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:`b`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1}},{keys:`B`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:`ge`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:`gE`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:`{`,type:`motion`,motion:`moveByParagraph`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`}`,type:`motion`,motion:`moveByParagraph`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`(`,type:`motion`,motion:`moveBySentence`,motionArgs:{forward:!1}},{keys:`)`,type:`motion`,motion:`moveBySentence`,motionArgs:{forward:!0}},{keys:`<C-f>`,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!0}},{keys:`<C-b>`,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!1}},{keys:`<C-d>`,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!0,explicitRepeat:!0}},{keys:`<C-u>`,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!1,explicitRepeat:!0}},{keys:`gg`,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:`G`,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:`g$`,type:`motion`,motion:`moveToEndOfDisplayLine`},{keys:`g^`,type:`motion`,motion:`moveToStartOfDisplayLine`},{keys:`g0`,type:`motion`,motion:`moveToStartOfDisplayLine`},{keys:`0`,type:`motion`,motion:`moveToStartOfLine`},{keys:`^`,type:`motion`,motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`+`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,toFirstChar:!0}},{keys:`-`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!1,toFirstChar:!0}},{keys:`_`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:`$`,type:`motion`,motion:`moveToEol`,motionArgs:{inclusive:!0}},{keys:`%`,type:`motion`,motion:`moveToMatchedSymbol`,motionArgs:{inclusive:!0,toJumplist:!0}},{keys:`f<character>`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`F<character>`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!1}},{keys:`t<character>`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`T<character>`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!1}},{keys:`;`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!0}},{keys:`,`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!1}},{keys:`'<register>`,type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0}},{keys:"]`",type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!0}},{keys:"[`",type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!1}},{keys:`]'`,type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!0,linewise:!0}},{keys:`['`,type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!1,linewise:!0}},{keys:`]p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:`[p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:`]<character>`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`[<character>`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`|`,type:`motion`,motion:`moveToColumn`},{keys:`o`,type:`motion`,motion:`moveToOtherHighlightedEnd`,context:`visual`},{keys:`O`,type:`motion`,motion:`moveToOtherHighlightedEnd`,motionArgs:{sameLine:!0},context:`visual`},{keys:`d`,type:`operator`,operator:`delete`},{keys:`y`,type:`operator`,operator:`yank`},{keys:`c`,type:`operator`,operator:`change`},{keys:`=`,type:`operator`,operator:`indentAuto`},{keys:`>`,type:`operator`,operator:`indent`,operatorArgs:{indentRight:!0}},{keys:`<`,type:`operator`,operator:`indent`,operatorArgs:{indentRight:!1}},{keys:`g~`,type:`operator`,operator:`changeCase`},{keys:`gu`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!0},isEdit:!0},{keys:`gU`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!1},isEdit:!0},{keys:`n`,type:`motion`,motion:`findNext`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`N`,type:`motion`,motion:`findNext`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`gn`,type:`motion`,motion:`findAndSelectNextInclusive`,motionArgs:{forward:!0}},{keys:`gN`,type:`motion`,motion:`findAndSelectNextInclusive`,motionArgs:{forward:!1}},{keys:`gq`,type:`operator`,operator:`hardWrap`},{keys:`gw`,type:`operator`,operator:`hardWrap`,operatorArgs:{keepCursor:!0}},{keys:`g?`,type:`operator`,operator:`rot13`},{keys:`x`,type:`operatorMotion`,operator:`delete`,motion:`moveByCharacters`,motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:`X`,type:`operatorMotion`,operator:`delete`,motion:`moveByCharacters`,motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:`D`,type:`operatorMotion`,operator:`delete`,motion:`moveToEol`,motionArgs:{inclusive:!0},context:`normal`},{keys:`D`,type:`operator`,operator:`delete`,operatorArgs:{linewise:!0},context:`visual`},{keys:`Y`,type:`operatorMotion`,operator:`yank`,motion:`expandToLine`,motionArgs:{linewise:!0},context:`normal`},{keys:`Y`,type:`operator`,operator:`yank`,operatorArgs:{linewise:!0},context:`visual`},{keys:`C`,type:`operatorMotion`,operator:`change`,motion:`moveToEol`,motionArgs:{inclusive:!0},context:`normal`},{keys:`C`,type:`operator`,operator:`change`,operatorArgs:{linewise:!0},context:`visual`},{keys:`~`,type:`operatorMotion`,operator:`changeCase`,motion:`moveByCharacters`,motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:`normal`},{keys:`~`,type:`operator`,operator:`changeCase`,context:`visual`},{keys:`<C-u>`,type:`operatorMotion`,operator:`delete`,motion:`moveToStartOfLine`,context:`insert`},{keys:`<C-w>`,type:`operatorMotion`,operator:`delete`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1},context:`insert`},{keys:`<C-w>`,type:`idle`,context:`normal`},{keys:`<C-i>`,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!0}},{keys:`<C-o>`,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!1}},{keys:`<C-e>`,type:`action`,action:`scroll`,actionArgs:{forward:!0,linewise:!0}},{keys:`<C-y>`,type:`action`,action:`scroll`,actionArgs:{forward:!1,linewise:!0}},{keys:`a`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`charAfter`},context:`normal`},{keys:`A`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`eol`},context:`normal`},{keys:`A`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`endOfSelectedArea`},context:`visual`},{keys:`i`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`inplace`},context:`normal`},{keys:`gi`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`lastEdit`},context:`normal`},{keys:`I`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`firstNonBlank`},context:`normal`},{keys:`gI`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`bol`},context:`normal`},{keys:`I`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`startOfSelectedArea`},context:`visual`},{keys:`o`,type:`action`,action:`newLineAndEnterInsertMode`,isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:`normal`},{keys:`O`,type:`action`,action:`newLineAndEnterInsertMode`,isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:`normal`},{keys:`v`,type:`action`,action:`toggleVisualMode`},{keys:`V`,type:`action`,action:`toggleVisualMode`,actionArgs:{linewise:!0}},{keys:`<C-v>`,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:`<C-q>`,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:`gv`,type:`action`,action:`reselectLastSelection`},{keys:`J`,type:`action`,action:`joinLines`,isEdit:!0},{keys:`gJ`,type:`action`,action:`joinLines`,actionArgs:{keepSpaces:!0},isEdit:!0},{keys:`p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:`P`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:`r<character>`,type:`action`,action:`replace`,isEdit:!0},{keys:`@<register>`,type:`action`,action:`replayMacro`},{keys:`q<register>`,type:`action`,action:`enterMacroRecordMode`},{keys:`R`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{replace:!0},context:`normal`},{keys:`R`,type:`operator`,operator:`change`,operatorArgs:{linewise:!0,fullLine:!0},context:`visual`,exitVisualBlock:!0},{keys:`u`,type:`action`,action:`undo`,context:`normal`},{keys:`u`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!0},context:`visual`,isEdit:!0},{keys:`U`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!1},context:`visual`,isEdit:!0},{keys:`<C-r>`,type:`action`,action:`redo`},{keys:`m<register>`,type:`action`,action:`setMark`},{keys:`"<register>`,type:`action`,action:`setRegister`},{keys:`<C-r><register>`,type:`action`,action:`insertRegister`,context:`insert`,isEdit:!0},{keys:`<C-o>`,type:`action`,action:`oneNormalCommand`,context:`insert`},{keys:`zz`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`center`}},{keys:`z.`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`center`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`zt`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`top`}},{keys:`z<CR>`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`top`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`zb`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`bottom`}},{keys:`z-`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`bottom`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`.`,type:`action`,action:`repeatLastEdit`},{keys:`<C-a>`,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:`<C-x>`,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:`<C-t>`,type:`action`,action:`indent`,actionArgs:{indentRight:!0},context:`insert`},{keys:`<C-d>`,type:`action`,action:`indent`,actionArgs:{indentRight:!1},context:`insert`},{keys:`a<register>`,type:`motion`,motion:`textObjectManipulation`},{keys:`i<register>`,type:`motion`,motion:`textObjectManipulation`,motionArgs:{textObjectInner:!0}},{keys:`/`,type:`search`,searchArgs:{forward:!0,querySrc:`prompt`,toJumplist:!0}},{keys:`?`,type:`search`,searchArgs:{forward:!1,querySrc:`prompt`,toJumplist:!0}},{keys:`*`,type:`search`,searchArgs:{forward:!0,querySrc:`wordUnderCursor`,wholeWordOnly:!0,toJumplist:!0}},{keys:`#`,type:`search`,searchArgs:{forward:!1,querySrc:`wordUnderCursor`,wholeWordOnly:!0,toJumplist:!0}},{keys:`g*`,type:`search`,searchArgs:{forward:!0,querySrc:`wordUnderCursor`,toJumplist:!0}},{keys:`g#`,type:`search`,searchArgs:{forward:!1,querySrc:`wordUnderCursor`,toJumplist:!0}},{keys:`:`,type:`ex`}],i=Object.create(null),a=r.length,o=[{name:`colorscheme`,shortName:`colo`},{name:`map`},{name:`imap`,shortName:`im`},{name:`nmap`,shortName:`nm`},{name:`vmap`,shortName:`vm`},{name:`omap`,shortName:`om`},{name:`noremap`,shortName:`no`},{name:`nnoremap`,shortName:`nn`},{name:`vnoremap`,shortName:`vn`},{name:`inoremap`,shortName:`ino`},{name:`onoremap`,shortName:`ono`},{name:`unmap`},{name:`mapclear`,shortName:`mapc`},{name:`nmapclear`,shortName:`nmapc`},{name:`vmapclear`,shortName:`vmapc`},{name:`imapclear`,shortName:`imapc`},{name:`omapclear`,shortName:`omapc`},{name:`write`,shortName:`w`},{name:`undo`,shortName:`u`},{name:`redo`,shortName:`red`},{name:`set`,shortName:`se`},{name:`setlocal`,shortName:`setl`},{name:`setglobal`,shortName:`setg`},{name:`sort`,shortName:`sor`},{name:`substitute`,shortName:`s`,possiblyAsync:!0},{name:`startinsert`,shortName:`start`},{name:`nohlsearch`,shortName:`noh`},{name:`yank`,shortName:`y`},{name:`delmarks`,shortName:`delm`},{name:`marks`,excludeFromCommandHistory:!0},{name:`registers`,shortName:`reg`,excludeFromCommandHistory:!0},{name:`vglobal`,shortName:`v`},{name:`delete`,shortName:`d`},{name:`join`,shortName:`j`},{name:`normal`,shortName:`norm`},{name:`global`,shortName:`g`}],s=pe(``);function c(t){t.setOption(`disableInput`,!0),t.setOption(`showCursorWhenSelecting`,!1),e.signal(t,`vim-mode-change`,{mode:`normal`}),t.on(`cursorActivity`,sn),re(t),e.on(t.getInputField(),`paste`,u(t))}function l(t){t.setOption(`disableInput`,!1),t.off(`cursorActivity`,sn),e.off(t.getInputField(),`paste`,u(t)),t.state.vim=null,Lt&&clearTimeout(Lt)}function u(e){var t=e.state.vim;return t.onPasteFn||=function(){t.insertMode||(e.setCursor(je(e.getCursor(),0,1)),De.enterInsertMode(e,{},t))},t.onPasteFn}var d=/[\d]/,f=[e.isWordChar,function(t){return t&&!e.isWordChar(t)&&!/\s/.test(t)}],p=[function(e){return/\S/.test(e)}],m=[`<`,`>`],h=[`-`,`"`,`.`,`:`,`_`,`/`,`+`],g=/^\w$/,_=/^[A-Z]$/;try{_=RegExp(`^[\\p{Lu}]$`,`u`)}catch{}function v(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function y(e){return/^[a-z]$/.test(e)}function b(e){return`()[]{}`.indexOf(e)!=-1}function x(e){return d.test(e)}function S(e){return _.test(e)}function C(e){return/^\s*$/.test(e)}function w(e){return`.?!`.indexOf(e)!=-1}function T(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}var E={};function D(e,t,n,r,i){if(t===void 0&&!i)throw Error(`defaultValue is required unless callback is provided`);if(n||=`string`,E[e]={type:n,defaultValue:t,callback:i},r)for(var a=0;a<r.length;a++)E[r[a]]=E[e];t&&O(e,t)}function O(e,t,n,r){var i=E[e];r||={};var a=r.scope;if(!i)return Error(`Unknown option: `+e);if(i.type==`boolean`){if(t&&t!==!0)return Error(`Invalid argument: `+e+`=`+t);t!==!1&&(t=!0)}i.callback?(a!==`local`&&i.callback(t,void 0),a!==`global`&&n&&i.callback(t,n)):(a!==`local`&&(i.value=i.type==`boolean`?!!t:t),a!==`global`&&n&&(n.state.vim.options[e]={value:t}))}function k(e,t,n){var r=E[e];n||={};var i=n.scope;if(!r)return Error(`Unknown option: `+e);if(r.callback){let e=t&&r.callback(void 0,t);return i!==`global`&&e!==void 0?e:i===`local`?void 0:r.callback()}return(i!==`global`&&t&&t.state.vim.options[e]||i!==`local`&&r||{}).value}D(`filetype`,void 0,`string`,[`ft`],function(e,t){if(t!==void 0){if(e===void 0){let e=t.getOption(`mode`);return e==`null`?``:e}{let n=e==``?`null`:e;t.setOption(`mode`,n)}}}),D(`textwidth`,80,`number`,[`tw`],function(e,t){if(t!==void 0){if(e===void 0)return t.getOption(`textwidth`);var n=Math.round(e);n>1&&t.setOption(`textwidth`,n)}});var ee=function(){var e=100,t=-1,n=0,r=0,i=Array(e);function a(a,o,s){var c=i[t%e];function l(n){var r=++t%e,o=i[r];o&&o.clear(),i[r]=a.setBookmark(n)}if(c){var u=c.find();u&&!Ie(u,o)&&l(o)}else l(o);l(s),n=t,r=t-e+1,r<0&&(r=0)}function o(a,o){t+=o,t>n?t=n:t<r&&(t=r);var s=i[(e+t)%e];if(s&&!s.find()){var c=o>0?1:-1,l,u=a.getCursor();do if(t+=c,s=i[(e+t)%e],s&&(l=s.find())&&!Ie(u,l))break;while(t<n&&t>r)}return s}function s(e,n){var r=t,i=o(e,n);return t=r,i&&i.find()}return{cachedCursor:void 0,add:a,find:s,move:o}},te=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class ne{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=te()}exitMacroRecordMode(){var e=A.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1}enterMacroRecordMode(e,t){var n=A.registerController.getRegister(t);if(n){if(n.clear(),this.latestRegister=t,e.openDialog){var r=At(`span`,{class:`cm-vim-message`},`recording @`+t);this.onRecordingDone=e.openDialog(r,function(){},{bottom:!0})}this.isRecording=!0}}}function re(e){return e.state.vim||(e.state.vim={inputState:new me,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:void 0,sel:{anchor:new t(0,0),head:new t(0,0)},options:{},expectLiteralNext:!1,status:``}),e.state.vim}var A;function j(){for(var e in A={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:ee(),macroModeState:new ne,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:``},registerController:new ye({}),searchHistoryController:new be,exCommandHistoryController:new be},E){var t=E[e];t.value=t.defaultValue}}class M{constructor(e,t){this.keyName=e,this.key=t.key,this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.shiftKey=t.shiftKey}}var ie,ae={enterVimMode:c,leaveVimMode:l,buildKeyMap:function(){},getRegisterController:function(){return A.registerController},resetVimGlobalState_:j,getVimGlobalState_:function(){return A},maybeInitVimState_:re,suppressErrorLogging:!1,InsertModeKey:M,map:function(e,t,n){Jt.map(e,t,n)},unmap:function(e,t){return Jt.unmap(e,t)},noremap:function(e,t,n){Jt.map(e,t,n,!0)},mapclear:function(e){var t=r.length,n=a,i=r.slice(0,t-n);if(r=r.slice(t-n),e)for(var o=i.length-1;o>=0;o--){var s=i[o];if(e!==s.context){if(s.context)this._mapCommand(s);else{var c=[`normal`,`insert`,`visual`];for(var l in c)if(c[l]!==e){var u=Object.assign({},s);u.context=c[l],this._mapCommand(u)}}}}},langmap:fe,vimKeyFromEvent:de,setOption:O,getOption:k,defineOption:D,defineEx:function(e,t,n){if(!t)t=e;else if(e.indexOf(t)!==0)throw Error(`(Vim.defineEx) "`+t+`" is not a prefix of "`+e+`", command not registered`);qt[e]=n,Jt.commandMap_[t]={name:e,shortName:t,type:`api`}},handleKey:function(e,t,n){var r=this.findKey(e,t,n);if(typeof r==`function`)return r()},multiSelectHandleKey:mn,findKey:function(t,n,i){var a=re(t),o=t;function s(){var e=A.macroModeState;if(e.isRecording){if(n==`q`)return e.exitMacroRecordMode(),he(o),!0;i!=`mapping`&&nn(e,n)}}function c(){if(n==`<Esc>`){if(a.visualMode)Qe(o);else if(a.insertMode)Xt(o);else return;return he(o),!0}}function l(){if(c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``),t=n.length==1,i=xe.matchCommand(e,r,a.inputState,`insert`),s=a.inputState.changeQueue;if(i.type==`none`)return he(o),!1;if(i.type==`partial`){if(i.expectLiteralNext&&(a.expectLiteralNext=!0),ie&&window.clearTimeout(ie),ie=t&&window.setTimeout(function(){a.insertMode&&a.inputState.keyBuffer.length&&he(o)},k(`insertModeEscKeysTimeout`)),t){var l=o.listSelections();(!s||s.removed.length!=l.length)&&(s=a.inputState.changeQueue=new ge),s.inserted+=n;for(var u=0;u<l.length;u++){var d=R(l[u].anchor,l[u].head),f=Le(l[u].anchor,l[u].head),p=o.getRange(d,o.state.overwrite?je(f,0,1):f);s.removed[u]=(s.removed[u]||``)+p}}return!t}if(i.type==`full`&&(a.inputState.keyBuffer.length=0),a.expectLiteralNext=!1,ie&&window.clearTimeout(ie),i.command&&s){for(var l=o.listSelections(),u=0;u<l.length;u++){var m=l[u].head;o.replaceRange(s.removed[u]||``,je(m,0,-s.inserted.length),m,`+input`)}A.macroModeState.lastInsertModeChanges.changes.pop()}return i.command||he(o),i.command}function u(){if(s()||c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``);if(/^[1-9]\d*$/.test(e))return!0;var t=/^(\d*)(.*)$/.exec(e);if(!t)return he(o),!1;var i=a.visualMode?`visual`:`normal`,l=t[2]||t[1];a.inputState.operatorShortcut&&a.inputState.operatorShortcut.slice(-1)==l&&(l=a.inputState.operatorShortcut);var u=xe.matchCommand(l,r,a.inputState,i);return u.type==`none`?(he(o),!1):u.type==`partial`?(u.expectLiteralNext&&(a.expectLiteralNext=!0),!0):u.type==`clear`?(he(o),!0):(a.expectLiteralNext=!1,a.inputState.keyBuffer.length=0,t=/^(\d*)(.*)$/.exec(e),t&&t[1]&&t[1]!=`0`&&a.inputState.pushRepeatDigit(t[1]),u.command)}var d=a.insertMode?l():u();if(d===!1)return!a.insertMode&&(n.length===1||e.isMac&&/<A-.>/.test(n))?function(){return!0}:void 0;if(d===!0)return function(){return!0};if(d)return function(){return o.operation(function(){o.curOp.isVimOp=!0;try{if(typeof d!=`object`)return;d.type==`keyToKey`?se(o,d.toKeys,d):xe.processCommand(o,a,d)}catch(e){throw o.state.vim=void 0,re(o),ae.suppressErrorLogging||console.log(e),e}return!0})}},handleEx:function(e,t){Jt.processCommand(e,t)},defineMotion:Ce,defineAction:Oe,defineOperator:Ee,mapCommand:en,_mapCommand:Zt,defineRegister:ve,exitVisualMode:Qe,exitInsertMode:Xt},N=[],oe=!1,P;function F(e){if(!P)throw Error(`No prompt to send key to`);if(e[0]==`<`){var t=e.toLowerCase().slice(1,-1);if(t=t.split(`-`).pop()||``,t==`lt`)e=`<`;else if(t==`space`)e=` `;else if(t==`cr`)e=`
|
|
54
|
-
`;else if(ue[t]){var n=P.value||``,r={key:ue[t],target:{value:n,selectionEnd:n.length,selectionStart:n.length}};P.onKeyDown&&P.onKeyDown(r,P.value,a),P&&P.onKeyUp&&P.onKeyUp(r,P.value,a);return}}if(e==`
|
|
55
|
-
`){var i=P;P=null,i.onClose&&i.onClose(i.value)}else P.value=(P.value||``)+e;function a(e){P&&(typeof e==`string`?P.value=e:P=null)}}function se(e,t,n){var r=oe;if(n){if(N.indexOf(n)!=-1)return;N.push(n),oe=n.noremap!=0}try{for(var i=re(e),a=/<(?:[CSMA]-)*\w+>|./gi,o;o=a.exec(t);){var s=o[0],c=i.insertMode;if(P){F(s);continue}if(!ae.handleKey(e,s,`mapping`)&&c&&i.insertMode){if(s[0]==`<`){var l=s.toLowerCase().slice(1,-1);if(l=l.split(`-`).pop()||``,l==`lt`)s=`<`;else if(l==`space`)s=` `;else if(l==`cr`)s=`
|
|
56
|
-
`;else if(ue.hasOwnProperty(l)){s=ue[l],dn(e,s);continue}else s=s[0],a.lastIndex=o.index+1}e.replaceSelection(s)}}}finally{if(N.pop(),oe=N.length?r:!1,!N.length&&P){var u=P;P=null,Nt(e,u)}}}var ce={Return:`CR`,Backspace:`BS`,Delete:`Del`,Escape:`Esc`,Insert:`Ins`,ArrowLeft:`Left`,ArrowRight:`Right`,ArrowUp:`Up`,ArrowDown:`Down`,Enter:`CR`," ":`Space`},le={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1,AltGraph:1,Dead:1,Unidentified:1},ue={};`Left|Right|Up|Down|End|Home`.split(`|`).concat(Object.keys(ce)).forEach(function(e){ue[(ce[e]||``).toLowerCase()]=ue[e.toLowerCase()]=e});function de(t,n){var r=t.key;if(!le[r]){r.length>1&&r[0]==`n`&&(r=r.replace(`Numpad`,``)),r=ce[r]||r;var a=``;if(t.ctrlKey&&(a+=`C-`),t.altKey&&(a+=`A-`),t.metaKey&&(a+=`M-`),e.isMac&&a==`A-`&&r.length==1&&(a=a.slice(2)),(a||r.length>1)&&t.shiftKey&&(a+=`S-`),n&&!n.expectLiteralNext&&r.length==1){if(s.keymap&&r in s.keymap)(s.remapCtrl!=0||!a)&&(r=s.keymap[r]);else if(r.charCodeAt(0)>128&&!i[r]){var o=t.code?.slice(-1)||``;t.shiftKey||(o=o.toLowerCase()),o&&(r=o,!a&&t.altKey&&(a=`A-`))}}return a+=r,a.length>1&&(a=`<`+a+`>`),a}}function fe(e,t){s.string!==e&&(s=pe(e)),s.remapCtrl=t}function pe(e){let t={};if(!e)return{keymap:t,string:``};function n(e){return e.split(/\\?(.)/).filter(Boolean)}return e.split(/((?:[^\\,]|\\.)+),/).map(e=>{if(!e)return;let r=e.split(/((?:[^\\;]|\\.)+);/);if(r.length==3){let e=n(r[1]),i=n(r[2]);if(e.length!==i.length)return;for(let n=0;n<e.length;++n)t[e[n]]=i[n]}else if(r.length==1){let r=n(e);if(r.length%2!=0)return;for(let e=0;e<r.length;e+=2)t[r[e]]=r[e+1]}}),{keymap:t,string:e}}D(`langmap`,void 0,`string`,[`lmap`],function(e,t){if(e===void 0)return s.string;fe(e)});class me{constructor(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=void 0,this.changeQueue=null}pushRepeatDigit(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)}getRepeat(){var e=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(``),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(``),10))),e}}function he(t,n){t.state.vim.inputState=new me,t.state.vim.expectLiteralNext=!1,e.signal(t,`vim-command-done`,n)}function ge(){this.removed=[],this.inserted=``}class _e{constructor(e,t,n){this.clear(),this.keyBuffer=[e||``],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!n}setText(e,t,n){this.keyBuffer=[e||``],this.linewise=!!t,this.blockwise=!!n}pushText(e,t){t&&(this.linewise||this.keyBuffer.push(`
|
|
57
|
-
`),this.linewise=!0),this.keyBuffer.push(e)}pushInsertModeChanges(e){this.insertModeChanges.push(te(e))}pushSearchQuery(e){this.searchQueries.push(e)}clear(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1}toString(){return this.keyBuffer.join(``)}}function ve(e,t){var n=A.registerController.registers;if(!e||e.length!=1)throw Error(`Register name must be 1 character`);if(n[e])throw Error(`Register already defined `+e);n[e]=t,h.push(e)}class ye{constructor(e){this.registers=e,this.unnamedRegister=e[`"`]=new _e,e[`.`]=new _e,e[`:`]=new _e,e[`/`]=new _e,e[`+`]=new _e}pushText(e,t,n,r,i){if(e!==`_`){r&&n.charAt(n.length-1)!==`
|
|
58
|
-
`&&(n+=`
|
|
59
|
-
`);var a=this.isValidRegister(e)?this.getRegister(e):null;if(!a||!e){switch(t){case`yank`:this.registers[0]=new _e(n,r,i);break;case`delete`:case`change`:n.indexOf(`
|
|
60
|
-
`)==-1?this.registers[`-`]=new _e(n,r):(this.shiftNumericRegisters_(),this.registers[1]=new _e(n,r))}this.unnamedRegister.setText(n,r,i);return}S(e)?a.pushText(n,r):a.setText(n,r,i),e===`+`&&navigator.clipboard.writeText(n),this.unnamedRegister.setText(a.toString(),r)}}getRegister(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new _e),this.registers[e]):this.unnamedRegister}isValidRegister(e){return e&&(T(e,h)||g.test(e))}shiftNumericRegisters_(){for(var e=9;e>=2;e--)this.registers[e]=this.getRegister(``+(e-1))}}class be{constructor(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}nextMatch(e,t){var n=this.historyBuffer,r=t?-1:1;this.initialPrefix===null&&(this.initialPrefix=e);for(var i=this.iterator+r;t?i>=0:i<n.length;i+=r)for(var a=n[i],o=0;o<=a.length;o++)if(this.initialPrefix==a.substring(0,o))return this.iterator=i,a;if(i>=n.length)return this.iterator=n.length,this.initialPrefix;if(i<0)return e}pushInput(e){var t=this.historyBuffer.indexOf(e);t>-1&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)}reset(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}}var xe={matchCommand:function(e,t,n,r){var i=Me(e,t,r,n),a=i.full[0];if(!a)return i.partial.length?{type:`partial`,expectLiteralNext:i.partial.length==1&&i.partial[0].keys.slice(-11)==`<character>`}:{type:`none`};if(a.keys.slice(-11)==`<character>`||a.keys.slice(-10)==`<register>`){var o=Pe(e);if(!o||o.length>1)return{type:`clear`};n.selectedCharacter=o}return{type:`full`,command:a}},processCommand:function(e,t,n){switch(t.inputState.repeatOverride=n.repeatOverride,n.type){case`motion`:this.processMotion(e,t,n);break;case`operator`:this.processOperator(e,t,n);break;case`operatorMotion`:this.processOperatorMotion(e,t,n);break;case`action`:this.processAction(e,t,n);break;case`search`:this.processSearch(e,t,n);break;case`ex`:case`keyToEx`:this.processEx(e,t,n)}},processMotion:function(e,t,n){t.inputState.motion=n.motion,t.inputState.motionArgs=Ae(n.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,n){var r=t.inputState;if(r.operator){if(r.operator==n.operator){r.motion=`expandToLine`,r.motionArgs={linewise:!0,repeat:1},this.evalInput(e,t);return}he(e)}r.operator=n.operator,r.operatorArgs=Ae(n.operatorArgs),n.keys.length>1&&(r.operatorShortcut=n.keys),n.exitVisualBlock&&(t.visualBlock=!1,Ye(e)),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,n){var r=t.visualMode,i=Ae(n.operatorMotionArgs);i&&r&&i.visualLine&&(t.visualLine=!0),this.processOperator(e,t,n),r||this.processMotion(e,t,n)},processAction:function(e,t,n){var r=t.inputState,i=r.getRepeat(),a=!!i,o=Ae(n.actionArgs)||{repeat:1};r.selectedCharacter&&(o.selectedCharacter=r.selectedCharacter),n.operator&&this.processOperator(e,t,n),n.motion&&this.processMotion(e,t,n),(n.motion||n.operator)&&this.evalInput(e,t),o.repeat=i||1,o.repeatIsExplicit=a,o.registerName=r.registerName,he(e),t.lastMotion=null,n.isEdit&&this.recordLastEdit(t,r,n),De[n.action](e,o,t)},processSearch:function(t,n,r){if(!t.getSearchCursor)return;var i=r.searchArgs.forward,a=r.searchArgs.wholeWordOnly;yt(t).setReversed(!i);var o=i?`/`:`?`,s=yt(t).getQuery(),c=t.getScrollInfo(),l=``;function u(e,i,a){A.searchHistoryController.pushInput(e),A.searchHistoryController.reset();try{Ft(t,e,i,a)}catch{jt(t,`Invalid regex: `+e),he(t);return}xe.processMotion(t,n,{keys:``,type:`motion`,motion:`findNext`,motionArgs:{forward:!0,toJumplist:r.searchArgs.toJumplist}})}function d(e){t.scrollTo(c.left,c.top),u(e,!0,!0);var n=A.macroModeState;n.isRecording&&an(n,e)}function f(){return k(`pcre`)?`(JavaScript regexp: set pcre)`:`(Vim regexp: set nopcre)`}function p(e,t,n){var r=de(e),i,a;r==`<Up>`||r==`<Down>`?(i=r==`<Up>`,a=e.target?e.target.selectionEnd:0,t=A.searchHistoryController.nextMatch(t,i)||``,n(t),a&&e.target&&(e.target.selectionEnd=e.target.selectionStart=Math.min(a,e.target.value.length))):r&&r!=`<Left>`&&r!=`<Right>`&&A.searchHistoryController.reset(),l=t,m()}function m(){var e;try{e=Ft(t,l,!0,!0)}catch{}e?t.scrollIntoView(zt(t,!i,e),30):(Vt(t),t.scrollTo(c.left,c.top))}function h(n,r,i){var a=de(n);a==`<Esc>`||a==`<C-c>`||a==`<C-[>`||a==`<BS>`&&r==``?(A.searchHistoryController.pushInput(r),A.searchHistoryController.reset(),Ft(t,s?.source||``),Vt(t),t.scrollTo(c.left,c.top),e.e_stop(n),he(t),i(),t.focus()):a==`<Up>`||a==`<Down>`?e.e_stop(n):a==`<C-u>`&&(e.e_stop(n),i(``))}switch(r.searchArgs.querySrc){case`prompt`:var g=A.macroModeState;g.isPlaying?u(g.replaySearchQueries.shift()||``,!0,!1):Nt(t,{onClose:d,prefix:o,desc:At(`span`,{$cursor:`pointer`,onmousedown:function(e){e.preventDefault(),O(`pcre`,!k(`pcre`)),this.textContent=f(),m()}},f()),onKeyUp:p,onKeyDown:h});break;case`wordUnderCursor`:var _=tt(t,{noSymbol:!0}),v=!0;if(_||(_=tt(t,{noSymbol:!1}),v=!1),!_){jt(t,`No word under cursor`),he(t);return}let e=t.getLine(_.start.line).substring(_.start.ch,_.end.ch);e=v&&a?`\\b`+e+`\\b`:Ve(e),A.jumpList.cachedCursor=t.getCursor(),t.setCursor(_.start),u(e,!0,!1)}},processEx:function(t,n,r){function i(e){A.exCommandHistoryController.pushInput(e),A.exCommandHistoryController.reset(),Jt.processCommand(t,e),t.state.vim&&he(t),Vt(t)}function a(n,r,i){var a=de(n),o,s;(a==`<Esc>`||a==`<C-c>`||a==`<C-[>`||a==`<BS>`&&r==``)&&(A.exCommandHistoryController.pushInput(r),A.exCommandHistoryController.reset(),e.e_stop(n),he(t),Vt(t),i(),t.focus()),a==`<Up>`||a==`<Down>`?(e.e_stop(n),o=a==`<Up>`,s=n.target?n.target.selectionEnd:0,r=A.exCommandHistoryController.nextMatch(r,o)||``,i(r),s&&n.target&&(n.target.selectionEnd=n.target.selectionStart=Math.min(s,n.target.value.length))):a==`<C-u>`?(e.e_stop(n),i(``)):a&&a!=`<Left>`&&a!=`<Right>`&&A.exCommandHistoryController.reset()}function o(n,r){var i=new e.StringStream(r),a={};try{if(Jt.parseInput_(t,i,a),a.commandName!=`s`){Vt(t);return}var o=Jt.matchCommand_(a.commandName);if(!o||(Jt.parseCommandArgs_(i,a,o),!a.argString))return;var s=kt(a.argString.slice(1),!0,!0);s&&Rt(t,s)}catch{}}if(r.type==`keyToEx`)Jt.processCommand(t,r.exArgs.input);else{var s={onClose:i,onKeyDown:a,onKeyUp:o,prefix:`:`};n.visualMode&&(s.value=`'<,'>`,s.selectValueOnOpen=!1),Nt(t,s)}},evalInput:function(e,r){var i=r.inputState,a=i.motion,o=i.motionArgs||{repeat:1},s=i.operator,c=i.operatorArgs||{},l=i.registerName,u=r.sel,d=I(r.visualMode?ke(e,u.head):e.getCursor(`head`)),f=I(r.visualMode?ke(e,u.anchor):e.getCursor(`anchor`)),p=I(d),m=I(f),h,g,_;if(s&&this.recordLastEdit(r,i),_=i.repeatOverride===void 0?i.getRepeat():i.repeatOverride,_>0&&o.explicitRepeat?o.repeatIsExplicit=!0:(o.noRepeat||!o.explicitRepeat&&_===0)&&(_=1,o.repeatIsExplicit=!1),i.selectedCharacter&&(o.selectedCharacter=c.selectedCharacter=i.selectedCharacter),o.repeat=_,he(e),a){var v=Se[a](e,d,o,r,i);if(r.lastMotion=Se[a],!v)return;if(o.toJumplist){var y=A.jumpList,b=y.cachedCursor;b?(rt(e,b,v),delete y.cachedCursor):rt(e,d,v)}v instanceof Array?(g=v[0],h=v[1]):h=v,h||=I(d),r.visualMode?(r.visualBlock&&h.ch===1/0||(h=ke(e,h,p)),g&&=ke(e,g),g||=m,u.anchor=g,u.head=h,Ye(e),ft(e,r,`<`,L(g,h)?g:h),ft(e,r,`>`,L(g,h)?h:g)):s||(h=ke(e,h,p),e.setCursor(h.line,h.ch))}if(s){if(c.lastSel){g=m;var x=c.lastSel,S=Math.abs(x.head.line-x.anchor.line),C=Math.abs(x.head.ch-x.anchor.ch);h=x.visualLine?new t(m.line+S,m.ch):x.visualBlock?new t(m.line+S,m.ch+C):x.head.line==x.anchor.line?new t(m.line,m.ch+C):new t(m.line+S,m.ch),r.visualMode=!0,r.visualLine=x.visualLine,r.visualBlock=x.visualBlock,u=r.sel={anchor:g,head:h},Ye(e)}else r.visualMode&&(c.lastSel={anchor:I(u.anchor),head:I(u.head),visualBlock:r.visualBlock,visualLine:r.visualLine});var w,T,E,D,O;if(r.visualMode){w=R(u.head,u.anchor),T=Le(u.head,u.anchor),E=r.visualLine||c.linewise,D=r.visualBlock?`block`:E?`line`:`char`;var k=n(e,w,T);if(O=Xe(e,{anchor:k.start,head:k.end},D),E){var ee=O.ranges;if(D==`block`)for(var te=0;te<ee.length;te++)ee[te].head.ch=ze(e,ee[te].head.line);else D==`line`&&(ee[0].head=new t(ee[0].head.line+1,0))}}else{if(w=I(g||m),T=I(h||p),L(T,w)){var ne=w;w=T,T=ne}E=o.linewise||c.linewise,E?et(e,w,T):o.forward&&$e(e,w,T),D=`char`;var re=!o.inclusive||E,k=n(e,w,T);O=Xe(e,{anchor:k.start,head:k.end},D,re)}e.setSelections(O.ranges,O.primary),r.lastMotion=null,c.repeat=_,c.registerName=l,c.linewise=E;var j=Te[s](e,c,O.ranges,m,h);r.visualMode&&Qe(e,j!=null),j&&e.setCursor(j)}},recordLastEdit:function(e,t,n){var r=A.macroModeState;r.isPlaying||(e.lastEditInputState=t,e.lastEditActionCommand=n,r.lastInsertModeChanges.changes=[],r.lastInsertModeChanges.expectCursorActivityForChange=!1,r.lastInsertModeChanges.visualBlock=e.visualBlock?e.sel.head.line-e.sel.anchor.line:0)}},Se={moveToTopLine:function(e,n,r){var i=Ut(e).top+r.repeat-1;return new t(i,z(e.getLine(i)))},moveToMiddleLine:function(e){var n=Ut(e),r=Math.floor((n.top+n.bottom)*.5);return new t(r,z(e.getLine(r)))},moveToBottomLine:function(e,n,r){var i=Ut(e).bottom-r.repeat+1;return new t(i,z(e.getLine(i)))},expandToLine:function(e,n,r){return new t(n.line+r.repeat-1,1/0)},findNext:function(e,t,n){var r=yt(e),i=r.getQuery();if(i){var a=!n.forward;a=r.isReversed()?!a:a,Rt(e,i);var o=zt(e,a,i,n.repeat);return o||jt(e,`No match found `+i+(k(`pcre`)?` (set nopcre to use Vim regexps)`:``)),o}},findAndSelectNextInclusive:function(n,r,i,a,o){var s=yt(n),c=s.getQuery();if(c){var l=!i.forward;l=s.isReversed()?!l:l;var u=Bt(n,l,c,i.repeat,a);if(u){if(o.operator)return u;var d=u[0],f=new t(u[1].line,u[1].ch-1);if(a.visualMode){(a.visualLine||a.visualBlock)&&(a.visualLine=!1,a.visualBlock=!1,e.signal(n,`vim-mode-change`,{mode:`visual`,subMode:``}));var p=a.sel.anchor;if(p)return s.isReversed()?i.forward?[p,d]:[p,f]:i.forward?[p,f]:[p,d]}else a.visualMode=!0,a.visualLine=!1,a.visualBlock=!1,e.signal(n,`vim-mode-change`,{mode:`visual`,subMode:``});return l?[f,d]:[d,f]}}},goToMark:function(e,t,n,r){var i=Wt(e,r,n.selectedCharacter||``);return i?n.linewise?{line:i.line,ch:z(e.getLine(i.line))}:i:null},moveToOtherHighlightedEnd:function(e,n,r,i){var a=i.sel;return i.visualBlock&&r.sameLine?[ke(e,new t(a.anchor.line,a.head.ch)),ke(e,new t(a.head.line,a.anchor.ch))]:[a.head,a.anchor]},jumpToMark:function(e,n,r,i){for(var a=n,o=0;o<r.repeat;o++){var s=a;for(var c in i.marks)if(y(c)){var l=i.marks[c].find();if(!(r.forward?L(l,s):L(s,l))&&!(r.linewise&&l.line==s.line)){var u=Ie(s,a),d=r.forward?Re(s,l,a):Re(a,l,s);(u||d)&&(a=l)}}}return r.linewise&&(a=new t(a.line,z(e.getLine(a.line)))),a},moveByCharacters:function(e,n,r){var i=n,a=r.repeat,o=r.forward?i.ch+a:i.ch-a;return new t(i.line,o)},moveByLines:function(e,n,r,i){var a=n,o=a.ch;switch(i.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:o=i.lastHPos;break;default:i.lastHPos=o}var s=r.repeat+(r.repeatOffset||0),c=r.forward?a.line+s:a.line-s,l=e.firstLine(),u=e.lastLine(),d=e.findPosV(a,r.forward?s:-s,`line`,i.lastHSPos);return(r.forward?d.line>c:d.line<c)&&(c=d.line,o=d.ch),c<l&&a.line==l?this.moveToStartOfLine(e,n,r,i):c>u&&a.line==u?ut(e,n,r,i,!0):(r.toFirstChar&&(o=z(e.getLine(c)),i.lastHPos=o),i.lastHSPos=e.charCoords(new t(c,o),`div`).left,new t(c,o))},moveByDisplayLines:function(e,n,r,i){var a=n;switch(i.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:i.lastHSPos=e.charCoords(a,`div`).left}var o=r.repeat,s=e.findPosV(a,r.forward?o:-o,`line`,i.lastHSPos);if(s.hitSide){if(r.forward){var c={top:e.charCoords(s,`div`).top+8,left:i.lastHSPos};s=e.coordsChar(c,`div`)}else{var l=e.charCoords(new t(e.firstLine(),0),`div`);l.left=i.lastHSPos,s=e.coordsChar(l,`div`)}}return i.lastHPos=s.ch,s},moveByPage:function(e,t,n){var r=t,i=n.repeat;return e.findPosV(r,n.forward?i:-i,`page`)},moveByParagraph:function(e,t,n){var r=n.forward?1:-1;return mt(e,t,n.repeat,r).start},moveBySentence:function(e,t,n){var r=n.forward?1:-1;return V(e,t,n.repeat,r)},moveByScroll:function(e,t,n,r){var i=e.getScrollInfo(),a=null,o=n.repeat;o||=i.clientHeight/(2*e.defaultTextHeight());var s=e.charCoords(t,`local`);if(n.repeat=o,a=Se.moveByDisplayLines(e,t,n,r),!a)return null;var c=e.charCoords(a,`local`);return e.scrollTo(null,i.top+c.top-s.top),a},moveByWords:function(e,t,n){return lt(e,t,n.repeat,!!n.forward,!!n.wordEnd,!!n.bigWord)},moveTillCharacter:function(e,t,n){var r=n.repeat,i=B(e,r,n.forward,n.selectedCharacter,t),a=n.forward?-1:1;return it(a,n),i?(i.ch+=a,i):null},moveToCharacter:function(e,t,n){var r=n.repeat;return it(0,n),B(e,r,n.forward,n.selectedCharacter,t)||t},moveToSymbol:function(e,t,n){var r=n.repeat;return n.selectedCharacter&&st(e,r,n.forward,n.selectedCharacter)||t},moveToColumn:function(e,t,n,r){var i=n.repeat;return r.lastHPos=i-1,r.lastHSPos=e.charCoords(t,`div`).left,dt(e,i)},moveToEol:function(e,t,n,r){return ut(e,t,n,r,!1)},moveToFirstNonWhiteSpaceCharacter:function(e,n){var r=n;return new t(r.line,z(e.getLine(r.line)))},moveToMatchedSymbol:function(e,n){for(var r=n,i=r.line,a=r.ch,o=e.getLine(i),s;a<o.length;a++)if(s=o.charAt(a),s&&b(s)){var c=e.getTokenTypeAt(new t(i,a+1));if(c!==`string`&&c!==`comment`)break}if(a<o.length){var l=s===`<`||s===`>`?/[(){}[\]<>]/:/[(){}[\]]/;return e.findMatchingBracket(new t(i,a),{bracketRegex:l}).to}return r},moveToStartOfLine:function(e,n){return new t(n.line,0)},moveToLineOrEdgeOfDocument:function(e,n,r){var i=r.forward?e.lastLine():e.firstLine();return r.repeatIsExplicit&&(i=r.repeat-e.getOption(`firstLineNumber`)),new t(i,z(e.getLine(i)))},moveToStartOfDisplayLine:function(e){return e.execCommand(`goLineLeft`),e.getCursor()},moveToEndOfDisplayLine:function(e){e.execCommand(`goLineRight`);var t=e.getCursor();return t.sticky==`before`&&t.ch--,t},textObjectManipulation:function(e,t,n,r){var i={"(":`)`,")":`(`,"{":`}`,"}":`{`,"[":`]`,"]":`[`,"<":`>`,">":`<`},a={"'":!0,'"':!0,"`":!0},o=n.selectedCharacter||``;o==`b`?o=`(`:o==`B`&&(o=`{`);var s=!n.textObjectInner,c,l;if(i[o]){if(l=!0,c=gt(e,t,o,s),!c){var u=e.getSearchCursor(RegExp(`\\`+o,`g`),t);u.find()&&(c=gt(e,u.from(),o,s))}}else if(a[o])l=!0,c=_t(e,t,o,s);else if(o===`W`||o===`w`)for(var d=n.repeat||1;d-->0;){var f=tt(e,{inclusive:s,innerWord:!s,bigWord:o===`W`,noSymbol:o===`W`,multiline:!0},c&&c.end);f&&(c||=f,c.end=f.end)}else if(o===`p`){if(c=mt(e,t,n.repeat,0,s),n.linewise=!0,r.visualMode)r.visualLine||=!0;else{var p=r.inputState.operatorArgs;p&&(p.linewise=!0),c.end.line--}}else if(o===`t`)c=nt(e,t,s);else if(o===`s`){var m=e.getLine(t.line);t.ch>0&&w(m[t.ch])&&--t.ch;var h=ht(e,t,n.repeat,1,s),g=ht(e,t,n.repeat,-1,s);C(e.getLine(g.line)[g.ch])&&C(e.getLine(h.line)[h.ch-1])&&(g={line:g.line,ch:g.ch+1}),c={start:g,end:h}}return c?e.state.vim.visualMode?Je(e,c.start,c.end,l):[c.start,c.end]:null},repeatLastCharacterSearch:function(e,t,n){var r=A.lastCharacterSearch,i=n.repeat,a=n.forward===r.forward,o=!!r.increment*(a?-1:1);e.moveH(-o,`char`),n.inclusive=!!a;var s=B(e,i,a,r.selectedCharacter);return s?(s.ch+=o,s):(e.moveH(o,`char`),t)}};function Ce(e,t){Se[e]=t}function we(e,t){for(var n=[],r=0;r<t;r++)n.push(e);return n}var Te={change:function(e,n,r){var i,a,o=e.state.vim,s=r[0].anchor,c=r[0].head;if(!o.visualMode){a=e.getRange(s,c);var l=o.lastEditInputState;if(l?.motion==`moveByWords`&&!C(a)){var u=/\s+$/.exec(a);u&&l.motionArgs&&l.motionArgs.forward&&(c=je(c,0,-u[0].length),a=a.slice(0,-u[0].length))}n.linewise&&(s=new t(s.line,z(e.getLine(s.line))),c.line>s.line&&(c=new t(c.line-1,Number.MAX_VALUE))),e.replaceRange(``,s,c),i=s}else if(n.fullLine)c.ch=Number.MAX_VALUE,c.line--,e.setSelection(s,c),a=e.getSelection(),e.replaceSelection(``),i=s;else{a=e.getSelection();var d=we(``,r.length);e.replaceSelections(d),i=R(r[0].head,r[0].anchor)}A.registerController.pushText(n.registerName,`change`,a,n.linewise,r.length>1),De.enterInsertMode(e,{head:i},e.state.vim)},delete:function(e,n,r){var i,a,o=e.state.vim;if(o.visualBlock){a=e.getSelection();var s=we(``,r.length);e.replaceSelections(s),i=R(r[0].head,r[0].anchor)}else{var c=r[0].anchor,l=r[0].head;n.linewise&&l.line!=e.firstLine()&&c.line==e.lastLine()&&c.line==l.line-1&&(c.line==e.firstLine()?c.ch=0:c=new t(c.line-1,ze(e,c.line-1))),a=e.getRange(c,l),e.replaceRange(``,c,l),i=c,n.linewise&&(i=Se.moveToFirstNonWhiteSpaceCharacter(e,c))}return A.registerController.pushText(n.registerName,`delete`,a,n.linewise,o.visualBlock),ke(e,i)},indent:function(e,t,n){var r=e.state.vim,i=r.visualMode&&t.repeat||1;if(r.visualBlock){for(var a=e.getOption(`tabSize`),o=e.getOption(`indentWithTabs`)?` `:` `.repeat(a),s,c=n.length-1;c>=0;c--)if(s=R(n[c].anchor,n[c].head),t.indentRight)e.replaceRange(o.repeat(i),s,s);else{for(var l=e.getLine(s.line),u=0,d=0;d<i;d++){var f=l[s.ch+u];if(f==` `)u++;else if(f==` `){u++;for(var p=1;p<o.length&&(f=l[s.ch+u],f===` `);p++)u++}else break}e.replaceRange(``,s,je(s,0,u))}return s}if(e.indentMore)for(var d=0;d<i;d++)t.indentRight?e.indentMore():e.indentLess();else{var m=n[0].anchor.line,h=r.visualBlock?n[n.length-1].anchor.line:n[0].head.line;t.linewise&&h--;for(var c=m;c<=h;c++)for(var d=0;d<i;d++)e.indentLine(c,t.indentRight)}return Se.moveToFirstNonWhiteSpaceCharacter(e,n[0].anchor)},indentAuto:function(e,t,n){return e.execCommand(`indentAuto`),Se.moveToFirstNonWhiteSpaceCharacter(e,n[0].anchor)},hardWrap:function(e,n,r,i){if(e.hardWrap){var a=r[0].anchor.line,o=r[0].head.line;n.linewise&&o--;var s=e.hardWrap({from:a,to:o});return s>a&&n.linewise&&s--,n.keepCursor?i:new t(s,0)}},changeCase:function(e,t,n,r,i){for(var a=e.getSelections(),o=[],s=t.toLower,c=0;c<a.length;c++){var l=a[c],u=``;if(s===!0)u=l.toLowerCase();else if(s===!1)u=l.toUpperCase();else for(var d=0;d<l.length;d++){var f=l.charAt(d);u+=S(f)?f.toLowerCase():f.toUpperCase()}o.push(u)}return e.replaceSelections(o),t.shouldMoveCursor?i:!e.state.vim.visualMode&&t.linewise&&n[0].anchor.line+1==n[0].head.line?Se.moveToFirstNonWhiteSpaceCharacter(e,r):t.linewise?r:R(n[0].anchor,n[0].head)},yank:function(e,t,n,r){var i=e.state.vim,a=e.getSelection(),o=i.visualMode?R(i.sel.anchor,i.sel.head,n[0].head,n[0].anchor):r;return A.registerController.pushText(t.registerName,`yank`,a,t.linewise,i.visualBlock),o},rot13:function(e,t,n,r,i){for(var a=e.getSelections(),o=[],s=0;s<a.length;s++){let e=a[s].split(``).map(e=>{let t=e.charCodeAt(0);return t>=65&&t<=90?String.fromCharCode(65+(t-65+13)%26):t>=97&&t<=122?String.fromCharCode(97+(t-97+13)%26):e}).join(``);o.push(e)}return e.replaceSelections(o),t.shouldMoveCursor?i:!e.state.vim.visualMode&&t.linewise&&n[0].anchor.line+1==n[0].head.line?Se.moveToFirstNonWhiteSpaceCharacter(e,r):t.linewise?r:R(n[0].anchor,n[0].head)}};function Ee(e,t){Te[e]=t}var De={jumpListWalk:function(e,t,n){if(!n.visualMode){var r=t.repeat||1,i=t.forward,a=A.jumpList.move(e,i?r:-r),o=a?a.find():void 0;o||=e.getCursor(),e.setCursor(o)}},scroll:function(e,t,n){if(!n.visualMode){var r=t.repeat||1,i=e.defaultTextHeight(),a=e.getScrollInfo().top,o=i*r,s=t.forward?a+o:a-o,c=I(e.getCursor()),l=e.charCoords(c,`local`);if(t.forward)s>l.top?(c.line+=(s-l.top)/i,c.line=Math.ceil(c.line),e.setCursor(c),l=e.charCoords(c,`local`),e.scrollTo(null,l.top)):e.scrollTo(null,s);else{var u=s+e.getScrollInfo().clientHeight;u<l.bottom?(c.line-=(l.bottom-u)/i,c.line=Math.floor(c.line),e.setCursor(c),l=e.charCoords(c,`local`),e.scrollTo(null,l.bottom-e.getScrollInfo().clientHeight)):e.scrollTo(null,s)}}},scrollToCursor:function(e,n){var r=e.getCursor().line,i=e.charCoords(new t(r,0),`local`),a=e.getScrollInfo().clientHeight,o=i.top;switch(n.position){case`center`:o=i.bottom-a/2;break;case`bottom`:var s=new t(r,e.getLine(r).length-1),c=e.charCoords(s,`local`).bottom-o;o=o-a+c}e.scrollTo(null,o)},replayMacro:function(e,t,n){var r=t.selectedCharacter||``,i=t.repeat||1,a=A.macroModeState;for(r==`@`?r=a.latestRegister||``:a.latestRegister=r;i--;)tn(e,n,a,r)},enterMacroRecordMode:function(e,t){var n=A.macroModeState,r=t.selectedCharacter;A.registerController.isValidRegister(r)&&n.enterMacroRecordMode(e,r)},toggleOverwrite:function(t){t.state.overwrite?(t.toggleOverwrite(!1),t.setOption(`keyMap`,`vim-insert`),e.signal(t,`vim-mode-change`,{mode:`insert`})):(t.toggleOverwrite(!0),t.setOption(`keyMap`,`vim-replace`),e.signal(t,`vim-mode-change`,{mode:`replace`}))},enterInsertMode:function(r,i,a){if(!r.getOption(`readOnly`)){a.insertMode=!0,a.insertModeRepeat=i&&i.repeat||1;var o=i?i.insertAt:null,s=a.sel,c=i.head||r.getCursor(`head`),l=r.listSelections().length;if(o==`eol`)c=new t(c.line,ze(r,c.line));else if(o==`bol`)c=new t(c.line,0);else if(o==`charAfter`){var u=n(r,c,je(c,0,1));c=u.end}else if(o==`firstNonBlank`){var u=n(r,c,Se.moveToFirstNonWhiteSpaceCharacter(r,c));c=u.end}else if(o==`startOfSelectedArea`){if(!a.visualMode)return;a.visualBlock?(c=new t(Math.min(s.head.line,s.anchor.line),Math.min(s.head.ch,s.anchor.ch)),l=Math.abs(s.head.line-s.anchor.line)+1):c=s.head.line<s.anchor.line?s.head:new t(s.anchor.line,0)}else if(o==`endOfSelectedArea`){if(!a.visualMode)return;a.visualBlock?(c=new t(Math.min(s.head.line,s.anchor.line),Math.max(s.head.ch,s.anchor.ch)+1),l=Math.abs(s.head.line-s.anchor.line)+1):c=s.head.line>=s.anchor.line?je(s.head,0,1):new t(s.anchor.line,0)}else if(o==`inplace`){if(a.visualMode)return}else o==`lastEdit`&&(c=Gt(r)||c);r.setOption(`disableInput`,!1),i&&i.replace?(r.toggleOverwrite(!0),r.setOption(`keyMap`,`vim-replace`),e.signal(r,`vim-mode-change`,{mode:`replace`})):(r.toggleOverwrite(!1),r.setOption(`keyMap`,`vim-insert`),e.signal(r,`vim-mode-change`,{mode:`insert`})),A.macroModeState.isPlaying||(r.on(`change`,on),a.insertEnd&&a.insertEnd.clear(),a.insertEnd=r.setBookmark(c,{insertLeft:!0}),e.on(r.getInputField(),`keydown`,ln)),a.visualMode&&Qe(r),We(r,c,l)}},toggleVisualMode:function(r,i,a){var o=i.repeat,s=r.getCursor(),c;if(a.visualMode)a.visualLine!=!!i.linewise||a.visualBlock!=!!i.blockwise?(a.visualLine=!!i.linewise,a.visualBlock=!!i.blockwise,e.signal(r,`vim-mode-change`,{mode:`visual`,subMode:a.visualLine?`linewise`:a.visualBlock?`blockwise`:``}),Ye(r)):Qe(r);else{a.visualMode=!0,a.visualLine=!!i.linewise,a.visualBlock=!!i.blockwise,c=ke(r,new t(s.line,s.ch+o-1));var l=n(r,s,c);a.sel={anchor:l.start,head:l.end},e.signal(r,`vim-mode-change`,{mode:`visual`,subMode:a.visualLine?`linewise`:a.visualBlock?`blockwise`:``}),Ye(r),ft(r,a,`<`,R(s,c)),ft(r,a,`>`,Le(s,c))}},reselectLastSelection:function(t,n,r){var i=r.lastSelection;if(r.visualMode&&qe(t,r),i){var a=i.anchorMark.find(),o=i.headMark.find();if(!a||!o)return;r.sel={anchor:a,head:o},r.visualMode=!0,r.visualLine=i.visualLine,r.visualBlock=i.visualBlock,Ye(t),ft(t,r,`<`,R(a,o)),ft(t,r,`>`,Le(a,o)),e.signal(t,`vim-mode-change`,{mode:`visual`,subMode:r.visualLine?`linewise`:r.visualBlock?`blockwise`:``})}},joinLines:function(e,n,r){var i,a;if(r.visualMode){if(i=e.getCursor(`anchor`),a=e.getCursor(`head`),L(a,i)){var o=a;a=i,i=o}a.ch=ze(e,a.line)-1}else{var s=Math.max(n.repeat,2);i=e.getCursor(),a=ke(e,new t(i.line+s-1,1/0))}for(var c=0,l=i.line;l<a.line;l++){c=ze(e,i.line);var u=``,d=0;if(!n.keepSpaces){var f=e.getLine(i.line+1);d=f.search(/\S/),d==-1?d=f.length:u=` `}e.replaceRange(u,new t(i.line,c),new t(i.line+1,d))}var p=ke(e,new t(i.line,c));r.visualMode&&Qe(e,!1),e.setCursor(p)},newLineAndEnterInsertMode:function(n,r,i){i.insertMode=!0;var a=I(n.getCursor());a.line===n.firstLine()&&!r.after?(n.replaceRange(`
|
|
61
|
-
`,new t(n.firstLine(),0)),n.setCursor(n.firstLine(),0)):(a.line=r.after?a.line:a.line-1,a.ch=ze(n,a.line),n.setCursor(a),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(n)),this.enterInsertMode(n,{repeat:r.repeat},i)},paste:function(e,t,n){var r=A.registerController.getRegister(t.registerName);if(t.registerName===`+`)navigator.clipboard.readText().then(i=>{this.continuePaste(e,t,n,i,r)});else{var i=r.toString();this.continuePaste(e,t,n,i,r)}},continuePaste:function(e,n,r,i,a){var o=I(e.getCursor());if(i){if(n.matchIndent){var s=e.getOption(`tabSize`),c=function(e){var t=e.split(` `).length-1,n=e.split(` `).length-1;return t*s+n*1},l=c(e.getLine(e.getCursor().line).match(/^\s*/)[0]),u=i.replace(/\n$/,``),d=i!==u,f=c(i.match(/^\s*/)[0]),i=u.replace(/^\s*/gm,function(t){var n=l+(c(t)-f);if(n<0)return``;if(e.getOption(`indentWithTabs`)){var r=Math.floor(n/s);return Array(r+1).join(` `)}return Array(n+1).join(` `)});i+=d?`
|
|
62
|
-
`:``}n.repeat>1&&(i=Array(n.repeat+1).join(i));var p=a.linewise,m=a.blockwise,h=m?i.split(`
|
|
63
|
-
`):void 0;if(h){p&&h.pop();for(var g=0;g<h.length;g++)h[g]=h[g]==``?` `:h[g];o.ch+=+!!n.after,o.ch=Math.min(ze(e,o.line),o.ch)}else p?r.visualMode?i=r.visualLine?i.slice(0,-1):`
|
|
64
|
-
`+i.slice(0,i.length-1)+`
|
|
65
|
-
`:n.after?(i=`
|
|
66
|
-
`+i.slice(0,i.length-1),o.ch=ze(e,o.line)):o.ch=0:o.ch+=+!!n.after;var _;if(r.visualMode){r.lastPastedText=i;var v,y=Ke(e),b=y[0],x=y[1],S=e.getSelection(),C=e.listSelections(),w=Array(C.length).join(`1`).split(`1`);r.lastSelection&&(v=r.lastSelection.headMark.find()),A.registerController.unnamedRegister.setText(S),m?(e.replaceSelections(w),x=new t(b.line+i.length-1,b.ch),e.setCursor(b),Ue(e,x),e.replaceSelections(i),_=b):r.visualBlock?(e.replaceSelections(w),e.setCursor(b),e.replaceRange(i,b,b),_=b):(e.replaceRange(i,b,x),_=e.posFromIndex(e.indexFromPos(b)+i.length-1)),v&&(r.lastSelection.headMark=e.setBookmark(v)),p&&(_.ch=0)}else if(m&&h){e.setCursor(o);for(var g=0;g<h.length;g++){var T=o.line+g;T>e.lastLine()&&e.replaceRange(`
|
|
67
|
-
`,new t(T,0)),ze(e,T)<o.ch&&He(e,T,o.ch)}e.setCursor(o),Ue(e,new t(o.line+h.length-1,o.ch)),e.replaceSelections(h),_=o}else if(e.replaceRange(i,o),p){var T=n.after?o.line+1:o.line;_=new t(T,z(e.getLine(T)))}else _=I(o),/\n/.test(i)||(_.ch+=i.length-+!!n.after);r.visualMode&&Qe(e,!1),e.setCursor(_)}},undo:function(t,n){t.operation(function(){Fe(t,e.commands.undo,n.repeat)(),t.setCursor(ke(t,t.getCursor(`start`)))})},redo:function(t,n){Fe(t,e.commands.redo,n.repeat)()},setRegister:function(e,t,n){n.inputState.registerName=t.selectedCharacter},insertRegister:function(e,t,n){var r=t.selectedCharacter,i=A.registerController.getRegister(r),a=i&&i.toString();a&&e.replaceSelection(a)},oneNormalCommand:function(t,n,r){Xt(t,!0),r.insertModeReturn=!0,e.on(t,`vim-command-done`,function n(){r.visualMode||(r.insertModeReturn&&(r.insertModeReturn=!1,r.insertMode||De.enterInsertMode(t,{},r)),e.off(t,`vim-command-done`,n))})},setMark:function(e,t,n){var r=t.selectedCharacter;r&&ft(e,n,r,e.getCursor())},replace:function(r,i,a){var o=i.selectedCharacter||``,s=r.getCursor(),c,l,u=r.listSelections();if(a.visualMode)s=r.getCursor(`start`),l=r.getCursor(`end`);else{var d=r.getLine(s.line);c=s.ch+i.repeat,c>d.length&&(c=d.length),l=new t(s.line,c)}var f=n(r,s,l);if(s=f.start,l=f.end,o==`
|
|
68
|
-
`)a.visualMode||r.replaceRange(``,s,l),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(r);else{var p=r.getRange(s,l);if(p=p.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,o),p=p.replace(/[^\n]/g,o),a.visualBlock){var m=Array(r.getOption(`tabSize`)+1).join(` `);p=r.getSelection(),p=p.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,o);var h=p.replace(/\t/g,m).replace(/[^\n]/g,o).split(`
|
|
69
|
-
`);r.replaceSelections(h)}else r.replaceRange(p,s,l);a.visualMode?(s=L(u[0].anchor,u[0].head)?u[0].anchor:u[0].head,r.setCursor(s),Qe(r,!1)):r.setCursor(je(l,0,-1))}},incrementNumberToken:function(e,n){for(var r=e.getCursor(),i=e.getLine(r.line),a=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi,o,s,c,l;(o=a.exec(i))!==null&&(s=o.index,c=s+o[0].length,!(r.ch<c)););if(!(!n.backtrack&&c<=r.ch)){if(o){var u=o[2]||o[4],d=o[3]||o[5],f=n.increase?1:-1,p={"0b":2,0:8,"":10,"0x":16}[u.toLowerCase()];l=(parseInt(o[1]+d,p)+f*n.repeat).toString(p);var m=u?Array(d.length-l.length+1+o[1].length).join(`0`):``;l=l.charAt(0)===`-`?`-`+u+m+l.substr(1):u+m+l;var h=new t(r.line,s),g=new t(r.line,c);e.replaceRange(l,h,g)}else return;e.setCursor(new t(r.line,s+l.length-1))}},repeatLastEdit:function(e,t,n){var r=n.lastEditInputState;if(r){var i=t.repeat;i&&t.repeatIsExplicit?r.repeatOverride=i:i=r.repeatOverride||i,un(e,n,i,!1)}},indent:function(e,t){e.indentLine(e.getCursor().line,t.indentRight)},exitInsertMode:function(e,t){Xt(e)}};function Oe(e,t){De[e]=t}function ke(e,n,r){var i=e.state.vim,a=i.insertMode||i.visualMode,o=Math.min(Math.max(e.firstLine(),n.line),e.lastLine()),s=e.getLine(o),c=s.length-1+Number(!!a),l=Math.min(Math.max(0,n.ch),c),u=s.charCodeAt(l);if(56320<=u&&u<=57343){var d=1;r&&r.line==o&&r.ch>l&&(d=-1),l+=d,l>c&&(l-=2)}return new t(o,l)}function Ae(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}function je(e,n,r){return typeof n==`object`&&(r=n.ch,n=n.line),new t(e.line+n,e.ch+r)}function Me(e,t,n,r){r.operator&&(n=`operatorPending`);for(var i,o=[],s=[],c=oe?t.length-a:0;c<t.length;c++){var l=t[c];n==`insert`&&l.context!=`insert`||l.context&&l.context!=n||r.operator&&l.type==`action`||!(i=Ne(e,l.keys))||(i==`partial`&&o.push(l),i==`full`&&s.push(l))}return{partial:o,full:s}}function Ne(e,t){let n=t.slice(-11)==`<character>`,r=t.slice(-10)==`<register>`;if(n||r){var i=t.length-(n?11:10),a=e.slice(0,i),o=t.slice(0,i);return a==o&&e.length>i?`full`:o.indexOf(a)==0&&`partial`}return e==t?`full`:t.indexOf(e)==0&&`partial`}function Pe(e){var t=/^.*(<[^>]+>)$/.exec(e),n=t?t[1]:e.slice(-1);if(n.length>1)switch(n){case`<CR>`:case`<S-CR>`:n=`
|
|
70
|
-
`;break;case`<Space>`:case`<S-Space>`:n=` `;break;default:n=``}return n}function Fe(e,t,n){return function(){for(var r=0;r<n;r++)t(e)}}function I(e){return new t(e.line,e.ch)}function Ie(e,t){return e.ch==t.ch&&e.line==t.line}function L(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function R(e,t){return arguments.length>2&&(t=R.apply(void 0,Array.prototype.slice.call(arguments,1))),L(e,t)?e:t}function Le(e,t){return arguments.length>2&&(t=Le.apply(void 0,Array.prototype.slice.call(arguments,1))),L(e,t)?t:e}function Re(e,t,n){var r=L(e,t),i=L(t,n);return r&&i}function ze(e,t){return e.getLine(t).length}function Be(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,``)}function Ve(e){return e.replace(/([.?*+$\[\]\/\\(){}|\-])/g,`\\$1`)}function He(e,n,r){var i=ze(e,n),a=Array(r-i+1).join(` `);e.setCursor(new t(n,i)),e.replaceRange(a,e.getCursor())}function Ue(e,n){var r=[],i=e.listSelections(),a=I(e.clipPos(n)),o=!Ie(n,a),s=Ge(i,e.getCursor(`head`)),c=Ie(i[s].head,i[s].anchor),l=i.length-1,u=l-s>s?l:0,d=i[u].anchor,f=Math.min(d.line,a.line),p=Math.max(d.line,a.line),m=d.ch,h=a.ch,g=i[u].head.ch-m,_=h-m;g>0&&_<=0?(m++,o||h--):g<0&&_>=0?(m--,c||h++):g<0&&_==-1&&(m--,h++);for(var v=f;v<=p;v++){var y={anchor:new t(v,m),head:new t(v,h)};r.push(y)}return e.setSelections(r),n.ch=h,d.ch=m,d}function We(e,t,n){for(var r=[],i=0;i<n;i++){var a=je(t,i,0);r.push({anchor:a,head:a})}e.setSelections(r,0)}function Ge(e,t,n){for(var r=0;r<e.length;r++){var i=Ie(e[r].anchor,t),a=Ie(e[r].head,t);if(i||a)return r}return-1}function Ke(e,t){var n=e.listSelections(),r=n[0],i=n[n.length-1];return[L(r.anchor,r.head)?r.anchor:r.head,L(i.anchor,i.head)?i.head:i.anchor]}function qe(e,t){var n=t.sel.anchor,r=t.sel.head;t.lastPastedText&&=(r=e.posFromIndex(e.indexFromPos(n)+t.lastPastedText.length),void 0),t.lastSelection={anchorMark:e.setBookmark(n),headMark:e.setBookmark(r),anchor:I(n),head:I(r),visualMode:t.visualMode,visualLine:t.visualLine,visualBlock:t.visualBlock}}function Je(e,n,r,i){var a=e.state.vim.sel,o=i?n:a.head,s=i?n:a.anchor,c;return L(r,n)&&(c=r,r=n,n=c),L(o,s)?(o=R(n,o),s=Le(s,r)):(s=R(n,s),o=Le(o,r),o=je(o,0,-1),o.ch==-1&&o.line!=e.firstLine()&&(o=new t(o.line-1,ze(e,o.line-1)))),[s,o]}function Ye(e,t,n){var r=e.state.vim;t||=r.sel,n||=r.visualLine?`line`:r.visualBlock?`block`:`char`;var i=Xe(e,t,n);e.setSelections(i.ranges,i.primary)}function Xe(e,n,r,i){var a=I(n.head),o=I(n.anchor);if(r==`char`){var s=+(!i&&!L(n.head,n.anchor)),c=+!!L(n.head,n.anchor);return a=je(n.head,0,s),o=je(n.anchor,0,c),{ranges:[{anchor:o,head:a}],primary:0}}if(r==`line`){if(L(n.head,n.anchor))a.ch=0,o.ch=ze(e,o.line);else{o.ch=0;var l=e.lastLine();a.line>l&&(a.line=l),a.ch=ze(e,a.line)}return{ranges:[{anchor:o,head:a}],primary:0}}if(r==`block`){var u=Math.min(o.line,a.line),d=o.ch,f=Math.max(o.line,a.line),p=a.ch;d<p?p+=1:d+=1;for(var m=f-u+1,h=a.line==u?0:m-1,g=[],_=0;_<m;_++)g.push({anchor:new t(u+_,d),head:new t(u+_,p)});return{ranges:g,primary:h}}throw`never happens`}function Ze(e){var t=e.getCursor(`head`);return e.getSelection().length==1&&(t=R(t,e.getCursor(`anchor`))),t}function Qe(t,n){var r=t.state.vim;n!==!1&&t.setCursor(ke(t,r.sel.head)),qe(t,r),r.visualMode=!1,r.visualLine=!1,r.visualBlock=!1,r.insertMode||e.signal(t,`vim-mode-change`,{mode:`normal`})}function $e(e,t,n){var r=e.getRange(t,n);if(/\n\s*$/.test(r)){var i=r.split(`
|
|
71
|
-
`);i.pop();for(var a=i.pop();i.length>0&&a&&C(a);a=i.pop())n.line--,n.ch=0;a?(n.line--,n.ch=ze(e,n.line)):n.ch=0}}function et(e,t,n){t.ch=0,n.ch=0,n.line++}function z(e){if(!e)return 0;var t=e.search(/\S/);return t==-1?e.length:t}function tt(e,{inclusive:n,innerWord:r,bigWord:i,noSymbol:a,multiline:o},s){var c=s||Ze(e),l=e.getLine(c.line),u=l,d=c.line,m=d,h=c.ch,g,_=a?f[0]:p[0];if(r&&/\s/.test(l.charAt(h)))_=function(e){return/\s/.test(e)};else{for(;!_(l.charAt(h));)if(h++,h>=l.length){if(!o)return null;h--,g=ct(e,c,!0,i,!0);break}i?_=p[0]:(_=f[0],_(l.charAt(h))||(_=f[1]))}for(var v=h,y=h;_(l.charAt(y))&&y>=0;)y--;if(y++,g)v=g.to,m=g.line,u=e.getLine(m),!u&&v==0&&v++;else for(;_(l.charAt(v))&&v<l.length;)v++;if(n){var b=v,x=c.ch<=y&&/\s/.test(l.charAt(c.ch));if(!x)for(;/\s/.test(u.charAt(v))&&v<u.length;)v++;if(b==v||x){for(var S=y;/\s/.test(l.charAt(y-1))&&y>0;)y--;!y&&!x&&(y=S)}}return{start:new t(d,y),end:new t(m,v)}}function nt(t,n,r){var i=n;if(!e.findMatchingTag||!e.findEnclosingTag)return{start:i,end:i};var a=e.findMatchingTag(t,n)||e.findEnclosingTag(t,n);return!a||!a.open||!a.close?{start:i,end:i}:r?{start:a.open.from,end:a.close.to}:{start:a.open.to,end:a.close.from}}function rt(e,t,n){Ie(t,n)||A.jumpList.add(e,t,n)}function it(e,t){A.lastCharacterSearch.increment=e,A.lastCharacterSearch.forward=t.forward,A.lastCharacterSearch.selectedCharacter=t.selectedCharacter}var at={"(":`bracket`,")":`bracket`,"{":`bracket`,"}":`bracket`,"[":`section`,"]":`section`,"*":`comment`,"/":`comment`,m:`method`,M:`method`,"#":`preprocess`},ot={bracket:{isComplete:function(e){if(e.nextCh===e.symb){if(e.depth++,e.depth>=1)return!0}else e.nextCh===e.reverseSymb&&e.depth--;return!1}},section:{init:function(e){e.curMoveThrough=!0,e.symb=(e.forward?`]`:`[`)===e.symb?`{`:`}`},isComplete:function(e){return e.index===0&&e.nextCh===e.symb}},comment:{isComplete:function(e){var t=e.lastCh===`*`&&e.nextCh===`/`;return e.lastCh=e.nextCh,t}},method:{init:function(e){e.symb=e.symb===`m`?`{`:`}`,e.reverseSymb=e.symb===`{`?`}`:`{`},isComplete:function(e){return e.nextCh===e.symb}},preprocess:{init:function(e){e.index=0},isComplete:function(e){if(e.nextCh===`#`){var t=e.lineText.match(/^#(\w+)/)?.[1];if(t===`endif`){if(e.forward&&e.depth===0)return!0;e.depth++}else if(t===`if`){if(!e.forward&&e.depth===0)return!0;e.depth--}if(t===`else`&&e.depth===0)return!0}return!1}}};function st(e,n,r,i){var a=I(e.getCursor()),o=r?1:-1,s=r?e.lineCount():-1,c=a.ch,l=a.line,u=e.getLine(l),d={lineText:u,nextCh:u.charAt(c),lastCh:null,index:c,symb:i,reverseSymb:(r?{")":`(`,"}":`{`}:{"(":`)`,"{":`}`})[i],forward:r,depth:0,curMoveThrough:!1},f=at[i];if(!f)return a;var p=ot[f].init,m=ot[f].isComplete;for(p&&p(d);l!==s&&n;){if(d.index+=o,d.nextCh=d.lineText.charAt(d.index),!d.nextCh){if(l+=o,d.lineText=e.getLine(l)||``,o>0)d.index=0;else{var h=d.lineText.length;d.index=h>0?h-1:0}d.nextCh=d.lineText.charAt(d.index)}m(d)&&(a.line=l,a.ch=d.index,n--)}return d.nextCh||d.curMoveThrough?new t(l,d.index):a}function ct(e,t,n,r,i){var a=t.line,o=t.ch,s=e.getLine(a),c=n?1:-1,l=r?p:f;if(i&&s==``){if(a+=c,s=e.getLine(a),!v(e,a))return null;o=n?0:s.length}for(;;){if(i&&s==``)return{from:0,to:0,line:a};for(var u=c>0?s.length:-1,d=u,m=u;o!=u;){for(var h=!1,g=0;g<l.length&&!h;++g)if(l[g](s.charAt(o))){for(d=o;o!=u&&l[g](s.charAt(o));)o+=c;if(m=o,h=d!=m,d==t.ch&&a==t.line&&m==d+c)continue;return{from:Math.min(d,m+1),to:Math.max(d,m),line:a}}h||(o+=c)}if(a+=c,!v(e,a))return null;s=e.getLine(a),o=c>0?0:s.length}}function lt(e,n,r,i,a,o){var s=I(n),c=[];(i&&!a||!i&&a)&&r++;for(var l=!(i&&a),u=0;u<r;u++){var d=ct(e,n,i,o,l);if(!d){var f=ze(e,e.lastLine());c.push(i?{line:e.lastLine(),from:f,to:f}:{line:0,from:0,to:0});break}c.push(d),n=new t(d.line,i?d.to-1:d.from)}var p=c.length!=r,m=c[0],h=c.pop();return i&&!a?(!p&&(m.from!=s.ch||m.line!=s.line)&&(h=c.pop()),h&&new t(h.line,h.from)):i&&a?h&&new t(h.line,h.to-1):!i&&a?(!p&&(m.to!=s.ch||m.line!=s.line)&&(h=c.pop()),h&&new t(h.line,h.to)):h&&new t(h.line,h.from)}function ut(e,n,r,i,a){var o=new t(n.line+r.repeat-1,1/0),s=e.clipPos(o);return s.ch--,a||(i.lastHPos=1/0,i.lastHSPos=e.charCoords(s,`div`).left),o}function B(e,n,r,i,a){if(i){for(var o=a||e.getCursor(),s=o.ch,c,l=0;l<n;l++){var u=e.getLine(o.line);if(c=pt(s,u,i,r),c==-1)return;s=c}if(c!=null)return new t(e.getCursor().line,c)}}function dt(e,n){var r=e.getCursor().line;return ke(e,new t(r,n-1))}function ft(e,t,n,r){!T(n,m)&&!g.test(n)||(t.marks[n]&&t.marks[n].clear(),t.marks[n]=e.setBookmark(r))}function pt(e,t,n,r,i){return r?t.indexOf(n,e+1):t.lastIndexOf(n,e-1)}function mt(e,n,r,i,a){var o=n.line,s=e.firstLine(),c=e.lastLine(),l,u,d=o;function f(t){return!e.getLine(t)}function p(e,t,n){return n?f(e)!=f(e+t):!f(e)&&f(e+t)}if(i){for(;s<=d&&d<=c&&r>0;)p(d,i)&&r--,d+=i;return{start:new t(d,0),end:n}}var m=e.state.vim;if(m.visualLine&&p(o,1,!0)){var h=m.sel.anchor;p(h.line,-1,!0)&&(!a||h.line!=o)&&(o+=1)}var g=f(o);for(d=o;d<=c&&r;d++)p(d,1,!0)&&(!a||f(d)!=g)&&r--;for(u=new t(d,0),d>c&&!g?g=!0:a=!1,d=o;d>s&&!((!a||f(d)==g||d==o)&&p(d,-1,!0));d--);return l=new t(d,0),{start:l,end:u}}function ht(e,n,r,i,a){function o(e){e.line!==null&&(e.pos+e.dir<0||e.pos+e.dir>=e.line.length?e.line=null:e.pos+=e.dir)}function s(e,t,n,r){var i={line:e.getLine(t),ln:t,pos:n,dir:r};if(i.line===``)return{ln:i.ln,pos:i.pos};var s=i.pos;for(o(i);i.line!==null;){if(s=i.pos,w(i.line[i.pos])){if(a){for(o(i);i.line!==null&&C(i.line[i.pos]);)s=i.pos,o(i);return{ln:i.ln,pos:s+1}}return{ln:i.ln,pos:i.pos+1}}o(i)}return{ln:i.ln,pos:s+1}}function c(e,t,n,r){var i=e.getLine(t),s={line:i,ln:t,pos:n,dir:r};if(s.line===``)return{ln:s.ln,pos:s.pos};var c=s.pos;for(o(s);s.line!==null;){if(!C(s.line[s.pos])&&!w(s.line[s.pos]))c=s.pos;else if(w(s.line[s.pos]))return a&&C(s.line[s.pos+1])?{ln:s.ln,pos:s.pos+1}:{ln:s.ln,pos:c};o(s)}return s.line=i,a&&C(s.line[s.pos])?{ln:s.ln,pos:s.pos}:{ln:s.ln,pos:c}}for(var l={ln:n.line,pos:n.ch};r>0;)l=i<0?c(e,l.ln,l.pos,i):s(e,l.ln,l.pos,i),r--;return new t(l.ln,l.pos)}function V(e,n,r,i){function a(e,t){if(t.line!==null){if(t.pos+t.dir<0||t.pos+t.dir>=t.line.length){if(t.ln+=t.dir,!v(e,t.ln)){t.line=null;return}t.line=e.getLine(t.ln),t.pos=t.dir>0?0:t.line.length-1}else t.pos+=t.dir}}function o(e,t,n,r){var i=e.getLine(t),o=i===``,s={line:i,ln:t,pos:n,dir:r},c={ln:s.ln,pos:s.pos},l=s.line===``;for(a(e,s);s.line!==null;){if(c.ln=s.ln,c.pos=s.pos,s.line===``&&!l||o&&s.line!==``&&!C(s.line[s.pos]))return{ln:s.ln,pos:s.pos};w(s.line[s.pos])&&!o&&(s.pos===s.line.length-1||C(s.line[s.pos+1]))&&(o=!0),a(e,s)}var i=e.getLine(c.ln);c.pos=0;for(var u=i.length-1;u>=0;--u)if(!C(i[u])){c.pos=u;break}return c}function s(e,t,n,r){var i=e.getLine(t),o={line:i,ln:t,pos:n,dir:r},s=o.ln,c=null,l=o.line===``;for(a(e,o);o.line!==null;){if(o.line===``&&!l)return c===null?{ln:o.ln,pos:o.pos}:{ln:s,pos:c};if(w(o.line[o.pos])&&c!==null&&(o.ln!==s||o.pos+1!==c))return{ln:s,pos:c};o.line!==``&&!C(o.line[o.pos])&&(l=!1,s=o.ln,c=o.pos),a(e,o)}var i=e.getLine(s);c=0;for(var u=0;u<i.length;++u)if(!C(i[u])){c=u;break}return{ln:s,pos:c}}for(var c={ln:n.line,pos:n.ch};r>0;)c=i<0?s(e,c.ln,c.pos,i):o(e,c.ln,c.pos,i),r--;return new t(c.ln,c.pos)}function gt(e,n,r,i){var a=n,o={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[r],s={"(":`(`,")":`(`,"[":`[`,"]":`[`,"{":`{`,"}":`{`,"<":`<`,">":`<`}[r],c=+(e.getLine(a.line).charAt(a.ch)===s),l=e.scanForBracket(new t(a.line,a.ch+c),-1,void 0,{bracketRegex:o}),u=e.scanForBracket(new t(a.line,a.ch+c),1,void 0,{bracketRegex:o});if(!l||!u)return null;var d=l.pos,f=u.pos;if(d.line==f.line&&d.ch>f.ch||d.line>f.line){var p=d;d=f,f=p}return i?f.ch+=1:d.ch+=1,{start:d,end:f}}function _t(e,n,r,i){var a=I(n),o=e.getLine(a.line).split(``),s,c,l,u,d=o.indexOf(r);if(a.ch<d)a.ch=d;else if(d<a.ch&&o[a.ch]==r){var f=/string/.test(e.getTokenTypeAt(je(n,0,1))),p=/string/.test(e.getTokenTypeAt(n));f&&!p||(c=a.ch,--a.ch)}if(o[a.ch]==r&&!c)s=a.ch+1;else for(l=a.ch;l>-1&&!s;l--)o[l]==r&&(s=l+1);if(s&&!c)for(l=s,u=o.length;l<u&&!c;l++)o[l]==r&&(c=l);return!s||!c?{start:a,end:a}:(i&&(--s,++c),{start:new t(a.line,s),end:new t(a.line,c)})}D(`pcre`,!0,`boolean`);class vt{constructor(){this.highlightTimeout}getQuery(){return A.query}setQuery(e){A.query=e}getOverlay(){return this.searchOverlay}setOverlay(e){this.searchOverlay=e}isReversed(){return A.isReversed}setReversed(e){A.isReversed=e}getScrollbarAnnotate(){return this.annotate}setScrollbarAnnotate(e){this.annotate=e}}function yt(e){var t=e.state.vim;return t.searchState_||=new vt}function bt(e){return St(e,`/`)}function xt(e){return Ct(e,`/`)}function St(e,t){var n=Ct(e,t)||[];if(!n.length)return[];var r=[];if(n[0]===0){for(var i=0;i<n.length;i++)typeof n[i]==`number`&&r.push(e.substring(n[i]+1,n[i+1]));return r}}function Ct(e,t){t||=`/`;for(var n=!1,r=[],i=0;i<e.length;i++){var a=e.charAt(i);!n&&a==t&&r.push(i),n=!n&&a==`\\`}return r}function wt(e){var t={V:`|(){+?*.[$^`,M:`|(){+?*.[`,m:`|(){+?`,v:`<>`},n={">":`(?<=[\\w])(?=[^\\w]|$)`,"<":`(?<=[^\\w]|^)(?=[\\w])`},r=t.m,i=e.replace(/\\.|[\[|(){+*?.$^<>]/g,function(e){if(e[0]===`\\`){var i=e[1];return i===`}`||r.indexOf(i)!=-1?i:i in t?(r=t[i],``):i in n?n[i]:e}return r.indexOf(e)==-1?e:n[e]||`\\`+e}),a=i.indexOf(`\\zs`);return a!=-1&&(i=`(?<=`+i.slice(0,a)+`)`+i.slice(a+3)),a=i.indexOf(`\\ze`),a!=-1&&(i=i.slice(0,a)+`(?=`+i.slice(a+3)+`)`),i}var Tt={"\\n":`
|
|
72
|
-
`,"\\r":`\r`,"\\t":` `};function Et(e){for(var t=!1,n=[],r=-1;r<e.length;r++){var i=e.charAt(r)||``,a=e.charAt(r+1)||``;Tt[i+a]?(n.push(Tt[i+a]),r++):t?(n.push(i),t=!1):i===`\\`?(t=!0,x(a)||a===`$`?n.push(`$`):a!==`/`&&a!==`\\`&&n.push(`\\`)):(i===`$`&&n.push(`$`),n.push(i),a===`/`&&n.push(`\\`))}return n.join(``)}var Dt={"\\/":`/`,"\\\\":`\\`,"\\n":`
|
|
73
|
-
`,"\\r":`\r`,"\\t":` `,"\\&":`&`};function Ot(t){for(var n=new e.StringStream(t),r=[];!n.eol();){for(;n.peek()&&n.peek()!=`\\`;)r.push(n.next());var i=!1;for(var a in Dt)if(n.match(a,!0)){i=!0,r.push(Dt[a]);break}i||r.push(n.next())}return r.join(``)}function kt(e,t,n){A.registerController.getRegister(`/`).setText(e);var r=xt(e),i,a;return r.length?(i=e.substring(0,r[0]),a=e.substring(r[0]).indexOf(`i`)!=-1):i=e,i?(k(`pcre`)||(i=wt(i)),n&&(t=/^[^A-Z]*$/.test(i)),new RegExp(i,t||a?`im`:`m`)):null}function At(e){typeof e==`string`&&(e=document.createElement(e));for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n){if(typeof n!=`object`&&(n=document.createTextNode(n)),n.nodeType)e.appendChild(n);else for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(r[0]===`$`?e.style[r.slice(1)]=n[r]:typeof n[r]==`function`?e[r]=n[r]:e.setAttribute(r,n[r]))}}return e}function jt(e,t,n){var r=At(`div`,{$color:`red`,$whiteSpace:`pre`,class:`cm-vim-message`},t);e.openNotification?n?(r=At(`div`,{},r,At(`div`,{},`Press ENTER or type command to continue`)),e.state.closeVimNotification&&e.state.closeVimNotification(),e.state.closeVimNotification=e.openNotification(r,{bottom:!0,duration:0})):e.openNotification(r,{bottom:!0,duration:15e3}):alert(r.innerText)}function Mt(e,t){return At(`div`,{$display:`flex`,$flex:1},At(`span`,{$fontFamily:`monospace`,$whiteSpace:`pre`,$flex:1,$display:`flex`},e,At(`input`,{type:`text`,autocorrect:`off`,autocapitalize:`off`,spellcheck:`false`,$flex:1})),t&&At(`span`,{$color:`#888`},t))}function Nt(e,t){if(N.length){t.value||=``,P=t;return}var n=Mt(t.prefix,t.desc);if(e.openDialog)e.openDialog(n,t.onClose,{onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,bottom:!0,selectValueOnOpen:!1,value:t.value});else{var r=``;typeof t.prefix!=`string`&&t.prefix&&(r+=t.prefix.textContent),t.desc&&(r+=` `+t.desc),t.onClose?.(prompt(r,``))}}function Pt(e,t){return e instanceof RegExp&&t instanceof RegExp&&e.flags==t.flags&&e.source==t.source}function Ft(e,t,n,r){if(t){var i=yt(e),a=kt(t,!!n,!!r);if(a)return Rt(e,a),Pt(a,i.getQuery())||i.setQuery(a),a}}function It(e){if(e.source.charAt(0)==`^`)var t=!0;return{token:function(n){if(t&&!n.sol()){n.skipToEnd();return}var r=n.match(e,!1);if(r)return r[0].length==0?(n.next(),`searching`):!n.sol()&&(n.backUp(1),!e.exec(n.next()+r[0]))?(n.next(),null):(n.match(e),`searching`);for(;!n.eol()&&(n.next(),!n.match(e,!1)););},query:e}}var Lt=0;function Rt(e,t){clearTimeout(Lt);var n=yt(e);n.highlightTimeout=Lt,Lt=setTimeout(function(){if(e.state.vim){var n=yt(e);n.highlightTimeout=void 0;var r=n.getOverlay();(!r||t!=r.query)&&(r&&e.removeOverlay(r),r=It(t),e.addOverlay(r),e.showMatchesOnScrollbar&&(n.getScrollbarAnnotate()&&n.getScrollbarAnnotate().clear(),n.setScrollbarAnnotate(e.showMatchesOnScrollbar(t))),n.setOverlay(r))}},50)}function zt(e,n,r,i){return e.operation(function(){i===void 0&&(i=1);for(var a=e.getCursor(),o=e.getSearchCursor(r,a),s=0;s<i;s++){var c=o.find(n);if(s==0&&c&&Ie(o.from(),a)){var l=n?o.from():o.to();c=o.find(n),c&&!c[0]&&Ie(o.from(),l)&&e.getLine(l.line).length==l.ch&&(c=o.find(n))}if(!c&&(o=e.getSearchCursor(r,n?new t(e.lastLine()):new t(e.firstLine(),0)),!o.find(n)))return}return o.from()})}function Bt(e,n,r,i,a){return e.operation(function(){i===void 0&&(i=1);var o=e.getCursor(),s=e.getSearchCursor(r,o),c=s.find(!n);!a.visualMode&&c&&Ie(s.from(),o)&&s.find(!n);for(var l=0;l<i;l++)if(c=s.find(n),!c&&(s=e.getSearchCursor(r,n?new t(e.lastLine()):new t(e.firstLine(),0)),!s.find(n)))return;var u=s.from(),d=s.to();return u&&d&&[u,d]})}function Vt(e){var t=yt(e);t.highlightTimeout&&=(clearTimeout(t.highlightTimeout),void 0),e.removeOverlay(yt(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function Ht(e,t,n){return typeof e!=`number`&&(e=e.line),t instanceof Array?T(e,t):typeof n==`number`?e>=t&&e<=n:e==t}function Ut(e){var t=e.getScrollInfo(),n=6,r=10,i=e.coordsChar({left:0,top:n+t.top},`local`),a=t.clientHeight-r+t.top,o=e.coordsChar({left:0,top:a},`local`);return{top:i.line,bottom:o.line}}function Wt(e,n,r){if(r==`'`||r=="`")return A.jumpList.find(e,-1)||new t(0,0);if(r==`.`)return Gt(e);var i=n.marks[r];return i&&i.find()}function Gt(e){if(e.getLastEditEnd)return e.getLastEditEnd();for(var t=e.doc.history.done,n=t.length;n--;)if(t[n].changes)return I(t[n].changes[0].to)}class Kt{constructor(){this.commandMap_,this.buildCommandMap_()}processCommand(e,t,n){var r=this;e.operation(function(){e.curOp&&(e.curOp.isVimOp=!0),r._processCommand(e,t,n)})}_processCommand(t,n,r){var i=t.state.vim,a=A.registerController.getRegister(`:`),o=a.toString(),s=new e.StringStream(n);a.setText(n);var c=r||{};c.input=n;try{this.parseInput_(t,s,c)}catch(e){throw jt(t,e+``),e}i.visualMode&&Qe(t);var l,u;if(!c.commandName)c.line!==void 0&&(u=`move`);else if(l=this.matchCommand_(c.commandName),l){if(u=l.name,l.excludeFromCommandHistory&&a.setText(o),this.parseCommandArgs_(s,c,l),l.type==`exToKey`){se(t,l.toKeys||``,l);return}if(l.type==`exToEx`){this.processCommand(t,l.toInput||``);return}}if(!u){jt(t,`Not an editor command ":`+n+`"`);return}try{qt[u](t,c),(!l||!l.possiblyAsync)&&c.callback&&c.callback()}catch(e){throw jt(t,e+``),e}}parseInput_(e,t,n){t.eatWhile(`:`),t.eat(`%`)?(n.line=e.firstLine(),n.lineEnd=e.lastLine()):(n.line=this.parseLineSpec_(e,t),n.line!==void 0&&t.eat(`,`)&&(n.lineEnd=this.parseLineSpec_(e,t))),n.line==null?e.state.vim.visualMode?(n.selectionLine=Wt(e,e.state.vim,`<`)?.line,n.selectionLineEnd=Wt(e,e.state.vim,`>`)?.line):n.selectionLine=e.getCursor().line:(n.selectionLine=n.line,n.selectionLineEnd=n.lineEnd);var r=t.match(/^(\w+|!!|@@|[!#&*<=>@~])/);return n.commandName=r?r[1]:(t.match(/.*/)||[``])[0],n}parseLineSpec_(e,t){var n=t.match(/^(\d+)/);if(n)return parseInt(n[1],10)-1;switch(t.next()){case`.`:return this.parseLineSpecOffset_(t,e.getCursor().line);case`$`:return this.parseLineSpecOffset_(t,e.lastLine());case`'`:var r=t.next()||``,i=Wt(e,e.state.vim,r);if(!i)throw Error(`Mark not set`);return this.parseLineSpecOffset_(t,i.line);case`-`:case`+`:return t.backUp(1),this.parseLineSpecOffset_(t,e.getCursor().line);default:t.backUp(1);return}}parseLineSpecOffset_(e,t){var n=e.match(/^([+-])?(\d+)/);if(n){var r=parseInt(n[2],10);n[1]==`-`?t-=r:t+=r}return t}parseCommandArgs_(e,t,n){if(!e.eol()){t.argString=e.match(/.*/)?.[0];var r=n.argDelimiter||/\s+/,i=Be(t.argString||``).split(r);i.length&&i[0]&&(t.args=i)}}matchCommand_(e){for(var t=e.length;t>0;t--){var n=e.substring(0,t);if(this.commandMap_[n]){var r=this.commandMap_[n];if(r.name.indexOf(e)===0)return r}}}buildCommandMap_(){this.commandMap_={};for(var e=0;e<o.length;e++){var t=o[e],n=t.shortName||t.name;this.commandMap_[n]=t}}map(e,t,n,r){if(e!=`:`&&e.charAt(0)==`:`){if(n)throw Error(`Mode not supported for ex mappings`);var i=e.substring(1);t!=`:`&&t.charAt(0)==`:`?this.commandMap_[i]={name:i,type:`exToEx`,toInput:t.substring(1),user:!0}:this.commandMap_[i]={name:i,type:`exToKey`,toKeys:t,user:!0}}else{var a={keys:e,type:`keyToKey`,toKeys:t,noremap:!!r};n&&(a.context=n),Zt(a)}}unmap(e,t){if(e!=`:`&&e.charAt(0)==`:`){if(t)throw Error(`Mode not supported for ex mappings`);var n=e.substring(1);if(this.commandMap_[n]&&this.commandMap_[n].user)return delete this.commandMap_[n],!0}else for(var i=e,a=0;a<r.length;a++)if(i==r[a].keys&&r[a].context===t)return r.splice(a,1),$t(i),!0}}var qt={colorscheme:function(e,t){if(!t.args||t.args.length<1){jt(e,e.getOption(`theme`));return}e.setOption(`theme`,t.args[0])},map:function(e,t,n,r){var i=t.args;if(!i||i.length<2){e&&jt(e,`Invalid mapping: `+t.input);return}Jt.map(i[0],i[1],n,r)},imap:function(e,t){this.map(e,t,`insert`)},nmap:function(e,t){this.map(e,t,`normal`)},vmap:function(e,t){this.map(e,t,`visual`)},omap:function(e,t){this.map(e,t,`operatorPending`)},noremap:function(e,t){this.map(e,t,void 0,!0)},inoremap:function(e,t){this.map(e,t,`insert`,!0)},nnoremap:function(e,t){this.map(e,t,`normal`,!0)},vnoremap:function(e,t){this.map(e,t,`visual`,!0)},onoremap:function(e,t){this.map(e,t,`operatorPending`,!0)},unmap:function(e,t,n){var r=t.args;(!r||r.length<1||!Jt.unmap(r[0],n))&&e&&jt(e,`No such mapping: `+t.input)},mapclear:function(e,t){ae.mapclear()},imapclear:function(e,t){ae.mapclear(`insert`)},nmapclear:function(e,t){ae.mapclear(`normal`)},vmapclear:function(e,t){ae.mapclear(`visual`)},omapclear:function(e,t){ae.mapclear(`operatorPending`)},move:function(e,t){xe.processCommand(e,e.state.vim,{keys:``,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:t.line+1})},set:function(e,t){var n=t.args,r=t.setCfg||{};if(!n||n.length<1){e&&jt(e,`Invalid mapping: `+t.input);return}var i=n[0].split(`=`),a=i.shift()||``,o=i.length>0?i.join(`=`):void 0,s=!1,c=!1;if(a.charAt(a.length-1)==`?`){if(o)throw Error(`Trailing characters: `+t.argString);a=a.substring(0,a.length-1),s=!0}else a.charAt(a.length-1)==`!`&&(a=a.substring(0,a.length-1),c=!0);o===void 0&&a.substring(0,2)==`no`&&(a=a.substring(2),o=!1);var l=E[a]&&E[a].type==`boolean`;if(l&&(c?o=!k(a,e,r):o??=!0),!l&&o===void 0||s){var u=k(a,e,r);u instanceof Error?jt(e,u.message):u===!0||u===!1?jt(e,` `+(u?``:`no`)+a):jt(e,` `+a+`=`+u)}else{var d=O(a,o,e,r);d instanceof Error&&jt(e,d.message)}},setlocal:function(e,t){t.setCfg={scope:`local`},this.set(e,t)},setglobal:function(e,t){t.setCfg={scope:`global`},this.set(e,t)},registers:function(e,t){var n=t.args,r=A.registerController.registers,i=`----------Registers----------
|
|
74
|
-
|
|
75
|
-
`;if(n)for(var a=n.join(``),o=0;o<a.length;o++){var s=a.charAt(o);if(A.registerController.isValidRegister(s)){var c=r[s]||new _e;i+=`"`+s+` `+c.toString()+`
|
|
76
|
-
`}}else for(var s in r){var l=r[s].toString();l.length&&(i+=`"`+s+` `+l+`
|
|
77
|
-
`)}jt(e,i,!0)},marks:function(e,t){var n=t.args,r=e.state.vim.marks,i=`-----------Marks-----------
|
|
78
|
-
mark line col
|
|
79
|
-
|
|
80
|
-
`;if(n)for(var a=n.join(``),o=0;o<a.length;o++){var s=a.charAt(o),c=r[s]&&r[s].find();c&&(i+=s+` `+c.line+` `+c.ch+`
|
|
81
|
-
`)}else for(var s in r){var c=r[s]&&r[s].find();c&&(i+=s+` `+c.line+` `+c.ch+`
|
|
82
|
-
`)}jt(e,i,!0)},sort:function(n,r){var i,a,o,s,c;function l(){if(r.argString){var t=new e.StringStream(r.argString);if(t.eat(`!`)&&(i=!0),t.eol())return;if(!t.eatSpace())return`Invalid arguments`;var n=t.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!n||!t.eol())return`Invalid arguments`;if(n[1]){a=n[1].indexOf(`i`)!=-1,o=n[1].indexOf(`u`)!=-1;var l=n[1].indexOf(`d`)!=-1||n[1].indexOf(`n`)!=-1,u=n[1].indexOf(`x`)!=-1,d=n[1].indexOf(`o`)!=-1;if(Number(l)+Number(u)+Number(d)>1)return`Invalid arguments`;s=l&&`decimal`||u&&`hex`||d&&`octal`}n[2]&&(c=new RegExp(n[2].substr(1,n[2].length-2),a?`i`:``))}}var u=l();if(u){jt(n,u+`: `+r.argString);return}var d=r.line||n.firstLine(),f=r.lineEnd||r.line||n.lastLine();if(d==f)return;var p=new t(d,0),m=new t(f,ze(n,f)),h=n.getRange(p,m).split(`
|
|
83
|
-
`),g=s==`decimal`?/(-?)([\d]+)/:s==`hex`?/(-?)(?:0x)?([0-9a-f]+)/i:s==`octal`?/([0-7]+)/:null,_=s==`decimal`?10:s==`hex`?16:s==`octal`?8:void 0,v=[],y=[];if(s||c)for(var b=0;b<h.length;b++){var x=c?h[b].match(c):null;x&&x[0]!=``?v.push(x):g&&g.exec(h[b])?v.push(h[b]):y.push(h[b])}else y=h;function S(e,t){if(i){var n=e;e=t,t=n}a&&(e=e.toLowerCase(),t=t.toLowerCase());var r=g&&g.exec(e),o=g&&g.exec(t);return!r||!o?e<t?-1:1:parseInt((r[1]+r[2]).toLowerCase(),_)-parseInt((o[1]+o[2]).toLowerCase(),_)}function C(e,t){if(i){var n=e;e=t,t=n}return a&&(e[0]=e[0].toLowerCase(),t[0]=t[0].toLowerCase()),e[0]<t[0]?-1:1}if(v.sort(c?C:S),c)for(var b=0;b<v.length;b++)v[b]=v[b].input;else s||y.sort(S);if(h=i?v.concat(y):y.concat(v),o){var w=h,T;h=[];for(var b=0;b<w.length;b++)w[b]!=T&&h.push(w[b]),T=w[b]}n.replaceRange(h.join(`
|
|
84
|
-
`),p,m)},vglobal:function(e,t){this.global(e,t)},normal:function(e,t){var n=!1,r=t.argString;if(r&&r[0]==`!`&&(r=r.slice(1),n=!0),r=r.trimStart(),!r){jt(e,`Argument is required.`);return}var i=t.line;if(typeof i==`number`)for(var a=isNaN(t.lineEnd)?i:t.lineEnd,o=i;o<=a;o++)e.setCursor(o,0),se(e,t.argString.trimStart(),{noremap:n}),e.state.vim.insertMode&&Xt(e,!0);else se(e,t.argString.trimStart(),{noremap:n}),e.state.vim.insertMode&&Xt(e,!0)},global:function(e,t){var n=t.argString;if(!n){jt(e,`Regular Expression missing from global`);return}var r=t.commandName[0]===`v`;n[0]===`!`&&t.commandName[0]===`g`&&(r=!0,n=n.slice(1));var i=t.line===void 0?e.firstLine():t.line,a=t.lineEnd||t.line||e.lastLine(),o=bt(n),s=n,c=``;if(o&&o.length&&(s=o[0],c=o.slice(1,o.length).join(`/`)),s)try{Ft(e,s,!0,!0)}catch{jt(e,`Invalid regex: `+s);return}for(var l=yt(e).getQuery(),u=[],d=i;d<=a;d++){var f=e.getLine(d);l.test(f)!==r&&u.push(c?e.getLineHandle(d):f)}if(!c){jt(e,u.join(`
|
|
85
|
-
`));return}var p=0,m=function(){if(p<u.length){var t=u[p++],n=e.getLineNumber(t);if(n==null){m();return}var r=n+1+c;Jt.processCommand(e,r,{callback:m})}else e.releaseLineHandles&&e.releaseLineHandles()};m()},substitute:function(e,n){if(!e.getSearchCursor)throw Error(`Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.`);var r=n.argString,i=r?St(r,r[0]):[],a=``,o=``,s,c,l,u=!1,d=!1;if(i&&i.length)a=i[0],k(`pcre`)&&a!==``&&(a=new RegExp(a).source),o=i[1],o!==void 0&&(o=k(`pcre`)?Ot(o.replace(/([^\\])&/g,`$1$$&`)):Et(o),A.lastSubstituteReplacePart=o),s=i[2]?i[2].split(` `):[];else if(r&&r.length){jt(e,`Substitutions should be of the form :s/pattern/replace/`);return}if(s&&(c=s[0],l=parseInt(s[1]),c&&(c.indexOf(`c`)!=-1&&(u=!0),c.indexOf(`g`)!=-1&&(d=!0),a=k(`pcre`)?a+`/`+c:a.replace(/\//g,`\\/`)+`/`+c)),a)try{Ft(e,a,!0,!0)}catch{jt(e,`Invalid regex: `+a);return}if(o||=A.lastSubstituteReplacePart,o===void 0){jt(e,`No previous substitute regular expression`);return}var f=yt(e).getQuery(),p=n.line===void 0?e.getCursor().line:n.line,m=n.lineEnd||p;p==e.firstLine()&&m==e.lastLine()&&(m=1/0),l&&(p=m,m=p+l-1);var h=ke(e,new t(p,0)),g=e.getSearchCursor(f,h);Yt(e,u,d,p,m,g,f,o,n.callback)},startinsert:function(e,t){se(e,t.argString==`!`?`A`:`i`,{})},redo:e.commands.redo,undo:e.commands.undo,write:function(t){e.commands.save?e.commands.save(t):t.save&&t.save()},nohlsearch:function(e){Vt(e)},yank:function(e){var t=I(e.getCursor()).line,n=e.getLine(t);A.registerController.pushText(`0`,`yank`,n,!0,!0)},delete:function(e,n){var r=n.selectionLine,i=isNaN(n.selectionLineEnd)?r:n.selectionLineEnd;Te.delete(e,{linewise:!0},[{anchor:new t(r,0),head:new t(i+1,0)}])},join:function(e,n){var r=n.selectionLine,i=isNaN(n.selectionLineEnd)?r:n.selectionLineEnd;e.setCursor(new t(r,0)),De.joinLines(e,{repeat:i-r},e.state.vim)},delmarks:function(t,n){if(!n.argString||!Be(n.argString)){jt(t,`Argument required`);return}for(var r=t.state.vim,i=new e.StringStream(Be(n.argString));!i.eol();){i.eatSpace();var a=i.pos;if(!i.match(/[a-zA-Z]/,!1)){jt(t,`Invalid argument: `+n.argString.substring(a));return}var o=i.next();if(i.match(`-`,!0)){if(!i.match(/[a-zA-Z]/,!1)){jt(t,`Invalid argument: `+n.argString.substring(a));return}var s=o,c=i.next();if(s&&c&&y(s)==y(c)){var l=s.charCodeAt(0),u=c.charCodeAt(0);if(l>=u){jt(t,`Invalid argument: `+n.argString.substring(a));return}for(var d=0;d<=u-l;d++){var f=String.fromCharCode(l+d);delete r.marks[f]}}else{jt(t,`Invalid argument: `+s+`-`);return}}else o&&delete r.marks[o]}}},Jt=new Kt;ae.defineEx(`version`,`ve`,e=>{jt(e,`Codemirror-vim version: 6.3.0`)});function Yt(t,n,r,i,a,o,s,c,l){t.state.vim.exMode=!0;var u=!1,d=0,f,p,m;function h(){t.operation(function(){for(;!u;)g(),v();y()})}function g(){var e=``,n=o.match||o.pos&&o.pos.match;e=n?c.replace(/\$(\d{1,3}|[$&])/g,function(e,t){if(t==`$`)return`$`;if(t==`&`)return n[0];for(var r=t;parseInt(r)>=n.length&&r.length>0;)r=r.slice(0,r.length-1);return r?n[r]+t.slice(r.length,t.length):e}):t.getRange(o.from(),o.to()).replace(s,c);var r=o.to().line;o.replace(e),p=o.to().line,a+=p-r,m=p<r}function _(){var e=f&&I(o.to()),t=o.findNext();return t&&!t[0]&&e&&Ie(o.from(),e)&&(t=o.findNext()),t&&d++,t}function v(){for(;_()&&Ht(o.from(),i,a);)if(!(!r&&o.from().line==p&&!m)){t.scrollIntoView(o.from(),30),t.setSelection(o.from(),o.to()),f=o.from(),u=!1;return}u=!0}function y(e){if(e&&e(),t.focus(),f){t.setCursor(f);var n=t.state.vim;n.exMode=!1,n.lastHPos=n.lastHSPos=f.ch}l?l():u&&jt(t,(d?`Found `+d+` matches`:`No matches found`)+` for pattern: `+s+(k(`pcre`)?` (set nopcre to use Vim regexps)`:``))}function b(n,r,i){switch(e.e_stop(n),de(n)){case`y`:g(),v();break;case`n`:v();break;case`a`:var a=l;l=void 0,t.operation(h),l=a;break;case`l`:g();case`q`:case`<Esc>`:case`<C-c>`:case`<C-[>`:y(i)}return u&&y(i),!0}if(v(),u){jt(t,`No matches for `+s+(k(`pcre`)?` (set nopcre to use vim regexps)`:``));return}if(!n){h(),l&&l();return}Nt(t,{prefix:At(`span`,`replace with `,At(`strong`,c),` (y/n/a/q/l)`),onKeyDown:b})}function Xt(t,n){var r=t.state.vim,i=A.macroModeState,a=A.registerController.getRegister(`.`),o=i.isPlaying,s=i.lastInsertModeChanges;o||(t.off(`change`,on),r.insertEnd&&r.insertEnd.clear(),r.insertEnd=void 0,e.off(t.getInputField(),`keydown`,ln)),!o&&r.insertModeRepeat&&r.insertModeRepeat>1&&(un(t,r,r.insertModeRepeat-1,!0),r.lastEditInputState.repeatOverride=r.insertModeRepeat),delete r.insertModeRepeat,r.insertMode=!1,n||t.setCursor(t.getCursor().line,t.getCursor().ch-1),t.setOption(`keyMap`,`vim`),t.setOption(`disableInput`,!0),t.toggleOverwrite(!1),a.setText(s.changes.join(``)),e.signal(t,`vim-mode-change`,{mode:`normal`}),i.isRecording&&rn(i)}function Zt(e){r.unshift(e),e.keys&&Qt(e.keys)}function Qt(e){e.split(/(<(?:[CSMA]-)*\w+>|.)/i).forEach(function(e){e&&(i[e]||(i[e]=0),i[e]++)})}function $t(e){e.split(/(<(?:[CSMA]-)*\w+>|.)/i).forEach(function(e){i[e]&&i[e]--})}function en(e,t,n,r,i){var a={keys:e,type:t};for(var o in a[t]=n,a[t+`Args`]=r,i)a[o]=i[o];Zt(a)}D(`insertModeEscKeysTimeout`,200,`number`);function tn(e,t,n,r){var i=A.registerController.getRegister(r);if(r==`:`){i.keyBuffer[0]&&Jt.processCommand(e,i.keyBuffer[0]),n.isPlaying=!1;return}var a=i.keyBuffer,o=0;n.isPlaying=!0,n.replaySearchQueries=i.searchQueries.slice(0);for(var s=0;s<a.length;s++)for(var c=a[s],l,u,d=/<(?:[CSMA]-)*\w+>|./gi;l=d.exec(c);)if(u=l[0],ae.handleKey(e,u,`macro`),t.insertMode){var f=i.insertModeChanges[o++].changes;A.macroModeState.lastInsertModeChanges.changes=f,fn(e,f,1),Xt(e)}n.isPlaying=!1}function nn(e,t){if(!e.isPlaying){var n=e.latestRegister,r=A.registerController.getRegister(n);r&&r.pushText(t)}}function rn(e){if(!e.isPlaying){var t=e.latestRegister,n=A.registerController.getRegister(t);n&&n.pushInsertModeChanges&&n.pushInsertModeChanges(e.lastInsertModeChanges)}}function an(e,t){if(!e.isPlaying){var n=e.latestRegister,r=A.registerController.getRegister(n);r&&r.pushSearchQuery&&r.pushSearchQuery(t)}}function on(e,t){var n=A.macroModeState,r=n.lastInsertModeChanges;if(!n.isPlaying)for(var i=e.state.vim;t;){if(r.expectCursorActivityForChange=!0,r.ignoreCount>1)r.ignoreCount--;else if(t.origin==`+input`||t.origin==`paste`||t.origin===void 0){var a=e.listSelections().length;a>1&&(r.ignoreCount=a);var o=t.text.join(`
|
|
86
|
-
`);if(r.maybeReset&&=(r.changes=[],!1),o){if(e.state.overwrite&&!/\n/.test(o))r.changes.push([o]);else{if(o.length>1){var s=i&&i.insertEnd&&i.insertEnd.find(),c=e.getCursor();if(s&&s.line==c.line){var l=s.ch-c.ch;l>0&&l<o.length&&(r.changes.push([o,l]),o=``)}}o&&r.changes.push(o)}}}t=t.next}}function sn(e){var t=e.state.vim;if(t.insertMode){var n=A.macroModeState;if(n.isPlaying)return;var r=n.lastInsertModeChanges;r.expectCursorActivityForChange?r.expectCursorActivityForChange=!1:(r.maybeReset=!0,t.insertEnd&&t.insertEnd.clear(),t.insertEnd=e.setBookmark(e.getCursor(),{insertLeft:!0}))}else e.curOp?.isVimOp||cn(e,t)}function cn(t,n){var r=t.getCursor(`anchor`),i=t.getCursor(`head`);if(n.visualMode&&!t.somethingSelected()?Qe(t,!1):!n.visualMode&&!n.insertMode&&t.somethingSelected()&&(n.visualMode=!0,n.visualLine=!1,e.signal(t,`vim-mode-change`,{mode:`visual`})),n.visualMode){var a=L(i,r)?0:-1,o=L(i,r)?-1:0;i=je(i,0,a),r=je(r,0,o),n.sel={anchor:r,head:i},ft(t,n,`<`,R(i,r)),ft(t,n,`>`,Le(i,r))}else n.insertMode||(n.lastHPos=t.getCursor().ch)}function ln(t){var n=A.macroModeState.lastInsertModeChanges,r=e.keyName?e.keyName(t):t.key;r&&(r.indexOf(`Delete`)!=-1||r.indexOf(`Backspace`)!=-1)&&(n.maybeReset&&=(n.changes=[],!1),n.changes.push(new M(r,t)))}function un(e,t,n,r){var i=A.macroModeState;i.isPlaying=!0;var a=t.lastEditActionCommand,o=t.inputState;function s(){a?xe.processAction(e,t,a):xe.evalInput(e,t)}function c(n){if(i.lastInsertModeChanges.changes.length>0){n=t.lastEditActionCommand?n:1;var r=i.lastInsertModeChanges;fn(e,r.changes,n)}}if(t.inputState=t.lastEditInputState,a&&a.interlaceInsertRepeat)for(var l=0;l<n;l++)s(),c(1);else r||s(),c(n);t.inputState=o,t.insertMode&&!r&&Xt(e),i.isPlaying=!1}function dn(t,n){e.lookupKey(n,`vim-insert`,function(n){return typeof n==`string`?e.commands[n](t):n(t),!0})}function fn(e,t,n){var r=e.getCursor(`head`),i=A.macroModeState.lastInsertModeChanges.visualBlock;i&&(We(e,r,i+1),n=e.listSelections().length,e.setCursor(r));for(var a=0;a<n;a++){i&&e.setCursor(je(r,a,0));for(var o=0;o<t.length;o++){var s=t[o];if(s instanceof M)dn(e,s.keyName);else if(typeof s==`string`)e.replaceSelection(s);else{var c=e.getCursor(),l=je(c,0,s[0].length-(s[1]||0));e.replaceRange(s[0],c,s[1]?c:l),e.setCursor(l)}}}i&&e.setCursor(je(r,0,1))}function pn(e){var t=new e.constructor;return Object.keys(e).forEach(function(n){if(n!=`insertEnd`){var r=e[n];Array.isArray(r)?r=r.slice():r&&typeof r==`object`&&r.constructor!=Object&&(r=pn(r)),t[n]=r}}),e.sel&&(t.sel={head:e.sel.head&&I(e.sel.head),anchor:e.sel.anchor&&I(e.sel.anchor)}),t}function mn(e,t,n){var r=re(e),i=e,a=!1,r=ae.maybeInitVimState_(i),o=r.visualBlock||r.wasInVisualBlock;if(i.state.closeVimNotification){var s=i.state.closeVimNotification;if(i.state.closeVimNotification=null,s(),t==`<CR>`)return he(i),!0}var c=i.isInMultiSelectMode();if(r.wasInVisualBlock&&!c?r.wasInVisualBlock=!1:c&&r.visualBlock&&(r.wasInVisualBlock=!0),t==`<Esc>`&&!r.insertMode&&!r.visualMode&&c&&r.status==`<Esc>`)he(i);else if(o||!c||i.inVirtualSelectionMode)a=ae.handleKey(i,t,n);else{var l=pn(r),u=r.inputState.changeQueueList||[];i.operation(function(){i.curOp&&(i.curOp.isVimOp=!0);var e=0;i.forEachSelection(function(){i.state.vim.inputState.changeQueue=u[e];var r=i.getCursor(`head`),o=i.getCursor(`anchor`),s=L(r,o)?0:-1,c=L(r,o)?-1:0;r=je(r,0,s),o=je(o,0,c),i.state.vim.sel.head=r,i.state.vim.sel.anchor=o,a=ae.handleKey(i,t,n),i.virtualSelection&&(u[e]=i.state.vim.inputState.changeQueue,i.state.vim=pn(l)),e++}),i.curOp?.cursorActivity&&!a&&(i.curOp.cursorActivity=!1),i.state.vim=r,r.inputState.changeQueueList=u,r.inputState.changeQueue=null},!0)}return a&&!r.visualMode&&!r.insertMode&&r.visualMode!=i.somethingSelected()&&cn(i,r),a}return j(),ae}function eh(e,t){var n=t.ch,r=t.line+1;r<1&&(r=1,n=0),r>e.lines&&(r=e.lines,n=Number.MAX_VALUE);var i=e.line(r);return Math.min(i.from+Math.max(0,n),i.to)}function th(e,t){let n=e.lineAt(t);return{line:n.number-1,ch:t-n.from}}var nh=class{constructor(e,t){this.line=e,this.ch=t}};function rh(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else{var r=e._handlers||={};r[t]=(r[t]||[]).concat(n)}}function ih(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else{var r=e._handlers,i=r&&r[t];if(i){var a=i.indexOf(n);a>-1&&(r[t]=i.slice(0,a).concat(i.slice(a+1)))}}}function ah(e,t,...n){var r=e._handlers?.[t];if(r)for(var i=0;i<r.length;++i)r[i](...n)}function oh(e,...t){if(e)for(var n=0;n<e.length;++n)e[n](...t)}var sh;try{sh=RegExp(`[\\w\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{sh=/[\w]/}function ch(e,t){var n=e.cm6;if(!n.state.readOnly){var r=`input.type.compose`;if(e.curOp&&(e.curOp.lastChange||(r=`input.type.compose.start`)),t.annotations)try{t.annotations.some(function(e){e.value==`input`&&(e.value=r)})}catch(e){console.error(e)}else t.userEvent=r;return n.dispatch(t)}}function lh(e,t){e.curOp&&(e.curOp.$changeStart=void 0),(t?Rt:kt)(e.cm6);let n=e.curOp?.$changeStart;n!=null&&e.cm6.dispatch({selection:{anchor:n}})}var uh={Left:e=>ct(e.cm6,{key:`Left`},`editor`),Right:e=>ct(e.cm6,{key:`Right`},`editor`),Up:e=>ct(e.cm6,{key:`Up`},`editor`),Down:e=>ct(e.cm6,{key:`Down`},`editor`),Backspace:e=>ct(e.cm6,{key:`Backspace`},`editor`),Delete:e=>ct(e.cm6,{key:`Delete`},`editor`)},$=class e{openDialog(e,t,n){return gh(this,e,t,n)}openNotification(e,t){return ph(this,e,t)}constructor(e){this.state={},this.marks=Object.create(null),this.$mid=0,this.options={},this._handlers={},this.$lastChangeEndOffset=0,this.virtualSelection=null,this.cm6=e,this.onChange=this.onChange.bind(this),this.onSelectionChange=this.onSelectionChange.bind(this)}on(e,t){rh(this,e,t)}off(e,t){ih(this,e,t)}signal(e,t,n){ah(this,e,t,n)}indexFromPos(e){return eh(this.cm6.state.doc,e)}posFromIndex(e){return th(this.cm6.state.doc,e)}foldCode(e){let t=this.cm6,n=t.state.selection.ranges,r=this.cm6.state.doc,i=eh(r,e),a=Je.create([Je.range(i,i)],0).ranges;t.state.selection.ranges=a,Pe(t),t.state.selection.ranges=n}firstLine(){return 0}lastLine(){return this.cm6.state.doc.lines-1}lineCount(){return this.cm6.state.doc.lines}setCursor(e,t){typeof e==`object`&&(t=e.ch,e=e.line);var n=eh(this.cm6.state.doc,{line:e,ch:t||0});this.cm6.dispatch({selection:{anchor:n}},{scrollIntoView:!this.curOp}),this.curOp&&!this.curOp.isVimOp&&this.onBeforeEndOperation()}getCursor(e){var t=this.cm6.state.selection.main,n=e==`head`||!e?t.head:e==`anchor`?t.anchor:e==`start`?t.from:e==`end`?t.to:null;if(n==null)throw Error(`Invalid cursor type`);return this.posFromIndex(n)}listSelections(){var e=this.cm6.state.doc;return this.cm6.state.selection.ranges.map(t=>({anchor:th(e,t.anchor),head:th(e,t.head)}))}setSelections(e,t){var n=this.cm6.state.doc,r=e.map(e=>{var t=eh(n,e.head),r=eh(n,e.anchor);return t==r?Je.cursor(t,1):Je.range(r,t)});this.cm6.dispatch({selection:Je.create(r,t)})}setSelection(e,t,n){this.setSelections([{anchor:e,head:t}],0),n&&n.origin==`*mouse`&&this.onBeforeEndOperation()}getLine(e){var t=this.cm6.state.doc;return e<0||e>=t.lines?``:this.cm6.state.doc.line(e+1).text}getLineHandle(e){return this.$lineHandleChanges||=[],{row:e,index:this.indexFromPos(new nh(e,0))}}getLineNumber(e){var t=this.$lineHandleChanges;if(!t)return null;for(var n=e.index,r=0;r<t.length;r++)if(n=t[r].changes.mapPos(n,1,ze.TrackAfter),n==null)return null;var i=this.posFromIndex(n);return i.ch==0?i.line:null}releaseLineHandles(){this.$lineHandleChanges=void 0}getRange(e,t){var n=this.cm6.state.doc;return this.cm6.state.sliceDoc(eh(n,e),eh(n,t))}replaceRange(e,t,n,r){n||=t;var i=this.cm6.state.doc,a=eh(i,t),o=eh(i,n);ch(this,{changes:{from:a,to:o,insert:e}})}replaceSelection(e){ch(this,this.cm6.state.replaceSelection(e))}replaceSelections(e){var t=this.cm6.state.selection.ranges.map((t,n)=>({from:t.from,to:t.to,insert:e[n]||``}));ch(this,{changes:t})}getSelection(){return this.getSelections().join(`
|
|
87
|
-
`)}getSelections(){var e=this.cm6;return e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to))}somethingSelected(){return this.cm6.state.selection.ranges.some(e=>!e.empty)}getInputField(){return this.cm6.contentDOM}clipPos(e){var t=this.cm6.state.doc,n=e.ch,r=e.line+1;r<1&&(r=1,n=0),r>t.lines&&(r=t.lines,n=Number.MAX_VALUE);var i=t.line(r);return n=Math.min(Math.max(0,n),i.to-i.from),new nh(r-1,n)}getValue(){return this.cm6.state.doc.toString()}setValue(e){var t=this.cm6;return t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e},selection:Je.range(0,0)})}focus(){return this.cm6.focus()}blur(){return this.cm6.contentDOM.blur()}defaultTextHeight(){return this.cm6.defaultLineHeight}findMatchingBracket(e,t){var n=this.cm6.state,r=eh(n.doc,e),i=yt(n,r+1,-1);return i&&i.end||(i=yt(n,r,1),i&&i.end)?{to:th(n.doc,i.end.from)}:{to:void 0}}scanForBracket(e,t,n,r){return yh(this,e,t,n,r)}indentLine(e,t){t?this.indentMore():this.indentLess()}indentMore(){Ct(this.cm6)}indentLess(){Tt(this.cm6)}execCommand(t){if(t==`indentAuto`)e.commands.indentAuto(this);else if(t==`goLineLeft`)Et(this.cm6);else if(t==`goLineRight`){Lt(this.cm6);let e=this.cm6.state,t=e.selection.main.head;t<e.doc.length&&e.sliceDoc(t,t+1)!==`
|
|
88
|
-
`&&jt(this.cm6)}else console.log(t+` is not implemented`)}setBookmark(e,t){var n=t?.insertLeft?1:-1,r=this.indexFromPos(e);return new Ch(this,r,n)}addOverlay({query:e}){let t=new Mt({regexp:!0,search:e.source,caseSensitive:!/i/.test(e.flags)});if(t.valid){t.forVim=!0,this.cm6Query=t;let e=Nt.of(t);return this.cm6.dispatch({effects:e}),t}}removeOverlay(e){if(!this.cm6Query)return;this.cm6Query.forVim=!1;let t=Nt.of(this.cm6Query);this.cm6.dispatch({effects:t})}getSearchCursor(e,t){var n=this,r=null,i=null,a=!1;t.ch??=Number.MAX_VALUE;var o=eh(n.cm6.state.doc,t),s=e.source.replace(/(\\.|{(?:\d+(?:,\d*)?|,\d+)})|[{}]/g,function(e,t){return t||`\\`+e});function c(t,n=0,r=t.length){return new Ft(t,s,{ignoreCase:e.ignoreCase},n,r)}function l(e){var t=n.cm6.state.doc;if(e>t.length)return null;let r=c(t,e).next();return r.done?null:r.value}var u=1e4;function d(e,t){var r=n.cm6.state.doc;for(let n=1;;n++){let i=Math.max(e,t-n*u),a=c(r,i,t),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==e||o.from>i+10))return o;if(i==e)return null}}return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){var t=n.cm6.state.doc;return r=e?d(0,r?a?r.to-1:r.from:o):l(r?a?r.to+1:r.to:o),i=r&&{from:th(t,r.from),to:th(t,r.to),match:r.match},a=r?r.from==r.to:!1,r&&r.match},from:function(){return i?.from},to:function(){return i?.to},replace:function(e){r&&(ch(n,{changes:{from:r.from,to:r.to,insert:e}}),r.to=r.from+e.length,i&&(i.to=th(n.cm6.state.doc,r.to)))},get match(){return i&&i.match}}}findPosV(e,t,n,r){let{cm6:i}=this,a=i.state.doc,o=n==`page`?i.dom.clientHeight:0,s=eh(a,e),c=Je.cursor(s,1,void 0,r),l=Math.round(Math.abs(t));for(let e=0;e<l;e++)n==`page`?c=i.moveVertically(c,t>0,o):n==`line`&&(c=i.moveVertically(c,t>0));let u=th(a,c.head);return(t<0&&c.head==0&&r!=0&&e.line==0&&e.ch!=0||t>0&&c.head==a.length&&u.ch!=r&&e.line==u.line)&&(u.hitSide=!0),u}charCoords(e,t){var n=this.cm6.contentDOM.getBoundingClientRect(),r=eh(this.cm6.state.doc,e),i=this.cm6.coordsAtPos(r),a=-n.top;return{left:(i?.left||0)-n.left,top:(i?.top||0)+a,bottom:(i?.bottom||0)+a}}coordsChar(e,t){var n=this.cm6.contentDOM.getBoundingClientRect(),r=this.cm6.posAtCoords({x:e.left+n.left,y:e.top+n.top})||0;return th(this.cm6.state.doc,r)}getScrollInfo(){var e=this.cm6.scrollDOM;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight,width:e.scrollWidth,clientHeight:e.clientHeight,clientWidth:e.clientWidth}}scrollTo(e,t){e!=null&&(this.cm6.scrollDOM.scrollLeft=e),t!=null&&(this.cm6.scrollDOM.scrollTop=t)}scrollIntoView(e,t){if(e){var n=this.indexFromPos(e);this.cm6.dispatch({effects:V.scrollIntoView(n)})}else this.cm6.dispatch({scrollIntoView:!0,userEvent:`scroll`})}getWrapperElement(){return this.cm6.dom}getMode(){return{name:this.getOption(`mode`)}}setSize(e,t){this.cm6.dom.style.width=e+4+`px`,this.cm6.dom.style.height=t+`px`,this.refresh()}refresh(){this.cm6.measure()}destroy(){this.removeOverlay()}getLastEditEnd(){return this.posFromIndex(this.$lastChangeEndOffset)}onChange(e){this.$lineHandleChanges&&this.$lineHandleChanges.push(e);for(let t in this.marks)this.marks[t].update(e.changes);this.virtualSelection&&(this.virtualSelection.ranges=this.virtualSelection.ranges.map(t=>t.map(e.changes)));var t=this.curOp=this.curOp||{};e.changes.iterChanges((e,n,r,i,a)=>{(t.$changeStart==null||t.$changeStart>r)&&(t.$changeStart=r),this.$lastChangeEndOffset=i;var o={text:a.toJSON()};t.lastChange?t.lastChange.next=t.lastChange=o:t.lastChange=t.change=o},!0),t.changeHandlers||=this._handlers.change&&this._handlers.change.slice()}onSelectionChange(){var e=this.curOp=this.curOp||{};e.cursorActivityHandlers||=this._handlers.cursorActivity&&this._handlers.cursorActivity.slice(),this.curOp.cursorActivity=!0}operation(e,t){this.curOp||={$d:0},this.curOp.$d++;try{var n=e()}finally{this.curOp&&(this.curOp.$d--,this.curOp.$d||this.onBeforeEndOperation())}return n}onBeforeEndOperation(){var e=this.curOp,t=!1;e&&(e.change&&oh(e.changeHandlers,this,e.change),e&&e.cursorActivity&&(oh(e.cursorActivityHandlers,this,null),e.isVimOp&&(t=!0)),this.curOp=null),t&&this.scrollIntoView()}moveH(e,t){if(t==`char`){var n=this.getCursor();this.setCursor(n.line,n.ch+e)}}setOption(e,t){switch(e){case`keyMap`:this.state.keyMap=t;break;case`textwidth`:this.state.textwidth=t}}getOption(e){switch(e){case`firstLineNumber`:return 1;case`tabSize`:return this.cm6.state.tabSize||4;case`readOnly`:return this.cm6.state.readOnly;case`indentWithTabs`:return this.cm6.state.facet(R)==` `;case`indentUnit`:return this.cm6.state.facet(R).length||2;case`textwidth`:return this.state.textwidth;case`keyMap`:return this.state.keyMap||`vim`}}toggleOverwrite(e){this.state.overwrite=e}getTokenTypeAt(e){var t=this.indexFromPos(e),n=(tt(this.cm6.state,t)?.resolve(t))?.type?.name||``;return/comment/i.test(n)?`comment`:/string/i.test(n)?`string`:``}overWriteSelection(e){var t=this.cm6.state.doc,n=this.cm6.state.selection,r=n.ranges.map(e=>{if(e.empty){var n=e.to<t.length?t.sliceString(e.from,e.to+1):``;if(n&&!/\n/.test(n))return Je.range(e.from,e.to+1)}return e});this.cm6.dispatch({selection:Je.create(r,n.mainIndex)}),this.replaceSelection(e)}isInMultiSelectMode(){return this.cm6.state.selection.ranges.length>1}virtualSelectionMode(){return!!this.virtualSelection}forEachSelection(e){var t=this.cm6.state.selection;this.virtualSelection=Je.create(t.ranges,t.mainIndex);for(var n=0;n<this.virtualSelection.ranges.length;n++){var r=this.virtualSelection.ranges[n];r&&(this.cm6.dispatch({selection:Je.create([r])}),e(),this.virtualSelection.ranges[n]=this.cm6.state.selection.ranges[0])}this.cm6.dispatch({selection:this.virtualSelection}),this.virtualSelection=null}hardWrap(e){return wh(this,e)}};$.isMac=typeof navigator<`u`&&/Mac/.test(navigator.platform),$.Pos=nh,$.StringStream=ft,$.commands={cursorCharLeft:function(e){Ot(e.cm6)},redo:function(e){lh(e,!1)},undo:function(e){lh(e,!0)},newlineAndIndent:function(e){At({state:e.cm6.state,dispatch:t=>ch(e,t)})},indentAuto:function(e){St(e.cm6)},newlineAndIndentContinueComment:void 0,save:void 0},$.isWordChar=function(e){return sh.test(e)},$.keys=uh,$.addClass=function(e,t){},$.rmClass=function(e,t){},$.e_preventDefault=function(e){e.preventDefault()},$.e_stop=function(e){var t,n;(t=e?.stopPropagation)==null||t.call(e),(n=e?.preventDefault)==null||n.call(e)},$.lookupKey=function(e,t,n){var r=$.keys[e];!r&&/^Arrow/.test(e)&&(r=$.keys[e.slice(5)]),r&&n(r)},$.on=rh,$.off=ih,$.signal=ah,$.findMatchingTag=bh,$.findEnclosingTag=xh,$.keyName=void 0;function dh(e,t,n){var r=document.createElement(`div`);return r.appendChild(t),r}function fh(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}function ph(e,t,n){fh(e,s);var r=dh(e,t,n&&n.bottom),i=!1,a,o=n&&n.duration!==void 0?n.duration:5e3;function s(){i||(i=!0,clearTimeout(a),r.remove(),hh(e,r))}return r.onclick=function(e){e.preventDefault(),s()},mh(e,r),o&&(a=setTimeout(s,o)),s}function mh(e,t){var n=e.state.dialog;e.state.dialog=t,t.style.flex=`1`,t&&n!==t&&(n&&n.contains(document.activeElement)&&e.focus(),n&&n.parentElement?n.parentElement.replaceChild(t,n):n&&n.remove(),$.signal(e,`dialog`))}function hh(e,t){e.state.dialog==t&&(e.state.dialog=null,$.signal(e,`dialog`))}function gh(e,t,n,r){r||={},fh(e,void 0);var i=dh(e,t,r.bottom),a=!1;mh(e,i);function o(t){if(typeof t==`string`)s.value=t;else{if(a)return;a=!0,hh(e,i),e.state.dialog||e.focus(),r.onClose&&r.onClose(i)}}var s=i.getElementsByTagName(`input`)[0];return s&&(r.value&&(s.value=r.value,r.selectValueOnOpen!==!1&&s.select()),r.onInput&&$.on(s,`input`,function(e){r.onInput(e,s.value,o)}),r.onKeyUp&&$.on(s,`keyup`,function(e){r.onKeyUp(e,s.value,o)}),$.on(s,`keydown`,function(e){r&&r.onKeyDown&&r.onKeyDown(e,s.value,o)||(e.keyCode==13&&n&&n(s.value),(e.keyCode==27||r.closeOnEnter!==!1&&e.keyCode==13)&&(s.blur(),$.e_stop(e),o()))}),r.closeOnBlur!==!1&&$.on(s,`blur`,function(){setTimeout(function(){document.activeElement!==s&&o()})}),s.focus()),o}var _h={"(":`)>`,")":`(<`,"[":`]>`,"]":`[<`,"{":`}>`,"}":`{<`,"<":`>>`,">":`<<`};function vh(e){return e&&e.bracketRegex||/[(){}[\]]/}function yh(e,t,n,r,i){for(var a=i&&i.maxScanLineLength||1e4,o=i&&i.maxScanLines||1e3,s=[],c=vh(i),l=n>0?Math.min(t.line+o,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-o),u=t.line;u!=l;u+=n){var d=e.getLine(u);if(d){var f=n>0?0:d.length-1,p=n>0?d.length:-1;if(!(d.length>a))for(u==t.line&&(f=t.ch-+(n<0));f!=p;f+=n){var m=d.charAt(f);if(c.test(m)){var h=_h[m];if(h&&h.charAt(1)==`>`==n>0)s.push(m);else if(s.length)s.pop();else return{pos:new nh(u,f),ch:m}}}}}return u-n!=(n>0?e.lastLine():e.firstLine())&&null}function bh(e,t){return null}function xh(e,t){var n=e.cm6.state,r=e.indexFromPos(t);r<n.doc.length&&n.sliceDoc(r,r+1)==`<`&&r++;for(var i=tt(n,r)?.resolve(r)||null;i;){if(i.firstChild?.type.name==`OpenTag`&&i.lastChild?.type.name==`CloseTag`)return{open:Sh(n.doc,i.firstChild),close:Sh(n.doc,i.lastChild)};i=i.parent}}function Sh(e,t){return{from:th(e,t.from),to:th(e,t.to)}}var Ch=class{constructor(e,t,n){this.cm=e,this.id=e.$mid++,this.offset=t,this.assoc=n,e.marks[this.id]=this}clear(){delete this.cm.marks[this.id]}find(){return this.offset==null?null:this.cm.posFromIndex(this.offset)}update(e){this.offset!=null&&(this.offset=e.mapPos(this.offset,this.assoc,ze.TrackDel))}};function wh(e,t){for(var n=t.column||e.getOption(`textwidth`)||80,r=t.allowMerge!=0,i=Math.min(t.from,t.to),a=Math.max(t.from,t.to);i<=a;){var o=e.getLine(i);if(o.length>n){var s=p(o,n,5);if(s){var c=/^\s*/.exec(o)?.[0];e.replaceRange(`
|
|
89
|
-
`+c,new nh(i,s.start),new nh(i,s.end))}a++}else if(r&&/\S/.test(o)&&i!=a){var l=e.getLine(i+1);if(l&&/\S/.test(l)){var u=o.replace(/\s+$/,``),d=l.replace(/^\s+/,``),f=u+` `+d,s=p(f,n,5);s&&s.start>u.length||f.length<n?(e.replaceRange(` `,new nh(i,u.length),new nh(i+1,l.length-d.length)),i--,a--):u.length<o.length&&e.replaceRange(``,new nh(i,u.length),new nh(i,o.length))}}i++}return i;function p(e,t,n){if(!(e.length<t)){var r=e.slice(0,t),i=e.slice(t),a=/^(?:(\s+)|(\S+)(\s+))/.exec(i),o=/(?:(\s+)|(\s+)(\S+))$/.exec(r),s=0,c=0;if(o&&!o[2]&&(s=t-o[1].length,c=t),a&&!a[2]&&(s||=t,c=t+a[1].length),s)return{start:s,end:c};if(o&&o[2]&&o.index>n)return{start:o.index,end:o.index+o[2].length};if(a&&a[2])return s=t+a[2].length,{start:s,end:s+a[3].length}}}}var Th=et||function(){let e={cursorBlinkRate:1200};return function(){return e}}(),Eh=class{constructor(e,t,n,r,i,a,o,s,c,l){this.left=e,this.top=t,this.height=n,this.fontFamily=r,this.fontSize=i,this.fontWeight=a,this.color=o,this.className=s,this.letter=c,this.partial=l}draw(){let e=document.createElement(`div`);return e.className=this.className,this.adjust(e),e}adjust(e){e.style.left=this.left+`px`,e.style.top=this.top+`px`,e.style.height=this.height+`px`,e.style.lineHeight=this.height+`px`,e.style.fontFamily=this.fontFamily,e.style.fontSize=this.fontSize,e.style.fontWeight=this.fontWeight,e.style.color=this.partial?`transparent`:this.color,e.className=this.className,e.textContent=this.letter}eq(e){return this.left==e.left&&this.top==e.top&&this.height==e.height&&this.fontFamily==e.fontFamily&&this.fontSize==e.fontSize&&this.fontWeight==e.fontWeight&&this.color==e.color&&this.className==e.className&&this.letter==e.letter}},Dh=class{constructor(e,t){this.view=e,this.rangePieces=[],this.cursors=[],this.cm=t,this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.cursorLayer=e.scrollDOM.appendChild(document.createElement(`div`)),this.cursorLayer.className=`cm-cursorLayer cm-vimCursorLayer`,this.cursorLayer.setAttribute(`aria-hidden`,`true`),e.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){let e=Th(this.cm.cm6.state).cursorBlinkRate;this.cursorLayer.style.animationDuration=e+`ms`}update(e){(e.selectionSet||e.geometryChanged||e.viewportChanged)&&(this.view.requestMeasure(this.measureReq),this.cursorLayer.style.animationName=this.cursorLayer.style.animationName==`cm-blink`?`cm-blink2`:`cm-blink`),Oh(e)&&this.setBlinkRate()}scheduleRedraw(){this.view.requestMeasure(this.measureReq)}readPos(){let{state:e}=this.view,t=[];for(let n of e.selection.ranges){let r=n==e.selection.main,i=jh(this.cm,this.view,n,r);i&&t.push(i)}return{cursors:t}}drawSel({cursors:e}){if(e.length!=this.cursors.length||e.some((e,t)=>!e.eq(this.cursors[t]))){let t=this.cursorLayer.children;if(t.length!==e.length){this.cursorLayer.textContent=``;for(let t of e)this.cursorLayer.appendChild(t.draw())}else e.forEach((e,n)=>e.adjust(t[n]));this.cursors=e}}destroy(){this.cursorLayer.remove()}};function Oh(e){return Th(e.startState)!=Th(e.state)}var kh=ht.highest(V.theme({".cm-vimMode .cm-line":{"& ::selection":{backgroundColor:`transparent !important`},"&::selection":{backgroundColor:`transparent !important`},caretColor:`transparent !important`},".cm-fat-cursor":{position:`absolute`,background:`#ff9696`,border:`none`,whiteSpace:`pre`},"&:not(.cm-focused) .cm-fat-cursor":{background:`none`,outline:`solid 1px #ff9696`,color:`transparent !important`}}));function Ah(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==dt.LTR?t.left:t.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function jh(e,t,n,r){var i;let a=n.head,o=!1,s=1,c=e.state.vim;if(c&&(!c.insertMode||e.state.overwrite)){if(o=!0,c.visualBlock&&!r)return null;n.anchor<n.head&&(a<t.state.doc.length&&t.state.sliceDoc(a,a+1))!=`
|
|
90
|
-
`&&a--,e.state.overwrite?s=.2:c.status&&(s=.5)}if(o){let e=a<t.state.doc.length&&t.state.sliceDoc(a,a+1);e&&/[\uDC00-\uDFFF]/.test(e)&&a>1&&(a--,e=t.state.sliceDoc(a,a+1));let n=t.coordsAtPos(a,1);if(!n)return null;let o=Ah(t),c=t.domAtPos(a),u=c?c.node:t.contentDOM;for(u instanceof Text&&c.offset>=u.data.length&&u.parentElement?.nextSibling&&(u=u.parentElement?.nextSibling,c={node:u,offset:0});c&&c.node instanceof HTMLElement;)u=c.node,c={node:c.node.childNodes[c.offset],offset:0};if(!(u instanceof HTMLElement)){if(!u.parentNode)return null;u=u.parentNode}let d=getComputedStyle(u),f=n.left,p=(i=t).coordsForChar?.call(i,a);if(p&&(f=p.left),!e||e==`
|
|
91
|
-
`||e==`\r`)e=`\xA0`;else if(e==` `){e=`\xA0`;var l=t.coordsAtPos(a+1,-1);l&&(f=l.left-(l.left-n.left)/parseInt(d.tabSize))}else/[\uD800-\uDBFF]/.test(e)&&a<t.state.doc.length-1&&(e+=t.state.sliceDoc(a+1,a+2));let m=n.bottom-n.top;return new Eh((f-o.left)/t.scaleX,(n.top-o.top+m*(1-s))/t.scaleY,m*s/t.scaleY,d.fontFamily,d.fontSize,d.fontWeight,d.color,r?`cm-fat-cursor cm-cursor-primary`:`cm-fat-cursor cm-cursor-secondary`,e,s!=1)}return null}var Mh=typeof navigator<`u`&&/linux/i.test(navigator.platform)&&/ Gecko\/\d+/.exec(navigator.userAgent),Nh=$m($),Ph=V.baseTheme({".cm-vimMode .cm-cursorLayer:not(.cm-vimCursorLayer)":{display:`none`},".cm-vim-panel":{padding:`0px 10px`,fontFamily:`monospace`,minHeight:`1.3em`,display:`flex`},".cm-vim-panel input":{border:`none`,outline:`none`,backgroundColor:`inherit`},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`}}),Fh=_t.fromClass(class{constructor(e){this.status=``,this.query=null,this.decorations=z.none,this.waitForCopy=!1,this.lastKeydown=``,this.useNextTextInput=!1,this.compositionText=``,this.view=e;let t=this.cm=new $(e);Nh.enterVimMode(this.cm),this.view.cm=this.cm,this.cm.state.vimPlugin=this,this.blockCursor=new Dh(e,t),this.updateClass(),this.cm.on(`vim-command-done`,()=>{t.state.vim&&(t.state.vim.status=``),this.blockCursor.scheduleRedraw(),this.updateStatus()}),this.cm.on(`vim-mode-change`,e=>{t.state.vim&&(t.state.vim.mode=e.mode,e.subMode&&(t.state.vim.mode+=` block`),t.state.vim.status=``,this.blockCursor.scheduleRedraw(),this.updateClass(),this.updateStatus())}),this.cm.on(`dialog`,()=>{this.cm.state.statusbar?this.updateStatus():e.dispatch({effects:Rh.of(!!this.cm.state.dialog)})}),this.dom=document.createElement(`span`),this.spacer=document.createElement(`span`),this.spacer.style.flex=`1`,this.statusButton=document.createElement(`span`),this.statusButton.onclick=e=>{Nh.handleKey(this.cm,`<Esc>`,`user`),this.cm.focus()},this.statusButton.style.cssText=`cursor: pointer`}update(e){if((e.viewportChanged||e.docChanged)&&this.query&&this.highlight(this.query),e.docChanged&&this.cm.onChange(e),e.selectionSet&&this.cm.onSelectionChange(),e.viewportChanged,this.cm.curOp&&!this.cm.curOp.isVimOp&&this.cm.onBeforeEndOperation(),e.transactions){for(let t of e.transactions)for(let e of t.effects)if(e.is(Nt)){if(!e.value?.forVim)this.highlight(null);else{let t=e.value.create();this.highlight(t)}}}this.blockCursor.update(e)}updateClass(){let e=this.cm.state;!e.vim||e.vim.insertMode&&!e.overwrite?this.view.scrollDOM.classList.remove(`cm-vimMode`):this.view.scrollDOM.classList.add(`cm-vimMode`)}updateStatus(){let e=this.cm.state.statusbar,t=this.cm.state.vim;if(!e||!t)return;let n=this.cm.state.dialog;if(n)n.parentElement!=e&&(e.textContent=``,e.appendChild(n));else{e.textContent=``;var r=(t.mode||`normal`).toUpperCase();t.insertModeReturn&&(r+=`(C-O)`),this.statusButton.textContent=`--${r}--`,e.appendChild(this.statusButton),e.appendChild(this.spacer)}this.dom.textContent=t.status,e.appendChild(this.dom)}destroy(){Nh.leaveVimMode(this.cm),this.updateClass(),this.blockCursor.destroy(),delete this.view.cm}highlight(e){if(this.query=e,!e)return this.decorations=z.none;let{view:t}=this,n=new Qe;for(let r=0,i=t.visibleRanges,a=i.length;r<a;r++){let{from:o,to:s}=i[r];for(;r<a-1&&s>i[r+1].from-500;)s=i[++r].to;e.highlight(t.state,o,s,(e,t)=>{n.add(e,t,Lh)})}return this.decorations=n.finish()}handleKey(e,t){let n=this.cm,r=n.state.vim;if(!r)return;let i=Nh.vimKeyFromEvent(e,r);if($.signal(this.cm,`inputEvent`,{type:`handleKey`,key:i}),!i)return;if(i==`<Esc>`&&!r.insertMode&&!r.visualMode&&this.query){let e=r.searchState_;e&&(n.removeOverlay(e.getOverlay()),e.setOverlay(null))}if(i===`<C-c>`&&!$.isMac&&n.somethingSelected())return this.waitForCopy=!0,!0;r.status=(r.status||``)+i;let a=Nh.multiSelectHandleKey(n,i,`user`);return r=Nh.maybeInitVimState_(n),!a&&r.insertMode&&n.state.overwrite&&(e.key&&e.key.length==1&&!/\n/.test(e.key)?(a=!0,n.overWriteSelection(e.key)):e.key==`Backspace`&&(a=!0,$.commands.cursorCharLeft(n))),a&&($.signal(this.cm,`vim-keypress`,i),e.preventDefault(),e.stopPropagation(),this.blockCursor.scheduleRedraw()),this.updateStatus(),!!a}},{eventHandlers:{copy:function(e,t){this.waitForCopy&&(this.waitForCopy=!1,Promise.resolve().then(()=>{var e=this.cm,t=e.state.vim;t&&(t.insertMode?e.setSelection(e.getCursor(),e.getCursor()):e.operation(()=>{e.curOp&&(e.curOp.isVimOp=!0),Nh.handleKey(e,`<Esc>`,`user`)}))}))},compositionstart:function(e,t){this.useNextTextInput=!0,$.signal(this.cm,`inputEvent`,e)},compositionupdate:function(e,t){$.signal(this.cm,`inputEvent`,e)},compositionend:function(e,t){$.signal(this.cm,`inputEvent`,e)},keypress:function(e,t){$.signal(this.cm,`inputEvent`,e),this.lastKeydown==`Dead`&&this.handleKey(e,t)},keydown:function(e,t){$.signal(this.cm,`inputEvent`,e),this.lastKeydown=e.key,this.lastKeydown==`Unidentified`||this.lastKeydown==`Process`||this.lastKeydown==`Dead`?this.useNextTextInput=!0:(this.useNextTextInput=!1,this.handleKey(e,t))}},provide:()=>[V.inputHandler.of((e,t,n,r)=>{var i=Uh(e);if(!i)return!1;var a=i.state?.vim,o=i.state.vimPlugin;if(a&&!a.insertMode&&!i.curOp?.isVimOp){if(r===`\0\0`)return!0;if($.signal(i,`inputEvent`,{type:`text`,text:r,from:t,to:n}),r.length==1&&o.useNextTextInput){if(a.expectLiteralNext&&e.composing)return o.compositionText=r,!1;if(o.compositionText){var s=o.compositionText;o.compositionText=``;var c=e.state.selection.main.head;if(s===e.state.sliceDoc(c-s.length,c)){var l=i.getCursor();i.replaceRange(``,i.posFromIndex(c-s.length),l)}}return o.handleKey({key:r,preventDefault:()=>{},stopPropagation:()=>{}}),Ih(e),!0}}return!1})],decorations:e=>e.decorations});function Ih(e){var t=e.scrollDOM.parentElement;if(t){if(Mh){e.contentDOM.textContent=`\0\0`,e.contentDOM.dispatchEvent(new CustomEvent(`compositionend`));return}var n=e.scrollDOM.nextSibling,r=window.getSelection(),i=r&&{anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset};e.scrollDOM.remove(),t.insertBefore(e.scrollDOM,n);try{i&&r&&(r.setPosition(i.anchorNode,i.anchorOffset),i.focusNode&&r.extend(i.focusNode,i.focusOffset))}catch(e){console.error(e)}e.focus(),e.contentDOM.dispatchEvent(new CustomEvent(`compositionend`))}}var Lh=z.mark({class:`cm-searchMatch`}),Rh=$e.define(),zh=He.define({create:()=>!1,update(e,t){for(let n of t.effects)n.is(Rh)&&(e=n.value);return e},provide:e=>Be.from(e,e=>e?Bh:null)});function Bh(e){let t=document.createElement(`div`);t.className=`cm-vim-panel`;let n=e.cm;return n.state.dialog&&t.appendChild(n.state.dialog),{top:!1,dom:t}}function Vh(e){let t=document.createElement(`div`);t.className=`cm-vim-panel`;let n=e.cm;return n.state.statusbar=t,n.state.vimPlugin.updateStatus(),{dom:t}}function Hh(e={}){return[Ph,Fh,kh,e.status?Be.of(Vh):zh]}function Uh(e){return e.cm||null}function Wh(e){let t=e.state.selection.main;return t.from===0&&t.to===0}function Gh(e,t=!1){let n=e.state.selection.main,r=e.state.doc.length;return t&&n.from===r-1&&n.to===r-1?!0:n.from===r&&n.to===r}function Kh(e){e&&e.dispatch({selection:{anchor:e.state.doc.length,head:e.state.doc.length}})}function qh(e){requestAnimationFrame(()=>{let t=e.current?.view;t&&(t.focus(),Kh(t))})}function Jh(e){let t=e.dom.closest(`.marimo-cell`);t&&requestAnimationFrame(()=>{t.scrollIntoView({behavior:`instant`,block:`nearest`,inline:`nearest`})})}function Yh(e){return Uh(e)?.state.vim!=null}function Xh(e){let t=Uh(e)?.state.vim;return t?!t.mode&&!t.insertMode&&!t.visualMode||t.mode===`normal`:!1}function Zh(e){e&&e.dispatch({selection:{anchor:0,head:e.state.doc.length}})}var Qh=new Set([Q.ClassDefinition]);function $h(e,t){requestAnimationFrame(()=>{e.focus(),e.dispatch({selection:{anchor:t,head:t},effects:V.scrollIntoView(t,{y:`center`})})}),Jh(e)}function eg(e,t){let n=Ie(e),r=null;return n.iterate({enter:n=>{if(r!==null)return!1;if(n.name===Q.VariableName&&e.doc.sliceString(n.from,n.to)===t)return r=n.from,!1;if(n.name===Q.Comment||n.name===Q.String)return!1}}),r}function tg(e,t){let n=[],r=e.resolveInner(t,0);for(;r;)Dm.has(r.name)&&(n.some(e=>e.type===Q.FunctionDefinition||e.type===Q.LambdaExpression)&&r.name===Q.ClassDefinition||n.push({id:r.from,type:r.name})),r=r.parent;return n.push({id:-1,type:`global`}),n}function ng(e,t,n){e.push({scopeId:t,from:n})}function rg(e,t){if(e.firstChild())do t(e.node);while(e.nextSibling())}function ig(e,t){let{state:n,variableName:r,scopeId:i,declarations:a}=t;switch(e.name){case Q.VariableName:n.doc.sliceString(e.from,e.to)===r&&ng(a,i,e.from);break;case Q.TupleExpression:case Q.ArrayExpression:{let n=e.node.cursor();n.firstChild();do ig(n,t);while(n.nextSibling());break}}}function ag(e,t){let{state:n,variableName:r,scopeId:i,declarations:a}=t,o=e.cursor();o.firstChild();do{if(o.name!==Q.ParamList)continue;let e=o.node.cursor();e.firstChild();do e.name===Q.VariableName&&n.doc.sliceString(e.from,e.to)===r&&ng(a,i,e.from);while(e.nextSibling())}while(o.nextSibling())}function og(e,t){let n=e.cursor();n.firstChild();let r=!1;do if(n.name===Em.For)r=!0;else if(r&&n.name===Em.In)break;else r&&ig(n,t);while(n.nextSibling())}function sg(e,t){let{state:n,variableName:r,scopeStack:i,declarations:a}=t,o=e.cursor(),s=o.name,c=o.from,l=Dm.has(s)?[...i,c]:i,u=l[l.length-1]??-1;switch(s){case Q.FunctionDefinition:case Q.ClassDefinition:{let t=e.cursor();t.firstChild();do if(t.name===Q.VariableName&&n.doc.sliceString(t.from,t.to)===r){ng(a,i[i.length-1]??-1,t.from);break}while(t.nextSibling());s===Q.FunctionDefinition&&ag(e,{state:n,variableName:r,scopeId:c,declarations:a});break}case Q.LambdaExpression:ag(e,{state:n,variableName:r,scopeId:c,declarations:a});break;case Q.ArrayComprehensionExpression:case Q.DictionaryComprehensionExpression:case Q.SetComprehensionExpression:case Q.ComprehensionExpression:case Q.ForStatement:og(e,{state:n,variableName:r,scopeId:u,declarations:a});break;case Q.AssignStatement:{let t=[],i=e.cursor();i.firstChild();do i.name===Q.AssignOp&&t.push(i.from);while(i.nextSibling());let o=t[t.length-1];if(o===void 0)break;let s=e.cursor();s.firstChild();do s.from<o&&ig(s,{state:n,variableName:r,scopeId:u,declarations:a});while(s.nextSibling());break}case Q.ImportStatement:{let t=e.cursor();t.firstChild();let i=!1,o=null,s=()=>{o?.matches&&ng(a,u,o.from),o=null};do{if(t.name===Em.Import){i=!0;continue}if(i){if(t.name===Em.As){o=null;continue}t.name===Q.VariableName?(s(),o={from:t.from,matches:n.doc.sliceString(t.from,t.to)===r}):t.name===`,`&&s()}}while(t.nextSibling());s();break}case Q.TryStatement:case Q.WithStatement:{let t=e.cursor();t.firstChild();let i=!1;do t.name===Em.As?i=!0:i&&t.name===Q.VariableName&&n.doc.sliceString(t.from,t.to)===r&&(ng(a,u,t.from),i=!1);while(t.nextSibling());break}}rg(o,e=>{sg(e,{state:n,variableName:r,scopeStack:l,declarations:a})})}function cg(e,t,n){let r=Ie(e),i=[];sg(r,{state:e,variableName:t,scopeStack:[],declarations:i});let a=Math.max(0,Math.min(n,e.doc.length));for(let e of tg(r,a)){let t=i.filter(t=>t.scopeId===e.id).filter(t=>!Qh.has(e.type)||t.from<=a).toSorted((e,t)=>e.from-t.from)[0];if(t)return t.from}return null}function lg(e,t,n){let{state:r}=e,i=n===void 0?eg(r,t):cg(r,t,n);return i!==null&&($h(e,i),!0)}function ug(e,t){return $h(e,e.state.doc.line(t).from),!0}function dg(e,t){let n=u.get(k);return(n===`mac`?e.mac??e.key:n===`windows`?e.win??e.key:e.linux??e.key)===t}function fg(e){let{from:t,to:n}=e.selection.main;if(t===n){let{startToken:n,endToken:r}=Ym(e.doc,t);return{position:n,word:e.doc.sliceString(n,r)}}return{position:t,word:e.doc.sliceString(t,n)}}function pg(e,t){if(!t)return null;let n=e[t];return!n||n.declaredBy.length===0?null:n.declaredBy[0]}function mg(e){return e.startsWith(`_`)}function hg(e){let{state:t}=e,{position:n,word:r}=fg(t);return r?(Qt(e),e.dispatch({effects:pt}),vg(e,r,n)):!1}function gg(e,t=u.get(ee).getHotkey(`cell.goToDefinition`).key){for(let n of e.state.facet(Ke).flat())if(dg(n,t)&&n.run?.(e))return!0;return!1}function _g(e){return hg(e)?!0:gg(e)}function vg(e,t,n){if(n!==void 0&&lg(e,t,n))return!0;let r=bg(e,t);return r?lg(r,t):!1}function yg(e,t){let n=xg(e);return n?ug(n,t):!1}function bg(e,t){if(mg(t))return e;let n=pg(u.get(em),t);return n?xg(n):null}function xg(e){return u.get(FT).cellHandles[e].current?.editorView??null}var Sg=o(null);function Cg(e){let t=u.get(Sg);if(e===null){u.set(Sg,null);return}(t?.cellId!==e.cellId||t.line!==e.line)&&u.set(Sg,{...e,startedAtMs:Date.now()})}var wg=o(new Map),Tg=new Set;function Eg(e){return o(t=>{let n=t(Sg);return n?.cellId===e?n.line:null})}function Dg(e){return o(t=>{let n=t(Sg);return n?.cellId===e?{line:n.line,startedAtMs:n.startedAtMs}:null})}function Og(e){return o(t=>t(wg).get(e)??Tg)}function kg(e){let t={};for(let[n,r]of e)r.size>0&&(t[n]=[...r].toSorted((e,t)=>e-t));sn().sendSetBreakpoints({breakpoints:t}).catch(e=>{T.debug(`Failed to sync breakpoints to kernel`,{error:e})})}function Ag(e){let t=u.get(wg);if(!t.has(e))return;let n=new Map(t);n.delete(e),u.set(wg,n),kg(n)}function jg(){let e=u.get(wg);e.size>0&&kg(e)}function Mg(e,t){let n=u.get(wg),r=new Map(n),i=new Set(r.get(e)??[]);i.has(t)?i.delete(t):i.add(t),i.size>0?r.set(e,i):r.delete(e),u.set(wg,r),kg(r)}function Ng(e,t){if(t==null||t<1||t>e.doc.lines)return z.none;let n=new Qe;try{let r=e.doc.line(t);n.add(r.from,r.from,z.line({class:`cm-debugger-current-line`}))}catch(e){T.debug(`Invalid debugger line`,{error:e})}return n.finish()}var Pg=class{unsubscribe;decorations;constructor(e,t){this.decorations=Ng(e.state,t.get()),this.unsubscribe=t.sub(t=>{this.decorations=Ng(e.state,t),e.dispatch({userEvent:`marimo.debugger-line-update`})})}update(e){this.decorations=this.decorations.map(e.changes)}destroy(){this.unsubscribe()}};function Fg(e){return[_t.define(t=>new Pg(t,e),{decorations:e=>e.decorations}),V.theme({".cm-debugger-current-line":{backgroundColor:`color-mix(in srgb, var(--amber-4) 50%, transparent)`}})]}var Ig=new class extends rt{toDOM(){let e=document.createElement(`div`);return e.className=`cm-breakpoint-marker`,e}},Lg=$e.define(),Rg=He.define({create:()=>new Set,update(e,t){for(let e of t.effects)if(e.is(Lg))return e.value;return e}});function zg(e){let t=e.field(Rg);if(t.size===0)return Le.empty;let n=new Qe;for(let r of[...t].toSorted((e,t)=>e-t))if(r>=1&&r<=e.doc.lines){let t=e.doc.line(r);n.add(t.from,t.from,Ig)}return n.finish()}var Bg=class{unsubscribe;constructor(e,t){let n=t=>{e.dispatch({effects:Lg.of(t)})};t.get().size>0&&queueMicrotask(()=>n(t.get())),this.unsubscribe=t.sub(n)}destroy(){this.unsubscribe()}};function Vg(e,t){return[Rg,_t.define(e=>new Bg(e,t)),nt({class:`cm-breakpoint-gutter`,markers:e=>zg(e.state),initialSpacer:()=>Ig,domEventHandlers:{mousedown:(t,n)=>{let r=t.state.doc.lineAt(n.from).number;return Mg(e,r),!0}}}),V.theme({".cm-breakpoint-gutter":{width:`14px`,cursor:`pointer`},".cm-breakpoint-marker":{width:`8px`,height:`8px`,borderRadius:`50%`,backgroundColor:`var(--red-9)`,margin:`4px auto`}})]}var Hg=class e{ms;static fromMilliseconds(t){return t==null?null:new e(t)}static fromSeconds(t){return t==null?null:new e(t*1e3)}static now(){return new e(Date.now())}constructor(e){this.ms=e}toMilliseconds(){return this.ms}toSeconds(){return this.ms/1e3}};function Ug(e){if(e===null)return``;let t=e,n=t/1e3;return n>=60?`${Math.floor(n/60)}m${Math.floor(n%60)}s`:n>=1?`${n.toFixed(2).toString()}s`:`${t.toFixed(0).toString()}ms`}var Wg=500,Gg=250,Kg=class e extends it{static intervals=new WeakMap;startedAtMs;constructor(e){super(),this.startedAtMs=e}eq(e){return e.startedAtMs===this.startedAtMs}toDOM(){let t=document.createElement(`span`);t.className=`cm-line-timer`,t.setAttribute(`aria-hidden`,`true`);let n=()=>{let e=Date.now()-this.startedAtMs;t.textContent=e>=Wg?Ug(e):``};return n(),e.intervals.set(t,window.setInterval(n,Gg)),t}destroy(t){let n=e.intervals.get(t);n!==void 0&&(window.clearInterval(n),e.intervals.delete(t))}ignoreEvent(){return!0}};function qg(e,t){if(t===null||t.line<1||t.line>e.doc.lines)return z.none;let n=new Qe;try{let r=e.doc.line(t.line);n.add(r.from,r.from,z.line({class:`cm-timing-current-line`})),n.add(r.to,r.to,z.widget({widget:new Kg(t.startedAtMs),side:1}))}catch(e){T.debug(`Invalid timing line`,{error:e})}return n.finish()}var Jg=class{unsubscribe;decorations;constructor(e,t){this.decorations=qg(e.state,t.get()),this.unsubscribe=t.sub(t=>{this.decorations=qg(e.state,t),e.dispatch({userEvent:`marimo.timing-line-update`})})}update(e){this.decorations=this.decorations.map(e.changes)}destroy(){this.unsubscribe()}};function Yg(e){return[_t.define(t=>new Jg(t,e),{decorations:e=>e.decorations}),V.theme({".cm-timing-current-line":{backgroundColor:`color-mix(in srgb, var(--grass-4) 50%, transparent)`},".cm-line-timer":{color:`var(--grass-11)`,fontSize:`0.85em`,marginLeft:`1.5ch`,pointerEvents:`none`}})]}function Xg(e,t){if(!t?.length)return z.none;let n=new Qe,r=e.facet(Cu),i=t.filter(e=>e.kind===`cell`&&e.cellId===r).toSorted((e,t)=>e.lineNumber-t.lineNumber);for(let t of i)try{let r=e.doc.line(t.lineNumber),i=z.line({class:`cm-error-line`});n.add(r.from,r.from,i)}catch(e){T.debug(`Invalid line number in error decoration`,{error:e})}return n.finish()}function Zg(e,t){if(!t?.length)return;let n=e.state.facet(Cu),r=t.filter(e=>e.kind===`cell`&&e.cellId===n);if(r.length===0)return;let i=lt(e.state),a=[];for(let t of r)try{let n=e.state.doc.line(t.lineNumber);i.between(n.from,n.to,(e,t)=>{a.push(Ye.of({from:e,to:t}))})}catch(e){T.debug(`Invalid line numbers`,{error:e})}a.length>0&&e.dispatch({effects:a})}var Qg=class{unsubscribe;decorations;constructor(e,t){let n=t.get();this.decorations=Xg(e.state,n),Zg(e,n),this.unsubscribe=t.sub(t=>{let n=this.decorations.size;this.decorations=Xg(e.state,t),Zg(e,t),n!==this.decorations.size&&e.dispatch({userEvent:`marimo.error-decoration-update`})})}update(e){this.decorations=this.decorations.map(e.changes)}destroy(){this.unsubscribe()}};function $g(e){return _t.define(t=>new Qg(t,e),{decorations:e=>e.decorations})}function e_(e){return[$g(e),V.theme({".cm-error-line":{backgroundColor:`color-mix(in srgb, var(--red-4) 40%, transparent)`},"&.cm-focused .cm-error-line.cm-activeLine":{backgroundColor:`color-mix(in srgb, var(--red-5) 40%, transparent)`}})]}function t_({cellId:e,hotkeys:t}){let n=[];return n.push(...C({key:t.getHotkey(`cell.run`).key,preventDefault:!0,stopPropagation:!0,run:e=>(e.state.facet(Su).onRun(),!0)}),{key:t.getHotkey(`cell.runAndNewBelow`).key,preventDefault:!0,stopPropagation:!0,run:t=>{let n=t.state.facet(Su);return n.onRun(),e===`__scratch__`||(t.contentDOM.blur(),n.moveToNextCell({cellId:e,before:!1}),!0)}},...C({key:t.getHotkey(`cell.runAndNewAbove`).key,preventDefault:!0,stopPropagation:!0,run:t=>{let n=t.state.facet(Su);return n.onRun(),e===`__scratch__`||(t.contentDOM.blur(),n.moveToNextCell({cellId:e,before:!0}),!0)}}),{key:t.getHotkey(`cell.aiCompletion`).key,preventDefault:!0,stopPropagation:!0,run:e=>(e.state.facet(Su).aiCellCompletion()&&e.contentDOM.focus(),!0)}),e!==`__scratch__`&&n.push({key:t.getHotkey(`cell.goToDefinition`).key,run:e=>hg(e)},{key:t.getHotkey(`cell.delete`).key,preventDefault:!0,stopPropagation:!0,run:e=>(e.state.doc.length===0&&e.state.facet(Su).deleteCell(),!0)},{key:t.getHotkey(`cell.moveUp`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Su).moveCell({cellId:e,before:!0}),!0)},{key:t.getHotkey(`cell.moveDown`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Su).moveCell({cellId:e,before:!1}),!0)},{key:t.getHotkey(`cell.moveLeft`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Su).moveCell({cellId:e,before:!0,direction:`left`}),!0)},{key:t.getHotkey(`cell.moveRight`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Su).moveCell({cellId:e,before:!1,direction:`right`}),!0)},{key:`ArrowUp`,run:t=>Xt(t.state)?!1:Wh(t)?(t.state.facet(Su).moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0):!1},{key:`ArrowDown`,run:t=>Xt(t.state)?!1:Gh(t)?(t.state.facet(Su).moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0):!1},{key:t.getHotkey(`cell.focusDown`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Su).moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0)},{key:t.getHotkey(`cell.focusUp`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Su).moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0)},{key:t.getHotkey(`cell.sendToBottom`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Su).sendToBottom({cellId:e}),!0)},{key:t.getHotkey(`cell.sendToTop`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Su).sendToTop({cellId:e}),!0)},{key:t.getHotkey(`cell.createAbove`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.contentDOM.blur(),t.state.facet(Su).createNewCell({cellId:e,before:!0}),!0)},{key:t.getHotkey(`cell.createBelow`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.contentDOM.blur(),t.state.facet(Su).createNewCell({cellId:e,before:!1}),!0)},{key:t.getHotkey(`cell.hideCode`).key,preventDefault:!0,stopPropagation:!0,run:t=>{let n=t.state.facet(Su).toggleHideCode();return Qt(t),n?(t.contentDOM.blur(),document.getElementById(mr.create(e))?.focus()):t.contentDOM.focus(),!0}},{key:t.getHotkey(`cell.splitCell`).key,preventDefault:!0,stopPropagation:!0,run:t=>{let n=t.state.facet(Su);return n.splitCell({cellId:e}),n.moveToNextCell&&requestAnimationFrame(()=>{t.contentDOM.blur(),n.moveToNextCell({cellId:e,before:!1})}),!0}}),[ht.high(Ke.of(n))]}function n_(e){return[V.updateListener.of(e=>{if(e.docChanged){let t=e.transactions.some(e=>e.effects.some(e=>e.is(Nf))),n=UC(e.view),r=e.view.state.facet(Su),i=e.view.state.facet(Cu);r.updateCellCode({cellId:i,code:n,formattingChange:t}),u.get(jp).has(i)&&u.set(Mp)}}),Jp(e)]}var r_=[`input`,`delete`,`undo`,`redo`];function i_({docChanged:e,transactions:t,predicate:n=()=>!0,hasFocus:r=!1}){return!e||!n()||t.some(e=>e.effects.some(e=>e.is(Nf)))?!1:t.some(e=>e.annotation(Lp)===void 0?r_.some(t=>e.isUserEvent(t))||r:!1)}function a_({predicate:e}){return V.updateListener.of(t=>{i_({docChanged:t.docChanged,transactions:t.transactions,predicate:e,hasFocus:t.view.hasFocus})&&t.view.state.facet(Su).onRun()})}function o_({cellId:e,hotkeys:t,cellActions:n}){let r=Vp(`debugger`),i=Vp(`line_timing`);return[Su.of(n),Cu.of(e),t_({cellId:e,hotkeys:t}),n_(t),e_(Up(DE(e),u)),r?Vg(e,Up(Og(e),u)):[],i?Yg(Up(Dg(e),u)):r?Fg(Up(Eg(e),u)):[]]}var s_=$e.define(),c_=20;function l_(e){let{state:t,anchor:n,head:r}=e;if(r<n)return!1;let i=t.doc.lineAt(r).number,a=t.doc.lineAt(n).number,o=Math.max(a,i-c_+1),s=Math.max(n,t.doc.line(o).from),c=s>n,l=+!!c,u=t.doc.iterRange(s,r);for(;;){let{value:e,done:t}=u.next();if(t)break;for(let t of e)if(t===`(`)l++;else if(t===`)`&&(l--,c?l<=0:l<0))return!1}return!0}function u_(e){return{...e,create:t=>{let{dom:n,...r}=e.create(t),i=document.createElement(`div`);return i.classList.add(`mo-cm-tooltip`),i.append(n),{...r,dom:i}}}}var d_=He.define({create:()=>null,update(e,t){for(let e of t.effects)if(e.is(s_))return e.value;if(!e||t.selection&&!t.docChanged)return null;if(t.docChanged){let n=t.changes.mapPos(e.pos);return l_({state:t.state,anchor:n,head:t.state.selection.main.head})?{...e,pos:n}:null}return e},provide:e=>Ve.from(e)});function f_(e){return e.state.field(d_,!1)?(e.dispatch({effects:s_.of(null)}),!0):!1}var p_=async e=>{let t=e.state.doc.sliceString(0,e.pos),n=document.activeElement,r=null;if(n!==null){let e=mr.findElement(n);e!==null&&(r=mr.parse(e.id))}if(r===null)return T.error(`Failed to find active cell.`),null;let i=await Um.request({document:t,cellId:r});if(!i)return e.view?.dispatch({effects:s_.of(null)}),null;let a=Gm.asHoverTooltip({position:e.pos,message:i,limitToType:`tooltip`});return a&&u.set(Tm,{documentation:a.html??null}),e.view?.dispatch({effects:s_.of(a?u_(a):null)}),a?null:Gm.asCompletionResult(e.pos,i)};function m_(e){return t=>e.predicate(t.state)?e.completion(t):null}var h_=async e=>{let t=e.matchBefore(/:\w*$/);if(!e.explicit&&!t)return null;let n=await g_();return{from:t?.from??e.pos,options:n,validFor:/^[\w:]*$/}},g_=Gt(async()=>{let e=await fetch(`https://unpkg.com/emojilib@3.0.11/dist/emoji-en-US.json`).then(e=>{if(!e.ok)throw Error(`Failed to fetch emoji list`);return e.json()}).catch(()=>({}));return Object.entries(e).map(([e,t])=>({shortcode:t[0],label:t.map(e=>`:${e}`).join(` `),emoji:e,displayLabel:`${e} ${t[0].replaceAll(`_`,` `)}`,apply:e,type:`emoji`}))}),__=async e=>{let t=e.matchBefore(/::[\w-:]*$/);if(!e.explicit&&!t)return null;let n=await v_();return{from:t?.from??e.pos,options:n,validFor:/^[\w-:]*$/}},v_=Gt(async()=>{let e=await fetch(`https://unpkg.com/lucide-static@0.452.0/tags.json`).then(e=>{if(!e.ok)throw Error(`Failed to fetch Lucide icon list`);return e.json()}).catch(()=>({})),t=e=>`https://cdn.jsdelivr.net/npm/lucide-static@0.452.0/icons/${e}.svg`;return Object.entries(e).map(([e,n])=>({label:`::${e}`,displayLabel:e,type:`lucide-icon`,boost:10,apply:`::lucide:${e}::`,detail:n.join(`, `),info:()=>{let n=document.createElement(`img`);return n.src=t(e),n.style.width=`24px`,n.style.height=`24px`,n}}))}),y_=e=>{let t=e.matchBefore(/\\\w*$/);return!e.explicit&&!t?null:{from:t?.from??e.pos,options:b_(),validFor:/^[\w\\]*$/}},b_=Gt(()=>[[`alpha`,`α`,`Greek small letter alpha`],[`beta`,`β`,`Greek small letter beta`],[`gamma`,`γ`,`Greek small letter gamma`],[`delta`,`δ`,`Greek small letter delta`],[`epsilon`,`ε`,`Greek small letter epsilon`],[`zeta`,`ζ`,`Greek small letter zeta`],[`eta`,`η`,`Greek small letter eta`],[`theta`,`θ`,`Greek small letter theta`],[`iota`,`ι`,`Greek small letter iota`],[`kappa`,`κ`,`Greek small letter kappa`],[`lambda`,`λ`,`Greek small letter lambda`],[`mu`,`μ`,`Greek small letter mu`],[`nu`,`ν`,`Greek small letter nu`],[`xi`,`ξ`,`Greek small letter xi`],[`omicron`,`ο`,`Greek small letter omicron`],[`pi`,`π`,`Greek small letter pi`],[`rho`,`ρ`,`Greek small letter rho`],[`sigma`,`σ`,`Greek small letter sigma`],[`tau`,`τ`,`Greek small letter tau`],[`upsilon`,`υ`,`Greek small letter upsilon`],[`phi`,`φ`,`Greek small letter phi`],[`chi`,`χ`,`Greek small letter chi`],[`psi`,`ψ`,`Greek small letter psi`],[`omega`,`ω`,`Greek small letter omega`],[`Gamma`,`Γ`,`Greek capital letter gamma`],[`Delta`,`Δ`,`Greek capital letter delta`],[`Theta`,`Θ`,`Greek capital letter theta`],[`Lambda`,`Λ`,`Greek capital letter lambda`],[`Xi`,`Ξ`,`Greek capital letter xi`],[`Pi`,`Π`,`Greek capital letter pi`],[`Sigma`,`Σ`,`Greek capital letter sigma`],[`Phi`,`Φ`,`Greek capital letter phi`],[`Psi`,`Ψ`,`Greek capital letter psi`],[`Omega`,`Ω`,`Greek capital letter omega`],[`pm`,`±`,`Plus-minus sign`],[`mp`,`∓`,`Minus-plus sign`],[`times`,`×`,`Multiplication sign`],[`div`,`÷`,`Division sign`],[`cdot`,`⋅`,`Dot operator`],[`ast`,`∗`,`Asterisk operator`],[`star`,`⋆`,`Star operator`],[`circ`,`∘`,`Ring operator`],[`bullet`,`•`,`Bullet`],[`cap`,`∩`,`Intersection`],[`cup`,`∪`,`Union`],[`uplus`,`⊎`,`Multiset union`],[`sqcap`,`⊓`,`Square cap`],[`sqcup`,`⊔`,`Square cup`],[`vee`,`∨`,`Logical or`],[`wedge`,`∧`,`Logical and`],[`setminus`,`∖`,`Set minus`],[`oplus`,`⊕`,`Circled plus`],[`ominus`,`⊖`,`Circled minus`],[`otimes`,`⊗`,`Circled times`],[`oslash`,`⊘`,`Circled division slash`],[`odot`,`⊙`,`Circled dot operator`],[`leq`,`≤`,`Less than or equal to`],[`geq`,`≥`,`Greater than or equal to`],[`equiv`,`≡`,`Identical to`],[`prec`,`≺`,`Precedes`],[`succ`,`≻`,`Succeeds`],[`sim`,`∼`,`Tilde operator`],[`perp`,`⊥`,`Up tack`],[`mid`,`∣`,`Divides`],[`parallel`,`∥`,`Parallel to`],[`subset`,`⊂`,`Subset of`],[`supset`,`⊃`,`Superset of`],[`subseteq`,`⊆`,`Subset of or equal to`],[`supseteq`,`⊇`,`Superset of or equal to`],[`cong`,`≅`,`Approximately equal to`],[`approx`,`≈`,`Almost equal to`],[`neq`,`≠`,`Not equal to`],[`ne`,`≠`,`Not equal to`],[`propto`,`∝`,`Proportional to`],[`leftarrow`,`←`,`Leftward arrow`],[`rightarrow`,`→`,`Rightward arrow`],[`Leftarrow`,`⇐`,`Leftward double arrow`],[`Rightarrow`,`⇒`,`Rightward double arrow`],[`leftrightarrow`,`↔`,`Left right arrow`],[`Leftrightarrow`,`⇔`,`Left right double arrow`],[`uparrow`,`↑`,`Upward arrow`],[`downarrow`,`↓`,`Downward arrow`],[`Uparrow`,`⇑`,`Upward double arrow`],[`Downarrow`,`⇓`,`Downward double arrow`],[`infty`,`∞`,`Infinity`],[`nabla`,`∇`,`Nabla`],[`partial`,`∂`,`Partial differential`],[`forall`,`∀`,`For all`],[`exists`,`∃`,`There exists`],[`nexists`,`∄`,`There does not exist`],[`emptyset`,`∅`,`Empty set`],[`in`,`∈`,`Element of`],[`notin`,`∉`,`Not an element of`],[`sum`,`∑`,`N-ary summation`],[`prod`,`∏`,`N-ary product`],[`int`,`∫`,`Integral`],[`oint`,`∮`,`Contour integral`],[`sqrt`,`√`,`Square root`],[`hbar`,`ℏ`,`Planck constant over 2pi`],[`ldots`,`…`,`Horizontal ellipsis`],[`cdots`,`⋯`,`Midline horizontal ellipsis`],[`vdots`,`⋮`,`Vertical ellipsis`],[`ddots`,`⋱`,`Down right diagonal ellipsis`]].map(([e,t,n])=>({label:`\\${e} ${n}`,displayLabel:e,type:`latex-symbol`,boost:10,apply:`\\${e}`,info:()=>{let e=document.createElement(`div`);return e.textContent=`${t} ${n}`,e},detail:t}))),x_=[h_,__,y_],S_=100;function C_(e){return!e.state.selection.main.empty}function w_({view:e,selection:t,markup:n}){let r=[],i=!0;for(let r=t.from;r<=t.to;r++)if(!e.state.doc.lineAt(r).text.startsWith(n)){i=!1;break}for(let a=t.from;a<=t.to;){let t=e.state.doc.lineAt(a),o=t.text.startsWith(n);i?r.push({from:t.from,to:t.from+n.length,insert:Me.of([``])}):(o&&r.push({from:t.from,to:t.from+n.length,insert:Me.of([``])}),r.push({from:t.from,insert:Me.of([n])})),a=t.to+1}return r}function T_({view:e,range:t,markupAfter:n,markupBefore:r}){if(t.empty){let n=e.state.wordAt(t.head);n&&(t=n)}let i=e.state.sliceDoc(t.from-r.length,t.from)===r,a=e.state.sliceDoc(t.to,t.to+n.length)===n,o=[];o.push(i?{from:t.from-r.length,to:t.from,insert:Me.of([``])}:{from:t.from,insert:Me.of(r.split(`
|
|
92
|
-
`))},a?{from:t.to,to:t.to+n.length,insert:Me.of([``])}:{from:t.to,insert:Me.of(n.split(`
|
|
93
|
-
`))});let s=i?-r.length:r.length,c=a?-n.length:n.length;return{changes:o,range:Je.range(t.from+s,t.to+c)}}function E_(e){if(!C_(e))return!1;let t=w_({view:e,selection:e.state.selection.main,markup:`> `});return t.length>0&&e.dispatch(e.state.update({changes:t,scrollIntoView:!0,userEvent:`input`})),e.focus(),!0}function D_(e){if(!C_(e))return!1;let t=e.state.changeByRange(t=>{if(t.empty){let n=e.state.wordAt(t.head);n&&(t=n)}return T_({view:e,range:t,markupBefore:`**`,markupAfter:`**`})});return e.dispatch(e.state.update(t,{scrollIntoView:!0,annotations:at.userEvent.of(`input`)})),e.focus(),!0}function O_(e){if(!C_(e))return!1;let t=e.state.changeByRange(t=>{if(t.empty){let n=e.state.wordAt(t.head);n&&(t=n)}let n=e.state.doc.lineAt(t.from).number!==e.state.doc.lineAt(t.to).number;return T_({view:e,range:t,markupBefore:n?"```\n":"`",markupAfter:n?"\n```":"`"})});return e.dispatch(e.state.update(t,{scrollIntoView:!0,annotations:at.userEvent.of(`input`)})),e.focus(),!0}function k_(e){let t=e.state.changeByRange(t=>{if(t.empty){let n=e.state.wordAt(t.head);n&&(t=n)}return T_({view:e,range:t,markupBefore:`_`,markupAfter:`_`})});return e.dispatch(e.state.update(t,{scrollIntoView:!0,annotations:at.userEvent.of(`input`)})),e.focus(),!0}function A_(e,t=`http://`){if(!C_(e))return!1;let n=e.state.changeByRange(n=>{let r=e.state.sliceDoc(n.from,n.to);return{changes:[{from:n.from,to:n.to,insert:`[${r}](${t})`}],range:n}});e.dispatch(e.state.update(n,{scrollIntoView:!0,annotations:at.userEvent.of(`input`)}));let{to:r}=n.selection.main;try{e.dispatch({selection:Je.create([Je.range(r+3,r+3+t.length),Je.cursor(r+3+t.length)])})}catch{}return e.focus(),!0}async function j_(e,t){let n=new FileReader,r=await new Promise(e=>{n.onload=()=>e(n.result),n.readAsDataURL(t)}),i;try{if(r.startsWith(`data:`)){let e=prompt(`We can save your image as a file. Enter a filename.`,t.name),n=t.type.split(`/`)[1];if(e===null){let e=Math.round(r.length/1024);if(e>S_){Hn({title:`Content too large`,description:`The content size is ${e} KB, which is too large to paste directly into the document.`});return}}else{e.trim()===``?e=t.name:e.endsWith(`.${n}`)||(e=`${e}.${n}`);let r=u.get(ta),a=r?Un.dirname(r):null,o=a?`${a}/public`:`public`,s=await sn().sendCreateFileOrFolder({path:o,type:`file`,name:e,file:t});s.success?(i=s.info?.path,i&&a&&i.startsWith(a)&&(i=Un.rest(i,a).replaceAll(`\\`,`/`)),Hn({title:`Image uploaded successfully`,description:`We've uploaded your image at ${i}`})):Hn({title:`Failed to upload image. Using raw base64 string.`})}}}catch{Hn({title:`Failed to upload image. Using raw base64 string.`})}let a=e.state.changeByRange(t=>{let n=e.state.sliceDoc(t.from,t.to);return n.trim()===``&&(n=`alt`),{changes:[{from:t.from,to:t.to,insert:``}],range:t}});e.dispatch(e.state.update(a,{scrollIntoView:!0,annotations:at.userEvent.of(`input`)}));let{to:o}=a.selection.main;try{e.dispatch({selection:Je.create([Je.range(o+4,o+4+r.length),Je.cursor(o+4+r.length)])})}catch{}return e.focus(),!0}async function M_(e,t){let n=await t.text(),r=e.state.changeByRange(e=>({changes:[{from:e.from,to:e.from,insert:n}],range:e}));return e.dispatch(e.state.update(r,{scrollIntoView:!0,annotations:at.userEvent.of(`input`)})),e.focus(),!0}function N_(e){if(!C_(e))return!1;let{changes:t}=e.state.changeByRange(t=>({range:t,changes:w_({view:e,selection:t,markup:e.state.sliceDoc(t.from,t.to+2).startsWith(`* `)?`* `:`- `})}));return t.length>0&&e.dispatch(e.state.update({changes:t,scrollIntoView:!0,userEvent:`input`})),e.focus(),!0}function P_(e){if(!C_(e))return!1;let{changes:t}=e.state.changeByRange(t=>({range:t,changes:w_({view:e,selection:t,markup:`1. `})}));return t.length>0&&e.dispatch(e.state.update({changes:t,scrollIntoView:!0,userEvent:`input`})),e.focus(),!0}function F_(e){return[ht.highest(Ke.of([{key:e.getHotkey(`markdown.bold`).key,stopPropagation:!0,run:D_},{key:e.getHotkey(`markdown.italic`).key,stopPropagation:!0,run:k_},{key:e.getHotkey(`markdown.link`).key,stopPropagation:!0,run:e=>A_(e)},{key:e.getHotkey(`markdown.orderedList`).key,run:P_},{key:e.getHotkey(`markdown.unorderedList`).key,run:N_},{key:e.getHotkey(`markdown.blockquote`).key,run:E_},{key:e.getHotkey(`markdown.code`).key,run:O_},{key:"`",run:O_}])),V.domEventHandlers({paste:(e,t)=>{if(t.state.selection.main.empty)return!1;let n=e.clipboardData?.getData(`text/plain`);n?.startsWith(`http`)&&(e.preventDefault(),A_(t,n))}}),V.domEventHandlers({paste:(e,t)=>{let n=e.clipboardData?.files[0];if(!n)return!1;if(n.type.startsWith(`image/`))return e.preventDefault(),j_(t,n),!0;if(n.type.startsWith(`text/`))return e.preventDefault(),M_(t,n),!0}})]}function I_(e,t,n=3,r=``){return Object.values(e).flatMap(e=>t.has(e.name)?[]:{label:`${r}${e.name}`,displayLabel:e.name,detail:e.dataType??``,boost:n,type:`variable`,apply:`${r}${e.name}`,section:`Variable`,info:()=>L_(e)})}function L_(e){let t=document.createElement(`div`);t.classList.add(`mo-cm-tooltip`,`docs-documentation`,`min-w-[200px]`,`flex`,`flex-col`,`gap-1`,`p-2`);let n=document.createElement(`div`);n.classList.add(`flex`,`items-center`,`gap-2`);let r=document.createElement(`span`);if(r.classList.add(`font-bold`,`text-base`),r.textContent=e.name,n.append(r),e.dataType){let t=document.createElement(`span`);t.classList.add(`text-xs`,`px-1.5`,`py-0.5`,`rounded-full`,`bg-purple-100`,`text-purple-800`,`dark:bg-purple-900`,`dark:text-purple-200`),t.textContent=e.dataType,n.append(t)}if(t.append(n),e.value){let n=document.createElement(`div`);n.classList.add(`flex`,`flex-col`,`gap-1`);let r=document.createElement(`div`);r.classList.add(`text-xs`,`text-muted-foreground`),r.textContent=`Value:`,n.append(r);let i=document.createElement(`div`);i.classList.add(`text-xs`,`font-mono`,`bg-muted`,`p-2`,`rounded`,`overflow-auto`,`max-h-40`),i.textContent=e.value,n.append(i),t.append(n)}return t}var R_=`Python`,z_=123,B_=125,V_=1,H_={mark:`${R_}Mark`,resolve:R_};function U_(e,t){return{defineNodes:[{name:R_,style:Ze.emphasis},{name:`${R_}Mark`,style:Ze.processingInstruction}],parseInline:[{name:R_,parse(e,n,r){return!t()||n!==z_&&n!==B_||n===z_&&e.slice(r-1,r)===`{`?-1:e.addDelimiter(H_,r,r+V_,n===z_,n===B_)}}],wrap:st(n=>{if(!t()||n.type.name!==R_)return null;let r=n.from+V_,i=n.to-V_;return r>=i||r<0||i<0?null:{parser:e,overlay:[{from:r,to:i}],extensions:[zn().support]}})}}var W_=e=>{let t=e.state.doc.sliceString(0,e.pos),n=t.lastIndexOf(`{`);if(t.at(n-1)===`{`||n===-1||t.indexOf(`}`,n)>n)return null;let r=e.matchBefore(/\w*$/);if(!r)return null;let i=I_(u.get(em),new Set,99);return{from:r.from,options:i,validFor:/^\w*$/}},G_=`InlineMathDollar`,K_=`InlineMathBracket`,q_=`BlockMathDollar`,J_=`BlockMathBracket`,Y_={[G_]:1,[K_]:3,[q_]:2,[J_]:3},X_={DOLLAR:36,BACKSLASH:92,OPEN_PAREN:40,CLOSE_PAREN:41,OPEN_BRACKET:91,CLOSE_BRACKET:93},Z_=Object.keys(Y_).reduce((e,t)=>(e[t]={mark:`${t}Mark`,resolve:t},e),{});function Q_(e){let t=[];return Object.keys(Y_).forEach(e=>{t.push({name:e,style:Ze.emphasis},{name:`${e}Mark`,style:Ze.processingInstruction})}),{defineNodes:t,parseInline:[{name:q_,parse(e,t,n){return t!==X_.DOLLAR||e.char(n+1)!==X_.DOLLAR?-1:e.addDelimiter(Z_[q_],n,n+Y_[q_],!0,!0)}},{name:G_,parse(e,t,n){return t!==X_.DOLLAR||e.char(n+1)===X_.DOLLAR?-1:e.addDelimiter(Z_[G_],n,n+Y_[G_],!0,!0)}},{name:K_,before:`Escape`,parse(e,t,n){return t!==X_.BACKSLASH||e.char(n+1)!==X_.BACKSLASH||![X_.OPEN_PAREN,X_.CLOSE_PAREN].includes(e.char(n+2))?-1:e.addDelimiter(Z_[K_],n,n+Y_[K_],e.char(n+2)===X_.OPEN_PAREN,e.char(n+2)===X_.CLOSE_PAREN)}},{name:J_,before:`Escape`,parse(e,t,n){return t!==X_.BACKSLASH||e.char(n+1)!==X_.BACKSLASH||![X_.OPEN_BRACKET,X_.CLOSE_BRACKET].includes(e.char(n+2))?-1:e.addDelimiter(Z_[J_],n,n+Y_[J_],e.char(n+2)===X_.OPEN_BRACKET,e.char(n+2)===X_.CLOSE_BRACKET)}},{name:K_,before:`Escape`,parse(e,t,n){return t!==X_.BACKSLASH||![X_.OPEN_PAREN,X_.CLOSE_PAREN].includes(e.char(n+1))?-1:e.addDelimiter(Z_[K_],n,n+2,e.char(n+1)===X_.OPEN_PAREN,e.char(n+1)===X_.CLOSE_PAREN)}},{name:J_,before:`Escape`,parse(e,t,n){return t!==X_.BACKSLASH||![X_.OPEN_BRACKET,X_.CLOSE_BRACKET].includes(e.char(n+1))?-1:e.addDelimiter(Z_[J_],n,n+2,e.char(n+1)===X_.OPEN_BRACKET,e.char(n+1)===X_.CLOSE_BRACKET)}}],wrap:st(t=>{let n=Y_[t.type.name];if(n){let r=t.from+n,i=t.to-n;return r>=i||r<0||i<0?null:{parser:e,overlay:[{from:r,to:i}]}}return null})}}var $_=$e.define(),ev=$e.define(),tv=He.define({create:()=>({}),update:(e,t)=>{for(let n of t.effects){if(n.is($_))return n.value;if(n.is(ev))return{...e,...n.value}}return e}}),nv=class{parser=new xp;type=`markdown`;defaultCode=this.parser.defaultCode;defaultMetadata=this.parser.defaultMetadata;static fromMarkdown(e){return xp.fromMarkdown(e)}transformIn(e){let t=this.parser.transformIn(e);return[t.code,t.offset,t.metadata]}transformOut(e,t){let n=this.parser.transformOut(e,t);return[n.code,n.offset]}isSupported(e){return this.parser.isSupported(e)}getExtension(e,t,n,r){let i=Pn().language.data,a,o=()=>{if(!a)return!0;let e=a?.state.field(tv);return e===void 0?!1:e.quotePrefix?.includes(`f`)??!1};return[_t.define(e=>(a=e,{})),Pn({base:Fn,codeLanguages:Bf,extensions:[Q_(ot.define(Vn).parser),U_(Ln.parser,o)]}),F_(n),x_.map(e=>i.of({autocomplete:e})),zn().language.data.of({autocomplete:m_({completion:p_,predicate:o})}),en({defaultKeymap:!1,activateOnTyping:!0}),a_({predicate:()=>!o()})]}},rv={PREFIX:`file:///`,of(e){return`${this.PREFIX}${e}`},is(e){return e.startsWith(this.PREFIX)},parse(e){return O(this.is(e),`Invalid cell document URI: ${e}`),e.slice(this.PREFIX.length)}};function iv(e){return`notify`in e&&typeof e.notify==`function`}function av(e){return`processNotification`in e&&typeof e.processNotification==`function`}function ov(e){return rv.is(e)?u.get(VT).inOrderIds.includes(rv.parse(e)):!1}function sv(){return u.get(ra)?.rootUri??`file:///`}function cv(){let e=u.get(ra)?.rootUri;return e?[{uri:e,name:`marimo`}]:[]}function lv(){return u.get(ra)?.documentUri??`file:///__marimo_notebook__.py`}function uv(e){return D.filter(e,e=>e!==!1&&e!==null)}function dv(e){let t=e.map(uv);return Object.assign({},...t)}var fv=class{clients=[];documentUri;constructor(e){this.clients=e,this.documentUri=lv()}onNotification(e){let t=[];for(let n of this.clients)t.push(n.onNotification(e));return()=>{for(let e of t)e();return!0}}get clientCapabilities(){return dv(this.clients.map(e=>{if(e.clientCapabilities)return typeof e.clientCapabilities==`function`?e.clientCapabilities({}):e.clientCapabilities}).filter(e=>e!=null))}get ready(){return this.clients.some(e=>e.ready)}set ready(e){this.clients.forEach(t=>{t.ready=e})}get capabilities(){return dv(this.clients.map(e=>e.capabilities).filter(e=>e!==null))}set capabilities(e){this.clients.forEach(t=>{t.capabilities=e})}get initializePromise(){return this.clients[0].initializePromise}set initializePromise(e){this.clients.forEach(t=>{t.initializePromise=e})}firstWithMethod(e){return this.clients.find(t=>t.hasCapability(e))}clientsWithMethod(e){return this.clients.filter(t=>t.hasCapability(e))}hasCapability(e){return this.clients.some(t=>t.hasCapability(e))}async initialize(){await Promise.all(this.clients.map(e=>e.initialize()))}async close(){await Promise.all(this.clients.map(e=>e.close()))}async textDocumentDidChange(e){await Promise.all(this.clients.map(t=>t.textDocumentDidChange(e)))}async completionItemResolve(e){let t=this.firstWithMethod(`textDocument/completion`);return t?t.completionItemResolve(e):e}async textDocumentCodeAction(e){let t=this.firstWithMethod(`textDocument/codeAction`);return t?t.textDocumentCodeAction(e):null}async codeActionResolve(e){let t=this.firstWithMethod(`textDocument/codeAction`);return t?t.codeActionResolve(e):e}async textDocumentRename(e){let t=this.firstWithMethod(`textDocument/rename`);return t?t.textDocumentRename(e):null}async textDocumentPrepareRename(e){let t=this.firstWithMethod(`textDocument/prepareRename`);return t?t.textDocumentPrepareRename(e):null}async textDocumentSignatureHelp(e){let t=this.firstWithMethod(`textDocument/signatureHelp`);return t?t.textDocumentSignatureHelp(e):null}async textDocumentCompletion(e){let t=this.clientsWithMethod(`textDocument/completion`);return pv(await Promise.allSettled(t.map(t=>t.textDocumentCompletion(e))))}async textDocumentDefinition(e){let t=this.firstWithMethod(`textDocument/definition`);return t?t.textDocumentDefinition(e):null}async textDocumentDidOpen(e){return(await Promise.all(this.clients.map(t=>t.textDocumentDidOpen(e)))).some(e=>e!==!1)}async textDocumentDidClose(e){await Promise.all(this.clients.map(t=>t.textDocumentDidClose(e)))}async textDocumentWillSave(e){await Promise.all(this.clients.map(t=>t.textDocumentWillSave(e)))}async textDocumentWillSaveWaitUntil(e){let t=await Promise.allSettled(this.clients.map(t=>t.textDocumentWillSaveWaitUntil(e)));for(let e of t)if(e.status===`fulfilled`&&e.value?.length)return e.value;return null}async textDocumentDidSave(e){await Promise.all(this.clients.map(t=>t.textDocumentDidSave(e)))}async textDocumentHover(e){for(let t of this.clients){if(!t.hasCapability(`textDocument/hover`))continue;let n=await t.textDocumentHover(e);if(n)return n}return{contents:[]}}};function pv(e){let t=[],n=!1;for(let r of e)if(r.status===`fulfilled`){let e=r.value;if(e==null)continue;Array.isArray(e)&&t.push(...e),`items`in e&&(t.push(...e.items),n||=e.isIncomplete)}return{items:t,isIncomplete:n}}function mv(e){let t=In.parse(e),n=``;return mt(e,t,Re,(e,t)=>{let r=e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`);n+=t?`<span class="${t}">${r}</span>`:r},()=>{n+=`
|
|
94
|
-
`}),n}function hv(){let e=new tn.Renderer,t=e.code.bind(e);return e.code=e=>{let{text:n,lang:r}=e;return n.trim()?r===`python`||r===`py`?`<pre><code class="language-python">${mv(n)}</code></pre>\n`:t(e):``},t=>tn(t,{async:!1,gfm:!0,breaks:!0,renderer:e})}function gv(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _v(e,t){return typeof e[t]==`function`}function vv(e){return[...yv(e),e].join(`
|
|
95
|
-
`)}function yv(e){return CE().map(t=>{let n=UC(t);return n===e?null:n}).filter(Boolean).toSorted((e,t)=>e.startsWith(`import`)&&!t.startsWith(`import`)?-1:!e.startsWith(`import`)&&t.startsWith(`import`)?1:0)}var bv=o(e=>{let t=e(FT);return D.fromEntries(t.cellIds.inOrderIds.map(e=>{let n=t.cellHandles[e];return[e,n?.current?.editorView?UC(n.current.editorView):``]}))}),xv=o(e=>e(FT).cellIds.inOrderIds),Sv=o(e=>wv(e(xv),e(em))),Cv=o(e=>({cellIds:e(Sv),codes:e(bv)}));function wv(e,t){let n=new Map;e.forEach(e=>n.set(e,[]));let r=new Set(e),i=new Set(e);for(let{declaredBy:e,usedBy:a}of Object.values(t))for(let t of e){r.delete(t);for(let e of a)i.delete(e),e!==t&&n.get(t)?.push(e)}let a=new Map;e.forEach(e=>a.set(e,0)),n.forEach(e=>{e.forEach(e=>{a.set(e,(a.get(e)||0)+1)})});let o=[];a.forEach((e,t)=>{e===0&&o.push(t)});let s=[];for(;o.length>0;){let e=o.shift();if(!e)break;s.push(e),n.get(e)?.forEach(e=>{a.set(e,(a.get(e)||0)-1),a.get(e)===0&&o.push(e)})}return[...s.filter(e=>!r.has(e)),...r]}function Tv(e,t){let n=new Map,r=0;e.forEach(e=>{n.set(e,r),r+=t[e].split(`
|
|
96
|
-
`).length});function i(e){return n.has(e)||T.warn(`[lsp] no cell line offsets for`,e),n.get(e)??0}let a=e.map(e=>t[e]).join(`
|
|
97
|
-
`);return{cellIds:e,mergedText:a,transformRange:(e,t)=>Ev(e,i(t)),reverseRange:(e,t)=>Ev(e,-i(t)),isInRange:(e,r)=>{let i=t[r].split(`
|
|
98
|
-
`).length,a=n.get(r)||0,o=e.start.line-a,s=e.end.line-a,c=o>=0&&o<i,l=s>=0&&s<i;return c&&!l&&T.warn(`[lsp] Cross-cell diagnostic detected: range starts in cell but ends outside`,{cellId:r,range:e,cellLines:i,offset:a}),c&&l},getEditsForNewText:e=>{let r=e.split(`
|
|
99
|
-
`),i=a.split(`
|
|
100
|
-
`);if(r.length!==i.length)throw T.warn(`[lsp] cannot apply rename with new lines`,r,i),Error(`Cannot apply rename when there are new lines`);let o=[];for(let[e,i]of D.entries(t)){if(!n.has(e))continue;let t=n.get(e)??0,a=i.split(`
|
|
101
|
-
`).length,s=r.slice(t,t+a);o.push({cellId:e,text:s.join(`
|
|
102
|
-
`)})}return o},transformPosition:(e,t)=>Dv(e,i(t)),reversePosition:(e,t)=>Dv(e,-i(t))}}function Ev(e,t){return{start:Dv(e.start,t),end:Dv(e.end,t)}}function Dv(e,t){return{line:e.line+t,character:e.character}}var Ov=/(?<!`):math:`([^\n`]+)`/g,kv=/:math:\s*<code>(.+?)<\/code>/gs,Av=/(?<!\S)\\\[(.+?)\\]/gs,jv=/\\\((.+?)\\\)/gs,Mv=/(?<!\\)\$\$(.+?)(?<!\\)\$\$/gs,Nv=/(?<![$\\])\$(?!\$)([^\n$]+?)(?<!\\)\$(?!\$)/g;function Pv(e){return Rv(e)?zv(e).map(e=>e.isFenced?e.text:Bv(e.text.replaceAll(Ov,(e,t)=>Wv(t)).replaceAll(kv,(e,t)=>Wv(t))).map(e=>e.isInlineCode?e.text:Vv(e.text)).join(``)).join(`
|
|
103
|
-
`):e}function Fv(e){return e==null?e:Array.isArray(e)?e.map(e=>Iv(e)):typeof e==`string`?Pv(e):Lv(e)?e.kind===`markdown`?{...e,value:Pv(e.value)}:Rv(e.value)?{kind:`markdown`,value:Pv(e.value)}:e:Iv(e)}function Iv(e){return typeof e==`string`?Pv(e):e.language!==`markdown`&&e.language!==`md`?e:{...e,value:Pv(e.value)}}function Lv(e){return typeof e==`object`&&`kind`in e&&`value`in e}function Rv(e){return e.includes(`.. math::`)||e.includes(":math:`")||/(?<!\S)\\\[[\S\s]+?\\]/.test(e)||/\\\([\S\s]+?\\\)/.test(e)||/(?<!\\)\$\$[\S\s]+?(?<!\\)\$\$/.test(e)||/(?<![$\\])\$(?!\$)[^\n$]+?(?<!\\)\$(?!\$)/.test(e)||/:math:\s*<code>[\S\s]+?<\/code>/.test(e)}function zv(e){let t=e.split(`
|
|
104
|
-
`),n=[],r=[],i=!1,a=``,o=0,s=e=>{r.length!==0&&(n.push({text:r.join(`
|
|
105
|
-
`),isFenced:e}),r=[])};for(let e of t){let t=e.match(/^[\t ]*(`{3,}|~{3,})/);if(t){let n=t[1],c=n[0],l=n.length;if(!i){s(!1),i=!0,a=c,o=l,r.push(e);continue}if(c===a&&l>=o){r.push(e),s(!0),i=!1,a=``,o=0;continue}}r.push(e)}return s(i),n}function Bv(e){let t=[],n=``,r=!1,i=``,a=0;for(;a<e.length;){if(e[a]==="`"){let o=a;for(;o<e.length&&e[o]==="`";)o+=1;let s=e.slice(a,o);if(r&&s===i){n+=s,t.push({text:n,isInlineCode:!0}),n=``,r=!1,i=``,a=o;continue}if(!r){n&&=(t.push({text:n,isInlineCode:!1}),``),r=!0,i=s,n+=s,a=o;continue}}n+=e[a],a+=1}return n&&t.push({text:n,isInlineCode:r}),t}function Vv(e){let t=Uv(e);return t=t.replaceAll(Av,(e,t)=>Gv(t)),t=t.replaceAll(jv,(e,t)=>Wv(t)),t=t.replaceAll(Mv,(e,t)=>Gv(t)),t=t.replaceAll(Nv,(e,t)=>Wv(t)),t}function Hv(e){return e.match(/^[\t ]*/)?.[0].replaceAll(` `,` `).length??0}function Uv(e){let t=e.split(`
|
|
106
|
-
`);if(t.length===0)return e;let n=[],r=0;for(;r<t.length;){let e=t[r],i=e.match(/^[\t ]*\.\.\s+math::(.*)$/);if(!i){n.push(e),r+=1;continue}let a=i[1]?.trim()??``,o=Hv(e);r+=1;let s=[],c=a.includes(`\\begin`);if(a)s.push(a);else{for(;r<t.length;){let e=t[r];if(!e.trim()){r+=1;continue}if(!(Hv(e)>o&&e.trim().startsWith(`:`)))break;r+=1}if(r<t.length){let e=t[r];c=!!e.trim()&&Hv(e)<=o&&e.trimStart().startsWith(`\\`)}}if(c)for(;r<t.length&&t[r].trim();)s.push(t[r]),r+=1;else for(;r<t.length;){let e=t[r];if(!e.trim()){s.push(``),r+=1;continue}if(Hv(e)<=o)break;s.push(e),r+=1}let l=s.filter(e=>!!e.trim());if(l.length===0){n.push(e);continue}let u=Math.min(...l.map(e=>Hv(e))),d=s.map(e=>{if(!e)return``;let t=Math.min(u,Hv(e));return e.slice(t)}).join(`
|
|
107
|
-
`).trim();n.push(Gv(d))}return n.join(`
|
|
108
|
-
`)}function Wv(e){return`<marimo-tex class="arithmatex">||(${e.trim()}||)</marimo-tex>`}function Gv(e){return`<marimo-tex class="arithmatex">||[${e.trim()}||]</marimo-tex>`}function Kv(e){return e.startsWith(`_`)&&!e.startsWith(`__`)}var qv=class{documentVersion=0;getNotebookCode;constructor(e){this.getNotebookCode=e}lastSnapshot=null;snapshot(){let e=this.getLens(),t=this.lastSnapshot?.mergedText!==e.mergedText;return t?(this.documentVersion++,this.lastSnapshot=e,{lens:e,didChange:t,version:this.documentVersion}):{lens:e,didChange:t,version:this.documentVersion}}getLatestSnapshot(){if(!this.lastSnapshot)throw Error(`No snapshots`);return{lens:this.lastSnapshot,version:this.documentVersion}}getLens(){let{cellIds:e,codes:t}=this.getNotebookCode();return Tv(e,t)}},Jv=()=>{let e=iE().cellHandles;return D.mapValues(e,e=>e.current?.editorViewOrNull)};function Yv(e){let t=Fv(e);return Array.isArray(t)?e:t}function Xv(e){return{...e,documentation:Yv(e.documentation)}}function Zv(e){return e==null?null:Array.isArray(e)?e.map(e=>Xv(e)):{...e,items:e.items.map(e=>Xv(e))}}function Qv(e){return{...e,signatures:e.signatures.map(e=>({...e,documentation:Yv(e.documentation),parameters:e.parameters?.map(e=>({...e,documentation:Yv(e.documentation)}))}))}}function $v(e){return gv(e)&&typeof e.line==`number`&&typeof e.character==`number`}function ey(e){return gv(e)&&$v(e.start)&&$v(e.end)}function ty(e){return gv(e)&&typeof e.message==`string`&&ey(e.range)}function ny(e){if(e.method!==`textDocument/publishDiagnostics`||!gv(e.params))return!1;let{uri:t,version:n,diagnostics:r}=e.params;return typeof t==`string`&&(n===void 0||typeof n==`number`)&&Array.isArray(r)&&r.every(ty)}var ry=class{documentUri;client;snapshotter;getNotebookEditors;initialSettings;seenCellDocumentUris=new Set;pruneSeenCellUris(e){for(let t of this.seenCellDocumentUris){let n=rv.parse(t);e.has(n)||this.seenCellDocumentUris.delete(t)}}completionItemCache=new hd(10);openCellDocumentCounts=new Map;latestDiagnosticsVersion=null;forwardedDiagnosticsVersion=0;constructor(e,t,n=Jv){this.documentUri=lv(),this.getNotebookEditors=n,this.initialSettings=t,this.client=e,this.patchProcessNotification(),this.initializePromise.then(()=>{O(iv(this.client),`notify is not a method on the client`),this.client.notify(`workspace/didChangeConfiguration`,{settings:t})}),this.snapshotter=new qv(this.getNotebookCode.bind(this))}onNotification(e){return this.client.onNotification(e)}get ready(){return this.client.ready}set ready(e){this.client.ready=e}get capabilities(){return this.client.capabilities}set capabilities(e){this.client.capabilities=e}get initializePromise(){return this.client.initializePromise}set initializePromise(e){this.client.initializePromise=e}get clientCapabilities(){return this.client.clientCapabilities}async initialize(){await this.client.initialize()}close(){this.openCellDocumentCounts.clear(),this.client.close()}hasCapability(e){return this.client.hasCapability(e)}async resyncAllDocuments(){O(iv(this.client),`notify is not a method on the client`),await this.client.initialize(),await this.client.notify(`workspace/didChangeConfiguration`,{settings:this.initialSettings});let{lens:e,version:t}=this.snapshotter.snapshot();this.latestDiagnosticsVersion=null,this.forwardedDiagnosticsVersion=0,this.openCellDocumentCounts.size>0&&await this.client.notify(`textDocument/didOpen`,{textDocument:{languageId:`python`,text:e.mergedText,uri:this.documentUri,version:t}}),T.log(`[lsp] Document re-synchronization complete`)}getNotebookCode(){return u.get(Cv)}assertCellDocumentUri(e){O(rv.is(e),`Execpted URI to be CellDocumentUri`)}async textDocumentDidOpen(e){T.debug(`[lsp] textDocumentDidOpen`,e);let t=e.textDocument.uri;this.assertCellDocumentUri(t);let{lens:n,version:r}=this.snapshotter.snapshot(),i=this.openCellDocumentCounts.get(t)??0;this.openCellDocumentCounts.set(t,i+1);try{let i=await this.client.textDocumentDidOpen({textDocument:{languageId:e.textDocument.languageId,text:n.mergedText,uri:this.documentUri,version:r}});return this.seenCellDocumentUris.add(t),i!==!1}catch(e){let n=this.openCellDocumentCounts.get(t)??0;throw n<=1?this.openCellDocumentCounts.delete(t):this.openCellDocumentCounts.set(t,n-1),e}}async textDocumentDidClose(e){let t=e.textDocument.uri;this.assertCellDocumentUri(t);let n=this.openCellDocumentCounts.get(t)??0;if(n===0){T.warn(`[lsp] textDocumentDidClose with no tracked open`,t);return}n<=1?this.openCellDocumentCounts.delete(t):this.openCellDocumentCounts.set(t,n-1),await this.client.textDocumentDidClose({textDocument:{uri:this.documentUri}})}async sync(){let{lens:e,version:t,didChange:n}=this.snapshotter.snapshot(),r={textDocument:{uri:this.documentUri,version:t},contentChanges:[{text:e.mergedText}]};return n&&await this.client.textDocumentDidChange(r),{params:r,lens:e}}async textDocumentDidChange(e){if(T.debug(`[lsp] textDocumentDidChange`,e),e.contentChanges.length===1){await this.sync();return}T.warn(`[lsp] Unhandled textDocumentDidChange`,e),await this.client.textDocumentDidChange(e)}async textDocumentWillSave(e){this.assertCellDocumentUri(e.textDocument.uri),await this.client.textDocumentWillSave({...e,textDocument:{uri:this.documentUri}})}async textDocumentWillSaveWaitUntil(e){return this.assertCellDocumentUri(e.textDocument.uri),T.debug(`[lsp] willSaveWaitUntil edits are disabled for notebook documents`),null}async textDocumentDidSave(e){this.assertCellDocumentUri(e.textDocument.uri);let{lens:t}=this.snapshotter.snapshot();await this.client.textDocumentDidSave({textDocument:{uri:this.documentUri},text:e.text===void 0?void 0:t.mergedText})}async textDocumentDefinition(e){let t=e.textDocument.uri;if(!rv.is(t))return T.warn(`Invalid cell document URI`,t),null;let{lens:n}=await this.sync(),r=rv.parse(t);return this.client.textDocumentDefinition({...e,textDocument:{uri:this.documentUri},position:n.transformPosition(e.position,r)})}async textDocumentSignatureHelp(e){let t=e.textDocument.uri;if(!rv.is(t))return T.warn(`Invalid cell document URI`,t),null;let{lens:n}=await this.sync(),r=rv.parse(t),i=await this.client.textDocumentSignatureHelp({...e,textDocument:{uri:this.documentUri},position:n.transformPosition(e.position,r)});return i?Qv(i):null}textDocumentCodeAction(e){return Promise.resolve(null)}codeActionResolve(e){return Promise.resolve(e)}reverseRelatedInformation(e,t){if(e)return e.map(e=>{if(!gv(e)||!gv(e.location)||e.location.uri!==this.documentUri||!ey(e.location.range))return e;let n=t.cellIds.find(n=>t.isInRange(e.location.range,n));return n===void 0?e:{...e,location:{uri:rv.of(n),range:t.reverseRange(e.location.range,n)}}})}async textDocumentRename(e){let t=e.textDocument.uri;if(!rv.is(t))return T.warn(`Invalid cell document URI`,t),null;let n=rv.parse(t),{lens:r}=await this.sync(),i=r.transformPosition(e.position,n),a=await this.client.textDocumentRename({...e,textDocument:{uri:this.documentUri},position:i});if(!a)return null;let o=a.documentChanges?.flatMap(e=>`edits`in e?e.edits:[]);if(!o||o.length!==1)return T.warn(`Expected exactly one edit`,o),a;let s=o[0];if(!(`newText`in s))return T.warn(`Expected newText in edit`,s),a;let c=r.getEditsForNewText(s.newText),l=new Map(c.map(e=>[e.cellId,e.text])),u=this.getNotebookEditors(),d=u[n],f=!1;if(d){let t=d.state.doc.line(e.position.line+1).from+e.position.character,{startToken:n,endToken:r}=Ym(d.state.doc,t),i=d.state.doc.sliceString(n,r);f=Kv(i),f&&T.debug(`[lsp] Private variable rename detected, limiting to current cell`,i)}let p=[],m=0;for(let[e,t]of D.entries(u)){if(f&&e!==n)continue;let r=l.get(e);if(r==null){T.warn(`[lsp] No new code for cell during rename`,e),p.push(e);continue}if(!t){T.warn(`[lsp] No editor view for cell during rename`,e),p.push(e);continue}UC(t)!==r&&(WC(t,r),m++)}return p.length>0&&T.error(`[lsp] Rename partially failed: could not update ${p.length} cell(s)`,p),T.debug(`[lsp] Rename completed: updated ${m} cell(s)`),{...a,documentChanges:[{edits:[],textDocument:{uri:t,version:0}}]}}async completionItemResolve(e){let t=JSON.stringify(e),n=this.completionItemCache.get(t);if(n)return n;let r=this.client.completionItemResolve(e).then(e=>Xv(e));return this.completionItemCache.set(t,r),r}async textDocumentPrepareRename(e){let t=e.textDocument.uri;if(!rv.is(t))return T.warn(`Invalid cell document URI`,t),null;let{lens:n}=await this.sync(),r=rv.parse(t);return this.client.textDocumentPrepareRename({...e,textDocument:{uri:this.documentUri},position:n.transformPosition(e.position,r)})}async textDocumentHover(e){T.debug(`[lsp] textDocumentHover`,e);let{lens:t}=await this.sync(),n=rv.parse(e.textDocument.uri),r=await this.client.textDocumentHover({...e,textDocument:{uri:this.documentUri},position:t.transformPosition(e.position,n)});return r?(typeof r.contents==`object`&&`kind`in r.contents&&(r.contents={kind:`markdown`,value:r.contents.value}),r.contents=Fv(r.contents)??r.contents,r.contents===``?null:(r.range&&=t.reverseRange(r.range,n),r)):(T.debug(`[lsp] no hover result`),r)}async textDocumentCompletion(e){let{lens:t}=this.snapshotter.getLatestSnapshot();if(!rv.is(e.textDocument.uri))return T.error(`[lsp] Invalid cell document URI in completion request`,e.textDocument.uri),null;let n=rv.parse(e.textDocument.uri);if(!n||n===`undefined`)return T.error(`[lsp] Invalid cellId 'undefined' in completion request`,{cellId:n,uri:e.textDocument.uri,availableCellIds:t.cellIds}),null;t.cellIds.includes(n)||T.warn(`[lsp] CellId in completion request not found in current lens`,{cellId:n,uri:e.textDocument.uri,availableCellIds:t.cellIds});let r=t.transformPosition(e.position,n);return Zv(await this.client.textDocumentCompletion({...e,textDocument:{uri:this.documentUri},position:r}))}patchProcessNotification(){O(av(this.client),`processNotification is not a method on the client`);let e=this.client.processNotification.bind(this.client),t=t=>{if(ny(t)){let n=t.params.version;if(n!=null){let e=this.latestDiagnosticsVersion;if(e!==null&&Number.isFinite(n)&&n<e){T.debug(`[lsp] dropping stale diagnostics notification`,t);return}this.latestDiagnosticsVersion=n}T.debug(`[lsp] handling diagnostics`,t);let r=this.snapshotter.getLatestSnapshot(),i=t.params.diagnostics,{lens:a}=r,o=++this.forwardedDiagnosticsVersion,s=new Map;for(let e of i)for(let t of a.cellIds)if(a.isInRange(e.range,t)){s.has(t)||s.set(t,[]);let n=this.reverseRelatedInformation(e.relatedInformation,a),r={...e,range:a.reverseRange(e.range,t),...n?{relatedInformation:n}:{}};s.get(t)?.push(r);break}let c=new Set(a.cellIds);this.pruneSeenCellUris(c);let l=new Set(this.seenCellDocumentUris);for(let[n,r]of s.entries()){T.debug(`[lsp] diagnostics for cell`,n,r);let i=rv.of(n);l.delete(i),e({...t,params:{...t.params,uri:i,version:o,diagnostics:r}})}if(l.size>0){T.debug(`[lsp] clearing diagnostics`,l);for(let t of l)e({method:`textDocument/publishDiagnostics`,params:{uri:t,version:o,diagnostics:[]}})}return}return e(t)};this.client.processNotification=t}},iy=1e3,ay=new Set([`textDocument/didOpen`,`textDocument/didChange`,`textDocument/didClose`]),oy=new Set([`initialize`,`initialized`,`workspace/didChangeConfiguration`,`textDocument/didOpen`]),sy=class{delegate;connectionPromise;isDelegateConnected=!1;connectionGeneration=0;restoringGeneration;isClosed=!1;hasConnectedBefore=!1;messageHandlers=new Set;pendingMessages=[];inFlightBacklog;hasLoggedQueueOverflow=!1;disposeDelegateMessage;disposeDelegateClose;options;onReconnect;constructor(e){this.options={...e,retries:e.retries??1,retryDelayMs:e.retryDelayMs??1e3},this.onReconnect=e.onReconnect}async connect(){if(this.isClosed)throw Error(`Transport is closed`);if(this.isDelegateConnected)return;if(this.connectionPromise)return this.connectionPromise;let e=++this.connectionGeneration,t=this.connectWithRetries(e).finally(()=>{this.connectionPromise===t&&(this.connectionPromise=void 0)});return this.connectionPromise=t,t}isStale(e){return this.isClosed||e!==this.connectionGeneration}send(e){if(!this.isClosed){if(this.delegate&&this.isDelegateConnected&&(this.restoringGeneration===void 0||this.canSendWhileRestoring(e))){this.delegate.send(e);return}this.pendingMessages.length<iy?this.pendingMessages.push(e):this.hasLoggedQueueOverflow||(this.hasLoggedQueueOverflow=!0,T.error(`LSP reconnect queue is full (${iy}); dropping messages until it drains`)),this.reconnect()}}onMessage(e){return this.messageHandlers.add(e),()=>{this.messageHandlers.delete(e)}}close(){this.isClosed||(this.isClosed=!0,this.isDelegateConnected=!1,this.restoringGeneration=void 0,this.connectionGeneration++,this.connectionPromise=void 0,this.pendingMessages=[],this.inFlightBacklog=void 0,this.messageHandlers.clear(),this.disposeDelegate(),this.delegate?.close(),this.delegate=void 0)}async connectWithRetries(e){let t;for(let n=1;n<=this.options.retries;n++)try{await this.connectDelegate(e);return}catch(r){if(t=r instanceof Error?r:Error(String(r)),this.isStale(e))throw t;this.invalidateDelegate(),T.warn(`WebSocket connection attempt ${n}/${this.options.retries} failed`,t),n<this.options.retries&&await new Promise(e=>setTimeout(e,this.options.retryDelayMs))}let n=t??Error(`WebSocket connection failed`);throw this.options.onConnectionFailure?.(n),n}async connectDelegate(e){if(await this.options.waitForConnection?.(),this.isStale(e))throw Error(`Connection attempt abandoned`);let t=this.createDelegate();if(await t.connect(),this.isStale(e)||this.delegate!==t)throw t.close(),Error(`Transport closed while connecting`);this.isDelegateConnected=!0;let n=this.hasConnectedBefore;this.hasConnectedBefore=!0;let r=this.detachPendingMessages();this.inFlightBacklog=r;try{if(n){this.restoringGeneration=e;try{await this.onReconnect?.()}finally{this.restoringGeneration===e&&(this.restoringGeneration=void 0)}}if(this.isStale(e)||this.delegate!==t||!this.isDelegateConnected)throw Error(`WebSocket closed while restoring LSP state`)}catch(t){throw this.isStale(e)||this.reclaimInFlightBacklog(),t}let i=n&&this.onReconnect?r.filter(e=>!(`method`in e&&ay.has(e.method))):r;this.inFlightBacklog=void 0;for(let e of[...i,...this.detachPendingMessages()])t.send(e);T.log(`WebSocket transport connected successfully`)}detachPendingMessages(){let e=this.pendingMessages;return this.pendingMessages=[],this.hasLoggedQueueOverflow=!1,e}reclaimInFlightBacklog(){this.inFlightBacklog&&=(this.pendingMessages=[...this.inFlightBacklog,...this.pendingMessages].slice(0,iy),void 0)}canSendWhileRestoring(e){return!(`method`in e)||oy.has(e.method)}createDelegate(){this.invalidateDelegate();let e=new Tl(this.options.getWsUrl());return this.delegate=e,this.disposeDelegateMessage=e.onMessage(e=>{for(let t of this.messageHandlers)try{t(e)}catch(e){T.error(`LSP message handler failed`,e)}}),this.disposeDelegateClose=e.onClose(t=>{this.delegate!==e||this.isClosed||(T.warn(`WebSocket transport connection closed`,t),this.isDelegateConnected=!1,this.disposeDelegate(),this.delegate=void 0,this.restoringGeneration=void 0,this.reclaimInFlightBacklog(),this.connectionPromise=void 0,queueMicrotask(()=>this.reconnect()))}),e}reconnect(){this.connect().catch(e=>{T.error(`WebSocket transport reconnection failed`,e)})}invalidateDelegate(){this.isDelegateConnected=!1,this.restoringGeneration=void 0,this.disposeDelegate(),this.delegate?.close(),this.delegate=void 0}disposeDelegate(){this.disposeDelegateMessage?.(),this.disposeDelegateMessage=void 0,this.disposeDelegateClose?.(),this.disposeDelegateClose=void 0}},cy=new Set([1,2]);function ly(e,t){if(!(`method`in t)||t.method!==`window/logMessage`)return;let n=t.params;!gv(n)||typeof n.message!=`string`||BT({logs:[{timestamp:Date.now()/1e3,level:cy.has(n.type)?`stderr`:`stdout`,message:n.message,source:{type:`lsp`,name:e}}]})}function uy(e,t){let n=ae(),r=new sy({getWsUrl:()=>n.getLSPURL(e).toString(),waitForConnection:async()=>{await ie()},onReconnect:t});return r.onMessage(t=>ly(e,t)),r}$e.define(),new L;function dy(e){return e.facet(Xe.readOnly)}function fy(e){return[ut(e),Ke.of([{key:`ArrowRight`,preventDefault:!0,run:t=>py(t,e)},{key:`Tab`,preventDefault:!0,run:t=>py(t,e)}])]}function py(e,t){if(dy(e.state))return!1;let n=e.state.doc.length;return n===0&&(e.dispatch({changes:{from:0,to:n,insert:t},selection:{head:t.length,anchor:t.length}}),!0)}function my(e){let{beforeText:t,linkText:n,afterText:r,onClick:i}=e;return[ut(e=>{let a=document.createElement(`span`);a.append(document.createTextNode(t));let o=document.createElement(`span`);return o.textContent=n,o.classList.add(`cm-clickable-placeholder`),o.onclick=t=>{t.stopPropagation(),i(e)},a.append(o),a.append(document.createTextNode(r)),a}),V.theme({".cm-placeholder":{color:`var(--slate-8)`},".cm-clickable-placeholder":{cursor:`pointer !important`,pointerEvents:`auto`,color:`var(--slate-9)`,textDecoration:`underline`,textUnderlineOffset:`0.2em`},".cm-clickable-placeholder:hover":{color:`var(--sky-11)`}})]}var hy=Gt(e=>{let t,n={transport:uy(`pylsp`,async()=>{await t?.()}),rootUri:sv(),workspaceFolders:cv()},r=e?.pylsp,i=[`D100`,`D103`],a=[`W292`,`E402`,`E302`,`E305`],o=[`B018`,`I001`],s={pylsp:{plugins:{marimo_plugin:{enabled:!0},jedi:{auto_import_modules:[`numpy`]},jedi_completion:{include_params:!0,resolve_at_most:50},flake8:{enabled:r?.enable_flake8,extendIgnore:a},pydocstyle:{enabled:r?.enable_pydocstyle,ignore:i},pylint:{enabled:r?.enable_pylint},pyflakes:{enabled:r?.enable_pyflakes},pylsp_mypy:{enabled:r?.enable_mypy,live_mode:!0},ruff:{enabled:r?.enable_ruff,extendIgnore:[...a,...i,...o]},signature:{formatter:r?.enable_ruff?`ruff`:`black`,line_length:88}}}},c=new ry(new wl({...n}),s);return t=()=>c.resyncAllDocuments(),c}),gy=Gt(e=>{let t,n=new ry(new wl({transport:uy(`ty`,async()=>{await t?.()}),rootUri:sv(),workspaceFolders:cv(),getWorkspaceConfiguration:e=>[{disableLanguageServices:!0}]}),{});return t=()=>n.resyncAllDocuments(),n}),_y=Gt(e=>{let t,n=new ry(new wl({transport:uy(`pyrefly`,async()=>{await t?.()}),rootUri:sv(),workspaceFolders:cv(),initializationOptions:{pyrefly:{displayTypeErrors:e.diagnostics?.enabled??!1?`force-on`:`force-off`}}}),{});return t=()=>n.resyncAllDocuments(),n}),vy=Gt(e=>{let t,n=new ry(new wl({transport:uy(`basedpyright`,async()=>{await t?.()}),rootUri:sv(),workspaceFolders:cv()}),{});return t=()=>n.resyncAllDocuments(),n}),yy=class{parser=new Sp;type=`python`;defaultCode=this.parser.defaultCode;defaultMetadata=this.parser.defaultMetadata;transformIn(e){let t=this.parser.transformIn(e);return[t.code,t.offset,t.metadata]}transformOut(e,t){let n=this.parser.transformOut(e,t);return[n.code,n.offset]}isSupported(e){return this.parser.isSupported(e)}getExtension(e,t,n,r,i){return[(()=>{let r={defaultKeymap:!1,activateOnTyping:t.activate_on_typing,closeOnBlur:!1},a={hideOnChange:!0},o=[];i?.pylsp?.enabled&&wm(`pylsp`)&&o.push(hy(i)),i?.ty?.enabled&&wm(`ty`)&&o.push(gy(i)),i?.pyrefly?.enabled&&wm(`pyrefly`)&&o.push(_y(i)),i?.basedpyright?.enabled&&wm(`basedpyright`)&&o.push(vy(i));let s=t.signature_hint_on_typing,c=s?/(\w+|\w+\.|\/)$/:/(\w+|\w+\.|\(|\/|,)$/;if(o.length>0){let t=o.length===1?o[0]:new fv(o),l=e=>{T.debug(`openExternalLocation`,e),!(t.documentUri===e.uri||ov(e.uri))&&sn().openFile({path:e.uri.replace(`file://`,``)})};return[Ul({client:t,languageId:`python`,allowHTMLContent:!0,markdownRenderer:hv(),useSnippetOnCompletion:!0,clientSideFiltering:!0,hoverConfig:a,completionConfig:r,diagnosticsEnabled:i.diagnostics?.enabled??!1,sendIncrementalChanges:!1,signatureHelpEnabled:!0,signatureActivateOnTyping:s,signatureHelpOptions:{position:`above`},keyboardShortcuts:{signatureHelp:n.getHotkey(`cell.signatureHelp`).key,goToDefinition:n.getHotkey(`cell.goToDefinition`).key,rename:n.getHotkey(`cell.renameSymbol`).key},completionMatchBefore:c,onGoToDefinition:l,onShowLocation:l}),pl.of(rv.of(e))]}return[en({...r,override:[p_]}),d_]})(),Sy(),by(r)]}};function by(e){return e===`marimo-import`?ht.highest(fy(`import marimo as mo`)):e===`ai`?my({beforeText:`Start coding or `,linkText:`generate`,afterText:` with AI.`,onClick:e=>{e.state.facet(Su).aiCellCompletion()}}):[]}var xy=Ln.configure({props:[Fe.add({ParenthesizedExpression:Ge,ArgList:Ge})]});function Sy(){return new gt(xy,[xy.data.of({autocomplete:Rn}),xy.data.of({autocomplete:Bn})])}function Cy(e){return typeof e==`object`&&!Array.isArray(e)&&!wy(e)}function wy(e){if(typeof e!=`object`||Array.isArray(e)||!(`self`in e)||!(`children`in e))return!1;let t=e.self;return typeof t==`object`&&!!t&&!Array.isArray(t)&&typeof t.label==`string`}function Ty(e){return Array.isArray(e)}function Ey(e,t,n,r){let i=e.length;if(t===`string`||t===`completion`&&r&&Ty(r))return`column`;if(t===`namespace`&&n){if(Ty(n))return`table`;if(Cy(n))return Object.values(n).some(e=>Ty(e)||wy(e)&&Ty(e.children))?i<=1?`database`:`schema`:i===0?`database`:`namespace`}if(t===`completion`&&n)return Ty(n)?`table`:(Cy(n)&&Object.values(n).some(e=>Ty(e)||wy(e)&&Ty(e.children)),i<=1?`database`:`schema`);switch(i){case 0:return`database`;case 1:return`schema`;default:return`namespace`}}function Dy(e,t,n={}){let{maxDepth:r=10}=n;if((typeof t==`string`?t===``:t.length===0)&&wy(e)){let t=Ey([],`completion`,e.children);return{completion:e.self,path:[],type:`completion`,semanticType:t,namespace:e.children}}let i=(typeof t==`string`?t.split(`.`):t).filter(e=>e.length>0);return i.length===0||i.length>r?null:Oy(e,i,[],n)}function Oy(e,t,n,r,i){if(t.length===0){if(wy(e)){let t=Ey(n,`completion`,e.children,i);return{completion:e.self,path:n,type:`completion`,semanticType:t,namespace:e.children}}return{path:n,type:`namespace`,semanticType:Ey(n,`namespace`,e,i),namespace:e}}let[a,...o]=t,{caseSensitive:s=!1}=r;if(!a)return null;if(Cy(e)){let t=s?Object.keys(e).find(e=>e===a):Object.keys(e).find(e=>e.toLowerCase()===a.toLowerCase());if(t){let i=e[t];if(i)return Oy(i,o,[...n,t],r,e)}}else if(wy(e))return Oy(e.children,t,n,r,e);else if(Ty(e)){for(let t of e)if(typeof t==`string`){if((s?t===a:t.toLowerCase()===a.toLowerCase())&&o.length===0){let r=Ey([...n,t],`string`,void 0,e);return{value:t,path:[...n,t],type:`string`,semanticType:r}}}else if((s?t.label===a:t.label.toLowerCase()===a.toLowerCase())&&o.length===0){let r=Ey([...n,t.label],`completion`,void 0,e);return{completion:t,path:[...n,t.label],type:`completion`,semanticType:r}}}return null}function ky(e,t,n={}){let r=[];if(t.includes(`.`)){let r=t.lastIndexOf(`.`),i=t.substring(0,r),a=t.substring(r+1),o=Dy(e,i,n);if(o?.namespace)return Ay(o.namespace,a,o.path,n)}else return Ay(e,t,[],n);return r}function Ay(e,t,n,r){let i=[],{caseSensitive:a=!1,allowPartialMatch:o=!0}=r;if(Cy(e)){for(let[r,s]of Object.entries(e))if(o?a?r.startsWith(t):r.toLowerCase().startsWith(t.toLowerCase()):a?r===t:r.toLowerCase()===t.toLowerCase()){if(wy(s)){let t=Ey([...n,r],`completion`,s.children,e);i.push({completion:s.self,path:[...n,r],type:`completion`,semanticType:t,namespace:s.children})}else{let t=Ey([...n,r],`namespace`,s,e);i.push({path:[...n,r],type:`namespace`,semanticType:t,namespace:s})}}}else if(wy(e)){if(o?a?e.self.label.startsWith(t):e.self.label.toLowerCase().startsWith(t.toLowerCase()):a?e.self.label===t:e.self.label.toLowerCase()===t.toLowerCase()){let t=Ey([...n,e.self.label],`completion`,e.children);i.push({completion:e.self,path:[...n,e.self.label],type:`completion`,semanticType:t,namespace:e.children})}i.push(...Ay(e.children,t,n,r))}else if(Ty(e)){for(let r of e)if(typeof r==`string`){if(o?a?r.startsWith(t):r.toLowerCase().startsWith(t.toLowerCase()):a?r===t:r.toLowerCase()===t.toLowerCase()){let t=Ey([...n,r],`string`,void 0,e);i.push({value:r,path:[...n,r],type:`string`,semanticType:t})}}else if(o?a?r.label.startsWith(t):r.label.toLowerCase().startsWith(t.toLowerCase()):a?r.label===t:r.label.toLowerCase()===t.toLowerCase()){let t=Ey([...n,r.label],`completion`,void 0,e);i.push({completion:r,path:[...n,r.label],type:`completion`,semanticType:t})}}return i}function jy(e,t,n={}){let r=[],{maxDepth:i=10}=n;My(e,[],r,i);let{caseSensitive:a=!1}=n;return r.filter(e=>e.path.some(e=>a?e===t:e.toLowerCase()===t.toLowerCase())).sort((e,n)=>{let r=a?e.path[e.path.length-1]===t:e.path[e.path.length-1]?.toLowerCase()===t.toLowerCase(),i=a?n.path[n.path.length-1]===t:n.path[n.path.length-1]?.toLowerCase()===t.toLowerCase();return r&&!i?-1:!r&&i?1:e.path.length-n.path.length})}function My(e,t,n,r){if(!(t.length>=r)){if(Cy(e))for(let[i,a]of Object.entries(e)){let o=[...t,i];if(wy(a)){let t=Ey(o,`completion`,a.children,e);n.push({completion:a.self,path:o,type:`completion`,semanticType:t,namespace:a.children}),My(a.children,o,n,r)}else{let t=Ey(o,`namespace`,a,e);n.push({path:o,type:`namespace`,semanticType:t,namespace:a}),My(a,o,n,r)}}else if(wy(e)){let i=Ey(t,`completion`,e.children);n.push({completion:e.self,path:t,type:`completion`,semanticType:i,namespace:e.children}),My(e.children,t,n,r)}else if(Ty(e))for(let r of e)if(typeof r==`string`){let i=Ey([...t,r],`string`,void 0,e);n.push({value:r,path:[...t,r],type:`string`,semanticType:i})}else{let i=Ey([...t,r.label],`completion`,void 0,e);n.push({completion:r,path:[...t,r.label],type:`completion`,semanticType:i})}}}function Ny(e,t,n={}){let{enableFuzzySearch:r=!1}=n,i=Dy(e,t,n);if(i)return i;let a=ky(e,t,n);if(a.length>0)return a[0]||null;if(r){let r=jy(e,t,n);if(r.length>0)return r[0]||null}return null}var Py=I.define({combine:e=>e[0]??null});function Fy(e,t){let n=e??t.state.facet(Py);return n==null?null:typeof n==`function`?n(t):n}function Iy(e,t){let n=e??t.state.facet(Py);return n==null?null:typeof n==`function`?t.view?n(t.view):null:n}function Ly(e){if(e==null)return null;let t=wy(e)?e.children:e;return Ty(t)?t:null}function Ry(e,t){let n=Ly(Dy(e,t,{caseSensitive:!1})?.namespace);if(n)return n;let r=(typeof t==`string`?t.split(`.`):t).map(e=>e.toLowerCase()),i=r[r.length-1];if(!i)return null;let a=jy(e,i).filter(e=>{if(Ly(e.namespace)===null||e.path.length<r.length)return!1;let t=e.path.slice(-r.length).map(e=>e.toLowerCase());return r.every((e,n)=>t[n]===e)});return a.length===1?Ly(a[0]?.namespace):null}function zy(e,t,n){if(typeof e==`string`)return n===void 0?{label:e,type:`property`,detail:t}:{label:e,type:`property`,detail:t,boost:n};let r={...e,type:`property`,detail:e.detail??t};return n!==void 0&&r.boost===void 0&&(r.boost=n),r}var By=e=>{let t;return async()=>(t||=e(),await t)},Vy=class{opts;parser=null;offsetRecord={};constructor(e={}){this.opts=e}getParser=By(async()=>{if(this.parser)return this.parser;let t=await H(()=>import(`./node-sql-parser-gD9ga-kL.js`).then(t=>e(t.default,1)),__vite__mapDeps([213,1]),import.meta.url),{Parser:n}=t.default||t;return this.parser=new n,this.parser});async parse(e,t){this.offsetRecord={};let n=this.opts.getParserOptions?.(t.state),r=await this.sanitizeSql(e,n);try{let e=await this.getParser();return n?.database===`DuckDB`?this.parseWithDuckDBSupport(r,n):{success:!0,errors:[],ast:e.astify(r,n)}}catch(e){return{success:!1,errors:[this.extractErrorInfo(e,r)]}}}async sanitizeSql(e,t){if(t?.ignoreBrackets){let{sql:t,offsetRecord:n}=Wy(e);return this.offsetRecord=n,t}return e}async parseWithDuckDBSupport(e,t){let n=await this.getParser(),r=Hy(e).trimStart().toLowerCase();if(r.startsWith(`from`)||r.includes(`macro`))return{success:!0,errors:[]};let i=e;r.includes(`create or replace table`)&&(this.offsetRecord[e.indexOf(`create or replace table`)]=-11,i=e.replace(/create or replace table/i,`create table`));try{let e={...t,database:`PostgreSQL`};return{success:!0,errors:[],ast:n.astify(i,e)}}catch(t){return{success:!1,errors:[this.extractErrorInfo(t,e)]}}}extractErrorInfo(e,t){let n=1,r=1,i=e?.message||`SQL parsing error`,a=e;if(a?.location)n=a.location.start?.line||1,r=a.location.start?.column||1;else if(a?.hash)n=a.hash.line||1,r=a.hash.loc?.first_column||1;else{let e=i.match(/line (\d+)/i),t=i.match(/column (\d+)/i);e?.[1]&&(n=parseInt(e[1],10)),t?.[1]&&(r=parseInt(t[1],10))}let o=Object.entries(this.offsetRecord).map(([e,t])=>({position:parseInt(e,10),offset:t})).sort((e,t)=>e.position-t.position),s=0;for(let{position:e,offset:i}of o){let a=e+s;s+=i;let o=t.slice(0,a),c=(o.match(/\n/g)?.length??0)+1,l=a-o.lastIndexOf(`
|
|
109
|
-
`);n===c&&r>l&&(r-=i)}return r>t.length&&(r=t.length),{message:this.cleanErrorMessage(i),line:Math.max(1,n),column:Math.max(1,r),severity:`error`}}cleanErrorMessage(e){return e.replace(/^Error: /,``).replace(/Expected .* but .* found\./i,e=>e.replace(/but .* found/,`found unexpected token`)).trim()}async validateSql(e,t){return(await this.parse(e,t)).errors}async extractTableReferences(e,t){let n=t?this.opts.getParserOptions?.(t.state):void 0;try{return(await this.getParser()).tableList(e,n).map(e=>{let t=e.split(`::`);return t[t.length-1]||e})}catch{return[]}}async extractColumnReferences(e,t){let n=t?.state?this.opts.getParserOptions?.(t.state):void 0;try{return(await this.getParser()).columnList(e,n).map(e=>{let t=e.split(`::`);return t[t.length-1]||e})}catch{return[]}}};function Hy(e,t=[`/*`,`--`]){let n=[];if(t.includes(`/*`)&&n.push(`/\\*[\\s\\S]*?\\*/`),t.includes(`--`)&&n.push(`--[^\\n]*`),n.length===0)return e;let r=RegExp(`^\\s*(${n.join(`|`)})\\s*`,``),i=e,a=``;for(;i!==a;)a=i,i=i.replace(r,``);return i}var Uy=2;function Wy(e){let t={};return{sql:e.replace(/("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\{[^}]*\})/g,(e,n,r,i,a)=>n||r?e:i?(t[a]=Uy,`'${i}'`):e),offsetRecord:t}}function Gy(){return{tables:[],ctes:[],aliases:new Map,selectAliases:[]}}function Ky(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qy(e){return Array.isArray(e)?e:[]}function Jy(e){let t=e[0],n=e[e.length-1];return e.length>=2&&(t===`"`&&n===`"`||t===`'`&&n===`'`||t==="`"&&n==="`"||t===`[`&&n===`]`)?e.slice(1,-1):e}function Yy(e){return typeof e==`string`?e:Ky(e)&&typeof e.value==`string`?e.value:null}function Xy(e){if(!Ky(e)||e.type!==`column_ref`)return null;let t=e.column;if(typeof t==`string`)return t;if(Ky(t)){let e=t.expr,n=Ky(e)?e.value:t.value;if(typeof n==`string`)return n}return null}function Zy(e){let t=qy(e.columns).map(e=>Yy(e)??Xy(e)??Yy(e.column)).filter(e=>typeof e==`string`);if(t.length>0)return t;let n=e.stmt,r=Ky(n)?n.ast??n:null;if(!Ky(r)||r.type!==`select`)return[];let i=[];for(let e of qy(r.columns))if(typeof e.as==`string`)i.push(e.as);else{let t=Xy(e.expr);t&&t!==`*`&&i.push(t)}return i}function Qy(e,t){if(typeof e.table!=`string`||e.table.length===0)return;let n=[e.db??e.catalog,e.schema,e.table].filter(e=>typeof e==`string`&&e.length>0).map(Jy),r=typeof e.as==`string`?Jy(e.as):void 0,i=`${n.join(`.`).toLowerCase()}::${r?.toLowerCase()??``}`;t.seenTables.has(i)||(t.seenTables.add(i),t.tables.push({name:Jy(e.table),path:n,...r?{alias:r}:{}}))}function $y(e,t,n){if(Array.isArray(e)){for(let r of e)$y(r,t,n);return}if(!(!Ky(e)||n.has(e))){n.add(e);for(let n of qy(e.with)){let e=Yy(n.name);e&&!t.seenCtes.has(e.toLowerCase())&&(t.seenCtes.add(e.toLowerCase()),t.ctes.push({name:Jy(e),columns:Zy(n).map(Jy),from:-1,to:-1}))}for(let n of[`from`,`table`])for(let r of qy(e[n]))Qy(r,t);for(let[r,i]of Object.entries(e))r!==`loc`&&r!==`tableList`&&r!==`columnList`&&$y(i,t,n)}}function eb(e,t){if(e.type===`select`)for(let n of qy(e.columns))typeof n.as==`string`&&t.selectAliases.push(Jy(n.as))}function tb(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r=`(?:"${n}"|\`${n}\`|\\[${n}\\]|\\b${n})`,i=RegExp(`(${r})\\s*(?:\\([^)]*\\)\\s*)?AS\\s*\\(`,`i`).exec(e);return!i||i.index<0||!i[1]?{from:-1,to:-1}:{from:i.index,to:i.index+i[1].length}}var nb=new Set(`as.on.using.where.join.inner.left.right.full.cross.outer.natural.lateral.group.order.limit.offset.having.union.intersect.except.select.set.values.when.then.and.or.not.in.is.asc.desc.fetch.window.qualify.returning.with`.split(`.`)),rb=String.raw`(?:[\w$]+|"[^"]+"|\`[^\`]+\`|\[[^\]]+\])`,ib=`(?!(?:${[...nb].join(`|`)})\\b)`,ab=new RegExp(String.raw`\b(?:from|join)\s+(${rb}(?:\.${rb})*)(?:\s+(?:as\s+)?${ib}(${rb}))?`,`gi`);function ob(e){let t=e.split(``),n=0;for(;n<e.length;){let r=e[n],i=e[n+1];if(r===`-`&&i===`-`){for(;n<e.length&&e[n]!==`
|
|
110
|
-
`;)t[n]=` `,n++;continue}if(r===`/`&&i===`*`){for(t[n]=` `,t[n+1]=` `,n+=2;n<e.length&&(e[n]!==`*`||e[n+1]!==`/`);)t[n]=` `,n++;n<e.length&&(t[n]=` `,t[n+1]=` `,n+=2);continue}if(r===`"`||r==="`"||r===`[`){let t=r===`[`?`]`:r;for(n++;n<e.length&&e[n]!==t;)n++;n++;continue}if(r===`'`){for(t[n]=` `,n++;n<e.length;){if(e[n]===`'`){if(t[n]=` `,e[n+1]===`'`){t[n+1]=` `,n+=2;continue}n++;break}t[n]=` `,n++}continue}n++}return t.join(``)}function sb(e){let t={tables:[],ctes:[],selectAliases:[],seenTables:new Set,seenCtes:new Set},n=ob(e);cb(n,t),ab.lastIndex=0;let r=ab.exec(n);for(;r!==null;){let e=r[1],i=r[2];if(e){let n=e.split(`.`).map(Jy),r=n[n.length-1]??``,a=i&&!nb.has(i.toLowerCase())?Jy(i):void 0,o=`${n.join(`.`).toLowerCase()}::${a?.toLowerCase()??``}`;r&&!t.seenTables.has(o)&&(t.seenTables.add(o),t.tables.push({name:r,path:n,...a?{alias:a}:{}}))}r=ab.exec(n)}return db(t)}function cb(e,t){let n=/\bWITH\s+(?:RECURSIVE\s+)?/gi,r=new RegExp(String.raw`^(${rb})\s*(?:\(([^)]*)\)\s*)?AS\s*\(`,`i`),i=n.exec(e);for(;i!==null;){let a=i.index+i[0].length;for(;;){let n=r.exec(e.slice(a)),i=n?.[1],o=i?Jy(i):void 0;if(!n||!i||!o)break;let s=a+n[0].length,c=s,l=1;for(;c<e.length&&l>0;)e[c]===`(`?l++:e[c]===`)`&&l--,c++;if(!t.seenCtes.has(o.toLowerCase())){t.seenCtes.add(o.toLowerCase());let r=(n[2]??``).split(`,`).map(e=>Jy(e.trim())).filter(e=>e.length>0);t.ctes.push({name:o,columns:r.length>0?r:ub(e.slice(s,Math.max(s,c-1))),from:a,to:a+i.length})}let u=/^\s*,\s*/.exec(e.slice(c));if(!u)break;a=c+u[0].length}i=n.exec(e)}}function lb(e){let t=[],n=0,r=``;for(let i of e)i===`(`?n++:i===`)`&&(n=Math.max(0,n-1)),i===`,`&&n===0?(t.push(r),r=``):r+=i;return t.push(r),t}function ub(e){let t=/^\s*SELECT\s+(?:DISTINCT\s+)?([\s\S]*?)\s+FROM\s/i.exec(e);if(!t||!t[1])return[];let n=[];for(let e of lb(t[1])){let t=e.trim(),r=new RegExp(String.raw`\s+AS\s+(${rb})$`,`i`).exec(t);if(r?.[1]){n.push(Jy(r[1]));continue}if(/^(?:[\w$]+\.)*[\w$]+$/.test(t)){let e=t.split(`.`),r=e[e.length-1];r&&r!==`*`&&n.push(r)}}return n}function db(e){let t=new Map;for(let n of e.tables)if(n.alias){let e=n.alias.toLowerCase();t.has(e)||t.set(e,n.path.join(`.`))}return{tables:e.tables,ctes:e.ctes,aliases:t,selectAliases:e.selectAliases}}async function fb(e,t,n){if(!e.trim())return Gy();let r=null;try{let i=await t.parse(e,n);i.success&&i.ast!=null&&(r=i.ast)}catch{}if(r==null)return sb(e);try{let t={tables:[],ctes:[],selectAliases:[],seenTables:new Set,seenCtes:new Set},n=Array.isArray(r)?r:[r];for(let e of n)Ky(e)&&eb(e,t);$y(r,t,new Set);let i=ob(e);for(let e of t.ctes){let t=tb(i,e.name);e.from=t.from,e.to=t.to}return db(t)}catch{return sb(e)}}var pb=class{parser;cache=new Map;MAX_CACHE_SIZE=20;constructor(e=new Vy){this.parser=e}async getContext(e,t){let n=this.cache.get(e);if(n)return n;let r=await fb(e,this.parser,t);if(this.cache.set(e,r),this.cache.size>this.MAX_CACHE_SIZE){let e=this.cache.keys().next().value;e!==void 0&&this.cache.delete(e)}return r}clearCache(){this.cache.clear()}},mb=class{parser;cache=new Map;MAX_CACHE_SIZE=10;constructor(e){this.parser=e}async analyzeDocument(e){let t=e.doc.toString(),n=this.cache.get(t);if(n)return n;let r=await this.extractStatements(t,e);if(this.cache.set(t,r),this.cache.size>this.MAX_CACHE_SIZE){let e=this.cache.keys().next().value;e!==void 0&&this.cache.delete(e)}return r}async getStatementAtPosition(e,t){return(await this.analyzeDocument(e)).find(e=>t>=e.from&&t<=e.to)||null}async getStatementsInRange(e,t,n){return(await this.analyzeDocument(e)).filter(e=>e.from<=n&&e.to>=t)}async extractStatements(e,t){let n=[],r=this.splitByStatementSeparators(e),i=0;for(let e of r){let r=e.trim();if(r.length===0){i+=e.length;continue}let a=i+e.indexOf(r),o=a+r.length,s=t.doc.lineAt(a),c=t.doc.lineAt(o),l=this.stripComments(r);if(l.trim().length===0||l.trim()===`;`){i+=e.length;continue}let u=await this.parser.parse(r,{state:t}),d=this.determineStatementType(l),f=l.endsWith(`;`)?l.slice(0,-1).trim():l.trim();n.push({from:a,to:o,lineFrom:s.number,lineTo:c.number,content:f,type:d,isValid:u.success,errors:u.errors??[]}),i+=e.length}return n}splitByStatementSeparators(e){let t=[],n=``,r=!1,i=``,a=!1,o=!1,s=0;for(;s<e.length;){let c=e[s],l=e[s+1];if(!r&&!o&&c===`-`&&l===`-`){a=!0,n+=c+l,s+=2;continue}if(!r&&!a&&c===`/`&&l===`*`){o=!0,n+=c+l,s+=2;continue}if(o&&c===`*`&&l===`/`){o=!1,n+=c+l,s+=2;continue}if(a&&(c===`
|
|
111
|
-
`||c===`\r`)){a=!1,n+=c,s++;continue}if(a||o){n+=c,s++;continue}if(!r&&(c===`'`||c===`"`||c==="`"))r=!0,i=c,n+=c;else if(r&&c===i){if(l===i){n+=c+l,s+=2;continue}r=!1,i=``,n+=c}else!r&&c===`;`?(n+=c,t.push(n),n=``):n+=c;s++}return n.trim()&&t.push(n),t}determineStatementType(e){let t=e.trim().toLowerCase();return t.startsWith(`select`)?`select`:t.startsWith(`insert`)?`insert`:t.startsWith(`update`)?`update`:t.startsWith(`delete`)?`delete`:t.startsWith(`create`)?`create`:t.startsWith(`drop`)?`drop`:t.startsWith(`alter`)?`alter`:t.startsWith(`use`)?`use`:`other`}stripComments(e){let t=``,n=!1,r=``,i=!1,a=!1,o=0;for(;o<e.length;){let s=e[o],c=e[o+1];if(!n&&!a&&s===`-`&&c===`-`){i=!0,o+=2;continue}if(!n&&!i&&s===`/`&&c===`*`){a=!0,o+=2;continue}if(a&&s===`*`&&c===`/`){a=!1,o+=2;continue}if(i&&(s===`
|
|
112
|
-
`||s===`\r`)){i=!1,t+=s,o++;continue}if(i||a){o++;continue}if(!n&&(s===`'`||s===`"`||s==="`"))n=!0,r=s,t+=s;else if(n&&s===r){if(c===r){t+=s+c,o+=2;continue}n=!1,r=``,t+=s}else t+=s;o++}return t}clearCache(){this.cache.clear()}};function hb(e={}){let t=e.parser??new Vy,n=e.contextAnalyzer??new pb(t),r=new mb(t);return async t=>{let i=t.matchBefore(/(?:[\w$]+|"[^"]+"|`[^`]+`|\[[^\]]+\])\.[\w$]*/);if(!i||t.state.sliceDoc(Math.max(0,i.from-1),i.from)===`.`)return null;let a=i.text.lastIndexOf(`.`),o=Jy(i.text.slice(0,a)),s=await r.getStatementAtPosition(t.state,t.pos),c=s?t.state.sliceDoc(s.from,s.to):t.state.doc.toString(),l=await n.getContext(c,{state:t.state}),u=l.aliases.get(o.toLowerCase());if(!u)return null;let d=null,f=l.ctes.find(e=>e.name.toLowerCase()===u.toLowerCase());if(f&&f.columns.length>0)d=f.columns;else if(!f){let n=Iy(e.schema,t);n!=null&&(d=Ry(n,u))}if(!d||d.length===0)return null;let p=`column of ${u}`;return{from:i.from+a+1,options:d.map(e=>zy(e,p)),validFor:/^[\w$]*$/}}}var gb=1,_b=/\b(?:from|join|into|update|table)\s+$/i,vb=/\bfrom\s+[\w$."`[\]]+(?:\s+(?:as\s+)?[\w$"`[\]]+)?(?:\s*,\s*[\w$."`[\]]+(?:\s+(?:as\s+)?[\w$"`[\]]+)?)*\s*,\s*$/i;function yb(e={}){let t=e.parser??new Vy,n=e.contextAnalyzer??new pb(t),r=new mb(t);return async t=>{let i=t.matchBefore(/[\w$]*/);if(!i||i.from===i.to&&!t.explicit||t.state.sliceDoc(Math.max(0,i.from-1),i.from)===`.`)return null;let a=t.state.sliceDoc(Math.max(0,i.from-256),i.from);if(_b.test(a)||vb.test(a))return null;let o=await r.getStatementAtPosition(t.state,t.pos),s=o?.from??0,c=o?t.state.sliceDoc(o.from,o.to):t.state.doc.toString(),l=ob(c),u=Math.max(s,i.from-1)-s,d=i.to-s;if(l.slice(u,d)!==c.slice(u,d))return null;let f=await n.getContext(c,{state:t.state});if(f.tables.length===0)return null;let p=Iy(e.schema,t),m=[],h=new Set,g=new Set;for(let e of f.tables){let t=e.path.join(`.`).toLowerCase();if(g.has(t))continue;g.add(t);let n=f.ctes.find(t=>t.name.toLowerCase()===e.name.toLowerCase()),r=null;if(n?r=n.columns.length>0?n.columns:null:p!=null&&(r=Ry(p,e.path)),!r)continue;let i=`column of ${e.name}`;for(let e of r){let t=(typeof e==`string`?e:e.label).toLowerCase();h.has(t)||(h.add(t),m.push(zy(e,i,gb)))}}return m.length===0?null:{from:i.from,options:m,validFor:/^[\w$]*$/}}}var bb=/[\w$]/,xb=/"[^"]*"|`[^`]*`|\[[^\]]*\]/g;function Sb(e,t){let n=e.doc.lineAt(t),r=n.text,i=t-n.from;xb.lastIndex=0;let a=xb.exec(r);for(;a!==null&&a.index<=i;){let e=a.index+a[0].length;if(i<=e)return{from:n.from+a.index,to:n.from+e,text:Jy(a[0])};a=xb.exec(r)}let o=i,s=i;for(;o>0&&bb.test(r[o-1]??``);)o--;for(;s<r.length&&bb.test(r[s]??``);)s++;return o===s?null:{from:n.from+o,to:n.from+s,text:r.slice(o,s)}}async function Cb(e,t,n){let r=await e.analyzeDocument(t),i=null;for(let e of r){if(n>=e.from&&n<=e.to)return e;e.from<=n&&(i=e)}return i}function wb(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Tb(e,t={}){let n=wb(e);return`(?:"${n}"|\`${n}\`|\\[${n}\\]|${t.allowLeadingDot?`(?<![\\w$])`:`(?<![\\w$.])`}${n}(?![\\w$]))`}function Eb(e,t,n={}){let r=new RegExp(Tb(t),`gi`),i=[],a=r.exec(e);for(;a!==null;){let t=a.index+a[0].length;(!n.followedByDot||e[t]===`.`)&&i.push({from:a.index,to:t}),a=r.exec(e)}return i}function Db(e){let t=[],n=0;for(let r=0;r<e.length;r++)e[r]===`)`&&(n=Math.max(0,n-1)),t[r]=n,e[r]===`(`&&n++;return t}var Ob=/\b(select|from|where|having|qualify|on|set|values|by|join|limit|offset|union|intersect|except|window)\b/gi;function kb(e){Ob.lastIndex=0;let t=null,n=Ob.exec(e);for(;n!==null;)t=(n[1]??``).toLowerCase(),n=Ob.exec(e);return t}function Ab(e,t){let n=t-1;for(;;){for(;n>=0&&/\s/.test(e[n]??``);)n--;if(n>=0&&e[n]===`.`){for(n--;n>=0&&/\s/.test(e[n]??``);)n--;let t=e[n];if(t===`"`||t==="`"||t===`]`){let r=t===`]`?`[`:t;for(n--;n>=0&&e[n]!==r;)n--;n--}else for(;n>=0&&bb.test(e[n]??``);)n--;continue}break}if(n<0)return!1;if(e[n]===`,`)return kb(e.slice(0,n))===`from`;let r=/([A-Za-z_]+)$/.exec(e.slice(0,n+1))?.[1]?.toLowerCase();return r===`from`||r===`join`}function jb(e){let t=new Map;for(let n of e)t.has(n.from)||t.set(n.from,n);return[...t.values()].sort((e,t)=>e.from-t.from)}function Mb(e,t){return e.some(e=>e.from<=t.from&&t.to<=e.to)}function Nb(e,t,n){let r=ob(e),i=n.text.toLowerCase(),a=t.selectAliases.some(e=>e.toLowerCase()===i),o=t.ctes.find(e=>e.name.toLowerCase()===i);if(o){let e=t.aliases.get(i);if(e&&e.toLowerCase()!==i||a||o.from<0)return null;let s={from:o.from,to:o.to},c=jb([s,...Eb(r,o.name).filter(e=>r[e.to]===`.`||Ab(r,e.from))]);return Mb(c,n)?{kind:`cte`,name:o.name,definition:s,references:c}:null}if(t.aliases.has(i)){if(a)return null;let e=t.tables.filter(e=>e.alias?.toLowerCase()===i);if(e.length!==1||!e[0])return null;let o=e[0],s=o.alias??n.text,c=Tb(o.name,{allowLeadingDot:!0}),l=RegExp(`${c}\\s+(?:AS\\s+)?(${Tb(s)})`,`gi`),u=l.exec(r);for(;u!==null&&!Ab(r,u.index);)u=l.exec(r);if(!u||u[1]==null)return null;let d={from:u.index+u[0].length-u[1].length,to:u.index+u[0].length},f=jb([d,...Eb(r,s,{followedByDot:!0})]);return Mb(f,n)?{kind:`table-alias`,name:s,definition:d,references:f}:null}let s=t.selectAliases.find(e=>e.toLowerCase()===i);if(s){let e=Db(r),t=t=>e[t]===0,i=Pb(r,/\bFROM\b/gi,t),a=i?i.index:r.length,o=RegExp(`\\bAS\\s+(${Tb(s)})`,`gi`),c=null,l=o.exec(r);for(;l!==null;){let e=l.index+l[0].length-(l[1]?.length??0);if(t(l.index)&&e<a){c={from:e,to:l.index+l[0].length};break}l=o.exec(r)}if(!c)return null;let u=Lb(r,t),d=Eb(r,s).filter(e=>u.some(t=>e.from>=t.from&&e.to<=t.to)),f=jb([c,...d]);return Mb(f,n)?{kind:`select-alias`,name:s,definition:c,references:f}:null}return null}function Pb(e,t,n){let r=t.exec(e);for(;r!==null;){if(n(r.index))return r;r=t.exec(e)}return null}var Fb=/\b(?:GROUP\s+BY|ORDER\s+BY|HAVING|QUALIFY)\b/gi,Ib=/\b(?:GROUP\s+BY|ORDER\s+BY|HAVING|QUALIFY|LIMIT|OFFSET|FETCH|WINDOW|UNION|INTERSECT|EXCEPT)\b/gi;function Lb(e,t){let n=[];Fb.lastIndex=0;let r=Fb.exec(e);for(;r!==null;){if(t(r.index)){let i=r.index+r[0].length;Ib.lastIndex=i;let a=e.length,o=Ib.exec(e);for(;o!==null;){if(t(o.index)){a=o.index;break}o=Ib.exec(e)}n.push({from:i,to:a})}r=Fb.exec(e)}return n}var Rb=class{structureAnalyzer;contextAnalyzer;constructor(e={}){let t=e.parser??new Vy;this.structureAnalyzer=e.structureAnalyzer??new mb(t),this.contextAnalyzer=e.contextAnalyzer??new pb(t)}async resolve(e,t){let n=Sb(e,t);if(!n)return null;let r=await Cb(this.structureAnalyzer,e,t);if(!r||n.from<r.from||n.to>r.to)return null;let i=e.sliceDoc(r.from,r.to),a=Nb(i,await this.contextAnalyzer.getContext(i,{state:e}),{from:n.from-r.from,to:n.to-r.from,text:n.text});if(!a)return null;let o=e=>({from:e.from+r.from,to:e.to+r.from});return{...a,definition:o(a.definition),references:a.references.map(o)}}},zb=/([\w$]+|"[^"]+"|`[^`]+`|\[[^\]]+\])$/;function Bb(e){return/\b(?:from|join)\s+$/i.test(e)}function Vb(e){return/^[A-Za-z_][\w$]*$/.test(e)}function Hb(e){return{label:e.name,type:`variable`,info:`Common Table Expression: ${e.name}`,boost:10,...Vb(e.name)?{}:{apply:`"${e.name}"`}}}function Ub(e){return e.columns.map(t=>({label:t,type:`property`,detail:`column of ${e.name}`,boost:5,...Vb(t)?{}:{apply:`"${t}"`}}))}function Wb(e={}){let t=e.parser??new Vy,n=e.contextAnalyzer??new pb(t),r=e.structureAnalyzer??new mb(t);return async e=>{let t=e.matchBefore(/[\w$]*/);if(!t)return null;let i=e.state.sliceDoc(Math.max(0,t.from-1),t.from)===`.`;if(t.from===t.to&&!e.explicit&&!i)return null;let a=await Cb(r,e.state,e.pos),o=a?e.state.sliceDoc(a.from,a.to):e.state.doc.toString(),s=await n.getContext(o,{state:e.state});if(s.ctes.length===0)return null;if(i){let n=e.state.doc.lineAt(t.from),r=e.state.sliceDoc(n.from,t.from-1),i=zb.exec(r);if(!i||!i[1]||r.slice(0,r.length-i[1].length).endsWith(`.`))return null;let a=Jy(i[1]).toLowerCase(),o=s.ctes.find(e=>e.name.toLowerCase()===a);return!o||o.columns.length===0?null:{from:t.from,options:Ub(o),validFor:/^[\w$]*$/}}let c=s.ctes.map(Hb);if(!Bb(e.state.sliceDoc(Math.max(0,t.from-64),t.from))){let e=new Set(s.tables.map(e=>e.name.toLowerCase())),t=new Set;for(let n of s.ctes)if(e.has(n.name.toLowerCase()))for(let e of Ub(n)){let n=e.label.toLowerCase();t.has(n)||(t.add(n),c.push(e))}}return{from:t.from,options:c,validFor:/^[\w$]*$/}}}var Gb=750;function Kb(e,t){if(t>=e.length)return e.length;let n=e.lineAt(t),r=n.text.slice(t-n.from).match(/^[\w"'`.]+/);return r?t+r[0].length:Math.min(t+1,e.length)}function qb(e,t){let n=t.line(Math.min(e.line,t.lines)),r=Math.min(n.from+Math.max(0,e.column-1),t.length);return{from:r,to:Kb(t,r),severity:e.severity,message:e.message,source:`sql-parser`}}function Jb(e,t,n){let r;return r=e.line<=1?t.from+Math.max(0,e.column-1):n.line(Math.min(t.lineFrom+e.line-1,n.lines)).from+Math.max(0,e.column-1),r=Math.max(t.from,Math.min(r,t.to)),{from:r,to:Math.max(r,Math.min(Kb(n,r),t.to)),severity:e.severity,message:e.message,source:`sql-parser`}}function Yb(e={}){return It(Xb(e),{delay:e.delay||Gb})}function Xb(e={}){let t=e.parser||new Vy,n=e.perStatement!==!1,r=e.structureAnalyzer||new mb(t);return async e=>{let i=e.state.doc,a=i.toString();return a.trim()?n?(await r.analyzeDocument(e.state)).flatMap(e=>e.errors.map(t=>Jb(t,e,i))):(await t.validateSql(a,{state:e.state})).map(e=>qb(e,i)):[]}}function Zb(e,t){if(t.size===0)return{};if(Cy(e)){let n={};for(let[r,i]of Object.entries(e))if(Array.from(t).some(e=>e.toLowerCase()===r.toLowerCase()))n[r]=i;else if(Cy(i)){let e=Zb(i,t);Object.keys(e).length>0&&(n[r]=e)}return n}return e}function Qb(e={}){let{schema:t,keywords:n={},enableKeywords:r=!0,enableTables:i=!0,enableColumns:a=!0,enableFuzzySearch:o=!0,parser:s=new Vy,tooltipRender:c,tooltipRenderers:l={}}=e,u=new mb(s),d=e.contextAnalyzer??new pb(s),f=null;return async(e,s,p)=>{let{from:m,to:h,text:g}=e.state.doc.lineAt(s),_=s,v=s;f===null&&(f=typeof n==`function`?n(e):Promise.resolve(n));let y;try{y=await f}catch{f=null,y={}}for(;_>m&&/[\w.]/.test(g[_-m-1]??``);)_--;for(;v<h&&/[\w.]/.test(g[v-m]??``);)v++;if(_===s&&p<0||v===s&&p>0)return null;let b=g.slice(_-m,v-m).toLowerCase();if(!b||b.length===0)return null;let x=Fy(t,e)??{},S=null;`${b}`;let C=Object.hasOwn(y,b)?y[b]:void 0;if(!S&&r&&C&&(S={word:b,view:e,pos:s,tooltipType:`keyword`,keywordData:{keyword:b,info:C}}),!S&&(i||a)&&x){let t=await u.getStatementAtPosition(e.state,s),n=t?e.state.doc.sliceString(t.from,t.to):e.state.doc.toString(),r=await d.getContext(n,{state:e.state}),[c=``,...l]=b.split(`.`),f=r.aliases.get(c),p=f?[f,...l].join(`.`).toLowerCase():b,m=new Set(r.tables.map(e=>e.name.toLowerCase())),h=Zb(x,m),g=Ny(h,p,{enableFuzzySearch:o});if(!g&&m.size===0&&(g=Ny(x,p,{enableFuzzySearch:o})),g){let{semanticType:e}=g;(e===`table`&&!i||e===`column`&&!a)&&(g=null)}g&&(Array.from(m),S={word:b,view:e,pos:s,tooltipType:`namespace`,namespaceData:{item:g,word:b,resolvedSchema:m.size>0?h:x,...f?{aliasFor:f}:{}}})}if(!S)return null;let w=S;return{pos:_,end:v,above:!0,create(e){if(c){let t=c(b,e,s);if(t)return{dom:t}}let t=null;if(w.tooltipType===`keyword`&&w.keywordData)t=l.keyword?l.keyword(w.keywordData):rx(w.keywordData);else if(w.tooltipType===`namespace`&&w.namespaceData){let e=w.namespaceData,{semanticType:n}=e.item;n===`table`&&l.table?t=l.table(e):n===`column`&&l.column?t=l.column(e):(n===`database`||n===`schema`||n===`namespace`)&&l.namespace?t=l.namespace(e):(t=tx(e.item),e.aliasFor&&(t=`<div class="sql-hover-alias"><code>${ex(e.word.split(`.`)[0]??``)}</code> is an alias for <code>${ex(e.aliasFor)}</code></div>`+t))}if(!t)return{dom:document.createElement(`div`)};let n=document.createElement(`div`);return n.className=`cm-sql-hover-tooltip`,n.innerHTML=t,{dom:n}}}}}function $b(e={}){let{hoverTime:t=300}=e;return vt(Qb(e),{hoverTime:t})}function ex(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}function tx(e){let t=e.path.join(`.`),n=e.completion?.label||e.value||e.path[e.path.length-1]||`unknown`,r=`<div class="sql-hover-${e.semanticType}">`;switch(r+=`<div class="sql-hover-header"><strong>${n}</strong> <span class="sql-hover-type">${e.semanticType}</span></div>`,e.semanticType){case`database`:if(r+=`<div class="sql-hover-description">Database${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,e.namespace){let t=nx(e.namespace);t>0&&(r+=`<div class="sql-hover-children">Contains ${t} schema${t===1?``:`s`}</div>`)}break;case`schema`:if(r+=`<div class="sql-hover-description">Schema${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,t&&(r+=`<div class="sql-hover-path"><strong>Path:</strong> <code>${t}</code></div>`),e.namespace){let t=nx(e.namespace);t>0&&(r+=`<div class="sql-hover-children">Contains ${t} table${t===1?``:`s`}</div>`)}break;case`table`:if(r+=`<div class="sql-hover-description">Table${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,t){let t=e.path;t.length>1&&(r+=`<div class="sql-hover-path"><strong>Schema:</strong> <code>${t.slice(0,-1).join(`.`)}</code></div>`)}if(e.namespace&&Ty(e.namespace)){let t=e.namespace;if(t.length>0){r+=`<div class="sql-hover-columns"><strong>Columns (${t.length}):</strong><br>`;let e=t.slice(0,8).map(e=>typeof e==`string`?e:e.label);r+=e.map(e=>`<code>${e}</code>`).join(`, `),t.length>8&&(r+=`, <em>and ${t.length-8} more...</em>`),r+=`</div>`}}break;case`column`:if(r+=`<div class="sql-hover-description">Column${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,t){let t=e.path;t.length>1&&(r+=`<div class="sql-hover-path"><strong>Table:</strong> <code>${t.slice(0,-1).join(`.`)}</code></div>`)}break;default:if(r+=`<div class="sql-hover-description">Namespace${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,t&&(r+=`<div class="sql-hover-path"><strong>Path:</strong> <code>${t}</code></div>`),e.namespace){let t=nx(e.namespace);t>0&&(r+=`<div class="sql-hover-children">Contains ${t} item${t===1?``:`s`}</div>`)}}return e.completion?.info&&typeof e.completion.info==`string`&&(r+=`<div class="sql-hover-info">${e.completion.info}</div>`),r+=`</div>`,r}function nx(e){return Array.isArray(e)?e.length:typeof e==`object`&&e?`self`in e&&`children`in e?1+nx(e.children):Object.keys(e).length:0}function rx(e){let{keyword:t,info:n}=e,r=`<div class="sql-hover-keyword">`;if(r+=`<div class="sql-hover-header"><strong>${t.toUpperCase()}</strong> <span class="sql-hover-type">keyword</span></div>`,r+=`<div class="sql-hover-description">${n.description}</div>`,n.syntax&&(r+=`<div class="sql-hover-syntax"><strong>Syntax:</strong> <code>${n.syntax}</code></div>`),n.example&&(r+=`<div class="sql-hover-example"><strong>Example:</strong><br><code>${n.example}</code></div>`),n.metadata&&typeof n.metadata==`object`&&Object.keys(n.metadata).length>0){r+=`<div class="sql-hover-metadata">`;for(let[e,t]of Object.entries(n.metadata))r+=`<span class="sql-hover-tag" title="${e}">${t}</span> `;r+=`</div>`}return r+=`</div>`,r}function ix(e){let{tableName:t,columns:n,metadata:r}=e,i=`<div class="sql-hover-table">`;if(i+=`<div class="sql-hover-header"><strong>${t}</strong> <span class="sql-hover-type">table</span></div>`,i+=`<div class="sql-hover-description">Table with ${n.length} column${n.length===1?``:`s`}</div>`,n.length>0){i+=`<div class="sql-hover-columns"><strong>Columns:</strong><br>`;let e=n.slice(0,10);i+=e.map(e=>`<code>${e}</code>`).join(`, `),n.length>10&&(i+=`, <em>and ${n.length-10} more...</em>`),i+=`</div>`}if(r&&typeof r==`object`&&Object.keys(r).length>0){i+=`<div class="sql-hover-metadata">`;for(let[e,t]of Object.entries(r))i+=`<span class="sql-hover-tag" title="${e}">${t}</span> `;i+=`</div>`}return i+=`</div>`,i}function ax(e){let{tableName:t,columnName:n,schema:r,metadata:i}=e,a=`<div class="sql-hover-column">`;a+=`<div class="sql-hover-header"><strong>${n}</strong> <span class="sql-hover-type">column</span></div>`,a+=`<div class="sql-hover-description">Column in table <code>${t}</code></div>`;let o=r[t];if(o&&o.length>1){let e=o.filter(e=>e!==n);if(e.length>0){a+=`<div class="sql-hover-related"><strong>Other columns in ${t}:</strong><br>`;let n=e.slice(0,8);a+=n.map(e=>`<code>${e}</code>`).join(`, `),e.length>8&&(a+=`, <em>and ${e.length-8} more...</em>`),a+=`</div>`}}if(i&&typeof i==`object`&&Object.keys(i).length>0){a+=`<div class="sql-hover-metadata">`;for(let[e,t]of Object.entries(i))a+=`<span class="sql-hover-tag" title="${e}">${t}</span> `;a+=`</div>`}return a+=`</div>`,a}var ox={keyword:rx,table:ix,column:ax,namespace:tx},sx=(e=`light`)=>{let t=e===`dark`?{tooltipBg:`#1f2937`,tooltipBorder:`#374151`,tooltipText:`#f9fafb`,tooltipTypeBg:`#374151`,tooltipTypeText:`#9ca3af`,tooltipChildren:`#9ca3af`,codeBg:`#374151`,codeText:`#f3f4f6`,strong:`#ffffff`,em:`#9ca3af`,header:`#ffffff`,info:`#d1d5db`,related:`#d1d5db`,path:`#d1d5db`,example:`#d1d5db`,columns:`#d1d5db`,syntax:`#d1d5db`}:{tooltipBg:`#ffffff`,tooltipBorder:`#e5e7eb`,tooltipText:`#374151`,tooltipTypeBg:`#f3f4f6`,tooltipTypeText:`#6b7280`,tooltipChildren:`#6b7280`,codeBg:`#f9fafb`,codeText:`#1f2937`,strong:`#111827`,em:`#6b7280`,header:`#111827`,info:`#374151`,related:`#374151`,path:`#374151`,example:`#374151`,columns:`#374151`,syntax:`#374151`};return V.theme({".cm-sql-hover-tooltip":{padding:`8px 12px`,backgroundColor:t.tooltipBg,border:`1px solid ${t.tooltipBorder}`,borderRadius:`6px`,boxShadow:`0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)`,fontSize:`13px`,lineHeight:`1.4`,maxWidth:`320px`,fontFamily:`system-ui, -apple-system, sans-serif`,color:t.tooltipText},".cm-sql-hover-tooltip .sql-hover-header":{marginBottom:`6px`,display:`flex`,alignItems:`center`,gap:`6px`,color:t.header},".cm-sql-hover-tooltip .sql-hover-type":{fontSize:`11px`,padding:`2px 6px`,backgroundColor:t.tooltipTypeBg,color:t.tooltipTypeText,borderRadius:`4px`,fontWeight:`500`},".cm-sql-hover-tooltip .sql-hover-description":{color:t.info,marginBottom:`8px`},".cm-sql-hover-tooltip .sql-hover-syntax":{marginBottom:`8px`,color:t.syntax},".cm-sql-hover-tooltip .sql-hover-example":{marginBottom:`4px`,color:t.example},".cm-sql-hover-tooltip .sql-hover-columns":{marginBottom:`4px`,color:t.columns},".cm-sql-hover-tooltip .sql-hover-related":{marginBottom:`4px`,color:t.related},".cm-sql-hover-tooltip .sql-hover-path":{marginBottom:`4px`,color:t.path},".cm-sql-hover-tooltip .sql-hover-info":{marginBottom:`4px`,color:t.info},".cm-sql-hover-tooltip .sql-hover-alias":{marginBottom:`6px`,color:t.tooltipChildren,fontSize:`12px`},".cm-sql-hover-tooltip .sql-hover-children":{marginBottom:`4px`,color:t.tooltipChildren,fontSize:`12px`},".cm-sql-hover-tooltip code":{backgroundColor:t.codeBg,padding:`1px 4px`,borderRadius:`3px`,fontSize:`12px`,fontFamily:`ui-monospace, 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace`,color:t.codeText},".cm-sql-hover-tooltip strong":{fontWeight:`600`,color:t.strong},".cm-sql-hover-tooltip em":{fontStyle:`italic`,color:t.em}})};function cx(e){return e.resolver??new Rb(e)}var lx=V.baseTheme({".cm-sqlReference":{backgroundColor:`rgba(96, 165, 250, 0.18)`},".cm-sqlReference.cm-sqlDefinition":{backgroundColor:`rgba(96, 165, 250, 0.35)`},".cm-sqlGotoTarget":{textDecoration:`underline`,cursor:`pointer`}}),ux=z.mark({class:`cm-sqlReference`}),dx=z.mark({class:`cm-sqlReference cm-sqlDefinition`}),fx=z.mark({class:`cm-sqlGotoTarget`});function px(e){return z.set(e.references.map(t=>(t.from===e.definition.from?dx:ux).range(t.from,t.to)),!0)}var mx=$e.define(),hx=He.define({create:()=>z.none,update(e,t){for(let e of t.effects)if(e.is(mx))return e.value;return t.docChanged?e.map(t.changes):e},provide:e=>V.decorations.from(e)});function gx(e={}){let t=cx(e),n=e.highlightDelay??150;return[hx,_t.fromClass(class{view;timer=null;generation=0;constructor(e){this.view=e,this.schedule()}update(e){(e.selectionSet||e.docChanged)&&this.schedule()}schedule(){this.generation++,this.timer!=null&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=null,this.run()},n)}async run(){let e=this.generation,n=this.view.state,r=n.selection.main,i=z.none;if(r.empty)try{let e=await t.resolve(n,r.head);e&&(i=px(e))}catch{}if(e!==this.generation)return;let a=this.view.state.field(hx,!1);(i.size!==0||a!=null&&a.size!==0)&&this.view.dispatch({effects:mx.of(i)})}destroy(){this.generation++,this.timer!=null&&clearTimeout(this.timer)}}),lx]}async function _x(e,t,n={}){let r=e.state,i=t??r.selection.main.head,a=await cx(n).resolve(r,i);return!a||e.state!==r?!1:(e.dispatch({selection:{anchor:a.definition.from,head:a.definition.to},scrollIntoView:!0,userEvent:`select`}),!0)}var vx=$e.define(),yx=He.define({create:()=>z.none,update(e,t){for(let e of t.effects)if(e.is(vx))return e.value;return t.docChanged?e.map(t.changes):e},provide:e=>V.decorations.from(e)});function bx(e={}){let t=cx(e);return[yx,_t.fromClass(class{view;hovered=null;constructor(e){this.view=e}update(e){e.docChanged&&(this.hovered=null)}resultAt(e){return this.hovered&&e>=this.hovered.from&&e<=this.hovered.to?this.hovered.result:null}clear(){if(this.hovered){this.hovered=null;let e=this.view.state.field(yx,!1);e&&e.size>0&&this.view.dispatch({effects:vx.of(z.none)})}}async hover(e){let n=Sb(this.view.state,e);if(!n){this.clear();return}if(this.hovered&&this.hovered.from===n.from&&this.hovered.to===n.to)return;let r={from:n.from,to:n.to,result:null};this.hovered=r;let i=this.view.state;try{let a=await t.resolve(i,e);if(this.hovered!==r||this.view.state!==i)return;r.result=a,this.view.dispatch({effects:vx.of(a?z.set([fx.range(n.from,n.to)]):z.none)})}catch{}}destroy(){this.hovered=null}},{eventHandlers:{mousemove(e,t){if(!(e.metaKey||e.ctrlKey)){this.clear();return}let n=t.posAtCoords({x:e.clientX,y:e.clientY});if(n==null){this.clear();return}this.hover(n)},mousedown(e,t){if(!(e.metaKey||e.ctrlKey)||e.button!==0)return!1;let n=t.posAtCoords({x:e.clientX,y:e.clientY});if(n==null)return!1;let r=this.resultAt(n);return r?(t.dispatch({selection:{anchor:r.definition.from,head:r.definition.to},scrollIntoView:!0,userEvent:`select.pointer`}),!0):!1}}}),lx]}var xx=e=>typeof window<`u`&&typeof window.prompt==`function`?window.prompt(`Rename '${e}' to:`,e):null,Sx=/^[A-Za-z_][\w$]*$/,Cx=new Set(`all.and.as.asc.between.by.case.cross.delete.desc.distinct.else.end.except.exists.fetch.from.full.group.having.in.inner.insert.intersect.into.is.join.lateral.left.like.limit.natural.not.null.offset.on.or.order.outer.qualify.recursive.right.select.set.table.then.union.update.using.values.when.where.window.with`.split(`.`));async function wx(e,t={}){let n=e.state,r=await cx(t).resolve(n,n.selection.main.head);if(!r)return!1;let i=await(t.prompt??xx)(r.name);return!i||i===r.name||!Sx.test(i)||Cx.has(i.toLowerCase())||e.state!==n?!1:(e.dispatch({changes:r.references.map(e=>({from:e.from,to:e.to,insert:i})),userEvent:`rename`}),!0)}function Tx(e={}){let t={...e,resolver:cx(e)},n=e.gotoDefinitionKeys??[`F12`,`Mod-b`],r=e.renameKey??`F2`;return Ke.of([...n.map(e=>({key:e,run:e=>(_x(e,void 0,t),!0)})),{key:r,run:e=>(wx(e,t),!0)}])}function Ex(e={}){let t={...e,resolver:cx(e)},n=[gx(t),bx(t)];return e.keymap&&n.push(Tx(t)),n}var Dx=750;function Ox(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&e.type===`select`}function kx(e){return Array.isArray(e)?e:[]}function Ax(e){return{sources:[],columnRefs:[],selectAliases:new Set,checkUnqualified:e,hasUsingJoin:!1}}function jx(e,t,n){let r=kx(e.with);for(let e of r){let n=e.name,r=typeof n==`string`?n:n?.value;typeof r==`string`&&t.add(r.toLowerCase())}for(let e of r){let r=e.stmt,i=r?.ast??r;Ox(i)&&Px(i,t,n,!1)}}function Mx(e,t,n,r){e.using!=null&&(t.hasUsingJoin=!0),typeof e.join==`string`&&e.join.toLowerCase().includes(`natural`)&&(t.hasUsingJoin=!0),e.on!=null&&Nx(e.on,t,n,r);let i=e.expr;if(i!=null){let a=i.ast??i;Ox(a)&&Px(a,n,r,!1),t.sources.push({path:``,name:``,alias:typeof e.as==`string`?e.as:null,isCte:!1,opaque:!0});return}if(typeof e.table==`string`){let r=[e.db??e.catalog,e.schema,e.table].filter(e=>typeof e==`string`&&e.length>0);t.sources.push({path:r.join(`.`),name:e.table,alias:typeof e.as==`string`?e.as:null,isCte:r.length===1&&n.has(e.table.toLowerCase()),opaque:!1})}}function Nx(e,t,n,r){if(typeof e!=`object`||!e)return;if(Array.isArray(e)){for(let i of e)Nx(i,t,n,r);return}let i=e;if(i.type===`column_ref`){t.columnRefs.push(i);return}if(Ox(i)){Px(i,n,r,!0);return}if(Ox(i.ast)){Px(i.ast,n,r,!0);return}for(let[e,a]of Object.entries(i))e!==`loc`&&e!==`tableList`&&e!==`columnList`&&Nx(a,t,n,r)}function Px(e,t,n,r){let i=new Set(t);jx(e,i,n);let a=Ax(!r);n.push(a);for(let t of kx(e.from))Mx(t,a,i,n);for(let t of kx(e.columns))typeof t.as==`string`&&a.selectAliases.add(t.as.toLowerCase());for(let[t,r]of Object.entries(e))t!==`with`&&t!==`from`&&t!==`loc`&&Nx(r,a,i,n)}function Fx(e,t){let n=new Set;switch(e.type){case`select`:Px(e,n,t,!1);return;case`update`:{jx(e,n,t);let r=Ax(!0);t.push(r);for(let i of kx(e.table))Mx(i,r,n,t);for(let i of kx(e.from))Mx(i,r,n,t);for(let i of kx(e.set))i.column!=null&&r.columnRefs.push({type:`column_ref`,table:i.table??null,column:i.column}),Nx(i.value,r,n,t);for(let[i,a]of Object.entries(e))i!==`with`&&i!==`table`&&i!==`from`&&i!==`set`&&i!==`loc`&&Nx(a,r,n,t);return}case`delete`:{jx(e,n,t);let r=Ax(!0);t.push(r);for(let i of kx(e.from))Mx(i,r,n,t);for(let[i,a]of Object.entries(e))i!==`with`&&i!==`table`&&i!==`from`&&i!==`loc`&&Nx(a,r,n,t);return}case`insert`:case`replace`:{jx(e,n,t);let r=Ax(!1);t.push(r);for(let i of kx(e.table))Mx(i,r,n,t);for(let[i,a]of Object.entries(e))i!==`with`&&i!==`table`&&i!==`columns`&&i!==`loc`&&(Ox(a)?Px(a,n,t,!1):Nx(a,r,n,t));return}case`create`:case`alter`:case`drop`:{let r=Ax(!1);t.push(r);for(let[i,a]of Object.entries(e))i!==`table`&&i!==`loc`&&(Ox(a)?Px(a,n,t,!1):Nx(a,r,n,t));return}default:{let r=Ax(!1);t.push(r);for(let[i,a]of Object.entries(e))i!==`loc`&&Nx(a,r,n,t)}}}function Ix(e){let t=e.column;if(typeof t==`string`)return t;if(typeof t==`object`&&t){let e=t.expr?.value??t.value;if(typeof e==`string`)return e}return null}function Lx(e){return typeof e.table!=`string`||e.table.length===0?null:typeof e.db==`string`&&e.db.length>0?`${e.db}.${e.table}`:e.table}function Rx(e){if(e==null)return null;let t=wy(e)?e.children:e;return Ty(t)?t.map(e=>typeof e==`string`?e:e.label):null}function zx(e,t){let n=Dy(e,t,{caseSensitive:!1});if(n)return{exists:!0,columns:Rx(n.namespace)};let r=t.split(`.`).map(e=>e.toLowerCase()),i=r[r.length-1];if(!i)return{exists:!1,columns:null};let a=jy(e,i).filter(e=>{if(Rx(e.namespace)===null||e.path.length<r.length)return!1;let t=e.path.slice(-r.length).map(e=>e.toLowerCase());return r.every((e,n)=>t[n]===e)});return a.length===0?{exists:!1,columns:null}:{exists:!0,columns:a.length===1?Rx(a[0]?.namespace):null}}function Bx(e,t){let n=t.toLowerCase();return e.some(e=>e.toLowerCase()===n)}function Vx(e,t){let n=[];Fx(e,n);let r=new Map,i=e=>{let t=`${e.kind}::${e.identifier.toLowerCase()}`;r.has(t)||r.set(t,e)};for(let e of n){let n=e.sources.map(e=>{if(e.opaque||e.isCte)return{source:e,exists:!0,columns:null};let n=zx(t,e.path);return{source:e,exists:n.exists,columns:n.columns}});for(let{source:e,exists:t}of n)!e.opaque&&!e.isCte&&!t&&i({kind:`unknownTable`,identifier:e.name,message:`Unknown table '${e.path}'`});for(let t of e.columnRefs){let r=Ix(t);if(!r||r===`*`)continue;let a=Lx(t);if(a){let e=a.toLowerCase(),t=n.find(t=>t.source.alias?.toLowerCase()===e)??n.find(t=>t.source.name.toLowerCase()===e||t.source.path.toLowerCase()===e);t?.columns&&!Bx(t.columns,r)&&i({kind:`unknownColumn`,identifier:r,message:`Column '${r}' not found in table '${t.source.path||a}'`});continue}if(!e.checkUnqualified||e.selectAliases.has(r.toLowerCase()))continue;let o=n.filter(e=>e.columns!==null&&Bx(e.columns,r));if(o.length>=2&&!e.hasUsingJoin){i({kind:`ambiguousColumn`,identifier:r,message:`Column '${r}' is ambiguous; it exists in ${o.map(e=>e.source.name).join(`, `)}`});continue}let s=n.length===1?n[0]:void 0;s&&s.columns!==null&&o.length===0&&i({kind:`unknownColumn`,identifier:r,message:`Column '${r}' not found in table '${s.source.path}'`})}}return[...r.values()]}function Hx(e,t){let n=e.toLowerCase(),r=t.toLowerCase(),i=n.indexOf(r);for(;i!==-1;){let e=i>0?n[i-1]??``:``,t=n[i+r.length]??``;if(!/[\w$]/.test(e)&&!/[\w$]/.test(t))return i;i=n.indexOf(r,i+1)}return-1}function Ux(e,t,n,r){let i=n.sliceString(t.from,t.to),a=Hx(i,e.identifier),o=a===-1?t.from:t.from+a;return{from:o,to:Math.min(a===-1?t.from+(i.match(/^[\w"'`.]+/)?.[0].length??1):o+e.identifier.length,t.to),severity:r,message:e.message,source:`sql-schema`}}function Wx(e){return Ty(e)?e.length===0:Cy(e)?Object.keys(e).length===0:!1}function Gx(e={}){let t=e.parser||new Vy,n=e.structureAnalyzer||new mb(t),r={unknownTable:e.severity?.unknownTable??`warning`,unknownColumn:e.severity?.unknownColumn??`warning`,ambiguousColumn:e.severity?.ambiguousColumn??`warning`};return async i=>{let a=Fy(e.schema,i);if(a==null||Wx(a))return[];let o=i.state.doc;if(!o.toString().trim())return[];let s=[],c=await n.analyzeDocument(i.state);for(let e of c){if(!e.isValid)continue;let n=await t.parse(e.content,{state:i.state});if(!n.success||n.ast==null)continue;let c=Array.isArray(n.ast)?n.ast:[n.ast];for(let t of c)for(let n of Vx(t,a)){let t=r[n.kind];t!==`off`&&s.push(Ux(n,e,o,t))}}return s}}function Kx(e={}){return It(Gx(e),{delay:e.delay||Dx})}var qx=$e.define(),Jx=He.define({create(){return{currentStatement:null,allStatements:[],cursorPosition:0,isFocused:!0}},update(e,t){for(let e of t.effects)if(e.is(qx))return e.value;return e}});function Yx(e,t){let{isCurrent:n,isValid:r,isFocused:i}=t,a=e.backgroundColor||`#3b82f6`;!r&&e.showInvalid!==!1&&(a=e.errorBackgroundColor||`#ef4444`);let o=n?`1`:(e.inactiveOpacity??.3).toString(),s;return s=i?o:e.unfocusedOpacity===void 0?e.hideWhenNotFocused?`0`:o:e.unfocusedOpacity.toString(),{backgroundColor:a,opacity:s}}var Xx=class extends rt{config;isCurrent;isValid;isFocused;constructor(e,t,n=!0,r=!0){super(),this.config=e,this.isCurrent=t,this.isValid=n,this.isFocused=r}toDOM(){let e=document.createElement(`div`);e.className=`cm-sql-gutter-marker`;let{backgroundColor:t,opacity:n}=Yx(this.config,{isCurrent:this.isCurrent,isValid:this.isValid,isFocused:this.isFocused});return e.style.cssText=`
|
|
113
|
-
background: ${t};
|
|
114
|
-
height: 100%;
|
|
115
|
-
width: 100%;
|
|
116
|
-
opacity: ${n};
|
|
117
|
-
transition: opacity 150ms ease-in-out;
|
|
118
|
-
border-radius: 1px;
|
|
119
|
-
`,e}eq(e){return this.isCurrent===e.isCurrent&&this.isValid===e.isValid&&this.isFocused===e.isFocused&&this.config===e.config}};function Zx(e,t){let n=Le.empty;if(t.whenHide?.(e))return n;let r=e.state.field(Jx,!1);if(!r)return n;let{currentStatement:i,allStatements:a,isFocused:o}=r;try{let r=e.state.doc.lineAt(e.viewport.from).number,s=e.state.doc.lineAt(e.viewport.to).number;for(let c of a){if(c.lineTo<r||c.lineFrom>s)continue;let a=i?.from===c.from&&i?.to===c.to;if(!c.isValid&&t.showInvalid===!1)continue;let l=new Xx(t,a,c.isValid,o),u=Math.max(c.lineFrom,r),d=Math.min(c.lineTo,s);for(let t=u;t<=d;t++)try{if(t<1||t>e.state.doc.lines)continue;let r=e.state.doc.line(t);n=n.update({add:[l.range(r.from)]})}catch(e){console.warn(`SqlGutter: Invalid line number`,t,e)}}}catch(e){console.warn(`SqlGutter: Error creating markers`,e)}return n}async function Qx(e,t){let{state:n}=e,r=n.selection.main.head,i=await t.analyzeDocument(n),a={currentStatement:await t.getStatementAtPosition(n,r),allStatements:i,cursorPosition:r,isFocused:e.hasFocus};e.dispatch({effects:qx.of(a)})}function $x(e){return _t.define(t=>(Qx(t,e),{update(t){!t.docChanged&&!t.selectionSet&&!t.focusChanged||Qx(t.view,e)}}))}function eS(e){let t=e.width||3;return V.baseTheme({".cm-sql-gutter":{width:`${t}px`,minWidth:`${t}px`},".cm-sql-gutter .cm-gutterElement":{width:`${t}px`,padding:`0`,margin:`0`},".cm-sql-gutter-marker":{width:`100%`,height:`100%`,display:`block`},".cm-lineNumbers .cm-gutterElement":{paddingLeft:`8px`,paddingRight:`8px`}})}function tS(e){return nt({class:`cm-sql-gutter ${e.className||``}`,markers:t=>Zx(t,e)})}function nS(e={}){return[Jx,$x(new mb(e.parser||new Vy)),eS(e),tS(e)]}function rS(e={}){let t=[],{schema:n,enableLinting:r=!0,enableSemanticLinting:i=!0,enableGutterMarkers:a=!0,enableHover:o=!0,enableNavigation:s=!0,linterConfig:c,semanticLinterConfig:l,gutterConfig:u,hoverConfig:d,navigationConfig:f}=e;if(n!=null&&t.push(Py.of(n)),r&&t.push(Yb(c)),i){let e=l?.parser??c?.parser,n=l?.structureAnalyzer??(l?.parser==null?c?.structureAnalyzer:void 0);t.push(Kx({...l,parser:e,structureAnalyzer:n}))}if(a&&t.push(nS(u)),o&&(t.push($b(d)),t.push(d?.theme??sx())),s){let e=f?.parser??c?.parser,n=f?.structureAnalyzer??(f?.parser==null?c?.structureAnalyzer:void 0);t.push(...Ex({...f,parser:e,structureAnalyzer:n}))}return t}var iS=class e{delegate;toKey;cache;static jsonStringifySortKeys(){return e=>typeof e!=`object`||!e?String(e):JSON.stringify(e,Object.keys(e).toSorted(),2)}constructor(t,n={}){this.delegate=t,this.toKey=n.toKey??e.jsonStringifySortKeys();let r=n.maxSize??128;this.cache=new hd(r)}request(e){let t=this.toKey(e),n=this.cache.get(t);if(n!==void 0)return n;let r=this.delegate.request(e);return this.cache.set(t,r),r.catch(e=>{throw this.cache.delete(t),e})}resolve(e,t){this.delegate.resolve(e,t)}reject(e,t){this.delegate.reject(e,t)}},aS=new Mn(`data-source-discovery-result`,async e=>{await sn().discoverDataSources({requestId:e})}),oS=new Mn(`sql-table-preview`,async(e,t)=>{await sn().previewSQLTable({requestId:e,...t})}),sS=new Mn(`sql-schema-list-preview`,async(e,t)=>{await sn().previewSQLSchemaList({requestId:e,...t})}),cS=new Mn(`sql-table-list-preview`,async(e,t)=>{await sn().previewSQLTableList({requestId:e,...t})}),lS=new iS(new Mn(`validate-sql`,async(e,t)=>{await sn().validateSQL({requestId:e,...t})}),{maxSize:3}),uS=o(new Map),dS=e=>{let t=(0,Qd.c)(3),n=s(uS),r;return t[0]!==e||t[1]!==n?(r=n.get(e),t[0]=e,t[1]=n,t[2]=r):r=t[2],r};function fS(e){let t=u.get(uS),n=new Map(t);n.delete(e),u.set(uS,n)}function pS(){u.set(uS,new Map)}function mS({cellId:e,errorMessage:t,dialect:n}){let r=u.get(uS),i=new Map(r),a=n===`DuckDB`?hS(t):gS(t);i.set(e,a),u.set(uS,i)}function hS(e){let{errorType:t,errorMessage:n}=gS(e),r=n,i,a=n.indexOf(`LINE `);return a!==-1&&(i=n.slice(Math.max(0,a)).trim(),r=n.slice(0,Math.max(0,a)).trim()),{errorType:t,errorMessage:r,codeblock:i}}function gS(e){return{errorType:e.split(`:`)[0].trim(),errorMessage:e.split(`:`).slice(1).join(`:`).trim()}}function _S(e){return e.field(tv)}function vS(){return e=>{let t=_S(e.state).engine,n=Mf.getCompletionSource(t);return n&&un(n)(e)||null}}function yS(){return e=>{let t=_S(e.state).engine,n=Mf.getDialect(t);return e.matchBefore(/\.\w*/)?null:yn(n,!0,(e,t)=>({label:e,type:t,info:async()=>{let t=(await bS())[e.toLocaleLowerCase()];if(!t)return null;let n=document.createElement(`div`);return n.innerHTML=ox.keyword({keyword:e,info:t}),n}}))(e)}}var bS=Gt(async()=>{let e=await H(()=>import(`./common-keywords-FICkW4yv.js`),[],import.meta.url),t=await H(()=>import(`./duckdb-keywords-iJc26n2t.js`),[],import.meta.url);return{...e.default.keywords,...t.default.keywords}}),xS=Zi(`marimo:notebook-sql-mode`,`default`,am);function SS(){let e=(0,Qd.c)(3),[t,n]=a(xS),r;return e[0]!==n||e[1]!==t?(r={sqlMode:t,setSQLMode:n},e[0]=n,e[1]=t,e[2]=r):r=e[2],r}function CS(){return u.get(xS)}var wS=Du,TS=`DuckDB`,ES=new L;function DS(){return u.get(cd).latestEngineSelected}var OS=class{parser=new wp;type=`sql`;sqlModeEnabled;constructor(){this.sqlModeEnabled=!0}get defaultMetadata(){return{...this.parser.defaultMetadata,engine:DS()||`__marimo_duckdb`}}get defaultCode(){let e=DS();return e&&e!==`__marimo_duckdb`?`_df = mo.sql(f"""SELECT * FROM """, engine=${e})`:this.parser.defaultCode}static fromQuery=e=>wp.fromQuery(e);transformIn(e){this.parser.defaultMetadata.engine=DS()||`__marimo_duckdb`;let t=this.parser.transformIn(e),n=t.metadata;return n.engine&&n.engine!==`__marimo_duckdb`&&fd(n.engine),[t.code,t.offset,n]}transformOut(e,t){let n=this.parser.transformOut(e,t);return[n.code,n.offset]}isSupported(e){return this.parser.isSupported(e)}getExtension(e,t,n,r,i){let a=kS(),o=[ES.of(dn({dialect:wS})),Ke.of([{key:`Tab`,run:e=>Zt(e)||bt(e),preventDefault:!0}]),en({defaultKeymap:!1,activateOnTyping:!0,override:[vS(),W_,yS(),a.cteCompletionSource,a.aliasCompletionSource,a.columnCompletionSource]})];if(i?.diagnostics?.sql_linter??!1){let e=u.get(Wn),t=new NS({getParserOptions:e=>({database:VS(e)??TS})});o.push(rS({schema:zS,enableLinting:!0,linterConfig:{delay:250,parser:t,perStatement:!1},enableSemanticLinting:!0,semanticLinterConfig:{parser:a.parser,structureAnalyzer:a.structureAnalyzer,severity:{unknownTable:`off`,unknownColumn:`warning`,ambiguousColumn:`warning`}},enableGutterMarkers:!0,gutterConfig:{backgroundColor:`#3b82f6`,errorBackgroundColor:`#ef4444`,hideWhenNotFocused:!0,parser:t},hoverConfig:{hoverTime:300,enableKeywords:!0,enableTables:!0,enableColumns:!0,parser:a.parser,contextAnalyzer:a.contextAnalyzer,theme:sx(e)},enableNavigation:!0,navigationConfig:{contextAnalyzer:a.contextAnalyzer,keymap:!1,parser:a.parser,structureAnalyzer:a.structureAnalyzer}}),V.updateListener.of(e=>{e.focusChanged&&t.setFocusState(e.view.hasFocus)}))}return this.sqlModeEnabled&&o.push(WS()),o}};function kS(){let e=new Vy({getParserOptions:e=>({database:AS(e)})}),t=new jS(e),n=new MS(e);return{parser:e,contextAnalyzer:t,structureAnalyzer:n,cteCompletionSource:Wb({parser:e,contextAnalyzer:t,structureAnalyzer:n}),aliasCompletionSource:hb({schema:zS,parser:e,contextAnalyzer:t}),columnCompletionSource:yb({schema:zS,parser:e,contextAnalyzer:t})}}function AS(e){return VS(e)??TS}var jS=class extends pb{analyzers=new Map;analysisParser;constructor(e){super(e),this.analysisParser=e}getContext(e,t){return this.getAnalyzer(t.state).getContext(e,t)}clearCache(){for(let e of this.analyzers.values())e.clearCache()}getAnalyzer(e){let t=AS(e),n=this.analyzers.get(t);return n||(n=new pb(this.analysisParser),this.analyzers.set(t,n)),n}},MS=class extends mb{analyzers=new Map;analysisParser;constructor(e){super(e),this.analysisParser=e}analyzeDocument(e){return this.getAnalyzer(e).analyzeDocument(e)}getStatementAtPosition(e,t){return this.getAnalyzer(e).getStatementAtPosition(e,t)}getStatementsInRange(e,t,n){return this.getAnalyzer(e).getStatementsInRange(e,t,n)}clearCache(){for(let e of this.analyzers.values())e.clearCache()}getAnalyzer(e){let t=AS(e),n=this.analyzers.get(t);return n||(n=new mb(this.analysisParser),this.analyzers.set(t,n)),n}},NS=class extends Vy{validationTimeout=null;pendingValidationResolve=null;VALIDATION_DELAY_MS=300;isFocused=!1;setFocusState(e){this.isFocused=e}resolvePendingValidation(e){this.pendingValidationResolve?.(e),this.pendingValidationResolve=null}async validateWithDelay(e,t,n){return this.validationTimeout&&(window.clearTimeout(this.validationTimeout),this.resolvePendingValidation([])),new Promise(r=>{this.pendingValidationResolve=r,this.validationTimeout=window.setTimeout(async()=>{if(this.validationTimeout=null,!this.isFocused){this.resolvePendingValidation([]);return}try{let r=await GS(e,t,n,Pu.has(t)?CS():`default`);if(r.error){T.error(`Failed to validate SQL`,{error:r.error}),this.resolvePendingValidation([]);return}this.resolvePendingValidation(r.parse_result?.errors??[])}catch(e){T.error(`Failed to validate SQL`,{error:e}),this.resolvePendingValidation([])}},this.VALIDATION_DELAY_MS)})}async validateSql(e,t){let n=RS(t.state),r=HS(n.engine);return this.isFocused?PS(n.engine,r)?this.validateWithDelay(e,n.engine,r??TS):super.validateSql(e,t):[]}async parse(e,t){let n=RS(t.state).engine;return PS(n,HS(n))?{success:!0,errors:[]}:super.parse(e,t)}};function PS(e,t){return e===`__marimo_duckdb`||t===`DuckDB`}function FS(e,t){e.dispatch({effects:ES.reconfigure(dn({dialect:t}))})}function IS(e,t){FS(e,Mf.getDialect(t))}function LS(e){let t=RS(e.state).engine;FS(e,Mf.getDialect(t))}function RS(e){return e.field(tv)}function zS(e){let t=RS(e.state).engine,n=Mf.getCompletionSource(t);if(!n?.schema)return{};let r=n.schema;if(!BS(r))return r;let i=n.defaultSchema,a=i?r[i]:void 0;return a&&!Array.isArray(a)&&typeof a==`object`&&`children`in a&&BS(a.children)?{...r,...Object.fromEntries(Object.entries(a.children).filter(([e])=>!Object.hasOwn(r,e)))}:r}function BS(e){if(Array.isArray(e))return!1;if(!(`self`in e)||!(`children`in e))return!0;let t=e.self;return!(typeof t==`object`&&t&&!Array.isArray(t)&&`label`in t&&typeof t.label==`string`)}function VS(e){let t=RS(e).engine;return HS(t)}function HS(e){let t=Mf.getInternalDialect(e)?.toLowerCase();if(!t||!ku(t))return null;switch(t){case`postgresql`:case`postgres`:return`PostgreSQL`;case`db2`:case`db2i`:return`DB2`;case`mysql`:return`MySQL`;case`sqlite`:return`Sqlite`;case`mssql`:case`sqlserver`:case`microsoft sql server`:return`TransactSQL`;case`duckdb`:return`DuckDB`;case`mariadb`:return`MariaDB`;case`cassandra`:return`Noql`;case`athena`:case`awsathena`:return`Athena`;case`bigquery`:return`BigQuery`;case`hive`:return`Hive`;case`redshift`:return`Redshift`;case`snowflake`:return`Snowflake`;case`flink`:return`FlinkSQL`;case`mongodb`:case`noql`:return`Noql`;case`oracle`:case`oracledb`:case`timescaledb`:case`couchbase`:case`trino`:case`tidb`:case`singlestoredb`:case`spark`:case`databricks`:case`datafusion`:case`dremio`:return T.debug(`Unsupported dialect`,{dialect:t}),null;default:return rn(t),null}}var US=300;function WS(){return _t.define(e=>{let t,n=null,r=e.state.facet(Cu);return{update(e){if(!e.docChanged)return;let i=CS();if(i==="default")return;let a=RS(e.state).engine;if(!Pu.has(a))return;let o=e.state.doc.toString();t&&window.clearTimeout(t),t=window.setTimeout(async()=>{if(n!==o){if(n=o,o===``){fS(r);return}try{let e=HS(a),t=(await GS(o,a,e,i)).validate_result;t?.error_message?mS({cellId:r,errorMessage:t.error_message,dialect:e}):fS(r)}catch(e){T.error(`Failed to validate SQL`,{error:e})}}},US)},destroy(){t&&window.clearTimeout(t),fS(r)}}})}async function GS(e,t,n,r){let i=await lS.request({onlyParse:r==="default",engine:t,dialect:n,query:e});if(i.error)throw Error(i.error);return i}var KS=Gt(()=>new yy),qS=Gt(()=>new nv),JS=Gt(()=>new OS),YS={get python(){return KS()},get markdown(){return qS()},get sql(){return JS()}};function XS(){return Object.values(YS)}var ZS=U.forwardRef((e,t)=>{let n=(0,Qd.c)(13),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=oe(`flex items-center justify-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=oe(`flex items-center justify-center text-current max-h-[14px] overflow-hidden`),n[5]=o):o=n[5];let s;n[6]===i.checked?s=n[7]:(s=(0,W.jsx)(Nr,{className:o,children:i.checked===`indeterminate`?(0,W.jsx)(Pd,{className:`h-4 w-4`}):(0,W.jsx)(En,{className:`h-4 w-4`})}),n[6]=i.checked,n[7]=s);let c;return n[8]!==i||n[9]!==t||n[10]!==a||n[11]!==s?(c=(0,W.jsx)(jr,{ref:t,className:a,...i,children:s}),n[8]=i,n[9]=t,n[10]=a,n[11]=s,n[12]=c):c=n[12],c});ZS.displayName=jr.displayName;var QS=new Set(`__*.marimo.app.False.None.True.__peg_parser__.and.as.assert.async.await.break.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.nonlocal.not.or.pass.raise.return.try.while.with.yield.None.setup`.split(`.`));function $S(e,t=!0){return e=e.trim(),e?(/^\d/.test(e)&&(e=`_${e}`),e=e.replaceAll(/\W/g,`_`),t?e.toLowerCase():e):`_`}function eC(e,t){let n=new Set(t),r=e,i=e=>!n.has(e)&&!QS.has(e);if(i(e))return e;let a=1;for(;!i(r);)r=`${e}_${a}`,a++;return r}function tC(e,t){return nC(e)?`cell-${t}`:e}function nC(e){return!e||e===`_`||e===`__`}function rC(e){let t=(0,Qd.c)(15),{minWidth:n,padding:r}=e,i=n===void 0?70:n,a=r===void 0?15:r,[o,s]=(0,U.useState)(50),c=(0,U.useRef)(null),l=(0,U.useRef)(null),u;t[0]===a?u=t[1]:(u=e=>{if(l.current&&c.current){let t=l.current;t.style.fontSize=window.getComputedStyle(c.current).fontSize,t.style.fontFamily=window.getComputedStyle(c.current).fontFamily,t.textContent=e;let n=t.offsetWidth;s(n+a)}},t[0]=a,t[1]=u);let d=u,f;t[2]===d?f=t[3]:(f=()=>{d(c.current?.value??``)},t[2]=d,t[3]=f),Tn(f);let p;t[4]===d?p=t[5]:(p=e=>{d(e.target.value)},t[4]=d,t[5]=p);let m=`${o}px`,h=`${i}px`,g;t[6]!==m||t[7]!==h?(g={width:m,minWidth:h},t[6]=m,t[7]=h,t[8]=g):g=t[8];let _;t[9]!==p||t[10]!==g?(_={ref:c,type:`text`,onChange:p,style:g},t[9]=p,t[10]=g,t[11]=_):_=t[11];let v=_,y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y={ref:l,style:{visibility:`hidden`,position:`absolute`,whiteSpace:`pre`}},t[12]=y):y=t[12];let b=y,x;return t[13]===v?x=t[14]:(x={inputProps:v,spanProps:b},t[13]=v,t[14]=x),x}function iC({currentQuotePrefix:e,checked:t,prefix:n}){let r=e;return t?e===``?r=n:e!==`rf`&&n!==e&&(r=`rf`):e===n?r=``:e===`rf`&&(r=n===`r`?`f`:`r`),r}var aC=()=>{let e=(0,Qd.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsxs)(`section`,{className:`flex flex-col gap-0.5`,children:[(0,W.jsxs)(`header`,{className:`flex items-center gap-1`,children:[(0,W.jsx)(`code`,{className:`text-xs px-1 py-0.5 bg-(--slate-2) rounded`,children:`r`}),(0,W.jsx)(`span`,{className:`font-semibold`,children:`Raw String`})]}),(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Write LaTeX without escaping special characters`}),(0,W.jsx)(`pre`,{className:`text-xs bg-(--slate-2) p-2 rounded`,children:`\\alpha \\beta`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[t,(0,W.jsxs)(`section`,{className:`flex flex-col gap-0.5`,children:[(0,W.jsxs)(`header`,{className:`flex items-center gap-1`,children:[(0,W.jsx)(`code`,{className:`text-xs px-1 py-0.5 bg-(--slate-2) rounded`,children:`f`}),(0,W.jsx)(`span`,{className:`font-semibold`,children:`Format String`})]}),(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Interpolate Python values`}),(0,W.jsxs)(`pre`,{className:`text-xs bg-(--slate-2) p-2 rounded`,children:[`Hello `,`{name}`,`! 😁`]})]})]}),e[1]=n):n=e[1],n},oC=`data-cell-id`;function sC(e){return{[oC]:e}}var cC=`data-for-cell-id`;function lC(e){return{[cC]:e}}var uC=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClickHouse%3c/title%3e%3cpath%20d='M21.333%2010H24v4h-2.667ZM16%201.335h2.667v21.33H16Zm-5.333%200h2.666v21.33h-2.666ZM0%2022.665V1.335h2.667v21.33zm5.333-21.33H8v21.33H5.333Z'/%3e%3c/svg%3e`,dC=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDatabricks%3c/title%3e%3cpath%20d='M.95%2014.184L12%2020.403l9.919-5.55v2.21L12%2022.662l-10.484-5.96-.565.308v.77L12%2024l11.05-6.218v-4.317l-.515-.309L12%2019.118l-9.867-5.653v-2.21L12%2016.805l11.05-6.218V6.32l-.515-.308L12%2011.974%202.647%206.681%2012%201.388l7.76%204.368.668-.411v-.566L12%200%20.95%206.27v.72L12%2013.207l9.919-5.55v2.26L12%2015.52%201.516%209.56l-.565.308Z'/%3e%3c/svg%3e`,fC=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAGcElEQVR4nNxZa2wcVxU+99557M6+vLazj6xjO6+maWVTl0YpLU1DU9KARNqooQhFVYJUqUWgiocqIVRESPlRoEhIqYoqgSiCItqQPkAEKUWQtlGSJtAY00R5mTjZTfze94x3HvdedMdZnKgS6s7O2kk/a7R3xvY933fOd874yhhucCyYAIWA9IOH2r+35/HUnjU96sBC8fAERQLpj0+mXjdeXM6rzy/no88uK6zolHu97EX8p/f/IWHAv38i9bsH+kIPo/ozhAJBgpR9J419je437xb62Zc7n/tcf+gRsebADYQAxLW2N/ApL/vNq4AdA7Ht2/piT4q15fAp1wEYAGEALYA18TzT1TXQ09O75qPuKbWS8NW4Lan27/pM4gWrBIgFnaIDvKZIpPPKt+nlgpMTi0q5PKqoqvZR950XAREZaz/fmHmFOFijwGHkDDu5PKGs1SlQ5gAAQ+S9U9Y/xM+Wy+WxRvaeFwE770z+OBNQbmYWwPlp63BPh3q7XQaCxAi50gP7Tldf87J3ywVszEQ2bumOf5WZAAajeWoDJjYOMM5BCECEw9miefxwduaol/1b2sQdCon/8BOZX3ETYWYiODFhvrNUC6ylFgJqzl27DxV+xD3GaGkFnl6deS4G8mJqAmRrtaGkoqxiJnazPpt9gPNVa3DvqfKrXmO0rAJ3RSLrHojHd4jMMwvBSMn+d1pSVrv37oXdz50Hx79JOXgtQGsqIAEiT8V7djtVzEiQ4w+K+t9uCmn3uNmX5rL/l8ullw5c1g80E6slFXgkuuixJVKw3y5jxEzExnV7pB3k7rr3hZDBiZl3njk+9u1mY/legSgm0cfiXbtcTziYHJmovNEXC99PZzAV41KMzaLtXGBVmaQltWfCdPLNxPNdwFdii58KYykhXM2AO5MGvTSAgw9aLnUx8zlomCxTKdeHdP14s/F8tdAiIie2RpPfAPcPNYAjRumNOwLRLZwL2rPgHAGnCF6aHPuJ5869Cr5WYFs0/S0ZkTDns9SK1BltI/JicYcEcXAX8L5R+vOblanf+hHTNwFtWGr7QiT9BAPklnWoVt5/qxrZILQI7wvyjHPrjKkfeL0y9QID76Pzavhmoa3RzNdkLMcYEKCA4aJtncjIgVs4oFnbCCGASDtRVrw3Uz7sV1xfBKiAlc2RJV+vkz9vWYMZWesTa1ER5vYEgot27YPvjJ/dXGBOwY+44JeAdaHkQxpRU9QVQGDIrPz1FjV+f/3eFcaRFcdKosicsh8x6/ClBzaEu7YLoqJNDUonVKR0UCTuRT9w9wshpAzb+qmcY2b9iFlH0xVow0r81sCiz9azfdCY3rNWSzw8a5/ZZ2ItPv9UmfiFP7Tn0HQFPhlMbuKIyOKkhThjNc4rBCtRJl5jrvO5W4mSY+beMib/4A/tOTQtYCCY2kTdszmHE7X8/tWBTtf7s7S528IYELxcuviMycWZzF80baHVgdT6/00fu3oso7Tdwa5Ypt7Aw5Zx7M1K7pf+UL4WTVWgQwqnQ5LWLexTpfblEFaT7Jrsc3GMLDw7+a9tFDj1j/YcmqpAWkn06yhERaYP6ZdeHtC6tl6deYPx4q7xY5+/YFfP+kf5WniqQELp6J6hNaNdia8s4TCojkmrjOYVHGin7qsLQdYqvb976uijk455yX/ac/AkYNLKZx9Nb/kNQkAsLJNBW9+/Uk3eJzI/ZlUG36qcfv6MXf3nmtjtO/ZO/v27/tOeA/L6iyu0pfdu7/riATF93s0fffq+toGdM5zmJ+ziuRgJpWSEgy/mXlk/Zk2f8ZfytfDcxOeM828XHH04TAIJjOTgDAlIiPNEmgQTw9Xh146UBn/aavLgVUAmkLk5IkdXFh09l62NHloaWblZjFGMONjMrsTUjqV5qzjuP90Pw9MUmrKms/2x276U0pbcO2Hlh9qUzj6GMJiclk/q5/b+Ovfqg+P29LD/dD+MhnsgSMLhnlDvPQVrOrcmfufjF2cuvI0BqVlj5GDBKmQZsJbMe9+BAZP1yU3fF+tloVV3LzSfhtEbXrWhO7Ri3ULz8PwmzoRXfTqr/+ddf+k0Dk8CEGBMOWccmC8H82bgSUAmfNO6S/q5Bc8+eBUQDXWtz1VP36gCMC4xnfPrZFw2/I9uLZi6u2aXs7ZdGWkNpcbQcAU0LX2XYYxeF/YBLwIYs0twndjnY4H/BgAA//95CrBYRwImwgAAAABJRU5ErkJggg==`,pC=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDuckDB%3c/title%3e%3cpath%20d='M12%200C5.363%200%200%205.363%200%2012s5.363%2012%2012%2012%2012-5.363%2012-12S18.637%200%2012%200zM9.502%207.03a4.974%204.974%200%200%201%204.97%204.97%204.974%204.974%200%200%201-4.97%204.97A4.974%204.974%200%200%201%204.532%2012a4.974%204.974%200%200%201%204.97-4.97zm6.563%203.183h2.351c.98%200%201.787.782%201.787%201.762s-.807%201.789-1.787%201.789h-2.351v-3.551z'/%3e%3c/svg%3e`,mC=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eGoogle%20BigQuery%3c/title%3e%3cpath%20d='M5.676%2010.595h2.052v5.244a5.892%205.892%200%200%201-2.052-2.088v-3.156zm18.179%2010.836a.504.504%200%200%201%200%20.708l-1.716%201.716a.504.504%200%200%201-.708%200l-4.248-4.248a.206.206%200%200%201-.007-.007c-.02-.02-.028-.045-.043-.066a10.736%2010.736%200%200%201-6.334%202.065C4.835%2021.599%200%2016.764%200%2010.799S4.835%200%2010.8%200s10.799%204.835%2010.799%2010.8c0%202.369-.772%204.553-2.066%206.333.025.017.052.028.074.05l4.248%204.248zm-5.028-10.632a8.015%208.015%200%201%200-8.028%208.028h.024a8.016%208.016%200%200%200%208.004-8.028zm-4.86%204.98a6.002%206.002%200%200%200%202.04-2.184v-1.764h-2.04v3.948zm-4.5.948c.442.057.887.08%201.332.072.4.025.8.025%201.2%200V7.692H9.468v9.035z'/%3e%3c/svg%3e`,hC=``+new URL(`iceberg-COKYXo-A.png`,import.meta.url).href,gC=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eMotherDuck%3c/title%3e%3cg%20transform='scale(0.85)%20translate(0,%202)'%3e%3cpath%20fill='%23ff9538'%20d='M1.71%2015.86s7.45%205.32%207.89%205.59c.44.27%201.08.33%201.64.11.56-.22.98-.71%201.11-1.21s1.85-9.49%201.85-9.49c.02-.12.07-.48-.13-.83-.27-.47-.86-.71-1.38-.57-.42.12-.64.44-.7.55-.09.17-.26.45-.57.7-.24.19-.47.3-.58.34-.96.38-2.02.06-2.61-.72-.38-.48-1.04-.67-1.64-.43-.6.24-.94.84-.89%201.45.11.98-.44%201.94-1.4%202.32-.51.21-1.06.21-1.54.05-.12-.03-.51-.12-.89.09-.48.26-.74.84-.61%201.37.09.39.38.62.48.69z'%20/%3e%3cpath%20fill='%23ff9538'%20d='M14.12%204.21s2.65%208.76%202.83%209.24c.19.48.66.92%201.23%201.09.58.16%201.21.03%201.62-.28.41-.31%207.25-6.39%207.25-6.39.09-.08.35-.34.4-.74.07-.53-.25-1.09-.75-1.29-.4-.16-.78-.04-.89%200-.18.08-.48.2-.88.2-.3.01-.55-.05-.67-.08-.99-.28-1.64-1.18-1.63-2.16-.01-.61-.42-1.17-1.04-1.35-.62-.18-1.26.09-1.59.6-.51.84-1.53%201.27-2.52.99-.53-.15-.96-.48-1.25-.91-.07-.09-.33-.4-.76-.48-.54-.09-1.1.22-1.32.71-.16.37-.08.72-.04.84z'%20/%3e%3c/g%3e%3c/svg%3e`,_C=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eMySQL%3c/title%3e%3cpath%20d='M16.405%205.501c-.115%200-.193.014-.274.033v.013h.014c.054.104.146.18.214.273.054.107.1.214.154.32l.014-.015c.094-.066.14-.172.14-.333-.04-.047-.046-.094-.08-.14-.04-.067-.126-.1-.18-.153zM5.77%2018.695h-.927a50.854%2050.854%200%2000-.27-4.41h-.008l-1.41%204.41H2.45l-1.4-4.41h-.01a72.892%2072.892%200%2000-.195%204.41H0c.055-1.966.192-3.81.41-5.53h1.15l1.335%204.064h.008l1.347-4.064h1.095c.242%202.015.384%203.86.428%205.53zm4.017-4.08c-.378%202.045-.876%203.533-1.492%204.46-.482.716-1.01%201.073-1.583%201.073-.153%200-.34-.046-.566-.138v-.494c.11.017.24.026.386.026.268%200%20.483-.075.647-.222.197-.18.295-.382.295-.605%200-.155-.077-.47-.23-.944L6.23%2014.615h.91l.727%202.36c.164.536.233.91.205%201.123.4-1.064.678-2.227.835-3.483zm12.325%204.08h-2.63v-5.53h.885v4.85h1.745zm-3.32.135l-1.016-.5c.09-.076.177-.158.255-.25.433-.506.648-1.258.648-2.253%200-1.83-.718-2.746-2.155-2.746-.704%200-1.254.232-1.65.697-.43.508-.646%201.256-.646%202.245%200%20.972.19%201.686.574%202.14.35.41.877.615%201.583.615.264%200%20.506-.033.725-.098l1.325.772.36-.622zM15.5%2017.588c-.225-.36-.337-.94-.337-1.736%200-1.393.424-2.09%201.27-2.09.443%200%20.77.167.977.5.224.362.336.936.336%201.723%200%201.404-.424%202.108-1.27%202.108-.445%200-.77-.167-.978-.5zm-1.658-.425c0%20.47-.172.856-.516%201.156-.344.3-.803.45-1.384.45-.543%200-1.064-.172-1.573-.515l.237-.476c.438.22.833.328%201.19.328.332%200%20.593-.073.783-.22a.754.754%200%2000.3-.615c0-.33-.23-.61-.648-.845-.388-.213-1.163-.657-1.163-.657-.422-.307-.632-.636-.632-1.177%200-.45.157-.81.47-1.085.315-.278.72-.415%201.22-.415.512%200%20.98.136%201.4.41l-.213.476a2.726%202.726%200%2000-1.064-.23c-.283%200-.502.068-.654.206a.685.685%200%2000-.248.524c0%20.328.234.61.666.85.393.215%201.187.67%201.187.67.433.305.648.63.648%201.168zm9.382-5.852c-.535-.014-.95.04-1.297.188-.1.04-.26.04-.274.167.055.053.063.14.11.214.08.134.218.313.346.407.14.11.28.216.427.31.26.16.555.255.81.416.145.094.293.213.44.313.073.05.12.14.214.172v-.02c-.046-.06-.06-.147-.105-.214-.067-.067-.134-.127-.2-.193a3.223%203.223%200%2000-.695-.675c-.214-.146-.682-.35-.77-.595l-.013-.014c.146-.013.32-.066.46-.106.227-.06.435-.047.67-.106.106-.027.213-.06.32-.094v-.06c-.12-.12-.21-.283-.334-.395a8.867%208.867%200%2000-1.104-.823c-.21-.134-.476-.22-.697-.334-.08-.04-.214-.06-.26-.127-.12-.146-.19-.34-.275-.514a17.69%2017.69%200%2001-.547-1.163c-.12-.262-.193-.523-.34-.763-.69-1.137-1.437-1.826-2.586-2.5-.247-.14-.543-.2-.856-.274-.167-.008-.334-.02-.5-.027-.11-.047-.216-.174-.31-.235-.38-.24-1.364-.76-1.644-.072-.18.434.267.862.422%201.082.115.153.26.328.34.5.047.116.06.235.107.356.106.294.207.622.347.897.073.14.153.287.247.413.054.073.146.107.167.227-.094.136-.1.334-.154.5-.24.757-.146%201.693.194%202.25.107.166.362.534.703.393.3-.12.234-.5.32-.835.02-.08.007-.133.048-.187v.015c.094.188.188.367.274.555.206.328.566.668.867.895.16.12.287.328.487.402v-.02h-.015c-.043-.058-.1-.086-.154-.133a3.445%203.445%200%2001-.35-.4%208.76%208.76%200%2001-.747-1.218c-.11-.21-.202-.436-.29-.643-.04-.08-.04-.2-.107-.24-.1.146-.247.273-.32.453-.127.288-.14.642-.188%201.01-.027.007-.014%200-.027.014-.214-.052-.287-.274-.367-.46-.2-.475-.233-1.238-.06-1.785.047-.14.247-.582.167-.716-.042-.127-.174-.2-.247-.303a2.478%202.478%200%2001-.24-.427c-.16-.374-.24-.788-.414-1.162-.08-.173-.22-.354-.334-.513-.127-.18-.267-.307-.368-.52-.033-.073-.08-.194-.027-.274.014-.054.042-.075.094-.09.088-.072.335.022.422.062.247.1.455.194.662.334.094.066.195.193.315.226h.14c.214.047.455.014.655.073.355.114.675.28.962.46a5.953%205.953%200%20012.085%202.286c.08.154.115.295.188.455.14.33.313.663.455.982.14.315.275.636.476.897.1.14.502.213.682.286.133.06.34.115.46.188.23.14.454.3.67.454.11.076.443.243.463.378z'/%3e%3c/svg%3e`,vC=``+new URL(`postgresql-q8VEBKGg.svg`,import.meta.url).href,yC={sqlite:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eSQLite%3c/title%3e%3cpath%20d='M21.678.521c-1.032-.92-2.28-.55-3.513.544a8.71%208.71%200%200%200-.547.535c-2.109%202.237-4.066%206.38-4.674%209.544.237.48.422%201.093.544%201.561a13.044%2013.044%200%200%201%20.164.703s-.019-.071-.096-.296l-.05-.146a1.689%201.689%200%200%200-.033-.08c-.138-.32-.518-.995-.686-1.289-.143.423-.27.818-.376%201.176.484.884.778%202.4.778%202.4s-.025-.099-.147-.442c-.107-.303-.644-1.244-.772-1.464-.217.804-.304%201.346-.226%201.478.152.256.296.698.422%201.186.286%201.1.485%202.44.485%202.44l.017.224a22.41%2022.41%200%200%200%20.056%202.748c.095%201.146.273%202.13.5%202.657l.155-.084c-.334-1.038-.47-2.399-.41-3.967.09-2.398.642-5.29%201.661-8.304%201.723-4.55%204.113-8.201%206.3-9.945-1.993%201.8-4.692%207.63-5.5%209.788-.904%202.416-1.545%204.684-1.931%206.857.666-2.037%202.821-2.912%202.821-2.912s1.057-1.304%202.292-3.166c-.74.169-1.955.458-2.362.629-.6.251-.762.337-.762.337s1.945-1.184%203.613-1.72C21.695%207.9%2024.195%202.767%2021.678.521m-18.573.543A1.842%201.842%200%200%200%201.27%202.9v16.608a1.84%201.84%200%200%200%201.835%201.834h9.418a22.953%2022.953%200%200%201-.052-2.707c-.006-.062-.011-.141-.016-.2a27.01%2027.01%200%200%200-.473-2.378c-.121-.47-.275-.898-.369-1.057-.116-.197-.098-.31-.097-.432%200-.12.015-.245.037-.386a9.98%209.98%200%200%201%20.234-1.045l.217-.028c-.017-.035-.014-.065-.031-.097l-.041-.381a32.8%2032.8%200%200%201%20.382-1.194l.2-.019c-.008-.016-.01-.038-.018-.053l-.043-.316c.63-3.28%202.587-7.443%204.8-9.791.066-.069.133-.128.198-.194Z'/%3e%3c/svg%3e`,duckdb:pC,motherduck:gC,postgres:vC,postgresql:vC,mysql:_C,snowflake:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eSnowflake%3c/title%3e%3cpath%20d='M24%203.459c0%20.646-.418%201.18-1.141%201.18-.723%200-1.142-.534-1.142-1.18%200-.647.419-1.18%201.142-1.18.723%200%201.141.533%201.141%201.18zm-.228%200c0-.533-.38-.951-.913-.951s-.913.38-.913.95c0%20.533.38.952.913.952.57%200%20.913-.419.913-.951zm-1.37-.533h.495c.266%200%20.456.152.456.38%200%20.153-.076.229-.19.305l.19.266v.038h-.266l-.19-.266h-.229v.266h-.266zm.495.228h-.229v.267h.229c.114%200%20.152-.038.152-.114.038-.077-.038-.153-.152-.153zM7.602%2012.4c.038-.151.076-.304.076-.456%200-.114-.038-.228-.038-.342-.114-.343-.304-.647-.646-.838l-4.87-2.777c-.685-.38-1.56-.152-1.94.533-.381.685-.153%201.56.532%201.94l2.701%201.56-2.701%201.56c-.685.38-.913%201.256-.533%201.94.38.685%201.256.914%201.94.533l4.832-2.777c.343-.267.571-.533.647-.876zm1.332%202.626c-.266-.038-.57.038-.837.19l-4.832%202.777c-.685.38-.913%201.256-.532%201.94.38.686%201.255.914%201.94.533l2.701-1.56v3.12c0%20.8.647%201.408%201.446%201.408.799%200%201.407-.647%201.407-1.408v-5.592c0-.761-.57-1.37-1.293-1.408zm4.946-6.088c.266.038.57-.038.837-.19l4.832-2.777c.685-.38.913-1.256.532-1.94-.38-.686-1.255-.914-1.94-.533l-2.701%201.56V1.975c0-.799-.647-1.408-1.446-1.408-.799%200-1.446.609-1.446%201.408V7.53c0%20.76.609%201.37%201.332%201.407zM3.265%205.97l4.832%202.777c.266.152.533.19.837.19.723-.038%201.331-.684%201.331-1.407V1.975c0-.799-.646-1.408-1.407-1.408-.799%200-1.446.647-1.446%201.408v3.12l-2.701-1.56c-.685-.38-1.56-.152-1.94.533-.419.646-.19%201.521.494%201.902zm9.093%206.011a.412.412%200%2000-.114-.266l-.57-.571a.346.346%200%2000-.267-.114.412.412%200%2000-.266.114l-.571.57a.411.411%200%2000-.114.267c0%20.076.038.19.114.267l.57.57a.345.345%200%2000.267.114c.076%200%20.19-.038.266-.114l.571-.57a.412.412%200%2000.114-.267zm1.598.533L11.94%2014.53c-.039.038-.153.114-.229.114h-.608a.411.411%200%2001-.267-.114L8.82%2012.514a.408.408%200%2001-.076-.229v-.608c0-.076.038-.19.114-.267l2.016-2.016a.41.41%200%2001.267-.114h.608a.41.41%200%2001.267.114l2.016%202.016a.347.347%200%2001.114.267v.608c-.076.077-.114.19-.19.229zm5.593%205.44l-4.832-2.777c-.266-.152-.57-.19-.837-.152-.723.038-1.332.684-1.332%201.408v5.554c0%20.8.647%201.408%201.408%201.408.799%200%201.446-.647%201.446-1.408v-3.12l2.7%201.56c.686.38%201.561.152%201.941-.533.419-.646.19-1.521-.494-1.94zm2.549-7.533l-2.701%201.56%202.7%201.56c.686.38.914%201.256.533%201.94-.38.685-1.255.913-1.94.533l-4.832-2.778a1.644%201.644%200%2001-.647-.798c-.037-.153-.076-.305-.076-.457%200-.114.039-.228.039-.342.114-.343.342-.647.646-.837l4.832-2.778c.685-.38%201.56-.152%201.94.533.457.609.19%201.484-.494%201.864'/%3e%3c/svg%3e`,databricks:dC,clickhouse:uC,timeplus:`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3c!--%20Generated%20by%20Pixelmator%20Pro%203.6.17%20--%3e%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Option2SymbolB'%3e%3cg%20id='Layer1-2'%3e%3cg%20id='Group'%20opacity='0.4'%3e%3cpath%20id='Path'%20fill='%23d53c97'%20stroke='none'%20d='M%2017.016802%2012.188573%20C%2017.016802%209.607646%2015.86018%207.293022%2014.039526%205.731081%20C%2013.942595%205.70038%2013.844628%205.671406%2013.745972%205.645189%20C%2013.131133%205.809095%2012.54265%206.059378%2011.998103%206.388559%20C%2013.964327%207.575191%2015.281006%209.730104%2015.281006%2012.188573%20C%2015.279476%2014.563734%2014.033739%2016.764488%2011.998103%2017.988243%20C%2012.542634%2018.317537%2013.131119%2018.567936%2013.745972%2018.731958%20C%2013.844628%2018.705742%2013.942595%2018.67642%2014.039526%2018.645721%20C%2015.86018%2017.084126%2017.016802%2014.769501%2017.016802%2012.188573%20Z'/%3e%3cpath%20id='path1'%20fill='%23d53c97'%20stroke='none'%20d='M%2013.897406%205.609659%20L%2013.894991%205.60759%20C%2013.844973%205.619663%2013.7953%205.631737%2013.745972%205.645189%20C%2013.79599%205.631737%2013.847043%205.622078%2013.897406%205.609659%20Z'/%3e%3cpath%20id='path2'%20fill='%23d53c97'%20stroke='none'%20d='M%201.735796%2012.188573%20C%201.735796%209.164728%203.728925%206.59622%206.470945%205.729357%20C%207.554634%204.797861%208.856011%204.155121%2010.254373%203.860756%20C%209.680216%203.740549%209.095179%203.679977%208.508574%203.68%20C%203.816888%203.68%20-0%207.496887%20-0%2012.188573%20C%20-0%2016.880259%203.816888%2020.697147%208.508574%2020.697147%20C%209.0952%2020.697229%209.680255%2020.636539%2010.254373%2020.516048%20C%208.855971%2020.221794%207.554568%2019.579041%206.470945%2018.647446%20C%203.728925%2017.780582%201.735796%2015.213453%201.735796%2012.188573%20Z'/%3e%3cpath%20id='path3'%20fill='%23d53c97'%20stroke='none'%20d='M%2013.745972%2018.731958%20C%2013.7953%2018.745068%2013.844973%2018.757484%2013.894991%2018.769558%20C%2013.894991%2018.769558%2013.896715%2018.769558%2013.897406%2018.767488%20C%2013.847043%2018.754379%2013.79599%2018.745411%2013.745972%2018.731958%20Z'/%3e%3c/g%3e%3cpath%20id='path4'%20fill='%23ff3b65'%20stroke='none'%20d='M%2020.508402%2012.188573%20C%2020.508402%209.606611%2019.351088%207.290262%2017.5294%205.729357%20C%2016.301817%205.342468%2014.989366%205.313629%2013.745972%205.646223%20C%2016.636665%206.418224%2018.772606%209.058484%2018.772606%2012.189609%20C%2018.772606%2015.320732%2016.636665%2017.960991%2013.745972%2018.731958%20C%2014.98947%2019.064316%2016.301983%2019.034998%2017.5294%2018.647446%20C%2019.419907%2017.034296%2020.508638%2014.673781%2020.508402%2012.188573%20Z'/%3e%3cpath%20id='path5'%20fill='%23ff3b65'%20stroke='none'%20d='M%209.962543%2018.647446%20C%207.220525%2017.780582%205.227395%2015.213453%205.227395%2012.188573%20C%205.227395%209.163693%207.220525%206.59622%209.962543%205.729357%20C%2011.046233%204.797861%2012.34761%204.155121%2013.745972%203.860756%20C%2013.171818%203.74053%2012.586779%203.679956%2012.000173%203.68%20C%207.308832%203.68%203.491599%207.496887%203.491599%2012.188573%20C%203.491599%2016.880259%207.308487%2020.697147%2012.000173%2020.697147%20C%2012.586799%2020.697247%2013.171857%2020.636557%2013.745972%2020.516048%20C%2012.34757%2020.221794%2011.046167%2019.579041%209.962543%2018.647446%20Z'/%3e%3cpath%20id='path6'%20fill='%23383838'%20stroke='none'%20d='M%2015.491772%203.68%20C%2010.800431%203.68%206.983198%207.496887%206.983198%2012.188573%20C%206.983198%2016.880259%2010.800086%2020.697147%2015.491772%2020.697147%20C%2020.183456%2020.697147%2024%2016.880259%2024%2012.188573%20C%2024%207.496887%2020.183456%203.68%2015.491772%203.68%20Z%20M%2022.264549%2012.188573%20C%2022.264549%2015.923018%2019.226215%2018.961351%2015.491772%2018.961351%20C%2011.757326%2018.961351%208.718994%2015.923018%208.718994%2012.188573%20C%208.718994%208.454128%2011.757326%205.415796%2015.491772%205.415796%20C%2019.226215%205.415796%2022.264549%208.454128%2022.264549%2012.188573%20Z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e`,bigquery:mC,trino:``+new URL(`trino-DFsJbQoT.svg`,import.meta.url).href,iceberg:hC,datafusion:fC,pyspark:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eApache%20Spark%3c/title%3e%3cpath%20d='M10.812%200c-.425.013-.845.215-1.196.605a3.593%203.593%200%2000-.493.722c-.355.667-.425%201.415-.556%202.143a551.9%20551.9%200%2000-.726%204.087c-.027.16-.096.227-.244.273C5.83%208.386%204.06%208.94%202.3%209.514c-.387.125-.773.289-1.114.506-1.042.665-1.196%201.753-.415%202.71.346.422.79.715%201.284.936%201.1.49%202.202.976%203.3%201.47.019.01.036.013.053.019h-.004l1.306.535c0%20.023.002.045%200%20.073-.2%202.03-.39%204.063-.58%206.095-.04.419-.012.831.134%201.23.317.87%201.065%201.148%201.881.701.372-.204.666-.497.937-.818%201.372-1.623%202.746-3.244%204.113-4.872.111-.133.205-.15.363-.098.349.117.697.231%201.045.347h.001c.02.012.045.02.073.03l.142.042c1.248.416%202.68.775%203.929%201.19.4.132.622.164%201.045.098.311-.048.592-.062.828-.236.602-.33.995-.957.988-1.682-.005-.427-.154-.813-.35-1.186-.82-1.556-1.637-3.113-2.461-4.666-.078-.148-.076-.243.037-.375%201.381-1.615%202.756-3.236%204.133-4.855.272-.32.513-.658.653-1.058.308-.878-.09-1.57-1-1.741a2.783%202.783%200%2000-1.235.069c-1.974.521-3.947%201.041-5.918%201.57-.175.047-.26.015-.355-.144a353.08%20353.08%200%2000-2.421-4.018%204.61%204.61%200%2000-.652-.849c-.371-.37-.802-.549-1.227-.536zm.172%203.703a.592.592%200%2001.189.211c.87%201.446%201.742%202.89%202.609%204.338.07.118.135.16.277.121%201.525-.41%203.052-.813%204.579-1.217.367-.098.735-.193%201.103-.289a.399.399%200%2001-.1.2c-1.259%201.48-2.516%202.962-3.779%204.438-.11.13-.12.22-.04.37.937%201.803%201.768%203.309%202.498%204.76l-3.696-1.019c-.538-.18-1.077-.358-1.615-.539-.163-.055-.25-.03-.36.1-1.248%201.488-2.504%202.97-3.759%204.454a.398.398%200%2001-.18.132c.035-.378.068-.757.104-1.136.149-1.572.297-3.144.451-4.716-.03-.318.117-.405-.322-.545-1.493-.593-3.346-1.321-4.816-1.905a.595.595%200%2001.24-.134c1.797-.57%203.595-1.14%205.394-1.705.127-.04.199-.092.211-.233.013-.148.05-.294.076-.441.241-1.363.483-2.726.726-4.088.068-.386.14-.771.21-1.157z'/%3e%3c/svg%3e`,redshift:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eAmazon%20Redshift%3c/title%3e%3cpath%20d='M16.639%209.932a.822.822%200%200%201-.822-.82.823.823%200%200%201%201.645%200c0%20.452-.37.82-.823.82m-2.086%204.994a.823.823%200%200%201-.822-.822.822.822%200%200%201%201.645%200%20.822.822%200%200%201-.823.822m-5.004-.833a.822.822%200%201%201%20.002-1.644.822.822%200%200%201-.002%201.644m-2.083%204.578a.823.823%200%200%201-.823-.82.823.823%200%200%201%201.645%200c0%20.452-.37.82-.822.82m9.173-11.236a1.68%201.68%200%200%200-1.68%201.676c0%20.566.285%201.066.718%201.37l-.782%201.982a1.674%201.674%200%200%200-1.923%201.104l-1.753-.398a1.675%201.675%200%200%200-3.348.103c0%20.432.169.823.438%201.12l-.764%201.79c-.028-.001-.053-.008-.08-.008a1.68%201.68%200%200%200-1.68%201.676%201.68%201.68%200%200%200%203.36%200c0-.593-.312-1.112-.778-1.41l.674-1.579c.161.052.33.088.508.088.661%200%201.228-.386%201.502-.94l1.856.42a1.68%201.68%200%200%200%203.327-.325c0-.5-.224-.943-.574-1.25l.822-2.083c.053.005.104.016.157.016a1.68%201.68%200%200%200%201.68-1.676%201.68%201.68%200%200%200-1.68-1.676M12%2023.145c-4.17%200-7.286-1.252-7.286-2.37V4.79C6.14%205.938%209.131%206.547%2012%206.547c2.869%200%205.86-.609%207.286-1.756v15.983c0%201.12-3.116%202.37-7.286%202.37M12%20.856c4.293%200%207.286%201.274%207.286%202.419%200%201.143-2.993%202.418-7.286%202.418-4.293%200-7.286-1.275-7.286-2.418C4.714%202.129%207.707.855%2012%20.855m8.143%202.419C20.143%201.147%2015.947%200%2012%200%208.052%200%203.857%201.147%203.857%203.274l.002.01h-.002v17.49C3.857%2022.87%208.052%2024%2012%2024c3.947%200%208.143-1.13%208.143-3.226V3.284h-.002l.002-.01'/%3e%3c/svg%3e`,supabase:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eSupabase%3c/title%3e%3cpath%20d='M11.9%201.036c-.015-.986-1.26-1.41-1.874-.637L.764%2012.05C-.33%2013.427.65%2015.455%202.409%2015.455h9.579l.113%207.51c.014.985%201.259%201.408%201.873.636l9.262-11.653c1.093-1.375.113-3.403-1.645-3.403h-9.642z'/%3e%3c/svg%3e`},bC=e=>{let t=(0,Qd.c)(11),{name:n,className:r}=e,i=yC[n.toLowerCase()];if(!i){let e;t[0]===r?e=t[1]:(e=oe(`mt-0.5`,r),t[0]=r,t[1]=e);let n;return t[2]===e?n=t[3]:(n=(0,W.jsx)(Ed,{className:e}),t[2]=e,t[3]=n),n}let a;t[4]!==r||t[5]!==i?(a=oe(`invert-[.5] dark:invert-[.7]`,r,i.endsWith(`.png`)&&`brightness-100 dark:brightness-100 invert-0 dark:invert-0`),t[4]=r,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==n||t[8]!==a||t[9]!==i?(o=(0,W.jsx)(`img`,{src:i,alt:n,className:a}),t[7]=n,t[8]=a,t[9]=i,t[10]=o):o=t[10],o},xC=e=>{let t=(0,Qd.c)(37),{selectedEngine:n,onChange:r,cellId:i}=e,a=s(ud),o=[],c=[];for(let[e,t]of a.entries())Pu.has(e)?o.push(t):c.push(t);let l=nn(),u;t[0]!==a||t[1]!==n?(u=n&&!a.has(n),t[0]=a,t[1]=n,t[2]=u):u=t[2];let d=u,f;t[3]!==a||t[4]!==r||t[5]!==l?(f=e=>{if(e===SC){window.open(CC,`_blank`);return}let t=a.get(e);t&&(l(),r(t.name),fd(t.name))},t[3]=a,t[4]=r,t[5]=l,t[6]=f):f=t[6];let p=f,m=OC,h=Oe,g;t[7]===i?g=t[8]:(g=lC(i),t[7]=i,t[8]=g);let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,W.jsx)(xe,{placeholder:`Select an engine`}),t[9]=_):_=t[9];let v;t[10]===g?v=t[11]:(v=(0,W.jsx)(TC,{...g,children:_}),t[10]=g,t[11]=v);let y=we,b;t[12]===i?b=t[13]:(b=lC(i),t[12]=i,t[13]=b);let x=Ee,S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,W.jsx)(be,{children:`Database connections`}),t[14]=S):S=t[14];let C;t[15]!==d||t[16]!==n?(C=d&&(0,W.jsx)(Se,{value:n,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-1 opacity-50`,children:[(0,W.jsx)(X,{className:`h-3 w-3`}),(0,W.jsx)(`span`,{className:`truncate`,children:Kd(n)})]})},n),t[15]=d,t[16]=n,t[17]=C):C=t[17];let w=m(c),T=c.length>0&&(0,W.jsx)(Te,{}),E=m(o),D;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,W.jsx)(Te,{}),t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,W.jsx)(Se,{className:`text-muted-foreground`,value:SC,children:(0,W.jsxs)(`a`,{className:`flex items-center gap-1`,href:CC,target:`_blank`,rel:`noreferrer`,children:[(0,W.jsx)(kn,{className:`h-3 w-3`}),(0,W.jsx)(`span`,{children:`How to add a database connection`})]})}),t[19]=O):O=t[19];let k;t[20]!==x||t[21]!==w||t[22]!==T||t[23]!==E||t[24]!==S||t[25]!==C?(k=(0,W.jsxs)(x,{children:[S,C,w,T,E,D,O]}),t[20]=x,t[21]=w,t[22]=T,t[23]=E,t[24]=S,t[25]=C,t[26]=k):k=t[26];let ee;t[27]!==y||t[28]!==k||t[29]!==b?(ee=(0,W.jsx)(y,{...b,children:k}),t[27]=y,t[28]=k,t[29]=b,t[30]=ee):ee=t[30];let te;return t[31]!==h||t[32]!==p||t[33]!==n||t[34]!==ee||t[35]!==v?(te=(0,W.jsx)(`div`,{className:`flex flex-row gap-1 items-center`,children:(0,W.jsxs)(h,{value:n,onValueChange:p,children:[v,ee]})}),t[31]=h,t[32]=p,t[33]=n,t[34]=ee,t[35]=v,t[36]=te):te=t[36],te},SC=`__help__`,CC=`http://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database`,wC=()=>{let e=(0,Qd.c)(16),{sqlMode:t,setSQLMode:n}=SS(),r;e[0]!==n||e[1]!==t?(r=()=>{let e=t===`validate`?`default`:`validate`;e==="default"&&pS(),n(e)},e[0]=n,e[1]=t,e[2]=r):r=e[2];let i=r,a=kC,o=AC,s;e[3]===t?s=e[4]:(s=o(t),e[3]=t,e[4]=s);let c;e[5]===t?c=e[6]:(c=a(t),e[5]=t,e[6]=c);let l=t===`validate`?`Validate`:`Default`,u;e[7]===l?u=e[8]:(u=(0,W.jsx)(`span`,{className:`ml-1`,children:l}),e[7]=l,e[8]=u);let d;e[9]!==i||e[10]!==c||e[11]!==u?(d=(0,W.jsxs)(je,{variant:`ghost`,size:`sm`,onClick:i,className:`h-5 px-1.5 text-xs border-border shadow-none hover:bg-accent`,children:[c,u]}),e[9]=i,e[10]=c,e[11]=u,e[12]=d):d=e[12];let f;return e[13]!==s||e[14]!==d?(f=(0,W.jsx)(`div`,{className:`flex flex-row gap-1 items-center`,children:(0,W.jsx)(Ae,{delayDuration:300,content:s,children:d})}),e[13]=s,e[14]=d,e[15]=f):f=e[15],f},TC=e=>{let t=(0,Qd.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,W.jsx)(De,{className:`text-xs border-border shadow-none! ring-0! h-5 px-1.5 hover:bg-accent transition-colors`,...r,children:n}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i};function EC(e){return e.source!==`iceberg`}function DC(e){return(0,W.jsx)(Se,{value:e.name,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,W.jsx)(bC,{className:`h-3 w-3`,name:e.dialect}),(0,W.jsx)(`span`,{className:`truncate ml-0.5`,children:Kd(e.display_name)})]})},e.name)}function OC(e){return e=e.filter(EC),e.map(DC)}function kC(e){return e===`validate`?(0,W.jsx)(zd,{className:`h-3 w-3`}):(0,W.jsx)(An,{className:`h-3 w-3`})}function AC(e){return e===`validate`?(0,W.jsxs)(`div`,{className:`text-xs`,children:[(0,W.jsxs)(`div`,{className:`font-semibold mb-1 flex flex-row items-center gap-1`,children:[(0,W.jsx)(zd,{className:`h-3 w-3`}),`Validate Mode`]}),(0,W.jsx)(`p`,{children:`Queries are validated as you write them`})]}):(0,W.jsxs)(`div`,{className:`text-xs`,children:[(0,W.jsxs)(`div`,{className:`font-semibold mb-1 flex flex-row items-center gap-1`,children:[(0,W.jsx)(An,{className:`h-3 w-3`}),`Default Mode`]}),(0,W.jsx)(`p`,{children:`Standard editing`})]})}var jC=()=>{let e=(0,Qd.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsx)(`div`,{className:`h-4 border-r border-border`}),e[0]=t):t=e[0],t},MC=e=>{let t=(0,Qd.c)(102),{view:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={minWidth:50},t[0]=r):r=t[0];let{spanProps:i,inputProps:a}=rC(r),o;t[1]===n.state?o=t[2]:(o=n.state.field(FC),t[1]=n.state,t[2]=o);let s=o,c;t[3]===n.state?c=t[4]:(c=n.state.facet(Cu),t[3]=n.state,t[4]=c);let l=c,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,W.jsx)(`div`,{}),t[5]=u):u=t[5];let d=u,f=!1,p;t[6]===n?p=t[7]:(p=e=>{n.dispatch({effects:ev.of(e),changes:{from:0,to:n.state.doc.length,insert:n.state.doc.toString()}})},t[6]=n,t[7]=p);let m=p;if(s instanceof OS){let e;t[8]===n.state?e=t[9]:(e=n.state.field(tv),t[8]=n.state,t[9]=e);let r=e;f=!0;let o;t[10]===m?o=t[11]:(o=e=>{let t=$S(e.currentTarget.value,!1);e.currentTarget.value=t,m({dataframeName:t})},t[10]=m,t[11]=o);let s=o,c;t[12]!==m||t[13]!==n?(c=e=>{m({engine:e}),IS(n,e)},t[12]=m,t[13]=n,t[14]=c):c=t[14];let u=c,p;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,W.jsx)(`span`,{className:`select-none`,children:`Output variable: `}),t[15]=p):p=t[15];let h;t[16]===a?h=t[17]:(h=e=>{a.onChange?.(e)},t[16]=a,t[17]=h);let g;t[18]===s?g=t[19]:(g=e=>{e.key===`Enter`&&e.shiftKey&&s(e)},t[18]=s,t[19]=g);let _;t[20]!==a||t[21]!==r.dataframeName||t[22]!==s||t[23]!==h||t[24]!==g?(_=(0,W.jsx)(`input`,{...a,defaultValue:r.dataframeName,onChange:h,onBlur:s,onKeyDown:g,className:`min-w-14 w-auto border border-border rounded px-1 focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring`}),t[20]=a,t[21]=r.dataframeName,t[22]=s,t[23]=h,t[24]=g,t[25]=_):_=t[25];let v;t[26]===i?v=t[27]:(v=(0,W.jsx)(`span`,{...i}),t[26]=i,t[27]=v);let y;t[28]!==_||t[29]!==v?(y=(0,W.jsxs)(`label`,{className:`flex gap-2 items-center`,children:[p,_,v]}),t[28]=_,t[29]=v,t[30]=y):y=t[30];let b;t[31]!==l||t[32]!==r.engine||t[33]!==u?(b=(0,W.jsx)(xC,{selectedEngine:r.engine,onChange:u,cellId:l}),t[31]=l,t[32]=r.engine,t[33]=u,t[34]=b):b=t[34];let x;t[35]===r.engine?x=t[36]:(x=r.engine===`__marimo_duckdb`&&(0,W.jsx)(wC,{}),t[35]=r.engine,t[36]=x);let S;t[37]!==r.engine||t[38]!==n?(S=async()=>{await If(n,r.engine)},t[37]=r.engine,t[38]=n,t[39]=S):S=t[39];let C;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,W.jsx)(Ld,{className:`h-3 w-3`}),t[40]=C):C=t[40];let w;t[41]===S?w=t[42]:(w=(0,W.jsx)(Ae,{content:`Format SQL`,children:(0,W.jsx)(je,{variant:`text`,size:`icon`,onClick:S,children:C})}),t[41]=S,t[42]=w);let T;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,W.jsx)(jC,{}),t[43]=T):T=t[43];let E;t[44]===m?E=t[45]:(E=e=>{m({showOutput:!e.target.checked})},t[44]=m,t[45]=E);let D=!r.showOutput,O;t[46]!==E||t[47]!==D?(O=(0,W.jsx)(`input`,{type:`checkbox`,onChange:E,checked:D}),t[46]=E,t[47]=D,t[48]=O):O=t[48];let k;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,W.jsx)(`span`,{className:`select-none`,children:`Hide output`}),t[49]=k):k=t[49];let ee;t[50]===O?ee=t[51]:(ee=(0,W.jsxs)(`label`,{className:`flex items-center gap-2`,children:[O,k]}),t[50]=O,t[51]=ee);let te;t[52]!==x||t[53]!==w||t[54]!==ee?(te=(0,W.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[x,w,T,ee]}),t[52]=x,t[53]=w,t[54]=ee,t[55]=te):te=t[55];let ne;t[56]!==y||t[57]!==b||t[58]!==te?(ne=(0,W.jsxs)(`div`,{className:`flex flex-1 gap-2 items-center`,children:[y,b,te]}),t[56]=y,t[57]=b,t[58]=te,t[59]=ne):ne=t[59],d=ne}if(s instanceof nv){f=!0;let e,r,i,a,o,s,c,l,u,p;if(t[60]!==m||t[61]!==n.state){let{quotePrefix:d}=n.state.field(tv);r=d,r===void 0&&(r=`r`,m({quotePrefix:r})),p=(e,t)=>{if(typeof t!=`boolean`)return;let n=iC({currentQuotePrefix:r,checked:t,prefix:e});m({quotePrefix:n})},a=`flex flex-row w-full justify-end gap-1.5 items-center`,u=`flex items-center gap-1.5`,t[72]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,W.jsx)(`span`,{children:`r`}),t[72]=i):i=t[72],e=ZS,s=`Toggle raw string`,c=`w-3 h-3`,l=r.includes(`r`),o=e=>{p(`r`,e)},t[60]=m,t[61]=n.state,t[62]=e,t[63]=r,t[64]=i,t[65]=a,t[66]=o,t[67]=s,t[68]=c,t[69]=l,t[70]=u,t[71]=p}else e=t[62],r=t[63],i=t[64],a=t[65],o=t[66],s=t[67],c=t[68],l=t[69],u=t[70],p=t[71];let h;t[73]!==e||t[74]!==o||t[75]!==s||t[76]!==c||t[77]!==l?(h=(0,W.jsx)(e,{"aria-label":s,className:c,checked:l,onCheckedChange:o}),t[73]=e,t[74]=o,t[75]=s,t[76]=c,t[77]=l,t[78]=h):h=t[78];let g;t[79]!==i||t[80]!==h||t[81]!==u?(g=(0,W.jsxs)(`div`,{className:u,children:[i,h]}),t[79]=i,t[80]=h,t[81]=u,t[82]=g):g=t[82];let _;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,W.jsx)(`span`,{children:`f`}),t[83]=_):_=t[83];let v;t[84]===r?v=t[85]:(v=r.includes(`f`),t[84]=r,t[85]=v);let y;t[86]===p?y=t[87]:(y=e=>{p(`f`,e)},t[86]=p,t[87]=y);let b;t[88]!==v||t[89]!==y?(b=(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[_,(0,W.jsx)(ZS,{"aria-label":`Toggle f-string`,className:`w-3 h-3`,checked:v,onCheckedChange:y})]}),t[88]=v,t[89]=y,t[90]=b):b=t[90];let x;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,W.jsx)(Ae,{content:(0,W.jsx)(aC,{}),children:(0,W.jsx)(Ad,{className:`w-3 h-3`})}),t[91]=x):x=t[91];let S;t[92]!==a||t[93]!==g||t[94]!==b?(S=(0,W.jsxs)(`div`,{className:a,children:[g,b,x]}),t[92]=a,t[93]=g,t[94]=b,t[95]=S):S=t[95],d=S}let h;t[96]===f?h=t[97]:(h=f&&(0,W.jsx)(jC,{}),t[96]=f,t[97]=h);let g;return t[98]!==d||t[99]!==s.type||t[100]!==h?(g=(0,W.jsx)(ke,{children:(0,W.jsxs)(`div`,{className:`flex justify-between items-center gap-4 pl-2 pt-2`,children:[d,h,s.type]})}),t[98]=d,t[99]=s.type,t[100]=h,t[101]=g):g=t[101],g},NC=new L,PC=$e.define(),FC=He.define({create(){return YS.python},update(e,t){for(let e of t.effects)if(e.is(PC))return e.value;return e},provide:e=>Be.from(e,e=>e.type===`python`?null:e=>Rf(e,MC))});function IC(){let e=XS(),t=(n,r)=>{let i=e[r%e.length];return i.isSupported(n)?i:t(n,r+1)};return[Ke.of([{key:`F4`,preventDefault:!0,run:n=>{let r=n.state.field(FC),i=e.findIndex(e=>e.type===r.type),a=n.state.doc.toString(),o=t(a,i+1);return r!==o&&(LC({view:n,nextLanguage:o,opts:{keepCodeAsIs:!1}}),!0)}}])]}function LC({view:e,nextLanguage:t,opts:n}){let r=e.state.field(FC),i=e.state.doc.toString(),a=e.state.facet(Xl),o=e.state.facet(Zl),s=e.state.facet(Ql),c=e.state.facet($l),l=e.state.facet(eu),u=e.state.field(tv),d=e.state.selection.main.head,f;if(n.keepCodeAsIs)f=i,r.type!==t.type&&(u={...t.defaultMetadata});else{let[e,n]=r.transformOut(i,u),[a,o,s]=t.transformIn(e);d+=n,d-=o,d=Ut(d,0,a.length),f=a,u=s}e.dispatch({effects:[PC.of(t),$_.of(u),NC.reconfigure(t.getExtension(c,a,o,s,l)),nu.reconfigure([]),Nf.of(!0)],changes:n.keepCodeAsIs?void 0:{from:0,to:e.state.doc.length,insert:f},selection:n.keepCodeAsIs?void 0:Je.cursor(d)}),e.dispatch({effects:[nu.reconfigure([wt()])]}),t.type===`sql`&&LS(e)}function RC(e){let{placeholderType:t,completionConfig:n,hotkeys:r,cellId:i,lspConfig:a}=e;return[IC(),NC.of(YS.python.getExtension(i,n,r,t,a)),FC,tv]}function zC(e){return BC(UC({state:e}).trim())}function BC(e){return e?YS.markdown.isSupported(e)?YS.markdown:YS.sql.isSupported(e)?YS.sql:YS.python:YS.python}function VC(e,t){e.state.field(FC).type!==t.language&&LC({view:e,nextLanguage:YS[t.language],opts:{keepCodeAsIs:t.keepCodeAsIs??!1}})}function HC(e,{completionConfig:t,hotkeysProvider:n,lspConfig:r}){let i=e.state.field(FC),a=e.state.facet(Ql),o=e.state.facet($l);return o===void 0&&T.error(`Cell ID is undefined in reconfigureLanguageEffect`),a===void 0&&T.error(`Placeholder type is undefined in reconfigureLanguageEffect`),t===void 0&&T.error(`Completion config is undefined in reconfigureLanguageEffect`),NC.reconfigure(i.getExtension(o,t,n,a,r))}function UC(e,t,n){let r=e.state.field(FC),i=e.state.field(tv),a=e.state.doc.toString();return t===void 0?r.transformOut(a,i)[0]:r.transformOut(a.slice(t,n),i)[0]}function WC(e,t){let n=e.state.field(FC),r=BC(t);r.type!==n.type&&VC(e,{language:r.type,keepCodeAsIs:!0});let[i]=e.state.field(FC).transformIn(t);return Jl(e,i),i}function GC(e){let t=e.state.selection.main.head,n=e.state.doc.toString(),r=n.length>0&&n[t-1]===`
|
|
120
|
-
`,i=n.length>0&&n[t]===`
|
|
121
|
-
`,a=r?t-1:t,o=i?t+1:t;return{beforeCursorCode:UC(e,0,a),afterCursorCode:UC(e,o)}}if(typeof document<`u`){let e=`data-temp-href-target`;Gn.addHook(`beforeSanitizeAttributes`,t=>{t.tagName===`A`&&(t.hasAttribute(`target`)||t.setAttribute(`target`,`_self`),t.hasAttribute(`target`)&&t.setAttribute(e,t.getAttribute(`target`)||``))}),Gn.addHook(`afterSanitizeAttributes`,t=>{t.tagName===`A`&&t.hasAttribute(e)&&(t.setAttribute(`target`,t.getAttribute(e)||``),t.removeAttribute(e),t.getAttribute(`target`)===`_blank`&&t.setAttribute(`rel`,`noopener noreferrer`))})}function KC(e){let t={USE_PROFILES:{html:!0,svg:!0,mathMl:!0},ADD_TAGS:[`use`],ADD_ATTR:[`href`,`xlink:href`],FORCE_BODY:!0,CUSTOM_ELEMENT_HANDLING:{tagNameCheck:/^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,attributeNameCheck:/^[A-Za-z][\w-]*$/},SAFE_FOR_XML:!e.includes(`marimo-mermaid`)};return Gn.sanitize(e,t)}var qC=[`marimo-carousel`,`marimo-tabs`,`marimo-accordion`,`marimo-sidebar`],JC=`h1, h2, h3, h4, h5, h6`;function YC(e){if(typeof DOMParser>`u`)return null;let t=[],n=new DOMParser().parseFromString(e,`text/html`).querySelectorAll(JC);for(let e of Array.from(n)){let n=e.textContent;if(qC.some(t=>e.closest(t))||!n)continue;let r=Number.parseInt(e.tagName[1],10),i=e.innerHTML,a={name:n,level:r,by:ZC(e)};i!==n&&(a.html=KC(i)),t.push(a)}return{items:t}}function XC(e){if(!e.includes(`"`))return`"${e}"`;if(!e.includes(`'`))return`'${e}'`;let t=e.split(`"`),n=[];for(let[e,r]of t.entries())r&&n.push(`"${r}"`),e<t.length-1&&n.push(`'"'`);return`concat(${n.join(`, `)})`}function ZC(e){let t=e.id;if(t)return{id:t};let n=e.textContent??``;return{path:`//${e.tagName}[contains(., ${XC(n)})]`}}function QC(e){return{items:e.filter(Boolean).flatMap(e=>e.items)}}function $C(e){if(e==null||e.mimetype!==`text/html`&&e.mimetype!==`text/markdown`||e.data==null)return null;try{return O(typeof e.data==`string`,`expected string`),YC(e.data)}catch{return T.error(`Failed to parse outline`),null}}function ew(e){return e!=null&&e.items.some(e=>e.level<=3)}function tw(e,t){let n=e=>e.items.length===0?7:Math.min(...e.items.map(e=>e.level)),r=t[e];if(r==null||r.items.length===0)return T.warn(`Failed to find a starting outline`),null;let i=n(r),a=e+1;for(;a<t.length;){let r=t[a];if(r&&n(r)<=i)return[e,a-1];a++}return[e,t.length-1]}var nw=Zi(`marimo:rtc:username`,``,am),rw=Gt(()=>Vp(`rtc_v2`));function iw(e){return e!==dr}var aw=class e{lines=[``];cursor={row:0,col:0};static ESCAPE_REGEX=/\u001B\[([0-9;]*)([A-DJKH])/u;ensureLine(e){for(;this.lines.length<=e;)this.lines.push(``)}moveCursor(e,t){let n=this.cursor.row;this.cursor.row=Math.max(0,this.cursor.row+e),this.cursor.col=Math.max(0,this.cursor.col+t),this.ensureLine(this.cursor.row),e<0&&this.cursor.row<n&&this.lines.splice(this.cursor.row+1)}setCursor(e,t){this.cursor.row=Math.max(0,e),this.cursor.col=Math.max(0,t),this.ensureLine(this.cursor.row)}writeChar(e){this.ensureLine(this.cursor.row);let t=this.lines[this.cursor.row].padEnd(this.cursor.col,` `);this.lines[this.cursor.row]=t.slice(0,this.cursor.col)+e+t.slice(this.cursor.col+1),this.cursor.col++}writeString(e){if(e.length===0)return;this.ensureLine(this.cursor.row);let t=this.lines[this.cursor.row].padEnd(this.cursor.col,` `);this.lines[this.cursor.row]=t.slice(0,this.cursor.col)+e+t.slice(this.cursor.col+e.length),this.cursor.col+=e.length}control(e){switch(e){case`
|
|
122
|
-
`:this.cursor.row++,this.cursor.col=0,this.ensureLine(this.cursor.row);break;case`\r`:this.cursor.col=0;break;case` `:this.writeChar(` `);break;case`\b`:this.cursor.col=Math.max(0,this.cursor.col-1);break;case`\v`:this.cursor.row++,this.ensureLine(this.cursor.row)}}handleEscape(t){let n=e.ESCAPE_REGEX.exec(t);if(!n){this.writeString(t);return}let r=n[1].split(`;`).map(e=>e===``?1:Number.parseInt(e,10));switch(n[2]){case`A`:this.moveCursor(-r[0],0);break;case`B`:this.moveCursor(r[0],0);break;case`C`:this.moveCursor(0,r[0]);break;case`D`:this.moveCursor(0,-r[0]);break;case`H`:this.setCursor(r[0]-1||0,r[1]-1||0);break;case`J`:r[0]===2&&(this.lines=[``],this.setCursor(0,0));break;case`K`:switch(this.ensureLine(this.cursor.row),r[0]){case 0:this.lines[this.cursor.row]=this.lines[this.cursor.row].slice(0,this.cursor.col);break;case 1:{let e=this.lines[this.cursor.row].length;this.lines[this.cursor.row]=` `.repeat(this.cursor.col)+this.lines[this.cursor.row].slice(this.cursor.col,e);break}case 2:this.lines[this.cursor.row]=``}break;default:this.writeString(t)}}render(){return this.lines.join(`
|
|
123
|
-
`)}},ow=class{ESC_REGEX=/\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])/gu;parse(e){let t=[],n=0;for(let r of e.matchAll(this.ESC_REGEX)){let i=r.index??0;i>n&&t.push({type:`text`,value:e.slice(n,i)}),t.push({type:`escape`,value:r[0]}),n=i+r[0].length}return n<e.length&&t.push({type:`text`,value:e.slice(n)}),t}},sw=class{parser=new ow;buffer=new aw;reduce(e){return this.reset(),this.append(e),this.render()}append(e){let t=this.parser.parse(e);if(t.length===1&&t[0].type===`text`){let e=t[0].value;if(!this.hasControlChars(e)){this.buffer.writeString(e);return}}for(let e of t)e.type===`text`?this.processText(e.value):this.buffer.handleEscape(e.value)}reset(){this.buffer=new aw}render(){return this.buffer.render()}hasControlChars(e){for(let t of e)if(t<` `)return!0;return!1}processText(e){let t=0,n=e.length;for(let r=0;r<n;r++){let n=e[r];if(n===`
|
|
124
|
-
`||n===`\r`||n===` `||n===`\b`||n===`\v`){if(r>t){let n=e.slice(t,r),i=this.filterControlChars(n);i.length>0&&this.buffer.writeString(i)}this.buffer.control(n),t=r+1}else if(n<` `){if(r>t){let n=e.slice(t,r);n.length>0&&this.buffer.writeString(n)}t=r+1}}if(t<n){let n=e.slice(t),r=this.filterControlChars(n);r.length>0&&this.buffer.writeString(r)}}filterControlChars(e){let t=!1;for(let n of e)if(n<` `){t=!0;break}if(!t)return e;let n=``;for(let t of e)t>=` `&&(n+=t);return n}},cw=class e{mimetype;channel;timestamp;ansiReducer=new sw;_data;get data(){return this._data}static create(t){let n=new sw;return n.append(t.data),new e(t.mimetype,t.channel,t.timestamp,n)}constructor(e,t,n,r){this.mimetype=e,this.channel=t,this.timestamp=n,this.ansiReducer=r,this._data=this.ansiReducer.render()}appendData(t){return this.ansiReducer.append(t),new e(this.mimetype,this.channel,this.timestamp,this.ansiReducer)}toJSON(){return{mimetype:this.mimetype,channel:this.channel,timestamp:this.timestamp,data:this.data}}};function lw(e,t=5e3){let n=[...e];if(n.length<2)return mw(n.map(dw),t);let r=n[n.length-1],i=n[n.length-2];return uw(r,i)&&(pw(r),pw(i),n[n.length-2]=fw(i,r),n.pop()),mw(n,t)}function uw(e,t){let n=e.mimetype===`text/plain`&&t.mimetype===`text/plain`;if(!n)return!1;let r=e.channel===t.channel,i=e.channel!==`stdin`;return n&&r&&i}function dw(e){return e instanceof cw?e:typeof e.data==`string`?cw.create(e):e}function fw(e,t){return e instanceof cw?e.appendData(t.data):cw.create(e).appendData(t.data)}function pw(e){O(typeof e.data==`string`,`expected string output`)}function mw(e,t){let n=0,r;for(r=e.length-1;r>=0&&n<t;r--){let t=e[r];t.mimetype===`text/plain`?(O(typeof t.data==`string`,`expected string`),n+=t.data.split(`
|
|
125
|
-
`).length):n++}if(n<t)return e;let i=r+1,a={channel:`stderr`,mimetype:`text/html`,data:`<pre>Streaming output truncated to last ${t} lines.\n</pre>`,timestamp:-1},o=e[i];if(o==null)return[a,...e.slice(i+1)];if(o.mimetype===`text/plain`){O(typeof o.data==`string`,`expected string`);let r=o.data.split(`
|
|
126
|
-
`),s=t-(n-r.length);return[a,{...o,data:r.slice(-s).join(`
|
|
127
|
-
`)},...e.slice(i+1)]}return[a,...e.slice(i+1)]}function hw(e,t){let n={...e};switch(t.status){case`queued`:n.interrupted=!1,n.errored=!1,n.runElapsedTimeMs=null,n.debuggerActive=!1;break;case`running`:n.interrupted=!1,e.stopped&&(n.output=null),n.status===`queued`&&(n.consoleOutputs=[]),n.stopped=!1,n.runStartTimestamp=t.timestamp,n.lastRunStartTimestamp=t.timestamp;break;case`idle`:e.runStartTimestamp&&(n.runElapsedTimeMs=Hg.fromSeconds((t.timestamp??0)-e.runStartTimestamp).toMilliseconds(),n.runStartTimestamp=null,n.staleInputs=!1),!e.lastRunStartTimestamp&&t.timestamp&&(n.lastRunStartTimestamp=t.timestamp),n.debuggerActive=!1;break;case null:break;case`disabled-transitively`:break;case void 0:break;default:rn(t.status)}n.output=t.output??n.output,n.staleInputs=t.stale_inputs??n.staleInputs,n.status=t.status??n.status,t.serialization!==void 0&&(n.serialization=t.serialization);let r=!1;t.output!=null&&t.output.mimetype===`application/vnd.marimo+error`&&((n.status===`queued`||n.status===`running`)&&(n.status=`idle`),O(Array.isArray(t.output.data),`Expected error output data to be an array`),t.output.data.some(e=>e.type===`interruption`)?(n.interrupted=!0,r=!0):t.output.data.some(e=>e.type.includes(`ancestor`))?n.stopped=!0:n.errored=!0);let i=e.consoleOutputs;(r||t.status===`idle`)&&(n.debuggerActive=!1,i=i.map(e=>e.channel===`stdin`?{...e,response:e.response??``}:e));let a=t.console;a!=null&&(i=lw(Array.isArray(a)?a:[...i,a])),n.consoleOutputs=i,n.outline=$C(n.output);let o=[t.console].flat().filter(Boolean).filter(e=>e.channel===`pdb`);return o.length>0&&o.some(e=>e.data===`start`)&&(n.debuggerActive=!0),n}function gw(e){let t={...e};return e.status!==`disabled-transitively`&&(t.status=`queued`),t.interrupted=!1,t.errored=!1,t.runElapsedTimeMs=null,t.debuggerActive=!1,t}function _w(e){return e===`running`||e===`queued`}function vw(e,t){let{status:n,output:r,runStartTimestamp:i,interrupted:a,staleInputs:o}=e;if(a)return!1;if(t)return!0;let s=_w(n),c=n===`running`&&r!==null&&i!==null&&(r.timestamp??0)>i;return s&&!c?!0:o}function yw(e,t){if(!e){T.warn(`getCell: cellId is undefined`);return}let n=t.cellData[e];if(!n){T.warn(`getCell: cell ${e} not found in state`);return}return n}function bw(e,t){let n=t.cellIds.inOrderIds,r=n.indexOf(e);if(r>0)return{after:n[r-1]};if(r===0&&n.length>1)return{before:n[1]}}function xw(e){let t=new Map,n=e.cellIds.getColumns();for(let[e,r]of n.entries())for(let n of r.inOrderIds)t.set(n,e);return t}function Sw(e,t){let n=new Set(e.cellIds.inOrderIds),r=[];for(let e of t.cellIds.inOrderIds)if(!n.has(e)){let n=yw(e,t);n&&r.push({type:`create-cell`,cellId:n.id,code:n.code,name:n.name,config:n.config,...bw(n.id,t)})}return r}function Cw(e,t){let n=new Set(t.cellIds.inOrderIds),r=[];for(let t of e.cellIds.inOrderIds)n.has(t)||r.push({type:`delete-cell`,cellId:t});return r}function ww(e,t){let n=xw(e),r=xw(t),i=[];for(let[e,a]of r)if(n.get(e)!==a){let n=yw(e,t);i.push({type:`set-config`,cellId:e,column:a,disabled:n?.config.disabled??!1,hideCode:n?.config.hide_code??!1})}return i.push({type:`reorder-cells`,cellIds:t.cellIds.inOrderIds}),i}function Tw(e,t,n){switch(n.type){case`createNewCell`:return Sw(e,t);case`deleteCell`:return[{type:`delete-cell`,cellId:n.payload.cellId}];case`moveCell`:case`sendToTop`:case`sendToBottom`:{let{cellId:e}=n.payload;return[{type:`move-cell`,cellId:e,...bw(e,t)}]}case`dropCellOverCell`:case`dropCellOverColumn`:case`moveCellToIndex`:case`moveCellsRelativeTo`:return ww(e,t);case`updateCellCode`:{let e=yw(n.payload.cellId,t);return e?[{type:`set-code`,cellId:e.id,code:e.code}]:[]}case`updateCellName`:{let e=yw(n.payload.cellId,t);return e?[{type:`set-name`,cellId:e.id,name:e.name}]:[]}case`updateCellConfig`:{let{cellId:e}=n.payload,r=yw(e,t);return r?[{type:`set-config`,cellId:e,column:r.config.column??null,disabled:r.config.disabled??!1,hideCode:r.config.hide_code??!1}]:[]}case`dropOverNewColumn`:case`moveColumn`:case`addColumnBreakpoint`:case`deleteColumn`:case`mergeAllColumns`:case`compactColumns`:return ww(e,t);case`addColumn`:return[...Sw(e,t),...ww(e,t)];case`undoDeleteCell`:{let n=Sw(e,t),r=ww(e,t);return n.length===0?r:r.length>1?[...n,...r]:n}case`splitCell`:{let{cellId:r}=n.payload,i=yw(r,t);return i?[{type:`set-code`,cellId:r,code:i.code},...Sw(e,t)]:[]}case`undoSplitCell`:{let{cellId:r}=n.payload,i=yw(r,t);return i?[{type:`set-code`,cellId:r,code:i.code},...Cw(e,t)]:[]}case`moveToNextCell`:return Sw(e,t);case`addSetupCellIfDoesntExist`:return Sw(e,t);case`focusCell`:case`focusTopCell`:case`focusBottomCell`:case`scrollToTarget`:case`showCellIfHidden`:case`markTouched`:case`markUntouched`:return[];case`prepareForRun`:case`handleCellMessage`:case`setCellIds`:case`rebuildCellColumns`:case`setCellCodes`:case`setCells`:case`setStdinResponse`:case`clearSerializedEditorState`:case`clearCellOutput`:case`clearCellConsoleOutput`:case`clearAllCellOutputs`:case`clearLogs`:case`addLogs`:return[];case`foldAll`:case`unfoldAll`:case`collapseCell`:case`expandCell`:case`collapseAllCells`:case`expandAllCells`:return[];default:an(n)}}function Ew(e){let t=new Set,n=new Set;for(let r of e)r.type===`create-cell`?t.add(r.cellId):r.type===`delete-cell`&&n.add(r.cellId);return t.intersection(n)}function Dw(e,t){let n=[];for(let r of e)switch(r.type){case`create-cell`:{let e=`__end__`,t=!1;r.after?(e=r.after,t=!1):r.before&&(e=r.before,t=!0),n.push({type:`createNewCell`,payload:{cellId:e,before:t,code:r.code,newCellId:r.cellId,autoFocus:!1,hideCode:r.config?.hide_code??!1}}),r.name&&n.push({type:`updateCellName`,payload:{cellId:r.cellId,name:r.name}}),(r.config?.disabled!=null||r.config?.column!=null)&&n.push({type:`updateCellConfig`,payload:{cellId:r.cellId,config:{...r.config.disabled!=null&&{disabled:r.config.disabled},...r.config.column!=null&&{column:r.config.column}}}});break}case`delete-cell`:n.push({type:`deleteCell`,payload:{cellId:r.cellId}});break;case`move-cell`:{let e=[...t()],i=r.cellId,a=e.indexOf(i);if(a<0)break;if(e.splice(a,1),r.after){let t=e.indexOf(r.after);t>=0?e.splice(t+1,0,i):e.push(i)}else if(r.before){let t=e.indexOf(r.before);t>=0?e.splice(t,0,i):e.unshift(i)}else e.push(i);n.push({type:`setCellIds`,payload:{cellIds:e}});break}case`reorder-cells`:n.push({type:`setCellIds`,payload:{cellIds:r.cellIds}});break;case`set-code`:n.push({type:`setCellCodes`,payload:{ids:[r.cellId],codes:[r.code],codeIsStale:!0}});break;case`set-name`:n.push({type:`updateCellName`,payload:{cellId:r.cellId,name:r.name}});break;case`set-config`:n.push({type:`updateCellConfig`,payload:{cellId:r.cellId,config:{column:r.column,disabled:r.disabled,hide_code:r.hideCode}}})}return n}var Ow=new Set([`set-code`,`set-name`,`set-config`]),kw=new Set([`set-code`,`set-name`,`set-config`,`move-cell`]);function Aw(e){let t=new Set;for(let n of e)n.type===`delete-cell`&&t.add(n.cellId);let n=e.filter(e=>!(kw.has(e.type)&&`cellId`in e&&t.has(e.cellId))),r=new Map;return n.forEach((e,t)=>{Ow.has(e.type)&&`cellId`in e&&r.set(`${e.type}:${e.cellId}`,t)}),n.filter((e,t)=>Ow.has(e.type)&&`cellId`in e?r.get(`${e.type}:${e.cellId}`)===t:!0)}var jw=[],Mw=S(()=>{let e=Aw(jw);jw=[],e.length!==0&&sn().sendDocumentTransaction({changes:e})},400);function Nw(e){return`cellId`in e&&e.cellId===`__scratch__`}function Pw(e){u.get(j)||Nw(e)||(jw.push(e),Mw())}function Fw(e,t,n){for(let r of Tw(e,t,n))Pw(r)}function Iw(e,t,n){let r=Ew(e),i=[...e.filter(e=>e.type!==`set-config`),...e.filter(e=>e.type===`set-config`)],a=!1,o=null;for(let e of i)if(!(r.size>0&&`cellId`in e&&r.has(e.cellId))){e.type===`set-config`&&(a=!0),e.type===`create-cell`&&e.config?.column!=null&&(a=!0),e.type===`reorder-cells`&&(o=e.cellIds);for(let r of Dw([e],n))t[r.type](r.payload)}a&&t.rebuildCellColumns({cellIds:o??n()})}function Lw(e,t){return On(e*1e3,t?.in)}var Rw=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},zw;(function(e){e[e.EOS=0]=`EOS`,e[e.Text=1]=`Text`,e[e.Incomplete=2]=`Incomplete`,e[e.ESC=3]=`ESC`,e[e.Unknown=4]=`Unknown`,e[e.SGR=5]=`SGR`,e[e.OSCURL=6]=`OSCURL`})(zw||={});var Bw=class{constructor(){this.VERSION=`6.0.6`,this.setup_palettes(),this._use_classes=!1,this.bold=!1,this.faint=!1,this.italic=!1,this.underline=!1,this.fg=this.bg=null,this._buffer=``,this._url_allowlist={http:1,https:1},this._escape_html=!0,this.boldStyle=`font-weight:bold`,this.faintStyle=`opacity:0.7`,this.italicStyle=`font-style:italic`,this.underlineStyle=`text-decoration:underline`}set use_classes(e){this._use_classes=e}get use_classes(){return this._use_classes}set url_allowlist(e){this._url_allowlist=e}get url_allowlist(){return this._url_allowlist}set escape_html(e){this._escape_html=e}get escape_html(){return this._escape_html}set boldStyle(e){this._boldStyle=e}get boldStyle(){return this._boldStyle}set faintStyle(e){this._faintStyle=e}get faintStyle(){return this._faintStyle}set italicStyle(e){this._italicStyle=e}get italicStyle(){return this._italicStyle}set underlineStyle(e){this._underlineStyle=e}get underlineStyle(){return this._underlineStyle}setup_palettes(){this.ansi_colors=[[{rgb:[0,0,0],class_name:`ansi-black`},{rgb:[187,0,0],class_name:`ansi-red`},{rgb:[0,187,0],class_name:`ansi-green`},{rgb:[187,187,0],class_name:`ansi-yellow`},{rgb:[0,0,187],class_name:`ansi-blue`},{rgb:[187,0,187],class_name:`ansi-magenta`},{rgb:[0,187,187],class_name:`ansi-cyan`},{rgb:[255,255,255],class_name:`ansi-white`}],[{rgb:[85,85,85],class_name:`ansi-bright-black`},{rgb:[255,85,85],class_name:`ansi-bright-red`},{rgb:[0,255,0],class_name:`ansi-bright-green`},{rgb:[255,255,85],class_name:`ansi-bright-yellow`},{rgb:[85,85,255],class_name:`ansi-bright-blue`},{rgb:[255,85,255],class_name:`ansi-bright-magenta`},{rgb:[85,255,255],class_name:`ansi-bright-cyan`},{rgb:[255,255,255],class_name:`ansi-bright-white`}]],this.palette_256=[],this.ansi_colors.forEach(e=>{e.forEach(e=>{this.palette_256.push(e)})});let e=[0,95,135,175,215,255];for(let t=0;t<6;++t)for(let n=0;n<6;++n)for(let r=0;r<6;++r){let i={rgb:[e[t],e[n],e[r]],class_name:`truecolor`};this.palette_256.push(i)}let t=8;for(let e=0;e<24;++e,t+=10){let e={rgb:[t,t,t],class_name:`truecolor`};this.palette_256.push(e)}}escape_txt_for_html(e){return this._escape_html?e.replace(/[&<>"']/gm,e=>{if(e===`&`)return`&`;if(e===`<`)return`<`;if(e===`>`)return`>`;if(e===`"`)return`"`;if(e===`'`)return`'`}):e}append_buffer(e){var t=this._buffer+e;this._buffer=t}get_next_packet(){var e={kind:zw.EOS,text:``,url:``},t=this._buffer.length;if(t==0)return e;var n=this._buffer.indexOf(`\x1B`);if(n==-1)return e.kind=zw.Text,e.text=this._buffer,this._buffer=``,e;if(n>0)return e.kind=zw.Text,e.text=this._buffer.slice(0,n),this._buffer=this._buffer.slice(n),e;if(n==0){if(t<3)return e.kind=zw.Incomplete,e;var r=this._buffer.charAt(1);if(r!=`[`&&r!=`]`&&r!=`(`)return e.kind=zw.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;if(r==`[`){this._csi_regex||=Vw(Uw||=Rw([`
|
|
128
|
-
^ # beginning of line
|
|
129
|
-
#
|
|
130
|
-
# First attempt
|
|
131
|
-
(?: # legal sequence
|
|
132
|
-
\x1B[ # CSI
|
|
133
|
-
([<-?]?) # private-mode char
|
|
134
|
-
([d;]*) # any digits or semicolons
|
|
135
|
-
([ -/]? # an intermediate modifier
|
|
136
|
-
[@-~]) # the command
|
|
137
|
-
)
|
|
138
|
-
| # alternate (second attempt)
|
|
139
|
-
(?: # illegal sequence
|
|
140
|
-
\x1B[ # CSI
|
|
141
|
-
[ -~]* # anything legal
|
|
142
|
-
([\0-:]) # anything illegal
|
|
143
|
-
)
|
|
144
|
-
`],[`
|
|
145
|
-
^ # beginning of line
|
|
146
|
-
#
|
|
147
|
-
# First attempt
|
|
148
|
-
(?: # legal sequence
|
|
149
|
-
\\x1b\\[ # CSI
|
|
150
|
-
([\\x3c-\\x3f]?) # private-mode char
|
|
151
|
-
([\\d;]*) # any digits or semicolons
|
|
152
|
-
([\\x20-\\x2f]? # an intermediate modifier
|
|
153
|
-
[\\x40-\\x7e]) # the command
|
|
154
|
-
)
|
|
155
|
-
| # alternate (second attempt)
|
|
156
|
-
(?: # illegal sequence
|
|
157
|
-
\\x1b\\[ # CSI
|
|
158
|
-
[\\x20-\\x7e]* # anything legal
|
|
159
|
-
([\\x00-\\x1f:]) # anything illegal
|
|
160
|
-
)
|
|
161
|
-
`]));let t=this._buffer.match(this._csi_regex);if(t===null)return e.kind=zw.Incomplete,e;if(t[4])return e.kind=zw.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;e.kind=t[1]!=``||t[3]!=`m`?zw.Unknown:zw.SGR,e.text=t[2];var i=t[0].length;return this._buffer=this._buffer.slice(i),e}if(r==`]`){if(t<4)return e.kind=zw.Incomplete,e;if(this._buffer.charAt(2)!=`8`||this._buffer.charAt(3)!=`;`)return e.kind=zw.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;this._osc_st||=Hw(Ww||=Rw([`
|
|
162
|
-
(?: # legal sequence
|
|
163
|
-
(\x1B\\) # ESC | # alternate
|
|
164
|
-
(\x07) # BEL (what xterm did)
|
|
165
|
-
)
|
|
166
|
-
| # alternate (second attempt)
|
|
167
|
-
( # illegal sequence
|
|
168
|
-
[\0-] # anything illegal
|
|
169
|
-
| # alternate
|
|
170
|
-
[\b-] # anything illegal
|
|
171
|
-
| # alternate
|
|
172
|
-
[-] # anything illegal
|
|
173
|
-
)
|
|
174
|
-
`],[`
|
|
175
|
-
(?: # legal sequence
|
|
176
|
-
(\\x1b\\\\) # ESC \\
|
|
177
|
-
| # alternate
|
|
178
|
-
(\\x07) # BEL (what xterm did)
|
|
179
|
-
)
|
|
180
|
-
| # alternate (second attempt)
|
|
181
|
-
( # illegal sequence
|
|
182
|
-
[\\x00-\\x06] # anything illegal
|
|
183
|
-
| # alternate
|
|
184
|
-
[\\x08-\\x1a] # anything illegal
|
|
185
|
-
| # alternate
|
|
186
|
-
[\\x1c-\\x1f] # anything illegal
|
|
187
|
-
)
|
|
188
|
-
`])),this._osc_st.lastIndex=0;{let t=this._osc_st.exec(this._buffer);if(t===null)return e.kind=zw.Incomplete,e;if(t[3])return e.kind=zw.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e}{let t=this._osc_st.exec(this._buffer);if(t===null)return e.kind=zw.Incomplete,e;if(t[3])return e.kind=zw.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e}this._osc_regex||=Vw(Gw||=Rw([`
|
|
189
|
-
^ # beginning of line
|
|
190
|
-
#
|
|
191
|
-
\x1B]8; # OSC Hyperlink
|
|
192
|
-
[ -:<-~]* # params (excluding ;)
|
|
193
|
-
; # end of params
|
|
194
|
-
([!-~]{0,512}) # URL capture
|
|
195
|
-
(?: # ST
|
|
196
|
-
(?:\x1B\\) # ESC | # alternate
|
|
197
|
-
(?:\x07) # BEL (what xterm did)
|
|
198
|
-
)
|
|
199
|
-
([ -~]+) # TEXT capture
|
|
200
|
-
\x1B]8;; # OSC Hyperlink End
|
|
201
|
-
(?: # ST
|
|
202
|
-
(?:\x1B\\) # ESC | # alternate
|
|
203
|
-
(?:\x07) # BEL (what xterm did)
|
|
204
|
-
)
|
|
205
|
-
`],[`
|
|
206
|
-
^ # beginning of line
|
|
207
|
-
#
|
|
208
|
-
\\x1b\\]8; # OSC Hyperlink
|
|
209
|
-
[\\x20-\\x3a\\x3c-\\x7e]* # params (excluding ;)
|
|
210
|
-
; # end of params
|
|
211
|
-
([\\x21-\\x7e]{0,512}) # URL capture
|
|
212
|
-
(?: # ST
|
|
213
|
-
(?:\\x1b\\\\) # ESC \\
|
|
214
|
-
| # alternate
|
|
215
|
-
(?:\\x07) # BEL (what xterm did)
|
|
216
|
-
)
|
|
217
|
-
([\\x20-\\x7e]+) # TEXT capture
|
|
218
|
-
\\x1b\\]8;; # OSC Hyperlink End
|
|
219
|
-
(?: # ST
|
|
220
|
-
(?:\\x1b\\\\) # ESC \\
|
|
221
|
-
| # alternate
|
|
222
|
-
(?:\\x07) # BEL (what xterm did)
|
|
223
|
-
)
|
|
224
|
-
`]));let n=this._buffer.match(this._osc_regex);if(n===null)return e.kind=zw.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;e.kind=zw.OSCURL,e.url=n[1],e.text=n[2];var i=n[0].length;return this._buffer=this._buffer.slice(i),e}if(r==`(`)return e.kind=zw.Unknown,this._buffer=this._buffer.slice(3),e}}ansi_to_html(e){this.append_buffer(e);for(var t=[];;){var n=this.get_next_packet();if(n.kind==zw.EOS||n.kind==zw.Incomplete)break;n.kind!=zw.ESC&&n.kind!=zw.Unknown&&(n.kind==zw.Text?t.push(this.transform_to_html(this.with_state(n))):n.kind==zw.SGR?this.process_ansi(n):n.kind==zw.OSCURL&&t.push(this.process_hyperlink(n)))}return t.join(``)}with_state(e){return{bold:this.bold,faint:this.faint,italic:this.italic,underline:this.underline,fg:this.fg,bg:this.bg,text:e.text}}process_ansi(e){let t=e.text.split(`;`);for(;t.length>0;){let e=t.shift(),n=parseInt(e,10);if(isNaN(n)||n===0)this.fg=null,this.bg=null,this.bold=!1,this.faint=!1,this.italic=!1,this.underline=!1;else if(n===1)this.bold=!0;else if(n===2)this.faint=!0;else if(n===3)this.italic=!0;else if(n===4)this.underline=!0;else if(n===21)this.bold=!1;else if(n===22)this.faint=!1,this.bold=!1;else if(n===23)this.italic=!1;else if(n===24)this.underline=!1;else if(n===39)this.fg=null;else if(n===49)this.bg=null;else if(n>=30&&n<38)this.fg=this.ansi_colors[0][n-30];else if(n>=40&&n<48)this.bg=this.ansi_colors[0][n-40];else if(n>=90&&n<98)this.fg=this.ansi_colors[1][n-90];else if(n>=100&&n<108)this.bg=this.ansi_colors[1][n-100];else if((n===38||n===48)&&t.length>0){let e=n===38,r=t.shift();if(r===`5`&&t.length>0){let n=parseInt(t.shift(),10);n>=0&&n<=255&&(e?this.fg=this.palette_256[n]:this.bg=this.palette_256[n])}if(r===`2`&&t.length>2){let n=parseInt(t.shift(),10),r=parseInt(t.shift(),10),i=parseInt(t.shift(),10);if(n>=0&&n<=255&&r>=0&&r<=255&&i>=0&&i<=255){let t={rgb:[n,r,i],class_name:`truecolor`};e?this.fg=t:this.bg=t}}}}}transform_to_html(e){let t=e.text;if(t.length===0||(t=this.escape_txt_for_html(t),!e.bold&&!e.italic&&!e.faint&&!e.underline&&e.fg===null&&e.bg===null))return t;let n=[],r=[],i=e.fg,a=e.bg;e.bold&&n.push(this._boldStyle),e.faint&&n.push(this._faintStyle),e.italic&&n.push(this._italicStyle),e.underline&&n.push(this._underlineStyle),this._use_classes?(i&&(i.class_name===`truecolor`?n.push(`color:rgb(${i.rgb.join(`,`)})`):r.push(`${i.class_name}-fg`)),a&&(a.class_name===`truecolor`?n.push(`background-color:rgb(${a.rgb.join(`,`)})`):r.push(`${a.class_name}-bg`))):(i&&n.push(`color:rgb(${i.rgb.join(`,`)})`),a&&n.push(`background-color:rgb(${a.rgb})`));let o=``,s=``;return r.length&&(o=` class="${r.join(` `)}"`),n.length&&(s=` style="${n.join(`;`)}"`),`<span${s}${o}>${t}</span>`}process_hyperlink(e){let t=e.url.split(`:`);return t.length<1||!this._url_allowlist[t[0]]?``:`<a href="${this.escape_txt_for_html(e.url)}">${this.escape_txt_for_html(e.text)}</a>`}};function Vw(e,...t){let n=e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,``);return new RegExp(n)}function Hw(e,...t){let n=e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,``);return new RegExp(n,`g`)}var Uw,Ww,Gw,Kw=new Bw;function qw(e){try{let t=document.createElement(`div`);return t.innerHTML=e,(t.textContent||t.innerText||``).split(`
|
|
225
|
-
`).map(e=>e.trimEnd()).join(`
|
|
226
|
-
`)}catch(t){return T.error(`Error parsing HTML content:`,t),e}}function Jw(e){if(!e)return``;try{return qw(Kw.ansi_to_html(e))}catch(t){return T.error(`Error converting ANSI to plain text:`,t),e}}var Yw=o(null),Xw=Oi,Zw=U.forwardRef((e,t)=>{let n=(0,Qd.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=oe(`fixed top-0 z-100 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:w-fit md:max-w-[420px]`,`print:hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(G,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Zw.displayName=G.displayName;var Qw={default:`bg-background border`,danger:`group destructive text-error border-destructive bg-(--red-1) shadow-md-solid shadow-error`},$w=N(`data-[swipe=move]:transition-none group relative pointer-events-auto flex w-full items-start justify-between gap-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=move]:translate-x-(--radix-toast-swipe-move-x) data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-(--radix-toast-swipe-end-x) data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-top-full sm:data-[state=open]:slide-in-from-bottom-full data-[state=closed]:slide-out-to-right-full`,{variants:{variant:Qw},defaultVariants:{variant:`default`}});function eT(e){return typeof e==`string`&&e in Qw}var tT=U.forwardRef((e,t)=>{let n=(0,Qd.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,variant:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=eT(a)?a:`default`,s;n[4]!==r||n[5]!==o?(s=oe($w({variant:o}),`print:hidden`,r),n[4]=r,n[5]=o,n[6]=s):s=n[6];let c;return n[7]!==i||n[8]!==t||n[9]!==s?(c=(0,W.jsx)(ki,{ref:t,className:s,...i}),n[7]=i,n[8]=t,n[9]=s,n[10]=c):c=n[10],c});tT.displayName=ki.displayName;var nT=U.forwardRef((e,t)=>{let n=(0,Qd.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=oe(`inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-destructive/30 hover:group-[.destructive]:border-destructive/30 hover:group-[.destructive]:bg-destructive hover:group-[.destructive]:text-destructive-foreground focus:group-[.destructive]:ring-destructive`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(Mi,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});nT.displayName=Mi.displayName;var rT=U.forwardRef((e,t)=>{let n=(0,Qd.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=oe(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-hidden focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 hover:group-[.destructive]:text-red-500 focus:group-[.destructive]:ring-red-400 focus:group-[.destructive]:ring-offset-red-600`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,W.jsx)(Dn,{className:`h-4 w-4`}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,W.jsx)(Ni,{ref:t,className:a,"toast-close":``,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});rT.displayName=Ni.displayName;var iT=U.forwardRef((e,t)=>{let n=(0,Qd.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=oe(`text-sm font-semibold`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(Ai,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});iT.displayName=Ai.displayName;var aT=U.forwardRef((e,t)=>{let n=(0,Qd.c)(13),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,onPointerDown:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===r?o=n[5]:(o=oe(`max-h-48 overflow-auto text-sm opacity-90 whitespace-pre-wrap wrap-break-word select-text cursor-text`,r),n[4]=r,n[5]=o);let s;n[6]===i?s=n[7]:(s=e=>{e.stopPropagation(),i?.(e)},n[6]=i,n[7]=s);let c;return n[8]!==a||n[9]!==t||n[10]!==o||n[11]!==s?(c=(0,W.jsx)(ji,{ref:t,className:o,onPointerDown:s,...a}),n[8]=a,n[9]=t,n[10]=o,n[11]=s,n[12]=c):c=n[12],c});aT.displayName=ji.displayName;function oT(e){return e.type===`cell`?e.cellId:`lsp:${e.name}`}var sT=!1;function cT(e){let t=[],n=[e.console].filter(Boolean).flat();for(let r of n){let n=r.mimetype===`text/plain`,i=r.mimetype===`text/html`||r.mimetype===`application/vnd.marimo+traceback`;if(n||i){let n=r.channel===`stderr`||r.channel===`marimo-error`;switch(r.channel){case`stdout`:case`stderr`:case`marimo-error`:{let a=on.asString(r.data),o=i?qw(a):a;t.push({timestamp:r.timestamp||Date.now(),level:n?`stderr`:`stdout`,message:o,source:{type:`cell`,cellId:e.cell_id}});break}}}}if(t.forEach(lT.log),n.length===0&&au(e.output?.mimetype)&&Array.isArray(e.output.data)){e.output.data.forEach(t=>{lT.log({level:`stderr`,source:{type:`cell`,cellId:e.cell_id},timestamp:e.timestamp??0,message:JSON.stringify(t)})});let t=e.output.data.filter(e=>`type`in e&&e.type===`exception`||e.type===`internal`),n=u.get(re)===`read`;if(t.length>0&&!sT&&n){sT=!0;let e=t.find(e=>e.traceback);Hn(e?{title:`An internal error occurred`,description:e.msg||`Click 'View' to see traceback`,variant:`danger`,action:U.createElement(nT,{altText:`View traceback`,onClick:()=>{u.set(Yw,{traceback:e.traceback,errorMessage:e.msg||`An internal error occurred`})}},`View`)}:{title:`An internal error occurred`,description:`See console for details.`,variant:`danger`})}}return t}var lT={log:e=>{let t=e.level===`stdout`?`gray`:e.level===`stderr`?`red`:`orange`,n=e.level.toUpperCase();console.log(`%c[${n}]`,`color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`,`[${uT(e.timestamp)}]`,`(${oT(e.source)}) ${e.message}`)}};function uT(e){try{return Lw(e).toLocaleTimeString(void 0,{hour12:!0,hour:`numeric`,minute:`numeric`,second:`numeric`})}catch{return``}}function dT(e,t){let n=wE(t);n?n.focus():T.warn(`[CellFocusManager] focusCellEditor: element not found: ${t}`)}function fT(e){let t=document.getElementById(mr.create(e));t?hT(t):T.warn(`[CellFocusManager] focusCell: element not found: ${e}`)}function pT(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function mT(){return document.activeElement instanceof HTMLElement&&document.activeElement.classList.contains(`marimo-cell`)}function hT(e){try{e.focus()}catch{T.warn(`[CellFocusManager] element may not be focusable`,e)}}function gT(e,t){let{retries:n,delay:r,initialDelay:i=0}=t,a=0,o=()=>{if(a<n){try{if(e())return}catch(e){T.error(`Error executing function on attempt ${a+1}, retrying`,{error:e})}a++,setTimeout(o,r)}};i>0?setTimeout(o,i):o()}function _T(){let e=globalThis.scheduler;if(typeof e?.postTask==`function`)return t=>{e.postTask(t,{priority:`user-visible`}).catch(e=>{setTimeout(()=>{throw e})})};if(typeof MessageChannel==`function`){let e=[],t=new MessageChannel;return t.port1.onmessage=()=>{e.shift()?.()},n=>{e.push(n),t.port2.postMessage(null)}}return e=>{setTimeout(e,0)}}var vT=_T();function yT(e=vT){let t=new Map,n=new Set,r=!1;function i(){r||t.size===0||(r=!0,e(o))}function a(){for(let e of n){if(t.has(e))return e;n.delete(e)}return t.keys().next().value}function o(){r=!1;try{let e=a();if(e!==void 0){let r=t.get(e);t.delete(e),n.delete(e),r?.()}}finally{i()}}return{request(e,n){t.set(e,n),i()},promote(e){let r=t.get(e);r&&(t.delete(e),n.delete(e),r())},prioritize(e){t.has(e)&&n.add(e)},deprioritize(e){n.delete(e)},cancel(e){t.delete(e),n.delete(e)}}}var bT=yT();function xT({cellId:e,cell:t,isCodeHidden:n,codeFocus:r,variableName:i}){if(!t)return;let a=document.getElementById(mr.create(e));if(!a){T.warn(`scrollCellIntoView: element not found`);return}if(mT()){hT(a);return}if(n)hT(a);else{bT.promote(e);let n=t.current?.editorView;if(!n){T.warn(`scrollCellIntoView: editor not found`,e);return}if(n.hasFocus||!document.hasFocus())return;if(gT(()=>(n.focus(),n.hasFocus),{retries:5,delay:20}),r===`top`)n.dispatch({selection:{anchor:0,head:0}});else if(r===`bottom`){let e=n.state.doc.line(n.state.doc.lines);n.dispatch({selection:{anchor:e.from,head:e.from}})}else i&&lg(n,i)}a.scrollIntoView({behavior:`smooth`,block:`nearest`})}function ST(e){let t=document.getElementById(mr.create(e));if(!t){T.warn(`scrollCellIntoView: element not found`);return}t.classList.add(`focus-outline`),setTimeout(()=>{t.classList.remove(`focus-outline`)},2e3),t.scrollIntoView({behavior:`smooth`,block:`center`})}function CT(){let e=document.getElementById(`App`);e?.scrollTo({top:e.scrollHeight,behavior:`smooth`})}function wT(){document.getElementById(`App`)?.scrollTo({top:0,behavior:`smooth`})}function TT(e){let t=wE(e);if(t?.hasFocus){Xp(t,{behavior:`instant`});return}let n=document.getElementById(mr.create(e));n?n.scrollIntoView({behavior:`instant`,block:`nearest`}):T.warn(`[CellFocusManager] scrollCellIntoView: element not found: ${e}`)}function ET({id:e,name:t=`_`,code:n=``,lastCodeRun:r=null,lastExecutionTime:i=null,edited:a=!1,config:o,serializedEditorState:s=null}){return{id:e,config:o||{hide_code:!1,disabled:!1,column:null},name:t,code:n,edited:a,lastCodeRun:r,lastExecutionTime:i,serializedEditorState:s}}function DT(e){return{hide_code:!1,disabled:!1,column:null,...e}}function OT(e){return{outline:null,output:null,consoleOutputs:[],status:`idle`,staleInputs:!1,interrupted:!1,errored:!1,stopped:!1,runElapsedTimeMs:null,runStartTimestamp:null,lastRunStartTimestamp:null,debuggerActive:!1,...e}}function kT(e){let t={column:0,hide_code:!1,disabled:!1};return{...e,cellData:{[dr]:ET({id:dr,config:t}),...e.cellData},cellRuntime:{[dr]:OT(),...e.cellRuntime},cellHandles:{[dr]:(0,U.createRef)(),...e.cellHandles}}}function AT(){return kT({cellIds:ba.from([]),cellData:{},cellRuntime:{},cellHandles:{},history:[],scrollKey:null,cellLogs:[],untouchedNewCells:new Set})}var{reducer:jT,addMiddleware:MT,createActions:NT,useActions:PT,valueAtom:FT}=Jt(AT,{createNewCell:(e,t)=>{let{cellId:n,before:r,code:i,name:a,config:o,lastCodeRun:s=null,lastExecutionTime:c=null,autoFocus:l=!0,skipIfCodeExists:u=!1,hideCode:d=void 0}=t,f,p;if(u){for(let t of e.cellIds.inOrderIds)if(e.cellData[t]?.code===i)return e}if(n===`__end__`){let t=e.cellIds.atOrThrow(0);f=t.id,p=t.length}else if(typeof n==`string`){let t=e.cellIds.findWithId(n);f=t.id,p=t.topLevelIds.indexOf(n)}else if(n.type===`__end__`){let t=e.cellIds.get(n.columnId)||e.cellIds.atOrThrow(0);f=t.id,p=t.length}else throw Error(`Invalid cellId`);let m=t.newCellId||pr.create(),h=r?p:p+1;return{...e,cellIds:e.cellIds.insertId(m,f,h),cellData:{...e.cellData,[m]:ET({id:m,code:i,name:a,lastCodeRun:s,config:DT({...o,...d!=null&&{hide_code:d}}),lastExecutionTime:c,edited:!!i&&i!==s})},cellRuntime:{...e.cellRuntime,[m]:OT()},cellHandles:{...e.cellHandles,[m]:(0,U.createRef)()},scrollKey:l?m:null,untouchedNewCells:d&&l?new Set([...e.untouchedNewCells,m]):e.untouchedNewCells}},moveCell:(e,t)=>{let{cellId:n,before:r,direction:i}=t;if(r!==void 0&&i!==void 0&&T.warn(`Both before and direction specified for moveCell. Ignoring one.`),i){let t=e.cellIds.findWithId(n),r=e.cellIds.indexOf(t),a=i===`left`?r-1:r+1,o=e.cellIds.at(a);return o?{...e,cellIds:e.cellIds.moveAcrossColumns(t.id,n,o.id,void 0),scrollKey:n}:e}let a=e.cellIds.findWithId(n),o=a.indexOfOrThrow(n);return r&&o===0?{...e,cellIds:e.cellIds.moveWithinColumn(a.id,o,0),scrollKey:n}:!r&&o===a.length-1?{...e,cellIds:e.cellIds.moveWithinColumn(a.id,o,a.length-1),scrollKey:n}:r?{...e,cellIds:e.cellIds.moveWithinColumn(a.id,o,o-1),scrollKey:n}:{...e,cellIds:e.cellIds.moveWithinColumn(a.id,o,o+1),scrollKey:n}},moveCellToIndex:(e,t)=>{let{cellId:n,columnId:r,index:i}=t,a=e.cellIds.findWithId(n),o=a.indexOfOrThrow(n),s=e.cellIds.get(r);if(!s)return e;let c=Math.max(0,Math.min(i,s.length)),l=a.id===r&&o<c?c-1:c;if(a.id===r&&o===l)return e;let u=e.cellIds.deleteById(n),d=u.get(r);return d?{...e,cellIds:u.insertId(n,r,Math.max(0,Math.min(l,d.length))),scrollKey:null}:e},dropCellOverCell:(e,t)=>{let{cellId:n,overCellId:r}=t,i=e.cellIds.findWithId(n),a=e.cellIds.findWithId(r),o=i.indexOfOrThrow(n),s=a.indexOfOrThrow(r);return i.id===a.id?o===s?e:{...e,cellIds:e.cellIds.moveWithinColumn(i.id,o,s),scrollKey:null}:{...e,cellIds:e.cellIds.moveAcrossColumns(i.id,n,a.id,r),scrollKey:null}},moveCellsRelativeTo:(e,t)=>{let{cellIds:n,targetCellId:r,position:i,previousPlacements:a}=t;if(n.length===0)return e;let o=e.cellIds.moveCellsRelativeTo(n,r,i),s=a&&a.length===n.length?[...e.history,{type:`move`,cellIds:n,placements:a}]:e.history;return{...e,cellIds:o,history:s,scrollKey:null}},dropCellOverColumn:(e,t)=>{let{cellId:n,columnId:r}=t,i=e.cellIds.findWithId(n);return{...e,cellIds:e.cellIds.moveAcrossColumns(i.id,n,r,void 0)}},dropOverNewColumn:(e,t)=>{let{cellId:n}=t;return{...e,cellIds:e.cellIds.moveToNewColumn(n)}},moveColumn:(e,t)=>t.column===t.overColumn?e:{...e,cellIds:e.cellIds.moveColumn(t.column,t.overColumn)},focusCell:(e,t)=>{let n=e.cellIds.findWithId(t.cellId);if(n.length===0)return e;let{cellId:r,where:i}=t,a=n.indexOfOrThrow(r),o;o=i===`before`?Ut(a-1,0,n.length-1):i===`after`?Ut(a+1,0,n.length-1):a;let s=n.atOrThrow(o);return xT({cellId:s,cell:e.cellHandles[s],isCodeHidden:IT(e,s),codeFocus:i===`after`?`top`:`bottom`,variableName:void 0}),e},focusTopCell:e=>{let t=e.cellIds.getColumns().at(0);if(t===void 0||t.length===0)return e;let n=t.first();return xT({cellId:n,cell:e.cellHandles[n],isCodeHidden:IT(e,n),codeFocus:void 0,variableName:void 0}),wT(),e},focusBottomCell:e=>{let t=e.cellIds.getColumns().at(-1);if(t===void 0||t.length===0)return e;let n=t.last();return xT({cellId:n,cell:e.cellHandles[n],isCodeHidden:IT(e,n),codeFocus:void 0,variableName:void 0}),CT(),e},sendToTop:(e,t)=>{let n=e.cellIds.findWithId(t.cellId);if(n.length===0)return e;let{cellId:r,scroll:i=!0}=t,a=n.indexOfOrThrow(r);return a===0?e:{...e,cellIds:e.cellIds.moveWithinColumn(n.id,a,0),scrollKey:i?r:null}},sendToBottom:(e,t)=>{let n=e.cellIds.findWithId(t.cellId);if(n.length===0)return e;let{cellId:r,scroll:i=!0}=t,a=n.indexOfOrThrow(r),o=n.length-1;return a===o?e:{...e,cellIds:e.cellIds.moveWithinColumn(n.id,a,o),scrollKey:i?r:null}},addColumn:(e,t)=>{let n=pr.create();return{...e,cellIds:e.cellIds.addColumn(t.columnId,[n]),cellData:{...e.cellData,[n]:ET({id:n})},cellRuntime:{...e.cellRuntime,[n]:OT()},cellHandles:{...e.cellHandles,[n]:(0,U.createRef)()},scrollKey:n}},addColumnBreakpoint:(e,t)=>{let{cellId:n}=t;return e.cellIds.getColumns()[0].inOrderIds[0]===n?e:{...e,cellIds:e.cellIds.insertBreakpoint(n)}},deleteColumn:(e,t)=>{let{columnId:n}=t;return{...e,cellIds:e.cellIds.delete(n)}},mergeAllColumns:e=>({...e,cellIds:e.cellIds.mergeAllColumns()}),compactColumns:e=>({...e,cellIds:e.cellIds.compact()}),deleteCell:(e,t)=>{let n=t.cellId;if(e.cellIds.hasOnlyOneId())return e;let r;try{r=e.cellIds.findWithId(n)}catch(t){return T.warn(`Skipping delete for missing cellId`,{cellId:n,error:t}),e}let i=r.indexOfOrThrow(n),a=i===0?1:i-1,o=null;r.length>1&&(o=r.atOrThrow(a));let s=(e.cellHandles[n].current?.editorView)?.state.toJSON({history:xt});s&&(s.doc=e.cellData[n].code),yE(n);let c=e.cellData[n];return{...e,cellIds:e.cellIds.deleteById(n),history:[...e.history,{type:`delete`,name:c.name,serializedEditorState:s,column:r.id,index:i,isSetupCell:n===fr,config:c.config}],scrollKey:o}},undoDeleteCell:e=>{if(e.history.length===0)return e;let t=e.history[e.history.length-1];if(t.type===`move`){let{cellIds:n,placements:r}=t;if(n.length===0||r.length!==n.length||n.some(t=>!e.cellData[t]))return{...e,history:e.history.slice(0,-1)};let i=n.map((e,t)=>({id:e,columnId:r[t].columnId,index:r[t].index}));return{...e,cellIds:e.cellIds.placeCells(i),history:e.history.slice(0,-1),scrollKey:n[0]??null}}let{name:n,serializedEditorState:r={doc:``},column:i,index:a,isSetupCell:o,config:s}=t,c=o?fr:pr.create(),l=ET({id:c,name:n,code:r.doc,edited:r.doc.trim().length>0,serializedEditorState:r,config:s});return{...e,cellIds:e.cellIds.insertId(c,i,a),cellData:{...e.cellData,[c]:l},cellRuntime:{...e.cellRuntime,[c]:OT()},cellHandles:{...e.cellHandles,[c]:(0,U.createRef)()},history:e.history.slice(0,-1),scrollKey:c}},clearSerializedEditorState:(e,t)=>{let{cellId:n}=t;return RT({state:e,cellId:n,cellReducer:e=>({...e,serializedEditorState:null})})},updateCellCode:(e,t)=>{let{cellId:n,code:r,formattingChange:i}=t;return e.cellData[n]?RT({state:e,cellId:n,cellReducer:e=>i?{...e,code:r,lastCodeRun:e.edited?e.lastCodeRun:r}:{...e,code:r,edited:r.trim()!==e.lastCodeRun}}):e},updateCellName:(e,t)=>{let{cellId:n,name:r}=t;return RT({state:e,cellId:n,cellReducer:e=>({...e,name:r})})},updateCellConfig:(e,t)=>{let{cellId:n,config:r}=t;return RT({state:e,cellId:n,cellReducer:e=>({...e,config:DT({...e.config,...r})})})},prepareForRun:(e,t)=>RT({state:LT({state:e,cellId:t.cellId,cellReducer:e=>gw(e)}),cellId:t.cellId,cellReducer:e=>({...e,edited:!1,lastCodeRun:e.code.trim()})}),handleCellMessage:(e,t)=>{let n=t.cell_id,r=LT({state:e,cellId:n,cellReducer:e=>hw(e,t)});return t.status===`queued`&&(r=RT({state:r,cellId:n,cellReducer:e=>({...e,lastCodeRun:e.code.trim(),edited:!1})})),{...r,cellLogs:[...r.cellLogs,...cT(t)]}},addLogs:(e,t)=>({...e,cellLogs:[...e.cellLogs,...t.logs]}),setCellIds:(e,t)=>{if(l(e.cellIds.inOrderIds,t.cellIds))return e;let n={...e.cellData},r={...e.cellRuntime},i={...e.cellHandles};for(let a of t.cellIds)a in e.cellData||(n[a]=ET({id:a})),a in e.cellRuntime||(r[a]=OT()),a in e.cellHandles||(i[a]=(0,U.createRef)());return{...e,cellIds:ba.fromWithPreviousShape(t.cellIds,e.cellIds),cellData:n,cellRuntime:r,cellHandles:i}},rebuildCellColumns:(e,t)=>{let n=ba.fromIdsAndColumns(t.cellIds.map(t=>[t,e.cellData[t]?.config.column??null]));return{...e,cellIds:n}},setCellCodes:(e,t)=>{O(t.codes.length===t.ids.length,`Expected codes and ids to have the same length`);let n={...e},r=({cell:e,code:r,cellId:i,name:a,config:o})=>{if(!e)return ET({id:i,code:r,name:a,config:o,lastCodeRun:t.codeIsStale?null:r,edited:t.codeIsStale&&r.trim().length>0});let s=t.codeIsStale?e.lastCodeRun:r,c=s?s.trim()!==r.trim():!!r;if(e.code.trim()===r.trim())return{...e,code:r,edited:c,lastCodeRun:s,...a!==void 0&&{name:a},...o!==void 0&&{config:o}};if(!rw()||!iw(i)){let e=n.cellHandles[i].current;e?.editorViewOrNull&&WC(e.editorViewOrNull,r)}return{...e,code:r,edited:c,lastCodeRun:s,...a!==void 0&&{name:a},...o!==void 0&&{config:o}}};for(let e=0;e<t.ids.length;e++){let i=t.ids[e],a=t.codes[e];if(i===void 0||a===void 0)continue;let o=t.names?.[e],s=t.configs?.[e];n={...n,cellData:{...n.cellData,[i]:r({cell:n.cellData[i],code:a,cellId:i,name:o,config:s})}}}return n},setStdinResponse:(e,t)=>{let{cellId:n,response:r,outputIndex:i}=t;return LT({state:e,cellId:n,cellReducer:e=>{let t=[...e.consoleOutputs],n=t[i];return n==null||n.channel!==`stdin`?(T.warn(`Expected stdin output`),e):(t[i]={channel:`stdin`,mimetype:n.mimetype,data:n.data,timestamp:n.timestamp,response:r},{...e,interrupted:!1,consoleOutputs:t})}})},setCells:(e,t)=>{let n=Object.fromEntries(t.map(e=>[e.id,e])),r=A(),i=t=>{if(!r)return OT();let n=e.cellRuntime[t];return n&&(n.output!=null||n.consoleOutputs.length>0)?n:OT()},a=Object.fromEntries(t.map(e=>[e.id,i(e.id)]));return kT({...e,cellIds:ba.fromIdsAndColumns(t.map(e=>[e.id,e.config.column])),cellData:n,cellRuntime:a,cellHandles:Object.fromEntries(t.map(e=>[e.id,(0,U.createRef)()]))})},moveToNextCell:(e,t)=>{let{cellId:n,before:r,noCreate:i=!1}=t;if(n===`__scratch__`)return e;let a=e.cellIds.findWithId(n),o=a.indexOfOrThrow(n),s=r?o-1:o+1,c=s===a.length,l=s===-1;if(c&&!i){let t=pr.create();return{...e,cellIds:e.cellIds.insertId(t,a.id,s),cellData:{...e.cellData,[t]:ET({id:t})},cellRuntime:{...e.cellRuntime,[t]:OT()},cellHandles:{...e.cellHandles,[t]:(0,U.createRef)()},scrollKey:t}}if(l&&!i){let t=pr.create();return{...e,cellIds:e.cellIds.insertId(t,a.id,0),cellData:{...e.cellData,[t]:ET({id:t})},cellRuntime:{...e.cellRuntime,[t]:OT()},cellHandles:{...e.cellHandles,[t]:(0,U.createRef)()},scrollKey:t}}if((c||l)&&i)return e;if(s>=0&&s<a.length){let t=a.atOrThrow(s);xT({cellId:t,cell:e.cellHandles[t],isCodeHidden:IT(e,t),codeFocus:r?`bottom`:`top`,variableName:void 0})}return e},markTouched:(e,t)=>{let{cellId:n}=t;if(e.untouchedNewCells.has(n)){let t=new Set(e.untouchedNewCells);return t.delete(n),{...e,untouchedNewCells:t}}return e},markUntouched:(e,t)=>{let{cellId:n}=t;if(!e.untouchedNewCells.has(n)){let t=new Set(e.untouchedNewCells);return t.add(n),{...e,untouchedNewCells:t}}return e},scrollToTarget:e=>{let t=e.scrollKey;if(t===null)return e;let n=e.cellIds.findWithId(t),r=n.indexOfOrThrow(t),i=r===n.length-1?n.last():n.atOrThrow(r);return xT({cellId:i,cell:e.cellHandles[i],isCodeHidden:IT(e,i),codeFocus:void 0,variableName:void 0}),{...e,scrollKey:null}},foldAll:e=>(Ba(Object.values(e.cellHandles).map(e=>e.current?.editorView)),e),unfoldAll:e=>(Va(Object.values(e.cellHandles).map(e=>e.current?.editorView)),e),clearLogs:e=>({...e,cellLogs:[]}),collapseCell:(e,t)=>{let{cellId:n}=t,r=e.cellIds.findWithId(n),i=r.topLevelIds.map(t=>e.cellRuntime[t].outline),a=tw(r.indexOfOrThrow(n),i);if(!a)return e;let o=r.atOrThrow(a[1]);return{...e,cellIds:e.cellIds.transformWithCellId(n,e=>e.collapse(n,o)),scrollKey:n}},expandCell:(e,t)=>{let{cellId:n}=t;return{...e,cellIds:e.cellIds.transformWithCellId(n,e=>e.expand(n)),scrollKey:n}},collapseAllCells:e=>({...e,cellIds:e.cellIds.transformAll(t=>{let n=t.topLevelIds.map(t=>e.cellRuntime[t].outline),r=[...t.nodes],i=[],a=[],o=r.length-1;for(;o>=0;){let e=tw(o,n);if(e){let n=o,r=e[1],s=i.find(e=>e.start<=r&&e.end===r);s&&(r=s.start),i.push({start:n,end:r});let c=t.atOrThrow(n),l=t.atOrThrow(r);a.push({id:c,until:l})}else a.push(null);o--}let s=a.toReversed();return t.collapseAll(s)})}),expandAllCells:e=>({...e,cellIds:e.cellIds.transformAll(e=>e.expandAll())}),showCellIfHidden:(e,t)=>{let{cellId:n}=t,r=e.cellIds.findWithId(n),i=r,a=r.findAndExpandDeep(n);return a.equals(i)?e:{...e,cellIds:e.cellIds.transformWithCellId(n,()=>a)}},splitCell:(e,t)=>{let{cellId:n}=t,r=e.cellIds.findWithId(n),i=r.indexOfOrThrow(n),a=e.cellData[n],o=e.cellHandles[n].current;if(o?.editorView==null)return e;let{beforeCursorCode:s,afterCursorCode:c}=GC(o.editorView);WC(o.editorView,s);let l=pr.create();return{...e,cellIds:e.cellIds.insertId(l,r.id,i+1),cellData:{...e.cellData,[n]:{...a,code:s,edited:!!s&&s.trim()!==a.lastCodeRun?.trim()},[l]:ET({id:l,code:c,edited:!!c})},cellRuntime:{...e.cellRuntime,[n]:{...e.cellRuntime[n],output:null,consoleOutputs:[]},[l]:OT()},cellHandles:{...e.cellHandles,[l]:(0,U.createRef)()},scrollKey:l}},undoSplitCell:(e,t)=>{let{cellId:n,snapshot:r}=t,i=e.cellData[n],a=e.cellHandles[n].current;return a?.editorView==null?e:(WC(a.editorView,r),{...e,cellIds:e.cellIds.transformWithCellId(n,e=>{let t=e.indexOfOrThrow(n)+1;return e.deleteAtIndex(t)}),cellData:{...e.cellData,[n]:{...i,code:r,edited:!!r&&r?.trim()!==i.lastCodeRun?.trim()}},cellRuntime:{...e.cellRuntime,[n]:{...e.cellRuntime[n],output:null,consoleOutputs:[]}},cellHandles:{...e.cellHandles}})},clearCellOutput:(e,t)=>{let{cellId:n}=t;return LT({state:e,cellId:n,cellReducer:e=>({...e,output:null,consoleOutputs:[]})})},clearCellConsoleOutput:(e,t)=>{let{cellId:n}=t;return LT({state:e,cellId:n,cellReducer:e=>({...e,consoleOutputs:e.consoleOutputs.filter(e=>e.channel===`stdin`&&e.response==null)})})},clearAllCellOutputs:e=>{let t={...e.cellRuntime};for(let n of e.cellIds.inOrderIds)t[n]={...t[n],output:null,consoleOutputs:[]};return{...e,cellRuntime:t}},addSetupCellIfDoesntExist:(e,t)=>{let{code:n}=t;return e.cellIds.setupCellExists()?{...e,scrollKey:fr}:{...e,cellIds:e.cellIds.insertId(fr,e.cellIds.atOrThrow(0).id,0),cellData:{...e.cellData,[fr]:ET({id:fr,name:fr,code:n,edited:!!n})},cellRuntime:{...e.cellRuntime,[fr]:OT()},cellHandles:{...e.cellHandles,[fr]:(0,U.createRef)()},scrollKey:fr}}});MT(Fw);function IT(e,t){return!!e.cellData[t].config.hide_code&&!e.untouchedNewCells.has(t)}function LT({state:e,cellId:t,cellReducer:n}){return t in e.cellRuntime?{...e,cellRuntime:{...e.cellRuntime,[t]:n(e.cellRuntime[t])}}:(T.warn(`Cell ${t} not found in state`),e)}function RT({state:e,cellId:t,cellReducer:n}){return t in e.cellData?{...e,cellData:{...e.cellData,[t]:n(e.cellData[t])}}:(T.warn(`Cell ${t} not found in state`),e)}function zT(e){let t=e.cellData,n={column:null};return e.cellIds.getColumns().length>1?e.cellIds.getColumns().flatMap((e,r)=>e.inOrderIds.map((e,i)=>{let a={...n};return i===0&&(a.column=r),{...t[e].config,...a}})):e.cellIds.getColumns().flatMap(e=>e.inOrderIds.map(e=>({...t[e].config,...n})))}var BT=NT(e=>{u.set(FT,t=>jT(t,e))}).addLogs,VT=o(e=>e(FT).cellIds),HT=o(e=>e(VT).hasOnlyOneId()),UT=o(e=>du(e(FT)).length>0);o(e=>fu(e(FT)).length>0);var WT=o(e=>pu(e(FT))),GT=o(e=>mu(e(FT))),KT=o(e=>cu(e(FT))),qT=o(e=>{let{cellIds:t,cellRuntime:n,cellData:r}=e(FT);return t.inOrderIds.map(e=>{let t=n[e],{name:i}=r[e];if(au(t.output?.mimetype)){O(Array.isArray(t.output.data),`Expected array data`);let n=t.output.data.filter(e=>!e.type.includes(`ancestor`));if(n.length>0)return{output:{...t.output,data:n},cellId:e,cellName:i}}return null}).filter(Boolean)}),JT=o(e=>{let{cellIds:t,cellRuntime:n}=e(FT);return QC(t.inOrderIds.map(e=>n[e].outline))}),YT=o(e=>e(qT).length),XT=c(o(e=>{let{cellIds:t,cellData:n}=e(FT);return D.fromEntries(t.inOrderIds.map(e=>[e,n[e]?.name]))})),ZT=o(e=>e(FT).scrollKey),QT=()=>s(FT),$T=()=>s(VT),eE=()=>s(XT),tE=()=>s(qT),nE=()=>s(FT).cellLogs,rE=()=>s(ZT),iE=()=>u.get(FT),aE=()=>u.get(FT).cellIds,oE=()=>{let{cellIds:e,cellData:t}=u.get(FT);return e.inOrderIds.map(e=>t[e]?.name).filter(Boolean)},sE=qi(Bi(FT,e=>e.cellIds.inOrderIds.map(t=>e.cellData[t]))),cE=()=>a(sE),lE=o(e=>e(FT).cellRuntime),uE=o(e=>ou(e(FT))),dE=o(e=>{let{cellRuntime:t}=e(FT);return Object.entries(t).every(([e,t])=>t.status!==`running`||e===`__scratch__`)}),fE=o(e=>su(e(FT))),pE=o(e=>e(FT).cellIds.colLength),mE=o(e=>e(FT).cellIds.idLength>0),hE=o(e=>e(FT).cellIds.getColumnIds()),gE=Ii(e=>o(t=>t(FT).cellData[e])),_E=Ii(e=>o(t=>t(FT).cellRuntime[e])),vE=Ii(e=>o(t=>t(FT).cellHandles[e]));function yE(e){gE.remove(e),_E.remove(e),vE.remove(e)}var bE=e=>{let t=(0,Qd.c)(2),n;return t[0]===e?n=t[1]:(n=gE(e),t[0]=e,t[1]=n),s(n)},xE=e=>{let t=(0,Qd.c)(2),n;return t[0]===e?n=t[1]:(n=_E(e),t[0]=e,t[1]=n),s(n)},SE=e=>{let t=(0,Qd.c)(2),n;return t[0]===e?n=t[1]:(n=vE(e),t[0]=e,t[1]=n),s(n)},CE=()=>{let{cellIds:e,cellHandles:t}=u.get(FT);return e.inOrderIds.map(e=>t[e]?.current?.editorViewOrNull).filter(Boolean)},wE=e=>{let{cellHandles:t}=u.get(FT);return t[e].current?.editorView};function TE(e){let{cellIds:t,cellData:n,cellRuntime:r}=e;return t.getColumns().flatMap(e=>e.topLevelIds.map(e=>({...n[e],...r[e]})))}function EE(e){return o(t=>t(FT).untouchedNewCells.has(e))}function DE(e){let t=_E(e);return o(n=>{let r=n(t);if(!r||r.status===`queued`||r.status===`running`)return;let i=[],a=r.consoleOutputs;if(a&&a.length>0){let e=a.find(e=>e.mimetype===`application/vnd.marimo+traceback`);if(e){let t=e.data;i.push(...Ra(t))}}let o=r.output;if(o?.mimetype===`application/vnd.marimo+error`){let t=o.data;if(Array.isArray(t))for(let n of t)n.type===`syntax`&&n.lineno!=null&&i.push({kind:`cell`,cellId:e,lineNumber:n.lineno}),n.type===`import-star`&&n.lineno!=null&&i.push({kind:`cell`,cellId:e,lineNumber:n.lineno})}return i.length>0?i:void 0})}function OE(e){let t=(0,Qd.c)(2),n;return t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n),PT(n)}export{iT as $,na as $i,Lp as $n,ed as $r,f_ as $t,SE as A,iu as Ai,Em as An,Fd as Ar,nC as At,TT as B,Ia as Bi,om as Bn,Sd as Br,lS as Bt,pE as C,uu as Ci,qm as Cn,Wd as Cr,bC as Ct,bE as D,gu as Di,zm as Dn,Rd as Dr,lC as Dt,OE as E,xu as Ei,Vm as En,Vd as Er,sC as Et,QT as F,Ul as Fi,vm as Fn,Od as Fr,dS as Ft,mT as G,ba as Gi,nm as Gn,_d as Gr,gv as Gt,gT as H,La as Hi,cm as Hn,bd as Hr,sy as Ht,rE as I,Il as Ii,Sm as In,Dd as Ir,aS as It,oT as J,ua as Ji,Yp as Jn,dd as Jr,$_ as Jt,pT as K,ga as Ki,rm as Kn,gd as Kr,nv as Kt,ET as L,Ll as Li,dm as Ln,Ed as Lr,sS as Lt,nE as M,tu as Mi,Dm as Mn,Nd as Mr,ZS as Mt,eE as N,Yl as Ni,Tm as Nn,Md as Nr,YS as Nt,cE as O,au as Oi,Nm as On,Ld as Or,tC as Ot,xE as P,Jl as Pi,Cm as Pn,Ad as Pr,OS as Pt,Xw as Q,ia as Qi,zp as Qn,ld as Qr,M_ as Qt,OT as R,wl as Ri,xm as Rn,Td as Rr,oS as Rt,fE as S,Yn as Sa,_u as Si,Hh as Sn,Gd as Sr,VC as St,GT as T,bu as Ti,Im as Tn,Hd as Tr,cC as Tt,fT as U,Pa as Ui,im as Un,yd as Ur,vv as Ut,bT as V,Ra as Vi,sm as Vn,X as Vr,Sy as Vt,dT as W,Na as Wi,am as Wn,vd as Wr,_v as Wt,rT as X,la as Xi,qp as Xn,cd as Xr,L_ as Xt,tT as Y,ca as Yi,Gp as Yn,ud as Yr,ev as Yt,aT as Z,sa as Zi,Vp as Zn,md as Zr,j_ as Zt,HT as _,sr as _a,vu as _i,Kh as _n,Xd as _r,RC as _t,lE as a,Sr as aa,Lu as ai,jg as an,Fp as ar,Iw as at,uE as b,rr as ba,fu as bi,Nh as bn,Yd as br,HC as bt,TE as c,xr as ca,Iu as ci,yg as cn,Qf as cr,iw as ct,wE as d,_r as da,Wu as di,lg as dn,nf as dr,ew as dt,ta as ea,Qu as ei,d_ as en,Ip as er,Zw as et,oE as f,mr as fa,Fu as fi,qh as fn,uf as fr,ZC as ft,UT as g,hr as ga,Cu as gi,Xh as gn,mf as gr,WC as gt,mE as h,gr as ha,Su as hi,Yh as hn,Sf as hr,UC as ht,VT as i,Zi as ia,zu as ii,Ag as in,Np as ir,Bw as it,$T as j,nu as ji,Q as jn,Pd as jr,$S as jt,tE as k,ru as ki,Om as kn,Id as kr,eC as kt,CE as l,vr as la,Bu as li,hg as ln,Ff as lr,rw as lt,iE as m,fr as ma,Pu as mi,Wh as mn,xf as mr,KC as mt,gE as n,Qi as na,Zu as ni,Hg as nn,jp as nr,Jw as nt,hE as o,yr as oa,Ru as oi,Cg as on,wp as or,_w as ot,aE as p,dr as pa,Nu as pi,Gh as pn,lf as pr,$C as pt,uT as q,ma as qi,em as qn,pd as qr,tv as qt,YT as r,Fi as ra,td as ri,Ug as rn,Pp as rr,qw as rt,EE as s,br as sa,Gu as si,Mg as sn,xp as sr,vw as st,WT as t,ra as ta,$u as ti,o_ as tn,Mp as tr,Yw as tt,zT as u,pr as ua,Vu as ui,_g as un,Pf as ur,nw as ut,KT as v,cr as va,yu as vi,Jh as vn,Zd as vr,zC as vt,dE as w,lu as wi,Um as wn,Ud as wr,oC as wt,JT as x,er as xa,hu as xi,Uh as xn,Jd as xr,PC as xt,FT as y,nr as ya,du as yi,Zh as yn,qd as yr,FC as yt,ST as z,cc as zi,bm as zn,Cd as zr,cS as zt};
|