@evandu/super-pi 0.1.242 → 0.1.243
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/code-auditor.md +8 -2
- package/agents/code-designer.md +10 -4
- package/agents/solution-designer.md +5 -1
- package/dist/client/.super-pi-client-sources.json +10 -7
- package/dist/client/assets/{CodeMirrorEditor-BXlGF-8I.js → CodeMirrorEditor-B7eDr7dY.js} +1 -1
- package/dist/client/assets/{GitDiffEditor-zWN38BGh.js → GitDiffEditor-pYaHOM0Q.js} +1 -1
- package/dist/client/assets/index-CfAcuYba.css +1 -0
- package/dist/client/assets/{index-D8M5Jjzq.js → index-D0Po7xmY.js} +52 -52
- package/dist/client/index.html +2 -2
- package/dist/server/application/group-chat-service.js +115 -38
- package/dist/server/http-server.js +121 -91
- package/dist/server/runtime.js +1 -1
- package/dist/server/update-status.d.ts +14 -0
- package/dist/server/update-status.js +69 -0
- package/dist/server/update.d.ts +0 -17
- package/dist/server/update.js +0 -26
- package/dist/shared/group-chat.d.ts +5 -0
- package/dist/shared/update-status.d.ts +28 -0
- package/dist/shared/update-status.js +1 -0
- package/package.json +1 -1
- package/scripts/restart-server.mjs +9 -1
- package/dist/client/assets/index-BbMji0nU.css +0 -1
package/agents/code-auditor.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: 代码审计员
|
|
3
3
|
mode: primary
|
|
4
|
-
description:
|
|
4
|
+
description: 独立复测代码行为和规范,写出可核查的审计报告。适合作为项目复核者。
|
|
5
5
|
color: "#5CA9ED"
|
|
6
6
|
tools:
|
|
7
7
|
"*": false
|
|
@@ -9,6 +9,10 @@ tools:
|
|
|
9
9
|
grep: true
|
|
10
10
|
find: true
|
|
11
11
|
ls: true
|
|
12
|
+
edit: true
|
|
13
|
+
write: true
|
|
14
|
+
bash: true
|
|
15
|
+
powershell: true
|
|
12
16
|
task: false
|
|
13
17
|
workflow: false
|
|
14
18
|
run_async: false
|
|
@@ -26,10 +30,12 @@ tools:
|
|
|
26
30
|
session_reminder: false
|
|
27
31
|
---
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
你是代码审计员。运行必要的复测,在任务指定的位置直接创建或更新审计报告与验证证据。独立复核期间保持被审交付原样,向实现者交接需要修正的问题和复查条件。
|
|
30
34
|
|
|
31
35
|
独立核对改动、既有规范和真实证据。按影响给出可定位的问题与复测方法。指出尚未证实的推断和未执行的验证。已知规范、历史记录与本次新增观察要有各自的来源。
|
|
32
36
|
|
|
37
|
+
群聊中发现需要返工的具体问题时,向实现者交接复现、预期和验收方法,并在收到修订后复测。
|
|
38
|
+
|
|
33
39
|
## 代码规范与记忆
|
|
34
40
|
|
|
35
41
|
开工先核对本仓规范与召回的全局工程经验。用 `memory(target="experience", action="list")` 查看其他经验的来源与适用条件。引用时指出来源项目,按当前风险、迭代速度和维护周期判断。发生冲突时遵循当前用户和仓库规范。
|
package/agents/code-designer.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: 代码设计员
|
|
3
3
|
mode: primary
|
|
4
|
-
description:
|
|
4
|
+
description: 设计模块、接口和测试,承接项目里的代码实现与验证。适合作为执行者。
|
|
5
5
|
color: "#45BCB5"
|
|
6
6
|
tools:
|
|
7
7
|
"*": false
|
|
@@ -9,6 +9,10 @@ tools:
|
|
|
9
9
|
grep: true
|
|
10
10
|
find: true
|
|
11
11
|
ls: true
|
|
12
|
+
edit: true
|
|
13
|
+
write: true
|
|
14
|
+
bash: true
|
|
15
|
+
powershell: true
|
|
12
16
|
task: false
|
|
13
17
|
workflow: false
|
|
14
18
|
run_async: false
|
|
@@ -26,9 +30,11 @@ tools:
|
|
|
26
30
|
session_reminder: false
|
|
27
31
|
---
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
你是代码设计员,负责把选定方案落到代码和测试里。任务要求实现、修复或调试时,直接编辑相关文件、执行必要的验证,再给出实际改动和测试结果。仅要求设计时,把接口、边界和回归方案写入约定的设计文档。
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
沿现有入口定位实际代码,处理旧数据兼容、失败恢复和回归用例。涉及其他成员时直接回应他们指出的具体问题,并把改动路径和证据交给复核者。
|
|
36
|
+
|
|
37
|
+
群聊里的实现完成后,如本次任务需要独立复核,向代码审计员交接改动与测试证据。收到复核意见时直接修改并回请复测。
|
|
32
38
|
|
|
33
39
|
## 代码规范与记忆
|
|
34
40
|
|
|
@@ -44,7 +50,7 @@ tools:
|
|
|
44
50
|
|
|
45
51
|
## 在项目里
|
|
46
52
|
|
|
47
|
-
|
|
53
|
+
当你在项目里被派了活时,按任务范围交付实际代码、测试或设计产物。
|
|
48
54
|
完成时调用 `project(action="submit", projectId, taskId, output, evidenceRefs)`,不能自行宣布完成。evidenceRefs 填真实读取的文件、行号和记录。
|
|
49
55
|
复核退回后按 `review.summary` 补证据和设计,再 `submit`。
|
|
50
56
|
阻塞时用 `project(action="report", kind="blocked", ...)` 向直接上级报告,需要上级决策时用 `escalate`,收件人自动是直接上级。
|
|
@@ -9,6 +9,8 @@ tools:
|
|
|
9
9
|
grep: true
|
|
10
10
|
find: true
|
|
11
11
|
ls: true
|
|
12
|
+
edit: true
|
|
13
|
+
write: true
|
|
12
14
|
task: false
|
|
13
15
|
workflow: false
|
|
14
16
|
run_async: false
|
|
@@ -26,7 +28,9 @@ tools:
|
|
|
26
28
|
session_reminder: false
|
|
27
29
|
---
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
你是方案设计员。将已确定的方案、取舍和验收条件直接创建或更新到约定的项目文档中,交付时给出文件路径。实现另有分工时,把可执行步骤和验收条件交给实现者。
|
|
32
|
+
|
|
33
|
+
群聊已经要求实现且方案收敛时,直接向群里的代码设计员或指定实现者交接,写清方案路径、首要改动和验收条件。
|
|
30
34
|
|
|
31
35
|
给出目标、现状证据、约束和可选路线。根据影响与成本推荐一条路线,写清验收信号和失败边界。涉及启动或发布时,分别列出服务就绪、版本一致与真实业务链路的验收条件。
|
|
32
36
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"hash": "
|
|
2
|
+
"hash": "78e1170c0d7bbe5faf2742e612c0a32bb7a38a5a922a5c0bf71be1f69fd13c9e",
|
|
3
3
|
"files": {
|
|
4
|
-
"src/client/App.tsx": "
|
|
4
|
+
"src/client/App.tsx": "b983250f708bbdba649ed03debbce9a48d677a9dc5ea973ab2417cf66db8d899",
|
|
5
5
|
"src/client/CodeMirrorEditor.tsx": "f6cbdcc7edd2713ff720159b871e3af545ba1a160a946e67840ed66bc1a04596",
|
|
6
6
|
"src/client/ErrorBoundary.tsx": "d16376f9f6c7cc1fab8590c65a66438127642f7d6bb8023cec53d8a6cc9f3964",
|
|
7
7
|
"src/client/FeishuPanel.tsx": "52f116eba265bfde683338f5893107ad5559fd2f7d4a9e0df935507a46862a3b",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"src/client/FilesPanel.tsx": "ba95182ea84939de4e620c7f16158a5047ea40d56d673fb1c3f5f77d0b637a5c",
|
|
11
11
|
"src/client/GitDiffEditor.tsx": "34093541954a5874ae40113862c58b305c6b10b921082b683da4c7043d7531e5",
|
|
12
12
|
"src/client/GitPanel.tsx": "8a61b42582058b7d962f693bd03255cc4aaed65db97b5e53f4e0d94b3dade7ca",
|
|
13
|
-
"src/client/GroupChatPane.tsx": "
|
|
13
|
+
"src/client/GroupChatPane.tsx": "b81233283d8b34dfd46824d34d46c3f90b982c553404a9e2a74a8f8d43217a59",
|
|
14
14
|
"src/client/HelpWindow.tsx": "a52005240894911eb8a35efab78aa6ddcda9fef6dca976aafc4255a4f635ca76",
|
|
15
15
|
"src/client/KnowledgeFilePicker.tsx": "8f7eb7e9f70265aed09cc0892b091827976757d8f2a2d736d6ca170fcdd871e7",
|
|
16
16
|
"src/client/KnowledgePanel.tsx": "4f7230cfe610cd86d63aa143c82f6195b3c4208ef0bea703f92104ef27237704",
|
|
@@ -24,11 +24,12 @@
|
|
|
24
24
|
"src/client/ScheduledTasksPanel.tsx": "ed69d3617b6e4dc1a815cbf1a8d675c7c2010061b9fe2eac216813527c9cd7ab",
|
|
25
25
|
"src/client/SidebarSection.tsx": "579c014caeddd94d21911d7b9eca4ceef930ca13c2baeb7bf5ffba59c2bb0b75",
|
|
26
26
|
"src/client/SlashCommandMenu.tsx": "69cd0a9d5e35f41f703e91a845e5bd750c952d2957be03b5528e156e60bf6ecb",
|
|
27
|
+
"src/client/SoftwareUpdate.tsx": "6672fbe0da7b7d57efa5aa0278003ba55a8f9867209fc196cee345874e6188fa",
|
|
27
28
|
"src/client/Tabs.tsx": "4c2bf81f21d095b2d3497d8302f958d808fdd8c11b107742946caef9cb467836",
|
|
28
29
|
"src/client/TeamHandoffCard.tsx": "925284ab81c7845c5cfdcfa1f631e124bb02d7d86b03ede8f3fbabc194c32dca",
|
|
29
30
|
"src/client/TerminalPanel.tsx": "eb47ab8117ec4e1377e9ce0b7b7f6ec5f19a055cf5a21ac9ba2bb27f2a6026c5",
|
|
30
31
|
"src/client/ToolGlyph.tsx": "a1100b61f1eee9520e7323385f667898763bfd69068f22de7dd36db2d4096c76",
|
|
31
|
-
"src/client/WorkbenchChrome.tsx": "
|
|
32
|
+
"src/client/WorkbenchChrome.tsx": "cdb0c16658043c8ec01cb8caa6249494d0d27924acf572c9010dbb89482369b7",
|
|
32
33
|
"src/client/WorkbenchSearch.tsx": "83a52a45d561bc31f19ae0c76708572cde73cb952ef69e60247e638c0abe57f2",
|
|
33
34
|
"src/client/WorkbenchSplit.tsx": "7afc0e435ad8eae95f95a28563034e3bf09eef070f47bd3366d9b8eff9bc229e",
|
|
34
35
|
"src/client/WorkflowCard.tsx": "8ce5458537a3b02dcbb9bbb4c7afacb07e0f41857ed250aa4cde0cbc8d4bde6c",
|
|
@@ -42,7 +43,8 @@
|
|
|
42
43
|
"src/client/errors.ts": "2ea215b8676cca8841b93c780563f1f2031320270d4d0865221f6a12b65c6f22",
|
|
43
44
|
"src/client/file-diff.ts": "b1fd62dd0f561c567f249d98364068c947e31758fa9f1644d27250679e0f62a4",
|
|
44
45
|
"src/client/file-icons.tsx": "65e571a5378723511caef0e4bdbecdd4adba9461a46db878d65a948fc99fcb65",
|
|
45
|
-
"src/client/group-chat.
|
|
46
|
+
"src/client/group-chat-client.ts": "9b1bbe9705002b00158e81cfb6bc4a62fd12b9c0d592fdfaaf8a7d6ba226d3cc",
|
|
47
|
+
"src/client/group-chat.css": "27c8a0af1b13e2b81192701bbbdf08b05a8da3df00343c6a313411ca5572b8fb",
|
|
46
48
|
"src/client/main.tsx": "d6325cec79ebc225e4972c33ad9b4266fa1eab5f962fec36ed4c539124a8fcab",
|
|
47
49
|
"src/client/markdown-settings.ts": "33075c9137183ae4874d5a9a764cd2ae5ce9abd27331065880aa53cf6e3f307a",
|
|
48
50
|
"src/client/markdown.ts": "b22d015fcc797570407492240c2c065320176abf65c05cb0e6b8bb8851ea7a5c",
|
|
@@ -51,7 +53,8 @@
|
|
|
51
53
|
"src/client/reader-recovery.ts": "20030e65dce38d06bcc65d13cbe451e87dcee9c10cae7cdb7c056e5407f77849",
|
|
52
54
|
"src/client/session-tree.ts": "08a14c6611fdd9a72001eb1672060479e7660de5a5d221c7e80036209fd26546",
|
|
53
55
|
"src/client/slash-commands.ts": "4a2cef1eb9517628eadfdc38bca7e3663e4d48090d8b87a8a79de4bfd586e112",
|
|
54
|
-
"src/client/
|
|
56
|
+
"src/client/software-update.css": "a4ec1565b70008b55618197a8d88db51a79fb932b9a69bfe4318a62774e8020a",
|
|
57
|
+
"src/client/styles.css": "343bf23db0d866def8cb36c88d12d235085e6a56c89815e531c8702e38b60400",
|
|
55
58
|
"src/client/terminal-emulator.ts": "ffcc4f5fbddaf25cebcc9e03dbe5d7d0ad2c21586f5d169e57c04c82e2308b3b",
|
|
56
59
|
"src/client/theme.tsx": "3974330014e335c9e668491067a642a56b20d3ec54af8f227a182cea72436876",
|
|
57
60
|
"src/client/tool-launcher.ts": "40fb4974362bbc8c73ecd651da1abce251fc28857564a9321037adcfdb0bfe24",
|
|
@@ -62,5 +65,5 @@
|
|
|
62
65
|
"src/client/vite-env.d.ts": "65996936fbb042915f7b74a200fcdde7e410f32a669b1ab9597cfaa4b0faddb5",
|
|
63
66
|
"src/client/workbench-navigation.ts": "3b229752a8ce4a45eba7aeff040eb33001413190141f1e9b8e5f38246a1761e2"
|
|
64
67
|
},
|
|
65
|
-
"recordedAt": "2026-11-
|
|
68
|
+
"recordedAt": "2026-11-18T16:47:39.647Z"
|
|
66
69
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-BUCp8C1J.js","assets/dist-Dobw-6kL.js","assets/rolldown-runtime-XKyaHtl9.js","assets/dist-KYkkwisQ.js","assets/dist-Cus6_oaF.js","assets/dist-B8HMl2sC.js","assets/dist-BXAOrsjq.js","assets/dist-BaqnkrBt.js","assets/dist-BOxW9j9f.js","assets/dist-DMNSi_OW.js","assets/dist-BZcQqwK2.js","assets/dist-MjzwBrDE.js","assets/dist-EZTF454G.js","assets/dist-CDdAirBD.js","assets/dist-CsOcBQZU.js","assets/dist-rWx2sy4G.js","assets/dist-Bd_1wEMo.js","assets/dist-blcD_RX0.js","assets/dist-DfYcl24C.js","assets/dist-BJ4DyKpr.js","assets/dist-DDX_kEXl.js","assets/dist-DDMxAmWr.js","assets/dist-KRvDAowe.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{l as t,n,o as r,r as i,t as a}from"./index-D8M5Jjzq.js";var o=e(t(),1);async function s(e,t){let[{StreamLanguage:n},r]=await Promise.all([i(()=>import(`./dist-BUCp8C1J.js`),__vite__mapDeps([0,1,2,3,4])),e()]),a=r[t]??r.default??r;return n.define(a)}var c={cpp:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),cc:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),cxx:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),hpp:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),hh:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),hxx:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),c:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),h:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),cu:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),cuh:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),js:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,2,1,3,4,0,6,8])),jsx:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([7,2,1,3,4,0,6,8])),mjs:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,2,1,3,4,0,6,8])),cjs:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,2,1,3,4,0,6,8])),ts:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,2,1,3,4,0,6,8])),tsx:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0,jsx:!0})),__vite__mapDeps([7,2,1,3,4,0,6,8])),mts:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,2,1,3,4,0,6,8])),cts:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,2,1,3,4,0,6,8])),py:()=>i(()=>import(`./dist-DMNSi_OW.js`).then(e=>e.python()),__vite__mapDeps([9,4,2,0,1,3,6,8])),pyi:()=>i(()=>import(`./dist-DMNSi_OW.js`).then(e=>e.python()),__vite__mapDeps([9,4,2,0,1,3,6,8])),java:()=>i(()=>import(`./dist-BZcQqwK2.js`).then(e=>e.java()),__vite__mapDeps([10,4,2,0,1,3,6])),php:()=>i(()=>import(`./dist-MjzwBrDE.js`).then(e=>e.php()),__vite__mapDeps([11,4,2,0,1,3,6,12,13,7,8])),sql:()=>i(()=>import(`./dist-CsOcBQZU.js`).then(e=>e.sql()),__vite__mapDeps([14,4,2,0,1,3,6,8])),yaml:()=>i(()=>import(`./dist-rWx2sy4G.js`).then(e=>e.yaml()),__vite__mapDeps([15,4,2,0,1,3,6])),yml:()=>i(()=>import(`./dist-rWx2sy4G.js`).then(e=>e.yaml()),__vite__mapDeps([15,4,2,0,1,3,6])),xml:()=>i(()=>import(`./dist-Bd_1wEMo.js`).then(e=>e.xml()),__vite__mapDeps([16,1,2,3,4,0,6])),json:()=>i(()=>import(`./dist-blcD_RX0.js`).then(e=>e.json()),__vite__mapDeps([17,4,2,0,1,3,6])),jsonc:()=>i(()=>import(`./dist-blcD_RX0.js`).then(e=>e.json()),__vite__mapDeps([17,4,2,0,1,3,6])),json5:()=>i(()=>import(`./dist-blcD_RX0.js`).then(e=>e.json()),__vite__mapDeps([17,4,2,0,1,3,6])),html:()=>i(()=>import(`./dist-EZTF454G.js`).then(e=>e.html()),__vite__mapDeps([12,1,2,3,4,0,6,13,7,8])),htm:()=>i(()=>import(`./dist-EZTF454G.js`).then(e=>e.html()),__vite__mapDeps([12,1,2,3,4,0,6,13,7,8])),vue:()=>i(()=>import(`./dist-EZTF454G.js`).then(e=>e.html()),__vite__mapDeps([12,1,2,3,4,0,6,13,7,8])),svelte:()=>i(()=>import(`./dist-EZTF454G.js`).then(e=>e.html()),__vite__mapDeps([12,1,2,3,4,0,6,13,7,8])),css:()=>i(()=>import(`./dist-CDdAirBD.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([13,2,4,0,1,3,6])),md:()=>i(()=>import(`./dist-DfYcl24C.js`).then(e=>e.markdown()),__vite__mapDeps([18,1,2,3,4,0,8,12,6,13,7])),markdown:()=>i(()=>import(`./dist-DfYcl24C.js`).then(e=>e.markdown()),__vite__mapDeps([18,1,2,3,4,0,8,12,6,13,7])),mdx:()=>i(()=>import(`./dist-DfYcl24C.js`).then(e=>e.markdown()),__vite__mapDeps([18,1,2,3,4,0,8,12,6,13,7])),rs:()=>i(()=>import(`./dist-BJ4DyKpr.js`).then(e=>e.rust()),__vite__mapDeps([19,4,2,0,1,3,6])),go:()=>i(()=>import(`./dist-DDX_kEXl.js`).then(e=>e.go()),__vite__mapDeps([20,4,2,0,1,3,6,8])),sh:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),bash:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),zsh:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),fish:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),ps1:()=>s(()=>i(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),psm1:()=>s(()=>i(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),rb:()=>s(()=>i(()=>import(`./ruby-ChfNwlCY.js`),[]),`ruby`),swift:()=>s(()=>i(()=>import(`./swift-DKB6_1j6.js`),[]),`swift`),toml:()=>s(()=>i(()=>import(`./toml-BPTmHmyx.js`),[]),`toml`),ini:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),cfg:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),conf:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),properties:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),dockerfile:()=>s(()=>i(()=>import(`./dockerfile-BDePf5PZ.js`),[]),`dockerfile`),diff:()=>s(()=>i(()=>import(`./diff-ChtP43wD.js`),[]),`diff`),patch:()=>s(()=>i(()=>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=r(),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:r,jumpToLine:s,onSave:c,workspaceId:l,blame:g,onPosition:v,readOnly:y=!1}){let 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)(null),D=(0,o.useRef)(null),O=(0,o.useRef)(r),k=(0,o.useRef)(c);O.current=r,k.current=c;let[A,j]=(0,o.useState)(!1),[M,N]=(0,o.useState)(!1),[P,F]=(0,o.useState)(`0,0`),[I,L]=(0,o.useState)(0);(0,o.useEffect)(()=>{let r=!1,a,o,s,c,l;return(async()=>{try{let d=h(e),f=u(d),[m,g,v,A,M,P,I,R]=await Promise.all([i(()=>import(`./dist-Dobw-6kL.js`).then(e=>e.x),__vite__mapDeps([1,2])),i(()=>import(`./dist-KYkkwisQ.js`).then(e=>e.s),__vite__mapDeps([3,2,1])),i(()=>import(`./dist-DDMxAmWr.js`),__vite__mapDeps([21,1,2,3,4,0])),i(()=>import(`./dist-KRvDAowe.js`),__vite__mapDeps([22,1,2,3])),i(()=>import(`./dist-BUCp8C1J.js`),__vite__mapDeps([0,1,2,3,4])),i(()=>import(`./dist-Cus6_oaF.js`).then(e=>e.n),__vite__mapDeps([4,2])),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(r||!b.current)return;c=M,l=P,C.current=m.Annotation.define(),w.current=m.Transaction.addToHistory;let z=t.length<=p&&I!==null;o=new m.Compartment;let B=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),v.history(),g.keymap.of([v.indentWithTab,...v.defaultKeymap,...v.historyKeymap,...A.searchKeymap,{key:`Mod-s`,run:()=>(k.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(C.current&&e.transactions.some(e=>e.annotation(C.current)===!0))&&O.current(e.state.doc.toString()),e.selectionSet&&F(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(y&&B.push(m.EditorState.readOnly.of(!0),g.EditorView.editable.of(!1)),R&&!y&&(s=new m.Compartment,B.splice(1,0,s.of([])),B.push(R.base)),I)try{B.push(I)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),z=!1}if(z&&o&&c&&l)try{B.push(o.of(c.syntaxHighlighting(_(c,l))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),z=!1}if(a=new g.EditorView({state:m.EditorState.create({doc:t,extensions:B}),parent:b.current}),r){a.destroy();return}x.current=a,j(z),N(!0),T.current=R,E.current=s??null,D.current=null,L(e=>e+1);let V=new MutationObserver(()=>{let e=x.current;if(e&&z&&o&&c&&l)try{e.dispatch({effects:o.reconfigure(c.syntaxHighlighting(_(c,l)))})}catch{}});S.current=V,V.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),r||N(!0)}})(),()=>{r=!0,S.current?.disconnect(),S.current=null,a?.destroy(),x.current=null,N(!1),b.current&&(b.current.textContent=``)}},[e,y]),(0,o.useEffect)(()=>{let e=x.current;if(!e)return;let n=e.state.doc.toString();n!==t&&e.dispatch({changes:{from:0,to:n.length,insert:t},annotations:C.current?C.current.of(!0):void 0})},[t]),(0,o.useEffect)(()=>{let e=x.current;if(!e||!s)return;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines)),n=Math.min(t.to,t.from+(s.column??1)-1);e.dispatch({selection:{anchor:t.to,head:n},scrollIntoView:!0}),e.focus()},[s,M]);let R=!!(g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l);(0,o.useEffect)(()=>{let t=x.current,n=T.current,r=E.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;D.current!==o&&(D.current=o,t.dispatch({effects:[n.setBlame.of(o),r.reconfigure(o?n.gutter:[])]}))},[g?.state,g?.response,g?.path,g?.workspaceId,e,l,I]);let z=x.current?.state.doc.toString()??t,B=z.length<=m?z:z.slice(0,m),V=h(e),H=d(V),U=x.current?.state,W=U?.selection.main.head,G=W===void 0?void 0:U?.doc.lineAt(W),K=G?.number,q=W!==void 0&&G?W-G.from+1:void 0;return(0,o.useEffect)(()=>{M&&K!==void 0&&q!==void 0&&v?.({line:K,column:q,language:A&&H||`纯文本`,highlight:A?V:`plain`})},[M,K,q,A,H,V,v]),(0,o.useEffect)(()=>()=>v?.(),[v]),(0,f.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":B,"data-file-content-truncated":z.length>m?`1`:`0`,"data-file-selection":P,"data-file-editor-ready":M?`1`:`0`,"data-file-blame-gutter":R?`1`:void 0,onMouseDown:()=>x.current?.focus(),children:[(0,f.jsx)(`div`,{className:`file-cm`,ref:b,"aria-label":`${y?`查看`:`编辑`} ${e}`}),(!M||!v)&&(0,f.jsxs)(`div`,{className:`file-editor-status`,children:[!M&&(0,f.jsx)(`span`,{"data-file-editor-loading":`1`,children:`正在加载编辑器…`}),M&&W!==void 0&&G&&(0,f.jsxs)(`span`,{children:[`第 `,G.number,` 行,第 `,W-G.from+1,` 列`]}),M&&!A&&(0,f.jsx)(`span`,{"data-file-highlight-status":`plain`,children:`纯文本`}),M&&A&&H&&(0,f.jsx)(`span`,{"data-file-highlight-status":V,children:H})]})]})}export{v as CodeMirrorEditor};
|
|
2
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{l as t,n,o as r,r as i,t as a}from"./index-D0Po7xmY.js";var o=e(t(),1);async function s(e,t){let[{StreamLanguage:n},r]=await Promise.all([i(()=>import(`./dist-BUCp8C1J.js`),__vite__mapDeps([0,1,2,3,4])),e()]),a=r[t]??r.default??r;return n.define(a)}var c={cpp:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),cc:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),cxx:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),hpp:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),hh:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),hxx:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),c:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),h:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),cu:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),cuh:()=>i(()=>import(`./dist-B8HMl2sC.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,2,0,1,3,6])),js:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,2,1,3,4,0,6,8])),jsx:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([7,2,1,3,4,0,6,8])),mjs:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,2,1,3,4,0,6,8])),cjs:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,2,1,3,4,0,6,8])),ts:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,2,1,3,4,0,6,8])),tsx:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0,jsx:!0})),__vite__mapDeps([7,2,1,3,4,0,6,8])),mts:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,2,1,3,4,0,6,8])),cts:()=>i(()=>import(`./dist-BaqnkrBt.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,2,1,3,4,0,6,8])),py:()=>i(()=>import(`./dist-DMNSi_OW.js`).then(e=>e.python()),__vite__mapDeps([9,4,2,0,1,3,6,8])),pyi:()=>i(()=>import(`./dist-DMNSi_OW.js`).then(e=>e.python()),__vite__mapDeps([9,4,2,0,1,3,6,8])),java:()=>i(()=>import(`./dist-BZcQqwK2.js`).then(e=>e.java()),__vite__mapDeps([10,4,2,0,1,3,6])),php:()=>i(()=>import(`./dist-MjzwBrDE.js`).then(e=>e.php()),__vite__mapDeps([11,4,2,0,1,3,6,12,13,7,8])),sql:()=>i(()=>import(`./dist-CsOcBQZU.js`).then(e=>e.sql()),__vite__mapDeps([14,4,2,0,1,3,6,8])),yaml:()=>i(()=>import(`./dist-rWx2sy4G.js`).then(e=>e.yaml()),__vite__mapDeps([15,4,2,0,1,3,6])),yml:()=>i(()=>import(`./dist-rWx2sy4G.js`).then(e=>e.yaml()),__vite__mapDeps([15,4,2,0,1,3,6])),xml:()=>i(()=>import(`./dist-Bd_1wEMo.js`).then(e=>e.xml()),__vite__mapDeps([16,1,2,3,4,0,6])),json:()=>i(()=>import(`./dist-blcD_RX0.js`).then(e=>e.json()),__vite__mapDeps([17,4,2,0,1,3,6])),jsonc:()=>i(()=>import(`./dist-blcD_RX0.js`).then(e=>e.json()),__vite__mapDeps([17,4,2,0,1,3,6])),json5:()=>i(()=>import(`./dist-blcD_RX0.js`).then(e=>e.json()),__vite__mapDeps([17,4,2,0,1,3,6])),html:()=>i(()=>import(`./dist-EZTF454G.js`).then(e=>e.html()),__vite__mapDeps([12,1,2,3,4,0,6,13,7,8])),htm:()=>i(()=>import(`./dist-EZTF454G.js`).then(e=>e.html()),__vite__mapDeps([12,1,2,3,4,0,6,13,7,8])),vue:()=>i(()=>import(`./dist-EZTF454G.js`).then(e=>e.html()),__vite__mapDeps([12,1,2,3,4,0,6,13,7,8])),svelte:()=>i(()=>import(`./dist-EZTF454G.js`).then(e=>e.html()),__vite__mapDeps([12,1,2,3,4,0,6,13,7,8])),css:()=>i(()=>import(`./dist-CDdAirBD.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([13,2,4,0,1,3,6])),md:()=>i(()=>import(`./dist-DfYcl24C.js`).then(e=>e.markdown()),__vite__mapDeps([18,1,2,3,4,0,8,12,6,13,7])),markdown:()=>i(()=>import(`./dist-DfYcl24C.js`).then(e=>e.markdown()),__vite__mapDeps([18,1,2,3,4,0,8,12,6,13,7])),mdx:()=>i(()=>import(`./dist-DfYcl24C.js`).then(e=>e.markdown()),__vite__mapDeps([18,1,2,3,4,0,8,12,6,13,7])),rs:()=>i(()=>import(`./dist-BJ4DyKpr.js`).then(e=>e.rust()),__vite__mapDeps([19,4,2,0,1,3,6])),go:()=>i(()=>import(`./dist-DDX_kEXl.js`).then(e=>e.go()),__vite__mapDeps([20,4,2,0,1,3,6,8])),sh:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),bash:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),zsh:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),fish:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),ps1:()=>s(()=>i(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),psm1:()=>s(()=>i(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),rb:()=>s(()=>i(()=>import(`./ruby-ChfNwlCY.js`),[]),`ruby`),swift:()=>s(()=>i(()=>import(`./swift-DKB6_1j6.js`),[]),`swift`),toml:()=>s(()=>i(()=>import(`./toml-BPTmHmyx.js`),[]),`toml`),ini:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),cfg:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),conf:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),properties:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),dockerfile:()=>s(()=>i(()=>import(`./dockerfile-BDePf5PZ.js`),[]),`dockerfile`),diff:()=>s(()=>i(()=>import(`./diff-ChtP43wD.js`),[]),`diff`),patch:()=>s(()=>i(()=>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=r(),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:r,jumpToLine:s,onSave:c,workspaceId:l,blame:g,onPosition:v,readOnly:y=!1}){let 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)(null),D=(0,o.useRef)(null),O=(0,o.useRef)(r),k=(0,o.useRef)(c);O.current=r,k.current=c;let[A,j]=(0,o.useState)(!1),[M,N]=(0,o.useState)(!1),[P,F]=(0,o.useState)(`0,0`),[I,L]=(0,o.useState)(0);(0,o.useEffect)(()=>{let r=!1,a,o,s,c,l;return(async()=>{try{let d=h(e),f=u(d),[m,g,v,A,M,P,I,R]=await Promise.all([i(()=>import(`./dist-Dobw-6kL.js`).then(e=>e.x),__vite__mapDeps([1,2])),i(()=>import(`./dist-KYkkwisQ.js`).then(e=>e.s),__vite__mapDeps([3,2,1])),i(()=>import(`./dist-DDMxAmWr.js`),__vite__mapDeps([21,1,2,3,4,0])),i(()=>import(`./dist-KRvDAowe.js`),__vite__mapDeps([22,1,2,3])),i(()=>import(`./dist-BUCp8C1J.js`),__vite__mapDeps([0,1,2,3,4])),i(()=>import(`./dist-Cus6_oaF.js`).then(e=>e.n),__vite__mapDeps([4,2])),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(r||!b.current)return;c=M,l=P,C.current=m.Annotation.define(),w.current=m.Transaction.addToHistory;let z=t.length<=p&&I!==null;o=new m.Compartment;let B=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),v.history(),g.keymap.of([v.indentWithTab,...v.defaultKeymap,...v.historyKeymap,...A.searchKeymap,{key:`Mod-s`,run:()=>(k.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(C.current&&e.transactions.some(e=>e.annotation(C.current)===!0))&&O.current(e.state.doc.toString()),e.selectionSet&&F(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(y&&B.push(m.EditorState.readOnly.of(!0),g.EditorView.editable.of(!1)),R&&!y&&(s=new m.Compartment,B.splice(1,0,s.of([])),B.push(R.base)),I)try{B.push(I)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),z=!1}if(z&&o&&c&&l)try{B.push(o.of(c.syntaxHighlighting(_(c,l))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),z=!1}if(a=new g.EditorView({state:m.EditorState.create({doc:t,extensions:B}),parent:b.current}),r){a.destroy();return}x.current=a,j(z),N(!0),T.current=R,E.current=s??null,D.current=null,L(e=>e+1);let V=new MutationObserver(()=>{let e=x.current;if(e&&z&&o&&c&&l)try{e.dispatch({effects:o.reconfigure(c.syntaxHighlighting(_(c,l)))})}catch{}});S.current=V,V.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),r||N(!0)}})(),()=>{r=!0,S.current?.disconnect(),S.current=null,a?.destroy(),x.current=null,N(!1),b.current&&(b.current.textContent=``)}},[e,y]),(0,o.useEffect)(()=>{let e=x.current;if(!e)return;let n=e.state.doc.toString();n!==t&&e.dispatch({changes:{from:0,to:n.length,insert:t},annotations:C.current?C.current.of(!0):void 0})},[t]),(0,o.useEffect)(()=>{let e=x.current;if(!e||!s)return;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines)),n=Math.min(t.to,t.from+(s.column??1)-1);e.dispatch({selection:{anchor:t.to,head:n},scrollIntoView:!0}),e.focus()},[s,M]);let R=!!(g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l);(0,o.useEffect)(()=>{let t=x.current,n=T.current,r=E.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;D.current!==o&&(D.current=o,t.dispatch({effects:[n.setBlame.of(o),r.reconfigure(o?n.gutter:[])]}))},[g?.state,g?.response,g?.path,g?.workspaceId,e,l,I]);let z=x.current?.state.doc.toString()??t,B=z.length<=m?z:z.slice(0,m),V=h(e),H=d(V),U=x.current?.state,W=U?.selection.main.head,G=W===void 0?void 0:U?.doc.lineAt(W),K=G?.number,q=W!==void 0&&G?W-G.from+1:void 0;return(0,o.useEffect)(()=>{M&&K!==void 0&&q!==void 0&&v?.({line:K,column:q,language:A&&H||`纯文本`,highlight:A?V:`plain`})},[M,K,q,A,H,V,v]),(0,o.useEffect)(()=>()=>v?.(),[v]),(0,f.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":B,"data-file-content-truncated":z.length>m?`1`:`0`,"data-file-selection":P,"data-file-editor-ready":M?`1`:`0`,"data-file-blame-gutter":R?`1`:void 0,onMouseDown:()=>x.current?.focus(),children:[(0,f.jsx)(`div`,{className:`file-cm`,ref:b,"aria-label":`${y?`查看`:`编辑`} ${e}`}),(!M||!v)&&(0,f.jsxs)(`div`,{className:`file-editor-status`,children:[!M&&(0,f.jsx)(`span`,{"data-file-editor-loading":`1`,children:`正在加载编辑器…`}),M&&W!==void 0&&G&&(0,f.jsxs)(`span`,{children:[`第 `,G.number,` 行,第 `,W-G.from+1,` 列`]}),M&&!A&&(0,f.jsx)(`span`,{"data-file-highlight-status":`plain`,children:`纯文本`}),M&&A&&H&&(0,f.jsx)(`span`,{"data-file-highlight-status":V,children:H})]})]})}export{v as CodeMirrorEditor};
|