@evandu/super-pi 0.1.144 → 0.1.146
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/agents/super-pi-task/core.ts +15 -2
- package/agents/super-pi-task/index.ts +3 -0
- package/dist/.super-pi-check-inputs.json +2 -2
- package/dist/client/.super-pi-client-sources.json +9 -9
- package/dist/client/assets/{CodeMirrorEditor-DfQHX1Hy.js → CodeMirrorEditor-CEwBCVM6.js} +2 -2
- package/dist/client/assets/{dist-Cu3B0JQX.js → dist-76ArZ5M4.js} +1 -1
- package/dist/client/assets/{dist-BEbEv2KM.js → dist-9F1wL-T5.js} +1 -1
- package/dist/client/assets/{dist-BRjyQs_L.js → dist-B0RXZeXQ.js} +1 -1
- package/dist/client/assets/{dist-SzZEAk24.js → dist-BCNaDgNW.js} +1 -1
- package/dist/client/assets/{dist-qAUj_2Ue.js → dist-BXBSIuTD.js} +1 -1
- package/dist/client/assets/{dist-BGBinEie.js → dist-Bh8Q7Y_n.js} +1 -1
- package/dist/client/assets/{dist-DKkMk3XX.js → dist-BoyICDlL.js} +1 -1
- package/dist/client/assets/{dist-ISoxXlmW.js → dist-BuR5Iagd.js} +1 -1
- package/dist/client/assets/{dist-LRNzDUVb.js → dist-Bx6ZWYUW.js} +1 -1
- package/dist/client/assets/{dist-DOvzruAQ.js → dist-CAOcjKAQ.js} +1 -1
- package/dist/client/assets/{dist-CDtFD-PW.js → dist-CHt8PX8R.js} +1 -1
- package/dist/client/assets/{dist-BuPimjY-.js → dist-CSCUT1PQ.js} +1 -1
- package/dist/client/assets/{dist-BsMikSTM.js → dist-CUB_Chdh.js} +1 -1
- package/dist/client/assets/{dist-KQJCVwxy.js → dist-CbVf2Cjn.js} +1 -1
- package/dist/client/assets/{dist-Dnru8_uX.js → dist-DBUqwiWG.js} +1 -1
- package/dist/client/assets/{dist-B8oH6dsc.js → dist-DC1IocrS.js} +1 -1
- package/dist/client/assets/{dist-D7aAMRTb.js → dist-DFMtP3wG.js} +1 -1
- package/dist/client/assets/{dist-Cw_KCDH9.js → dist-DN0GlnnZ.js} +1 -1
- package/dist/client/assets/{dist-BCLhQXYY.js → dist-DftD4ibj.js} +1 -1
- package/dist/client/assets/{dist-CgQ7zaWY.js → dist-Do52MRwm.js} +1 -1
- package/dist/client/assets/{dist-BS-FBUKW.js → dist-JvQIIdqB.js} +1 -1
- package/dist/client/assets/{dist-C5BQsmB7.js → dist-oLq6HXLG.js} +1 -1
- package/dist/client/assets/{index-Xaui0uUI.css → index-D-OxlUxN.css} +1 -1
- package/dist/client/assets/index-E7yaLa2C.js +102 -0
- package/dist/client/index.html +2 -2
- package/dist/server/agents.d.ts +1 -1
- package/dist/server/agents.js +3 -1
- package/dist/server/application/conversation-service.d.ts +1 -1
- package/dist/server/application/conversation-service.js +6 -4
- package/dist/server/application/run-service.d.ts +16 -2
- package/dist/server/application/run-service.js +121 -14
- package/dist/server/application/scheduled-task-service.d.ts +14 -1
- package/dist/server/application/scheduled-task-service.js +27 -2
- package/dist/server/application/session-orchestrator-service.d.ts +11 -2
- package/dist/server/application/session-orchestrator-service.js +103 -27
- package/dist/server/command-handler.js +1 -1
- package/dist/server/conversation-usage.d.ts +19 -0
- package/dist/server/conversation-usage.js +40 -0
- package/dist/server/file-diff.d.ts +3 -0
- package/dist/server/file-diff.js +4 -4
- package/dist/server/file-index.d.ts +4 -2
- package/dist/server/file-index.js +14 -9
- package/dist/server/file-name-index.d.ts +5 -2
- package/dist/server/file-name-index.js +22 -5
- package/dist/server/git.d.ts +3 -3
- package/dist/server/git.js +10 -9
- package/dist/server/http-server.js +195 -33
- package/dist/server/model-context-window.d.ts +46 -0
- package/dist/server/model-context-window.js +121 -0
- package/dist/server/pi-session.d.ts +6 -0
- package/dist/server/pi-session.js +15 -1
- package/dist/server/runtime.d.ts +3 -0
- package/dist/server/runtime.js +21 -6
- package/dist/server/session-cwd.d.ts +17 -0
- package/dist/server/session-cwd.js +43 -0
- package/dist/server/session-ledger.d.ts +7 -0
- package/dist/server/store.d.ts +22 -0
- package/dist/server/store.js +52 -0
- package/dist/server/task-tool.d.ts +2 -1
- package/dist/server/task-tool.js +3 -1
- package/dist/server/terminal.d.ts +1 -0
- package/dist/server/terminal.js +5 -3
- package/dist/server/turn-failure.js +16 -1
- package/dist/server/types.d.ts +18 -0
- package/dist/server/version.d.ts +25 -2
- package/dist/server/version.js +98 -26
- package/dist/server/ws-server.d.ts +1 -1
- package/dist/server/ws-server.js +7 -5
- package/package.json +20 -3
- package/dist/client/assets/index-BLWr70ej.js +0 -100
|
@@ -100,7 +100,9 @@ export const SUPER_PI_CAPABILITIES_SECTION_KEY = "super_pi_capabilities";
|
|
|
100
100
|
*/
|
|
101
101
|
export const SUPER_PI_CAPABILITIES_SECTION = `你运行在 Super Pi(Pi 的 Web 控制面板)里。当用户让你操作 Super Pi 本身的功能时,这样做:
|
|
102
102
|
|
|
103
|
-
- 用户要把文件或资料加入工作区知识库:用 knowledge_import
|
|
103
|
+
- 用户要把文件或资料加入工作区知识库:用 knowledge_import 工具导入(给工作区内的文件路径,或直接给正文和标题)。原生支持文本类(.md/.txt/.csv/.json 等)以及 PDF、Word (.docx)、Excel (.xlsx)、PowerPoint (.pptx/.ppt) 文件直接导入,无需转换脚本。删除知识库文档只有用户能在「设置 → 知识库」里做,不要声称你已经删除。
|
|
104
|
+
- 用户要读写 Office 或 PDF 文档:用 document_read 读取(支持 pdf/docx/xlsx/pptx/ppt,提取为文本)或 document_write 生成新文档(支持 pdf/docx/xlsx/pptx;不支持老 .ppt 生成;修改纯文本用 write 工具)。若涉及飞书云文档链接,用 feishu_doc_read / feishu_doc_write 读写。
|
|
105
|
+
- 用户需要定时或周期性执行任务(如每天定时总结、每隔一段时间检查):用 scheduled_task 工具(action: create/list/update/delete,schedule 支持 once/interval/daily/weekly)。任务会在独立的后台会话中执行,右侧栏「任务」面板可见。
|
|
104
106
|
- 用户要创建一个新的 Agent(比如「帮我开发一个处理 Excel 数据的 agent」):在用户主目录的 .super-pi/agents/ 下新建 <id>.md(Windows 就是 C:\\Users\\<用户名>\\.super-pi\\agents\\)。内容 = YAML frontmatter + 正文,正文就是该 agent 的 system prompt。frontmatter 字段:name(显示名)、description(什么时候用它)、mode(primary=主对话角色,subagent=供 task/workflow 派发的子角色)。例如:
|
|
105
107
|
---
|
|
106
108
|
name: Excel 数据助手
|
|
@@ -1131,6 +1133,7 @@ export async function executeScheduledTask(
|
|
|
1131
1133
|
* `src/server/task-tool.ts` is the other end; `scripts/task-tool.test.mjs` asserts the two copies agree.
|
|
1132
1134
|
*/
|
|
1133
1135
|
export const ORCHESTRATOR_ENDPOINT_ENV = "SUPER_PI_ORCHESTRATOR_ENDPOINT";
|
|
1136
|
+
export const ORCHESTRATOR_WORKSPACE_ENV = "SUPER_PI_ORCHESTRATOR_WORKSPACE";
|
|
1134
1137
|
|
|
1135
1138
|
/** Tool names registered with Pi. */
|
|
1136
1139
|
export const SESSION_SPAWN_TOOL_NAME = "session_spawn";
|
|
@@ -1159,7 +1162,8 @@ Usage notes:
|
|
|
1159
1162
|
1. Spawning is ASYNCHRONOUS by default: it creates the conversation, enqueues the initial task, and returns the new conversationId immediately. The sibling session runs in the background.
|
|
1160
1163
|
2. The initial task should provide clear context and goals since the new session starts with a fresh conversation history.
|
|
1161
1164
|
3. Use session_status with the returned conversationId to check progress, or session_dispatch to send further messages.
|
|
1162
|
-
4. The new session reports completion to its DIRECT parent automatically. 'parentConversationId' optionally selects that parent; by default it is the calling session
|
|
1165
|
+
4. The new session reports completion to its DIRECT parent automatically. 'parentConversationId' optionally selects that parent; by default it is the calling session.
|
|
1166
|
+
5. The new session always belongs to the calling session's workspace. Pass 'cwd' as a workspace-relative subdirectory (for example, 'packages/a') when it should work below the workspace root; absolute paths and traversal are rejected.`;
|
|
1163
1167
|
|
|
1164
1168
|
/** Model-facing description for session_status. */
|
|
1165
1169
|
export const SESSION_STATUS_DESCRIPTION = `Inspect the progress, run state, and latest activity of sibling conversations created by the orchestrator.
|
|
@@ -1228,6 +1232,7 @@ export type OrchestratorSessionSummary = {
|
|
|
1228
1232
|
|
|
1229
1233
|
export type OrchestratorToolConfig = {
|
|
1230
1234
|
endpoint: string;
|
|
1235
|
+
workspaceId: string;
|
|
1231
1236
|
conversationId: string;
|
|
1232
1237
|
parentConversationId?: string;
|
|
1233
1238
|
token?: string;
|
|
@@ -1241,6 +1246,7 @@ export function readOrchestratorConfig(env: Record<string, string | undefined>):
|
|
|
1241
1246
|
const parentConversationId = env[PARENT_CONVERSATION_ENV];
|
|
1242
1247
|
return {
|
|
1243
1248
|
endpoint: env[ORCHESTRATOR_ENDPOINT_ENV] ?? "",
|
|
1249
|
+
workspaceId: env[ORCHESTRATOR_WORKSPACE_ENV] ?? "",
|
|
1244
1250
|
conversationId: env[TASK_CONVERSATION_ENV] ?? "",
|
|
1245
1251
|
...(parentConversationId ? { parentConversationId } : {}),
|
|
1246
1252
|
...(token ? { token } : {}),
|
|
@@ -1255,6 +1261,8 @@ export type SessionSpawnParams = {
|
|
|
1255
1261
|
agentId?: string;
|
|
1256
1262
|
thinkingLevel?: string;
|
|
1257
1263
|
wait?: boolean;
|
|
1264
|
+
/** Optional subdirectory (relative to the resolved workspace root) the new session's cwd should be rooted in. */
|
|
1265
|
+
cwd?: string;
|
|
1258
1266
|
};
|
|
1259
1267
|
|
|
1260
1268
|
export type SessionStatusParams = {
|
|
@@ -1290,6 +1298,9 @@ export async function executeSessionSpawn(
|
|
|
1290
1298
|
if (!config.endpoint) {
|
|
1291
1299
|
return text("The session_spawn tool is not available in this session: SUPER_PI_ORCHESTRATOR_ENDPOINT is not set.", true);
|
|
1292
1300
|
}
|
|
1301
|
+
if (!config.workspaceId) {
|
|
1302
|
+
return text("The session_spawn tool is not available in this session: SUPER_PI_ORCHESTRATOR_WORKSPACE is not set.", true);
|
|
1303
|
+
}
|
|
1293
1304
|
if (!params.task || !params.task.trim()) {
|
|
1294
1305
|
return text("session_spawn requires a non-empty `task` parameter describing what the sibling session should do.", true);
|
|
1295
1306
|
}
|
|
@@ -1304,11 +1315,13 @@ export async function executeSessionSpawn(
|
|
|
1304
1315
|
},
|
|
1305
1316
|
body: JSON.stringify({
|
|
1306
1317
|
action: "spawn",
|
|
1318
|
+
workspaceId: config.workspaceId,
|
|
1307
1319
|
task: params.task.trim(),
|
|
1308
1320
|
title: params.title?.trim() || undefined,
|
|
1309
1321
|
agentId: params.agentId?.trim() || undefined,
|
|
1310
1322
|
thinkingLevel: params.thinkingLevel?.trim() || undefined,
|
|
1311
1323
|
wait: Boolean(params.wait),
|
|
1324
|
+
cwd: params.cwd?.trim() || undefined,
|
|
1312
1325
|
callerConversationId: config.conversationId || undefined,
|
|
1313
1326
|
parentConversationId: params.parentConversationId?.trim() || config.conversationId || undefined,
|
|
1314
1327
|
capability: config.capability,
|
|
@@ -464,6 +464,9 @@ const extension = (pi: ExtensionApi): void => {
|
|
|
464
464
|
wait: Type.Optional(Type.Boolean({
|
|
465
465
|
description: "Whether to await turn completion before returning (default: false, asynchronous).",
|
|
466
466
|
})),
|
|
467
|
+
cwd: Type.Optional(Type.String({
|
|
468
|
+
description: "Optional workspace-root-relative subdirectory (for example, packages/a). Absolute paths, '..' traversal, UNC paths, and escaping symlinks are rejected; omit it to use the workspace root.",
|
|
469
|
+
})),
|
|
467
470
|
});
|
|
468
471
|
|
|
469
472
|
const SessionStatusParameters = Type.Object({
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"hash": "
|
|
2
|
+
"hash": "e744700c40ec7a903b3e20b034b70ed20aac955aa6023fdf8099131ab59cc49f",
|
|
3
3
|
"files": {
|
|
4
|
-
"src/client/App.tsx": "
|
|
4
|
+
"src/client/App.tsx": "e370ca6c86a9b061b699277e346622cd168d53e5c19ead08846ad24799eef47e",
|
|
5
5
|
"src/client/CodeMirrorEditor.tsx": "b6b6479effa1482eda710f04a26f3af843515526e129ca5bc70692cca9074b09",
|
|
6
6
|
"src/client/ErrorBoundary.tsx": "d16376f9f6c7cc1fab8590c65a66438127642f7d6bb8023cec53d8a6cc9f3964",
|
|
7
7
|
"src/client/FeishuPanel.tsx": "52f116eba265bfde683338f5893107ad5559fd2f7d4a9e0df935507a46862a3b",
|
|
8
|
-
"src/client/FilesPanel.tsx": "
|
|
9
|
-
"src/client/GitPanel.tsx": "
|
|
8
|
+
"src/client/FilesPanel.tsx": "820a8685729ab03d22917bc56b7831f5cd8c6534dde4ba2a8d145f4dab5a9293",
|
|
9
|
+
"src/client/GitPanel.tsx": "c684c851820f233e3b755665266d5b9195b1f1b1d4cfdddc72c95a5f98413ed7",
|
|
10
10
|
"src/client/HelpWindow.tsx": "a52005240894911eb8a35efab78aa6ddcda9fef6dca976aafc4255a4f635ca76",
|
|
11
11
|
"src/client/KnowledgeFilePicker.tsx": "8f7eb7e9f70265aed09cc0892b091827976757d8f2a2d736d6ca170fcdd871e7",
|
|
12
12
|
"src/client/KnowledgePanel.tsx": "4f7230cfe610cd86d63aa143c82f6195b3c4208ef0bea703f92104ef27237704",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"src/client/ScheduledTasksPanel.tsx": "83a97794ed99b25a3175ed31ea3fb096976311566b03ddcc975685378d78a217",
|
|
16
16
|
"src/client/SlashCommandMenu.tsx": "69cd0a9d5e35f41f703e91a845e5bd750c952d2957be03b5528e156e60bf6ecb",
|
|
17
17
|
"src/client/Tabs.tsx": "53323a198c0948887cb0cd018284ecd5c9b36025364484a91426f8e1e2198000",
|
|
18
|
-
"src/client/TerminalPanel.tsx": "
|
|
18
|
+
"src/client/TerminalPanel.tsx": "89db360a96c47e4afa7d84bbeada7ab765794a6a28b8c1260f15a71fbf948201",
|
|
19
19
|
"src/client/WorkflowCard.tsx": "8ce5458537a3b02dcbb9bbb4c7afacb07e0f41857ed250aa4cde0cbc8d4bde6c",
|
|
20
|
-
"src/client/editor-blame.ts": "
|
|
20
|
+
"src/client/editor-blame.ts": "d03669f945aca09ff77d100ef0d4f0129af4f8ccef81963c3ce00f8f6fb034c2",
|
|
21
21
|
"src/client/editor-languages.ts": "d5319cfd9b9f3b07c2599ba64ec49a9038304d09fa1702302f3b2b97493d0a69",
|
|
22
22
|
"src/client/errors.ts": "e2e3b417a02eca0870237f5f502041a06a91a56d3d508161b1afca4dd6101889",
|
|
23
23
|
"src/client/file-diff.ts": "b1fd62dd0f561c567f249d98364068c947e31758fa9f1644d27250679e0f62a4",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"src/client/pending-operations.ts": "8a5f9e9711c0f875c8ed194196c218162de5270298dad4091351d41294c859d7",
|
|
28
28
|
"src/client/session-tree.ts": "affc00d2264926d615a38e458a89d3a8c651b74135bbfe004d0a9be9b14a0c86",
|
|
29
29
|
"src/client/slash-commands.ts": "b792018fb67bd9e6f777397b0720b8b3aa565a4d8f7a76f94fec097ddf749480",
|
|
30
|
-
"src/client/styles.css": "
|
|
30
|
+
"src/client/styles.css": "ed619bab79aa716f7dddd8e046ff432c0cb03677899ecc4f4ae1449877c733c9",
|
|
31
31
|
"src/client/terminal-emulator.ts": "ffcc4f5fbddaf25cebcc9e03dbe5d7d0ad2c21586f5d169e57c04c82e2308b3b",
|
|
32
32
|
"src/client/theme.tsx": "5892479a802f41e7d45adeb5170efbf555b240f8581528bcde7bf2d99c635010",
|
|
33
33
|
"src/client/tool-sharing.ts": "679c97f6d40be466964f2f1076aa7ea55f4a585c3deff8214675070220921059",
|
|
34
34
|
"src/client/tools.ts": "58fe41f0edbd490e3fab7f12f258b1dbc2163b653553b03ac61caf1543618e50",
|
|
35
|
-
"src/client/types.ts": "
|
|
35
|
+
"src/client/types.ts": "85997a0aa7553c0aed07fb7920463720770ffe4ab1a760dbfbb0b19abed24534",
|
|
36
36
|
"src/client/vite-env.d.ts": "65996936fbb042915f7b74a200fcdde7e410f32a669b1ab9597cfaa4b0faddb5"
|
|
37
37
|
},
|
|
38
|
-
"recordedAt": "2026-10-
|
|
38
|
+
"recordedAt": "2026-10-31T10:13:46.384Z"
|
|
39
39
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-
|
|
2
|
-
import{a as e,i as t,n,r,s as i,t as a}from"./index-BLWr70ej.js";var o=i(e(),1);async function s(e,t){let[{StreamLanguage:n},i]=await Promise.all([r(()=>import(`./dist-CgQ7zaWY.js`),__vite__mapDeps([0,1,2,3,4,5])),e()]),a=i[t]??i.default??i;return n.define(a)}var c={cpp:()=>r(()=>import(`./dist-DKkMk3XX.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cc:()=>r(()=>import(`./dist-DKkMk3XX.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cxx:()=>r(()=>import(`./dist-DKkMk3XX.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hpp:()=>r(()=>import(`./dist-DKkMk3XX.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hh:()=>r(()=>import(`./dist-DKkMk3XX.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hxx:()=>r(()=>import(`./dist-DKkMk3XX.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),c:()=>r(()=>import(`./dist-DKkMk3XX.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),h:()=>r(()=>import(`./dist-DKkMk3XX.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cu:()=>r(()=>import(`./dist-DKkMk3XX.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cuh:()=>r(()=>import(`./dist-DKkMk3XX.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),js:()=>r(()=>import(`./dist-BsMikSTM.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),jsx:()=>r(()=>import(`./dist-BsMikSTM.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),mjs:()=>r(()=>import(`./dist-BsMikSTM.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cjs:()=>r(()=>import(`./dist-BsMikSTM.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),ts:()=>r(()=>import(`./dist-BsMikSTM.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),tsx:()=>r(()=>import(`./dist-BsMikSTM.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0,jsx:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),mts:()=>r(()=>import(`./dist-BsMikSTM.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cts:()=>r(()=>import(`./dist-BsMikSTM.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),py:()=>r(()=>import(`./dist-BGBinEie.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),pyi:()=>r(()=>import(`./dist-BGBinEie.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),java:()=>r(()=>import(`./dist-KQJCVwxy.js`).then(e=>e.java()),__vite__mapDeps([11,5,2,3,0,1,4,7])),php:()=>r(()=>import(`./dist-BCLhQXYY.js`).then(e=>e.php()),__vite__mapDeps([12,5,2,3,0,1,4,7,13,14,8,9])),sql:()=>r(()=>import(`./dist-CDtFD-PW.js`).then(e=>e.sql()),__vite__mapDeps([15,5,2,3,0,1,4,7,9])),yaml:()=>r(()=>import(`./dist-Cw_KCDH9.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),yml:()=>r(()=>import(`./dist-Cw_KCDH9.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),xml:()=>r(()=>import(`./dist-Cu3B0JQX.js`).then(e=>e.xml()),__vite__mapDeps([17,1,2,3,4,5,0,7])),json:()=>r(()=>import(`./dist-BRjyQs_L.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),jsonc:()=>r(()=>import(`./dist-BRjyQs_L.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),json5:()=>r(()=>import(`./dist-BRjyQs_L.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),html:()=>r(()=>import(`./dist-BS-FBUKW.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),htm:()=>r(()=>import(`./dist-BS-FBUKW.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),vue:()=>r(()=>import(`./dist-BS-FBUKW.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),svelte:()=>r(()=>import(`./dist-BS-FBUKW.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),css:()=>r(()=>import(`./dist-qAUj_2Ue.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([14,2,3,5,0,1,4,7])),md:()=>r(()=>import(`./dist-C5BQsmB7.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),markdown:()=>r(()=>import(`./dist-C5BQsmB7.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),mdx:()=>r(()=>import(`./dist-C5BQsmB7.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),rs:()=>r(()=>import(`./dist-DOvzruAQ.js`).then(e=>e.rust()),__vite__mapDeps([20,5,2,3,0,1,4,7])),go:()=>r(()=>import(`./dist-ISoxXlmW.js`).then(e=>e.go()),__vite__mapDeps([21,5,2,3,0,1,4,7,9])),sh:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),bash:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),zsh:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),fish:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),ps1:()=>s(()=>r(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),psm1:()=>s(()=>r(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),rb:()=>s(()=>r(()=>import(`./ruby-ChfNwlCY.js`),[]),`ruby`),swift:()=>s(()=>r(()=>import(`./swift-DKB6_1j6.js`),[]),`swift`),toml:()=>s(()=>r(()=>import(`./toml-BPTmHmyx.js`),[]),`toml`),ini:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),cfg:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),conf:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),properties:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),dockerfile:()=>s(()=>r(()=>import(`./dockerfile-BDePf5PZ.js`),[]),`dockerfile`),diff:()=>s(()=>r(()=>import(`./diff-ChtP43wD.js`),[]),`diff`),patch:()=>s(()=>r(()=>import(`./diff-ChtP43wD.js`),[]),`diff`)},l={cpp:`C++`,cc:`C++`,cxx:`C++`,hpp:`C++`,hh:`C++`,hxx:`C++`,cu:`CUDA C++`,cuh:`CUDA C++`,c:`C`,h:`C/C++ Header`,js:`JavaScript`,jsx:`JSX`,mjs:`JavaScript`,cjs:`JavaScript`,ts:`TypeScript`,tsx:`TSX`,mts:`TypeScript`,cts:`TypeScript`,py:`Python`,pyi:`Python Stub`,java:`Java`,php:`PHP`,sql:`SQL`,yaml:`YAML`,yml:`YAML`,xml:`XML`,json:`JSON`,jsonc:`JSON with Comments`,json5:`JSON5`,css:`CSS`,md:`Markdown`,markdown:`Markdown`,mdx:`MDX`,rs:`Rust`,go:`Go`,html:`HTML`,htm:`HTML`,vue:`Vue`,svelte:`Svelte`,sh:`Shell`,bash:`Bash`,zsh:`Zsh`,fish:`Fish`,ps1:`PowerShell`,psm1:`PowerShell`,rb:`Ruby`,swift:`Swift`,toml:`TOML`,ini:`INI`,cfg:`Config`,conf:`Config`,properties:`Properties`,dockerfile:`Dockerfile`,diff:`Diff`,patch:`Patch`};function u(e){return c[e.toLowerCase()]}function d(e){return l[e.toLowerCase()]}var f=t(),p=262144,m=131072;function h(e){return e.split(`.`).pop()?.toLowerCase()??``}function g(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function _(e,t){return e.HighlightStyle.define([{tag:t.tags.keyword,color:g(`--cm-keyword`)},{tag:t.tags.string,color:g(`--cm-string`)},{tag:t.tags.number,color:g(`--cm-number`)},{tag:t.tags.comment,color:g(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:g(`--cm-function`)},{tag:t.tags.typeName,color:g(`--cm-type`)},{tag:t.tags.className,color:g(`--cm-type`)},{tag:t.tags.propertyName,color:g(`--cm-property`)},{tag:t.tags.operator,color:g(`--cm-operator`)},{tag:t.tags.variableName,color:g(`--cm-variable`)}])}function v({path:e,value:t,onChange:i,jumpToLine:s,onSave:c,workspaceId:l,blame:g}){let v=(0,o.useRef)(null),y=(0,o.useRef)(null),b=(0,o.useRef)(null),x=(0,o.useRef)(null),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(null),T=(0,o.useRef)(null),E=(0,o.useRef)(i),D=(0,o.useRef)(c);E.current=i,D.current=c;let[O,k]=(0,o.useState)(!1),[A,j]=(0,o.useState)(!1),[M,N]=(0,o.useState)(`0,0`),[P,F]=(0,o.useState)(0);(0,o.useEffect)(()=>{let i=!1,a,o,s,c,l;return(async()=>{try{let d=h(e),f=u(d),[m,g,O,A,M,P,I,L]=await Promise.all([r(()=>import(`./dist-Dnru8_uX.js`).then(e=>e.x),__vite__mapDeps([1,2,3])),r(()=>import(`./dist-SzZEAk24.js`).then(e=>e.s),__vite__mapDeps([4,2,3,1])),r(()=>import(`./dist-BuPimjY-.js`),__vite__mapDeps([22,1,2,3,4,5,0])),r(()=>import(`./dist-BEbEv2KM.js`),__vite__mapDeps([23,1,2,3,4])),r(()=>import(`./dist-CgQ7zaWY.js`),__vite__mapDeps([0,1,2,3,4,5])),r(()=>import(`./dist-LRNzDUVb.js`).then(e=>e.n),__vite__mapDeps([5,2,3])),f?f().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${d}:`,e),null)):Promise.resolve(null),n().catch(e=>(console.warn(`[CodeMirror] Failed to build the blame extension:`,e),null))]);if(i||!v.current)return;c=M,l=P,x.current=m.Annotation.define(),S.current=m.Transaction.addToHistory;let R=t.length<=p&&I!==null;o=new m.Compartment;let z=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),O.history(),g.keymap.of([O.indentWithTab,...O.defaultKeymap,...O.historyKeymap,...A.searchKeymap,{key:`Mod-s`,run:()=>(D.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(x.current&&e.transactions.some(e=>e.annotation(x.current)===!0))&&E.current(e.state.doc.toString()),e.selectionSet&&N(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(L&&(s=new m.Compartment,z.splice(1,0,s.of([])),z.push(L.base)),I)try{z.push(I)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),R=!1}if(R&&o&&c&&l)try{z.push(o.of(c.syntaxHighlighting(_(c,l))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),R=!1}if(a=new g.EditorView({state:m.EditorState.create({doc:t,extensions:z}),parent:v.current}),i){a.destroy();return}y.current=a,k(R),j(!0),C.current=L,w.current=s??null,T.current=null,F(e=>e+1);let B=new MutationObserver(()=>{let e=y.current;if(e&&R&&o&&c&&l)try{e.dispatch({effects:o.reconfigure(c.syntaxHighlighting(_(c,l)))})}catch{}});b.current=B,B.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),i||j(!0)}})(),()=>{i=!0,b.current?.disconnect(),b.current=null,a?.destroy(),y.current=null,j(!1),v.current&&(v.current.textContent=``)}},[e]),(0,o.useEffect)(()=>{let e=y.current;if(!e)return;let n=e.state.doc.toString();n!==t&&e.dispatch({changes:{from:0,to:n.length,insert:t},annotations:x.current?x.current.of(!0):void 0})},[t]),(0,o.useEffect)(()=>{let e=y.current;if(!e||!s)return;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines));e.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0}),e.focus()},[s,A]);let I=!!(g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l);(0,o.useEffect)(()=>{let t=y.current,n=C.current,r=w.current;if(!t||!n||!r)return;let i=g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l?g.response:null,o=i?a(i):null;T.current!==o&&(T.current=o,t.dispatch({effects:[n.setBlame.of(o),r.reconfigure(o?n.gutter:[])]}))},[g?.state,g?.response,g?.path,g?.workspaceId,e,l,P]);let L=y.current?.state.doc.toString()??t,R=L.length<=m?L:L.slice(0,m),z=h(e),B=d(z);return(0,f.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":R,"data-file-content-truncated":L.length>m?`1`:`0`,"data-file-selection":M,"data-file-editor-ready":A?`1`:`0`,"data-file-blame-gutter":I?`1`:void 0,onMouseDown:()=>y.current?.focus(),children:[(0,f.jsx)(`div`,{className:`file-cm`,ref:v,"aria-label":`编辑 ${e}`}),!A&&(0,f.jsx)(`span`,{className:`file-cm-status`,"data-file-editor-loading":`1`,children:`⌛ 正在加载编辑器…`}),A&&!O&&(0,f.jsx)(`span`,{className:`file-cm-status`,"data-file-highlight-status":`plain`,children:`纯文本`}),A&&O&&B&&(0,f.jsx)(`span`,{className:`file-cm-status file-cm-status-lang`,"data-file-highlight-status":z,children:B})]})}export{v as CodeMirrorEditor};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-Do52MRwm.js","assets/dist-DBUqwiWG.js","assets/index-E7yaLa2C.js","assets/index-D-OxlUxN.css","assets/dist-BCNaDgNW.js","assets/dist-Bx6ZWYUW.js","assets/dist-BoyICDlL.js","assets/dist-DFMtP3wG.js","assets/dist-CUB_Chdh.js","assets/dist-DC1IocrS.js","assets/dist-Bh8Q7Y_n.js","assets/dist-CbVf2Cjn.js","assets/dist-DftD4ibj.js","assets/dist-JvQIIdqB.js","assets/dist-BXBSIuTD.js","assets/dist-CHt8PX8R.js","assets/dist-DN0GlnnZ.js","assets/dist-76ArZ5M4.js","assets/dist-B0RXZeXQ.js","assets/dist-oLq6HXLG.js","assets/dist-CAOcjKAQ.js","assets/dist-BuR5Iagd.js","assets/dist-CSCUT1PQ.js","assets/dist-9F1wL-T5.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,i as t,n,r,s as i,t as a}from"./index-E7yaLa2C.js";var o=i(e(),1);async function s(e,t){let[{StreamLanguage:n},i]=await Promise.all([r(()=>import(`./dist-Do52MRwm.js`),__vite__mapDeps([0,1,2,3,4,5])),e()]),a=i[t]??i.default??i;return n.define(a)}var c={cpp:()=>r(()=>import(`./dist-BoyICDlL.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cc:()=>r(()=>import(`./dist-BoyICDlL.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cxx:()=>r(()=>import(`./dist-BoyICDlL.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hpp:()=>r(()=>import(`./dist-BoyICDlL.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hh:()=>r(()=>import(`./dist-BoyICDlL.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hxx:()=>r(()=>import(`./dist-BoyICDlL.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),c:()=>r(()=>import(`./dist-BoyICDlL.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),h:()=>r(()=>import(`./dist-BoyICDlL.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cu:()=>r(()=>import(`./dist-BoyICDlL.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cuh:()=>r(()=>import(`./dist-BoyICDlL.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),js:()=>r(()=>import(`./dist-CUB_Chdh.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),jsx:()=>r(()=>import(`./dist-CUB_Chdh.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),mjs:()=>r(()=>import(`./dist-CUB_Chdh.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cjs:()=>r(()=>import(`./dist-CUB_Chdh.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),ts:()=>r(()=>import(`./dist-CUB_Chdh.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),tsx:()=>r(()=>import(`./dist-CUB_Chdh.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0,jsx:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),mts:()=>r(()=>import(`./dist-CUB_Chdh.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cts:()=>r(()=>import(`./dist-CUB_Chdh.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),py:()=>r(()=>import(`./dist-Bh8Q7Y_n.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),pyi:()=>r(()=>import(`./dist-Bh8Q7Y_n.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),java:()=>r(()=>import(`./dist-CbVf2Cjn.js`).then(e=>e.java()),__vite__mapDeps([11,5,2,3,0,1,4,7])),php:()=>r(()=>import(`./dist-DftD4ibj.js`).then(e=>e.php()),__vite__mapDeps([12,5,2,3,0,1,4,7,13,14,8,9])),sql:()=>r(()=>import(`./dist-CHt8PX8R.js`).then(e=>e.sql()),__vite__mapDeps([15,5,2,3,0,1,4,7,9])),yaml:()=>r(()=>import(`./dist-DN0GlnnZ.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),yml:()=>r(()=>import(`./dist-DN0GlnnZ.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),xml:()=>r(()=>import(`./dist-76ArZ5M4.js`).then(e=>e.xml()),__vite__mapDeps([17,1,2,3,4,5,0,7])),json:()=>r(()=>import(`./dist-B0RXZeXQ.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),jsonc:()=>r(()=>import(`./dist-B0RXZeXQ.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),json5:()=>r(()=>import(`./dist-B0RXZeXQ.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),html:()=>r(()=>import(`./dist-JvQIIdqB.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),htm:()=>r(()=>import(`./dist-JvQIIdqB.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),vue:()=>r(()=>import(`./dist-JvQIIdqB.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),svelte:()=>r(()=>import(`./dist-JvQIIdqB.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),css:()=>r(()=>import(`./dist-BXBSIuTD.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([14,2,3,5,0,1,4,7])),md:()=>r(()=>import(`./dist-oLq6HXLG.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),markdown:()=>r(()=>import(`./dist-oLq6HXLG.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),mdx:()=>r(()=>import(`./dist-oLq6HXLG.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),rs:()=>r(()=>import(`./dist-CAOcjKAQ.js`).then(e=>e.rust()),__vite__mapDeps([20,5,2,3,0,1,4,7])),go:()=>r(()=>import(`./dist-BuR5Iagd.js`).then(e=>e.go()),__vite__mapDeps([21,5,2,3,0,1,4,7,9])),sh:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),bash:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),zsh:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),fish:()=>s(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),ps1:()=>s(()=>r(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),psm1:()=>s(()=>r(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),rb:()=>s(()=>r(()=>import(`./ruby-ChfNwlCY.js`),[]),`ruby`),swift:()=>s(()=>r(()=>import(`./swift-DKB6_1j6.js`),[]),`swift`),toml:()=>s(()=>r(()=>import(`./toml-BPTmHmyx.js`),[]),`toml`),ini:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),cfg:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),conf:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),properties:()=>s(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),dockerfile:()=>s(()=>r(()=>import(`./dockerfile-BDePf5PZ.js`),[]),`dockerfile`),diff:()=>s(()=>r(()=>import(`./diff-ChtP43wD.js`),[]),`diff`),patch:()=>s(()=>r(()=>import(`./diff-ChtP43wD.js`),[]),`diff`)},l={cpp:`C++`,cc:`C++`,cxx:`C++`,hpp:`C++`,hh:`C++`,hxx:`C++`,cu:`CUDA C++`,cuh:`CUDA C++`,c:`C`,h:`C/C++ Header`,js:`JavaScript`,jsx:`JSX`,mjs:`JavaScript`,cjs:`JavaScript`,ts:`TypeScript`,tsx:`TSX`,mts:`TypeScript`,cts:`TypeScript`,py:`Python`,pyi:`Python Stub`,java:`Java`,php:`PHP`,sql:`SQL`,yaml:`YAML`,yml:`YAML`,xml:`XML`,json:`JSON`,jsonc:`JSON with Comments`,json5:`JSON5`,css:`CSS`,md:`Markdown`,markdown:`Markdown`,mdx:`MDX`,rs:`Rust`,go:`Go`,html:`HTML`,htm:`HTML`,vue:`Vue`,svelte:`Svelte`,sh:`Shell`,bash:`Bash`,zsh:`Zsh`,fish:`Fish`,ps1:`PowerShell`,psm1:`PowerShell`,rb:`Ruby`,swift:`Swift`,toml:`TOML`,ini:`INI`,cfg:`Config`,conf:`Config`,properties:`Properties`,dockerfile:`Dockerfile`,diff:`Diff`,patch:`Patch`};function u(e){return c[e.toLowerCase()]}function d(e){return l[e.toLowerCase()]}var f=t(),p=262144,m=131072;function h(e){return e.split(`.`).pop()?.toLowerCase()??``}function g(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function _(e,t){return e.HighlightStyle.define([{tag:t.tags.keyword,color:g(`--cm-keyword`)},{tag:t.tags.string,color:g(`--cm-string`)},{tag:t.tags.number,color:g(`--cm-number`)},{tag:t.tags.comment,color:g(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:g(`--cm-function`)},{tag:t.tags.typeName,color:g(`--cm-type`)},{tag:t.tags.className,color:g(`--cm-type`)},{tag:t.tags.propertyName,color:g(`--cm-property`)},{tag:t.tags.operator,color:g(`--cm-operator`)},{tag:t.tags.variableName,color:g(`--cm-variable`)}])}function v({path:e,value:t,onChange:i,jumpToLine:s,onSave:c,workspaceId:l,blame:g}){let v=(0,o.useRef)(null),y=(0,o.useRef)(null),b=(0,o.useRef)(null),x=(0,o.useRef)(null),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(null),T=(0,o.useRef)(null),E=(0,o.useRef)(i),D=(0,o.useRef)(c);E.current=i,D.current=c;let[O,k]=(0,o.useState)(!1),[A,j]=(0,o.useState)(!1),[M,N]=(0,o.useState)(`0,0`),[P,F]=(0,o.useState)(0);(0,o.useEffect)(()=>{let i=!1,a,o,s,c,l;return(async()=>{try{let d=h(e),f=u(d),[m,g,O,A,M,P,I,L]=await Promise.all([r(()=>import(`./dist-DBUqwiWG.js`).then(e=>e.x),__vite__mapDeps([1,2,3])),r(()=>import(`./dist-BCNaDgNW.js`).then(e=>e.s),__vite__mapDeps([4,2,3,1])),r(()=>import(`./dist-CSCUT1PQ.js`),__vite__mapDeps([22,1,2,3,4,5,0])),r(()=>import(`./dist-9F1wL-T5.js`),__vite__mapDeps([23,1,2,3,4])),r(()=>import(`./dist-Do52MRwm.js`),__vite__mapDeps([0,1,2,3,4,5])),r(()=>import(`./dist-Bx6ZWYUW.js`).then(e=>e.n),__vite__mapDeps([5,2,3])),f?f().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${d}:`,e),null)):Promise.resolve(null),n().catch(e=>(console.warn(`[CodeMirror] Failed to build the blame extension:`,e),null))]);if(i||!v.current)return;c=M,l=P,x.current=m.Annotation.define(),S.current=m.Transaction.addToHistory;let R=t.length<=p&&I!==null;o=new m.Compartment;let z=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),O.history(),g.keymap.of([O.indentWithTab,...O.defaultKeymap,...O.historyKeymap,...A.searchKeymap,{key:`Mod-s`,run:()=>(D.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(x.current&&e.transactions.some(e=>e.annotation(x.current)===!0))&&E.current(e.state.doc.toString()),e.selectionSet&&N(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(L&&(s=new m.Compartment,z.splice(1,0,s.of([])),z.push(L.base)),I)try{z.push(I)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),R=!1}if(R&&o&&c&&l)try{z.push(o.of(c.syntaxHighlighting(_(c,l))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),R=!1}if(a=new g.EditorView({state:m.EditorState.create({doc:t,extensions:z}),parent:v.current}),i){a.destroy();return}y.current=a,k(R),j(!0),C.current=L,w.current=s??null,T.current=null,F(e=>e+1);let B=new MutationObserver(()=>{let e=y.current;if(e&&R&&o&&c&&l)try{e.dispatch({effects:o.reconfigure(c.syntaxHighlighting(_(c,l)))})}catch{}});b.current=B,B.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),i||j(!0)}})(),()=>{i=!0,b.current?.disconnect(),b.current=null,a?.destroy(),y.current=null,j(!1),v.current&&(v.current.textContent=``)}},[e]),(0,o.useEffect)(()=>{let e=y.current;if(!e)return;let n=e.state.doc.toString();n!==t&&e.dispatch({changes:{from:0,to:n.length,insert:t},annotations:x.current?x.current.of(!0):void 0})},[t]),(0,o.useEffect)(()=>{let e=y.current;if(!e||!s)return;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines));e.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0}),e.focus()},[s,A]);let I=!!(g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l);(0,o.useEffect)(()=>{let t=y.current,n=C.current,r=w.current;if(!t||!n||!r)return;let i=g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l?g.response:null,o=i?a(i):null;T.current!==o&&(T.current=o,t.dispatch({effects:[n.setBlame.of(o),r.reconfigure(o?n.gutter:[])]}))},[g?.state,g?.response,g?.path,g?.workspaceId,e,l,P]);let L=y.current?.state.doc.toString()??t,R=L.length<=m?L:L.slice(0,m),z=h(e),B=d(z);return(0,f.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":R,"data-file-content-truncated":L.length>m?`1`:`0`,"data-file-selection":M,"data-file-editor-ready":A?`1`:`0`,"data-file-blame-gutter":I?`1`:void 0,onMouseDown:()=>y.current?.focus(),children:[(0,f.jsx)(`div`,{className:`file-cm`,ref:v,"aria-label":`编辑 ${e}`}),!A&&(0,f.jsx)(`span`,{className:`file-cm-status`,"data-file-editor-loading":`1`,children:`⌛ 正在加载编辑器…`}),A&&!O&&(0,f.jsx)(`span`,{className:`file-cm-status`,"data-file-highlight-status":`plain`,children:`纯文本`}),A&&O&&B&&(0,f.jsx)(`span`,{className:`file-cm-status file-cm-status-lang`,"data-file-highlight-status":z,children:B})]})}export{v as CodeMirrorEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./dist-Dnru8_uX.js";import{r as t}from"./dist-SzZEAk24.js";import{i as n,o as r}from"./dist-LRNzDUVb.js";import{LRLanguage as i,LanguageSupport as a,bracketMatchingHandle as o,foldNodeProp as s,indentNodeProp as c,syntaxTree as l}from"./dist-CgQ7zaWY.js";import{n as u,r as d,t as f}from"./dist-D7aAMRTb.js";var p=1,m=2,h=3,g=4,_=5,v=36,y=37,b=38,x=11,S=13;function C(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}function w(e){return e==9||e==10||e==13||e==32}var T=null,E=null,D=0;function O(e,t){let n=e.pos+t;if(E==e&&D==n)return T;for(;w(e.peek(t));)t++;let r=``;for(;;){let n=e.peek(t);if(!C(n))break;r+=String.fromCharCode(n),t++}return E=e,D=n,T=r||null}function k(e,t){this.name=e,this.parent=t}var A=new f({start:null,shift(e,t,n,r){return t==p?new k(O(r,1)||``,e):e},reduce(e,t){return t==x&&e?e.parent:e},reuse(e,t,n,r){let i=t.type.id;return i==p||i==S?new k(O(r,1)||``,e):e},strict:!1}),j=new u((e,t)=>{if(e.next==60){if(e.advance(),e.next==47){e.advance();let n=O(e,0);if(!n)return e.acceptToken(_);if(t.context&&n==t.context.name)return e.acceptToken(m);for(let r=t.context;r;r=r.parent)if(r.name==n)return e.acceptToken(h,-2);e.acceptToken(g)}else if(e.next!=33&&e.next!=63)return e.acceptToken(p)}},{contextual:!0});function M(e,t){return new u(n=>{let r=0,i=t.charCodeAt(0);scan:for(;!(n.next<0);n.advance(),r++)if(n.next==i){for(let e=1;e<t.length;e++)if(n.peek(e)!=t.charCodeAt(e))continue scan;break}r&&n.acceptToken(e)})}var N=M(v,`-->`),P=M(y,`?>`),F=M(b,`]]>`),I=n({Text:r.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":r.angleBracket,TagName:r.tagName,"MismatchedCloseTag/TagName":[r.tagName,r.invalid],AttributeName:r.attributeName,AttributeValue:r.attributeValue,Is:r.definitionOperator,"EntityReference CharacterReference":r.character,Comment:r.blockComment,ProcessingInst:r.processingInstruction,DoctypeDecl:r.documentMeta,Cdata:r.special(r.string)}),L=d.deserialize({version:14,states:",lOQOaOOOrOxO'#CfOzOpO'#CiO!tOaO'#CgOOOP'#Cg'#CgO!{OrO'#CrO#TOtO'#CsO#]OpO'#CtOOOP'#DT'#DTOOOP'#Cv'#CvQQOaOOOOOW'#Cw'#CwO#eOxO,59QOOOP,59Q,59QOOOO'#Cx'#CxO#mOpO,59TO#uO!bO,59TOOOP'#C|'#C|O$TOaO,59RO$[OpO'#CoOOOP,59R,59ROOOQ'#C}'#C}O$dOrO,59^OOOP,59^,59^OOOS'#DO'#DOO$lOtO,59_OOOP,59_,59_O$tOpO,59`O$|OpO,59`OOOP-E6t-E6tOOOW-E6u-E6uOOOP1G.l1G.lOOOO-E6v-E6vO%UO!bO1G.oO%UO!bO1G.oO%dOpO'#CkO%lO!bO'#CyO%zO!bO1G.oOOOP1G.o1G.oOOOP1G.w1G.wOOOP-E6z-E6zOOOP1G.m1G.mO&VOpO,59ZO&_OpO,59ZOOOQ-E6{-E6{OOOP1G.x1G.xOOOS-E6|-E6|OOOP1G.y1G.yO&gOpO1G.zO&gOpO1G.zOOOP1G.z1G.zO&oO!bO7+$ZO&}O!bO7+$ZOOOP7+$Z7+$ZOOOP7+$c7+$cO'YOpO,59VO'bOpO,59VO'mO!bO,59eOOOO-E6w-E6wO'{OpO1G.uO'{OpO1G.uOOOP1G.u1G.uO(TOpO7+$fOOOP7+$f7+$fO(]O!bO<<GuOOOP<<Gu<<GuOOOP<<G}<<G}O'bOpO1G.qO'bOpO1G.qO(hO#tO'#CnO(vO&jO'#CnOOOO1G.q1G.qO)UOpO7+$aOOOP7+$a7+$aOOOP<<HQ<<HQOOOPAN=aAN=aOOOPAN=iAN=iO'bOpO7+$]OOOO7+$]7+$]OOOO'#Cz'#CzO)^O#tO,59YOOOO,59Y,59YOOOO'#C{'#C{O)lO&jO,59YOOOP<<G{<<G{OOOO<<Gw<<GwOOOO-E6x-E6xOOOO1G.t1G.tOOOO-E6y-E6y",stateData:")z~OPQOSVOTWOVWOWWOXWOiXOyPO!QTO!SUO~OvZOx]O~O^`Oz^O~OPQOQcOSVOTWOVWOWWOXWOyPO!QTO!SUO~ORdO~P!SOteO!PgO~OuhO!RjO~O^lOz^O~OvZOxoO~O^qOz^O~O[vO`sOdwOz^O~ORyO~P!SO^{Oz^O~OteO!P}O~OuhO!R!PO~O^!QOz^O~O[!SOz^O~O[!VO`sOd!WOz^O~Oa!YOz^O~Oz^O[mX`mXdmX~O[!VO`sOd!WO~O^!]Oz^O~O[!_Oz^O~O[!aOz^O~O[!cO`sOd!dOz^O~O[!cO`sOd!dO~Oa!eOz^O~Oz^O{!gO}!hO~Oz^O[ma`madma~O[!kOz^O~O[!lOz^O~O[!mO`sOd!nO~OW!qOX!qO{!sO|!qO~OW!tOX!tO}!sO!O!tO~O[!vOz^O~OW!qOX!qO{!yO|!qO~OW!tOX!tO}!yO!O!tO~O",goto:"%cxPPPPPPPPPPyyP!PP!VPP!`!jP!pyyyP!v!|#S$[$k$q$w$}%TPPPP%ZXWORYbXRORYb_t`qru!T!U!bQ!i!YS!p!e!fR!w!oQdRRybXSORYbQYORmYQ[PRn[Q_QQkVjp_krz!R!T!X!Z!^!`!f!j!oQr`QzcQ!RlQ!TqQ!XsQ!ZtQ!^{Q!`!QQ!f!YQ!j!]R!o!eQu`S!UqrU![u!U!bR!b!TQ!r!gR!x!rQ!u!hR!z!uQbRRxbQfTR|fQiUR!OiSXOYTaRb",nodeNames:`⚠ StartTag StartCloseTag MissingCloseTag StartCloseTag StartCloseTag Document Text EntityReference CharacterReference Cdata Element EndTag OpenTag TagName Attribute AttributeName Is AttributeValue CloseTag SelfCloseEndTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag DoctypeDecl`,maxTerm:50,context:A,nodeProps:[[`closedBy`,1,`SelfCloseEndTag EndTag`,13,`CloseTag MissingCloseTag`],[`openedBy`,12,`StartTag StartCloseTag`,19,`OpenTag`,20,`StartTag`],[`isolate`,-6,13,18,19,21,22,24,``]],propSources:[I],skippedNodes:[0],repeatNodeCount:9,tokenData:"!)v~R!YOX$qXY)iYZ)iZ]$q]^)i^p$qpq)iqr$qrs*vsv$qvw+fwx/ix}$q}!O0[!O!P$q!P!Q2z!Q![$q![!]4n!]!^$q!^!_8U!_!`!#t!`!a!$l!a!b!%d!b!c$q!c!}4n!}#P$q#P#Q!'W#Q#R$q#R#S4n#S#T$q#T#o4n#o%W$q%W%o4n%o%p$q%p&a4n&a&b$q&b1p4n1p4U$q4U4d4n4d4e$q4e$IS4n$IS$I`$q$I`$Ib4n$Ib$Kh$q$Kh%#t4n%#t&/x$q&/x&Et4n&Et&FV$q&FV;'S4n;'S;:j8O;:j;=`)c<%l?&r$q?&r?Ah4n?Ah?BY$q?BY?Mn4n?MnO$qi$zXVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qa%nVVP!O`Ov%gwx&Tx!^%g!^!_&o!_;'S%g;'S;=`'W<%lO%gP&YTVPOv&Tw!^&T!_;'S&T;'S;=`&i<%lO&TP&lP;=`<%l&T`&tS!O`Ov&ox;'S&o;'S;=`'Q<%lO&o`'TP;=`<%l&oa'ZP;=`<%l%gX'eWVP|WOr'^rs&Tsv'^w!^'^!^!_'}!_;'S'^;'S;=`(i<%lO'^W(ST|WOr'}sv'}w;'S'};'S;=`(c<%lO'}W(fP;=`<%l'}X(lP;=`<%l'^h(vV|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oh)`P;=`<%l(oi)fP;=`<%l$qo)t`VP|W!O`zUOX$qXY)iYZ)iZ]$q]^)i^p$qpq)iqr$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk+PV{YVP!O`Ov%gwx&Tx!^%g!^!_&o!_;'S%g;'S;=`'W<%lO%g~+iast,n![!]-r!c!}-r#R#S-r#T#o-r%W%o-r%p&a-r&b1p-r4U4d-r4e$IS-r$I`$Ib-r$Kh%#t-r&/x&Et-r&FV;'S-r;'S;:j/c?&r?Ah-r?BY?Mn-r~,qQ!Q![,w#l#m-V~,zQ!Q![,w!]!^-Q~-VOX~~-YR!Q![-c!c!i-c#T#Z-c~-fS!Q![-c!]!^-Q!c!i-c#T#Z-c~-ug}!O-r!O!P-r!Q![-r![!]-r!]!^/^!c!}-r#R#S-r#T#o-r$}%O-r%W%o-r%p&a-r&b1p-r1p4U-r4U4d-r4e$IS-r$I`$Ib-r$Je$Jg-r$Kh%#t-r&/x&Et-r&FV;'S-r;'S;:j/c?&r?Ah-r?BY?Mn-r~/cOW~~/fP;=`<%l-rk/rW}bVP|WOr'^rs&Tsv'^w!^'^!^!_'}!_;'S'^;'S;=`(i<%lO'^k0eZVP|W!O`Or$qrs%gsv$qwx'^x}$q}!O1W!O!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk1aZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a2S!a;'S$q;'S;=`)c<%lO$qk2_X!PQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qm3TZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a3v!a;'S$q;'S;=`)c<%lO$qm4RXdSVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qo4{!P`S^QVP|W!O`Or$qrs%gsv$qwx'^x}$q}!O4n!O!P4n!P!Q$q!Q![4n![!]4n!]!^$q!^!_(o!_!c$q!c!}4n!}#R$q#R#S4n#S#T$q#T#o4n#o$}$q$}%O4n%O%W$q%W%o4n%o%p$q%p&a4n&a&b$q&b1p4n1p4U4n4U4d4n4d4e$q4e$IS4n$IS$I`$q$I`$Ib4n$Ib$Je$q$Je$Jg4n$Jg$Kh$q$Kh%#t4n%#t&/x$q&/x&Et4n&Et&FV$q&FV;'S4n;'S;:j8O;:j;=`)c<%l?&r$q?&r?Ah4n?Ah?BY$q?BY?Mn4n?MnO$qo8RP;=`<%l4ni8]Y|W!O`Oq(oqr8{rs&osv(owx'}x!a(o!a!b!#U!b;'S(o;'S;=`)]<%lO(oi9S_|W!O`Or(ors&osv(owx'}x}(o}!O:R!O!f(o!f!g;e!g!}(o!}#ODh#O#W(o#W#XLp#X;'S(o;'S;=`)]<%lO(oi:YX|W!O`Or(ors&osv(owx'}x}(o}!O:u!O;'S(o;'S;=`)]<%lO(oi;OV!QP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oi;lX|W!O`Or(ors&osv(owx'}x!q(o!q!r<X!r;'S(o;'S;=`)]<%lO(oi<`X|W!O`Or(ors&osv(owx'}x!e(o!e!f<{!f;'S(o;'S;=`)]<%lO(oi=SX|W!O`Or(ors&osv(owx'}x!v(o!v!w=o!w;'S(o;'S;=`)]<%lO(oi=vX|W!O`Or(ors&osv(owx'}x!{(o!{!|>c!|;'S(o;'S;=`)]<%lO(oi>jX|W!O`Or(ors&osv(owx'}x!r(o!r!s?V!s;'S(o;'S;=`)]<%lO(oi?^X|W!O`Or(ors&osv(owx'}x!g(o!g!h?y!h;'S(o;'S;=`)]<%lO(oi@QY|W!O`Or?yrs@psv?yvwA[wxBdx!`?y!`!aCr!a;'S?y;'S;=`Db<%lO?ya@uV!O`Ov@pvxA[x!`@p!`!aAy!a;'S@p;'S;=`B^<%lO@pPA_TO!`A[!`!aAn!a;'SA[;'S;=`As<%lOA[PAsOiPPAvP;=`<%lA[aBQSiP!O`Ov&ox;'S&o;'S;=`'Q<%lO&oaBaP;=`<%l@pXBiX|WOrBdrsA[svBdvwA[w!`Bd!`!aCU!a;'SBd;'S;=`Cl<%lOBdXC]TiP|WOr'}sv'}w;'S'};'S;=`(c<%lO'}XCoP;=`<%lBdiC{ViP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oiDeP;=`<%l?yiDoZ|W!O`Or(ors&osv(owx'}x!e(o!e!fEb!f#V(o#V#WIr#W;'S(o;'S;=`)]<%lO(oiEiX|W!O`Or(ors&osv(owx'}x!f(o!f!gFU!g;'S(o;'S;=`)]<%lO(oiF]X|W!O`Or(ors&osv(owx'}x!c(o!c!dFx!d;'S(o;'S;=`)]<%lO(oiGPX|W!O`Or(ors&osv(owx'}x!v(o!v!wGl!w;'S(o;'S;=`)]<%lO(oiGsX|W!O`Or(ors&osv(owx'}x!c(o!c!dH`!d;'S(o;'S;=`)]<%lO(oiHgX|W!O`Or(ors&osv(owx'}x!}(o!}#OIS#O;'S(o;'S;=`)]<%lO(oiI]V|W!O`yPOr(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oiIyX|W!O`Or(ors&osv(owx'}x#W(o#W#XJf#X;'S(o;'S;=`)]<%lO(oiJmX|W!O`Or(ors&osv(owx'}x#T(o#T#UKY#U;'S(o;'S;=`)]<%lO(oiKaX|W!O`Or(ors&osv(owx'}x#h(o#h#iK|#i;'S(o;'S;=`)]<%lO(oiLTX|W!O`Or(ors&osv(owx'}x#T(o#T#UH`#U;'S(o;'S;=`)]<%lO(oiLwX|W!O`Or(ors&osv(owx'}x#c(o#c#dMd#d;'S(o;'S;=`)]<%lO(oiMkX|W!O`Or(ors&osv(owx'}x#V(o#V#WNW#W;'S(o;'S;=`)]<%lO(oiN_X|W!O`Or(ors&osv(owx'}x#h(o#h#iNz#i;'S(o;'S;=`)]<%lO(oi! RX|W!O`Or(ors&osv(owx'}x#m(o#m#n! n#n;'S(o;'S;=`)]<%lO(oi! uX|W!O`Or(ors&osv(owx'}x#d(o#d#e!!b#e;'S(o;'S;=`)]<%lO(oi!!iX|W!O`Or(ors&osv(owx'}x#X(o#X#Y?y#Y;'S(o;'S;=`)]<%lO(oi!#_V!SP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(ok!$PXaQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qo!$wX[UVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!%mZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!&`!a;'S$q;'S;=`)c<%lO$qk!&kX!RQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!'aZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_#P$q#P#Q!(S#Q;'S$q;'S;=`)c<%lO$qk!(]ZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!)O!a;'S$q;'S;=`)c<%lO$qk!)ZXxQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$q",tokenizers:[j,N,P,F,0,1,2,3,4],topRules:{Document:[0,6]},tokenPrec:0});function R(e,t){let n=t&&t.getChild(`TagName`);return n?e.sliceString(n.from,n.to):``}function z(e,t){let n=t&&t.firstChild;return!n||n.name!=`OpenTag`?``:R(e,n)}function B(e,t,n){let r=t&&t.getChildren(`Attribute`).find(e=>e.from<=n&&e.to>=n),i=r&&r.getChild(`AttributeName`);return i?e.sliceString(i.from,i.to):``}function V(e){for(let t=e&&e.parent;t;t=t.parent)if(t.name==`Element`)return t;return null}function H(e,t){let n=l(e).resolveInner(t,-1),r=null;for(let e=n;!r&&e.parent;e=e.parent)(e.name==`OpenTag`||e.name==`CloseTag`||e.name==`SelfClosingTag`||e.name==`MismatchedCloseTag`)&&(r=e);if(r&&(r.to>t||r.lastChild.type.isError)){let e=r.parent;if(n.name==`TagName`)return r.name==`CloseTag`||r.name==`MismatchedCloseTag`?{type:`closeTag`,from:n.from,context:e}:{type:`openTag`,from:n.from,context:V(e)};if(n.name==`AttributeName`)return{type:`attrName`,from:n.from,context:r};if(n.name==`AttributeValue`)return{type:`attrValue`,from:n.from,context:r};let i=n==r||n.name==`Attribute`?n.childBefore(t):n;return i?.name==`StartTag`?{type:`openTag`,from:t,context:V(e)}:i?.name==`StartCloseTag`&&i.to<=t?{type:`closeTag`,from:t,context:e}:i?.name==`Is`?{type:`attrValue`,from:t,context:r}:i?{type:`attrName`,from:t,context:r}:null}if(n.name==`StartCloseTag`)return{type:`closeTag`,from:t,context:n.parent};for(;n.parent&&n.to==t&&!n.lastChild?.type.isError;)n=n.parent;return n.name==`Element`||n.name==`Text`||n.name==`Document`?{type:`tag`,from:t,context:n.name==`Element`?n:V(n)}:null}var U=class{constructor(e,t,n){this.attrs=t,this.attrValues=n,this.children=[],this.name=e.name,this.completion=Object.assign(Object.assign({type:`type`},e.completion||{}),{label:this.name}),this.openCompletion=Object.assign(Object.assign({},this.completion),{label:`<`+this.name}),this.closeCompletion=Object.assign(Object.assign({},this.completion),{label:`</`+this.name+`>`,boost:2}),this.closeNameCompletion=Object.assign(Object.assign({},this.completion),{label:this.name+`>`}),this.text=e.textContent?e.textContent.map(e=>({label:e,type:`text`})):[]}},W=/^[:\-\.\w\u00b7-\uffff]*$/;function G(e){return Object.assign(Object.assign({type:`property`},e.completion||{}),{label:e.name})}function K(e){return typeof e==`string`?{label:`"${e}"`,type:`constant`}:/^"/.test(e.label)?e:Object.assign(Object.assign({},e),{label:`"${e.label}"`})}function q(e,t){let n=[],r=[],i=Object.create(null);for(let e of t){let t=G(e);n.push(t),e.global&&r.push(t),e.values&&(i[e.name]=e.values.map(K))}let a=[],o=[],s=Object.create(null);for(let t of e){let e=r,c=i;t.attributes&&(e=e.concat(t.attributes.map(e=>typeof e==`string`?n.find(t=>t.label==e)||{label:e,type:`property`}:(e.values&&(c==i&&(c=Object.create(c)),c[e.name]=e.values.map(K)),G(e)))));let l=new U(t,e,c);s[l.name]=l,a.push(l),t.top&&o.push(l)}o.length||(o=a);for(let t=0;t<a.length;t++){let n=e[t],r=a[t];if(n.children)for(let e of n.children)s[e]&&r.children.push(s[e]);else r.children=a}return e=>{let{doc:t}=e.state,n=H(e.state,e.pos);if(!n||n.type==`tag`&&!e.explicit)return null;let{type:c,from:l,context:u}=n;if(c==`openTag`){let e=o,n=z(t,u);return n&&(e=s[n]?.children||a),{from:l,options:e.map(e=>e.completion),validFor:W}}if(c==`closeTag`){let n=z(t,u);return n?{from:l,to:e.pos+ +(t.sliceString(e.pos,e.pos+1)==`>`),options:[s[n]?.closeNameCompletion||{label:n+`>`,type:`type`}],validFor:W}:null}if(c==`attrName`)return{from:l,options:s[R(t,u)]?.attrs||r,validFor:W};if(c==`attrValue`){let n=B(t,u,l);if(!n)return null;let r=(s[R(t,u)]?.attrValues||i)[n];return!r||!r.length?null:{from:l,to:e.pos+ +(t.sliceString(e.pos,e.pos+1)==`"`),options:r,validFor:/^"[^"]*"?$/}}if(c==`tag`){let n=z(t,u),r=s[n],i=[],c=u&&u.lastChild;n&&(!c||c.name!=`CloseTag`||R(t,c)!=n)&&i.push(r?r.closeCompletion:{label:`</`+n+`>`,type:`type`,boost:2});let d=i.concat((r?.children||(u?a:o)).map(e=>e.openCompletion));if(u&&r?.text.length){let t=u.firstChild;t.to>e.pos-20&&!/\S/.test(e.state.sliceDoc(t.to,e.pos))&&(d=d.concat(r.text))}return{from:l,options:d,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}return null}}var J=i.define({name:`xml`,parser:L.configure({props:[c.add({Element(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),s.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!=`OpenTag`?null:{from:t.to,to:n.name==`CloseTag`?n.from:e.to}}}),o.add({"OpenTag CloseTag":e=>e.getChild(`TagName`)})]}),languageData:{commentTokens:{block:{open:`<!--`,close:`-->`}},indentOnInput:/^\s*<\/$/}});function Y(e={}){let t=[J.data.of({autocomplete:q(e.elements||[],e.attributes||[])})];return e.autoCloseTags!==!1&&t.push(Z),new a(J,t)}function X(e,t,n=e.length){if(!t)return``;let r=t.firstChild,i=r&&r.getChild(`TagName`);return i?e.sliceString(i.from,Math.min(i.to,n)):``}var Z=t.inputHandler.of((t,n,r,i,a)=>{if(t.composing||t.state.readOnly||n!=r||i!=`>`&&i!=`/`||!J.isActiveAt(t.state,n,-1))return!1;let o=a(),{state:s}=o,c=s.changeByRange(t=>{let{head:n}=t,r=s.doc.sliceString(n-1,n)==i,a=l(s).resolveInner(n,-1),o;if(r&&i==`>`&&a.name==`EndTag`){let e=a.parent;if(e.parent?.lastChild?.name!=`CloseTag`&&(o=X(s.doc,e.parent,n)))return{range:t,changes:{from:n,to:n+ +(s.doc.sliceString(n,n+1)===`>`),insert:`</${o}>`}}}else if(r&&i==`/`&&a.name==`StartCloseTag`){let t=a.parent;if(a.from==n-2&&t.lastChild?.name!=`CloseTag`&&(o=X(s.doc,t,n))){let t=n+ +(s.doc.sliceString(n,n+1)===`>`),r=`${o}>`;return{range:e.cursor(n+r.length,-1),changes:{from:n,to:t,insert:r}}}}return{range:t}});return!c.changes.empty&&(t.dispatch([o,s.update(c,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)});export{Y as xml};
|
|
1
|
+
import{a as e}from"./dist-DBUqwiWG.js";import{r as t}from"./dist-BCNaDgNW.js";import{i as n,o as r}from"./dist-Bx6ZWYUW.js";import{LRLanguage as i,LanguageSupport as a,bracketMatchingHandle as o,foldNodeProp as s,indentNodeProp as c,syntaxTree as l}from"./dist-Do52MRwm.js";import{n as u,r as d,t as f}from"./dist-DFMtP3wG.js";var p=1,m=2,h=3,g=4,_=5,v=36,y=37,b=38,x=11,S=13;function C(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}function w(e){return e==9||e==10||e==13||e==32}var T=null,E=null,D=0;function O(e,t){let n=e.pos+t;if(E==e&&D==n)return T;for(;w(e.peek(t));)t++;let r=``;for(;;){let n=e.peek(t);if(!C(n))break;r+=String.fromCharCode(n),t++}return E=e,D=n,T=r||null}function k(e,t){this.name=e,this.parent=t}var A=new f({start:null,shift(e,t,n,r){return t==p?new k(O(r,1)||``,e):e},reduce(e,t){return t==x&&e?e.parent:e},reuse(e,t,n,r){let i=t.type.id;return i==p||i==S?new k(O(r,1)||``,e):e},strict:!1}),j=new u((e,t)=>{if(e.next==60){if(e.advance(),e.next==47){e.advance();let n=O(e,0);if(!n)return e.acceptToken(_);if(t.context&&n==t.context.name)return e.acceptToken(m);for(let r=t.context;r;r=r.parent)if(r.name==n)return e.acceptToken(h,-2);e.acceptToken(g)}else if(e.next!=33&&e.next!=63)return e.acceptToken(p)}},{contextual:!0});function M(e,t){return new u(n=>{let r=0,i=t.charCodeAt(0);scan:for(;!(n.next<0);n.advance(),r++)if(n.next==i){for(let e=1;e<t.length;e++)if(n.peek(e)!=t.charCodeAt(e))continue scan;break}r&&n.acceptToken(e)})}var N=M(v,`-->`),P=M(y,`?>`),F=M(b,`]]>`),I=n({Text:r.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":r.angleBracket,TagName:r.tagName,"MismatchedCloseTag/TagName":[r.tagName,r.invalid],AttributeName:r.attributeName,AttributeValue:r.attributeValue,Is:r.definitionOperator,"EntityReference CharacterReference":r.character,Comment:r.blockComment,ProcessingInst:r.processingInstruction,DoctypeDecl:r.documentMeta,Cdata:r.special(r.string)}),L=d.deserialize({version:14,states:",lOQOaOOOrOxO'#CfOzOpO'#CiO!tOaO'#CgOOOP'#Cg'#CgO!{OrO'#CrO#TOtO'#CsO#]OpO'#CtOOOP'#DT'#DTOOOP'#Cv'#CvQQOaOOOOOW'#Cw'#CwO#eOxO,59QOOOP,59Q,59QOOOO'#Cx'#CxO#mOpO,59TO#uO!bO,59TOOOP'#C|'#C|O$TOaO,59RO$[OpO'#CoOOOP,59R,59ROOOQ'#C}'#C}O$dOrO,59^OOOP,59^,59^OOOS'#DO'#DOO$lOtO,59_OOOP,59_,59_O$tOpO,59`O$|OpO,59`OOOP-E6t-E6tOOOW-E6u-E6uOOOP1G.l1G.lOOOO-E6v-E6vO%UO!bO1G.oO%UO!bO1G.oO%dOpO'#CkO%lO!bO'#CyO%zO!bO1G.oOOOP1G.o1G.oOOOP1G.w1G.wOOOP-E6z-E6zOOOP1G.m1G.mO&VOpO,59ZO&_OpO,59ZOOOQ-E6{-E6{OOOP1G.x1G.xOOOS-E6|-E6|OOOP1G.y1G.yO&gOpO1G.zO&gOpO1G.zOOOP1G.z1G.zO&oO!bO7+$ZO&}O!bO7+$ZOOOP7+$Z7+$ZOOOP7+$c7+$cO'YOpO,59VO'bOpO,59VO'mO!bO,59eOOOO-E6w-E6wO'{OpO1G.uO'{OpO1G.uOOOP1G.u1G.uO(TOpO7+$fOOOP7+$f7+$fO(]O!bO<<GuOOOP<<Gu<<GuOOOP<<G}<<G}O'bOpO1G.qO'bOpO1G.qO(hO#tO'#CnO(vO&jO'#CnOOOO1G.q1G.qO)UOpO7+$aOOOP7+$a7+$aOOOP<<HQ<<HQOOOPAN=aAN=aOOOPAN=iAN=iO'bOpO7+$]OOOO7+$]7+$]OOOO'#Cz'#CzO)^O#tO,59YOOOO,59Y,59YOOOO'#C{'#C{O)lO&jO,59YOOOP<<G{<<G{OOOO<<Gw<<GwOOOO-E6x-E6xOOOO1G.t1G.tOOOO-E6y-E6y",stateData:")z~OPQOSVOTWOVWOWWOXWOiXOyPO!QTO!SUO~OvZOx]O~O^`Oz^O~OPQOQcOSVOTWOVWOWWOXWOyPO!QTO!SUO~ORdO~P!SOteO!PgO~OuhO!RjO~O^lOz^O~OvZOxoO~O^qOz^O~O[vO`sOdwOz^O~ORyO~P!SO^{Oz^O~OteO!P}O~OuhO!R!PO~O^!QOz^O~O[!SOz^O~O[!VO`sOd!WOz^O~Oa!YOz^O~Oz^O[mX`mXdmX~O[!VO`sOd!WO~O^!]Oz^O~O[!_Oz^O~O[!aOz^O~O[!cO`sOd!dOz^O~O[!cO`sOd!dO~Oa!eOz^O~Oz^O{!gO}!hO~Oz^O[ma`madma~O[!kOz^O~O[!lOz^O~O[!mO`sOd!nO~OW!qOX!qO{!sO|!qO~OW!tOX!tO}!sO!O!tO~O[!vOz^O~OW!qOX!qO{!yO|!qO~OW!tOX!tO}!yO!O!tO~O",goto:"%cxPPPPPPPPPPyyP!PP!VPP!`!jP!pyyyP!v!|#S$[$k$q$w$}%TPPPP%ZXWORYbXRORYb_t`qru!T!U!bQ!i!YS!p!e!fR!w!oQdRRybXSORYbQYORmYQ[PRn[Q_QQkVjp_krz!R!T!X!Z!^!`!f!j!oQr`QzcQ!RlQ!TqQ!XsQ!ZtQ!^{Q!`!QQ!f!YQ!j!]R!o!eQu`S!UqrU![u!U!bR!b!TQ!r!gR!x!rQ!u!hR!z!uQbRRxbQfTR|fQiUR!OiSXOYTaRb",nodeNames:`⚠ StartTag StartCloseTag MissingCloseTag StartCloseTag StartCloseTag Document Text EntityReference CharacterReference Cdata Element EndTag OpenTag TagName Attribute AttributeName Is AttributeValue CloseTag SelfCloseEndTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag DoctypeDecl`,maxTerm:50,context:A,nodeProps:[[`closedBy`,1,`SelfCloseEndTag EndTag`,13,`CloseTag MissingCloseTag`],[`openedBy`,12,`StartTag StartCloseTag`,19,`OpenTag`,20,`StartTag`],[`isolate`,-6,13,18,19,21,22,24,``]],propSources:[I],skippedNodes:[0],repeatNodeCount:9,tokenData:"!)v~R!YOX$qXY)iYZ)iZ]$q]^)i^p$qpq)iqr$qrs*vsv$qvw+fwx/ix}$q}!O0[!O!P$q!P!Q2z!Q![$q![!]4n!]!^$q!^!_8U!_!`!#t!`!a!$l!a!b!%d!b!c$q!c!}4n!}#P$q#P#Q!'W#Q#R$q#R#S4n#S#T$q#T#o4n#o%W$q%W%o4n%o%p$q%p&a4n&a&b$q&b1p4n1p4U$q4U4d4n4d4e$q4e$IS4n$IS$I`$q$I`$Ib4n$Ib$Kh$q$Kh%#t4n%#t&/x$q&/x&Et4n&Et&FV$q&FV;'S4n;'S;:j8O;:j;=`)c<%l?&r$q?&r?Ah4n?Ah?BY$q?BY?Mn4n?MnO$qi$zXVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qa%nVVP!O`Ov%gwx&Tx!^%g!^!_&o!_;'S%g;'S;=`'W<%lO%gP&YTVPOv&Tw!^&T!_;'S&T;'S;=`&i<%lO&TP&lP;=`<%l&T`&tS!O`Ov&ox;'S&o;'S;=`'Q<%lO&o`'TP;=`<%l&oa'ZP;=`<%l%gX'eWVP|WOr'^rs&Tsv'^w!^'^!^!_'}!_;'S'^;'S;=`(i<%lO'^W(ST|WOr'}sv'}w;'S'};'S;=`(c<%lO'}W(fP;=`<%l'}X(lP;=`<%l'^h(vV|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oh)`P;=`<%l(oi)fP;=`<%l$qo)t`VP|W!O`zUOX$qXY)iYZ)iZ]$q]^)i^p$qpq)iqr$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk+PV{YVP!O`Ov%gwx&Tx!^%g!^!_&o!_;'S%g;'S;=`'W<%lO%g~+iast,n![!]-r!c!}-r#R#S-r#T#o-r%W%o-r%p&a-r&b1p-r4U4d-r4e$IS-r$I`$Ib-r$Kh%#t-r&/x&Et-r&FV;'S-r;'S;:j/c?&r?Ah-r?BY?Mn-r~,qQ!Q![,w#l#m-V~,zQ!Q![,w!]!^-Q~-VOX~~-YR!Q![-c!c!i-c#T#Z-c~-fS!Q![-c!]!^-Q!c!i-c#T#Z-c~-ug}!O-r!O!P-r!Q![-r![!]-r!]!^/^!c!}-r#R#S-r#T#o-r$}%O-r%W%o-r%p&a-r&b1p-r1p4U-r4U4d-r4e$IS-r$I`$Ib-r$Je$Jg-r$Kh%#t-r&/x&Et-r&FV;'S-r;'S;:j/c?&r?Ah-r?BY?Mn-r~/cOW~~/fP;=`<%l-rk/rW}bVP|WOr'^rs&Tsv'^w!^'^!^!_'}!_;'S'^;'S;=`(i<%lO'^k0eZVP|W!O`Or$qrs%gsv$qwx'^x}$q}!O1W!O!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk1aZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a2S!a;'S$q;'S;=`)c<%lO$qk2_X!PQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qm3TZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a3v!a;'S$q;'S;=`)c<%lO$qm4RXdSVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qo4{!P`S^QVP|W!O`Or$qrs%gsv$qwx'^x}$q}!O4n!O!P4n!P!Q$q!Q![4n![!]4n!]!^$q!^!_(o!_!c$q!c!}4n!}#R$q#R#S4n#S#T$q#T#o4n#o$}$q$}%O4n%O%W$q%W%o4n%o%p$q%p&a4n&a&b$q&b1p4n1p4U4n4U4d4n4d4e$q4e$IS4n$IS$I`$q$I`$Ib4n$Ib$Je$q$Je$Jg4n$Jg$Kh$q$Kh%#t4n%#t&/x$q&/x&Et4n&Et&FV$q&FV;'S4n;'S;:j8O;:j;=`)c<%l?&r$q?&r?Ah4n?Ah?BY$q?BY?Mn4n?MnO$qo8RP;=`<%l4ni8]Y|W!O`Oq(oqr8{rs&osv(owx'}x!a(o!a!b!#U!b;'S(o;'S;=`)]<%lO(oi9S_|W!O`Or(ors&osv(owx'}x}(o}!O:R!O!f(o!f!g;e!g!}(o!}#ODh#O#W(o#W#XLp#X;'S(o;'S;=`)]<%lO(oi:YX|W!O`Or(ors&osv(owx'}x}(o}!O:u!O;'S(o;'S;=`)]<%lO(oi;OV!QP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oi;lX|W!O`Or(ors&osv(owx'}x!q(o!q!r<X!r;'S(o;'S;=`)]<%lO(oi<`X|W!O`Or(ors&osv(owx'}x!e(o!e!f<{!f;'S(o;'S;=`)]<%lO(oi=SX|W!O`Or(ors&osv(owx'}x!v(o!v!w=o!w;'S(o;'S;=`)]<%lO(oi=vX|W!O`Or(ors&osv(owx'}x!{(o!{!|>c!|;'S(o;'S;=`)]<%lO(oi>jX|W!O`Or(ors&osv(owx'}x!r(o!r!s?V!s;'S(o;'S;=`)]<%lO(oi?^X|W!O`Or(ors&osv(owx'}x!g(o!g!h?y!h;'S(o;'S;=`)]<%lO(oi@QY|W!O`Or?yrs@psv?yvwA[wxBdx!`?y!`!aCr!a;'S?y;'S;=`Db<%lO?ya@uV!O`Ov@pvxA[x!`@p!`!aAy!a;'S@p;'S;=`B^<%lO@pPA_TO!`A[!`!aAn!a;'SA[;'S;=`As<%lOA[PAsOiPPAvP;=`<%lA[aBQSiP!O`Ov&ox;'S&o;'S;=`'Q<%lO&oaBaP;=`<%l@pXBiX|WOrBdrsA[svBdvwA[w!`Bd!`!aCU!a;'SBd;'S;=`Cl<%lOBdXC]TiP|WOr'}sv'}w;'S'};'S;=`(c<%lO'}XCoP;=`<%lBdiC{ViP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oiDeP;=`<%l?yiDoZ|W!O`Or(ors&osv(owx'}x!e(o!e!fEb!f#V(o#V#WIr#W;'S(o;'S;=`)]<%lO(oiEiX|W!O`Or(ors&osv(owx'}x!f(o!f!gFU!g;'S(o;'S;=`)]<%lO(oiF]X|W!O`Or(ors&osv(owx'}x!c(o!c!dFx!d;'S(o;'S;=`)]<%lO(oiGPX|W!O`Or(ors&osv(owx'}x!v(o!v!wGl!w;'S(o;'S;=`)]<%lO(oiGsX|W!O`Or(ors&osv(owx'}x!c(o!c!dH`!d;'S(o;'S;=`)]<%lO(oiHgX|W!O`Or(ors&osv(owx'}x!}(o!}#OIS#O;'S(o;'S;=`)]<%lO(oiI]V|W!O`yPOr(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oiIyX|W!O`Or(ors&osv(owx'}x#W(o#W#XJf#X;'S(o;'S;=`)]<%lO(oiJmX|W!O`Or(ors&osv(owx'}x#T(o#T#UKY#U;'S(o;'S;=`)]<%lO(oiKaX|W!O`Or(ors&osv(owx'}x#h(o#h#iK|#i;'S(o;'S;=`)]<%lO(oiLTX|W!O`Or(ors&osv(owx'}x#T(o#T#UH`#U;'S(o;'S;=`)]<%lO(oiLwX|W!O`Or(ors&osv(owx'}x#c(o#c#dMd#d;'S(o;'S;=`)]<%lO(oiMkX|W!O`Or(ors&osv(owx'}x#V(o#V#WNW#W;'S(o;'S;=`)]<%lO(oiN_X|W!O`Or(ors&osv(owx'}x#h(o#h#iNz#i;'S(o;'S;=`)]<%lO(oi! RX|W!O`Or(ors&osv(owx'}x#m(o#m#n! n#n;'S(o;'S;=`)]<%lO(oi! uX|W!O`Or(ors&osv(owx'}x#d(o#d#e!!b#e;'S(o;'S;=`)]<%lO(oi!!iX|W!O`Or(ors&osv(owx'}x#X(o#X#Y?y#Y;'S(o;'S;=`)]<%lO(oi!#_V!SP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(ok!$PXaQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qo!$wX[UVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!%mZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!&`!a;'S$q;'S;=`)c<%lO$qk!&kX!RQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!'aZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_#P$q#P#Q!(S#Q;'S$q;'S;=`)c<%lO$qk!(]ZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!)O!a;'S$q;'S;=`)c<%lO$qk!)ZXxQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$q",tokenizers:[j,N,P,F,0,1,2,3,4],topRules:{Document:[0,6]},tokenPrec:0});function R(e,t){let n=t&&t.getChild(`TagName`);return n?e.sliceString(n.from,n.to):``}function z(e,t){let n=t&&t.firstChild;return!n||n.name!=`OpenTag`?``:R(e,n)}function B(e,t,n){let r=t&&t.getChildren(`Attribute`).find(e=>e.from<=n&&e.to>=n),i=r&&r.getChild(`AttributeName`);return i?e.sliceString(i.from,i.to):``}function V(e){for(let t=e&&e.parent;t;t=t.parent)if(t.name==`Element`)return t;return null}function H(e,t){let n=l(e).resolveInner(t,-1),r=null;for(let e=n;!r&&e.parent;e=e.parent)(e.name==`OpenTag`||e.name==`CloseTag`||e.name==`SelfClosingTag`||e.name==`MismatchedCloseTag`)&&(r=e);if(r&&(r.to>t||r.lastChild.type.isError)){let e=r.parent;if(n.name==`TagName`)return r.name==`CloseTag`||r.name==`MismatchedCloseTag`?{type:`closeTag`,from:n.from,context:e}:{type:`openTag`,from:n.from,context:V(e)};if(n.name==`AttributeName`)return{type:`attrName`,from:n.from,context:r};if(n.name==`AttributeValue`)return{type:`attrValue`,from:n.from,context:r};let i=n==r||n.name==`Attribute`?n.childBefore(t):n;return i?.name==`StartTag`?{type:`openTag`,from:t,context:V(e)}:i?.name==`StartCloseTag`&&i.to<=t?{type:`closeTag`,from:t,context:e}:i?.name==`Is`?{type:`attrValue`,from:t,context:r}:i?{type:`attrName`,from:t,context:r}:null}if(n.name==`StartCloseTag`)return{type:`closeTag`,from:t,context:n.parent};for(;n.parent&&n.to==t&&!n.lastChild?.type.isError;)n=n.parent;return n.name==`Element`||n.name==`Text`||n.name==`Document`?{type:`tag`,from:t,context:n.name==`Element`?n:V(n)}:null}var U=class{constructor(e,t,n){this.attrs=t,this.attrValues=n,this.children=[],this.name=e.name,this.completion=Object.assign(Object.assign({type:`type`},e.completion||{}),{label:this.name}),this.openCompletion=Object.assign(Object.assign({},this.completion),{label:`<`+this.name}),this.closeCompletion=Object.assign(Object.assign({},this.completion),{label:`</`+this.name+`>`,boost:2}),this.closeNameCompletion=Object.assign(Object.assign({},this.completion),{label:this.name+`>`}),this.text=e.textContent?e.textContent.map(e=>({label:e,type:`text`})):[]}},W=/^[:\-\.\w\u00b7-\uffff]*$/;function G(e){return Object.assign(Object.assign({type:`property`},e.completion||{}),{label:e.name})}function K(e){return typeof e==`string`?{label:`"${e}"`,type:`constant`}:/^"/.test(e.label)?e:Object.assign(Object.assign({},e),{label:`"${e.label}"`})}function q(e,t){let n=[],r=[],i=Object.create(null);for(let e of t){let t=G(e);n.push(t),e.global&&r.push(t),e.values&&(i[e.name]=e.values.map(K))}let a=[],o=[],s=Object.create(null);for(let t of e){let e=r,c=i;t.attributes&&(e=e.concat(t.attributes.map(e=>typeof e==`string`?n.find(t=>t.label==e)||{label:e,type:`property`}:(e.values&&(c==i&&(c=Object.create(c)),c[e.name]=e.values.map(K)),G(e)))));let l=new U(t,e,c);s[l.name]=l,a.push(l),t.top&&o.push(l)}o.length||(o=a);for(let t=0;t<a.length;t++){let n=e[t],r=a[t];if(n.children)for(let e of n.children)s[e]&&r.children.push(s[e]);else r.children=a}return e=>{let{doc:t}=e.state,n=H(e.state,e.pos);if(!n||n.type==`tag`&&!e.explicit)return null;let{type:c,from:l,context:u}=n;if(c==`openTag`){let e=o,n=z(t,u);return n&&(e=s[n]?.children||a),{from:l,options:e.map(e=>e.completion),validFor:W}}if(c==`closeTag`){let n=z(t,u);return n?{from:l,to:e.pos+ +(t.sliceString(e.pos,e.pos+1)==`>`),options:[s[n]?.closeNameCompletion||{label:n+`>`,type:`type`}],validFor:W}:null}if(c==`attrName`)return{from:l,options:s[R(t,u)]?.attrs||r,validFor:W};if(c==`attrValue`){let n=B(t,u,l);if(!n)return null;let r=(s[R(t,u)]?.attrValues||i)[n];return!r||!r.length?null:{from:l,to:e.pos+ +(t.sliceString(e.pos,e.pos+1)==`"`),options:r,validFor:/^"[^"]*"?$/}}if(c==`tag`){let n=z(t,u),r=s[n],i=[],c=u&&u.lastChild;n&&(!c||c.name!=`CloseTag`||R(t,c)!=n)&&i.push(r?r.closeCompletion:{label:`</`+n+`>`,type:`type`,boost:2});let d=i.concat((r?.children||(u?a:o)).map(e=>e.openCompletion));if(u&&r?.text.length){let t=u.firstChild;t.to>e.pos-20&&!/\S/.test(e.state.sliceDoc(t.to,e.pos))&&(d=d.concat(r.text))}return{from:l,options:d,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}return null}}var J=i.define({name:`xml`,parser:L.configure({props:[c.add({Element(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),s.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!=`OpenTag`?null:{from:t.to,to:n.name==`CloseTag`?n.from:e.to}}}),o.add({"OpenTag CloseTag":e=>e.getChild(`TagName`)})]}),languageData:{commentTokens:{block:{open:`<!--`,close:`-->`}},indentOnInput:/^\s*<\/$/}});function Y(e={}){let t=[J.data.of({autocomplete:q(e.elements||[],e.attributes||[])})];return e.autoCloseTags!==!1&&t.push(Z),new a(J,t)}function X(e,t,n=e.length){if(!t)return``;let r=t.firstChild,i=r&&r.getChild(`TagName`);return i?e.sliceString(i.from,Math.min(i.to,n)):``}var Z=t.inputHandler.of((t,n,r,i,a)=>{if(t.composing||t.state.readOnly||n!=r||i!=`>`&&i!=`/`||!J.isActiveAt(t.state,n,-1))return!1;let o=a(),{state:s}=o,c=s.changeByRange(t=>{let{head:n}=t,r=s.doc.sliceString(n-1,n)==i,a=l(s).resolveInner(n,-1),o;if(r&&i==`>`&&a.name==`EndTag`){let e=a.parent;if(e.parent?.lastChild?.name!=`CloseTag`&&(o=X(s.doc,e.parent,n)))return{range:t,changes:{from:n,to:n+ +(s.doc.sliceString(n,n+1)===`>`),insert:`</${o}>`}}}else if(r&&i==`/`&&a.name==`StartCloseTag`){let t=a.parent;if(a.from==n-2&&t.lastChild?.name!=`CloseTag`&&(o=X(s.doc,t,n))){let t=n+ +(s.doc.sliceString(n,n+1)===`>`),r=`${o}>`;return{range:e.cursor(n+r.length,-1),changes:{from:n,to:t,insert:r}}}}return{range:t}});return!c.changes.empty&&(t.dispatch([o,s.update(c,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)});export{Y as xml};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{S as e,_ as t,a as n,d as r,i,l as a,m as o,o as s,p as c,s as l,v as u,w as d,y as f}from"./dist-
|
|
1
|
+
import{S as e,_ as t,a as n,d as r,i,l as a,m as o,o as s,p as c,s as l,v as u,w as d,y as f}from"./dist-DBUqwiWG.js";import{a as p,c as m,g as h,h as ee,l as g,m as te,p as ne,r as _,t as v}from"./dist-BCNaDgNW.js";var y=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,b=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(y(e)):y,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return t(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=d(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=u(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(b.prototype[Symbol.iterator]=function(){return this});var re={from:-1,to:-1,match:/.*/.exec(``),precise:!0},x=`gm`+(/x/.unicode==null?``:`u`),S=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=re,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new T(e,t,n,r,i);this.re=new RegExp(t,x+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=E(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=E(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},C=new WeakMap,w=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=C.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return C.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),C.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},T=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=re,this.matchPos=E(e,r),this.re=new RegExp(t,x+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=w.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=E(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=w.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(S.prototype[Symbol.iterator]=T.prototype[Symbol.iterator]=function(){return this});function ie(e){try{return new RegExp(e,x),!0}catch{return!1}}function E(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var D=e=>{let t=m(e,`cm-goto-line`);if(t){let e=t.dom.querySelector(`input[type=text]`);return e&&e.select(),!0}let{state:r}=e,i=String(r.doc.lineAt(e.state.selection.main.head).number),{close:a,result:o}=te(e,{class:`cm-goto-line`,label:r.phrase(`Go to line`),input:{type:`text`,name:`line`,value:i},focus:!0,submitLabel:r.phrase(`go`)});return o.then(t=>{let i=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!i){e.dispatch({effects:a});return}let o=r.doc.lineAt(r.selection.main.head),[,s,c,l,u]=i,d=l?+l.slice(1):0,f=c?+c:o.number;if(c&&u){let e=f/100;s&&(e=e*(s==`-`?-1:1)+o.number/r.doc.lines),f=Math.round(r.doc.lines*e)}else c&&s&&(f=f*(s==`-`?-1:1)+o.number);let p=r.doc.line(Math.max(1,Math.min(r.doc.lines,f))),m=n.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[a,_.scrollIntoView(m.from,{y:`center`})],selection:m})}),!0},ae={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},O=l.define({combine(e){return f(e,ae,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function oe(e){let t=[fe,de];return e&&t.push(O.of(e)),t}var se=v.mark({class:`cm-selectionMatch`}),ce=v.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function le(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=i.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=i.Word)}function ue(e,t,n,r){return e(t.sliceDoc(n,n+1))==i.Word&&e(t.sliceDoc(r-1,r))==i.Word}var de=p.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(O),{state:n}=e,r=n.selection;if(r.ranges.length>1)return v.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return v.none;let e=n.wordAt(i.head);if(!e)return v.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return v.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(le(o,n,i.from,i.to)&&ue(o,n,i.from,i.to)))return v.none}else if(a=n.sliceDoc(i.from,i.to),!a)return v.none}let s=[];for(let r of e.visibleRanges){let e=new b(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||le(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(ce.range(r,a)):(r>=i.to||a<=i.from)&&s.push(se.range(r,a)),s.length>t.maxMatches))return v.none}}return v.set(s)}},{decorations:e=>e.decorations}),fe=_.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),pe=({state:e,dispatch:t})=>{let{selection:r}=e,i=n.create(r.ranges.map(t=>e.wordAt(t.head)||n.cursor(t.head)),r.mainIndex);return!i.eq(r)&&(t(e.update({selection:i})),!0)};function me(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new b(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new b(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var he=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(e=>e.from===e.to))return pe({state:e,dispatch:t});let i=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=i))return!1;let a=me(e,i);return a?(t(e.update({selection:e.selection.addRange(n.range(a.from,a.to),!1),effects:_.scrollIntoView(a.to)})),!0):!1},k=l.define({combine(e){return f(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ne(e),scrollToMatch:e=>_.scrollIntoView(e)})}});function ge(e){return e?[k.of(e),$]:$}var A=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||ie(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
2
2
|
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Se(this):new ye(this)}getCursor(e,t=0,n){let r=e.doc?e:s.create({doc:e});return n??=r.doc.length,this.regexp?N(this,r,t,n):M(this,r,t,n)}},j=class{constructor(e){this.spec=e}};function _e(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function M(e,t,n,r){let i;return e.wholeWord&&(i=ve(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=_e(e.test,t,i)),new b(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function ve(e,t){return(n,r,a,o)=>((o>n||o+a.length<r)&&(o=Math.max(0,n-2),a=e.sliceString(o,Math.min(e.length,r+2))),(t(P(a,n-o))!=i.Word||t(F(a,n-o))!=i.Word)&&(t(F(a,r-o))!=i.Word||t(P(a,r-o))!=i.Word))}var ye=class extends j{constructor(e){super(e)}nextMatch(e,t,n){let r=M(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=M(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=M(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=M(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=M(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function be(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function N(e,t,n,r){let i;return e.wholeWord&&(i=xe(t.charCategorizer(t.selection.main.head))),e.test&&(i=be(e.test,t,i)),new S(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function P(t,n){return t.slice(e(t,n,!1),n)}function F(t,n){return t.slice(n,e(t,n))}function xe(e){return(t,n,r)=>!r[0].length||(e(P(r.input,r.index))!=i.Word||e(F(r.input,r.index))!=i.Word)&&(e(F(r.input,r.index+r[0].length))!=i.Word||e(P(r.input,r.index+r[0].length))!=i.Word)}var Se=class extends j{nextMatch(e,t,n){let r=N(this.spec,e,n,e.doc.length).next();return r.done&&(r=N(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=N(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=N(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=N(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},I=c.define(),L=c.define(),R=o.define({create(e){return new z(G(e).create(),null)},update(e,t){for(let n of t.effects)n.is(I)?e=new z(n.value.create(),e.panel):n.is(L)&&(e=new z(e.query,n.value?W:null));return e},provide:e=>ee.from(e,e=>e.panel)});function Ce(e){let t=e.field(R,!1);return t?t.query.spec:G(e)}function we(e){return e.field(R,!1)?.panel!=null}var z=class{constructor(e,t){this.query=e,this.panel=t}},Te=v.mark({class:`cm-searchMatch`}),Ee=v.mark({class:`cm-searchMatch cm-searchMatch-selected`}),De=p.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(R))}update(e){let t=e.state.field(R);(t!=e.startState.field(R)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return v.none;let{view:n}=this,i=new r;for(let t=0,r=n.visibleRanges,a=r.length;t<a;t++){let{from:o,to:s}=r[t];for(;t<a-1&&s>r[t+1].from-500;)s=r[++t].to;e.highlight(n.state,o,s,(e,t)=>{let r=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);i.add(e,t,r?Ee:Te)})}return i.finish()}},{decorations:e=>e.decorations});function B(e){return t=>{let n=t.state.field(R,!1);return n&&n.query.spec.valid?e(t,n):q(t)}}var V=B((e,{query:t})=>{let{to:r}=e.state.selection.main,i=t.nextMatch(e.state,r,r);if(!i)return!1;let a=n.single(i.from,i.to),o=e.state.facet(k);return e.dispatch({selection:a,effects:[Q(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),je(e),!0}),H=B((e,{query:t})=>{let{state:r}=e,{from:i}=r.selection.main,a=t.prevMatch(r,i,i);if(!a)return!1;let o=n.single(a.from,a.to),s=e.state.facet(k);return e.dispatch({selection:o,effects:[Q(e,a),s.scrollToMatch(o.main,e)],userEvent:`select.search`}),je(e),!0}),Oe=B((e,{query:t})=>{let r=t.matchAll(e.state,1e3);return!r||!r.length?!1:(e.dispatch({selection:n.create(r.map(e=>n.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),ke=({state:e,dispatch:t})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:i,to:a}=r.main,o=[],s=0;for(let t=new b(e.doc,e.sliceDoc(i,a));!t.next().done;){if(o.length>1e3)return!1;t.value.from==i&&(s=o.length),o.push(n.range(t.value.from,t.value.to))}return t(e.update({selection:n.create(o,s),userEvent:`select.search.matches`})),!0},U=B((e,{query:t})=>{let{state:r}=e,{from:i,to:a}=r.selection.main;if(r.readOnly)return!1;let o=t.nextMatch(r,i,i);if(!o)return!1;let s=o,c=[],l,u,d=[];s.precise?s.from==i&&s.to==a&&(u=r.toText(t.getReplacement(s)),c.push({from:s.from,to:s.to,insert:u}),s=t.nextMatch(r,s.from,s.to),d.push(_.announce.of(r.phrase(`replaced match on line $`,r.doc.lineAt(i).number)+`.`))):s=t.nextMatch(r,s.from,s.to);let f=e.state.changes(c);return s&&(l=n.single(s.from,s.to).map(f),d.push(Q(e,s)),d.push(r.facet(k).scrollToMatch(l.main,e))),e.dispatch({changes:f,selection:l,effects:d,userEvent:`input.replace`}),!0}),Ae=B((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:_.announce.of(r),userEvent:`input.replace.all`}),!0});function W(e){return e.state.facet(k).createPanel(e)}function G(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(k);return new A({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function K(e){let t=g(e,W);return t&&t.dom.querySelector(`[main-field]`)}function je(e){let t=K(e);t&&t==e.root.activeElement&&t.select()}var q=e=>{let t=e.state.field(R,!1);if(t&&t.panel){let n=K(e);if(n&&n!=e.root.activeElement){let r=G(e.state,t.query.spec);r.valid&&e.dispatch({effects:I.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[L.of(!0),t?I.of(G(e.state,t.query.spec)):c.appendConfig.of($)]});return!0},J=e=>{let t=e.state.field(R,!1);if(!t||!t.panel)return!1;let n=g(e,W);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:L.of(!1)}),!0},Me=[{key:`Mod-f`,run:q,scope:`editor search-panel`},{key:`F3`,run:V,shift:H,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:V,shift:H,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:J,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:ke},{key:`Mod-Alt-g`,run:D},{key:`Mod-d`,run:he,preventDefault:!0}],Ne=class{constructor(e){this.view=e;let t=this.query=e.state.field(R).query.spec;this.commit=this.commit.bind(this),this.searchField=h(`input`,{value:t.search,placeholder:Y(e,`Find`),"aria-label":Y(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=h(`input`,{value:t.replace,placeholder:Y(e,`Replace`),"aria-label":Y(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=h(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=h(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=h(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return h(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=h(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>V(e),[Y(e,`next`)]),n(`prev`,()=>H(e),[Y(e,`previous`)]),n(`select`,()=>Oe(e),[Y(e,`all`)]),h(`label`,null,[this.caseField,Y(e,`match case`)]),h(`label`,null,[this.reField,Y(e,`regexp`)]),h(`label`,null,[this.wordField,Y(e,`by word`)]),...e.state.readOnly?[]:[h(`br`),this.replaceField,n(`replace`,()=>U(e),[Y(e,`replace`)]),n(`replaceAll`,()=>Ae(e),[Y(e,`replace all`)])],h(`button`,{name:`close`,onclick:()=>J(e),"aria-label":Y(e,`close`),type:`button`},[`×`])])}commit(){let e=new A({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:I.of(e)}))}keydown(e){ne(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?H:V)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),U(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(I)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(k).top}};function Y(e,t){return e.state.phrase(t)}var X=30,Z=/[\s\.,:;?!]/;function Q(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-X),o=Math.min(i,n+X),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<X;e++)if(!Z.test(s[e+1])&&Z.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-X;e--)if(!Z.test(s[e-1])&&Z.test(s[e])){s=s.slice(0,e);break}}return _.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Pe=_.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),$=[R,a.low(De),Pe];export{S as RegExpCursor,b as SearchCursor,A as SearchQuery,J as closeSearchPanel,V as findNext,H as findPrevious,Ce as getSearchQuery,D as gotoLine,oe as highlightSelectionMatches,q as openSearchPanel,Ae as replaceAll,U as replaceNext,ge as search,Me as searchKeymap,we as searchPanelOpen,Oe as selectMatches,he as selectNextOccurrence,ke as selectSelectionMatches,I as setSearchQuery};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,o as t}from"./dist-
|
|
1
|
+
import{i as e,o as t}from"./dist-Bx6ZWYUW.js";import{LRLanguage as n,LanguageSupport as r,continuedIndent as i,foldInside as a,foldNodeProp as o,indentNodeProp as s}from"./dist-Do52MRwm.js";import{r as c}from"./dist-DFMtP3wG.js";var l=e({String:t.string,Number:t.number,"True False":t.bool,PropertyName:t.propertyName,Null:t.null,", :":t.separator,"[ ]":t.squareBracket,"{ }":t.brace}),u=c.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:`#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O`,goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:`⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array`,maxTerm:25,nodeProps:[[`isolate`,-2,6,11,``],[`openedBy`,7,`{`,14,`[`],[`closedBy`,8,`}`,15,`]`]],propSources:[l],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),d=n.define({name:`json`,parser:u.configure({props:[s.add({Object:i({except:/^\s*\}/}),Array:i({except:/^\s*\]/})}),o.add({"Object Array":a})]}),languageData:{closeBrackets:{brackets:[`[`,`{`,`"`]},indentOnInput:/^\s*[\}\]]$/}});function f(){return new r(d)}export{f as json};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./index-
|
|
1
|
+
import{o as e}from"./index-E7yaLa2C.js";import{C as t,S as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b,y as x}from"./dist-DBUqwiWG.js";for(var ee=`ͼ`,te=typeof Symbol>`u`?`__ͼ`:Symbol.for(ee),ne=typeof Symbol>`u`?`__styleSet`+Math.floor(Math.random()*1e8):Symbol(`styleSet`),re=typeof globalThis<`u`?globalThis:typeof window<`u`?window:{},ie=class{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function i(e,t,a,o){let s=[],c=/^@(\w+)\b/.exec(e[0]),l=c&&c[1]==`keyframes`;if(c&&t==null)return a.push(e[0]+`;`);for(let n in t){let o=t[n];if(/&/.test(n))i(n.split(/,\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),o,a);else if(o&&typeof o==`object`){if(!c)throw RangeError(`The value of a property (`+n+`) should be a primitive value.`);i(r(n),o,s,l)}else o!=null&&s.push(n.replace(/_.*/,``).replace(/[A-Z]/g,e=>`-`+e.toLowerCase())+`: `+o+`;`)}(s.length||l)&&a.push((n&&!c&&!o?e.map(n):e).join(`, `)+` {`+s.join(` `)+`}`)}for(let t in e)i(r(t),e[t],this.rules)}getRules(){return this.rules.join(`
|
|
2
2
|
`)}static newName(){let e=re[te]||1;return re[te]=e+1,ee+e.toString(36)}static mount(e,t,n){let r=e[ne],i=n&&n.nonce;r?i&&r.setNonce(i):r=new oe(e,i),r.mount(Array.isArray(t)?t:[t],e)}},ae=new Map,oe=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=ae.get(n);if(t)return e[ne]=t;this.sheet=new r.CSSStyleSheet,ae.set(n,this)}else this.styleTag=n.createElement(`style`),t&&this.styleTag.setAttribute(`nonce`,t);this.modules=[],e[ne]=this}mount(e,t){let n=this.sheet,r=0,i=0,a=!1;for(let t=0;t<e.length;t++){let o=e[t],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),a=!0,i--,s=-1),s==-1){if(this.modules.splice(i++,0,o),a=!0,n)for(let e=0;e<o.rules.length;e++)n.insertRule(o.rules[e],r++)}else{for(;i<s;)r+=this.modules[i++].rules.length;r+=o.rules.length,i++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(a){let e=``;for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+`
|
|
3
3
|
`;this.styleTag.textContent=e}let e=t.head||t;this.styleTag.parentNode!=e&&e.insertBefore(this.styleTag,e.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute(`nonce`)!=e&&this.styleTag.setAttribute(`nonce`,e)}},S={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},se={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},ce=typeof navigator<`u`&&/Mac/.test(navigator.platform),le=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),C=0;C<10;C++)S[48+C]=S[96+C]=String(C);for(var C=1;C<=24;C++)S[C+111]=`F`+C;for(var C=65;C<=90;C++)S[C]=String.fromCharCode(C+32),se[C]=String.fromCharCode(C);for(var ue in S)se.hasOwnProperty(ue)||(se[ue]=S[ue]);function de(e){var t=!(ce&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||le&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?se:S)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}function w(){var e=arguments[0];typeof e==`string`&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n==`object`&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i==`string`?e.setAttribute(r,i):i!=null&&(e[r]=i)}t++}for(;t<arguments.length;t++)fe(e,arguments[t]);return e}function fe(e,t){if(typeof t==`string`)e.appendChild(document.createTextNode(t));else if(t!=null){if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var n=0;n<t.length;n++)fe(e,t[n]);else throw RangeError(`Unsupported child node: `+t)}}var pe=e({BidiSpan:()=>I,BlockInfo:()=>q,BlockType:()=>O,BlockWrapper:()=>Ie,Decoration:()=>k,Direction:()=>P,EditorView:()=>Z,GutterMarker:()=>$,MatchDecorator:()=>ja,RectangleMarker:()=>sa,ViewPlugin:()=>B,ViewUpdate:()=>an,WidgetType:()=>D,__test:()=>Ds,activateHover:()=>ko,closeHoverTooltip:()=>Po,closeHoverTooltips:()=>No,crosshairCursor:()=>oo,drawSelection:()=>_a,dropCursor:()=>Oa,getDialog:()=>Wo,getDrawSelectionConfig:()=>va,getPanel:()=>Ro,getTooltip:()=>Ao,gutter:()=>$o,gutterLineClass:()=>Yo,gutterWidgetClass:()=>Xo,gutters:()=>ts,hasHoverTooltips:()=>jo,highlightActiveLine:()=>qa,highlightActiveLineGutter:()=>ys,highlightSpecialChars:()=>Ra,highlightTrailingWhitespace:()=>Es,highlightWhitespace:()=>ws,hoverTooltip:()=>Oo,keymap:()=>$i,layer:()=>ma,lineNumberMarkers:()=>ls,lineNumberWidgetMarker:()=>us,lineNumbers:()=>hs,logException:()=>R,panels:()=>Lo,placeholder:()=>Za,rectangularSelection:()=>ro,repositionTooltips:()=>Fo,runScopeHandlers:()=>na,scrollPastEnd:()=>Ka,showDialog:()=>Uo,showPanel:()=>Ho,showTooltip:()=>yo,tooltips:()=>lo}),T=typeof navigator<`u`?navigator:{userAgent:``,vendor:``,platform:``},me=typeof document<`u`?document:{documentElement:{style:{}}},he=/Edge\/(\d+)/.exec(T.userAgent),ge=/MSIE \d/.test(T.userAgent),_e=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(T.userAgent),ve=!!(ge||_e||he),ye=!ve&&/gecko\/(\d+)/i.test(T.userAgent),be=!ve&&/Chrome\/(\d+)/.exec(T.userAgent),xe=`webkitFontSmoothing`in me.documentElement.style,Se=!ve&&/Apple Computer/.test(T.vendor),Ce=Se&&(/Mobile\/\w+/.test(T.userAgent)||T.maxTouchPoints>2),E={mac:Ce||/Mac/.test(T.platform),windows:/Win/.test(T.platform),linux:/Linux|X11/.test(T.platform),ie:ve,ie_version:ge?me.documentMode||6:_e?+_e[1]:he?+he[1]:0,gecko:ye,gecko_version:ye?+(/Firefox\/(\d+)/.exec(T.userAgent)||[0,0])[1]:0,chrome:!!be,chrome_version:be?+be[1]:0,ios:Ce,android:/Android\b/.test(T.userAgent),webkit:xe,webkit_version:xe?+(/\bAppleWebKit\/(\d+)/.exec(T.userAgent)||[0,0])[1]:0,safari:Se,safari_version:Se?+(/\bVersion\/(\d+(\.\d+)?)/.exec(T.userAgent)||[0,0])[1]:0,tabSize:me.documentElement.style.tabSize==null?`-moz-tab-size`:`tab-size`};function we(e,t){for(let n in e)n==`class`&&t.class?t.class+=` `+e.class:n==`style`&&t.style?t.style+=`;`+e.style:t[n]=e[n];return t}var Te=Object.create(null);function Ee(e,t,n){if(e==t)return!0;e||=Te,t||=Te;let r=Object.keys(e),i=Object.keys(t);if(r.length-0!=i.length-0)return!1;for(let a of r)if(a!=n&&(i.indexOf(a)==-1||e[a]!==t[a]))return!1;return!0}function De(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]??e.removeAttribute(r)}for(let n in t){let r=t[n];n==`style`?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function Oe(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,i==`style`?e.style.cssText=``:e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,i==`style`?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function ke(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}var D=class{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},O=(function(e){return e[e.Text=0]=`Text`,e[e.WidgetBefore=1]=`WidgetBefore`,e[e.WidgetAfter=2]=`WidgetAfter`,e[e.WidgetRange=3]=`WidgetRange`,e})(O||={}),k=class extends c{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new Ae(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Me(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:i,end:a}=Ne(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new Me(e,n,r,t,e.widget||null,!0)}static line(e){return new je(e)}static set(e,t=!1){return y.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};k.none=y.empty;var Ae=class e extends k{constructor(e){let{start:t,end:n}=Ne(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||`span`,this.attrs=e.class&&e.attributes?we(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Te}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&Ee(this.attrs,t.attrs)}range(e,t=e){if(e>=t)throw RangeError(`Mark decorations may not be empty`);return super.range(e,t)}};Ae.prototype.point=!1;var je=class e extends k{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&Ee(this.spec.attributes,t.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError(`Line decoration ranges must be zero-length`);return super.range(e,t)}};je.prototype.mapMode=o.TrackBefore,je.prototype.point=!0;var Me=class e extends k{constructor(e,t,n,r,i,a){super(t,n,i,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?o.TrackBefore:o.TrackAfter:o.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?O.WidgetBefore:O.WidgetAfter:O.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&Pe(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError(`Invalid range for replacement decoration`);if(!this.isReplace&&t!=e)throw RangeError(`Widget decorations can only have zero-length ranges`);return super.range(e,t)}};Me.prototype.point=!0;function Ne(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n??=e.inclusive,r??=e.inclusive,{start:n??t,end:r??t}}function Pe(e,t){return e==t||!!(e&&t&&e.compare(t))}function Fe(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}var Ie=class e extends c{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.rank=n}eq(t){return t==this||t instanceof e&&this.tagName==t.tagName&&Ee(this.attributes,t.attributes)}static create(t){return new e(t.tagName,t.attributes||Te,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(e,t=!1){return y.of(e,t)}};Ie.prototype.startSide=Ie.prototype.endSide=-1;var A=e=>e.nodeType==1,Le=e=>e.nodeType==3;function Re(e){let t;return t=e.nodeType==11?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function ze(e,t){return t?e==t||e.contains(t.nodeType==1?t:t.parentNode):!1}function Be(e,t){if(!t.anchorNode)return!1;try{return ze(e,t.anchorNode)}catch{return!1}}function Ve(e){return Le(e)?nt(e,0,e.nodeValue.length).getClientRects():A(e)?e.getClientRects():[]}function He(e,t,n,r){return n?We(e,t,n,r,-1)||We(e,t,n,r,1):!1}function j(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function Ue(e){return A(e)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function We(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:M(e))){if(e.nodeName==`DIV`)return!1;let n=e.parentNode;if(!n||!A(n))return!1;t=j(e)+(i<0?0:1),e=n}else if(A(e)){if(e=e.childNodes[t+(i<0?-1:0)],A(e)&&(e.nodeName==`IMG`||e.nodeName==`BR`||e.contentEditable==`false`))return!1;t=i<0?M(e):0}else return!1}}function M(e){return Le(e)?e.nodeValue.length:e.childNodes.length}function Ge(e,t){let{left:n,right:r}=e;if(n==r)return e;let i=t?n:r;return{left:i,right:i,top:e.top,bottom:e.bottom}}function Ke(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function qe(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function Je(e,t,n,r,i,a,o,s){let c=e.ownerDocument,l=c.defaultView||window;for(let u=e,d=!1;u&&!d;)if(A(u)){let e,f=u==c.body,p=1,m=1,h=!0,g=!0;if(f)e=Ke(l);else{let t=getComputedStyle(u);if(/^(fixed|sticky)$/.test(t.position)&&(d=!0),(u.scrollHeight<=u.clientHeight||!/auto|scroll/.test(t.overflowY))&&(g=!1),(u.scrollWidth<=u.clientWidth||!/auto|scroll/.test(t.overflowX))&&(h=!1),!h&&!g){u=u.assignedSlot||u.parentNode;continue}let n=u.getBoundingClientRect();({scaleX:p,scaleY:m}=qe(u,n)),e={left:n.left,right:n.left+u.clientWidth*p,top:n.top,bottom:n.top+u.clientHeight*m}}let _=0,v=0;if(g){if(i==`nearest`)t.top<e.top+o?(v=t.top-(e.top+o),n>0&&t.bottom>e.bottom+v&&(v=t.bottom-e.bottom+o)):t.bottom>e.bottom-o&&(v=t.bottom-e.bottom+o,n<0&&t.top-v<e.top&&(v=t.top-(e.top+o)));else{let r=t.bottom-t.top,a=e.bottom-e.top;v=(i==`center`&&r<=a?t.top+r/2-a/2:i==`start`||i==`center`&&n<0?t.top-o:t.bottom-a+o)-e.top}}if(h&&(r==`nearest`?t.left<e.left+a?(_=t.left-(e.left+a),n>0&&t.right>e.right+_&&(_=t.right-e.right+a)):t.right>e.right-a&&(_=t.right-e.right+a,n<0&&t.left<e.left+_&&(_=t.left-(e.left+a))):_=(r==`center`?t.left+(t.right-t.left)/2-(e.right-e.left)/2:r==`start`==s?t.left-a:t.right-(e.right-e.left)+a)-e.left),_||v){if(f)l.scrollBy(_,v);else{let e=0,n=0;if(v){let e=u.scrollTop;u.scrollTop+=v/m,n=(u.scrollTop-e)*m}if(_){let t=u.scrollLeft;u.scrollLeft+=_/p,e=(u.scrollLeft-t)*p}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-_)<1&&(r=`nearest`),n&&Math.abs(n-v)<1&&(i=`nearest`)}}if(f)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function Ye(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let a=e.parentNode;a&&!(a==n.body||(!t||r)&&i);)if(A(a))!i&&a.scrollHeight>a.clientHeight&&/scroll|auto/.test(getComputedStyle(a).overflowY)&&(i=a),t&&!r&&a.scrollWidth>a.clientWidth&&/scroll|auto/.test(getComputedStyle(a).overflowX)&&(r=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:r,y:i}}var Xe=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?M(t):0),n,Math.min(e.focusOffset,n?M(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}};function Ze(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)A(n)&&t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function Qe(e,t=!0){for(let{node:n,left:r,top:i}of e)t&&n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}var $e=null;E.safari&&E.safari_version>=26&&($e=!1);function et(e){if(e.setActive)return e.setActive();if($e)return e.focus($e);let t=Ze(e);e.focus($e==null?{get preventScroll(){return $e={preventScroll:!0},!0}}:void 0),$e||($e=!1,Qe(t))}var tt;function nt(e,t,n=t){let r=tt||=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}function rt(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let a=new KeyboardEvent(`keydown`,i);a.synthetic=!0,e.dispatchEvent(a);let o=new KeyboardEvent(`keyup`,i);return o.synthetic=!0,e.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function it(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function at(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,M(n));;)if(r){if(!A(n))return!1;let e=n.childNodes[r-1];e.contentEditable==`false`?r--:(n=e,r=M(n))}else if(n==e)return!0;else r=j(n),n=n.parentNode}function ot(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function st(e,t){for(let n=e,r=t;;)if(Le(n)&&r>0)return{node:n,offset:r};else if(A(n)&&r>0){if(n.contentEditable==`false`)return null;n=n.childNodes[r-1],r=M(n)}else if(n.parentNode&&!Ue(n))r=j(n),n=n.parentNode;else return null}function ct(e,t){for(let n=e,r=t;;)if(Le(n)&&r<n.nodeValue.length)return{node:n,offset:r};else if(A(n)&&r<n.childNodes.length){if(n.contentEditable==`false`)return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!Ue(n))r=j(n)+1,n=n.parentNode;else return null}var N=class e{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(t,n){return new e(t.parentNode,j(t),n)}static after(t,n){return new e(t.parentNode,j(t)+1,n)}},P=(function(e){return e[e.LTR=0]=`LTR`,e[e.RTL=1]=`RTL`,e})(P||={}),lt=P.LTR,ut=P.RTL;function dt(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<e[n]);return t}var ft=dt(`88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008`),pt=dt(`4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333`),mt=Object.create(null),F=[];for(let e of[`()`,`[]`,`{}`]){let t=e.charCodeAt(0),n=e.charCodeAt(1);mt[t]=n,mt[n]=-t}function ht(e){return e<=247?ft[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?pt[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var gt=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,I=class{get dir(){return this.level%2?ut:lt}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let i=-1;for(let a=0;a<e.length;a++){let o=e[a];if(o.from<=t&&o.to>=t){if(o.level==n)return a;(i<0||(r==0?e[i].level>o.level:r<0?o.from<t:o.to>t))&&(i=a)}}if(i<0)throw RangeError(`Index out of range`);return i}};function _t(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!_t(r.inner,i.inner))return!1}return!0}var L=[];function vt(e,t,n,r,i){for(let a=0;a<=r.length;a++){let o=a?r[a-1].to:t,s=a<r.length?r[a].from:n,c=a?256:i;for(let t=o,n=c,r=c;t<s;t++){let i=ht(e.charCodeAt(t));i==512?i=n:i==8&&r==4&&(i=16),L[t]=i==4?2:i,i&7&&(r=i),n=i}for(let e=o,t=c,r=c;e<s;e++){let i=L[e];if(i==128)e<s-1&&t==L[e+1]&&t&24?i=L[e]=t:L[e]=256;else if(i==64){let i=e+1;for(;i<s&&L[i]==64;)i++;let a=e&&t==8||i<n&&L[i]==8?r==1?1:8:256;for(let t=e;t<i;t++)L[t]=a;e=i-1}else i==8&&r==1&&(L[e]=1);t=i,i&7&&(r=i)}}}function yt(e,t,n,r,i){let a=i==1?2:1;for(let o=0,s=0,c=0;o<=r.length;o++){let l=o?r[o-1].to:t,u=o<r.length?r[o].from:n;for(let t=l,n,r,o;t<u;t++)if(r=mt[n=e.charCodeAt(t)]){if(r<0){for(let e=s-3;e>=0;e-=3)if(F[e+1]==-r){let n=F[e+2],r=n&2?i:n&4?n&1?a:i:0;r&&(L[t]=L[F[e]]=r),s=e;break}}else if(F.length==189)break;else F[s++]=t,F[s++]=n,F[s++]=c}else if((o=L[t])==2||o==1){let e=o==i;c=+!e;for(let t=s-3;t>=0;t-=3){let n=F[t+2];if(n&2)break;if(e)F[t+2]|=2;else{if(n&4)break;F[t+2]|=4}}}}}function bt(e,t,n,r){for(let i=0,a=r;i<=n.length;i++){let o=i?n[i-1].to:e,s=i<n.length?n[i].from:t;for(let c=o;c<s;){let o=L[c];if(o==256){let o=c+1;for(;;)if(o==s){if(i==n.length)break;o=n[i++].to,s=i<n.length?n[i].from:t}else if(L[o]==256)o++;else break;let l=a==1,u=l==((o<t?L[o]:r)==1)?l?1:2:r;for(let t=o,r=i,a=r?n[r-1].to:e;t>c;)t==a&&(t=n[--r].from,a=r?n[r-1].to:e),L[--t]=u;c=o}else a=o,c++}}}function xt(e,t,n,r,i,a,o){let s=r%2?2:1;if(r%2==i%2)for(let c=t,l=0;c<n;){let t=!0,u=!1;if(l==a.length||c<a[l].from){let e=L[c];e!=s&&(t=!1,u=e==16)}let d=!t&&s==1?[]:null,f=t?r:r+1,p=c;run:for(;;)if(l<a.length&&p==a[l].from){if(u)break run;let m=a[l];if(!t)for(let e=m.to,t=l+1;;){if(e==n)break run;if(t<a.length&&a[t].from==e)e=a[t++].to;else if(L[e]==s)break run;else break}l++,d?d.push(m):(m.from>c&&o.push(new I(c,m.from,f)),St(e,m.direction==lt==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.to),p=m.to}else if(p==n||(t?L[p]!=s:L[p]==s))break;else p++;d?xt(e,c,p,r+1,i,d,o):c<p&&o.push(new I(c,p,f)),c=p}else for(let c=n,l=a.length;c>t;){let n=!0,u=!1;if(!l||c>a[l-1].to){let e=L[c-1];e!=s&&(n=!1,u=e==16)}let d=!n&&s==1?[]:null,f=n?r:r+1,p=c;run:for(;;)if(l&&p==a[l-1].to){if(u)break run;let m=a[--l];if(!n)for(let e=m.from,n=l;;){if(e==t)break run;if(n&&a[n-1].to==e)e=a[--n].from;else if(L[e-1]==s)break run;else break}d?d.push(m):(m.to<c&&o.push(new I(m.to,c,f)),St(e,m.direction==lt==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.from),p=m.from}else if(p==t||(n?L[p-1]!=s:L[p-1]==s))break;else p--;d?xt(e,p,c,r+1,i,d,o):p<c&&o.push(new I(p,c,f)),c=p}}function St(e,t,n,r,i,a,o){let s=t%2?2:1;vt(e,i,a,r,s),yt(e,i,a,r,s),bt(i,a,r,s),xt(e,i,a,t,n,r,o)}function Ct(e,t,n){if(!e)return[new I(0,0,+(t==ut))];if(t==lt&&!n.length&&!gt.test(e))return wt(e.length);if(n.length)for(;e.length>L.length;)L[L.length]=256;let r=[],i=t==lt?0:1;return St(e,i,i,n,0,e.length,r),r}function wt(e){return[new I(0,e,0)]}var Tt=``;function Et(e,t,r,a,o){if(!e.length)return null;let s=a.head-e.from,c;if(a.head==e.from&&a.assoc<0){if(!o)return null;s=t[c=0].side(!1,r)}else if(a.head==e.to&&a.assoc>0){if(o)return null;s=t[c=t.length-1].side(!0,r)}else c=I.find(t,s,a.bidiLevel??-1,a.assoc);let l=t[c],u=l.side(o,r);if(s==u){let e=c+=o?1:-1;if(e<0||e>=t.length)return null;l=t[c=e],s=l.side(!o,r),u=l.side(o,r)}let d=n(e.text,s,l.forward(o,r));(d<l.from||d>l.to)&&(d=u),Tt=e.text.slice(Math.min(s,d),Math.max(s,d));let f=c==(o?t.length-1:0)?null:t[c+(o?1:-1)];if(d==u){if(!f)return o?i.cursor(e.to,1):i.cursor(e.from,-1);if(f.level+ +!o<l.level)return i.cursor(f.side(!o,r)+e.from,f.forward(o,r)?1:-1,f.level)}return i.cursor(d+e.from,l.forward(o,r)?-1:1,l.level)}function Dt(e,t,n){for(let r=t;r<n;r++){let t=ht(e.charCodeAt(r));if(t==1)return lt;if(t==2||t==4)return ut}}var Ot=_.define(),kt=_.define(),At=_.define(),jt=_.define(),Mt=_.define(),Nt=_.define(),Pt=_.define(),Ft=_.define(),It=_.define(),Lt=_.define({combine:e=>e.some(e=>e)}),Rt=_.define({combine:e=>e.some(e=>e)}),zt=_.define(),Bt=class e{constructor(e,t,n,r,i,a=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=a}map(t){return t.empty?this:new e(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new e(i.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},Vt=h.define({map:(e,t)=>e.map(t)}),Ht=h.define();function R(e,t,n){let r=e.facet(jt);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+`:`,t):console.error(t))}var z=_.define({combine:e=>!e.length||e[0]}),Ut=0,Wt=_.define({combine(e){return e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})}}),B=class e{constructor(e,t,n,r,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Wt.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Wt.of({plugin:this,arg:e}))}static define(t,n){let{eventHandlers:r,eventObservers:i,provide:a,decorations:o}=n||{};return new e(Ut++,t,r,i,e=>{let t=[];return o&&t.push(Jt.of(t=>{let n=t.plugin(e);return n?o(n):k.none})),a&&t.push(a(e)),t})}static fromClass(t,n){return e.define((e,n)=>new t(e,n),n)}},Gt=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(!this.value){if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){R(e.state,t,`CodeMirror plugin crashed`),this.deactivate()}}else if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(R(e.state,t,`CodeMirror plugin crashed`),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}return this}destroy(e){if(this.value?.destroy)try{this.value.destroy()}catch(t){R(e.state,t,`CodeMirror plugin crashed`)}}deactivate(){this.spec=this.value=null}},Kt=_.define(),qt=_.define(),Jt=_.define(),Yt=_.define(),Xt=_.define(),Zt=_.define(),Qt=_.define();function $t(e,t){let n=e.state.facet(Qt);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return y.spans(r,t.from,t.to,{point(){},span(e,n,r,a){let o=e-t.from,s=n-t.from,c=i;for(let e=r.length-1;e>=0;e--,a--){let t=r[e].spec.bidiIsolate,n;if(a>0&&c.length&&(n=c[c.length-1]).to==o&&n.direction==t)n.to=s,c=n.inner;else{let e={from:o,to:s,direction:t,inner:[]};c.push(e),c=e.inner}}}}),en(t.text,i)}function en(e,t){for(let n of t){if(n.direction==null){for(let t=n.from,r=0;t<n.to;r++){let i=r<n.inner.length?n.inner[r]:null,a=Dt(e,t,i?i.from:n.to);if(a){n.direction=a;break}if(!i)break;t=i.to}n.direction??=P.LTR}en(e,n.inner)}return t}var tn=_.define();function nn(e){let t=0,n=0,r=0,i=0;for(let a of e.state.facet(tn)){let o=a(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:t,right:n,top:r,bottom:i}}var rn=_.define(),V=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(t){return new e(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(t,n){if(n.length==0)return t;let r=[];for(let i=0,a=0,o=0;;){let s=i<t.length?t[i].fromB:1e9,c=a<n.length?n[a]:1e9,l=Math.min(s,c);if(l==1e9)break;let u=l+o,d=l,f=u;for(;;)if(a<n.length&&n[a]<=d){let e=n[a+1];a+=2,d=Math.max(d,e);for(let e=i;e<t.length&&t[e].fromB<=d;e++)o=t[e].toA-t[e].toB;f=Math.max(f,e+o)}else if(i<t.length&&t[i].fromB<=d){let e=t[i++];d=Math.max(d,e.toB),f=Math.max(f,e.toA),o=e.toA-e.toB}else break;r.push(new e(u,f,l,d))}return r}},an=class e{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=g.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new V(e,t,n,i))),this.changedRanges=r}static create(t,n,r){return new e(t,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},on=[],H=class{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return on}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let e=this.domAttrs;e&&De(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:``)+(this.breakAfter?`#`:``)}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw RangeError(`Invalid child in posBefore`)}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,n){return null}domPosFor(e,t){let n=j(this.dom),r=this.length?e>0:t>0;return new N(this.parent.dom,n+ +!!r,e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof ln)return e;return null}static get(e){return e.cmTile}},sn=class extends H{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,n=null,r,i=e?.node==t?e:null,a=0;for(let o of this.children){if(o.sync(e),a+=o.length+o.breakAfter,r=n?n.nextSibling:t.firstChild,i&&r!=o.dom&&(i.written=!0),o.dom.parentNode==t)for(;r&&r!=o.dom;)r=cn(r);else t.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:t.firstChild,i&&r&&(i.written=!0);r;)r=cn(r);this.length=a}};function cn(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var ln=class extends sn{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=H.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,i=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&i++,r=t.pop()}else{let a=n.children[r++];if(a instanceof un)t.push(r),n=a,r=0;else{let t=i+a.length,n=e(a,i);if(n!==void 0)return n;i=t+a.breakAfter}}}resolveBlock(e,t){let n,r=-1,i,a=-1;if(this.blockTiles((o,s)=>{let c=s+o.length;if(e>=s&&e<=c){if(o.isWidget()&&t>=-1&&t<=1){if(o.flags&32)return!0;o.flags&16&&(n=void 0)}(s<e||e==c&&(t<-1?o.length:o.covers(1)))&&(!n||!o.isWidget()&&n.isWidget())&&(n=o,r=e-s),(c>e||e==s&&(t>1?o.length:o.covers(-1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,a=e-s)}}),!n&&!i)throw Error(`No tile at position `+e);return n&&t<0||!i?{tile:n,offset:r}:{tile:i,offset:a}}},un=class e extends sn{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},dn=class e extends sn{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(t,n,r){let i=new e(n||document.createElement(`div`),t);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n=!1){let r=null,i=-1,a=null,o=-1;function s(e,c){for(let l=0,u=0;l<e.children.length&&u<=c;l++){let d=e.children[l],f=u+d.length;f>=c&&(d.isComposite()?s(d,c-u):(!a||n&&a.isHidden&&(t>0&&!(a.flags&32)||n&&pn(a,d)))&&(f>c||d.flags&32&&t<=1)?(a=d,o=c-u):(u<c||d.flags&16&&!(n&&d.isHidden)&&t>=-1)&&(r=d,i=c-u)),u=f}}s(this,e);let c=(t<0?r:a)||r||a;return c?{tile:c,offset:c==r?i:o}:null}coordsIn(e,t,n){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t,n):fn(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:r}=n;if(this.dom.contains(e.dom))return e.isText()?new N(e.dom,Math.min(e.dom.nodeValue.length,r)):e.domPosFor(r,e.flags&16?1:e.flags&32?-1:t);let i=n.tile.parent,a=!1;for(let e of i.children){if(a)return new N(e.dom,0);e==n.tile&&(a=!0)}}return new N(this.dom,0)}};function fn(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Ve(t);return n[n.length-1]||null}function pn(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}var U=class e extends sn{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},mn=class e extends H{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,a=e,o=0;e==0&&t<0||e==r&&t>=0?E.chrome||E.gecko||(e?(i--,o=1):a<r&&(a++,o=-1)):t<0?i--:a<r&&a++;let s=nt(this.dom,i,a).getClientRects();if(!s.length)return null;let c=s[(o?o<0:t>=0)?0:s.length-1];return E.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(s,e=>e.width)||c),n==null?c:Ge(c,(o?o>0:t<0)==n)}static of(t,n){let r=new e(n||document.createTextNode(t),t);return n||(r.flags|=2),r}},hn=class e extends H{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return Ge(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let r=this.flags&16?!0:this.flags&32?!1:e>0;for(let i=r?t.length-1:0;n=t[i],!(e>0?i==0:i==t.length-1||n.top<n.bottom);i+=r?-1:1);return Ge(n,!r)}}get overrideDOMText(){if(!this.length)return u.empty;let{root:e}=this;if(!e)return u.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,r,i,a){return a||(a=t.toDOM(n),t.editable||(a.contentEditable=`false`)),new e(a,r,t,i)}},gn=class extends H{constructor(e){let t=document.createElement(`img`);t.className=`cm-widgetBuffer`,t.setAttribute(`aria-hidden`,`true`),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return u.empty}coordsIn(e,t,n){let r=this.dom.getBoundingClientRect();return n==null?r:Ge(r,t>0==n)}},_n=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:i,beforeBreak:a,parents:o}=this;for(;e||t>0;)if(!r.isComposite()){let t=r.length;if(i<t&&e){let a=Math.min(e,t-i);n&&n.skip(r,i,i+a),e-=a,i+=a}if(i==t)a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++;else if(!e)break}else if(a){if(!e)break;n&&n.break(),e--,a=!1}else if(i==r.children.length){if(!e&&!o.length)break;n&&n.leave(r),a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++}else{let s=r.children[i],c=s.breakAfter;(t>0?s.length<=e:s.length<e)&&(!n||n.skip(s,0,s.length)!==!1||!s.isComposite)?(a=!!c,i++,e-=s.length):(o.push({tile:r,index:i}),r=s,i=0,n&&s.isComposite()&&n.enter(s))}return this.tile=r,this.index=i,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},vn=class{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}},yn=class{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){this.flushBuffer();let i=this.ensureMarks(t,n),a=i.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let t=i.children[i.children.length-1]=new mn(a.dom,a.text+e);t.parent=i}else i.append(r||mn.of(e,this.cache.find(mn)?.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?kn(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],i=r.lastChild;if(i instanceof U&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(kn(n.dom)),r=i;else{let{dom:e}=n;this.cache.reused.get(n)&&H.get(n.dom)&&(e=kn(n.dom));let t=U.of(n.mark,e);r.append(t),r=t}this.cache.reused.set(n,2)}let i=H.get(e.text);i&&this.cache.reused.set(i,2);let a=new mn(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,r.append(a)}addInlineWidget(e,t,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let i=this.ensureMarks(t,n);!r&&!(e.flags&16)&&i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){e||=En;let n=dn.start(e,t||this.cache.find(dn)?.dom,!!t);this.getBlockPos().append(this.lastBlock=this.curLine=n)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){let n=this.curLine;for(let r=e.length-1;r>=0;r--){let i=e[r],a;if(t>0&&(a=n.lastChild)&&a instanceof U&&a.mark.eq(i))n=a,t--;else{let e=U.of(i,this.cache.find(U,e=>e.mark.eq(i))?.dom);n.append(e),n=e,t=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!wn(this.curLine,!1)||e.dom.nodeName!=`BR`&&e.isWidget()&&!(E.ios&&wn(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(jn,0,32)||new hn(jn.toDOM(),0,jn,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,n=new vn(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){this.updateBlockWrappers();let e=this.root;for(let t of this.wrappers){let n=e.lastChild;if(t.from<this.pos&&n instanceof un&&n.wrapper.eq(t.wrapper))e=n;else{let n=un.of(t.wrapper,this.cache.find(un,e=>e.wrapper.eq(t.wrapper))?.dom);e.append(n),e=n}}return e}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(gn,void 0,1);return n&&(n.flags=t),n||new gn(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},bn=class{constructor(e){this.skipCount=0,this.text=``,this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text=``,this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skipCount);if(this.skipCount=0,r)throw Error(`Ran out of text content when drawing inline views`);this.text=t;let i=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,i)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}},xn=[hn,dn,mn,U,gn,un,ln];for(let e=0;e<xn.length;e++)xn[e].bucket=e;var Sn=class{constructor(e){this.view=e,this.buckets=xn.map(()=>[]),this.index=xn.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,i=this.buckets[r],a=this.index[r];for(let e=0;e<i.length;e++){let o=(e+a)%i.length,s=i[o];if((!t||t(s))&&!this.reused.has(s))return i.splice(o,1),o<a&&this.index[r]--,this.reused.set(s,n),s}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let i=0,a=0;;i++){if(i==r.length){if(a)return null;a=1,i=0}let o=r[i];if(!this.reused.has(o)&&(a==0?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view,o.widget)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,o.widget==e&&o.length==t&&(o.flags&497)==n?(this.reused.set(o,1),o):(this.reused.set(o,2),new hn(o.dom,t,e,o.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}},Cn=class{constructor(e,t,n,r,i){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new Sn(e),this.text=new bn(e.state.doc),this.builder=new yn(this.cache,new ln(e,e.contentDOM),y.iter(n)),this.cache.reused.set(t,2),this.old=new _n(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,i=0,a=0;;){let o=a<e.length?e[a++]:null,s=o?o.fromA:this.old.root.length;if(s>r){let e=s-r;this.preserve(e,!a,!o),r=s,i+=e}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(i,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,o.toA),this.emit(t.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(i,o.toB)),i=o.toB,r=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=On(this.old),i=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget()){if(this.openWidget)this.builder.continueWidget(n-t);else{let a=n>0||t<e.length?hn.of(e.widget,this.view,n-t,e.flags&496,this.cache.maybeReuse(e)):this.cache.reuse(e);a.flags&256?(a.flags&=-2,this.builder.addBlockWidget(a)):(this.builder.ensureLine(null),this.builder.addInlineWidget(a,r,i),i=r.length)}}else if(e.isText())this.builder.ensureLine(null),!t&&n==e.length&&!this.cache.reused.has(e)?this.builder.addText(e.text,r,i,this.cache.reuse(e)):(this.cache.add(e),this.builder.addText(e.text.slice(t,n),r,i)),i=r.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof gn)this.cache.add(e);else if(e instanceof U)this.builder.ensureLine(null),this.builder.addMark(e,r,i),this.cache.reused.set(e,1),i=r.length;else return!1;this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof U&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&=i=0:e instanceof U&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,i=-1,a=y.spans(this.decorations,e,t,{point:(e,t,a,o,s,c)=>{if(a instanceof Me){if(this.disallowBlockEffectsFor[c]){if(a.block)throw RangeError(`Block decorations may not be specified via plugins`);if(t>this.view.state.doc.lineAt(e).to)throw RangeError(`Decorations that replace line breaks may not be specified via plugins`)}if(i=o.length,s>o.length)r.continueWidget(t-e);else{let i=a.widget||(a.block?An.block:An.inline),c=Tn(a),l=this.cache.findWidget(i,t-e,c)||hn.of(i,this.view,t-e,c);a.block?(a.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(l)):(r.ensureLine(n),r.addInlineWidget(l,o,s))}n=null}else n=Dn(n,a);t>e&&this.text.skip(t-e)},span:(e,t,a,o)=>{for(let i=e;i<t;){let s=this.text.next(Math.min(512,t-i));s==null?(r.addLineStartIfNotCovered(n),r.addBreak(),i++):(r.ensureLine(n),r.addText(s,a,i==e?o:a.length),i+=s.length),n=null}i=a.length}});i>-1&&(this.openWidget=a>i),this.openWidget||r.addLineStartIfNotCovered(n),this.openMarks=a}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=H.get(r);if(r==this.view.contentDOM)break;e instanceof U?t.push(e):e?.isLine()?n=e:e instanceof un||(r.nodeName==`DIV`&&!n?n=new dn(r,En):n||t.push(U.of(new Ae({tagName:r.nodeName.toLowerCase(),attributes:ke(r)}),r)))}return n?{line:n,marks:t}:null}};function wn(e,t){let n=e=>{for(let r of e.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function Tn(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}var En={class:`cm-line`};function Dn(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||={class:`cm-line`},n&&we(n,e),r&&(e.class+=` `+r)),e}function On(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof U&&t.push(r.mark)}return t}function kn(e){let t=H.get(e);return t&&t.setDOM(e.cloneNode()),e}var An=class extends D{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};An.inline=new An(`span`),An.block=new An(`div`);var jn=new class extends D{toDOM(){return document.createElement(`br`)}get isHidden(){return!0}get editable(){return!0}},Mn=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=k.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new ln(e,e.contentDOM),this.updateInner([new V(0,0,0,e.state.doc.length)],null)}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(this.domChanged?.newSel?n=this.domChanged.newSel.head:!Un(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?In(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:n,to:r}=this.hasComposition;t=new V(n,r,e.changes.mapPos(n,-1),e.changes.mapPos(r,1)).addToSet(t.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(E.ie||E.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,a=this.blockWrappers;this.updateDeco();let o=zn(i,this.decorations,e.changes);o.length&&(t=V.extendWithRanges(t,o));let s=Vn(a,this.blockWrappers,e.changes);return s.length&&(t=V.extendWithRanges(t,s)),r&&!t.some(e=>e.fromA<=r.range.fromA&&e.toA>=r.range.toA)&&(t=r.range.addToSet(t.slice())),this.tile.flags&2&&t.length==0?!1:(this.updateInner(t,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,r=new Cn(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&H.get(t.text)&&r.cache.reused.set(H.get(t.text),2),this.tile=r.run(e,t),Nn(n,r.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+`px`,this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+`px`:``;let r=E.chrome||E.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||n.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=``});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof Wn&&r.push(e.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(Ht)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,i=r==n,a=!i&&!(this.view.state.facet(z)||n.tabIndex>-1)&&Be(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(i||t||a))return;let o=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,c,l;if(s.empty?l=c=this.inlineDOMNearPos(s.anchor,s.assoc||1):(l=this.inlineDOMNearPos(s.head,s.head==s.from?1:-1),c=this.inlineDOMNearPos(s.anchor,s.anchor==s.from?1:-1)),E.gecko&&s.empty&&!this.hasComposition&&Pn(c)){let e=document.createTextNode(``);this.view.observer.ignore(()=>c.node.insertBefore(e,c.node.childNodes[c.offset]||null)),c=l=new N(e,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!He(c.node,c.offset,u.anchorNode,u.anchorOffset)||!He(l.node,l.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,s))&&(this.view.observer.ignore(()=>{E.android&&E.chrome&&n.contains(u.focusNode)&&Hn(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=Re(this.view.root);if(e){if(s.empty){if(E.gecko){let e=Ln(c.node,c.offset);if(e&&e!=3){let t=(e==1?st:ct)(c.node,c.offset);t&&(c=new N(t.node,t.offset))}}e.collapse(c.node,c.offset),s.bidiLevel!=null&&e.caretBidiLevel!==void 0&&(e.caretBidiLevel=s.bidiLevel)}else if(e.extend){e.collapse(c.node,c.offset);try{e.extend(l.node,l.offset)}catch{}}else{let t=document.createRange();s.anchor>s.head&&([c,l]=[l,c]),t.setEnd(l.node,l.offset),t.setStart(c.node,c.offset),e.removeAllRanges(),e.addRange(t)}}a&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,l)),this.impreciseAnchor=c.precise?null:new N(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new N(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&He(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Re(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let o=a.posAtStart;if(t.head==o||t.head==o+a.length)return;let s=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!s||!c||s.bottom>c.top)return;let l=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(l.node,l.offset),n.modify(`move`,t.assoc<0?`forward`:`backward`,`lineboundary`),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(r,i)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let i;if(e==n.dom)i=n.dom.childNodes[t];else{let r=M(e)==0?0:t==0?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;r==0&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}i=r<0?e:e.nextSibling}if(i==n.dom.firstChild)return r;for(;i&&!H.get(i);)i=i.nextSibling;if(!i)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==i)return t;t+=r.length+r.breakAfter}}else if(n.isText())return e==n.dom?r+t:r+(t?n.length:0);else return r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(r,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,i=!1,a,o=-1,s=!1;return this.tile.blockTiles((t,c)=>{if(t.isWidget()){if(t.flags&32&&c>=e)return!0;t.flags&16&&(i=!0)}else{let l=c+t.length;if(c<=e&&(n=t,r=e-c,i=l<e),l>=e&&!a&&(a=t,o=e-c,s=c>e),c>e&&a)return!0}}),!n&&!a?this.domAtPos(e,t):(i&&a?n=null:s&&n&&(a=null),n&&t<0||!a?n.domIn(r,t):a.domIn(o,t))}coordsAt(e,t,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof Wn?null:r.coordsInWidget(i,t,!0):r.coordsIn(i,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:r}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function i(e,t){if(e.isComposite())for(let n of e.children){if(n.length>=t){let e=i(n,t);if(e)return e}if(t-=n.length,t<0)break}else if(e.isText()&&t<e.length){let r=n(e.text,t);if(r==t)return null;let i=nt(e.dom,t,r).getClientRects();for(let e=0;e<i.length;e++){let t=i[e];if(e==i.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}return i(t,r)}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,i=this.view.contentDOM.clientWidth,a=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,s=this.view.textDirection==P.LTR,c=0,l=(e,u,d)=>{for(let f=0;f<e.children.length&&!(u>r);f++){let r=e.children[f],p=u+r.length,m=r.dom.getBoundingClientRect(),{height:h}=m;if(d&&!f&&(c+=m.top-d.top),r instanceof un)p>n&&l(r,u,m);else if(u>=n&&(c>0&&t.push(-c),t.push(h+c),c=0,a)){let e=r.dom.lastChild,t=e?Ve(e):[];if(t.length){let e=t[t.length-1],n=s?e.right-m.left:m.right-e.left;n>o&&(o=n,this.minWidth=i,this.minWidthFrom=u,this.minWidthTo=p)}}d&&f==e.children.length-1&&(c+=d.bottom-m.bottom),u=p+r.breakAfter}};return l(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction==`rtl`?P.RTL:P.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t=0,n;for(let r of e.children){if(!r.isText()||/[^ -~]/.test(r.text))return;let e=Ve(r.dom);if(e.length!=1)return;t+=e[0].width,n=e[0].height}if(t)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:t/e.length,textHeight:n}}});if(e)return e;let t=document.createElement(`div`),n,r,i;return t.className=`cm-line`,t.style.width=`99999px`,t.style.position=`absolute`,t.textContent=`abc def ghi jkl mno pqr stu`,this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let e=Ve(t.firstChild)[0];n=t.getBoundingClientRect().height,r=e&&e.width?e.width/27:7,i=e&&e.height?e.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],a=i?i.from-1:this.view.state.doc.length;if(a>n){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(k.replace({widget:new Wn(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!i)break;n=i.to+1}return k.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Jt).map(t=>(this.dynamicDecorationMap[e++]=typeof t==`function`)?t(this.view):t),n=!1,r=this.view.state.facet(Xt).map((e,t)=>{let r=typeof e==`function`;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(y.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Yt).map(e=>typeof e==`function`?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=t.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let t of this.view.state.facet(zt))try{if(t(this.view,e.range,e))return!0}catch(e){R(this.view.state,e,`scroll handler`)}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let i=nn(this.view),a={left:n.left-i.left,top:n.top-i.top,right:n.right+i.right,bottom:n.bottom+i.bottom},{offsetWidth:o,offsetHeight:s}=this.view.scrollDOM;if(Je(this.view.scrollDOM,a,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,o),-o),Math.max(Math.min(e.yMargin,s),-s),this.view.textDirection==P.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(t.head,1);if(e){let t=Ze(e.dom);e.dom.scrollIntoView({block:`nearest`}),Qe(t,!1)}}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Nn(this.tile)}};function Nn(e,t){let n=t?.get(e);if(n!=1){n??e.destroy();for(let n of e.children)Nn(n,t)}}function Pn(e){return A(e.node)&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable==`false`)&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable==`false`)}function Fn(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=st(n.focusNode,n.focusOffset),i=ct(n.focusNode,n.focusOffset),a=r||i;if(i&&r&&i.node!=r.node){let t=H.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)a=i;else if(e.docView.lastCompositionAfterCursor){let e=H.get(r.node);!e||e.isText()&&e.text!=r.node.nodeValue||(a=i)}}if(e.docView.lastCompositionAfterCursor=a!=r,!a)return null;let o=t-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function In(e,t,n){let r=Fn(e,n);if(!r)return null;let{node:i,from:a,to:o}=r,s=i.nodeValue;if(/[\n\r]/.test(s)||e.state.doc.sliceString(r.from,r.to)!=s)return null;let c=t.invertedDesc;return{range:new V(c.mapPos(a),c.mapPos(o),a,o),text:i}}function Ln(e,t){return A(e)?(t&&e.childNodes[t-1].contentEditable==`false`?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable==`false`?2:0):0}var Rn=class{constructor(){this.changes=[]}compareRange(e,t){Fe(e,t,this.changes)}comparePoint(e,t){Fe(e,t,this.changes)}boundChange(e){Fe(e,e,this.changes)}};function zn(e,t,n){let r=new Rn;return y.compare(e,t,n,r),r.changes}var Bn=class{constructor(){this.changes=[]}compareRange(e,t){Fe(e,t,this.changes)}comparePoint(){}boundChange(e){Fe(e,e,this.changes)}};function Vn(e,t,n){let r=new Bn;return y.compare(e,t,n,r),r.changes}function Hn(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(A(n)&&n.contentEditable==`false`)return!0;return!1}function Un(e,t){let n=!1;return t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)}),n}var Wn=class extends D{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement(`div`);return e.className=`cm-gap`,this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+`px`,!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function Gn(e,t,r=1){let a=e.charCategorizer(t),o=e.doc.lineAt(t),s=t-o.from;if(o.length==0)return i.cursor(t);s==0?r=1:s==o.length&&(r=-1);let c=s,l=s;r<0?c=n(o.text,s,!1):l=n(o.text,s);let u=a(o.text.slice(c,l));for(;c>0;){let e=n(o.text,c,!1);if(a(o.text.slice(e,c))!=u)break;c=e}for(;l<o.length;){let e=n(o.text,l);if(a(o.text.slice(l,e))!=u)break;l=e}return i.undirectionalRange(c+o.from,l+o.from)}function Kn(e,n,r,i,a){let o=Math.round((i-n.left)*e.defaultCharacterWidth);if(e.lineWrapping&&r.height>e.defaultLineHeight*1.5){let t=e.viewState.heightOracle.textHeight,n=Math.floor((a-r.top-(e.defaultLineHeight-t)*.5)/t);o+=n*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(r.from,r.to);return r.from+t(s,o,e.state.tabSize)}function qn(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!e||i.type==O.Text&&(e.type!=i.type||(n<0?i.from<t:i.to>t)))&&(e=i)}}return e||r}return r}function Jn(e,t,n,r){let a=qn(e,t.head,t.assoc||-1),o=!r||a.type!=O.Text||!(e.lineWrapping||a.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>a.from?t.head-1:t.head);if(o){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(a.from),s=e.posAndSideAtCoords({x:n==(r==P.LTR)?t.right-1:t.left+1,y:(o.top+o.bottom)/2});if(s)return i.cursor(s.pos,s.assoc)}return i.cursor(n?a.to:a.from,n?1:-1)}function Yn(e,t,n,r){let a=e.state.doc.lineAt(t.head),o=e.bidiSpans(a),s=e.textDirectionAt(a.from);for(let c=t,l=null;;){let t=Et(a,o,s,c,n),u=Tt;if(!t){if(a.number==(n?e.state.doc.lines:1))return c;u=`
|
|
4
4
|
`,a=e.state.doc.line(a.number+(n?1:-1)),o=e.bidiSpans(a),t=n?i.cursor(a.from,-1):i.cursor(a.to,1)}if(!l){if(!r)return t;l=r(u)}else if(!l(u))return c;c=t}}function Xn(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==d.Space&&(i=t),i==t}}function Zn(e,t,n,r){let a=t.head,o=n?1:-1;if(a==(n?e.state.doc.length:0))return i.cursor(a,t.assoc);let s=t.goalColumn,c,l=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(a,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),d=e.documentTop;if(u)s??=u.left-l.left,c=o<0?u.top:u.bottom;else{let t=e.viewState.lineBlockAt(a);s??=Math.min(l.right-l.left,e.defaultCharacterWidth*(a-t.from)),c=(o<0?t.top:t.bottom)+d}let f=l.left+s,p=e.viewState.heightOracle.textHeight>>1,m=r??p;for(let t=0;;t+=p){let r=c+(m+t)*o,a=tr(e,{x:f,y:r},!1,o);if(n?r>l.bottom:r<l.top)return i.cursor(a.pos,a.assoc);let u=e.coordsAtPos(a.pos,a.assoc),d=u?(u.top+u.bottom)/2:0;if(!u||(n?d>c:d<c))return i.cursor(a.pos,a.assoc,void 0,s)}}function Qn(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,(e,i,a)=>{if(t>e&&t<i){let a=r||n||(t-e<i-t?-1:1);t=a<0?e:i,r=a}});if(!r)return t}}function $n(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let a=t.ranges[r],o=null;if(a.empty){let t=Qn(e,a.from,0);t!=a.from&&(o=i.cursor(t,-1))}else{let t=Qn(e,a.from,-1),n=Qn(e,a.to,1);(t!=a.from||n!=a.to)&&(o=a.undirectional?i.undirectionalRange(a.from,a.to):i.range(a.from==a.anchor?t:n,a.from==a.head?t:n))}o&&(n||=t.ranges.slice(),n[r]=o)}return n?i.create(n,t.mainIndex):t}function er(e,t,n){let r=Qn(e.state.facet(Zt).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:i.cursor(r,r<n.from?1:-1)}var W=class{constructor(e,t){this.pos=e,this.assoc=t}};function tr(e,t,n,r){let i=e.contentDOM.getBoundingClientRect(),a=i.top+e.viewState.paddingTop,{x:o,y:s}=t,c=s-a,l;for(;;){if(c<0)return new W(0,1);if(c>e.viewState.docHeight)return new W(e.state.doc.length,-1);if(l=e.elementAtHeight(c),r==null)break;if(l.type==O.Text){if(r<0?l.to<e.viewport.from:l.from>e.viewport.to)break;let t=e.docView.coordsAt(r<0?l.from:l.to,r>0?-1:1);if(t&&(r<0?t.top<=c+a:t.bottom>=c+a))break}let t=e.viewState.heightOracle.textHeight/2;c=r>0?l.bottom+t:l.top-t}if(e.viewport.from>=l.to||e.viewport.to<=l.from){if(n)return null;if(l.type==O.Text){let t=Kn(e,i,l,o,s);return new W(t,t==l.from?1:-1)}}if(l.type!=O.Text)return c<(l.top+l.bottom)/2?new W(l.from,1):new W(l.to,-1);let u=e.docView.lineAt(l.from,2);return(!u||u.length!=l.length)&&(u=e.docView.lineAt(l.from,-2)),new nr(e,o,s,e.textDirectionAt(l.from)).scanTile(u,l.from)}var nr=class{constructor(e,t,n,r){this.view=e,this.x=t,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[I.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[I.find(r,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<t)}scan(e,t,n=!1){let r=0,i=e.length-1,a=new Set,o=this.bidiIn(e[0],e[i]),s,c,l=-1,u=1e9,d;search:for(;r<i;){let n=i-r,f=r+i>>1;adjust:if(a.has(f)){for(let e=1;e<n;e++){let t=f+e;if(t>=i&&(t-=n),!a.has(t)){f=t;break adjust}}break search}a.add(f);let p=t(f),m=0;if(p)for(let e=0;e<p.length;e++){let t=p[e];if(!(t.width==0&&p.length>1)){if(t.bottom<this.y)(!s||s.bottom<t.bottom)&&(s=t),m=1;else if(t.top>this.y)(!c||c.top>t.top)&&(c=t),m=-1;else{let e=t.left>this.x?this.x-t.left:t.right<this.x?this.x-t.right:0,n=Math.abs(e);n<u&&(l=f,u=n,d=t),e&&(m=e<0==(this.baseDir==P.LTR)?-1:1)}}}m==-1&&(!o||this.baseDirAt(e[f],1))?i=f:m==1&&(!o||this.baseDirAt(e[f+1],-1))&&(r=f+1)}if(!d){if(!c&&!s)return{i:0,after:!1};let n=s&&(!c||this.y-s.bottom<c.top-this.y)?s:c;return this.y=(n.top+n.bottom)/2,this.scan(e,t,!0)}if(u&&!n){let{top:n,bottom:r}=d;if(s&&s.bottom>(n+n+r)/3)return this.y=s.bottom-1,this.scan(e,t,!0);if(c&&c.top<(n+r+r)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(o?this.dirAt(e[l],1):this.baseDir)==P.LTR;return{i:l,after:this.x>(d.left+d.right)/2==f}}scanText(e,t){let r=[];for(let i=0;i<e.length;i=n(e.text,i))r.push(t+i);r.push(t+e.length);let i=this.scan(r,n=>{let i=r[n]-t,a=r[n+1]-t;return nt(e.dom,i,a).getClientRects()});return i.after?new W(r[i.i+1],-1):new W(r[i.i],1)}scanTile(e,t){if(!e.length)return new W(t,1);if(e.children.length==1){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let r=0,i=t;r<e.children.length;r++)n.push(i+=e.children[r].length);let r=this.scan(n,t=>{let n=e.children[t];return n.flags&48?null:(A(n.dom)?n.dom:nt(n.dom,0,n.length)).getClientRects()}),i=e.children[r.i],a=n[r.i];return i.isText()?this.scanText(i,a):i.isComposite()?this.scanTile(i,a):r.after?new W(n[r.i+1],-1):new W(a,1)}},rr=``,ir=class{constructor(e,t){this.points=e,this.view=t,this.text=``,this.lineSeparator=t.state.facet(m.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=rr}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=H.get(r),a=r.nextSibling;if(a==t){i?.breakAfter&&!a&&n!=this.view.contentDOM&&this.lineBreak();break}let o=H.get(a);(i&&o?i.breakAfter:(i?i.breakAfter:Ue(r))||Ue(a)&&(r.nodeName!=`BR`||i?.isWidget())&&this.text.length>e)&&!or(a,t)&&this.lineBreak(),r=a}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,a=1,o;if(this.lineSeparator?(i=t.indexOf(this.lineSeparator,n),a=this.lineSeparator.length):(o=r.exec(t))&&(i=o.index,a=o[0].length),this.append(t.slice(n,i<0?t.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=a-1);n=i+a}}readNode(e){let t=H.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else Le(e)?this.readTextNode(e):e.nodeName==`BR`?e.nextSibling&&this.lineBreak():A(e)&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(Le(e)?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(ar(e,n.node,n.offset)?t:0))}};function ar(e,t,n){for(;;){if(!t||n<M(t))return!1;if(t==e)return!0;n=j(t)+1,t=t.parentNode}}function or(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=H.get(e);if(!t?.isWidget())return!1;t&&(n||=[]).push(t)}if(n){for(let e of n)if(e.overrideDOMText?.length)return!1}return!0}var sr=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},cr=class{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text=``,this.domChanged=t>-1;let{impreciseHead:a,impreciseAnchor:o}=e.docView,s=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=lr(e.docView.tile,t,n,0))){let t=a||o?[]:mr(e),n=new ir(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=hr(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=a&&a.node==t.focusNode&&a.offset==t.focusOffset||!ze(e.contentDOM,t.focusNode)?s.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=o&&o.node==t.anchorNode&&o.offset==t.anchorOffset||!ze(e.contentDOM,t.anchorNode)?s.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),c=e.viewport;if((E.ios||E.chrome)&&n!=r&&Math.min(n,r)<=s.main.from&&Math.max(n,r)>=s.main.to&&(c.from>0||c.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),a=c.from-t,o=c.to-i;(a==0||a==1||t==0)&&(o==0||o==-1||i==e.state.doc.length)&&(n=0,r=e.state.doc.length)}if(e.inputState.composing>-1&&s.ranges.length>1)this.newSel=s.replaceRange(i.range(r,n));else if(e.lineWrapping&&r==n&&!(s.main.empty&&s.main.head==n)&&e.inputState.lastTouchTime>Date.now()-100){let t=e.coordsAtPos(n,-1),r=0;t&&(r=e.inputState.lastTouchY<=t.bottom?-1:1),this.newSel=i.create([i.cursor(n,r)])}else this.newSel=i.single(r,n)}}};function lr(e,t,n,r){if(e.isComposite()){let i=-1,a=-1,o=-1,s=-1;for(let c=0,l=r,u=r;c<e.children.length;c++){let r=e.children[c],d=l+r.length;if(l<t&&d>n)return lr(r,t,n,l);if(d>=t&&i==-1&&(i=c,a=l),l>n&&r.dom.parentNode==e.dom){o=c,s=u;break}u=d,l=d+r.breakAfter}return{from:a,to:s<0?r+e.length:s,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function ur(e,t){let n,{newSel:r}=t,{state:a}=e,o=a.selection.main,s=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:r}=t.bounds,i=o.from,c=null;(s===8||E.android&&t.text.length<r-e)&&(i=o.to,c=`end`);let l=a.doc.sliceString(e,r,rr),d,f;!o.empty&&o.from>=e&&o.to<=r&&(t.typeOver||l!=t.text)&&l.slice(0,o.from-e)==t.text.slice(0,o.from-e)&&l.slice(o.to-e)==t.text.slice(d=t.text.length-(l.length-(o.to-e)))?n={from:o.from,to:o.to,insert:u.of(t.text.slice(o.from-e,d).split(rr))}:(f=pr(l,t.text,i-e,c))&&(E.chrome&&s==13&&f.toB==f.from+2&&t.text.slice(f.from,f.toB)==``&&f.toB--,n={from:e+f.from,to:e+f.toA,insert:u.of(t.text.slice(f.from,f.toB).split(rr))})}else r&&(!e.hasFocus&&a.facet(z)||gr(r,o))&&(r=null);if(!n&&!r)return!1;if((E.mac||E.android)&&n&&n.from==n.to&&n.from==o.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute(`autocorrect`)==`off`?(r&&n.insert.length==2&&(r=i.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:u.of([n.insert.toString().replace(`.`,` `)])}):a.doc.lineAt(o.from).to<o.to&&e.docView.lineHasWidget(o.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:o.from,to:o.to,insert:a.toText(e.inputState.insertingText)}:E.chrome&&n&&n.from==n.to&&n.from==o.head&&n.insert.toString()==`
|