@evandu/super-pi 0.1.219 → 0.1.221

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/agents/project-leader.md +3 -2
  2. package/agents/super-pi-task/core.ts +1 -1
  3. package/dist/client/.super-pi-client-sources.json +6 -6
  4. package/dist/client/assets/{CodeMirrorEditor-BoRBaVec.js → CodeMirrorEditor-Cv1X2hmd.js} +2 -2
  5. package/dist/client/assets/{dist-CYpk6fXT.js → dist-B3GZVLeH.js} +1 -1
  6. package/dist/client/assets/{dist-DQ_C0DEU.js → dist-BA1wBjGJ.js} +1 -1
  7. package/dist/client/assets/{dist-CPjKkcyd.js → dist-BT_Z_-2X.js} +1 -1
  8. package/dist/client/assets/{dist-Digy2Mj0.js → dist-BqNxkXgs.js} +1 -1
  9. package/dist/client/assets/{dist-CiRgPe6t.js → dist-Bxyffyjn.js} +1 -1
  10. package/dist/client/assets/{dist-D1hdxSH6.js → dist-C-Kbr0WK.js} +1 -1
  11. package/dist/client/assets/{dist-CIv6vCdn.js → dist-C071I6sD.js} +1 -1
  12. package/dist/client/assets/{dist-CMdO3YzL.js → dist-C729XRkf.js} +1 -1
  13. package/dist/client/assets/{dist-BOF4T7jI.js → dist-CRfLPcZ8.js} +1 -1
  14. package/dist/client/assets/{dist-Dwsqs8C-.js → dist-CT23BwQB.js} +1 -1
  15. package/dist/client/assets/{dist-mAA5Fw0-.js → dist-CVErcv3I.js} +1 -1
  16. package/dist/client/assets/{dist-Cp3XgqJR.js → dist-CeHhOkTz.js} +1 -1
  17. package/dist/client/assets/{dist-CjhpwEGf.js → dist-ClwDCrdU.js} +1 -1
  18. package/dist/client/assets/{dist-xb23AFcT.js → dist-CsqiBKUZ.js} +1 -1
  19. package/dist/client/assets/{dist-DvWgfLRt.js → dist-DPYofnO9.js} +1 -1
  20. package/dist/client/assets/{dist-DUbHNa35.js → dist-DlBSkHdo.js} +1 -1
  21. package/dist/client/assets/{dist-DLYLxwOe.js → dist-DrNjVA0k.js} +1 -1
  22. package/dist/client/assets/{dist-BVVJTFYw.js → dist-Gvvox7eW.js} +1 -1
  23. package/dist/client/assets/{dist-BXOV_xtI.js → dist-IohJ9Qkl.js} +1 -1
  24. package/dist/client/assets/{dist-BOC9yjsN.js → dist-J-F3f1eU.js} +1 -1
  25. package/dist/client/assets/{dist-Bh20DSAa.js → dist-w6rH3SJG.js} +1 -1
  26. package/dist/client/assets/{dist-gRtmlyhZ.js → dist-xdw6XDXx.js} +1 -1
  27. package/dist/client/assets/index-B-h_KnC5.css +1 -0
  28. package/dist/client/assets/{index-DmxXnVfN.js → index-CCF1Ymba.js} +11 -11
  29. package/dist/client/index.html +2 -2
  30. package/dist/server/application/extension-ui-service.d.ts +2 -1
  31. package/dist/server/application/extension-ui-service.js +25 -17
  32. package/dist/server/application/project-service.d.ts +48 -3
  33. package/dist/server/application/project-service.js +123 -38
  34. package/dist/server/application/run-service.d.ts +3 -1
  35. package/dist/server/application/run-service.js +20 -5
  36. package/dist/server/application/session-orchestrator-service.d.ts +62 -0
  37. package/dist/server/application/session-orchestrator-service.js +122 -1
  38. package/dist/server/application/session-reminder-service.js +1 -2
  39. package/dist/server/index.js +5 -1
  40. package/dist/server/runtime.js +2 -2
  41. package/dist/server/store.d.ts +10 -3
  42. package/dist/server/store.js +87 -20
  43. package/dist/server/types.d.ts +7 -0
  44. package/dist/shared/project-overview.d.ts +12 -0
  45. package/dist/shared/project-overview.js +15 -0
  46. package/dist/shared/session-reporting.d.ts +14 -0
  47. package/dist/shared/session-reporting.js +11 -0
  48. package/package.json +5 -1
  49. package/dist/client/assets/index-Nu--gcBs.css +0 -1
@@ -21,7 +21,8 @@ description: 协调敏捷开发中的实现与交付,适合项目根 Leader
21
21
  轻量项目只登记执行任务,经 `dispatch` 后亲自执行并 `submit`,不拆子任务、不调用 `request_review`,明确交付为自评。
22
22
  用 `resolve_escalation` 处理收件人为自己的直属升级并记录决定;Boss 级事项不能自行关闭。
23
23
  遇到阻塞用 `project(action="report", kind="blocked", ...)` 上报:分支报直接上级;根负责人先自行排查处理,普通阻塞不变成用户待办。
24
- 需要更高层决策时用 `escalate`,分支收件人自动是直接上级;只有根负责人判断需要 Boss 决策时才向 Boss 升级。
25
- 不要用 `question` 直接问 Boss;分支让上级逐级代问,根负责人用升级记录需要 Boss 决定的问题。
24
+ 需要更高层决策时用 `escalate`。只要本会话有父会话,即使你是项目负责人,收件人也是直属父会话。
25
+ 上级先处理自己能解决的事,确需再上报才重新收敛问题。只有没有父会话的团队顶层才向用户发出决策请求。
26
+ 不要用 `question` 直接问 Boss;团队顶层通过项目升级记录确需用户决定的问题。
26
27
  按项目分工与汇报线委派任务,不要用 `session_spawn` / `session_dispatch` / `task` / `workflow` 绕开项目职责与汇报线;派发后等待子会话自动回传,不要轮询。
27
28
  根负责人在本阶段必需任务按模式验收、例外均处理后调用 `deliver`,记录总结及 `evidenceRefs`。后续继续在同一项目安排新任务或让原会话补充验证。只用 `session_remove` 删除自己的直属子会话。
@@ -1141,7 +1141,7 @@ export async function executeScheduledTask(
1141
1141
  export const PROJECT_TOOL_NAME = "project";
1142
1142
  export const PROJECT_ENDPOINT_ENV = "SUPER_PI_PROJECT_ENDPOINT";
1143
1143
 
1144
- export const PROJECT_DESCRIPTION = `Manage an agile coding team project through clear delegation, evidence, independent review and level-by-level reporting. When the user describes a project in natural language, to create a project you ONLY need title and objective — all other fields (deliverables, acceptanceCriteria, constraints, risk, tasks, default profiles, mode) are optional; omit whatever you do not already have, leaving them out never blocks starting, and never pause to invent or fill optional parameters before calling action="create". Call action="create" with title and objective (plus any optional fields you already know) to stand up the project in one call: create registers the project (and any optional top-level tasks), spawns the leader session, and starts it immediately with the full context (no separate start call or initial project(action="get") is needed before work begins; action="start" remains available for a planning project created outside the tool). Optional fields include deliverables, acceptanceCriteria, constraints, risk (defaults to low; any value is accepted without error), defaultLeaderProfile/defaultExecutorProfile/defaultReviewerProfile, and mode: standard (the default) or lightweight. For a small self-contained project, create it with mode="lightweight": the project leader session does the work itself, the project has no separate worker or reviewer sessions, and a task is accepted on the worker's own evidence. Use the standard mode when the work needs an independent review. In a lightweight project the leader registers only executor tasks, never splits into child tasks and never asks for a review - a submitted task is a completed task. The conversation that created a project may cancel it with action="cancel" and a reason: the project is marked cancelled, its running sessions are stopped, and its record, tasks, events and evidence are kept. Only that initiating conversation may cancel it - a worker or reviewer cannot cancel the project it belongs to. If you choose to pass the optional tasks array, each entry only needs a title and an objective, and its dependencies name the titles of sibling tasks in the same array. You are the initiator: you may create the project, register top-level tasks and cancel if needed; you may not register child tasks or interfere with member execution. Only a root conversation may create a project. Top-level tasks can also be registered later with add_task. When the user asks "我的项目现在怎么样", "我还有哪些项目在跑", "列出所有项目", or wants an overview of running projects, call action="list" first to retrieve up to 20 most recently updated projects with lightweight summaries (headline, task counts, active workers, tokens) without needing a projectId; the response returns projects, total, and returned counts, where total > returned indicates more historical projects exist in the workspace. Never guess a projectId to call get blindly; only call get when the user targets a specific project and you need deep task, escalation or event details. The project leader receives the current tasks in its startup context and does not need to call get before dispatching; it uses add_task (only title and objective are required; deliverables, acceptanceCriteria, dependencies, role=leader/executor, and executorProfile/reviewerProfile with agentId, cwd, model, thinkingLevel, watchdogTimeoutSeconds are optional), dispatch and request_review. A branch leader creates children with parentTaskId set to its own task ID and manages only its direct tasks. Dependencies must be siblings. Leader aggregate submission requires independently accepted children. Keep at most 3 leader levels and 8 branch leaders; small projects need only one executor. Workers submit output plus evidenceRefs. Only the assigned independent reviewer can review with verdict accepted or changes_requested, summary and evidenceRefs. update_task marks blocked/failed with blockedReason, updates executorProfile/reviewerProfile before child sessions spawn, or the leader resets ready for retry. report records kind=progress/blocked, progress, summary, variance, nextStep, risks, decisionNeeded and evidenceRefs; blocked reports notify your direct supervisor rather than directly alerting Boss. escalate records an optional title, a reason and severity=low/medium/high. The title is ONE SENTENCE naming what the reader has to decide - the question - and the reason is the case for it: why it matters, what the evidence shows, what happens if nobody decides. Give a title whenever the question can be said in one line, because the reader decides on the title and reads the reason only when the question is not obvious; without a title the escalation falls back to its reason. member escalations route to your direct supervisor, and only project leader escalations reach Boss. resolve_escalation closes an escalation that was addressed to you: pass escalationId, decision and status (resolved, dismissed or returned, default resolved). Take escalationId from the escalations array that project(action=get) returns - it is the id of the one escalation you are answering, and the same array tells you whether it is still open. decision is your handling note: what you decided and why. status is optional and defaults to resolved; use dismissed when the question no longer stands. status="returned" means the material was not enough to decide on: the case goes back to whoever raised it, and that person is woken up to supply what is missing instead of the case hanging unanswered. It only accepts a supervisor escalation whose target session is your own - only the session an escalation names may answer it - and an escalation addressed to Boss is the Boss's to decide and is refused for you. Resolving it cascades: the member who raised the escalation is woken up with your decision. deliver records a milestone once the required tasks are accepted - independently reviewed in the standard mode, self-accepted in the lightweight mode - with summary and evidenceRefs. Continue the same project for future tasks. Only a direct parent removes its child sessions using session_remove. action="export" returns the project as a Markdown report: the objective, every task with its delivery, evidence and review, the exceptions and how they were decided, and the full timeline. Use it when the user asks for a summary, a handover, or a status write-up of the project. Project and task IDs come from create/get/add_task. Reads never invoke models. Dispatch is asynchronous and starts the child session immediately; wait for child completion reports instead of polling. Do not use session_spawn, session_dispatch, task or workflow to bypass the project's delegation and reporting chain. Never claim success on an error.`;
1144
+ export const PROJECT_DESCRIPTION = `Manage an agile coding team project through clear delegation, evidence, independent review and level-by-level reporting. When the user describes a project in natural language, to create a project you ONLY need title and objective — all other fields (deliverables, acceptanceCriteria, constraints, risk, tasks, default profiles, mode) are optional; omit whatever you do not already have, leaving them out never blocks starting, and never pause to invent or fill optional parameters before calling action="create". Call action="create" with title and objective (plus any optional fields you already know) to stand up the project in one call: create registers the project (and any optional top-level tasks), spawns the leader session, and starts it immediately with the full context (no separate start call or initial project(action="get") is needed before work begins; action="start" remains available for a planning project created outside the tool). Optional fields include deliverables, acceptanceCriteria, constraints, risk (defaults to low; any value is accepted without error), defaultLeaderProfile/defaultExecutorProfile/defaultReviewerProfile, and mode: standard (the default) or lightweight. For a small self-contained project, create it with mode="lightweight": the project leader session does the work itself, the project has no separate worker or reviewer sessions, and a task is accepted on the worker's own evidence. Use the standard mode when the work needs an independent review. In a lightweight project the leader registers only executor tasks, never splits into child tasks and never asks for a review - a submitted task is a completed task. The conversation that created a project may cancel it with action="cancel" and a reason: the project is marked cancelled, its running sessions are stopped, and its record, tasks, events and evidence are kept. Only that initiating conversation may cancel it - a worker or reviewer cannot cancel the project it belongs to. If you choose to pass the optional tasks array, each entry only needs a title and an objective, and its dependencies name the titles of sibling tasks in the same array. You are the initiator: you may create the project, register top-level tasks and cancel if needed; you may not register child tasks or interfere with member execution. Only a root conversation may create a project. Top-level tasks can also be registered later with add_task. When the user asks "我的项目现在怎么样", "我还有哪些项目在跑", "列出所有项目", or wants an overview of running projects, call action="list" first to retrieve up to 20 most recently updated projects with lightweight summaries (headline, task counts, active workers, tokens) without needing a projectId; the response returns projects, total, and returned counts, where total > returned indicates more historical projects exist in the workspace. Never guess a projectId to call get blindly; only call get when the user targets a specific project and you need deep task, escalation or event details. The project leader receives the current tasks in its startup context and does not need to call get before dispatching; it uses add_task (only title and objective are required; deliverables, acceptanceCriteria, dependencies, role=leader/executor, and executorProfile/reviewerProfile with agentId, cwd, model, thinkingLevel, watchdogTimeoutSeconds are optional), dispatch and request_review. A branch leader creates children with parentTaskId set to its own task ID and manages only its direct tasks. Dependencies must be siblings. Leader aggregate submission requires independently accepted children. Keep at most 3 leader levels and 8 branch leaders; small projects need only one executor. Workers submit output plus evidenceRefs. Only the assigned independent reviewer can review with verdict accepted or changes_requested, summary and evidenceRefs. update_task marks blocked/failed with blockedReason, updates executorProfile/reviewerProfile before child sessions spawn, or the leader resets ready for retry. report records kind=progress/blocked, progress, summary, variance, nextStep, risks, decisionNeeded and evidenceRefs; blocked reports notify your direct supervisor rather than directly alerting Boss. escalate records an optional title, a reason and severity=low/medium/high. The title is ONE SENTENCE naming what the reader has to decide - the question - and the reason is the case for it: why it matters, what the evidence shows, what happens if nobody decides. Give a title whenever the question can be said in one line, because the reader decides on the title and reads the reason only when the question is not obvious; without a title the escalation falls back to its reason. Escalations from any child conversation, including a project leader, go to its direct parent. Only the team's top-level conversation can raise a decision for the user. Resolve issues at your level whenever you can. resolve_escalation closes an escalation that was addressed to you: pass escalationId, decision and status (resolved, dismissed or returned, default resolved). Take escalationId from the escalations array that project(action=get) returns - it is the id of the one escalation you are answering, and the same array tells you whether it is still open. decision is your handling note: what you decided and why. status is optional and defaults to resolved; use dismissed when the question no longer stands. status="returned" means the material was not enough to decide on: the case goes back to whoever raised it, and that person is woken up to supply what is missing instead of the case hanging unanswered. It only accepts a supervisor escalation whose target session is your own - only the session an escalation names may answer it - and an escalation addressed to Boss is the Boss's to decide and is refused for you. Resolving it cascades: the member who raised the escalation is woken up with your decision. deliver records a milestone once the required tasks are accepted - independently reviewed in the standard mode, self-accepted in the lightweight mode - with summary and evidenceRefs. Continue the same project for future tasks. Only a direct parent removes its child sessions using session_remove. action="export" returns the project as a Markdown report: the objective, every task with its delivery, evidence and review, the exceptions and how they were decided, and the full timeline. Use it when the user asks for a summary, a handover, or a status write-up of the project. Project and task IDs come from create/get/add_task. Reads never invoke models. Dispatch is asynchronous and starts the child session immediately; wait for child completion reports instead of polling. Do not use session_spawn, session_dispatch, task or workflow to bypass the project's delegation and reporting chain. Never claim success on an error.`;
1145
1145
 
1146
1146
  export function readProjectConfig(env: Record<string, string | undefined>) {
1147
1147
  return { endpoint: env[PROJECT_ENDPOINT_ENV] ?? "", conversationId: env[TASK_CONVERSATION_ENV] ?? "", workspaceId: env.SUPER_PI_ORCHESTRATOR_WORKSPACE ?? "", capability: env[TASK_CAPABILITY_ENV] };
@@ -1,7 +1,7 @@
1
1
  {
2
- "hash": "668c02deeca81524fee97afc7a5f97b29e69e6d7f7ae9d119042a15a852d04bc",
2
+ "hash": "82a1affaead0a9f424b4b450e1758dfaf89ccab25135daba615cafd18fc9e1cc",
3
3
  "files": {
4
- "src/client/App.tsx": "2b8ebb312c3b3d3f2355c357c2e994c10ec72c97ebf2dedcbdcca25fbbac59f7",
4
+ "src/client/App.tsx": "5948945877422d5e550e50799805d865d81ed3de4e952368850ddb1fa4bbab9d",
5
5
  "src/client/CodeMirrorEditor.tsx": "b6b6479effa1482eda710f04a26f3af843515526e129ca5bc70692cca9074b09",
6
6
  "src/client/ErrorBoundary.tsx": "d16376f9f6c7cc1fab8590c65a66438127642f7d6bb8023cec53d8a6cc9f3964",
7
7
  "src/client/FeishuPanel.tsx": "52f116eba265bfde683338f5893107ad5559fd2f7d4a9e0df935507a46862a3b",
@@ -15,7 +15,7 @@
15
15
  "src/client/MarkdownView.tsx": "8dcb5733a4aafdf786ef44e51540b75da09a92d2d3fc02dbf7730df7e6470732",
16
16
  "src/client/MemoryPanel.tsx": "59a74f5789f43708245b6f62ba3b873ad91804f64c1e352403d5b7dffd478fdc",
17
17
  "src/client/MessageMedia.tsx": "a9bdfa7f06690b6db5faed8309d7aeb3230ba895dd91386aeec0cd090c46e0c5",
18
- "src/client/ProjectControlPanel.tsx": "d0d7351b5614a41c03751bf64ae9d4c45f2a9bd01e91bea01afddaddfee2ac4f",
18
+ "src/client/ProjectControlPanel.tsx": "ff56ba70f9a422c398759017e2cd1a58740e25178602ed8b5ba05a8f35234fbe",
19
19
  "src/client/ProviderNetworkSettings.tsx": "602850c884136d57dd39a1e87a6418de92ac007ab445c94a1ca434c83b37c29f",
20
20
  "src/client/ScheduledTasksPanel.tsx": "ed69d3617b6e4dc1a815cbf1a8d675c7c2010061b9fe2eac216813527c9cd7ab",
21
21
  "src/client/SidebarSection.tsx": "579c014caeddd94d21911d7b9eca4ceef930ca13c2baeb7bf5ffba59c2bb0b75",
@@ -38,15 +38,15 @@
38
38
  "src/client/project-evidence.ts": "3bc5ea85f6b20a19a36cfdd4a958d83dd53b21f3d8f20fae1914a575dfbad3c4",
39
39
  "src/client/session-tree.ts": "08a14c6611fdd9a72001eb1672060479e7660de5a5d221c7e80036209fd26546",
40
40
  "src/client/slash-commands.ts": "b792018fb67bd9e6f777397b0720b8b3aa565a4d8f7a76f94fec097ddf749480",
41
- "src/client/styles.css": "92880010db4837a2cbc98239e4918c5a7e22349a7b1744d54538198c3e607ee6",
41
+ "src/client/styles.css": "5ebd2ea34332e645a88aaa0518a176452f49baaf30a33769e34ec78f4704c68a",
42
42
  "src/client/terminal-emulator.ts": "ffcc4f5fbddaf25cebcc9e03dbe5d7d0ad2c21586f5d169e57c04c82e2308b3b",
43
43
  "src/client/theme.tsx": "3974330014e335c9e668491067a642a56b20d3ec54af8f227a182cea72436876",
44
44
  "src/client/tool-launcher.ts": "40fb4974362bbc8c73ecd651da1abce251fc28857564a9321037adcfdb0bfe24",
45
45
  "src/client/tool-sharing.ts": "011212825dbbffe18c8f15aca721c02938ab6273fb5607b072a1e7b8b1853640",
46
46
  "src/client/tool-shortcuts.ts": "cbd89186776cab19b8b3ec40b8a755c4fc2a47d1c03653eca55e6b23b865c3b6",
47
47
  "src/client/tools.ts": "58fe41f0edbd490e3fab7f12f258b1dbc2163b653553b03ac61caf1543618e50",
48
- "src/client/types.ts": "f34f21eee0374e8cb9dc14f7156d68d9bd65184f6fc2710c65bf28247311fe2e",
48
+ "src/client/types.ts": "401a9c240b92d71b67d8fe325f8d9f9287d4ab265a9e01e23142e03f0df8593e",
49
49
  "src/client/vite-env.d.ts": "65996936fbb042915f7b74a200fcdde7e410f32a669b1ab9597cfaa4b0faddb5"
50
50
  },
51
- "recordedAt": "2026-11-15T14:03:02.167Z"
51
+ "recordedAt": "2026-11-16T01:27:28.016Z"
52
52
  }
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-mAA5Fw0-.js","assets/dist-Digy2Mj0.js","assets/index-DmxXnVfN.js","assets/index-Nu--gcBs.css","assets/dist-BVVJTFYw.js","assets/dist-BOC9yjsN.js","assets/dist-DUbHNa35.js","assets/dist-CiRgPe6t.js","assets/dist-DQ_C0DEU.js","assets/dist-CYpk6fXT.js","assets/dist-gRtmlyhZ.js","assets/dist-BXOV_xtI.js","assets/dist-Bh20DSAa.js","assets/dist-Dwsqs8C-.js","assets/dist-DvWgfLRt.js","assets/dist-BOF4T7jI.js","assets/dist-Cp3XgqJR.js","assets/dist-xb23AFcT.js","assets/dist-D1hdxSH6.js","assets/dist-CjhpwEGf.js","assets/dist-DLYLxwOe.js","assets/dist-CMdO3YzL.js","assets/dist-CIv6vCdn.js","assets/dist-CPjKkcyd.js"])))=>i.map(i=>d[i]);
2
- import{a as e,i as t,n,r,s as i,t as a}from"./index-DmxXnVfN.js";var o=i(e(),1);async function s(e,t){let[{StreamLanguage:n},i]=await Promise.all([r(()=>import(`./dist-mAA5Fw0-.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-DUbHNa35.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cc:()=>r(()=>import(`./dist-DUbHNa35.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cxx:()=>r(()=>import(`./dist-DUbHNa35.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hpp:()=>r(()=>import(`./dist-DUbHNa35.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hh:()=>r(()=>import(`./dist-DUbHNa35.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hxx:()=>r(()=>import(`./dist-DUbHNa35.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),c:()=>r(()=>import(`./dist-DUbHNa35.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),h:()=>r(()=>import(`./dist-DUbHNa35.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cu:()=>r(()=>import(`./dist-DUbHNa35.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cuh:()=>r(()=>import(`./dist-DUbHNa35.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),js:()=>r(()=>import(`./dist-DQ_C0DEU.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),jsx:()=>r(()=>import(`./dist-DQ_C0DEU.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-DQ_C0DEU.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cjs:()=>r(()=>import(`./dist-DQ_C0DEU.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),ts:()=>r(()=>import(`./dist-DQ_C0DEU.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-DQ_C0DEU.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-DQ_C0DEU.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-DQ_C0DEU.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-gRtmlyhZ.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),pyi:()=>r(()=>import(`./dist-gRtmlyhZ.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),java:()=>r(()=>import(`./dist-BXOV_xtI.js`).then(e=>e.java()),__vite__mapDeps([11,5,2,3,0,1,4,7])),php:()=>r(()=>import(`./dist-Bh20DSAa.js`).then(e=>e.php()),__vite__mapDeps([12,5,2,3,0,1,4,7,13,14,8,9])),sql:()=>r(()=>import(`./dist-BOF4T7jI.js`).then(e=>e.sql()),__vite__mapDeps([15,5,2,3,0,1,4,7,9])),yaml:()=>r(()=>import(`./dist-Cp3XgqJR.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),yml:()=>r(()=>import(`./dist-Cp3XgqJR.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),xml:()=>r(()=>import(`./dist-xb23AFcT.js`).then(e=>e.xml()),__vite__mapDeps([17,1,2,3,4,5,0,7])),json:()=>r(()=>import(`./dist-D1hdxSH6.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),jsonc:()=>r(()=>import(`./dist-D1hdxSH6.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),json5:()=>r(()=>import(`./dist-D1hdxSH6.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),html:()=>r(()=>import(`./dist-Dwsqs8C-.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),htm:()=>r(()=>import(`./dist-Dwsqs8C-.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),vue:()=>r(()=>import(`./dist-Dwsqs8C-.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),svelte:()=>r(()=>import(`./dist-Dwsqs8C-.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),css:()=>r(()=>import(`./dist-DvWgfLRt.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([14,2,3,5,0,1,4,7])),md:()=>r(()=>import(`./dist-CjhpwEGf.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),markdown:()=>r(()=>import(`./dist-CjhpwEGf.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),mdx:()=>r(()=>import(`./dist-CjhpwEGf.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),rs:()=>r(()=>import(`./dist-DLYLxwOe.js`).then(e=>e.rust()),__vite__mapDeps([20,5,2,3,0,1,4,7])),go:()=>r(()=>import(`./dist-CMdO3YzL.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-Digy2Mj0.js`).then(e=>e.x),__vite__mapDeps([1,2,3])),r(()=>import(`./dist-BVVJTFYw.js`).then(e=>e.s),__vite__mapDeps([4,2,3,1])),r(()=>import(`./dist-CIv6vCdn.js`),__vite__mapDeps([22,1,2,3,4,5,0])),r(()=>import(`./dist-CPjKkcyd.js`),__vite__mapDeps([23,1,2,3,4])),r(()=>import(`./dist-mAA5Fw0-.js`),__vite__mapDeps([0,1,2,3,4,5])),r(()=>import(`./dist-BOC9yjsN.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-CVErcv3I.js","assets/dist-BqNxkXgs.js","assets/index-CCF1Ymba.js","assets/index-B-h_KnC5.css","assets/dist-Gvvox7eW.js","assets/dist-J-F3f1eU.js","assets/dist-DlBSkHdo.js","assets/dist-Bxyffyjn.js","assets/dist-BA1wBjGJ.js","assets/dist-B3GZVLeH.js","assets/dist-xdw6XDXx.js","assets/dist-IohJ9Qkl.js","assets/dist-w6rH3SJG.js","assets/dist-CT23BwQB.js","assets/dist-DPYofnO9.js","assets/dist-CRfLPcZ8.js","assets/dist-CeHhOkTz.js","assets/dist-CsqiBKUZ.js","assets/dist-C-Kbr0WK.js","assets/dist-ClwDCrdU.js","assets/dist-DrNjVA0k.js","assets/dist-C729XRkf.js","assets/dist-C071I6sD.js","assets/dist-BT_Z_-2X.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,i as t,n,r,s as i,t as a}from"./index-CCF1Ymba.js";var o=i(e(),1);async function s(e,t){let[{StreamLanguage:n},i]=await Promise.all([r(()=>import(`./dist-CVErcv3I.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-DlBSkHdo.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cc:()=>r(()=>import(`./dist-DlBSkHdo.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cxx:()=>r(()=>import(`./dist-DlBSkHdo.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hpp:()=>r(()=>import(`./dist-DlBSkHdo.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hh:()=>r(()=>import(`./dist-DlBSkHdo.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hxx:()=>r(()=>import(`./dist-DlBSkHdo.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),c:()=>r(()=>import(`./dist-DlBSkHdo.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),h:()=>r(()=>import(`./dist-DlBSkHdo.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cu:()=>r(()=>import(`./dist-DlBSkHdo.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cuh:()=>r(()=>import(`./dist-DlBSkHdo.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),js:()=>r(()=>import(`./dist-BA1wBjGJ.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),jsx:()=>r(()=>import(`./dist-BA1wBjGJ.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-BA1wBjGJ.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cjs:()=>r(()=>import(`./dist-BA1wBjGJ.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),ts:()=>r(()=>import(`./dist-BA1wBjGJ.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-BA1wBjGJ.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-BA1wBjGJ.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-BA1wBjGJ.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-xdw6XDXx.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),pyi:()=>r(()=>import(`./dist-xdw6XDXx.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),java:()=>r(()=>import(`./dist-IohJ9Qkl.js`).then(e=>e.java()),__vite__mapDeps([11,5,2,3,0,1,4,7])),php:()=>r(()=>import(`./dist-w6rH3SJG.js`).then(e=>e.php()),__vite__mapDeps([12,5,2,3,0,1,4,7,13,14,8,9])),sql:()=>r(()=>import(`./dist-CRfLPcZ8.js`).then(e=>e.sql()),__vite__mapDeps([15,5,2,3,0,1,4,7,9])),yaml:()=>r(()=>import(`./dist-CeHhOkTz.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),yml:()=>r(()=>import(`./dist-CeHhOkTz.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),xml:()=>r(()=>import(`./dist-CsqiBKUZ.js`).then(e=>e.xml()),__vite__mapDeps([17,1,2,3,4,5,0,7])),json:()=>r(()=>import(`./dist-C-Kbr0WK.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),jsonc:()=>r(()=>import(`./dist-C-Kbr0WK.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),json5:()=>r(()=>import(`./dist-C-Kbr0WK.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),html:()=>r(()=>import(`./dist-CT23BwQB.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),htm:()=>r(()=>import(`./dist-CT23BwQB.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),vue:()=>r(()=>import(`./dist-CT23BwQB.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),svelte:()=>r(()=>import(`./dist-CT23BwQB.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),css:()=>r(()=>import(`./dist-DPYofnO9.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([14,2,3,5,0,1,4,7])),md:()=>r(()=>import(`./dist-ClwDCrdU.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),markdown:()=>r(()=>import(`./dist-ClwDCrdU.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),mdx:()=>r(()=>import(`./dist-ClwDCrdU.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),rs:()=>r(()=>import(`./dist-DrNjVA0k.js`).then(e=>e.rust()),__vite__mapDeps([20,5,2,3,0,1,4,7])),go:()=>r(()=>import(`./dist-C729XRkf.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-BqNxkXgs.js`).then(e=>e.x),__vite__mapDeps([1,2,3])),r(()=>import(`./dist-Gvvox7eW.js`).then(e=>e.s),__vite__mapDeps([4,2,3,1])),r(()=>import(`./dist-C071I6sD.js`),__vite__mapDeps([22,1,2,3,4,5,0])),r(()=>import(`./dist-BT_Z_-2X.js`),__vite__mapDeps([23,1,2,3,4])),r(()=>import(`./dist-CVErcv3I.js`),__vite__mapDeps([0,1,2,3,4,5])),r(()=>import(`./dist-J-F3f1eU.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,c as t,f as n,g as r,h as i,l as a,m as o,p as s,s as c,t as l}from"./dist-Digy2Mj0.js";import{d as u,o as d,r as f,t as p}from"./dist-BVVJTFYw.js";import{indentUnit as m,syntaxTree as h}from"./dist-mAA5Fw0-.js";var g=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=h(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(x(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function _(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function v(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=_(t)+_(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function y(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:v(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function b(e,t){return n=>{for(let t=h(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}function x(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var S=l.define();typeof navigator==`object`&&navigator.platform;var C=f.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),w=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},T=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(n){let r=n.mapPos(this.from,-1,t.TrackDel),i=n.mapPos(this.to,1,t.TrackDel);return r==null||i==null?null:new e(this.field,r,i)}},E=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(m);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new T(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new w(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},D=p.widget({widget:new class extends d{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),O=p.mark({class:`cm-snippetField`}),k=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=p.set(e.map(e=>(e.from==e.to?D:O).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},A=s.define({map(e,t){return e&&e.map(t)}}),j=s.define(),M=o.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(A))return n.value;if(n.is(j)&&e)return new k(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>f.decorations.from(e,e=>e?e.deco:p.none)});function N(t,n){return e.create(t.filter(e=>e.field==n).map(t=>e.range(t.from,t.to)))}function P(e){let t=E.parse(e);return(e,n,a,o)=>{let{text:c,ranges:l}=t.instantiate(e.state,a),{main:u}=e.state.selection,d={changes:{from:a,to:o==u.from?u.to:o,insert:i.of(c)},scrollIntoView:!0,annotations:n?[S.of(n),r.userEvent.of(`input.complete`)]:void 0};if(l.length&&(d.selection=N(l,0)),l.some(e=>e.field>0)){let t=new k(l,0),n=d.effects=[A.of(t)];e.state.field(M,!1)===void 0&&n.push(s.appendConfig.of([M,R,B,C]))}e.dispatch(e.state.update(d))}}function F(e){return({state:t,dispatch:n})=>{let r=t.field(M,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:N(r.ranges,i),effects:A.of(a?null:new k(r.ranges,i)),scrollIntoView:!0})),!0}}var I=[{key:`Tab`,run:F(1),shift:F(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(M,!1)?(t(e.update({effects:A.of(null)})),!0):!1}],L=c.define({combine(e){return e.length?e[0]:I}}),R=a.highest(u.compute([L],e=>e.facet(L)));function z(e,t){return{...t,apply:P(e)}}var B=f.domEventHandlers({mousedown(e,t){let n=t.state.field(M,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:N(n.ranges,i.field),effects:A.of(n.ranges.some(e=>e.field>i.field)?new k(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),V=new class extends n{};V.startSide=1,V.endSide=-1,typeof navigator==`object`&&navigator.userAgent;export{z as i,y as n,b as r,g as t};
1
+ import{a as e,c as t,f as n,g as r,h as i,l as a,m as o,p as s,s as c,t as l}from"./dist-BqNxkXgs.js";import{d as u,o as d,r as f,t as p}from"./dist-Gvvox7eW.js";import{indentUnit as m,syntaxTree as h}from"./dist-CVErcv3I.js";var g=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=h(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(x(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function _(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function v(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=_(t)+_(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function y(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:v(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function b(e,t){return n=>{for(let t=h(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}function x(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var S=l.define();typeof navigator==`object`&&navigator.platform;var C=f.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),w=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},T=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(n){let r=n.mapPos(this.from,-1,t.TrackDel),i=n.mapPos(this.to,1,t.TrackDel);return r==null||i==null?null:new e(this.field,r,i)}},E=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(m);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new T(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new w(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},D=p.widget({widget:new class extends d{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),O=p.mark({class:`cm-snippetField`}),k=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=p.set(e.map(e=>(e.from==e.to?D:O).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},A=s.define({map(e,t){return e&&e.map(t)}}),j=s.define(),M=o.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(A))return n.value;if(n.is(j)&&e)return new k(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>f.decorations.from(e,e=>e?e.deco:p.none)});function N(t,n){return e.create(t.filter(e=>e.field==n).map(t=>e.range(t.from,t.to)))}function P(e){let t=E.parse(e);return(e,n,a,o)=>{let{text:c,ranges:l}=t.instantiate(e.state,a),{main:u}=e.state.selection,d={changes:{from:a,to:o==u.from?u.to:o,insert:i.of(c)},scrollIntoView:!0,annotations:n?[S.of(n),r.userEvent.of(`input.complete`)]:void 0};if(l.length&&(d.selection=N(l,0)),l.some(e=>e.field>0)){let t=new k(l,0),n=d.effects=[A.of(t)];e.state.field(M,!1)===void 0&&n.push(s.appendConfig.of([M,R,B,C]))}e.dispatch(e.state.update(d))}}function F(e){return({state:t,dispatch:n})=>{let r=t.field(M,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:N(r.ranges,i),effects:A.of(a?null:new k(r.ranges,i)),scrollIntoView:!0})),!0}}var I=[{key:`Tab`,run:F(1),shift:F(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(M,!1)?(t(e.update({effects:A.of(null)})),!0):!1}],L=c.define({combine(e){return e.length?e[0]:I}}),R=a.highest(u.compute([L],e=>e.facet(L)));function z(e,t){return{...t,apply:P(e)}}var B=f.domEventHandlers({mousedown(e,t){let n=t.state.field(M,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:N(n.ranges,i.field),effects:A.of(n.ranges.some(e=>e.field>i.field)?new k(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),V=new class extends n{};V.startSide=1,V.endSide=-1,typeof navigator==`object`&&navigator.userAgent;export{z as i,y as n,b as r,g as t};