paintress 0.5.2 → 0.6.0
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 +29 -13
- package/README.zh-CN.md +29 -13
- package/dist/cli.js +367 -63
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/{render-CCxYNL6A.js → render-BSf62388.js} +9 -3
- package/dist/{server-ssrAxbTR.js → server-DZRNNWac.js} +752 -129
- package/package.json +1 -1
- package/skills/paintress/SKILL.md +42 -16
- package/ui/dist/assets/{index-CP8lZ8lp.css → index-BFcvu7wr.css} +1 -1
- package/ui/dist/assets/index-CEhK1JXE.js +8 -0
- package/ui/dist/assets/marked.esm-DZCVybOJ.js +72 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/index-BnDj5nL8.js +0 -8
package/package.json
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: paintress
|
|
3
|
-
description: Create, read, query, edit, render and screenshot
|
|
3
|
+
description: Create, read, query, edit, render and screenshot design files through MCP tools, and drive the local viewer. Use when the user refers to a design file, wants a new design file created, a node in it, a board screenshot, or shorthand ids like #1.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# paintress
|
|
7
7
|
|
|
8
8
|
paintress is a design-document operation layer: JSON design files in, MCP tools and a CLI out. It does not draw anything itself — it reads and writes the file, and renders it to HTML for a browser.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Files
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
- **`.pen` is compatible**: read, queried, edited and rendered exactly the same way. Do not convert a `.pen` the user is still working with — edit it in place.
|
|
14
|
-
- Both render identically; the difference is only which layer owns future format changes.
|
|
12
|
+
Design files are JSON, and `paintress_new` picks the extension for you — never hand-write design JSON and never rename a file to change formats. If the user already has a `.pen` file, edit it in place instead of converting it.
|
|
15
13
|
|
|
16
14
|
## Check before installing
|
|
17
15
|
|
|
@@ -22,11 +20,21 @@ npm ls -g --depth=0 paintress # installed globally?
|
|
|
22
20
|
|
|
23
21
|
If either prints something, **do not install again**. Use the existing binary. `paintress doctor` shows which agents already have the MCP entry and whether it is current.
|
|
24
22
|
|
|
23
|
+
## Start the viewer before you draw
|
|
24
|
+
|
|
25
|
+
**Drawing means someone is watching.** Before the first write of a drawing session (creating, editing or showing a design), make sure the viewer is running — do not wait to be asked, and do not draw into the void first.
|
|
26
|
+
|
|
27
|
+
- MCP: call `paintress_viewer` — it ensures the viewer, registers this project, and returns the URL to hand over.
|
|
28
|
+
- CLI: run `paintress web --daemon` — it prints `pid` / `port` / `http` and returns immediately.
|
|
29
|
+
|
|
30
|
+
Both are **idempotent**: if a viewer is already up they reuse it and start nothing, so running them every time is safe and you will never end up with a second process. Never run plain `paintress web` in a shell call — the foreground form blocks until the process is stopped.
|
|
31
|
+
|
|
25
32
|
## Tools
|
|
26
33
|
|
|
27
34
|
| Tool | What it does |
|
|
28
35
|
| --- | --- |
|
|
29
|
-
| `
|
|
36
|
+
| `paintress_viewer` | **ensure the viewer is up** and register the project; idempotent, returns the URL |
|
|
37
|
+
| `paintress_new` | **create a design file.** Writes a valid document with one empty board; returns the `boardId`. Refuses to overwrite; a `path` without an extension gets the default one |
|
|
30
38
|
| `paintress_doc_info` | document summary: version, format flavor, node counts, variables, top-level nodes |
|
|
31
39
|
| `paintress_query` | find nodes by type / name (exact or regex) / id / reusable |
|
|
32
40
|
| `paintress_get` | fetch one node's subtree; `depth` controls how far down |
|
|
@@ -39,15 +47,33 @@ If either prints something, **do not install again**. Use the existing binary. `
|
|
|
39
47
|
| `paintress_render` | write the canvas as a standalone HTML file |
|
|
40
48
|
| `paintress_screenshot` | render to PNG (headless Chromium); pass `board` (id or name) to capture one board instead of the whole canvas |
|
|
41
49
|
| `paintress_marks` | read the user's click markers (`#1 → node id`) |
|
|
50
|
+
| `paintress_preset` | project presets (colors / corner radii): `list`, `set`, `remove` |
|
|
51
|
+
| `paintress_component` | project component library: `list` reusable components, `insert` one as a copy |
|
|
52
|
+
|
|
53
|
+
## Design system: presets and components
|
|
54
|
+
|
|
55
|
+
Two project-level files keep a design consistent. Both are created automatically when the project is registered; the human never has to manage them.
|
|
56
|
+
|
|
57
|
+
**Presets (`__preset.ptr`) — colors and corner radii live in one place.**
|
|
58
|
+
- Before the first shape of a session, call `paintress_preset` with `action: "list"`. If it is empty, propose a small palette and a radius scale, then register each one with `action: "set"` (`type: "color"` or `type: "radius"`).
|
|
59
|
+
- In the design, **always reference a preset** (`"fill": "$color-brand"`), never paste a raw hex or radius when a preset exists. Raw values are how the design drifts.
|
|
60
|
+
- The human tunes preset values in the viewer and the canvas updates instantly. Do not overwrite a preset value unless asked — that is their knob.
|
|
61
|
+
|
|
62
|
+
**Components (`__components.ptr`) — look before you build.**
|
|
63
|
+
- Before drawing a button, card, input, etc., call `paintress_component` with `action: "list"`.
|
|
64
|
+
- If one fits, `action: "insert"` copies it into the design with fresh ids (a copy, not a live link) — then adjust the copy.
|
|
65
|
+
- After you build something reusable, register it in the component library (`paintress_insert` with `"reusable": true`), so the next session can find it. Never rebuild a component that already exists.
|
|
42
66
|
|
|
43
67
|
## Working rules
|
|
44
68
|
|
|
45
|
-
1. **
|
|
46
|
-
2. **
|
|
47
|
-
3.
|
|
48
|
-
4.
|
|
49
|
-
5. **
|
|
50
|
-
6. **
|
|
69
|
+
1. **Viewer first.** Start it (`paintress_viewer` / `paintress web --daemon`) before the first write — see above. It is idempotent, so there is no reason to skip it.
|
|
70
|
+
2. **Nothing to edit? Create it.** `paintress_new` is the only way to make a file; there is no "empty document" state to work around, and no need to hand-write JSON.
|
|
71
|
+
3. **Query before you edit.** Node ids come from the file; never invent them.
|
|
72
|
+
4. **`#N` means a marker.** When the user writes `#1`, call `paintress_marks` and map `#1` to a real node id. Markers are per viewer session.
|
|
73
|
+
5. **Top-level nodes are boards.** Use `paintress_doc_info` to list them before guessing what "the second screen" means.
|
|
74
|
+
6. **After a batch, validate.** `paintress_validate` catches structural mistakes before the user opens the file.
|
|
75
|
+
7. **Presets before pixels, components before building.** See above: colors and radii go through `paintress_preset`, and the component library is checked before anything new is drawn.
|
|
76
|
+
8. **Screenshots are for you.** `paintress_screenshot` is how you look at the design; the HTML viewer is for the human. When a document has several boards, pass `board` to get just that page — an ambiguous name errors out and lists the candidates rather than guessing.
|
|
51
77
|
|
|
52
78
|
## Node fields worth knowing
|
|
53
79
|
|
|
@@ -58,22 +84,22 @@ If either prints something, **do not install again**. Use the existing binary. `
|
|
|
58
84
|
The human-facing viewer is a separate process:
|
|
59
85
|
|
|
60
86
|
```bash
|
|
61
|
-
paintress web --daemon #
|
|
62
|
-
paintress watch <name> <dir> # register a directory
|
|
87
|
+
paintress web --daemon # idempotent: reuses the running one, else starts it
|
|
88
|
+
paintress watch <name> <dir> # register a directory (only when it is outside the project)
|
|
63
89
|
```
|
|
64
90
|
|
|
65
91
|
Ask the user to open the URL and click the nodes they mean; then read `paintress_marks` to learn which ids those clicks became.
|
|
66
92
|
|
|
67
93
|
## Bind the project yourself — do not wait to be asked
|
|
68
94
|
|
|
69
|
-
When the user refers to a design, asks to see one, or asks to draw something in this project, **you** make it viewable. The MCP server auto-registers the working directory at startup (its name is the last two path segments, slash included, e.g. `acme/shop`); if that already covers the request, just hand over the viewer URL:
|
|
95
|
+
When the user refers to a design, asks to see one, or asks to draw something in this project, **you** make it viewable — start with `paintress_viewer` / `paintress web --daemon` (both idempotent). The MCP server also auto-registers the working directory at startup and re-checks it before every write (its name is the last two path segments, slash included, e.g. `acme/shop`); if that already covers the request, just hand over the viewer URL:
|
|
70
96
|
|
|
71
97
|
- viewer: `http://localhost:3316/`
|
|
72
98
|
- deep link to a file: `http://localhost:3316/<name>?file=<relative/path>` (e.g. `http://localhost:3316/acme/shop?file=design/main.pen`)
|
|
73
99
|
|
|
74
100
|
Starting the viewer for the first time opens the browser on the agent's own project; you do not have to tell the user to visit anything.
|
|
75
101
|
|
|
76
|
-
If the design lives elsewhere (a
|
|
102
|
+
If the design lives elsewhere (a design file outside the working directory, or a second project), bind it yourself:
|
|
77
103
|
|
|
78
104
|
```bash
|
|
79
105
|
paintress watch <name> <dir> [--depth 1..6]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--bg:#f6f1ea;--panel:#fffcf8;--border:#e6ded2;--text:#1f2a37;--muted:#7a7166;--accent:#205080;--accent-soft:#20508014;--gold:#908030;--gold-soft:#90803073;--radius:8px}*{box-sizing:border-box;margin:0;padding:0}html,body,#root{height:100%}body{color:var(--text);background:var(--bg);-webkit-font-smoothing:antialiased;font:14px/1.55 system-ui,-apple-system,Segoe UI,Noto Sans SC,sans-serif}.app{grid-template-columns:280px 1fr;height:100%;display:grid}.sidebar{background:var(--panel);border-right:1px solid var(--border);flex-direction:column;min-height:0;display:flex}.sidebar-head{border-bottom:1px solid var(--border);align-items:center;gap:8px;padding:16px 16px 12px;display:flex}.sidebar-head h1{letter-spacing:-.01em;color:var(--accent);font-size:15px;font-weight:650}.badge{color:var(--muted);background:var(--bg);border-radius:999px;padding:1px 6px;font-size:11px}.badge-stack{font:inherit;cursor:pointer;border:1px solid #0000;flex-direction:column;align-items:flex-start;gap:1px;font-size:11px;line-height:1.2;display:inline-flex}.badge-stack:hover{border-color:#b4402a59}.badge-new{color:#b4402a;font-weight:700}.prompt{background:var(--bg);border:1px solid var(--border);font:inherit;white-space:pre-wrap;word-break:break-word;-webkit-user-select:all;user-select:all;border-radius:6px;margin:10px 0 8px;padding:8px 10px;font-size:12px;line-height:1.6}a.ghost{text-decoration:none;display:inline-block}.section{min-height:0;padding:12px 8px 4px;overflow-y:auto}.section.files{border-top:1px solid var(--border);flex:1;padding-top:12px}.section h2{text-transform:uppercase;letter-spacing:.06em;color:var(--muted);justify-content:space-between;gap:8px;padding:0 8px 8px;font-size:11px;font-weight:600;display:flex}.hint{color:var(--muted);text-transform:none;letter-spacing:0;font-size:11px;font-weight:400}.list{list-style:none}.item{text-align:left;cursor:pointer;width:100%;font:inherit;color:inherit;background:0 0;border:0;border-radius:6px;flex-direction:column;gap:1px;padding:7px 8px;display:flex}.item:hover{background:var(--bg)}.item.active{background:var(--accent-soft);color:var(--accent)}.item-name{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.item-meta{color:var(--muted);font-size:11px}.item.active .item-meta{color:var(--accent);opacity:.75}.empty{color:var(--muted);padding:4px 8px 12px;font-size:12px;line-height:1.7}.empty code{background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:1px 5px;font-size:11px}.sidebar-foot{border-top:1px solid var(--border);color:var(--muted);flex-wrap:wrap;align-items:center;gap:8px;padding:10px 16px;font-size:12px;display:flex}.toggle{cursor:pointer;align-items:center;gap:5px;display:inline-flex}.ghost{background:var(--bg);border:1px solid var(--border);font:inherit;color:var(--text);cursor:pointer;border-radius:6px;padding:3px 9px;font-size:12px}.ghost:hover{border-color:var(--accent);color:var(--accent)}.stage{background:var(--canvas-bg,var(--bg));flex-direction:column;min-width:0;min-height:0;display:flex}.toolbar{border-bottom:1px solid var(--border);background:var(--panel);justify-content:space-between;align-items:center;gap:12px;padding:8px 14px;display:flex}.toolbar code{color:var(--muted);text-overflow:ellipsis;white-space:nowrap;font-size:12px;overflow:hidden}.preview{border:1px solid var(--border);background:var(--canvas-bg,#fff);border-radius:10px;flex:1;width:calc(100% - 24px);min-height:0;margin:12px;box-shadow:0 1px 2px #1f2a370d,0 8px 24px #1f2a370d}.stage[data-canvas-bg=dark] .preview{border-color:#ffffff1f;box-shadow:0 1px 2px #00000059,0 10px 30px #00000052}.placeholder{color:var(--muted);flex:1;place-items:center;display:grid}.error{border-radius:var(--radius);color:#b91c1c;white-space:pre-wrap;background:#fef2f2;border:1px solid #fecaca;margin:12px;padding:10px 12px;font-size:12px}.section.marks{border-top:1px solid var(--border);flex:0 auto;max-height:34vh}.mark-no{background:var(--accent-soft);min-width:20px;color:var(--accent);font-variant-numeric:tabular-nums;border-radius:4px;margin-right:4px;padding:0 4px;font-size:11px;display:inline-block}.item.active .mark-no{background:#fff}.ghost.tiny{text-transform:none;letter-spacing:0;padding:1px 6px;font-size:11px}.crumbs{flex-wrap:wrap;align-items:center;gap:3px;min-width:0;display:flex;overflow:hidden}.crumbs code{color:var(--muted);text-overflow:ellipsis;white-space:nowrap;font-size:12px;overflow:hidden}.crumb{font:inherit;color:var(--muted);cursor:pointer;text-overflow:ellipsis;white-space:nowrap;background:0 0;border:0;border-radius:4px;max-width:220px;padding:2px 5px;font-size:12px;overflow:hidden}.crumb:hover{background:var(--bg);color:var(--text)}.crumb.active{color:var(--accent);background:var(--accent-soft)}.sep{color:var(--border);font-size:11px}.brand-mark{flex:none;width:auto;height:32px}.canvas-bg{border:1px solid var(--border);background:var(--bg);-webkit-user-select:none;user-select:none;border-radius:6px;flex:none;align-items:stretch;display:inline-flex;overflow:hidden}.canvas-bg-opt{border:0;border-left:1px solid var(--border);font:inherit;color:var(--muted);cursor:pointer;background:0 0;align-items:center;gap:5px;padding:3px 8px;font-size:11px;line-height:16px;display:inline-flex}.canvas-bg-opt:first-child{border-left:0}.canvas-bg-opt:hover{color:var(--text);background:#2050800f}.canvas-bg-opt.active{background:var(--accent-soft);color:var(--accent);font-weight:600}.canvas-bg-opt:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.canvas-bg-dot{background:var(--dot,#fff);border-radius:50%;flex:none;width:9px;height:9px;box-shadow:0 0 0 1px #1f2a3733}.lang-switch{border:1px solid var(--border);background:var(--bg);border-radius:6px;flex:none;align-items:stretch;margin-left:4px;display:inline-flex;overflow:hidden}.lang-opt{border:0;border-left:1px solid var(--border);font:inherit;color:var(--muted);cursor:pointer;background:0 0;padding:3px 8px;font-size:11px;line-height:16px}.lang-opt:first-child{border-left:0}.lang-opt:hover{color:var(--text);background:#2050800f}.lang-opt.active{background:var(--accent-soft);color:var(--accent);font-weight:600}.tool-sep{background:var(--border);flex:none;width:1px;height:18px;margin:0 2px}.tools{flex:none;align-items:center;gap:6px;display:flex}.zoom{font-variant-numeric:tabular-nums;text-align:right;min-width:40px}.boardbar{border-bottom:1px solid var(--border);background:var(--panel);align-items:center;gap:6px;padding:6px 14px;display:flex}.boardbar-scroll{scrollbar-width:thin;flex:auto;align-items:center;gap:6px;min-width:0;padding:1px 1px 2px;display:flex;overflow:auto hidden}.board{background:var(--bg);border:1px solid var(--border);max-width:220px;font:inherit;color:var(--text);cursor:pointer;border-radius:6px;flex:none;align-items:baseline;gap:6px;padding:3px 9px;font-size:12px;display:inline-flex}.board-name{white-space:nowrap;flex:0 auto;max-width:132px;overflow:hidden}.board-name.overflow{-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 10px),#0000);mask-image:linear-gradient(90deg,#000 calc(100% - 10px),#0000)}.boardbar{scrollbar-width:thin;scroll-padding-left:48px}.boardbar>.board:first-child{z-index:1;background:var(--bg);position:sticky;left:0;box-shadow:6px 0 8px -6px #1f2a372e}.boardbar>.board:first-child.active{background:var(--accent-soft)}.board:hover{border-color:var(--accent);color:var(--accent)}.board.active{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}.board-size{color:var(--muted);font-variant-numeric:tabular-nums;font-size:10px}.board.active .board-size{color:var(--accent);opacity:.75}.row{align-items:center;display:flex;position:relative}.row .item{flex:1;min-width:0}.row-action{background:var(--panel);width:20px;height:20px;color:var(--muted);font:inherit;cursor:pointer;opacity:0;border:1px solid #0000;border-radius:5px;place-items:center;padding:0;font-size:13px;line-height:1;transition:opacity .12s;display:grid;position:absolute;top:50%;right:4px;transform:translateY(-50%)}.row:hover .row-action,.row-action:focus-visible{opacity:1}.row-action:hover{color:#a33;border-color:#aa333359}@media (hover:none){.row-action{opacity:1}}.modal-backdrop{z-index:50;background:#1f2a3747;place-items:center;display:grid;position:fixed;inset:0}.modal{background:var(--panel);border:1px solid var(--border);border-radius:10px;width:min(380px,100vw - 32px);padding:16px 18px 14px;box-shadow:0 12px 40px #1f2a372e}.modal h3{color:var(--accent);margin-bottom:6px;font-size:14px;font-weight:650}.modal-body{color:var(--muted);font-size:12.5px;line-height:1.65}.modal-actions{justify-content:flex-end;gap:8px;margin-top:14px;display:flex}.ghost.danger{color:#a33}.ghost.danger:hover,.ghost.danger:focus-visible{color:#a33;background:#aa33330f;border-color:#a33}.row{animation:.22s cubic-bezier(.22,.61,.36,1) both row-in}.row.leaving{pointer-events:none;animation:.24s cubic-bezier(.4,0,1,1) both row-out;overflow:hidden}@keyframes row-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}@keyframes row-out{0%{opacity:1;max-height:60px}to{opacity:0;max-height:0;transform:translate(-6px)}}@media (prefers-reduced-motion:reduce){.row,.row.leaving{animation:none}}.dot{vertical-align:middle;background:#4c9a6a;border-radius:50%;width:5px;height:5px;margin-left:6px;display:inline-block}.countdown-backdrop{-webkit-backdrop-filter:blur(1.5px);backdrop-filter:blur(1.5px);background:#1f2a376b}.countdown{text-align:center;width:min(320px,100vw - 32px);padding:20px 20px 18px}.countdown h3{letter-spacing:.02em;font-size:13px}.countdown .modal-body{font-variant-numeric:tabular-nums;margin-top:2px}.countdown-track{background:var(--border);border-radius:999px;height:3px;margin-top:14px;overflow:hidden}.countdown-fill{height:100%;width:var(--left,100%);background:var(--accent);border-radius:inherit;transition:width 1s linear;display:block}
|
|
1
|
+
:root{--bg:#f6f1ea;--panel:#fffcf8;--border:#e6ded2;--text:#1f2a37;--muted:#7a7166;--accent:#205080;--accent-soft:#20508014;--gold:#908030;--gold-soft:#90803073;--radius:8px}*{box-sizing:border-box;margin:0;padding:0}html,body,#root{height:100%}body{color:var(--text);background:var(--bg);-webkit-font-smoothing:antialiased;font:14px/1.55 system-ui,-apple-system,Segoe UI,Noto Sans SC,sans-serif}.app{grid-template-columns:280px 1fr;height:100%;display:grid}.sidebar{background:var(--panel);border-right:1px solid var(--border);flex-direction:column;min-height:0;display:flex}.sidebar-head{border-bottom:1px solid var(--border);align-items:center;gap:8px;padding:16px 16px 12px;display:flex}.sidebar-head h1{letter-spacing:-.01em;color:var(--accent);font-size:15px;font-weight:650}.badge{color:var(--muted);background:var(--bg);border-radius:999px;padding:1px 6px;font-size:11px}.badge-stack{font:inherit;cursor:pointer;border:1px solid #0000;flex-direction:column;align-items:flex-start;gap:1px;font-size:11px;line-height:1.2;display:inline-flex}.badge-stack:hover{border-color:#b4402a59}.badge-new{color:#b4402a;font-weight:700}.prompt{background:var(--bg);border:1px solid var(--border);font:inherit;white-space:pre-wrap;word-break:break-word;-webkit-user-select:all;user-select:all;border-radius:6px;margin:10px 0 8px;padding:8px 10px;font-size:12px;line-height:1.6}a.ghost{text-decoration:none;display:inline-block}.section{min-height:0;padding:12px 8px 4px;overflow-y:auto}.section.files{border-top:1px solid var(--border);flex:1;padding-top:12px}.section h2{text-transform:uppercase;letter-spacing:.06em;color:var(--muted);justify-content:space-between;gap:8px;padding:0 8px 8px;font-size:11px;font-weight:600;display:flex}.hint{color:var(--muted);text-transform:none;letter-spacing:0;font-size:11px;font-weight:400}.list{list-style:none}.item{text-align:left;cursor:pointer;width:100%;font:inherit;color:inherit;background:0 0;border:0;border-radius:6px;flex-direction:column;gap:1px;padding:7px 8px;display:flex}.item:hover{background:var(--bg)}.item.active{background:var(--accent-soft);color:var(--accent)}.item-name{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.item-meta{color:var(--muted);font-size:11px}.item.active .item-meta{color:var(--accent);opacity:.75}.empty{color:var(--muted);padding:4px 8px 12px;font-size:12px;line-height:1.7}.empty code{background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:1px 5px;font-size:11px}.sidebar-foot{border-top:1px solid var(--border);color:var(--muted);flex-wrap:wrap;align-items:center;gap:8px;padding:10px 16px;font-size:12px;display:flex}.toggle{cursor:pointer;align-items:center;gap:5px;display:inline-flex}.ghost{background:var(--bg);border:1px solid var(--border);font:inherit;color:var(--text);cursor:pointer;border-radius:6px;padding:3px 9px;font-size:12px}.ghost:hover{border-color:var(--accent);color:var(--accent)}.stage{background:var(--canvas-bg,var(--bg));flex-direction:column;min-width:0;min-height:0;display:flex}.toolbar{border-bottom:1px solid var(--border);background:var(--panel);justify-content:space-between;align-items:center;gap:12px;padding:8px 14px;display:flex}.toolbar code{color:var(--muted);text-overflow:ellipsis;white-space:nowrap;font-size:12px;overflow:hidden}.preview{border:1px solid var(--border);background:var(--canvas-bg,#fff);border-radius:10px;flex:1;width:calc(100% - 24px);min-height:0;margin:12px;box-shadow:0 1px 2px #1f2a370d,0 8px 24px #1f2a370d}.stage[data-canvas-bg=dark] .preview{border-color:#ffffff1f;box-shadow:0 1px 2px #00000059,0 10px 30px #00000052}.placeholder{color:var(--muted);flex:1;place-items:center;display:grid}.error{border-radius:var(--radius);color:#b91c1c;white-space:pre-wrap;background:#fef2f2;border:1px solid #fecaca;margin:12px;padding:10px 12px;font-size:12px}.section.marks{border-top:1px solid var(--border);flex:0 auto;max-height:34vh}.mark-no{background:var(--accent-soft);min-width:20px;color:var(--accent);font-variant-numeric:tabular-nums;border-radius:4px;margin-right:4px;padding:0 4px;font-size:11px;display:inline-block}.item.active .mark-no{background:#fff}.ghost.tiny{text-transform:none;letter-spacing:0;padding:1px 6px;font-size:11px}.crumbs{flex-wrap:wrap;align-items:center;gap:3px;min-width:0;display:flex;overflow:hidden}.crumbs code{color:var(--muted);text-overflow:ellipsis;white-space:nowrap;font-size:12px;overflow:hidden}.crumb{font:inherit;color:var(--muted);cursor:pointer;text-overflow:ellipsis;white-space:nowrap;background:0 0;border:0;border-radius:4px;max-width:220px;padding:2px 5px;font-size:12px;overflow:hidden}.crumb:hover{background:var(--bg);color:var(--text)}.crumb.active{color:var(--accent);background:var(--accent-soft)}.sep{color:var(--border);font-size:11px}.brand-mark{flex:none;width:auto;height:32px}.canvas-bg{border:1px solid var(--border);background:var(--bg);-webkit-user-select:none;user-select:none;border-radius:6px;flex:none;align-items:stretch;display:inline-flex;overflow:hidden}.canvas-bg-opt{border:0;border-left:1px solid var(--border);font:inherit;color:var(--muted);cursor:pointer;background:0 0;align-items:center;gap:5px;padding:3px 8px;font-size:11px;line-height:16px;display:inline-flex}.canvas-bg-opt:first-child{border-left:0}.canvas-bg-opt:hover{color:var(--text);background:#2050800f}.canvas-bg-opt.active{background:var(--accent-soft);color:var(--accent);font-weight:600}.canvas-bg-opt:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.canvas-bg-dot{background:var(--dot,#fff);border-radius:50%;flex:none;width:9px;height:9px;box-shadow:0 0 0 1px #1f2a3733}.lang-switch{border:1px solid var(--border);background:var(--bg);border-radius:6px;flex:none;align-items:stretch;margin-left:4px;display:inline-flex;overflow:hidden}.lang-opt{border:0;border-left:1px solid var(--border);font:inherit;color:var(--muted);cursor:pointer;background:0 0;padding:3px 8px;font-size:11px;line-height:16px}.lang-opt:first-child{border-left:0}.lang-opt:hover{color:var(--text);background:#2050800f}.lang-opt.active{background:var(--accent-soft);color:var(--accent);font-weight:600}.tool-sep{background:var(--border);flex:none;width:1px;height:18px;margin:0 2px}.tools{flex:none;align-items:center;gap:6px;display:flex}.zoom{font-variant-numeric:tabular-nums;text-align:right;min-width:40px}.boardbar{border-bottom:1px solid var(--border);background:var(--panel);align-items:center;gap:6px;padding:6px 14px;display:flex}.boardbar-scroll{scrollbar-width:thin;flex:auto;align-items:center;gap:6px;min-width:0;padding:1px 1px 2px;display:flex;overflow:auto hidden}.board{background:var(--bg);border:1px solid var(--border);max-width:220px;font:inherit;color:var(--text);cursor:pointer;border-radius:6px;flex:none;align-items:baseline;gap:6px;padding:3px 9px;font-size:12px;display:inline-flex}.board-name{white-space:nowrap;flex:0 auto;max-width:132px;overflow:hidden}.board-name.overflow{-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 10px),#0000);mask-image:linear-gradient(90deg,#000 calc(100% - 10px),#0000)}.boardbar{scrollbar-width:thin;scroll-padding-left:48px}.boardbar>.board:first-child{z-index:1;background:var(--bg);position:sticky;left:0;box-shadow:6px 0 8px -6px #1f2a372e}.boardbar>.board:first-child.active{background:var(--accent-soft)}.board:hover{border-color:var(--accent);color:var(--accent)}.board.active{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}.board-size{color:var(--muted);font-variant-numeric:tabular-nums;font-size:10px}.board.active .board-size{color:var(--accent);opacity:.75}.row{align-items:center;display:flex;position:relative}.row .item{flex:1;min-width:0}.row-action{background:var(--panel);width:20px;height:20px;color:var(--muted);font:inherit;cursor:pointer;opacity:0;border:1px solid #0000;border-radius:5px;place-items:center;padding:0;font-size:13px;line-height:1;transition:opacity .12s;display:grid;position:absolute;top:50%;right:4px;transform:translateY(-50%)}.row:hover .row-action,.row-action:focus-visible{opacity:1}.row-action:hover{color:#a33;border-color:#aa333359}@media (hover:none){.row-action{opacity:1}}.modal-backdrop{z-index:50;background:#1f2a3747;place-items:center;display:grid;position:fixed;inset:0}.modal{background:var(--panel);border:1px solid var(--border);border-radius:10px;width:min(380px,100vw - 32px);padding:16px 18px 14px;box-shadow:0 12px 40px #1f2a372e}.modal h3{color:var(--accent);margin-bottom:6px;font-size:14px;font-weight:650}.modal-body{color:var(--muted);font-size:12.5px;line-height:1.65}.modal-actions{justify-content:flex-end;gap:8px;margin-top:14px;display:flex}.ghost.danger{color:#a33}.ghost.danger:hover,.ghost.danger:focus-visible{color:#a33;background:#aa33330f;border-color:#a33}.row{animation:.22s cubic-bezier(.22,.61,.36,1) both row-in}.row.leaving{pointer-events:none;animation:.24s cubic-bezier(.4,0,1,1) both row-out;overflow:hidden}@keyframes row-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}@keyframes row-out{0%{opacity:1;max-height:60px}to{opacity:0;max-height:0;transform:translate(-6px)}}@media (prefers-reduced-motion:reduce){.row,.row.leaving{animation:none}}.dot{vertical-align:middle;background:#4c9a6a;border-radius:50%;width:5px;height:5px;margin-left:6px;display:inline-block}.countdown-backdrop{-webkit-backdrop-filter:blur(1.5px);backdrop-filter:blur(1.5px);background:#1f2a376b}.countdown{text-align:center;width:min(320px,100vw - 32px);padding:20px 20px 18px}.countdown h3{letter-spacing:.02em;font-size:13px}.countdown .modal-body{font-variant-numeric:tabular-nums;margin-top:2px}.countdown-track{background:var(--border);border-radius:999px;height:3px;margin-top:14px;overflow:hidden}.countdown-fill{height:100%;width:var(--left,100%);background:var(--accent);border-radius:inherit;transition:width 1s linear;display:block}.canvas-row{flex:1;align-items:stretch;gap:12px;min-width:0;min-height:0;padding:12px;display:flex}.canvas-wrap{flex:1;min-width:0;min-height:0;display:flex;position:relative}.canvas-wrap .preview{width:100%;height:100%;min-height:0;margin:0}.panel{background:var(--panel);border:1px solid var(--border);border-radius:10px;flex-direction:column;min-height:0;display:flex;box-shadow:0 1px 2px #1f2a370d,0 8px 24px #1f2a370d}.notes-panel{flex:0 0 380px;width:380px}.panel-float{z-index:3;width:320px;max-height:100%;animation:.14s ease-out panel-in;position:absolute;top:0;right:60px}.preset-panel{width:320px}.components-panel{width:420px;max-width:calc(100vw - 360px)}@keyframes panel-in{0%{opacity:0;transform:translate(8px)}to{opacity:1;transform:translate(0)}}@media (prefers-reduced-motion:reduce){.panel-float{animation:none}}.panel-head{border-bottom:1px solid var(--border);justify-content:space-between;align-items:center;gap:8px;padding:8px 10px 8px 14px;display:flex}.panel-head h2{font-size:13px;font-weight:600}.panel-close{line-height:1}.panel-body{scrollbar-width:thin;flex:1;min-height:0;padding:12px 14px 16px;overflow:auto}.panel-empty{color:var(--muted);font-size:12px}.panel-hint{color:var(--muted);margin-top:6px;font-size:12px}.panel-error{color:#b91c1c;white-space:pre-wrap;font-size:12px}.panel-group{letter-spacing:.04em;text-transform:uppercase;color:var(--muted);margin:10px 0 6px;font-size:11px;font-weight:600}.panel-group:first-child{margin-top:0}.markdown{overflow-wrap:anywhere;font-size:13px;line-height:1.7}.markdown>*+*{margin-top:.7em}.markdown h1,.markdown h2,.markdown h3,.markdown h4{margin-top:1.1em;line-height:1.35}.markdown h1{font-size:17px}.markdown h2{font-size:15px}.markdown h3{font-size:13.5px}.markdown ul,.markdown ol{padding-left:1.3em}.markdown code{background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:0 4px;font-size:12px}.markdown pre{background:var(--bg);border:1px solid var(--border);border-radius:8px;padding:10px 12px;overflow:auto}.markdown pre code{background:0 0;border:0;padding:0}.markdown blockquote{border-left:2px solid var(--border);color:var(--muted);padding-left:10px}.markdown table{border-collapse:collapse;font-size:12px}.markdown th,.markdown td{border:1px solid var(--border);text-align:left;padding:3px 8px}.markdown a{color:var(--accent)}.markdown img{max-width:100%}.notes-toggle{z-index:3;border:1px solid var(--border);background:var(--panel);color:var(--text);font:inherit;cursor:pointer;border-radius:8px;align-items:center;gap:6px;padding:5px 10px;font-size:12px;display:inline-flex;position:absolute;top:10px;left:10px;box-shadow:0 1px 2px #1f2a3714}.notes-toggle:hover{border-color:var(--accent);color:var(--accent)}.tool-rail{z-index:4;border:1px solid var(--border);background:var(--panel);border-radius:10px;flex-direction:column;gap:4px;padding:4px;display:flex;position:absolute;top:10px;right:10px;box-shadow:0 1px 2px #1f2a3714}.rail-btn{width:34px;height:34px;color:var(--muted);cursor:pointer;background:0 0;border:0;border-radius:7px;place-items:center;display:grid}.rail-btn:hover,.rail-btn.active{background:var(--accent-soft);color:var(--accent)}.rail-btn:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.preset-list{flex-direction:column;gap:6px;list-style:none;display:flex}.preset-row{align-items:center;gap:8px;display:flex}.preset-name{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:12px;overflow:hidden}.preset-swatch{border:1px solid var(--border);cursor:pointer;background:0 0;border-radius:5px;flex:none;width:26px;height:22px;padding:0}.preset-value{border:1px solid var(--border);background:var(--bg);width:92px;color:var(--text);font:inherit;font-variant-numeric:tabular-nums;border-radius:5px;flex:none;padding:2px 6px;font-size:12px}.preset-value:focus,.preset-swatch:focus{outline:2px solid var(--accent);outline-offset:1px}.tiles{flex-wrap:wrap;gap:10px;margin-top:10px;display:flex}.tile{flex-direction:column;gap:4px;width:148px;display:flex}.tile-frame{border:1px solid var(--border);background:var(--bg);border-radius:10px;width:148px;height:148px;position:relative;overflow:hidden}.tile-frame iframe{transform-origin:50%;background:0 0;border:0;position:absolute;top:50%;left:50%}.tile figcaption{color:var(--muted);text-overflow:ellipsis;white-space:nowrap;font-size:11px;overflow:hidden}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return t(this.context.count)},getNextContextId(){return t(this.context.count++)}};function t(t){let n=String(t),r=n.length-1;return e.context.id+(r?String.fromCharCode(96+r):``)+n}function n(t){e.context=t}var r=(e,t)=>e===t,i=Symbol(`solid-track`),a={equals:r},o=null,s=ue,c=1,l=2,u={owned:null,cleanups:null,context:null,owner:null},d=null,f=null,p=null,m=null,h=null,g=0;function _(e,t){let n=p,r=d,i=e.length===0,a=t===void 0?r:t,o=i?u:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(v(o));d=o,p=null;try{return D(s,!0)}finally{p=n,d=r}}function v(e){return()=>C(()=>A(e))}function y(e,t){t=t?Object.assign({},a,t):a;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[ie.bind(n),e=>(typeof e==`function`&&(e=f&&f.running&&f.sources.has(n)?e(n.tValue):e(n.value)),ae(n,e))]}function b(e,t,n){oe(ce(e,t,!1,c))}function x(e,t,n){s=k;let r=ce(e,t,!1,c),i=re&&ne(re);i&&(r.suspense=i),n&&n.render||(r.user=!0),h?h.push(r):oe(r)}function S(e,t,n){n=n?Object.assign({},a,n):a;let r=ce(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,oe(r),ie.bind(r)}function C(e){if(p===null)return e();let t=p;p=null;try{return e()}finally{p=t}}function w(e,t,n){let r=Array.isArray(e),i,a=n&&n.defer;return n=>{let o;if(r){o=Array(e.length);for(let t=0;t<e.length;t++)o[t]=e[t]()}else o=e();if(a)return a=!1,n;let s=C(()=>t(o,i,n));return i=o,s}}function T(e){x(()=>C(e))}function E(e){return d===null||(d.cleanups===null?d.cleanups=[e]:d.cleanups.push(e)),e}var[ee,te]=y(!1);function ne(e){let t;return d&&d.context&&(t=d.context[e.id])!==void 0?t:e.defaultValue}var re;function ie(){let e=f&&f.running;if(this.sources&&(e?this.tState:this.state)){if((e?this.tState:this.state)===c)oe(this);else{let e=m;m=null,D(()=>de(this),!1),m=e}}if(p){let e=this.observers;if(!e||e[e.length-1]!==p){let t=e?e.length:0;p.sources?(p.sources.push(this),p.sourceSlots.push(t)):(p.sources=[this],p.sourceSlots=[t]),e?(e.push(p),this.observerSlots.push(p.sources.length-1)):(this.observers=[p],this.observerSlots=[p.sources.length-1])}}return e&&f.sources.has(this)?this.tValue:this.value}function ae(e,t,n){let r=f&&f.running&&f.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(f){let r=f.running;(r||!n&&f.sources.has(e))&&(f.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&D(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=f&&f.running;r&&f.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?m.push(n):h.push(n),n.observers&&fe(n)),r?n.tState=c:n.state=c)}if(m.length>1e6)throw m=[],Error()},!1)}return t}function oe(e){if(!e.fn)return;A(e);let t=g;se(e,f&&f.running&&f.sources.has(e)?e.tValue:e.value,t),f&&!f.running&&f.sources.has(e)&&queueMicrotask(()=>{D(()=>{f&&(f.running=!0),p=d=e,se(e,e.tValue,t),p=d=null},!1)})}function se(e,t,n){let r,i=d,a=p;p=d=e;try{r=e.fn(t)}catch(t){return e.pure&&(f&&f.running?(e.tState=c,e.tOwned&&e.tOwned.forEach(A),e.tOwned=void 0):(e.state=c,e.owned&&e.owned.forEach(A),e.owned=null)),e.updatedAt=n+1,M(t)}finally{p=a,d=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?ae(e,r,!0):f&&f.running&&e.pure?(f.sources.has(e)||(e.value=r),f.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function ce(e,t,n,r=c,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:d,context:d?d.context:null,pure:n};return f&&f.running&&(a.state=0,a.tState=r),d===null||d!==u&&(f&&f.running&&d.pure?d.tOwned?d.tOwned.push(a):d.tOwned=[a]:d.owned?d.owned.push(a):d.owned=[a]),a}function le(e){let t=f&&f.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===l)return de(e);if(e.suspense&&C(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<g);){if(t&&f.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(f.disposed.has(t))return}if((t?e.tState:e.state)===c)oe(e);else if((t?e.tState:e.state)===l){let t=m;m=null,D(()=>de(e,n[0]),!1),m=t}}}function D(e,t){if(m)return e();let n=!1;t||(m=[]),h?n=!0:h=[],g++;try{let t=e();return O(n),t}catch(e){n||(h=null),m=null,M(e)}}function O(e){if(m&&=(ue(m),null),e)return;let t;if(f){if(!f.promises.size&&!f.queue.size){let e=f.sources,n=f.disposed;h.push.apply(h,f.effects),t=f.resolve;for(let e of h)`tState`in e&&(e.state=e.tState),delete e.tState;f=null,D(()=>{for(let e of n)A(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)A(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}te(!1)},!1)}else if(f.running){f.running=!1,f.effects.push.apply(f.effects,h),h=null,te(!0);return}}let n=h;h=null,n.length&&D(()=>s(n),!1),t&&t()}function ue(e){for(let t=0;t<e.length;t++)le(e[t])}function k(t){let r,i=0;for(r=0;r<t.length;r++){let e=t[r];e.user?t[i++]=e:le(e)}if(e.context){if(e.count){e.effects||=[],e.effects.push(...t.slice(0,i));return}n()}for(e.effects&&(e.done||!e.count)&&(t=[...e.effects,...t],i+=e.effects.length,delete e.effects),r=0;r<i;r++)le(t[r])}function de(e,t){let n=f&&f.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===c?i!==t&&(!i.updatedAt||i.updatedAt<g)&&le(i):e===l&&de(i,t)}}}function fe(e){let t=f&&f.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=l:r.state=l,r.pure?m.push(r):h.push(r),r.observers&&fe(r))}}function A(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)A(e.tOwned[t]);delete e.tOwned}if(f&&f.running&&e.pure)j(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)A(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}f&&f.running?e.tState=0:e.state=0}function j(e,t){if(t||(e.tState=0,f.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)j(e.owned[t])}function pe(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function me(e,t,n){try{for(let n of t)n(e)}catch(e){M(e,n&&n.owner||null)}}function M(e,t=d){let n=o&&t&&t.context&&t.context[o],r=pe(e);if(!n)throw r;h?h.push({fn(){me(r,n,t)},state:c}):me(r,n,t)}var he=Symbol(`fallback`);function ge(e){for(let t=0;t<e.length;t++)e[t]()}function _e(e,t,n={}){let r=[],a=[],o=[],s=0,c=t.length>1?[]:null;return E(()=>ge(o)),()=>{let l=e()||[],u=l.length,d,f;return l[i],C(()=>{let e,t,i,m,h,g,v,y,b;if(u===0)s!==0&&(ge(o),o=[],r=[],a=[],s=0,c&&=[]),n.fallback&&(r=[he],a[0]=_(e=>(o[0]=e,n.fallback())),s=1);else if(s===0){for(a=Array(u),f=0;f<u;f++)r[f]=l[f],a[f]=_(p);s=u}else{for(i=Array(u),m=Array(u),c&&(h=Array(u)),g=0,v=Math.min(s,u);g<v&&r[g]===l[g];g++);for(v=s-1,y=u-1;v>=g&&y>=g&&r[v]===l[y];v--,y--)i[y]=a[v],m[y]=o[v],c&&(h[y]=c[v]);for(e=new Map,t=Array(y+1),f=y;f>=g;f--)b=l[f],d=e.get(b),t[f]=d===void 0?-1:d,e.set(b,f);for(d=g;d<=v;d++)b=r[d],f=e.get(b),f!==void 0&&f!==-1?(i[f]=a[d],m[f]=o[d],c&&(h[f]=c[d]),f=t[f],e.set(b,f)):o[d]();for(f=g;f<u;f++)f in i?(a[f]=i[f],o[f]=m[f],c&&(c[f]=h[f],c[f](f))):a[f]=_(p);a=a.slice(0,s=u),r=l.slice(0)}return a});function p(e){if(o[f]=e,c){let[e,n]=y(f);return c[f]=n,t(l[f],e)}return t(l[f])}}}function N(e,t){return C(()=>e(t||{}))}var ve=e=>`Stale read from <${e}>.`;function P(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return S(_e(()=>e.each,e.children,t||void 0))}function F(e){let t=e.keyed,n=S(()=>e.when,void 0,void 0),r=t?n:S(n,void 0,{equals:(e,t)=>!e==!t});return S(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?C(()=>a(t?i:()=>{if(!C(r))throw ve(`Show`);return n()})):a}return e.fallback},void 0,void 0)}var I=e=>S(()=>e());function ye(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;)if(t[o]===n[s])o++,s++;else{for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)l&&l.has(t[o])||t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null){if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&(d=l.get(t[c]))!=null&&d===r+u;)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++}else t[o++].remove()}}}var be=`_$DX_DELEGATE`;function L(e,t,n,r={}){let i;return _(r=>{i=r,t===document?e():V(t,e(),!n&&t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function R(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>C(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function z(e,t=window.document){let n=t[be]||(t[be]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,H))}}function B(e,t,n){Te(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function xe(e,t){Te(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function Se(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function Ce(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function we(e,t,n){return C(()=>e(t,n))}function V(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return U(e,t,r,n);b(r=>U(e,t(),r,n),r)}function Te(t){return!!e.context&&!e.done&&(!t||t.isConnected)}function H(t){if(e.registry&&e.events&&e.events.find(([e,n])=>n===t))return;let n=t.target,r=`$$${t.type}`,i=t.target,a=t.currentTarget,o=e=>Object.defineProperty(t,"target",{configurable:!0,value:e}),s=()=>{let e=n[r];if(e&&!n.disabled){let i=n[`${r}Data`];if(i===void 0?e.call(n,t):e.call(n,i,t),t.cancelBubble)return}return n.host&&typeof n.host!=`string`&&!n.host._$host&&n.contains(t.target)&&o(n.host),!0},c=()=>{for(;s()&&(n=n._$host||n.parentNode||n.host););};Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return n||document}}),e.registry&&!e.done&&(e.done=_$HY.done=!0);try{if(t.composedPath){let e=t.composedPath();o(e[0]);for(let t=0;t<e.length-2&&(n=e[t],s());t++){if(n._$host){n=n._$host,c();break}if(n.parentNode===a)break}}else c();o(i)}finally{t=n=null}}function U(e,t,n,r,i){let a=Te(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=W(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=W(e,n,r)}else if(o===`function`)return b(()=>{let i=t();for(;typeof i==`function`;)i=i();n=U(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(Ee(o,t,n,i))return b(()=>n=U(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=W(e,n,r),s)return n}else c?n.length===0?De(e,o,r):ye(e,n,o):(n&&W(e),De(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=W(e,n,r,t);W(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function Ee(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(o!=null&&o!==!0&&o!==!1){if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=Ee(e,o,s)||i;else if(c===`function`){if(r){for(;typeof o==`function`;)o=o();i=Ee(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0}else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}}return i}function De(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function W(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}async function G(e){let t=await fetch(e,{headers:{accept:`application/json`}});if(!t.ok){let e=await t.text().catch(()=>``);throw Error(`HTTP ${t.status}${e?`: ${e.slice(0,200)}`:``}`)}return await t.json()}function Oe(){return G(`/api/projects`)}function ke(){return G(`/api/version`)}function Ae(e){return G(`/api/projects/${encodeURIComponent(e)}/files`)}function je(e,t){return`/render/${encodeURIComponent(e)}/${t.split(`/`).map(encodeURIComponent).join(`/`)}?embed=1`}function Me(e,t){return`/events?project=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`}function Ne(){return`/events`}function Pe(e){return G(`/api/marks?project=${encodeURIComponent(e)}`)}async function Fe(e){let t=await fetch(`/api/marks`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();if(!n.ok)throw Error(n.error??`添加标记失败`);return n.mark}async function Ie(e){let t=await fetch(`/api/marks?project=${encodeURIComponent(e)}`,{method:`DELETE`});if(!t.ok)throw Error(`HTTP ${t.status}`);return(await t.json()).cleared}var Le={"x-paintress":`1`};async function Re(e){let t=await fetch(`/api/projects/${encodeURIComponent(e)}`,{method:`DELETE`,headers:Le}),n=await t.json();if(!t.ok||!n.ok)throw Error(n.error??`HTTP ${t.status}`);return n.unwatched===!0}async function ze(){let e=await fetch(`/api/shutdown`,{method:`POST`,headers:Le}),t=await e.json();if(!e.ok||!t.ok)throw Error(t.error??`HTTP ${e.status}`);return t.connections??0}function Be(e,t){return G(`/api/changes?project=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`)}function Ve(e,t){return G(`/api/notes?project=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`)}function He(e){return G(`/api/presets?project=${encodeURIComponent(e)}`)}async function Ue(e,t,n){let r=await fetch(`/api/presets`,{method:`PUT`,headers:{"content-type":`application/json`,...Le},body:JSON.stringify({project:e,key:t,value:n})}),i=await r.json();if(!r.ok||!i.ok)throw Error(i.error??`HTTP ${r.status}`);return i}function We(e){return G(`/api/components?project=${encodeURIComponent(e)}`)}function K(e,t){return`/render-component?project=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`}var Ge=R(`<div class=modal-actions>`),Ke=R(`<div class=modal-backdrop><div class=modal role=dialog aria-modal=true><h3>`),q=R(`<p class=modal-body>`),qe=R(`<button class=ghost>`),J=R(`<button class="ghost danger">`);function Je(e){x(()=>{e.open&&queueMicrotask(()=>{(e.initialFocus?.()??document.querySelector(`.modal-actions button`))?.focus()})});let t=t=>{t.key===`Escape`&&(t.preventDefault(),e.onClose())};return N(F,{get when(){return e.open},get children(){var n=Ke(),r=n.firstChild,i=r.firstChild;return n.$$mousedown=t=>{t.target===t.currentTarget&&e.onClose()},r.$$keydown=t,V(i,()=>e.title),V(r,()=>e.children,null),V(r,N(F,{get when(){return e.actions},get children(){var t=Ge();return V(t,()=>e.actions),t}}),null),b(()=>B(r,`aria-label`,e.title)),n}})}function Ye(e){let t;return N(Je,{get open(){return e.open},get title(){return e.title},get onClose(){return e.onCancel},initialFocus:()=>t,get actions(){return[(()=>{var t=qe();return t.$$click=()=>e.onCancel(),V(t,()=>e.cancelLabel),t})(),(()=>{var n=J();return n.$$click=()=>e.onConfirm(),we(e=>{t=e},n),V(n,()=>e.confirmLabel),n})()]},get children(){var t=q();return V(t,()=>e.body),t}})}z([`mousedown`,`keydown`,`click`]);function Xe(e){let t=e.trim().replace(/^v/i,``),n=t.indexOf(`-`);return{nums:(n>=0?t.slice(0,n):t).split(`.`).map(e=>{let t=Number.parseInt(e,10);return Number.isFinite(t)?t:0}),prerelease:n>=0}}function Ze(e,t){let n=Xe(e),r=Xe(t),i=Math.max(n.nums.length,r.nums.length);for(let e=0;e<i;e+=1){let t=n.nums[e]??0,i=r.nums[e]??0;if(t!==i)return t>i?1:-1}return n.prerelease===r.prerelease?0:n.prerelease?-1:1}function Qe(e,t){return Ze(e,t)>0}var Y=.1,$e=.02;function et(e,t){return t===0||Math.abs(e)>=Math.abs(t)?null:t>0?-1:1}function X(e,t=Y){return Math.min(4,Math.max(t,e))}function tt(e,t,n,r,i=Y){let a=X(e.z*t,i);if(a===e.z)return e;let o=a/e.z;return{z:a,tx:n-(n-e.tx)*o,ty:r-(r-e.ty)*o}}function nt(e,t,n,r=Y){return tt(e,X(t,r)/e.z,n.width/2,n.height/2,r)}function rt(e,t,n=24){let r=Math.max(1,e.w),i=Math.max(1,e.h),a=Math.max(1,t.width-n*2),o=Math.max(1,t.height-n*2),s=X(Math.min(a/r,o/i),$e);return{z:s,tx:(t.width-r*s)/2-e.x*s,ty:(t.height-i*s)/2-e.y*s}}function it(e,t,n){return{z:e.z,tx:e.tx+t,ty:e.ty+n}}function at(e){return`translate(${e.tx}px, ${e.ty}px) scale(${e.z})`}function ot(e){if(e===null||e===``)return null;let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t)return null;let{z:n,tx:r,ty:i}=t;return typeof n!=`number`||typeof r!=`number`||typeof i!=`number`||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||n<=0?null:{z:X(n,$e),tx:r,ty:i}}var st=3,ct=.0015;function lt({doc:e,onChange:t,onLevelStep:n}){let r=e.querySelector(`.ptr-canvas`);if(r===null)return null;let i=r;i.style.transformOrigin=`0 0`;let a={z:1,tx:0,ty:0},o=!1,s=!1,c=!1,l=null,u=()=>({width:e.documentElement.clientWidth||1,height:e.documentElement.clientHeight||1});function d(){i.style.transform=at(a),t?.(a)}function f(e){a=e,d()}function p(){i.style.transition=``}function m(e){i.style.transition=`transform 180ms ease-out`,f(e),setTimeout(p,220)}function h(t){e.documentElement.style.cursor=t}function g(e){if(e.preventDefault(),e.altKey&&n!==void 0){let t=et(e.deltaX,e.deltaY);t!==null&&n(t,{x:e.clientX,y:e.clientY});return}p();let t=1;e.deltaMode===1?t=16:e.deltaMode===2&&(t=u().height);let r=a.z<.1?$e:Y;f(tt(a,Math.exp(-e.deltaY*t*ct),e.clientX,e.clientY,r))}function _(t){return t.button===1?!0:t.button===0?o?!0:t.target===i||t.target===e.body||t.target===e.documentElement:!1}function v(e){_(e)&&(e.preventDefault(),l={lastX:e.clientX,lastY:e.clientY,startX:e.clientX,startY:e.clientY},s=!1)}function y(t){if(!l)return;if(!s){if(Math.hypot(t.clientX-l.startX,t.clientY-l.startY)<st)return;s=!0,p(),e.body.style.userSelect=`none`,h(`grabbing`)}let n=t.clientX-l.lastX,r=t.clientY-l.lastY;l.lastX=t.clientX,l.lastY=t.clientY,f(it(a,n,r))}function b(){l&&(l=null,s&&(s=!1,c=!0,e.body.style.userSelect=``,h(o?`grab`:``)))}function x(e){o!==e&&(o=e,s||h(e?`grab`:``))}function S(e){if(e.key===` `&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let t=e.target,n=t?.tagName??``;if(n===`INPUT`||n===`TEXTAREA`||t?.isContentEditable===!0)return;x(!0),e.preventDefault()}else T(e)&&e.preventDefault()}function C(e){e.key===` `&&x(!1)}function w(){x(!1),b()}function T(e){return(e.ctrlKey||e.metaKey)&&(e.key===`0`||e.key===`)`||e.code===`Digit0`||e.code===`Numpad0`)?(f(nt(a,1,u())),!0):e.shiftKey&&!e.ctrlKey&&!e.metaKey&&(e.key===`!`||e.code===`Digit1`)?(E(),!0):!1}function E(){f(rt({x:0,y:0,w:i.offsetWidth,h:i.offsetHeight},u()))}function ee(e){let t=u();m({z:a.z,tx:t.width/2-(e.x+e.w/2)*a.z,ty:t.height/2-(e.y+e.h/2)*a.z})}return e.addEventListener(`wheel`,g,{passive:!1}),e.addEventListener(`mousedown`,v,!0),e.addEventListener(`mousemove`,y,!0),e.addEventListener(`mouseup`,b,!0),e.addEventListener(`keydown`,S),e.addEventListener(`keyup`,C),e.defaultView?.addEventListener(`blur`,w),{get:()=>a,set:f,fitAll:E,centerOn:ee,focusBox:e=>m(rt(e,u())),zoomToPercent:e=>f(nt(a,e,u())),consumeDragClick:()=>{let e=c;return c=!1,e},handleKey:T,setSpace:x,destroy:()=>{e.removeEventListener(`wheel`,g),e.removeEventListener(`mousedown`,v,!0),e.removeEventListener(`mousemove`,y,!0),e.removeEventListener(`mouseup`,b,!0),e.removeEventListener(`keydown`,S),e.removeEventListener(`keyup`,C),e.defaultView?.removeEventListener(`blur`,w)}}}var ut=`[data-ptr-selected]{outline:2px solid #908030 !important;outline-offset:-2px;}
|
|
2
|
+
[data-ptr-hover]:not([data-ptr-selected]){outline:1px dashed rgba(144,128,48,.55) !important;outline-offset:-2px;}
|
|
3
|
+
[data-ptr-changed]{box-shadow:inset 0 0 0 2px rgba(144,128,48,1);animation:ptr-pulse 2s ease-in-out infinite;}
|
|
4
|
+
@keyframes ptr-pulse{0%,100%{box-shadow:inset 0 0 0 2px rgba(144,128,48,1)}50%{box-shadow:inset 0 0 0 2px rgba(144,128,48,.25)}}
|
|
5
|
+
@media (prefers-reduced-motion: reduce){[data-ptr-changed]{animation:none !important;}}
|
|
6
|
+
html{cursor:default;}
|
|
7
|
+
html,body{overflow:hidden;}
|
|
8
|
+
html,body{background:var(--ptr-canvas-bg,#ffffff);}`,dt=R(`<div class=canvas-bg role=group>`),ft=R(`<button type=button class=canvas-bg-opt><span class=canvas-bg-dot aria-hidden=true>`),pt=[`light`,`gray`,`dark`],mt={light:`#ffffff`,gray:`#d2cec7`,dark:`#242b36`},ht=`paintress:canvas-bg`;function gt(e){return pt.includes(e)}function _t(){try{let e=localStorage.getItem(ht);if(gt(e))return e}catch{}return`light`}function vt(e){try{localStorage.setItem(ht,e)}catch{}}var yt={light:`Light`,gray:`Gray`,dark:`Dark`};function bt(e){return(()=>{var t=dt();return V(t,()=>pt.map(t=>(()=>{var n=ft(),r=n.firstChild;return n.$$click=()=>e.onChange(t),V(n,()=>yt[t],null),b(i=>{var a=e.value===t,o=e.value===t,s=mt[t];return a!==i.e&&n.classList.toggle(`active`,i.e=a),o!==i.t&&B(n,`aria-pressed`,i.t=o),s!==i.a&&Ce(r,`--dot`,i.a=s),i},{e:void 0,t:void 0,a:void 0}),n})())),b(n=>{var r=e.label,i=e.label;return r!==n.e&&B(t,`aria-label`,n.e=r),i!==n.t&&B(t,`title`,n.t=i),n},{e:void 0,t:void 0}),t})()}z([`click`]);var xt={zh:{projects:`项目`,noProjects:`还没有注册项目`,projectFiles:e=>`${e} 个设计稿`,designs:`设计稿`,depth:`depth`,noFiles:`没有 .ptr / .pen 文件`,marks:`标记`,clear:`清空`,liveReload:`实时刷新`,refreshList:`刷新列表`,pickProject:`从左侧选择项目`,pickFile:`从左侧选择一个设计稿`,fit:`适应`,fitTitle:`适应窗口(Shift+1)`,actualSize:`1:1`,actualSizeTitle:`100%(Ctrl/Cmd+0)`,rerender:`重新渲染`,allBoards:`全部`,canvasBackground:`画布背景`,language:`界面语言`,unwatch:`解绑`,unwatchTitle:`解绑项目`,unwatchBody:e=>`「${e}」将从项目列表中移除。设计稿文件不受影响;agent 下次启动会自动重新注册。`,closeServer:`关闭服务器`,closeServerTitle:`关闭 web 进程`,closeServerBody:(e,t)=>`将断开 ${t} 个长连接并停止进程 pid ${e}。之后可用 paintress web 重新启动。`,cancel:`取消`,serverClosed:`服务已关闭`,serverClosedHint:`可以关闭此页面;需要时重新启动 paintress web。`,updateAvailable:(e,t)=>`新版 v${e}(当前 v${t})`,updateTitle:`有新版本`,updatePrompt:`把 paintress 升级到最新版:npm install -g paintress@latest,完成后重启 MCP 会话。`,updateSteps:`把上面这句话交给你的 AI 即可;或自己在终端执行那条命令。`,updateRepo:`GitHub`,copy:`复制`,copied:`已复制`,close:`关闭`,versionTitle:`版本`,agentOnline:`agent 已接入`,noActiveProjects:`无激活项目`,closingIn:e=>`窗口将在 ${e} 秒后关闭`,waitingForAgent:`等待 agent 接入 —— 在项目里让 AI 操作设计稿,这里会自动出现。`,notes:`笔记`,notesTitle:`设计笔记`,canvasTools:`画布工具`,presets:`预设`,components:`组件`,closePanel:`关闭`,presetEmpty:`还没有预设。让 agent 先把颜色和倒角定下来。`,presetHint:`改一个值,画布立刻更新。`,presetColor:`颜色`,presetRadius:`倒角`,componentsEmpty:`还没有组件。让 agent 把做好的组件登记进组件库。`,componentsHint:`画新组件之前,先看这里有没有能复用的。`,componentsCount:e=>`${e} 个组件`},en:{projects:`Projects`,noProjects:`No projects registered yet`,projectFiles:e=>`${e} design${e===1?``:`s`}`,designs:`Designs`,depth:`depth`,noFiles:`No .ptr / .pen files`,marks:`Marks`,clear:`Clear`,liveReload:`Live reload`,refreshList:`Refresh`,pickProject:`Pick a project on the left`,pickFile:`Pick a design on the left`,fit:`Fit`,fitTitle:`Fit to window (Shift+1)`,actualSize:`1:1`,actualSizeTitle:`100% (Ctrl/Cmd+0)`,rerender:`Re-render`,allBoards:`All`,canvasBackground:`Canvas background`,language:`Language`,unwatch:`Unbind`,unwatchTitle:`Unbind project`,unwatchBody:e=>`“${e}” will be removed from the project list. Design files are untouched; the agent re-registers it on next start.`,closeServer:`Stop server`,closeServerTitle:`Stop web process`,closeServerBody:(e,t)=>`This drops ${t} live connection${t===1?``:`s`} and stops process pid ${e}. Restart later with paintress web.`,cancel:`Cancel`,serverClosed:`Server stopped`,serverClosedHint:`You can close this page; run paintress web to start it again.`,updateAvailable:(e,t)=>`v${e} available (running v${t})`,updateTitle:`Update available`,updatePrompt:`Upgrade paintress to the latest version: npm install -g paintress@latest, then restart the MCP session.`,updateSteps:`Hand that line to your AI, or run the command yourself in a terminal.`,updateRepo:`GitHub`,copy:`Copy`,copied:`Copied`,close:`Close`,versionTitle:`Version`,agentOnline:`Agent attached`,noActiveProjects:`No active projects`,closingIn:e=>`This window closes in ${e}s`,waitingForAgent:`Waiting for an agent — ask your AI to touch a design and it shows up here automatically.`,notes:`Notes`,notesTitle:`Design notes`,canvasTools:`Canvas tools`,presets:`Presets`,components:`Components`,closePanel:`Close`,presetEmpty:`No presets yet. Ask the agent to fix colors and corner radii first.`,presetHint:`Change a value and the canvas updates immediately.`,presetColor:`Colors`,presetRadius:`Corner radius`,componentsEmpty:`No components yet. Ask the agent to register the ones it built.`,componentsHint:`Check here before building a new component.`,componentsCount:e=>`${e} component${e===1?``:`s`}`}};function St(e){return xt[e]}function Ct(e){return(e?.languages?.[0]??e?.language??``).toLowerCase().startsWith(`zh`)?`zh`:`en`}var wt=`paintress:lang`;function Tt(e){return e===`zh`||e===`en`}function Et(){try{let e=localStorage.getItem(wt);if(Tt(e))return e}catch{}return Ct(typeof navigator>`u`?void 0:navigator)}function Dt(e){try{localStorage.setItem(wt,e)}catch{}}var Ot=R(`<aside><header class=panel-head><h2></h2><button class="ghost tiny panel-close">✕</button></header><div class=panel-body>`);function kt(e){let t=()=>[`panel`,e.floating===!0?`panel-float`:``,e.class??``].filter(e=>e!==``).join(` `);return(()=>{var n=Ot(),r=n.firstChild,i=r.firstChild,a=i.nextSibling,o=r.nextSibling;return V(i,()=>e.title),Se(a,`click`,e.onClose,!0),V(o,()=>e.children),b(r=>{var i=t(),o=e.closeLabel,s=e.closeLabel;return i!==r.e&&xe(n,r.e=i),o!==r.t&&B(a,`title`,r.t=o),s!==r.a&&B(a,`aria-label`,r.a=s),r},{e:void 0,t:void 0,a:void 0}),n})()}z([`click`]);var Z=`modulepreload`,At=function(e){return`/`+e},jt={},Mt=function(e){return e.pathname.endsWith(`.css`)},Nt=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Pt=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=At(t,n);let r=s(t),i=Mt(r);return Nt(jt,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Z,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Ft=null;function It(){return Ft??=Pt(()=>import(`./marked.esm-DZCVybOJ.js`),[]),Ft}var Lt=/^(https?:\/\/|mailto:|#|\/)/i;function Rt(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}function Q(e){return Rt(e).replace(/'/g,`'`)}async function zt(e){let{Marked:t}=await It(),n=new t({gfm:!0,breaks:!1});return n.use({renderer:{html(e){return Rt(e.text)},link(e){let t=Lt.test(e.href)?e.href:`#`,n=e.title!==null&&e.title!==void 0?` title="${Q(e.title)}"`:``,r=this.parser.parseInline(e.tokens);return`<a href="${Q(t)}"${n} target="_blank" rel="noreferrer noopener">${r}</a>`},image(e){let t=Lt.test(e.href)?e.href:``;if(t===``)return Rt(e.text??``);let n=e.title!==null&&e.title!==void 0?` title="${Q(e.title)}"`:``;return`<img src="${Q(t)}" alt="${Q(e.text??``)}"${n} loading="lazy">`}},walkTokens(e){e.type!==`link`&&e.type!==`image`||Lt.test(e.href)||(e.href=``)}}),n.parse(e,{async:!1})}var Bt=R(`<div class=markdown>`),Vt=R(`<p class=panel-error>`);function Ht(e){let[t,n]=y(``),[r,i]=y(null);return x(w(()=>e.markdown,e=>{if(e===null){n(``),i(null);return}let t=!1;zt(e).then(e=>{t||(n(e),i(null))}).catch(e=>{t||i(e instanceof Error?e.message:String(e))}),E(()=>{t=!0})})),N(kt,{get title(){return e.title},get closeLabel(){return e.closeLabel},get onClose(){return e.onClose},class:`notes-panel`,get children(){return N(F,{get when(){return r()??e.error},get fallback(){return(()=>{var e=Bt();return b(()=>e.innerHTML=t()),e})()},children:e=>(()=>{var t=Vt();return V(t,e),t})()})}})}var Ut=R(`<h3 class=panel-group>`),Wt=R(`<ul class=preset-list>`),Gt=R(`<p class=panel-empty>`),Kt=R(`<p class=panel-hint>`),qt=R(`<li class=preset-row><span class=preset-name></span><input class=preset-swatch type=color><input class=preset-value type=text>`),Jt=R(`<li class=preset-row><span class=preset-name></span><input class=preset-value type=number min=0 step=1>`);function $(e){let t=e.trim();return/^#[0-9a-fA-F]{3}$/.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`.toUpperCase():/^#[0-9a-fA-F]{6,8}$/.test(t)?t.slice(0,7).toUpperCase():`#000000`}function Yt(e){let[t,n]=y({}),r=e=>t()[e.key]??e.value,i=()=>e.items.filter(e=>e.type===`color`),a=()=>e.items.filter(e=>e.type===`radius`);function o(e,t){n(n=>({...n,[e]:t}))}function s(t){let i=r(t).trim();i===``||i===t.value||e.onSet(t.key,i),n(e=>{let n={...e};return delete n[t.key],n})}return N(kt,{get title(){return e.labels.title},get closeLabel(){return e.labels.close},get onClose(){return e.onClose},floating:!0,class:`preset-panel`,get children(){return N(F,{get when(){return e.items.length>0},get fallback(){return[(()=>{var t=Gt();return V(t,()=>e.labels.empty),t})(),(()=>{var t=Kt();return V(t,()=>e.labels.hint),t})()]},get children(){return[N(F,{get when(){return i().length>0},get children(){return[(()=>{var t=Ut();return V(t,()=>e.labels.color),t})(),(()=>{var t=Wt();return V(t,N(P,{get each(){return i()},children:t=>(()=>{var i=qt(),a=i.firstChild,c=a.nextSibling,l=c.nextSibling;return V(a,()=>t.name),c.addEventListener(`change`,e=>{o(t.key,e.currentTarget.value.toUpperCase()),s(t)}),c.$$input=e=>o(t.key,e.currentTarget.value.toUpperCase()),l.$$keydown=e=>{e.key===`Enter`&&s(t),e.key===`Escape`&&n({})},l.addEventListener(`blur`,()=>s(t)),l.$$input=e=>o(t.key,e.currentTarget.value),B(l,`spellcheck`,!1),b(n=>{var r=t.key,i=`${t.name} ${e.labels.color}`,o=`${t.name} ${e.labels.color}`;return r!==n.e&&B(a,`title`,n.e=r),i!==n.t&&B(c,`aria-label`,n.t=i),o!==n.a&&B(l,`aria-label`,n.a=o),n},{e:void 0,t:void 0,a:void 0}),b(()=>c.value=$(r(t))),b(()=>l.value=r(t)),i})()})),t})()]}}),N(F,{get when(){return a().length>0},get children(){return[(()=>{var t=Ut();return V(t,()=>e.labels.radius),t})(),(()=>{var t=Wt();return V(t,N(P,{get each(){return a()},children:t=>(()=>{var i=Jt(),a=i.firstChild,c=a.nextSibling;return V(a,()=>t.name),c.$$keydown=e=>{e.key===`Enter`&&s(t),e.key===`Escape`&&n({})},c.addEventListener(`blur`,()=>s(t)),c.$$input=e=>o(t.key,e.currentTarget.value),b(n=>{var r=t.key,i=`${t.name} ${e.labels.radius}`;return r!==n.e&&B(a,`title`,n.e=r),i!==n.t&&B(c,`aria-label`,n.t=i),n},{e:void 0,t:void 0}),b(()=>c.value=r(t)),i})()})),t})()]}})]}})}})}z([`input`,`keydown`]);var Xt=R(`<figure class=tile><div class=tile-frame><iframe loading=lazy scrolling=no sandbox=allow-same-origin></iframe></div><figcaption>`,!0,!1,!1),Zt=R(`<p class=panel-hint>`),Qt=R(`<div class=tiles>`),$t=R(`<p class=panel-empty>`);function en(e){let t=()=>Math.max(1,e.item.width??120),n=()=>Math.max(1,e.item.height??40),r=()=>Math.min(1,120/Math.max(t(),n()));return(()=>{var i=Xt(),a=i.firstChild,o=a.firstChild,s=a.nextSibling;return V(s,()=>e.item.name),b(i=>{var a=K(e.project,e.item.id),c=e.item.name,l=`${t()}px`,u=`${n()}px`,d=`translate(-50%, -50%) scale(${r()})`,f=e.item.name;return a!==i.e&&B(o,`src`,i.e=a),c!==i.t&&B(o,`title`,i.t=c),l!==i.a&&Ce(o,`width`,i.a=l),u!==i.o&&Ce(o,`height`,i.o=u),d!==i.i&&Ce(o,`transform`,i.i=d),f!==i.n&&B(s,`title`,i.n=f),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),i})()}function tn(e){return N(kt,{get title(){return e.labels.title},get closeLabel(){return e.labels.close},get onClose(){return e.onClose},floating:!0,class:`components-panel`,get children(){return N(F,{get when(){return e.items.length>0},get fallback(){return[(()=>{var t=$t();return V(t,()=>e.labels.empty),t})(),(()=>{var t=Zt();return V(t,()=>e.labels.hint),t})()]},get children(){return[(()=>{var t=Zt();return V(t,()=>e.labels.count(e.items.length)),t})(),(()=>{var t=Qt();return V(t,N(P,{get each(){return e.items},children:t=>N(en,{item:t,get project(){return e.project}})})),t})()]}})}})}var nn=R(`<svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.6 stroke-linecap=round stroke-linejoin=round aria-hidden=true><rect x=3 y=3 width=18 height=18 rx=4></rect><circle cx=8.5 cy=9 r=1.3 fill=currentColor stroke=none></circle><circle cx=15.5 cy=9 r=1.3 fill=currentColor stroke=none></circle><circle cx=8.5 cy=15 r=1.3 fill=currentColor stroke=none></circle><circle cx=15.5 cy=15 r=1.3 fill=currentColor stroke=none>`),rn=R(`<svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.6 stroke-linecap=round stroke-linejoin=round aria-hidden=true><rect x=3 y=3 width=7.5 height=7.5 rx=2></rect><rect x=13.5 y=3 width=7.5 height=7.5 rx=2></rect><rect x=3 y=13.5 width=7.5 height=7.5 rx=2></rect><rect x=13.5 y=13.5 width=7.5 height=7.5 rx=2>`),an=R(`<div class=tool-rail role=toolbar>`),on=R(`<button class=rail-btn>`);function sn(){return nn()}function cn(){return rn()}function ln(e){return(()=>{var t=an();return V(t,N(P,{get each(){return e.items},children:t=>(()=>{var n=on();return n.$$click=()=>e.onToggle(t.id),V(n,(()=>{var e=I(()=>t.icon===`preset`);return()=>e()?N(sn,{}):N(cn,{})})()),b(r=>{var i=e.active===t.id,a=t.label,o=t.label,s=e.active===t.id;return i!==r.e&&n.classList.toggle(`active`,r.e=i),a!==r.t&&B(n,`title`,r.t=a),o!==r.a&&B(n,`aria-label`,r.a=o),s!==r.o&&B(n,`aria-pressed`,r.o=s),r},{e:void 0,t:void 0,a:void 0,o:void 0}),n})()})),b(()=>B(t,`aria-label`,e.label)),t})()}z([`click`]);var un=R(`<button class="badge badge-stack"><span>v</span><span class=badge-new>v`),dn=R(`<ul class=list>`),fn=R(`<section class="section files"><h2> <span class=hint> `),pn=R(`<section class="section marks"><h2><button class="ghost tiny"></button></h2><ul class=list>`),mn=R(`<span class=hint>pid `),hn=R(`<div class=error>`),gn=R(`<code>`),_n=R(`<span class=sep>/`),vn=R(`<span class="hint zoom">%`),yn=R(`<button class="ghost tiny">`),bn=R(`<button class=ghost>`),xn=R(`<span class=tool-sep>`),Sn=R(`<div class=boardbar><button class=board></button><div class=boardbar-scroll>`),Cn=R(`<button class=notes-toggle><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.6 stroke-linecap=round stroke-linejoin=round aria-hidden=true><path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"></path><path d="M14 3v5h5"></path><path d="M9 13h6M9 17h4">`),wn=R(`<div class=canvas-row><div class=canvas-wrap><iframe class=preview title="design preview"sandbox="allow-same-origin allow-scripts">`),Tn=R(`<div class=modal-backdrop><div class=modal role=status><h3></h3><p class=modal-body>`),En=R(`<div class="modal-backdrop countdown-backdrop"><div class="modal countdown"role=alertdialog aria-live=polite><h3></h3><p class=modal-body></p><div class=countdown-track aria-hidden=true><span class=countdown-fill>`),Dn=R(`<p class=modal-body>`),On=R(`<pre class=prompt>`),kn=R(`<div class=app><aside class=sidebar><header class=sidebar-head><img class=brand-mark src=/logo.svg alt><h1>paintress</h1></header><section class=section><h2></h2></section><footer class=sidebar-foot><label class=toggle><input type=checkbox></label><button class=ghost></button><button class=ghost></button></footer></aside><main class=stage><div class=toolbar><div class=crumbs></div><div class=tools><div class=lang-switch role=group><button class=lang-opt>中</button><button class=lang-opt>EN`),An=R(`<span class=badge>v`),jn=R(`<p class=empty><br><code>paintress watch <name> <dir>`),Mn=R(`<li class=row><button class=item><span class=item-name></span><span class=item-meta></span></button><button class=row-action>×`),Nn=R(`<span class=dot>`),Pn=R(`<p class=empty>`),Fn=R(`<li><button class=item><span class=item-name>`),In=R(`<li><button class=item><span class=item-name><b class=mark-no>#</b> </span><span class=item-meta>`),Ln=R(`<button class=crumb>`),Rn=R(`<p>`),zn=R(`<div class=placeholder>`),Bn=R(`<button class=board><span class=board-name></span><span class=board-size>×`),Vn=R(`<a class=ghost href=https://github.com/aliciai-dev/paintress target=_blank rel=noreferrer>`);function Hn(e,t){let n=e.split(`/`).filter(e=>e!==``);for(let e=Math.min(3,n.length);e>=1;e--){let r=n.slice(0,e).map(e=>decodeURIComponent(e)).join(`/`);if(t.some(e=>e.name===r))return r}return null}function Un(e,t){let n=`/${e.split(`/`).filter(e=>e!==``).map(encodeURIComponent).join(`/`)}`;return t===null?n:`${n}?file=${t.split(`/`).map(encodeURIComponent).join(`/`)}`}function Wn(e){return typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`)}function Gn(){let[e,t]=y([]),[n,r]=y([]),[i,a]=y(null),[o,s]=y([]),[c,l]=y(null),[u,d]=y([]),[f,p]=y(null),[m,h]=y([]),[g,_]=y(null),[v,S]=y({}),[C,ee]=y(0),[te,ne]=y(!0),[re,ie]=y(``),[ae,oe]=y([]),[se,ce]=y(null),[le,D]=y(1),[O,ue]=y(Et()),[k,de]=y(_t()),[fe,A]=y(null),[j,pe]=y(!1),[me,M]=y(!1),[he,ge]=y(!1),[_e,ve]=y(null),[ye,be]=y(null),[L,R]=y(null),[z,xe]=y([]),[Se,Te]=y([]),[H,U]=y(null),Ee=!1,[De,W]=y(!1),[G,Le]=y(!1),K=()=>St(O()),Ge=()=>[{id:`presets`,label:K().presets,icon:`preset`},{id:`components`,label:K().components,icon:`component`}],Ke,q,qe,J=null,Xe;function Ze(e){e.classList.toggle(`overflow`,e.scrollWidth>e.clientWidth+1)}function Y(){let e=i(),t=c();history.replaceState(null,``,e===null?`/`:Un(e,t))}let $e;function et(e){let t=n(),i=new Map(t.map(e=>[e.name,e])),a=new Set(e.map(e=>e.name)),o=[];for(let t of e){let e=i.get(t.name),n=e!==void 0&&e.leaving!==!0&&e.fileCount===t.fileCount&&e.agentConns===t.agentConns&&e.depth===t.depth&&e.label===t.label&&e.root===t.root;o.push(n?e:{...t})}let s=!1;for(let e of t)e.leaving===!0?a.has(e.name)||(o.push(e),s=!0):a.has(e.name)||(o.push({...e,leaving:!0}),s=!0);r(o),s&&(clearTimeout($e),$e=setTimeout(()=>r(e=>e.filter(e=>e.leaving!==!0)),240)),e.length>0&&(Ee=!0)}async function X(){try{let e=await Oe();t(e.projects),et(e.projects),S({pid:e.pid,version:e.version,latest:e.latest??null,connections:e.connections}),_(null)}catch(e){_(e instanceof Error?e.message:String(e))}}async function tt(){try{let e=await ke();S({pid:e.pid,version:e.version,latest:e.latest??null,connections:e.connections})}catch{}}async function nt(e){try{d((await Pe(e)).marks)}catch{d([])}}async function rt(e){a(e),l(null),p(null),h([]);try{let t=await Ae(e);s(t.files),_(null)}catch(e){s([]),_(e instanceof Error?e.message:String(e))}nt(e),Y()}async function it(){await X();let t=i();if(t!==null){if(!e().some(e=>e.name===t))a(null),l(null),s([]),p(null),h([]),Y();else{try{let n=await Ae(t),r=o();s(n.files);let i=c();if(i===null){let i=n.files.filter(e=>!r.includes(e));i.length>0&&e().some(e=>e.name===t)&&at(i[0])}else n.files.includes(i)||(l(null),p(null),h([]),Y())}catch{}nt(t)}}}function at(e){l(e),p(null),h([]),M(!1),Y()}async function st(e,t){try{let n=await Ve(e,t);ge(n.exists),ve(n.markdown??null),be(null),n.exists||M(!1)}catch(e){ge(!1),ve(null),be(e instanceof Error?e.message:String(e))}}async function ct(e){try{xe((await He(e)).items)}catch(e){_(e instanceof Error?e.message:String(e))}}async function dt(e){try{Te((await We(e)).items)}catch(e){_(e instanceof Error?e.message:String(e))}}async function ft(e,t){let n=i();if(n!==null)try{let r=await Ue(n,e,t);xe(r.items),ee(e=>e+1),_(null)}catch(e){_(e instanceof Error?e.message:String(e)),ct(n)}}function pt(e){let t=L()===e?null:e===`presets`?`presets`:`components`;R(t);let n=i();n!==null&&(t===`presets`&&ct(n),t===`components`&&dt(n))}function ht(){let e=v().latest??null,t=v().version??null;return e===null||t===null?null:Qe(e,t)?e:null}async function gt(){try{await navigator.clipboard.writeText(K().updatePrompt),Le(!0),setTimeout(()=>Le(!1),1500)}catch{}}function yt(e){A({kind:`unwatch`,name:e})}function xt(){A({kind:`shutdown`}),tt()}function Ct(){let e=fe();return e===null?{title:``,body:``,confirm:``}:e.kind===`unwatch`?{title:K().unwatchTitle,body:K().unwatchBody(e.name),confirm:K().unwatch}:{title:K().closeServerTitle,body:K().closeServerBody(v().pid??0,v().connections??0),confirm:K().closeServer}}async function wt(){let e=fe();if(A(null),e!==null)try{e.kind===`unwatch`?(await Re(e.name),await it()):(await ze(),pe(!0))}catch(e){_(e instanceof Error?e.message:String(e))}}T(()=>{let n=new EventSource(Ne());n.addEventListener(`projects`,e=>{let n=e.data,r=null;try{let e=JSON.parse(n);Array.isArray(e.projects)&&(r=e.projects)}catch{}if(r!==null){t(r),et(r);let e=i();e!==null&&!r.some(t=>t.name===e)?(a(null),l(null),s([]),p(null),h([]),Y()):it()}else it()}),n.addEventListener(`shutdown`,()=>{U(null),pe(!0)}),E(()=>n.close());let r=setTimeout(()=>{j()||tt()},4e3),o=setInterval(()=>{j()||tt()},6e4);E(()=>{clearTimeout(r),clearInterval(o)});let c=e=>{let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable===!0},u=e=>{if(!c(e)){if(e.key===`Escape`){if(L()!==null){R(null),e.preventDefault();return}if(me()){M(!1),e.preventDefault();return}}e.key===` `&&!e.ctrlKey&&!e.metaKey&&!e.altKey?(J?.setSpace(!0),e.preventDefault()):J?.handleKey(e)===!0&&e.preventDefault()}},d=e=>{e.key===` `&&J?.setSpace(!1)};window.addEventListener(`keydown`,u),window.addEventListener(`keyup`,d),E(()=>{window.removeEventListener(`keydown`,u),window.removeEventListener(`keyup`,d)});let f=e=>{let t=qe;if(t===void 0)return;let n=e.target;if(n===null||!t.contains(n))return;let r=e.deltaY===0?e.deltaX:e.deltaY;if(r===0)return;let i=t.scrollWidth-t.clientWidth;i<=0||(e.preventDefault(),t.scrollLeft=Math.max(0,Math.min(i,t.scrollLeft+r)))};window.addEventListener(`wheel`,f,{passive:!1}),E(()=>window.removeEventListener(`wheel`,f));let m=new URLSearchParams(location.search);(async()=>{await X();let t=Hn(location.pathname,e()),n=m.get(`project`),r=t??(n!==null&&e().some(e=>e.name===n)?n:null);if(r!==null){await rt(r);let e=m.get(`file`);e?at(e):Y()}})()});let Tt;E(()=>clearInterval(Tt));function Ot(){clearInterval(Tt),Tt=void 0,U(null)}async function kt(){Ot();try{await ze()}catch{}pe(!0),window.close()}x(w(()=>e().length,e=>{j()||(e>0?H()!==null&&Ot():Ee&&H()===null&&(U(10),clearInterval(Tt),Tt=setInterval(()=>{let e=(H()??0)-1;e<=0?(Ot(),kt()):U(e)},1e3)))}));let Z=()=>Ke?.contentDocument??null;function At(){let e=Z();if(!e||e.getElementById(`ptr-style`))return;let t=e.createElement(`style`);t.id=`ptr-style`,t.textContent=ut,e.head.appendChild(t)}function jt(){let e=Z();if(!e)return;for(let t of e.querySelectorAll(`[data-ptr-selected]`))t.removeAttribute(`data-ptr-selected`);let t=f();t&&e.querySelector(`[data-node-id="${Wn(t)}"]`)?.setAttribute(`data-ptr-selected`,``)}function Mt(e){return e.parentElement?.closest(`[data-node-id]`)??null}function Nt(e){return e.querySelector(`:scope > [data-node-id]`)}function Pt(e){if(J?.consumeDragClick()===!0){e.preventDefault(),e.stopPropagation();return}let t=e.target?.closest(`[data-node-id]`);t&&(e.preventDefault(),e.stopPropagation(),Gt(e.altKey?Mt(t)??t:t))}function Ft(e,t){let n=Z();if(!n)return;let r=f(),i=r===null?null:n.querySelector(`[data-node-id="${Wn(r)}"]`);if(i===null){let e=(n.elementFromPoint(t.x,t.y)?.closest(`[data-node-id]`))?.dataset.nodeId;e!==void 0&&Kt(e);return}let a=(e===1?Mt(i):Nt(i))?.dataset.nodeId;a!==void 0&&Kt(a)}function It(e){let t=Z();if(t){for(let e of t.querySelectorAll(`[data-ptr-hover]`))e.removeAttribute(`data-ptr-hover`);(e.target?.closest(`[data-node-id]`))?.setAttribute(`data-ptr-hover`,``)}}async function Lt(){let e=i(),t=c();if(e&&t)try{let n=await Be(e,t);if(!n.ok||n.ids.length===0)return;let r=Z();if(!r)return;for(let e of n.ids)r.querySelector(`[data-node-id="${Wn(e)}"]`)?.setAttribute(`data-ptr-changed`,``)}catch{}}function Rt(){let e=Z();if(!e)return[];let t=e.querySelector(`.ptr-canvas`)?.getBoundingClientRect(),n=J?.get().z??1;return Array.from(e.querySelectorAll(`[data-board]`)).map(e=>{let r=e.dataset,i=t===void 0?null:e.getBoundingClientRect(),a=i!==null&&n>0?{x:(i.left-t.left)/n,y:(i.top-t.top)/n,w:i.width/n,h:i.height/n}:null;return{id:r.nodeId??``,...r.boardName===void 0?{}:{name:r.boardName},x:a?.x??Number(r.boardX??0),y:a?.y??Number(r.boardY??0),w:a!==null&&a.w>0?a.w:Number(r.boardW??0),h:a!==null&&a.h>0?a.h:Number(r.boardH??0)}})}function Q(){let e=i(),t=c();return e&&t?`paintress:viewport:${e}/${t}`:null}function zt(e){let t=Q();t!==null&&(clearTimeout(Xe),Xe=setTimeout(()=>{try{localStorage.setItem(t,JSON.stringify(e))}catch{}},300))}function Bt(){let e=Z();e&&(At(),Jt(),J?.destroy(),J=lt({doc:e,onChange:e=>{D(e.z),zt(e)},onLevelStep:Ft}),oe(Rt()),ce(null),Vt(),e.addEventListener(`click`,Pt,!0),e.addEventListener(`mousemove`,It,!0),jt(),Lt())}function Vt(){if(!J)return;let e=Q(),t=e===null?null:localStorage.getItem(e),n=t===null?null:ot(t);n===null?J.fitAll():J.set(n)}function Ut(e){if(ce(e),!J)return;if(e===null){J.fitAll();return}let t=ae().find(t=>t.id===e);t&&J.focusBox({x:t.x,y:t.y,w:t.w,h:t.h})}function Wt(e){let t=[],n=e;for(;n;){let e=n.closest(`[data-node-id]`);if(!e)break;let r=e;t.unshift({id:r.dataset.nodeId??``,type:r.dataset.nodeType??`?`,name:r.dataset.nodeName}),n=e.parentElement}return t}async function Gt(e){let t=e.dataset.nodeId??``;if(t===``)return;let n=Wt(e);p(t),h(n),jt();let r=i();if(r)try{await Fe({project:r,nodeId:t,...e.dataset.nodeName===void 0?{}:{name:e.dataset.nodeName},...e.dataset.nodeType===void 0?{}:{type:e.dataset.nodeType},path:n.map(e=>e.name??e.type).join(` / `)}),d((await Pe(r)).marks),_(null)}catch(e){_(e instanceof Error?e.message:String(e))}}function Kt(e){p(e),jt();let t=Z(),n=t?.querySelector(`[data-node-id="${Wn(e)}"]`);if(!n||!t){h([]);return}h(Wt(n));let r=t.querySelector(`.ptr-canvas`);if(!r||!J){n.scrollIntoView({block:`center`});return}let i=n.getBoundingClientRect(),a=r.getBoundingClientRect(),o=J.get().z;J.centerOn({x:(i.left-a.left)/o,y:(i.top-a.top)/o,w:i.width/o,h:i.height/o})}async function qt(){let e=i();if(e)try{await Ie(e),d([]),p(null),h([]),jt()}catch(e){_(e instanceof Error?e.message:String(e))}}x(()=>{let e=O();document.documentElement.lang=e===`zh`?`zh-CN`:`en`,Dt(e)});function Jt(){if(q!==void 0){if(c()===null)q.style.removeProperty(`--canvas-bg`),q.removeAttribute(`data-canvas-bg`);else{let e=mt[k()];q.style.setProperty(`--canvas-bg`,e),q.setAttribute(`data-canvas-bg`,k())}Z()?.documentElement.style.setProperty(`--ptr-canvas-bg`,mt[k()])}}x(()=>{k(),vt(k()),Jt()}),x(w([i,c,C],()=>{let e=i(),t=c();ie(e&&t?`${je(e,t)}&r=${C()}`:``),Jt()})),x(w([i,c],()=>{ge(!1),ve(null),be(null);let e=i(),t=c();e!==null&&t!==null&&st(e,t)}));let $=null;return x(w([i,c,te],()=>{$?.close(),$=null;let e=i(),t=c();te()&&e&&t&&($=new EventSource(Me(e,t)),$.addEventListener(`change`,()=>{ee(e=>e+1),st(e,t),L()===`presets`&&ct(e),L()===`components`&&dt(e)}))})),E(()=>$?.close()),(()=>{var t=kn(),r=t.firstChild,a=r.firstChild;a.firstChild.nextSibling;var s=a.nextSibling,l=s.firstChild,d=s.nextSibling,p=d.firstChild,h=p.firstChild,_=p.nextSibling,y=_.nextSibling,x=r.nextSibling,S=x.firstChild,C=S.firstChild,w=C.nextSibling,T=w.firstChild,E=T.firstChild,ie=E.nextSibling;return V(a,N(F,{get when(){return v().version},get children(){return N(F,{get when(){return ht()},get fallback(){return(()=>{var e=An();return e.firstChild,V(e,()=>v().version,null),b(()=>B(e,`title`,K().versionTitle)),e})()},get children(){var e=un(),t=e.firstChild;t.firstChild;var n=t.nextSibling;return n.firstChild,e.$$click=()=>W(!0),V(t,()=>v().version,null),V(n,ht,null),b(()=>B(e,`title`,K().updateTitle)),e}})}}),null),V(l,()=>K().projects),V(s,N(F,{get when(){return n().length>0},get fallback(){return(()=>{var e=jn(),t=e.firstChild;return V(e,()=>K().waitingForAgent,t),e})()},get children(){var e=dn();return V(e,N(P,{get each(){return n()},children:e=>(()=>{var t=Mn(),n=t.firstChild,r=n.firstChild,a=r.nextSibling,o=n.nextSibling;return n.$$click=()=>void rt(e.name),V(r,()=>e.label??e.name),V(a,()=>K().projectFiles(e.fileCount),null),V(a,(()=>{var t=I(()=>e.agentConns>0);return()=>t()?(()=>{var e=Nn();return b(()=>B(e,`title`,K().agentOnline)),e})():null})(),null),o.$$click=()=>yt(e.name),b(r=>{var a=e.leaving===!0,s=i()===e.name,c=K().unwatch,l=`${K().unwatch} ${e.name}`;return a!==r.e&&t.classList.toggle(`leaving`,r.e=a),s!==r.t&&n.classList.toggle(`active`,r.t=s),c!==r.a&&B(o,`title`,r.a=c),l!==r.o&&B(o,`aria-label`,r.o=l),r},{e:void 0,t:void 0,a:void 0,o:void 0}),t})()})),e}}),null),V(r,N(F,{get when(){return i()},get children(){var t=fn(),n=t.firstChild,r=n.firstChild,a=r.nextSibling,s=a.firstChild;return V(n,()=>K().designs,r),V(a,()=>K().depth,s),V(a,()=>e().find(e=>e.name===i())?.depth??`-`,null),V(t,N(F,{get when(){return o().length>0},get fallback(){return(()=>{var e=Pn();return V(e,()=>K().noFiles),e})()},get children(){var e=dn();return V(e,N(P,{get each(){return o()},children:e=>(()=>{var t=Fn(),n=t.firstChild,r=n.firstChild;return n.$$click=()=>at(e),V(r,e),b(()=>n.classList.toggle(`active`,c()===e)),t})()})),e}}),null),t}}),d),V(r,N(F,{get when(){return u().length>0},get children(){var e=pn(),t=e.firstChild,n=t.firstChild,r=t.nextSibling;return V(t,()=>K().marks,n),n.$$click=()=>void qt(),V(n,()=>K().clear),V(r,N(P,{get each(){return u()},children:e=>(()=>{var t=In(),n=t.firstChild,r=n.firstChild,i=r.firstChild;i.firstChild,i.nextSibling;var a=r.nextSibling;return n.$$click=()=>Kt(e.nodeId),V(i,()=>e.shortId,null),V(r,()=>e.name??e.nodeId,null),V(a,()=>e.path),b(()=>n.classList.toggle(`active`,f()===e.nodeId)),t})()})),e}}),d),h.addEventListener(`change`,e=>ne(e.currentTarget.checked)),V(p,()=>K().liveReload,null),_.$$click=()=>void X(),V(_,()=>K().refreshList),y.$$click=()=>xt(),V(y,()=>K().closeServer),V(d,N(F,{get when(){return v().pid},get children(){var e=mn();return e.firstChild,V(e,()=>v().pid,null),e}}),null),we(e=>{q=e},x),V(x,N(F,{get when(){return g()},get children(){var e=hn();return V(e,g),e}}),S),V(C,N(F,{get when(){return m().length===0},get fallback(){return N(P,{get each(){return m()},children:(e,t)=>[N(F,{get when(){return t()>0},get children(){return _n()}}),(()=>{var t=Ln();return t.$$click=()=>Kt(e.id),V(t,()=>e.name??e.type),b(()=>t.classList.toggle(`active`,f()===e.id)),t})()]})},get children(){return N(F,{get when(){return I(()=>i()!==null)()&&c()!==null},get children(){return[(()=>{var t=gn();return V(t,()=>e().find(e=>e.name===i())?.label??i()),t})(),_n(),(()=>{var e=gn();return V(e,c),e})()]}})}})),V(w,N(F,{get when(){return I(()=>i()!==null)()&&c()!==null},get children(){return[(()=>{var e=vn(),t=e.firstChild;return V(e,()=>Math.round(le()*100),t),e})(),(()=>{var e=yn();return e.$$click=()=>J?.fitAll(),V(e,()=>K().fit),b(()=>B(e,`title`,K().fitTitle)),e})(),(()=>{var e=yn();return e.$$click=()=>J?.zoomToPercent(1),V(e,()=>K().actualSize),b(()=>B(e,`title`,K().actualSizeTitle)),e})(),(()=>{var e=bn();return e.$$click=()=>ee(e=>e+1),V(e,()=>K().rerender),e})(),xn()]}}),T),V(w,N(bt,{get value(){return k()},onChange:de,get label(){return K().canvasBackground}}),T),E.$$click=()=>ue(`zh`),ie.$$click=()=>ue(`en`),V(x,N(F,{get when(){return I(()=>i()!==null)()&&c()!==null},get fallback(){return(()=>{var e=zn();return V(e,N(F,{get when(){return i()},get fallback(){return(()=>{var e=Rn();return V(e,()=>K().pickProject),e})()},get children(){var e=Rn();return V(e,()=>K().pickFile),e}})),e})()},get children(){return[N(F,{get when(){return ae().length>1},get children(){var e=Sn(),t=e.firstChild,n=t.nextSibling;return t.$$click=()=>Ut(null),V(t,()=>K().allBoards),we(e=>{qe=e},n),V(n,N(P,{get each(){return ae()},children:e=>(()=>{var t=Bn(),n=t.firstChild,r=n.nextSibling,i=r.firstChild;return t.$$click=()=>Ut(e.id),we(e=>queueMicrotask(()=>Ze(e)),n),V(n,()=>e.name??`#${e.id}`),V(r,()=>Math.round(e.w),i),V(r,()=>Math.round(e.h),null),b(()=>t.classList.toggle(`active`,se()===e.id)),t})()})),b(()=>t.classList.toggle(`active`,se()===null)),e}}),(()=>{var e=wn(),t=e.firstChild,n=t.firstChild;return V(e,N(F,{get when(){return me()},get children(){return N(Ht,{get title(){return K().notesTitle},get closeLabel(){return K().closePanel},get markdown(){return _e()},get error(){return ye()},onClose:()=>M(!1)})}}),t),n.addEventListener(`load`,Bt),we(e=>{Ke=e},n),V(t,N(F,{get when(){return I(()=>!!he())()&&!me()},get children(){var e=Cn();return e.firstChild,e.$$click=()=>M(!0),V(e,()=>K().notes,null),b(()=>B(e,`title`,K().notesTitle)),e}}),null),V(t,N(ln,{get items(){return Ge()},get active(){return L()},onToggle:pt,get label(){return K().canvasTools}}),null),V(t,N(F,{get when(){return L()===`presets`},get children(){return N(Yt,{get items(){return z()},get labels(){return{title:K().presets,close:K().closePanel,empty:K().presetEmpty,hint:K().presetHint,color:K().presetColor,radius:K().presetRadius}},onClose:()=>R(null),onSet:(e,t)=>void ft(e,t)})}}),null),V(t,N(F,{get when(){return L()===`components`},get children(){return N(tn,{get items(){return Se()},get project(){return i()??``},get labels(){return{title:K().components,close:K().closePanel,empty:K().componentsEmpty,hint:K().componentsHint,count:K().componentsCount}},onClose:()=>R(null)})}}),null),b(()=>B(n,`src`,re())),e})()]}}),null),V(t,N(Ye,{get open(){return fe()!==null},get title(){return Ct().title},get body(){return Ct().body},get confirmLabel(){return Ct().confirm},get cancelLabel(){return K().cancel},onConfirm:()=>void wt(),onCancel:()=>A(null)}),null),V(t,N(F,{get when(){return j()},get children(){var e=Tn(),t=e.firstChild.firstChild,n=t.nextSibling;return V(t,()=>K().serverClosed),V(n,()=>K().serverClosedHint),e}}),null),V(t,N(F,{get when(){return I(()=>H()!==null)()&&!j()},get children(){var e=En(),t=e.firstChild.firstChild,n=t.nextSibling,r=n.nextSibling.firstChild;return V(t,()=>K().noActiveProjects),V(n,()=>K().closingIn(H()??0)),b(e=>Ce(r,`--left`,`${(H()??0)/10*100}%`)),e}}),null),V(t,N(Je,{get open(){return De()},get title(){return K().updateTitle},onClose:()=>W(!1),get actions(){return[(()=>{var e=Vn();return V(e,()=>K().updateRepo),e})(),(()=>{var e=bn();return e.$$click=()=>W(!1),V(e,()=>K().close),e})()]},get children(){return[(()=>{var e=Dn();return V(e,()=>K().updateAvailable(ht()??``,v().version??``)),e})(),(()=>{var e=On();return V(e,()=>K().updatePrompt),e})(),(()=>{var e=yn();return e.$$click=()=>void gt(),V(e,(()=>{var e=I(()=>!!G());return()=>e()?K().copied:K().copy})()),e})(),(()=>{var e=Dn();return V(e,()=>K().updateSteps),e})()]}}),null),b(e=>{var t=K().language,n=K().language,r=O()===`zh`,i=O()===`zh`,a=O()===`en`,o=O()===`en`;return t!==e.e&&B(T,`aria-label`,e.e=t),n!==e.t&&B(T,`title`,e.t=n),r!==e.a&&E.classList.toggle(`active`,e.a=r),i!==e.o&&B(E,`aria-pressed`,e.o=i),a!==e.i&&ie.classList.toggle(`active`,e.i=a),o!==e.n&&B(ie,`aria-pressed`,e.n=o),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),b(()=>h.checked=te()),t})()}z([`click`]);var Kn=document.getElementById(`root`);if(!Kn)throw Error(`缺少 #root 容器`);L(()=>N(Gn,{}),Kn);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
function e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var t=e();function n(e){t=e}var r={exec:()=>null};function i(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function a(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(s.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var o=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),s={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,listInterruptsParagraph:/^ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:i(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:i(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:i(e=>RegExp(`^ {0,${e}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:i(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:i(e=>RegExp(`^ {0,${e}}(?:</?(?:${b})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:i(e=>RegExp(`^ {0,${e}}>`)),nestedContainerMarkers:/^(?: {0,3}(?:(?:[*+-]|\d{1,9}[.)])[ \t]+|>[ \t]?))+/},c=/^(?:[ \t]*(?:\n|$))+/,l=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,u=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,d=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,f=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,p=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,m=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,h=a(m).replace(/bull/g,p).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),g=a(m).replace(/bull/g,p).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),_=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,v=/^[^\n]+/,y=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,ee=a(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,y).replace(`title`,/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),te=a(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,p).getRegex(),b=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,x=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ne=a(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,x).replace(`tag`,b).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),re=e=>a(_).replace(`hr`,d).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,b).getRegex(),ie=re(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ae=re(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),S={blockquote:a(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace(`paragraph`,ae).getRegex(),code:l,def:ee,fences:u,heading:f,hr:d,html:ne,lheading:h,list:te,newline:c,paragraph:ie,table:r,text:v},C=a(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,d).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,b).getRegex(),oe={...S,lheading:g,table:C,paragraph:a(_).replace(`hr`,d).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,C).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,b).getRegex()},se={...S,html:a(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace(`comment`,x).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:r,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:a(_).replace(`hr`,d).replace(`heading`,` *#{1,6} *[^
|
|
2
|
+
]`).replace(`lheading`,h).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ce=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,le=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ue=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,de=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,w=/[\p{P}\p{S}]/u,T=/[\s\p{P}\p{S}]/u,E=/[^\s\p{P}\p{S}]/u,fe=a(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,T).getRegex(),pe=/[\p{Pi}\p{Ps}"']/u,D=/(?!~)[\p{P}\p{S}]/u,me=/(?!~)[\s\p{P}\p{S}]/u,he=/(?:[^\s\p{P}\p{S}]|~)/u,ge=a(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,o?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),_e=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ve=a(_e,`u`).replace(/punct/g,w).getRegex(),ye=a(_e,`u`).replace(/punct/g,D).getRegex(),be=a(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,pe).replace(/punct/g,w).getRegex(),xe=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Se=a(xe,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),Ce=a(xe,`gu`).replace(/notPunctSpace/g,he).replace(/punctSpace/g,me).replace(/punct/g,D).getRegex(),we=a(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),Te=a(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),Ee=a(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),De=a(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,w).getRegex(),Oe=a(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),ke=a(/\\(punct)/,`gu`).replace(/punct/g,w).getRegex(),Ae=a(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,w).getRegex(),je=a(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Me=a(x).replace(`(?:-->|$)`,`-->`).getRegex(),Ne=a(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Me).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Pe=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,O=a(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,Pe).getRegex(),Fe=a(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,O).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),Ie=a(/^!?\[(label)\]\[(ref)\]/).replace(`label`,O).replace(`ref`,y).getRegex(),Le=a(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,y).getRegex(),k=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Re=a(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,Pe).getRegex(),ze=a(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,a(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Re).replace(`ref`,k).getRegex()).replace(`nolink`,a(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,k).getRegex()).getRegex(),A=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Be=a(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),j={_backpedal:r,anyPunctuation:ke,anyPunctuationOutsideCode:Ae,autolink:je,blockSkip:ge,br:ue,code:le,del:r,delLDelim:r,delRDelim:r,emStrongLDelim:ve,emStrongRDelimAst:Se,emStrongRDelimUnd:Te,escape:ce,link:Fe,nolink:Le,punctuation:fe,reflink:Ie,reflinkSearch:ze,tag:Ne,text:de,url:r},Ve={...j,emStrongLDelim:be,emStrongRDelimAst:we,emStrongRDelimUnd:Ee,link:a(/^!?\[(label)\]\((.*?)\)/).replace(`label`,O).getRegex(),reflink:a(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,O).getRegex()},M={...j,emStrongRDelimAst:Ce,emStrongLDelim:ye,delLDelim:De,delRDelim:Oe,url:a(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,Be).replace(`protocol`,A).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:a(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|wwwStart|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,A).replace(/emailProtocol/g,/(?:mailto|xmpp):/).replace(`wwwStart`,o?`(?<![^\\s*_~(])www\\.`:`www\\.`).getRegex()},He={...M,br:a(ue).replace(`{2,}`,`*`).getRegex(),text:a(M.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},N={normal:S,gfm:oe,pedantic:se},P={normal:j,gfm:M,breaks:He,pedantic:Ve},Ue={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},We=e=>Ue[e];function F(e,t){if(t){if(s.escapeTest.test(e))return e.replace(s.escapeReplace,We)}else if(s.escapeTestNoEncode.test(e))return e.replace(s.escapeReplaceNoEncode,We);return e}function Ge(e){return s.numericCharacterReference.test(e)?e.replace(s.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&`:String.fromCodePoint(r)}):e}function I(e){try{e=encodeURI(e).replace(s.percentDecode,`%`)}catch{return null}return e}function Ke(e,t){let n=e.replace(s.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(s.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(s.slashPipe,`|`);return n}function L(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function R(e){let t=e.split(`
|
|
3
|
+
`),n=t.length-1;for(;n>=0&&s.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
4
|
+
`)}function z(e){return e.trim().replace(s.multipleSpaceGlobal,` `).toLowerCase().toUpperCase().toLowerCase()}function B(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}var V=new WeakMap;function H(e){let t={"*":-1,_:-1},n=-1,r=e.length;for(let i=0;i<r;i++){let a=e[i];if(a!==`*`&&a!==`_`&&a!==`~`)continue;let o=i===0?`
|
|
5
|
+
`:e[i-1],s=i+1;for(;s<r&&e[s]===a;)s++;o!==` `&&o!==` `&&o!==`
|
|
6
|
+
`&&o!==`\r`&&o!==`\f`&&(a===`~`?n=i:t[a]=i),i=s-1}return{maskedSrc:e,lastPossibleEmStrongCloserIndex:t,lastPossibleDelCloserIndex:n}}function qe(e,t){let n=H(t),r=V.get(e);r?r.push(n):V.set(e,[n])}function Je(e){let t=V.get(e);t&&(t.pop(),t.length===0&&V.delete(e))}function Ye(e,t,n){let r=V.get(e)?.at(-1);return r&&r.maskedSrc===t?r.lastPossibleEmStrongCloserIndex[n]:H(t).lastPossibleEmStrongCloserIndex[n]}function Xe(e,t){let n=V.get(e)?.at(-1);return n&&n.maskedSrc===t?n.lastPossibleDelCloserIndex:H(t).lastPossibleDelCloserIndex}function U(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function W(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function Ze(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
7
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
|
|
8
|
+
`)}function Qe(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var G=class{options;rules;lexer;constructor(e){this.options=e||t}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:R(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Ze(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=L(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:L(t[0],`
|
|
9
|
+
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:L(t[0],`
|
|
10
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=L(t[0],`
|
|
11
|
+
`).split(`
|
|
12
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
13
|
+
`),c=s.replace(this.rules.other.blockquoteMarkerWhitespace,(e,t,n)=>t+U(n,t.length)).replace(this.rules.other.blockquoteSetextReplace,`
|
|
14
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
15
|
+
${s}`:s,r=r?`${r}
|
|
16
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`||u?.type===`heading`||u?.type===`hr`||u?.type===`html`||u?.type===`table`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
|
|
17
|
+
`),o=t.raw+`
|
|
18
|
+
`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
|
|
19
|
+
`).length:0,d=l?e.slice(0,-l):e;if(d.length>0&&(n=`${n}
|
|
20
|
+
${d.join(`
|
|
21
|
+
`)}`),r=r.substring(0,r.length-t.text.length)+s.text,e=e.slice(d.length),e.length>0&&this.rules.other.blockquoteStart.test(e[0]))continue;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
22
|
+
`+e.join(`
|
|
23
|
+
`),o=this.list(a);i[i.length-1]=o;let s=o.raw.length>t.raw.length?a.slice(t.raw.length+1,o.raw.length).split(`
|
|
24
|
+
`).length:0;if(s>0){let t=e.slice(0,s).join(`
|
|
25
|
+
`);n=`${n}
|
|
26
|
+
${t}`,r=`${r}
|
|
27
|
+
${t}`}e=e.slice(s)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){if(!this.options.pedantic&&this.lexer.state.lastToken?.type===`text`&&!this.rules.other.listInterruptsParagraph.test(e))return;let n=e,r=()=>n.length-e.length,i=t[1].trim(),a=i.length>1,o={type:`list`,raw:``,ordered:a,start:a?+i.slice(0,-1):``,loose:!1,items:[]};i=a?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=a?i:`[*+-]`);let s=this.rules.other.listItemRegex(i),c=!1;for(;e;){let i=!1,a=``;if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;let l=r();e=e.substring(t[0].length);let u=t[2].split(`
|
|
28
|
+
`,1)[0],d=t[1].length,f=this.options.pedantic?U(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>U(e,d)),p=e.split(`
|
|
29
|
+
`,1)[0],m=!f.trim(),h=0;if(this.options.pedantic?(h=2,a=f.trimStart()):m?h=d+1:(h=f.search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=f.slice(h),h+=d),m&&this.rules.other.blankLine.test(p)&&(e=e.substring(p.length+1),i=!0),!i){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),i=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(h):this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h),c=!1;for(;e;){let l=e.split(`
|
|
30
|
+
`,1)[0],u;if(p=l,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),u=p):u=p.replace(this.rules.other.leadingSpaceTab,e=>U(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(u.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`
|
|
31
|
+
`+u.slice(h),c=!1;else{if(m||f.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(f)||i.test(f)||o.test(f)||n.test(f))break;if(!this.options.pedantic&&!c){let e=f.replace(this.rules.other.nestedContainerMarkers,``);if(this.rules.block.fences.test(e)||this.rules.block.heading.test(e)||this.rules.block.hr.test(e))break}let e=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(p)&&this.rules.block.lheading.test(`${f}
|
|
32
|
+
${p}`)?` ${u.replace(/^ {0,3}/,``)}`:p;a+=`
|
|
33
|
+
`+e,c=!0}m=!p.trim(),e=e.substring(l.length+1),f=u.slice(h)}}let g=n.slice(l,r());o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),o.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();for(let e of o.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!o.loose){let t=e.tokens.filter(e=>e.type===`space`);o.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of o.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,o.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=R(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&B(t[2],`()`)!==-1)return;let e=z(t[1]),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:L(t[0],`
|
|
34
|
+
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ke(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
35
|
+
`):[],a={type:`table`,raw:L(t[0],`
|
|
36
|
+
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Ke(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:L(t[0],`
|
|
37
|
+
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
38
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Qe(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=L(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=B(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=L(t[0].slice(0,-1),`\\`);if((t[0].length-i.length)%2==0)return;let a=t[2],o=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(a);e&&(a=e[1],o=e[3])}else o=t[3]?t[3].slice(1,-1):``;return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(a=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?a.slice(1):a.slice(1,-1)),W(t,{href:a&&a.replace(this.rules.inline.anyPunctuation,`$1`),title:o&&o.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Qe(e,n[1],r,this.rules))return;let i=t[z(n[2]||n[1])];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return W(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||!r[1]&&!r[2]&&!r[3]&&!r[4])return;let i=r[0][0],a=n===i,o=t.length-e.length,s=o;for(;!this.options.pedantic&&s>0&&t[s-1]===i;)s--;let c=[...t.slice(Math.max(0,s-2),s)].at(-1)??``,l=c===`*`||c===`_`||!!this.rules.inline.punctuation.exec(c);s<o&&(n=c);let u=s<o?l:n===`*`||n===`_`||!!this.rules.inline.punctuation.exec(n);if(r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;let d=r[1]||r[3]||``;if(!d||!n||u){let n=[...r[0]].length-1,u,f,p=n,m=0,h=o-s+n,g=!this.options.pedantic&&!!c.trim()&&(!!d||i===`*`&&!l);if(i!==`*`&&i!==`_`)return;let _=i===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd,v=Ye(this,t,i),y=t.length-e.length+n;if(v<y)return;t=t.slice(-1*e.length+n);let ee=v-y;for(_.lastIndex=0;(r=_.exec(t))!==null&&!(r.index>ee);){if(u=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!u)continue;if(f=[...u].length,r[3]||r[4]){p+=f;continue}if(r[5]||r[6]||g){if(a&&(r[5]||r[6]))break;if(h%3&&!((h+f)%3)){m+=f;continue}}if(p-=f,p>0)continue;f=Math.min(f,f+p+m);let t=[...r[0]][0].length,i=e.slice(0,n+r.index+t+f);if(Math.min(n,f)%2){let e=i.slice(1,-1);return{type:`em`,raw:i,text:e,tokens:this.lexer.inlineTokens(e)}}let o=i.slice(2,-2);return{type:`strong`,raw:i,text:o,tokens:this.lexer.inlineTokens(o)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim,c=Xe(this,t),l=t.length-e.length+n;if(c<l)return;t=t.slice(-1*e.length+n);let u=c-l;for(s.lastIndex=0;(r=s.exec(t))!==null&&!(r.index>u);){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:Ge(t[0]),escaped:e}}}},K=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||t,this.options.tokenizer=this.options.tokenizer||new G,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let n={other:s,block:N.normal,inline:P.normal};this.options.pedantic?(n.block=N.pedantic,n.inline=P.pedantic):this.options.gfm&&(n.block=N.gfm,n.inline=this.options.breaks?P.breaks:P.gfm),this.tokenizer.rules=n}static get rules(){return{block:N,inline:P}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(s.carriageReturn,`
|
|
39
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.state.inRawBlock=!1,this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this;let r=this.state.lastToken;this.options.pedantic&&(e=e.replace(s.tabCharGlobal,` `).replace(s.spaceLine,``));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}this.state.lastToken=t.at(-1);let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
40
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
41
|
+
`)?``:`
|
|
42
|
+
`)+r.raw,n.text+=`
|
|
43
|
+
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if((r=this.tokenizer.fences(e))||(r=this.tokenizer.heading(e))||(r=this.tokenizer.hr(e))||(r=this.tokenizer.blockquote(e))||(r=this.tokenizer.list(e))||(r=this.tokenizer.html(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
44
|
+
`)?``:`
|
|
45
|
+
`)+r.raw,n.text+=`
|
|
46
|
+
`+r.raw,this.inlineQueue.at(-1).src=n.text):(this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title}),t.push(r));continue}if((r=this.tokenizer.table(e))||(r=this.tokenizer.lheading(e))){e=e.substring(r.raw.length),t.push(r);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(a))){let i=t.at(-1);n&&i?.type===`paragraph`?(i.raw+=(i.raw.endsWith(`
|
|
47
|
+
`)?``:`
|
|
48
|
+
`)+r.raw,i.text+=`
|
|
49
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(r),n=a.length!==e.length,e=e.substring(r.raw.length)}else if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
50
|
+
`)?``:`
|
|
51
|
+
`)+r.raw,n.text+=`
|
|
52
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,this.state.lastToken=r,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,z(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e.includes(`*`)||e.includes(`_`)||e.includes(`~`)||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==G.prototype.emStrong||this.tokenizer.del!==G.prototype.del?this.#r(e):e;qe(this.tokenizer,n);try{return this.#t(e,n,t)}finally{Je(this.tokenizer)}}#t(e,t,n){let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(t=>(o=t.call({lexer:this},e,n))?(e=e.substring(o.raw.length),n.push(o),!0):!1))continue;if((o=this.tokenizer.escape(e))||(o=this.tokenizer.tag(e))||(o=this.tokenizer.link(e))){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let t=n.at(-1);o.type===`text`&&t?.type===`text`?(t.raw+=o.raw,t.text+=o.text):n.push(o);continue}if((o=this.tokenizer.emStrong(e,t,i))||(o=this.tokenizer.codespan(e))||(o=this.tokenizer.br(e))||(o=this.tokenizer.del(e,t,i))||(o=this.tokenizer.autolink(e))||!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),n.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let t=n.at(-1);t?.type===`text`?(t.raw+=o.raw,t.text+=o.text):n.push(o)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}#n(e){let{blockSkip:t,tag:n,autolink:r}=this.tokenizer.rules.inline,i=``,a=0,o;for(t.lastIndex=0;o=t.exec(e);){let s=o.index+(o[2]?o[2].length:0),c=o.index+o[0].length;if(e.charAt(s)===`<`){let i=e.slice(s),a=n.exec(i)||r.exec(i);if(!a){t.lastIndex=s+1;continue}c=s+a[0].length,t.lastIndex=c}i+=e.slice(a,s)+`[`+`a`.repeat(c-s-2)+`]`,a=c}return i+e.slice(a)}#r(e){let t=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,n=t=>{let r=t.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,z(t.slice(r+1,-1))))return t;if(r>1&&t.charAt(0)!==`!`){let i=t.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,n)+`][`+`a`.repeat(t.length-r-2)+`]`}return`[`+`a`.repeat(t.length-2)+`]`};t=t.replace(e,n)}return t=t.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(e,t,n)=>n?`+`.repeat(e.length):t?t+e.slice(t.length,-t.length).replace(/`/g,`+`)+t:e),t=this.#n(t),t=this.options.hooks?.emStrongMask?.call({lexer:this},t)??t,t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},q=class{options;parser;constructor(e){this.options=e||t}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(s.notSpaceStart)?.[0],i=e?e.replace(s.endingNewline,``)+`
|
|
53
|
+
`:``;return r?`<pre><code class="language-`+F(r)+`">`+(n?i:F(i,!0))+`</code></pre>
|
|
54
|
+
`:`<pre><code>`+(n?i:F(i,!0))+`</code></pre>
|
|
55
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
56
|
+
${this.parser.parse(e)}</blockquote>
|
|
57
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
58
|
+
`}hr(e){return`<hr>
|
|
59
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
60
|
+
`+r+`</`+i+`>
|
|
61
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
62
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
63
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
64
|
+
<thead>
|
|
65
|
+
`+t+`</thead>
|
|
66
|
+
`+r+`</table>
|
|
67
|
+
`}tablerow({text:e}){return`<tr>
|
|
68
|
+
${e}</tr>
|
|
69
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
70
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${F(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?F(n,!0):this.parser.parseInline(r),o=I(e);if(o===null)return a;e=F(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+F(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=I(e);if(i===null)return F(n);e=i;let a=`<img src="${F(e)}" alt="${F(n)}"`;return t&&(a+=` title="${F(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:F(e.text)}},J=class{parser;strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return`
|
|
71
|
+
`}checkbox({raw:e}){return e}},Y=class e{options;renderer;textRenderer;constructor(e){this.options=e||t,this.options.renderer=this.options.renderer||new q,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new J,this.textRenderer.parser=this}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n===!1?``:n??``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e===!1?``:e??``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},X=class{options;block;constructor(e){this.options=e||t}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?K.lex:K.lexInline}provideParser(e=this.block){return e?Y.parse:Y.parseInline}};function Z(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var $e=class{defaults=e();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Y;Renderer=q;TextRenderer=J;Lexer=K;Tokenizer=G;Hooks=X;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(Z(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)Z(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)Z(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;Z(n,this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);Z(n,this.walkTokens(i,t))}):e.tokens&&Z(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new q(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n===!1?``:n??``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new G(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new X;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=X.passThroughHooks.has(n)?e=>{if(t.options.async&&X.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(t.options.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return Z(n,r.call(this,e)),t&&Z(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return K.lex(e,t??this.defaults)}parser(e,t){return Y.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?K.lex:K.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Y.parse:Y.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?K.lex:K.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Y.parse:Y.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
72
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+F(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},Q=new $e;function $(e,t){return Q.parse(e,t)}$.options=$.setOptions=function(e){return Q.setOptions(e),$.defaults=Q.defaults,n($.defaults),$},$.getDefaults=e,$.defaults=t;function et(...e){return Q.use(...e),$.defaults=Q.defaults,n($.defaults),$}$.use=et,$.walkTokens=function(e,t){return Q.walkTokens(e,t)},$.parseInline=Q.parseInline,$.Parser=Y,$.parser=Y.parse,$.Renderer=q,$.TextRenderer=J,$.Lexer=K,$.lexer=K.lex,$.Tokenizer=G,$.Hooks=X,$.parse=$;var tt=$.options,nt=$.setOptions,rt=$.walkTokens,it=$.parseInline,at=$,ot=Y.parse,st=K.lex;export{X as Hooks,K as Lexer,$e as Marked,Y as Parser,q as Renderer,J as TextRenderer,G as Tokenizer,t as defaults,e as getDefaults,st as lexer,$ as marked,tt as options,at as parse,it as parseInline,ot as parser,nt as setOptions,et as use,rt as walkTokens};
|
package/ui/dist/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>paintress</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-CEhK1JXE.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BFcvu7wr.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|