ryugi-artifacts 1.101.2 → 1.102.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/cli.cjs +7 -34
  2. package/dist/server.cjs +258 -258
  3. package/dist/viewer/{ActionBar-GEbMi4TD.js → ActionBar-DFtKepA7.js} +1 -1
  4. package/dist/viewer/{ActionIcon-RLJErXaL.js → ActionIcon-BmG7lBfd.js} +1 -1
  5. package/dist/viewer/{AgentStatusPill-DyrlWEmW.js → AgentStatusPill-Dr0IG63t.js} +1 -1
  6. package/dist/viewer/ArtboardLayout-Csu2pQ-T.js +14 -0
  7. package/dist/viewer/{ArtifactList-BWJ45-uL.js → ArtifactList-DsM43F_P.js} +1 -1
  8. package/dist/viewer/{ArtifactModal-Qn47mKCN.js → ArtifactModal-DjgA_mk-.js} +1 -1
  9. package/dist/viewer/{Avatar-A1oAz1XR.js → Avatar-OGhW38pt.js} +1 -1
  10. package/dist/viewer/{BottomSheet-BN9gyx7S.js → BottomSheet-wczv_s4I.js} +1 -1
  11. package/dist/viewer/{Canvas-B89LEvKt.js → Canvas-C9BgB5Vk.js} +1 -1
  12. package/dist/viewer/{CloudLegalNotice-BCTyYAWa.js → CloudLegalNotice-9Jrnaiz1.js} +1 -1
  13. package/dist/viewer/{CompositeItem-CSvIO8uB.js → CompositeItem-BLrDOuic.js} +1 -1
  14. package/dist/viewer/{DocumentExportMenu-DXxjkRFA.js → DocumentExportMenu-CxdmnnnP.js} +1 -1
  15. package/dist/viewer/DocumentLayout-Byaaj0lf.js +2 -0
  16. package/dist/viewer/{DocumentPage-B2UKgse3.js → DocumentPage-CrVLG3xw.js} +1 -1
  17. package/dist/viewer/{DraggablePanel-GGPnqMPs.js → DraggablePanel-D2U_w1Mh.js} +1 -1
  18. package/dist/viewer/{DropdownMenu-SGAC8XYI.js → DropdownMenu-D8PSw8rX.js} +1 -1
  19. package/dist/viewer/GroupVerdict-B4YWlFtx.js +1 -0
  20. package/dist/viewer/{HtmlLayout-CkyPc8Q7.js → HtmlLayout-p52oMbkD.js} +1 -1
  21. package/dist/viewer/{Input-CNcWZmH8.js → Input-BPP1bIR7.js} +1 -1
  22. package/dist/viewer/{MenuTrigger-OHGsk3Iu.js → MenuTrigger-CJXtjCtF.js} +1 -1
  23. package/dist/viewer/{PhoneArtboardBar-CdMJseRN.js → PhoneArtboardBar-BLmC5n92.js} +1 -1
  24. package/dist/viewer/{PhoneSheet-DHZCV8bd.js → PhoneSheet-RzYP9raH.js} +1 -1
  25. package/dist/viewer/{Popover-SE4RXx2B.js → Popover-CI2fBO-6.js} +1 -1
  26. package/dist/viewer/{PreviewArtifactLayout-BsIOQy80.js → PreviewArtifactLayout-BKcZov33.js} +1 -1
  27. package/dist/viewer/{PreviewLayout-DTAIcv0H.js → PreviewLayout-h2V6IEPR.js} +2 -2
  28. package/dist/viewer/{PublishMenu-D-u3yCNM.js → PublishMenu-I7yHr3IR.js} +1 -1
  29. package/dist/viewer/{ReportLayout-SZVzfC0J.js → ReportLayout-C1A2NXor.js} +1 -1
  30. package/dist/viewer/{RyugiMark-E1gFKvlG.js → RyugiMark-D6HsF-eP.js} +1 -1
  31. package/dist/viewer/{Segmented-Dd4wqUb4.js → Segmented-DWi3WMbI.js} +1 -1
  32. package/dist/viewer/{Select-BO3NR7PD.js → Select-C3XqBQ1N.js} +1 -1
  33. package/dist/viewer/{SelectScrollUpArrow-CGM1ElW0.js → SelectScrollUpArrow-DccpygLx.js} +1 -1
  34. package/dist/viewer/{SideDrawer-D9oZAAPW.js → SideDrawer-DtqMHMZa.js} +1 -1
  35. package/dist/viewer/{SlidesLayout-D1Sjqz7W.js → SlidesLayout-_aL_Wmn0.js} +3 -3
  36. package/dist/viewer/{SnapshotDocument-D0ymuHac.js → SnapshotDocument-BmyM7kKr.js} +1 -1
  37. package/dist/viewer/{SplitFrame-sFi3srWj.js → SplitFrame-DY4Pomig.js} +1 -1
  38. package/dist/viewer/{StoryboardLayout-BOCBT0dT.js → StoryboardLayout-DWmYoJbh.js} +1 -1
  39. package/dist/viewer/{StoryboardRender-DvDujY6-.js → StoryboardRender-Bz4HnHfj.js} +1 -1
  40. package/dist/viewer/{ThreadView-DgoYNafB.js → ThreadView-uYestFjK.js} +1 -1
  41. package/dist/viewer/VerifyLayout-B9e4RHAZ.css +1 -0
  42. package/dist/viewer/VerifyLayout-D3L_Nyhx.js +1 -0
  43. package/dist/viewer/{VirtualizedEditor-uWe43zaI-JDpZ-UaE.js → VirtualizedEditor-uWe43zaI-BRjchUcR.js} +1 -1
  44. package/dist/viewer/{VirtualizedRenderer-C_d95FXi-DpRLDZzT.js → VirtualizedRenderer-C_d95FXi-BiKuicf_.js} +1 -1
  45. package/dist/viewer/{WarningsBadge-B_8vwkt1.js → WarningsBadge-t_H3hA4c.js} +1 -1
  46. package/dist/viewer/{WhiteboardEditor-cZ32fLqJ-ZVWL_tx_.js → WhiteboardEditor-cZ32fLqJ-DHGUDfT6.js} +1 -1
  47. package/dist/viewer/{WhiteboardLayout-CXcVyWLf.js → WhiteboardLayout-BwzWcl_v.js} +1 -1
  48. package/dist/viewer/{WritingCursor-Tz_0Kzrp.js → WritingCursor-BgZ_CXA8.js} +1 -1
  49. package/dist/viewer/{api-C8atBssM.js → api-DnU71xnS.js} +1 -1
  50. package/dist/viewer/{artifact-list-DYdFYJaa.js → artifact-list-DLC6w9uW.js} +1 -1
  51. package/dist/viewer/{auto-publish-B0M98Fca.js → auto-publish-I637YfTf.js} +1 -1
  52. package/dist/viewer/{channel-BO955bMH.js → channel-BzQy5yb9.js} +3 -3
  53. package/dist/viewer/{crop-encode-B86CUhHc.js → crop-encode-DKOXrrBx.js} +1 -1
  54. package/dist/viewer/{dist-BODFR1Jr.js → dist-B4EO2CPv.js} +1 -1
  55. package/dist/viewer/{dist-C2M3_G3-.js → dist-B8JYmYN_.js} +1 -1
  56. package/dist/viewer/{dist-CpFhTJdQ.js → dist-BHAJ5J6a.js} +1 -1
  57. package/dist/viewer/{dist-w46wmgZp.js → dist-BI7tUIez.js} +1 -1
  58. package/dist/viewer/{dist-CZGkzFCv.js → dist-BL7gVqxi.js} +1 -1
  59. package/dist/viewer/{dist-C01DUxTi.js → dist-BP8ay-gZ.js} +1 -1
  60. package/dist/viewer/{dist-P_tj0_YM.js → dist-Bo83M38T.js} +1 -1
  61. package/dist/viewer/{dist-DWXSGLTE.js → dist-CO1p9q1Z.js} +1 -1
  62. package/dist/viewer/{dist-DaPsw--V.js → dist-CVt5MFeC.js} +1 -1
  63. package/dist/viewer/{dist-kTp8pZMq.js → dist-CaBa68Xm.js} +1 -1
  64. package/dist/viewer/{dist-DznRRxrn.js → dist-Cdwc8_lc.js} +1 -1
  65. package/dist/viewer/{dist-BDu6AHeP.js → dist-ChnAy31A.js} +1 -1
  66. package/dist/viewer/{dist-CDlrNMXS.js → dist-Ckvl87v1.js} +1 -1
  67. package/dist/viewer/{dist-BpYfPdi5.js → dist-DBpGO_S5.js} +1 -1
  68. package/dist/viewer/{dist-DNL6Um7a.js → dist-DCj5-otB.js} +1 -1
  69. package/dist/viewer/{dist-4HoMYeED.js → dist-DJbqyYbr.js} +1 -1
  70. package/dist/viewer/{dist-YyMYbSB-.js → dist-DSiP1sno.js} +1 -1
  71. package/dist/viewer/{dist-HTuDq_aa.js → dist-DrVA7ut5.js} +1 -1
  72. package/dist/viewer/{dist-tObrbDpE.js → dist-DxrXYjGy.js} +1 -1
  73. package/dist/viewer/{dist-fjhXjUom.js → dist-EEnCrnE5.js} +1 -1
  74. package/dist/viewer/{dist-CRRvcFM-.js → dist-UhLZmzFt.js} +1 -1
  75. package/dist/viewer/{dist-BXm5Rfgj.js → dist-j0019Ujc.js} +1 -1
  76. package/dist/viewer/{dist-a0u-2S_l.js → dist-jEPSRJix.js} +2 -2
  77. package/dist/viewer/{dist-DUF2tfCf.js → dist-r4fmjkHw.js} +1 -1
  78. package/dist/viewer/{editor-BpnTfMcC.js → editor-2avuG1le.js} +4 -4
  79. package/dist/viewer/{icons-yzuVhXUP.js → icons-DWimed9E.js} +1 -1
  80. package/dist/viewer/index.html +3 -3
  81. package/dist/viewer/index.js +2 -2
  82. package/dist/viewer/index5.css +151 -76
  83. package/dist/viewer/{labels-BlxZjLTh.js → labels-6JqNXprT.js} +1 -1
  84. package/dist/viewer/{local-split-host-C2RW7m9m.js → local-split-host-kaL99YNI.js} +1 -1
  85. package/dist/viewer/{parseTrigger-fuIDIBGR.js → parseTrigger-dhvXKZoS.js} +1 -1
  86. package/dist/viewer/preview.html +5 -5
  87. package/dist/viewer/preview.js +1 -1
  88. package/dist/viewer/{printDocument-SgAybSS9.js → printDocument-Bob6oDU4.js} +1 -1
  89. package/dist/viewer/{read-resolutions-D1nnXtlv.js → read-resolutions-iX7kD7Xz.js} +1 -1
  90. package/dist/viewer/{ref-oE9hXZLB.js → ref-CG33owdM.js} +1 -1
  91. package/dist/viewer/{route-CmBbNmVb.js → route-CkVEiakc.js} +2 -2
  92. package/dist/viewer/{route-messages-CAzxmUWF.js → route-messages-BblikCub.js} +1 -1
  93. package/dist/viewer/{settings-BU73kkrW.js → settings-i1xE8pA8.js} +1 -1
  94. package/dist/viewer/{snap-C_E1z6AY.js → snap-BoMEN-8e.js} +1 -1
  95. package/dist/viewer/{split-DvTDpgJW.js → split-C-_Iw2K0.js} +2 -2
  96. package/dist/viewer/{stable-C9ggSXF9.js → stable-DqmWGuUk.js} +1 -1
  97. package/dist/viewer/{tokens.stylex-zG8haNmJ.js → tokens.stylex-No4bA13s.js} +1 -1
  98. package/dist/viewer/{url-Brz_p3MH.js → url-64-774qp.js} +1 -1
  99. package/dist/viewer/{useArtifactFeed-Vqt5fAyB.js → useArtifactFeed-CojHZEow.js} +1 -1
  100. package/dist/viewer/{useCloudStatus-DvxxuOq7.js → useCloudStatus-BngR4Pm7.js} +1 -1
  101. package/dist/viewer/{useLayerZIndex-CuKgxp6B.js → useLayerZIndex-t4BgGwYi.js} +1 -1
  102. package/dist/viewer/{useStoryboardData-CPlKQjJu.js → useStoryboardData-B1gfG0bU.js} +1 -1
  103. package/dist/viewer/{useTranslation-BGQ-vF4X.js → useTranslation-ByuUeDLl.js} +1 -1
  104. package/dist/viewer/{view-aVq9gyhB.js → view-BnFGOXLi.js} +1 -1
  105. package/dist/viewer/{viewport-CFJHn_Y6-CeUex0Or.js → viewport-CFJHn_Y6-NgtbO-g_.js} +1 -1
  106. package/package.json +1 -1
  107. package/dist/viewer/ArtboardLayout-BTX9NX6v.js +0 -14
  108. package/dist/viewer/DocumentLayout-Bc3IfTlz.js +0 -2
  109. package/dist/viewer/GroupVerdict-BbSPek24.js +0 -1
  110. package/dist/viewer/VerifyLayout-B3HHzVWF.js +0 -1
  111. package/dist/viewer/VerifyLayout-BH4hYui6.css +0 -1
package/dist/cli.cjs CHANGED
@@ -372,34 +372,7 @@ if (ffmpeg.status !== 0) {
372
372
  process.exit(1);
373
373
  }
374
374
  console.log(JSON.stringify({ duration: pcm.length / 2 / RATE }));
375
- `,{flag:`wx`}),!0)}var Kt='# Artboard writing\n\nWrite `canvas.json` and board HTML/media under `pages/`. Re-read canvas before each edit; preserve human edits, stable IDs and positions. Never edit comments.json or `.state/`.\n\n## Writing order\n\nNew artboard or round: apply canvas changes as soon as the structure is ready, before composing a large HTML batch. Scripts and batch writes are fine: canvas first, then HTML with the focus group first; other boards may run in parallel. Existing board content edits need HTML only unless layout, grouping, metadata or focus changes.\n\n## canvas.json\n\n```json\n{\n "version": 1,\n "title": "Delivery settings",\n "activePage": "settings",\n "pages": [{ "id": "settings", "name": "Settings" }],\n "boards": {\n "q1-a": { "file": "pages/settings/a.html", "page": "settings", "x": 0, "y": 0, "w": 640, "h": 400, "title": "Fixed delay" },\n "q1-b": { "file": "pages/settings/b.html", "page": "settings", "x": 720, "y": 0, "w": 640, "h": 400, "title": "Exponential" }\n },\n "groups": {\n "q1": { "title": "Retry strategy", "boards": ["q1-a", "q1-b"], "choose": true, "recommend": "q1-b" }\n },\n "notes": {\n "round-one": { "kind": "title", "page": "settings", "x": 0, "y": -300, "text": "Retry strategy" }\n }\n}\n```\n\n- **Title**: readable, distinct from the slug.\n- **Boards**: HTML boards require file/page/x/y/w/h; title/interactive are optional. Media boards use type:"image"|"video" and src instead of file.\n- **Resources**: relative paths under pages/; other directories are not served. Limits: 8MB per media file, 20MB per artboard. Video: mp4(H.264)/webm. Verify clips trim idle ends with one second context and retain originals; trim:false preserves timing/narration. Check recordings/pending before handoff.\n- **Tokens**: the product\'s tokens live in one `pages/tokens.css`, linked by every board; never copy token values into each board.\n- **Groups** contain board IDs from one page: plain groups organize, choose:true + recommend:<member> asks a choice, verify:true + from:<environment/build> + capturedAt:<real ISO capture time> asks a verdict. Never combine choose and verify.\n- **Notes** require kind (title/sticky/condition), page/x/y/text; title size defaults to 96, optional w wraps; sticky w defaults to 240, optional color is #RGB/#RRGGBB.\n- **Edges** connect boards that follow one another: see Flows.\n- **Opening view**: activePage is the opening default; existing readers keep their page. focus `{target:<board/group/note>,at:<fresh ISO time>}` guides first ready content/phone question without resetting open camera/drafts. Share ?page=<id> for a new area.\n- **Spacing** is explicit: 80px horizontal board gap, 160px row gap; group frame 144px above and 48px outside boards. Leave 240px vertically/200px horizontally between groups; notes >=80px clear.\n- **Appending**: read `.state/artboard/<id>/layout.json` for actual group/note rectangles and page bounds first. A new round starts below maxY, title at maxY+120 then boards below title+80+144.\n- **Sizes**: desktop1280x800, phone402x874, tablet834x1194, component640x400. Frame height clips without warning: size h to content.\n\n## Flows\n\nWhen boards are steps of one path (an action on one screen opens the next, a condition forks, an error leads back), draw the path: connect them with `edges` and use condition notes for branches. Boards that are options to compare stay unconnected in a group. The viewer routes lines and keeps them attached when nodes move. Edit `edges` to change connections.\n\n```json\n{\n "version": 1,\n "title": "Publish flow",\n "pages": [{ "id": "flow", "name": "Flow" }],\n "boards": {\n "artboard": { "file": "pages/flow/artboard.html", "page": "flow", "x": 0, "y": 0, "w": 1280, "h": 800, "title": "Artboard" },\n "sign-in": { "file": "pages/flow/sign-in.html", "page": "flow", "x": 2308, "y": 1200, "w": 1280, "h": 800, "title": "Sign in" },\n "share": { "file": "pages/flow/share.html", "page": "flow", "x": 4068, "y": 0, "w": 1280, "h": 800, "title": "Share panel" }\n },\n "notes": {\n "signed-in": { "kind": "condition", "page": "flow", "x": 1760, "y": 328, "text": "Signed in?" }\n },\n "edges": {\n "publish": { "from": "artboard", "to": "signed-in", "label": "Click Publish" },\n "yes": { "from": "signed-in", "to": "share", "label": "Yes" },\n "no": { "from": "signed-in", "to": "sign-in", "label": "No" },\n "done": { "from": "sign-in", "to": "share", "label": "Signed in" }\n }\n}\n```\n\nEdge `from`/`to` reference board or condition IDs on one page; boards and notes share an ID space. Optional `label`: one line, at most 32 characters. Conditions require page/x/y/text, one incoming edge and at least two outgoing edges, each labelled. They are 96px tall, text-width, without wrapping.\n\nLay out flows on a grid with 480px between connected boards and on each side of a condition. Align a condition with a board at `y + (h - 48) / 2 - 48` (the name strip is 48px). Keep the main path on one row and branches below, clear of other boards.\n\nFix `edge "<id>" crosses board "<id>"` notices by moving boards or conditions; lines cannot be routed by hand. Conditions must not cover boards.\n\n## Board HTML\n\nWrite complete HTML ending `</html>` (last when streaming), inline CSS/scripts, html/body margin0. Missing or unfinished files stay pending. Use native, accessible labelled controls with visible state changes. Static by default; interactive:true enables PLAY.\n\nEach board/expanded view has independent iframe state: use memory, no localStorage/sessionStorage/cookies. Keep shared-state flows in one board; relative links stay inside its iframe. Replay, HTML edits and page changes/reloads reset prototype state; selected/playing/tweaked frames stay mounted on the same page.\n\n`ryugi-icon name="copy" size="18"` supplies Lucide icons; label actions. For JS-only icons add meta name="ryugi-icons" content="1" and await custom element definition.\n\n## Feedback\n\nChoice lifecycle: title notes define rounds. Read comment list --sections threads,groups,rounds --detail; act only on submitted rounds and read their threads. If human answered in terminal, record actual picks with comment choose and comment submit --round <id>. Withdrawal means wait. Add next round below, not over the old one. Documents can reference groups/boards using inline ref; preserve referenced keys.\n\nMarked comments: each `marked` line describes one mark. A box on an image or video board can end with `· at t=<s>` (the video frame) and `· crop <path>`: open that JPEG with your image reader before acting; it shows what the box covers.\n\nVerify lifecycle: put screen evidence in new verify groups with real from/capturedAt and language-matched titles/stickies. Record pass/reject only on human instruction. On rejection, repair behavior, replace evidence (resets pending), reply and leave the thread open; passing closes it. Preserve passed evidence unless asked. Command-output claims/gaps belong in a verify report. Run Check after writing; clear pending/warnings before claiming ready and inspect screenshots/recordings for visual claims.\n\n`browser_not_run:<board>` means no browser has loaded that board since its file, or a file under `pages/` that is not a board, last changed. Boards load only on the open page and near the view: open the artboard, go to each page Check lists under `Show` (`?page=<id>`), bring those boards into view, then run Check again. Editing one board or moving boards keeps the other boards\' results. With no browser to open, report Check as incomplete.\n\n## Selection and node IDs\n\nFor "here", "selected", Inspector changes or a node ID (`hero-2#7`), read `.state/artboard/<id>/selection.json`:\n\n- `selected`: file, CSS path from body, text, html, tweaks (`property/from/value`); `more` counts omitted nodes.\n- `boards`, `notes`: selected canvas IDs, omitted when empty.\n- `tweaks`: Inspector changes outside the selection.\n- `nodes`: all node IDs with file/path; query only the requested ID, never dump the list.\n\n```bash\njq \'{selected, more, boards, notes, tweaks}\' \'.ryugi/artifacts/.state/artboard/<id>/selection.json\'\n```\n\nFor a typed ID: `jq \'.nodes[] | select(.id == "hero-2#7")\' …/selection.json`. A harness-attached selection carries the same data. Edit its file/path; Inspector tweaks become source only when you write them. IDs renumber on every board reload/edit: resolve against current nodes and ask for a fresh ID before a later edit to that board.\n\n## Author-declared parameters\n\nExpose deliberate controls with one JSON declaration before any JS that reads it. The viewer supplies Parameters; phone uses defaults. Inspector Tweaks remain CSS overrides.\n\n```html\n<script type="application/json" data-ryugi-tweaks>\n {\n "version": 1,\n "controls": { "accent": { "type": "color", "default": "#b45309" } }\n }\n<\/script>\n```\n\nEach control needs `type` and `default`; optional `label` defaults to its key, `section` groups controls. Keys: letter first, then letters/digits/underscores/hyphens, <=64 characters, unique ignoring case.\n\n| Type | Values and extra fields |\n| --------- | ----------------------------------------------------------------- |\n| `color` | Six-digit hex; optional `options` list supplies swatches |\n| `range` | Number; requires `min` and `max`; `step` defaults to 1 |\n| `number` | Finite number; optional `min`, `max`, `step` |\n| `boolean` | `true` or `false` |\n| `enum` | String; `options` is a list of strings or `{value,label}` objects |\n| `text` | String, at most 512 characters |\n\nDefaults/updates must match type, bounds, step and options. Limits: 32 controls, 32 choices per control. Invalid JSON/defaults or duplicate declarations show a Parameters error.\n\nValues set `--tweak-<key>` and `data-tweak-<key>` on `<html>`; numbers are unitless (`calc(var(--tweak-radius, 12) * 1px)`). `window.ryugiTweaks` gives a typed snapshot; `document` emits `ryugi-tweaks` with all updated values in `event.detail`. Keep ordinary copy literal; expose text controls only for cross-cutting values or requested editable copy.\n\nControl changes and Reset apply without reload, preserving unrelated app state. Canvas/expanded instances share values per board; other boards are independent. Replay, source edits and page switches retain valid overrides; untouched defaults follow source changes, removed/invalid overrides fall back to defaults. Viewer refresh resets to defaults. Reset affects parameters only; preview values never write HTML or publish.\n\nTest the host Parameters control, each value, Reset, Replay and expanded view before claiming it works; appearance changes must preserve in-progress interactions.\n',qt='# Document writing\n\nWrite `doc.xml` under the returned artifact directory; put assets in `assets/`. Re-read immediately before each edit: the human and server edit this file too. Patch intended blocks, preserve existing IDs and human text; new blocks omit IDs and receive them from the server. Never edit `comments.json` or `.state/`. The server normalizes aliases and indentation after saving. Finish with `check`; pending merging or browser work means check again, not success.\n\nUse a closed `<doc>`. Choose blocks for the reader: diagrams show relationships, charts compare numbers, tables map exact attributes, prose explains reasons. A first draft can contain `<pending intent="What remains to investigate"/>`; fill every pending before claiming completion. Diagrams use native mermaid, or a whiteboard of this project embedded with a reference (below); never pictures of text or box drawing in code blocks.\n\nComplete block and inline vocabulary:\n\n- `h1`–`h6`, `p`, `blockquote`, `ul`/`ol` with `li`, `table`/`tr`/`th`/`td`, `hr`.\n- Inline `b i u s code sub sup mark a br`; aliases `strong em del strike`. Links use `href`. Ordered lists accept `start`; checklists use `<ul type="check"><li checked="true">Done</li></ul>`.\n- `codeblock lang="ts"`: code; use CDATA for literal XML/angle brackets. `mermaid`: native flowcharts/sequences/states. `math`: inline LaTeX, `display="block"` for a block.\n- `img src="assets/image.png" alt="…" caption="…" width="640"`: real images.\n- `alert type="note|tip|important|warning|caution"`: block children. `details summary="…" open="true"`: collapsed depth; omit open for collapsed. `steps` contains `step title="…"` with block children; titles omit numbering.\n- `footnote ref="1"` inline; `footnote-section` contains `def ref="1"` definitions.\n- `chart`: CDATA ChartSpec JSON. Required `version:1`, `type:bar|line|area|pie`, `x` category field, `series:[{key,label?}]`, `data` rows containing x and every series key. Values numbers/null, pie nonnegative. At most 6 series and 6 pie rows. Optional title/subtitle/note/source/xLabel/stacked/donut/highlight, format `{unit,compact,decimals,signed}`, y `{min,max}`, refs `[{y,label}]`. `highlight` is a `series.key` and highlights that entire series; omit it when unnecessary. With `series:[{key:"failures"}]` and rows `[{phase:"Before",failures:12},{phase:"After",failures:4}]`, `highlight:"failures"` is valid; `highlight:"After"` is invalid because it is a row/category value.\n- `dynamic url="assets/demo.html" initial-height="240"`: CDATA JSON becomes `window.ryugiProps`. Self-contained sandboxed HTML, inline scripts/styles, size by content, transparent body. Browser controls persist on HTML rewrite; changing props resets them. Runtime is incomplete until the block has run. Native HTML/CSS/JS and `ryugi-icon` work; storage/cookies do not.\n- `pending intent="…"`, inline `ask`/`option` and `ref` (below; a whiteboard `ref` can also embed as a block). Other tags are rejected.\n\n```xml\n<doc>\n <h1>Retry policy</h1>\n <p>Retry failed delivery at most <b>3</b> times.</p>\n <mermaid><![CDATA[flowchart LR\n ingress --> queue --> worker]]></mermaid>\n <p>Choose a strategy: <ask id="retry-strategy" recommend="exponential"><option value="fixed">Fixed delay</option><option value="exponential">Exponential backoff</option></ask></p>\n <details summary="Evidence"><codeblock lang="text"><![CDATA[attempts: 3]]></codeblock></details>\n</doc>\n```\n\nQuestions: `ask` is inline in p/li/table-cell paragraphs, never directly under doc. Its unique stable id is lowercase letters/digits/hyphens; never reuse an old question ID. Options contain plain text and distinct `value`s; `recommend` must name an option. No options makes an open question: `<ask id="other" placeholder="Describe it"/>`. Human picks are drafts until submitted. Read `comment list --sections threads,asks --detail`. Apply submitted answers, then `comment note --ask <id> --text <what changed>`. Every submitted question needs a note, even unanswered ones (state what was left or assumed). Record terminal answers only when actually supplied via `comment answer --ask <id> --choice <value>` or `--text`, then `comment submit`. Never invent an answer; wait after withdrawal. Changed settled answers require a human instruction and a fresh note.\n\nReferences: inline `<ref document="slug"/>`, `<ref html="slug">label</ref>`, `<ref artboard="slug" group="q1"/>` (or board), `<ref whiteboard="slug" frame="f1"/>` (or page), `<ref slides="slug" slide="slide-id"/>` (a deck, or one slide of it). Exactly one kind, at most one allowed subtarget, lowercase slug. Optional plain text label; server adds `to` when resolved, preserve it. Missing targets are warnings; clear before handoff. Keep referenced IDs stable; when changing a target, update the reference too. A reference under its section heading connects that section to its companion canvas. Live choices/verdicts belong in refs, not duplicated prose.\n\nEmbedded whiteboards: `<ref whiteboard="slug" frame="f1" embed="true"/>` draws the whiteboard in the document instead of a chip. Write it as a paragraph of its own directly under `<doc>`, e.g. `<p><ref whiteboard="sync-flow" frame="f-steps" embed="true"/></p>`; never beside text, in a list, table or quote. `frame` shows that frame cut to its box, `page` one page, neither the main page. Only whiteboard references embed. The drawing follows the whiteboard live: draw and change it on the whiteboard, not in the document; a reader clicks it to open the whole whiteboard. A missing whiteboard or frame is the same check warning as any reference.\n\nAfter editing, run the returned Check command. It names invalid blocks, chart/math/diagram errors, unresolved refs and pending dynamic work. Read complete feedback before acting; reply/resolve and acknowledge only the receipt for evidence actually used.\n',Jt='# HTML writing\n\nWrite one complete `index.html` with a descriptive `<title>`, inline or relative styles/scripts/images. The page reloads on edits. Native HTML/CSS/JavaScript works; use labelled controls and visible results. Assets stay inside this artifact directory; CDN fonts/scripts work, absolute local paths do not. The iframe is sandboxed: localStorage/sessionStorage/cookies throw; keep state in DOM/variables. Popups, forms, downloads and clipboard work.\n\n```html\n<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>Retry explorer</title>\n </head>\n <body>\n <label>Attempts <input id="attempts" type="range" min="1" max="5" value="3" /></label>\n <output id="result"></output>\n <script>\n const input = document.getElementById(\'attempts\');\n const render = () =>\n (document.getElementById(\'result\').textContent = input.value + \' attempts\');\n input.addEventListener(\'input\', render);\n render();\n <\/script>\n </body>\n</html>\n```\n\nStable control IDs preserve human input, checks, details and scroll across rewrites. Restoration fires input/change: render from those events. Script-only state resets. Use one surface for one investigation; comparison across independent screens belongs on an artboard. Re-read files before editing; never edit comments or `.state/`.\n\nBundled UI elements require no imports. Use native HTML/CSS for layout. `ryugi-icon name="message-square" size="18"` provides Lucide kebab-case icons (stroke-width defaults 2, color currentColor); label the button, icons are decorative. Unknown names become runtime warnings. For JS-only icons add `<meta name="ryugi-icons" content="1">` and await customElements.whenDefined(\'ryugi-icon\'). Preview glyphs map to the app\'s existing business icons when implementing the design.\n\nRun Check after edits. It distinguishes current static evidence from browser runtime. A closed/unloaded tab means runtime pending; open the returned URL and check again. Uncaught exceptions, rejected promises and missing relative assets are warnings; no browser run is not proof that a page works.\n\n# UI components\n\nHTML artifacts can use a small set of Lobe UI components through Web\nComponents. The artifacts server loads the runtime automatically when the page\ncontains a `<ryugi-…>` element:\n\n```html\n<ryugi-button variant="primary">Save</ryugi-button>\n```\n\nNo script tag is needed. If you create components dynamically, add\n`<meta name="ryugi-ui" content="1">` to the page so the runtime is loaded.\n\nThe runtime loads with `defer`. A page script that needs the components should\nwait for the document event:\n\n```js\ndocument.addEventListener(\n \'ryugi-ui:ready\',\n () => {\n // custom elements are defined\n },\n { once: true },\n);\n```\n\nUse these for controls and basic display. Use plain HTML and CSS for layout;\nthere is no layout wrapper to learn.\n\n## Rules\n\n- Give every interactive control a stable `id`. The viewer restores custom\n controls across rewrites by `id`, the same way it restores native inputs.\n- Listen for `ryugi-change` on controls:\n\n ```js\n document.addEventListener(\'ryugi-change\', (event) => {\n const { value, checked } = event.detail;\n console.log(event.target.id, value, checked);\n });\n ```\n\n It bubbles. `value` is a string, number, boolean, or `null`; `checked` is\n present for checkboxes and switches.\n\n- `value` / `checked` attributes set the initial state. Read the current state\n from the element\'s `value` / `checked` property after `ryugi-ui:ready`, and\n listen for `ryugi-change` for later updates.\n- `class` styles the host; `style` is forwarded to the component as well, so\n `style="width:100%"` works. Style the host, not the component\'s internal\n classes.\n- Keep children simple. For `ryugi-button`, `ryugi-card`, `ryugi-text`,\n `ryugi-tag`, `ryugi-checkbox`, and `ryugi-badge`, the original children are\n moved into the component. `ryugi-select`, `ryugi-segmented`, and\n `ryugi-radio-group` use option children instead.\n- Do not invent a `ryugi-` tag. If a component is not listed here, use HTML.\n- `ryugi-card` already paints a surface. Do not put a background, border and\n padding on both the host and the card: pick one. For a floating panel,\n either position the host and let the card paint its own surface, or make the\n host the surface and use `variant="borderless"` without `glass`/`shadow`.\n- Components follow `prefers-color-scheme`. Set `<html data-theme="light">`\n or `data-theme="dark"` before the runtime loads to pin the whole page.\n Without an explicit theme, the runtime follows OS theme changes.\n Lobe tokens such as `--lobe-color-primary` can be overridden on the host or\n page.\n\n## Controls\n\n### Button\n\n```html\n<ryugi-button variant="primary" size="middle" icon="plus">Add</ryugi-button>\n<ryugi-button variant="outlined" loading>Working…</ryugi-button>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`), `size`\n(`small`, `middle`, `large`), `block`, `loading`, `disabled`, `shape`, `type`,\n`icon` (any Lucide kebab-case name; `refresh` and `trash` remain aliases).\nRun `node app/ryugi.cjs guide icons` for standalone icons and mapping the preview\'s\nactions to business icons when implementing the app.\n\nUses the native `click` event.\n\n### Action icon\n\n```html\n<ryugi-action-icon icon="settings" title="Settings" aria-label="Settings"></ryugi-action-icon>\n```\n\nAttributes: `icon` (same set as Button), `size`, `disabled`, `title`,\n`aria-label`. Uses the native `click` event.\n\n### Tooltip and popover\n\n```html\n<ryugi-tooltip content="Copy a private link" placement="top">\n <ryugi-icon name="copy" size="14"></ryugi-icon> Copy\n</ryugi-tooltip>\n<ryugi-popover id="sharing" content="Only people you invite can open this link.">\n Sharing details\n</ryugi-popover>\n```\n\nBoth provide a native button trigger; children are its label and decorative\nicons, not nested buttons or controls. `content` is plain text, `placement`\nsets the floating position. Tooltip opens on hover/focus; Popover opens on\nclick (`trigger="hover"` opts into hover). Tooltip also accepts `open` for\na controlled preview. Native trigger clicks still reach your handlers.\n\n### Action menu\n\n```html\n<ryugi-menu id="actions" label="More" icon="ellipsis">\n <ryugi-menu-item value="copy" icon="copy">Copy link</ryugi-menu-item>\n <ryugi-menu-item value="delete" icon="trash-2" disabled>Delete</ryugi-menu-item>\n</ryugi-menu>\n```\n\nAttributes: `label`, `icon`, `placement`, `disabled`. Items accept `value`,\n`icon`, `disabled`; their text is the label. Selecting an enabled item emits\n`ryugi-change` with its action in `event.detail.value`. Actions are not\nrestored as control values on reload.\n\n### Input\n\n```html\n<ryugi-input id="title" placeholder="Title" value="Ryugi" style="width:100%"></ryugi-input>\n```\n\nAttributes: `type`, `size` (`small`, `middle`, `large`), `variant`\n(`filled`, `outlined`, `borderless`), `allowClear`, `placeholder`, `value`,\n`disabled`, `name`, `aria-label`.\n\n### Textarea\n\n```html\n<ryugi-textarea id="notes" rows="4" placeholder="Notes" style="width:100%"></ryugi-textarea>\n```\n\nAttributes: `rows`, `size`, `variant`, `placeholder`, `value`, `disabled`,\n`name`.\n\n### Number\n\n```html\n<ryugi-input-number id="count" value="12" min="0" max="100" step="1"></ryugi-input-number>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `precision`, `controls`, `size`,\n`variant`, `placeholder`, `disabled`.\n\n### Slider\n\n```html\n<ryugi-slider id="size" value="32" min="0" max="100" step="1"></ryugi-slider>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `disabled`.\n\n### Slider with number input\n\nThe most useful control for tuning an exact value.\n\n```html\n<ryugi-slider-input id="radius" value="8" min="0" max="32" step="1"></ryugi-slider-input>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `controls`, `size`, `variant`,\n`disabled`.\n\n### Switch\n\n```html\n<ryugi-switch id="dark" checked></ryugi-switch>\n```\n\nAttributes: `checked`, `loading`, `size`, `disabled`, `name`.\n\n### Checkbox\n\n```html\n<ryugi-checkbox id="compact">Compact</ryugi-checkbox>\n```\n\nAttributes: `checked`, `shape`, `size`, `disabled`, `name`. Children are the\nlabel.\n\n### Segmented\n\n```html\n<ryugi-segmented id="mode" value="grid">\n <ryugi-segment value="list">List</ryugi-segment>\n <ryugi-segment value="grid">Grid</ryugi-segment>\n <ryugi-segment value="masonry">Masonry</ryugi-segment>\n</ryugi-segmented>\n```\n\nAttributes: `value`, `size` (`small`, `middle`, `large`), `variant`\n(`filled`, `outlined`), `block`, `glass`, `shadow`, `vertical`, `disabled`.\n\n### Select\n\n```html\n<ryugi-select id="layout" value="a" placeholder="Choose layout">\n <ryugi-option value="a">Sidebar</ryugi-option>\n <ryugi-option value="b">Top tabs</ryugi-option>\n <ryugi-option value="c">Bottom rail</ryugi-option>\n</ryugi-select>\n```\n\nAttributes: `value`, `placeholder`, `size`, `variant`, `allowClear`,\n`showSearch`, `loading`, `mode` (`multiple`, `tags`), `disabled`.\n\n### Radio group\n\n```html\n<ryugi-radio-group id="density" value="comfortable">\n <ryugi-radio value="compact">Compact</ryugi-radio>\n <ryugi-radio value="comfortable">Comfortable</ryugi-radio>\n <ryugi-radio value="spacious">Spacious</ryugi-radio>\n</ryugi-radio-group>\n```\n\nAttributes: `value`, `horizontal`, `gap`, `size`, `disabled`.\n\n### Colour picker\n\n```html\n<ryugi-color-picker id="accent" value="#c56473" trigger="field"></ryugi-color-picker>\n```\n\nAttributes: `value`, `alpha`, `defaultFormat` (`hex`, `rgb`, `hsl`),\n`trigger` (`swatch`, `field`, `chip`), `size`, `disabled`.\n\n## Display\n\n### Toast\n\nHTML artifacts can call the bundled Lobe UI toast API as `window.ryugiToast`.\nIf the page has no `ryugi-` UI controls, opt in with the meta tag. Wait for\n`ryugi-ui:ready` before calling it:\n\n```html\n<meta name="ryugi-ui" content="1" />\n<button id="save" type="button">Save</button>\n<script>\n document.addEventListener(\n \'ryugi-ui:ready\',\n () => {\n document.getElementById(\'save\').addEventListener(\'click\', async () => {\n try {\n await saveDraft(); // the page\'s own operation\n window.ryugiToast.success({ id: \'save-result\', title: \'Saved\' });\n } catch {\n window.ryugiToast.error({\n id: \'save-result\',\n title: \'Save failed\',\n description: \'Try again.\',\n });\n }\n });\n },\n { once: true },\n );\n<\/script>\n```\n\nMethods: `success`, `error`, `info`, `warning`, `loading`. Each takes a string\nmessage or `{ title, description, id, duration }`. Text is rendered as text,\nnot HTML. A stable `id` refreshes the same notification instead of stacking\ncopies. The default duration is 5000ms; `duration: 0` stays until closed.\n`loading` stays until closed by default.\n\nCalls return a handle with `id` and `close()`. Use\n`window.ryugiToast.dismiss(id)` to close one, or `dismiss()` to close all.\nToasts appear at the bottom right and follow the page\'s theme. They are\ntransient: rewriting the page does not restore them. No `ryugi-toast` tag is\nneeded. Artboard pages do not load this UI runtime.\n\n### Tag\n\n```html\n<ryugi-tag variant="outlined">New</ryugi-tag>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`, `solid`), `size`,\n`shape` (`normal`, `round`), `color`, `closable`.\n\n### Alert\n\n```html\n<ryugi-alert\n type="info"\n title="Streaming"\n description="Pending boards draw as skeletons."\n></ryugi-alert>\n```\n\nAttributes: `type` (`success`, `info`, `warning`, `error`, `secondary`),\n`variant` (`soft`, `outlined`, `plain`), `title`, `description`, `showIcon`,\n`closable`. Text children are used as the title when `title` is absent.\n\n### Progress\n\n```html\n<ryugi-progress percent="64" size="small"></ryugi-progress>\n```\n\nAttributes: `percent`, `size`, `status`.\n\n### Badge\n\n```html\n<ryugi-badge count="3" status="processing"></ryugi-badge>\n<ryugi-badge count="3">\n <ryugi-avatar src="avatar.png" alt="Innei" size="32"></ryugi-avatar>\n</ryugi-badge>\n```\n\nAttributes: `count`, `dot`, `status`, `text`, `showZero`, `size`, `color`.\n\n### Avatar\n\n```html\n<ryugi-avatar src="avatar.png" alt="Innei" size="32"></ryugi-avatar>\n```\n\nAttributes: `src`, `alt`, `size`, `shape`.\n\n### Divider\n\n```html\n<ryugi-divider dashed></ryugi-divider>\n```\n\nAttributes: `orientation`, `dashed`.\n\n### Card\n\n```html\n<ryugi-card variant="outlined" shadow>\n <ryugi-text strong>Header</ryugi-text>\n <ryugi-text type="secondary">Supporting copy.</ryugi-text>\n</ryugi-card>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`), `shadow`,\n`glass`, `clickable`. Children are preserved, including nested components.\n`glass`, `shadow` and `variant` paint the inner Block surface, not the host.\nIf the host supplies the panel background and padding, omit `glass`/`shadow`\nand use `variant="borderless"` so there is only one visible container.\n\n### Text\n\n```html\n<ryugi-text type="secondary">Secondary body text</ryugi-text>\n<ryugi-text strong>Strong label</ryugi-text>\n<ryugi-text code>const x = 1</ryugi-text>\n```\n\nAttributes: `type` (`secondary`, `success`, `warning`, `danger`, `info`),\n`strong`, `code`, `italic`, `underline`, `delete`, `mark`, `align`, `weight`.\n\n## Complete tuning panel\n\n```html\n<ryugi-card>\n <ryugi-text strong>Header</ryugi-text>\n <ryugi-text type="secondary">Tune the reading column.</ryugi-text>\n\n <ryugi-slider-input id="measure" value="64" min="40" max="90" step="1"></ryugi-slider-input>\n\n <ryugi-segmented id="density" value="comfortable">\n <ryugi-segment value="compact">Compact</ryugi-segment>\n <ryugi-segment value="comfortable">Comfortable</ryugi-segment>\n <ryugi-segment value="spacious">Spacious</ryugi-segment>\n </ryugi-segmented>\n\n <ryugi-switch id="dark"></ryugi-switch>\n <ryugi-tag>Live preview</ryugi-tag>\n</ryugi-card>\n\n<script>\n document.addEventListener(\'ryugi-change\', (event) => {\n document.body.dataset[event.target.id] = event.detail.value;\n });\n<\/script>\n```\n\n## Not included in the first version\n\nTabs, Modal, Drawer, Table, DatePicker, and layout\ncomponents. Use plain HTML/CSS or a later component if one is added.\n',Yt='## Mockup components\n\n`<ryugi-ios-shell>` draws the device and nothing else: the screen (402×874, iPhone 17), status bar, Dynamic Island, home indicator and, with `bezel`, the frame (442×914). Size phone boards to match. Never hand-draw those parts. Everything on the screen (navigation bar, glass buttons, tab bar, cards, lists, inputs, sheets, a floating composer) is the product\'s own design system: write it by hand in HTML/CSS from the variables of `tokens.css`, in the product\'s own style, including its own Liquid Glass where the product uses it. Do not imitate iOS Settings rows unless the product\'s own screens look like that. The shell renders in light DOM, so selection, comments and the Inspector reach every part. The server loads it when the page contains the tag; for a shell created by script add `<meta name="ryugi-mockup" content="1">` and wait for `ryugi-mockup:ready` on `document`.\n\n```html\n<!doctype html>\n<html lang="zh">\n <head>\n <meta charset="utf-8" />\n <link rel="stylesheet" href="../tokens.css" />\n <style>\n html,\n body {\n margin: 0;\n }\n .nav {\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 44px;\n padding: 0 16px;\n }\n .mark {\n font: 700 26px/32px var(--font-display);\n color: var(--color-text);\n }\n .glass {\n display: flex;\n border-radius: 22px;\n background: var(--color-glass);\n backdrop-filter: blur(16px) saturate(1.8);\n color: var(--color-text);\n }\n .glass > * {\n display: grid;\n place-items: center;\n width: 44px;\n height: 44px;\n }\n .card {\n margin: 8px 16px;\n padding: 16px;\n border-radius: var(--radius-card);\n background: var(--color-surface);\n }\n </style>\n </head>\n <body>\n <ryugi-ios-shell>\n <div class="nav">\n <span class="mark">喵旅</span>\n <span class="glass">\n <span\n ><ryugi-icon symbol="person.crop.circle" name="circle-user" size="22"></ryugi-icon\n ></span>\n <span><ryugi-icon symbol="plus" name="plus" size="22"></ryugi-icon></span>\n </span>\n </div>\n <section class="card">…</section>\n </ryugi-ios-shell>\n </body>\n</html>\n```\n\nThe variable names in the example (`--font-display`, `--radius-card`, `--color-glass`) stand for roles; use the names the product\'s own `tokens.css` defines.\n\n| Element | Attributes | Children |\n| ------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `ryugi-ios-shell` | `bezel`, `time` (9:41), `hide="status island home all"` (any of them) | the screen content: it flows from below the status bar (`--safe-top`, 62px); absolutely positioned content measures from the screen\'s top edge. `--safe-bottom` is 34px. Both stay when parts are hidden |\n| `ryugi-token-sheet` | `appearance` to show one set only | one `<script type="application/json">` |\n\nBoth take `appearance="light|dark"`, otherwise follow the nearest `[data-appearance]`, then the system. Unknown attribute values raise a runtime warning.\n\nIcons: `<ryugi-icon name>` is a Lucide icon. Add `symbol`, an SF Symbol name (`wallet.bifold.fill`): when the local server runs on macOS it draws the symbol through the system and shows it at the symbol\'s own proportions, tinted with `currentColor`; anywhere else (other systems, Ryugi Cloud, published links) the Lucide icon shows. Write both. Use `symbol` only in mockups of apps for Apple platforms; that is the condition of Apple\'s license. Symbol images are never part of `pages/` and are never published.\n\nProduct tokens live in one stylesheet (on an artboard `pages/tokens.css`), light on `:root`, dark on `[data-appearance="dark"]`. The shell\'s root carries `data-appearance`, so light and dark phones sit side by side and your content under `[data-appearance="dark"]` flips with them. The shell reads `--color-bg` (screen), `--color-text` (status bar, home indicator) and `--font-body`, falling back to iOS system values; the token sheet also reads `--color-text-secondary`, `--color-separator`, `--color-surface`, `--color-fill` and `--color-accent`. Your content reads the same variables plus the product\'s own (radius, spacing, type, glass).\n\n`ryugi-token-sheet` draws the token table from JSON that names tokens, never values; values come from the stylesheet in both appearances:\n\n```json\n{\n "groups": [\n {\n "name": "Text",\n "kind": "color",\n "tokens": [\n {\n "name": "--color-text-secondary",\n "use": "行右侧的值",\n "on": "--color-surface",\n "board": "t-color-a"\n }\n ]\n },\n {\n "name": "Type",\n "kind": "type",\n "tokens": [{ "name": "--type-body", "use": "正文", "sample": "招商银行储蓄卡" }]\n }\n ]\n}\n```\n\nKinds: `color` (swatches; with `on`, WCAG contrast per appearance flagged under 4.5:1, or 3:1 with `"large": true`), `type` (a `font` shorthand), `space`, `radius`, `size`, `shadow`, `motion` (`<duration> <easing>`, click to play). Token and group names are English; `use` and `sample` follow the product\'s language. Missing variables and broken JSON show inline errors.\n',Xt="## Phone mockups\n\nEvery phone screen is a `<ryugi-ios-shell>`: it draws the 402×874 screen, status bar, Dynamic Island and home indicator, and `bezel` adds the 442×914 frame. Never hand-draw those parts; everything on the screen is the product's own design from its `tokens.css`. Before the first phone screen or `<ryugi-token-sheet>`, read the mockup guide: `start --artifact <artifact> --help --mockup`.\n",Zt='# Report writing\n\nA report is data and presentation kept apart. Each data source is a Node script that prints JSON; the report is `report.tsx`, one default-exported component built only from `@ryugi/report` that imports the data it draws.\n\n```\nreport/<id>/\n report.tsx\n sources/<source-id>/source.json\n sources/<source-id>/<script>.mjs\n data/<source-id>.json written by the hub when a source runs; never write it by hand\n assets/<file>.png images the report shows (png, jpg, gif, webp, avif, svg)\n```\n\n## Data sources\n\n`sources/<source-id>/source.json`: `{ "title": "Commits per day", "description": "main branch, last 30 days", "input": "git history of the repo", "script": "collect.mjs", "args": ["--days", "30"] }`. `title` and `script` are required; the script is a `.mjs`, `.js` or `.cjs` file in the same folder. Source ids are kebab-case.\n\nThe script runs with the project root as cwd and Node from the hub, so it can use the project\'s `node_modules`. Its env is the hub\'s env with the project\'s `.env` and `.env.local` laid over it; read secrets and machine paths from env or `args`, never write them into the script. It must print one JSON value on stdout (at most 2 MB; the whole report\'s data at most 10 MB) and exit 0 within 60 s. Do the aggregation in the script: the report only draws. A stderr line `ryugi:input <text>` replaces the input shown in the panel for that run, such as the commit the data was read at; other stderr is shown when the run fails.\n\nRun sources with `ryugi report refresh --artifact report/<id>` (all) or with `--only <source-id>` (one). The hub runs them, one run per source at a time, and writes `data/<source-id>.json`. Refresh after adding or changing a source, and before `check`. Reports fetched from someone else\'s Cloud link are read-only: never run their scripts.\n\n## report.tsx\n\n```tsx\nimport {\n BarChart,\n Grid,\n Report,\n Section,\n Stat,\n Table,\n useMemo,\n useState,\n Param,\n} from \'@ryugi/report\';\nimport days from \'./data/commits-per-day.json\';\n\nexport default function Commits() {\n const [span, setSpan] = useState(14);\n const shown = useMemo(() => days.slice(-span), [span]);\n return (\n <Report title="Ryugi commits" caption="main branch">\n <Param label="Window" min={7} max={30} unit="days" value={span} onChange={setSpan} />\n <Grid columns={3}>\n <Stat\n id="total"\n source="commits-per-day"\n title="Commits"\n value={shown.reduce((sum, day) => sum + day.commits, 0)}\n />\n </Grid>\n <Section id="daily" title="Per day">\n <BarChart\n id="per-day"\n source="commits-per-day"\n title="Commits per day"\n data={shown}\n x="date"\n series={[{ key: \'commits\', label: \'Commits\' }]}\n />\n <Table\n id="days"\n source="commits-per-day"\n title="Days"\n rows={shown}\n rowKey="date"\n columns={[{ key: \'date\' }, { key: \'commits\', align: \'right\' }]}\n />\n </Section>\n </Report>\n );\n}\n```\n\nImports come only from `@ryugi/report` and `./data/<source-id>.json` (default import; the source must exist). JSX uses SDK components only: no `div`, `img`, `a` or other native elements, no network calls, `document` / `window` / `location` / `navigator` / storage access, `globalThis`, `eval`, `Function`, `.constructor`, `import()` / `require()` or timers. Words in text and strings are fine; the check reads code. The page cannot reach the network either way. `report.tsx` stays under 64 KB; put data in a source. Derive with `useMemo` and plain expressions; keep state in `useState`.\n\nEvery Stat, chart, Table, Callout, Image and Section needs an `id`: kebab-case, unique in the report, and stable across edits, since comments and references hold on to it. Stat, charts and Table also need `source`: the source id, or a list of them, that the block\'s numbers come from; the hover chip and the sources panel read it. Write `id`, `source` and `title` as string literals.\n\nComponents:\n\n- `Report` `{ title, caption? }`: the root; `title` is the artifact\'s title.\n- `Section` `{ id?, title? }`, `Grid` `{ columns?: 1 | 2 | 3 | 4 }`, `Card`, `Stack` `{ gap? }`, `Divider`.\n- `H2`, `H3`, `Text` `{ tone?: \'muted\' }`, `List` `{ items }`, `Callout` `{ id, title?, tone?: \'info\' | \'success\' | \'warning\' | \'error\' }`.\n- `Stat` `{ id, source, title, value, unit?, delta?, format?, note? }`; `delta` is signed and shown up or down.\n- `Table` `{ id, source, title?, rows, rowKey, columns: { key, label?, align?, format? }[] }`; every row prints; a click on a row starts a comment on it.\n- `LineChart`, `BarChart`, `AreaChart`, `PieChart`, `ScatterChart` `{ id, source, title, data, x, series: { key, label?, color? }[], subtitle?, stacked?, donut?, highlight?, refs?: { label, y }[], format?, note? }`: the same chart renderer as a document\'s chart block. A `ScatterChart` needs a numeric `x` in every row. A reader clicks a point to pin it and comments on that point.\n- `Param` `{ label, value, onChange, min?, max?, step?, unit? }` (a slider with a number field when min and max are set), `Select` `{ label?, value, options, onChange }`, `Toggle` `{ label, checked, onChange }`. Printed, they show the value the reader set; a comment on a point or row records them too.\n- `Image` `{ id, src, alt, caption?, width? }`: an image file from the report folder, `src` written as a string such as `"assets/sources-panel.png"`; `alt` describes it. Copy screenshots and figures into `assets/` first; remote URLs are not allowed. Comments anchor to the image as a block.\n- `useState`, `useMemo` from `@ryugi/report`.\n\n`format` is `{ unit?, decimals?, compact?, signed? }`.\n\n## Check, comments, references\n\n`ryugi check --artifact report/<id>` reports static issues (imports, native elements, missing or repeated ids, unknown sources, missing data files) and, once a browser has opened the report, render errors.\n\nComments anchor to a block, a table row or a chart point: `ryugi comment add --artifact report/<id> --block <block-id> [--point <series>:<x> | --row <rowKey>]`. A comment keeps the value it was made on and which data it saw; after a refresh changes that data it is marked data changed and stays where it was.\n\nReference a report from a document with `<ref report="<id>"/>`, or one block with `<ref report="<id>" block="<block-id>"/>`. A deck names it inline with the same `<ref>`, and shows one block on a slide with `<embed report="<id>" block="<block-id>"/>`; give the blocks a deck shows a stable `id`.\n\nPublishing includes `report.tsx`, `sources/**`, `data/**` and the images under `assets/` with the report\'s visibility. Publishing is refused while a script, `report.tsx` or the data holds an absolute machine path (`/Users/…`, `/home/…`, `C:\\\\…`, not checked in data) or something that looks like a secret (`sk-…`, `ghp_…`, `AKIA…`, a private key, a value from `.env`); the refusal names the file and line.\n',Qt='# Slides writing\n\nWrite one complete `deck.xml` under the returned artifact directory; put images in `assets/` and reference them with relative paths. The deck is for an audience: your human partner presents it. Re-read before each edit; never edit `comments.json` or `.state/`. Finish with `check`.\n\nThe file holds what the slides say. The server compiles it into the page and adds the presentation engine, theme, code highlighting, diagrams and formulas. Only the tags and attributes below exist: there is no `class` and no `style`, and `check` reports anything else by slide and tag.\n\n```xml\n<deck title="Retry policy" lang="en">\n <slide id="cover" layout="cover">\n <kicker>Delivery · Q3</kicker>\n <h1>Retry policy</h1>\n <subtitle>Why failed deliveries now retry three times</subtitle>\n <notes>Open with last month\'s incident.</notes>\n </slide>\n\n <slide id="what-changes">\n <h2>What changes</h2>\n <ol steps="true">\n <li>At most three attempts</li>\n <li>Exponential backoff</li>\n </ol>\n </slide>\n\n <slide id="backoff" layout="code">\n <h2>Backoff</h2>\n <codeblock lang="ts" lines="1|2-3"><![CDATA[\n const delay = (attempt: number) =>\n Math.min(30_000,\n 500 * 2 ** attempt);\n ]]></codeblock>\n </slide>\n</deck>\n```\n\n## Slides\n\n- One slide is one `<slide>` directly inside `<deck>`. The deck\'s `title` is required; `lang` is optional.\n- Every slide needs a unique, stable `id` of lowercase letters, digits and hyphens. Comments and document references find a slide by its id: keep the id when you rewrite a slide, and only change it when the slide becomes a different slide. Deleting a slide orphans its comments.\n- The canvas is fixed at 1280×720. Content that leaves that box is reported by `check` as overflow, naming the slide. Fix it by cutting or splitting the slide; `zoom="0.8"` on the slide (0.3 to 1) is for the one dense slide that must stay whole.\n- While the deck is open in the viewer, `check` also names contact sheet images (`Sheet:`) that show every slide at its last step, twelve to an image, with overflowing and hidden slides marked. After editing, run `check`, open those images, and look for slides that are too full or that all look like the same template. `sheet_not_drawn` under `Pending` means the open viewer has not drawn this version yet. `Sheet: unavailable (…)` means it cannot be drawn, as for a deck holding a video or an iframe: go on without it.\n- `hidden="true"` keeps a slide in the file and out of the talk: it shows, marked, only while the deck is worked on; presenting, the audience window, the PDF and a published link never get it, and it takes no page number.\n- `<group id="evidence" title="What the data says">` inside `<deck>` gathers the slides of one part of the talk. It holds only `<slide>` and `<include>`, never another group; its `id` follows the slide id rules and is unique among slides and groups, and `title` is required. The grid view shows each group as a titled row; the audience sees nothing of it. Slides outside any group are fine, before, between or after groups.\n- `cover="<slide id>"` on `<deck>` names the slide that stands for the deck in lists and links. `check` warns when it names a slide that is missing or hidden.\n- Write XML: close every tag, quote every attribute, write `&lt;` and `&amp;` in text; common names such as `&nbsp;`, `&mdash;` and `&rarr;` work, any other is an error, so write the character itself. Code, diagrams and formulas go in `<![CDATA[ … ]]>` so nothing in them needs escaping. CDATA ends at the first `]]>`: code that contains `]]>` comes from a file with `src`. End the file with `</deck>`.\n\n## Layouts\n\nPick the layout that fits what the slide says, and vary them: a deck of identical title-and-bullets slides reads as a template. Each layout adds a few places of its own; a place used in another layout is reported. The theme adds the page number itself.\n\n| `layout` | Use it for | Inside the slide |\n| ----------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------- |\n| `default` | A title with text, a list, a table or code | Optional `<label>`, an `<h2>`, then blocks. Omitting `layout` gives this one |\n| `cover` | The first slide | `<kicker>`, `<h1>`, `<subtitle>` |\n| `section` | The start of a new part | Optional `<label>`, then an `<h1>` or `<h2>` |\n| `statement` | One sentence the audience should remember | Optional `<label>`, an `<h2>` with the key words in `<mark>`, optional `<subtitle>` |\n| `two-cols` | Two things side by side | An `<h2>`, then exactly two `<col>`, each holding blocks |\n| `image` | Text beside a picture | One `<col>` holding the text and one `<img>`; whichever comes first is on the left |\n| `quote` | A quotation | `<quote>` and `<cite>` |\n| `fact` | One number that matters | `<big value="10–12" unit="working days"/>`, then up to three `<fact value="5 days" label="API"/>` |\n| `code` | Code as the subject of the slide | Optional `<label>`, an `<h2>` and one `<codeblock>` or one `<magic>` |\n| `end` | The last slide | An `<h1>` |\n| `none` | A slide you lay out yourself | `src` naming an HTML file; see Free HTML. No padding and no page number |\n\n```xml\n<slide id="numbers" layout="fact">\n <big value="13" unit="harnesses supported"/>\n <fact value="5" label="artifact types"/>\n <fact value="0" label="subscriptions"/>\n</slide>\n<slide id="before-after" layout="two-cols">\n <h2>Before and after</h2>\n <col>\n <h3>Before</h3>\n <p>One attempt, then a page.</p>\n </col>\n <col>\n <h3>After</h3>\n <p>Three attempts, then a page.</p>\n </col>\n</slide>\n<slide id="dashboard" layout="image">\n <col>\n <label>Result</label>\n <h2>Failures fell by half</h2>\n </col>\n <img src="assets/dashboard.png" alt="Failure rate before and after the change" frame="true"/>\n</slide>\n```\n\n## Blocks and text\n\nBlocks sit in a slide or a `<col>`: `<h1>`, `<h2>`, `<h3>`, `<p>`, `<ul>` and `<ol>` of `<li>` (a list may nest in an item), `<table>` of `<tr>` holding `<th>` or `<td>`, `<blockquote>`, `<hr/>`, `<alert type="note|tip|important|warning|caution">` holding blocks, `<img>`, `<icon>`, `<codeblock>`, `<magic>`, `<mermaid>`, `<math>`, `<html>`, `<embed>` and `<notes>`.\n\nBlocks and inline tags a document also has carry the same names here. Inside text: `<b>`/`<strong>`, `<i>`/`<em>`, `<u>`, `<s>`/`<del>`, `<sub>`, `<sup>`, `<code>`, `<mark>`, `<a href="…">`, `<br/>`, `<math>`, `<icon>` and `<ref>`.\n\n- `<img src="assets/chart.png" alt="…"/>` shows a file of the artifact directory. `frame="true"` gives a screenshot rounded corners and a shadow.\n- `<icon name="check" size="32"/>` draws an icon; `size` is in pixels.\n- `<mermaid>` holds a Mermaid diagram and `<math>` a LaTeX formula, both in CDATA. `<math>` inside text is an inline formula.\n- `<notes>` holds speaker notes, shown only to the presenter. One per slide, plain text with `<br/>` between lines.\n\n```xml\n<h2>How a delivery flows</h2>\n<mermaid><![CDATA[\n flowchart LR\n A["ingress<br/>edge"] --> B[queue] --> C[worker]\n]]></mermaid>\n<table>\n <tr><th>Attempt</th><th>Delay</th></tr>\n <tr><td>1</td><td><math>500 \\cdot 2^1</math> ms</td></tr>\n</table>\n<p><icon name="check" size="24"/> Shipped behind a flag, see <a href="https://example.com/rfc">the RFC</a>.</p>\n```\n\n## Code\n\n`<codeblock lang="ts">` is a code block, named as in a document; `<code>` is inline code inside text. Write the code in CDATA; the indentation it shares with the XML is taken off.\n\n- `lines`: stepped line highlight. Parts are separated by `|`, each one step, lines count from 1: `1`, `2-3`, `2-3,5`; `all` lights every line and `hide` hides the block for that step.\n- `src="src/retry.ts#L10-24"`: take the code from a file of the project instead of writing it, optionally only those lines. The path is relative to the project root; files outside the project, dot-files such as `.env`, and files over 512 KB are refused, and so are files named like secrets (`secrets.*`, `credentials.*`, `*.pem`, `*.key`, `*.tfstate`, `*.tfvars`, SSH keys) and files git ignores. Never show a file that holds a secret under another name. What a deck shows is published with it.\n- `numbers="true"`: line numbers. `title="src/retry.ts"`: a title above the block. `max-height="320"`: a height in pixels past which the block scrolls, following the highlighted lines. `diff="true"`: lines starting with `+` or `-` are drawn as added or removed.\n- `<magic lang="ts">` holds two or more `<step>`, each the whole code at one step, in CDATA; what stays moves into place, and each step after the first is a step of the slide.\n\n```xml\n<codeblock lang="ts" src="src/retry.ts#L10-24" numbers="true" title="src/retry.ts" lines="all|3-5"/>\n<codeblock lang="ts" diff="true"><![CDATA[\n const attempts =\n - 1;\n + 3;\n]]></codeblock>\n<magic lang="ts">\n <step><![CDATA[const delay = 500;]]></step>\n <step><![CDATA[const delay = (attempt: number) => 500 * 2 ** attempt;]]></step>\n</magic>\n```\n\n## Steps and marks\n\n- `step="true"` on a block or a list item: it appears on the next step. `steps="true"` on a `<ul>`, `<ol>`, `<table>` or `<col>` makes each item, row or block a step.\n- `step="2"` places a step by number, and `step="with"` makes it appear together with the step before it.\n- `<mark>` highlights words. `type="highlight"`, `underline`, `circle` or `strike` draws that mark; with `step` the words are there from the start and the mark is drawn on its step.\n- `morph="title"` on a block in two consecutive slides moves it from one to the other; a name is used once per slide and the pair should hold the same text.\n\n```xml\n<h2 morph="title">The <mark type="underline" step="true">retry budget</mark> is per delivery</h2>\n<p step="true">Three attempts in total.</p>\n<p step="with">The first one counts.</p>\n<ul steps="true">\n <li>500 ms</li>\n <li>1 s</li>\n</ul>\n```\n\n## Several files and free HTML\n\n- `<include src="parts/appendix.xml"/>` inside `<deck>` puts the slides of another file of the artifact directory there. That file starts with `<slides>`, holds only `<slide>`, and cannot include further files. Ids stay unique across all files.\n- `<html src="parts/demo.html"/>` is a block of HTML you write yourself, in a file of the artifact directory.\n- `<slide id="demo" layout="none" src="parts/demo.html"/>` is a whole slide of your own HTML: you own every pixel of 1280×720. It may hold `<notes>` and nothing else.\n- A free HTML file is a fragment: no page wrapper, every `<div>` closed. `data-step` on an element inside it makes that element a step. It runs in the deck\'s sandbox: no localStorage, sessionStorage or cookies.\n\n```xml\n<deck title="Retry policy">\n <slide id="live-demo" layout="none" src="parts/demo.html">\n <notes>Click through the three states.</notes>\n </slide>\n <slide id="curve">\n <h2>The backoff curve</h2>\n <html src="parts/curve.html"/>\n </slide>\n <include src="parts/appendix.xml"/>\n</deck>\n```\n\n## Other artifacts\n\n`<embed>` puts another artifact of this project on the slide. Name the target by its slug, as a document\'s `<ref>` does:\n\n- `<embed artboard="settings-page" board="q1-b"/>` shows one board of an artboard, in a box of the board\'s shape.\n- `<embed whiteboard="sync-flow" frame="f1"/>` shows one frame of a whiteboard; `page="<page id>"` instead of `frame` shows a whole page. The box takes the shape of the frame or of what is drawn on the page.\n- `<embed report="q3-revenue" block="by-month"/>` shows one block of a report at the slide\'s width and at the block\'s own height, in the deck\'s light or dark.\n- `<embed slides="launch" slide="pricing"/>` shows one slide of another deck at 1280×720, at its last step, in that deck\'s own theme. Embeds on that slide hold their place under their names: decks nest one level.\n- `<embed html="spring-curve"/>` shows an html page, at 1280×720.\n\nAn embed is live: it shows the target as it is now, changes when the target does, and can be scrolled and clicked during the talk. Its corner button opens the target nearly full screen at the embedded part, and Esc closes it. In thumbnails, PNG and PDF export and the contact sheet every embed is a picture of the target.\n\n`<ref>` names another artifact inside text, as a chip: `<ref document="retry-policy">the design</ref>`, `<ref report="q3-revenue" block="by-month"/>`, `<ref whiteboard="sync-flow" frame="f1"/>`. Every kind a document can reference can be named, with the same attributes; with no text of its own the chip shows the target\'s title. Clicking it opens the target nearly full screen; nothing opens while the slide is edited or the pen or laser is on.\n\nPublished, a deck shows the published versions of what it embeds and names. A target that is private, unpublished or gone shows to visitors as its chip text or as an unpublished artifact, never its title or a picture of it; its owner sees it. Publishing the deck offers what it embeds and names to publish with it.\n\nAn embed takes `step` and `morph` like any block. `check` warns, naming the slide, when the artifact or the part it names (board, frame, page, block, slide) is not there, and the slide shows the target\'s name in its place. A `<ref>` to a missing target is warned about the same way.\n\n```xml\n<slide id="settings" layout="two-cols">\n <h2>The settings page</h2>\n <col>\n <p>Option B keeps billing on the first screen.</p>\n </col>\n <col>\n <embed artboard="settings-page" board="q1-b"/>\n </col>\n</slide>\n```\n\n## Theme, motion and glow\n\nChange the look for the whole deck with one `<theme>` before the first slide. `name` picks the theme: `paper` (the default: warm paper, one seal-coloured accent, glow) or `mono` (black on white, monospace labels, emphasis by weight, no glow). `appearance` is `light`, `dark` or `auto`; `auto`, the default, follows the system of whoever opens the deck and prints light, so write `light` or `dark` when the room decides. Every other attribute overrides one variable of the theme, in both appearances. A deck that sets its own `paper`, `surface` or `ink` is `light` unless it names an appearance: those colours suit one appearance only. Do not restyle slide by slide.\n\n```xml\n<deck title="Retry policy">\n <theme name="paper" appearance="dark" accent="#0a7cff" transition="slide-left" fragment="rise" glow-opacity="0.6"/>\n <slide id="cover" layout="cover" transition="fade" glow="top-right" glow-seed="launch">\n <h1>Retry policy</h1>\n </slide>\n</deck>\n```\n\n| `<theme>` attribute | Values | Paper |\n| ----------------------------- | ------------------------------------------------------------ | ------------------------------- |\n| `paper`, `surface` | the slide\'s background, and that of code and cards | |\n| `ink`, `ink-2`, `ink-3` | text, secondary text, labels | |\n| `accent`, `on-accent`, `info` | the accent colour, text on it, and the second accent | |\n| `rule`, `rule-strong` | hairlines | |\n| `font`, `font-mono` | font families | |\n| `transition` | `view`, `fade-out`, `fade`, `slide-left`, `slide-up`, `none` | `view` |\n| `transition-duration` | a time | `500ms` |\n| `transition-blur` | a length | `5px` |\n| `fragment` | `blur`, `fade`, `rise` | `blur` |\n| `fragment-duration` | a time | `500ms` |\n| `fragment-blur` | a length | `3px` |\n| `glow` | `on`, `off` | `on` |\n| `glow-1`, `glow-2`, `glow-3` | colours of the three shapes | `#9440e3`, `#41d1ff`, `#dce354` |\n| `glow-fade` | the colour each shape fades to | `rgb(255 255 255 / 0.1)` |\n| `glow-opacity` | 0 to 1 | `1` |\n| `glow-blur` | a length | `70px` |\n| `glow-drift` | how long the glow takes to move to the next slide\'s place | `2500ms` |\n| `glow-hue` | an angle | `0deg` |\n| `glow-at` | a glow place | `full` |\n\nTransitions:\n\n- `view`: the slide fades out, then the next fades in, both blurred; blocks with the same `morph` on both slides move and resize between them.\n- `fade-out`: the same fade out then in, without moving blocks.\n- `fade`: both slides cross-fade.\n- `slide-left`, `slide-up`: the next slide pushes in from the right or from below; going back reverses it.\n- `none`: the slide changes at once.\n\nSteps: `blur` fades a step in from a blur, `rise` also lifts it 12px, `fade` only fades it.\n\nOn a `<slide>`:\n\n- `transition`: the transition into this slide, one of the values above.\n- `glow`: where this slide\'s glow sits: `full`, `top`, `bottom`, `left`, `right`, `top-left`, `top-right`, `bottom-left`, `bottom-right`, `center`, or `none` for no glow. Left out, the place follows the layout and changes from slide to slide.\n- `glow-seed`: any text; the same seed on the same page number always gives the same shapes.\n- `glow-opacity`: 0 to 1, this slide only.\n- `glow-hue`: degrees, this slide only.\n\n`check` reports an unknown transition or glow place and a `morph` name used twice in one slide. With reduced motion, turns are instant and the glow does not move.\n\n## Placing blocks freely\n\nA layout arranges a slide for you. When a slide must sit exactly as drawn, put `free="true"` on it: every block it holds, inside a `<col>` too, then takes `x`, `y` and `w` in slide pixels of the 1280×720 canvas, and `h` when its height matters (pictures, embeds, diagrams). The layout stays named, so its type sizes still apply, and removing `free` with the coordinates brings the layout back. A block on a free slide without `x`, `y` and `w` is reported, and so are coordinates on a slide that is not free. Later blocks sit on top of earlier ones.\n\n```xml\n<slide id="library" layout="two-cols" free="true">\n <h2 id="b4k2qz" x="96" y="80" w="520">The library</h2>\n <col>\n <p x="96" y="180" w="420" align="center" color="muted">Every artifact, one server.</p>\n </col>\n <col>\n <img x="640" y="120" w="560" h="380" src="assets/library.png" alt="The library page" frame="true"/>\n </col>\n</slide>\n```\n\n- `align="left|center|right|justify"` and `color` work on text blocks on any slide. `color` takes a theme colour, `ink|muted|faint|accent|info`, which follows the theme and its light and dark appearances, or a fixed `#RRGGBB` / `#RRGGBBAA`, which does not. Prefer the theme colours.\n- On a free slide, `w="fill"` stretches a block from its `x` to the right safe margin, and a text block may take `h`: what does not fit is clipped, unless the block also has `fit="shrink"`, which shrinks its text until it fits.\n\n### Look attributes\n\nYour human partner tunes blocks in the viewer\'s tweak panel. Each setting is one attribute on the block, on any slide; `check` reports a value outside its range and an attribute on a block that does not take it.\n\n| Attribute | Blocks | Value |\n| --------------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------- |\n| `size="32"` | text | font size, 8–400 px |\n| `weight="600"` | text | 100–900 in steps of 100 |\n| `font="Avenir Next"` | text | `mono` or a font name; a font missing on another machine falls back to the theme font |\n| `leading="1.4"` | text | line height, 0.8–3 |\n| `tracking="-0.5"` | text | letter spacing, -20–100 px |\n| `pad="16"` | text, table, codeblock, code, alert, big, fact | padding, 0–200 px |\n| `fill="surface"` | all but hr, icon and html | a theme colour (`surface`, `paper`, `ink`, `muted`, `faint`, `accent`, `info`) or hex |\n| `opacity="80"` | all but html | 0–100 |\n| `radius="12"` | all but hr, icon and html | 0–360 px |\n| `border="solid"` | all but hr, icon and html | `solid`, `dashed` or `dotted`, 1 px in the theme\'s rule colour |\n| `shadow="0 8 24 #00000040"` | all but hr, icon and html | x, y, blur in px and a colour |\n\n```xml\n<slide id="promise" free="true">\n <p x="96" y="180" w="fill" h="120" fit="shrink" size="32" weight="600" fill="surface" radius="12" pad="16">Every artifact, one server.</p>\n</slide>\n```\n\nThese are deliberate choices: keep these attributes when you rewrite a block, unless changing them is the point.\n\n- An `id` on a block (letters, digits, `_` and `-`, at most 32) is how the viewer and comments know that block again. Your human partner\'s edits give blocks ids: keep every block id when you rewrite a slide, as you keep slide ids.\n\n## Rules\n\n- A talk is given offline: keep fonts, scripts and images inside the artifact directory and avoid CDNs.\n- Notes are not secret: they are hidden from viewers in the interface but remain in the page source.\n- Your human partner can edit notes in the viewer. Saving writes that slide\'s `<notes>` back as plain text lines joined by `<br/>`, replacing any markup inside it, in the file the slide is written in.\n- Keep the whole artifact under 20 MB.\n- Your human partner can edit slides in the viewer: select blocks, drag and resize them (which makes a slide `free="true"`), type into them, change their tag, alignment, colour and every look attribute, restack blocks, change a slide\'s layout, add text boxes, copy, paste and delete. Each edit rewrites the slide in `deck.xml` or its include file in place and is listed by `changes`. Re-read the file before every edit. When you write over one of their edits before you have read it, `check` warns with `W_HUMAN_EDIT_OVERWRITTEN`, naming the slide, the block and what they had set: put their edit back unless you meant to change it.\n- Your human partner can restructure the deck in the viewer\'s grid: reorder and duplicate slides, skip them, add placeholder slides, delete them, and create, rename or move groups. Each change rewrites `deck.xml` (and an include file, for a slide written there) in place, keeping the rest of the text as it was. When `check` reports `Structure: N changes by your human partner`, run `changes --artifact slides/<id>` and read them before editing the deck, so you build on their order instead of writing it back.\n\n## Feedback\n\nComments are anchored to a slide, usually to a point on it. `comment list --sections threads --detail` shows the slide id, its title, the text under the pin and the message. A comment made on selected blocks lists them as `nodes`, each with its block (`#id`, or its position on the slide) and its text: change those blocks. Edit that slide, keep its id, run `check`, then reply with what changed. A comment whose slide was deleted is listed as an orphan.\n\nRun the returned Check command after every edit. Without a browser it reports XML that does not parse, tags, attributes and values the deck cannot take, files it cannot read, missing or duplicate ids, unknown layouts, missing assets and embeds whose target is not there, each naming its slide. Slides that overflow and code, diagram or formula errors come from the browser: with no browser open the result is pending, not clean.\n',$t='# Storyboard writing\n\nA storyboard plans a product demo video and plays it back before anything is recorded: shots in order, each with a duration, what happens on screen, and voiceover lines that are synthesized and spoken with captions. Write `storyboard.xml` under the returned artifact directory first, with no shot pictures at all: every shot without `src` plays as a title card, so your human partner can hear the pacing within minutes. Add moving pictures, recorded takes, music and sound effects afterwards. On this machine the hub opens a storyboard in an editor: a monitor, a bin and a multitrack timeline (captions, overlay, picture, voice, music, effects) where your human partner trims, splits, reorders, adds transitions, speed, keys and sounds, and exports the next cut.\n\nRe-read `storyboard.xml` and the shot pages immediately before each edit: your human partner edits the timeline, and the server writes those edits into the same file, and moving an overlay rewrites the times of `sb-cursor`, `sb-type` or `sb-clip` in the shot page. Patch only the shots and lines you mean to change and keep every id. Never edit `comments.json`, `audio/`, `cuts/` or `.state/`. Finish with `check`; lines still being voiced are pending, not done.\n\n```xml\n<storyboard title="Shared albums" aspect="16:9" lang="en" voice="Kore" target="10-15">\n <lexicon>\n <say word="Ryugi" as="Lyu-ghee"/>\n </lexicon>\n <music id="bed" src="sound/bed.mp3" at="0" gain="-18" duck="-10" fade-in="1" fade-out="2"/>\n <shot id="hook" title="A wall of text" dur="4">\n <action>The terminal fills with a 300-line plan</action>\n <action>Cut away before anyone could read it</action>\n <line id="hook-1" at="0.4">Your agent wrote 300 lines. Now read them.</line>\n </shot>\n <shot id="sketch" title="Sketch it together" dur="8" src="shots/sketch.html" transition="dissolve" transition-dur="0.4">\n <action>You draw a box; the agent completes the flow</action>\n <key prop="scale" at="2" value="1"/>\n <key prop="scale" at="5" value="1.18" ease="in-out"/>\n <sfx id="click" src="sound/click.wav" at="2.6" gain="-6"/>\n <line id="sketch-1" caption="Sketch it together.">Sketch the structure together, right in the page.</line>\n </shot>\n</storyboard>\n```\n\n## Elements\n\n- `<storyboard>`: `title`; `aspect` is `16:9` (default), `9:16` or `1:1`; `lang`; `voice` is the voice name passed to the voice script; `target` is the intended length as a range of seconds (`"65-80"`), and a total outside it is a warning.\n- `<lexicon>` with `<say word="…" as="…"/>`: pronunciations. Before synthesis every whole-word `word` is replaced by `as`; captions keep the original words.\n- `<shot>`: `id`, `title`, `dur` (seconds, required, one decimal is fine). Optional `src` (a shot page under `shots/`), `take` (a recorded clip under `takes/`) and `take-in` (the second of the take to start from). A shot starts where the shots before it end; never write start times.\n- `<action>`: one thing that happens on screen, one sentence each. Title cards and the script column show them.\n- `<line>`: one voiceover line. `at` is seconds from the shot\'s start; without it the line follows the previous line by 0.3s (the first line starts 0.3s in). `caption` replaces the words shown on screen; without it the caption is the line itself. `gain` is its volume in dB (default 0).\n\nShot and line ids are lowercase letters, digits and hyphens, unique across the whole file; comments are anchored to them.\n\n## Tracks\n\nShots are the spine: everything below is optional, and a storyboard without it is a picture, voice and caption timeline. Times on a shot are seconds from its start on the timeline; music uses whole-video seconds.\n\n- On `<shot>`: `speed` (0.25 to 4, default 1) runs the page clock and the take faster or slower while `dur` stays its length on the timeline; voice, keys and effects are not sped up. `src-in` is the second of the shot page to start from. `transition` is `cut` (default), `dissolve` or `black`, centred on the seam before this shot and `transition-dur` seconds long (default 0.4, at most half the shorter shot); it never changes the total length. `gain` in dB plays a take\'s own sound, which is otherwise muted.\n- `<key prop="…" at="…" value="…" ease="…"/>` inside a shot animates the picture layer: `x` and `y` in design pixels, `scale` as a factor, `opacity` 0 to 1, and `gain` in dB for a take\'s sound. `ease` is `linear` (default), `in`, `out` or `in-out`, easing into that key. One key holds its value for the whole shot; captions do not move.\n- `<sfx id src at gain fade-in fade-out/>` inside a shot plays a sound effect `at` seconds into the shot.\n- `<music id src at from to gain duck fade-in fade-out>` at the top level plays a file from `at` seconds into the video, starting `from` seconds into the file and ending at `to` (default: the end of the video). `duck` lowers it by that many dB while a voice line plays (down in 0.2s, back in 0.4s). Gain `<key prop="gain">` elements inside it change its volume over time, in seconds from `at`.\n- On `<storyboard>`: `mute="music sfx"` silences any of `voice`, `music` and `sfx`, and `captions="off"` hides captions; both carry into the export.\n\nSound files live in `sound/` (mp3, wav, m4a or ogg). Put them there yourself, or your human partner drops them into the editor. `check` reports a track that names a file that is not there.\n\n## Voice\n\nEvery line is synthesized on its own by `voice/voice.mjs` in the artifact directory, which `start` copies from a template the first time (OpenRouter text-to-speech; it reads `OPENROUTER_API_KEY` from the project\'s `.env` and needs ffmpeg). The hub runs it a second after `storyboard.xml` changes, only for lines whose words, voice or lexicon changed. Run `ryugi storyboard voice --artifact storyboard/<id>` to synthesize and print each line\'s length, then fit shot durations to the voice: `check` reports a voiced line that runs past its shot or overlaps the line before it. `--line <id>` voices one line; `--force` re-voices everything after you change the script.\n\n## Shot pages\n\nA shot page is plain HTML with CSS animations, drawn the way the product looks, laid out at 1920×1080 (1080×1920 for `aspect="9:16"`, 1080×1080 for `1:1`) and scaled to fit the player. Time 0 is the shot\'s start; the viewer pauses every animation and seeks it, so scrubbing and frame-by-frame capture show exactly the same frame. Animate only with CSS animations or the Web Animations API, never with `setTimeout`, `setInterval` or `requestAnimationFrame`, and give every animation a finite iteration count. Three elements cover what CSS cannot seek:\n\n- `<sb-clip src="../takes/raw.mp4" from="3.2" to="11.2" at="0.5">` plays part of a recorded video, muted, starting `at` seconds into the shot.\n- `<sb-cursor path="420,300@0 610,340@1.2 click@1.3 700,420@2.4">` moves a pointer through `x,y@seconds` points and ripples on each `click@seconds`.\n- `<sb-type at="2.3" cps="28">text</sb-type>` types its text from `at`, `cps` characters a second.\n\n`sb-cursor` covers the page, so its points are page pixels. Pages cannot reach the network; keep images under `assets/` and refer to them relatively. `check` warns about timers and endless animations, and counts a shot as not yet run until the viewer has shown it.\n\nThe page `…/storyboard/<id>/render` draws only the picture and captions, with transitions, speed and keys, exactly as the editor\'s monitor does (`?captions=0` drops captions, `?from=&to=` draws only that stretch). Its `window.ryugiStoryboard.seek(t)` resolves once that frame is painted, `duration` is the length in seconds, `audio()` lists every voiced line\'s file URL and start, and `mix()` lists every sound with its file, start, end, gain, fades, keys and duck, so any capture tool can step frame by frame and mix the sound in.\n\n## Takes, export and the cut\n\nPut recorded clips in `takes/` and name them with `take` on their shot; the shot then plays the clip under the voiceover, muted unless the shot has a `gain`, and its shot page and overlays are not drawn (put a clip in the page with `sb-clip` to draw over it).\n\nExport renders the timeline into the next cut on this machine. `start` copies an export script to `render/render.mjs` the first time; it drives Chrome over the DevTools protocol and ffmpeg, with no packages to install, renders each shot from the render page frame by frame, reuses shots that did not change, mixes voice, music and effects and writes 1080p H.264. The hub hands it the timeline as JSON on stdin and registers what it writes as the next cut, with a hash of every shot so the editor marks the shots that changed. Run `ryugi storyboard export --artifact storyboard/<id> [--wait]` to export from the command line; lines not yet voiced are voiced first. `ryugi storyboard template --artifact storyboard/<id> --force` replaces `render/render.mjs` with the latest template; without `--force` a script you changed is kept. A project can replace the script with its own kit that reads the same JSON.\n\nWhen a finished video comes from somewhere else, register it with `ryugi storyboard cut --artifact storyboard/<id> --file <1080p.mp4> [--map <map.json>] [--master <4k.mp4>]`. Without `--map` each shot\'s range comes from the storyboard\'s current durations; pass a map (`{"shots":[{"id":"hook","start":0,"end":4.2}]}`) when the cut\'s timing differs. Encode the cut as H.264 1080p at about 1.5 Mbps so it fits the Cloud allowance.\n\n## Comments and references\n\nRead feedback with `comment list`. Comments are anchored to a shot, a line, a moment of a shot (`--at <seconds>`) or a moment of a cut (`--cut <n> --at <seconds>`), which maps to its shot; `comment list` names each thread\'s shot, moment or line, and for an area marked on a recorded take or the cut, the path of its crop. A thread whose shot was deleted stays, marked `shot deleted`. Your human partner can reorder, trim, split and join shots, rewrite titles, actions and voice lines, add, duplicate or delete shots, and set transitions, speed, keys, sounds and mutes in the editor; each edit rewrites only its part of `storyboard.xml`. A split gives the second half the id `<id>-b` and leaves its comments on the first half. When `check` reports `Structure: N changes by your human partner`, run `changes --artifact storyboard/<id>` and read them before editing the file, so you build on their version instead of writing it back. A document or deck links a shot with `<ref storyboard="<id>" shot="<shot-id>"/>`.\n',en=`# Verify report writing
376
-
377
- Write \`verify.xml\` and captured files in \`evidence/\`. Reports cover command output, counts, API behavior, deploy evidence and evals. Claims judged by looking at a screen go in artboard verify groups; reference those groups from the report. Never invent captured output or human verdicts. Report prose uses the human's language; IDs/commands/raw logs retain their form.
378
-
379
- \`\`\`xml
380
- <verify title="Delivery survives reconnect">
381
- <p>Verified against local build.</p>
382
- <claim id="delivery" judge="agent" from="local build @ COMMIT" capturedAt="2026-11-13T10:00:00Z">
383
- <title>Three attempts preserve the delivery</title>
384
- <table>
385
- <tr><th>Measured</th><th>Got</th><th>Expected</th></tr>
386
- <tr><td>Attempts</td><td><code>3</code></td><td>3</td></tr>
387
- <tr><td>Deliveries kept</td><td><code>1</code></td><td>1</td></tr>
388
- </table>
389
- <output src="evidence/delivery.txt"/>
390
- </claim>
391
- <gap id="production"><title>Production run</title><why>No production credentials</why><needs>A test key</needs></gap>
392
- </verify>
393
- \`\`\`
394
-
395
- Required report title; optional one introductory p first; only claim/gap/ref after it, no top-level headings. Claim needs unique stable id, judge, title and evidence. \`from\` identifies actual environment/build; capturedAt is the real ISO capture time, not a future/example timestamp. Update both with replaced evidence. Capture command output directly to evidence/*.txt and never edit it. \`output src="evidence/…"\` keeps it one click away; no HTML output files. Over 200,000 characters is explicitly truncated.
396
-
397
- Above the output, write the result for the person reading: nobody should have to read a log to see what it proved. A claim may hold p, ul/ol, table (tr/th/td), steps (\`step title="…"\` with block children), codeblock, img, alert, details and inline marks. A table or steps directly inside the claim folds its raw output behind one line. Inside a table or steps, inline \`code\` means "copied from this claim's output": write the value exactly as the output prints it, with no rounding and no unit change. Check and the page name any such value the output does not contain, and that claim then waits on the human. Expected values, ordinals and your own wording stay outside \`code\`; commands go in a codeblock.
398
-
399
- judge="agent" means a command decided the stated predicate, ran in the claimed environment, passed and has raw output plus from. Missing evidence/from needs human judgment. A failed check is a fix or gap, never a passed agent claim. judge="human" requires an ask explaining what would make the judgment wrong; use for unresolved nonscreen tradeoffs, not to re-ask approved decisions. A rejected agent claim remains human-owned until the human passes it, even after new evidence.
400
-
401
- Gap needs id/title/why/needs (one specific unblock). \`<ref artboard="slug" group="v2"/>\` links a screen claim. Read via comment list; record pass/reject/waive only if requested by the human, reply on rejection threads and replace evidence after a repair. Stable IDs preserve verdicts/comments. Never edit comments.json or \`.state/\`. Run the returned Check command before sharing.
402
- `;const tn=/^(\s*(?:<\?xml[^>]*\?>\s*)?(?:<!--[\s\S]*?-->\s*)*)<report(?=[\s/>])/;function nn(e){let t=d.default.join(e,ue.verify),n=d.default.join(e,`report.xml`);if(u.default.existsSync(t)||!u.default.existsSync(n))return;let r;try{r=u.default.readFileSync(n,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}let i=r.lastIndexOf(`</report>`),a=tn.test(r)&&i!==-1?`${r.slice(0,i).replace(tn,`$1<verify`)}</verify>${r.slice(i+9)}`:r,o=`${t}.${process.pid}.tmp`;u.default.writeFileSync(o,a),u.default.renameSync(o,t),u.default.rmSync(n,{force:!0})}var rn=`# Whiteboard writing
375
+ `,{flag:`wx`}),!0)}var Kt='# Artboard writing\n\nWrite `canvas.json` and board HTML/media under `pages/`. Re-read canvas before each edit; preserve human edits, stable IDs and positions. Never edit comments.json or `.state/`.\n\n## Writing order\n\nNew artboard or round: apply canvas changes as soon as the structure is ready, before composing a large HTML batch. Scripts and batch writes are fine: canvas first, then HTML with the focus group first; other boards may run in parallel. Existing board content edits need HTML only unless layout, grouping, metadata or focus changes.\n\n## canvas.json\n\n```json\n{\n "version": 1,\n "title": "Delivery settings",\n "activePage": "settings",\n "pages": [{ "id": "settings", "name": "Settings" }],\n "boards": {\n "q1-a": { "file": "pages/settings/a.html", "page": "settings", "x": 0, "y": 0, "w": 640, "h": 400, "title": "Fixed delay" },\n "q1-b": { "file": "pages/settings/b.html", "page": "settings", "x": 720, "y": 0, "w": 640, "h": 400, "title": "Exponential" }\n },\n "groups": {\n "q1": { "title": "Retry strategy", "boards": ["q1-a", "q1-b"], "choose": true, "recommend": "q1-b" }\n },\n "notes": {\n "round-one": { "kind": "title", "page": "settings", "x": 0, "y": -300, "text": "Retry strategy" }\n }\n}\n```\n\n- **Title**: readable, distinct from the slug.\n- **Boards**: HTML boards require file/page/x/y/w/h; title/interactive are optional. Media boards use type:"image"|"video" and src instead of file.\n- **Resources**: relative paths under pages/; other directories are not served. Limits: 8MB per media file, 20MB per artboard. Video: mp4(H.264)/webm. Verify clips trim idle ends with one second context and retain originals; trim:false preserves timing/narration. Check recordings/pending before handoff.\n- **Tokens**: the product\'s tokens live in one `pages/tokens.css`, linked by every board; never copy token values into each board.\n- **Groups** contain board IDs from one page: plain groups organize, choose:true + recommend:<member> asks a choice, verify:true + from:<environment/build> + capturedAt:<real ISO capture time> asks a verdict. Never combine choose and verify.\n- **Notes** require kind (title/sticky/condition), page/x/y/text; title size defaults to 96, optional w wraps; sticky w defaults to 240, optional color is #RGB/#RRGGBB.\n- **Edges** connect boards that follow one another: see Flows.\n- **Opening view**: activePage is the opening default; existing readers keep their page. focus `{target:<board/group/note>,at:<fresh ISO time>}` guides first ready content/phone question without resetting open camera/drafts. Share ?page=<id> for a new area.\n- **Spacing** is explicit: 80px horizontal board gap, 160px row gap; group frame 144px above and 48px outside boards. Leave 240px vertically/200px horizontally between groups; notes >=80px clear.\n- **Appending**: read `.state/artboard/<id>/layout.json` for actual group/note rectangles and page bounds first. A new round starts below maxY, title at maxY+120 then boards below title+80+144.\n- **Sizes**: desktop1280x800, phone402x874, tablet834x1194, component640x400. Frame height clips without warning: size h to content.\n\n## Flows\n\nWhen boards are steps of one path (an action on one screen opens the next, a condition forks, an error leads back), draw the path: connect them with `edges` and use condition notes for branches. Boards that are options to compare stay unconnected in a group. The viewer routes lines and keeps them attached when nodes move. Edit `edges` to change connections.\n\n```json\n{\n "version": 1,\n "title": "Publish flow",\n "pages": [{ "id": "flow", "name": "Flow" }],\n "boards": {\n "artboard": { "file": "pages/flow/artboard.html", "page": "flow", "x": 0, "y": 0, "w": 1280, "h": 800, "title": "Artboard" },\n "sign-in": { "file": "pages/flow/sign-in.html", "page": "flow", "x": 2308, "y": 1200, "w": 1280, "h": 800, "title": "Sign in" },\n "share": { "file": "pages/flow/share.html", "page": "flow", "x": 4068, "y": 0, "w": 1280, "h": 800, "title": "Share panel" }\n },\n "notes": {\n "signed-in": { "kind": "condition", "page": "flow", "x": 1760, "y": 328, "text": "Signed in?" }\n },\n "edges": {\n "publish": { "from": "artboard", "to": "signed-in", "label": "Click Publish" },\n "yes": { "from": "signed-in", "to": "share", "label": "Yes" },\n "no": { "from": "signed-in", "to": "sign-in", "label": "No" },\n "done": { "from": "sign-in", "to": "share", "label": "Signed in" }\n }\n}\n```\n\nEdge `from`/`to` reference board or condition IDs on one page; boards and notes share an ID space. Optional `label`: one line, at most 32 characters. Conditions require page/x/y/text, one incoming edge and at least two outgoing edges, each labelled. They are 96px tall, text-width, without wrapping.\n\nLay out flows on a grid with 480px between connected boards and on each side of a condition. Align a condition with a board at `y + (h - 48) / 2 - 48` (the name strip is 48px). Keep the main path on one row and branches below, clear of other boards.\n\nFix `edge "<id>" crosses board "<id>"` notices by moving boards or conditions; lines cannot be routed by hand. Conditions must not cover boards.\n\n## Board HTML\n\nWrite complete HTML ending `</html>` (last when streaming), inline CSS/scripts, html/body margin0. Missing or unfinished files stay pending. Use native, accessible labelled controls with visible state changes. Static by default; interactive:true enables PLAY.\n\nEach board/expanded view has independent iframe state: use memory, no localStorage/sessionStorage/cookies. Keep shared-state flows in one board; relative links stay inside its iframe. Replay, HTML edits and page changes/reloads reset prototype state; selected/playing/tweaked frames stay mounted on the same page.\n\n`ryugi-icon name="copy" size="18"` supplies Lucide icons; label actions. For JS-only icons add meta name="ryugi-icons" content="1" and await custom element definition.\n\n## Feedback\n\nChoice lifecycle: title notes define rounds. Read comment list --sections threads,groups,rounds --detail; act only on submitted rounds and read their threads. If human answered in terminal, record actual picks with comment choose and comment submit --round <id>. Withdrawal means wait. Add next round below, not over the old one. Documents can reference groups/boards using inline ref; preserve referenced keys.\n\nMarked comments: each `marked` line describes one mark. A box on an image or video board can end with `· at t=<s>` (the video frame) and `· crop <path>`: open that JPEG with your image reader before acting; it shows what the box covers.\n\nVerify lifecycle: put screen evidence in new verify groups with real from/capturedAt and language-matched titles/stickies. Record pass/reject only on human instruction. On rejection, repair behavior, replace evidence (resets pending), reply and leave the thread open; passing closes it. Preserve passed evidence unless asked. Command-output claims/gaps belong in a verify report. Run Check after writing; clear pending/warnings before claiming ready and inspect screenshots/recordings for visual claims.\n\n`browser_not_run:<board>` means no browser has loaded that board since its file, or a file under `pages/` that is not a board, last changed. Boards load only on the open page and near the view: open the artboard, go to each page Check lists under `Show` (`?page=<id>`), bring those boards into view, then run Check again. Editing one board or moving boards keeps the other boards\' results. With no browser to open, report Check as incomplete.\n\n## Selection and node IDs\n\nFor "here", "selected", Inspector changes or a node ID (`hero-2#7`), read `.state/artboard/<id>/selection.json`:\n\n- `selected`: file, CSS path from body, text, html, tweaks (`property/from/value`); `more` counts omitted nodes.\n- `boards`, `notes`: selected canvas IDs, omitted when empty.\n- `tweaks`: Inspector changes outside the selection.\n- `nodes`: all node IDs with file/path; query only the requested ID, never dump the list.\n\n```bash\njq \'{selected, more, boards, notes, tweaks}\' \'.ryugi/artifacts/.state/artboard/<id>/selection.json\'\n```\n\nFor a typed ID: `jq \'.nodes[] | select(.id == "hero-2#7")\' …/selection.json`. A harness-attached selection carries the same data. Edit its file/path; Inspector tweaks become source only when you write them. IDs renumber on every board reload/edit: resolve against current nodes and ask for a fresh ID before a later edit to that board.\n\n## Author-declared parameters\n\nExpose deliberate controls with one JSON declaration before any JS that reads it. The viewer supplies Parameters; phone uses defaults. Inspector Tweaks remain CSS overrides.\n\n```html\n<script type="application/json" data-ryugi-tweaks>\n {\n "version": 1,\n "controls": { "accent": { "type": "color", "default": "#b45309" } }\n }\n<\/script>\n```\n\nEach control needs `type` and `default`; optional `label` defaults to its key, `section` groups controls. Keys: letter first, then letters/digits/underscores/hyphens, <=64 characters, unique ignoring case.\n\n| Type | Values and extra fields |\n| --------- | ----------------------------------------------------------------- |\n| `color` | Six-digit hex; optional `options` list supplies swatches |\n| `range` | Number; requires `min` and `max`; `step` defaults to 1 |\n| `number` | Finite number; optional `min`, `max`, `step` |\n| `boolean` | `true` or `false` |\n| `enum` | String; `options` is a list of strings or `{value,label}` objects |\n| `text` | String, at most 512 characters |\n\nDefaults/updates must match type, bounds, step and options. Limits: 32 controls, 32 choices per control. Invalid JSON/defaults or duplicate declarations show a Parameters error.\n\nValues set `--tweak-<key>` and `data-tweak-<key>` on `<html>`; numbers are unitless (`calc(var(--tweak-radius, 12) * 1px)`). `window.ryugiTweaks` gives a typed snapshot; `document` emits `ryugi-tweaks` with all updated values in `event.detail`. Keep ordinary copy literal; expose text controls only for cross-cutting values or requested editable copy.\n\nControl changes and Reset apply without reload, preserving unrelated app state. Canvas/expanded instances share values per board; other boards are independent. Replay, source edits and page switches retain valid overrides; untouched defaults follow source changes, removed/invalid overrides fall back to defaults. Viewer refresh resets to defaults. Reset affects parameters only; preview values never write HTML or publish.\n\nTest the host Parameters control, each value, Reset, Replay and expanded view before claiming it works; appearance changes must preserve in-progress interactions.\n',qt='# Document writing\n\nWrite `doc.xml` under the returned artifact directory; put assets in `assets/`. Re-read immediately before each edit: the human and server edit this file too. Patch intended blocks, preserve existing IDs and human text; new blocks omit IDs and receive them from the server. Never edit `comments.json` or `.state/`. The server normalizes aliases and indentation after saving. Finish with `check`; pending merging or browser work means check again, not success.\n\nUse a closed `<doc>`. Choose blocks for the reader: diagrams show relationships, charts compare numbers, tables map exact attributes, prose explains reasons. A first draft can contain `<pending intent="What remains to investigate"/>`; fill every pending before claiming completion. Diagrams use native mermaid, or a whiteboard of this project embedded with a reference (below); never pictures of text or box drawing in code blocks.\n\nComplete block and inline vocabulary:\n\n- `h1`–`h6`, `p`, `blockquote`, `ul`/`ol` with `li`, `table`/`tr`/`th`/`td`, `hr`.\n- Inline `b i u s code sub sup mark a br`; aliases `strong em del strike`. Links use `href`. Ordered lists accept `start`; checklists use `<ul type="check"><li checked="true">Done</li></ul>`.\n- `codeblock lang="ts"`: code; use CDATA for literal XML/angle brackets. `mermaid`: native flowcharts/sequences/states. `math`: inline LaTeX, `display="block"` for a block.\n- `img src="assets/image.png" alt="…" caption="…" width="640"`: real images.\n- `alert type="note|tip|important|warning|caution"`: block children. `details summary="…" open="true"`: collapsed depth; omit open for collapsed. `steps` contains `step title="…"` with block children; titles omit numbering.\n- `footnote ref="1"` inline; `footnote-section` contains `def ref="1"` definitions.\n- `chart`: CDATA ChartSpec JSON. Required `version:1`, `type:bar|line|area|pie`, `x` category field, `series:[{key,label?}]`, `data` rows containing x and every series key. Values numbers/null, pie nonnegative. At most 6 series and 6 pie rows. Optional title/subtitle/note/source/xLabel/stacked/donut/highlight, format `{unit,compact,decimals,signed}`, y `{min,max}`, refs `[{y,label}]`. `highlight` is a `series.key` and highlights that entire series; omit it when unnecessary. With `series:[{key:"failures"}]` and rows `[{phase:"Before",failures:12},{phase:"After",failures:4}]`, `highlight:"failures"` is valid; `highlight:"After"` is invalid because it is a row/category value.\n- `dynamic url="assets/demo.html" initial-height="240"`: CDATA JSON becomes `window.ryugiProps`. Self-contained sandboxed HTML, inline scripts/styles, size by content, transparent body. Browser controls persist on HTML rewrite; changing props resets them. Runtime is incomplete until the block has run. Native HTML/CSS/JS and `ryugi-icon` work; storage/cookies do not.\n- `pending intent="…"`, inline `ask`/`option` and `ref` (below; a whiteboard `ref` can also embed as a block). Other tags are rejected.\n\n```xml\n<doc>\n <h1>Retry policy</h1>\n <p>Retry failed delivery at most <b>3</b> times.</p>\n <mermaid><![CDATA[flowchart LR\n ingress --> queue --> worker]]></mermaid>\n <p>Choose a strategy: <ask id="retry-strategy" recommend="exponential"><option value="fixed">Fixed delay</option><option value="exponential">Exponential backoff</option></ask></p>\n <details summary="Evidence"><codeblock lang="text"><![CDATA[attempts: 3]]></codeblock></details>\n</doc>\n```\n\nQuestions: `ask` is inline in p/li/table-cell paragraphs, never directly under doc. Its unique stable id is lowercase letters/digits/hyphens; never reuse an old question ID. Options contain plain text and distinct `value`s; `recommend` must name an option. No options makes an open question: `<ask id="other" placeholder="Describe it"/>`. Human picks are drafts until submitted. Read `comment list --sections threads,asks --detail`. Apply submitted answers, then `comment note --ask <id> --text <what changed>`. Every submitted question needs a note, even unanswered ones (state what was left or assumed). Record terminal answers only when actually supplied via `comment answer --ask <id> --choice <value>` or `--text`, then `comment submit`. Never invent an answer; wait after withdrawal. Changed settled answers require a human instruction and a fresh note.\n\nReferences: inline `<ref document="slug"/>`, `<ref html="slug">label</ref>`, `<ref artboard="slug" group="q1"/>` (or board), `<ref whiteboard="slug" frame="f1"/>` (or page), `<ref slides="slug" slide="slide-id"/>` (a deck, or one slide of it). Exactly one kind, at most one allowed subtarget, lowercase slug. Optional plain text label; server adds `to` when resolved, preserve it. Missing targets are warnings; clear before handoff. Keep referenced IDs stable; when changing a target, update the reference too. A reference under its section heading connects that section to its companion canvas. Live choices/verdicts belong in refs, not duplicated prose.\n\nEmbedded whiteboards: `<ref whiteboard="slug" frame="f1" embed="true"/>` draws the whiteboard in the document instead of a chip. Write it as a paragraph of its own directly under `<doc>`, e.g. `<p><ref whiteboard="sync-flow" frame="f-steps" embed="true"/></p>`; never beside text, in a list, table or quote. `frame` shows that frame cut to its box, `page` one page, neither the main page. Only whiteboard references embed. The drawing follows the whiteboard live: draw and change it on the whiteboard, not in the document; a reader clicks it to open the whole whiteboard. A missing whiteboard or frame is the same check warning as any reference.\n\nAfter editing, run the returned Check command. It names invalid blocks, chart/math/diagram errors, unresolved refs and pending dynamic work. Read complete feedback before acting; reply/resolve and acknowledge only the receipt for evidence actually used.\n',Jt='# HTML writing\n\nWrite one complete `index.html` with a descriptive `<title>`, inline or relative styles/scripts/images. The page reloads on edits. Native HTML/CSS/JavaScript works; use labelled controls and visible results. Assets stay inside this artifact directory; CDN fonts/scripts work, absolute local paths do not. The iframe is sandboxed: localStorage/sessionStorage/cookies throw; keep state in DOM/variables. Popups, forms, downloads and clipboard work.\n\n```html\n<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>Retry explorer</title>\n </head>\n <body>\n <label>Attempts <input id="attempts" type="range" min="1" max="5" value="3" /></label>\n <output id="result"></output>\n <script>\n const input = document.getElementById(\'attempts\');\n const render = () =>\n (document.getElementById(\'result\').textContent = input.value + \' attempts\');\n input.addEventListener(\'input\', render);\n render();\n <\/script>\n </body>\n</html>\n```\n\nStable control IDs preserve human input, checks, details and scroll across rewrites. Restoration fires input/change: render from those events. Script-only state resets. Use one surface for one investigation; comparison across independent screens belongs on an artboard. Re-read files before editing; never edit comments or `.state/`.\n\nBundled UI elements require no imports. Use native HTML/CSS for layout. `ryugi-icon name="message-square" size="18"` provides Lucide kebab-case icons (stroke-width defaults 2, color currentColor); label the button, icons are decorative. Unknown names become runtime warnings. For JS-only icons add `<meta name="ryugi-icons" content="1">` and await customElements.whenDefined(\'ryugi-icon\'). Preview glyphs map to the app\'s existing business icons when implementing the design.\n\nRun Check after edits. It distinguishes current static evidence from browser runtime. A closed/unloaded tab means runtime pending; open the returned URL and check again. Uncaught exceptions, rejected promises and missing relative assets are warnings; no browser run is not proof that a page works.\n\n# UI components\n\nHTML artifacts can use a small set of Lobe UI components through Web\nComponents. The artifacts server loads the runtime automatically when the page\ncontains a `<ryugi-…>` element:\n\n```html\n<ryugi-button variant="primary">Save</ryugi-button>\n```\n\nNo script tag is needed. If you create components dynamically, add\n`<meta name="ryugi-ui" content="1">` to the page so the runtime is loaded.\n\nThe runtime loads with `defer`. A page script that needs the components should\nwait for the document event:\n\n```js\ndocument.addEventListener(\n \'ryugi-ui:ready\',\n () => {\n // custom elements are defined\n },\n { once: true },\n);\n```\n\nUse these for controls and basic display. Use plain HTML and CSS for layout;\nthere is no layout wrapper to learn.\n\n## Rules\n\n- Give every interactive control a stable `id`. The viewer restores custom\n controls across rewrites by `id`, the same way it restores native inputs.\n- Listen for `ryugi-change` on controls:\n\n ```js\n document.addEventListener(\'ryugi-change\', (event) => {\n const { value, checked } = event.detail;\n console.log(event.target.id, value, checked);\n });\n ```\n\n It bubbles. `value` is a string, number, boolean, or `null`; `checked` is\n present for checkboxes and switches.\n\n- `value` / `checked` attributes set the initial state. Read the current state\n from the element\'s `value` / `checked` property after `ryugi-ui:ready`, and\n listen for `ryugi-change` for later updates.\n- `class` styles the host; `style` is forwarded to the component as well, so\n `style="width:100%"` works. Style the host, not the component\'s internal\n classes.\n- Keep children simple. For `ryugi-button`, `ryugi-card`, `ryugi-text`,\n `ryugi-tag`, `ryugi-checkbox`, and `ryugi-badge`, the original children are\n moved into the component. `ryugi-select`, `ryugi-segmented`, and\n `ryugi-radio-group` use option children instead.\n- Do not invent a `ryugi-` tag. If a component is not listed here, use HTML.\n- `ryugi-card` already paints a surface. Do not put a background, border and\n padding on both the host and the card: pick one. For a floating panel,\n either position the host and let the card paint its own surface, or make the\n host the surface and use `variant="borderless"` without `glass`/`shadow`.\n- Components follow `prefers-color-scheme`. Set `<html data-theme="light">`\n or `data-theme="dark"` before the runtime loads to pin the whole page.\n Without an explicit theme, the runtime follows OS theme changes.\n Lobe tokens such as `--lobe-color-primary` can be overridden on the host or\n page.\n\n## Controls\n\n### Button\n\n```html\n<ryugi-button variant="primary" size="middle" icon="plus">Add</ryugi-button>\n<ryugi-button variant="outlined" loading>Working…</ryugi-button>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`), `size`\n(`small`, `middle`, `large`), `block`, `loading`, `disabled`, `shape`, `type`,\n`icon` (any Lucide kebab-case name; `refresh` and `trash` remain aliases).\nRun `node app/ryugi.cjs guide icons` for standalone icons and mapping the preview\'s\nactions to business icons when implementing the app.\n\nUses the native `click` event.\n\n### Action icon\n\n```html\n<ryugi-action-icon icon="settings" title="Settings" aria-label="Settings"></ryugi-action-icon>\n```\n\nAttributes: `icon` (same set as Button), `size`, `disabled`, `title`,\n`aria-label`. Uses the native `click` event.\n\n### Tooltip and popover\n\n```html\n<ryugi-tooltip content="Copy a private link" placement="top">\n <ryugi-icon name="copy" size="14"></ryugi-icon> Copy\n</ryugi-tooltip>\n<ryugi-popover id="sharing" content="Only people you invite can open this link.">\n Sharing details\n</ryugi-popover>\n```\n\nBoth provide a native button trigger; children are its label and decorative\nicons, not nested buttons or controls. `content` is plain text, `placement`\nsets the floating position. Tooltip opens on hover/focus; Popover opens on\nclick (`trigger="hover"` opts into hover). Tooltip also accepts `open` for\na controlled preview. Native trigger clicks still reach your handlers.\n\n### Action menu\n\n```html\n<ryugi-menu id="actions" label="More" icon="ellipsis">\n <ryugi-menu-item value="copy" icon="copy">Copy link</ryugi-menu-item>\n <ryugi-menu-item value="delete" icon="trash-2" disabled>Delete</ryugi-menu-item>\n</ryugi-menu>\n```\n\nAttributes: `label`, `icon`, `placement`, `disabled`. Items accept `value`,\n`icon`, `disabled`; their text is the label. Selecting an enabled item emits\n`ryugi-change` with its action in `event.detail.value`. Actions are not\nrestored as control values on reload.\n\n### Input\n\n```html\n<ryugi-input id="title" placeholder="Title" value="Ryugi" style="width:100%"></ryugi-input>\n```\n\nAttributes: `type`, `size` (`small`, `middle`, `large`), `variant`\n(`filled`, `outlined`, `borderless`), `allowClear`, `placeholder`, `value`,\n`disabled`, `name`, `aria-label`.\n\n### Textarea\n\n```html\n<ryugi-textarea id="notes" rows="4" placeholder="Notes" style="width:100%"></ryugi-textarea>\n```\n\nAttributes: `rows`, `size`, `variant`, `placeholder`, `value`, `disabled`,\n`name`.\n\n### Number\n\n```html\n<ryugi-input-number id="count" value="12" min="0" max="100" step="1"></ryugi-input-number>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `precision`, `controls`, `size`,\n`variant`, `placeholder`, `disabled`.\n\n### Slider\n\n```html\n<ryugi-slider id="size" value="32" min="0" max="100" step="1"></ryugi-slider>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `disabled`.\n\n### Slider with number input\n\nThe most useful control for tuning an exact value.\n\n```html\n<ryugi-slider-input id="radius" value="8" min="0" max="32" step="1"></ryugi-slider-input>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `controls`, `size`, `variant`,\n`disabled`.\n\n### Switch\n\n```html\n<ryugi-switch id="dark" checked></ryugi-switch>\n```\n\nAttributes: `checked`, `loading`, `size`, `disabled`, `name`.\n\n### Checkbox\n\n```html\n<ryugi-checkbox id="compact">Compact</ryugi-checkbox>\n```\n\nAttributes: `checked`, `shape`, `size`, `disabled`, `name`. Children are the\nlabel.\n\n### Segmented\n\n```html\n<ryugi-segmented id="mode" value="grid">\n <ryugi-segment value="list">List</ryugi-segment>\n <ryugi-segment value="grid">Grid</ryugi-segment>\n <ryugi-segment value="masonry">Masonry</ryugi-segment>\n</ryugi-segmented>\n```\n\nAttributes: `value`, `size` (`small`, `middle`, `large`), `variant`\n(`filled`, `outlined`), `block`, `glass`, `shadow`, `vertical`, `disabled`.\n\n### Select\n\n```html\n<ryugi-select id="layout" value="a" placeholder="Choose layout">\n <ryugi-option value="a">Sidebar</ryugi-option>\n <ryugi-option value="b">Top tabs</ryugi-option>\n <ryugi-option value="c">Bottom rail</ryugi-option>\n</ryugi-select>\n```\n\nAttributes: `value`, `placeholder`, `size`, `variant`, `allowClear`,\n`showSearch`, `loading`, `mode` (`multiple`, `tags`), `disabled`.\n\n### Radio group\n\n```html\n<ryugi-radio-group id="density" value="comfortable">\n <ryugi-radio value="compact">Compact</ryugi-radio>\n <ryugi-radio value="comfortable">Comfortable</ryugi-radio>\n <ryugi-radio value="spacious">Spacious</ryugi-radio>\n</ryugi-radio-group>\n```\n\nAttributes: `value`, `horizontal`, `gap`, `size`, `disabled`.\n\n### Colour picker\n\n```html\n<ryugi-color-picker id="accent" value="#c56473" trigger="field"></ryugi-color-picker>\n```\n\nAttributes: `value`, `alpha`, `defaultFormat` (`hex`, `rgb`, `hsl`),\n`trigger` (`swatch`, `field`, `chip`), `size`, `disabled`.\n\n## Display\n\n### Toast\n\nHTML artifacts can call the bundled Lobe UI toast API as `window.ryugiToast`.\nIf the page has no `ryugi-` UI controls, opt in with the meta tag. Wait for\n`ryugi-ui:ready` before calling it:\n\n```html\n<meta name="ryugi-ui" content="1" />\n<button id="save" type="button">Save</button>\n<script>\n document.addEventListener(\n \'ryugi-ui:ready\',\n () => {\n document.getElementById(\'save\').addEventListener(\'click\', async () => {\n try {\n await saveDraft(); // the page\'s own operation\n window.ryugiToast.success({ id: \'save-result\', title: \'Saved\' });\n } catch {\n window.ryugiToast.error({\n id: \'save-result\',\n title: \'Save failed\',\n description: \'Try again.\',\n });\n }\n });\n },\n { once: true },\n );\n<\/script>\n```\n\nMethods: `success`, `error`, `info`, `warning`, `loading`. Each takes a string\nmessage or `{ title, description, id, duration }`. Text is rendered as text,\nnot HTML. A stable `id` refreshes the same notification instead of stacking\ncopies. The default duration is 5000ms; `duration: 0` stays until closed.\n`loading` stays until closed by default.\n\nCalls return a handle with `id` and `close()`. Use\n`window.ryugiToast.dismiss(id)` to close one, or `dismiss()` to close all.\nToasts appear at the bottom right and follow the page\'s theme. They are\ntransient: rewriting the page does not restore them. No `ryugi-toast` tag is\nneeded. Artboard pages do not load this UI runtime.\n\n### Tag\n\n```html\n<ryugi-tag variant="outlined">New</ryugi-tag>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`, `solid`), `size`,\n`shape` (`normal`, `round`), `color`, `closable`.\n\n### Alert\n\n```html\n<ryugi-alert\n type="info"\n title="Streaming"\n description="Pending boards draw as skeletons."\n></ryugi-alert>\n```\n\nAttributes: `type` (`success`, `info`, `warning`, `error`, `secondary`),\n`variant` (`soft`, `outlined`, `plain`), `title`, `description`, `showIcon`,\n`closable`. Text children are used as the title when `title` is absent.\n\n### Progress\n\n```html\n<ryugi-progress percent="64" size="small"></ryugi-progress>\n```\n\nAttributes: `percent`, `size`, `status`.\n\n### Badge\n\n```html\n<ryugi-badge count="3" status="processing"></ryugi-badge>\n<ryugi-badge count="3">\n <ryugi-avatar src="avatar.png" alt="Innei" size="32"></ryugi-avatar>\n</ryugi-badge>\n```\n\nAttributes: `count`, `dot`, `status`, `text`, `showZero`, `size`, `color`.\n\n### Avatar\n\n```html\n<ryugi-avatar src="avatar.png" alt="Innei" size="32"></ryugi-avatar>\n```\n\nAttributes: `src`, `alt`, `size`, `shape`.\n\n### Divider\n\n```html\n<ryugi-divider dashed></ryugi-divider>\n```\n\nAttributes: `orientation`, `dashed`.\n\n### Card\n\n```html\n<ryugi-card variant="outlined" shadow>\n <ryugi-text strong>Header</ryugi-text>\n <ryugi-text type="secondary">Supporting copy.</ryugi-text>\n</ryugi-card>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`), `shadow`,\n`glass`, `clickable`. Children are preserved, including nested components.\n`glass`, `shadow` and `variant` paint the inner Block surface, not the host.\nIf the host supplies the panel background and padding, omit `glass`/`shadow`\nand use `variant="borderless"` so there is only one visible container.\n\n### Text\n\n```html\n<ryugi-text type="secondary">Secondary body text</ryugi-text>\n<ryugi-text strong>Strong label</ryugi-text>\n<ryugi-text code>const x = 1</ryugi-text>\n```\n\nAttributes: `type` (`secondary`, `success`, `warning`, `danger`, `info`),\n`strong`, `code`, `italic`, `underline`, `delete`, `mark`, `align`, `weight`.\n\n## Complete tuning panel\n\n```html\n<ryugi-card>\n <ryugi-text strong>Header</ryugi-text>\n <ryugi-text type="secondary">Tune the reading column.</ryugi-text>\n\n <ryugi-slider-input id="measure" value="64" min="40" max="90" step="1"></ryugi-slider-input>\n\n <ryugi-segmented id="density" value="comfortable">\n <ryugi-segment value="compact">Compact</ryugi-segment>\n <ryugi-segment value="comfortable">Comfortable</ryugi-segment>\n <ryugi-segment value="spacious">Spacious</ryugi-segment>\n </ryugi-segmented>\n\n <ryugi-switch id="dark"></ryugi-switch>\n <ryugi-tag>Live preview</ryugi-tag>\n</ryugi-card>\n\n<script>\n document.addEventListener(\'ryugi-change\', (event) => {\n document.body.dataset[event.target.id] = event.detail.value;\n });\n<\/script>\n```\n\n## Not included in the first version\n\nTabs, Modal, Drawer, Table, DatePicker, and layout\ncomponents. Use plain HTML/CSS or a later component if one is added.\n',Yt='## Mockup components\n\n`<ryugi-ios-shell>` draws the device and nothing else: the screen (402×874, iPhone 17), status bar, Dynamic Island, home indicator and, with `bezel`, the frame (442×914). Size phone boards to match. Never hand-draw those parts. Everything on the screen (navigation bar, glass buttons, tab bar, cards, lists, inputs, sheets, a floating composer) is the product\'s own design system: write it by hand in HTML/CSS from the variables of `tokens.css`, in the product\'s own style, including its own Liquid Glass where the product uses it. Do not imitate iOS Settings rows unless the product\'s own screens look like that. The shell renders in light DOM, so selection, comments and the Inspector reach every part. The server loads it when the page contains the tag; for a shell created by script add `<meta name="ryugi-mockup" content="1">` and wait for `ryugi-mockup:ready` on `document`.\n\n```html\n<!doctype html>\n<html lang="zh">\n <head>\n <meta charset="utf-8" />\n <link rel="stylesheet" href="../tokens.css" />\n <style>\n html,\n body {\n margin: 0;\n }\n .nav {\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 44px;\n padding: 0 16px;\n }\n .mark {\n font: 700 26px/32px var(--font-display);\n color: var(--color-text);\n }\n .glass {\n display: flex;\n border-radius: 22px;\n background: var(--color-glass);\n backdrop-filter: blur(16px) saturate(1.8);\n color: var(--color-text);\n }\n .glass > * {\n display: grid;\n place-items: center;\n width: 44px;\n height: 44px;\n }\n .card {\n margin: 8px 16px;\n padding: 16px;\n border-radius: var(--radius-card);\n background: var(--color-surface);\n }\n </style>\n </head>\n <body>\n <ryugi-ios-shell>\n <div class="nav">\n <span class="mark">喵旅</span>\n <span class="glass">\n <span\n ><ryugi-icon symbol="person.crop.circle" name="circle-user" size="22"></ryugi-icon\n ></span>\n <span><ryugi-icon symbol="plus" name="plus" size="22"></ryugi-icon></span>\n </span>\n </div>\n <section class="card">…</section>\n </ryugi-ios-shell>\n </body>\n</html>\n```\n\nThe variable names in the example (`--font-display`, `--radius-card`, `--color-glass`) stand for roles; use the names the product\'s own `tokens.css` defines.\n\n| Element | Attributes | Children |\n| ------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `ryugi-ios-shell` | `bezel`, `time` (9:41), `hide="status island home all"` (any of them) | the screen content: it flows from below the status bar (`--safe-top`, 62px); absolutely positioned content measures from the screen\'s top edge. `--safe-bottom` is 34px. Both stay when parts are hidden |\n| `ryugi-token-sheet` | `appearance` to show one set only | one `<script type="application/json">` |\n\nBoth take `appearance="light|dark"`, otherwise follow the nearest `[data-appearance]`, then the system. Unknown attribute values raise a runtime warning.\n\nIcons: `<ryugi-icon name>` is a Lucide icon. Add `symbol`, an SF Symbol name (`wallet.bifold.fill`): when the local server runs on macOS it draws the symbol through the system and shows it at the symbol\'s own proportions, tinted with `currentColor`; anywhere else (other systems, Ryugi Cloud, published links) the Lucide icon shows. Write both. Use `symbol` only in mockups of apps for Apple platforms; that is the condition of Apple\'s license. Symbol images are never part of `pages/` and are never published.\n\nProduct tokens live in one stylesheet (on an artboard `pages/tokens.css`), light on `:root`, dark on `[data-appearance="dark"]`. The shell\'s root carries `data-appearance`, so light and dark phones sit side by side and your content under `[data-appearance="dark"]` flips with them. The shell reads `--color-bg` (screen), `--color-text` (status bar, home indicator) and `--font-body`, falling back to iOS system values; the token sheet also reads `--color-text-secondary`, `--color-separator`, `--color-surface`, `--color-fill` and `--color-accent`. Your content reads the same variables plus the product\'s own (radius, spacing, type, glass).\n\n`ryugi-token-sheet` draws the token table from JSON that names tokens, never values; values come from the stylesheet in both appearances:\n\n```json\n{\n "groups": [\n {\n "name": "Text",\n "kind": "color",\n "tokens": [\n {\n "name": "--color-text-secondary",\n "use": "行右侧的值",\n "on": "--color-surface",\n "board": "t-color-a"\n }\n ]\n },\n {\n "name": "Type",\n "kind": "type",\n "tokens": [{ "name": "--type-body", "use": "正文", "sample": "招商银行储蓄卡" }]\n }\n ]\n}\n```\n\nKinds: `color` (swatches; with `on`, WCAG contrast per appearance flagged under 4.5:1, or 3:1 with `"large": true`), `type` (a `font` shorthand), `space`, `radius`, `size`, `shadow`, `motion` (`<duration> <easing>`, click to play). Token and group names are English; `use` and `sample` follow the product\'s language. Missing variables and broken JSON show inline errors.\n',Xt="## Phone mockups\n\nEvery phone screen is a `<ryugi-ios-shell>`: it draws the 402×874 screen, status bar, Dynamic Island and home indicator, and `bezel` adds the 442×914 frame. Never hand-draw those parts; everything on the screen is the product's own design from its `tokens.css`. Before the first phone screen or `<ryugi-token-sheet>`, read the mockup guide: `start --artifact <artifact> --help --mockup`.\n",Zt='# Report writing\n\nA report is data and presentation kept apart. Each data source is a Node script that prints JSON; the report is `report.tsx`, one default-exported component built only from `@ryugi/report` that imports the data it draws.\n\n```\nreport/<id>/\n report.tsx\n sources/<source-id>/source.json\n sources/<source-id>/<script>.mjs\n data/<source-id>.json written by the hub when a source runs; never write it by hand\n assets/<file>.png images the report shows (png, jpg, gif, webp, avif, svg)\n```\n\n## Data sources\n\n`sources/<source-id>/source.json`: `{ "title": "Commits per day", "description": "main branch, last 30 days", "input": "git history of the repo", "script": "collect.mjs", "args": ["--days", "30"] }`. `title` and `script` are required; the script is a `.mjs`, `.js` or `.cjs` file in the same folder. Source ids are kebab-case.\n\nThe script runs with the project root as cwd and Node from the hub, so it can use the project\'s `node_modules`. Its env is the hub\'s env with the project\'s `.env` and `.env.local` laid over it; read secrets and machine paths from env or `args`, never write them into the script. It must print one JSON value on stdout (at most 2 MB; the whole report\'s data at most 10 MB) and exit 0 within 60 s. Do the aggregation in the script: the report only draws. A stderr line `ryugi:input <text>` replaces the input shown in the panel for that run, such as the commit the data was read at; other stderr is shown when the run fails.\n\nRun sources with `ryugi report refresh --artifact report/<id>` (all) or with `--only <source-id>` (one). The hub runs them, one run per source at a time, and writes `data/<source-id>.json`. Refresh after adding or changing a source, and before `check`. Reports fetched from someone else\'s Cloud link are read-only: never run their scripts.\n\n## report.tsx\n\n```tsx\nimport {\n BarChart,\n Grid,\n Report,\n Section,\n Stat,\n Table,\n useMemo,\n useState,\n Param,\n} from \'@ryugi/report\';\nimport days from \'./data/commits-per-day.json\';\n\nexport default function Commits() {\n const [span, setSpan] = useState(14);\n const shown = useMemo(() => days.slice(-span), [span]);\n return (\n <Report title="Ryugi commits" caption="main branch">\n <Param label="Window" min={7} max={30} unit="days" value={span} onChange={setSpan} />\n <Grid columns={3}>\n <Stat\n id="total"\n source="commits-per-day"\n title="Commits"\n value={shown.reduce((sum, day) => sum + day.commits, 0)}\n />\n </Grid>\n <Section id="daily" title="Per day">\n <BarChart\n id="per-day"\n source="commits-per-day"\n title="Commits per day"\n data={shown}\n x="date"\n series={[{ key: \'commits\', label: \'Commits\' }]}\n />\n <Table\n id="days"\n source="commits-per-day"\n title="Days"\n rows={shown}\n rowKey="date"\n columns={[{ key: \'date\' }, { key: \'commits\', align: \'right\' }]}\n />\n </Section>\n </Report>\n );\n}\n```\n\nImports come only from `@ryugi/report` and `./data/<source-id>.json` (default import; the source must exist). JSX uses SDK components only: no `div`, `img`, `a` or other native elements, no network calls, `document` / `window` / `location` / `navigator` / storage access, `globalThis`, `eval`, `Function`, `.constructor`, `import()` / `require()` or timers. Words in text and strings are fine; the check reads code. The page cannot reach the network either way. `report.tsx` stays under 64 KB; put data in a source. Derive with `useMemo` and plain expressions; keep state in `useState`.\n\nEvery Stat, chart, Table, Callout, Image and Section needs an `id`: kebab-case, unique in the report, and stable across edits, since comments and references hold on to it. Stat, charts and Table also need `source`: the source id, or a list of them, that the block\'s numbers come from; the hover chip and the sources panel read it. Write `id`, `source` and `title` as string literals.\n\nComponents:\n\n- `Report` `{ title, caption? }`: the root; `title` is the artifact\'s title.\n- `Section` `{ id?, title? }`, `Grid` `{ columns?: 1 | 2 | 3 | 4 }`, `Card`, `Stack` `{ gap? }`, `Divider`.\n- `H2`, `H3`, `Text` `{ tone?: \'muted\' }`, `List` `{ items }`, `Callout` `{ id, title?, tone?: \'info\' | \'success\' | \'warning\' | \'error\' }`.\n- `Stat` `{ id, source, title, value, unit?, delta?, format?, note? }`; `delta` is signed and shown up or down.\n- `Table` `{ id, source, title?, rows, rowKey, columns: { key, label?, align?, format? }[] }`; every row prints; a click on a row starts a comment on it.\n- `LineChart`, `BarChart`, `AreaChart`, `PieChart`, `ScatterChart` `{ id, source, title, data, x, series: { key, label?, color? }[], subtitle?, stacked?, donut?, highlight?, refs?: { label, y }[], format?, note? }`: the same chart renderer as a document\'s chart block. A `ScatterChart` needs a numeric `x` in every row. A reader clicks a point to pin it and comments on that point.\n- `Param` `{ label, value, onChange, min?, max?, step?, unit? }` (a slider with a number field when min and max are set), `Select` `{ label?, value, options, onChange }`, `Toggle` `{ label, checked, onChange }`. Printed, they show the value the reader set; a comment on a point or row records them too.\n- `Image` `{ id, src, alt, caption?, width? }`: an image file from the report folder, `src` written as a string such as `"assets/sources-panel.png"`; `alt` describes it. Copy screenshots and figures into `assets/` first; remote URLs are not allowed. Comments anchor to the image as a block.\n- `useState`, `useMemo` from `@ryugi/report`.\n\n`format` is `{ unit?, decimals?, compact?, signed? }`.\n\n## Check, comments, references\n\n`ryugi check --artifact report/<id>` reports static issues (imports, native elements, missing or repeated ids, unknown sources, missing data files) and, once a browser has opened the report, render errors.\n\nComments anchor to a block, a table row or a chart point: `ryugi comment add --artifact report/<id> --block <block-id> [--point <series>:<x> | --row <rowKey>]`. A comment keeps the value it was made on and which data it saw; after a refresh changes that data it is marked data changed and stays where it was.\n\nReference a report from a document with `<ref report="<id>"/>`, or one block with `<ref report="<id>" block="<block-id>"/>`. A deck names it inline with the same `<ref>`, and shows one block on a slide with `<embed report="<id>" block="<block-id>"/>`; give the blocks a deck shows a stable `id`.\n\nPublishing includes `report.tsx`, `sources/**`, `data/**` and the images under `assets/` with the report\'s visibility. Publishing is refused while a script, `report.tsx` or the data holds an absolute machine path (`/Users/…`, `/home/…`, `C:\\\\…`, not checked in data) or something that looks like a secret (`sk-…`, `ghp_…`, `AKIA…`, a private key, a value from `.env`); the refusal names the file and line.\n',Qt='# Slides writing\n\nWrite one complete `deck.xml` under the returned artifact directory; put images in `assets/` and reference them with relative paths. The deck is for an audience: your human partner presents it. Re-read before each edit; never edit `comments.json` or `.state/`. Finish with `check`.\n\nThe file holds what the slides say. The server compiles it into the page and adds the presentation engine, theme, code highlighting, diagrams and formulas. Only the tags and attributes below exist: there is no `class` and no `style`, and `check` reports anything else by slide and tag.\n\n```xml\n<deck title="Retry policy" lang="en">\n <slide id="cover" layout="cover">\n <kicker>Delivery · Q3</kicker>\n <h1>Retry policy</h1>\n <subtitle>Why failed deliveries now retry three times</subtitle>\n <notes>Open with last month\'s incident.</notes>\n </slide>\n\n <slide id="what-changes">\n <h2>What changes</h2>\n <ol steps="true">\n <li>At most three attempts</li>\n <li>Exponential backoff</li>\n </ol>\n </slide>\n\n <slide id="backoff" layout="code">\n <h2>Backoff</h2>\n <codeblock lang="ts" lines="1|2-3"><![CDATA[\n const delay = (attempt: number) =>\n Math.min(30_000,\n 500 * 2 ** attempt);\n ]]></codeblock>\n </slide>\n</deck>\n```\n\n## Slides\n\n- One slide is one `<slide>` directly inside `<deck>`. The deck\'s `title` is required; `lang` is optional.\n- Every slide needs a unique, stable `id` of lowercase letters, digits and hyphens. Comments and document references find a slide by its id: keep the id when you rewrite a slide, and only change it when the slide becomes a different slide. Deleting a slide orphans its comments.\n- The canvas is fixed at 1280×720. Content that leaves that box is reported by `check` as overflow, naming the slide. Fix it by cutting or splitting the slide; `zoom="0.8"` on the slide (0.3 to 1) is for the one dense slide that must stay whole.\n- While the deck is open in the viewer, `check` also names contact sheet images (`Sheet:`) that show every slide at its last step, twelve to an image, with overflowing and hidden slides marked. After editing, run `check`, open those images, and look for slides that are too full or that all look like the same template. `sheet_not_drawn` under `Pending` means the open viewer has not drawn this version yet. `Sheet: unavailable (…)` means it cannot be drawn, as for a deck holding a video or an iframe: go on without it.\n- `hidden="true"` keeps a slide in the file and out of the talk: it shows, marked, only while the deck is worked on; presenting, the audience window, the PDF and a published link never get it, and it takes no page number.\n- `<group id="evidence" title="What the data says">` inside `<deck>` gathers the slides of one part of the talk. It holds only `<slide>` and `<include>`, never another group; its `id` follows the slide id rules and is unique among slides and groups, and `title` is required. The grid view shows each group as a titled row; the audience sees nothing of it. Slides outside any group are fine, before, between or after groups.\n- `cover="<slide id>"` on `<deck>` names the slide that stands for the deck in lists and links. `check` warns when it names a slide that is missing or hidden.\n- Write XML: close every tag, quote every attribute, write `&lt;` and `&amp;` in text; common names such as `&nbsp;`, `&mdash;` and `&rarr;` work, any other is an error, so write the character itself. Code, diagrams and formulas go in `<![CDATA[ … ]]>` so nothing in them needs escaping. CDATA ends at the first `]]>`: code that contains `]]>` comes from a file with `src`. End the file with `</deck>`.\n\n## Layouts\n\nPick the layout that fits what the slide says, and vary them: a deck of identical title-and-bullets slides reads as a template. Each layout adds a few places of its own; a place used in another layout is reported. The theme adds the page number itself.\n\n| `layout` | Use it for | Inside the slide |\n| ----------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------- |\n| `default` | A title with text, a list, a table or code | Optional `<label>`, an `<h2>`, then blocks. Omitting `layout` gives this one |\n| `cover` | The first slide | `<kicker>`, `<h1>`, `<subtitle>` |\n| `section` | The start of a new part | Optional `<label>`, then an `<h1>` or `<h2>` |\n| `statement` | One sentence the audience should remember | Optional `<label>`, an `<h2>` with the key words in `<mark>`, optional `<subtitle>` |\n| `two-cols` | Two things side by side | An `<h2>`, then exactly two `<col>`, each holding blocks |\n| `image` | Text beside a picture | One `<col>` holding the text and one `<img>`; whichever comes first is on the left |\n| `quote` | A quotation | `<quote>` and `<cite>` |\n| `fact` | One number that matters | `<big value="10–12" unit="working days"/>`, then up to three `<fact value="5 days" label="API"/>` |\n| `code` | Code as the subject of the slide | Optional `<label>`, an `<h2>` and one `<codeblock>` or one `<magic>` |\n| `end` | The last slide | An `<h1>` |\n| `none` | A slide you lay out yourself | `src` naming an HTML file; see Free HTML. No padding and no page number |\n\n```xml\n<slide id="numbers" layout="fact">\n <big value="13" unit="harnesses supported"/>\n <fact value="5" label="artifact types"/>\n <fact value="0" label="subscriptions"/>\n</slide>\n<slide id="before-after" layout="two-cols">\n <h2>Before and after</h2>\n <col>\n <h3>Before</h3>\n <p>One attempt, then a page.</p>\n </col>\n <col>\n <h3>After</h3>\n <p>Three attempts, then a page.</p>\n </col>\n</slide>\n<slide id="dashboard" layout="image">\n <col>\n <label>Result</label>\n <h2>Failures fell by half</h2>\n </col>\n <img src="assets/dashboard.png" alt="Failure rate before and after the change" frame="true"/>\n</slide>\n```\n\n## Blocks and text\n\nBlocks sit in a slide or a `<col>`: `<h1>`, `<h2>`, `<h3>`, `<p>`, `<ul>` and `<ol>` of `<li>` (a list may nest in an item), `<table>` of `<tr>` holding `<th>` or `<td>`, `<blockquote>`, `<hr/>`, `<alert type="note|tip|important|warning|caution">` holding blocks, `<img>`, `<icon>`, `<codeblock>`, `<magic>`, `<mermaid>`, `<math>`, `<html>`, `<embed>` and `<notes>`.\n\nBlocks and inline tags a document also has carry the same names here. Inside text: `<b>`/`<strong>`, `<i>`/`<em>`, `<u>`, `<s>`/`<del>`, `<sub>`, `<sup>`, `<code>`, `<mark>`, `<a href="…">`, `<br/>`, `<math>`, `<icon>` and `<ref>`.\n\n- `<img src="assets/chart.png" alt="…"/>` shows a file of the artifact directory. `frame="true"` gives a screenshot rounded corners and a shadow.\n- `<icon name="check" size="32"/>` draws an icon; `size` is in pixels.\n- `<mermaid>` holds a Mermaid diagram and `<math>` a LaTeX formula, both in CDATA. `<math>` inside text is an inline formula.\n- `<notes>` holds speaker notes, shown only to the presenter. One per slide, plain text with `<br/>` between lines.\n\n```xml\n<h2>How a delivery flows</h2>\n<mermaid><![CDATA[\n flowchart LR\n A["ingress<br/>edge"] --> B[queue] --> C[worker]\n]]></mermaid>\n<table>\n <tr><th>Attempt</th><th>Delay</th></tr>\n <tr><td>1</td><td><math>500 \\cdot 2^1</math> ms</td></tr>\n</table>\n<p><icon name="check" size="24"/> Shipped behind a flag, see <a href="https://example.com/rfc">the RFC</a>.</p>\n```\n\n## Code\n\n`<codeblock lang="ts">` is a code block, named as in a document; `<code>` is inline code inside text. Write the code in CDATA; the indentation it shares with the XML is taken off.\n\n- `lines`: stepped line highlight. Parts are separated by `|`, each one step, lines count from 1: `1`, `2-3`, `2-3,5`; `all` lights every line and `hide` hides the block for that step.\n- `src="src/retry.ts#L10-24"`: take the code from a file of the project instead of writing it, optionally only those lines. The path is relative to the project root; files outside the project, dot-files such as `.env`, and files over 512 KB are refused, and so are files named like secrets (`secrets.*`, `credentials.*`, `*.pem`, `*.key`, `*.tfstate`, `*.tfvars`, SSH keys) and files git ignores. Never show a file that holds a secret under another name. What a deck shows is published with it.\n- `numbers="true"`: line numbers. `title="src/retry.ts"`: a title above the block. `max-height="320"`: a height in pixels past which the block scrolls, following the highlighted lines. `diff="true"`: lines starting with `+` or `-` are drawn as added or removed.\n- `<magic lang="ts">` holds two or more `<step>`, each the whole code at one step, in CDATA; what stays moves into place, and each step after the first is a step of the slide.\n\n```xml\n<codeblock lang="ts" src="src/retry.ts#L10-24" numbers="true" title="src/retry.ts" lines="all|3-5"/>\n<codeblock lang="ts" diff="true"><![CDATA[\n const attempts =\n - 1;\n + 3;\n]]></codeblock>\n<magic lang="ts">\n <step><![CDATA[const delay = 500;]]></step>\n <step><![CDATA[const delay = (attempt: number) => 500 * 2 ** attempt;]]></step>\n</magic>\n```\n\n## Steps and marks\n\n- `step="true"` on a block or a list item: it appears on the next step. `steps="true"` on a `<ul>`, `<ol>`, `<table>` or `<col>` makes each item, row or block a step.\n- `step="2"` places a step by number, and `step="with"` makes it appear together with the step before it.\n- `<mark>` highlights words. `type="highlight"`, `underline`, `circle` or `strike` draws that mark; with `step` the words are there from the start and the mark is drawn on its step.\n- `morph="title"` on a block in two consecutive slides moves it from one to the other; a name is used once per slide and the pair should hold the same text.\n\n```xml\n<h2 morph="title">The <mark type="underline" step="true">retry budget</mark> is per delivery</h2>\n<p step="true">Three attempts in total.</p>\n<p step="with">The first one counts.</p>\n<ul steps="true">\n <li>500 ms</li>\n <li>1 s</li>\n</ul>\n```\n\n## Several files and free HTML\n\n- `<include src="parts/appendix.xml"/>` inside `<deck>` puts the slides of another file of the artifact directory there. That file starts with `<slides>`, holds only `<slide>`, and cannot include further files. Ids stay unique across all files.\n- `<html src="parts/demo.html"/>` is a block of HTML you write yourself, in a file of the artifact directory.\n- `<slide id="demo" layout="none" src="parts/demo.html"/>` is a whole slide of your own HTML: you own every pixel of 1280×720. It may hold `<notes>` and nothing else.\n- A free HTML file is a fragment: no page wrapper, every `<div>` closed. `data-step` on an element inside it makes that element a step. It runs in the deck\'s sandbox: no localStorage, sessionStorage or cookies.\n\n```xml\n<deck title="Retry policy">\n <slide id="live-demo" layout="none" src="parts/demo.html">\n <notes>Click through the three states.</notes>\n </slide>\n <slide id="curve">\n <h2>The backoff curve</h2>\n <html src="parts/curve.html"/>\n </slide>\n <include src="parts/appendix.xml"/>\n</deck>\n```\n\n## Other artifacts\n\n`<embed>` puts another artifact of this project on the slide. Name the target by its slug, as a document\'s `<ref>` does:\n\n- `<embed artboard="settings-page" board="q1-b"/>` shows one board of an artboard, in a box of the board\'s shape.\n- `<embed whiteboard="sync-flow" frame="f1"/>` shows one frame of a whiteboard; `page="<page id>"` instead of `frame` shows a whole page. The box takes the shape of the frame or of what is drawn on the page.\n- `<embed report="q3-revenue" block="by-month"/>` shows one block of a report at the slide\'s width and at the block\'s own height, in the deck\'s light or dark.\n- `<embed slides="launch" slide="pricing"/>` shows one slide of another deck at 1280×720, at its last step, in that deck\'s own theme. Embeds on that slide hold their place under their names: decks nest one level.\n- `<embed html="spring-curve"/>` shows an html page, at 1280×720.\n\nAn embed is live: it shows the target as it is now, changes when the target does, and can be scrolled and clicked during the talk. Its corner button opens the target nearly full screen at the embedded part, and Esc closes it. In thumbnails, PNG and PDF export and the contact sheet every embed is a picture of the target.\n\n`<ref>` names another artifact inside text, as a chip: `<ref document="retry-policy">the design</ref>`, `<ref report="q3-revenue" block="by-month"/>`, `<ref whiteboard="sync-flow" frame="f1"/>`. Every kind a document can reference can be named, with the same attributes; with no text of its own the chip shows the target\'s title. Clicking it opens the target nearly full screen; nothing opens while the slide is edited or the pen or laser is on.\n\nPublished, a deck shows the published versions of what it embeds and names. A target that is private, unpublished or gone shows to visitors as its chip text or as an unpublished artifact, never its title or a picture of it; its owner sees it. Publishing the deck offers what it embeds and names to publish with it.\n\nAn embed takes `step` and `morph` like any block. `check` warns, naming the slide, when the artifact or the part it names (board, frame, page, block, slide) is not there, and the slide shows the target\'s name in its place. A `<ref>` to a missing target is warned about the same way.\n\n```xml\n<slide id="settings" layout="two-cols">\n <h2>The settings page</h2>\n <col>\n <p>Option B keeps billing on the first screen.</p>\n </col>\n <col>\n <embed artboard="settings-page" board="q1-b"/>\n </col>\n</slide>\n```\n\n## Theme, motion and glow\n\nChange the look for the whole deck with one `<theme>` before the first slide. `name` picks the theme: `paper` (the default: warm paper, one seal-coloured accent, glow) or `mono` (black on white, monospace labels, emphasis by weight, no glow). `appearance` is `light`, `dark` or `auto`; `auto`, the default, follows the system of whoever opens the deck and prints light, so write `light` or `dark` when the room decides. Every other attribute overrides one variable of the theme, in both appearances. A deck that sets its own `paper`, `surface` or `ink` is `light` unless it names an appearance: those colours suit one appearance only. Do not restyle slide by slide.\n\n```xml\n<deck title="Retry policy">\n <theme name="paper" appearance="dark" accent="#0a7cff" transition="slide-left" fragment="rise" glow-opacity="0.6"/>\n <slide id="cover" layout="cover" transition="fade" glow="top-right" glow-seed="launch">\n <h1>Retry policy</h1>\n </slide>\n</deck>\n```\n\n| `<theme>` attribute | Values | Paper |\n| ----------------------------- | ------------------------------------------------------------ | ------------------------------- |\n| `paper`, `surface` | the slide\'s background, and that of code and cards | |\n| `ink`, `ink-2`, `ink-3` | text, secondary text, labels | |\n| `accent`, `on-accent`, `info` | the accent colour, text on it, and the second accent | |\n| `rule`, `rule-strong` | hairlines | |\n| `font`, `font-mono` | font families | |\n| `transition` | `view`, `fade-out`, `fade`, `slide-left`, `slide-up`, `none` | `view` |\n| `transition-duration` | a time | `500ms` |\n| `transition-blur` | a length | `5px` |\n| `fragment` | `blur`, `fade`, `rise` | `blur` |\n| `fragment-duration` | a time | `500ms` |\n| `fragment-blur` | a length | `3px` |\n| `glow` | `on`, `off` | `on` |\n| `glow-1`, `glow-2`, `glow-3` | colours of the three shapes | `#9440e3`, `#41d1ff`, `#dce354` |\n| `glow-fade` | the colour each shape fades to | `rgb(255 255 255 / 0.1)` |\n| `glow-opacity` | 0 to 1 | `1` |\n| `glow-blur` | a length | `70px` |\n| `glow-drift` | how long the glow takes to move to the next slide\'s place | `2500ms` |\n| `glow-hue` | an angle | `0deg` |\n| `glow-at` | a glow place | `full` |\n\nTransitions:\n\n- `view`: the slide fades out, then the next fades in, both blurred; blocks with the same `morph` on both slides move and resize between them.\n- `fade-out`: the same fade out then in, without moving blocks.\n- `fade`: both slides cross-fade.\n- `slide-left`, `slide-up`: the next slide pushes in from the right or from below; going back reverses it.\n- `none`: the slide changes at once.\n\nSteps: `blur` fades a step in from a blur, `rise` also lifts it 12px, `fade` only fades it.\n\nOn a `<slide>`:\n\n- `transition`: the transition into this slide, one of the values above.\n- `glow`: where this slide\'s glow sits: `full`, `top`, `bottom`, `left`, `right`, `top-left`, `top-right`, `bottom-left`, `bottom-right`, `center`, or `none` for no glow. Left out, the place follows the layout and changes from slide to slide.\n- `glow-seed`: any text; the same seed on the same page number always gives the same shapes.\n- `glow-opacity`: 0 to 1, this slide only.\n- `glow-hue`: degrees, this slide only.\n\n`check` reports an unknown transition or glow place and a `morph` name used twice in one slide. With reduced motion, turns are instant and the glow does not move.\n\n## Placing blocks freely\n\nA layout arranges a slide for you. When a slide must sit exactly as drawn, put `free="true"` on it: every block it holds, inside a `<col>` too, then takes `x`, `y` and `w` in slide pixels of the 1280×720 canvas, and `h` when its height matters (pictures, embeds, diagrams). The layout stays named, so its type sizes still apply, and removing `free` with the coordinates brings the layout back. A block on a free slide without `x`, `y` and `w` is reported, and so are coordinates on a slide that is not free. Later blocks sit on top of earlier ones.\n\n```xml\n<slide id="library" layout="two-cols" free="true">\n <h2 id="b4k2qz" x="96" y="80" w="520">The library</h2>\n <col>\n <p x="96" y="180" w="420" align="center" color="muted">Every artifact, one server.</p>\n </col>\n <col>\n <img x="640" y="120" w="560" h="380" src="assets/library.png" alt="The library page" frame="true"/>\n </col>\n</slide>\n```\n\n- `align="left|center|right|justify"` and `color` work on text blocks on any slide. `color` takes a theme colour, `ink|muted|faint|accent|info`, which follows the theme and its light and dark appearances, or a fixed `#RRGGBB` / `#RRGGBBAA`, which does not. Prefer the theme colours.\n- On a free slide, `w="fill"` stretches a block from its `x` to the right safe margin, and a text block may take `h`: what does not fit is clipped, unless the block also has `fit="shrink"`, which shrinks its text until it fits.\n\n### Look attributes\n\nYour human partner tunes blocks in the viewer\'s tweak panel. Each setting is one attribute on the block, on any slide; `check` reports a value outside its range and an attribute on a block that does not take it.\n\n| Attribute | Blocks | Value |\n| --------------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------- |\n| `size="32"` | text | font size, 8–400 px |\n| `weight="600"` | text | 100–900 in steps of 100 |\n| `font="Avenir Next"` | text | `mono` or a font name; a font missing on another machine falls back to the theme font |\n| `leading="1.4"` | text | line height, 0.8–3 |\n| `tracking="-0.5"` | text | letter spacing, -20–100 px |\n| `pad="16"` | text, table, codeblock, code, alert, big, fact | padding, 0–200 px |\n| `fill="surface"` | all but hr, icon and html | a theme colour (`surface`, `paper`, `ink`, `muted`, `faint`, `accent`, `info`) or hex |\n| `opacity="80"` | all but html | 0–100 |\n| `radius="12"` | all but hr, icon and html | 0–360 px |\n| `border="solid"` | all but hr, icon and html | `solid`, `dashed` or `dotted`, 1 px in the theme\'s rule colour |\n| `shadow="0 8 24 #00000040"` | all but hr, icon and html | x, y, blur in px and a colour |\n\n```xml\n<slide id="promise" free="true">\n <p x="96" y="180" w="fill" h="120" fit="shrink" size="32" weight="600" fill="surface" radius="12" pad="16">Every artifact, one server.</p>\n</slide>\n```\n\nThese are deliberate choices: keep these attributes when you rewrite a block, unless changing them is the point.\n\n- An `id` on a block (letters, digits, `_` and `-`, at most 32) is how the viewer and comments know that block again. Your human partner\'s edits give blocks ids: keep every block id when you rewrite a slide, as you keep slide ids.\n\n## Rules\n\n- A talk is given offline: keep fonts, scripts and images inside the artifact directory and avoid CDNs.\n- Notes are not secret: they are hidden from viewers in the interface but remain in the page source.\n- Your human partner can edit notes in the viewer. Saving writes that slide\'s `<notes>` back as plain text lines joined by `<br/>`, replacing any markup inside it, in the file the slide is written in.\n- Keep the whole artifact under 20 MB.\n- Your human partner can edit slides in the viewer: select blocks, drag and resize them (which makes a slide `free="true"`), type into them, change their tag, alignment, colour and every look attribute, restack blocks, change a slide\'s layout, add text boxes, copy, paste and delete. Each edit rewrites the slide in `deck.xml` or its include file in place and is listed by `changes`. Re-read the file before every edit. When you write over one of their edits before you have read it, `check` warns with `W_HUMAN_EDIT_OVERWRITTEN`, naming the slide, the block and what they had set: put their edit back unless you meant to change it.\n- Your human partner can restructure the deck in the viewer\'s grid: reorder and duplicate slides, skip them, add placeholder slides, delete them, and create, rename or move groups. Each change rewrites `deck.xml` (and an include file, for a slide written there) in place, keeping the rest of the text as it was. When `check` reports `Structure: N changes by your human partner`, run `changes --artifact slides/<id>` and read them before editing the deck, so you build on their order instead of writing it back.\n\n## Feedback\n\nComments are anchored to a slide, usually to a point on it. `comment list --sections threads --detail` shows the slide id, its title, the text under the pin and the message. A comment made on selected blocks lists them as `nodes`, each with its block (`#id`, or its position on the slide) and its text: change those blocks. Edit that slide, keep its id, run `check`, then reply with what changed. A comment whose slide was deleted is listed as an orphan.\n\nRun the returned Check command after every edit. Without a browser it reports XML that does not parse, tags, attributes and values the deck cannot take, files it cannot read, missing or duplicate ids, unknown layouts, missing assets and embeds whose target is not there, each naming its slide. Slides that overflow and code, diagram or formula errors come from the browser: with no browser open the result is pending, not clean.\n',$t='# Storyboard writing\n\nA storyboard plans a product demo video and plays it back before anything is recorded: shots in order, each with a duration, what happens on screen, and voiceover lines that are synthesized and spoken with captions. Write `storyboard.xml` under the returned artifact directory first, with no shot pictures at all: every shot without `src` plays as a title card, so your human partner can hear the pacing within minutes. Add moving pictures, recorded takes, music and sound effects afterwards. On this machine the hub opens a storyboard in an editor: a monitor, a bin and a multitrack timeline (captions, overlay, picture, voice, music, effects) where your human partner trims, splits, reorders, adds transitions, speed, keys and sounds, and exports the next cut.\n\nRe-read `storyboard.xml` and the shot pages immediately before each edit: your human partner edits the timeline, and the server writes those edits into the same file, and moving an overlay rewrites the times of `sb-cursor`, `sb-type` or `sb-clip` in the shot page. Patch only the shots and lines you mean to change and keep every id. Never edit `comments.json`, `audio/`, `cuts/` or `.state/`. Finish with `check`; lines still being voiced are pending, not done.\n\n```xml\n<storyboard title="Shared albums" aspect="16:9" lang="en" voice="Kore" target="10-15">\n <lexicon>\n <say word="Ryugi" as="Lyu-ghee"/>\n </lexicon>\n <music id="bed" src="sound/bed.mp3" at="0" gain="-18" duck="-10" fade-in="1" fade-out="2"/>\n <shot id="hook" title="A wall of text" dur="4">\n <action>The terminal fills with a 300-line plan</action>\n <action>Cut away before anyone could read it</action>\n <line id="hook-1" at="0.4">Your agent wrote 300 lines. Now read them.</line>\n </shot>\n <shot id="sketch" title="Sketch it together" dur="8" src="shots/sketch.html" transition="dissolve" transition-dur="0.4">\n <action>You draw a box; the agent completes the flow</action>\n <key prop="scale" at="2" value="1"/>\n <key prop="scale" at="5" value="1.18" ease="in-out"/>\n <sfx id="click" src="sound/click.wav" at="2.6" gain="-6"/>\n <line id="sketch-1" caption="Sketch it together.">Sketch the structure together, right in the page.</line>\n </shot>\n</storyboard>\n```\n\n## Elements\n\n- `<storyboard>`: `title`; `aspect` is `16:9` (default), `9:16` or `1:1`; `lang`; `voice` is the voice name passed to the voice script; `target` is the intended length as a range of seconds (`"65-80"`), and a total outside it is a warning.\n- `<lexicon>` with `<say word="…" as="…"/>`: pronunciations. Before synthesis every whole-word `word` is replaced by `as`; captions keep the original words.\n- `<shot>`: `id`, `title`, `dur` (seconds, required, one decimal is fine). Optional `src` (a shot page under `shots/`), `take` (a recorded clip under `takes/`) and `take-in` (the second of the take to start from). A shot starts where the shots before it end; never write start times.\n- `<action>`: one thing that happens on screen, one sentence each. Title cards and the script column show them.\n- `<line>`: one voiceover line. `at` is seconds from the shot\'s start; without it the line follows the previous line by 0.3s (the first line starts 0.3s in). `caption` replaces the words shown on screen; without it the caption is the line itself. `gain` is its volume in dB (default 0).\n\nShot and line ids are lowercase letters, digits and hyphens, unique across the whole file; comments are anchored to them.\n\n## Tracks\n\nShots are the spine: everything below is optional, and a storyboard without it is a picture, voice and caption timeline. Times on a shot are seconds from its start on the timeline; music uses whole-video seconds.\n\n- On `<shot>`: `speed` (0.25 to 4, default 1) runs the page clock and the take faster or slower while `dur` stays its length on the timeline; voice, keys and effects are not sped up. `src-in` is the second of the shot page to start from. `transition` is `cut` (default), `dissolve` or `black`, centred on the seam before this shot and `transition-dur` seconds long (default 0.4, at most half the shorter shot); it never changes the total length. `gain` in dB plays a take\'s own sound, which is otherwise muted.\n- `<key prop="…" at="…" value="…" ease="…"/>` inside a shot animates the picture layer: `x` and `y` in design pixels, `scale` as a factor, `opacity` 0 to 1, and `gain` in dB for a take\'s sound. `ease` is `linear` (default), `in`, `out` or `in-out`, easing into that key. One key holds its value for the whole shot; captions do not move.\n- `<sfx id src at gain fade-in fade-out/>` inside a shot plays a sound effect `at` seconds into the shot.\n- `<music id src at from to gain duck fade-in fade-out>` at the top level plays a file from `at` seconds into the video, starting `from` seconds into the file and ending at `to` (default: the end of the video). `duck` lowers it by that many dB while a voice line plays (down in 0.2s, back in 0.4s). Gain `<key prop="gain">` elements inside it change its volume over time, in seconds from `at`.\n- On `<storyboard>`: `mute="music sfx"` silences any of `voice`, `music` and `sfx`, and `captions="off"` hides captions; both carry into the export.\n\nSound files live in `sound/` (mp3, wav, m4a or ogg). Put them there yourself, or your human partner drops them into the editor. `check` reports a track that names a file that is not there.\n\n## Voice\n\nEvery line is synthesized on its own by `voice/voice.mjs` in the artifact directory, which `start` copies from a template the first time (OpenRouter text-to-speech; it reads `OPENROUTER_API_KEY` from the project\'s `.env` and needs ffmpeg). The hub runs it a second after `storyboard.xml` changes, only for lines whose words, voice or lexicon changed. Run `ryugi storyboard voice --artifact storyboard/<id>` to synthesize and print each line\'s length, then fit shot durations to the voice: `check` reports a voiced line that runs past its shot or overlaps the line before it. `--line <id>` voices one line; `--force` re-voices everything after you change the script.\n\n## Shot pages\n\nA shot page is plain HTML with CSS animations, drawn the way the product looks, laid out at 1920×1080 (1080×1920 for `aspect="9:16"`, 1080×1080 for `1:1`) and scaled to fit the player. Time 0 is the shot\'s start; the viewer pauses every animation and seeks it, so scrubbing and frame-by-frame capture show exactly the same frame. Animate only with CSS animations or the Web Animations API, never with `setTimeout`, `setInterval` or `requestAnimationFrame`, and give every animation a finite iteration count. Three elements cover what CSS cannot seek:\n\n- `<sb-clip src="../takes/raw.mp4" from="3.2" to="11.2" at="0.5">` plays part of a recorded video, muted, starting `at` seconds into the shot.\n- `<sb-cursor path="420,300@0 610,340@1.2 click@1.3 700,420@2.4">` moves a pointer through `x,y@seconds` points and ripples on each `click@seconds`.\n- `<sb-type at="2.3" cps="28">text</sb-type>` types its text from `at`, `cps` characters a second.\n\n`sb-cursor` covers the page, so its points are page pixels. Pages cannot reach the network; keep images under `assets/` and refer to them relatively. `check` warns about timers and endless animations, and counts a shot as not yet run until the viewer has shown it.\n\nThe page `…/storyboard/<id>/render` draws only the picture and captions, with transitions, speed and keys, exactly as the editor\'s monitor does (`?captions=0` drops captions, `?from=&to=` draws only that stretch). Its `window.ryugiStoryboard.seek(t)` resolves once that frame is painted, `duration` is the length in seconds, `audio()` lists every voiced line\'s file URL and start, and `mix()` lists every sound with its file, start, end, gain, fades, keys and duck, so any capture tool can step frame by frame and mix the sound in.\n\n## Takes, export and the cut\n\nPut recorded clips in `takes/` and name them with `take` on their shot; the shot then plays the clip under the voiceover, muted unless the shot has a `gain`, and its shot page and overlays are not drawn (put a clip in the page with `sb-clip` to draw over it).\n\nExport renders the timeline into the next cut on this machine. `start` copies an export script to `render/render.mjs` the first time; it drives Chrome over the DevTools protocol and ffmpeg, with no packages to install, renders each shot from the render page frame by frame, reuses shots that did not change, mixes voice, music and effects and writes 1080p H.264. The hub hands it the timeline as JSON on stdin and registers what it writes as the next cut, with a hash of every shot so the editor marks the shots that changed. Run `ryugi storyboard export --artifact storyboard/<id> [--wait]` to export from the command line; lines not yet voiced are voiced first. `ryugi storyboard template --artifact storyboard/<id> --force` replaces `render/render.mjs` with the latest template; without `--force` a script you changed is kept. A project can replace the script with its own kit that reads the same JSON.\n\nWhen a finished video comes from somewhere else, register it with `ryugi storyboard cut --artifact storyboard/<id> --file <1080p.mp4> [--map <map.json>] [--master <4k.mp4>]`. Without `--map` each shot\'s range comes from the storyboard\'s current durations; pass a map (`{"shots":[{"id":"hook","start":0,"end":4.2}]}`) when the cut\'s timing differs. Encode the cut as H.264 1080p at about 1.5 Mbps so it fits the Cloud allowance.\n\n## Comments and references\n\nRead feedback with `comment list`. Comments are anchored to a shot, a line, a moment of a shot (`--at <seconds>`) or a moment of a cut (`--cut <n> --at <seconds>`), which maps to its shot; `comment list` names each thread\'s shot, moment or line, and for an area marked on a recorded take or the cut, the path of its crop. A thread whose shot was deleted stays, marked `shot deleted`. Your human partner can reorder, trim, split and join shots, rewrite titles, actions and voice lines, add, duplicate or delete shots, and set transitions, speed, keys, sounds and mutes in the editor; each edit rewrites only its part of `storyboard.xml`. A split gives the second half the id `<id>-b` and leaves its comments on the first half. When `check` reports `Structure: N changes by your human partner`, run `changes --artifact storyboard/<id>` and read them before editing the file, so you build on their version instead of writing it back. A document or deck links a shot with `<ref storyboard="<id>" shot="<shot-id>"/>`.\n',en='# Verify report writing\n\nWrite `verify.xml` and captured files in `evidence/`. Reports cover command output, counts, API behavior, deploy evidence and evals. Claims judged by looking at a screen go in artboard verify groups; reference those groups from the report. Never invent captured output or human verdicts. Report prose uses the human\'s language; IDs/commands/raw logs retain their form.\n\n```xml\n<verify title="Delivery survives reconnect">\n <p>Verified against local build.</p>\n <claim id="delivery" judge="agent" from="local build @ COMMIT" capturedAt="2026-11-13T10:00:00Z">\n <title>Three attempts preserve the delivery</title>\n <result><code>3</code> attempts, <code>1</code> delivery kept</result>\n <table>\n <tr><th>Measured</th><th>Got</th><th>Expected</th></tr>\n <tr><td>Attempts</td><td><code>3</code></td><td>3</td></tr>\n <tr><td>Deliveries kept</td><td><code>1</code></td><td>1</td></tr>\n </table>\n <output src="evidence/delivery.txt"/>\n </claim>\n <gap id="production"><title>Production run</title><why>No production credentials</why><needs>A test key</needs></gap>\n</verify>\n```\n\nRequired report title; optional one introductory p first; only claim/gap/ref after it, no top-level headings. The page reads as one column: a status line, then what waits on the human (gaps, rejected and pending claims), then the agent\'s checks one line each, grouped by environment. Claim needs unique stable id, judge, title and evidence. `from` identifies actual environment/build; capturedAt is the real ISO capture time, not a future/example timestamp. Update both with replaced evidence. Capture command output directly to evidence/*.txt and never edit it. `output src="evidence/…"` keeps it one click away; no HTML output files. Over 200,000 characters is explicitly truncated.\n\nEvery agent claim has one `<result>`: inline, one line, what it proved (`<result><code>897 passed (897)</code></result>`); it is the claim\'s whole line on the page, and Check notes an agent claim without one. Its `code` values follow the copied-value rule below. Claims from the same environment and build use the identical `from` string: the page groups checks by exact `from` and writes it once per group. Above the output, write the result for the person reading: nobody should have to read a log to see what it proved. A claim may hold p, ul/ol, table (tr/th/td), steps (`step title="…"` with block children), codeblock, img, alert, details and inline marks. A table or steps directly inside the claim folds its raw output behind one line. Inside a table or steps, inline `code` means "copied from this claim\'s output": write the value exactly as the output prints it, with no rounding and no unit change. Check and the page name any such value the output does not contain, and that claim then waits on the human. Expected values, ordinals and your own wording stay outside `code`; commands go in a codeblock.\n\njudge="agent" means a command decided the stated predicate, ran in the claimed environment, passed and has raw output plus from. Missing evidence/from needs human judgment. A failed check is a fix or gap, never a passed agent claim. judge="human" requires an ask explaining what would make the judgment wrong; use for unresolved nonscreen tradeoffs, not to re-ask approved decisions. A human claim holding a long table (rulings, decisions) marks each row `<tr cost="change|small|none">`: change (wrong means behavior must change), small (a small cost), none (no effect). Only change rows show; small and none fold behind a count. Check notes a human-claim table over 12 rows without cost. A rejected agent claim remains human-owned until the human passes it, even after new evidence.\n\nGap needs id/title/why/needs (one specific unblock). `<ref artboard="slug" group="v2"/>` counts a screen claim toward done; the page sums the groups per artboard in one status-line sentence with a link, not as rows, so the verdict is given on the artboard. Read via comment list; record pass/reject/waive only if requested by the human, reply on rejection threads and replace evidence after a repair. Stable IDs preserve verdicts/comments. Never edit comments.json or `.state/`. Run the returned Check command before sharing.\n';const tn=/^(\s*(?:<\?xml[^>]*\?>\s*)?(?:<!--[\s\S]*?-->\s*)*)<report(?=[\s/>])/;function nn(e){let t=d.default.join(e,ue.verify),n=d.default.join(e,`report.xml`);if(u.default.existsSync(t)||!u.default.existsSync(n))return;let r;try{r=u.default.readFileSync(n,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}let i=r.lastIndexOf(`</report>`),a=tn.test(r)&&i!==-1?`${r.slice(0,i).replace(tn,`$1<verify`)}</verify>${r.slice(i+9)}`:r,o=`${t}.${process.pid}.tmp`;u.default.writeFileSync(o,a),u.default.renameSync(o,t),u.default.rmSync(n,{force:!0})}var rn=`# Whiteboard writing
403
376
 
404
377
  Write \`scene.excalidraw\` (main page); optional \`pages.json\` and \`pages/<id>.excalidraw\`. The browser and agent collaborate live. Re-read immediately before edits, preserve IDs and all customData (\`ryugiAuthor\`, \`ryugiRev\`, \`ryugiLastBy\`). Never manufacture revision fields or force over a conflict; read again and apply on top of the human version. Missing elements are not deletion; retain the element and set \`isDeleted:true\`. Bound labels are separate text elements: edit text and originalText.
405
378
 
@@ -475,10 +448,10 @@ Run Check after edits; skeleton_not_completed/browser_not_run needs the board op
475
448
  `).map(e=>` ${e.replaceAll(/\p{Cc}/gu,e=>e===` `?e:``)}`))}t.groups.length||e||t.page||s.push(`No messages.`),h(t.page)}else if(t.kind===`diagnostics`){let e=n.detail?t.items.length:t.preview??3;for(let n of t.items.slice(0,e))s.push(` ${n.location?`${nr(n.location)} `:``}${nr(n.code)}: ${u(n.message,`data.${t.key}`)}`);e<t.items.length&&c.push({path:`data.${t.key}`,reason:`preview`,count:t.items.length-e})}else m(e&&`${e}:`,t.summary),s.push(...t.text.trimEnd().split(`
476
449
  `).map(e=>` ${e.replaceAll(/\p{Cc}/gu,e=>e===` `||e===`
477
450
  `?e:``)}`))}t.page&&h(t.page),(a||(t.effects??[]).some(e=>e.state!==`confirmed`))&&s.push(..._ee(t.effects??[]));for(let e of t.warnings??[])s.push(`Warning: ${nr(e.message)}`);let _=e.actions??t.next??[],v=[..._,...g.filter(e=>!_.some(t=>ar(t)===ar(e)))],y=/* @__PURE__ */ new Set,b=v.find(e=>e.label===`Details`);for(let e of c){if(e.count===void 0)continue;let t=`${e.count} more ${vee(e.path)}`;b&&!y.has(b)?(y.add(b),s.push(`${t} · Details: ${ar(b)}`)):s.push(t)}for(let e of v)y.has(e)||s.push(`${nr(e.label??`Next`)}: ${e.reason?`${nr(e.reason)} · `:``}${ar(e)}`);return`${s.join(`
478
- `)}\n`}function yee(e,t,n=1){return or({heading:mee(e.command),status:``,facts:[],sections:[]},e,{...t,fields:void 0},void 0,[],n)}function sr(e,t){return{run:(n,r,i,a)=>cr(e,t,n,r,i,a)}}async function cr(e,t,n,r,i,a){let o=0,s=Promise.resolve(),c,l=!1,u=[],d=new AbortController,f=()=>d.abort(i?.reason);i?.addEventListener(`abort`,f,{once:!0}),i?.aborted&&f();let p={signal:d.signal,effects:new see,payloads:{},progress(e){l||h(n.format===`jsonl`?`stdout`:`stderr`,n.format===`jsonl`?m(`progress`,e):`${e.phase}${e.current===void 0?``:` ${e.current}${e.total===void 0?``:`/${e.total}`}`}\n`)},diagnostic(e){h(`stderr`,`${e.trimEnd()}\n`)}};function m(e,t){return`${JSON.stringify({schema:`ryugi.cli/v1`,...t,seq:o++,kind:e})}\n`}function h(e,t){s=s.then(()=>r.write(e,t)).catch(e=>{c=e,d.abort(e)})}async function g(){if(await s,c)throw c}let _=8388608;async function v(e,t){if((typeof t==`string`?new TextEncoder().encode(t).byteLength:t.byteLength)>_)throw new k({code:`E_RESULT_TOO_LARGE`,message:`Result exceeds 8 MiB; read one object or save it to a file.`});await g(),await r.write(e,t)}async function y(t,r=`result`){let i={...t,effects:t.effects.length?t.effects:p.effects.snapshot()};i.effects.some(e=>e.state===`unknown`)&&(i.actions=[...i.actions,...a?.(e.id,void 0,i.effects)??[]]),u=i.effects;let o=Pn(e.id,i,n,e.output);if(n.format===`json`)await v(`stdout`,`${JSON.stringify(o)}\n`);else if(n.format===`jsonl`){let t=o,n=e.output.collection;if(n&&r===`result`){let e=o.data,r=e[n];if(Array.isArray(r)){for(let e of r)await v(`stdout`,m(`item`,{collection:n,data:e}));let i={...e};delete i[n],t={...o,data:i}}}await v(`stdout`,m(r,t))}else if(n.format===`raw`||n.format===`source`){let e=p.payloads[n.format];if(e===void 0)throw new k({code:`E_PAYLOAD_UNAVAILABLE`,message:`No ${n.format} payload was returned.`});await v(`stdout`,e)}else if(n.format===`quiet`){if(!e.output.scalar)throw new k({code:`E_FORMAT_UNSUPPORTED`,message:`This command has no scalar output.`});await v(`stdout`,`${e.output.scalar(i.data)}\n`)}else await v(i.completion.kind===`failed`?`stderr`:`stdout`,or(e.present(i),o,n,e.output.collection,e.output.requiredFields,Mn(i.completion).code));return Mn(i.completion).code}try{if(!e.output.formats.includes(n.format)||e.mode===`live`&&[`json`,`quiet`,`raw`,`source`,`table`].includes(n.format))throw new k({code:`E_FORMAT_UNSUPPORTED`,message:`${n.format} is not supported for ${e.id}. Supported: ${e.output.formats.join(`, `)}`});if(n.detail&&!e.output.detail)throw new k({code:`E_OPTION_UNSUPPORTED`,message:`--detail is not supported for this operation.`});let r=n.fields?.find(t=>!e.output.fields?.includes(t));if(r)throw new k({code:`E_FIELD_UNKNOWN`,message:`Unknown output field: ${r}`});if(n.format===`jsonl`&&await v(`stdout`,m(`meta`,{command:e.id})),e.mode===`finite`){let n=await e.run(t,p);return l=!0,await y(n)}let i=!1,a;for await(let n of e.run(t,p)){if(a||n.kind===`ready`&&i)throw new k({code:`E_LIFECYCLE_INVALID`,message:`Invalid command lifecycle.`});if(n.kind===`ready`){i=!0;try{await y(n.result,`ready`)}catch(e){throw d.abort(e),e}}else a=n.result,l=!0}if(!a)throw new k({code:`E_LIFECYCLE_INCOMPLETE`,message:`Command ended without a terminal result.`});return await y(a)}catch(t){if(l=!0,t instanceof k&&t.raw!==void 0&&(p.payloads.raw=t.raw),t?.code===`EPIPE`)return 141;let i=d.signal.aborted&&(d.signal.reason===`SIGINT`||d.signal.reason===`SIGTERM`)?d.signal.reason:void 0,o=i?{code:`E_INTERRUPTED`,message:`Command interrupted by ${i}.`,details:{signal:i}}:jn(t),s=t instanceof k?t.kind===`action_required`:t?.code===2,c=p.effects.snapshot(),f=Zn(null,i?{kind:`interrupted`,signal:i}:s?{kind:`action_required`,reason:o.message}:{kind:`failed`,error:o},{effects:c.length?c:u,actions:[...a?.(e.id,o,c.length?c:u)??[],...t?.actions??[]]}),h={...Pn(e.id,f,{...n,fields:void 0},{}),error:o};try{await g(),n.format===`json`||n.format===`jsonl`?await r.write(`stdout`,n.format===`json`?`${JSON.stringify(h)}\n`:m(`result`,h)):n.format===`raw`&&p.payloads.raw!==void 0&&o.code!==`E_RESULT_TOO_LARGE`&&Buffer.byteLength(p.payloads.raw)<=_?await r.write(`stdout`,p.payloads.raw):await r.write(`stderr`,yee(h,n,Mn(f.completion).code)),n.verbose&&t instanceof Error&&t.stack&&await r.write(`stderr`,`${t.stack}\n`)}catch(e){if(e?.code===`EPIPE`)return 141}return Mn(f.completion).code}finally{i?.removeEventListener(`abort`,f)}}function bee(e){let t=e.values;if(t.foreground&&t.background)throw new k({code:`E_OPTION_CONFLICT`,message:`Choose --foreground or --background.`});if(t.open&&t[`no-open`])throw new k({code:`E_OPTION_CONFLICT`,message:`Choose --open or --no-open.`});return{projectDir:e.projectDir,artifact:t.artifact,background:!!t.background,foreground:!!t.foreground,host:t.host??`127.0.0.1`,urlHost:t[`url-host`],port:t.port,open:t[`no-open`]?!1:t.open?!0:process.env.ARTIFACTS_OPEN!==`0`,openExisting:!!t.open,mockup:!!t.mockup}}function lr(e,t){let n=t?d.default.dirname(d.default.dirname(t.root)):e.projectDir,r=e.artifact?ln(n,e.artifact):void 0;return{cliVersion:`1.101.2`,serverVersion:et(je().version),status:t?`running`:`stopped`,scope:`machine`,project:n,...r,...r?.content===`missing`?{writing:sn(e.artifact,{mockup:e.mockup})}:{},reused:!!t?.reused,...t?{url:t.cloudLink??t.link??t.url,localUrl:t.link??t.url}:{},...e.artifact?{artifact:e.artifact}:{},cloud:t?.cloudLink?`live_link_reserved`:`local_only`}}function ur({data:e}){return{heading:`Server`,status:e.status,subject:e.reused?`reused`:void 0,facts:[A(`Scope`,tr(e,`scope`)),A(`CLI version`,tr(e,`cliVersion`)),A(`Server version`,tr(e,`serverVersion`)),A(`Project`,tr(e,`project`),!0),...e.artifact?[A(`Artifact`,tr(e,`artifact`),!0)]:[],...e.write?[A(`Write`,tr(e,`write`),!0),A(`Content`,tr(e,`content`),!0)]:[],...e.url?[A(`Open`,tr(e,`url`),!0)]:[],...e.localUrl&&e.localUrl!==e.url?[A(`Local`,tr(e,`localUrl`),!0)]:[],A(`Cloud`,tr(e,`cloud`))],sections:e.writing?[{kind:`content`,key:`writing`,title:`Writing`,text:e.writing}]:[]}}function dr(e,t){if(e.artifact?.startsWith(`storyboard/`)){let n=d.default.join(d.default.dirname(d.default.dirname(t.root)),`.ryugi`,`artifacts`,e.artifact);Gt(n),Wt(n)}let n=t.cloudLimit?.upgradeUrl?[{kind:`url`,url:t.cloudLimit.upgradeUrl,label:`Upgrade`}]:[];return e.artifact&&n.push(Xn([`check`,`--project-dir`,d.default.dirname(d.default.dirname(t.root)),`--artifact`,e.artifact],`Check`)),t.loginHint&&n.push(Xn([`publish`,`--login`,`--from`,`hint`,`--project-dir`,e.projectDir],`Sign in`)),Zn(lr(e,t),void 0,{actions:n,warnings:[...t.loginHint?[{code:`W_LOGIN_OPTIONAL`,message:t.loginHint.message}]:[],...t.cloudLimit?[{code:`W_CLOUD_LIMIT`,message:String(t.cloudLimit.message??`Cloud link unavailable; local server is ready.`)}]:[]]})}async function*xee(e,t){let n=[],r,i=!1,a,o,s,c=t.effects.begin(`start`,e.projectDir),l=e=>{n.push(e),r?.()},u=yr(e,{signal:t.signal,ready(n){o=n,t.effects.confirm(c,{reused:!!n.reused}),l({kind:`ready`,result:dr(e,n)})},failure(e){s=String(e.error??`Server failed`)},log:e=>t.diagnostic(e)}).then(n=>{if(t.signal.aborted){let n=t.signal.reason===`SIGINT`?`SIGINT`:`SIGTERM`;l({kind:`result`,result:Zn({...lr(e,o),status:`stopped`},{kind:`interrupted`,signal:n},{effects:t.effects.snapshot()})})}else if(n!==0||s)throw new k({code:`E_SERVER_FAILED`,message:s??`Server exited with ${n}.`});else l({kind:`result`,result:Zn({...lr(e,o),status:o?.reused?`running`:`stopped`},void 0,{effects:t.effects.snapshot()})})}).catch(e=>{a=e}).finally(()=>{i=!0,r?.()});try{for(;!i||n.length;)n.length?yield n.shift():await new Promise(e=>{r=e});if(a)throw a}finally{await u}}function fr(e,t=`start`){let n=bee(e);return n.library=t===`browse`,n.foreground?sr({id:t,mode:`live`,output:{formats:[`brief`,`jsonl`]},run:(e,t)=>xee(n,t),present:ur},e):sr({id:t,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.url},async run(e,t){let r,i,a=t.effects.begin(`start`,n.projectDir);if(await yr(n,{signal:t.signal,ready(e){r=e,t.effects.confirm(a,{reused:!!e.reused})},failure(e){i=String(e.error??`Server failed`)},log:e=>t.diagnostic(e)})!==0||!r)throw new k({code:`E_SERVER_FAILED`,message:i??`Server did not become ready.`});return dr(n,r)},present:ur},e)}function See(e,t){return e&&t&&e===t?`keep`:`replace`}const pr=`https://ryugi.innei.dev`,mr=1e4,hr=(e,t)=>{let n=process.env[e]?Number(process.env[e]):NaN;return Number.isFinite(n)&&n>=0?n:t},Cee=hr(`RYUGI_START_SETTLE_MS`,6e3),wee=hr(`RYUGI_STOP_GRACE_MS`,7e3),Tee=e=>(e.RYUGI_CLOUD_ORIGIN||pr).replace(/\/+$/,``),Eee=e=>{let t=new URL(e);return t.hostname===`localhost`&&(t.hostname=`127.0.0.1`),t},gr=(e,t)=>{let n=Eee(e.url),r=new URL(t,n.origin),i=n.searchParams.get(`key`);return i&&r.searchParams.set(`key`,i),r.toString()};function Dee(e,t,n){let r={type:`server-started`,url:e.url,port:e.port,root:t.root};if(n){let i=new URL(e.url),a=Se(n),o=i.searchParams.get(`key`);r.link=`${i.origin}${we(t.root,a.type,a.id)}${o?`?key=${o}`:``}`}return r}async function Oee(e,t,n,r){if(!r)return e;try{let{url:i,limit:a}=await(await fetch(gr(t,`/api/cloud/reserve/${r}`),{method:`POST`,headers:{"X-Ryugi-Project":encodeURIComponent(n.project)},signal:AbortSignal.timeout(5e3)})).json();return typeof i==`string`?{...e,cloudLink:i}:typeof a?.upgradeUrl==`string`?{...e,cloudLimit:{message:a.message,upgradeUrl:a.upgradeUrl}}:e}catch{return e}}async function kee(e){for(let t=0;t<150;t++){try{return u.default.mkdirSync(e),!0}catch{}try{if(Date.now()-u.default.statSync(e).mtimeMs>6e4){u.default.rmdirSync(e);continue}}catch{}await qe(100)}return!1}function Aee(e){let t=Number(et(e.pid)),n=et(e.serverId);return!Number.isInteger(t)||t<=0||!n?null:Qe(t,n)?t:null}function _r(e){try{let t=JSON.parse(et(e.info)??``);return typeof t.url==`string`&&Number.isInteger(t.port)?t:null}catch{return null}}async function jee(e){try{return(await fetch(gr(e,`/api/status`),{signal:AbortSignal.timeout(1e3)})).ok}catch{return!1}}async function vr(e,t){try{process.kill(e,`SIGTERM`)}catch{}if(!await $e(e,wee)){try{process.kill(e,`SIGKILL`)}catch{}if(!await $e(e,2e3))throw new O(`The ${t} (pid ${e}) did not stop; stop it with \`${We()} stop\` and retry`)}}async function Mee(){let e=Ie();for(let t of Be(e)){if(Qe(t.pid,t.serverId)){try{process.kill(t.pid,`SIGTERM`)}catch{}await $e(t.pid,5e3)}try{Ve(e,t)}catch{}}}function Nee(e){let t=Object.fromEntries(ie.flatMap(e=>process.env[e]?[[e,process.env[e]]]:[]));Object.keys(t).length&&u.default.writeFileSync(e.agent,`${JSON.stringify(t)}\n`)}function Pee(e){let t={...process.env,ARTIFACTS_HOST:e.host,ARTIFACTS_URL_HOST:e.urlHost};process.env.RYUGI_ARTIFACTS_COMMAND&&(t.RYUGI_ARTIFACTS_LAUNCHER=process.env.RYUGI_ARTIFACTS_COMMAND);for(let e of[`RYUGI_ARTIFACTS_OWNER`,`RYUGI_ARTIFACTS_VERSION`,`RYUGI_ARTIFACTS_COMMAND`,`ARTIFACTS_OPEN_CMD`,`ARTIFACTS_ROOT`])delete t[e];return t}const Fee=e=>e.split(`
451
+ `)}\n`}function yee(e,t,n=1){return or({heading:mee(e.command),status:``,facts:[],sections:[]},e,{...t,fields:void 0},void 0,[],n)}function sr(e,t){return{run:(n,r,i,a)=>cr(e,t,n,r,i,a)}}async function cr(e,t,n,r,i,a){let o=0,s=Promise.resolve(),c,l=!1,u=[],d=new AbortController,f=()=>d.abort(i?.reason);i?.addEventListener(`abort`,f,{once:!0}),i?.aborted&&f();let p={signal:d.signal,effects:new see,payloads:{},progress(e){l||h(n.format===`jsonl`?`stdout`:`stderr`,n.format===`jsonl`?m(`progress`,e):`${e.phase}${e.current===void 0?``:` ${e.current}${e.total===void 0?``:`/${e.total}`}`}\n`)},diagnostic(e){h(`stderr`,`${e.trimEnd()}\n`)}};function m(e,t){return`${JSON.stringify({schema:`ryugi.cli/v1`,...t,seq:o++,kind:e})}\n`}function h(e,t){s=s.then(()=>r.write(e,t)).catch(e=>{c=e,d.abort(e)})}async function g(){if(await s,c)throw c}let _=8388608;async function v(e,t){if((typeof t==`string`?new TextEncoder().encode(t).byteLength:t.byteLength)>_)throw new k({code:`E_RESULT_TOO_LARGE`,message:`Result exceeds 8 MiB; read one object or save it to a file.`});await g(),await r.write(e,t)}async function y(t,r=`result`){let i={...t,effects:t.effects.length?t.effects:p.effects.snapshot()};i.effects.some(e=>e.state===`unknown`)&&(i.actions=[...i.actions,...a?.(e.id,void 0,i.effects)??[]]),u=i.effects;let o=Pn(e.id,i,n,e.output);if(n.format===`json`)await v(`stdout`,`${JSON.stringify(o)}\n`);else if(n.format===`jsonl`){let t=o,n=e.output.collection;if(n&&r===`result`){let e=o.data,r=e[n];if(Array.isArray(r)){for(let e of r)await v(`stdout`,m(`item`,{collection:n,data:e}));let i={...e};delete i[n],t={...o,data:i}}}await v(`stdout`,m(r,t))}else if(n.format===`raw`||n.format===`source`){let e=p.payloads[n.format];if(e===void 0)throw new k({code:`E_PAYLOAD_UNAVAILABLE`,message:`No ${n.format} payload was returned.`});await v(`stdout`,e)}else if(n.format===`quiet`){if(!e.output.scalar)throw new k({code:`E_FORMAT_UNSUPPORTED`,message:`This command has no scalar output.`});await v(`stdout`,`${e.output.scalar(i.data)}\n`)}else await v(i.completion.kind===`failed`?`stderr`:`stdout`,or(e.present(i),o,n,e.output.collection,e.output.requiredFields,Mn(i.completion).code));return Mn(i.completion).code}try{if(!e.output.formats.includes(n.format)||e.mode===`live`&&[`json`,`quiet`,`raw`,`source`,`table`].includes(n.format))throw new k({code:`E_FORMAT_UNSUPPORTED`,message:`${n.format} is not supported for ${e.id}. Supported: ${e.output.formats.join(`, `)}`});if(n.detail&&!e.output.detail)throw new k({code:`E_OPTION_UNSUPPORTED`,message:`--detail is not supported for this operation.`});let r=n.fields?.find(t=>!e.output.fields?.includes(t));if(r)throw new k({code:`E_FIELD_UNKNOWN`,message:`Unknown output field: ${r}`});if(n.format===`jsonl`&&await v(`stdout`,m(`meta`,{command:e.id})),e.mode===`finite`){let n=await e.run(t,p);return l=!0,await y(n)}let i=!1,a;for await(let n of e.run(t,p)){if(a||n.kind===`ready`&&i)throw new k({code:`E_LIFECYCLE_INVALID`,message:`Invalid command lifecycle.`});if(n.kind===`ready`){i=!0;try{await y(n.result,`ready`)}catch(e){throw d.abort(e),e}}else a=n.result,l=!0}if(!a)throw new k({code:`E_LIFECYCLE_INCOMPLETE`,message:`Command ended without a terminal result.`});return await y(a)}catch(t){if(l=!0,t instanceof k&&t.raw!==void 0&&(p.payloads.raw=t.raw),t?.code===`EPIPE`)return 141;let i=d.signal.aborted&&(d.signal.reason===`SIGINT`||d.signal.reason===`SIGTERM`)?d.signal.reason:void 0,o=i?{code:`E_INTERRUPTED`,message:`Command interrupted by ${i}.`,details:{signal:i}}:jn(t),s=t instanceof k?t.kind===`action_required`:t?.code===2,c=p.effects.snapshot(),f=Zn(null,i?{kind:`interrupted`,signal:i}:s?{kind:`action_required`,reason:o.message}:{kind:`failed`,error:o},{effects:c.length?c:u,actions:[...a?.(e.id,o,c.length?c:u)??[],...t?.actions??[]]}),h={...Pn(e.id,f,{...n,fields:void 0},{}),error:o};try{await g(),n.format===`json`||n.format===`jsonl`?await r.write(`stdout`,n.format===`json`?`${JSON.stringify(h)}\n`:m(`result`,h)):n.format===`raw`&&p.payloads.raw!==void 0&&o.code!==`E_RESULT_TOO_LARGE`&&Buffer.byteLength(p.payloads.raw)<=_?await r.write(`stdout`,p.payloads.raw):await r.write(`stderr`,yee(h,n,Mn(f.completion).code)),n.verbose&&t instanceof Error&&t.stack&&await r.write(`stderr`,`${t.stack}\n`)}catch(e){if(e?.code===`EPIPE`)return 141}return Mn(f.completion).code}finally{i?.removeEventListener(`abort`,f)}}function bee(e){let t=e.values;if(t.foreground&&t.background)throw new k({code:`E_OPTION_CONFLICT`,message:`Choose --foreground or --background.`});if(t.open&&t[`no-open`])throw new k({code:`E_OPTION_CONFLICT`,message:`Choose --open or --no-open.`});return{projectDir:e.projectDir,artifact:t.artifact,background:!!t.background,foreground:!!t.foreground,host:t.host??`127.0.0.1`,urlHost:t[`url-host`],port:t.port,open:t[`no-open`]?!1:t.open?!0:process.env.ARTIFACTS_OPEN!==`0`,openExisting:!!t.open,mockup:!!t.mockup}}function lr(e,t){let n=t?d.default.dirname(d.default.dirname(t.root)):e.projectDir,r=e.artifact?ln(n,e.artifact):void 0;return{cliVersion:`1.102.1`,serverVersion:et(je().version),status:t?`running`:`stopped`,scope:`machine`,project:n,...r,...r?.content===`missing`?{writing:sn(e.artifact,{mockup:e.mockup})}:{},reused:!!t?.reused,...t?{url:t.cloudLink??t.link??t.url,localUrl:t.link??t.url}:{},...e.artifact?{artifact:e.artifact}:{},cloud:t?.cloudLink?`live_link_reserved`:`local_only`}}function ur({data:e}){return{heading:`Server`,status:e.status,subject:e.reused?`reused`:void 0,facts:[A(`Scope`,tr(e,`scope`)),A(`CLI version`,tr(e,`cliVersion`)),A(`Server version`,tr(e,`serverVersion`)),A(`Project`,tr(e,`project`),!0),...e.artifact?[A(`Artifact`,tr(e,`artifact`),!0)]:[],...e.write?[A(`Write`,tr(e,`write`),!0),A(`Content`,tr(e,`content`),!0)]:[],...e.url?[A(`Open`,tr(e,`url`),!0)]:[],...e.localUrl&&e.localUrl!==e.url?[A(`Local`,tr(e,`localUrl`),!0)]:[],A(`Cloud`,tr(e,`cloud`))],sections:e.writing?[{kind:`content`,key:`writing`,title:`Writing`,text:e.writing}]:[]}}function dr(e,t){if(e.artifact?.startsWith(`storyboard/`)){let n=d.default.join(d.default.dirname(d.default.dirname(t.root)),`.ryugi`,`artifacts`,e.artifact);Gt(n),Wt(n)}let n=t.cloudLimit?.upgradeUrl?[{kind:`url`,url:t.cloudLimit.upgradeUrl,label:`Upgrade`}]:[];return e.artifact&&n.push(Xn([`check`,`--project-dir`,d.default.dirname(d.default.dirname(t.root)),`--artifact`,e.artifact],`Check`)),t.loginHint&&n.push(Xn([`publish`,`--login`,`--from`,`hint`,`--project-dir`,e.projectDir],`Sign in`)),Zn(lr(e,t),void 0,{actions:n,warnings:[...t.loginHint?[{code:`W_LOGIN_OPTIONAL`,message:t.loginHint.message}]:[],...t.cloudLimit?[{code:`W_CLOUD_LIMIT`,message:String(t.cloudLimit.message??`Cloud link unavailable; local server is ready.`)}]:[]]})}async function*xee(e,t){let n=[],r,i=!1,a,o,s,c=t.effects.begin(`start`,e.projectDir),l=e=>{n.push(e),r?.()},u=yr(e,{signal:t.signal,ready(n){o=n,t.effects.confirm(c,{reused:!!n.reused}),l({kind:`ready`,result:dr(e,n)})},failure(e){s=String(e.error??`Server failed`)},log:e=>t.diagnostic(e)}).then(n=>{if(t.signal.aborted){let n=t.signal.reason===`SIGINT`?`SIGINT`:`SIGTERM`;l({kind:`result`,result:Zn({...lr(e,o),status:`stopped`},{kind:`interrupted`,signal:n},{effects:t.effects.snapshot()})})}else if(n!==0||s)throw new k({code:`E_SERVER_FAILED`,message:s??`Server exited with ${n}.`});else l({kind:`result`,result:Zn({...lr(e,o),status:o?.reused?`running`:`stopped`},void 0,{effects:t.effects.snapshot()})})}).catch(e=>{a=e}).finally(()=>{i=!0,r?.()});try{for(;!i||n.length;)n.length?yield n.shift():await new Promise(e=>{r=e});if(a)throw a}finally{await u}}function fr(e,t=`start`){let n=bee(e);return n.library=t===`browse`,n.foreground?sr({id:t,mode:`live`,output:{formats:[`brief`,`jsonl`]},run:(e,t)=>xee(n,t),present:ur},e):sr({id:t,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.url},async run(e,t){let r,i,a=t.effects.begin(`start`,n.projectDir);if(await yr(n,{signal:t.signal,ready(e){r=e,t.effects.confirm(a,{reused:!!e.reused})},failure(e){i=String(e.error??`Server failed`)},log:e=>t.diagnostic(e)})!==0||!r)throw new k({code:`E_SERVER_FAILED`,message:i??`Server did not become ready.`});return dr(n,r)},present:ur},e)}function See(e,t){return e&&t&&e===t?`keep`:`replace`}const pr=`https://ryugi.innei.dev`,mr=1e4,hr=(e,t)=>{let n=process.env[e]?Number(process.env[e]):NaN;return Number.isFinite(n)&&n>=0?n:t},Cee=hr(`RYUGI_START_SETTLE_MS`,6e3),wee=hr(`RYUGI_STOP_GRACE_MS`,7e3),Tee=e=>(e.RYUGI_CLOUD_ORIGIN||pr).replace(/\/+$/,``),Eee=e=>{let t=new URL(e);return t.hostname===`localhost`&&(t.hostname=`127.0.0.1`),t},gr=(e,t)=>{let n=Eee(e.url),r=new URL(t,n.origin),i=n.searchParams.get(`key`);return i&&r.searchParams.set(`key`,i),r.toString()};function Dee(e,t,n){let r={type:`server-started`,url:e.url,port:e.port,root:t.root};if(n){let i=new URL(e.url),a=Se(n),o=i.searchParams.get(`key`);r.link=`${i.origin}${we(t.root,a.type,a.id)}${o?`?key=${o}`:``}`}return r}async function Oee(e,t,n,r){if(!r)return e;try{let{url:i,limit:a}=await(await fetch(gr(t,`/api/cloud/reserve/${r}`),{method:`POST`,headers:{"X-Ryugi-Project":encodeURIComponent(n.project)},signal:AbortSignal.timeout(5e3)})).json();return typeof i==`string`?{...e,cloudLink:i}:typeof a?.upgradeUrl==`string`?{...e,cloudLimit:{message:a.message,upgradeUrl:a.upgradeUrl}}:e}catch{return e}}async function kee(e){for(let t=0;t<150;t++){try{return u.default.mkdirSync(e),!0}catch{}try{if(Date.now()-u.default.statSync(e).mtimeMs>6e4){u.default.rmdirSync(e);continue}}catch{}await qe(100)}return!1}function Aee(e){let t=Number(et(e.pid)),n=et(e.serverId);return!Number.isInteger(t)||t<=0||!n?null:Qe(t,n)?t:null}function _r(e){try{let t=JSON.parse(et(e.info)??``);return typeof t.url==`string`&&Number.isInteger(t.port)?t:null}catch{return null}}async function jee(e){try{return(await fetch(gr(e,`/api/status`),{signal:AbortSignal.timeout(1e3)})).ok}catch{return!1}}async function vr(e,t){try{process.kill(e,`SIGTERM`)}catch{}if(!await $e(e,wee)){try{process.kill(e,`SIGKILL`)}catch{}if(!await $e(e,2e3))throw new O(`The ${t} (pid ${e}) did not stop; stop it with \`${We()} stop\` and retry`)}}async function Mee(){let e=Ie();for(let t of Be(e)){if(Qe(t.pid,t.serverId)){try{process.kill(t.pid,`SIGTERM`)}catch{}await $e(t.pid,5e3)}try{Ve(e,t)}catch{}}}function Nee(e){let t=Object.fromEntries(ie.flatMap(e=>process.env[e]?[[e,process.env[e]]]:[]));Object.keys(t).length&&u.default.writeFileSync(e.agent,`${JSON.stringify(t)}\n`)}function Pee(e){let t={...process.env,ARTIFACTS_HOST:e.host,ARTIFACTS_URL_HOST:e.urlHost};process.env.RYUGI_ARTIFACTS_COMMAND&&(t.RYUGI_ARTIFACTS_LAUNCHER=process.env.RYUGI_ARTIFACTS_COMMAND);for(let e of[`RYUGI_ARTIFACTS_OWNER`,`RYUGI_ARTIFACTS_VERSION`,`RYUGI_ARTIFACTS_COMMAND`,`ARTIFACTS_OPEN_CMD`,`ARTIFACTS_ROOT`])delete t[e];return t}const Fee=e=>e.split(`
479
452
  `).find(e=>e.includes(`"server-started"`)),Iee=e=>e.split(`
480
453
  `).find(e=>e.includes(`"server-error"`));async function Lee(e,t,n){let r=await fetch(gr(e,`/api/hub/projects`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dir:t.project,...n?{open:n}:{},...n&&process.env.ARTIFACTS_OPEN_CMD?{openCmd:process.env.ARTIFACTS_OPEN_CMD}:{}}),signal:AbortSignal.timeout(15e3)});if(!r.ok)throw new O(`The artifacts server refused this project: ${await r.text()}`)}async function yr(e,t){if(t.signal?.throwIfAborted(),e.artifact!==void 0&&!Ge.test(e.artifact))throw new O(Ke);if(e.port!==void 0&&(!/^\d+$/.test(e.port)||Number(e.port)<1||Number(e.port)>65535))throw new O(`--port must be a port number`);e.urlHost||=e.host===`127.0.0.1`||e.host===`localhost`?`localhost`:e.host,process.umask(63);let n=Ue(e.projectDir),r=je();Me(r.home),u.default.mkdirSync(n.state,{recursive:!0}),u.default.existsSync(d.default.join(n.state,`.gitignore`))||u.default.writeFileSync(d.default.join(n.state,`.gitignore`),`*
481
- `);let i=process.env.RYUGI_ARTIFACTS_VERSION||`1.101.2`,a=Pe(r.projects).some(e=>e.dir===n.project),o=async(r,i)=>{Nee(n);let o=e.open&&!e.library&&(!i||!a);await Lee(r,n,o?e.artifact??!0:void 0);let s=Dee(r,n,e.artifact);i&&(s.reused=!0);let c=await Oee(s,r,n,e.artifact),l=Vt(n.project);if(t.signal?.throwIfAborted(),e.library&&e.open&&(process.env.ARTIFACTS_OPEN_CMD?await new Promise(e=>(0,f.execFile)(process.env.ARTIFACTS_OPEN_CMD,[r.url],()=>e())):await Ae(r.url,[r.url]).catch(e=>t.log(e.message,`stderr`))),await t.ready(l?{...c,loginHint:l}:c),i&&a&&process.platform===`darwin`&&e.open&&e.openExisting&&e.artifact&&!process.env.ARTIFACTS_OPEN_CMD){let e=c.link;await Ae(typeof c.cloudLink==`string`?c.cloudLink:e,[e]).catch(e=>t.log(e.message,`stderr`))}};if(!await kee(r.lock))throw new O(`Another start is still starting the artifacts server; retry in a moment`);let s=!0,c=()=>{if(s){s=!1;try{u.default.rmdirSync(r.lock)}catch{}}};try{t.signal?.throwIfAborted();let a=Aee(r),s=_r(r);if(a&&!s){for(let e=0;e<Cee&&Je(a)&&!s;e+=100)await qe(100),s=_r(r);!s&&Je(a)&&await vr(a,`stopping artifacts server`)}if(a&&s){let t=See(et(r.version)??``,i),n=(s.host??`127.0.0.1`)!==e.host||(s.urlHost??`localhost`)!==e.urlHost||(s.cloudOrigin??pr)!==Tee(process.env)||e.port!==void 0&&String(s.port)!==e.port;if(t!==`replace`&&!n&&await jee(s))return c(),await o(s,!0),0;await vr(a,`running artifacts server`)}await Mee(),u.default.rmSync(r.info,{force:!0});let l=p.default.randomBytes(24).toString(`hex`);u.default.writeFileSync(r.serverId,`${l}\n`),u.default.writeFileSync(r.version,`${i}\n`);let h=[d.default.join(__dirname,`server.cjs`),`--artifacts-server-id=${l}`,...e.port?[`--port=${e.port}`]:[]],g=Pee(e);if(e.foreground){let e=(0,f.spawn)(process.execPath,h,{env:g,stdio:[`ignore`,`pipe`,`pipe`]});u.default.writeFileSync(r.pid,`${e.pid}\n`);let n=()=>{e.kill(`SIGTERM`)};if(t.signal)t.signal.addEventListener(`abort`,n,{once:!0});else for(let e of[`SIGINT`,`SIGTERM`])process.on(e,n);m.default.createInterface({input:e.stderr}).on(`line`,e=>t.log(e,`stderr`));let i=new Promise(t=>e.on(`close`,e=>t(e??1))),a=!1,s;m.default.createInterface({input:e.stdout}).on(`line`,e=>{let r;try{r=JSON.parse(e)}catch{t.log(e,`stdout`);return}r.type!==`server-started`||a?t.event?t.event(r):r.type===`server-error`||r.type===`error`?t.failure(r):t.log(JSON.stringify(r),`stderr`):(a=!0,c(),s=o(r,!1),s.catch(()=>n()))});try{let e=await i;return await s,e}finally{if(t.signal)t.signal.removeEventListener(`abort`,n);else for(let e of[`SIGINT`,`SIGTERM`])process.removeListener(e,n)}}try{u.default.renameSync(r.log,`${r.log}.1`)}catch{}let _=u.default.openSync(r.log,`w`),v=(0,f.spawn)(process.execPath,h,{env:g,detached:!0,windowsHide:!0,stdio:[`ignore`,_,_]});u.default.closeSync(_),v.unref(),u.default.writeFileSync(r.pid,`${v.pid}\n`);for(let i=0;i<mr;i+=100){let i=et(r.log)??``,a=Fee(i);if(a){for(let t=0;t<10;t++){if(!Je(v.pid))throw new O(`Server started but was killed. Retry in a persistent terminal with: ${We()} start --project-dir ${n.project}${e.artifact?` --artifact ${e.artifact}`:``} --host ${e.host} --url-host ${e.urlHost} --foreground`);await qe(100)}return c(),await o(JSON.parse(a),!1),0}let s=Iee(i);if(s)return t.failure(JSON.parse(s)),1;await qe(100)}throw new O(`Server failed to start within ${mr/1e3} seconds`)}finally{c()}}const Ree={semantic:fr,name:`start`,summary:`Start this machine's artifacts server if needed and register the project with it`,options:{artifact:{type:`string`,value:`<type>/<id>`,help:`Also print a link that opens this artifact`},host:{type:`string`,value:`<host>`,help:`Interface to listen on (default: 127.0.0.1)`},"url-host":{type:`string`,value:`<host>`,help:`Host in printed URLs (default: localhost for a loopback --host)`},port:{type:`string`,value:`<n>`,help:`Port to listen on (default: the first free of 27319-27321)`},open:{type:`boolean`,help:`Open or focus the artifact, including when reusing a server`},"no-open":{type:`boolean`,help:`Do not open a browser`},foreground:{type:`boolean`,help:`Run the server in this process until Ctrl+C`},background:{type:`boolean`,help:`Run until ready and detach (the default; incompatible with --foreground)`},mockup:{type:`boolean`,help:`Include the phone mockup guide in the writing description; with --help, print only the guide`}}},br=e=>`No artifacts server is running for this project. Start it with \`${We()} start --project-dir ${e}\`, then run this again.`,xr=e=>{try{let{url:t}=JSON.parse(et(e)??``);return typeof t==`string`?t:null}catch{return null}};function zee(e,t){let n=je(),r=xr(n.info);return r?Pe(n.projects).some(t=>t.dir===e)?r:null:xr(t)}function Sr(e){let t=Ue(e),n=zee(t.project,t.info);if(!n)throw new k({code:`E_SERVER_NOT_RUNNING`,message:br(t.project)});let r=new URL(n),i=r.searchParams.get(`key`)??``;return r.hostname===`localhost`&&(r.hostname=`127.0.0.1`),{project:t.project,async call(e,n,a,o){let s;try{let c=new URL(`${r.origin}${n}`);c.searchParams.set(`key`,i);let l=Lt(process.env);s=await fetch(c,{method:e,signal:o,headers:{"X-Ryugi-Project":encodeURIComponent(t.project),...l?{"x-ryugi-cloud-token":l}:{},...a?{"Content-Type":`application/json`}:{}},body:a?JSON.stringify(a):void 0})}catch{throw new k({code:`E_SERVER_UNREACHABLE`,message:br(t.project)})}let c=new Uint8Array(await s.arrayBuffer()),l;try{l=JSON.parse(new TextDecoder().decode(c))}catch{}if(!l||typeof l!=`object`||Array.isArray(l))throw new k({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an invalid JSON response; the operation result is unknown.`,httpStatus:s.status},`failed`,c);return{status:s.status,json:l,raw:c}}}}async function Bee(){let e=je(),t=xr(e.info),n={scope:`machine`,version:et(e.version)};if(!t)return{...n,status:`not_running`};try{let e=new URL(`/api/status`,t);e.search=new URL(t).search;let r=await fetch(e,{signal:AbortSignal.timeout(1e3)}),i=await r.json();return{...n,status:r.ok&&typeof i.pid==`number`?`running`:`unreachable`,pid:typeof i.pid==`number`?i.pid:void 0}}catch{return{...n,status:`unreachable`}}}const Cr=`preview.json`,wr=/^[a-z0-9][a-z0-9-]{0,63}$/;function Tr(e){return d.default.join(d.default.dirname(e),`preview`)}function Vee(e,t){return wr.test(t)?d.default.join(Tr(e),t):null}function Hee(e){let t=Tr(e),n;try{n=u.default.readdirSync(t)}catch{return[]}let r=[];for(let e of n){if(!wr.test(e))continue;let n=d.default.join(t,e);u.default.existsSync(d.default.join(n,`preview.json`))&&r.push({id:e,payload:Uee(n,e)})}return r}function Uee(e,t,n){let r=d.default.join(e,Cr),i,a=1;try{let e=u.default.statSync(r);a=Math.trunc(e.mtimeMs)||1,i=u.default.readFileSync(r,`utf8`)}catch{return{title:t,version:a,config:null,issues:[`preview.json is missing`],warnings:[`preview.json is missing`],proxyUrl:n??null}}let{config:o,issues:s}=te(i);return{title:o?.title||t,version:a,config:o,issues:s,warnings:s,proxyUrl:n??null}}function Wee(e,t){u.default.mkdirSync(e,{recursive:!0}),It(d.default.join(e,Cr),t)}function Er(e,t,n){return new Promise(r=>{let i=_.default.connect({host:e,port:t}),a=!1,o=e=>{a||(a=!0,i.destroy(),r(e))};i.setTimeout(n,()=>o(!1)),i.once(`connect`,()=>o(!0)),i.once(`error`,()=>o(!1))})}async function Gee(e,t=800){let n=w(e);if(!n)return!1;if(n.hostname!==`localhost`)return Er(n.hostname,n.port,t);let r=await Promise.all([Er(`127.0.0.1`,n.port,t),Er(`::1`,n.port,t)]);return r[0]||r[1]}function Dr(e){let t=typeof e==`string`&&e.trim()?e.trim():`dev`;if(!wr.test(t))throw new O(`Preview --id must use lowercase letters, digits, and hyphens.`);return t}function Kee(e){let t=e.anchor??{},n=typeof t.route==`string`?t.route:`/`,r=t.kind===`box`?`box`:`element`,i=t.pageRect??t.rect,a=t.source,o=a?.file?`${a.file}${a.line?`:${a.line}`:``}`:a?.component?`<${a.component}>`:``,s=r===`box`&&i?`box (${i.x},${i.y} ${i.w}x${i.h})`:[typeof t.selector==`string`?t.selector:``,typeof t.text==`string`?`"${t.text.slice(0,48)}"`:``].filter(Boolean).join(` `),c=t.viewport,l=typeof t.cropPath==`string`?t.cropPath:``,u=[[`${String(e.id??``)} [${String(e.status??`open`)}]`,n,s,o,c?`${c.w}x${c.h}`:``,l?`crop ${l}`:``].filter(Boolean).join(` · `)],d=Array.isArray(e.messages)?e.messages:[];for(let e of d){if(e.deleted)continue;let t=e.author===`agent`?String(e.name||`agent`):`human`;u.push(` ${String(e.id??``)} ${t}: ${String(e.text??``)}`)}return Array.isArray(t.errors)&&t.errors.length>0&&u.push(` errors: ${t.errors.join(` | `)}`),u}function qee({data:e}){return{heading:`Preview ${e.action}`,status:e.action===`open`?`ready`:`ok`,subject:e.id?`preview/${e.id}`:void 0,facts:[...e.url?[A(`Target`,{key:`url`,value:e.url})]:[],...e.upstreamAlive===void 0?[]:[A(`Upstream`,{key:`upstreamAlive`,value:e.upstreamAlive?`online`:`offline`})],...e.open?[A(`Open`,{key:`open`,value:e.open},!0)]:[],...e.receipt?[A(`Receipt`,{key:`receipt`,value:e.receipt})]:[]],sections:e.lines.length?[{kind:`content`,key:`lines`,text:e.lines.join(`
454
+ `);let i=process.env.RYUGI_ARTIFACTS_VERSION||`1.102.1`,a=Pe(r.projects).some(e=>e.dir===n.project),o=async(r,i)=>{Nee(n);let o=e.open&&!e.library&&(!i||!a);await Lee(r,n,o?e.artifact??!0:void 0);let s=Dee(r,n,e.artifact);i&&(s.reused=!0);let c=await Oee(s,r,n,e.artifact),l=Vt(n.project);if(t.signal?.throwIfAborted(),e.library&&e.open&&(process.env.ARTIFACTS_OPEN_CMD?await new Promise(e=>(0,f.execFile)(process.env.ARTIFACTS_OPEN_CMD,[r.url],()=>e())):await Ae(r.url,[r.url]).catch(e=>t.log(e.message,`stderr`))),await t.ready(l?{...c,loginHint:l}:c),i&&a&&process.platform===`darwin`&&e.open&&e.openExisting&&e.artifact&&!process.env.ARTIFACTS_OPEN_CMD){let e=c.link;await Ae(typeof c.cloudLink==`string`?c.cloudLink:e,[e]).catch(e=>t.log(e.message,`stderr`))}};if(!await kee(r.lock))throw new O(`Another start is still starting the artifacts server; retry in a moment`);let s=!0,c=()=>{if(s){s=!1;try{u.default.rmdirSync(r.lock)}catch{}}};try{t.signal?.throwIfAborted();let a=Aee(r),s=_r(r);if(a&&!s){for(let e=0;e<Cee&&Je(a)&&!s;e+=100)await qe(100),s=_r(r);!s&&Je(a)&&await vr(a,`stopping artifacts server`)}if(a&&s){let t=See(et(r.version)??``,i),n=(s.host??`127.0.0.1`)!==e.host||(s.urlHost??`localhost`)!==e.urlHost||(s.cloudOrigin??pr)!==Tee(process.env)||e.port!==void 0&&String(s.port)!==e.port;if(t!==`replace`&&!n&&await jee(s))return c(),await o(s,!0),0;await vr(a,`running artifacts server`)}await Mee(),u.default.rmSync(r.info,{force:!0});let l=p.default.randomBytes(24).toString(`hex`);u.default.writeFileSync(r.serverId,`${l}\n`),u.default.writeFileSync(r.version,`${i}\n`);let h=[d.default.join(__dirname,`server.cjs`),`--artifacts-server-id=${l}`,...e.port?[`--port=${e.port}`]:[]],g=Pee(e);if(e.foreground){let e=(0,f.spawn)(process.execPath,h,{env:g,stdio:[`ignore`,`pipe`,`pipe`]});u.default.writeFileSync(r.pid,`${e.pid}\n`);let n=()=>{e.kill(`SIGTERM`)};if(t.signal)t.signal.addEventListener(`abort`,n,{once:!0});else for(let e of[`SIGINT`,`SIGTERM`])process.on(e,n);m.default.createInterface({input:e.stderr}).on(`line`,e=>t.log(e,`stderr`));let i=new Promise(t=>e.on(`close`,e=>t(e??1))),a=!1,s;m.default.createInterface({input:e.stdout}).on(`line`,e=>{let r;try{r=JSON.parse(e)}catch{t.log(e,`stdout`);return}r.type!==`server-started`||a?t.event?t.event(r):r.type===`server-error`||r.type===`error`?t.failure(r):t.log(JSON.stringify(r),`stderr`):(a=!0,c(),s=o(r,!1),s.catch(()=>n()))});try{let e=await i;return await s,e}finally{if(t.signal)t.signal.removeEventListener(`abort`,n);else for(let e of[`SIGINT`,`SIGTERM`])process.removeListener(e,n)}}try{u.default.renameSync(r.log,`${r.log}.1`)}catch{}let _=u.default.openSync(r.log,`w`),v=(0,f.spawn)(process.execPath,h,{env:g,detached:!0,windowsHide:!0,stdio:[`ignore`,_,_]});u.default.closeSync(_),v.unref(),u.default.writeFileSync(r.pid,`${v.pid}\n`);for(let i=0;i<mr;i+=100){let i=et(r.log)??``,a=Fee(i);if(a){for(let t=0;t<10;t++){if(!Je(v.pid))throw new O(`Server started but was killed. Retry in a persistent terminal with: ${We()} start --project-dir ${n.project}${e.artifact?` --artifact ${e.artifact}`:``} --host ${e.host} --url-host ${e.urlHost} --foreground`);await qe(100)}return c(),await o(JSON.parse(a),!1),0}let s=Iee(i);if(s)return t.failure(JSON.parse(s)),1;await qe(100)}throw new O(`Server failed to start within ${mr/1e3} seconds`)}finally{c()}}const Ree={semantic:fr,name:`start`,summary:`Start this machine's artifacts server if needed and register the project with it`,options:{artifact:{type:`string`,value:`<type>/<id>`,help:`Also print a link that opens this artifact`},host:{type:`string`,value:`<host>`,help:`Interface to listen on (default: 127.0.0.1)`},"url-host":{type:`string`,value:`<host>`,help:`Host in printed URLs (default: localhost for a loopback --host)`},port:{type:`string`,value:`<n>`,help:`Port to listen on (default: the first free of 27319-27321)`},open:{type:`boolean`,help:`Open or focus the artifact, including when reusing a server`},"no-open":{type:`boolean`,help:`Do not open a browser`},foreground:{type:`boolean`,help:`Run the server in this process until Ctrl+C`},background:{type:`boolean`,help:`Run until ready and detach (the default; incompatible with --foreground)`},mockup:{type:`boolean`,help:`Include the phone mockup guide in the writing description; with --help, print only the guide`}}},br=e=>`No artifacts server is running for this project. Start it with \`${We()} start --project-dir ${e}\`, then run this again.`,xr=e=>{try{let{url:t}=JSON.parse(et(e)??``);return typeof t==`string`?t:null}catch{return null}};function zee(e,t){let n=je(),r=xr(n.info);return r?Pe(n.projects).some(t=>t.dir===e)?r:null:xr(t)}function Sr(e){let t=Ue(e),n=zee(t.project,t.info);if(!n)throw new k({code:`E_SERVER_NOT_RUNNING`,message:br(t.project)});let r=new URL(n),i=r.searchParams.get(`key`)??``;return r.hostname===`localhost`&&(r.hostname=`127.0.0.1`),{project:t.project,async call(e,n,a,o){let s;try{let c=new URL(`${r.origin}${n}`);c.searchParams.set(`key`,i);let l=Lt(process.env);s=await fetch(c,{method:e,signal:o,headers:{"X-Ryugi-Project":encodeURIComponent(t.project),...l?{"x-ryugi-cloud-token":l}:{},...a?{"Content-Type":`application/json`}:{}},body:a?JSON.stringify(a):void 0})}catch{throw new k({code:`E_SERVER_UNREACHABLE`,message:br(t.project)})}let c=new Uint8Array(await s.arrayBuffer()),l;try{l=JSON.parse(new TextDecoder().decode(c))}catch{}if(!l||typeof l!=`object`||Array.isArray(l))throw new k({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an invalid JSON response; the operation result is unknown.`,httpStatus:s.status},`failed`,c);return{status:s.status,json:l,raw:c}}}}async function Bee(){let e=je(),t=xr(e.info),n={scope:`machine`,version:et(e.version)};if(!t)return{...n,status:`not_running`};try{let e=new URL(`/api/status`,t);e.search=new URL(t).search;let r=await fetch(e,{signal:AbortSignal.timeout(1e3)}),i=await r.json();return{...n,status:r.ok&&typeof i.pid==`number`?`running`:`unreachable`,pid:typeof i.pid==`number`?i.pid:void 0}}catch{return{...n,status:`unreachable`}}}const Cr=`preview.json`,wr=/^[a-z0-9][a-z0-9-]{0,63}$/;function Tr(e){return d.default.join(d.default.dirname(e),`preview`)}function Vee(e,t){return wr.test(t)?d.default.join(Tr(e),t):null}function Hee(e){let t=Tr(e),n;try{n=u.default.readdirSync(t)}catch{return[]}let r=[];for(let e of n){if(!wr.test(e))continue;let n=d.default.join(t,e);u.default.existsSync(d.default.join(n,`preview.json`))&&r.push({id:e,payload:Uee(n,e)})}return r}function Uee(e,t,n){let r=d.default.join(e,Cr),i,a=1;try{let e=u.default.statSync(r);a=Math.trunc(e.mtimeMs)||1,i=u.default.readFileSync(r,`utf8`)}catch{return{title:t,version:a,config:null,issues:[`preview.json is missing`],warnings:[`preview.json is missing`],proxyUrl:n??null}}let{config:o,issues:s}=te(i);return{title:o?.title||t,version:a,config:o,issues:s,warnings:s,proxyUrl:n??null}}function Wee(e,t){u.default.mkdirSync(e,{recursive:!0}),It(d.default.join(e,Cr),t)}function Er(e,t,n){return new Promise(r=>{let i=_.default.connect({host:e,port:t}),a=!1,o=e=>{a||(a=!0,i.destroy(),r(e))};i.setTimeout(n,()=>o(!1)),i.once(`connect`,()=>o(!0)),i.once(`error`,()=>o(!1))})}async function Gee(e,t=800){let n=w(e);if(!n)return!1;if(n.hostname!==`localhost`)return Er(n.hostname,n.port,t);let r=await Promise.all([Er(`127.0.0.1`,n.port,t),Er(`::1`,n.port,t)]);return r[0]||r[1]}function Dr(e){let t=typeof e==`string`&&e.trim()?e.trim():`dev`;if(!wr.test(t))throw new O(`Preview --id must use lowercase letters, digits, and hyphens.`);return t}function Kee(e){let t=e.anchor??{},n=typeof t.route==`string`?t.route:`/`,r=t.kind===`box`?`box`:`element`,i=t.pageRect??t.rect,a=t.source,o=a?.file?`${a.file}${a.line?`:${a.line}`:``}`:a?.component?`<${a.component}>`:``,s=r===`box`&&i?`box (${i.x},${i.y} ${i.w}x${i.h})`:[typeof t.selector==`string`?t.selector:``,typeof t.text==`string`?`"${t.text.slice(0,48)}"`:``].filter(Boolean).join(` `),c=t.viewport,l=typeof t.cropPath==`string`?t.cropPath:``,u=[[`${String(e.id??``)} [${String(e.status??`open`)}]`,n,s,o,c?`${c.w}x${c.h}`:``,l?`crop ${l}`:``].filter(Boolean).join(` · `)],d=Array.isArray(e.messages)?e.messages:[];for(let e of d){if(e.deleted)continue;let t=e.author===`agent`?String(e.name||`agent`):`human`;u.push(` ${String(e.id??``)} ${t}: ${String(e.text??``)}`)}return Array.isArray(t.errors)&&t.errors.length>0&&u.push(` errors: ${t.errors.join(` | `)}`),u}function qee({data:e}){return{heading:`Preview ${e.action}`,status:e.action===`open`?`ready`:`ok`,subject:e.id?`preview/${e.id}`:void 0,facts:[...e.url?[A(`Target`,{key:`url`,value:e.url})]:[],...e.upstreamAlive===void 0?[]:[A(`Upstream`,{key:`upstreamAlive`,value:e.upstreamAlive?`online`:`offline`})],...e.open?[A(`Open`,{key:`open`,value:e.open},!0)]:[],...e.receipt?[A(`Receipt`,{key:`receipt`,value:e.receipt})]:[]],sections:e.lines.length?[{kind:`content`,key:`lines`,text:e.lines.join(`
482
455
  `)}]:[]}}const Jee={name:`preview`,summary:`Manage local dev server previews (open, list, comments, reply, resolve, ack)`,usage:[`open --url <http://localhost:port> [--id dev]`,`list`,`comments [--id dev] [--all]`,`reply --thread <id> --text <message> [--id dev]`,`resolve --thread <id> [--id dev]`,`ack --receipt <id> [--id dev]`],positionals:1,options:{id:{type:`string`,value:`<id>`,help:`Preview id (default: dev)`},url:{type:`string`,value:`<http://localhost:port>`,help:`Local loopback dev server URL`},all:{type:`boolean`,help:`Include all threads, not just unread ones`},thread:{type:`string`,value:`<id>`,help:`Comment thread ID for reply/resolve`},text:{type:`string`,value:`<message>`,help:`Reply message text`},receipt:{type:`string`,value:`<id>`,help:`Review receipt ID to acknowledge`},agent:{type:`string`,value:`<name>`,help:`Agent name for comments/replies`}},semantic:e=>sr({id:`preview`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.open??e.lines[0]??`ok`},async run(t,n){let r=e.positionals[0]||`list`,i=Ue(e.projectDir);if(r===`list`){let e=Hee(i.root);return Zn({action:`list`,lines:e.length?e.map(({id:e,payload:t})=>`${e} · ${t.config?.url??`(invalid)`}${t.config?.path??`/`}`):[`No local previews configured yet.`]})}if(r===`open`){let t=Dr(e.values.id),r=e.values.url;if(!r)throw new O(`Pass --url http://localhost:<port>`);let a=T(r);if(!a)throw new O(`--url must be a local loopback http URL (e.g. http://localhost:5182)`);let o=Vee(i.root,t),s=null;try{s=te(u.default.readFileSync(d.default.join(o,`preview.json`),`utf8`)).config}catch{}Wee(o,{version:1,url:a.url,...s?.title?{title:s.title}:{},...a.path&&a.path!==`/`?{path:a.path}:s?.path?{path:s.path}:{},...s?.viewport?{viewport:s.viewport}:{}});let c=``;if(await yr({projectDir:e.projectDir,background:!1,foreground:!1,host:`127.0.0.1`,open:!1},{signal:n.signal,ready(e){c=e.url},failure(e){throw new O(String(e.error??`Failed to start Hub`))},log(e){n.diagnostic(e)}})!==0||!c)throw new O(`Hub did not start.`);let l=`${new URL(c).origin}/preview/${encodeURIComponent(t)}?project=${encodeURIComponent(i.project)}`,f=await Gee(a.url);return Zn({action:`open`,id:t,url:a.url,upstreamAlive:f,open:l,lines:f?[]:[`Upstream ${a.url} is not listening yet; start your dev server and reload.`]})}let a=Dr(e.values.id),o=Sr(e.projectDir),s=e.values.agent||`Agent`;if(r===`comments`){let t=await o.call(`POST`,`/api/agent/v1/preview/${encodeURIComponent(a)}/review`,{op:`list`,section:`threads`,detail:!0,include:e.values.all?`all`:`unread`,agent:s},n.signal);if(t.status<200||t.status>=300)throw new O(t.json?.error||`HTTP ${t.status}`);let r=Array.isArray(t.json?.items)?t.json.items:[];return Zn({action:`comments`,id:a,lines:r.length?r.flatMap(Kee):[`No unread preview comments.`],receipt:typeof t.json?.receipt==`string`?t.json.receipt:void 0})}if(r===`reply`||r===`resolve`){let t=e.values.thread;if(!t)throw new O(`Pass --thread <id> for preview ${r}`);let i=e.values.text;if(r===`reply`&&!i?.trim())throw new O(`Pass --text <message> for preview reply`);let c=await o.call(`POST`,`/api/agent/preview/${encodeURIComponent(a)}/comments`,r===`reply`?{op:`reply`,threadId:t,text:i,agent:s}:{op:`resolve`,threadId:t,agent:s},n.signal);if(c.status<200||c.status>=300)throw new O(c.json?.error||`HTTP ${c.status}`);return Zn({action:r,id:a,lines:[r===`reply`?`Replied to preview/${a} thread ${t}`:`Resolved preview/${a} thread ${t}`]})}if(r===`ack`){let t=e.values.receipt;if(!t)throw new O(`Pass --receipt <id> for preview ack`);let r=await o.call(`POST`,`/api/agent/v1/preview/${encodeURIComponent(a)}/review`,{op:`ack`,receipt:t,agent:s},n.signal);if(r.status<200||r.status>=300)throw new O(r.json?.error||`HTTP ${r.status}`);return Zn({action:`ack`,id:a,receipt:t,lines:[`Acknowledged receipt ${t}`]})}throw new O(`Unknown preview action "${r}". Use open, list, comments, reply, resolve, or ack.`)},present:qee},e)},Yee=/^report\/[a-z0-9][a-z0-9-]*$/,Xee=e=>typeof e==`object`&&!!e&&Array.isArray(e.sources),Or=({sources:e})=>e.map(e=>e.ok?`${e.id}: ok in ${(e.durationMs/1e3).toFixed(1)} s${e.shape?` · ${e.shape}`:``}`:`${e.id}: failed · ${e.error??`unknown error`}`),Zee={name:`report`,summary:`Run the data sources of a report on this machine (needs a running server)`,usage:[`refresh --artifact report/<id> [--only <source-id>]`],details:`refresh runs each data source script under sources/<id>/ and writes its JSON to data/<id>.json; a failed run keeps the last good data. Prints one line per source with the shape of its data.`,positionals:1,options:{artifact:{type:`string`,value:`report/<id>`,help:`The report`},only:{type:`string`,value:`<source-id>`,help:`Run only this data source`}},semantic:e=>sr({id:`report`,mode:`finite`,output:{detail:!1,formats:[`brief`,`json`,`jsonl`,`raw`],fields:[`artifact`,`sources`,`issues`,`lines`],scalar:e=>e.sources.every(e=>e.ok)?`ok`:`failed`},async run(t,n){if(e.positionals[0]!==`refresh`)throw new O(`usage: ryugi report refresh --artifact report/<id>`);let r=e.values.artifact;if(!r||!Yee.test(r))throw new O(`--artifact must be report/<id>`);let i=e.values.only,a=await Sr(e.projectDir).call(`POST`,`/api/${r}/refresh`,i?{source:i}:{},n.signal);if(n.payloads.raw=a.raw,a.status<200||a.status>=300)throw new O(a.json?.error||`HTTP ${a.status}`);if(!Xee(a.json))throw new k({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an invalid refresh report.`});let o={...a.json,artifact:r,lines:Or(a.json)},s=o.sources.filter(e=>!e.ok);return Zn(o,s.length?s.length===o.sources.length?{kind:`failed`,error:{code:`E_REPORT_SOURCE_FAILED`,message:Or({sources:s}).join(`; `)}}:{kind:`partial`}:{kind:`succeeded`})},present:Qee},e)};function Qee({data:e}){return{heading:`Refresh`,status:e.sources.every(e=>e.ok)?``:`failed`,subject:e.artifact??``,facts:[A(`Sources`,{key:`sources`,value:String(e.sources.length)})],sections:[{kind:`content`,key:`lines`,text:(e.lines??Or(e)).join(`
483
456
  `)},...e.issues?.length?[{kind:`content`,key:`issues`,text:e.issues.join(`
484
457
  `)}]:[]]}}const $ee=/^storyboard\/[a-z0-9][a-z0-9-]*$/,ete=e=>typeof e==`object`&&!!e&&Array.isArray(e.lines),tte=e=>typeof e==`object`&&!!e&&typeof e.n==`number`&&Array.isArray(e.shots),kr=({lines:e})=>e.map(e=>e.ok?`${e.id}: ${Math.round((e.duration??0)*100)/100}s${e.cached?` (unchanged)`:``}`:`${e.id}: failed · ${e.error??`unknown error`}`),nte=e=>{let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},rte=e=>[`cut ${e.n}: ${e.file} · ${e.shots.length} shot${e.shots.length===1?``:`s`}, ${nte(e.shots.at(-1)?.end??0)} · timing from the ${e.mapped===`map`?`map`:`storyboard's durations`}`],Ar=(e,t)=>d.default.resolve(e,t),jr=e=>e.state===`done`?[`cut ${e.n}: cuts/${e.n}.mp4`]:e.state===`running`?[`cut ${e.n}: ${Math.round(e.progress*100)}% · ${e.stage}`]:[`cut ${e.n} ${e.state}${e.error?`: ${e.error}`:``}`];function ite(e,t,n){let r=d.default.join(e,`.ryugi`,`artifacts`,...t.split(`/`));if(!u.default.existsSync(r))throw new O(`${t} not found in ${e}`);return Wt(r,n)?[`wrote ${Ut}`]:[`${Ut} is already there; pass --force to replace it with the latest template`]}const Mr=e=>typeof e==`object`&&!!e&&typeof e.state==`string`,ate=(e,t)=>new Promise(n=>{let r=setTimeout(n,e);t?.addEventListener(`abort`,()=>{clearTimeout(r),n()})});function ote(e,t){if(t!==void 0)try{return JSON.parse(u.default.readFileSync(Ar(e,t),`utf8`))}catch(e){throw new O(`--map ${t} is not readable JSON: ${e.message}`)}}const ste={name:`storyboard`,summary:`Voice the lines of a storyboard, export or register a cut, or refresh its render script, on this machine`,usage:[`voice --artifact storyboard/<id> [--line <line-id>] [--force]`,`cut --artifact storyboard/<id> --file <1080p.mp4> [--map <map.json>] [--master <4k.mp4>]`,`export --artifact storyboard/<id> [--wait]`,`template --artifact storyboard/<id> [--force]`],details:`voice runs voice/voice.mjs for every line whose words, voice or lexicon changed and prints each line's length, so shot durations can be fitted to the voice; a failed line keeps the audio it had. cut copies the 1080p H.264 file in as the next version under cuts/, with each shot's range from --map ({"shots":[{"id","start","end"}]}) or from the storyboard's durations; --master records where the full-size master lives without copying it. export asks the server to run render/render.mjs on the current timeline and registers what it writes as the next cut; --wait prints its progress until it ends. template copies the latest render script to render/render.mjs; --force replaces one that is already there.`,positionals:1,options:{artifact:{type:`string`,value:`storyboard/<id>`,help:`The storyboard`},line:{type:`string`,value:`<line-id>`,help:`voice: voice only this line`},force:{type:`boolean`,help:`voice: voice again even when the words did not change; template: replace render/render.mjs`},wait:{type:`boolean`,help:`export: wait for the export to end, printing its progress`},file:{type:`string`,value:`<1080p.mp4>`,help:`cut: the finished video to register`},map:{type:`string`,value:`<map.json>`,help:`cut: each shot's start and end in the video`},master:{type:`string`,value:`<4k.mp4>`,help:`cut: where the full-size master is kept`}},semantic:e=>sr({id:`storyboard`,mode:`finite`,output:{detail:!1,formats:[`brief`,`json`,`jsonl`,`raw`],fields:[`artifact`,`action`,`lines`,`cut`,`export`,`error`,`summary`],scalar:e=>e.error||e.lines.some(e=>!e.ok)?`failed`:`ok`},async run(t,n){let r=e.positionals[0];if(r!==`voice`&&r!==`cut`&&r!==`export`&&r!==`template`)throw new O(`usage: ryugi storyboard voice|cut|export|template --artifact storyboard/<id>`);let i=e.values.artifact;if(!i||!$ee.test(i))throw new O(`--artifact must be storyboard/<id>`);if(r===`template`)return Zn({action:r,artifact:i,lines:[],summary:ite(e.projectDir,i,!!e.values.force)},{kind:`succeeded`});let a=Sr(e.projectDir);if(r===`export`){let t=await a.call(`POST`,`/api/${i}/export`,{},n.signal);if(n.payloads.raw=t.raw,t.status<200||t.status>=300||!Mr(t.json))throw new O(t.json?.error||`HTTP ${t.status}`);let o=t.json,s=[];for(;e.values.wait&&o.state===`running`&&!n.signal?.aborted;){let e=jr(o)[0];s.at(-1)!==e&&s.push(e),await ate(1e3,n.signal);let t=await a.call(`GET`,`/api/${i}/export`,void 0,n.signal);Mr(t.json)&&(o=t.json)}return Zn({action:r,artifact:i,export:o,lines:[],summary:[...s,...jr(o)],...o.error?{error:o.error}:{}},o.state===`failed`||o.state===`cancelled`?{kind:`failed`,error:{code:`E_STORYBOARD_EXPORT`,message:o.error??o.state}}:{kind:`succeeded`})}if(r===`cut`){let t=e.values.file;if(!t)throw new O(`storyboard cut needs --file <1080p.mp4>`);let o=ote(e.projectDir,e.values.map),s=e.values.master,c=await a.call(`POST`,`/api/${i}/cut`,{file:Ar(e.projectDir,t),...o===void 0?{}:{map:o},...s?{master:Ar(e.projectDir,s)}:{}},n.signal);if(n.payloads.raw=c.raw,c.status<200||c.status>=300)throw new O(c.json?.error||`HTTP ${c.status}`);if(!tte(c.json))throw new k({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an invalid cut.`});let l=c.json;return Zn({action:r,artifact:i,cut:l,lines:[],summary:rte(l)},{kind:`succeeded`})}let o=e.values.line,s=await a.call(`POST`,`/api/${i}/voice`,{...o?{line:o}:{},force:!!e.values.force},n.signal);if(n.payloads.raw=s.raw,!ete(s.json))throw s.status<200||s.status>=300?new O(s.json?.error||`HTTP ${s.status}`):new k({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an invalid voice report.`});let c={action:r,artifact:i,lines:s.json.lines,...s.json.error?{error:s.json.error}:{},summary:kr(s.json)};if(c.error)return Zn(c,{kind:`failed`,error:{code:`E_STORYBOARD_VOICE`,message:c.error}});let l=c.lines.filter(e=>!e.ok);return Zn(c,l.length?l.length===c.lines.length?{kind:`failed`,error:{code:`E_STORYBOARD_VOICE`,message:kr({lines:l}).join(`; `)}}:{kind:`partial`}:{kind:`succeeded`})},present:cte},e)};function cte({data:e}){let t=e.action===`cut`;return{heading:{cut:`Cut`,export:`Export`,template:`Template`,voice:`Voice`}[e.action],status:e.error||e.lines.some(e=>!e.ok)?`failed`:``,subject:e.artifact??``,facts:t?[A(`Version`,{key:`cut`,value:String(e.cut?.n??``)})]:e.action===`export`?[A(`Version`,{key:`export`,value:String(e.export?.n??``)})]:e.action===`voice`?[A(`Lines`,{key:`lines`,value:String(e.lines.length)})]:[],sections:[...e.error?[{kind:`content`,key:`error`,text:e.error}]:[],{kind:`content`,key:`summary`,text:(e.summary??[]).join(`
@@ -513,8 +486,8 @@ Run Check after edits; skeleton_not_completed/browser_not_run needs the board op
513
486
  <string>${fi(e.log)}</string>
514
487
  </dict>
515
488
  </plist>
516
- `}async function _ne(e){let t=`ryugi-daemon-${e.platform}-${e.arch}`,n=`${(process.env.RYUGI_DAEMON_RELEASE_BASE||`https://github.com/Innei/ryugi/releases/download`).replace(/\/+$/,``)}/v${e.version}/${t}`,r=await e.fetch(n);if(!r.ok)throw new O(`could not download ${t} ${e.version}: HTTP ${r.status}`);let i=Buffer.from(await r.arrayBuffer()),a=await e.fetch(`${n}.sha256`);if(!a.ok)throw new O(`could not download the sha256 for ${t}: HTTP ${a.status}`);if((await a.text()).trim().split(/\s+/)[0]?.toLowerCase()!==p.default.createHash(`sha256`).update(i).digest(`hex`))throw new O(`${t} failed its sha256 check; nothing was installed`);return i}function vne(e,t){u.default.mkdirSync(d.default.dirname(e),{recursive:!0,mode:448});let n=`${e}.${process.pid}.tmp`;u.default.writeFileSync(n,t,{mode:493}),u.default.chmodSync(n,493),u.default.renameSync(n,e)}async function yne(e,t){if(e.platform!==`darwin`)throw new O(`ryugi daemon runs on macOS only for now`);let n=di(e.home),r=t.binary?u.default.readFileSync(t.binary):await _ne(e);vne(n.binary,r),u.default.mkdirSync(d.default.dirname(n.log),{recursive:!0,mode:448}),u.default.mkdirSync(d.default.dirname(n.plist),{recursive:!0}),u.default.writeFileSync(n.plist,gne({binary:n.binary,hubStart:e.hubStart,path:e.path,log:n.log})),e.launchctl([`bootout`,`gui/${e.uid}/${ui}`]);let i=e.launchctl([`bootstrap`,`gui/${e.uid}`,n.plist]);if(i.status!==0)throw new O(`launchctl bootstrap failed: ${i.stderr.trim()}`);return{binary:n.binary,plist:n.plist,tmux:e.which(`tmux`)!==null}}function bne(e){let t=di(e.home);return e.launchctl([`bootout`,`gui/${e.uid}/${ui}`]),u.default.rmSync(t.plist,{force:!0}),u.default.rmSync(t.binary,{force:!0}),{binary:t.binary,plist:t.plist}}async function xne(e){let{cloud:t}=e;try{await e.daemon.call(`status`,{})}catch{throw new O(`the daemon is not running; start it with: ryugi daemon install`)}let n=await e.fetch(`${t.origin}/api/devices/confirm`,{method:`POST`,headers:{Authorization:`Bearer ${t.token}`,"Content-Type":`application/json`},body:JSON.stringify({code:e.code.trim().toUpperCase(),hostId:t.hostId,...e.label?{label:e.label}:{}})}),r=await n.json().catch(()=>null);if(!n.ok||!r?.deviceId)throw new O(r?.error?.message??`Cloud refused the code: HTTP ${n.status}`);let i=r.label??``;return await e.daemon.call(`trust.add`,{deviceId:r.deviceId,label:i}),{deviceId:r.deviceId,label:i}}function Sne(e,t){let n=e.filter(e=>e.state===`running`&&e.window),r=t?n.find(e=>e.taskId===t||e.artifact===t):n.length===1?n[0]:void 0;if(!r)throw n.length===0?new O(`no daemon session is running`):t?new O(`no running daemon session ${t}`):new O(`several daemon sessions are running; name one:\n${n.map(e=>` ${e.taskId} ${e.artifact}`).join(`
517
- `)}`);return[`-L`,`ryugi`,`attach`,`-t`,r.window]}const pi=[`install`,`uninstall`,`status`,`trust`,`devices`,`remote`,`sessions`,`attach`],Cne=()=>(process.env.RYUGI_CLOUD_ORIGIN||`https://ryugi.innei.dev`).replace(/\/+$/,``);function mi(){return{arch:process.arch,fetch,home:g.default.homedir(),hubStart:[process.execPath,u.default.realpathSync(process.argv[1])],launchctl:e=>{let t=(0,f.spawnSync)(`launchctl`,e,{encoding:`utf8`});return{status:t.status,stderr:t.stderr??``}},path:process.env.PATH??`/usr/bin:/bin`,platform:process.platform,uid:process.getuid?.()??0,version:process.env.RYUGI_ARTIFACTS_VERSION||`1.101.2`,which:e=>{let t=(0,f.spawnSync)(`/usr/bin/which`,[e],{encoding:`utf8`});return t.status===0?t.stdout.trim():null}}}function hi(){let e=zt(process.env,process.platform,g.default.homedir()),t=Cne(),n=Rt(e,t);if(!n)throw new O(`sign in to Ryugi Cloud (${t}) on this computer first`);return{origin:t,token:n.token,hostId:hne(e)}}const gi=()=>mne(pne());async function _i(e){try{return await e()}catch(e){let t=e.code;throw t===`ENOENT`||t===`ECONNREFUSED`?new O(`the daemon is not running; install it with: ryugi daemon install`):new O(e.message)}}async function vi(){return(await _i(()=>gi().call(`sessions.local`,{}))).sessions}async function wne(e){let[t,n,r]=e.positionals;if(!t||!pi.includes(t))throw new O(`usage: ryugi daemon ${pi.join(`|`)}`);let i=(e,n)=>({action:t,status:e,lines:n});switch(t){case`install`:{let t=await yne(mi(),{binary:e.values.binary});return i(`installed`,[`binary ${t.binary}`,`agent ${t.plist}`,...t.tmux?[]:[`tmux is missing; install it with: brew install tmux`]])}case`uninstall`:{let e=bne(mi());return i(`removed`,[`removed ${e.binary}`,`removed ${e.plist}`])}case`status`:{let e=await _i(()=>gi().call(`status`,{}));return i(`running`,[`version ${e.version}`,`remote ${e.remote?`on`:`off`}`,`sessions ${e.sessions} running, ${e.queued} queued`])}case`trust`:{if(!n)throw new O(`usage: ryugi daemon trust <code>`);let t=await xne({code:n,cloud:hi(),daemon:gi(),fetch,label:e.values.label});return i(`trusted`,[`${t.deviceId} ${t.label}`])}case`devices`:{if(n===`revoke`){if(!r)throw new O(`usage: ryugi daemon devices revoke <device-id>`);let e=hi(),t=await fetch(`${e.origin}/api/devices/${encodeURIComponent(r)}`,{method:`DELETE`,headers:{Authorization:`Bearer ${e.token}`}});if(!t.ok&&t.status!==404)throw new O(`Cloud refused the revoke: HTTP ${t.status}`);return await _i(()=>gi().call(`trust.remove`,{deviceId:r})),i(`revoked`,[r])}let e=await _i(()=>gi().call(`trust.list`,{}));return i(`listed`,e.devices.length?e.devices.map(e=>`${e.id} ${e.label}`):[`no trusted devices; pair one from Ryugi Cloud on the phone`])}case`remote`:if(n!==`on`&&n!==`off`)throw new O(`usage: ryugi daemon remote on|off`);return await _i(()=>gi().call(`remote.set`,{on:n===`on`})),i(n,[`remote mode ${n}`]);case`sessions`:{let e=await vi();return i(`listed`,e.length?e.map(e=>`${e.taskId} ${e.state.padEnd(7)} ${e.harness.padEnd(6)} ${e.artifact} ${e.projectDir}`):[`no daemon sessions`])}default:{let e=Sne(await vi(),n);return process.stderr.write(`This is a daemon session: it runs with permission checks bypassed.
489
+ `}async function _ne(e){let t=`ryugi-daemon-${e.platform}-${e.arch}`,n=`${(process.env.RYUGI_DAEMON_RELEASE_BASE||`https://github.com/Innei/ryugi/releases/download`).replace(/\/+$/,``)}/v${e.version}/${t}`,r=await e.fetch(n);if(!r.ok)throw new O(`could not download ${t} ${e.version}: HTTP ${r.status}`);let i=Buffer.from(await r.arrayBuffer()),a=await e.fetch(`${n}.sha256`);if(!a.ok)throw new O(`could not download the sha256 for ${t}: HTTP ${a.status}`);if((await a.text()).trim().split(/\s+/)[0]?.toLowerCase()!==p.default.createHash(`sha256`).update(i).digest(`hex`))throw new O(`${t} failed its sha256 check; nothing was installed`);return i}function vne(e,t){u.default.mkdirSync(d.default.dirname(e),{recursive:!0,mode:448});let n=`${e}.${process.pid}.tmp`;u.default.writeFileSync(n,t,{mode:493}),u.default.chmodSync(n,493),u.default.renameSync(n,e)}async function yne(e,t){if(e.platform!==`darwin`)throw new O(`ryugi daemon runs on macOS only for now`);if(!t.binary&&e.arch!==`arm64`)throw new O(`ryugi-daemon ships for Apple silicon Macs only`);let n=di(e.home),r=t.binary?u.default.readFileSync(t.binary):await _ne(e);vne(n.binary,r),u.default.mkdirSync(d.default.dirname(n.log),{recursive:!0,mode:448}),u.default.mkdirSync(d.default.dirname(n.plist),{recursive:!0}),u.default.writeFileSync(n.plist,gne({binary:n.binary,hubStart:e.hubStart,path:e.path,log:n.log})),e.launchctl([`bootout`,`gui/${e.uid}/${ui}`]);let i=e.launchctl([`bootstrap`,`gui/${e.uid}`,n.plist]);if(i.status!==0)throw new O(`launchctl bootstrap failed: ${i.stderr.trim()}`);return{binary:n.binary,plist:n.plist,tmux:e.which(`tmux`)!==null}}function bne(e){let t=di(e.home);return e.launchctl([`bootout`,`gui/${e.uid}/${ui}`]),u.default.rmSync(t.plist,{force:!0}),u.default.rmSync(t.binary,{force:!0}),{binary:t.binary,plist:t.plist}}async function xne(e){let{cloud:t}=e;try{await e.daemon.call(`status`,{})}catch{throw new O(`the daemon is not running; start it with: ryugi daemon install`)}let n=await e.fetch(`${t.origin}/api/devices/confirm`,{method:`POST`,headers:{Authorization:`Bearer ${t.token}`,"Content-Type":`application/json`},body:JSON.stringify({code:e.code.trim().toUpperCase(),hostId:t.hostId,...e.label?{label:e.label}:{}})}),r=await n.json().catch(()=>null);if(!n.ok||!r?.deviceId)throw new O(r?.error?.message??`Cloud refused the code: HTTP ${n.status}`);let i=r.label??``;return await e.daemon.call(`trust.add`,{deviceId:r.deviceId,label:i}),{deviceId:r.deviceId,label:i}}function Sne(e,t){let n=e.filter(e=>e.state===`running`&&e.window),r=t?n.find(e=>e.taskId===t||e.artifact===t):n.length===1?n[0]:void 0;if(!r)throw n.length===0?new O(`no daemon session is running`):t?new O(`no running daemon session ${t}`):new O(`several daemon sessions are running; name one:\n${n.map(e=>` ${e.taskId} ${e.artifact}`).join(`
490
+ `)}`);return[`-L`,`ryugi`,`attach`,`-t`,r.window]}const pi=[`install`,`uninstall`,`status`,`trust`,`devices`,`remote`,`sessions`,`attach`],Cne=()=>(process.env.RYUGI_CLOUD_ORIGIN||`https://ryugi.innei.dev`).replace(/\/+$/,``);function mi(){return{arch:process.arch,fetch,home:g.default.homedir(),hubStart:[process.execPath,u.default.realpathSync(process.argv[1])],launchctl:e=>{let t=(0,f.spawnSync)(`launchctl`,e,{encoding:`utf8`});return{status:t.status,stderr:t.stderr??``}},path:process.env.PATH??`/usr/bin:/bin`,platform:process.platform,uid:process.getuid?.()??0,version:process.env.RYUGI_ARTIFACTS_VERSION||`1.102.1`,which:e=>{let t=(0,f.spawnSync)(`/usr/bin/which`,[e],{encoding:`utf8`});return t.status===0?t.stdout.trim():null}}}function hi(){let e=zt(process.env,process.platform,g.default.homedir()),t=Cne(),n=Rt(e,t);if(!n)throw new O(`sign in to Ryugi Cloud (${t}) on this computer first`);return{origin:t,token:n.token,hostId:hne(e)}}const gi=()=>mne(pne());async function _i(e){try{return await e()}catch(e){let t=e.code;throw t===`ENOENT`||t===`ECONNREFUSED`?new O(`the daemon is not running; install it with: ryugi daemon install`):new O(e.message)}}async function vi(){return(await _i(()=>gi().call(`sessions.local`,{}))).sessions}async function wne(e){let[t,n,r]=e.positionals;if(!t||!pi.includes(t))throw new O(`usage: ryugi daemon ${pi.join(`|`)}`);let i=(e,n)=>({action:t,status:e,lines:n});switch(t){case`install`:{let t=await yne(mi(),{binary:e.values.binary});return i(`installed`,[`binary ${t.binary}`,`agent ${t.plist}`,...t.tmux?[]:[`tmux is missing; install it with: brew install tmux`]])}case`uninstall`:{let e=bne(mi());return i(`removed`,[`removed ${e.binary}`,`removed ${e.plist}`])}case`status`:{let e=await _i(()=>gi().call(`status`,{}));return i(`running`,[`version ${e.version}`,`remote ${e.remote?`on`:`off`}`,`sessions ${e.sessions} running, ${e.queued} queued`])}case`trust`:{if(!n)throw new O(`usage: ryugi daemon trust <code>`);let t=await xne({code:n,cloud:hi(),daemon:gi(),fetch,label:e.values.label});return i(`trusted`,[`${t.deviceId} ${t.label}`])}case`devices`:{if(n===`revoke`){if(!r)throw new O(`usage: ryugi daemon devices revoke <device-id>`);let e=hi(),t=await fetch(`${e.origin}/api/devices/${encodeURIComponent(r)}`,{method:`DELETE`,headers:{Authorization:`Bearer ${e.token}`}});if(!t.ok&&t.status!==404)throw new O(`Cloud refused the revoke: HTTP ${t.status}`);return await _i(()=>gi().call(`trust.remove`,{deviceId:r})),i(`revoked`,[r])}let e=await _i(()=>gi().call(`trust.list`,{}));return i(`listed`,e.devices.length?e.devices.map(e=>`${e.id} ${e.label}`):[`no trusted devices; pair one from Ryugi Cloud on the phone`])}case`remote`:if(n!==`on`&&n!==`off`)throw new O(`usage: ryugi daemon remote on|off`);return await _i(()=>gi().call(`remote.set`,{on:n===`on`})),i(n,[`remote mode ${n}`]);case`sessions`:{let e=await vi();return i(`listed`,e.length?e.map(e=>`${e.taskId} ${e.state.padEnd(7)} ${e.harness.padEnd(6)} ${e.artifact} ${e.projectDir}`):[`no daemon sessions`])}default:{let e=Sne(await vi(),n);return process.stderr.write(`This is a daemon session: it runs with permission checks bypassed.
518
491
  `),i((0,f.spawnSync)(`tmux`,e,{stdio:`inherit`}).status===0?`detached`:`failed`,[])}}}function Tne({data:e}){return{heading:`Daemon`,status:e.status,summary:``,facts:[],sections:e.lines.length?[{kind:`content`,key:`lines`,text:e.lines.join(`
519
492
  `)}]:[]}}const Ene={name:`daemon`,summary:`Install and run the daemon that starts agent sessions from your phone`,usage:[`install [--binary <path>]`,`uninstall`,`status`,`trust <code> [--label <name>]`,`devices [revoke <device-id>]`,`remote on|off`,`sessions`,`attach [<task-id>|<type>/<id>]`],details:`install downloads ryugi-daemon for this version, checks its sha256 and loads it as a launchd agent (--binary installs a local build instead). trust confirms the code shown on the phone with Ryugi Cloud and adds the device to the daemon. remote off makes the daemon refuse new tasks, resumes and screens. attach opens a daemon session in this terminal.`,positionals:3,options:{binary:{type:`string`,value:`<path>`,help:`Install this ryugi-daemon build instead of downloading one`},label:{type:`string`,value:`<name>`,help:`Name for the trusted device`}},semantic:e=>sr({id:`daemon`,mode:`finite`,output:{formats:[`brief`,`json`,`quiet`],scalar:e=>e.status},async run(){let t=await wne(e);return Zn(t,t.status===`failed`?{kind:`failed`,error:{code:`E_DAEMON`,message:`daemon ${t.action} failed`}}:{kind:`succeeded`})},present:Tne},e)};function yi(e,t){try{return u.default.realpathSync(e)===u.default.realpathSync(t)}catch{return d.default.resolve(e)===d.default.resolve(t)}}function bi(e,t){let n=JSON.parse(t(`claude`,[`plugin`,`list`,`--json`]));if(!Array.isArray(n))throw Error(`Claude returned an unknown plugin list`);let r=n.find(t=>t.id===e&&t.scope===`user`);if(!r||typeof r.installPath!=`string`)throw Error(`Native Claude plugin not found: ${e}`);return{path:r.installPath,source:typeof r.readFromFolder==`string`?r.readFromFolder:r.installPath,version:String(r.version||`unknown`)}}function xi(e,t){let n=e.path;if(e.harness===`claude-code`)return!e.nativeSource||!e.registration?!1:yi(bi(e.registration,t).source,e.nativeSource);if(e.harness===`codex`){let e=JSON.parse(t(`codex`,[`plugin`,`list`,`--json`]));return Array.isArray(e.installed)&&e.installed.some(e=>e.pluginId===`ryugi@ryugi-managed`&&typeof e.source?.path==`string`&&yi(e.source.path,n))}if(e.harness===`pi`)return t(`pi`,[`list`]).split(/\r?\n/).some(e=>d.default.isAbsolute(e.trim())&&yi(e.trim(),n));if(e.harness===`gemini`){let e=JSON.parse(t(`gemini`,[`extensions`,`list`,`--output-format`,`json`]));return Array.isArray(e)&&e.some(e=>e.name===`ryugi`&&e.installMetadata?.type===`link`&&typeof e.installMetadata.source==`string`&&yi(e.installMetadata.source,n)&&typeof e.path==`string`&&yi(e.path,n))}if(e.harness===`copilot`){let e=JSON.parse(t(`copilot`,[`plugin`,`list`,`--json`]));return Array.isArray(e)&&e.some(e=>e.name===`ryugi`&&e.marketplace===`ryugi-managed`&&typeof e.installedFrom==`string`&&yi(e.installedFrom,d.default.dirname(n)))}if(e.harness===`agy`){let e=JSON.parse(t(`agy`,[`plugin`,`list`,`--json`])),r=JSON.parse(u.default.readFileSync(d.default.join(n,`.antigravity-plugin/plugin.json`),`utf8`)).version;return Array.isArray(e)&&e.some(e=>e.name===`ryugi`&&e.enabled!==!1&&e.version===r)}return!0}function Dne(e,t,n){let r=JSON.parse(n(e,[`plugin`,`marketplace`,`list`,`--json`])),i=e===`codex`?r.marketplaces:r;if(!Array.isArray(i))throw Error(`${e} returned an unknown marketplace list`);return i.some(n=>n.name===`ryugi-managed`&&(e===`codex`?typeof n.root==`string`&&yi(n.root,t):typeof n.source==`string`&&yi(n.source.replace(/^Local:\s*/i,``),t)))}function One(e,t){let n=JSON.parse(t(e,[`plugin`,`marketplace`,`list`,`--json`])),r=e===`codex`?n.marketplaces:n;if(!Array.isArray(r))throw Error(`${e} returned an unknown marketplace list`);return r.some(e=>e.name===`ryugi-managed`)}function Si(e){let t=(0,p.createHash)(`sha256`);function n(r){for(let i of u.default.readdirSync(r).sort()){let a=d.default.join(r,i),o=u.default.lstatSync(a);if(o.isSymbolicLink())throw Error(`Plugin contains an unexpected symlink: ${a}`);t.update(d.default.relative(e,a)),t.update(o.isDirectory()?`\0dir\0`:`\0file\0`),o.isDirectory()?n(a):t.update(u.default.readFileSync(a))}}return n(e),t.digest(`hex`)}function kne(e,t,n){if(u.default.existsSync(t))throw Error(`Candidate already exists: ${t}`);u.default.mkdirSync(t,{recursive:!0});try{for(let n of[`skills`,`hooks`,`lib`,`assets`,`index.js`,`package.json`,`LICENSE`,`GEMINI.md`,`gemini-extension.json`,`.pi`,`.opencode`,`.antigravity-plugin`,`.claude-plugin`,`.codex-plugin`,`.cursor-plugin`]){let r=d.default.join(e,n);u.default.existsSync(r)&&u.default.cpSync(r,d.default.join(t,n),{recursive:!0,filter(t){let n=d.default.relative(e,t).replaceAll(`\\`,`/`);if(/^skills\/artifacts\/app\/(cli\.cjs|server\.cjs|viewer|runtime)(\/|$)/.test(n))return!1;if(u.default.lstatSync(t).isSymbolicLink())throw Error(`Plugin source symlink is not supported: ${t}`);return!0}})}for(let e of[`artifacts`,`interface-craft`,...n===`full`?[`using-ryugi`]:[]])if(!u.default.existsSync(d.default.join(t,`skills`,e,`SKILL.md`)))throw Error(`Incomplete Ryugi plugin: missing ${e}`);if(n===`artifacts`){for(let e of u.default.readdirSync(d.default.join(t,`skills`)))[`artifacts`,`interface-craft`].includes(e)||u.default.rmSync(d.default.join(t,`skills`,e),{recursive:!0,force:!0});u.default.writeFileSync(d.default.join(t,`GEMINI.md`),`# Ryugi Artifacts
520
493
  Use the artifacts and interface-craft skills when requested.
@@ -540,7 +513,7 @@ if (!relative || relative.startsWith('..') || path.isAbsolute(relative)) throw E
540
513
  process.env.RYUGI_INSTALL_ROOT = root;
541
514
  process.env.RYUGI_MANAGED_RUNTIME = '1';
542
515
  require(path.join(current.packageRoot, 'dist/cli.cjs'));
543
- `}shimSource(){return`@echo off\r\nnode "${this.launcher}" %*\r\n`}ownsBin(){try{return process.platform===`win32`?u.default.readFileSync(this.bin,`utf8`)===this.shimSource():u.default.lstatSync(this.bin).isSymbolicLink()&&u.default.realpathSync(this.bin)===u.default.realpathSync(this.launcher)}catch{return!1}}preflight(){let e=!1;try{u.default.lstatSync(this.bin),e=!0}catch(e){if(e.code!==`ENOENT`)throw e}if(e&&!this.ownsBin())throw Error(`Command already exists at ${this.bin}; choose --bin-dir or keep its original package manager.`);if(u.default.existsSync(this.launcher)){let e=u.default.readFileSync(this.launcher,`utf8`);if(e!==this.launcherSource()&&ji(e)!==this.current()?.launcherDigest)throw Error(`Foreign launcher already exists at ${this.launcher}`)}}current(){let e=d.default.join(this.root,`current.json`);if(!u.default.existsSync(e))return null;let t=JSON.parse(u.default.readFileSync(e,`utf8`)),n=d.default.relative(u.default.realpathSync(d.default.join(this.root,`versions`)),u.default.realpathSync(t.packageRoot));if(!n||n.startsWith(`..`)||d.default.isAbsolute(n))throw Error(`Invalid runtime state at ${e}`);return t}install(e){this.preflight();let t=JSON.parse(u.default.readFileSync(d.default.join(e,`package.json`),`utf8`));if(t.name!==`ryugi-artifacts`||!/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/.test(t.version))throw Error(`Invalid Ryugi runtime package`);for(let t of Pne)if(!u.default.existsSync(d.default.join(e,t)))throw Error(`Incomplete Ryugi runtime: missing ${t}. Build or reinstall the complete package.`);let n=Mi(e),r=this.current();if(r&&r.version===t.version&&r.digest===n&&this.ownsBin())try{if(Mi(r.packageRoot)===n)return r}catch{}let i=d.default.join(this.root,`versions`,`${t.version}-${(0,p.randomUUID)()}`);u.default.mkdirSync(i,{recursive:!0});try{for(let t of[`package.json`,`bin`,`dist`])u.default.cpSync(d.default.join(e,t),d.default.join(i,t),{recursive:!0,dereference:!0});let r=(0,f.spawnSync)(process.execPath,[d.default.join(i,`dist/cli.cjs`),`--version`,`--format`,`brief`],{encoding:`utf8`,timeout:15e3,env:{...process.env,RYUGI_NO_UPDATE_CHECK:`1`}});if(r.error||r.status!==0||![t.version,`ryugi ${t.version}`].includes(r.stdout.trim()))throw Error(`Runtime validation failed: ${r.stderr||r.error?.message||`version mismatch`}`);u.default.writeFileSync(this.launcher,this.launcherSource(),{mode:493}),u.default.mkdirSync(this.binDir,{recursive:!0}),this.ownsBin()||(process.platform===`win32`?u.default.writeFileSync(this.bin,this.shimSource(),{flag:`wx`}):u.default.symlinkSync(this.launcher,this.bin));let a={version:t.version,digest:n,launcherDigest:ji(this.launcherSource()),packageRoot:i,launcher:this.launcher,bin:this.bin};return Ai(d.default.join(this.root,`current.json`),a),a}catch(e){throw u.default.rmSync(i,{recursive:!0,force:!0}),e}}};function Pi(e,t=process.env){return(t.PATH||``).split(d.default.delimiter).some(t=>d.default.resolve(t)===d.default.resolve(e))?null:(t.SHELL||``).endsWith(`/fish`)?`Run: fish_add_path ${JSON.stringify(e)}`:process.platform===`win32`?`Add ${e} to your user PATH, then open a new terminal.`:`Add to your shell profile: export PATH=${JSON.stringify(e)}:"$PATH"`}const Fi=e=>e===`antigravity`?`agy`:e;function Ii(e){let t=d.default.join(e,`installation.json`);if(!u.default.existsSync(t))return{schema:1,harnesses:{}};let n=JSON.parse(u.default.readFileSync(t,`utf8`));if(n.schema!==1||!n.harnesses||typeof n.harnesses!=`object`)throw Error(`Unsupported installation state: ${t}`);return n}function Li(e,t){Ai(d.default.join(e,`installation.json`),t)}const Fne=e=>`export { default, RyugiPlugin } from ${JSON.stringify((0,v.pathToFileURL)(d.default.join(e,`.opencode/plugins/ryugi.js`)).href)};\n`;function Ine(e,t={}){let n=[],r=new Ni(e).current();if(r){let i=new Ni(e,t.binDir||d.default.dirname(r.bin));n.push({component:`CLI command`,status:i.ownsBin()?`ok`:`attention`,message:i.bin});let a=Pi(i.binDir,t.env||process.env);n.push({component:`PATH`,status:a?`attention`:`ok`,message:a||`${i.binDir} is on PATH`});for(let e of[`dist/cli.cjs`,`dist/server.cjs`,`dist/document-host.cjs`,`dist/viewer/index.html`,`dist/runtime/ryugi-ui.js`])n.push({component:`CLI ${e}`,status:u.default.existsSync(d.default.join(r.packageRoot,e))?`ok`:`attention`,message:d.default.join(r.packageRoot,e)})}else n.push({component:`CLI runtime`,status:`attention`,message:`No self-managed runtime; retain the current package-manager or development CLI.`});for(let r of Object.values(Ii(e).harnesses))try{if(r.harness===`claude-code`){let e=d.default.join((t.env||process.env).CLAUDE_CONFIG_DIR||d.default.join(t.home||g.default.homedir(),`.claude`),`settings.json`);if(!JSON.parse(u.default.readFileSync(e,`utf8`)).enabledPlugins?.[r.registration])throw Error(`Recorded Claude plugin is not enabled at user scope`);if(!xi(r,t.run||wi))throw Error(`Native Claude source no longer matches the record`)}else if(Di(r,Ei(r.harness,{root:e,home:t.home})),!xi(r,t.run||wi))throw Error(`Native registration does not match the owned source`);n.push({component:r.harness,status:`ok`,message:`${r.mode} · ${r.version}; restart/new session required; delivery unverified`})}catch(e){n.push({component:r.harness,status:`attention`,message:e.message})}return n}function Lne(e,t={}){let n=Ii(e),r={removed:[],failures:[],preserved:[`Project artifacts, comments, harness plugin data and runtime caches are retained.`]},i=t.run||wi;for(let a of t.targets||Object.keys(n.harnesses)){let o=n.harnesses[a];if(o)try{if(a===`claude-code`){if(![`ryugi@ryugi-dev`,`ryugi-artifacts@ryugi-dev`].includes(o.registration||``))throw Error(`Unknown native Claude plugin identity`);if(!xi(o,i))throw Error(`Native Claude source changed; preserving it`);i(`claude`,[`plugin`,`uninstall`,o.registration,`--scope`,`user`])}else{if(Di(o,Ei(a,{root:e,home:t.home})),!xi(o,i))throw Error(`Native plugin source changed; preserving it`);if(a===`codex`&&i(`codex`,[`plugin`,`remove`,`ryugi@ryugi-managed`]),a===`copilot`&&i(`copilot`,[`plugin`,`uninstall`,`ryugi@ryugi-managed`]),a===`pi`&&i(`pi`,[`remove`,o.path]),a===`gemini`&&i(`gemini`,[`extensions`,`uninstall`,`ryugi`]),a===`agy`&&i(`agy`,[`plugin`,`uninstall`,`ryugi`]),a===`opencode`){let e=t.env||process.env,n=d.default.join(e.XDG_CONFIG_HOME||d.default.join(t.home||g.default.homedir(),`.config`),`opencode/plugins/ryugi.js`);if(!u.default.existsSync(n)||u.default.readFileSync(n,`utf8`)!==Fne(o.path))throw Error(`Plugin entry was changed; preserving ${n}`);u.default.unlinkSync(n)}u.default.rmSync(o.path,{recursive:!0})}delete n.harnesses[a],Li(e,n),r.removed.push(a)}catch(e){r.failures.push({component:a,message:e.message})}}if(!t.targets){let n=new Ni(e).current();if(n){let i=new Ni(e,t.binDir||d.default.dirname(n.bin));i.ownsBin()?(u.default.unlinkSync(i.bin),r.removed.push(`CLI command`)):r.failures.push({component:`CLI command`,message:`Command changed; preserving ${i.bin}`})}}return r}const Rne={name:`doctor`,summary:`Check installed CLI ownership, plugin files and native registrations`,options:{"install-dir":{type:`string`,value:`<path>`,help:`Managed installation directory`}},semantic:e=>sr({id:`doctor`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`]},run(){let t=Ine(d.default.resolve(e.values[`install-dir`]||Oi()));return Zn({checks:t},t.some(e=>e.status===`attention`)?{kind:`action_required`,reason:`Some installation components need attention`}:{kind:`succeeded`})},present:({data:e})=>({heading:`Doctor`,status:e.checks.some(e=>e.status===`attention`)?`attention`:`ok`,facts:[],sections:[{kind:`records`,key:`checks`,rows:e.checks.map(e=>({...e})),columns:[{key:`component`,required:!0},{key:`status`,required:!0},{key:`message`,required:!0}]}]})},e)},Ri={"X-Ryugi-Version":`1.101.2`},zne=/<head(\s[^>]*)?>/i,Bne=/^\s*(<!doctype[^>]*>)?\s*(<html(\s[^>]*)?>)?/i,Vne=/^<script>([\s\S]*?)<\/script>/,Hne=/^(?:<script (?:defer|type="module") src="[^"]*\/_ryugi\/runtime\/ryugi-(?:icons|ui|deck|storyboard)\.js"><\/script>|<style data-ryugi-deck>[^<]*<\/style>)+/;function Une(e){let t=zne.exec(e);return t?t.index+t[0].length:Bne.exec(e)?.[0].length??0}function Wne(e){let t=Une(e),n=e.slice(t);n.startsWith(`<style>:root{color-scheme:light dark;background:transparent}body{margin:0;font-family:var(--lobe-font-family,system-ui,-apple-system,sans-serif)}</style>`)&&(n=n.slice(153));let r=Vne.exec(n);return!r||!r[1].includes(`ryugi:`)?e:e.slice(0,t)+n.slice(r[0].length).replace(Hne,``)}const zi=/^[a-z0-9][a-z0-9-]{0,63}$/,Bi=e=>e.type===`ask`;function Gne(e,t){return{id:e.askId,blockId:t,...e.recommend?{recommend:e.recommend}:{},...e.placeholder?{placeholder:e.placeholder}:{},options:e.options.map(({value:e,label:t})=>({value:e,label:t}))}}function Kne(e){let t=[],n=(e,r)=>{Bi(e)&&t.push(Gne(e,r));for(let t of e.children??[])n(t,r)};for(let t of e.root.children)n(t,t.$?.blockId??``);return t}const Vi=e=>e===null||typeof e==`string`&&e.length<=2e4;function Hi(e){let t={};if(e.ask!==void 0){if(typeof e.ask!=`string`||!zi.test(e.ask))return null;t.ask=e.ask}if(e.choice!==void 0){if(!Vi(e.choice))return null;t.choice=e.choice}if(e.answer!==void 0){if(!Vi(e.answer))return null;t.answer=e.answer}if(e.note!==void 0){if(e.note!==!0)return null;t.note=!0}if(e.submit!==void 0){if(typeof e.submit!=`boolean`)return null;t.submit=e.submit}if(e.asks!==void 0){if(!Array.isArray(e.asks)||!e.asks.every(e=>typeof e==`string`))return null;t.asks=e.asks}if(e.remote!==void 0){if(e.remote!==!0)return null;t.remote=!0}if(e.of!==void 0){if(typeof e.of!=`string`)return null;t.of=e.of}return t}const qne=(e,t)=>JSON.stringify(Hi(e))===JSON.stringify(Hi(t)),Jne=e=>e.messages.find(e=>!e.deleted);function Ui(e,t){return e.map((e,t)=>({thread:e,index:t,message:Jne(e)})).filter(e=>e.message&&t(e.thread.anchor)).sort((e,t)=>e.message.at.localeCompare(t.message.at)||e.index-t.index)}function Yne(e){let t=new Set(Ui(e,e=>e.submit===!1&&e.of!==void 0).map(e=>e.thread.anchor.of));return Ui(e,e=>e.submit===!0).map(({thread:e,message:n})=>({id:e.id,at:n.at,asks:e.anchor.asks??[],withdrawn:t.has(e.id)}))}function Xne(e,t){let n=new Set(Yne(t).filter(e=>!e.withdrawn).flatMap(e=>e.asks)),r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map;for(let{thread:e,message:n}of Ui(t,e=>e.ask!==void 0&&e.note===void 0))e.anchor.remote?i.set(e.anchor.ask,[...i.get(e.anchor.ask)??[],{anchor:e.anchor,name:n.name}]):r.set(e.anchor.ask,e.anchor);let a=/* @__PURE__ */ new Set;for(let[e,t]of i){if(r.has(e))continue;let n=t[0].anchor;t.every(({anchor:e})=>(e.choice??null)===(n.choice??null)&&(e.answer??null)===(n.answer??null))&&(r.set(e,t.at(-1).anchor),a.add(e))}let o=/* @__PURE__ */ new Map;for(let{thread:e,message:n}of Ui(t,e=>e.ask!==void 0&&e.note===!0))o.set(e.anchor.ask,{text:n.text,by:n.name});let s=new Set(e.map(e=>e.id)),c=[.../* @__PURE__ */ new Set([...r.keys(),...i.keys(),...o.keys()])].filter(e=>!s.has(e)).map(e=>({id:e,blockId:``,options:[]}));return[...e,...c].map(e=>{let t=r.get(e.id),c=o.get(e.id),l=!s.has(e.id),u=new Set(e.options.map(e=>e.value)),d=t?.choice??null,f=d!==null&&(l||u.has(d))?d:null,p=t?.answer?.trim()?t.answer:null,m=f!==null||p!==null,h=!m&&e.recommend!==void 0,g=m?f:e.recommend??null,_=l?`orphan`:c?`settled`:n.has(e.id)||a.has(e.id)?`submitted`:`draft`,v=i.get(e.id)?.map(({anchor:e,name:t})=>({...t?{name:t}:{},choice:e.choice??null,text:e.answer?.trim()?e.answer:null}));return{id:e.id,blockId:e.blockId,state:_,...e.recommend?{recommend:e.recommend}:{},...e.placeholder?{placeholder:e.placeholder}:{},options:e.options,choice:g,text:p,byRecommendation:h,changed:m&&(p!==null||f!==e.recommend),...c?{note:c.text,...c.by?{noteBy:c.by}:{}}:{},...d!==null&&f===null?{staleChoice:d}:{},...v?{others:v}:{}}})}const Wi=e=>typeof e==`string`&&e.length>0&&e.length<=200;function Zne(e){if(typeof e!=`object`||!e)return null;let t=e;return t.kind===`node`?Wi(t.id)?{kind:`node`,id:t.id}:null:t.kind===`edge`&&Wi(t.from)&&Wi(t.to)&&typeof t.index==`number`&&Number.isSafeInteger(t.index)&&t.index>=0?{kind:`edge`,from:t.from,to:t.to,index:t.index}:null}function Qne(e,t){return!e||!t?e===t:e.kind===`node`?t.kind===`node`&&e.id===t.id:t.kind===`edge`&&e.from===t.from&&e.to===t.to&&e.index===t.index}const Gi=e=>e.blockIds??[e.blockId],Ki=e=>typeof e==`object`&&!!e,$ne={read:e=>{if(!Ki(e)||typeof e.blockId!=`string`||!e.blockId)return null;let{blockIds:t,textRanges:n}=e,r=e.diagram===void 0?void 0:Zne(e.diagram);if(r===null||r&&(t!==void 0||n!==void 0)||t!==void 0&&(!Array.isArray(t)||!t.length||t[0]!==e.blockId||!t.every(e=>typeof e==`string`&&e.length>0&&e.length<=100)||new Set(t).size!==t.length))return null;let i=Hi(e);if(!i)return null;let a=t??[e.blockId];return n!==void 0&&(!Array.isArray(n)||n.length!==a.length||!n.every((e,t)=>Ki(e)&&e.blockId===a[t]&&typeof e.quote==`string`&&e.quote.length<=2e4&&typeof e.start==`number`&&Number.isSafeInteger(e.start)&&e.start>=0&&Number.isSafeInteger(e.start+e.quote.length)))?null:{blockId:e.blockId,...t?{blockIds:t}:{},...r?{diagram:r}:{},quote:typeof e.quote==`string`?e.quote:``,...n?{textRanges:n.map(({blockId:e,quote:t,start:n})=>({blockId:e,quote:t,start:n}))}:{},...i}},same:(e,t)=>qne(e,t)&&e.quote===t.quote&&Qne(e.diagram,t.diagram)&&Gi(e).length===Gi(t).length&&Gi(e).every((e,n)=>e===Gi(t)[n])&&e.textRanges?.length===t.textRanges?.length&&(e.textRanges??[]).every((e,n)=>{let r=t.textRanges?.[n];return e.blockId===r?.blockId&&e.quote===r.quote&&e.start===r.start}),missing:`a new thread needs anchor.blockId; dropped it`};function ere(e){let t=JSON.parse(e);if(!Ki(t))throw Error(`comments.json must be an object`);if(!Array.isArray(t.threads))throw Error(`threads must be an array`);return t.threads.forEach((e,t)=>{if(!Ki(e))throw Error(`threads[${t}] must be an object`);if(e.messages!==void 0&&!Array.isArray(e.messages))throw Error(`threads[${t}].messages must be an array`);if(!e.id&&!Ki(e.anchor))throw Error(`threads[${t}] needs an anchor`)}),t}const tre=e=>!!e.id&&(e.author===`human`||e.author===`agent`)&&typeof e.text==`string`&&typeof e.at==`string`;function nre(e,t=$ne){let n=[];for(let r of e.threads){let e=t.read(r.anchor);if(!r.id||!e||!r.statusAt||r.status!==`open`&&r.status!==`resolved`)continue;let i=(r.messages??[]).filter(tre),a=r.statusBy===`human`||r.statusBy===`agent`?{statusBy:r.statusBy}:{};n.push({id:r.id,anchor:e,status:r.status,statusAt:r.statusAt,...a,messages:i})}return{version:1,threads:n}}function qi(e){let t=0;for(;t<e.length;){let n=Math.min(t+65536,e.length);crypto.getRandomValues(e.subarray(t,n)),t=n}}function Ji(e){if(e|=0,e<0)throw RangeError(`Wrong ID size`);let t=Buffer.allocUnsafe(e);return qi(t),t}function Yi(e,t,n){let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i|=0;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}return(i=t)=>{if(!i)return``;let a=``,o=Math.ceil(409.6*i/r);for(;;){let t=n(o),s=o;for(;s--;)if(t[s]<r&&(a+=e[t[s]%e.length],a.length>=i))return a}}}function Xi(e,t=21){if(typeof e!=`string`||!e||e.length>256)return Yi(e,t,Ji);for(let n=0;n<e.length;n++)if(e.charCodeAt(n)>255)return Yi(e,t,Ji);let n=Uint8Array.from(e,e=>e.charCodeAt(0)),r=e.length,i=(2<<31-Math.clz32(r-1|1))-1,a=``,o=0,s=0;return(e=t)=>{if(e|=0,e<0)throw RangeError(`Wrong ID size`);if(e===0)return``;if(o+e>a.length){let t=Math.max(s,e);s=Math.min(t*16,32768);let c=Buffer.allocUnsafe(t);if(i===r-1){qi(c);for(let e=0;e<t;e++)c[e]=n[c[e]&i]}else{let e=Buffer.allocUnsafe(Math.ceil(1.6*(i+1)*t/r)),a=0;for(;a<t;){qi(e);for(let o=0;o<e.length;o++){let s=e[o]&i;if(s<r&&(c[a++]=n[s],a===t))break}}}a=c.toString(`latin1`),o=0}return o+=e,a.substring(o-e,o)}}Xi(`57X6y3wQZNzYjJB2L_10pxbackgroundhimselfUTF-8DEMOGRAPHICSVqvt4KW9`);var Zi=null;function rre(e){Zi=e}function ire(e){if(!Zi)throw Error(`@haklex/rich-litexml: parseHTML implementation not registered. Import from the main entry (@haklex/rich-litexml), not a deep submodule path.`);return Zi(e)}function Qi(e){let t=e.getAttribute(`id`);return t?{$:{blockId:t}}:{}}var $i={direction:`ltr`,format:``,indent:0,textFormat:0,textStyle:``,version:1};function are(e){e.registerReader(`p`,(e,t)=>({type:`paragraph`,...Qi(e),children:t.parseChildren(e),...$i}));for(let t=1;t<=6;t++)e.registerReader(`h${t}`,(e,n)=>({type:`heading`,tag:`h${t}`,...Qi(e),children:n.parseChildren(e),...$i}));e.registerReader(`blockquote`,(e,t)=>{let n=e.getAttribute(`attribution`),r=e.getAttribute(`rich`)!==null||n!==null,i={...Qi(e),children:t.parseChildren(e),...$i};return r?{type:`rich-quote`,attribution:n?.trim()?n:null,...i}:{type:`quote`,...i}}),e.registerReader(`hr`,e=>({type:`horizontalrule`,...Qi(e),version:1})),e.registerReader(`ul`,(e,t)=>({type:`list`,listType:e.getAttribute(`type`)===`check`?`check`:`bullet`,tag:`ul`,start:1,...Qi(e),children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`ol`,(e,t)=>({type:`list`,listType:`number`,tag:`ol`,start:Number(e.getAttribute(`start`)??1),...Qi(e),children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`li`,(e,t)=>{let n=e.getAttribute(`checked`);return{type:`listitem`,...Qi(e),...n===null?{}:{checked:n===`true`},children:t.parseChildren(e),...$i,value:1}}),e.registerReader(`a`,(e,t)=>({type:`link`,url:e.getAttribute(`href`)??``,target:e.getAttribute(`target`)??null,title:e.getAttribute(`title`)??null,rel:e.getAttribute(`rel`),children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`table`,(e,t)=>({type:`table`,...Qi(e),children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`tr`,(e,t)=>({type:`tablerow`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`th`,(e,t)=>({type:`tablecell`,headerState:1,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`td`,(e,t)=>({type:`tablecell`,headerState:0,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1}))}var ea=`abcdefghijklmnopqrstuvwxyz0123456789`,ore=Xi(ea,10),sre=Xi(ea,6),cre=Xi(ea,6),lre=Xi(ea,8),ure=Xi(ea,8);function ta(e){let t=e.getAttribute(`id`);return t?{$:{blockId:t}}:{}}function na(e,t){let n=e.getAttribute(t);return n===null?void 0:Number(n)}var dre=/* @__PURE__ */ new Set([`align-left`,`align-right`,`float-left`,`float-right`]);function fre(e){let t=na(e,`display-width`);return t!==void 0&&Number.isFinite(t)&&t>=10&&t<=100?t:void 0}function ra(e,t){let n=na(e,t);return n!==void 0&&Number.isFinite(n)&&n>0?Math.round(n):void 0}function pre(e){let t=fre(e);if(t!==void 0)return{displayWidth:t};let n=ra(e,`fixed-width`);if(n!==void 0)return{fixedWidth:n};let r=ra(e,`fixed-height`);return r===void 0?{}:{fixedHeight:r}}function mre(e){let t=e.getAttribute(`layout`);return t!==null&&dre.has(t)?t:void 0}var hre=/* @__PURE__ */ new Set([`auto`,`1:1`,`4:3`,`16:9`,`3:4`]),gre=/* @__PURE__ */ new Set([`cover`,`contain`]);function _re(e){let t=e.getAttribute(`aspect`);return t!==null&&hre.has(t)?t:`auto`}function vre(e){let t=e.getAttribute(`fit`);return t!==null&&gre.has(t)?t:`cover`}function yre(e){let t=na(e,`max-item-height`);return t!==void 0&&Number.isFinite(t)&&t>0?t:void 0}function ia(e){for(let t of e.childNodes)if(t.nodeType===8){let e=t.nodeValue??``;if(e.startsWith(`[CDATA[`)&&e.endsWith(`]]`))return e.slice(7,-2)}return null}function aa(e){return ia(e)??e.textContent??``}function bre(e){e.registerReader(`img`,e=>e.parentElement?.tagName.toLowerCase()!==`gallery`&&{type:`image`,...ta(e),src:e.getAttribute(`src`)??``,altText:e.getAttribute(`alt`)??``,width:na(e,`width`),height:na(e,`height`),caption:e.getAttribute(`caption`)??void 0,thumbhash:e.getAttribute(`thumbhash`)??void 0,accent:e.getAttribute(`accent`)??void 0,...pre(e),layout:mre(e),version:1}),e.registerReader(`video`,e=>({type:`video`,...ta(e),src:e.getAttribute(`src`)??``,poster:e.getAttribute(`poster`)??void 0,width:na(e,`width`),height:na(e,`height`),version:1})),e.registerReader(`attachment`,e=>({type:`file`,...ta(e),src:e.getAttribute(`src`)??``,name:e.getAttribute(`name`)??``,size:na(e,`size`),mimeType:e.getAttribute(`mime-type`)??void 0,ext:e.getAttribute(`ext`)??void 0,display:e.getAttribute(`display`)===`inline`?`inline`:`block`,version:1})),e.registerReader(`link-card`,e=>({type:`link-card`,...ta(e),url:e.getAttribute(`url`)??``,source:e.getAttribute(`source`)??void 0,title:e.getAttribute(`title`)??void 0,description:e.getAttribute(`description`)??void 0,favicon:e.getAttribute(`favicon`)??void 0,image:e.getAttribute(`image`)??void 0,version:1})),e.registerReader(`embed`,e=>({type:`embed`,...ta(e),url:e.getAttribute(`url`)??``,source:e.getAttribute(`source`)??null,version:1})),e.registerReader(`codeblock`,e=>({type:`code-block`,...ta(e),code:aa(e),language:e.getAttribute(`lang`)??``,version:1})),e.registerReader(`mermaid`,e=>({type:`mermaid`,...ta(e),diagram:aa(e),version:1})),e.registerReader(`math`,e=>{if(e.getAttribute(`display`)===`block`)return{type:`katex-block`,...ta(e),equation:aa(e),version:1};let t=e.getAttribute(`color`);return{type:`katex-inline`,equation:aa(e),...t?{color:t}:{},version:1}}),e.registerReader(`alert`,(e,t)=>{let n={root:{type:`root`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1}};return{type:`alert-quote`,...ta(e),alertType:e.getAttribute(`type`)??`note`,content:n,version:1}}),e.registerReader(`banner`,(e,t)=>{let n={root:{type:`root`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1}};return{type:`banner`,...ta(e),bannerType:e.getAttribute(`type`)??`note`,content:n,version:1}}),e.registerReader(`nested-doc`,(e,t)=>{let n={root:{type:`root`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1}};return{type:`nested-doc`,...ta(e),content:n,version:1}}),e.registerReader(`details`,(e,t)=>({type:`details`,...ta(e),summary:e.getAttribute(`summary`)??``,open:e.getAttribute(`open`)===`true`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`spoiler`,(e,t)=>({type:`spoiler`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,textFormat:0,textStyle:``,version:1})),e.registerReader(`ruby`,(e,t)=>({type:`ruby`,reading:e.getAttribute(`rt`)??``,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,textFormat:0,textStyle:``,version:1})),e.registerReader(`mention`,e=>({type:`mention`,platform:e.getAttribute(`platform`)??``,handle:e.getAttribute(`handle`)??``,displayName:e.textContent||void 0,version:1})),e.registerReader(`tag`,e=>({type:`tag`,text:e.textContent??``,format:0,detail:0,mode:`normal`,style:``,version:1})),e.registerReader(`comment`,e=>({type:`comment`,text:e.textContent??``,format:0,detail:0,mode:`normal`,style:``,version:1})),e.registerReader(`footnote`,e=>({type:`footnote`,identifier:e.getAttribute(`ref`)??``,version:1})),e.registerReader(`footnote-section`,e=>{let t={};for(let n of e.children)if(n.tagName.toLowerCase()===`def`){let e=n.getAttribute(`ref`)??``;t[e]=n.textContent??``}return{type:`footnote-section`,...ta(e),definitions:t,version:1}}),e.registerReader(`gallery`,e=>{let t=[];for(let n of e.children)n.tagName.toLowerCase()===`img`&&t.push({src:n.getAttribute(`src`)??``,alt:n.getAttribute(`alt`)??void 0});return{type:`gallery`,...ta(e),images:t,layout:e.getAttribute(`layout`)??`grid`,aspect:_re(e),fit:vre(e),maxItemHeight:yre(e),version:1}}),e.registerReader(`excalidraw`,e=>({type:`excalidraw`,...ta(e),snapshot:ia(e)||e.getAttribute(`snapshot`)||e.textContent?.trim()||``,version:1})),e.registerReader(`chart`,e=>({type:`chart`,...ta(e),spec:aa(e).trim(),version:1})),e.registerReader(`dynamic`,e=>{let t={},n=(ia(e)??e.textContent??``).trim();if(n)try{let e=JSON.parse(n);e&&typeof e==`object`&&!Array.isArray(e)&&(t=e)}catch{}return{type:`dynamic`,...ta(e),url:e.getAttribute(`url`)??``,props:t,initialHeight:na(e,`initial-height`)??320,version:1}}),e.registerReader(`grid`,(e,t)=>{let n=[];for(let r of e.children)if(r.tagName.toLowerCase()===`cell`){let e=t.parseChildren(r);n.push({root:{type:`root`,children:e,direction:`ltr`,format:``,indent:0,version:1}})}return{type:`grid-container`,...ta(e),cols:na(e,`cols`)??2,gap:e.getAttribute(`gap`)??`16px`,cells:n,version:1}}),e.registerReader(`agent-diff`,e=>({type:`agent-diff`,...ta(e),opType:e.getAttribute(`op`)??`insert`,diffEntryId:e.getAttribute(`entry`)??``,version:1})),e.registerReader(`code-snippet`,e=>{let t=[];for(let n of e.children)n.tagName.toLowerCase()===`file`&&t.push({filename:n.getAttribute(`name`)??``,code:aa(n),language:n.getAttribute(`lang`)??``});return{type:`code-snippet`,...ta(e),files:t,version:1}}),e.registerReader(`steps`,(e,t)=>{let n=[];for(let r of e.children)r.tagName.toLowerCase()===`step`&&n.push({id:r.getAttribute(`id`)||`s_${ure()}`,title:r.getAttribute(`title`)??``,content:{root:{type:`root`,children:t.parseChildren(r),direction:`ltr`,format:``,indent:0,version:1}}});return{type:`steps`,...ta(e),steps:n,version:1}}),e.registerReader(`chat`,e=>{let t=e.getAttribute(`variant`)===`user-user`?`user-user`:`user-agent`,n=[],r=[];for(let t of e.children){let e=t.tagName.toLowerCase();if(e===`participants`)for(let e of t.children){if(e.tagName.toLowerCase()!==`participant`)continue;let t=e.getAttribute(`kind`)===`agent`?`agent`:`user`;n.push({id:e.getAttribute(`id`)||`p_${cre()}`,kind:t,name:e.getAttribute(`name`)||void 0,avatar:e.getAttribute(`avatar`)||void 0})}else if(e===`messages`)for(let e of t.children)e.tagName.toLowerCase()===`message`&&r.push({id:e.getAttribute(`id`)||`m_${lre()}`,participantId:e.getAttribute(`participant`)??``,content:e.textContent??``})}return{type:`chat`,...ta(e),variant:t,participants:n,messages:r,version:1}}),e.registerReader(`poll`,e=>{let t=``,n=[];for(let r of e.children){let e=r.tagName.toLowerCase();if(e===`question`)t=r.textContent??``;else if(e===`option`){let e=r.getAttribute(`id`)||`o_${sre()}`;n.push({id:e,label:r.textContent??``})}}let r=e.getAttribute(`mode`)===`multiple`?`multiple`:`single`,i=e.getAttribute(`close-at`),a=e.getAttribute(`show-results`),o=a===`always`||a===`after-vote`||a===`after-close`?a:void 0;return{type:`poll`,...ta(e),pollId:e.getAttribute(`poll-id`)||`p_${ore()}`,question:t,options:n,mode:r,...i?{closeAt:i}:{},...o?{showResults:o}:{},version:1}})}var xre=class{constructor(){this.writers=/* @__PURE__ */ new Map,this.readers=/* @__PURE__ */ new Map}registerWriter(e,t){this.writers.set(e,t)}registerReader(e,t){this.readers.set(e.toLowerCase(),t)}getWriter(e){return this.writers.get(e)}getReader(e){return this.readers.get(e.toLowerCase())}};function oa(e){return e.$?.blockId?{id:e.$.blockId}:{}}function Sre(e){e.registerWriter(`paragraph`,(e,t)=>{let n=e;return{tag:`p`,attrs:oa(n),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`heading`,(e,t)=>{let n=e;return{tag:n.tag??`h1`,attrs:oa(n),children:t.serializeChildren(n.children??[])}});let t=(e,t)=>{let n=e,r={...oa(n)};return n.type===`rich-quote`&&((typeof n.attribution==`string`?n.attribution.trim():``)===``?r.rich=`true`:r.attribution=n.attribution),{tag:`blockquote`,attrs:r,children:t.serializeChildren(n.children??[])}};e.registerWriter(`quote`,t),e.registerWriter(`rich-quote`,t),e.registerWriter(`horizontalrule`,e=>({tag:`hr`,attrs:oa(e),selfClosing:!0})),e.registerWriter(`list`,(e,t)=>{let n=e,r=n.listType===`number`?`ol`:`ul`,i={...oa(n)};return n.listType===`check`&&(i.type=`check`),{tag:r,attrs:i,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`listitem`,(e,t)=>{let n=e,r={...oa(n)};return n.checked!==void 0&&(r.checked=String(n.checked)),{tag:`li`,attrs:r,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`link`,(e,t)=>{let n=e,r={href:typeof n.url==`string`?n.url:``};return typeof n.target==`string`&&n.target!==``&&(r.target=n.target),typeof n.title==`string`&&n.title!==``&&(r.title=n.title),typeof n.rel==`string`&&n.rel!==``&&(r.rel=n.rel),{tag:`a`,attrs:r,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`autolink`,(e,t)=>{let n=e;return{tag:`a`,attrs:{href:n.url??``},children:t.serializeChildren(n.children??[])}}),e.registerWriter(`table`,(e,t)=>{let n=e;return{tag:`table`,attrs:oa(n),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`tablerow`,(e,t)=>{let n=e;return{tag:`tr`,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`tablecell`,(e,t)=>{let n=e;return{tag:n.headerState===1?`th`:`td`,children:t.serializeChildren(n.children??[])}})}function sa(e){return e.$?.blockId?{id:e.$.blockId}:{}}function ca(e){let t={};for(let[n,r]of Object.entries(e))r!=null&&r!==``&&(t[n]=String(r));return t}function Cre(e){e.registerWriter(`image`,e=>{let t=e;return{tag:`img`,attrs:ca({...sa(t),src:t.src,alt:t.altText,width:t.width==null?void 0:String(t.width),height:t.height==null?void 0:String(t.height),caption:t.caption,thumbhash:t.thumbhash,accent:t.accent,"display-width":t.displayWidth==null?void 0:String(t.displayWidth),"fixed-width":t.fixedWidth==null?void 0:String(t.fixedWidth),"fixed-height":t.fixedHeight==null?void 0:String(t.fixedHeight),layout:t.layout}),selfClosing:!0}}),e.registerWriter(`video`,e=>{let t=e;return{tag:`video`,attrs:ca({...sa(t),src:t.src,poster:t.poster}),selfClosing:!0}}),e.registerWriter(`file`,e=>{let t=e;return{tag:`attachment`,attrs:ca({...sa(t),src:t.src,name:t.name,size:t.size==null?void 0:String(t.size),"mime-type":t.mimeType,ext:t.ext,display:t.display===`inline`?`inline`:void 0}),selfClosing:!0}}),e.registerWriter(`link-card`,e=>{let t=e;return{tag:`link-card`,attrs:ca({...sa(t),url:t.url,source:t.source,title:t.title,description:t.description,favicon:t.favicon,image:t.image}),selfClosing:!0}}),e.registerWriter(`embed`,e=>{let t=e;return{tag:`embed`,attrs:ca({...sa(t),url:t.url,source:t.source}),selfClosing:!0}}),e.registerWriter(`code-block`,e=>{let t=e;return{tag:`codeblock`,attrs:ca({...sa(t),lang:t.language}),children:[t.code??``]}}),e.registerWriter(`mermaid`,e=>{let t=e;return{tag:`mermaid`,attrs:sa(t),children:[t.diagram??``]}}),e.registerWriter(`katex-block`,e=>{let t=e;return{tag:`math`,attrs:{...sa(t),display:`block`},children:[t.equation??``]}}),e.registerWriter(`katex-inline`,e=>{let t=e,n={};return t.color&&(n.color=t.color),{tag:`math`,attrs:Object.keys(n).length>0?n:void 0,children:[t.equation??``]}}),e.registerWriter(`alert-quote`,(e,t)=>{let n=e;return{tag:`alert`,attrs:ca({...sa(n),type:n.alertType}),children:t.serializeNestedState(n.content)}}),e.registerWriter(`banner`,(e,t)=>{let n=e;return{tag:`banner`,attrs:ca({...sa(n),type:n.bannerType}),children:t.serializeNestedState(n.content)}}),e.registerWriter(`nested-doc`,(e,t)=>{let n=e;return{tag:`nested-doc`,attrs:sa(n),children:t.serializeNestedState(n.content??n.contentState)}}),e.registerWriter(`excalidraw`,e=>{let t=e;return t.snapshot?/^(?:https?:\/\/|blob:|ref:)\S+$/.test(t.snapshot.trim())?{tag:`excalidraw`,attrs:ca(sa(t)),children:[t.snapshot.trim()]}:{tag:`excalidraw`,attrs:ca(sa(t)),children:[{cdata:t.snapshot}]}:{tag:`excalidraw`,attrs:ca(sa(t)),selfClosing:!0}}),e.registerWriter(`chart`,e=>{let t=e,n=typeof t.spec==`string`?t.spec:``;return n?{tag:`chart`,attrs:ca(sa(t)),children:[{cdata:n}]}:{tag:`chart`,attrs:ca(sa(t)),selfClosing:!0}}),e.registerWriter(`dynamic`,e=>{let t=e,n=ca({...sa(t),url:t.url,"initial-height":t.initialHeight==null?void 0:String(t.initialHeight)});return!t.props||Object.keys(t.props).length===0?{tag:`dynamic`,attrs:n,selfClosing:!0}:{tag:`dynamic`,attrs:n,children:[{cdata:JSON.stringify(t.props)}]}}),e.registerWriter(`grid-container`,(e,t)=>{let n=e,r=(n.cells??[]).map(e=>({tag:`cell`,children:t.serializeNestedState(e)}));return{tag:`grid`,attrs:ca({...sa(n),cols:n.cols==null?void 0:String(n.cols),gap:n.gap}),children:r}}),e.registerWriter(`agent-diff`,e=>{let t=e;return{tag:`agent-diff`,attrs:ca({...sa(t),op:t.opType,entry:t.diffEntryId}),selfClosing:!0}}),e.registerWriter(`details`,(e,t)=>{let n=e;return{tag:`details`,attrs:ca({...sa(n),summary:n.summary,open:n.open==null?void 0:String(n.open)}),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`spoiler`,(e,t)=>{let n=e;return{tag:`spoiler`,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`ruby`,(e,t)=>{let n=e;return{tag:`ruby`,attrs:ca({rt:n.reading}),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`mention`,e=>{let t=e;return{tag:`mention`,attrs:ca({platform:t.platform,handle:t.handle}),children:[t.displayName??t.handle??``]}}),e.registerWriter(`tag`,e=>({tag:`tag`,children:[e.text??``]})),e.registerWriter(`comment`,e=>({tag:`comment`,children:[e.text??``]})),e.registerWriter(`footnote`,e=>({tag:`footnote`,attrs:{ref:e.identifier??``},selfClosing:!0})),e.registerWriter(`footnote-section`,e=>{let t=e,n=t.definitions??{},r=Object.entries(n).map(([e,t])=>({tag:`def`,attrs:{ref:e},children:[t]}));return{tag:`footnote-section`,attrs:sa(t),children:r}}),e.registerWriter(`gallery`,e=>{let t=e,n=(t.images??[]).map(e=>({tag:`img`,attrs:ca({src:e.src,alt:e.alt}),selfClosing:!0}));return{tag:`gallery`,attrs:ca({...sa(t),layout:t.layout,aspect:t.aspect&&t.aspect!==`auto`?t.aspect:void 0,fit:t.fit&&t.fit!==`cover`?t.fit:void 0,"max-item-height":t.maxItemHeight==null?void 0:String(t.maxItemHeight)}),children:n}}),e.registerWriter(`code-snippet`,e=>{let t=e,n=(t.files??[]).map(e=>({tag:`file`,attrs:ca({name:e.filename,lang:e.language}),children:[e.code??``]}));return{tag:`code-snippet`,attrs:sa(t),children:n}}),e.registerWriter(`steps`,(e,t)=>{let n=e,r=(n.steps??[]).map(e=>({tag:`step`,attrs:ca({id:e.id,title:e.title}),children:t.serializeNestedState(e.content)}));return{tag:`steps`,attrs:sa(n),children:r}}),e.registerWriter(`chat`,e=>{let t=e,n={tag:`participants`,children:(t.participants??[]).map(e=>({tag:`participant`,attrs:ca({id:e.id,kind:e.kind,name:e.name,avatar:e.avatar}),children:[]}))},r={tag:`messages`,children:(t.messages??[]).map(e=>({tag:`message`,attrs:ca({id:e.id,participant:e.participantId}),children:[e.content??``]}))};return{tag:`chat`,attrs:ca({...sa(t),variant:t.variant}),children:[n,r]}}),e.registerWriter(`poll`,e=>{let t=e,n=(t.options??[]).map(e=>({tag:`option`,attrs:ca({id:e.id}),children:[e.label??``]}));return{tag:`poll`,attrs:ca({...sa(t),"poll-id":t.pollId,mode:t.mode,"close-at":t.closeAt,"show-results":t.showResults}),children:[{tag:`question`,children:[t.question??``]},...n]}})}function wre(){let e=new xre;return Sre(e),are(e),Cre(e),bre(e),e}var la={b:1,strong:1,i:2,em:2,s:4,del:4,strike:4,u:8,code:16,sub:32,sup:64,mark:128};function Tre(e){return e.toLowerCase()in la}function Ere(e){return la[e.toLowerCase()]??0}var Dre=/* @__PURE__ */ new Set([`b`,`i`,`u`,`s`,`code`,`sub`,`sup`,`mark`,`strong`,`em`,`del`,`strike`,`a`,`mention`,`tag`,`spoiler`,`ruby`,`math`,`footnote`,`comment`,`br`,`img`]);function Ore(e){return Dre.has(e.toLowerCase())}var kre=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),Are=/<([\w-]+)((?:\s+[\w-]+(?:\s*=\s*(?:"[^"]*"|'[^']*'))?)*)\s*\/>/g,jre=`<![CDATA[`,Mre=`]]>`;function ua(e){return e.replaceAll(Are,(e,t,n)=>kre.has(t.toLowerCase())?e:`<${t}${n}></${t}>`)}function Nre(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(jre,n);if(r<0){t.push(ua(e.slice(n)));break}t.push(ua(e.slice(n,r)));let i=e.indexOf(Mre,r+9);if(i<0){t.push(e.slice(r));break}t.push(e.slice(r,i+3)),n=i+3}return t.join(``)}function Pre(e){return ire(`<!DOCTYPE html><html><body>${Nre(e)}</body></html>`)}function da(e,t){let n=Pre(e),r=n.querySelector(`doc`)??n.body;return{root:{type:`root`,children:Lre(t).parseChildren(r),direction:`ltr`,format:``,indent:0,version:1}}}var Fre=/* @__PURE__ */ new Set([`doc`,`fragment`,`root`,`ul`,`ol`,`table`,`tr`,`blockquote`,`alert`,`banner`,`details`,`nested-doc`,`gallery`,`codeblock`,`code-snippet`,`footnote-section`,`grid`,`cell`,`steps`,`step`,`excalidraw`]);function Ire(e){return Fre.has(e.tagName.toLowerCase())}function Lre(e){let t={parseChildren(n){let r=[...n.children].some(e=>!Ore(e.tagName)),i=Ire(n)||r,a=[],o=``,s=()=>{if(o===``)return;if(i&&o.trim()===``){o=``;return}let e=i?o.replace(/^\s*\n[ \t]*/,``).replace(/\n\s*$/,``):o;a.push(pa(e,0)),o=``};for(let r of n.childNodes)if(r.nodeType===3)o+=r.textContent??``;else if(r.nodeType===1){s();let n=fa(r,e,t,0);n&&(Array.isArray(n)?a.push(...n):a.push(n))}return s(),a},parseNestedState(t){return da(t,e)}};return t}function fa(e,t,n,r){let i=e.tagName.toLowerCase();if(Tre(i))return Rre(e,t,n,r|Ere(i));if(i===`br`)return{type:`linebreak`,version:1};if(i===`node`)return zre(e);let a=t.getReader(i);if(a){let t=a(e,n);if(t!==!1)return t}return n.parseChildren(e)}function Rre(e,t,n,r){let i=[],a=``,o=()=>{a!==``&&(i.push(pa(a,r)),a=``)};for(let s of e.childNodes)if(s.nodeType===3)a+=s.textContent??``;else if(s.nodeType===1){o();let e=fa(s,t,n,r);e&&(Array.isArray(e)?i.push(...e):i.push(e))}return o(),i}function zre(e){let t=e.getAttribute(`type`)??`unknown`,n=e.getAttribute(`id`),r=e.getAttribute(`data`),i=r?JSON.parse(r):{};return{type:t,...n?{$:{blockId:n}}:{},...i,version:1}}function pa(e,t){return{type:`text`,text:e,format:t,detail:0,mode:`normal`,style:``,version:1}}const ma=Symbol(`changed`),ha=Symbol(`classList`),ga=Symbol(`CustomElements`),_a=Symbol(`content`),va=Symbol(`dataset`),ya=Symbol(`doctype`),ba=Symbol(`DOMParser`),xa=Symbol(`end`),Sa=Symbol(`EventTarget`),Ca=Symbol(`globals`),wa=Symbol(`image`),Ta=Symbol(`mime`),Ea=Symbol(`MutationObserver`),j=Symbol(`next`),Da=Symbol(`ownerElement`),Oa=Symbol(`prev`),ka=Symbol(`private`),Aa=Symbol(`sheet`),ja=Symbol(`start`),Ma=Symbol(`style`),Na=Symbol(`upgrade`),Pa=Symbol(`value`),Bre=/* @__PURE__ */ new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Fa=String.fromCodePoint??(e=>{let t=``;return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t});function Vre(e){return e>=55296&&e<=57343||e>1114111?65533:Bre.get(e)??e}function Ia(e){let t=typeof atob==`function`?atob(e):typeof Buffer.from==`function`?Buffer.from(e,`base64`).toString(`binary`):new Buffer(e,`base64`).toString(`binary`),n=t.length&-2,r=new Uint16Array(n/2);for(let e=0,i=0;e<n;e+=2){let n=t.charCodeAt(e),a=t.charCodeAt(e+1);r[i++]=n|a<<8}return r}const Hre=/* #__PURE__ */ Ia(`QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fAlbHlGdW5jdGlvbgCgYSBpAG4AZwA7gMUAxUAAAWNzpACoAHIAAOA12Jzc6SFnbgCgVCJpAGwAZABlADuAwwDDQG0AbAA7gMQAxEAABGFjZWZvcnN1xQDYANoA7QDxAPYA+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXYBd1wAGYAAOA12Dnd5S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ABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg`),Ure=/* #__PURE__ */ Ia(`AAJhZ2xxBwARABMAFQBtAg0AAAAAAA8AcAAmYG8AcwAnYHQAPmB0ADxg9SFvdCJg`);var La;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.FLAG13=8192]=`FLAG13`,e[e.BRANCH_LENGTH=8064]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(La||={});var Ra;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(Ra||={});function za(e){return e>=Ra.ZERO&&e<=Ra.NINE}function Wre(e){return e>=Ra.UPPER_A&&e<=Ra.UPPER_F||e>=Ra.LOWER_A&&e<=Ra.LOWER_F}function Gre(e){return e>=Ra.UPPER_A&&e<=Ra.UPPER_Z||e>=Ra.LOWER_A&&e<=Ra.LOWER_Z||za(e)}function Kre(e){return e===Ra.EQUALS||Gre(e)}var Ba;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(Ba||={});var Va;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(Va||={});var qre=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=Ba.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Va.Strict,this.runConsumed=0}startEntity(e){this.decodeMode=e,this.state=Ba.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(e,t){switch(this.state){case Ba.EntityStart:return e.charCodeAt(t)===Ra.NUM?(this.state=Ba.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=Ba.NamedEntity,this.stateNamedEntity(e,t));case Ba.NumericStart:return this.stateNumericStart(e,t);case Ba.NumericDecimal:return this.stateNumericDecimal(e,t);case Ba.NumericHex:return this.stateNumericHex(e,t);case Ba.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|32)===Ra.LOWER_X?(this.state=Ba.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=Ba.NumericDecimal,this.stateNumericDecimal(e,t))}stateNumericHex(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(za(n)||Wre(n)){let e=n<=Ra.NINE?n-Ra.ZERO:(n|32)-Ra.LOWER_A+10;this.result=this.result*16+e,this.consumed++,t++}else return this.emitNumericEntity(n,3)}return-1}stateNumericDecimal(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(za(n))this.result=this.result*10+(n-Ra.ZERO),this.consumed++,t++;else return this.emitNumericEntity(n,2)}return-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Ra.SEMI)this.consumed+=1;else if(this.decodeMode===Va.Strict)return 0;return this.emitCodePoint(Vre(this.result),this.consumed),this.errors&&(e!==Ra.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&La.VALUE_LENGTH)>>14;for(;t<e.length;){if(i===0&&(r&La.FLAG13)!==0){let a=(r&La.BRANCH_LENGTH)>>7;if(this.runConsumed===0){let n=r&La.JUMP_TABLE;if(e.charCodeAt(t)!==n)return this.result===0?0:this.emitNotTerminatedNamedEntity();t++,this.excess++,this.runConsumed++}for(;this.runConsumed<a;){if(t>=e.length)return-1;let r=this.runConsumed-1,i=n[this.treeIndex+1+(r>>1)],a=r%2==0?i&255:i>>8&255;if(e.charCodeAt(t)!==a)return this.runConsumed=0,this.result===0?0:this.emitNotTerminatedNamedEntity();t++,this.excess++,this.runConsumed++}this.runConsumed=0,this.treeIndex+=1+(a>>1),r=n[this.treeIndex],i=(r&La.VALUE_LENGTH)>>14}if(t>=e.length)break;let a=e.charCodeAt(t);if(a===Ra.SEMI&&i!==0&&(r&La.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);if(this.treeIndex=Jre(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===Va.Attribute&&(i===0||Kre(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&La.VALUE_LENGTH)>>14,i!==0){if(a===Ra.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Va.Strict&&(r&La.FLAG13)===0&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}t++,this.excess++}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&La.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~(La.VALUE_LENGTH|La.FLAG13):r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case Ba.NamedEntity:return this.result!==0&&(this.decodeMode!==Va.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Ba.NumericDecimal:return this.emitNumericEntity(0,2);case Ba.NumericHex:return this.emitNumericEntity(0,3);case Ba.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Ba.EntityStart:return 0}}};function Jre(e,t,n,r){let i=(t&La.BRANCH_LENGTH)>>7,a=t&La.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=i+1>>1,s=0,c=i-1;for(;s<=c;){let t=s+c>>>1,i=e[n+(t>>1)]>>(t&1)*8&255;if(i<r)s=t+1;else if(i>r)c=t-1;else return e[n+o+t]}return-1}var Ha;(function(e){e[e.Tab=9]=`Tab`,e[e.NewLine=10]=`NewLine`,e[e.FormFeed=12]=`FormFeed`,e[e.CarriageReturn=13]=`CarriageReturn`,e[e.Space=32]=`Space`,e[e.ExclamationMark=33]=`ExclamationMark`,e[e.Number=35]=`Number`,e[e.Amp=38]=`Amp`,e[e.SingleQuote=39]=`SingleQuote`,e[e.DoubleQuote=34]=`DoubleQuote`,e[e.Dash=45]=`Dash`,e[e.Slash=47]=`Slash`,e[e.Zero=48]=`Zero`,e[e.Nine=57]=`Nine`,e[e.Semi=59]=`Semi`,e[e.Lt=60]=`Lt`,e[e.Eq=61]=`Eq`,e[e.Gt=62]=`Gt`,e[e.Questionmark=63]=`Questionmark`,e[e.UpperA=65]=`UpperA`,e[e.LowerA=97]=`LowerA`,e[e.UpperF=70]=`UpperF`,e[e.LowerF=102]=`LowerF`,e[e.UpperZ=90]=`UpperZ`,e[e.LowerZ=122]=`LowerZ`,e[e.LowerX=120]=`LowerX`,e[e.OpeningSquareBracket=91]=`OpeningSquareBracket`})(Ha||={});var M;(function(e){e[e.Text=1]=`Text`,e[e.BeforeTagName=2]=`BeforeTagName`,e[e.InTagName=3]=`InTagName`,e[e.InSelfClosingTag=4]=`InSelfClosingTag`,e[e.BeforeClosingTagName=5]=`BeforeClosingTagName`,e[e.InClosingTagName=6]=`InClosingTagName`,e[e.AfterClosingTagName=7]=`AfterClosingTagName`,e[e.BeforeAttributeName=8]=`BeforeAttributeName`,e[e.InAttributeName=9]=`InAttributeName`,e[e.AfterAttributeName=10]=`AfterAttributeName`,e[e.BeforeAttributeValue=11]=`BeforeAttributeValue`,e[e.InAttributeValueDq=12]=`InAttributeValueDq`,e[e.InAttributeValueSq=13]=`InAttributeValueSq`,e[e.InAttributeValueNq=14]=`InAttributeValueNq`,e[e.BeforeDeclaration=15]=`BeforeDeclaration`,e[e.InDeclaration=16]=`InDeclaration`,e[e.InProcessingInstruction=17]=`InProcessingInstruction`,e[e.BeforeComment=18]=`BeforeComment`,e[e.CDATASequence=19]=`CDATASequence`,e[e.InSpecialComment=20]=`InSpecialComment`,e[e.InCommentLike=21]=`InCommentLike`,e[e.BeforeSpecialS=22]=`BeforeSpecialS`,e[e.BeforeSpecialT=23]=`BeforeSpecialT`,e[e.SpecialStartSequence=24]=`SpecialStartSequence`,e[e.InSpecialTag=25]=`InSpecialTag`,e[e.InEntity=26]=`InEntity`})(M||={});function Ua(e){return e===Ha.Space||e===Ha.NewLine||e===Ha.Tab||e===Ha.FormFeed||e===Ha.CarriageReturn}function Wa(e){return e===Ha.Slash||e===Ha.Gt||Ua(e)}function Yre(e){return e>=Ha.LowerA&&e<=Ha.LowerZ||e>=Ha.UpperA&&e<=Ha.UpperZ}var Ga;(function(e){e[e.NoValue=0]=`NoValue`,e[e.Unquoted=1]=`Unquoted`,e[e.Single=2]=`Single`,e[e.Double=3]=`Double`})(Ga||={});const Ka={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97]),XmpEnd:new Uint8Array([60,47,120,109,112])};var qa=class{constructor({xmlMode:e=!1,decodeEntities:t=!0},n){this.cbs=n,this.state=M.Text,this.buffer=``,this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=M.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=e,this.decodeEntities=t,this.entityDecoder=new qre(e?Ure:Hre,(e,t)=>this.emitCodePoint(e,t))}reset(){this.state=M.Text,this.buffer=``,this.sectionStart=0,this.index=0,this.baseState=M.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(e){this.offset+=this.buffer.length,this.buffer=e,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}stateText(e){e===Ha.Lt||!this.decodeEntities&&this.fastForwardTo(Ha.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=M.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&e===Ha.Amp&&this.startEntity()}stateSpecialStartSequence(e){let t=this.sequenceIndex===this.currentSequence.length;if(!(t?Wa(e):(e|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!t){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=M.InTagName,this.stateInTagName(e)}stateInSpecialTag(e){if(this.sequenceIndex===this.currentSequence.length){if(e===Ha.Gt||Ua(e)){let t=this.index-this.currentSequence.length;if(this.sectionStart<t){let e=this.index;this.index=t,this.cbs.ontext(this.sectionStart,t),this.index=e}this.isSpecial=!1,this.sectionStart=t+2,this.stateInClosingTagName(e);return}this.sequenceIndex=0}(e|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===Ka.TitleEnd?this.decodeEntities&&e===Ha.Amp&&this.startEntity():this.fastForwardTo(Ha.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=Number(e===Ha.Lt)}stateCDATASequence(e){e===Ka.Cdata[this.sequenceIndex]?++this.sequenceIndex===Ka.Cdata.length&&(this.state=M.InCommentLike,this.currentSequence=Ka.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=M.InDeclaration,this.stateInDeclaration(e))}fastForwardTo(e){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===e)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(e){e===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===Ka.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=M.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):e!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(e){return this.xmlMode?!Wa(e):Yre(e)}startSpecial(e,t){this.isSpecial=!0,this.currentSequence=e,this.sequenceIndex=t,this.state=M.SpecialStartSequence}stateBeforeTagName(e){if(e===Ha.ExclamationMark)this.state=M.BeforeDeclaration,this.sectionStart=this.index+1;else if(e===Ha.Questionmark)this.state=M.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(e)){let t=e|32;this.sectionStart=this.index,this.state=this.xmlMode?M.InTagName:t===Ka.ScriptEnd[2]?M.BeforeSpecialS:t===Ka.TitleEnd[2]||t===Ka.XmpEnd[2]?M.BeforeSpecialT:M.InTagName}else e===Ha.Slash?this.state=M.BeforeClosingTagName:(this.state=M.Text,this.stateText(e))}stateInTagName(e){Wa(e)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=M.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateBeforeClosingTagName(e){Ua(e)||(e===Ha.Gt?this.state=M.Text:(this.state=this.isTagStartChar(e)?M.InClosingTagName:M.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(e){(e===Ha.Gt||Ua(e))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=M.AfterClosingTagName,this.stateAfterClosingTagName(e))}stateAfterClosingTagName(e){(e===Ha.Gt||this.fastForwardTo(Ha.Gt))&&(this.state=M.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(e){e===Ha.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=M.InSpecialTag,this.sequenceIndex=0):this.state=M.Text,this.sectionStart=this.index+1):e===Ha.Slash?this.state=M.InSelfClosingTag:Ua(e)||(this.state=M.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(e){e===Ha.Gt?(this.cbs.onselfclosingtag(this.index),this.state=M.Text,this.sectionStart=this.index+1,this.isSpecial=!1):Ua(e)||(this.state=M.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateInAttributeName(e){(e===Ha.Eq||Wa(e))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=M.AfterAttributeName,this.stateAfterAttributeName(e))}stateAfterAttributeName(e){e===Ha.Eq?this.state=M.BeforeAttributeValue:e===Ha.Slash||e===Ha.Gt?(this.cbs.onattribend(Ga.NoValue,this.sectionStart),this.sectionStart=-1,this.state=M.BeforeAttributeName,this.stateBeforeAttributeName(e)):Ua(e)||(this.cbs.onattribend(Ga.NoValue,this.sectionStart),this.state=M.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(e){e===Ha.DoubleQuote?(this.state=M.InAttributeValueDq,this.sectionStart=this.index+1):e===Ha.SingleQuote?(this.state=M.InAttributeValueSq,this.sectionStart=this.index+1):Ua(e)||(this.sectionStart=this.index,this.state=M.InAttributeValueNq,this.stateInAttributeValueNoQuotes(e))}handleInAttributeValue(e,t){e===t||!this.decodeEntities&&this.fastForwardTo(t)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(t===Ha.DoubleQuote?Ga.Double:Ga.Single,this.index+1),this.state=M.BeforeAttributeName):this.decodeEntities&&e===Ha.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(e){this.handleInAttributeValue(e,Ha.DoubleQuote)}stateInAttributeValueSingleQuotes(e){this.handleInAttributeValue(e,Ha.SingleQuote)}stateInAttributeValueNoQuotes(e){Ua(e)||e===Ha.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(Ga.Unquoted,this.index),this.state=M.BeforeAttributeName,this.stateBeforeAttributeName(e)):this.decodeEntities&&e===Ha.Amp&&this.startEntity()}stateBeforeDeclaration(e){e===Ha.OpeningSquareBracket?(this.state=M.CDATASequence,this.sequenceIndex=0):this.state=e===Ha.Dash?M.BeforeComment:M.InDeclaration}stateInDeclaration(e){(e===Ha.Gt||this.fastForwardTo(Ha.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=M.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(e){(e===Ha.Gt||this.fastForwardTo(Ha.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=M.Text,this.sectionStart=this.index+1)}stateBeforeComment(e){e===Ha.Dash?(this.state=M.InCommentLike,this.currentSequence=Ka.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=M.InDeclaration}stateInSpecialComment(e){(e===Ha.Gt||this.fastForwardTo(Ha.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=M.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(e){let t=e|32;t===Ka.ScriptEnd[3]?this.startSpecial(Ka.ScriptEnd,4):t===Ka.StyleEnd[3]?this.startSpecial(Ka.StyleEnd,4):(this.state=M.InTagName,this.stateInTagName(e))}stateBeforeSpecialT(e){switch(e|32){case Ka.TitleEnd[3]:this.startSpecial(Ka.TitleEnd,4);break;case Ka.TextareaEnd[3]:this.startSpecial(Ka.TextareaEnd,4);break;case Ka.XmpEnd[3]:this.startSpecial(Ka.XmpEnd,4);break;default:this.state=M.InTagName,this.stateInTagName(e)}}startEntity(){this.baseState=this.state,this.state=M.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?Va.Strict:this.baseState===M.Text||this.baseState===M.InSpecialTag?Va.Legacy:Va.Attribute)}stateInEntity(){let e=this.index-this.offset,t=this.entityDecoder.write(this.buffer,e);if(t>=0)this.state=this.baseState,t===0&&--this.index;else{if(e<this.buffer.length&&this.buffer.charCodeAt(e)===Ha.Amp){this.state=this.baseState,--this.index;return}this.index=this.offset+this.buffer.length-1}}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===M.Text||this.state===M.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===M.InAttributeValueDq||this.state===M.InAttributeValueSq||this.state===M.InAttributeValueNq)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){let e=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case M.Text:this.stateText(e);break;case M.SpecialStartSequence:this.stateSpecialStartSequence(e);break;case M.InSpecialTag:this.stateInSpecialTag(e);break;case M.CDATASequence:this.stateCDATASequence(e);break;case M.InAttributeValueDq:this.stateInAttributeValueDoubleQuotes(e);break;case M.InAttributeName:this.stateInAttributeName(e);break;case M.InCommentLike:this.stateInCommentLike(e);break;case M.InSpecialComment:this.stateInSpecialComment(e);break;case M.BeforeAttributeName:this.stateBeforeAttributeName(e);break;case M.InTagName:this.stateInTagName(e);break;case M.InClosingTagName:this.stateInClosingTagName(e);break;case M.BeforeTagName:this.stateBeforeTagName(e);break;case M.AfterAttributeName:this.stateAfterAttributeName(e);break;case M.InAttributeValueSq:this.stateInAttributeValueSingleQuotes(e);break;case M.BeforeAttributeValue:this.stateBeforeAttributeValue(e);break;case M.BeforeClosingTagName:this.stateBeforeClosingTagName(e);break;case M.AfterClosingTagName:this.stateAfterClosingTagName(e);break;case M.BeforeSpecialS:this.stateBeforeSpecialS(e);break;case M.BeforeSpecialT:this.stateBeforeSpecialT(e);break;case M.InAttributeValueNq:this.stateInAttributeValueNoQuotes(e);break;case M.InSelfClosingTag:this.stateInSelfClosingTag(e);break;case M.InDeclaration:this.stateInDeclaration(e);break;case M.BeforeDeclaration:this.stateBeforeDeclaration(e);break;case M.BeforeComment:this.stateBeforeComment(e);break;case M.InProcessingInstruction:this.stateInProcessingInstruction(e);break;case M.InEntity:this.stateInEntity()}this.index++}this.cleanup()}finish(){this.state===M.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){let e=this.buffer.length+this.offset;this.sectionStart>=e||(this.state===M.InCommentLike?this.currentSequence===Ka.CdataEnd?this.cbs.oncdata(this.sectionStart,e,0):this.cbs.oncomment(this.sectionStart,e,0):this.state===M.InTagName||this.state===M.BeforeAttributeName||this.state===M.BeforeAttributeValue||this.state===M.AfterAttributeName||this.state===M.InAttributeName||this.state===M.InAttributeValueSq||this.state===M.InAttributeValueDq||this.state===M.InAttributeValueNq||this.state===M.InClosingTagName||this.cbs.ontext(this.sectionStart,e))}emitCodePoint(e,t){this.baseState!==M.Text&&this.baseState!==M.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+t,this.index=this.sectionStart-1,this.cbs.onattribentity(e)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+t,this.index=this.sectionStart-1,this.cbs.ontextentity(e,this.sectionStart))}};const Ja=/* @__PURE__ */ new Set([`input`,`option`,`optgroup`,`select`,`button`,`datalist`,`textarea`]),Ya=/* @__PURE__ */ new Set([`p`]),Xa=/* @__PURE__ */ new Set([`thead`,`tbody`]),Za=/* @__PURE__ */ new Set([`dd`,`dt`]),Qa=/* @__PURE__ */ new Set([`rt`,`rp`]),Xre=/* @__PURE__ */ new Map([[`tr`,/* @__PURE__ */ new Set([`tr`,`th`,`td`])],[`th`,/* @__PURE__ */ new Set([`th`])],[`td`,/* @__PURE__ */ new Set([`thead`,`th`,`td`])],[`body`,/* @__PURE__ */ new Set([`head`,`link`,`script`])],[`li`,/* @__PURE__ */ new Set([`li`])],[`p`,Ya],[`h1`,Ya],[`h2`,Ya],[`h3`,Ya],[`h4`,Ya],[`h5`,Ya],[`h6`,Ya],[`select`,Ja],[`input`,Ja],[`output`,Ja],[`button`,Ja],[`datalist`,Ja],[`textarea`,Ja],[`option`,/* @__PURE__ */ new Set([`option`])],[`optgroup`,/* @__PURE__ */ new Set([`optgroup`,`option`])],[`dd`,Za],[`dt`,Za],[`address`,Ya],[`article`,Ya],[`aside`,Ya],[`blockquote`,Ya],[`details`,Ya],[`div`,Ya],[`dl`,Ya],[`fieldset`,Ya],[`figcaption`,Ya],[`figure`,Ya],[`footer`,Ya],[`form`,Ya],[`header`,Ya],[`hr`,Ya],[`main`,Ya],[`nav`,Ya],[`ol`,Ya],[`pre`,Ya],[`section`,Ya],[`table`,Ya],[`ul`,Ya],[`rt`,Qa],[`rp`,Qa],[`tbody`,Xa],[`tfoot`,Xa]]),Zre=/* @__PURE__ */ new Set([`area`,`base`,`basefont`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`img`,`input`,`isindex`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),$a=/* @__PURE__ */ new Set([`math`,`svg`]),eo=/* @__PURE__ */ new Set([`mi`,`mo`,`mn`,`ms`,`mtext`,`annotation-xml`,`foreignobject`,`desc`,`title`]),Qre=/\s|\//;var to=class{constructor(e,t={}){var n,r;this.options=t,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname=``,this.attribname=``,this.attribvalue=``,this.attribs=null,this.stack=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=e??{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=t.lowerCaseTags??this.htmlMode,this.lowerCaseAttributeNames=t.lowerCaseAttributeNames??this.htmlMode,this.recognizeSelfClosing=t.recognizeSelfClosing??!this.htmlMode,this.tokenizer=new(t.Tokenizer??qa)(this.options,this),this.foreignContext=[!this.htmlMode],(r=(n=this.cbs).onparserinit)==null||r.call(n,this)}ontext(e,t){var n,r;let i=this.getSlice(e,t);this.endIndex=t-1,(r=(n=this.cbs).ontext)==null||r.call(n,i),this.startIndex=t}ontextentity(e,t){var n,r;this.endIndex=t-1,(r=(n=this.cbs).ontext)==null||r.call(n,Fa(e)),this.startIndex=t}isVoidElement(e){return this.htmlMode&&Zre.has(e)}onopentagname(e,t){this.endIndex=t;let n=this.getSlice(e,t);this.lowerCaseTagNames&&(n=n.toLowerCase()),this.emitOpenTag(n)}emitOpenTag(e){var t,n,r,i;this.openTagStart=this.startIndex,this.tagname=e;let a=this.htmlMode&&Xre.get(e);if(a)for(;this.stack.length>0&&a.has(this.stack[0]);){let e=this.stack.shift();(n=(t=this.cbs).onclosetag)==null||n.call(t,e,!0)}this.isVoidElement(e)||(this.stack.unshift(e),this.htmlMode&&($a.has(e)?this.foreignContext.unshift(!0):eo.has(e)&&this.foreignContext.unshift(!1))),(i=(r=this.cbs).onopentagname)==null||i.call(r,e),this.cbs.onopentag&&(this.attribs={})}endOpenTag(e){var t,n;this.startIndex=this.openTagStart,this.attribs&&=((n=(t=this.cbs).onopentag)==null||n.call(t,this.tagname,this.attribs,e),null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=``}onopentagend(e){this.endIndex=e,this.endOpenTag(!1),this.startIndex=e+1}onclosetag(e,t){var n,r,i,a,o,s,c,l;this.endIndex=t;let u=this.getSlice(e,t);if(this.lowerCaseTagNames&&(u=u.toLowerCase()),this.htmlMode&&($a.has(u)||eo.has(u))&&this.foreignContext.shift(),this.isVoidElement(u))this.htmlMode&&u===`br`&&((a=(i=this.cbs).onopentagname)==null||a.call(i,`br`),(s=(o=this.cbs).onopentag)==null||s.call(o,`br`,{},!0),(l=(c=this.cbs).onclosetag)==null||l.call(c,`br`,!1));else{let e=this.stack.indexOf(u);if(e!==-1)for(let t=0;t<=e;t++){let i=this.stack.shift();(r=(n=this.cbs).onclosetag)==null||r.call(n,i,t!==e)}else this.htmlMode&&u===`p`&&(this.emitOpenTag(`p`),this.closeCurrentTag(!0))}this.startIndex=t+1}onselfclosingtag(e){this.endIndex=e,this.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=e+1):this.onopentagend(e)}closeCurrentTag(e){var t,n;let r=this.tagname;this.endOpenTag(e),this.stack[0]===r&&((n=(t=this.cbs).onclosetag)==null||n.call(t,r,!e),this.stack.shift())}onattribname(e,t){this.startIndex=e;let n=this.getSlice(e,t);this.attribname=this.lowerCaseAttributeNames?n.toLowerCase():n}onattribdata(e,t){this.attribvalue+=this.getSlice(e,t)}onattribentity(e){this.attribvalue+=Fa(e)}onattribend(e,t){var n,r;this.endIndex=t,(r=(n=this.cbs).onattribute)==null||r.call(n,this.attribname,this.attribvalue,e===Ga.Double?`"`:e===Ga.Single?`'`:e===Ga.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=``}getInstructionName(e){let t=e.search(Qre),n=t<0?e:e.substr(0,t);return this.lowerCaseTagNames&&(n=n.toLowerCase()),n}ondeclaration(e,t){this.endIndex=t;let n=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){let e=this.getInstructionName(n);this.cbs.onprocessinginstruction(`!${e}`,`!${n}`)}this.startIndex=t+1}onprocessinginstruction(e,t){this.endIndex=t;let n=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){let e=this.getInstructionName(n);this.cbs.onprocessinginstruction(`?${e}`,`?${n}`)}this.startIndex=t+1}oncomment(e,t,n){var r,i,a,o;this.endIndex=t,(i=(r=this.cbs).oncomment)==null||i.call(r,this.getSlice(e,t-n)),(o=(a=this.cbs).oncommentend)==null||o.call(a),this.startIndex=t+1}oncdata(e,t,n){var r,i,a,o,s,c,l,u,d,f;this.endIndex=t;let p=this.getSlice(e,t-n);!this.htmlMode||this.options.recognizeCDATA?((i=(r=this.cbs).oncdatastart)==null||i.call(r),(o=(a=this.cbs).ontext)==null||o.call(a,p),(c=(s=this.cbs).oncdataend)==null||c.call(s)):((u=(l=this.cbs).oncomment)==null||u.call(l,`[CDATA[${p}]]`),(f=(d=this.cbs).oncommentend)==null||f.call(d)),this.startIndex=t+1}onend(){var e,t;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let e=0;e<this.stack.length;e++)this.cbs.onclosetag(this.stack[e],!0)}(t=(e=this.cbs).onend)==null||t.call(e)}reset(){var e,t,n,r;(t=(e=this.cbs).onreset)==null||t.call(e),this.tokenizer.reset(),this.tagname=``,this.attribname=``,this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(r=(n=this.cbs).onparserinit)==null||r.call(n,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(e){this.reset(),this.end(e)}getSlice(e,t){for(;e-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let n=this.buffers[0].slice(e-this.bufferOffset,t-this.bufferOffset);for(;t-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),n+=this.buffers[0].slice(0,t-this.bufferOffset);return n}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(e){var t,n;this.ended?(n=(t=this.cbs).onerror)==null||n.call(t,/* @__PURE__ */ Error(`.write() after done!`)):(this.buffers.push(e),this.tokenizer.running&&(this.tokenizer.write(e),this.writeIndex++))}end(e){var t,n;this.ended?(n=(t=this.cbs).onerror)==null||n.call(t,/* @__PURE__ */ Error(`.end() after done!`)):(e&&this.write(e),this.ended=!0,this.tokenizer.end())}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(e){this.write(e)}done(e){this.end(e)}},$re=/* @__PURE__ */ s({CDATA:()=>fo,Comment:()=>so,Directive:()=>oo,Doctype:()=>po,ElementType:()=>no,Root:()=>io,Script:()=>co,Style:()=>lo,Tag:()=>uo,Text:()=>ao,isTag:()=>ro}),no;(function(e){e.Root=`root`,e.Text=`text`,e.Directive=`directive`,e.Comment=`comment`,e.Script=`script`,e.Style=`style`,e.Tag=`tag`,e.CDATA=`cdata`,e.Doctype=`doctype`})(no||={});function ro(e){return e.type===no.Tag||e.type===no.Script||e.type===no.Style}const io=no.Root,ao=no.Text,oo=no.Directive,so=no.Comment,co=no.Script,lo=no.Style,uo=no.Tag,fo=no.CDATA,po=no.Doctype;var mo=class{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(e){this.parent=e}get previousSibling(){return this.prev}set previousSibling(e){this.prev=e}get nextSibling(){return this.next}set nextSibling(e){this.next=e}cloneNode(e=!1){return ko(this,e)}},ho=class extends mo{constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},go=class extends ho{constructor(){super(...arguments),this.type=no.Text}get nodeType(){return 3}},_o=class extends ho{constructor(){super(...arguments),this.type=no.Comment}get nodeType(){return 8}},vo=class extends ho{constructor(e,t){super(t),this.name=e,this.type=no.Directive}get nodeType(){return 1}},yo=class extends mo{constructor(e){super(),this.children=e}get firstChild(){return this.children[0]??null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(e){this.children=e}},bo=class extends yo{constructor(){super(...arguments),this.type=no.CDATA}get nodeType(){return 4}},xo=class extends yo{constructor(){super(...arguments),this.type=no.Root}get nodeType(){return 9}},So=class extends yo{constructor(e,t,n=[],r=e===`script`?no.Script:e===`style`?no.Style:no.Tag){super(n),this.name=e,this.attribs=t,this.type=r}get nodeType(){return 1}get tagName(){return this.name}set tagName(e){this.name=e}get attributes(){return Object.keys(this.attribs).map(e=>({name:e,value:this.attribs[e],namespace:this[`x-attribsNamespace`]?.[e],prefix:this[`x-attribsPrefix`]?.[e]}))}};function Co(e){return ro(e)}function wo(e){return e.type===no.CDATA}function To(e){return e.type===no.Text}function Eo(e){return e.type===no.Comment}function eie(e){return e.type===no.Directive}function Do(e){return e.type===no.Root}function Oo(e){return Object.prototype.hasOwnProperty.call(e,`children`)}function ko(e,t=!1){let n;if(To(e))n=new go(e.data);else if(Eo(e))n=new _o(e.data);else if(Co(e)){let r=t?Ao(e.children):[],i=new So(e.name,{...e.attribs},r);r.forEach(e=>e.parent=i),e.namespace!=null&&(i.namespace=e.namespace),e[`x-attribsNamespace`]&&(i[`x-attribsNamespace`]={...e[`x-attribsNamespace`]}),e[`x-attribsPrefix`]&&(i[`x-attribsPrefix`]={...e[`x-attribsPrefix`]}),n=i}else if(wo(e)){let r=t?Ao(e.children):[],i=new bo(r);r.forEach(e=>e.parent=i),n=i}else if(Do(e)){let r=t?Ao(e.children):[],i=new xo(r);r.forEach(e=>e.parent=i),e[`x-mode`]&&(i[`x-mode`]=e[`x-mode`]),n=i}else if(eie(e)){let t=new vo(e.name,e.data);e[`x-name`]!=null&&(t[`x-name`]=e[`x-name`],t[`x-publicId`]=e[`x-publicId`],t[`x-systemId`]=e[`x-systemId`]),n=t}else throw Error(`Not implemented yet: ${e.type}`);return n.startIndex=e.startIndex,n.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(n.sourceCodeLocation=e.sourceCodeLocation),n}function Ao(e){let t=e.map(e=>ko(e,!0));for(let e=1;e<t.length;e++)t[e].prev=t[e-1],t[e-1].next=t[e];return t}const jo={withStartIndices:!1,withEndIndices:!1,xmlMode:!1};var Mo=class{constructor(e,t,n){this.dom=[],this.root=new xo(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof t==`function`&&(n=t,t=jo),typeof e==`object`&&(t=e,e=void 0),this.callback=e??null,this.options=t??jo,this.elementCB=n??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new xo(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(e){this.handleCallback(e)}onclosetag(){this.lastNode=null;let e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)}onopentag(e,t){let n=new So(e,t,void 0,this.options.xmlMode?no.Tag:void 0);this.addNode(n),this.tagStack.push(n)}ontext(e){let{lastNode:t}=this;if(t&&t.type===no.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{let t=new go(e);this.addNode(t),this.lastNode=t}}oncomment(e){if(this.lastNode&&this.lastNode.type===no.Comment){this.lastNode.data+=e;return}let t=new _o(e);this.addNode(t),this.lastNode=t}oncommentend(){this.lastNode=null}oncdatastart(){let e=new go(``),t=new bo([e]);this.addNode(t),e.parent=t,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,t){let n=new vo(e,t);this.addNode(n)}handleCallback(e){if(typeof this.callback==`function`)this.callback(e,this.dom);else if(e)throw e}addNode(e){let t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null}};const No=/["&'<>$\x80-\uFFFF]/g,tie=/* @__PURE__ */ new Map([[34,`&quot;`],[38,`&amp;`],[39,`&apos;`],[60,`&lt;`],[62,`&gt;`]]),nie=String.prototype.codePointAt==null?(e,t)=>(e.charCodeAt(t)&64512)==55296?(e.charCodeAt(t)-55296)*1024+e.charCodeAt(t+1)-56320+65536:e.charCodeAt(t):(e,t)=>e.codePointAt(t);function Po(e){let t=``,n=0,r;for(;(r=No.exec(e))!==null;){let i=r.index,a=e.charCodeAt(i),o=tie.get(a);o===void 0?(t+=`${e.substring(n,i)}&#x${nie(e,i).toString(16)};`,n=No.lastIndex+=Number((a&64512)==55296)):(t+=e.substring(n,i)+o,n=i+1)}return t+e.substr(n)}function Fo(e,t){return function(n){let r,i=0,a=``;for(;r=e.exec(n);)i!==r.index&&(a+=n.substring(i,r.index)),a+=t.get(r[0].charCodeAt(0)),i=r.index+1;return a+n.substring(i)}}const rie=Fo(/["&\u00A0]/g,/* @__PURE__ */ new Map([[34,`&quot;`],[38,`&amp;`],[160,`&nbsp;`]])),iie=Fo(/[&<>\u00A0]/g,/* @__PURE__ */ new Map([[38,`&amp;`],[60,`&lt;`],[62,`&gt;`],[160,`&nbsp;`]])),aie=new Map((/* @__PURE__ */ `altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`)).map(e=>[e.toLowerCase(),e])),oie=new Map((/* @__PURE__ */ `definitionURL.attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`)).map(e=>[e.toLowerCase(),e])),sie=/* @__PURE__ */ new Set([`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`]);function cie(e){return e.replace(/"/g,`&quot;`)}function lie(e,t){if(!e)return;let n=(t.encodeEntities??t.decodeEntities)===!1?cie:t.xmlMode||t.encodeEntities!==`utf8`?Po:rie;return Object.keys(e).map(r=>{let i=e[r]??``;return t.xmlMode===`foreign`&&(r=oie.get(r)??r),!t.emptyAttrs&&!t.xmlMode&&i===``?r:`${r}="${n(i)}"`}).join(` `)}const Io=/* @__PURE__ */ new Set([`area`,`base`,`basefont`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`img`,`input`,`isindex`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function Lo(e,t={}){let n=`length`in e?e:[e],r=``;for(let e=0;e<n.length;e++)r+=uie(n[e],t);return r}function uie(e,t){switch(e.type){case io:return Lo(e.children,t);case po:case oo:return mie(e);case so:return _ie(e);case fo:return gie(e);case co:case lo:case uo:return pie(e,t);case ao:return hie(e,t)}}const die=/* @__PURE__ */ new Set([`mi`,`mo`,`mn`,`ms`,`mtext`,`annotation-xml`,`foreignObject`,`desc`,`title`]),fie=/* @__PURE__ */ new Set([`svg`,`math`]);function pie(e,t){t.xmlMode===`foreign`&&(e.name=aie.get(e.name)??e.name,e.parent&&die.has(e.parent.name)&&(t={...t,xmlMode:!1})),!t.xmlMode&&fie.has(e.name)&&(t={...t,xmlMode:`foreign`});let n=`<${e.name}`,r=lie(e.attribs,t);return r&&(n+=` ${r}`),e.children.length===0&&(t.xmlMode?t.selfClosingTags!==!1:t.selfClosingTags&&Io.has(e.name))?(t.xmlMode||(n+=` `),n+=`/>`):(n+=`>`,e.children.length>0&&(n+=Lo(e.children,t)),(t.xmlMode||!Io.has(e.name))&&(n+=`</${e.name}>`)),n}function mie(e){return`<${e.data}>`}function hie(e,t){let n=e.data||``;return(t.encodeEntities??t.decodeEntities)!==!1&&!(!t.xmlMode&&e.parent&&sie.has(e.parent.name))&&(n=t.xmlMode||t.encodeEntities!==`utf8`?Po(n):iie(n)),n}function gie(e){return`<![CDATA[${e.children[0].data}]]>`}function _ie(e){return`<!--${e.data}-->`}function Ro(e,t){return Lo(e,t)}function vie(e,t){return Oo(e)?e.children.map(e=>Ro(e,t)).join(``):``}function zo(e){return Array.isArray(e)?e.map(zo).join(``):Co(e)?e.name===`br`?`
516
+ `}shimSource(){return`@echo off\r\nnode "${this.launcher}" %*\r\n`}ownsBin(){try{return process.platform===`win32`?u.default.readFileSync(this.bin,`utf8`)===this.shimSource():u.default.lstatSync(this.bin).isSymbolicLink()&&u.default.realpathSync(this.bin)===u.default.realpathSync(this.launcher)}catch{return!1}}preflight(){let e=!1;try{u.default.lstatSync(this.bin),e=!0}catch(e){if(e.code!==`ENOENT`)throw e}if(e&&!this.ownsBin())throw Error(`Command already exists at ${this.bin}; choose --bin-dir or keep its original package manager.`);if(u.default.existsSync(this.launcher)){let e=u.default.readFileSync(this.launcher,`utf8`);if(e!==this.launcherSource()&&ji(e)!==this.current()?.launcherDigest)throw Error(`Foreign launcher already exists at ${this.launcher}`)}}current(){let e=d.default.join(this.root,`current.json`);if(!u.default.existsSync(e))return null;let t=JSON.parse(u.default.readFileSync(e,`utf8`)),n=d.default.relative(u.default.realpathSync(d.default.join(this.root,`versions`)),u.default.realpathSync(t.packageRoot));if(!n||n.startsWith(`..`)||d.default.isAbsolute(n))throw Error(`Invalid runtime state at ${e}`);return t}install(e){this.preflight();let t=JSON.parse(u.default.readFileSync(d.default.join(e,`package.json`),`utf8`));if(t.name!==`ryugi-artifacts`||!/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/.test(t.version))throw Error(`Invalid Ryugi runtime package`);for(let t of Pne)if(!u.default.existsSync(d.default.join(e,t)))throw Error(`Incomplete Ryugi runtime: missing ${t}. Build or reinstall the complete package.`);let n=Mi(e),r=this.current();if(r&&r.version===t.version&&r.digest===n&&this.ownsBin())try{if(Mi(r.packageRoot)===n)return r}catch{}let i=d.default.join(this.root,`versions`,`${t.version}-${(0,p.randomUUID)()}`);u.default.mkdirSync(i,{recursive:!0});try{for(let t of[`package.json`,`bin`,`dist`])u.default.cpSync(d.default.join(e,t),d.default.join(i,t),{recursive:!0,dereference:!0});let r=(0,f.spawnSync)(process.execPath,[d.default.join(i,`dist/cli.cjs`),`--version`,`--format`,`brief`],{encoding:`utf8`,timeout:15e3,env:{...process.env,RYUGI_NO_UPDATE_CHECK:`1`}});if(r.error||r.status!==0||![t.version,`ryugi ${t.version}`].includes(r.stdout.trim()))throw Error(`Runtime validation failed: ${r.stderr||r.error?.message||`version mismatch`}`);u.default.writeFileSync(this.launcher,this.launcherSource(),{mode:493}),u.default.mkdirSync(this.binDir,{recursive:!0}),this.ownsBin()||(process.platform===`win32`?u.default.writeFileSync(this.bin,this.shimSource(),{flag:`wx`}):u.default.symlinkSync(this.launcher,this.bin));let a={version:t.version,digest:n,launcherDigest:ji(this.launcherSource()),packageRoot:i,launcher:this.launcher,bin:this.bin};return Ai(d.default.join(this.root,`current.json`),a),a}catch(e){throw u.default.rmSync(i,{recursive:!0,force:!0}),e}}};function Pi(e,t=process.env){return(t.PATH||``).split(d.default.delimiter).some(t=>d.default.resolve(t)===d.default.resolve(e))?null:(t.SHELL||``).endsWith(`/fish`)?`Run: fish_add_path ${JSON.stringify(e)}`:process.platform===`win32`?`Add ${e} to your user PATH, then open a new terminal.`:`Add to your shell profile: export PATH=${JSON.stringify(e)}:"$PATH"`}const Fi=e=>e===`antigravity`?`agy`:e;function Ii(e){let t=d.default.join(e,`installation.json`);if(!u.default.existsSync(t))return{schema:1,harnesses:{}};let n=JSON.parse(u.default.readFileSync(t,`utf8`));if(n.schema!==1||!n.harnesses||typeof n.harnesses!=`object`)throw Error(`Unsupported installation state: ${t}`);return n}function Li(e,t){Ai(d.default.join(e,`installation.json`),t)}const Fne=e=>`export { default, RyugiPlugin } from ${JSON.stringify((0,v.pathToFileURL)(d.default.join(e,`.opencode/plugins/ryugi.js`)).href)};\n`;function Ine(e,t={}){let n=[],r=new Ni(e).current();if(r){let i=new Ni(e,t.binDir||d.default.dirname(r.bin));n.push({component:`CLI command`,status:i.ownsBin()?`ok`:`attention`,message:i.bin});let a=Pi(i.binDir,t.env||process.env);n.push({component:`PATH`,status:a?`attention`:`ok`,message:a||`${i.binDir} is on PATH`});for(let e of[`dist/cli.cjs`,`dist/server.cjs`,`dist/document-host.cjs`,`dist/viewer/index.html`,`dist/runtime/ryugi-ui.js`])n.push({component:`CLI ${e}`,status:u.default.existsSync(d.default.join(r.packageRoot,e))?`ok`:`attention`,message:d.default.join(r.packageRoot,e)})}else n.push({component:`CLI runtime`,status:`attention`,message:`No self-managed runtime; retain the current package-manager or development CLI.`});for(let r of Object.values(Ii(e).harnesses))try{if(r.harness===`claude-code`){let e=d.default.join((t.env||process.env).CLAUDE_CONFIG_DIR||d.default.join(t.home||g.default.homedir(),`.claude`),`settings.json`);if(!JSON.parse(u.default.readFileSync(e,`utf8`)).enabledPlugins?.[r.registration])throw Error(`Recorded Claude plugin is not enabled at user scope`);if(!xi(r,t.run||wi))throw Error(`Native Claude source no longer matches the record`)}else if(Di(r,Ei(r.harness,{root:e,home:t.home})),!xi(r,t.run||wi))throw Error(`Native registration does not match the owned source`);n.push({component:r.harness,status:`ok`,message:`${r.mode} · ${r.version}; restart/new session required; delivery unverified`})}catch(e){n.push({component:r.harness,status:`attention`,message:e.message})}return n}function Lne(e,t={}){let n=Ii(e),r={removed:[],failures:[],preserved:[`Project artifacts, comments, harness plugin data and runtime caches are retained.`]},i=t.run||wi;for(let a of t.targets||Object.keys(n.harnesses)){let o=n.harnesses[a];if(o)try{if(a===`claude-code`){if(![`ryugi@ryugi-dev`,`ryugi-artifacts@ryugi-dev`].includes(o.registration||``))throw Error(`Unknown native Claude plugin identity`);if(!xi(o,i))throw Error(`Native Claude source changed; preserving it`);i(`claude`,[`plugin`,`uninstall`,o.registration,`--scope`,`user`])}else{if(Di(o,Ei(a,{root:e,home:t.home})),!xi(o,i))throw Error(`Native plugin source changed; preserving it`);if(a===`codex`&&i(`codex`,[`plugin`,`remove`,`ryugi@ryugi-managed`]),a===`copilot`&&i(`copilot`,[`plugin`,`uninstall`,`ryugi@ryugi-managed`]),a===`pi`&&i(`pi`,[`remove`,o.path]),a===`gemini`&&i(`gemini`,[`extensions`,`uninstall`,`ryugi`]),a===`agy`&&i(`agy`,[`plugin`,`uninstall`,`ryugi`]),a===`opencode`){let e=t.env||process.env,n=d.default.join(e.XDG_CONFIG_HOME||d.default.join(t.home||g.default.homedir(),`.config`),`opencode/plugins/ryugi.js`);if(!u.default.existsSync(n)||u.default.readFileSync(n,`utf8`)!==Fne(o.path))throw Error(`Plugin entry was changed; preserving ${n}`);u.default.unlinkSync(n)}u.default.rmSync(o.path,{recursive:!0})}delete n.harnesses[a],Li(e,n),r.removed.push(a)}catch(e){r.failures.push({component:a,message:e.message})}}if(!t.targets){let n=new Ni(e).current();if(n){let i=new Ni(e,t.binDir||d.default.dirname(n.bin));i.ownsBin()?(u.default.unlinkSync(i.bin),r.removed.push(`CLI command`)):r.failures.push({component:`CLI command`,message:`Command changed; preserving ${i.bin}`})}}return r}const Rne={name:`doctor`,summary:`Check installed CLI ownership, plugin files and native registrations`,options:{"install-dir":{type:`string`,value:`<path>`,help:`Managed installation directory`}},semantic:e=>sr({id:`doctor`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`]},run(){let t=Ine(d.default.resolve(e.values[`install-dir`]||Oi()));return Zn({checks:t},t.some(e=>e.status===`attention`)?{kind:`action_required`,reason:`Some installation components need attention`}:{kind:`succeeded`})},present:({data:e})=>({heading:`Doctor`,status:e.checks.some(e=>e.status===`attention`)?`attention`:`ok`,facts:[],sections:[{kind:`records`,key:`checks`,rows:e.checks.map(e=>({...e})),columns:[{key:`component`,required:!0},{key:`status`,required:!0},{key:`message`,required:!0}]}]})},e)},Ri={"X-Ryugi-Version":`1.102.1`},zne=/<head(\s[^>]*)?>/i,Bne=/^\s*(<!doctype[^>]*>)?\s*(<html(\s[^>]*)?>)?/i,Vne=/^<script>([\s\S]*?)<\/script>/,Hne=/^(?:<script (?:defer|type="module") src="[^"]*\/_ryugi\/runtime\/ryugi-(?:icons|ui|deck|storyboard)\.js"><\/script>|<style data-ryugi-deck>[^<]*<\/style>)+/;function Une(e){let t=zne.exec(e);return t?t.index+t[0].length:Bne.exec(e)?.[0].length??0}function Wne(e){let t=Une(e),n=e.slice(t);n.startsWith(`<style>:root{color-scheme:light dark;background:transparent}body{margin:0;font-family:var(--lobe-font-family,system-ui,-apple-system,sans-serif)}</style>`)&&(n=n.slice(153));let r=Vne.exec(n);return!r||!r[1].includes(`ryugi:`)?e:e.slice(0,t)+n.slice(r[0].length).replace(Hne,``)}const zi=/^[a-z0-9][a-z0-9-]{0,63}$/,Bi=e=>e.type===`ask`;function Gne(e,t){return{id:e.askId,blockId:t,...e.recommend?{recommend:e.recommend}:{},...e.placeholder?{placeholder:e.placeholder}:{},options:e.options.map(({value:e,label:t})=>({value:e,label:t}))}}function Kne(e){let t=[],n=(e,r)=>{Bi(e)&&t.push(Gne(e,r));for(let t of e.children??[])n(t,r)};for(let t of e.root.children)n(t,t.$?.blockId??``);return t}const Vi=e=>e===null||typeof e==`string`&&e.length<=2e4;function Hi(e){let t={};if(e.ask!==void 0){if(typeof e.ask!=`string`||!zi.test(e.ask))return null;t.ask=e.ask}if(e.choice!==void 0){if(!Vi(e.choice))return null;t.choice=e.choice}if(e.answer!==void 0){if(!Vi(e.answer))return null;t.answer=e.answer}if(e.note!==void 0){if(e.note!==!0)return null;t.note=!0}if(e.submit!==void 0){if(typeof e.submit!=`boolean`)return null;t.submit=e.submit}if(e.asks!==void 0){if(!Array.isArray(e.asks)||!e.asks.every(e=>typeof e==`string`))return null;t.asks=e.asks}if(e.remote!==void 0){if(e.remote!==!0)return null;t.remote=!0}if(e.of!==void 0){if(typeof e.of!=`string`)return null;t.of=e.of}return t}const qne=(e,t)=>JSON.stringify(Hi(e))===JSON.stringify(Hi(t)),Jne=e=>e.messages.find(e=>!e.deleted);function Ui(e,t){return e.map((e,t)=>({thread:e,index:t,message:Jne(e)})).filter(e=>e.message&&t(e.thread.anchor)).sort((e,t)=>e.message.at.localeCompare(t.message.at)||e.index-t.index)}function Yne(e){let t=new Set(Ui(e,e=>e.submit===!1&&e.of!==void 0).map(e=>e.thread.anchor.of));return Ui(e,e=>e.submit===!0).map(({thread:e,message:n})=>({id:e.id,at:n.at,asks:e.anchor.asks??[],withdrawn:t.has(e.id)}))}function Xne(e,t){let n=new Set(Yne(t).filter(e=>!e.withdrawn).flatMap(e=>e.asks)),r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map;for(let{thread:e,message:n}of Ui(t,e=>e.ask!==void 0&&e.note===void 0))e.anchor.remote?i.set(e.anchor.ask,[...i.get(e.anchor.ask)??[],{anchor:e.anchor,name:n.name}]):r.set(e.anchor.ask,e.anchor);let a=/* @__PURE__ */ new Set;for(let[e,t]of i){if(r.has(e))continue;let n=t[0].anchor;t.every(({anchor:e})=>(e.choice??null)===(n.choice??null)&&(e.answer??null)===(n.answer??null))&&(r.set(e,t.at(-1).anchor),a.add(e))}let o=/* @__PURE__ */ new Map;for(let{thread:e,message:n}of Ui(t,e=>e.ask!==void 0&&e.note===!0))o.set(e.anchor.ask,{text:n.text,by:n.name});let s=new Set(e.map(e=>e.id)),c=[.../* @__PURE__ */ new Set([...r.keys(),...i.keys(),...o.keys()])].filter(e=>!s.has(e)).map(e=>({id:e,blockId:``,options:[]}));return[...e,...c].map(e=>{let t=r.get(e.id),c=o.get(e.id),l=!s.has(e.id),u=new Set(e.options.map(e=>e.value)),d=t?.choice??null,f=d!==null&&(l||u.has(d))?d:null,p=t?.answer?.trim()?t.answer:null,m=f!==null||p!==null,h=!m&&e.recommend!==void 0,g=m?f:e.recommend??null,_=l?`orphan`:c?`settled`:n.has(e.id)||a.has(e.id)?`submitted`:`draft`,v=i.get(e.id)?.map(({anchor:e,name:t})=>({...t?{name:t}:{},choice:e.choice??null,text:e.answer?.trim()?e.answer:null}));return{id:e.id,blockId:e.blockId,state:_,...e.recommend?{recommend:e.recommend}:{},...e.placeholder?{placeholder:e.placeholder}:{},options:e.options,choice:g,text:p,byRecommendation:h,changed:m&&(p!==null||f!==e.recommend),...c?{note:c.text,...c.by?{noteBy:c.by}:{}}:{},...d!==null&&f===null?{staleChoice:d}:{},...v?{others:v}:{}}})}const Wi=e=>typeof e==`string`&&e.length>0&&e.length<=200;function Zne(e){if(typeof e!=`object`||!e)return null;let t=e;return t.kind===`node`?Wi(t.id)?{kind:`node`,id:t.id}:null:t.kind===`edge`&&Wi(t.from)&&Wi(t.to)&&typeof t.index==`number`&&Number.isSafeInteger(t.index)&&t.index>=0?{kind:`edge`,from:t.from,to:t.to,index:t.index}:null}function Qne(e,t){return!e||!t?e===t:e.kind===`node`?t.kind===`node`&&e.id===t.id:t.kind===`edge`&&e.from===t.from&&e.to===t.to&&e.index===t.index}const Gi=e=>e.blockIds??[e.blockId],Ki=e=>typeof e==`object`&&!!e,$ne={read:e=>{if(!Ki(e)||typeof e.blockId!=`string`||!e.blockId)return null;let{blockIds:t,textRanges:n}=e,r=e.diagram===void 0?void 0:Zne(e.diagram);if(r===null||r&&(t!==void 0||n!==void 0)||t!==void 0&&(!Array.isArray(t)||!t.length||t[0]!==e.blockId||!t.every(e=>typeof e==`string`&&e.length>0&&e.length<=100)||new Set(t).size!==t.length))return null;let i=Hi(e);if(!i)return null;let a=t??[e.blockId];return n!==void 0&&(!Array.isArray(n)||n.length!==a.length||!n.every((e,t)=>Ki(e)&&e.blockId===a[t]&&typeof e.quote==`string`&&e.quote.length<=2e4&&typeof e.start==`number`&&Number.isSafeInteger(e.start)&&e.start>=0&&Number.isSafeInteger(e.start+e.quote.length)))?null:{blockId:e.blockId,...t?{blockIds:t}:{},...r?{diagram:r}:{},quote:typeof e.quote==`string`?e.quote:``,...n?{textRanges:n.map(({blockId:e,quote:t,start:n})=>({blockId:e,quote:t,start:n}))}:{},...i}},same:(e,t)=>qne(e,t)&&e.quote===t.quote&&Qne(e.diagram,t.diagram)&&Gi(e).length===Gi(t).length&&Gi(e).every((e,n)=>e===Gi(t)[n])&&e.textRanges?.length===t.textRanges?.length&&(e.textRanges??[]).every((e,n)=>{let r=t.textRanges?.[n];return e.blockId===r?.blockId&&e.quote===r.quote&&e.start===r.start}),missing:`a new thread needs anchor.blockId; dropped it`};function ere(e){let t=JSON.parse(e);if(!Ki(t))throw Error(`comments.json must be an object`);if(!Array.isArray(t.threads))throw Error(`threads must be an array`);return t.threads.forEach((e,t)=>{if(!Ki(e))throw Error(`threads[${t}] must be an object`);if(e.messages!==void 0&&!Array.isArray(e.messages))throw Error(`threads[${t}].messages must be an array`);if(!e.id&&!Ki(e.anchor))throw Error(`threads[${t}] needs an anchor`)}),t}const tre=e=>!!e.id&&(e.author===`human`||e.author===`agent`)&&typeof e.text==`string`&&typeof e.at==`string`;function nre(e,t=$ne){let n=[];for(let r of e.threads){let e=t.read(r.anchor);if(!r.id||!e||!r.statusAt||r.status!==`open`&&r.status!==`resolved`)continue;let i=(r.messages??[]).filter(tre),a=r.statusBy===`human`||r.statusBy===`agent`?{statusBy:r.statusBy}:{};n.push({id:r.id,anchor:e,status:r.status,statusAt:r.statusAt,...a,messages:i})}return{version:1,threads:n}}function qi(e){let t=0;for(;t<e.length;){let n=Math.min(t+65536,e.length);crypto.getRandomValues(e.subarray(t,n)),t=n}}function Ji(e){if(e|=0,e<0)throw RangeError(`Wrong ID size`);let t=Buffer.allocUnsafe(e);return qi(t),t}function Yi(e,t,n){let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i|=0;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}return(i=t)=>{if(!i)return``;let a=``,o=Math.ceil(409.6*i/r);for(;;){let t=n(o),s=o;for(;s--;)if(t[s]<r&&(a+=e[t[s]%e.length],a.length>=i))return a}}}function Xi(e,t=21){if(typeof e!=`string`||!e||e.length>256)return Yi(e,t,Ji);for(let n=0;n<e.length;n++)if(e.charCodeAt(n)>255)return Yi(e,t,Ji);let n=Uint8Array.from(e,e=>e.charCodeAt(0)),r=e.length,i=(2<<31-Math.clz32(r-1|1))-1,a=``,o=0,s=0;return(e=t)=>{if(e|=0,e<0)throw RangeError(`Wrong ID size`);if(e===0)return``;if(o+e>a.length){let t=Math.max(s,e);s=Math.min(t*16,32768);let c=Buffer.allocUnsafe(t);if(i===r-1){qi(c);for(let e=0;e<t;e++)c[e]=n[c[e]&i]}else{let e=Buffer.allocUnsafe(Math.ceil(1.6*(i+1)*t/r)),a=0;for(;a<t;){qi(e);for(let o=0;o<e.length;o++){let s=e[o]&i;if(s<r&&(c[a++]=n[s],a===t))break}}}a=c.toString(`latin1`),o=0}return o+=e,a.substring(o-e,o)}}Xi(`57X6y3wQZNzYjJB2L_10pxbackgroundhimselfUTF-8DEMOGRAPHICSVqvt4KW9`);var Zi=null;function rre(e){Zi=e}function ire(e){if(!Zi)throw Error(`@haklex/rich-litexml: parseHTML implementation not registered. Import from the main entry (@haklex/rich-litexml), not a deep submodule path.`);return Zi(e)}function Qi(e){let t=e.getAttribute(`id`);return t?{$:{blockId:t}}:{}}var $i={direction:`ltr`,format:``,indent:0,textFormat:0,textStyle:``,version:1};function are(e){e.registerReader(`p`,(e,t)=>({type:`paragraph`,...Qi(e),children:t.parseChildren(e),...$i}));for(let t=1;t<=6;t++)e.registerReader(`h${t}`,(e,n)=>({type:`heading`,tag:`h${t}`,...Qi(e),children:n.parseChildren(e),...$i}));e.registerReader(`blockquote`,(e,t)=>{let n=e.getAttribute(`attribution`),r=e.getAttribute(`rich`)!==null||n!==null,i={...Qi(e),children:t.parseChildren(e),...$i};return r?{type:`rich-quote`,attribution:n?.trim()?n:null,...i}:{type:`quote`,...i}}),e.registerReader(`hr`,e=>({type:`horizontalrule`,...Qi(e),version:1})),e.registerReader(`ul`,(e,t)=>({type:`list`,listType:e.getAttribute(`type`)===`check`?`check`:`bullet`,tag:`ul`,start:1,...Qi(e),children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`ol`,(e,t)=>({type:`list`,listType:`number`,tag:`ol`,start:Number(e.getAttribute(`start`)??1),...Qi(e),children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`li`,(e,t)=>{let n=e.getAttribute(`checked`);return{type:`listitem`,...Qi(e),...n===null?{}:{checked:n===`true`},children:t.parseChildren(e),...$i,value:1}}),e.registerReader(`a`,(e,t)=>({type:`link`,url:e.getAttribute(`href`)??``,target:e.getAttribute(`target`)??null,title:e.getAttribute(`title`)??null,rel:e.getAttribute(`rel`),children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`table`,(e,t)=>({type:`table`,...Qi(e),children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`tr`,(e,t)=>({type:`tablerow`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`th`,(e,t)=>({type:`tablecell`,headerState:1,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`td`,(e,t)=>({type:`tablecell`,headerState:0,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1}))}var ea=`abcdefghijklmnopqrstuvwxyz0123456789`,ore=Xi(ea,10),sre=Xi(ea,6),cre=Xi(ea,6),lre=Xi(ea,8),ure=Xi(ea,8);function ta(e){let t=e.getAttribute(`id`);return t?{$:{blockId:t}}:{}}function na(e,t){let n=e.getAttribute(t);return n===null?void 0:Number(n)}var dre=/* @__PURE__ */ new Set([`align-left`,`align-right`,`float-left`,`float-right`]);function fre(e){let t=na(e,`display-width`);return t!==void 0&&Number.isFinite(t)&&t>=10&&t<=100?t:void 0}function ra(e,t){let n=na(e,t);return n!==void 0&&Number.isFinite(n)&&n>0?Math.round(n):void 0}function pre(e){let t=fre(e);if(t!==void 0)return{displayWidth:t};let n=ra(e,`fixed-width`);if(n!==void 0)return{fixedWidth:n};let r=ra(e,`fixed-height`);return r===void 0?{}:{fixedHeight:r}}function mre(e){let t=e.getAttribute(`layout`);return t!==null&&dre.has(t)?t:void 0}var hre=/* @__PURE__ */ new Set([`auto`,`1:1`,`4:3`,`16:9`,`3:4`]),gre=/* @__PURE__ */ new Set([`cover`,`contain`]);function _re(e){let t=e.getAttribute(`aspect`);return t!==null&&hre.has(t)?t:`auto`}function vre(e){let t=e.getAttribute(`fit`);return t!==null&&gre.has(t)?t:`cover`}function yre(e){let t=na(e,`max-item-height`);return t!==void 0&&Number.isFinite(t)&&t>0?t:void 0}function ia(e){for(let t of e.childNodes)if(t.nodeType===8){let e=t.nodeValue??``;if(e.startsWith(`[CDATA[`)&&e.endsWith(`]]`))return e.slice(7,-2)}return null}function aa(e){return ia(e)??e.textContent??``}function bre(e){e.registerReader(`img`,e=>e.parentElement?.tagName.toLowerCase()!==`gallery`&&{type:`image`,...ta(e),src:e.getAttribute(`src`)??``,altText:e.getAttribute(`alt`)??``,width:na(e,`width`),height:na(e,`height`),caption:e.getAttribute(`caption`)??void 0,thumbhash:e.getAttribute(`thumbhash`)??void 0,accent:e.getAttribute(`accent`)??void 0,...pre(e),layout:mre(e),version:1}),e.registerReader(`video`,e=>({type:`video`,...ta(e),src:e.getAttribute(`src`)??``,poster:e.getAttribute(`poster`)??void 0,width:na(e,`width`),height:na(e,`height`),version:1})),e.registerReader(`attachment`,e=>({type:`file`,...ta(e),src:e.getAttribute(`src`)??``,name:e.getAttribute(`name`)??``,size:na(e,`size`),mimeType:e.getAttribute(`mime-type`)??void 0,ext:e.getAttribute(`ext`)??void 0,display:e.getAttribute(`display`)===`inline`?`inline`:`block`,version:1})),e.registerReader(`link-card`,e=>({type:`link-card`,...ta(e),url:e.getAttribute(`url`)??``,source:e.getAttribute(`source`)??void 0,title:e.getAttribute(`title`)??void 0,description:e.getAttribute(`description`)??void 0,favicon:e.getAttribute(`favicon`)??void 0,image:e.getAttribute(`image`)??void 0,version:1})),e.registerReader(`embed`,e=>({type:`embed`,...ta(e),url:e.getAttribute(`url`)??``,source:e.getAttribute(`source`)??null,version:1})),e.registerReader(`codeblock`,e=>({type:`code-block`,...ta(e),code:aa(e),language:e.getAttribute(`lang`)??``,version:1})),e.registerReader(`mermaid`,e=>({type:`mermaid`,...ta(e),diagram:aa(e),version:1})),e.registerReader(`math`,e=>{if(e.getAttribute(`display`)===`block`)return{type:`katex-block`,...ta(e),equation:aa(e),version:1};let t=e.getAttribute(`color`);return{type:`katex-inline`,equation:aa(e),...t?{color:t}:{},version:1}}),e.registerReader(`alert`,(e,t)=>{let n={root:{type:`root`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1}};return{type:`alert-quote`,...ta(e),alertType:e.getAttribute(`type`)??`note`,content:n,version:1}}),e.registerReader(`banner`,(e,t)=>{let n={root:{type:`root`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1}};return{type:`banner`,...ta(e),bannerType:e.getAttribute(`type`)??`note`,content:n,version:1}}),e.registerReader(`nested-doc`,(e,t)=>{let n={root:{type:`root`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1}};return{type:`nested-doc`,...ta(e),content:n,version:1}}),e.registerReader(`details`,(e,t)=>({type:`details`,...ta(e),summary:e.getAttribute(`summary`)??``,open:e.getAttribute(`open`)===`true`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`spoiler`,(e,t)=>({type:`spoiler`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,textFormat:0,textStyle:``,version:1})),e.registerReader(`ruby`,(e,t)=>({type:`ruby`,reading:e.getAttribute(`rt`)??``,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,textFormat:0,textStyle:``,version:1})),e.registerReader(`mention`,e=>({type:`mention`,platform:e.getAttribute(`platform`)??``,handle:e.getAttribute(`handle`)??``,displayName:e.textContent||void 0,version:1})),e.registerReader(`tag`,e=>({type:`tag`,text:e.textContent??``,format:0,detail:0,mode:`normal`,style:``,version:1})),e.registerReader(`comment`,e=>({type:`comment`,text:e.textContent??``,format:0,detail:0,mode:`normal`,style:``,version:1})),e.registerReader(`footnote`,e=>({type:`footnote`,identifier:e.getAttribute(`ref`)??``,version:1})),e.registerReader(`footnote-section`,e=>{let t={};for(let n of e.children)if(n.tagName.toLowerCase()===`def`){let e=n.getAttribute(`ref`)??``;t[e]=n.textContent??``}return{type:`footnote-section`,...ta(e),definitions:t,version:1}}),e.registerReader(`gallery`,e=>{let t=[];for(let n of e.children)n.tagName.toLowerCase()===`img`&&t.push({src:n.getAttribute(`src`)??``,alt:n.getAttribute(`alt`)??void 0});return{type:`gallery`,...ta(e),images:t,layout:e.getAttribute(`layout`)??`grid`,aspect:_re(e),fit:vre(e),maxItemHeight:yre(e),version:1}}),e.registerReader(`excalidraw`,e=>({type:`excalidraw`,...ta(e),snapshot:ia(e)||e.getAttribute(`snapshot`)||e.textContent?.trim()||``,version:1})),e.registerReader(`chart`,e=>({type:`chart`,...ta(e),spec:aa(e).trim(),version:1})),e.registerReader(`dynamic`,e=>{let t={},n=(ia(e)??e.textContent??``).trim();if(n)try{let e=JSON.parse(n);e&&typeof e==`object`&&!Array.isArray(e)&&(t=e)}catch{}return{type:`dynamic`,...ta(e),url:e.getAttribute(`url`)??``,props:t,initialHeight:na(e,`initial-height`)??320,version:1}}),e.registerReader(`grid`,(e,t)=>{let n=[];for(let r of e.children)if(r.tagName.toLowerCase()===`cell`){let e=t.parseChildren(r);n.push({root:{type:`root`,children:e,direction:`ltr`,format:``,indent:0,version:1}})}return{type:`grid-container`,...ta(e),cols:na(e,`cols`)??2,gap:e.getAttribute(`gap`)??`16px`,cells:n,version:1}}),e.registerReader(`agent-diff`,e=>({type:`agent-diff`,...ta(e),opType:e.getAttribute(`op`)??`insert`,diffEntryId:e.getAttribute(`entry`)??``,version:1})),e.registerReader(`code-snippet`,e=>{let t=[];for(let n of e.children)n.tagName.toLowerCase()===`file`&&t.push({filename:n.getAttribute(`name`)??``,code:aa(n),language:n.getAttribute(`lang`)??``});return{type:`code-snippet`,...ta(e),files:t,version:1}}),e.registerReader(`steps`,(e,t)=>{let n=[];for(let r of e.children)r.tagName.toLowerCase()===`step`&&n.push({id:r.getAttribute(`id`)||`s_${ure()}`,title:r.getAttribute(`title`)??``,content:{root:{type:`root`,children:t.parseChildren(r),direction:`ltr`,format:``,indent:0,version:1}}});return{type:`steps`,...ta(e),steps:n,version:1}}),e.registerReader(`chat`,e=>{let t=e.getAttribute(`variant`)===`user-user`?`user-user`:`user-agent`,n=[],r=[];for(let t of e.children){let e=t.tagName.toLowerCase();if(e===`participants`)for(let e of t.children){if(e.tagName.toLowerCase()!==`participant`)continue;let t=e.getAttribute(`kind`)===`agent`?`agent`:`user`;n.push({id:e.getAttribute(`id`)||`p_${cre()}`,kind:t,name:e.getAttribute(`name`)||void 0,avatar:e.getAttribute(`avatar`)||void 0})}else if(e===`messages`)for(let e of t.children)e.tagName.toLowerCase()===`message`&&r.push({id:e.getAttribute(`id`)||`m_${lre()}`,participantId:e.getAttribute(`participant`)??``,content:e.textContent??``})}return{type:`chat`,...ta(e),variant:t,participants:n,messages:r,version:1}}),e.registerReader(`poll`,e=>{let t=``,n=[];for(let r of e.children){let e=r.tagName.toLowerCase();if(e===`question`)t=r.textContent??``;else if(e===`option`){let e=r.getAttribute(`id`)||`o_${sre()}`;n.push({id:e,label:r.textContent??``})}}let r=e.getAttribute(`mode`)===`multiple`?`multiple`:`single`,i=e.getAttribute(`close-at`),a=e.getAttribute(`show-results`),o=a===`always`||a===`after-vote`||a===`after-close`?a:void 0;return{type:`poll`,...ta(e),pollId:e.getAttribute(`poll-id`)||`p_${ore()}`,question:t,options:n,mode:r,...i?{closeAt:i}:{},...o?{showResults:o}:{},version:1}})}var xre=class{constructor(){this.writers=/* @__PURE__ */ new Map,this.readers=/* @__PURE__ */ new Map}registerWriter(e,t){this.writers.set(e,t)}registerReader(e,t){this.readers.set(e.toLowerCase(),t)}getWriter(e){return this.writers.get(e)}getReader(e){return this.readers.get(e.toLowerCase())}};function oa(e){return e.$?.blockId?{id:e.$.blockId}:{}}function Sre(e){e.registerWriter(`paragraph`,(e,t)=>{let n=e;return{tag:`p`,attrs:oa(n),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`heading`,(e,t)=>{let n=e;return{tag:n.tag??`h1`,attrs:oa(n),children:t.serializeChildren(n.children??[])}});let t=(e,t)=>{let n=e,r={...oa(n)};return n.type===`rich-quote`&&((typeof n.attribution==`string`?n.attribution.trim():``)===``?r.rich=`true`:r.attribution=n.attribution),{tag:`blockquote`,attrs:r,children:t.serializeChildren(n.children??[])}};e.registerWriter(`quote`,t),e.registerWriter(`rich-quote`,t),e.registerWriter(`horizontalrule`,e=>({tag:`hr`,attrs:oa(e),selfClosing:!0})),e.registerWriter(`list`,(e,t)=>{let n=e,r=n.listType===`number`?`ol`:`ul`,i={...oa(n)};return n.listType===`check`&&(i.type=`check`),{tag:r,attrs:i,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`listitem`,(e,t)=>{let n=e,r={...oa(n)};return n.checked!==void 0&&(r.checked=String(n.checked)),{tag:`li`,attrs:r,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`link`,(e,t)=>{let n=e,r={href:typeof n.url==`string`?n.url:``};return typeof n.target==`string`&&n.target!==``&&(r.target=n.target),typeof n.title==`string`&&n.title!==``&&(r.title=n.title),typeof n.rel==`string`&&n.rel!==``&&(r.rel=n.rel),{tag:`a`,attrs:r,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`autolink`,(e,t)=>{let n=e;return{tag:`a`,attrs:{href:n.url??``},children:t.serializeChildren(n.children??[])}}),e.registerWriter(`table`,(e,t)=>{let n=e;return{tag:`table`,attrs:oa(n),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`tablerow`,(e,t)=>{let n=e;return{tag:`tr`,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`tablecell`,(e,t)=>{let n=e;return{tag:n.headerState===1?`th`:`td`,children:t.serializeChildren(n.children??[])}})}function sa(e){return e.$?.blockId?{id:e.$.blockId}:{}}function ca(e){let t={};for(let[n,r]of Object.entries(e))r!=null&&r!==``&&(t[n]=String(r));return t}function Cre(e){e.registerWriter(`image`,e=>{let t=e;return{tag:`img`,attrs:ca({...sa(t),src:t.src,alt:t.altText,width:t.width==null?void 0:String(t.width),height:t.height==null?void 0:String(t.height),caption:t.caption,thumbhash:t.thumbhash,accent:t.accent,"display-width":t.displayWidth==null?void 0:String(t.displayWidth),"fixed-width":t.fixedWidth==null?void 0:String(t.fixedWidth),"fixed-height":t.fixedHeight==null?void 0:String(t.fixedHeight),layout:t.layout}),selfClosing:!0}}),e.registerWriter(`video`,e=>{let t=e;return{tag:`video`,attrs:ca({...sa(t),src:t.src,poster:t.poster}),selfClosing:!0}}),e.registerWriter(`file`,e=>{let t=e;return{tag:`attachment`,attrs:ca({...sa(t),src:t.src,name:t.name,size:t.size==null?void 0:String(t.size),"mime-type":t.mimeType,ext:t.ext,display:t.display===`inline`?`inline`:void 0}),selfClosing:!0}}),e.registerWriter(`link-card`,e=>{let t=e;return{tag:`link-card`,attrs:ca({...sa(t),url:t.url,source:t.source,title:t.title,description:t.description,favicon:t.favicon,image:t.image}),selfClosing:!0}}),e.registerWriter(`embed`,e=>{let t=e;return{tag:`embed`,attrs:ca({...sa(t),url:t.url,source:t.source}),selfClosing:!0}}),e.registerWriter(`code-block`,e=>{let t=e;return{tag:`codeblock`,attrs:ca({...sa(t),lang:t.language}),children:[t.code??``]}}),e.registerWriter(`mermaid`,e=>{let t=e;return{tag:`mermaid`,attrs:sa(t),children:[t.diagram??``]}}),e.registerWriter(`katex-block`,e=>{let t=e;return{tag:`math`,attrs:{...sa(t),display:`block`},children:[t.equation??``]}}),e.registerWriter(`katex-inline`,e=>{let t=e,n={};return t.color&&(n.color=t.color),{tag:`math`,attrs:Object.keys(n).length>0?n:void 0,children:[t.equation??``]}}),e.registerWriter(`alert-quote`,(e,t)=>{let n=e;return{tag:`alert`,attrs:ca({...sa(n),type:n.alertType}),children:t.serializeNestedState(n.content)}}),e.registerWriter(`banner`,(e,t)=>{let n=e;return{tag:`banner`,attrs:ca({...sa(n),type:n.bannerType}),children:t.serializeNestedState(n.content)}}),e.registerWriter(`nested-doc`,(e,t)=>{let n=e;return{tag:`nested-doc`,attrs:sa(n),children:t.serializeNestedState(n.content??n.contentState)}}),e.registerWriter(`excalidraw`,e=>{let t=e;return t.snapshot?/^(?:https?:\/\/|blob:|ref:)\S+$/.test(t.snapshot.trim())?{tag:`excalidraw`,attrs:ca(sa(t)),children:[t.snapshot.trim()]}:{tag:`excalidraw`,attrs:ca(sa(t)),children:[{cdata:t.snapshot}]}:{tag:`excalidraw`,attrs:ca(sa(t)),selfClosing:!0}}),e.registerWriter(`chart`,e=>{let t=e,n=typeof t.spec==`string`?t.spec:``;return n?{tag:`chart`,attrs:ca(sa(t)),children:[{cdata:n}]}:{tag:`chart`,attrs:ca(sa(t)),selfClosing:!0}}),e.registerWriter(`dynamic`,e=>{let t=e,n=ca({...sa(t),url:t.url,"initial-height":t.initialHeight==null?void 0:String(t.initialHeight)});return!t.props||Object.keys(t.props).length===0?{tag:`dynamic`,attrs:n,selfClosing:!0}:{tag:`dynamic`,attrs:n,children:[{cdata:JSON.stringify(t.props)}]}}),e.registerWriter(`grid-container`,(e,t)=>{let n=e,r=(n.cells??[]).map(e=>({tag:`cell`,children:t.serializeNestedState(e)}));return{tag:`grid`,attrs:ca({...sa(n),cols:n.cols==null?void 0:String(n.cols),gap:n.gap}),children:r}}),e.registerWriter(`agent-diff`,e=>{let t=e;return{tag:`agent-diff`,attrs:ca({...sa(t),op:t.opType,entry:t.diffEntryId}),selfClosing:!0}}),e.registerWriter(`details`,(e,t)=>{let n=e;return{tag:`details`,attrs:ca({...sa(n),summary:n.summary,open:n.open==null?void 0:String(n.open)}),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`spoiler`,(e,t)=>{let n=e;return{tag:`spoiler`,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`ruby`,(e,t)=>{let n=e;return{tag:`ruby`,attrs:ca({rt:n.reading}),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`mention`,e=>{let t=e;return{tag:`mention`,attrs:ca({platform:t.platform,handle:t.handle}),children:[t.displayName??t.handle??``]}}),e.registerWriter(`tag`,e=>({tag:`tag`,children:[e.text??``]})),e.registerWriter(`comment`,e=>({tag:`comment`,children:[e.text??``]})),e.registerWriter(`footnote`,e=>({tag:`footnote`,attrs:{ref:e.identifier??``},selfClosing:!0})),e.registerWriter(`footnote-section`,e=>{let t=e,n=t.definitions??{},r=Object.entries(n).map(([e,t])=>({tag:`def`,attrs:{ref:e},children:[t]}));return{tag:`footnote-section`,attrs:sa(t),children:r}}),e.registerWriter(`gallery`,e=>{let t=e,n=(t.images??[]).map(e=>({tag:`img`,attrs:ca({src:e.src,alt:e.alt}),selfClosing:!0}));return{tag:`gallery`,attrs:ca({...sa(t),layout:t.layout,aspect:t.aspect&&t.aspect!==`auto`?t.aspect:void 0,fit:t.fit&&t.fit!==`cover`?t.fit:void 0,"max-item-height":t.maxItemHeight==null?void 0:String(t.maxItemHeight)}),children:n}}),e.registerWriter(`code-snippet`,e=>{let t=e,n=(t.files??[]).map(e=>({tag:`file`,attrs:ca({name:e.filename,lang:e.language}),children:[e.code??``]}));return{tag:`code-snippet`,attrs:sa(t),children:n}}),e.registerWriter(`steps`,(e,t)=>{let n=e,r=(n.steps??[]).map(e=>({tag:`step`,attrs:ca({id:e.id,title:e.title}),children:t.serializeNestedState(e.content)}));return{tag:`steps`,attrs:sa(n),children:r}}),e.registerWriter(`chat`,e=>{let t=e,n={tag:`participants`,children:(t.participants??[]).map(e=>({tag:`participant`,attrs:ca({id:e.id,kind:e.kind,name:e.name,avatar:e.avatar}),children:[]}))},r={tag:`messages`,children:(t.messages??[]).map(e=>({tag:`message`,attrs:ca({id:e.id,participant:e.participantId}),children:[e.content??``]}))};return{tag:`chat`,attrs:ca({...sa(t),variant:t.variant}),children:[n,r]}}),e.registerWriter(`poll`,e=>{let t=e,n=(t.options??[]).map(e=>({tag:`option`,attrs:ca({id:e.id}),children:[e.label??``]}));return{tag:`poll`,attrs:ca({...sa(t),"poll-id":t.pollId,mode:t.mode,"close-at":t.closeAt,"show-results":t.showResults}),children:[{tag:`question`,children:[t.question??``]},...n]}})}function wre(){let e=new xre;return Sre(e),are(e),Cre(e),bre(e),e}var la={b:1,strong:1,i:2,em:2,s:4,del:4,strike:4,u:8,code:16,sub:32,sup:64,mark:128};function Tre(e){return e.toLowerCase()in la}function Ere(e){return la[e.toLowerCase()]??0}var Dre=/* @__PURE__ */ new Set([`b`,`i`,`u`,`s`,`code`,`sub`,`sup`,`mark`,`strong`,`em`,`del`,`strike`,`a`,`mention`,`tag`,`spoiler`,`ruby`,`math`,`footnote`,`comment`,`br`,`img`]);function Ore(e){return Dre.has(e.toLowerCase())}var kre=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),Are=/<([\w-]+)((?:\s+[\w-]+(?:\s*=\s*(?:"[^"]*"|'[^']*'))?)*)\s*\/>/g,jre=`<![CDATA[`,Mre=`]]>`;function ua(e){return e.replaceAll(Are,(e,t,n)=>kre.has(t.toLowerCase())?e:`<${t}${n}></${t}>`)}function Nre(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(jre,n);if(r<0){t.push(ua(e.slice(n)));break}t.push(ua(e.slice(n,r)));let i=e.indexOf(Mre,r+9);if(i<0){t.push(e.slice(r));break}t.push(e.slice(r,i+3)),n=i+3}return t.join(``)}function Pre(e){return ire(`<!DOCTYPE html><html><body>${Nre(e)}</body></html>`)}function da(e,t){let n=Pre(e),r=n.querySelector(`doc`)??n.body;return{root:{type:`root`,children:Lre(t).parseChildren(r),direction:`ltr`,format:``,indent:0,version:1}}}var Fre=/* @__PURE__ */ new Set([`doc`,`fragment`,`root`,`ul`,`ol`,`table`,`tr`,`blockquote`,`alert`,`banner`,`details`,`nested-doc`,`gallery`,`codeblock`,`code-snippet`,`footnote-section`,`grid`,`cell`,`steps`,`step`,`excalidraw`]);function Ire(e){return Fre.has(e.tagName.toLowerCase())}function Lre(e){let t={parseChildren(n){let r=[...n.children].some(e=>!Ore(e.tagName)),i=Ire(n)||r,a=[],o=``,s=()=>{if(o===``)return;if(i&&o.trim()===``){o=``;return}let e=i?o.replace(/^\s*\n[ \t]*/,``).replace(/\n\s*$/,``):o;a.push(pa(e,0)),o=``};for(let r of n.childNodes)if(r.nodeType===3)o+=r.textContent??``;else if(r.nodeType===1){s();let n=fa(r,e,t,0);n&&(Array.isArray(n)?a.push(...n):a.push(n))}return s(),a},parseNestedState(t){return da(t,e)}};return t}function fa(e,t,n,r){let i=e.tagName.toLowerCase();if(Tre(i))return Rre(e,t,n,r|Ere(i));if(i===`br`)return{type:`linebreak`,version:1};if(i===`node`)return zre(e);let a=t.getReader(i);if(a){let t=a(e,n);if(t!==!1)return t}return n.parseChildren(e)}function Rre(e,t,n,r){let i=[],a=``,o=()=>{a!==``&&(i.push(pa(a,r)),a=``)};for(let s of e.childNodes)if(s.nodeType===3)a+=s.textContent??``;else if(s.nodeType===1){o();let e=fa(s,t,n,r);e&&(Array.isArray(e)?i.push(...e):i.push(e))}return o(),i}function zre(e){let t=e.getAttribute(`type`)??`unknown`,n=e.getAttribute(`id`),r=e.getAttribute(`data`),i=r?JSON.parse(r):{};return{type:t,...n?{$:{blockId:n}}:{},...i,version:1}}function pa(e,t){return{type:`text`,text:e,format:t,detail:0,mode:`normal`,style:``,version:1}}const ma=Symbol(`changed`),ha=Symbol(`classList`),ga=Symbol(`CustomElements`),_a=Symbol(`content`),va=Symbol(`dataset`),ya=Symbol(`doctype`),ba=Symbol(`DOMParser`),xa=Symbol(`end`),Sa=Symbol(`EventTarget`),Ca=Symbol(`globals`),wa=Symbol(`image`),Ta=Symbol(`mime`),Ea=Symbol(`MutationObserver`),j=Symbol(`next`),Da=Symbol(`ownerElement`),Oa=Symbol(`prev`),ka=Symbol(`private`),Aa=Symbol(`sheet`),ja=Symbol(`start`),Ma=Symbol(`style`),Na=Symbol(`upgrade`),Pa=Symbol(`value`),Bre=/* @__PURE__ */ new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Fa=String.fromCodePoint??(e=>{let t=``;return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t});function Vre(e){return e>=55296&&e<=57343||e>1114111?65533:Bre.get(e)??e}function Ia(e){let t=typeof atob==`function`?atob(e):typeof Buffer.from==`function`?Buffer.from(e,`base64`).toString(`binary`):new Buffer(e,`base64`).toString(`binary`),n=t.length&-2,r=new Uint16Array(n/2);for(let e=0,i=0;e<n;e+=2){let n=t.charCodeAt(e),a=t.charCodeAt(e+1);r[i++]=n|a<<8}return r}const Hre=/* #__PURE__ */ Ia(`QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAj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OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg`),Ure=/* #__PURE__ */ Ia(`AAJhZ2xxBwARABMAFQBtAg0AAAAAAA8AcAAmYG8AcwAnYHQAPmB0ADxg9SFvdCJg`);var La;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.FLAG13=8192]=`FLAG13`,e[e.BRANCH_LENGTH=8064]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(La||={});var Ra;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(Ra||={});function za(e){return e>=Ra.ZERO&&e<=Ra.NINE}function Wre(e){return e>=Ra.UPPER_A&&e<=Ra.UPPER_F||e>=Ra.LOWER_A&&e<=Ra.LOWER_F}function Gre(e){return e>=Ra.UPPER_A&&e<=Ra.UPPER_Z||e>=Ra.LOWER_A&&e<=Ra.LOWER_Z||za(e)}function Kre(e){return e===Ra.EQUALS||Gre(e)}var Ba;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(Ba||={});var Va;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(Va||={});var qre=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=Ba.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Va.Strict,this.runConsumed=0}startEntity(e){this.decodeMode=e,this.state=Ba.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(e,t){switch(this.state){case Ba.EntityStart:return e.charCodeAt(t)===Ra.NUM?(this.state=Ba.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=Ba.NamedEntity,this.stateNamedEntity(e,t));case Ba.NumericStart:return this.stateNumericStart(e,t);case Ba.NumericDecimal:return this.stateNumericDecimal(e,t);case Ba.NumericHex:return this.stateNumericHex(e,t);case Ba.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|32)===Ra.LOWER_X?(this.state=Ba.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=Ba.NumericDecimal,this.stateNumericDecimal(e,t))}stateNumericHex(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(za(n)||Wre(n)){let e=n<=Ra.NINE?n-Ra.ZERO:(n|32)-Ra.LOWER_A+10;this.result=this.result*16+e,this.consumed++,t++}else return this.emitNumericEntity(n,3)}return-1}stateNumericDecimal(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(za(n))this.result=this.result*10+(n-Ra.ZERO),this.consumed++,t++;else return this.emitNumericEntity(n,2)}return-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Ra.SEMI)this.consumed+=1;else if(this.decodeMode===Va.Strict)return 0;return this.emitCodePoint(Vre(this.result),this.consumed),this.errors&&(e!==Ra.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&La.VALUE_LENGTH)>>14;for(;t<e.length;){if(i===0&&(r&La.FLAG13)!==0){let a=(r&La.BRANCH_LENGTH)>>7;if(this.runConsumed===0){let n=r&La.JUMP_TABLE;if(e.charCodeAt(t)!==n)return this.result===0?0:this.emitNotTerminatedNamedEntity();t++,this.excess++,this.runConsumed++}for(;this.runConsumed<a;){if(t>=e.length)return-1;let r=this.runConsumed-1,i=n[this.treeIndex+1+(r>>1)],a=r%2==0?i&255:i>>8&255;if(e.charCodeAt(t)!==a)return this.runConsumed=0,this.result===0?0:this.emitNotTerminatedNamedEntity();t++,this.excess++,this.runConsumed++}this.runConsumed=0,this.treeIndex+=1+(a>>1),r=n[this.treeIndex],i=(r&La.VALUE_LENGTH)>>14}if(t>=e.length)break;let a=e.charCodeAt(t);if(a===Ra.SEMI&&i!==0&&(r&La.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);if(this.treeIndex=Jre(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===Va.Attribute&&(i===0||Kre(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&La.VALUE_LENGTH)>>14,i!==0){if(a===Ra.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Va.Strict&&(r&La.FLAG13)===0&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}t++,this.excess++}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&La.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~(La.VALUE_LENGTH|La.FLAG13):r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case Ba.NamedEntity:return this.result!==0&&(this.decodeMode!==Va.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Ba.NumericDecimal:return this.emitNumericEntity(0,2);case Ba.NumericHex:return this.emitNumericEntity(0,3);case Ba.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Ba.EntityStart:return 0}}};function Jre(e,t,n,r){let i=(t&La.BRANCH_LENGTH)>>7,a=t&La.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=i+1>>1,s=0,c=i-1;for(;s<=c;){let t=s+c>>>1,i=e[n+(t>>1)]>>(t&1)*8&255;if(i<r)s=t+1;else if(i>r)c=t-1;else return e[n+o+t]}return-1}var Ha;(function(e){e[e.Tab=9]=`Tab`,e[e.NewLine=10]=`NewLine`,e[e.FormFeed=12]=`FormFeed`,e[e.CarriageReturn=13]=`CarriageReturn`,e[e.Space=32]=`Space`,e[e.ExclamationMark=33]=`ExclamationMark`,e[e.Number=35]=`Number`,e[e.Amp=38]=`Amp`,e[e.SingleQuote=39]=`SingleQuote`,e[e.DoubleQuote=34]=`DoubleQuote`,e[e.Dash=45]=`Dash`,e[e.Slash=47]=`Slash`,e[e.Zero=48]=`Zero`,e[e.Nine=57]=`Nine`,e[e.Semi=59]=`Semi`,e[e.Lt=60]=`Lt`,e[e.Eq=61]=`Eq`,e[e.Gt=62]=`Gt`,e[e.Questionmark=63]=`Questionmark`,e[e.UpperA=65]=`UpperA`,e[e.LowerA=97]=`LowerA`,e[e.UpperF=70]=`UpperF`,e[e.LowerF=102]=`LowerF`,e[e.UpperZ=90]=`UpperZ`,e[e.LowerZ=122]=`LowerZ`,e[e.LowerX=120]=`LowerX`,e[e.OpeningSquareBracket=91]=`OpeningSquareBracket`})(Ha||={});var M;(function(e){e[e.Text=1]=`Text`,e[e.BeforeTagName=2]=`BeforeTagName`,e[e.InTagName=3]=`InTagName`,e[e.InSelfClosingTag=4]=`InSelfClosingTag`,e[e.BeforeClosingTagName=5]=`BeforeClosingTagName`,e[e.InClosingTagName=6]=`InClosingTagName`,e[e.AfterClosingTagName=7]=`AfterClosingTagName`,e[e.BeforeAttributeName=8]=`BeforeAttributeName`,e[e.InAttributeName=9]=`InAttributeName`,e[e.AfterAttributeName=10]=`AfterAttributeName`,e[e.BeforeAttributeValue=11]=`BeforeAttributeValue`,e[e.InAttributeValueDq=12]=`InAttributeValueDq`,e[e.InAttributeValueSq=13]=`InAttributeValueSq`,e[e.InAttributeValueNq=14]=`InAttributeValueNq`,e[e.BeforeDeclaration=15]=`BeforeDeclaration`,e[e.InDeclaration=16]=`InDeclaration`,e[e.InProcessingInstruction=17]=`InProcessingInstruction`,e[e.BeforeComment=18]=`BeforeComment`,e[e.CDATASequence=19]=`CDATASequence`,e[e.InSpecialComment=20]=`InSpecialComment`,e[e.InCommentLike=21]=`InCommentLike`,e[e.BeforeSpecialS=22]=`BeforeSpecialS`,e[e.BeforeSpecialT=23]=`BeforeSpecialT`,e[e.SpecialStartSequence=24]=`SpecialStartSequence`,e[e.InSpecialTag=25]=`InSpecialTag`,e[e.InEntity=26]=`InEntity`})(M||={});function Ua(e){return e===Ha.Space||e===Ha.NewLine||e===Ha.Tab||e===Ha.FormFeed||e===Ha.CarriageReturn}function Wa(e){return e===Ha.Slash||e===Ha.Gt||Ua(e)}function Yre(e){return e>=Ha.LowerA&&e<=Ha.LowerZ||e>=Ha.UpperA&&e<=Ha.UpperZ}var Ga;(function(e){e[e.NoValue=0]=`NoValue`,e[e.Unquoted=1]=`Unquoted`,e[e.Single=2]=`Single`,e[e.Double=3]=`Double`})(Ga||={});const Ka={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97]),XmpEnd:new Uint8Array([60,47,120,109,112])};var qa=class{constructor({xmlMode:e=!1,decodeEntities:t=!0},n){this.cbs=n,this.state=M.Text,this.buffer=``,this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=M.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=e,this.decodeEntities=t,this.entityDecoder=new qre(e?Ure:Hre,(e,t)=>this.emitCodePoint(e,t))}reset(){this.state=M.Text,this.buffer=``,this.sectionStart=0,this.index=0,this.baseState=M.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(e){this.offset+=this.buffer.length,this.buffer=e,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}stateText(e){e===Ha.Lt||!this.decodeEntities&&this.fastForwardTo(Ha.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=M.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&e===Ha.Amp&&this.startEntity()}stateSpecialStartSequence(e){let t=this.sequenceIndex===this.currentSequence.length;if(!(t?Wa(e):(e|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!t){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=M.InTagName,this.stateInTagName(e)}stateInSpecialTag(e){if(this.sequenceIndex===this.currentSequence.length){if(e===Ha.Gt||Ua(e)){let t=this.index-this.currentSequence.length;if(this.sectionStart<t){let e=this.index;this.index=t,this.cbs.ontext(this.sectionStart,t),this.index=e}this.isSpecial=!1,this.sectionStart=t+2,this.stateInClosingTagName(e);return}this.sequenceIndex=0}(e|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===Ka.TitleEnd?this.decodeEntities&&e===Ha.Amp&&this.startEntity():this.fastForwardTo(Ha.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=Number(e===Ha.Lt)}stateCDATASequence(e){e===Ka.Cdata[this.sequenceIndex]?++this.sequenceIndex===Ka.Cdata.length&&(this.state=M.InCommentLike,this.currentSequence=Ka.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=M.InDeclaration,this.stateInDeclaration(e))}fastForwardTo(e){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===e)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(e){e===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===Ka.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=M.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):e!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(e){return this.xmlMode?!Wa(e):Yre(e)}startSpecial(e,t){this.isSpecial=!0,this.currentSequence=e,this.sequenceIndex=t,this.state=M.SpecialStartSequence}stateBeforeTagName(e){if(e===Ha.ExclamationMark)this.state=M.BeforeDeclaration,this.sectionStart=this.index+1;else if(e===Ha.Questionmark)this.state=M.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(e)){let t=e|32;this.sectionStart=this.index,this.state=this.xmlMode?M.InTagName:t===Ka.ScriptEnd[2]?M.BeforeSpecialS:t===Ka.TitleEnd[2]||t===Ka.XmpEnd[2]?M.BeforeSpecialT:M.InTagName}else e===Ha.Slash?this.state=M.BeforeClosingTagName:(this.state=M.Text,this.stateText(e))}stateInTagName(e){Wa(e)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=M.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateBeforeClosingTagName(e){Ua(e)||(e===Ha.Gt?this.state=M.Text:(this.state=this.isTagStartChar(e)?M.InClosingTagName:M.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(e){(e===Ha.Gt||Ua(e))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=M.AfterClosingTagName,this.stateAfterClosingTagName(e))}stateAfterClosingTagName(e){(e===Ha.Gt||this.fastForwardTo(Ha.Gt))&&(this.state=M.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(e){e===Ha.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=M.InSpecialTag,this.sequenceIndex=0):this.state=M.Text,this.sectionStart=this.index+1):e===Ha.Slash?this.state=M.InSelfClosingTag:Ua(e)||(this.state=M.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(e){e===Ha.Gt?(this.cbs.onselfclosingtag(this.index),this.state=M.Text,this.sectionStart=this.index+1,this.isSpecial=!1):Ua(e)||(this.state=M.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateInAttributeName(e){(e===Ha.Eq||Wa(e))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=M.AfterAttributeName,this.stateAfterAttributeName(e))}stateAfterAttributeName(e){e===Ha.Eq?this.state=M.BeforeAttributeValue:e===Ha.Slash||e===Ha.Gt?(this.cbs.onattribend(Ga.NoValue,this.sectionStart),this.sectionStart=-1,this.state=M.BeforeAttributeName,this.stateBeforeAttributeName(e)):Ua(e)||(this.cbs.onattribend(Ga.NoValue,this.sectionStart),this.state=M.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(e){e===Ha.DoubleQuote?(this.state=M.InAttributeValueDq,this.sectionStart=this.index+1):e===Ha.SingleQuote?(this.state=M.InAttributeValueSq,this.sectionStart=this.index+1):Ua(e)||(this.sectionStart=this.index,this.state=M.InAttributeValueNq,this.stateInAttributeValueNoQuotes(e))}handleInAttributeValue(e,t){e===t||!this.decodeEntities&&this.fastForwardTo(t)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(t===Ha.DoubleQuote?Ga.Double:Ga.Single,this.index+1),this.state=M.BeforeAttributeName):this.decodeEntities&&e===Ha.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(e){this.handleInAttributeValue(e,Ha.DoubleQuote)}stateInAttributeValueSingleQuotes(e){this.handleInAttributeValue(e,Ha.SingleQuote)}stateInAttributeValueNoQuotes(e){Ua(e)||e===Ha.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(Ga.Unquoted,this.index),this.state=M.BeforeAttributeName,this.stateBeforeAttributeName(e)):this.decodeEntities&&e===Ha.Amp&&this.startEntity()}stateBeforeDeclaration(e){e===Ha.OpeningSquareBracket?(this.state=M.CDATASequence,this.sequenceIndex=0):this.state=e===Ha.Dash?M.BeforeComment:M.InDeclaration}stateInDeclaration(e){(e===Ha.Gt||this.fastForwardTo(Ha.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=M.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(e){(e===Ha.Gt||this.fastForwardTo(Ha.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=M.Text,this.sectionStart=this.index+1)}stateBeforeComment(e){e===Ha.Dash?(this.state=M.InCommentLike,this.currentSequence=Ka.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=M.InDeclaration}stateInSpecialComment(e){(e===Ha.Gt||this.fastForwardTo(Ha.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=M.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(e){let t=e|32;t===Ka.ScriptEnd[3]?this.startSpecial(Ka.ScriptEnd,4):t===Ka.StyleEnd[3]?this.startSpecial(Ka.StyleEnd,4):(this.state=M.InTagName,this.stateInTagName(e))}stateBeforeSpecialT(e){switch(e|32){case Ka.TitleEnd[3]:this.startSpecial(Ka.TitleEnd,4);break;case Ka.TextareaEnd[3]:this.startSpecial(Ka.TextareaEnd,4);break;case Ka.XmpEnd[3]:this.startSpecial(Ka.XmpEnd,4);break;default:this.state=M.InTagName,this.stateInTagName(e)}}startEntity(){this.baseState=this.state,this.state=M.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?Va.Strict:this.baseState===M.Text||this.baseState===M.InSpecialTag?Va.Legacy:Va.Attribute)}stateInEntity(){let e=this.index-this.offset,t=this.entityDecoder.write(this.buffer,e);if(t>=0)this.state=this.baseState,t===0&&--this.index;else{if(e<this.buffer.length&&this.buffer.charCodeAt(e)===Ha.Amp){this.state=this.baseState,--this.index;return}this.index=this.offset+this.buffer.length-1}}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===M.Text||this.state===M.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===M.InAttributeValueDq||this.state===M.InAttributeValueSq||this.state===M.InAttributeValueNq)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){let e=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case M.Text:this.stateText(e);break;case M.SpecialStartSequence:this.stateSpecialStartSequence(e);break;case M.InSpecialTag:this.stateInSpecialTag(e);break;case M.CDATASequence:this.stateCDATASequence(e);break;case M.InAttributeValueDq:this.stateInAttributeValueDoubleQuotes(e);break;case M.InAttributeName:this.stateInAttributeName(e);break;case M.InCommentLike:this.stateInCommentLike(e);break;case M.InSpecialComment:this.stateInSpecialComment(e);break;case M.BeforeAttributeName:this.stateBeforeAttributeName(e);break;case M.InTagName:this.stateInTagName(e);break;case M.InClosingTagName:this.stateInClosingTagName(e);break;case M.BeforeTagName:this.stateBeforeTagName(e);break;case M.AfterAttributeName:this.stateAfterAttributeName(e);break;case M.InAttributeValueSq:this.stateInAttributeValueSingleQuotes(e);break;case M.BeforeAttributeValue:this.stateBeforeAttributeValue(e);break;case M.BeforeClosingTagName:this.stateBeforeClosingTagName(e);break;case M.AfterClosingTagName:this.stateAfterClosingTagName(e);break;case M.BeforeSpecialS:this.stateBeforeSpecialS(e);break;case M.BeforeSpecialT:this.stateBeforeSpecialT(e);break;case M.InAttributeValueNq:this.stateInAttributeValueNoQuotes(e);break;case M.InSelfClosingTag:this.stateInSelfClosingTag(e);break;case M.InDeclaration:this.stateInDeclaration(e);break;case M.BeforeDeclaration:this.stateBeforeDeclaration(e);break;case M.BeforeComment:this.stateBeforeComment(e);break;case M.InProcessingInstruction:this.stateInProcessingInstruction(e);break;case M.InEntity:this.stateInEntity()}this.index++}this.cleanup()}finish(){this.state===M.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){let e=this.buffer.length+this.offset;this.sectionStart>=e||(this.state===M.InCommentLike?this.currentSequence===Ka.CdataEnd?this.cbs.oncdata(this.sectionStart,e,0):this.cbs.oncomment(this.sectionStart,e,0):this.state===M.InTagName||this.state===M.BeforeAttributeName||this.state===M.BeforeAttributeValue||this.state===M.AfterAttributeName||this.state===M.InAttributeName||this.state===M.InAttributeValueSq||this.state===M.InAttributeValueDq||this.state===M.InAttributeValueNq||this.state===M.InClosingTagName||this.cbs.ontext(this.sectionStart,e))}emitCodePoint(e,t){this.baseState!==M.Text&&this.baseState!==M.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+t,this.index=this.sectionStart-1,this.cbs.onattribentity(e)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+t,this.index=this.sectionStart-1,this.cbs.ontextentity(e,this.sectionStart))}};const Ja=/* @__PURE__ */ new Set([`input`,`option`,`optgroup`,`select`,`button`,`datalist`,`textarea`]),Ya=/* @__PURE__ */ new Set([`p`]),Xa=/* @__PURE__ */ new Set([`thead`,`tbody`]),Za=/* @__PURE__ */ new Set([`dd`,`dt`]),Qa=/* @__PURE__ */ new Set([`rt`,`rp`]),Xre=/* @__PURE__ */ new Map([[`tr`,/* @__PURE__ */ new Set([`tr`,`th`,`td`])],[`th`,/* @__PURE__ */ new Set([`th`])],[`td`,/* @__PURE__ */ new Set([`thead`,`th`,`td`])],[`body`,/* @__PURE__ */ new Set([`head`,`link`,`script`])],[`li`,/* @__PURE__ */ new Set([`li`])],[`p`,Ya],[`h1`,Ya],[`h2`,Ya],[`h3`,Ya],[`h4`,Ya],[`h5`,Ya],[`h6`,Ya],[`select`,Ja],[`input`,Ja],[`output`,Ja],[`button`,Ja],[`datalist`,Ja],[`textarea`,Ja],[`option`,/* @__PURE__ */ new Set([`option`])],[`optgroup`,/* @__PURE__ */ new Set([`optgroup`,`option`])],[`dd`,Za],[`dt`,Za],[`address`,Ya],[`article`,Ya],[`aside`,Ya],[`blockquote`,Ya],[`details`,Ya],[`div`,Ya],[`dl`,Ya],[`fieldset`,Ya],[`figcaption`,Ya],[`figure`,Ya],[`footer`,Ya],[`form`,Ya],[`header`,Ya],[`hr`,Ya],[`main`,Ya],[`nav`,Ya],[`ol`,Ya],[`pre`,Ya],[`section`,Ya],[`table`,Ya],[`ul`,Ya],[`rt`,Qa],[`rp`,Qa],[`tbody`,Xa],[`tfoot`,Xa]]),Zre=/* @__PURE__ */ new Set([`area`,`base`,`basefont`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`img`,`input`,`isindex`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),$a=/* @__PURE__ */ new Set([`math`,`svg`]),eo=/* @__PURE__ */ new Set([`mi`,`mo`,`mn`,`ms`,`mtext`,`annotation-xml`,`foreignobject`,`desc`,`title`]),Qre=/\s|\//;var to=class{constructor(e,t={}){var n,r;this.options=t,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname=``,this.attribname=``,this.attribvalue=``,this.attribs=null,this.stack=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=e??{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=t.lowerCaseTags??this.htmlMode,this.lowerCaseAttributeNames=t.lowerCaseAttributeNames??this.htmlMode,this.recognizeSelfClosing=t.recognizeSelfClosing??!this.htmlMode,this.tokenizer=new(t.Tokenizer??qa)(this.options,this),this.foreignContext=[!this.htmlMode],(r=(n=this.cbs).onparserinit)==null||r.call(n,this)}ontext(e,t){var n,r;let i=this.getSlice(e,t);this.endIndex=t-1,(r=(n=this.cbs).ontext)==null||r.call(n,i),this.startIndex=t}ontextentity(e,t){var n,r;this.endIndex=t-1,(r=(n=this.cbs).ontext)==null||r.call(n,Fa(e)),this.startIndex=t}isVoidElement(e){return this.htmlMode&&Zre.has(e)}onopentagname(e,t){this.endIndex=t;let n=this.getSlice(e,t);this.lowerCaseTagNames&&(n=n.toLowerCase()),this.emitOpenTag(n)}emitOpenTag(e){var t,n,r,i;this.openTagStart=this.startIndex,this.tagname=e;let a=this.htmlMode&&Xre.get(e);if(a)for(;this.stack.length>0&&a.has(this.stack[0]);){let e=this.stack.shift();(n=(t=this.cbs).onclosetag)==null||n.call(t,e,!0)}this.isVoidElement(e)||(this.stack.unshift(e),this.htmlMode&&($a.has(e)?this.foreignContext.unshift(!0):eo.has(e)&&this.foreignContext.unshift(!1))),(i=(r=this.cbs).onopentagname)==null||i.call(r,e),this.cbs.onopentag&&(this.attribs={})}endOpenTag(e){var t,n;this.startIndex=this.openTagStart,this.attribs&&=((n=(t=this.cbs).onopentag)==null||n.call(t,this.tagname,this.attribs,e),null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=``}onopentagend(e){this.endIndex=e,this.endOpenTag(!1),this.startIndex=e+1}onclosetag(e,t){var n,r,i,a,o,s,c,l;this.endIndex=t;let u=this.getSlice(e,t);if(this.lowerCaseTagNames&&(u=u.toLowerCase()),this.htmlMode&&($a.has(u)||eo.has(u))&&this.foreignContext.shift(),this.isVoidElement(u))this.htmlMode&&u===`br`&&((a=(i=this.cbs).onopentagname)==null||a.call(i,`br`),(s=(o=this.cbs).onopentag)==null||s.call(o,`br`,{},!0),(l=(c=this.cbs).onclosetag)==null||l.call(c,`br`,!1));else{let e=this.stack.indexOf(u);if(e!==-1)for(let t=0;t<=e;t++){let i=this.stack.shift();(r=(n=this.cbs).onclosetag)==null||r.call(n,i,t!==e)}else this.htmlMode&&u===`p`&&(this.emitOpenTag(`p`),this.closeCurrentTag(!0))}this.startIndex=t+1}onselfclosingtag(e){this.endIndex=e,this.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=e+1):this.onopentagend(e)}closeCurrentTag(e){var t,n;let r=this.tagname;this.endOpenTag(e),this.stack[0]===r&&((n=(t=this.cbs).onclosetag)==null||n.call(t,r,!e),this.stack.shift())}onattribname(e,t){this.startIndex=e;let n=this.getSlice(e,t);this.attribname=this.lowerCaseAttributeNames?n.toLowerCase():n}onattribdata(e,t){this.attribvalue+=this.getSlice(e,t)}onattribentity(e){this.attribvalue+=Fa(e)}onattribend(e,t){var n,r;this.endIndex=t,(r=(n=this.cbs).onattribute)==null||r.call(n,this.attribname,this.attribvalue,e===Ga.Double?`"`:e===Ga.Single?`'`:e===Ga.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=``}getInstructionName(e){let t=e.search(Qre),n=t<0?e:e.substr(0,t);return this.lowerCaseTagNames&&(n=n.toLowerCase()),n}ondeclaration(e,t){this.endIndex=t;let n=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){let e=this.getInstructionName(n);this.cbs.onprocessinginstruction(`!${e}`,`!${n}`)}this.startIndex=t+1}onprocessinginstruction(e,t){this.endIndex=t;let n=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){let e=this.getInstructionName(n);this.cbs.onprocessinginstruction(`?${e}`,`?${n}`)}this.startIndex=t+1}oncomment(e,t,n){var r,i,a,o;this.endIndex=t,(i=(r=this.cbs).oncomment)==null||i.call(r,this.getSlice(e,t-n)),(o=(a=this.cbs).oncommentend)==null||o.call(a),this.startIndex=t+1}oncdata(e,t,n){var r,i,a,o,s,c,l,u,d,f;this.endIndex=t;let p=this.getSlice(e,t-n);!this.htmlMode||this.options.recognizeCDATA?((i=(r=this.cbs).oncdatastart)==null||i.call(r),(o=(a=this.cbs).ontext)==null||o.call(a,p),(c=(s=this.cbs).oncdataend)==null||c.call(s)):((u=(l=this.cbs).oncomment)==null||u.call(l,`[CDATA[${p}]]`),(f=(d=this.cbs).oncommentend)==null||f.call(d)),this.startIndex=t+1}onend(){var e,t;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let e=0;e<this.stack.length;e++)this.cbs.onclosetag(this.stack[e],!0)}(t=(e=this.cbs).onend)==null||t.call(e)}reset(){var e,t,n,r;(t=(e=this.cbs).onreset)==null||t.call(e),this.tokenizer.reset(),this.tagname=``,this.attribname=``,this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(r=(n=this.cbs).onparserinit)==null||r.call(n,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(e){this.reset(),this.end(e)}getSlice(e,t){for(;e-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let n=this.buffers[0].slice(e-this.bufferOffset,t-this.bufferOffset);for(;t-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),n+=this.buffers[0].slice(0,t-this.bufferOffset);return n}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(e){var t,n;this.ended?(n=(t=this.cbs).onerror)==null||n.call(t,/* @__PURE__ */ Error(`.write() after done!`)):(this.buffers.push(e),this.tokenizer.running&&(this.tokenizer.write(e),this.writeIndex++))}end(e){var t,n;this.ended?(n=(t=this.cbs).onerror)==null||n.call(t,/* @__PURE__ */ Error(`.end() after done!`)):(e&&this.write(e),this.ended=!0,this.tokenizer.end())}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(e){this.write(e)}done(e){this.end(e)}},$re=/* @__PURE__ */ s({CDATA:()=>fo,Comment:()=>so,Directive:()=>oo,Doctype:()=>po,ElementType:()=>no,Root:()=>io,Script:()=>co,Style:()=>lo,Tag:()=>uo,Text:()=>ao,isTag:()=>ro}),no;(function(e){e.Root=`root`,e.Text=`text`,e.Directive=`directive`,e.Comment=`comment`,e.Script=`script`,e.Style=`style`,e.Tag=`tag`,e.CDATA=`cdata`,e.Doctype=`doctype`})(no||={});function ro(e){return e.type===no.Tag||e.type===no.Script||e.type===no.Style}const io=no.Root,ao=no.Text,oo=no.Directive,so=no.Comment,co=no.Script,lo=no.Style,uo=no.Tag,fo=no.CDATA,po=no.Doctype;var mo=class{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(e){this.parent=e}get previousSibling(){return this.prev}set previousSibling(e){this.prev=e}get nextSibling(){return this.next}set nextSibling(e){this.next=e}cloneNode(e=!1){return ko(this,e)}},ho=class extends mo{constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},go=class extends ho{constructor(){super(...arguments),this.type=no.Text}get nodeType(){return 3}},_o=class extends ho{constructor(){super(...arguments),this.type=no.Comment}get nodeType(){return 8}},vo=class extends ho{constructor(e,t){super(t),this.name=e,this.type=no.Directive}get nodeType(){return 1}},yo=class extends mo{constructor(e){super(),this.children=e}get firstChild(){return this.children[0]??null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(e){this.children=e}},bo=class extends yo{constructor(){super(...arguments),this.type=no.CDATA}get nodeType(){return 4}},xo=class extends yo{constructor(){super(...arguments),this.type=no.Root}get nodeType(){return 9}},So=class extends yo{constructor(e,t,n=[],r=e===`script`?no.Script:e===`style`?no.Style:no.Tag){super(n),this.name=e,this.attribs=t,this.type=r}get nodeType(){return 1}get tagName(){return this.name}set tagName(e){this.name=e}get attributes(){return Object.keys(this.attribs).map(e=>({name:e,value:this.attribs[e],namespace:this[`x-attribsNamespace`]?.[e],prefix:this[`x-attribsPrefix`]?.[e]}))}};function Co(e){return ro(e)}function wo(e){return e.type===no.CDATA}function To(e){return e.type===no.Text}function Eo(e){return e.type===no.Comment}function eie(e){return e.type===no.Directive}function Do(e){return e.type===no.Root}function Oo(e){return Object.prototype.hasOwnProperty.call(e,`children`)}function ko(e,t=!1){let n;if(To(e))n=new go(e.data);else if(Eo(e))n=new _o(e.data);else if(Co(e)){let r=t?Ao(e.children):[],i=new So(e.name,{...e.attribs},r);r.forEach(e=>e.parent=i),e.namespace!=null&&(i.namespace=e.namespace),e[`x-attribsNamespace`]&&(i[`x-attribsNamespace`]={...e[`x-attribsNamespace`]}),e[`x-attribsPrefix`]&&(i[`x-attribsPrefix`]={...e[`x-attribsPrefix`]}),n=i}else if(wo(e)){let r=t?Ao(e.children):[],i=new bo(r);r.forEach(e=>e.parent=i),n=i}else if(Do(e)){let r=t?Ao(e.children):[],i=new xo(r);r.forEach(e=>e.parent=i),e[`x-mode`]&&(i[`x-mode`]=e[`x-mode`]),n=i}else if(eie(e)){let t=new vo(e.name,e.data);e[`x-name`]!=null&&(t[`x-name`]=e[`x-name`],t[`x-publicId`]=e[`x-publicId`],t[`x-systemId`]=e[`x-systemId`]),n=t}else throw Error(`Not implemented yet: ${e.type}`);return n.startIndex=e.startIndex,n.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(n.sourceCodeLocation=e.sourceCodeLocation),n}function Ao(e){let t=e.map(e=>ko(e,!0));for(let e=1;e<t.length;e++)t[e].prev=t[e-1],t[e-1].next=t[e];return t}const jo={withStartIndices:!1,withEndIndices:!1,xmlMode:!1};var Mo=class{constructor(e,t,n){this.dom=[],this.root=new xo(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof t==`function`&&(n=t,t=jo),typeof e==`object`&&(t=e,e=void 0),this.callback=e??null,this.options=t??jo,this.elementCB=n??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new xo(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(e){this.handleCallback(e)}onclosetag(){this.lastNode=null;let e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)}onopentag(e,t){let n=new So(e,t,void 0,this.options.xmlMode?no.Tag:void 0);this.addNode(n),this.tagStack.push(n)}ontext(e){let{lastNode:t}=this;if(t&&t.type===no.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{let t=new go(e);this.addNode(t),this.lastNode=t}}oncomment(e){if(this.lastNode&&this.lastNode.type===no.Comment){this.lastNode.data+=e;return}let t=new _o(e);this.addNode(t),this.lastNode=t}oncommentend(){this.lastNode=null}oncdatastart(){let e=new go(``),t=new bo([e]);this.addNode(t),e.parent=t,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,t){let n=new vo(e,t);this.addNode(n)}handleCallback(e){if(typeof this.callback==`function`)this.callback(e,this.dom);else if(e)throw e}addNode(e){let t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null}};const No=/["&'<>$\x80-\uFFFF]/g,tie=/* @__PURE__ */ new Map([[34,`&quot;`],[38,`&amp;`],[39,`&apos;`],[60,`&lt;`],[62,`&gt;`]]),nie=String.prototype.codePointAt==null?(e,t)=>(e.charCodeAt(t)&64512)==55296?(e.charCodeAt(t)-55296)*1024+e.charCodeAt(t+1)-56320+65536:e.charCodeAt(t):(e,t)=>e.codePointAt(t);function Po(e){let t=``,n=0,r;for(;(r=No.exec(e))!==null;){let i=r.index,a=e.charCodeAt(i),o=tie.get(a);o===void 0?(t+=`${e.substring(n,i)}&#x${nie(e,i).toString(16)};`,n=No.lastIndex+=Number((a&64512)==55296)):(t+=e.substring(n,i)+o,n=i+1)}return t+e.substr(n)}function Fo(e,t){return function(n){let r,i=0,a=``;for(;r=e.exec(n);)i!==r.index&&(a+=n.substring(i,r.index)),a+=t.get(r[0].charCodeAt(0)),i=r.index+1;return a+n.substring(i)}}const rie=Fo(/["&\u00A0]/g,/* @__PURE__ */ new Map([[34,`&quot;`],[38,`&amp;`],[160,`&nbsp;`]])),iie=Fo(/[&<>\u00A0]/g,/* @__PURE__ */ new Map([[38,`&amp;`],[60,`&lt;`],[62,`&gt;`],[160,`&nbsp;`]])),aie=new Map((/* @__PURE__ */ `altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`)).map(e=>[e.toLowerCase(),e])),oie=new Map((/* @__PURE__ */ `definitionURL.attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`)).map(e=>[e.toLowerCase(),e])),sie=/* @__PURE__ */ new Set([`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`]);function cie(e){return e.replace(/"/g,`&quot;`)}function lie(e,t){if(!e)return;let n=(t.encodeEntities??t.decodeEntities)===!1?cie:t.xmlMode||t.encodeEntities!==`utf8`?Po:rie;return Object.keys(e).map(r=>{let i=e[r]??``;return t.xmlMode===`foreign`&&(r=oie.get(r)??r),!t.emptyAttrs&&!t.xmlMode&&i===``?r:`${r}="${n(i)}"`}).join(` `)}const Io=/* @__PURE__ */ new Set([`area`,`base`,`basefont`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`img`,`input`,`isindex`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function Lo(e,t={}){let n=`length`in e?e:[e],r=``;for(let e=0;e<n.length;e++)r+=uie(n[e],t);return r}function uie(e,t){switch(e.type){case io:return Lo(e.children,t);case po:case oo:return mie(e);case so:return _ie(e);case fo:return gie(e);case co:case lo:case uo:return pie(e,t);case ao:return hie(e,t)}}const die=/* @__PURE__ */ new Set([`mi`,`mo`,`mn`,`ms`,`mtext`,`annotation-xml`,`foreignObject`,`desc`,`title`]),fie=/* @__PURE__ */ new Set([`svg`,`math`]);function pie(e,t){t.xmlMode===`foreign`&&(e.name=aie.get(e.name)??e.name,e.parent&&die.has(e.parent.name)&&(t={...t,xmlMode:!1})),!t.xmlMode&&fie.has(e.name)&&(t={...t,xmlMode:`foreign`});let n=`<${e.name}`,r=lie(e.attribs,t);return r&&(n+=` ${r}`),e.children.length===0&&(t.xmlMode?t.selfClosingTags!==!1:t.selfClosingTags&&Io.has(e.name))?(t.xmlMode||(n+=` `),n+=`/>`):(n+=`>`,e.children.length>0&&(n+=Lo(e.children,t)),(t.xmlMode||!Io.has(e.name))&&(n+=`</${e.name}>`)),n}function mie(e){return`<${e.data}>`}function hie(e,t){let n=e.data||``;return(t.encodeEntities??t.decodeEntities)!==!1&&!(!t.xmlMode&&e.parent&&sie.has(e.parent.name))&&(n=t.xmlMode||t.encodeEntities!==`utf8`?Po(n):iie(n)),n}function gie(e){return`<![CDATA[${e.children[0].data}]]>`}function _ie(e){return`<!--${e.data}-->`}function Ro(e,t){return Lo(e,t)}function vie(e,t){return Oo(e)?e.children.map(e=>Ro(e,t)).join(``):``}function zo(e){return Array.isArray(e)?e.map(zo).join(``):Co(e)?e.name===`br`?`
544
517
  `:zo(e.children):wo(e)?zo(e.children):To(e)?e.data:``}function Bo(e){return Array.isArray(e)?e.map(Bo).join(``):Oo(e)&&!Eo(e)?Bo(e.children):To(e)?e.data:``}function Vo(e){return Array.isArray(e)?e.map(Vo).join(``):Oo(e)&&(e.type===no.Tag||wo(e))?Vo(e.children):To(e)?e.data:``}function Ho(e){return Oo(e)?e.children:[]}function Uo(e){return e.parent||null}function yie(e){let t=Uo(e);if(t!=null)return Ho(t);let n=[e],{prev:r,next:i}=e;for(;r!=null;)n.unshift(r),{prev:r}=r;for(;i!=null;)n.push(i),{next:i}=i;return n}function bie(e,t){return e.attribs?.[t]}function xie(e,t){return e.attribs!=null&&Object.prototype.hasOwnProperty.call(e.attribs,t)&&e.attribs[t]!=null}function Sie(e){return e.name}function Cie(e){let{next:t}=e;for(;t!==null&&!Co(t);)({next:t}=t);return t}function wie(e){let{prev:t}=e;for(;t!==null&&!Co(t);)({prev:t}=t);return t}function Wo(e){if(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.parent){let t=e.parent.children,n=t.lastIndexOf(e);n>=0&&t.splice(n,1)}e.next=null,e.prev=null,e.parent=null}function Tie(e,t){let n=t.prev=e.prev;n&&(n.next=t);let r=t.next=e.next;r&&(r.prev=t);let i=t.parent=e.parent;if(i){let n=i.children;n[n.lastIndexOf(e)]=t,e.parent=null}}function Eie(e,t){if(Wo(t),t.next=null,t.parent=e,e.children.push(t)>1){let n=e.children[e.children.length-2];n.next=t,t.prev=n}else t.prev=null}function Die(e,t){Wo(t);let{parent:n}=e,r=e.next;if(t.next=r,t.prev=e,e.next=t,t.parent=n,r){if(r.prev=t,n){let e=n.children;e.splice(e.lastIndexOf(r),0,t)}}else n&&n.children.push(t)}function Oie(e,t){if(Wo(t),t.parent=e,t.prev=null,e.children.unshift(t)!==1){let n=e.children[1];n.prev=t,t.next=n}else t.next=null}function kie(e,t){Wo(t);let{parent:n}=e;if(n){let r=n.children;r.splice(r.indexOf(e),0,t)}e.prev&&(e.prev.next=t),t.parent=n,t.prev=e.prev,t.next=e,e.prev=t}function Go(e,t,n=!0,r=1/0){return Ko(e,Array.isArray(t)?t:[t],n,r)}function Ko(e,t,n,r){let i=[],a=[Array.isArray(t)?t:[t]],o=[0];for(;;){if(o[0]>=a[0].length){if(o.length===1)return i;a.shift(),o.shift();continue}let t=a[0][o[0]++];if(e(t)&&(i.push(t),--r<=0))return i;n&&Oo(t)&&t.children.length>0&&(o.unshift(0),a.unshift(t.children))}}function Aie(e,t){return t.find(e)}function qo(e,t,n=!0){let r=Array.isArray(t)?t:[t];for(let t=0;t<r.length;t++){let i=r[t];if(Co(i)&&e(i))return i;if(n&&Oo(i)&&i.children.length>0){let t=qo(e,i.children,!0);if(t)return t}}return null}function Jo(e,t){return(Array.isArray(t)?t:[t]).some(t=>Co(t)&&e(t)||Oo(t)&&Jo(e,t.children))}function jie(e,t){let n=[],r=[Array.isArray(t)?t:[t]],i=[0];for(;;){if(i[0]>=r[0].length){if(r.length===1)return n;r.shift(),i.shift();continue}let t=r[0][i[0]++];Co(t)&&e(t)&&n.push(t),Oo(t)&&t.children.length>0&&(i.unshift(0),r.unshift(t.children))}}const Yo={tag_name(e){return typeof e==`function`?t=>Co(t)&&e(t.name):e===`*`?Co:t=>Co(t)&&t.name===e},tag_type(e){return typeof e==`function`?t=>e(t.type):t=>t.type===e},tag_contains(e){return typeof e==`function`?t=>To(t)&&e(t.data):t=>To(t)&&t.data===e}};function Xo(e,t){return typeof t==`function`?n=>Co(n)&&t(n.attribs[e]):n=>Co(n)&&n.attribs[e]===t}function Mie(e,t){return n=>e(n)||t(n)}function Zo(e){let t=Object.keys(e).map(t=>{let n=e[t];return Object.prototype.hasOwnProperty.call(Yo,t)?Yo[t](n):Xo(t,n)});return t.length===0?null:t.reduce(Mie)}function Nie(e,t){let n=Zo(e);return!n||n(t)}function Pie(e,t,n,r=1/0){let i=Zo(e);return i?Go(i,t,n,r):[]}function Fie(e,t,n=!0){return Array.isArray(t)||(t=[t]),qo(Xo(`id`,e),t,n)}function Qo(e,t,n=!0,r=1/0){return Go(Yo.tag_name(e),t,n,r)}function Iie(e,t,n=!0,r=1/0){return Go(Xo(`class`,e),t,n,r)}function Lie(e,t,n=!0,r=1/0){return Go(Yo.tag_type(e),t,n,r)}function Rie(e){let t=e.length;for(;--t>=0;){let n=e[t];if(t>0&&e.lastIndexOf(n,t-1)>=0)e.splice(t,1);else for(let r=n.parent;r;r=r.parent)if(e.includes(r)){e.splice(t,1);break}}return e}var $o;(function(e){e[e.DISCONNECTED=1]=`DISCONNECTED`,e[e.PRECEDING=2]=`PRECEDING`,e[e.FOLLOWING=4]=`FOLLOWING`,e[e.CONTAINS=8]=`CONTAINS`,e[e.CONTAINED_BY=16]=`CONTAINED_BY`})($o||={});function es(e,t){let n=[],r=[];if(e===t)return 0;let i=Oo(e)?e:e.parent;for(;i;)n.unshift(i),i=i.parent;for(i=Oo(t)?t:t.parent;i;)r.unshift(i),i=i.parent;let a=Math.min(n.length,r.length),o=0;for(;o<a&&n[o]===r[o];)o++;if(o===0)return $o.DISCONNECTED;let s=n[o-1],c=s.children,l=n[o],u=r[o];return c.indexOf(l)>c.indexOf(u)?s===t?$o.FOLLOWING|$o.CONTAINED_BY:$o.FOLLOWING:s===e?$o.PRECEDING|$o.CONTAINS:$o.PRECEDING}function zie(e){return e=e.filter((e,t,n)=>!n.includes(e,t+1)),e.sort((e,t)=>{let n=es(e,t);return n&$o.PRECEDING?-1:n&$o.FOLLOWING?1:0}),e}function ts(e){let t=rs(Wie,e);return t?t.name===`feed`?Bie(t):Vie(t):null}function Bie(e){let t=e.children,n={type:`atom`,items:Qo(`entry`,t).map(e=>{let{children:t}=e,n={media:ns(t)};as(n,`id`,`id`,t),as(n,`title`,`title`,t);let r=rs(`link`,t)?.attribs.href;r&&(n.link=r);let i=is(`summary`,t)||is(`content`,t);i&&(n.description=i);let a=is(`updated`,t);return a&&(n.pubDate=new Date(a)),n})};as(n,`id`,`id`,t),as(n,`title`,`title`,t);let r=rs(`link`,t)?.attribs.href;r&&(n.link=r),as(n,`description`,`subtitle`,t);let i=is(`updated`,t);return i&&(n.updated=new Date(i)),as(n,`author`,`email`,t,!0),n}function Vie(e){let t=rs(`channel`,e.children)?.children??[],n={type:e.name.substr(0,3),id:``,items:Qo(`item`,e.children).map(e=>{let{children:t}=e,n={media:ns(t)};as(n,`id`,`guid`,t),as(n,`title`,`title`,t),as(n,`link`,`link`,t),as(n,`description`,`description`,t);let r=is(`pubDate`,t)||is(`dc:date`,t);return r&&(n.pubDate=new Date(r)),n})};as(n,`title`,`title`,t),as(n,`link`,`link`,t),as(n,`description`,`description`,t);let r=is(`lastBuildDate`,t);return r&&(n.updated=new Date(r)),as(n,`author`,`managingEditor`,t,!0),n}const Hie=[`url`,`type`,`lang`],Uie=[`fileSize`,`bitrate`,`framerate`,`samplingrate`,`channels`,`duration`,`height`,`width`];function ns(e){return Qo(`media:content`,e).map(e=>{let{attribs:t}=e,n={medium:t.medium,isDefault:!!t.isDefault};for(let e of Hie)t[e]&&(n[e]=t[e]);for(let e of Uie)t[e]&&(n[e]=parseInt(t[e],10));return t.expression&&(n.expression=t.expression),n})}function rs(e,t){return Qo(e,t,!0,1)[0]}function is(e,t,n=!1){return Bo(Qo(e,t,n,1)).trim()}function as(e,t,n,r,i=!1){let a=is(n,r,i);a&&(e[t]=a)}function Wie(e){return e===`rss`||e===`feed`||e===`rdf:RDF`}var Gie=/* @__PURE__ */ s({DocumentPosition:()=>$o,append:()=>Die,appendChild:()=>Eie,compareDocumentPosition:()=>es,existsOne:()=>Jo,filter:()=>Go,find:()=>Ko,findAll:()=>jie,findOne:()=>qo,findOneChild:()=>Aie,getAttributeValue:()=>bie,getChildren:()=>Ho,getElementById:()=>Fie,getElements:()=>Pie,getElementsByClassName:()=>Iie,getElementsByTagName:()=>Qo,getElementsByTagType:()=>Lie,getFeed:()=>ts,getInnerHTML:()=>vie,getName:()=>Sie,getOuterHTML:()=>Ro,getParent:()=>Uo,getSiblings:()=>yie,getText:()=>zo,hasAttrib:()=>xie,hasChildren:()=>Oo,innerText:()=>Vo,isCDATA:()=>wo,isComment:()=>Eo,isDocument:()=>Do,isTag:()=>Co,isText:()=>To,nextElementSibling:()=>Cie,prepend:()=>kie,prependChild:()=>Oie,prevElementSibling:()=>wie,removeElement:()=>Wo,removeSubsets:()=>Rie,replaceElement:()=>Tie,testElement:()=>Nie,textContent:()=>Bo,uniqueSort:()=>zie}),Kie=/* @__PURE__ */ s({DefaultHandler:()=>Mo,DomHandler:()=>Mo,DomUtils:()=>Gie,ElementType:()=>$re,Parser:()=>to,QuoteType:()=>Ga,Tokenizer:()=>qa,createDocumentStream:()=>qie,createDomStream:()=>Jie,getFeed:()=>ts,parseDOM:()=>ss,parseDocument:()=>os,parseFeed:()=>Xie});function os(e,t){let n=new Mo(void 0,t);return new to(n,t).end(e),n.root}function ss(e,t){return os(e,t).children}function qie(e,t,n){let r=new Mo(t=>e(t,r.root),t,n);return new to(r,t)}function Jie(e,t,n){return new to(new Mo(e,t,n),t)}const Yie={xmlMode:!0};function Xie(e,t=Yie){return ts(ss(e,t))}const Zie=/* @__PURE__ */ new Set(/* @__PURE__ */ `ARTICLE.ASIDE.BLOCKQUOTE.BODY.BR.BUTTON.CANVAS.CAPTION.COL.COLGROUP.DD.DIV.DL.DT.EMBED.FIELDSET.FIGCAPTION.FIGURE.FOOTER.FORM.H1.H2.H3.H4.H5.H6.LI.UL.OL.P`.split(`.`)),cs=`http://www.w3.org/2000/svg`,{assign:Qie,create:$ie,defineProperties:eae,entries:tae,getOwnPropertyDescriptors:nae,keys:rae,setPrototypeOf:ls}=Object,us=String,ds=e=>e.nodeType===1?e[xa]:e,fs=({ownerDocument:e})=>e[Ta].ignoreCase,ps=(e,t)=>{e[j]=t,t[Oa]=e},ms=(e,t,n)=>{ps(e,t),ps(ds(t),n)},hs=(e,t,n,r)=>{ps(e,t),ps(ds(n),r)},gs=(e,t,n)=>{ps(e,t),ps(t,n)},_s=({localName:e,ownerDocument:t})=>t[Ta].ignoreCase?e.toUpperCase():e,vs=(e,t)=>{e&&(e[j]=t),t&&(t[Oa]=e)},ys=(e,t)=>{let n=e.createDocumentFragment(),r=e.createElement(``);r.innerHTML=t;let{firstChild:i,lastChild:a}=r;if(i){hs(n,i,a,n[xa]);let e=i;do e.parentNode=n;while(e!==a&&(e=ds(e)[j]))}return n},bs=/* @__PURE__ */ new WeakMap;let xs=!1;const Ss=/* @__PURE__ */ new WeakMap,Cs=/* @__PURE__ */ new WeakMap,ws=(e,t,n,r)=>{xs&&Cs.has(e)&&e.attributeChangedCallback&&e.constructor.observedAttributes.includes(t)&&e.attributeChangedCallback(t,n,r)},Ts=(e,t)=>n=>{if(Cs.has(n)){let r=Cs.get(n);r.connected!==t&&n.isConnected===t&&(r.connected=t,e in n&&n[e]())}},Es=Ts(`connectedCallback`,!0),Ds=e=>{if(xs){Es(e),bs.has(e)&&(e=bs.get(e).shadowRoot);let{[j]:t,[xa]:n}=e;for(;t!==n;)t.nodeType===1&&Es(t),t=t[j]}},Os=Ts(`disconnectedCallback`,!1),iae=e=>{if(xs){Os(e),bs.has(e)&&(e=bs.get(e).shadowRoot);let{[j]:t,[xa]:n}=e;for(;t!==n;)t.nodeType===1&&Os(t),t=t[j]}};var aae=class{constructor(e){this.ownerDocument=e,this.registry=/* @__PURE__ */ new Map,this.waiting=/* @__PURE__ */ new Map,this.active=!1}define(e,t,n={}){let{ownerDocument:r,registry:i,waiting:a}=this;if(i.has(e))throw Error(`unable to redefine `+e);if(Ss.has(t))throw Error(`unable to redefine the same class: `+t);this.active=xs=!0;let{extends:o}=n;Ss.set(t,{ownerDocument:r,options:{is:o?e:``},localName:o||e});let s=o?t=>t.localName===o&&t.getAttribute(`is`)===e:t=>t.localName===e;if(i.set(e,{Class:t,check:s}),a.has(e)){for(let n of a.get(e))n(t);a.delete(e)}r.querySelectorAll(o?`${o}[is="${e}"]`:e).forEach(this.upgrade,this)}upgrade(e){if(Cs.has(e))return;let{ownerDocument:t,registry:n}=this,r=e.getAttribute(`is`)||e.localName;if(n.has(r)){let{Class:i,check:a}=n.get(r);if(a(e)){let{attributes:n,isConnected:a}=e;for(let t of n)e.removeAttributeNode(t);let o=tae(e);for(let[t]of o)delete e[t];ls(e,i.prototype),t[Na]={element:e,values:o},new i(t,r),Cs.set(e,{connected:a});for(let t of n)e.setAttributeNode(t);a&&e.connectedCallback&&e.connectedCallback()}}}whenDefined(e){let{registry:t,waiting:n}=this;return new Promise(r=>{t.has(e)?r(t.get(e).Class):(n.has(e)||n.set(e,[]),n.get(e).push(r))})}get(e){let t=this.registry.get(e);return t&&t.Class}getName(e){if(Ss.has(e)){let{localName:t}=Ss.get(e);return t}return null}};const{Parser:oae}=Kie,ks=(e,t,n)=>{let r=e[xa];return t.parentNode=e,ms(r[Oa],t,r),n&&t.nodeType===1&&Ds(t),t},sae=(e,t,n,r,i)=>{n[Pa]=r,n.ownerElement=e,gs(t[Oa],n,t),n.name===`class`&&(e.className=r),i&&ws(e,n.name,null,r)},As=(e,t,n)=>{let{active:r,registry:i}=e[ga],a=e,o=null,s=!1,c=new oae({onprocessinginstruction(t,n){t.toLowerCase()===`!doctype`&&(e.doctype=n.slice(t.length).trim())},onopentag(n,s){let c=!0;if(t){if(o)a=ks(a,e.createElementNS(cs,n),r),a.ownerSVGElement=o,c=!1;else if(n===`svg`||n===`SVG`)o=e.createElementNS(cs,n),a=ks(a,o,r),c=!1;else if(r){let e=n.includes(`-`)?n:s.is||``;if(e&&i.has(e)){let{Class:t}=i.get(e);a=ks(a,new t,r),delete s.is,c=!1}}}c&&(a=ks(a,e.createElement(n),!1));let l=a[xa];for(let t of rae(s))sae(a,l,e.createAttribute(t),s[t],r)},oncomment(t){ks(a,e.createComment(t),r)},ontext(t){s?ks(a,e.createCDATASection(t),r):ks(a,e.createTextNode(t),r)},oncdatastart(){s=!0},oncdataend(){s=!1},onclosetag(){t&&a===o&&(o=null),a=a.parentNode}},{lowerCaseAttributeNames:!1,decodeEntities:!0,xmlMode:!t});return c.write(n),c.end(),e},js=/* @__PURE__ */ new Map,Ms=(e,t)=>{for(let n of[].concat(e))js.set(n,t),js.set(n.toUpperCase(),t)},Ns=({[j]:e,[xa]:t},n)=>{for(;e!==t;){switch(e.nodeType){case 2:Ps(e,n);break;case 3:case 8:case 4:Fs(e,n);break;case 1:Ls(e,n),e=ds(e);break;case 10:Is(e,n)}e=e[j]}let r=n.length-1,i=n[r];typeof i==`number`&&i<0?n[r]+=-1:n.push(-1)},Ps=(e,t)=>{t.push(2,e.name);let n=e[Pa].trim();n&&t.push(n)},Fs=(e,t)=>{let n=e[Pa];n.trim()&&t.push(e.nodeType,n)},cae=(e,t)=>{t.push(e.nodeType),Ns(e,t)},Is=({name:e,publicId:t,systemId:n},r)=>{r.push(10,e),t&&r.push(t),n&&r.push(n)},Ls=(e,t)=>{t.push(1,e.localName),Ns(e,t)},Rs=(e,t,n,r,i,a,o)=>({type:e,target:t,addedNodes:r,removedNodes:i,attributeName:a,oldValue:o,previousSibling:n?.previousSibling||null,nextSibling:n?.nextSibling||null}),zs=(e,t,n,r,i,a)=>{if(!r||r.includes(n)){let{callback:r,records:o,scheduled:s}=e;o.push(Rs(`attributes`,t,null,[],[],n,i?a:void 0)),s||(e.scheduled=!0,Promise.resolve().then(()=>{e.scheduled=!1,r(o.splice(0),e)}))}},Bs=(e,t,n)=>{let{ownerDocument:r}=e,{active:i,observers:a}=r[Ea];if(i){for(let i of a)for(let[a,{childList:o,subtree:s,attributes:c,attributeFilter:l,attributeOldValue:u}]of i.nodes)if(o){if(s&&(a===r||a.contains(e))||!s&&a.children.includes(e)){zs(i,e,t,l,u,n);break}}else if(c&&a===e){zs(i,e,t,l,u,n);break}}},Vs=(e,t)=>{let{ownerDocument:n}=e,{active:r,observers:i}=n[Ea];if(r){for(let r of i)for(let[i,{subtree:a,childList:o,characterData:s}]of r.nodes)if(o&&(t&&(i===t||a&&i.contains(t))||!t&&(a&&(i===n||/* c8 ignore next */i.contains(e))||!a&&i[s?`childNodes`:`children`].includes(e)))){let{callback:n,records:a,scheduled:o}=r;a.push(Rs(`childList`,i,e,t?[]:[e],t?[e]:[])),o||(r.scheduled=!0,Promise.resolve().then(()=>{r.scheduled=!1,n(a.splice(0),r)}));break}}};var lae=class{constructor(e){let t=/* @__PURE__ */ new Set;this.observers=t,this.active=!1,this.class=class{constructor(e){this.callback=e,this.nodes=/* @__PURE__ */ new Map,this.records=[],this.scheduled=!1}disconnect(){this.records.splice(0),this.nodes.clear(),t.delete(this),e[Ea].active=!!t.size}observe(n,r={subtree:!1,childList:!1,attributes:!1,attributeFilter:null,attributeOldValue:!1,characterData:!1}){(`attributeOldValue`in r||`attributeFilter`in r)&&(r.attributes=!0),r.childList=!!r.childList,r.subtree=!!r.subtree,this.nodes.set(n,r),t.add(this),e[Ea].active=!0}takeRecords(){return this.records.splice(0)}}}};const uae=/* @__PURE__ */ new Set(/* @__PURE__ */ `allowfullscreen.allowpaymentrequest.async.autofocus.autoplay.checked.class.contenteditable.controls.default.defer.disabled.draggable.formnovalidate.hidden.id.ismap.itemscope.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.selected.style.truespeed`.split(`.`)),Hs=(e,t)=>{let{[Pa]:n,name:r}=t;t.ownerElement=e,gs(e,t,e[j]),r===`class`&&(e.className=n),Bs(e,r,null),ws(e,r,null,n)},Us=(e,t)=>{let{[Pa]:n,name:r}=t;ps(t[Oa],t[j]),t.ownerElement=t[Oa]=t[j]=null,r===`class`&&(e[ha]=null),Bs(e,r,n),ws(e,r,n,null)},Ws={get(e,t){return e.hasAttribute(t)},set(e,t,n){n?e.setAttribute(t,``):e.removeAttribute(t)}},Gs={get(e,t){return parseFloat(e.getAttribute(t)||0)},set(e,t,n){e.setAttribute(t,n)}},N={get(e,t){return e.getAttribute(t)||``},set(e,t,n){e.setAttribute(t,n)}},Ks=/* @__PURE__ */ new WeakMap;function dae(e,t){return typeof t==`function`?t.call(e.target,e):t.handleEvent(e),e._stopImmediatePropagationFlag}function fae({currentTarget:e,target:t}){let n=Ks.get(e);if(n&&n.has(this.type)){let r=n.get(this.type);this.eventPhase=e===t?this.AT_TARGET:this.BUBBLING_PHASE,this.currentTarget=e,this.target=t;for(let[e,t]of r)if(t&&t.once&&r.delete(e),dae(this,e))break;return delete this.currentTarget,delete this.target,this.cancelBubble}}var qs=class{constructor(){Ks.set(this,/* @__PURE__ */ new Map)}_getParent(){return null}addEventListener(e,t,n){let r=Ks.get(this);r.has(e)||r.set(e,/* @__PURE__ */ new Map),r.get(e).set(t,n)}removeEventListener(e,t){let n=Ks.get(this);if(n.has(e)){let r=n.get(e);r.delete(t)&&!r.size&&n.delete(e)}}dispatchEvent(e){let t=this;for(e.eventPhase=e.CAPTURING_PHASE;t;)t.dispatchEvent&&e._path.push({currentTarget:t,target:this}),t=e.bubbles&&t._getParent&&t._getParent();return e._path.some(fae,e),e._path=[],e.eventPhase=e.NONE,!e.defaultPrevented}},Js=class extends Array{item(e){return e<this.length?this[e]:null}};const Ys=({parentNode:e})=>{let t=0;for(;e;)t++,e=e.parentNode;return t};var Xs=class extends qs{static get ELEMENT_NODE(){return 1}static get ATTRIBUTE_NODE(){return 2}static get TEXT_NODE(){return 3}static get CDATA_SECTION_NODE(){return 4}static get COMMENT_NODE(){return 8}static get DOCUMENT_NODE(){return 9}static get DOCUMENT_FRAGMENT_NODE(){return 11}static get DOCUMENT_TYPE_NODE(){return 10}constructor(e,t,n){super(),this.ownerDocument=e,this.localName=t,this.nodeType=n,this.parentNode=null,this[j]=null,this[Oa]=null}get ELEMENT_NODE(){return 1}get ATTRIBUTE_NODE(){return 2}get TEXT_NODE(){return 3}get CDATA_SECTION_NODE(){return 4}get COMMENT_NODE(){return 8}get DOCUMENT_NODE(){return 9}get DOCUMENT_FRAGMENT_NODE(){return 11}get DOCUMENT_TYPE_NODE(){return 10}get baseURI(){let e=this.nodeType===9?this:this.ownerDocument;if(e){let t=e.querySelector(`base`);if(t)return t.getAttribute(`href`);let{location:n}=e.defaultView;if(n)return n.href}return null}
545
518
  /* c8 ignore start */
546
519
  get isConnected(){return!1}get nodeName(){return this.localName}get parentElement(){return null}get previousSibling(){return null}get previousElementSibling(){return null}get nextSibling(){return null}get nextElementSibling(){return null}get childNodes(){return new Js}get firstChild(){return null}get lastChild(){return null}get nodeValue(){return null}set nodeValue(e){}get textContent(){return null}set textContent(e){}normalize(){}cloneNode(){return null}contains(){return!1}insertBefore(e,t){return e}appendChild(e){return e}replaceChild(e,t){return t}removeChild(e){return e}toString(){return``}
@@ -1263,4 +1236,4 @@ Results:
1263
1236
  failed a download or write failed; the local copy is as it was
1264
1237
 
1265
1238
  Local comments.json, marks/ and dotfiles are kept. A document gets the published comments only when it has no comments.json.`,options:{artifact:{type:`string`,value:`<type>/<id>`,help:`Pull only the Cloud copy this local artifact is bound to`},project:{type:`string`,value:`<owner/repo>`,help:`Pull another project’s artifacts; they keep publishing under it`},as:{type:`string`,value:`<id>`,help:`With one target: the local id to pull it under`},"dry-run":{type:`boolean`,help:`Report what each artifact would do; write nothing`},force:{type:`boolean`,help:`Take the Cloud version over local edits (conflict) or an unbound directory`}}};function SWe(e){for(let t of Pe(e))u.default.rmSync(d.default.join(Fe(t.dir),`.state`,`server-info`),{force:!0})}function CWe({data:e}){return{heading:`Server`,status:e.status,summary:e.status===e.reason?``:e.reason.replaceAll(`_`,` `),facts:[A(`Scope`,tr(e,`scope`)),A(`Artifacts`,tr(e,`artifacts`))],sections:[]}}async function wWe(){let e=je(),t=t=>{u.default.rmSync(e.info,{force:!0}),SWe(e.projects),u.default.mkdirSync(e.home,{recursive:!0,mode:448}),u.default.writeFileSync(e.stopped,`${JSON.stringify({reason:t,timestamp:Math.floor(Date.now()/1e3)})}\n`)};if(et(e.pid)===null)return{status:`not_running`};let n=Number(et(e.pid)),r=et(e.serverId)??``;if(!Number.isInteger(n)||n<=0||!/^[\w-]{32,64}$/.test(r)||!Qe(n,r))return u.default.rmSync(e.pid,{force:!0}),u.default.rmSync(e.serverId,{force:!0}),t(`stale_pid`),{status:`stale_pid`};try{process.kill(n,`SIGTERM`)}catch{}if(!await $e(n,7e3)){try{process.kill(n,`SIGKILL`)}catch{}await $e(n,1e3)}if(Je(n))return{status:`failed`,error:`process still running`};for(let t of[e.pid,e.serverId])u.default.rmSync(t,{force:!0});return t(`stop`),{status:`stopped`}}const TWe={name:`stop`,summary:`Stop this machine's artifacts server; the artifacts are kept`,usage:[`[options]`],options:{},semantic:e=>sr({id:`stop`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.status},async run(e,t){let n=t.effects.begin(`stop`,`machine`),r=await wWe();return r.status!==`failed`&&t.effects.set(n,r.status===`not_running`?`none`:`confirmed`),Zn({status:r.status===`stopped`?`stopped`:r.status===`failed`?`failed`:`unchanged`,reason:r.status,scope:`machine`,artifacts:`kept`},r.status===`failed`?{kind:`failed`,error:{code:`E_SERVER_STOP_FAILED`,message:r.error}}:{kind:`succeeded`})},present:CWe},e)},EWe={name:`uninstall`,summary:`Remove recorded integrations and owned command; keep artifacts and data`,options:{"install-dir":{type:`string`,value:`<path>`,help:`Managed installation directory`},harness:{type:`string`,value:`<targets>`,help:`Only remove these comma-separated harnesses; keep CLI`}},semantic:e=>sr({id:`uninstall`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`]},run(t,n){let r=typeof e.values.harness==`string`?e.values.harness.split(`,`).map(Fi):void 0;if(r?.some(e=>!Ci.some(t=>t.id===e)))return Zn({removed:[],preserved:[],failures:[]},{kind:`validation_failed`},{warnings:[{code:`E_HARNESS`,severity:`error`,message:`Unknown harness selection`}]});let i=d.default.resolve(e.values[`install-dir`]||Oi()),a=n.effects.begin(`uninstall`,i),o=Lne(i,{targets:r});return o.failures.length||n.effects.confirm(a,o.removed),Zn(o,o.failures.length?{kind:`partial`}:{kind:`succeeded`})},present:({data:e})=>({heading:`Uninstall`,status:e.failures.length?`partial`:`removed`,facts:[A(`Removed`,tr(e,`removed`)),A(`Preserved`,tr(e,`preserved`))],sections:[{kind:`records`,key:`failures`,rows:e.failures,columns:[{key:`component`,required:!0},{key:`message`,required:!0}]}]})},e)};function DWe(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<3;e++)if(n[e]!==r[e])return n[e]>r[e];return!1}const OWe=e=>d.default.join(e.XDG_CACHE_HOME||d.default.join(g.default.homedir(),`.cache`),`ryugi`,`artifacts`,`latest.json`);function kWe(e,t,n){try{u.default.mkdirSync(d.default.dirname(e),{recursive:!0});let r=`${e}.${process.pid}`;u.default.writeFileSync(r,JSON.stringify({version:t,checkedAt:n})),u.default.renameSync(r,e)}catch{}}const Y9=`ryugi-artifacts`;function AWe(e,t){let n=`${Y9}@${t}`;return{cmd:e,args:e===`npm`?[`install`,`-g`,n]:e===`yarn`?[`global`,`add`,n]:[`add`,`-g`,n]}}const X9=({cmd:e,args:t})=>[e,...t].join(` `);async function jWe(e){let t=e.endsWith(`/`)?e:`${e}/`;try{let e=await fetch(new URL(`${Y9}/latest`,t),{signal:AbortSignal.timeout(1e4)}),{version:n}=await e.json();if(e.ok&&typeof n==`string`&&/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/.test(n))return n;throw Error(`registry returned ${e.status}`)}catch(e){throw new O(`Could not get the latest ${Y9} version from ${t}: ${e.message}`)}}function MWe(e,t){return e.kind===`transient`?`You ran ${Y9} through ${e.runner}, which keeps no install to update. Run \`${e.runner} ${Y9}@latest\` to get ${t}.`:e.kind===`local`?"This is a local build from a Ryugi checkout. Update it with `git pull`, then `pnpm build` in artifacts/.":e.kind===`launcher`?`Release cache refreshed to ${t}. Run the returned start command through the launcher to install it and replace the running server.`:null}var NWe=class extends O{};async function PWe(e,t={}){if(e.pm!==void 0&&!v9.includes(e.pm))throw new O(`--pm must be one of ${v9.join(`, `)}`);let n=e.pm?{kind:`global`,pm:e.pm}:y9(e.file,e.env),r=await jWe(e.registry);t.beforeCache?.(),kWe(OWe(e.env),r,Date.now()),t.cacheRefreshed?.();let i={type:`update-check`,current:e.current,latest:r,install:n.kind};if(!DWe(r,e.current))return{...i,upToDate:!0,command:null};if(n.kind===`unknown`){let t=v9.map(e=>` ${X9(AWe(e,r))}`).join(`
1266
- `);throw new NWe(`Could not tell how ${Y9} was installed (${e.file}). Install ${r} with one of:\n${t}\nor run \`${Y9} update --pm <${v9.join(`|`)}>\`.`)}if(n.kind===`managed`){if(e.check)return{...i,upToDate:!1,command:`ryugi update`};let n=Oi(e.env),a=new Ni(n).current();if(!a)throw new O(`Managed runtime state is missing; run ryugi doctor.`);let o=new Ni(n,d.default.dirname(a.bin)),s=d.default.join(n,`downloads`,`runtime-${(0,p.randomUUID)()}`);try{t.beforeInstall?.();let n;return t.downloadRuntime?n=await t.downloadRuntime(r):(u.default.mkdirSync(s,{recursive:!0}),t.log?.(`Downloading ${Y9}@${r}`),wi(`npm`,[`install`,`--prefix`,s,`--ignore-scripts`,`--no-audit`,`--no-fund`,`--omit=dev`,`--legacy-peer-deps`,`--registry`,e.registry,`${Y9}@${r}`]),n=d.default.join(s,`node_modules`,Y9)),o.install(n),{type:`updated`,from:e.current,to:r,pm:`ryugi`,command:`ryugi update`}}finally{u.default.rmSync(s,{recursive:!0,force:!0})}}if(n.kind!==`global`)return{...i,upToDate:!1,command:null,message:MWe(n,r)};let a=AWe(n.pm,r);if(e.check)return{...i,upToDate:!1,command:X9(a)};let o=process.platform===`win32`;t.beforeInstall?.();let s=t.log?[`inherit`,`pipe`,`pipe`]:[`inherit`,2,2],c=o?(0,f.spawnSync)(X9(a),{stdio:[...s],env:e.env,shell:!0}):(0,f.spawnSync)(a.cmd,a.args,{stdio:[...s],env:e.env});if(c.stdout?.length&&t.log?.(c.stdout.toString()),c.stderr?.length&&t.log?.(c.stderr.toString()),c.error)throw new O(`Could not run ${X9(a)}: ${c.error.message}`);if(c.status!==0)throw new O(`${X9(a)} exited with ${c.status??c.signal}`);return{type:`updated`,from:e.current,to:r,pm:n.pm,command:X9(a)}}const FWe={name:`update`,summary:`Update the CLI through its original owner and refresh recorded harness integrations`,options:{check:{type:`boolean`,help:`Compare CLI versions only; do not install`},"cli-only":{type:`boolean`,help:`Update CLI without refreshing harness plugins`},"plugins-only":{type:`boolean`,help:`Refresh recorded plugins without updating CLI`},"install-dir":{type:`string`,value:`<path>`,help:`Managed installation directory`},"plugin-source":{type:`string`,value:`<path>`,help:`Plugin checkout for offline/development refresh`},pm:{type:`string`,value:`<npm|pnpm|yarn|bun>`,help:`Use this package manager instead of detecting it`}},semantic:e=>sr({id:`update`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`],fields:[`current`,`latest`,`install`,`status`,`installed`,`message`,`command`,`plugins`]},async run(t,n){if(e.values[`cli-only`]&&e.values[`plugins-only`])throw new O(`Choose --cli-only or --plugins-only`);let r,i,a;try{a=e.values[`plugins-only`]?{type:`update-check`,current:`1.101.2`,latest:`1.101.2`,install:y9(__filename,process.env).kind,upToDate:!0,command:null,message:`CLI unchanged; refreshing recorded plugins.`}:await PWe({current:`1.101.2`,file:__filename,env:process.env,registry:process.env.npm_config_registry||`https://registry.npmjs.org/`,check:!!e.values.check,pm:e.values.pm},{beforeCache(){i=n.effects.begin(`release-cache`,OWe(process.env))},cacheRefreshed(){i!==void 0&&n.effects.confirm(i)},beforeInstall(){r=n.effects.begin(`install`,Y9)},log:n.diagnostic})}catch(e){throw e instanceof NWe?new k({code:`E_INSTALL_UNKNOWN`,message:e.message},`action_required`):e}a.type===`updated`&&r!==void 0&&n.effects.confirm(r,{from:a.from,to:a.to});let o=a.type===`updated`?{current:a.to,latest:a.to,install:a.pm===`ryugi`?`managed`:`global`,status:`updated`,installed:!0,command:a.command}:{current:a.current,latest:a.latest,install:a.install,status:a.upToDate?`up_to_date`:`available`,installed:!1,command:a.command,...a.message?{message:a.message}:{}};if(!e.values.check&&!e.values[`cli-only`]){let t=d.default.resolve(e.values[`install-dir`]||Oi());o.plugins=[];for(let r of Object.values(Ii(t).harnesses)){let i=await FUe({projectDir:e.projectDir,positionals:[],values:{mode:r.mode,harness:r.harness,"no-cli":!0,"install-dir":t,"plugin-source":e.values[`plugin-source`]}},n,!1,!0),a=i.data.targets.find(e=>e.harness===r.harness);o.plugins.push({harness:r.harness,mode:r.mode,status:a?.status||`failed`,error:a?.error||(i.completion.kind===`succeeded`?void 0:i.warnings.map(e=>e.message).join(`; `))})}}return Zn(o,o.plugins?.some(e=>e.status!==`installed`)?{kind:`partial`}:void 0,{effects:n.effects.snapshot(),actions:o.install===`launcher`&&o.status===`available`?[Xn([`start`,`--background`,`--no-open`,`--project-dir`,e.projectDir],`Restart server`)]:[]})},present:IWe},e)};function IWe({data:e}){return{heading:`Update`,status:e.status,facts:[A(`Current`,tr(e,`current`),!0),A(`Latest`,tr(e,`latest`)),A(`Install`,tr(e,`install`)),...e.message?[A(`Advice`,tr(e,`message`))]:[]],sections:e.plugins?.length?[{kind:`records`,key:`plugins`,title:`Harnesses`,rows:e.plugins.map(e=>({...e})),columns:[{key:`harness`,required:!0},{key:`mode`,required:!0},{key:`status`,required:!0},{key:`error`}]}]:[]}}const Z9=[Ree,TWe,Bte,gWe,xWe,Zee,ste,Jee,cWe,cne,Fte,dte,mHe,dne,FWe,LUe,Rne,Ene,EWe];function LWe(e){return(t,n,r)=>{let i=[`--project-dir`,e.projectDir],a=typeof e.values.artifact==`string`?e.values.artifact:void 0,o=[...i,...a?[`--artifact`,a]:[]];if(r.some(e=>e.state===`unknown`)){let e;if(t.startsWith(`comment`)&&a)e=[`comment`,`list`,...o,...a.startsWith(`verify/`)?[]:[`--sections`,`all`,...t.endsWith(`.ack`)?[]:[`--all`],`--detail`]];else if(t.startsWith(`changes`))e=[`changes`,...o,`--detail`];else if(t.startsWith(`publish`))e=[`publish`,`--list`,...i,...a&&r.some(e=>[`share-key`,`revoke-key`].includes(e.operation)&&e.state===`unknown`)?[`--artifact`,a]:[]];else if(t===`config`)e=[`config`,...i];else if(t.startsWith(`modules`))e=[`modules`,...o];else if(t===`update`)e=[`--version`];else if(t===`install`)return[{kind:`command`,argv:[`claude`,`plugin`,`list`,`--json`],label:`Verify state`,reason:`Inspect installed plugins before any retry; an operation may already have completed.`}];else e=[`get`,...i];return[{...Xn(e,`Verify state`),reason:`Inspect current state before any retry; an operation may already have completed.`}]}return n?.code===`E_SERVER_NOT_RUNNING`||n?.code===`E_SERVER_UNREACHABLE`?[Xn([`start`,`--background`,`--no-open`,...o],`Start server`)]:n?.code===`E_ARGUMENT_INVALID`||n?.code===`E_OPTION_CONFLICT`?[Xn([t.split(`.`)[0],...e.positionals[0]&&t.startsWith(`comment`)?[e.positionals[0]]:[],`--help`],`Help`)]:n?er(n):[]}}async function Q9(e,t,n,r){return cr({id:e,mode:`finite`,output:{formats:[n.format]},run(){throw t},present(){return{heading:`Error`,status:`failed`,facts:[],sections:[]}}},void 0,{...n,fields:void 0,detail:!1},r)}function RWe(e,t){return{id:e,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`],fields:[`text`,`version`,`capabilities`,`commands`]},run(){return Zn(t)},present({data:e}){return e.version?{heading:`ryugi ${e.version}`,status:``,facts:[],sections:[]}:{heading:`Help`,status:``,facts:[],sections:[{kind:`content`,key:`text`,text:e.text}]}}}}async function zWe(e,t,n,r,i,a,o){let[s,...c]=e,l=t.find(e=>e.name===s),d;try{if(l?.positionals&&l.usage?.some(e=>/^[a-z]+\s/.test(e))&&(d=qn(c.filter(e=>e!==`--help`&&e!==`-h`),l.options,l.positionals).positionals[0]),s===`--version`||s===`-v`)return qn(c,{},0),await sr(RWe(`version`,{text:r,version:r,capabilities:[`reviewBundlesV1`]}),void 0).run(i,a);if(s===`--help`||s===`-h`||l&&eee(c)){l||qn(c,{},0);let e=l?nee(l,d):ree(t,n);if(l&&[`start`,`check`].includes(l.name)){let t=qn(c.filter(e=>e!==`--help`&&e!==`-h`),l.options,l.positionals);t.values.mockup?e=cn():typeof t.values.artifact==`string`&&(e+=`\n\n${sn(t.values.artifact)}`)}return await sr(RWe(`help`,{text:e,commands:t.map(({name:e,summary:t})=>({name:e,summary:t}))}),void 0).run(i,a)}if(!l&&(!s||s.startsWith(`-`)||(()=>{try{return u.default.statSync(s).isDirectory()}catch{return!1}})())){let t=qn(e,n,1);if(t.positionals.length&&t.values[`project-dir`])throw new k({code:`E_ARGUMENT_INVALID`,message:`Specify one project directory.`});return t.projectDir=t.values[`project-dir`]??t.positionals[0]??t.projectDir,t.values.foreground=!0,t.values.open=!t.values[`no-open`],await fr(t,`browse`).run(i,a,o)}if(!l)throw new k({code:s?.includes(`/`)?`E_PROJECT_NOT_FOUND`:`E_UNKNOWN_COMMAND`,message:s?`Unknown command: ${s}`:`Use start --foreground to browse with semantic output.`});let f;try{f=qn(c,Yn(l,d),l.positionals)}catch(e){throw new k({code:`E_ARGUMENT_INVALID`,message:e.message})}return f.projectDir=Ue(f.projectDir).project,await l.semantic(f).run(i,a,o,LWe(f))}catch(e){let t=e instanceof O?new k({code:`E_ARGUMENT_INVALID`,message:e.message}):e;return t instanceof Error&&Object.assign(t,{actions:[Xn([...l?[l.name,...d&&l.usage?.some(e=>e.startsWith(`${d} `))?[d]:[]]:[],`--help`],`Help`)]}),Q9(l?.name??s??`browse`,t,i,a)}}function BWe(e=process.stdout,t=process.stderr){let n=/* @__PURE__ */ new WeakMap;for(let r of[e,t])r.on(`error`,e=>n.set(r,e));return{write(r,i){let a=r===`stdout`?e:t,o=n.get(a);return o?Promise.reject(o):new Promise((e,t)=>a.write(i,n=>n?t(n):e()))}}}function $9(e){process.exitCode=e}const VWe={"no-open":{type:`boolean`,help:`Print the URL without opening a browser`}};async function HWe(e){let t=Object.assign({},Gn,...Z9.map(e=>e.options)),n=BWe(),r;try{r=Ln(e,t,Un(e,t))}catch(r){return Q9(e[0]??`browse`,r,Ln(e,t).options,n)}if(r.error)return Q9(e[0]??`browse`,r.error,r.options,n);let i=new AbortController,a=()=>i.abort(`SIGINT`),o=()=>i.abort(`SIGTERM`);process.on(`SIGINT`,a),process.on(`SIGTERM`,o);try{return await zWe(e,Z9,VWe,`1.101.2`,r.options,n,i.signal)}finally{process.removeListener(`SIGINT`,a),process.removeListener(`SIGTERM`,o)}}HWe(process.argv.slice(2)).then($9,e=>Q9(process.argv[2]??`browse`,e,{format:`brief`},BWe()).then($9));
1239
+ `);throw new NWe(`Could not tell how ${Y9} was installed (${e.file}). Install ${r} with one of:\n${t}\nor run \`${Y9} update --pm <${v9.join(`|`)}>\`.`)}if(n.kind===`managed`){if(e.check)return{...i,upToDate:!1,command:`ryugi update`};let n=Oi(e.env),a=new Ni(n).current();if(!a)throw new O(`Managed runtime state is missing; run ryugi doctor.`);let o=new Ni(n,d.default.dirname(a.bin)),s=d.default.join(n,`downloads`,`runtime-${(0,p.randomUUID)()}`);try{t.beforeInstall?.();let n;return t.downloadRuntime?n=await t.downloadRuntime(r):(u.default.mkdirSync(s,{recursive:!0}),t.log?.(`Downloading ${Y9}@${r}`),wi(`npm`,[`install`,`--prefix`,s,`--ignore-scripts`,`--no-audit`,`--no-fund`,`--omit=dev`,`--legacy-peer-deps`,`--registry`,e.registry,`${Y9}@${r}`]),n=d.default.join(s,`node_modules`,Y9)),o.install(n),{type:`updated`,from:e.current,to:r,pm:`ryugi`,command:`ryugi update`}}finally{u.default.rmSync(s,{recursive:!0,force:!0})}}if(n.kind!==`global`)return{...i,upToDate:!1,command:null,message:MWe(n,r)};let a=AWe(n.pm,r);if(e.check)return{...i,upToDate:!1,command:X9(a)};let o=process.platform===`win32`;t.beforeInstall?.();let s=t.log?[`inherit`,`pipe`,`pipe`]:[`inherit`,2,2],c=o?(0,f.spawnSync)(X9(a),{stdio:[...s],env:e.env,shell:!0}):(0,f.spawnSync)(a.cmd,a.args,{stdio:[...s],env:e.env});if(c.stdout?.length&&t.log?.(c.stdout.toString()),c.stderr?.length&&t.log?.(c.stderr.toString()),c.error)throw new O(`Could not run ${X9(a)}: ${c.error.message}`);if(c.status!==0)throw new O(`${X9(a)} exited with ${c.status??c.signal}`);return{type:`updated`,from:e.current,to:r,pm:n.pm,command:X9(a)}}const FWe={name:`update`,summary:`Update the CLI through its original owner and refresh recorded harness integrations`,options:{check:{type:`boolean`,help:`Compare CLI versions only; do not install`},"cli-only":{type:`boolean`,help:`Update CLI without refreshing harness plugins`},"plugins-only":{type:`boolean`,help:`Refresh recorded plugins without updating CLI`},"install-dir":{type:`string`,value:`<path>`,help:`Managed installation directory`},"plugin-source":{type:`string`,value:`<path>`,help:`Plugin checkout for offline/development refresh`},pm:{type:`string`,value:`<npm|pnpm|yarn|bun>`,help:`Use this package manager instead of detecting it`}},semantic:e=>sr({id:`update`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`],fields:[`current`,`latest`,`install`,`status`,`installed`,`message`,`command`,`plugins`]},async run(t,n){if(e.values[`cli-only`]&&e.values[`plugins-only`])throw new O(`Choose --cli-only or --plugins-only`);let r,i,a;try{a=e.values[`plugins-only`]?{type:`update-check`,current:`1.102.1`,latest:`1.102.1`,install:y9(__filename,process.env).kind,upToDate:!0,command:null,message:`CLI unchanged; refreshing recorded plugins.`}:await PWe({current:`1.102.1`,file:__filename,env:process.env,registry:process.env.npm_config_registry||`https://registry.npmjs.org/`,check:!!e.values.check,pm:e.values.pm},{beforeCache(){i=n.effects.begin(`release-cache`,OWe(process.env))},cacheRefreshed(){i!==void 0&&n.effects.confirm(i)},beforeInstall(){r=n.effects.begin(`install`,Y9)},log:n.diagnostic})}catch(e){throw e instanceof NWe?new k({code:`E_INSTALL_UNKNOWN`,message:e.message},`action_required`):e}a.type===`updated`&&r!==void 0&&n.effects.confirm(r,{from:a.from,to:a.to});let o=a.type===`updated`?{current:a.to,latest:a.to,install:a.pm===`ryugi`?`managed`:`global`,status:`updated`,installed:!0,command:a.command}:{current:a.current,latest:a.latest,install:a.install,status:a.upToDate?`up_to_date`:`available`,installed:!1,command:a.command,...a.message?{message:a.message}:{}};if(!e.values.check&&!e.values[`cli-only`]){let t=d.default.resolve(e.values[`install-dir`]||Oi());o.plugins=[];for(let r of Object.values(Ii(t).harnesses)){let i=await FUe({projectDir:e.projectDir,positionals:[],values:{mode:r.mode,harness:r.harness,"no-cli":!0,"install-dir":t,"plugin-source":e.values[`plugin-source`]}},n,!1,!0),a=i.data.targets.find(e=>e.harness===r.harness);o.plugins.push({harness:r.harness,mode:r.mode,status:a?.status||`failed`,error:a?.error||(i.completion.kind===`succeeded`?void 0:i.warnings.map(e=>e.message).join(`; `))})}}return Zn(o,o.plugins?.some(e=>e.status!==`installed`)?{kind:`partial`}:void 0,{effects:n.effects.snapshot(),actions:o.install===`launcher`&&o.status===`available`?[Xn([`start`,`--background`,`--no-open`,`--project-dir`,e.projectDir],`Restart server`)]:[]})},present:IWe},e)};function IWe({data:e}){return{heading:`Update`,status:e.status,facts:[A(`Current`,tr(e,`current`),!0),A(`Latest`,tr(e,`latest`)),A(`Install`,tr(e,`install`)),...e.message?[A(`Advice`,tr(e,`message`))]:[]],sections:e.plugins?.length?[{kind:`records`,key:`plugins`,title:`Harnesses`,rows:e.plugins.map(e=>({...e})),columns:[{key:`harness`,required:!0},{key:`mode`,required:!0},{key:`status`,required:!0},{key:`error`}]}]:[]}}const Z9=[Ree,TWe,Bte,gWe,xWe,Zee,ste,Jee,cWe,cne,Fte,dte,mHe,dne,FWe,LUe,Rne,Ene,EWe];function LWe(e){return(t,n,r)=>{let i=[`--project-dir`,e.projectDir],a=typeof e.values.artifact==`string`?e.values.artifact:void 0,o=[...i,...a?[`--artifact`,a]:[]];if(r.some(e=>e.state===`unknown`)){let e;if(t.startsWith(`comment`)&&a)e=[`comment`,`list`,...o,...a.startsWith(`verify/`)?[]:[`--sections`,`all`,...t.endsWith(`.ack`)?[]:[`--all`],`--detail`]];else if(t.startsWith(`changes`))e=[`changes`,...o,`--detail`];else if(t.startsWith(`publish`))e=[`publish`,`--list`,...i,...a&&r.some(e=>[`share-key`,`revoke-key`].includes(e.operation)&&e.state===`unknown`)?[`--artifact`,a]:[]];else if(t===`config`)e=[`config`,...i];else if(t.startsWith(`modules`))e=[`modules`,...o];else if(t===`update`)e=[`--version`];else if(t===`install`)return[{kind:`command`,argv:[`claude`,`plugin`,`list`,`--json`],label:`Verify state`,reason:`Inspect installed plugins before any retry; an operation may already have completed.`}];else e=[`get`,...i];return[{...Xn(e,`Verify state`),reason:`Inspect current state before any retry; an operation may already have completed.`}]}return n?.code===`E_SERVER_NOT_RUNNING`||n?.code===`E_SERVER_UNREACHABLE`?[Xn([`start`,`--background`,`--no-open`,...o],`Start server`)]:n?.code===`E_ARGUMENT_INVALID`||n?.code===`E_OPTION_CONFLICT`?[Xn([t.split(`.`)[0],...e.positionals[0]&&t.startsWith(`comment`)?[e.positionals[0]]:[],`--help`],`Help`)]:n?er(n):[]}}async function Q9(e,t,n,r){return cr({id:e,mode:`finite`,output:{formats:[n.format]},run(){throw t},present(){return{heading:`Error`,status:`failed`,facts:[],sections:[]}}},void 0,{...n,fields:void 0,detail:!1},r)}function RWe(e,t){return{id:e,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`],fields:[`text`,`version`,`capabilities`,`commands`]},run(){return Zn(t)},present({data:e}){return e.version?{heading:`ryugi ${e.version}`,status:``,facts:[],sections:[]}:{heading:`Help`,status:``,facts:[],sections:[{kind:`content`,key:`text`,text:e.text}]}}}}async function zWe(e,t,n,r,i,a,o){let[s,...c]=e,l=t.find(e=>e.name===s),d;try{if(l?.positionals&&l.usage?.some(e=>/^[a-z]+\s/.test(e))&&(d=qn(c.filter(e=>e!==`--help`&&e!==`-h`),l.options,l.positionals).positionals[0]),s===`--version`||s===`-v`)return qn(c,{},0),await sr(RWe(`version`,{text:r,version:r,capabilities:[`reviewBundlesV1`]}),void 0).run(i,a);if(s===`--help`||s===`-h`||l&&eee(c)){l||qn(c,{},0);let e=l?nee(l,d):ree(t,n);if(l&&[`start`,`check`].includes(l.name)){let t=qn(c.filter(e=>e!==`--help`&&e!==`-h`),l.options,l.positionals);t.values.mockup?e=cn():typeof t.values.artifact==`string`&&(e+=`\n\n${sn(t.values.artifact)}`)}return await sr(RWe(`help`,{text:e,commands:t.map(({name:e,summary:t})=>({name:e,summary:t}))}),void 0).run(i,a)}if(!l&&(!s||s.startsWith(`-`)||(()=>{try{return u.default.statSync(s).isDirectory()}catch{return!1}})())){let t=qn(e,n,1);if(t.positionals.length&&t.values[`project-dir`])throw new k({code:`E_ARGUMENT_INVALID`,message:`Specify one project directory.`});return t.projectDir=t.values[`project-dir`]??t.positionals[0]??t.projectDir,t.values.foreground=!0,t.values.open=!t.values[`no-open`],await fr(t,`browse`).run(i,a,o)}if(!l)throw new k({code:s?.includes(`/`)?`E_PROJECT_NOT_FOUND`:`E_UNKNOWN_COMMAND`,message:s?`Unknown command: ${s}`:`Use start --foreground to browse with semantic output.`});let f;try{f=qn(c,Yn(l,d),l.positionals)}catch(e){throw new k({code:`E_ARGUMENT_INVALID`,message:e.message})}return f.projectDir=Ue(f.projectDir).project,await l.semantic(f).run(i,a,o,LWe(f))}catch(e){let t=e instanceof O?new k({code:`E_ARGUMENT_INVALID`,message:e.message}):e;return t instanceof Error&&Object.assign(t,{actions:[Xn([...l?[l.name,...d&&l.usage?.some(e=>e.startsWith(`${d} `))?[d]:[]]:[],`--help`],`Help`)]}),Q9(l?.name??s??`browse`,t,i,a)}}function BWe(e=process.stdout,t=process.stderr){let n=/* @__PURE__ */ new WeakMap;for(let r of[e,t])r.on(`error`,e=>n.set(r,e));return{write(r,i){let a=r===`stdout`?e:t,o=n.get(a);return o?Promise.reject(o):new Promise((e,t)=>a.write(i,n=>n?t(n):e()))}}}function $9(e){process.exitCode=e}const VWe={"no-open":{type:`boolean`,help:`Print the URL without opening a browser`}};async function HWe(e){let t=Object.assign({},Gn,...Z9.map(e=>e.options)),n=BWe(),r;try{r=Ln(e,t,Un(e,t))}catch(r){return Q9(e[0]??`browse`,r,Ln(e,t).options,n)}if(r.error)return Q9(e[0]??`browse`,r.error,r.options,n);let i=new AbortController,a=()=>i.abort(`SIGINT`),o=()=>i.abort(`SIGTERM`);process.on(`SIGINT`,a),process.on(`SIGTERM`,o);try{return await zWe(e,Z9,VWe,`1.102.1`,r.options,n,i.signal)}finally{process.removeListener(`SIGINT`,a),process.removeListener(`SIGTERM`,o)}}HWe(process.argv.slice(2)).then($9,e=>Q9(process.argv[2]??`browse`,e,{format:`brief`},BWe()).then($9));