@evandu/super-pi 0.1.130 → 0.1.132
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/README.md +18 -0
- package/agents/super-pi-documents/index.ts +92 -0
- package/agents/super-pi-feishu/index.ts +88 -0
- package/agents/super-pi-knowledge/index.ts +32 -1
- package/agents/super-pi-task/core.ts +217 -0
- package/agents/super-pi-task/index.ts +74 -1
- package/agents/super-pi-web/index.ts +32 -0
- package/assets/fonts/LICENSE +92 -0
- package/assets/fonts/NotoSansSC-Bold.otf +0 -0
- package/assets/fonts/NotoSansSC-Regular.otf +0 -0
- package/dist/client/.super-pi-client-sources.json +13 -10
- package/dist/client/assets/CodeMirrorEditor-ktyL2PcX.js +2 -0
- package/dist/client/assets/{dist-BKp4AWEJ.js → dist--igDAzRS.js} +1 -1
- package/dist/client/assets/{dist-BBW2SE_R.js → dist-60usx__o.js} +1 -1
- package/dist/client/assets/{dist-GkIV1LTX.js → dist-8pdzh6h1.js} +1 -1
- package/dist/client/assets/{dist-B2nPVdKh.js → dist-B8OZ-n_C.js} +1 -1
- package/dist/client/assets/{dist-BDygQgZD.js → dist-BAJCrbnX.js} +1 -1
- package/dist/client/assets/{dist-CiSGSVBZ.js → dist-BJi5HmH4.js} +1 -1
- package/dist/client/assets/{dist-CRzRB9k3.js → dist-BRjGckmQ.js} +1 -1
- package/dist/client/assets/{dist-Cxerc7Bb.js → dist-Bg9zLfex.js} +1 -1
- package/dist/client/assets/{dist-C90MPTnk.js → dist-BjZUYxLd.js} +1 -1
- package/dist/client/assets/{dist-DmAOqr0M.js → dist-Bv6P2Rcp.js} +1 -1
- package/dist/client/assets/{dist-BhJGK8-b.js → dist-C6iAHGvb.js} +1 -1
- package/dist/client/assets/{dist-Dq4-QFAJ.js → dist-CMscy2Nn.js} +1 -1
- package/dist/client/assets/{dist-Ur37340K.js → dist-CPLCQDqy.js} +1 -1
- package/dist/client/assets/{dist-DZnUERoW.js → dist-CgmISAMr.js} +1 -1
- package/dist/client/assets/{dist-CWYRjnj-.js → dist-CoszOk5k.js} +1 -1
- package/dist/client/assets/{dist-CMnvChDX.js → dist-Cu75NyQ0.js} +1 -1
- package/dist/client/assets/{dist-HdeIBl2J.js → dist-DNZMXYNq.js} +1 -1
- package/dist/client/assets/{dist-BykVFExd.js → dist-D_Zdnhm8.js} +1 -1
- package/dist/client/assets/{dist-ChszWGDv.js → dist-DvHghuGd.js} +1 -1
- package/dist/client/assets/{dist-CZ9I2JCd.js → dist-Hj_dWgPr.js} +1 -1
- package/dist/client/assets/{dist-B61RSa-K.js → dist-Zhdkfvng.js} +1 -1
- package/dist/client/assets/{dist-DB5M5fZG.js → dist-vsMBLoxV.js} +1 -1
- package/dist/client/assets/{index-D_c-CYAr.js → index-ChyemF2I.js} +23 -21
- package/dist/client/assets/{index-CXB6U5mz.css → index-D3MEG8uH.css} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/application/document-service.d.ts +68 -0
- package/dist/server/application/document-service.js +120 -0
- package/dist/server/application/feishu-service.d.ts +132 -0
- package/dist/server/application/feishu-service.js +264 -0
- package/dist/server/application/run-service.js +49 -7
- package/dist/server/application/scheduled-task-service.d.ts +164 -0
- package/dist/server/application/scheduled-task-service.js +350 -0
- package/dist/server/command-handler.d.ts +25 -1
- package/dist/server/command-handler.js +60 -1
- package/dist/server/documents.d.ts +152 -0
- package/dist/server/documents.js +998 -0
- package/dist/server/feishu-cli.d.ts +207 -0
- package/dist/server/feishu-cli.js +419 -0
- package/dist/server/file-changes.js +6 -4
- package/dist/server/files.d.ts +32 -0
- package/dist/server/files.js +31 -3
- package/dist/server/http-server.js +324 -2
- package/dist/server/index.js +41 -2
- package/dist/server/inline-thinking.d.ts +90 -0
- package/dist/server/inline-thinking.js +181 -0
- package/dist/server/knowledge.d.ts +24 -14
- package/dist/server/knowledge.js +57 -34
- package/dist/server/persistence/app-state-repository.d.ts +13 -1
- package/dist/server/persistence/sqlite-state-repository.js +3 -0
- package/dist/server/pi-session-pool.js +2 -1
- package/dist/server/pi-session.d.ts +4 -0
- package/dist/server/pi-session.js +14 -0
- package/dist/server/presentations/schema.d.ts +120 -0
- package/dist/server/presentations/schema.js +128 -0
- package/dist/server/runtime.d.ts +67 -0
- package/dist/server/runtime.js +204 -18
- package/dist/server/scheduled-tasks.d.ts +101 -0
- package/dist/server/scheduled-tasks.js +138 -0
- package/dist/server/server-context.d.ts +19 -0
- package/dist/server/store.d.ts +30 -0
- package/dist/server/store.js +81 -2
- package/dist/server/subagents.js +33 -6
- package/dist/server/task-tool.d.ts +18 -0
- package/dist/server/task-tool.js +18 -0
- package/dist/server/types.d.ts +56 -0
- package/dist/server/web.d.ts +24 -0
- package/dist/server/web.js +180 -0
- package/package.json +45 -6
- package/skills/presentation/SKILL.md +30 -0
- package/skills/presentation/references/data.md +10 -0
- package/skills/presentation/references/quality.md +12 -0
- package/skills/presentation/references/story.md +12 -0
- package/skills/presentation/references/templates-and-editing.md +11 -0
- package/skills/presentation/references/visual-system.md +10 -0
- package/dist/.super-pi-check-inputs.json +0 -4
- package/dist/client/assets/CodeMirrorEditor-BNVBZZSS.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evandu/super-pi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.132",
|
|
4
4
|
"description": "Web control plane and companion for Pi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,12 +16,14 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
18
|
"agents",
|
|
19
|
+
"skills",
|
|
19
20
|
"bin",
|
|
20
21
|
"scripts/restart-server.mjs",
|
|
21
22
|
"README.md",
|
|
22
23
|
"assets/knowledge-model",
|
|
23
24
|
"scripts/patch-brace-expansion.mjs",
|
|
24
|
-
"scripts/diagnose.mjs"
|
|
25
|
+
"scripts/diagnose.mjs",
|
|
26
|
+
"assets/fonts"
|
|
25
27
|
],
|
|
26
28
|
"engines": {
|
|
27
29
|
"node": ">=22.19.0"
|
|
@@ -37,11 +39,15 @@
|
|
|
37
39
|
"start": "node dist/server/index.js",
|
|
38
40
|
"restart:server": "node scripts/restart-server.mjs",
|
|
39
41
|
"smoke": "npm run build && node scripts/smoke.mjs",
|
|
40
|
-
"check": "node scripts/run-check.mjs"
|
|
42
|
+
"check": "node scripts/run-check.mjs",
|
|
43
|
+
"test": "node scripts/test.mjs"
|
|
41
44
|
},
|
|
42
45
|
"check:logic": [
|
|
46
|
+
"scripts/test-runner.test.mjs",
|
|
43
47
|
"scripts/stream-checkpoint.test.mjs",
|
|
44
48
|
"scripts/stream-transport.test.mjs",
|
|
49
|
+
"scripts/inline-thinking.test.mjs",
|
|
50
|
+
"scripts/inline-thinking-close-tag.test.mjs",
|
|
45
51
|
"scripts/pi-session.test.mjs",
|
|
46
52
|
"scripts/pi-session-isolation.test.mjs",
|
|
47
53
|
"scripts/installed-layout.test.mjs",
|
|
@@ -81,6 +87,10 @@
|
|
|
81
87
|
"scripts/queue-store.test.mjs",
|
|
82
88
|
"scripts/followup.test.mjs",
|
|
83
89
|
"scripts/pi-followup-queue.test.mjs",
|
|
90
|
+
"scripts/background-result-delivery.test.mjs",
|
|
91
|
+
"scripts/question-stop.test.mjs",
|
|
92
|
+
"scripts/background-result-body.test.mjs",
|
|
93
|
+
"scripts/question-request-size.test.mjs",
|
|
84
94
|
"scripts/md-render.test.mjs",
|
|
85
95
|
"scripts/revert-session-format.test.mjs",
|
|
86
96
|
"scripts/revert-session-file.test.mjs",
|
|
@@ -96,6 +106,7 @@
|
|
|
96
106
|
"scripts/file-content-search.test.mjs",
|
|
97
107
|
"scripts/file-diff-client.test.mjs",
|
|
98
108
|
"scripts/editor-languages.test.mjs",
|
|
109
|
+
"scripts/editor-blame.test.mjs",
|
|
99
110
|
"scripts/task-tool.test.mjs",
|
|
100
111
|
"scripts/tool-register-env.test.mjs",
|
|
101
112
|
"scripts/bg-task-zombie.test.mjs",
|
|
@@ -114,6 +125,8 @@
|
|
|
114
125
|
"scripts/provider-pi-reads.test.mjs",
|
|
115
126
|
"scripts/active-memory.test.mjs",
|
|
116
127
|
"scripts/knowledge-base.test.mjs",
|
|
128
|
+
"scripts/knowledge-import-path.test.mjs",
|
|
129
|
+
"scripts/knowledge-import-identity.test.mjs",
|
|
117
130
|
"scripts/tool-runner.test.mjs",
|
|
118
131
|
"scripts/tool-runtime-api.test.mjs",
|
|
119
132
|
"scripts/tool-sharing.test.mjs",
|
|
@@ -124,10 +137,21 @@
|
|
|
124
137
|
"scripts/cli.test.mjs",
|
|
125
138
|
"scripts/check-runner.test.mjs",
|
|
126
139
|
"scripts/skills-discovery.test.mjs",
|
|
140
|
+
"scripts/built-in-skills.test.mjs",
|
|
141
|
+
"scripts/presentation-schema.test.mjs",
|
|
127
142
|
"scripts/session-state-icon.test.mjs",
|
|
128
143
|
"scripts/provider-fetch-models.test.mjs",
|
|
129
144
|
"scripts/shared-chrome.test.mjs",
|
|
130
|
-
"scripts/prompt-templates.test.mjs"
|
|
145
|
+
"scripts/prompt-templates.test.mjs",
|
|
146
|
+
"scripts/documents.test.mjs",
|
|
147
|
+
"scripts/web-tools.test.mjs",
|
|
148
|
+
"scripts/document-service.test.mjs",
|
|
149
|
+
"scripts/document-block-parse.test.mjs",
|
|
150
|
+
"scripts/document-write-overwrite.test.mjs",
|
|
151
|
+
"scripts/feishu.test.mjs",
|
|
152
|
+
"scripts/scheduled-tasks.test.mjs",
|
|
153
|
+
"scripts/scheduled-task-scope.test.mjs",
|
|
154
|
+
"scripts/scheduled-task-tool.test.mjs"
|
|
131
155
|
],
|
|
132
156
|
"check:browser": [
|
|
133
157
|
"scripts/interrupt-browser.test.mjs",
|
|
@@ -144,6 +168,7 @@
|
|
|
144
168
|
"scripts/session-state-animation-browser.test.mjs",
|
|
145
169
|
"scripts/agent-vis-card-browser.test.mjs",
|
|
146
170
|
"scripts/queue-dock.test.mjs",
|
|
171
|
+
"scripts/scheduled-tasks-browser.test.mjs",
|
|
147
172
|
"scripts/md-render-browser.test.mjs",
|
|
148
173
|
"scripts/right-sidebar-browser.test.mjs",
|
|
149
174
|
"scripts/sidebar-tools-browser.test.mjs",
|
|
@@ -151,6 +176,8 @@
|
|
|
151
176
|
"scripts/session-context-menu-browser.test.mjs",
|
|
152
177
|
"scripts/tool-call-blocks-browser.test.mjs",
|
|
153
178
|
"scripts/files-tab-browser.test.mjs",
|
|
179
|
+
"scripts/editor-blame-browser.test.mjs",
|
|
180
|
+
"scripts/file-panel-external-poll-browser.test.mjs",
|
|
154
181
|
"scripts/file-quickopen-browser.test.mjs",
|
|
155
182
|
"scripts/file-content-search-browser.test.mjs",
|
|
156
183
|
"scripts/file-changes-browser.test.mjs",
|
|
@@ -177,7 +204,9 @@
|
|
|
177
204
|
"scripts/knowledge-base-browser.test.mjs",
|
|
178
205
|
"scripts/terminal-browser.test.mjs",
|
|
179
206
|
"scripts/ux-polish-browser.test.mjs",
|
|
180
|
-
"scripts/prompt-templates-browser.test.mjs"
|
|
207
|
+
"scripts/prompt-templates-browser.test.mjs",
|
|
208
|
+
"scripts/documents-browser.test.mjs",
|
|
209
|
+
"scripts/feishu-browser.test.mjs"
|
|
181
210
|
],
|
|
182
211
|
"dependencies": {
|
|
183
212
|
"@codemirror/commands": "^6.11.1",
|
|
@@ -212,12 +241,14 @@
|
|
|
212
241
|
},
|
|
213
242
|
"devDependencies": {
|
|
214
243
|
"@types/node": "latest",
|
|
244
|
+
"@types/pdfkit": "^0.17.7",
|
|
215
245
|
"@types/react": "latest",
|
|
216
246
|
"@types/react-dom": "latest",
|
|
217
247
|
"@types/ws": "latest",
|
|
218
248
|
"@vitejs/plugin-react": "latest",
|
|
219
249
|
"concurrently": "latest",
|
|
220
250
|
"cross-env": "latest",
|
|
251
|
+
"pdf-lib": "^1.17.1",
|
|
221
252
|
"react": "latest",
|
|
222
253
|
"react-dom": "latest",
|
|
223
254
|
"tsx": "latest",
|
|
@@ -225,6 +256,14 @@
|
|
|
225
256
|
"vite": "latest"
|
|
226
257
|
},
|
|
227
258
|
"optionalDependencies": {
|
|
228
|
-
"@huggingface/transformers": "^4.3.1"
|
|
259
|
+
"@huggingface/transformers": "^4.3.1",
|
|
260
|
+
"cfb": "^1.2.2",
|
|
261
|
+
"docx": "^9.14.0",
|
|
262
|
+
"exceljs": "^4.4.0",
|
|
263
|
+
"fflate": "^0.8.3",
|
|
264
|
+
"mammoth": "^1.13.0",
|
|
265
|
+
"pdfjs-dist": "^6.4.299",
|
|
266
|
+
"pdfkit": "^0.20.2",
|
|
267
|
+
"pptxgenjs": "^4.0.1"
|
|
229
268
|
}
|
|
230
269
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: presentation
|
|
3
|
+
description: Create, revise, or review PowerPoint presentations when the user needs a coherent story, deliberate visual design, charts or imagery, template fidelity, and a validated PPTX deliverable.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Presentation production
|
|
7
|
+
|
|
8
|
+
Treat a deck as a communication artifact, not a document split across slides. Preserve the user's audience, purpose, evidence, brand constraints, language, and requested file path.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. Inspect supplied source material and any existing deck or template before proposing a structure.
|
|
13
|
+
2. Establish the audience, decision or learning outcome, presentation setting, and approximate duration. Infer ordinary defaults when they do not materially change the result; ask only for consequential missing choices.
|
|
14
|
+
3. Write a slide-level story before building. Each slide needs one job and a conclusion-oriented title.
|
|
15
|
+
4. Choose a small visual system and a layout appropriate to each slide's job. Do not make every slide a title plus bullets.
|
|
16
|
+
5. Build with the presentation tools available in the session. Never claim that an image, chart, template, or visual validation was applied if the available tools cannot perform it.
|
|
17
|
+
6. Render or inspect the finished deck when the tools support it. Fix overflow, collisions, illegible text, weak hierarchy, misleading charts, and visual repetition before delivery.
|
|
18
|
+
7. Report the output path, what was validated, and any limitation that remains observable to the user.
|
|
19
|
+
|
|
20
|
+
## Progressive references
|
|
21
|
+
|
|
22
|
+
- Read [references/story.md](references/story.md) when developing or restructuring the narrative.
|
|
23
|
+
- Read [references/visual-system.md](references/visual-system.md) when choosing layouts, typography, colour, imagery, or information hierarchy.
|
|
24
|
+
- Read [references/data.md](references/data.md) for tables, quantitative claims, and chart selection.
|
|
25
|
+
- Read [references/templates-and-editing.md](references/templates-and-editing.md) when a template or existing deck must be preserved or edited.
|
|
26
|
+
- Read [references/quality.md](references/quality.md) before final validation and delivery.
|
|
27
|
+
|
|
28
|
+
## Current tool boundary
|
|
29
|
+
|
|
30
|
+
The legacy `document_write` PPT path accepts Markdown and produces a clean text-first deck. It cannot faithfully implement positioned elements, images, native charts, templates, object-level edits, or visual rendering. When those capabilities are absent, produce the strongest honest text-first deck possible and state the limitation; do not simulate visual completion in prose.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Data, tables, and charts
|
|
2
|
+
|
|
3
|
+
Use quantitative visuals to answer a question, not to decorate a slide.
|
|
4
|
+
|
|
5
|
+
- Bar: compare categories. Line: change over ordered time. Scatter: relationship or distribution. Waterfall: contributions to a change. Pie or donut: only a few parts of one whole when precise comparison is unimportant.
|
|
6
|
+
- Start axes honestly, disclose truncation, preserve units, and name the time period and source.
|
|
7
|
+
- Highlight the series or value that supports the slide's takeaway; mute supporting context.
|
|
8
|
+
- Direct-label when practical. Remove chart furniture that does not help interpretation.
|
|
9
|
+
- Use a table when exact lookup matters; use a chart when pattern or comparison matters.
|
|
10
|
+
- Reconcile values against the source before building and again after rendering.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Presentation quality gate
|
|
2
|
+
|
|
3
|
+
Validate the artifact, not just the source instructions.
|
|
4
|
+
|
|
5
|
+
1. File integrity: opens without repair, has the requested aspect ratio and slide count, and contains no missing relationships.
|
|
6
|
+
2. Content: claims match sources; titles communicate takeaways; spelling, units, dates, and names are correct.
|
|
7
|
+
3. Geometry: no object is outside the canvas; no accidental overlap, clipping, or text overflow; margins and alignment are consistent.
|
|
8
|
+
4. Readability: type remains legible at presentation scale, contrast is adequate, and charts have readable labels.
|
|
9
|
+
5. Visual rhythm: layouts vary with the story while retaining one system; no page is needlessly dense or empty.
|
|
10
|
+
6. Delivery: render every slide when possible, inspect a contact sheet and full-size pages, repair defects, then rerender the affected pages.
|
|
11
|
+
|
|
12
|
+
Report exactly which checks ran. A PPTX that merely reopens and yields its text has passed structural round-trip testing, not visual QA.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Story and slide architecture
|
|
2
|
+
|
|
3
|
+
Start from the outcome: what should the audience understand, believe, decide, or do afterward? Arrange evidence so the answer becomes inevitable rather than merely chronological.
|
|
4
|
+
|
|
5
|
+
- Give every slide one communicative job and a title that states its takeaway.
|
|
6
|
+
- Prefer a visible arc: context or tension, evidence, implication, recommendation, next action.
|
|
7
|
+
- Separate sections when the audience must reset its mental model.
|
|
8
|
+
- Remove slides that neither change understanding nor support a decision.
|
|
9
|
+
- Put detail needed only for questions in an appendix.
|
|
10
|
+
- For a timed talk, budget roughly one substantive slide per one to two minutes, then adjust for demos and discussion.
|
|
11
|
+
|
|
12
|
+
Before building, record for each slide: purpose, takeaway title, evidence, intended visual form, and source.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Templates and existing decks
|
|
2
|
+
|
|
3
|
+
Inspect before editing. Preserve the existing slide size, theme, masters, layouts, placeholders, brand assets, and object relationships unless the user asks for a redesign.
|
|
4
|
+
|
|
5
|
+
- Prefer filling real placeholders over painting look-alike text boxes on top.
|
|
6
|
+
- Duplicate an appropriate existing layout when adding a slide.
|
|
7
|
+
- Make object-level changes for local requests; do not rebuild the whole deck and lose unsupported content.
|
|
8
|
+
- Preserve charts, notes, links, media, accessibility metadata, and animations that are outside the requested change.
|
|
9
|
+
- Require a fresh version token before overwriting an existing file.
|
|
10
|
+
|
|
11
|
+
If the available tools expose only extracted text, state that template-faithful editing is unavailable instead of pretending the regenerated file preserves it.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Visual system and layout
|
|
2
|
+
|
|
3
|
+
Choose a restrained system and apply it consistently: aspect ratio, typefaces, title/body scale, margins, grid, background, primary text, muted text, accent, and semantic status colours.
|
|
4
|
+
|
|
5
|
+
- Use hierarchy, whitespace, alignment, and scale before decoration.
|
|
6
|
+
- Select layouts by content relationship: comparison, sequence, hierarchy, spatial relationship, evidence plus interpretation, or a single focal statement.
|
|
7
|
+
- Prefer diagrams, images, charts, and short labels over dense prose when they communicate the same idea more directly.
|
|
8
|
+
- Avoid repeated card grids, decorative gradients, arbitrary icons, excessive rounded rectangles, and tiny captions that create an automatic “AI deck” look.
|
|
9
|
+
- Keep body copy comfortably readable in the actual presentation setting. Split content instead of shrinking it to fit.
|
|
10
|
+
- Treat accessibility as a design constraint: sufficient contrast, colour-independent meaning, readable labels, and sensible reading order.
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-CWYRjnj-.js","assets/dist-BDygQgZD.js","assets/index-D_c-CYAr.js","assets/index-CXB6U5mz.css","assets/dist-CiSGSVBZ.js","assets/dist-CMnvChDX.js","assets/dist-C90MPTnk.js","assets/dist-DmAOqr0M.js","assets/dist-Dq4-QFAJ.js","assets/dist-ChszWGDv.js","assets/dist-BhJGK8-b.js","assets/dist-HdeIBl2J.js","assets/dist-BykVFExd.js","assets/dist-Cxerc7Bb.js","assets/dist-Ur37340K.js","assets/dist-B2nPVdKh.js","assets/dist-DB5M5fZG.js","assets/dist-B61RSa-K.js","assets/dist-CZ9I2JCd.js","assets/dist-GkIV1LTX.js","assets/dist-DZnUERoW.js","assets/dist-CRzRB9k3.js","assets/dist-BBW2SE_R.js","assets/dist-BKp4AWEJ.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e,n as t,r as n,t as r}from"./index-D_c-CYAr.js";var i=e(n(),1);async function a(e,t){let[{StreamLanguage:n},i]=await Promise.all([r(()=>import(`./dist-CWYRjnj-.js`),__vite__mapDeps([0,1,2,3,4,5])),e()]),a=i[t]??i.default??i;return n.define(a)}var o={cpp:()=>r(()=>import(`./dist-C90MPTnk.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cc:()=>r(()=>import(`./dist-C90MPTnk.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cxx:()=>r(()=>import(`./dist-C90MPTnk.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hpp:()=>r(()=>import(`./dist-C90MPTnk.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hh:()=>r(()=>import(`./dist-C90MPTnk.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),hxx:()=>r(()=>import(`./dist-C90MPTnk.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),c:()=>r(()=>import(`./dist-C90MPTnk.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),h:()=>r(()=>import(`./dist-C90MPTnk.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cu:()=>r(()=>import(`./dist-C90MPTnk.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),cuh:()=>r(()=>import(`./dist-C90MPTnk.js`).then(e=>e.cpp()),__vite__mapDeps([6,5,2,3,0,1,4,7])),js:()=>r(()=>import(`./dist-Dq4-QFAJ.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),jsx:()=>r(()=>import(`./dist-Dq4-QFAJ.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-Dq4-QFAJ.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),cjs:()=>r(()=>import(`./dist-Dq4-QFAJ.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,2,3,1,4,5,0,7,9])),ts:()=>r(()=>import(`./dist-Dq4-QFAJ.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-Dq4-QFAJ.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-Dq4-QFAJ.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-Dq4-QFAJ.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-BhJGK8-b.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),pyi:()=>r(()=>import(`./dist-BhJGK8-b.js`).then(e=>e.python()),__vite__mapDeps([10,5,2,3,0,1,4,7,9])),java:()=>r(()=>import(`./dist-HdeIBl2J.js`).then(e=>e.java()),__vite__mapDeps([11,5,2,3,0,1,4,7])),php:()=>r(()=>import(`./dist-BykVFExd.js`).then(e=>e.php()),__vite__mapDeps([12,5,2,3,0,1,4,7,13,14,8,9])),sql:()=>r(()=>import(`./dist-B2nPVdKh.js`).then(e=>e.sql()),__vite__mapDeps([15,5,2,3,0,1,4,7,9])),yaml:()=>r(()=>import(`./dist-DB5M5fZG.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),yml:()=>r(()=>import(`./dist-DB5M5fZG.js`).then(e=>e.yaml()),__vite__mapDeps([16,5,2,3,0,1,4,7])),xml:()=>r(()=>import(`./dist-B61RSa-K.js`).then(e=>e.xml()),__vite__mapDeps([17,1,2,3,4,5,0,7])),json:()=>r(()=>import(`./dist-CZ9I2JCd.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),jsonc:()=>r(()=>import(`./dist-CZ9I2JCd.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),json5:()=>r(()=>import(`./dist-CZ9I2JCd.js`).then(e=>e.json()),__vite__mapDeps([18,5,2,3,0,1,4,7])),html:()=>r(()=>import(`./dist-Cxerc7Bb.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),htm:()=>r(()=>import(`./dist-Cxerc7Bb.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),vue:()=>r(()=>import(`./dist-Cxerc7Bb.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),svelte:()=>r(()=>import(`./dist-Cxerc7Bb.js`).then(e=>e.html()),__vite__mapDeps([13,1,2,3,4,5,0,7,14,8,9])),css:()=>r(()=>import(`./dist-Ur37340K.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([14,2,3,5,0,1,4,7])),md:()=>r(()=>import(`./dist-GkIV1LTX.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),markdown:()=>r(()=>import(`./dist-GkIV1LTX.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),mdx:()=>r(()=>import(`./dist-GkIV1LTX.js`).then(e=>e.markdown()),__vite__mapDeps([19,1,2,3,4,5,0,9,13,7,14,8])),rs:()=>r(()=>import(`./dist-DZnUERoW.js`).then(e=>e.rust()),__vite__mapDeps([20,5,2,3,0,1,4,7])),go:()=>r(()=>import(`./dist-CRzRB9k3.js`).then(e=>e.go()),__vite__mapDeps([21,5,2,3,0,1,4,7,9])),sh:()=>a(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),bash:()=>a(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),zsh:()=>a(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),fish:()=>a(()=>r(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),ps1:()=>a(()=>r(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),psm1:()=>a(()=>r(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),rb:()=>a(()=>r(()=>import(`./ruby-ChfNwlCY.js`),[]),`ruby`),swift:()=>a(()=>r(()=>import(`./swift-DKB6_1j6.js`),[]),`swift`),toml:()=>a(()=>r(()=>import(`./toml-BPTmHmyx.js`),[]),`toml`),ini:()=>a(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),cfg:()=>a(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),conf:()=>a(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),properties:()=>a(()=>r(()=>import(`./properties-C357ku5U.js`),[]),`properties`),dockerfile:()=>a(()=>r(()=>import(`./dockerfile-BDePf5PZ.js`),[]),`dockerfile`),diff:()=>a(()=>r(()=>import(`./diff-ChtP43wD.js`),[]),`diff`),patch:()=>a(()=>r(()=>import(`./diff-ChtP43wD.js`),[]),`diff`)},s={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 c(e){return o[e.toLowerCase()]}function l(e){return s[e.toLowerCase()]}var u=t(),d=262144,f=131072;function p(e){return e.split(`.`).pop()?.toLowerCase()??``}function m(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function h(e,t){return e.HighlightStyle.define([{tag:t.tags.keyword,color:m(`--cm-keyword`)},{tag:t.tags.string,color:m(`--cm-string`)},{tag:t.tags.number,color:m(`--cm-number`)},{tag:t.tags.comment,color:m(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:m(`--cm-function`)},{tag:t.tags.typeName,color:m(`--cm-type`)},{tag:t.tags.className,color:m(`--cm-type`)},{tag:t.tags.propertyName,color:m(`--cm-property`)},{tag:t.tags.operator,color:m(`--cm-operator`)},{tag:t.tags.variableName,color:m(`--cm-variable`)}])}function g({path:e,value:t,onChange:n,jumpToLine:a,onSave:o}){let s=(0,i.useRef)(null),m=(0,i.useRef)(null),g=(0,i.useRef)(null),_=(0,i.useRef)(null),v=(0,i.useRef)(null),y=(0,i.useRef)(n),b=(0,i.useRef)(o);y.current=n,b.current=o;let[x,S]=(0,i.useState)(!1),[C,w]=(0,i.useState)(!1),[T,E]=(0,i.useState)(`0,0`);(0,i.useEffect)(()=>{let n=!1,i,a,o,l;return(async()=>{try{let u=p(e),f=c(u),[x,C,T,D,O,k,A]=await Promise.all([r(()=>import(`./dist-BDygQgZD.js`).then(e=>e.x),__vite__mapDeps([1,2,3])),r(()=>import(`./dist-CiSGSVBZ.js`).then(e=>e.s),__vite__mapDeps([4,2,3,1])),r(()=>import(`./dist-BBW2SE_R.js`),__vite__mapDeps([22,1,2,3,4,5,0])),r(()=>import(`./dist-BKp4AWEJ.js`),__vite__mapDeps([23,1,2,3,4])),r(()=>import(`./dist-CWYRjnj-.js`),__vite__mapDeps([0,1,2,3,4,5])),r(()=>import(`./dist-CMnvChDX.js`).then(e=>e.n),__vite__mapDeps([5,2,3])),f?f().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${u}:`,e),null)):Promise.resolve(null)]);if(n||!s.current)return;o=O,l=k,_.current=x.Annotation.define(),v.current=x.Transaction.addToHistory;let j=t.length<=d&&A!==null;a=new x.Compartment;let M=[C.lineNumbers(),C.highlightActiveLine(),C.drawSelection(),T.history(),C.keymap.of([T.indentWithTab,...T.defaultKeymap,...T.historyKeymap,...D.searchKeymap,{key:`Mod-s`,run:()=>(b.current(),!0)}]),C.EditorView.updateListener.of(e=>{e.docChanged&&!(_.current&&e.transactions.some(e=>e.annotation(_.current)===!0))&&y.current(e.state.doc.toString()),e.selectionSet&&E(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),C.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(A)try{M.push(A)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${u}:`,e),j=!1}if(j&&a&&o&&l)try{M.push(a.of(o.syntaxHighlighting(h(o,l))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${u}:`,e),j=!1}if(i=new C.EditorView({state:x.EditorState.create({doc:t,extensions:M}),parent:s.current}),n){i.destroy();return}m.current=i,S(j),w(!0);let N=new MutationObserver(()=>{let e=m.current;if(e&&j&&a&&o&&l)try{e.dispatch({effects:a.reconfigure(o.syntaxHighlighting(h(o,l)))})}catch{}});g.current=N,N.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),n||w(!0)}})(),()=>{n=!0,g.current?.disconnect(),g.current=null,i?.destroy(),m.current=null,w(!1),s.current&&(s.current.textContent=``)}},[e]),(0,i.useEffect)(()=>{let e=m.current;if(!e)return;let n=e.state.doc.toString();n!==t&&e.dispatch({changes:{from:0,to:n.length,insert:t},annotations:_.current?_.current.of(!0):void 0})},[t]),(0,i.useEffect)(()=>{let e=m.current;if(!e||!a)return;let t=e.state.doc.line(Math.min(Math.max(1,a.line),e.state.doc.lines));e.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0}),e.focus()},[a,C]);let D=m.current?.state.doc.toString()??t,O=D.length<=f?D:D.slice(0,f),k=p(e),A=l(k);return(0,u.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":O,"data-file-content-truncated":D.length>f?`1`:`0`,"data-file-selection":T,"data-file-editor-ready":C?`1`:`0`,onMouseDown:()=>m.current?.focus(),children:[(0,u.jsx)(`div`,{className:`file-cm`,ref:s,"aria-label":`编辑 ${e}`}),!C&&(0,u.jsx)(`span`,{className:`file-cm-status`,"data-file-editor-loading":`1`,children:`⌛ 正在加载编辑器…`}),C&&!x&&(0,u.jsx)(`span`,{className:`file-cm-status`,"data-file-highlight-status":`plain`,children:`纯文本`}),C&&x&&A&&(0,u.jsx)(`span`,{className:`file-cm-status file-cm-status-lang`,"data-file-highlight-status":k,children:A})]})}export{g as CodeMirrorEditor};
|