@marimo-team/islands 0.25.3-dev170 → 0.25.3-dev175
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/{ConnectedDataExplorerComponent-BbSXV-Xa.js → ConnectedDataExplorerComponent-Le_OBfmt.js} +9 -9
- package/dist/{ErrorBoundary-NE86qEWZ.js → ErrorBoundary-DNvcAIsP.js} +8 -8
- package/dist/{abnfDiagram-VCTEODGH-D7n07nXf.js → abnfDiagram-VCTEODGH-Tf1ghyQQ.js} +2 -2
- package/dist/{any-language-editor-3E24SnCV.js → any-language-editor-BVFHDDQ3.js} +4 -4
- package/dist/{architectureDiagram-5GKGNRK7-D6CjRib5.js → architectureDiagram-5GKGNRK7-xlnbTG0T.js} +1 -1
- package/dist/{chat-ui-CC7GekpG.js → chat-ui-X-cWrL9u.js} +1218 -1218
- package/dist/{check-SpOMoCLP.js → check-C9Mp9eCK.js} +1 -1
- package/dist/{chunk-IMKFNOWR-6dtPz7uS.js → chunk-IMKFNOWR-Cmd4a5jy.js} +1 -1
- package/dist/{chunk-SHT3W25Y-BwnFNKDA.js → chunk-SHT3W25Y-mSNp-WpO.js} +1 -1
- package/dist/{chunk-SVP7TREG-D2eV4vBJ.js → chunk-SVP7TREG-CWC49D8X.js} +1 -1
- package/dist/{chunk-TICWLB2K-BDs4-_-r.js → chunk-TICWLB2K-De9FINtG.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-DCJnf_8v.js → classDiagram-ZZMXUADV-DweTkYdp.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-BOmSzPBD.js → classDiagram-v2-VYDZK3BY-A6MR2TiE.js} +2 -2
- package/dist/{code-visibility-Bzvc6ajl.js → code-visibility-CH1lmM1h.js} +5 -5
- package/dist/{common-Ciw4zkh2.js → common-DIrS1UR9.js} +1081 -1085
- package/dist/{copy-icon-C1trdvVt.js → copy-icon-De584pZ4.js} +2 -2
- package/dist/{cynefinDiagram-5FMLGOSQ-Bln_Soky.js → cynefinDiagram-5FMLGOSQ-BSvo5le-.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-D-nf7WzW.js → dagre-GXQ25YYZ-tXRQslO6.js} +1 -1
- package/dist/{data-grid-overlay-editor-AQREmxI7.js → data-grid-overlay-editor-DFLZvFK0.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-PsgSMkY2.js → diagram-S7CK7UJ4-r3t5VtwI.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-DfwfUuSw.js → diagram-UQ7AKVKN-qgbC8YnT.js} +1 -1
- package/dist/{diagram-VX7I27RA-C9_e-oMc.js → diagram-VX7I27RA-CiHxEwtp.js} +1 -1
- package/dist/{diagram-Z3DM3KII-CWLa5tuY.js → diagram-Z3DM3KII-D95u15Ev.js} +1 -1
- package/dist/{dialog-DgeqyrEZ.js → dialog-DVRfQuhD.js} +24 -24
- package/dist/{dist-F8Ep36rk.js → dist-B1M0bGO3.js} +1 -1
- package/dist/{dist-D6d86eNJ.js → dist-BA13RJj5.js} +1 -1
- package/dist/{dist-Bvs24R_E.js → dist-BJtmSgcE.js} +48 -48
- package/dist/{dist-CN_BeG2I.js → dist-Ba2VIn1K.js} +53 -53
- package/dist/{dist-PXYI_yuP.js → dist-Bj4bmwUm.js} +12 -12
- package/dist/{dist-DoE4XJBC.js → dist-BmS-ZGjl.js} +8626 -8626
- package/dist/{dist-BorMD-uX.js → dist-Bzogh7CW.js} +87 -87
- package/dist/{dist-CN8zI-XC.js → dist-CThPVKaP.js} +1385 -1382
- package/dist/{dist-DiDibOYr.js → dist-CTi5FTiV.js} +87 -87
- package/dist/{dist-diIx5qJW.js → dist-Ck_C32ye.js} +2 -2
- package/dist/{dist-BLfKmR-l.js → dist-D1fnFp1J.js} +1 -1
- package/dist/{dist-OR1OnN-y.js → dist-D3x9__Fu.js} +46 -46
- package/dist/{dist-BMQf5zIS.js → dist-D7mrh5sO.js} +36 -36
- package/dist/{dist-CSJ0MDRw.js → dist-D9Q3xjiP.js} +1 -1
- package/dist/{dist-BuaRHxOc.js → dist-DP60Ubh8.js} +2 -2
- package/dist/{dist-CSbh1PNP.js → dist-DTv9KkpW.js} +12 -12
- package/dist/{dist-D-wwqlzJ.js → dist-DVVwOfrD.js} +109 -109
- package/dist/{dist-C8fAKSH1.js → dist-DYXM73-k.js} +36 -36
- package/dist/{dist-DBtSl3sf.js → dist-DjeybPOb.js} +1 -1
- package/dist/{dist-CrSP_H1M.js → dist-DtGn9N4h.js} +197 -197
- package/dist/{dist-CLdpGQVr.js → dist-KN80qWCP.js} +2 -2
- package/dist/{dist-Cg7gzw-a.js → dist-O0qFpEJh.js} +56 -56
- package/dist/{dist-CkTTIdBe.js → dist-OUle2RT7.js} +207 -207
- package/dist/{dist-BK4Oj99o.js → dist-T5rh6JvL.js} +1 -1
- package/dist/{dropdown-menu-B6ftyzOg.js → dropdown-menu-DCMbbQ35.js} +691 -691
- package/dist/{ebnfDiagram-PWID7BFC-B1QRM58v.js → ebnfDiagram-PWID7BFC-P7e4bryK.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-DJK_FqvW.js → erDiagram-RLTQ6QDP-CUHZcmRj.js} +1 -1
- package/dist/{error-banner-D40pmfQQ.js → error-banner-DxJ3s8YO.js} +57 -57
- package/dist/{error-entries-DgK3wUJR.js → error-entries-mpoD5t79.js} +4985 -5006
- package/dist/{esm-D2gTsXEV.js → esm-Bbw_Njjx.js} +575 -575
- package/dist/{esm-AMFssoNp.js → esm-mDQNEFe_.js} +354 -354
- package/dist/{feedback-button-8a6SETmT.js → feedback-button-DL0DJ-LB.js} +30 -30
- package/dist/{flowDiagram-HODETNUW-Uxc25XSJ.js → flowDiagram-HODETNUW-BGZ95AzI.js} +2 -2
- package/dist/{formats-DQCyPd5Z.js → formats-DI7HEVv7.js} +1 -1
- package/dist/{glide-data-editor-B70oke_v.js → glide-data-editor-n4wnx19S.js} +10 -10
- package/dist/{glide-utils-Dz_F4pAY.js → glide-utils-D98laidb.js} +2 -2
- package/dist/{globals-Cxd5hNlI.js → globals-NCsYyjpB.js} +3 -3
- package/dist/{html-to-image-D4yG5Ru0.js → html-to-image-BoZthB4P.js} +467 -458
- package/dist/{infoDiagram-27XIBGKW-DmjxqwL0.js → infoDiagram-27XIBGKW-BF0YX70D.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-NgCLHqQi.js → ishikawaDiagram-5VMMS53U-_itsAAn-.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-CZaG-iam.js → kanban-definition-UXKFOSKX-VNW2Beqh.js} +1 -1
- package/dist/{label-D9_-zSg-.js → label-Qvw1E97W.js} +1 -1
- package/dist/main.js +8257 -6606
- package/dist/{mermaid-CSvw7c71.js → mermaid-CZ6FrClS.js} +35 -35
- package/dist/{mindmap-definition-YA3MSWOX-DJYQBDH_.js → mindmap-definition-YA3MSWOX-DR4ripvd.js} +1 -1
- package/dist/{number-overlay-editor-ChK-SKUk.js → number-overlay-editor-rlvo4mo3.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-CHKO_dAe.js → pegDiagram-XKGWAZYB-CFr3XlGl.js} +2 -2
- package/dist/{pieDiagram-E7YTZNPT-DVevbMAo.js → pieDiagram-E7YTZNPT-j91XYSLY.js} +1 -1
- package/dist/{process-output-DxvBAeL3.js → process-output-DLS4Mqg_.js} +4 -4
- package/dist/{railroadDiagram-O6MQD6OU-Detj1kcB.js → railroadDiagram-O6MQD6OU-Cd47ZV9E.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-BLFD0T_Z.js → requirementDiagram-BXWQKSXE-eJH6gLtX.js} +1 -1
- package/dist/{reveal-component-CXMXeDZD.js → reveal-component-BJfmRUzb.js} +9 -9
- package/dist/{select-CkF_GBxO.js → select-2KOiReNY.js} +324 -324
- package/dist/{sequenceDiagram-WJ2MYXX4-BZBgatQV.js → sequenceDiagram-WJ2MYXX4-DdfFEIrm.js} +1 -1
- package/dist/{spec-Mnkn3XEr.js → spec-h69nC3SI.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-4BZW9-6_.js → stateDiagram-D77RDMKH-DkjDvip8.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-C4sKC8Iq.js → stateDiagram-v2-MP3YSRHH-DBHACnOo.js} +2 -2
- package/dist/{swimlanes-42K2YHIH-SL5yeGe2.js → swimlanes-42K2YHIH-ogImlOmp.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-DqPmAYUv.js → swimlanesDiagram-VR7AAH4N-D6x-zsci.js} +2 -2
- package/dist/{timeline-definition-24CTP7MA-BfXUMWkq.js → timeline-definition-24CTP7MA-DQpLtsHD.js} +1 -1
- package/dist/{toDate-TMubKIVL.js → toDate-CDzoofJo.js} +2 -2
- package/dist/{toast-Btbve3Lm.js → toast-B5t9o6s_.js} +47 -47
- package/dist/{tooltip-CJ4Rqasp.js → tooltip-s4zZxwKe.js} +67 -67
- package/dist/{use-restore-focus-CmGwRNId.js → use-restore-focus-BgDTd2tc.js} +1 -1
- package/dist/{useAsyncData-DjMGFzFy.js → useAsyncData-Bn8SxUqM.js} +1 -1
- package/dist/{useDateFormatter-eCL_SdeG.js → useDateFormatter-D3Tkfzej.js} +2 -2
- package/dist/{useDeepCompareMemoize-BQR5TJot.js → useDeepCompareMemoize-CC2tnPCk.js} +1 -1
- package/dist/{useLifecycle-C_GvKWbQ.js → useLifecycle-BJlxHqWa.js} +2 -2
- package/dist/{useTheme-Bns2gJZ6.js → useTheme-DMfQYmlG.js} +85 -85
- package/dist/{vega-component-BsVptuhz.js → vega-component-CovWHi60.js} +7 -7
- package/dist/{vennDiagram-4TSXK5OY-CH65znGa.js → vennDiagram-4TSXK5OY-BD-SL_vq.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-z9pWKb2_.js → wardleyDiagram-VM6X3IG4-BDgJV4ah.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-MxyaWjjq.js → xychartDiagram-S5SC5T6Z-1hIHN6Rl.js} +1 -1
- package/package.json +1 -1
- package/src/__mocks__/document.tsx +54 -0
- package/src/__mocks__/notebook.ts +2 -1
- package/src/__mocks__/requests.ts +0 -2
- package/src/components/chat/chat-panel.tsx +3 -3
- package/src/components/datasources/__tests__/column-preview.test.tsx +6 -8
- package/src/components/datasources/column-preview.tsx +4 -8
- package/src/components/datasources/datasources.tsx +4 -3
- package/src/components/dependency-graph/minimap-content.tsx +2 -6
- package/src/components/dependency-graph/panels.tsx +2 -1
- package/src/components/editor/__tests__/Output.test.tsx +50 -32
- package/src/components/editor/__tests__/data-attributes.test.tsx +22 -11
- package/src/components/editor/__tests__/output-persistence.test.tsx +6 -1
- package/src/components/editor/actions/__tests__/name-cell-input.test.tsx +69 -0
- package/src/components/editor/actions/name-cell-input.tsx +4 -3
- package/src/components/editor/actions/useCellActionButton.tsx +20 -26
- package/src/components/editor/actions/useNotebookActions.tsx +13 -18
- package/src/components/editor/actions/useSetCodeVisibility.ts +10 -11
- package/src/components/editor/actions/useSetOutputsExpanded.ts +13 -18
- package/src/components/editor/cell/CreateCellButton.tsx +5 -9
- package/src/components/editor/cell/__tests__/StagedAICell.test.tsx +3 -1
- package/src/components/editor/cell/code/cell-editor.tsx +13 -20
- package/src/components/editor/cell/useAddCell.ts +4 -8
- package/src/components/editor/cell/useDeleteCell.tsx +10 -36
- package/src/components/editor/cell/useRunCells.ts +2 -5
- package/src/components/editor/cell/useSplitCell.tsx +2 -1
- package/src/components/editor/chrome/panels/logs-panel.tsx +2 -1
- package/src/components/editor/chrome/panels/snippets-panel.tsx +5 -11
- package/src/components/editor/chrome/wrapper/__tests__/pending-ai-cells.test.tsx +3 -1
- package/src/components/editor/columns/sortable-column.tsx +1 -1
- package/src/components/editor/connections/components.tsx +4 -9
- package/src/components/editor/controls/Controls.tsx +1 -1
- package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +9 -3
- package/src/components/editor/documentation.css +34 -11
- package/src/components/editor/errors/auto-fix.tsx +4 -8
- package/src/components/editor/file-tree/file-explorer.tsx +3 -7
- package/src/components/editor/links/__tests__/cell-link.test.tsx +3 -1
- package/src/components/editor/links/cell-link.tsx +2 -1
- package/src/components/editor/navigation/__tests__/clipboard.test.ts +60 -38
- package/src/components/editor/navigation/__tests__/navigation.test.ts +73 -64
- package/src/components/editor/navigation/clipboard.ts +12 -11
- package/src/components/editor/navigation/multi-cell-action-toolbar.tsx +11 -20
- package/src/components/editor/navigation/navigation.ts +20 -28
- package/src/components/editor/notebook-cell.tsx +7 -10
- package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +125 -69
- package/src/components/editor/renderers/cell-array.tsx +10 -17
- package/src/components/markdown/markdown-renderer.tsx +4 -8
- package/src/components/pages/edit-page.tsx +32 -17
- package/src/components/scratchpad/scratchpad.test.tsx +3 -1
- package/src/components/scratchpad/scratchpad.tsx +4 -7
- package/src/components/slides/__tests__/minimap-actions.test.tsx +9 -25
- package/src/components/slides/minimap.tsx +7 -3
- package/src/components/slides/slide-cell-view.tsx +3 -3
- package/src/components/sort/SortableCellsProvider.tsx +2 -1
- package/src/core/ai/__tests__/staged-cells.test.ts +18 -20
- package/src/core/ai/staged-cells.ts +8 -16
- package/src/core/ai/tools/__tests__/edit-notebook-tool.test.ts +2 -2
- package/src/core/ai/tools/__tests__/run-cells-tool.test.ts +2 -2
- package/src/core/ai/tools/base.ts +2 -2
- package/src/core/ai/tools/edit-notebook-tool.ts +13 -21
- package/src/core/cells/__tests__/actions.test.ts +474 -34
- package/src/core/cells/__tests__/add-missing-import.test.ts +7 -8
- package/src/core/cells/__tests__/cells.test.ts +251 -861
- package/src/core/cells/__tests__/document.test.ts +42 -38
- package/src/core/cells/__tests__/notebook-outline.test.ts +7 -1
- package/src/core/cells/__tests__/outputs.test.tsx +71 -53
- package/src/core/cells/actions.ts +391 -3
- package/src/core/cells/add-missing-import.ts +46 -42
- package/src/core/cells/cells.ts +73 -444
- package/src/core/cells/document.ts +38 -6
- package/src/core/cells/outputs.ts +12 -28
- package/src/core/codemirror/cells/extensions.ts +6 -6
- package/src/core/codemirror/cells/state.ts +1 -1
- package/src/core/codemirror/keymaps/vim.ts +2 -2
- package/src/core/edit-app.tsx +20 -25
- package/src/core/islands/__tests__/bootstrap.test.ts +56 -0
- package/src/core/islands/__tests__/bridge.test.ts +42 -0
- package/src/core/islands/bootstrap.ts +24 -1
- package/src/core/islands/bridge.ts +46 -5
- package/src/core/kernel/__tests__/handlers.test.ts +7 -153
- package/src/core/kernel/handlers.ts +18 -59
- package/src/core/network/__tests__/requests-lazy.test.ts +1 -3
- package/src/core/network/requests-lazy.ts +0 -2
- package/src/core/network/requests-network.ts +0 -16
- package/src/core/network/requests-static.ts +0 -2
- package/src/core/network/requests-toasting.tsx +0 -2
- package/src/core/network/types.ts +0 -7
- package/src/core/notebook/document/__tests__/codemirror.test.ts +5 -0
- package/src/core/notebook/document/__tests__/draft.test.ts +41 -0
- package/src/core/notebook/document/__tests__/state.test.ts +21 -0
- package/src/core/notebook/document/draft.ts +35 -5
- package/src/core/notebook/document/index.ts +1 -0
- package/src/core/notebook/document/state.ts +6 -2
- package/src/core/run-app.tsx +1 -7
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +0 -6
- package/src/core/session/useNotebookSession.tsx +28 -35
- package/src/core/wasm/bridge.ts +0 -16
- package/src/css/globals.css +56 -22
- package/src/stories/runtime-story.tsx +22 -15
|
@@ -1,1612 +1,1615 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region ../node_modules/.pnpm/@codemirror+
|
|
3
|
-
var pe =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
function b(e, t) {
|
|
8
|
-
return ({ state: n, dispatch: r }) => {
|
|
9
|
-
if (n.readOnly) return !1;
|
|
10
|
-
let i = e(t, n);
|
|
11
|
-
return i ? (r(n.update(i)), !0) : !1;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
var me = /*@__PURE__*/ b(be, 0), he = /*@__PURE__*/ b(ye, 0), ge = /*@__PURE__*/ b((e, t) => ye(e, t, ve(t)), 0);
|
|
15
|
-
function x(e, t) {
|
|
16
|
-
let n = e.languageDataAt("commentTokens", t, 1);
|
|
17
|
-
return n.length ? n[0] : {};
|
|
18
|
-
}
|
|
19
|
-
var S = 50;
|
|
20
|
-
function _e(e, { open: t, close: n }, r, i) {
|
|
21
|
-
let a = e.sliceDoc(r - S, r), o = e.sliceDoc(i, i + S), s = /\s*$/.exec(a)[0].length, c = /^\s*/.exec(o)[0].length, l = a.length - s;
|
|
22
|
-
if (a.slice(l - t.length, l) == t && o.slice(c, c + n.length) == n) return {
|
|
23
|
-
open: {
|
|
24
|
-
pos: r - s,
|
|
25
|
-
margin: s && 1
|
|
26
|
-
},
|
|
27
|
-
close: {
|
|
28
|
-
pos: i + c,
|
|
29
|
-
margin: c && 1
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
let u, d;
|
|
33
|
-
i - r <= 100 ? u = d = e.sliceDoc(r, i) : (u = e.sliceDoc(r, r + S), d = e.sliceDoc(i - S, i));
|
|
34
|
-
let f = /^\s*/.exec(u)[0].length, p = /\s*$/.exec(d)[0].length, m = d.length - p - n.length;
|
|
35
|
-
return u.slice(f, f + t.length) == t && d.slice(m, m + n.length) == n ? {
|
|
36
|
-
open: {
|
|
37
|
-
pos: r + f + t.length,
|
|
38
|
-
margin: +!!/\s/.test(u.charAt(f + t.length))
|
|
39
|
-
},
|
|
40
|
-
close: {
|
|
41
|
-
pos: i - p - n.length,
|
|
42
|
-
margin: +!!/\s/.test(d.charAt(m - 1))
|
|
43
|
-
}
|
|
44
|
-
} : null;
|
|
45
|
-
}
|
|
46
|
-
function ve(e) {
|
|
47
|
-
let t = [];
|
|
48
|
-
for (let n of e.selection.ranges) {
|
|
49
|
-
let r = e.doc.lineAt(n.from), i = n.to <= r.to ? r : e.doc.lineAt(n.to);
|
|
50
|
-
i.from > r.from && i.from == n.to && (i = n.to == r.to + 1 ? r : e.doc.lineAt(n.to - 1));
|
|
51
|
-
let a = t.length - 1;
|
|
52
|
-
a >= 0 && t[a].to > r.from ? t[a].to = i.to : t.push({
|
|
53
|
-
from: r.from + /^\s*/.exec(r.text)[0].length,
|
|
54
|
-
to: i.to
|
|
55
|
-
});
|
|
1
|
+
import { A as e, At as t, D as n, Dt as r, E as i, G as a, I as o, It as s, J as c, Lt as l, Mt as u, N as d, Nt as f, Ot as p, Rt as m, St as h, U as g, Vt as _, W as ee, Y as te, _t as ne, et as re, gt as v, j as ie, jt as ae, lt as oe, mt as se, o as ce, ot as le, q as ue, vt as de, wt as y, yt as fe } from "./dist-BmS-ZGjl.js";
|
|
2
|
+
//#region ../node_modules/.pnpm/@codemirror+lint@6.9.7/node_modules/@codemirror/lint/dist/index.js
|
|
3
|
+
var pe = class {
|
|
4
|
+
constructor(e, t, n) {
|
|
5
|
+
this.from = e, this.to = t, this.diagnostic = n;
|
|
56
6
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
let r = n.map((e) => x(t, e.from).block);
|
|
61
|
-
if (!r.every((e) => e)) return null;
|
|
62
|
-
let i = n.map((e, n) => _e(t, r[n], e.from, e.to));
|
|
63
|
-
if (e != 2 && !i.every((e) => e)) return { changes: t.changes(n.map((e, t) => i[t] ? [] : [{
|
|
64
|
-
from: e.from,
|
|
65
|
-
insert: r[t].open + " "
|
|
66
|
-
}, {
|
|
67
|
-
from: e.to,
|
|
68
|
-
insert: " " + r[t].close
|
|
69
|
-
}])) };
|
|
70
|
-
if (e != 1 && i.some((e) => e)) {
|
|
71
|
-
let e = [];
|
|
72
|
-
for (let t = 0, n; t < i.length; t++) if (n = i[t]) {
|
|
73
|
-
let i = r[t], { open: a, close: o } = n;
|
|
74
|
-
e.push({
|
|
75
|
-
from: a.pos - i.open.length,
|
|
76
|
-
to: a.pos + a.margin
|
|
77
|
-
}, {
|
|
78
|
-
from: o.pos - o.margin,
|
|
79
|
-
to: o.pos + i.close.length
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
return { changes: e };
|
|
7
|
+
}, b = class e {
|
|
8
|
+
constructor(e, t, n) {
|
|
9
|
+
this.diagnostics = e, this.panel = t, this.selected = n;
|
|
83
10
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
let
|
|
92
|
-
if (s
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
e < c.text.length && e < o && (o = e), r.push({
|
|
97
|
-
line: c,
|
|
98
|
-
comment: n,
|
|
99
|
-
token: s,
|
|
100
|
-
indent: e,
|
|
101
|
-
empty: t,
|
|
102
|
-
single: !1
|
|
103
|
-
});
|
|
11
|
+
static init(t, n, r) {
|
|
12
|
+
let i = r.facet(T).markerFilter;
|
|
13
|
+
i && (t = i(t, r));
|
|
14
|
+
let a = t.slice().sort((e, t) => e.from - t.from || e.to - t.to), o = new p(), s = [], c = 0, l = r.doc.iter(), u = 0, d = r.doc.length;
|
|
15
|
+
for (let e = 0;;) {
|
|
16
|
+
let t = e == a.length ? null : a[e];
|
|
17
|
+
if (!t && !s.length) break;
|
|
18
|
+
let n, r;
|
|
19
|
+
if (s.length) n = c, r = s.reduce((e, t) => Math.min(e, t.to), t && t.from > n ? t.from : 1e8);
|
|
20
|
+
else {
|
|
21
|
+
if (n = t.from, n > d) break;
|
|
22
|
+
r = t.to, s.push(t), e++;
|
|
104
23
|
}
|
|
105
|
-
|
|
24
|
+
for (; e < a.length;) {
|
|
25
|
+
let t = a[e];
|
|
26
|
+
if (t.from == n && (t.to > t.from || t.to == n)) s.push(t), e++, r = Math.min(t.to, r);
|
|
27
|
+
else {
|
|
28
|
+
r = Math.min(t.from, r);
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
r = Math.min(r, d);
|
|
33
|
+
let i = !1;
|
|
34
|
+
if (s.some((e) => e.from == n && (e.to == r || r == d)) && (i = n == r, !i && r - n < 10)) {
|
|
35
|
+
let e = n - (u + l.value.length);
|
|
36
|
+
e > 0 && (l.next(e), u = n);
|
|
37
|
+
for (let e = n;;) {
|
|
38
|
+
if (e >= r) {
|
|
39
|
+
i = !0;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
if (!l.lineBreak && u + l.value.length > e) break;
|
|
43
|
+
e = u + l.value.length, u += l.value.length, l.next();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
let f = Fe(s);
|
|
47
|
+
if (i) o.add(n, n, g.widget({
|
|
48
|
+
widget: new Ae(f),
|
|
49
|
+
diagnostics: s.slice()
|
|
50
|
+
}));
|
|
51
|
+
else {
|
|
52
|
+
let e = s.reduce((e, t) => t.markClass ? e + " " + t.markClass : e, "");
|
|
53
|
+
o.add(n, r, g.mark({
|
|
54
|
+
class: "cm-lintRange cm-lintRange-" + f + e,
|
|
55
|
+
diagnostics: s.slice(),
|
|
56
|
+
inclusiveEnd: s.some((e) => e.to > r)
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
if (c = r, c == d) break;
|
|
60
|
+
for (let e = 0; e < s.length; e++) s[e].to <= c && s.splice(e--, 1);
|
|
106
61
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
if (e != 2 && r.some((e) => e.comment < 0 && (!e.empty || e.single))) {
|
|
111
|
-
let e = [];
|
|
112
|
-
for (let { line: t, token: n, indent: i, empty: a, single: o } of r) (o || !a) && e.push({
|
|
113
|
-
from: t.from + i,
|
|
114
|
-
insert: n + " "
|
|
115
|
-
});
|
|
116
|
-
let n = t.changes(e);
|
|
117
|
-
return {
|
|
118
|
-
changes: n,
|
|
119
|
-
selection: t.selection.map(n, 1)
|
|
120
|
-
};
|
|
62
|
+
let f = o.finish();
|
|
63
|
+
return new e(f, n, x(f));
|
|
121
64
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
65
|
+
};
|
|
66
|
+
function x(e, t = null, n = 0) {
|
|
67
|
+
let r = null;
|
|
68
|
+
return e.between(n, 1e9, (e, n, { spec: i }) => {
|
|
69
|
+
if (!(t && i.diagnostics.indexOf(t) < 0)) {
|
|
70
|
+
if (!r) r = new pe(e, n, t || i.diagnostics[0]);
|
|
71
|
+
else if (i.diagnostics.indexOf(r.diagnostic) < 0) return !1;
|
|
72
|
+
else r = new pe(r.from, n, r.diagnostic);
|
|
130
73
|
}
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
return null;
|
|
74
|
+
}), r;
|
|
134
75
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
76
|
+
function me(e, t) {
|
|
77
|
+
let n = t.pos, r = t.end || n, i = e.state.facet(T).hideOn(e, n, r);
|
|
78
|
+
if (i != null) return i;
|
|
79
|
+
let a = e.startState.doc.lineAt(t.pos);
|
|
80
|
+
return !!(e.effects.some((e) => e.is(S)) || e.changes.touchesRange(a.from, Math.max(a.to, r)));
|
|
81
|
+
}
|
|
82
|
+
function he(e, n) {
|
|
83
|
+
return e.field(w, !1) ? n : n.concat(t.appendConfig.of(Le));
|
|
84
|
+
}
|
|
85
|
+
function ge(e, t) {
|
|
86
|
+
return { effects: he(e, [S.of(t)]) };
|
|
87
|
+
}
|
|
88
|
+
var S = /*@__PURE__*/ t.define(), C = /*@__PURE__*/ t.define(), _e = /*@__PURE__*/ t.define(), w = /*@__PURE__*/ ae.define({
|
|
146
89
|
create() {
|
|
147
|
-
return
|
|
90
|
+
return new b(g.none, null, null);
|
|
148
91
|
},
|
|
149
92
|
update(e, t) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
93
|
+
if (t.docChanged && e.diagnostics.size) {
|
|
94
|
+
let n = e.diagnostics.map(t.changes), r = null, i = e.panel;
|
|
95
|
+
if (e.selected) {
|
|
96
|
+
let i = t.changes.mapPos(e.selected.from, 1);
|
|
97
|
+
r = x(n, e.selected.diagnostic, i) || x(n, null, i);
|
|
98
|
+
}
|
|
99
|
+
!n.size && i && t.state.facet(T).autoPanel && (i = null), e = new b(n, i, r);
|
|
154
100
|
}
|
|
155
|
-
let
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
toJSON(e) {
|
|
161
|
-
return {
|
|
162
|
-
done: e.done.map((e) => e.toJSON()),
|
|
163
|
-
undone: e.undone.map((e) => e.toJSON())
|
|
164
|
-
};
|
|
101
|
+
for (let n of t.effects) if (n.is(S)) {
|
|
102
|
+
let r = t.state.facet(T).autoPanel ? n.value.length ? E.open : null : e.panel;
|
|
103
|
+
e = b.init(n.value, r, t.state);
|
|
104
|
+
} else n.is(C) ? e = new b(e.diagnostics, n.value ? E.open : null, e.selected) : n.is(_e) && (e = new b(e.diagnostics, e.panel, n.value));
|
|
105
|
+
return e;
|
|
165
106
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
107
|
+
provide: (e) => [se.from(e, (e) => e.panel), a.decorations.from(e, (e) => e.diagnostics)]
|
|
108
|
+
}), ve = /*@__PURE__*/ g.mark({ class: "cm-lintRange cm-lintRange-active" });
|
|
109
|
+
function ye(e, t, n) {
|
|
110
|
+
let { diagnostics: r } = e.state.field(w), i, a = -1, o = -1;
|
|
111
|
+
r.between(t - +(n < 0), t + +(n > 0), (e, r, { spec: s }) => {
|
|
112
|
+
if (t >= e && t <= r && (e == r || (t > e || n > 0) && (t < r || n < 0))) return i = s.diagnostics, a = e, o = r, !1;
|
|
113
|
+
});
|
|
114
|
+
let s = e.state.facet(T).tooltipFilter;
|
|
115
|
+
return i && s && (i = s(i, e.state)), i ? {
|
|
116
|
+
pos: a,
|
|
117
|
+
end: o,
|
|
118
|
+
above: !0,
|
|
119
|
+
create() {
|
|
120
|
+
return { dom: be(e, i) };
|
|
121
|
+
}
|
|
122
|
+
} : null;
|
|
179
123
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return function({ state: n, dispatch: r }) {
|
|
183
|
-
if (!t && n.readOnly) return !1;
|
|
184
|
-
let i = n.field(w, !1);
|
|
185
|
-
if (!i) return !1;
|
|
186
|
-
let a = i.pop(e, n, t);
|
|
187
|
-
return a ? (r(a), !0) : !1;
|
|
188
|
-
};
|
|
124
|
+
function be(e, t) {
|
|
125
|
+
return v("ul", { class: "cm-tooltip-lint" }, t.map((t) => ke(e, t, !1)));
|
|
189
126
|
}
|
|
190
|
-
var
|
|
191
|
-
|
|
192
|
-
|
|
127
|
+
var xe = (e) => {
|
|
128
|
+
let t = e.state.field(w, !1);
|
|
129
|
+
(!t || !t.panel) && e.dispatch({ effects: he(e.state, [C.of(!0)]) });
|
|
130
|
+
let n = re(e, E.open);
|
|
131
|
+
return n && n.dom.querySelector(".cm-panel-lint ul").focus(), !0;
|
|
132
|
+
}, Se = (e) => {
|
|
133
|
+
let t = e.state.field(w, !1);
|
|
134
|
+
return !t || !t.panel ? !1 : (e.dispatch({ effects: C.of(!1) }), !0);
|
|
135
|
+
}, Ce = [{
|
|
136
|
+
key: "Mod-Shift-m",
|
|
137
|
+
run: xe,
|
|
138
|
+
preventDefault: !0
|
|
139
|
+
}, {
|
|
140
|
+
key: "F8",
|
|
141
|
+
run: (e) => {
|
|
142
|
+
let t = e.state.field(w, !1);
|
|
143
|
+
if (!t) return !1;
|
|
144
|
+
let n = e.state.selection.main, r = x(t.diagnostics, null, n.to + 1);
|
|
145
|
+
return !r && (r = x(t.diagnostics, null, 0), !r || r.from == n.from && r.to == n.to) ? !1 : (e.dispatch({
|
|
146
|
+
selection: {
|
|
147
|
+
anchor: r.from,
|
|
148
|
+
head: r.to
|
|
149
|
+
},
|
|
150
|
+
scrollIntoView: !0
|
|
151
|
+
}), te(e, r.from, 1, {
|
|
152
|
+
tooltip: Ie,
|
|
153
|
+
until: (e) => e.docChanged || e.newSelection.main.head < r.from || e.newSelection.main.head > r.to
|
|
154
|
+
}), !0);
|
|
193
155
|
}
|
|
194
|
-
|
|
195
|
-
|
|
156
|
+
}], we = /*@__PURE__*/ ue.fromClass(class {
|
|
157
|
+
constructor(e) {
|
|
158
|
+
this.view = e, this.timeout = -1, this.set = !0;
|
|
159
|
+
let { delay: t } = e.state.facet(T);
|
|
160
|
+
this.lintTime = Date.now() + t, this.run = this.run.bind(this), this.timeout = setTimeout(this.run, t);
|
|
196
161
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
162
|
+
run() {
|
|
163
|
+
clearTimeout(this.timeout);
|
|
164
|
+
let e = Date.now();
|
|
165
|
+
if (e < this.lintTime - 10) this.timeout = setTimeout(this.run, this.lintTime - e);
|
|
166
|
+
else {
|
|
167
|
+
this.set = !1;
|
|
168
|
+
let { state: e } = this.view, { sources: t } = e.facet(T);
|
|
169
|
+
t.length && Te(t.map((e) => Promise.resolve(e(this.view))), (t) => {
|
|
170
|
+
this.view.state.doc == e.doc && this.view.dispatch(ge(this.view.state, t.reduce((e, t) => e.concat(t))));
|
|
171
|
+
}, (e) => {
|
|
172
|
+
oe(this.view.state, e);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
204
175
|
}
|
|
205
|
-
|
|
206
|
-
|
|
176
|
+
update(e) {
|
|
177
|
+
let t = e.state.facet(T);
|
|
178
|
+
(e.docChanged || t != e.startState.facet(T) || t.needsRefresh && t.needsRefresh(e)) && (this.lintTime = Date.now() + t.delay, this.set || (this.set = !0, this.timeout = setTimeout(this.run, t.delay)));
|
|
207
179
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
for (let e of t.startState.facet(Se)) {
|
|
211
|
-
let n = e(t);
|
|
212
|
-
n.length && (r = r.concat(n));
|
|
213
|
-
}
|
|
214
|
-
return !r.length && t.changes.empty ? null : new e(t.changes.invert(t.startState.doc), r, void 0, n || t.startState.selection, k);
|
|
180
|
+
force() {
|
|
181
|
+
this.set && (this.lintTime = Date.now(), this.run());
|
|
215
182
|
}
|
|
216
|
-
|
|
217
|
-
|
|
183
|
+
destroy() {
|
|
184
|
+
clearTimeout(this.timeout);
|
|
218
185
|
}
|
|
219
|
-
};
|
|
220
|
-
function
|
|
221
|
-
let
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
let n = [], r = !1;
|
|
226
|
-
return e.iterChangedRanges((e, t) => n.push(e, t)), t.iterChangedRanges((e, t, i, a) => {
|
|
227
|
-
for (let e = 0; e < n.length;) {
|
|
228
|
-
let t = n[e++], o = n[e++];
|
|
229
|
-
a >= t && i <= o && (r = !0);
|
|
230
|
-
}
|
|
231
|
-
}), r;
|
|
232
|
-
}
|
|
233
|
-
function Ae(e, t) {
|
|
234
|
-
return e.ranges.length == t.ranges.length && e.ranges.filter((e, n) => e.empty != t.ranges[n].empty).length === 0;
|
|
235
|
-
}
|
|
236
|
-
function je(e, t) {
|
|
237
|
-
return e.length ? t.length ? e.concat(t) : e : t;
|
|
186
|
+
});
|
|
187
|
+
function Te(e, t, n) {
|
|
188
|
+
let r = [], i = -1;
|
|
189
|
+
for (let a of e) a.then((n) => {
|
|
190
|
+
r.push(n), clearTimeout(i), r.length == e.length ? t(r) : i = setTimeout(() => t(r), 200);
|
|
191
|
+
}, n);
|
|
238
192
|
}
|
|
239
|
-
var
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
193
|
+
var T = /*@__PURE__*/ y.define({ combine(e) {
|
|
194
|
+
return {
|
|
195
|
+
sources: e.map((e) => e.source).filter((e) => e != null),
|
|
196
|
+
...s(e.map((e) => e.config), {
|
|
197
|
+
delay: 750,
|
|
198
|
+
markerFilter: null,
|
|
199
|
+
tooltipFilter: null,
|
|
200
|
+
needsRefresh: null,
|
|
201
|
+
hideOn: () => null
|
|
202
|
+
}, {
|
|
203
|
+
delay: Math.max,
|
|
204
|
+
markerFilter: Ee,
|
|
205
|
+
tooltipFilter: Ee,
|
|
206
|
+
needsRefresh: (e, t) => e ? t ? (n) => e(n) || t(n) : e : t,
|
|
207
|
+
hideOn: (e, t) => e ? t ? (n, r, i) => e(n, r, i) || t(n, r, i) : e : t,
|
|
208
|
+
autoPanel: (e, t) => e || t
|
|
209
|
+
})
|
|
210
|
+
};
|
|
211
|
+
} });
|
|
212
|
+
function Ee(e, t) {
|
|
213
|
+
return e ? t ? (n, r) => t(e(n, r), r) : e : t;
|
|
246
214
|
}
|
|
247
|
-
function
|
|
248
|
-
|
|
249
|
-
|
|
215
|
+
function De(e, t = {}) {
|
|
216
|
+
return [
|
|
217
|
+
T.of({
|
|
218
|
+
source: e,
|
|
219
|
+
config: t
|
|
220
|
+
}),
|
|
221
|
+
we,
|
|
222
|
+
Le
|
|
223
|
+
];
|
|
250
224
|
}
|
|
251
|
-
function
|
|
252
|
-
|
|
253
|
-
let n
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
225
|
+
function Oe(e) {
|
|
226
|
+
let t = [];
|
|
227
|
+
if (e) actions: for (let { name: n } of e) {
|
|
228
|
+
for (let e = 0; e < n.length; e++) {
|
|
229
|
+
let r = n[e];
|
|
230
|
+
if (/[a-zA-Z]/.test(r) && !t.some((e) => e.toLowerCase() == r.toLowerCase())) {
|
|
231
|
+
t.push(r);
|
|
232
|
+
continue actions;
|
|
233
|
+
}
|
|
259
234
|
}
|
|
260
|
-
t
|
|
235
|
+
t.push("");
|
|
261
236
|
}
|
|
262
|
-
return
|
|
237
|
+
return t;
|
|
263
238
|
}
|
|
264
|
-
function
|
|
265
|
-
let r =
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
239
|
+
function ke(e, t, n) {
|
|
240
|
+
let r = n ? Oe(t.actions) : [];
|
|
241
|
+
return v("li", { class: "cm-diagnostic cm-diagnostic-" + t.severity }, v("span", { class: "cm-diagnosticText" }, t.renderMessage ? t.renderMessage(e) : t.message), t.actions?.map((n, i) => {
|
|
242
|
+
let a = !1, o = (r) => {
|
|
243
|
+
if (r.preventDefault(), a) return;
|
|
244
|
+
a = !0;
|
|
245
|
+
let i = x(e.state.field(w).diagnostics, t);
|
|
246
|
+
i && n.apply(e, i.from, i.to);
|
|
247
|
+
}, { name: s } = n, c = r[i] ? s.indexOf(r[i]) : -1, l = c < 0 ? s : [
|
|
248
|
+
s.slice(0, c),
|
|
249
|
+
v("u", s.slice(c, c + 1)),
|
|
250
|
+
s.slice(c + 1)
|
|
251
|
+
], u = n.markClass ? " " + n.markClass : "";
|
|
252
|
+
return v("button", {
|
|
253
|
+
type: "button",
|
|
254
|
+
class: "cm-diagnosticAction" + u,
|
|
255
|
+
onclick: o,
|
|
256
|
+
onmousedown: o,
|
|
257
|
+
"aria-label": ` Action: ${s}${c < 0 ? "" : ` (access key "${r[i]})"`}.`
|
|
258
|
+
}, l);
|
|
259
|
+
}), t.source && v("div", { class: "cm-diagnosticSource" }, t.source));
|
|
269
260
|
}
|
|
270
|
-
var
|
|
271
|
-
constructor(e
|
|
272
|
-
|
|
261
|
+
var Ae = class extends c {
|
|
262
|
+
constructor(e) {
|
|
263
|
+
super(), this.sev = e;
|
|
273
264
|
}
|
|
274
|
-
|
|
275
|
-
return
|
|
265
|
+
eq(e) {
|
|
266
|
+
return e.sev == this.sev;
|
|
276
267
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
return o = s && s.changes && !s.changes.empty && t.changes && (!r || Ie.test(r)) && (!s.selectionsAfter.length && n - this.prevTime < i.newGroupDelay && i.joinToEvent(a, ke(s.changes, t.changes)) || r == "input.type.compose") ? O(o, o.length - 1, i.minDepth, new D(t.changes.compose(s.changes), je(h.mapEffects(t.effects, s.changes), s.effects), s.mapped, s.startSelection, k)) : O(o, o.length, i.minDepth, t), new e(o, k, n, r);
|
|
268
|
+
toDOM() {
|
|
269
|
+
return v("span", { class: "cm-lintPoint cm-lintPoint-" + this.sev });
|
|
280
270
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
271
|
+
}, je = class {
|
|
272
|
+
constructor(e, t) {
|
|
273
|
+
this.diagnostic = t, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom = ke(e, t, !0), this.dom.id = this.id, this.dom.setAttribute("role", "option");
|
|
284
274
|
}
|
|
285
|
-
|
|
286
|
-
|
|
275
|
+
}, E = class e {
|
|
276
|
+
constructor(e) {
|
|
277
|
+
this.view = e, this.items = [];
|
|
278
|
+
let t = (t) => {
|
|
279
|
+
if (!(t.ctrlKey || t.altKey || t.metaKey)) {
|
|
280
|
+
if (t.keyCode == 27) Se(this.view), this.view.focus();
|
|
281
|
+
else if (t.keyCode == 38 || t.keyCode == 33) this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);
|
|
282
|
+
else if (t.keyCode == 40 || t.keyCode == 34) this.moveSelection((this.selectedIndex + 1) % this.items.length);
|
|
283
|
+
else if (t.keyCode == 36) this.moveSelection(0);
|
|
284
|
+
else if (t.keyCode == 35) this.moveSelection(this.items.length - 1);
|
|
285
|
+
else if (t.keyCode == 13) this.view.focus();
|
|
286
|
+
else if (t.keyCode >= 65 && t.keyCode <= 90 && this.selectedIndex >= 0) {
|
|
287
|
+
let { diagnostic: n } = this.items[this.selectedIndex], r = Oe(n.actions);
|
|
288
|
+
for (let i = 0; i < r.length; i++) if (r[i].toUpperCase().charCodeAt(0) == t.keyCode) {
|
|
289
|
+
let t = x(this.view.state.field(w).diagnostics, n);
|
|
290
|
+
t && n.actions[i].apply(e, t.from, t.to);
|
|
291
|
+
}
|
|
292
|
+
} else return;
|
|
293
|
+
t.preventDefault();
|
|
294
|
+
}
|
|
295
|
+
}, n = (e) => {
|
|
296
|
+
for (let t = 0; t < this.items.length; t++) this.items[t].dom.contains(e.target) && this.moveSelection(t);
|
|
297
|
+
};
|
|
298
|
+
this.list = v("ul", {
|
|
299
|
+
tabIndex: 0,
|
|
300
|
+
role: "listbox",
|
|
301
|
+
"aria-label": this.view.state.phrase("Diagnostics"),
|
|
302
|
+
onkeydown: t,
|
|
303
|
+
onclick: n
|
|
304
|
+
}), this.dom = v("div", { class: "cm-panel-lint" }, this.list, v("button", {
|
|
305
|
+
type: "button",
|
|
306
|
+
name: "close",
|
|
307
|
+
"aria-label": this.view.state.phrase("close"),
|
|
308
|
+
onclick: () => Se(this.view)
|
|
309
|
+
}, "×")), this.update();
|
|
287
310
|
}
|
|
288
|
-
|
|
289
|
-
let
|
|
290
|
-
if (
|
|
291
|
-
let
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
311
|
+
get selectedIndex() {
|
|
312
|
+
let e = this.view.state.field(w).selected;
|
|
313
|
+
if (!e) return -1;
|
|
314
|
+
for (let t = 0; t < this.items.length; t++) if (this.items[t].diagnostic == e.diagnostic) return t;
|
|
315
|
+
return -1;
|
|
316
|
+
}
|
|
317
|
+
update() {
|
|
318
|
+
let { diagnostics: e, selected: t } = this.view.state.field(w), n = 0, r = !1, i = null, a = /* @__PURE__ */ new Set();
|
|
319
|
+
for (e.between(0, this.view.state.doc.length, (e, o, { spec: s }) => {
|
|
320
|
+
for (let e of s.diagnostics) {
|
|
321
|
+
if (a.has(e)) continue;
|
|
322
|
+
a.add(e);
|
|
323
|
+
let o = -1, s;
|
|
324
|
+
for (let t = n; t < this.items.length; t++) if (this.items[t].diagnostic == e) {
|
|
325
|
+
o = t;
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
o < 0 ? (s = new je(this.view, e), this.items.splice(n, 0, s), r = !0) : (s = this.items[o], o > n && (this.items.splice(n, o - n), r = !0)), t && s.diagnostic == t.diagnostic ? s.dom.hasAttribute("aria-selected") || (s.dom.setAttribute("aria-selected", "true"), i = s) : s.dom.hasAttribute("aria-selected") && s.dom.removeAttribute("aria-selected"), n++;
|
|
329
|
+
}
|
|
330
|
+
}); n < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0);) r = !0, this.items.pop();
|
|
331
|
+
this.items.length == 0 && (this.items.push(new je(this.view, {
|
|
332
|
+
from: -1,
|
|
333
|
+
to: -1,
|
|
334
|
+
severity: "info",
|
|
335
|
+
message: this.view.state.phrase("No diagnostics")
|
|
336
|
+
})), r = !0), i ? (this.list.setAttribute("aria-activedescendant", i.id), this.view.requestMeasure({
|
|
337
|
+
key: this,
|
|
338
|
+
read: () => ({
|
|
339
|
+
sel: i.dom.getBoundingClientRect(),
|
|
340
|
+
panel: this.list.getBoundingClientRect()
|
|
298
341
|
}),
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
rest: n,
|
|
311
|
-
selection: a
|
|
312
|
-
}),
|
|
313
|
-
filter: !1,
|
|
314
|
-
userEvent: e == 0 ? "undo" : "redo",
|
|
315
|
-
scrollIntoView: !0
|
|
316
|
-
});
|
|
342
|
+
write: ({ sel: e, panel: t }) => {
|
|
343
|
+
let n = t.height / this.list.offsetHeight;
|
|
344
|
+
e.top < t.top ? this.list.scrollTop -= (t.top - e.top) / n : e.bottom > t.bottom && (this.list.scrollTop += (e.bottom - t.bottom) / n);
|
|
345
|
+
}
|
|
346
|
+
})) : this.selectedIndex < 0 && this.list.removeAttribute("aria-activedescendant"), r && this.sync();
|
|
347
|
+
}
|
|
348
|
+
sync() {
|
|
349
|
+
let e = this.list.firstChild;
|
|
350
|
+
function t() {
|
|
351
|
+
let t = e;
|
|
352
|
+
e = t.nextSibling, t.remove();
|
|
317
353
|
}
|
|
318
|
-
|
|
354
|
+
for (let n of this.items) if (n.dom.parentNode == this.list) {
|
|
355
|
+
for (; e != n.dom;) t();
|
|
356
|
+
e = n.dom.nextSibling;
|
|
357
|
+
} else this.list.insertBefore(n.dom, e);
|
|
358
|
+
for (; e;) t();
|
|
359
|
+
}
|
|
360
|
+
moveSelection(e) {
|
|
361
|
+
if (this.selectedIndex < 0) return;
|
|
362
|
+
let t = x(this.view.state.field(w).diagnostics, this.items[e].diagnostic);
|
|
363
|
+
t && this.view.dispatch({
|
|
364
|
+
selection: {
|
|
365
|
+
anchor: t.from,
|
|
366
|
+
head: t.to
|
|
367
|
+
},
|
|
368
|
+
scrollIntoView: !0,
|
|
369
|
+
effects: _e.of(t)
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
static open(t) {
|
|
373
|
+
return new e(t);
|
|
319
374
|
}
|
|
320
375
|
};
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
376
|
+
function Me(e, t = "viewBox=\"0 0 40 40\"") {
|
|
377
|
+
return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`;
|
|
378
|
+
}
|
|
379
|
+
function D(e) {
|
|
380
|
+
return Me(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`, "width=\"6\" height=\"3\"");
|
|
381
|
+
}
|
|
382
|
+
var Ne = /*@__PURE__*/ a.baseTheme({
|
|
383
|
+
".cm-diagnostic": {
|
|
384
|
+
padding: "3px 6px 3px 8px",
|
|
385
|
+
marginLeft: "-1px",
|
|
386
|
+
display: "block",
|
|
387
|
+
whiteSpace: "pre-wrap"
|
|
327
388
|
},
|
|
328
|
-
{
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
389
|
+
".cm-diagnostic-error": { borderLeft: "5px solid #d11" },
|
|
390
|
+
".cm-diagnostic-warning": { borderLeft: "5px solid orange" },
|
|
391
|
+
".cm-diagnostic-info": { borderLeft: "5px solid #999" },
|
|
392
|
+
".cm-diagnostic-hint": { borderLeft: "5px solid #66d" },
|
|
393
|
+
".cm-diagnosticAction": {
|
|
394
|
+
font: "inherit",
|
|
395
|
+
border: "none",
|
|
396
|
+
padding: "2px 4px",
|
|
397
|
+
backgroundColor: "#444",
|
|
398
|
+
color: "white",
|
|
399
|
+
borderRadius: "3px",
|
|
400
|
+
marginLeft: "8px",
|
|
401
|
+
cursor: "pointer"
|
|
333
402
|
},
|
|
334
|
-
{
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
preventDefault: !0
|
|
403
|
+
".cm-diagnosticSource": {
|
|
404
|
+
fontSize: "70%",
|
|
405
|
+
opacity: .7
|
|
338
406
|
},
|
|
339
|
-
{
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
407
|
+
".cm-lintRange": {
|
|
408
|
+
backgroundPosition: "left bottom",
|
|
409
|
+
backgroundRepeat: "repeat-x",
|
|
410
|
+
paddingBottom: "0.7px"
|
|
343
411
|
},
|
|
344
|
-
{
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
return !r.eq(e.selection, !0) && (t(N(e, r)), !0);
|
|
364
|
-
}
|
|
365
|
-
function F(e, t) {
|
|
366
|
-
return n.cursor(t ? e.to : e.from);
|
|
367
|
-
}
|
|
368
|
-
function Re(e, t) {
|
|
369
|
-
return P(e, (n) => n.empty ? e.moveByChar(n, t) : F(n, t));
|
|
370
|
-
}
|
|
371
|
-
function I(e) {
|
|
372
|
-
return e.textDirectionAt(e.state.selection.main.head) == ee.LTR;
|
|
373
|
-
}
|
|
374
|
-
var ze = (e) => Re(e, !I(e)), Be = (e) => Re(e, I(e));
|
|
375
|
-
function Ve(e, t) {
|
|
376
|
-
return P(e, (n) => n.empty ? e.moveByGroup(n, t) : F(n, t));
|
|
377
|
-
}
|
|
378
|
-
var He = (e) => Ve(e, !I(e)), Ue = (e) => Ve(e, I(e));
|
|
379
|
-
typeof Intl < "u" && Intl.Segmenter;
|
|
380
|
-
function We(e, t, n) {
|
|
381
|
-
if (t.type.prop(n)) return !0;
|
|
382
|
-
let r = t.to - t.from;
|
|
383
|
-
return r && (r > 2 || /[^\s,.;:]/.test(e.sliceDoc(t.from, t.to))) || t.firstChild;
|
|
384
|
-
}
|
|
385
|
-
function L(e, t, r) {
|
|
386
|
-
let i = u(e).resolveInner(t.head), a = r ? _.closedBy : _.openedBy;
|
|
387
|
-
for (let n = t.head;;) {
|
|
388
|
-
let t = r ? i.childAfter(n) : i.childBefore(n);
|
|
389
|
-
if (!t) break;
|
|
390
|
-
We(e, t, a) ? i = t : n = r ? t.to : t.from;
|
|
391
|
-
}
|
|
392
|
-
let o = i.type.prop(a), s, c;
|
|
393
|
-
return c = o && (s = r ? m(e, i.from, 1) : m(e, i.to, -1)) && s.matched ? r ? s.end.to : s.end.from : r ? i.to : i.from, n.cursor(c, r ? -1 : 1);
|
|
394
|
-
}
|
|
395
|
-
var Ge = (e) => P(e, (t) => L(e.state, t, !I(e))), Ke = (e) => P(e, (t) => L(e.state, t, I(e)));
|
|
396
|
-
function qe(e, t) {
|
|
397
|
-
return P(e, (n) => {
|
|
398
|
-
if (!n.empty) return F(n, t);
|
|
399
|
-
let r = e.moveVertically(n, t);
|
|
400
|
-
return r.head == n.head ? e.moveToLineBoundary(n, t) : r;
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
var Je = (e) => qe(e, !1), Ye = (e) => qe(e, !0);
|
|
404
|
-
function Xe(t) {
|
|
405
|
-
let n = t.scrollDOM.clientHeight < t.scrollDOM.scrollHeight - 2, r = 0, i = 0, a;
|
|
406
|
-
if (n) {
|
|
407
|
-
for (let n of t.state.facet(e.scrollMargins)) {
|
|
408
|
-
let e = n(t);
|
|
409
|
-
e?.top && (r = Math.max(e?.top, r)), e?.bottom && (i = Math.max(e?.bottom, i));
|
|
412
|
+
".cm-lintRange-error": { backgroundImage: /*@__PURE__*/ D("#f11") },
|
|
413
|
+
".cm-lintRange-warning": { backgroundImage: /*@__PURE__*/ D("orange") },
|
|
414
|
+
".cm-lintRange-info": { backgroundImage: /*@__PURE__*/ D("#999") },
|
|
415
|
+
".cm-lintRange-hint": { backgroundImage: /*@__PURE__*/ D("#66d") },
|
|
416
|
+
".cm-lintRange-active": { backgroundColor: "#ffdd9980" },
|
|
417
|
+
".cm-tooltip-lint": {
|
|
418
|
+
padding: 0,
|
|
419
|
+
margin: 0
|
|
420
|
+
},
|
|
421
|
+
".cm-lintPoint": {
|
|
422
|
+
position: "relative",
|
|
423
|
+
"&:after": {
|
|
424
|
+
content: "\"\"",
|
|
425
|
+
position: "absolute",
|
|
426
|
+
bottom: 0,
|
|
427
|
+
left: "-2px",
|
|
428
|
+
borderLeft: "3px solid transparent",
|
|
429
|
+
borderRight: "3px solid transparent",
|
|
430
|
+
borderBottom: "4px solid #d11"
|
|
410
431
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
+
},
|
|
433
|
+
".cm-lintPoint-warning": { "&:after": { borderBottomColor: "orange" } },
|
|
434
|
+
".cm-lintPoint-info": { "&:after": { borderBottomColor: "#999" } },
|
|
435
|
+
".cm-lintPoint-hint": { "&:after": { borderBottomColor: "#66d" } },
|
|
436
|
+
".cm-panel.cm-panel-lint": {
|
|
437
|
+
position: "relative",
|
|
438
|
+
"& ul": {
|
|
439
|
+
maxHeight: "100px",
|
|
440
|
+
overflowY: "auto",
|
|
441
|
+
"& [aria-selected]": {
|
|
442
|
+
backgroundColor: "#ddd",
|
|
443
|
+
"& u": { textDecoration: "underline" }
|
|
444
|
+
},
|
|
445
|
+
"&:focus [aria-selected]": {
|
|
446
|
+
background_fallback: "#bdf",
|
|
447
|
+
backgroundColor: "Highlight",
|
|
448
|
+
color_fallback: "white",
|
|
449
|
+
color: "HighlightText"
|
|
450
|
+
},
|
|
451
|
+
"& u": { textDecoration: "none" },
|
|
452
|
+
padding: 0,
|
|
453
|
+
margin: 0
|
|
454
|
+
},
|
|
455
|
+
"& [name=close]": {
|
|
456
|
+
position: "absolute",
|
|
457
|
+
top: "0",
|
|
458
|
+
right: "2px",
|
|
459
|
+
background: "inherit",
|
|
460
|
+
border: "none",
|
|
461
|
+
font: "inherit",
|
|
462
|
+
padding: 0,
|
|
463
|
+
margin: 0
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
"&dark .cm-lintRange-active": { backgroundColor: "#86714a80" },
|
|
467
|
+
"&dark .cm-panel.cm-panel-lint ul": { "& [aria-selected]": { backgroundColor: "#2e343e" } }
|
|
468
|
+
});
|
|
469
|
+
function Pe(e) {
|
|
470
|
+
return e == "error" ? 4 : e == "warning" ? 3 : e == "info" ? 2 : 1;
|
|
432
471
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
let
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
r && t.head != i.from + r && (a = n.cursor(i.from + r));
|
|
472
|
+
function Fe(e) {
|
|
473
|
+
let t = "hint", n = 1;
|
|
474
|
+
for (let r of e) {
|
|
475
|
+
let e = Pe(r.severity);
|
|
476
|
+
e > n && (n = e, t = r.severity);
|
|
439
477
|
}
|
|
440
|
-
return
|
|
441
|
-
}
|
|
442
|
-
var $e = (e) => P(e, (t) => z(e, t, !0)), et = (e) => P(e, (t) => z(e, t, !1)), tt = (e) => P(e, (t) => z(e, t, !I(e))), nt = (e) => P(e, (t) => z(e, t, I(e))), rt = (e) => P(e, (t) => e.moveToLineBoundary(t, !1, !1)), it = (e) => P(e, (t) => e.moveToLineBoundary(t, !0, !1));
|
|
443
|
-
function at(e, t, r) {
|
|
444
|
-
let i = !1, a = M(e.selection, (t) => {
|
|
445
|
-
let a = m(e, t.head, -1) || m(e, t.head, 1) || t.head > 0 && m(e, t.head - 1, 1) || t.head < e.doc.length && m(e, t.head + 1, -1);
|
|
446
|
-
if (!a || !a.end) return t;
|
|
447
|
-
i = !0;
|
|
448
|
-
let o = a.start.from == t.head ? a.end.to : a.end.from;
|
|
449
|
-
return r ? n.range(t.anchor, o) : n.cursor(o);
|
|
450
|
-
});
|
|
451
|
-
return i ? (t(N(e, a)), !0) : !1;
|
|
452
|
-
}
|
|
453
|
-
var ot = ({ state: e, dispatch: t }) => at(e, t, !1);
|
|
454
|
-
function B(e, t, r) {
|
|
455
|
-
let i = M(e.state.selection, (e) => {
|
|
456
|
-
e.undirectional && e.head >= e.anchor != t && (e = n.range(e.head, e.anchor));
|
|
457
|
-
let i = r(e);
|
|
458
|
-
return n.range(e.anchor, i.head, i.goalColumn, i.bidiLevel || void 0, i.assoc);
|
|
459
|
-
});
|
|
460
|
-
return !i.eq(e.state.selection) && (e.dispatch(N(e.state, i)), !0);
|
|
461
|
-
}
|
|
462
|
-
function st(e, t) {
|
|
463
|
-
return B(e, t, (n) => e.moveByChar(n, t));
|
|
464
|
-
}
|
|
465
|
-
var ct = (e) => st(e, !I(e)), lt = (e) => st(e, I(e));
|
|
466
|
-
function ut(e, t) {
|
|
467
|
-
return B(e, t, (n) => e.moveByGroup(n, t));
|
|
468
|
-
}
|
|
469
|
-
var dt = (e) => ut(e, !I(e)), ft = (e) => ut(e, I(e)), pt = (e) => {
|
|
470
|
-
let t = !I(e);
|
|
471
|
-
return B(e, t, (n) => L(e.state, n, t));
|
|
472
|
-
}, mt = (e) => {
|
|
473
|
-
let t = I(e);
|
|
474
|
-
return B(e, t, (n) => L(e.state, n, t));
|
|
475
|
-
};
|
|
476
|
-
function ht(e, t) {
|
|
477
|
-
return B(e, t, (n) => e.moveVertically(n, t));
|
|
478
|
-
}
|
|
479
|
-
var gt = (e) => ht(e, !1), _t = (e) => ht(e, !0);
|
|
480
|
-
function vt(e, t) {
|
|
481
|
-
return B(e, t, (n) => e.moveVertically(n, t, Xe(e).height));
|
|
478
|
+
return t;
|
|
482
479
|
}
|
|
483
|
-
var
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
})), !0), Mt = ({ state: e, dispatch: t }) => {
|
|
502
|
-
let r = W(e).map(({ from: t, to: r }) => n.undirectionalRange(t, Math.min(r + 1, e.doc.length)));
|
|
503
|
-
return t(e.update({
|
|
504
|
-
selection: n.create(r),
|
|
505
|
-
userEvent: "select"
|
|
506
|
-
})), !0;
|
|
507
|
-
}, Nt = ({ state: e, dispatch: t }) => {
|
|
508
|
-
let r = M(e.selection, (t) => {
|
|
509
|
-
let r = u(e), i = r.resolveStack(t.from, 1);
|
|
510
|
-
if (t.empty) {
|
|
511
|
-
let e = r.resolveStack(t.from, -1);
|
|
512
|
-
e.node.from >= i.node.from && e.node.to <= i.node.to && (i = e);
|
|
513
|
-
}
|
|
514
|
-
for (let e = i; e; e = e.next) {
|
|
515
|
-
let { node: r } = e;
|
|
516
|
-
if ((r.from < t.from && r.to >= t.to || r.to > t.to && r.from <= t.from) && e.next) return n.undirectionalRange(r.from, r.to);
|
|
517
|
-
}
|
|
518
|
-
return t;
|
|
519
|
-
});
|
|
520
|
-
return !r.eq(e.selection) && (t(N(e, r)), !0);
|
|
521
|
-
};
|
|
522
|
-
function Pt(e, t) {
|
|
523
|
-
let { state: r } = e, i = r.selection, a = r.selection.ranges.slice();
|
|
524
|
-
for (let n of r.selection.ranges) {
|
|
525
|
-
let i = r.doc.lineAt(n.head);
|
|
526
|
-
if (t ? i.to < e.state.doc.length : i.from > 0) for (let r = n;;) {
|
|
527
|
-
let n = e.moveVertically(r, t);
|
|
528
|
-
if (n.head < i.from || n.head > i.to) {
|
|
529
|
-
a.some((e) => e.head == n.head) || a.push(n);
|
|
530
|
-
break;
|
|
531
|
-
}
|
|
532
|
-
if (n.head == r.head) break;
|
|
533
|
-
r = n;
|
|
480
|
+
var Ie = /*@__PURE__*/ le(ye, { hideOn: me }), Le = [
|
|
481
|
+
w,
|
|
482
|
+
/*@__PURE__*/ a.decorations.compute([w], (e) => {
|
|
483
|
+
let { selected: t, panel: n } = e.field(w);
|
|
484
|
+
return !t || !n || t.from == t.to ? g.none : g.set([ve.range(t.from, t.to)]);
|
|
485
|
+
}),
|
|
486
|
+
Ie,
|
|
487
|
+
Ne
|
|
488
|
+
];
|
|
489
|
+
function Re(e, t) {
|
|
490
|
+
let n = e.field(w, !1);
|
|
491
|
+
if (n && n.diagnostics.size) {
|
|
492
|
+
let e = [], i = [], a = -1;
|
|
493
|
+
for (let o = r.iter([n.diagnostics]);; o.next()) {
|
|
494
|
+
for (let n = 0; n < e.length; n++) (!o.value || o.value.spec.diagnostics.indexOf(e[n]) < 0) && (t(e[n], i[n], a), e.splice(n, 1), i.splice(n--, 1));
|
|
495
|
+
if (!o.value) break;
|
|
496
|
+
for (let t of o.value.spec.diagnostics) e.indexOf(t) < 0 && (e.push(t), i.push(o.from));
|
|
497
|
+
a = o.to;
|
|
534
498
|
}
|
|
535
499
|
}
|
|
536
|
-
return a.length != i.ranges.length && (e.dispatch(N(r, n.create(a, a.length - 1))), !0);
|
|
537
500
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region ../node_modules/.pnpm/@codemirror+commands@6.11.1/node_modules/@codemirror/commands/dist/index.js
|
|
503
|
+
var ze = (e) => {
|
|
504
|
+
let { state: t } = e, n = t.doc.lineAt(t.selection.main.from), r = k(e.state, n.from);
|
|
505
|
+
return r.line ? Be(e) : r.block ? He(e) : !1;
|
|
541
506
|
};
|
|
542
|
-
function
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
let
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
n < a ? (i = "delete.backward", n = H(t, n, !1)) : n > a && (i = "delete.forward", n = H(t, n, !0)), a = Math.min(a, n), o = Math.max(o, n);
|
|
549
|
-
} else a = H(t, a, !1), o = H(t, o, !0);
|
|
550
|
-
return a == o ? { range: e } : {
|
|
551
|
-
changes: {
|
|
552
|
-
from: a,
|
|
553
|
-
to: o
|
|
554
|
-
},
|
|
555
|
-
range: n.cursor(a, a < e.head ? -1 : 1)
|
|
556
|
-
};
|
|
557
|
-
});
|
|
558
|
-
return !o.changes.empty && (t.dispatch(a.update(o, {
|
|
559
|
-
scrollIntoView: !0,
|
|
560
|
-
userEvent: i,
|
|
561
|
-
effects: i == "delete.selection" ? e.announce.of(a.phrase("Selection deleted")) : void 0
|
|
562
|
-
})), !0);
|
|
507
|
+
function O(e, t) {
|
|
508
|
+
return ({ state: n, dispatch: r }) => {
|
|
509
|
+
if (n.readOnly) return !1;
|
|
510
|
+
let i = e(t, n);
|
|
511
|
+
return i ? (r(n.update(i)), !0) : !1;
|
|
512
|
+
};
|
|
563
513
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
}
|
|
568
|
-
return n;
|
|
514
|
+
var Be = /*@__PURE__*/ O(Ke, 0), Ve = /*@__PURE__*/ O(Ge, 0), He = /*@__PURE__*/ O((e, t) => Ge(e, t, We(t)), 0);
|
|
515
|
+
function k(e, t) {
|
|
516
|
+
let n = e.languageDataAt("commentTokens", t, 1);
|
|
517
|
+
return n.length ? n[0] : {};
|
|
569
518
|
}
|
|
570
|
-
var
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
for (let e = null;;) {
|
|
582
|
-
if (r == (t ? a.to : a.from)) {
|
|
583
|
-
r == n.head && a.number != (t ? i.doc.lines : 1) && (r += t ? 1 : -1);
|
|
584
|
-
break;
|
|
519
|
+
var A = 50;
|
|
520
|
+
function Ue(e, { open: t, close: n }, r, i) {
|
|
521
|
+
let a = e.sliceDoc(r - A, r), o = e.sliceDoc(i, i + A), s = /\s*$/.exec(a)[0].length, c = /^\s*/.exec(o)[0].length, l = a.length - s;
|
|
522
|
+
if (a.slice(l - t.length, l) == t && o.slice(c, c + n.length) == n) return {
|
|
523
|
+
open: {
|
|
524
|
+
pos: r - s,
|
|
525
|
+
margin: s && 1
|
|
526
|
+
},
|
|
527
|
+
close: {
|
|
528
|
+
pos: i + c,
|
|
529
|
+
margin: c && 1
|
|
585
530
|
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
return
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
}), Wt = (e) => V(e, (t) => {
|
|
595
|
-
let n = e.moveToLineBoundary(t, !1).head;
|
|
596
|
-
return t.head > n ? n : Math.max(0, t.head - 1);
|
|
597
|
-
}), Gt = (e) => V(e, (t) => {
|
|
598
|
-
let n = e.moveToLineBoundary(t, !0).head;
|
|
599
|
-
return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
|
|
600
|
-
}), Kt = ({ state: e, dispatch: t }) => {
|
|
601
|
-
if (e.readOnly) return !1;
|
|
602
|
-
let i = e.changeByRange((e) => ({
|
|
603
|
-
changes: {
|
|
604
|
-
from: e.from,
|
|
605
|
-
to: e.to,
|
|
606
|
-
insert: r.of(["", ""])
|
|
531
|
+
};
|
|
532
|
+
let u, d;
|
|
533
|
+
i - r <= 100 ? u = d = e.sliceDoc(r, i) : (u = e.sliceDoc(r, r + A), d = e.sliceDoc(i - A, i));
|
|
534
|
+
let f = /^\s*/.exec(u)[0].length, p = /\s*$/.exec(d)[0].length, m = d.length - p - n.length;
|
|
535
|
+
return u.slice(f, f + t.length) == t && d.slice(m, m + n.length) == n ? {
|
|
536
|
+
open: {
|
|
537
|
+
pos: r + f + t.length,
|
|
538
|
+
margin: +!!/\s/.test(u.charAt(f + t.length))
|
|
607
539
|
},
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
let
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
insert: e.doc.slice(r, o).append(e.doc.slice(a, r))
|
|
624
|
-
},
|
|
625
|
-
range: n.cursor(o)
|
|
626
|
-
};
|
|
627
|
-
});
|
|
628
|
-
return !r.changes.empty && (t(e.update(r, {
|
|
629
|
-
scrollIntoView: !0,
|
|
630
|
-
userEvent: "move.character"
|
|
631
|
-
})), !0);
|
|
632
|
-
};
|
|
633
|
-
function W(e) {
|
|
634
|
-
let t = [], n = -1;
|
|
635
|
-
for (let r of e.selection.ranges) {
|
|
636
|
-
let i = e.doc.lineAt(r.from), a = e.doc.lineAt(r.to);
|
|
637
|
-
if (!r.empty && r.to == a.from && (a = e.doc.lineAt(r.to - 1)), n >= i.number) {
|
|
638
|
-
let e = t[t.length - 1];
|
|
639
|
-
e.to = a.to, e.ranges.push(r);
|
|
640
|
-
} else t.push({
|
|
641
|
-
from: i.from,
|
|
642
|
-
to: a.to,
|
|
643
|
-
ranges: [r]
|
|
540
|
+
close: {
|
|
541
|
+
pos: i - p - n.length,
|
|
542
|
+
margin: +!!/\s/.test(d.charAt(m - 1))
|
|
543
|
+
}
|
|
544
|
+
} : null;
|
|
545
|
+
}
|
|
546
|
+
function We(e) {
|
|
547
|
+
let t = [];
|
|
548
|
+
for (let n of e.selection.ranges) {
|
|
549
|
+
let r = e.doc.lineAt(n.from), i = n.to <= r.to ? r : e.doc.lineAt(n.to);
|
|
550
|
+
i.from > r.from && i.from == n.to && (i = n.to == r.to + 1 ? r : e.doc.lineAt(n.to - 1));
|
|
551
|
+
let a = t.length - 1;
|
|
552
|
+
a >= 0 && t[a].to > r.from ? t[a].to = i.to : t.push({
|
|
553
|
+
from: r.from + /^\s*/.exec(r.text)[0].length,
|
|
554
|
+
to: i.to
|
|
644
555
|
});
|
|
645
|
-
n = a.number + 1;
|
|
646
556
|
}
|
|
647
557
|
return t;
|
|
648
558
|
}
|
|
649
|
-
function
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
to: t.from
|
|
559
|
+
function Ge(e, t, n = t.selection.ranges) {
|
|
560
|
+
let r = n.map((e) => k(t, e.from).block);
|
|
561
|
+
if (!r.every((e) => e)) return null;
|
|
562
|
+
let i = n.map((e, n) => Ue(t, r[n], e.from, e.to));
|
|
563
|
+
if (e != 2 && !i.every((e) => e)) return { changes: t.changes(n.map((e, t) => i[t] ? [] : [{
|
|
564
|
+
from: e.from,
|
|
565
|
+
insert: r[t].open + " "
|
|
566
|
+
}, {
|
|
567
|
+
from: e.to,
|
|
568
|
+
insert: " " + r[t].close
|
|
569
|
+
}])) };
|
|
570
|
+
if (e != 1 && i.some((e) => e)) {
|
|
571
|
+
let e = [];
|
|
572
|
+
for (let t = 0, n; t < i.length; t++) if (n = i[t]) {
|
|
573
|
+
let i = r[t], { open: a, close: o } = n;
|
|
574
|
+
e.push({
|
|
575
|
+
from: a.pos - i.open.length,
|
|
576
|
+
to: a.pos + a.margin
|
|
668
577
|
}, {
|
|
669
|
-
from:
|
|
670
|
-
|
|
578
|
+
from: o.pos - o.margin,
|
|
579
|
+
to: o.pos + i.close.length
|
|
671
580
|
});
|
|
672
|
-
for (let e of t.ranges) a.push(n.range(e.anchor - s, e.head - s));
|
|
673
581
|
}
|
|
582
|
+
return { changes: e };
|
|
674
583
|
}
|
|
675
|
-
return
|
|
676
|
-
changes: i,
|
|
677
|
-
scrollIntoView: !0,
|
|
678
|
-
selection: n.create(a, e.selection.mainIndex),
|
|
679
|
-
userEvent: "move.line"
|
|
680
|
-
})), !0) : !1;
|
|
681
|
-
}
|
|
682
|
-
var Yt = ({ state: e, dispatch: t }) => Jt(e, t, !1), Xt = ({ state: e, dispatch: t }) => Jt(e, t, !0);
|
|
683
|
-
function Zt(e, t, n) {
|
|
684
|
-
if (e.readOnly) return !1;
|
|
685
|
-
let r = [];
|
|
686
|
-
for (let t of W(e)) n ? r.push({
|
|
687
|
-
from: t.from,
|
|
688
|
-
insert: e.doc.slice(t.from, t.to) + e.lineBreak
|
|
689
|
-
}) : r.push({
|
|
690
|
-
from: t.to,
|
|
691
|
-
insert: e.lineBreak + e.doc.slice(t.from, t.to)
|
|
692
|
-
});
|
|
693
|
-
let i = e.changes(r);
|
|
694
|
-
return t(e.update({
|
|
695
|
-
changes: i,
|
|
696
|
-
selection: e.selection.map(i, n ? 1 : -1),
|
|
697
|
-
scrollIntoView: !0,
|
|
698
|
-
userEvent: "input.copyline"
|
|
699
|
-
})), !0;
|
|
584
|
+
return null;
|
|
700
585
|
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
586
|
+
function Ke(e, t, n = t.selection.ranges) {
|
|
587
|
+
let r = [], i = -1;
|
|
588
|
+
ranges: for (let { from: e, to: a } of n) {
|
|
589
|
+
let n = r.length, o = 1e9, s;
|
|
590
|
+
for (let n = e; n <= a;) {
|
|
591
|
+
let c = t.doc.lineAt(n);
|
|
592
|
+
if (s == null && (s = k(t, c.from).line, !s)) continue ranges;
|
|
593
|
+
if (c.from > i && (e == a || a > c.from)) {
|
|
594
|
+
i = c.from;
|
|
595
|
+
let e = /^\s*/.exec(c.text)[0].length, t = e == c.length, n = c.text.slice(e, e + s.length) == s ? e : -1;
|
|
596
|
+
e < c.text.length && e < o && (o = e), r.push({
|
|
597
|
+
line: c,
|
|
598
|
+
comment: n,
|
|
599
|
+
token: s,
|
|
600
|
+
indent: e,
|
|
601
|
+
empty: t,
|
|
602
|
+
single: !1
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
n = c.to + 1;
|
|
711
606
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
};
|
|
721
|
-
function tn(e, t) {
|
|
722
|
-
if (/\(\)|\[\]|\{\}/.test(e.sliceDoc(t - 1, t + 1))) return {
|
|
723
|
-
from: t,
|
|
724
|
-
to: t
|
|
725
|
-
};
|
|
726
|
-
let n = u(e).resolveInner(t), r = n.childBefore(t), i = n.childAfter(t), a;
|
|
727
|
-
return r && i && r.to <= t && i.from >= t && (a = r.type.prop(_.closedBy)) && a.indexOf(i.name) > -1 && e.doc.lineAt(r.to).from == e.doc.lineAt(i.from).from && !/\S/.test(e.sliceDoc(r.to, i.from)) ? {
|
|
728
|
-
from: r.to,
|
|
729
|
-
to: i.from
|
|
730
|
-
} : null;
|
|
731
|
-
}
|
|
732
|
-
var nn = /*@__PURE__*/ an(!1), rn = /*@__PURE__*/ an(!0);
|
|
733
|
-
function an(e) {
|
|
734
|
-
return ({ state: a, dispatch: o }) => {
|
|
735
|
-
if (a.readOnly) return !1;
|
|
736
|
-
let s = a.changeByRange((o) => {
|
|
737
|
-
let { from: s, to: c } = o, u = a.doc.lineAt(s), d = !e && s == c && tn(a, s);
|
|
738
|
-
e && (s = c = (c <= u.to ? u : a.doc.lineAt(c)).to);
|
|
739
|
-
let f = new le(a, {
|
|
740
|
-
simulateBreak: s,
|
|
741
|
-
simulateDoubleBreak: !!d
|
|
742
|
-
}), p = i(f, s);
|
|
743
|
-
for (p ??= l(/^\s*/.exec(a.doc.lineAt(s).text)[0], a.tabSize); c < u.to && /\s/.test(u.text[c - u.from]);) c++;
|
|
744
|
-
d ? {from: s, to: c} = d : s > u.from && s < u.from + 100 && !/\S/.test(u.text.slice(0, s)) && (s = u.from);
|
|
745
|
-
let m = ["", t(a, p)];
|
|
746
|
-
return d && m.push(t(a, f.lineIndent(u.from, -1))), {
|
|
747
|
-
changes: {
|
|
748
|
-
from: s,
|
|
749
|
-
to: c,
|
|
750
|
-
insert: r.of(m)
|
|
751
|
-
},
|
|
752
|
-
range: n.cursor(s + 1 + m[1].length)
|
|
753
|
-
};
|
|
607
|
+
if (o < 1e9) for (let e = n; e < r.length; e++) r[e].indent < r[e].line.text.length && (r[e].indent = o);
|
|
608
|
+
r.length == n + 1 && (r[n].single = !0);
|
|
609
|
+
}
|
|
610
|
+
if (e != 2 && r.some((e) => e.comment < 0 && (!e.empty || e.single))) {
|
|
611
|
+
let e = [];
|
|
612
|
+
for (let { line: t, token: n, indent: i, empty: a, single: o } of r) (o || !a) && e.push({
|
|
613
|
+
from: t.from + i,
|
|
614
|
+
insert: n + " "
|
|
754
615
|
});
|
|
755
|
-
|
|
756
|
-
scrollIntoView: !0,
|
|
757
|
-
userEvent: "input"
|
|
758
|
-
})), !0;
|
|
759
|
-
};
|
|
760
|
-
}
|
|
761
|
-
function G(e, t) {
|
|
762
|
-
let r = -1;
|
|
763
|
-
return e.changeByRange((i) => {
|
|
764
|
-
let a = [];
|
|
765
|
-
for (let n = i.from; n <= i.to;) {
|
|
766
|
-
let o = e.doc.lineAt(n);
|
|
767
|
-
o.number > r && (i.empty || i.to > o.from) && (t(o, a, i), r = o.number), n = o.to + 1;
|
|
768
|
-
}
|
|
769
|
-
let o = e.changes(a);
|
|
616
|
+
let n = t.changes(e);
|
|
770
617
|
return {
|
|
771
|
-
changes:
|
|
772
|
-
|
|
618
|
+
changes: n,
|
|
619
|
+
selection: t.selection.map(n, 1)
|
|
773
620
|
};
|
|
774
|
-
}
|
|
621
|
+
}
|
|
622
|
+
if (e != 1 && r.some((e) => e.comment >= 0)) {
|
|
623
|
+
let e = [];
|
|
624
|
+
for (let { line: t, comment: n, token: i } of r) if (n >= 0) {
|
|
625
|
+
let r = t.from + n, a = r + i.length;
|
|
626
|
+
t.text[a - t.from] == " " && a++, e.push({
|
|
627
|
+
from: r,
|
|
628
|
+
to: a
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
return { changes: e };
|
|
632
|
+
}
|
|
633
|
+
return null;
|
|
775
634
|
}
|
|
776
|
-
var
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
to: n.from + l.length,
|
|
786
|
-
insert: u
|
|
787
|
-
}));
|
|
788
|
-
});
|
|
789
|
-
return o.changes.empty || n(e.update(o, { userEvent: "indent" })), !0;
|
|
790
|
-
}, K = ({ state: e, dispatch: t }) => !e.readOnly && (t(e.update(G(e, (t, n) => {
|
|
791
|
-
n.push({
|
|
792
|
-
from: t.from,
|
|
793
|
-
insert: e.facet(oe)
|
|
794
|
-
});
|
|
795
|
-
}), { userEvent: "input.indent" })), !0), sn = ({ state: e, dispatch: n }) => !e.readOnly && (n(e.update(G(e, (n, r) => {
|
|
796
|
-
let i = /^\s*/.exec(n.text)[0];
|
|
797
|
-
if (!i) return;
|
|
798
|
-
let a = l(i, e.tabSize), s = 0, c = t(e, Math.max(0, a - o(e)));
|
|
799
|
-
for (; s < i.length && s < c.length && i.charCodeAt(s) == c.charCodeAt(s);) s++;
|
|
800
|
-
r.push({
|
|
801
|
-
from: n.from + s,
|
|
802
|
-
to: n.from + i.length,
|
|
803
|
-
insert: c.slice(s)
|
|
635
|
+
var j = /*@__PURE__*/ ne.define(), qe = /*@__PURE__*/ ne.define(), Je = /*@__PURE__*/ y.define(), Ye = /*@__PURE__*/ y.define({ combine(e) {
|
|
636
|
+
return s(e, {
|
|
637
|
+
minDepth: 100,
|
|
638
|
+
newGroupDelay: 500,
|
|
639
|
+
joinToEvent: (e, t) => t
|
|
640
|
+
}, {
|
|
641
|
+
minDepth: Math.max,
|
|
642
|
+
newGroupDelay: Math.min,
|
|
643
|
+
joinToEvent: (e, t) => (n, r) => e(n, r) || t(n, r)
|
|
804
644
|
});
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
}) : (t(e.update(e.replaceSelection(" "), {
|
|
809
|
-
scrollIntoView: !0,
|
|
810
|
-
userEvent: "input"
|
|
811
|
-
})), !0), un = [
|
|
812
|
-
{
|
|
813
|
-
key: "Ctrl-b",
|
|
814
|
-
run: ze,
|
|
815
|
-
shift: ct,
|
|
816
|
-
preventDefault: !0
|
|
817
|
-
},
|
|
818
|
-
{
|
|
819
|
-
key: "Ctrl-f",
|
|
820
|
-
run: Be,
|
|
821
|
-
shift: lt
|
|
822
|
-
},
|
|
823
|
-
{
|
|
824
|
-
key: "Ctrl-p",
|
|
825
|
-
run: Je,
|
|
826
|
-
shift: gt
|
|
827
|
-
},
|
|
828
|
-
{
|
|
829
|
-
key: "Ctrl-n",
|
|
830
|
-
run: Ye,
|
|
831
|
-
shift: _t
|
|
832
|
-
},
|
|
833
|
-
{
|
|
834
|
-
key: "Ctrl-a",
|
|
835
|
-
run: rt,
|
|
836
|
-
shift: Tt
|
|
837
|
-
},
|
|
838
|
-
{
|
|
839
|
-
key: "Ctrl-e",
|
|
840
|
-
run: it,
|
|
841
|
-
shift: Et
|
|
645
|
+
} }), M = /*@__PURE__*/ ae.define({
|
|
646
|
+
create() {
|
|
647
|
+
return z.empty;
|
|
842
648
|
},
|
|
843
|
-
{
|
|
844
|
-
|
|
845
|
-
|
|
649
|
+
update(e, t) {
|
|
650
|
+
let n = t.state.facet(Ye), r = t.annotation(j);
|
|
651
|
+
if (r) {
|
|
652
|
+
let i = F.fromTransaction(t, r.selection), a = r.side, o = a == 0 ? e.undone : e.done;
|
|
653
|
+
return o = i ? I(o, o.length, n.minDepth, i) : at(o, t.startState.selection), new z(a == 0 ? r.rest : o, a == 0 ? o : r.rest);
|
|
654
|
+
}
|
|
655
|
+
let i = t.annotation(qe);
|
|
656
|
+
if ((i == "full" || i == "before") && (e = e.isolate()), t.annotation(f.addToHistory) === !1) return t.changes.empty ? e : e.addMapping(t.changes.desc);
|
|
657
|
+
let a = F.fromTransaction(t), o = t.annotation(f.time), s = t.annotation(f.userEvent);
|
|
658
|
+
return a ? e = e.addChanges(a, o, s, n, t) : t.selection && (e = e.addSelection(t.startState.selection, o, s, n.newGroupDelay)), (i == "full" || i == "after") && (e = e.isolate()), e;
|
|
846
659
|
},
|
|
847
|
-
{
|
|
848
|
-
|
|
849
|
-
|
|
660
|
+
toJSON(e) {
|
|
661
|
+
return {
|
|
662
|
+
done: e.done.map((e) => e.toJSON()),
|
|
663
|
+
undone: e.undone.map((e) => e.toJSON())
|
|
664
|
+
};
|
|
850
665
|
},
|
|
666
|
+
fromJSON(e) {
|
|
667
|
+
return new z(e.done.map(F.fromJSON), e.undone.map(F.fromJSON));
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
function Xe(e = {}) {
|
|
671
|
+
return [
|
|
672
|
+
M,
|
|
673
|
+
Ye.of(e),
|
|
674
|
+
a.domEventHandlers({ beforeinput(e, t) {
|
|
675
|
+
let n = e.inputType == "historyUndo" ? Qe : e.inputType == "historyRedo" ? P : null;
|
|
676
|
+
return n ? (e.preventDefault(), n(t)) : !1;
|
|
677
|
+
} })
|
|
678
|
+
];
|
|
679
|
+
}
|
|
680
|
+
var Ze = M;
|
|
681
|
+
function N(e, t) {
|
|
682
|
+
return function({ state: n, dispatch: r }) {
|
|
683
|
+
if (!t && n.readOnly) return !1;
|
|
684
|
+
let i = n.field(M, !1);
|
|
685
|
+
if (!i) return !1;
|
|
686
|
+
let a = i.pop(e, n, t);
|
|
687
|
+
return a ? (r(a), !0) : !1;
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
var Qe = /*@__PURE__*/ N(0, !1), P = /*@__PURE__*/ N(1, !1), $e = /*@__PURE__*/ N(0, !0), et = /*@__PURE__*/ N(1, !0), F = class e {
|
|
691
|
+
constructor(e, t, n, r, i) {
|
|
692
|
+
this.changes = e, this.effects = t, this.mapped = n, this.startSelection = r, this.selectionsAfter = i;
|
|
693
|
+
}
|
|
694
|
+
setSelAfter(t) {
|
|
695
|
+
return new e(this.changes, this.effects, this.mapped, this.startSelection, t);
|
|
696
|
+
}
|
|
697
|
+
toJSON() {
|
|
698
|
+
return {
|
|
699
|
+
changes: this.changes?.toJSON(),
|
|
700
|
+
mapped: this.mapped?.toJSON(),
|
|
701
|
+
startSelection: this.startSelection?.toJSON(),
|
|
702
|
+
selectionsAfter: this.selectionsAfter.map((e) => e.toJSON())
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
static fromJSON(t) {
|
|
706
|
+
return new e(t.changes && fe.fromJSON(t.changes), [], t.mapped && de.fromJSON(t.mapped), t.startSelection && h.fromJSON(t.startSelection), t.selectionsAfter.map(h.fromJSON));
|
|
707
|
+
}
|
|
708
|
+
static fromTransaction(t, n) {
|
|
709
|
+
let r = L;
|
|
710
|
+
for (let e of t.startState.facet(Je)) {
|
|
711
|
+
let n = e(t);
|
|
712
|
+
n.length && (r = r.concat(n));
|
|
713
|
+
}
|
|
714
|
+
return !r.length && t.changes.empty ? null : new e(t.changes.invert(t.startState.doc), r, void 0, n || t.startState.selection, L);
|
|
715
|
+
}
|
|
716
|
+
static selection(t) {
|
|
717
|
+
return new e(void 0, L, void 0, void 0, t);
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
function I(e, t, n, r) {
|
|
721
|
+
let i = t + 1 > n + 20 ? t - n - 1 : 0, a = e.slice(i, t);
|
|
722
|
+
return a.push(r), a;
|
|
723
|
+
}
|
|
724
|
+
function tt(e, t) {
|
|
725
|
+
let n = [], r = !1;
|
|
726
|
+
return e.iterChangedRanges((e, t) => n.push(e, t)), t.iterChangedRanges((e, t, i, a) => {
|
|
727
|
+
for (let e = 0; e < n.length;) {
|
|
728
|
+
let t = n[e++], o = n[e++];
|
|
729
|
+
a >= t && i <= o && (r = !0);
|
|
730
|
+
}
|
|
731
|
+
}), r;
|
|
732
|
+
}
|
|
733
|
+
function nt(e, t) {
|
|
734
|
+
return e.ranges.length == t.ranges.length && e.ranges.filter((e, n) => e.empty != t.ranges[n].empty).length === 0;
|
|
735
|
+
}
|
|
736
|
+
function rt(e, t) {
|
|
737
|
+
return e.length ? t.length ? e.concat(t) : e : t;
|
|
738
|
+
}
|
|
739
|
+
var L = [], it = 200;
|
|
740
|
+
function at(e, t) {
|
|
741
|
+
if (e.length) {
|
|
742
|
+
let n = e[e.length - 1], r = n.selectionsAfter.slice(Math.max(0, n.selectionsAfter.length - it));
|
|
743
|
+
return r.length && r[r.length - 1].eq(t) ? e : (r.push(t), I(e, e.length - 1, 1e9, n.setSelAfter(r)));
|
|
744
|
+
}
|
|
745
|
+
return [F.selection([t])];
|
|
746
|
+
}
|
|
747
|
+
function ot(e) {
|
|
748
|
+
let t = e[e.length - 1], n = e.slice();
|
|
749
|
+
return n[e.length - 1] = t.setSelAfter(t.selectionsAfter.slice(0, t.selectionsAfter.length - 1)), n;
|
|
750
|
+
}
|
|
751
|
+
function R(e, t) {
|
|
752
|
+
if (!e.length) return e;
|
|
753
|
+
let n = e.length, r = L;
|
|
754
|
+
for (; n;) {
|
|
755
|
+
let i = st(e[n - 1], t, r);
|
|
756
|
+
if (i.changes && !i.changes.empty || i.effects.length) {
|
|
757
|
+
let t = e.slice(0, n);
|
|
758
|
+
return t[n - 1] = i, t;
|
|
759
|
+
}
|
|
760
|
+
t = i.mapped, n--, r = i.selectionsAfter;
|
|
761
|
+
}
|
|
762
|
+
return r.length ? [F.selection(r)] : L;
|
|
763
|
+
}
|
|
764
|
+
function st(e, n, r) {
|
|
765
|
+
let i = rt(e.selectionsAfter.length ? e.selectionsAfter.map((e) => e.map(n)) : L, r);
|
|
766
|
+
if (!e.changes) return F.selection(i);
|
|
767
|
+
let a = e.changes.map(n), o = n.mapDesc(e.changes, !0), s = e.mapped ? e.mapped.composeDesc(o) : o;
|
|
768
|
+
return new F(a, t.mapEffects(e.effects, n), s, e.startSelection.map(o), i);
|
|
769
|
+
}
|
|
770
|
+
var ct = /^(input\.type|delete)($|\.)/, z = class e {
|
|
771
|
+
constructor(e, t, n = 0, r = void 0) {
|
|
772
|
+
this.done = e, this.undone = t, this.prevTime = n, this.prevUserEvent = r;
|
|
773
|
+
}
|
|
774
|
+
isolate() {
|
|
775
|
+
return this.prevTime ? new e(this.done, this.undone) : this;
|
|
776
|
+
}
|
|
777
|
+
addChanges(n, r, i, a, o) {
|
|
778
|
+
let s = this.done, c = s[s.length - 1];
|
|
779
|
+
return s = c && c.changes && !c.changes.empty && n.changes && (!i || ct.test(i)) && (!c.selectionsAfter.length && r - this.prevTime < a.newGroupDelay && a.joinToEvent(o, tt(c.changes, n.changes)) || i == "input.type.compose") ? I(s, s.length - 1, a.minDepth, new F(n.changes.compose(c.changes), rt(t.mapEffects(n.effects, c.changes), c.effects), c.mapped, c.startSelection, L)) : I(s, s.length, a.minDepth, n), new e(s, L, r, i);
|
|
780
|
+
}
|
|
781
|
+
addSelection(t, n, r, i) {
|
|
782
|
+
let a = this.done.length ? this.done[this.done.length - 1].selectionsAfter : L;
|
|
783
|
+
return a.length > 0 && n - this.prevTime < i && r == this.prevUserEvent && r && /^select($|\.)/.test(r) && nt(a[a.length - 1], t) ? this : new e(at(this.done, t), this.undone, n, r);
|
|
784
|
+
}
|
|
785
|
+
addMapping(t) {
|
|
786
|
+
return new e(R(this.done, t), R(this.undone, t), this.prevTime, this.prevUserEvent);
|
|
787
|
+
}
|
|
788
|
+
pop(e, t, n) {
|
|
789
|
+
let r = e == 0 ? this.done : this.undone;
|
|
790
|
+
if (r.length == 0) return null;
|
|
791
|
+
let i = r[r.length - 1], a = i.selectionsAfter[0] || (i.startSelection ? i.startSelection.map(i.changes.invertedDesc, 1) : t.selection);
|
|
792
|
+
if (n && i.selectionsAfter.length) return t.update({
|
|
793
|
+
selection: i.selectionsAfter[i.selectionsAfter.length - 1],
|
|
794
|
+
annotations: j.of({
|
|
795
|
+
side: e,
|
|
796
|
+
rest: ot(r),
|
|
797
|
+
selection: a
|
|
798
|
+
}),
|
|
799
|
+
userEvent: e == 0 ? "select.undo" : "select.redo",
|
|
800
|
+
scrollIntoView: !0
|
|
801
|
+
});
|
|
802
|
+
if (i.changes) {
|
|
803
|
+
let n = r.length == 1 ? L : r.slice(0, r.length - 1);
|
|
804
|
+
return i.mapped && (n = R(n, i.mapped)), t.update({
|
|
805
|
+
changes: i.changes,
|
|
806
|
+
selection: i.startSelection,
|
|
807
|
+
effects: i.effects,
|
|
808
|
+
annotations: j.of({
|
|
809
|
+
side: e,
|
|
810
|
+
rest: n,
|
|
811
|
+
selection: a
|
|
812
|
+
}),
|
|
813
|
+
filter: !1,
|
|
814
|
+
userEvent: e == 0 ? "undo" : "redo",
|
|
815
|
+
scrollIntoView: !0
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
return null;
|
|
819
|
+
}
|
|
820
|
+
};
|
|
821
|
+
z.empty = /*@__PURE__*/ new z(L, L);
|
|
822
|
+
var lt = [
|
|
851
823
|
{
|
|
852
|
-
key: "
|
|
853
|
-
run:
|
|
824
|
+
key: "Mod-z",
|
|
825
|
+
run: Qe,
|
|
826
|
+
preventDefault: !0
|
|
854
827
|
},
|
|
855
828
|
{
|
|
856
|
-
key: "
|
|
857
|
-
|
|
829
|
+
key: "Mod-y",
|
|
830
|
+
mac: "Mod-Shift-z",
|
|
831
|
+
run: P,
|
|
832
|
+
preventDefault: !0
|
|
858
833
|
},
|
|
859
834
|
{
|
|
860
|
-
|
|
861
|
-
run:
|
|
835
|
+
linux: "Ctrl-Shift-z",
|
|
836
|
+
run: P,
|
|
837
|
+
preventDefault: !0
|
|
862
838
|
},
|
|
863
839
|
{
|
|
864
|
-
key: "
|
|
865
|
-
run:
|
|
840
|
+
key: "Mod-u",
|
|
841
|
+
run: $e,
|
|
842
|
+
preventDefault: !0
|
|
866
843
|
},
|
|
867
844
|
{
|
|
868
|
-
key: "
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
], dn = /*@__PURE__*/ [
|
|
872
|
-
{
|
|
873
|
-
key: "ArrowLeft",
|
|
874
|
-
run: ze,
|
|
875
|
-
shift: ct,
|
|
845
|
+
key: "Alt-u",
|
|
846
|
+
mac: "Mod-Shift-u",
|
|
847
|
+
run: et,
|
|
876
848
|
preventDefault: !0
|
|
849
|
+
}
|
|
850
|
+
];
|
|
851
|
+
function B(e, t) {
|
|
852
|
+
return h.create(e.ranges.map(t), e.mainIndex);
|
|
853
|
+
}
|
|
854
|
+
function V(e, t) {
|
|
855
|
+
return e.update({
|
|
856
|
+
selection: t,
|
|
857
|
+
scrollIntoView: !0,
|
|
858
|
+
userEvent: "select"
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
function H({ state: e, dispatch: t }, n) {
|
|
862
|
+
let r = B(e.selection, n);
|
|
863
|
+
return !r.eq(e.selection, !0) && (t(V(e, r)), !0);
|
|
864
|
+
}
|
|
865
|
+
function U(e, t) {
|
|
866
|
+
return h.cursor(t ? e.to : e.from);
|
|
867
|
+
}
|
|
868
|
+
function ut(e, t) {
|
|
869
|
+
return H(e, (n) => n.empty ? e.moveByChar(n, t) : U(n, t));
|
|
870
|
+
}
|
|
871
|
+
function W(e) {
|
|
872
|
+
return e.textDirectionAt(e.state.selection.main.head) == ee.LTR;
|
|
873
|
+
}
|
|
874
|
+
var dt = (e) => ut(e, !W(e)), ft = (e) => ut(e, W(e));
|
|
875
|
+
function pt(e, t) {
|
|
876
|
+
return H(e, (n) => n.empty ? e.moveByGroup(n, t) : U(n, t));
|
|
877
|
+
}
|
|
878
|
+
var mt = (e) => pt(e, !W(e)), ht = (e) => pt(e, W(e));
|
|
879
|
+
typeof Intl < "u" && Intl.Segmenter;
|
|
880
|
+
function gt(e, t, n) {
|
|
881
|
+
if (t.type.prop(n)) return !0;
|
|
882
|
+
let r = t.to - t.from;
|
|
883
|
+
return r && (r > 2 || /[^\s,.;:]/.test(e.sliceDoc(t.from, t.to))) || t.firstChild;
|
|
884
|
+
}
|
|
885
|
+
function G(e, t, n) {
|
|
886
|
+
let r = o(e).resolveInner(t.head), i = n ? _.closedBy : _.openedBy;
|
|
887
|
+
for (let a = t.head;;) {
|
|
888
|
+
let t = n ? r.childAfter(a) : r.childBefore(a);
|
|
889
|
+
if (!t) break;
|
|
890
|
+
gt(e, t, i) ? r = t : a = n ? t.to : t.from;
|
|
891
|
+
}
|
|
892
|
+
let a = r.type.prop(i), s, c;
|
|
893
|
+
return c = a && (s = n ? d(e, r.from, 1) : d(e, r.to, -1)) && s.matched ? n ? s.end.to : s.end.from : n ? r.to : r.from, h.cursor(c, n ? -1 : 1);
|
|
894
|
+
}
|
|
895
|
+
var _t = (e) => H(e, (t) => G(e.state, t, !W(e))), vt = (e) => H(e, (t) => G(e.state, t, W(e)));
|
|
896
|
+
function yt(e, t) {
|
|
897
|
+
return H(e, (n) => {
|
|
898
|
+
if (!n.empty) return U(n, t);
|
|
899
|
+
let r = e.moveVertically(n, t);
|
|
900
|
+
return r.head == n.head ? e.moveToLineBoundary(n, t) : r;
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
var bt = (e) => yt(e, !1), xt = (e) => yt(e, !0);
|
|
904
|
+
function St(e) {
|
|
905
|
+
let t = e.scrollDOM.clientHeight < e.scrollDOM.scrollHeight - 2, n = 0, r = 0, i;
|
|
906
|
+
if (t) {
|
|
907
|
+
for (let t of e.state.facet(a.scrollMargins)) {
|
|
908
|
+
let i = t(e);
|
|
909
|
+
i?.top && (n = Math.max(i?.top, n)), i?.bottom && (r = Math.max(i?.bottom, r));
|
|
910
|
+
}
|
|
911
|
+
i = e.scrollDOM.clientHeight - n - r;
|
|
912
|
+
} else i = (e.dom.ownerDocument.defaultView || window).innerHeight;
|
|
913
|
+
return {
|
|
914
|
+
marginTop: n,
|
|
915
|
+
marginBottom: r,
|
|
916
|
+
selfScroll: t,
|
|
917
|
+
height: Math.max(e.defaultLineHeight, i - 5)
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
function Ct(e, t) {
|
|
921
|
+
let n = St(e), { state: r } = e, i = B(r.selection, (r) => r.empty ? e.moveVertically(r, t, n.height) : U(r, t));
|
|
922
|
+
if (i.eq(r.selection)) return !1;
|
|
923
|
+
let o;
|
|
924
|
+
if (n.selfScroll) {
|
|
925
|
+
let t = e.coordsAtPos(r.selection.main.head), s = e.scrollDOM.getBoundingClientRect(), c = s.top + n.marginTop, l = s.bottom - n.marginBottom;
|
|
926
|
+
t && t.top > c && t.bottom < l && (o = a.scrollIntoView(i.main.head, {
|
|
927
|
+
y: "start",
|
|
928
|
+
yMargin: t.top - c
|
|
929
|
+
}));
|
|
930
|
+
}
|
|
931
|
+
return e.dispatch(V(r, i), { effects: o }), !0;
|
|
932
|
+
}
|
|
933
|
+
var wt = (e) => Ct(e, !1), K = (e) => Ct(e, !0);
|
|
934
|
+
function q(e, t, n) {
|
|
935
|
+
let r = e.lineBlockAt(t.head), i = e.moveToLineBoundary(t, n);
|
|
936
|
+
if (i.head == t.head && i.head != (n ? r.to : r.from) && (i = e.moveToLineBoundary(t, n, !1)), !n && i.head == r.from && r.length) {
|
|
937
|
+
let n = /^\s*/.exec(e.state.sliceDoc(r.from, Math.min(r.from + 100, r.to)))[0].length;
|
|
938
|
+
n && t.head != r.from + n && (i = h.cursor(r.from + n));
|
|
939
|
+
}
|
|
940
|
+
return i;
|
|
941
|
+
}
|
|
942
|
+
var Tt = (e) => H(e, (t) => q(e, t, !0)), Et = (e) => H(e, (t) => q(e, t, !1)), Dt = (e) => H(e, (t) => q(e, t, !W(e))), Ot = (e) => H(e, (t) => q(e, t, W(e))), kt = (e) => H(e, (t) => e.moveToLineBoundary(t, !1, !1)), At = (e) => H(e, (t) => e.moveToLineBoundary(t, !0, !1));
|
|
943
|
+
function jt(e, t, n) {
|
|
944
|
+
let r = !1, i = B(e.selection, (t) => {
|
|
945
|
+
let i = d(e, t.head, -1) || d(e, t.head, 1) || t.head > 0 && d(e, t.head - 1, 1) || t.head < e.doc.length && d(e, t.head + 1, -1);
|
|
946
|
+
if (!i || !i.end) return t;
|
|
947
|
+
r = !0;
|
|
948
|
+
let a = i.start.from == t.head ? i.end.to : i.end.from;
|
|
949
|
+
return n ? h.range(t.anchor, a) : h.cursor(a);
|
|
950
|
+
});
|
|
951
|
+
return r ? (t(V(e, i)), !0) : !1;
|
|
952
|
+
}
|
|
953
|
+
var Mt = ({ state: e, dispatch: t }) => jt(e, t, !1);
|
|
954
|
+
function J(e, t, n) {
|
|
955
|
+
let r = B(e.state.selection, (e) => {
|
|
956
|
+
e.undirectional && e.head >= e.anchor != t && (e = h.range(e.head, e.anchor));
|
|
957
|
+
let r = n(e);
|
|
958
|
+
return h.range(e.anchor, r.head, r.goalColumn, r.bidiLevel || void 0, r.assoc);
|
|
959
|
+
});
|
|
960
|
+
return !r.eq(e.state.selection) && (e.dispatch(V(e.state, r)), !0);
|
|
961
|
+
}
|
|
962
|
+
function Nt(e, t) {
|
|
963
|
+
return J(e, t, (n) => e.moveByChar(n, t));
|
|
964
|
+
}
|
|
965
|
+
var Pt = (e) => Nt(e, !W(e)), Ft = (e) => Nt(e, W(e));
|
|
966
|
+
function It(e, t) {
|
|
967
|
+
return J(e, t, (n) => e.moveByGroup(n, t));
|
|
968
|
+
}
|
|
969
|
+
var Lt = (e) => It(e, !W(e)), Rt = (e) => It(e, W(e)), zt = (e) => {
|
|
970
|
+
let t = !W(e);
|
|
971
|
+
return J(e, t, (n) => G(e.state, n, t));
|
|
972
|
+
}, Bt = (e) => {
|
|
973
|
+
let t = W(e);
|
|
974
|
+
return J(e, t, (n) => G(e.state, n, t));
|
|
975
|
+
};
|
|
976
|
+
function Vt(e, t) {
|
|
977
|
+
return J(e, t, (n) => e.moveVertically(n, t));
|
|
978
|
+
}
|
|
979
|
+
var Ht = (e) => Vt(e, !1), Ut = (e) => Vt(e, !0);
|
|
980
|
+
function Wt(e, t) {
|
|
981
|
+
return J(e, t, (n) => e.moveVertically(n, t, St(e).height));
|
|
982
|
+
}
|
|
983
|
+
var Gt = (e) => Wt(e, !1), Kt = (e) => Wt(e, !0), qt = (e) => J(e, !0, (t) => q(e, t, !0)), Jt = (e) => J(e, !1, (t) => q(e, t, !1)), Yt = (e) => {
|
|
984
|
+
let t = !W(e);
|
|
985
|
+
return J(e, t, (n) => q(e, n, t));
|
|
986
|
+
}, Xt = (e) => {
|
|
987
|
+
let t = W(e);
|
|
988
|
+
return J(e, t, (n) => q(e, n, t));
|
|
989
|
+
}, Zt = (e) => J(e, !1, (t) => h.cursor(e.lineBlockAt(t.head).from)), Qt = (e) => J(e, !0, (t) => h.cursor(e.lineBlockAt(t.head).to)), $t = ({ state: e, dispatch: t }) => (t(V(e, { anchor: 0 })), !0), en = ({ state: e, dispatch: t }) => (t(V(e, { anchor: e.doc.length })), !0), tn = ({ state: e, dispatch: t }) => (t(V(e, {
|
|
990
|
+
anchor: e.selection.main.anchor,
|
|
991
|
+
head: 0
|
|
992
|
+
})), !0), nn = ({ state: e, dispatch: t }) => (t(V(e, {
|
|
993
|
+
anchor: e.selection.main.anchor,
|
|
994
|
+
head: e.doc.length
|
|
995
|
+
})), !0), rn = ({ state: e, dispatch: t }) => (t(e.update({
|
|
996
|
+
selection: {
|
|
997
|
+
anchor: 0,
|
|
998
|
+
head: e.doc.length
|
|
877
999
|
},
|
|
1000
|
+
userEvent: "select"
|
|
1001
|
+
})), !0), an = ({ state: e, dispatch: t }) => {
|
|
1002
|
+
let n = Q(e).map(({ from: t, to: n }) => h.undirectionalRange(t, Math.min(n + 1, e.doc.length)));
|
|
1003
|
+
return t(e.update({
|
|
1004
|
+
selection: h.create(n),
|
|
1005
|
+
userEvent: "select"
|
|
1006
|
+
})), !0;
|
|
1007
|
+
}, on = ({ state: e, dispatch: t }) => {
|
|
1008
|
+
let n = B(e.selection, (t) => {
|
|
1009
|
+
let n = o(e), r = n.resolveStack(t.from, 1);
|
|
1010
|
+
if (t.empty) {
|
|
1011
|
+
let e = n.resolveStack(t.from, -1);
|
|
1012
|
+
e.node.from >= r.node.from && e.node.to <= r.node.to && (r = e);
|
|
1013
|
+
}
|
|
1014
|
+
for (let e = r; e; e = e.next) {
|
|
1015
|
+
let { node: n } = e;
|
|
1016
|
+
if ((n.from < t.from && n.to >= t.to || n.to > t.to && n.from <= t.from) && e.next) return h.undirectionalRange(n.from, n.to);
|
|
1017
|
+
}
|
|
1018
|
+
return t;
|
|
1019
|
+
});
|
|
1020
|
+
return !n.eq(e.selection) && (t(V(e, n)), !0);
|
|
1021
|
+
};
|
|
1022
|
+
function sn(e, t) {
|
|
1023
|
+
let { state: n } = e, r = n.selection, i = n.selection.ranges.slice();
|
|
1024
|
+
for (let r of n.selection.ranges) {
|
|
1025
|
+
let a = n.doc.lineAt(r.head);
|
|
1026
|
+
if (t ? a.to < e.state.doc.length : a.from > 0) for (let n = r;;) {
|
|
1027
|
+
let r = e.moveVertically(n, t);
|
|
1028
|
+
if (r.head < a.from || r.head > a.to) {
|
|
1029
|
+
i.some((e) => e.head == r.head) || i.push(r);
|
|
1030
|
+
break;
|
|
1031
|
+
}
|
|
1032
|
+
if (r.head == n.head) break;
|
|
1033
|
+
n = r;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
return i.length != r.ranges.length && (e.dispatch(V(n, h.create(i, i.length - 1))), !0);
|
|
1037
|
+
}
|
|
1038
|
+
var cn = (e) => sn(e, !1), ln = (e) => sn(e, !0), un = ({ state: e, dispatch: t }) => {
|
|
1039
|
+
let n = e.selection, r = null;
|
|
1040
|
+
return n.ranges.length > 1 ? r = h.create([n.main]) : n.main.empty || (r = h.create([h.cursor(n.main.head)])), r ? (t(V(e, r)), !0) : !1;
|
|
1041
|
+
};
|
|
1042
|
+
function Y(e, t) {
|
|
1043
|
+
if (e.state.readOnly) return !1;
|
|
1044
|
+
let n = "delete.selection", { state: r } = e, i = r.changeByRange((r) => {
|
|
1045
|
+
let { from: i, to: a } = r;
|
|
1046
|
+
if (i == a) {
|
|
1047
|
+
let o = t(r);
|
|
1048
|
+
o < i ? (n = "delete.backward", o = X(e, o, !1)) : o > i && (n = "delete.forward", o = X(e, o, !0)), i = Math.min(i, o), a = Math.max(a, o);
|
|
1049
|
+
} else i = X(e, i, !1), a = X(e, a, !0);
|
|
1050
|
+
return i == a ? { range: r } : {
|
|
1051
|
+
changes: {
|
|
1052
|
+
from: i,
|
|
1053
|
+
to: a
|
|
1054
|
+
},
|
|
1055
|
+
range: h.cursor(i, i < r.head ? -1 : 1)
|
|
1056
|
+
};
|
|
1057
|
+
});
|
|
1058
|
+
return !i.changes.empty && (e.dispatch(r.update(i, {
|
|
1059
|
+
scrollIntoView: !0,
|
|
1060
|
+
userEvent: n,
|
|
1061
|
+
effects: n == "delete.selection" ? a.announce.of(r.phrase("Selection deleted")) : void 0
|
|
1062
|
+
})), !0);
|
|
1063
|
+
}
|
|
1064
|
+
function X(e, t, n) {
|
|
1065
|
+
if (e instanceof a) for (let r of e.state.facet(a.atomicRanges).map((t) => t(e))) r.between(t, t, (e, r) => {
|
|
1066
|
+
e < t && r > t && (t = n ? r : e);
|
|
1067
|
+
});
|
|
1068
|
+
return t;
|
|
1069
|
+
}
|
|
1070
|
+
var dn = (e, t, n) => Y(e, (r) => {
|
|
1071
|
+
let a = r.from, { state: o } = e, s = o.doc.lineAt(a), c, u;
|
|
1072
|
+
if (n && !t && a > s.from && a < s.from + 200 && !/[^ \t]/.test(c = s.text.slice(0, a - s.from))) {
|
|
1073
|
+
if (c[c.length - 1] == " ") return a - 1;
|
|
1074
|
+
let e = l(c, o.tabSize) % i(o) || i(o);
|
|
1075
|
+
for (let t = 0; t < e && c[c.length - 1 - t] == " "; t++) a--;
|
|
1076
|
+
u = a;
|
|
1077
|
+
} else u = m(s.text, a - s.from, t, t) + s.from, u == a && s.number != (t ? o.doc.lines : 1) ? u += t ? 1 : -1 : !t && /[\ufe00-\ufe0f]/.test(s.text.slice(u - s.from, a - s.from)) && (u = m(s.text, u - s.from, !1, !1) + s.from);
|
|
1078
|
+
return u;
|
|
1079
|
+
}), Z = (e) => dn(e, !1, !0), fn = (e) => dn(e, !0, !1), pn = (e, t) => Y(e, (n) => {
|
|
1080
|
+
let r = n.head, { state: i } = e, a = i.doc.lineAt(r), o = i.charCategorizer(r);
|
|
1081
|
+
for (let e = null;;) {
|
|
1082
|
+
if (r == (t ? a.to : a.from)) {
|
|
1083
|
+
r == n.head && a.number != (t ? i.doc.lines : 1) && (r += t ? 1 : -1);
|
|
1084
|
+
break;
|
|
1085
|
+
}
|
|
1086
|
+
let s = m(a.text, r - a.from, t) + a.from, c = a.text.slice(Math.min(r, s) - a.from, Math.max(r, s) - a.from), l = o(c);
|
|
1087
|
+
if (e != null && l != e) break;
|
|
1088
|
+
(c != " " || r != n.head) && (e = l), r = s;
|
|
1089
|
+
}
|
|
1090
|
+
return r;
|
|
1091
|
+
}), mn = (e) => pn(e, !1), hn = (e) => pn(e, !0), gn = (e) => Y(e, (t) => {
|
|
1092
|
+
let n = e.lineBlockAt(t.head).to;
|
|
1093
|
+
return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
|
|
1094
|
+
}), _n = (e) => Y(e, (t) => {
|
|
1095
|
+
let n = e.moveToLineBoundary(t, !1).head;
|
|
1096
|
+
return t.head > n ? n : Math.max(0, t.head - 1);
|
|
1097
|
+
}), vn = (e) => Y(e, (t) => {
|
|
1098
|
+
let n = e.moveToLineBoundary(t, !0).head;
|
|
1099
|
+
return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
|
|
1100
|
+
}), yn = ({ state: e, dispatch: t }) => {
|
|
1101
|
+
if (e.readOnly) return !1;
|
|
1102
|
+
let n = e.changeByRange((e) => ({
|
|
1103
|
+
changes: {
|
|
1104
|
+
from: e.from,
|
|
1105
|
+
to: e.to,
|
|
1106
|
+
insert: u.of(["", ""])
|
|
1107
|
+
},
|
|
1108
|
+
range: h.cursor(e.from)
|
|
1109
|
+
}));
|
|
1110
|
+
return t(e.update(n, {
|
|
1111
|
+
scrollIntoView: !0,
|
|
1112
|
+
userEvent: "input"
|
|
1113
|
+
})), !0;
|
|
1114
|
+
}, bn = ({ state: e, dispatch: t }) => {
|
|
1115
|
+
if (e.readOnly) return !1;
|
|
1116
|
+
let n = e.changeByRange((t) => {
|
|
1117
|
+
if (!t.empty || t.from == 0 || t.from == e.doc.length) return { range: t };
|
|
1118
|
+
let n = t.from, r = e.doc.lineAt(n), i = n == r.from ? n - 1 : m(r.text, n - r.from, !1) + r.from, a = n == r.to ? n + 1 : m(r.text, n - r.from, !0) + r.from;
|
|
1119
|
+
return {
|
|
1120
|
+
changes: {
|
|
1121
|
+
from: i,
|
|
1122
|
+
to: a,
|
|
1123
|
+
insert: e.doc.slice(n, a).append(e.doc.slice(i, n))
|
|
1124
|
+
},
|
|
1125
|
+
range: h.cursor(a)
|
|
1126
|
+
};
|
|
1127
|
+
});
|
|
1128
|
+
return !n.changes.empty && (t(e.update(n, {
|
|
1129
|
+
scrollIntoView: !0,
|
|
1130
|
+
userEvent: "move.character"
|
|
1131
|
+
})), !0);
|
|
1132
|
+
};
|
|
1133
|
+
function Q(e) {
|
|
1134
|
+
let t = [], n = -1;
|
|
1135
|
+
for (let r of e.selection.ranges) {
|
|
1136
|
+
let i = e.doc.lineAt(r.from), a = e.doc.lineAt(r.to);
|
|
1137
|
+
if (!r.empty && r.to == a.from && (a = e.doc.lineAt(r.to - 1)), n >= i.number) {
|
|
1138
|
+
let e = t[t.length - 1];
|
|
1139
|
+
e.to = a.to, e.ranges.push(r);
|
|
1140
|
+
} else t.push({
|
|
1141
|
+
from: i.from,
|
|
1142
|
+
to: a.to,
|
|
1143
|
+
ranges: [r]
|
|
1144
|
+
});
|
|
1145
|
+
n = a.number + 1;
|
|
1146
|
+
}
|
|
1147
|
+
return t;
|
|
1148
|
+
}
|
|
1149
|
+
function xn(e, t, n) {
|
|
1150
|
+
if (e.readOnly) return !1;
|
|
1151
|
+
let r = [], i = [];
|
|
1152
|
+
for (let t of Q(e)) {
|
|
1153
|
+
if (n ? t.to == e.doc.length : t.from == 0) continue;
|
|
1154
|
+
let a = e.doc.lineAt(n ? t.to + 1 : t.from - 1), o = a.length + 1;
|
|
1155
|
+
if (n) {
|
|
1156
|
+
r.push({
|
|
1157
|
+
from: t.to,
|
|
1158
|
+
to: a.to
|
|
1159
|
+
}, {
|
|
1160
|
+
from: t.from,
|
|
1161
|
+
insert: a.text + e.lineBreak
|
|
1162
|
+
});
|
|
1163
|
+
for (let n of t.ranges) i.push(h.range(Math.min(e.doc.length, n.anchor + o), Math.min(e.doc.length, n.head + o)));
|
|
1164
|
+
} else {
|
|
1165
|
+
r.push({
|
|
1166
|
+
from: a.from,
|
|
1167
|
+
to: t.from
|
|
1168
|
+
}, {
|
|
1169
|
+
from: t.to,
|
|
1170
|
+
insert: e.lineBreak + a.text
|
|
1171
|
+
});
|
|
1172
|
+
for (let e of t.ranges) i.push(h.range(e.anchor - o, e.head - o));
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
return r.length ? (t(e.update({
|
|
1176
|
+
changes: r,
|
|
1177
|
+
scrollIntoView: !0,
|
|
1178
|
+
selection: h.create(i, e.selection.mainIndex),
|
|
1179
|
+
userEvent: "move.line"
|
|
1180
|
+
})), !0) : !1;
|
|
1181
|
+
}
|
|
1182
|
+
var Sn = ({ state: e, dispatch: t }) => xn(e, t, !1), Cn = ({ state: e, dispatch: t }) => xn(e, t, !0);
|
|
1183
|
+
function wn(e, t, n) {
|
|
1184
|
+
if (e.readOnly) return !1;
|
|
1185
|
+
let r = [];
|
|
1186
|
+
for (let t of Q(e)) n ? r.push({
|
|
1187
|
+
from: t.from,
|
|
1188
|
+
insert: e.doc.slice(t.from, t.to) + e.lineBreak
|
|
1189
|
+
}) : r.push({
|
|
1190
|
+
from: t.to,
|
|
1191
|
+
insert: e.lineBreak + e.doc.slice(t.from, t.to)
|
|
1192
|
+
});
|
|
1193
|
+
let i = e.changes(r);
|
|
1194
|
+
return t(e.update({
|
|
1195
|
+
changes: i,
|
|
1196
|
+
selection: e.selection.map(i, n ? 1 : -1),
|
|
1197
|
+
scrollIntoView: !0,
|
|
1198
|
+
userEvent: "input.copyline"
|
|
1199
|
+
})), !0;
|
|
1200
|
+
}
|
|
1201
|
+
var Tn = ({ state: e, dispatch: t }) => wn(e, t, !1), En = ({ state: e, dispatch: t }) => wn(e, t, !0), Dn = (e) => {
|
|
1202
|
+
if (e.state.readOnly) return !1;
|
|
1203
|
+
let { state: t } = e, n = t.changes(Q(t).map(({ from: e, to: n }) => (e > 0 ? e-- : n < t.doc.length && n++, {
|
|
1204
|
+
from: e,
|
|
1205
|
+
to: n
|
|
1206
|
+
}))), r = B(t.selection, (t) => {
|
|
1207
|
+
let n;
|
|
1208
|
+
if (e.lineWrapping) {
|
|
1209
|
+
let r = e.lineBlockAt(t.head), i = e.coordsAtPos(t.head, t.assoc || 1);
|
|
1210
|
+
i && (n = r.bottom + e.documentTop - i.bottom + e.defaultLineHeight / 2);
|
|
1211
|
+
}
|
|
1212
|
+
return e.moveVertically(t, !0, n);
|
|
1213
|
+
}).map(n);
|
|
1214
|
+
return e.dispatch({
|
|
1215
|
+
changes: n,
|
|
1216
|
+
selection: r,
|
|
1217
|
+
scrollIntoView: !0,
|
|
1218
|
+
userEvent: "delete.line"
|
|
1219
|
+
}), !0;
|
|
1220
|
+
};
|
|
1221
|
+
function On(e, t) {
|
|
1222
|
+
if (/\(\)|\[\]|\{\}/.test(e.sliceDoc(t - 1, t + 1))) return {
|
|
1223
|
+
from: t,
|
|
1224
|
+
to: t
|
|
1225
|
+
};
|
|
1226
|
+
let n = o(e).resolveInner(t), r = n.childBefore(t), i = n.childAfter(t), a;
|
|
1227
|
+
return r && i && r.to <= t && i.from >= t && (a = r.type.prop(_.closedBy)) && a.indexOf(i.name) > -1 && e.doc.lineAt(r.to).from == e.doc.lineAt(i.from).from && !/\S/.test(e.sliceDoc(r.to, i.from)) ? {
|
|
1228
|
+
from: r.to,
|
|
1229
|
+
to: i.from
|
|
1230
|
+
} : null;
|
|
1231
|
+
}
|
|
1232
|
+
var kn = /*@__PURE__*/ jn(!1), An = /*@__PURE__*/ jn(!0);
|
|
1233
|
+
function jn(t) {
|
|
1234
|
+
return ({ state: r, dispatch: i }) => {
|
|
1235
|
+
if (r.readOnly) return !1;
|
|
1236
|
+
let a = r.changeByRange((i) => {
|
|
1237
|
+
let { from: a, to: o } = i, s = r.doc.lineAt(a), c = !t && a == o && On(r, a);
|
|
1238
|
+
t && (a = o = (o <= s.to ? s : r.doc.lineAt(o)).to);
|
|
1239
|
+
let d = new ce(r, {
|
|
1240
|
+
simulateBreak: a,
|
|
1241
|
+
simulateDoubleBreak: !!c
|
|
1242
|
+
}), f = n(d, a);
|
|
1243
|
+
for (f ??= l(/^\s*/.exec(r.doc.lineAt(a).text)[0], r.tabSize); o < s.to && /\s/.test(s.text[o - s.from]);) o++;
|
|
1244
|
+
c ? {from: a, to: o} = c : a > s.from && a < s.from + 100 && !/\S/.test(s.text.slice(0, a)) && (a = s.from);
|
|
1245
|
+
let p = ["", e(r, f)];
|
|
1246
|
+
return c && p.push(e(r, d.lineIndent(s.from, -1))), {
|
|
1247
|
+
changes: {
|
|
1248
|
+
from: a,
|
|
1249
|
+
to: o,
|
|
1250
|
+
insert: u.of(p)
|
|
1251
|
+
},
|
|
1252
|
+
range: h.cursor(a + 1 + p[1].length)
|
|
1253
|
+
};
|
|
1254
|
+
});
|
|
1255
|
+
return i(r.update(a, {
|
|
1256
|
+
scrollIntoView: !0,
|
|
1257
|
+
userEvent: "input"
|
|
1258
|
+
})), !0;
|
|
1259
|
+
};
|
|
1260
|
+
}
|
|
1261
|
+
function $(e, t) {
|
|
1262
|
+
let n = -1;
|
|
1263
|
+
return e.changeByRange((r) => {
|
|
1264
|
+
let i = [];
|
|
1265
|
+
for (let a = r.from; a <= r.to;) {
|
|
1266
|
+
let o = e.doc.lineAt(a);
|
|
1267
|
+
o.number > n && (r.empty || r.to > o.from) && (t(o, i, r), n = o.number), a = o.to + 1;
|
|
1268
|
+
}
|
|
1269
|
+
let a = e.changes(i);
|
|
1270
|
+
return {
|
|
1271
|
+
changes: i,
|
|
1272
|
+
range: h.range(a.mapPos(r.anchor, 1), a.mapPos(r.head, 1))
|
|
1273
|
+
};
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
var Mn = ({ state: t, dispatch: r }) => {
|
|
1277
|
+
if (t.readOnly) return !1;
|
|
1278
|
+
let i = Object.create(null), a = new ce(t, { overrideIndentation: (e) => i[e] ?? -1 }), o = $(t, (r, o, s) => {
|
|
1279
|
+
let c = n(a, r.from);
|
|
1280
|
+
if (c == null) return;
|
|
1281
|
+
/\S/.test(r.text) || (c = 0);
|
|
1282
|
+
let l = /^\s*/.exec(r.text)[0], u = e(t, c);
|
|
1283
|
+
(l != u || s.from < r.from + l.length) && (i[r.from] = c, o.push({
|
|
1284
|
+
from: r.from,
|
|
1285
|
+
to: r.from + l.length,
|
|
1286
|
+
insert: u
|
|
1287
|
+
}));
|
|
1288
|
+
});
|
|
1289
|
+
return o.changes.empty || r(t.update(o, { userEvent: "indent" })), !0;
|
|
1290
|
+
}, Nn = ({ state: e, dispatch: t }) => !e.readOnly && (t(e.update($(e, (t, n) => {
|
|
1291
|
+
n.push({
|
|
1292
|
+
from: t.from,
|
|
1293
|
+
insert: e.facet(ie)
|
|
1294
|
+
});
|
|
1295
|
+
}), { userEvent: "input.indent" })), !0), Pn = ({ state: t, dispatch: n }) => !t.readOnly && (n(t.update($(t, (n, r) => {
|
|
1296
|
+
let a = /^\s*/.exec(n.text)[0];
|
|
1297
|
+
if (!a) return;
|
|
1298
|
+
let o = l(a, t.tabSize), s = 0, c = e(t, Math.max(0, o - i(t)));
|
|
1299
|
+
for (; s < a.length && s < c.length && a.charCodeAt(s) == c.charCodeAt(s);) s++;
|
|
1300
|
+
r.push({
|
|
1301
|
+
from: n.from + s,
|
|
1302
|
+
to: n.from + a.length,
|
|
1303
|
+
insert: c.slice(s)
|
|
1304
|
+
});
|
|
1305
|
+
}), { userEvent: "delete.dedent" })), !0), Fn = (e) => (e.setTabFocusMode(), !0), In = ({ state: e, dispatch: t }) => e.selection.ranges.some((e) => !e.empty) ? Nn({
|
|
1306
|
+
state: e,
|
|
1307
|
+
dispatch: t
|
|
1308
|
+
}) : (t(e.update(e.replaceSelection(" "), {
|
|
1309
|
+
scrollIntoView: !0,
|
|
1310
|
+
userEvent: "input"
|
|
1311
|
+
})), !0), Ln = [
|
|
878
1312
|
{
|
|
879
|
-
key: "
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
shift: dt,
|
|
1313
|
+
key: "Ctrl-b",
|
|
1314
|
+
run: dt,
|
|
1315
|
+
shift: Pt,
|
|
883
1316
|
preventDefault: !0
|
|
884
1317
|
},
|
|
885
1318
|
{
|
|
886
|
-
|
|
887
|
-
run:
|
|
888
|
-
shift:
|
|
889
|
-
preventDefault: !0
|
|
1319
|
+
key: "Ctrl-f",
|
|
1320
|
+
run: ft,
|
|
1321
|
+
shift: Ft
|
|
890
1322
|
},
|
|
891
1323
|
{
|
|
892
|
-
key: "
|
|
893
|
-
run:
|
|
894
|
-
shift:
|
|
895
|
-
preventDefault: !0
|
|
1324
|
+
key: "Ctrl-p",
|
|
1325
|
+
run: bt,
|
|
1326
|
+
shift: Ht
|
|
896
1327
|
},
|
|
897
1328
|
{
|
|
898
|
-
key: "
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
shift: ft,
|
|
902
|
-
preventDefault: !0
|
|
1329
|
+
key: "Ctrl-n",
|
|
1330
|
+
run: xt,
|
|
1331
|
+
shift: Ut
|
|
903
1332
|
},
|
|
904
1333
|
{
|
|
905
|
-
|
|
906
|
-
run:
|
|
907
|
-
shift:
|
|
908
|
-
preventDefault: !0
|
|
1334
|
+
key: "Ctrl-a",
|
|
1335
|
+
run: kt,
|
|
1336
|
+
shift: Zt
|
|
909
1337
|
},
|
|
910
1338
|
{
|
|
911
|
-
key: "
|
|
912
|
-
run:
|
|
913
|
-
shift:
|
|
914
|
-
preventDefault: !0
|
|
1339
|
+
key: "Ctrl-e",
|
|
1340
|
+
run: At,
|
|
1341
|
+
shift: Qt
|
|
915
1342
|
},
|
|
916
1343
|
{
|
|
917
|
-
|
|
918
|
-
run:
|
|
919
|
-
shift: kt
|
|
1344
|
+
key: "Ctrl-d",
|
|
1345
|
+
run: fn
|
|
920
1346
|
},
|
|
921
1347
|
{
|
|
922
|
-
|
|
923
|
-
run:
|
|
924
|
-
shift: yt
|
|
1348
|
+
key: "Ctrl-h",
|
|
1349
|
+
run: Z
|
|
925
1350
|
},
|
|
926
1351
|
{
|
|
927
|
-
key: "
|
|
928
|
-
run:
|
|
929
|
-
shift: _t,
|
|
930
|
-
preventDefault: !0
|
|
1352
|
+
key: "Ctrl-k",
|
|
1353
|
+
run: gn
|
|
931
1354
|
},
|
|
932
1355
|
{
|
|
933
|
-
|
|
1356
|
+
key: "Ctrl-Alt-h",
|
|
1357
|
+
run: mn
|
|
1358
|
+
},
|
|
1359
|
+
{
|
|
1360
|
+
key: "Ctrl-o",
|
|
1361
|
+
run: yn
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
key: "Ctrl-t",
|
|
1365
|
+
run: bn
|
|
1366
|
+
},
|
|
1367
|
+
{
|
|
1368
|
+
key: "Ctrl-v",
|
|
1369
|
+
run: K
|
|
1370
|
+
}
|
|
1371
|
+
], Rn = /*@__PURE__*/ [
|
|
1372
|
+
{
|
|
1373
|
+
key: "ArrowLeft",
|
|
1374
|
+
run: dt,
|
|
1375
|
+
shift: Pt,
|
|
1376
|
+
preventDefault: !0
|
|
1377
|
+
},
|
|
1378
|
+
{
|
|
1379
|
+
key: "Mod-ArrowLeft",
|
|
1380
|
+
mac: "Alt-ArrowLeft",
|
|
1381
|
+
run: mt,
|
|
1382
|
+
shift: Lt,
|
|
1383
|
+
preventDefault: !0
|
|
1384
|
+
},
|
|
1385
|
+
{
|
|
1386
|
+
mac: "Cmd-ArrowLeft",
|
|
1387
|
+
run: Dt,
|
|
1388
|
+
shift: Yt,
|
|
1389
|
+
preventDefault: !0
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
key: "ArrowRight",
|
|
1393
|
+
run: ft,
|
|
1394
|
+
shift: Ft,
|
|
1395
|
+
preventDefault: !0
|
|
1396
|
+
},
|
|
1397
|
+
{
|
|
1398
|
+
key: "Mod-ArrowRight",
|
|
1399
|
+
mac: "Alt-ArrowRight",
|
|
1400
|
+
run: ht,
|
|
1401
|
+
shift: Rt,
|
|
1402
|
+
preventDefault: !0
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
mac: "Cmd-ArrowRight",
|
|
934
1406
|
run: Ot,
|
|
935
|
-
shift:
|
|
1407
|
+
shift: Xt,
|
|
1408
|
+
preventDefault: !0
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
key: "ArrowUp",
|
|
1412
|
+
run: bt,
|
|
1413
|
+
shift: Ht,
|
|
1414
|
+
preventDefault: !0
|
|
1415
|
+
},
|
|
1416
|
+
{
|
|
1417
|
+
mac: "Cmd-ArrowUp",
|
|
1418
|
+
run: $t,
|
|
1419
|
+
shift: tn
|
|
1420
|
+
},
|
|
1421
|
+
{
|
|
1422
|
+
mac: "Ctrl-ArrowUp",
|
|
1423
|
+
run: wt,
|
|
1424
|
+
shift: Gt
|
|
1425
|
+
},
|
|
1426
|
+
{
|
|
1427
|
+
key: "ArrowDown",
|
|
1428
|
+
run: xt,
|
|
1429
|
+
shift: Ut,
|
|
1430
|
+
preventDefault: !0
|
|
1431
|
+
},
|
|
1432
|
+
{
|
|
1433
|
+
mac: "Cmd-ArrowDown",
|
|
1434
|
+
run: en,
|
|
1435
|
+
shift: nn
|
|
936
1436
|
},
|
|
937
1437
|
{
|
|
938
1438
|
mac: "Ctrl-ArrowDown",
|
|
939
|
-
run:
|
|
940
|
-
shift:
|
|
1439
|
+
run: K,
|
|
1440
|
+
shift: Kt
|
|
941
1441
|
},
|
|
942
1442
|
{
|
|
943
1443
|
key: "PageUp",
|
|
944
|
-
run:
|
|
945
|
-
shift:
|
|
1444
|
+
run: wt,
|
|
1445
|
+
shift: Gt
|
|
946
1446
|
},
|
|
947
1447
|
{
|
|
948
1448
|
key: "PageDown",
|
|
949
|
-
run:
|
|
950
|
-
shift:
|
|
1449
|
+
run: K,
|
|
1450
|
+
shift: Kt
|
|
951
1451
|
},
|
|
952
1452
|
{
|
|
953
1453
|
key: "Home",
|
|
954
|
-
run:
|
|
955
|
-
shift:
|
|
1454
|
+
run: Et,
|
|
1455
|
+
shift: Jt,
|
|
956
1456
|
preventDefault: !0
|
|
957
1457
|
},
|
|
958
1458
|
{
|
|
959
1459
|
key: "Mod-Home",
|
|
960
|
-
run:
|
|
961
|
-
shift:
|
|
1460
|
+
run: $t,
|
|
1461
|
+
shift: tn
|
|
962
1462
|
},
|
|
963
1463
|
{
|
|
964
1464
|
key: "End",
|
|
965
|
-
run:
|
|
966
|
-
shift:
|
|
1465
|
+
run: Tt,
|
|
1466
|
+
shift: qt,
|
|
967
1467
|
preventDefault: !0
|
|
968
1468
|
},
|
|
969
1469
|
{
|
|
970
1470
|
key: "Mod-End",
|
|
971
|
-
run:
|
|
972
|
-
shift:
|
|
1471
|
+
run: en,
|
|
1472
|
+
shift: nn
|
|
973
1473
|
},
|
|
974
1474
|
{
|
|
975
1475
|
key: "Enter",
|
|
976
|
-
run:
|
|
977
|
-
shift:
|
|
1476
|
+
run: kn,
|
|
1477
|
+
shift: kn
|
|
978
1478
|
},
|
|
979
1479
|
{
|
|
980
1480
|
key: "Mod-a",
|
|
981
|
-
run:
|
|
1481
|
+
run: rn
|
|
982
1482
|
},
|
|
983
1483
|
{
|
|
984
1484
|
key: "Backspace",
|
|
985
|
-
run:
|
|
986
|
-
shift:
|
|
1485
|
+
run: Z,
|
|
1486
|
+
shift: Z,
|
|
987
1487
|
preventDefault: !0
|
|
988
1488
|
},
|
|
989
1489
|
{
|
|
990
1490
|
key: "Delete",
|
|
991
|
-
run:
|
|
1491
|
+
run: fn,
|
|
992
1492
|
preventDefault: !0
|
|
993
1493
|
},
|
|
994
1494
|
{
|
|
995
1495
|
key: "Mod-Backspace",
|
|
996
1496
|
mac: "Alt-Backspace",
|
|
997
|
-
run:
|
|
1497
|
+
run: mn,
|
|
998
1498
|
preventDefault: !0
|
|
999
1499
|
},
|
|
1000
1500
|
{
|
|
1001
1501
|
key: "Mod-Delete",
|
|
1002
1502
|
mac: "Alt-Delete",
|
|
1003
|
-
run:
|
|
1503
|
+
run: hn,
|
|
1004
1504
|
preventDefault: !0
|
|
1005
1505
|
},
|
|
1006
1506
|
{
|
|
1007
1507
|
mac: "Mod-Backspace",
|
|
1008
|
-
run:
|
|
1508
|
+
run: _n,
|
|
1009
1509
|
preventDefault: !0
|
|
1010
1510
|
},
|
|
1011
1511
|
{
|
|
1012
1512
|
mac: "Mod-Delete",
|
|
1013
|
-
run:
|
|
1513
|
+
run: vn,
|
|
1014
1514
|
preventDefault: !0
|
|
1015
1515
|
}
|
|
1016
|
-
].concat(/*@__PURE__*/
|
|
1516
|
+
].concat(/*@__PURE__*/ Ln.map((e) => ({
|
|
1017
1517
|
mac: e.key,
|
|
1018
1518
|
run: e.run,
|
|
1019
1519
|
shift: e.shift
|
|
1020
|
-
}))),
|
|
1520
|
+
}))), zn = /*@__PURE__*/ [
|
|
1021
1521
|
{
|
|
1022
1522
|
key: "Alt-ArrowLeft",
|
|
1023
1523
|
mac: "Ctrl-ArrowLeft",
|
|
1024
|
-
run:
|
|
1025
|
-
shift:
|
|
1524
|
+
run: _t,
|
|
1525
|
+
shift: zt
|
|
1026
1526
|
},
|
|
1027
1527
|
{
|
|
1028
1528
|
key: "Alt-ArrowRight",
|
|
1029
1529
|
mac: "Ctrl-ArrowRight",
|
|
1030
|
-
run:
|
|
1031
|
-
shift:
|
|
1530
|
+
run: vt,
|
|
1531
|
+
shift: Bt
|
|
1032
1532
|
},
|
|
1033
1533
|
{
|
|
1034
1534
|
key: "Alt-ArrowUp",
|
|
1035
|
-
run:
|
|
1535
|
+
run: Sn
|
|
1036
1536
|
},
|
|
1037
1537
|
{
|
|
1038
1538
|
key: "Shift-Alt-ArrowUp",
|
|
1039
|
-
run:
|
|
1539
|
+
run: Tn
|
|
1040
1540
|
},
|
|
1041
1541
|
{
|
|
1042
1542
|
key: "Alt-ArrowDown",
|
|
1043
|
-
run:
|
|
1543
|
+
run: Cn
|
|
1044
1544
|
},
|
|
1045
1545
|
{
|
|
1046
1546
|
key: "Shift-Alt-ArrowDown",
|
|
1047
|
-
run:
|
|
1547
|
+
run: En
|
|
1048
1548
|
},
|
|
1049
1549
|
{
|
|
1050
1550
|
key: "Mod-Alt-ArrowUp",
|
|
1051
|
-
run:
|
|
1551
|
+
run: cn
|
|
1052
1552
|
},
|
|
1053
1553
|
{
|
|
1054
1554
|
key: "Mod-Alt-ArrowDown",
|
|
1055
|
-
run:
|
|
1555
|
+
run: ln
|
|
1056
1556
|
},
|
|
1057
1557
|
{
|
|
1058
1558
|
key: "Escape",
|
|
1059
|
-
run:
|
|
1559
|
+
run: un
|
|
1060
1560
|
},
|
|
1061
1561
|
{
|
|
1062
1562
|
key: "Mod-Enter",
|
|
1063
|
-
run:
|
|
1563
|
+
run: An
|
|
1064
1564
|
},
|
|
1065
1565
|
{
|
|
1066
1566
|
key: "Alt-l",
|
|
1067
1567
|
mac: "Ctrl-l",
|
|
1068
|
-
run:
|
|
1568
|
+
run: an
|
|
1069
1569
|
},
|
|
1070
1570
|
{
|
|
1071
1571
|
key: "Mod-i",
|
|
1072
|
-
run:
|
|
1572
|
+
run: on,
|
|
1073
1573
|
preventDefault: !0
|
|
1074
1574
|
},
|
|
1075
1575
|
{
|
|
1076
1576
|
key: "Mod-[",
|
|
1077
|
-
run:
|
|
1577
|
+
run: Pn
|
|
1078
1578
|
},
|
|
1079
1579
|
{
|
|
1080
1580
|
key: "Mod-]",
|
|
1081
|
-
run:
|
|
1581
|
+
run: Nn
|
|
1082
1582
|
},
|
|
1083
1583
|
{
|
|
1084
1584
|
key: "Mod-Alt-\\",
|
|
1085
|
-
run:
|
|
1585
|
+
run: Mn
|
|
1086
1586
|
},
|
|
1087
1587
|
{
|
|
1088
1588
|
key: "Shift-Mod-k",
|
|
1089
|
-
run:
|
|
1589
|
+
run: Dn
|
|
1090
1590
|
},
|
|
1091
1591
|
{
|
|
1092
1592
|
key: "Shift-Mod-\\",
|
|
1093
|
-
run:
|
|
1593
|
+
run: Mt
|
|
1094
1594
|
},
|
|
1095
1595
|
{
|
|
1096
1596
|
key: "Mod-/",
|
|
1097
|
-
run:
|
|
1597
|
+
run: ze
|
|
1098
1598
|
},
|
|
1099
1599
|
{
|
|
1100
1600
|
key: "Alt-A",
|
|
1101
1601
|
mac: "Ctrl-A",
|
|
1102
|
-
run:
|
|
1602
|
+
run: Ve
|
|
1103
1603
|
},
|
|
1104
1604
|
{
|
|
1105
1605
|
key: "Ctrl-m",
|
|
1106
1606
|
mac: "Shift-Alt-m",
|
|
1107
|
-
run:
|
|
1607
|
+
run: Fn
|
|
1108
1608
|
}
|
|
1109
|
-
].concat(
|
|
1609
|
+
].concat(Rn), Bn = {
|
|
1110
1610
|
key: "Tab",
|
|
1111
|
-
run:
|
|
1112
|
-
shift:
|
|
1113
|
-
}, mn = class {
|
|
1114
|
-
constructor(e, t, n) {
|
|
1115
|
-
this.from = e, this.to = t, this.diagnostic = n;
|
|
1116
|
-
}
|
|
1117
|
-
}, q = class e {
|
|
1118
|
-
constructor(e, t, n) {
|
|
1119
|
-
this.diagnostics = e, this.panel = t, this.selected = n;
|
|
1120
|
-
}
|
|
1121
|
-
static init(t, n, r) {
|
|
1122
|
-
let i = r.facet(Q).markerFilter;
|
|
1123
|
-
i && (t = i(t, r));
|
|
1124
|
-
let a = t.slice().sort((e, t) => e.from - t.from || e.to - t.to), o = new d(), s = [], c = 0, l = r.doc.iter(), u = 0, f = r.doc.length;
|
|
1125
|
-
for (let e = 0;;) {
|
|
1126
|
-
let t = e == a.length ? null : a[e];
|
|
1127
|
-
if (!t && !s.length) break;
|
|
1128
|
-
let n, r;
|
|
1129
|
-
if (s.length) n = c, r = s.reduce((e, t) => Math.min(e, t.to), t && t.from > n ? t.from : 1e8);
|
|
1130
|
-
else {
|
|
1131
|
-
if (n = t.from, n > f) break;
|
|
1132
|
-
r = t.to, s.push(t), e++;
|
|
1133
|
-
}
|
|
1134
|
-
for (; e < a.length;) {
|
|
1135
|
-
let t = a[e];
|
|
1136
|
-
if (t.from == n && (t.to > t.from || t.to == n)) s.push(t), e++, r = Math.min(t.to, r);
|
|
1137
|
-
else {
|
|
1138
|
-
r = Math.min(t.from, r);
|
|
1139
|
-
break;
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
r = Math.min(r, f);
|
|
1143
|
-
let i = !1;
|
|
1144
|
-
if (s.some((e) => e.from == n && (e.to == r || r == f)) && (i = n == r, !i && r - n < 10)) {
|
|
1145
|
-
let e = n - (u + l.value.length);
|
|
1146
|
-
e > 0 && (l.next(e), u = n);
|
|
1147
|
-
for (let e = n;;) {
|
|
1148
|
-
if (e >= r) {
|
|
1149
|
-
i = !0;
|
|
1150
|
-
break;
|
|
1151
|
-
}
|
|
1152
|
-
if (!l.lineBreak && u + l.value.length > e) break;
|
|
1153
|
-
e = u + l.value.length, u += l.value.length, l.next();
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
let d = Ln(s);
|
|
1157
|
-
if (i) o.add(n, n, v.widget({
|
|
1158
|
-
widget: new jn(d),
|
|
1159
|
-
diagnostics: s.slice()
|
|
1160
|
-
}));
|
|
1161
|
-
else {
|
|
1162
|
-
let e = s.reduce((e, t) => t.markClass ? e + " " + t.markClass : e, "");
|
|
1163
|
-
o.add(n, r, v.mark({
|
|
1164
|
-
class: "cm-lintRange cm-lintRange-" + d + e,
|
|
1165
|
-
diagnostics: s.slice(),
|
|
1166
|
-
inclusiveEnd: s.some((e) => e.to > r)
|
|
1167
|
-
}));
|
|
1168
|
-
}
|
|
1169
|
-
if (c = r, c == f) break;
|
|
1170
|
-
for (let e = 0; e < s.length; e++) s[e].to <= c && s.splice(e--, 1);
|
|
1171
|
-
}
|
|
1172
|
-
let p = o.finish();
|
|
1173
|
-
return new e(p, n, J(p));
|
|
1174
|
-
}
|
|
1175
|
-
};
|
|
1176
|
-
function J(e, t = null, n = 0) {
|
|
1177
|
-
let r = null;
|
|
1178
|
-
return e.between(n, 1e9, (e, n, { spec: i }) => {
|
|
1179
|
-
if (!(t && i.diagnostics.indexOf(t) < 0)) {
|
|
1180
|
-
if (!r) r = new mn(e, n, t || i.diagnostics[0]);
|
|
1181
|
-
else if (i.diagnostics.indexOf(r.diagnostic) < 0) return !1;
|
|
1182
|
-
else r = new mn(r.from, n, r.diagnostic);
|
|
1183
|
-
}
|
|
1184
|
-
}), r;
|
|
1185
|
-
}
|
|
1186
|
-
function hn(e, t) {
|
|
1187
|
-
let n = t.pos, r = t.end || n, i = e.state.facet(Q).hideOn(e, n, r);
|
|
1188
|
-
if (i != null) return i;
|
|
1189
|
-
let a = e.startState.doc.lineAt(t.pos);
|
|
1190
|
-
return !!(e.effects.some((e) => e.is(Y)) || e.changes.touchesRange(a.from, Math.max(a.to, r)));
|
|
1191
|
-
}
|
|
1192
|
-
function gn(e, t) {
|
|
1193
|
-
return e.field(Z, !1) ? t : t.concat(h.appendConfig.of(zn));
|
|
1194
|
-
}
|
|
1195
|
-
function _n(e, t) {
|
|
1196
|
-
return { effects: gn(e, [Y.of(t)]) };
|
|
1197
|
-
}
|
|
1198
|
-
var Y = /*@__PURE__*/ h.define(), X = /*@__PURE__*/ h.define(), vn = /*@__PURE__*/ h.define(), Z = /*@__PURE__*/ fe.define({
|
|
1199
|
-
create() {
|
|
1200
|
-
return new q(v.none, null, null);
|
|
1201
|
-
},
|
|
1202
|
-
update(e, t) {
|
|
1203
|
-
if (t.docChanged && e.diagnostics.size) {
|
|
1204
|
-
let n = e.diagnostics.map(t.changes), r = null, i = e.panel;
|
|
1205
|
-
if (e.selected) {
|
|
1206
|
-
let i = t.changes.mapPos(e.selected.from, 1);
|
|
1207
|
-
r = J(n, e.selected.diagnostic, i) || J(n, null, i);
|
|
1208
|
-
}
|
|
1209
|
-
!n.size && i && t.state.facet(Q).autoPanel && (i = null), e = new q(n, i, r);
|
|
1210
|
-
}
|
|
1211
|
-
for (let n of t.effects) if (n.is(Y)) {
|
|
1212
|
-
let r = t.state.facet(Q).autoPanel ? n.value.length ? Nn.open : null : e.panel;
|
|
1213
|
-
e = q.init(n.value, r, t.state);
|
|
1214
|
-
} else n.is(X) ? e = new q(e.diagnostics, n.value ? Nn.open : null, e.selected) : n.is(vn) && (e = new q(e.diagnostics, e.panel, n.value));
|
|
1215
|
-
return e;
|
|
1216
|
-
},
|
|
1217
|
-
provide: (t) => [te.from(t, (e) => e.panel), e.decorations.from(t, (e) => e.diagnostics)]
|
|
1218
|
-
}), yn = /*@__PURE__*/ v.mark({ class: "cm-lintRange cm-lintRange-active" });
|
|
1219
|
-
function bn(e, t, n) {
|
|
1220
|
-
let { diagnostics: r } = e.state.field(Z), i, a = -1, o = -1;
|
|
1221
|
-
r.between(t - +(n < 0), t + +(n > 0), (e, r, { spec: s }) => {
|
|
1222
|
-
if (t >= e && t <= r && (e == r || (t > e || n > 0) && (t < r || n < 0))) return i = s.diagnostics, a = e, o = r, !1;
|
|
1223
|
-
});
|
|
1224
|
-
let s = e.state.facet(Q).tooltipFilter;
|
|
1225
|
-
return i && s && (i = s(i, e.state)), i ? {
|
|
1226
|
-
pos: a,
|
|
1227
|
-
end: o,
|
|
1228
|
-
above: !0,
|
|
1229
|
-
create() {
|
|
1230
|
-
return { dom: xn(e, i) };
|
|
1231
|
-
}
|
|
1232
|
-
} : null;
|
|
1233
|
-
}
|
|
1234
|
-
function xn(e, t) {
|
|
1235
|
-
return y("ul", { class: "cm-tooltip-lint" }, t.map((t) => An(e, t, !1)));
|
|
1236
|
-
}
|
|
1237
|
-
var Sn = (e) => {
|
|
1238
|
-
let t = e.state.field(Z, !1);
|
|
1239
|
-
(!t || !t.panel) && e.dispatch({ effects: gn(e.state, [X.of(!0)]) });
|
|
1240
|
-
let n = ae(e, Nn.open);
|
|
1241
|
-
return n && n.dom.querySelector(".cm-panel-lint ul").focus(), !0;
|
|
1242
|
-
}, Cn = (e) => {
|
|
1243
|
-
let t = e.state.field(Z, !1);
|
|
1244
|
-
return !t || !t.panel ? !1 : (e.dispatch({ effects: X.of(!1) }), !0);
|
|
1245
|
-
}, wn = [{
|
|
1246
|
-
key: "Mod-Shift-m",
|
|
1247
|
-
run: Sn,
|
|
1248
|
-
preventDefault: !0
|
|
1249
|
-
}, {
|
|
1250
|
-
key: "F8",
|
|
1251
|
-
run: (e) => {
|
|
1252
|
-
let t = e.state.field(Z, !1);
|
|
1253
|
-
if (!t) return !1;
|
|
1254
|
-
let n = e.state.selection.main, r = J(t.diagnostics, null, n.to + 1);
|
|
1255
|
-
return !r && (r = J(t.diagnostics, null, 0), !r || r.from == n.from && r.to == n.to) ? !1 : (e.dispatch({
|
|
1256
|
-
selection: {
|
|
1257
|
-
anchor: r.from,
|
|
1258
|
-
head: r.to
|
|
1259
|
-
},
|
|
1260
|
-
scrollIntoView: !0
|
|
1261
|
-
}), ue(e, r.from, 1, {
|
|
1262
|
-
tooltip: Rn,
|
|
1263
|
-
until: (e) => e.docChanged || e.newSelection.main.head < r.from || e.newSelection.main.head > r.to
|
|
1264
|
-
}), !0);
|
|
1265
|
-
}
|
|
1266
|
-
}], Tn = /*@__PURE__*/ de.fromClass(class {
|
|
1267
|
-
constructor(e) {
|
|
1268
|
-
this.view = e, this.timeout = -1, this.set = !0;
|
|
1269
|
-
let { delay: t } = e.state.facet(Q);
|
|
1270
|
-
this.lintTime = Date.now() + t, this.run = this.run.bind(this), this.timeout = setTimeout(this.run, t);
|
|
1271
|
-
}
|
|
1272
|
-
run() {
|
|
1273
|
-
clearTimeout(this.timeout);
|
|
1274
|
-
let e = Date.now();
|
|
1275
|
-
if (e < this.lintTime - 10) this.timeout = setTimeout(this.run, this.lintTime - e);
|
|
1276
|
-
else {
|
|
1277
|
-
this.set = !1;
|
|
1278
|
-
let { state: e } = this.view, { sources: t } = e.facet(Q);
|
|
1279
|
-
t.length && En(t.map((e) => Promise.resolve(e(this.view))), (t) => {
|
|
1280
|
-
this.view.state.doc == e.doc && this.view.dispatch(_n(this.view.state, t.reduce((e, t) => e.concat(t))));
|
|
1281
|
-
}, (e) => {
|
|
1282
|
-
ie(this.view.state, e);
|
|
1283
|
-
});
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
update(e) {
|
|
1287
|
-
let t = e.state.facet(Q);
|
|
1288
|
-
(e.docChanged || t != e.startState.facet(Q) || t.needsRefresh && t.needsRefresh(e)) && (this.lintTime = Date.now() + t.delay, this.set || (this.set = !0, this.timeout = setTimeout(this.run, t.delay)));
|
|
1289
|
-
}
|
|
1290
|
-
force() {
|
|
1291
|
-
this.set && (this.lintTime = Date.now(), this.run());
|
|
1292
|
-
}
|
|
1293
|
-
destroy() {
|
|
1294
|
-
clearTimeout(this.timeout);
|
|
1295
|
-
}
|
|
1296
|
-
});
|
|
1297
|
-
function En(e, t, n) {
|
|
1298
|
-
let r = [], i = -1;
|
|
1299
|
-
for (let a of e) a.then((n) => {
|
|
1300
|
-
r.push(n), clearTimeout(i), r.length == e.length ? t(r) : i = setTimeout(() => t(r), 200);
|
|
1301
|
-
}, n);
|
|
1302
|
-
}
|
|
1303
|
-
var Q = /*@__PURE__*/ p.define({ combine(e) {
|
|
1304
|
-
return {
|
|
1305
|
-
sources: e.map((e) => e.source).filter((e) => e != null),
|
|
1306
|
-
...re(e.map((e) => e.config), {
|
|
1307
|
-
delay: 750,
|
|
1308
|
-
markerFilter: null,
|
|
1309
|
-
tooltipFilter: null,
|
|
1310
|
-
needsRefresh: null,
|
|
1311
|
-
hideOn: () => null
|
|
1312
|
-
}, {
|
|
1313
|
-
delay: Math.max,
|
|
1314
|
-
markerFilter: Dn,
|
|
1315
|
-
tooltipFilter: Dn,
|
|
1316
|
-
needsRefresh: (e, t) => e ? t ? (n) => e(n) || t(n) : e : t,
|
|
1317
|
-
hideOn: (e, t) => e ? t ? (n, r, i) => e(n, r, i) || t(n, r, i) : e : t,
|
|
1318
|
-
autoPanel: (e, t) => e || t
|
|
1319
|
-
})
|
|
1320
|
-
};
|
|
1321
|
-
} });
|
|
1322
|
-
function Dn(e, t) {
|
|
1323
|
-
return e ? t ? (n, r) => t(e(n, r), r) : e : t;
|
|
1324
|
-
}
|
|
1325
|
-
function On(e, t = {}) {
|
|
1326
|
-
return [
|
|
1327
|
-
Q.of({
|
|
1328
|
-
source: e,
|
|
1329
|
-
config: t
|
|
1330
|
-
}),
|
|
1331
|
-
Tn,
|
|
1332
|
-
zn
|
|
1333
|
-
];
|
|
1334
|
-
}
|
|
1335
|
-
function kn(e) {
|
|
1336
|
-
let t = [];
|
|
1337
|
-
if (e) actions: for (let { name: n } of e) {
|
|
1338
|
-
for (let e = 0; e < n.length; e++) {
|
|
1339
|
-
let r = n[e];
|
|
1340
|
-
if (/[a-zA-Z]/.test(r) && !t.some((e) => e.toLowerCase() == r.toLowerCase())) {
|
|
1341
|
-
t.push(r);
|
|
1342
|
-
continue actions;
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
t.push("");
|
|
1346
|
-
}
|
|
1347
|
-
return t;
|
|
1348
|
-
}
|
|
1349
|
-
function An(e, t, n) {
|
|
1350
|
-
let r = n ? kn(t.actions) : [];
|
|
1351
|
-
return y("li", { class: "cm-diagnostic cm-diagnostic-" + t.severity }, y("span", { class: "cm-diagnosticText" }, t.renderMessage ? t.renderMessage(e) : t.message), t.actions?.map((n, i) => {
|
|
1352
|
-
let a = !1, o = (r) => {
|
|
1353
|
-
if (r.preventDefault(), a) return;
|
|
1354
|
-
a = !0;
|
|
1355
|
-
let i = J(e.state.field(Z).diagnostics, t);
|
|
1356
|
-
i && n.apply(e, i.from, i.to);
|
|
1357
|
-
}, { name: s } = n, c = r[i] ? s.indexOf(r[i]) : -1, l = c < 0 ? s : [
|
|
1358
|
-
s.slice(0, c),
|
|
1359
|
-
y("u", s.slice(c, c + 1)),
|
|
1360
|
-
s.slice(c + 1)
|
|
1361
|
-
], u = n.markClass ? " " + n.markClass : "";
|
|
1362
|
-
return y("button", {
|
|
1363
|
-
type: "button",
|
|
1364
|
-
class: "cm-diagnosticAction" + u,
|
|
1365
|
-
onclick: o,
|
|
1366
|
-
onmousedown: o,
|
|
1367
|
-
"aria-label": ` Action: ${s}${c < 0 ? "" : ` (access key "${r[i]})"`}.`
|
|
1368
|
-
}, l);
|
|
1369
|
-
}), t.source && y("div", { class: "cm-diagnosticSource" }, t.source));
|
|
1370
|
-
}
|
|
1371
|
-
var jn = class extends ce {
|
|
1372
|
-
constructor(e) {
|
|
1373
|
-
super(), this.sev = e;
|
|
1374
|
-
}
|
|
1375
|
-
eq(e) {
|
|
1376
|
-
return e.sev == this.sev;
|
|
1377
|
-
}
|
|
1378
|
-
toDOM() {
|
|
1379
|
-
return y("span", { class: "cm-lintPoint cm-lintPoint-" + this.sev });
|
|
1380
|
-
}
|
|
1381
|
-
}, Mn = class {
|
|
1382
|
-
constructor(e, t) {
|
|
1383
|
-
this.diagnostic = t, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom = An(e, t, !0), this.dom.id = this.id, this.dom.setAttribute("role", "option");
|
|
1384
|
-
}
|
|
1385
|
-
}, Nn = class e {
|
|
1386
|
-
constructor(e) {
|
|
1387
|
-
this.view = e, this.items = [];
|
|
1388
|
-
let t = (t) => {
|
|
1389
|
-
if (!(t.ctrlKey || t.altKey || t.metaKey)) {
|
|
1390
|
-
if (t.keyCode == 27) Cn(this.view), this.view.focus();
|
|
1391
|
-
else if (t.keyCode == 38 || t.keyCode == 33) this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);
|
|
1392
|
-
else if (t.keyCode == 40 || t.keyCode == 34) this.moveSelection((this.selectedIndex + 1) % this.items.length);
|
|
1393
|
-
else if (t.keyCode == 36) this.moveSelection(0);
|
|
1394
|
-
else if (t.keyCode == 35) this.moveSelection(this.items.length - 1);
|
|
1395
|
-
else if (t.keyCode == 13) this.view.focus();
|
|
1396
|
-
else if (t.keyCode >= 65 && t.keyCode <= 90 && this.selectedIndex >= 0) {
|
|
1397
|
-
let { diagnostic: n } = this.items[this.selectedIndex], r = kn(n.actions);
|
|
1398
|
-
for (let i = 0; i < r.length; i++) if (r[i].toUpperCase().charCodeAt(0) == t.keyCode) {
|
|
1399
|
-
let t = J(this.view.state.field(Z).diagnostics, n);
|
|
1400
|
-
t && n.actions[i].apply(e, t.from, t.to);
|
|
1401
|
-
}
|
|
1402
|
-
} else return;
|
|
1403
|
-
t.preventDefault();
|
|
1404
|
-
}
|
|
1405
|
-
}, n = (e) => {
|
|
1406
|
-
for (let t = 0; t < this.items.length; t++) this.items[t].dom.contains(e.target) && this.moveSelection(t);
|
|
1407
|
-
};
|
|
1408
|
-
this.list = y("ul", {
|
|
1409
|
-
tabIndex: 0,
|
|
1410
|
-
role: "listbox",
|
|
1411
|
-
"aria-label": this.view.state.phrase("Diagnostics"),
|
|
1412
|
-
onkeydown: t,
|
|
1413
|
-
onclick: n
|
|
1414
|
-
}), this.dom = y("div", { class: "cm-panel-lint" }, this.list, y("button", {
|
|
1415
|
-
type: "button",
|
|
1416
|
-
name: "close",
|
|
1417
|
-
"aria-label": this.view.state.phrase("close"),
|
|
1418
|
-
onclick: () => Cn(this.view)
|
|
1419
|
-
}, "×")), this.update();
|
|
1420
|
-
}
|
|
1421
|
-
get selectedIndex() {
|
|
1422
|
-
let e = this.view.state.field(Z).selected;
|
|
1423
|
-
if (!e) return -1;
|
|
1424
|
-
for (let t = 0; t < this.items.length; t++) if (this.items[t].diagnostic == e.diagnostic) return t;
|
|
1425
|
-
return -1;
|
|
1426
|
-
}
|
|
1427
|
-
update() {
|
|
1428
|
-
let { diagnostics: e, selected: t } = this.view.state.field(Z), n = 0, r = !1, i = null, a = /* @__PURE__ */ new Set();
|
|
1429
|
-
for (e.between(0, this.view.state.doc.length, (e, o, { spec: s }) => {
|
|
1430
|
-
for (let e of s.diagnostics) {
|
|
1431
|
-
if (a.has(e)) continue;
|
|
1432
|
-
a.add(e);
|
|
1433
|
-
let o = -1, s;
|
|
1434
|
-
for (let t = n; t < this.items.length; t++) if (this.items[t].diagnostic == e) {
|
|
1435
|
-
o = t;
|
|
1436
|
-
break;
|
|
1437
|
-
}
|
|
1438
|
-
o < 0 ? (s = new Mn(this.view, e), this.items.splice(n, 0, s), r = !0) : (s = this.items[o], o > n && (this.items.splice(n, o - n), r = !0)), t && s.diagnostic == t.diagnostic ? s.dom.hasAttribute("aria-selected") || (s.dom.setAttribute("aria-selected", "true"), i = s) : s.dom.hasAttribute("aria-selected") && s.dom.removeAttribute("aria-selected"), n++;
|
|
1439
|
-
}
|
|
1440
|
-
}); n < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0);) r = !0, this.items.pop();
|
|
1441
|
-
this.items.length == 0 && (this.items.push(new Mn(this.view, {
|
|
1442
|
-
from: -1,
|
|
1443
|
-
to: -1,
|
|
1444
|
-
severity: "info",
|
|
1445
|
-
message: this.view.state.phrase("No diagnostics")
|
|
1446
|
-
})), r = !0), i ? (this.list.setAttribute("aria-activedescendant", i.id), this.view.requestMeasure({
|
|
1447
|
-
key: this,
|
|
1448
|
-
read: () => ({
|
|
1449
|
-
sel: i.dom.getBoundingClientRect(),
|
|
1450
|
-
panel: this.list.getBoundingClientRect()
|
|
1451
|
-
}),
|
|
1452
|
-
write: ({ sel: e, panel: t }) => {
|
|
1453
|
-
let n = t.height / this.list.offsetHeight;
|
|
1454
|
-
e.top < t.top ? this.list.scrollTop -= (t.top - e.top) / n : e.bottom > t.bottom && (this.list.scrollTop += (e.bottom - t.bottom) / n);
|
|
1455
|
-
}
|
|
1456
|
-
})) : this.selectedIndex < 0 && this.list.removeAttribute("aria-activedescendant"), r && this.sync();
|
|
1457
|
-
}
|
|
1458
|
-
sync() {
|
|
1459
|
-
let e = this.list.firstChild;
|
|
1460
|
-
function t() {
|
|
1461
|
-
let t = e;
|
|
1462
|
-
e = t.nextSibling, t.remove();
|
|
1463
|
-
}
|
|
1464
|
-
for (let n of this.items) if (n.dom.parentNode == this.list) {
|
|
1465
|
-
for (; e != n.dom;) t();
|
|
1466
|
-
e = n.dom.nextSibling;
|
|
1467
|
-
} else this.list.insertBefore(n.dom, e);
|
|
1468
|
-
for (; e;) t();
|
|
1469
|
-
}
|
|
1470
|
-
moveSelection(e) {
|
|
1471
|
-
if (this.selectedIndex < 0) return;
|
|
1472
|
-
let t = J(this.view.state.field(Z).diagnostics, this.items[e].diagnostic);
|
|
1473
|
-
t && this.view.dispatch({
|
|
1474
|
-
selection: {
|
|
1475
|
-
anchor: t.from,
|
|
1476
|
-
head: t.to
|
|
1477
|
-
},
|
|
1478
|
-
scrollIntoView: !0,
|
|
1479
|
-
effects: vn.of(t)
|
|
1480
|
-
});
|
|
1481
|
-
}
|
|
1482
|
-
static open(t) {
|
|
1483
|
-
return new e(t);
|
|
1484
|
-
}
|
|
1611
|
+
run: Nn,
|
|
1612
|
+
shift: Pn
|
|
1485
1613
|
};
|
|
1486
|
-
function Pn(e, t = "viewBox=\"0 0 40 40\"") {
|
|
1487
|
-
return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`;
|
|
1488
|
-
}
|
|
1489
|
-
function $(e) {
|
|
1490
|
-
return Pn(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`, "width=\"6\" height=\"3\"");
|
|
1491
|
-
}
|
|
1492
|
-
var Fn = /*@__PURE__*/ e.baseTheme({
|
|
1493
|
-
".cm-diagnostic": {
|
|
1494
|
-
padding: "3px 6px 3px 8px",
|
|
1495
|
-
marginLeft: "-1px",
|
|
1496
|
-
display: "block",
|
|
1497
|
-
whiteSpace: "pre-wrap"
|
|
1498
|
-
},
|
|
1499
|
-
".cm-diagnostic-error": { borderLeft: "5px solid #d11" },
|
|
1500
|
-
".cm-diagnostic-warning": { borderLeft: "5px solid orange" },
|
|
1501
|
-
".cm-diagnostic-info": { borderLeft: "5px solid #999" },
|
|
1502
|
-
".cm-diagnostic-hint": { borderLeft: "5px solid #66d" },
|
|
1503
|
-
".cm-diagnosticAction": {
|
|
1504
|
-
font: "inherit",
|
|
1505
|
-
border: "none",
|
|
1506
|
-
padding: "2px 4px",
|
|
1507
|
-
backgroundColor: "#444",
|
|
1508
|
-
color: "white",
|
|
1509
|
-
borderRadius: "3px",
|
|
1510
|
-
marginLeft: "8px",
|
|
1511
|
-
cursor: "pointer"
|
|
1512
|
-
},
|
|
1513
|
-
".cm-diagnosticSource": {
|
|
1514
|
-
fontSize: "70%",
|
|
1515
|
-
opacity: .7
|
|
1516
|
-
},
|
|
1517
|
-
".cm-lintRange": {
|
|
1518
|
-
backgroundPosition: "left bottom",
|
|
1519
|
-
backgroundRepeat: "repeat-x",
|
|
1520
|
-
paddingBottom: "0.7px"
|
|
1521
|
-
},
|
|
1522
|
-
".cm-lintRange-error": { backgroundImage: /*@__PURE__*/ $("#f11") },
|
|
1523
|
-
".cm-lintRange-warning": { backgroundImage: /*@__PURE__*/ $("orange") },
|
|
1524
|
-
".cm-lintRange-info": { backgroundImage: /*@__PURE__*/ $("#999") },
|
|
1525
|
-
".cm-lintRange-hint": { backgroundImage: /*@__PURE__*/ $("#66d") },
|
|
1526
|
-
".cm-lintRange-active": { backgroundColor: "#ffdd9980" },
|
|
1527
|
-
".cm-tooltip-lint": {
|
|
1528
|
-
padding: 0,
|
|
1529
|
-
margin: 0
|
|
1530
|
-
},
|
|
1531
|
-
".cm-lintPoint": {
|
|
1532
|
-
position: "relative",
|
|
1533
|
-
"&:after": {
|
|
1534
|
-
content: "\"\"",
|
|
1535
|
-
position: "absolute",
|
|
1536
|
-
bottom: 0,
|
|
1537
|
-
left: "-2px",
|
|
1538
|
-
borderLeft: "3px solid transparent",
|
|
1539
|
-
borderRight: "3px solid transparent",
|
|
1540
|
-
borderBottom: "4px solid #d11"
|
|
1541
|
-
}
|
|
1542
|
-
},
|
|
1543
|
-
".cm-lintPoint-warning": { "&:after": { borderBottomColor: "orange" } },
|
|
1544
|
-
".cm-lintPoint-info": { "&:after": { borderBottomColor: "#999" } },
|
|
1545
|
-
".cm-lintPoint-hint": { "&:after": { borderBottomColor: "#66d" } },
|
|
1546
|
-
".cm-panel.cm-panel-lint": {
|
|
1547
|
-
position: "relative",
|
|
1548
|
-
"& ul": {
|
|
1549
|
-
maxHeight: "100px",
|
|
1550
|
-
overflowY: "auto",
|
|
1551
|
-
"& [aria-selected]": {
|
|
1552
|
-
backgroundColor: "#ddd",
|
|
1553
|
-
"& u": { textDecoration: "underline" }
|
|
1554
|
-
},
|
|
1555
|
-
"&:focus [aria-selected]": {
|
|
1556
|
-
background_fallback: "#bdf",
|
|
1557
|
-
backgroundColor: "Highlight",
|
|
1558
|
-
color_fallback: "white",
|
|
1559
|
-
color: "HighlightText"
|
|
1560
|
-
},
|
|
1561
|
-
"& u": { textDecoration: "none" },
|
|
1562
|
-
padding: 0,
|
|
1563
|
-
margin: 0
|
|
1564
|
-
},
|
|
1565
|
-
"& [name=close]": {
|
|
1566
|
-
position: "absolute",
|
|
1567
|
-
top: "0",
|
|
1568
|
-
right: "2px",
|
|
1569
|
-
background: "inherit",
|
|
1570
|
-
border: "none",
|
|
1571
|
-
font: "inherit",
|
|
1572
|
-
padding: 0,
|
|
1573
|
-
margin: 0
|
|
1574
|
-
}
|
|
1575
|
-
},
|
|
1576
|
-
"&dark .cm-lintRange-active": { backgroundColor: "#86714a80" },
|
|
1577
|
-
"&dark .cm-panel.cm-panel-lint ul": { "& [aria-selected]": { backgroundColor: "#2e343e" } }
|
|
1578
|
-
});
|
|
1579
|
-
function In(e) {
|
|
1580
|
-
return e == "error" ? 4 : e == "warning" ? 3 : e == "info" ? 2 : 1;
|
|
1581
|
-
}
|
|
1582
|
-
function Ln(e) {
|
|
1583
|
-
let t = "hint", n = 1;
|
|
1584
|
-
for (let r of e) {
|
|
1585
|
-
let e = In(r.severity);
|
|
1586
|
-
e > n && (n = e, t = r.severity);
|
|
1587
|
-
}
|
|
1588
|
-
return t;
|
|
1589
|
-
}
|
|
1590
|
-
var Rn = /*@__PURE__*/ se(bn, { hideOn: hn }), zn = [
|
|
1591
|
-
Z,
|
|
1592
|
-
/*@__PURE__*/ e.decorations.compute([Z], (e) => {
|
|
1593
|
-
let { selected: t, panel: n } = e.field(Z);
|
|
1594
|
-
return !t || !n || t.from == t.to ? v.none : v.set([yn.range(t.from, t.to)]);
|
|
1595
|
-
}),
|
|
1596
|
-
Rn,
|
|
1597
|
-
Fn
|
|
1598
|
-
];
|
|
1599
|
-
function Bn(e, t) {
|
|
1600
|
-
let n = e.field(Z, !1);
|
|
1601
|
-
if (n && n.diagnostics.size) {
|
|
1602
|
-
let e = [], r = [], i = -1;
|
|
1603
|
-
for (let a = c.iter([n.diagnostics]);; a.next()) {
|
|
1604
|
-
for (let n = 0; n < e.length; n++) (!a.value || a.value.spec.diagnostics.indexOf(e[n]) < 0) && (t(e[n], r[n], i), e.splice(n, 1), r.splice(n--, 1));
|
|
1605
|
-
if (!a.value) break;
|
|
1606
|
-
for (let t of a.value.spec.diagnostics) e.indexOf(t) < 0 && (e.push(t), r.push(a.from));
|
|
1607
|
-
i = a.to;
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
1614
|
//#endregion
|
|
1612
|
-
export {
|
|
1615
|
+
export { Bn as a, Ce as c, lt as i, De as l, Xe as n, In as o, Ze as r, Re as s, zn as t, ge as u };
|