artideck 1.118.4 → 1.119.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,n)=>{let r=Object.setPrototypeOf({},null);for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n&1||t(r,Symbol.toStringTag,{value:`Module`}),n&2?r:Object.preventExtensions(r)},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));let u=require("node:fs"),d=require("node:path"),f=require("node:crypto"),p=require("node:child_process"),m=require("node:os"),h=require("node:util"),g=require("node:readline"),_=require("node:net"),v=require("node:url"),y=require("node:timers/promises"),b=require("node:process"),x=require("node:tty"),S=require("node:worker_threads");u=l(u,1),d=l(d,1),f=l(f,1),m=l(m,1),g=l(g,1),_=l(_,1),b=l(b,1);var C=`1.
|
|
3
|
-
`,{flag:`wx`,mode:384})}catch(e){if(e.code!==`EEXIST`)throw e}}}const
|
|
4
|
-
`),r=[],i=!1;for(let[e,t]of n.entries()){if(r.push(t),t.trimStart().startsWith(`#`)||!t.includes(`.ryugi`))continue;let a=t.split(
|
|
5
|
-
`)),i}function
|
|
6
|
-
`).slice(1).join(` `).trim();return r?r.split(/\s+/):null}const
|
|
7
|
-
`)}\n`)}const Je=e=>process.platform===`win32`?u.default.realpathSync.native(e):u.default.realpathSync(e);function Ye(e){let t;try{if(t=Je(d.default.resolve(e)),!u.default.statSync(t).isDirectory())throw Error(`Not a directory`)}catch{throw new A(`Project directory not found: ${e}`)}t=We(t);let n=Oe(t),r=d.default.join(n,`.state`);return{project:t,root:n,state:r,pid:d.default.join(r,`server.pid`),log:d.default.join(r,`server.log`),serverId:d.default.join(r,`server-instance-id`),info:d.default.join(r,`server-info`),version:d.default.join(r,`server-version`),owners:d.default.join(r,`owners`),stopped:d.default.join(r,`server-stopped`),lock:d.default.join(r,`start.lock`)}}function Xe(e=m.default.homedir()){if(u.default.existsSync(d.default.join(e,`.artideck`)))return!1;let t=d.default.join(e,_e,`server`);try{let e=Number(u.default.readFileSync(d.default.join(t,`server.pid`),`utf8`).trim()),n=u.default.readFileSync(d.default.join(t,`server-instance-id`),`utf8`).trim();return Number.isInteger(e)&&e>0&&!!n&&Ve(e,n)}catch{return!1}}const Ze=/* @__PURE__ */ new Set;function Qe(e,{legacyHubLive:t=Xe,quiet:n=!1}={}){let{project:r}=Ye(e);return u.default.existsSync(d.default.join(r,`.ryugi`))&&t()?(!n&&!Ze.has(r)&&process.stderr.write(`An older hub still serves ${r} from .ryugi; it moves to .artideck after ${$e()} start replaces that hub.\n`),Ze.add(r),Ye(r)):(qe(r,Fe(r,{home:m.default.homedir()})),Ye(r))}const $e=()=>process.env.RYUGI_ARTIFACTS_COMMAND||`adeck`,et=RegExp(`^(${pe.join(`|`)})/[a-z0-9][a-z0-9-]*$`),tt=`--artifact must be <type>/<id>: type ${pe.slice(0,-1).join(`, `)} or ${pe.at(-1)}; id of lowercase letters, digits and hyphens`,nt=[`add`,`reply`,`resolve`,`choose`,`submit`,`answer`,`note`,`pass`,`reject`,`waive`];function rt(){if(process.stdin.isTTY)return``;try{return u.default.readFileSync(0,`utf8`)}catch{return``}}function it(e){let t=(e.text??rt()).trim();if(!t)throw new A(`The message is empty: pass --text <text> or pipe it on stdin`);return t}function at(e,t){if(e===void 0)return;let n=Number(e);if(!Number.isFinite(n))throw new A(`${t} must be a number`);return n}var ot='# Artboard writing\n\nWrite `canvas.json` and board HTML/media under `pages/`. The server keeps a human\'s board positions over a stale write to `canvas.json`; nothing checks board HTML under `pages/`. 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": {\n "file": "pages/settings/retry.html",\n "page": "settings",\n "x": 0,\n "y": 0,\n "w": 640,\n "h": 400,\n "title": "Fixed delay",\n "props": { "strategy": "fixed" }\n },\n "q1-b": {\n "file": "pages/settings/retry.html",\n "page": "settings",\n "x": 720,\n "y": 0,\n "w": 640,\n "h": 400,\n "title": "Exponential",\n "props": { "strategy": "exponential" }\n }\n },\n "groups": {\n "q1": { "title": "Retry strategy", "boards": ["q1-a", "q1-b"], "choose": true, "recommend": "q1-b" }\n },\n "notes": {\n "round-one": {\n "kind": "title",\n "page": "settings",\n "x": 0,\n "y": -480,\n "text": "Delivery settings · round 1",\n "description": "Pick how a failed delivery is retried. Comment on a board, or answer in the terminal."\n }\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- **Props**: options of one choice that differ only in a few values (a token, a copy line, a state) are one file. So are options that are the same page with a part added, removed or restyled (an extra line, button or section): props switch those parts (`"recs": true`) and carry their copy. Options that arrange the page differently (navigation moved, regions reordered or regrouped) get their own files and no props, even when much of their content repeats; the parts they share (top bar, table styles, a scene script) go in one stylesheet or script under `pages/` that each file links, never into `tokens.css`. Each board passes what differs as `props`, a JSON object of at most 4096 characters, which the page reads as `window.ryugiProps` before its own scripts run. Props carry only an option\'s departures from `tokens.css` and the page\'s own defaults: CSS variables keyed by their name, other values by what they set. Values that differ per mode go one level down under `light` and `dark`, mode first, then variable: `"short": { "file": "pages/pay/button.html", "props": { "label": "Pay", "light": { "--button-bg": "#2563eb" }, "dark": { "--button-bg": "#3b82f6" } }, ... }`. A value no token holds yet goes into `tokens.css` with a default that changes nothing and still combines with other values (`0 0 0 0 transparent` for a shadow, `transparent` for a colour); props override it. New props reload that board and leave only it for Check. Comment threads and selected nodes include their board\'s props: read them with the 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 current tokens live in one `pages/tokens.css`, linked by every board; never copy token values into each board. Light values sit on `:root, [data-appearance="light"]`, dark ones under `[data-appearance="dark"]`, the attribute the mockup shell also carries, so a light half inside a dark one keeps its own values; a light-only product writes no dark block. An option that changes a token passes only the new value, as props, and its page sets each mode\'s props as CSS variables on the element carrying that mode\'s `data-appearance`; the option showing current values passes none and reads `window.ryugiProps` as `{}`.\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. A group\'s title is its short question; the round\'s title note names the round, so the two never repeat each other.\n- **Notes** require kind (title/sticky/condition), page/x/y/text; sticky w defaults to 240, optional color is #RGB/#RRGGBB.\n- **Titles** name a round or area in one short line: at most 40 full-width or about 70 Latin characters, size defaults to 96. Everything that explains it (what changed, how to answer, where to start) goes in the title\'s `description`, drawn smaller under it and wrapped at 40 characters, or at the title\'s w when that is narrower. A description makes the note taller: keep boards clear of its whole rectangle.\n- **Edges** connect boards that follow one another: see Flows.\n- **Opening view**: activePage is the opening default; existing readers keep their page. Top-level `focus` `{target:<board/group/note>}` guides first ready content/phone question without resetting open camera/drafts. Share ?page=<id> for a new area.\n- **Spacing** is explicit, measured between board rectangles: 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- **Placing a round**: read `.state/artboard/<id>/layout.json` for actual group/note rectangles and page bounds first. The round\'s title goes at y 0 on an empty page, else at maxY+120. At the default size 96 a title is 110.4 tall, plus 24 and 57 per description line (40 full-width or about 70 Latin characters a line). The round\'s first row of boards starts at title y + title height + 80 + 144, rounded up to a whole pixel. Mixed full-width and Latin text wraps less predictably: after the first Check, read the title\'s height from `layout.json` and move the boards if it differs.\n- **Sizes**: desktop1280x800, phone402x874, tablet834x1194, component640x400. A board at any other size (a component, a long page) takes the height its content needs when Check runs, growing or shrinking, and what sits below its row moves with it, so leave its h to Check; `"fit": false` keeps its h. Without agent-browser Check only grows boards. A device size keeps its h. Content taller or wider than its frame is `W_BOARD_CLIPPED`: fix the size or the content. A page whose height comes from the viewport (vh, 100%) only grows once: give it a height of its own.\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), with the board\'s own CSS/scripts inline, linking only `tokens.css`, the shared files above and CDN libraries, html/body margin0. Any npm library loads from a CDN with its version pinned; nothing is preloaded, so use one instead of hand-writing its equivalent. Missing or unfinished files stay pending. Use native, accessible labelled controls with visible state changes. Static by default, though a shared script may render the markup options share; 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. Find names with `adeck icons <english words>` (`adeck icons delete trash`); Check names unknown ones. 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, on the page with page id `verify` (name "Verify"); the viewer shows that page as its own verify entry beside the page menu, not as a design page. 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; the bare `browser_not_run` beside these only says that some board has not run, and clears with them. When the machine has agent-browser (`adeck doctor` lists it), Check loads those boards itself before it answers. Otherwise 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; editing a file several boards share sends all of them back, and a browser showing them reloads and reruns them on its own. With neither, 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- `removed`: elements the human deleted in the preview, omitted when empty; delete each from its file/path unless they say otherwise.\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, removed}\' \'.artideck/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';const st=e=>t=>{let n=e===`pass`&&!!t.all;if(!n&&!t.group)throw new A(e===`pass`?`comment pass needs --group <groupId>, or --all`:`comment reject needs --group <groupId>`);let r=e===`reject`?it(t):t.text?.trim();return{op:`verdict`,verdict:e,...n?{all:!0}:{group:t.group},...r?{text:r}:{}}},ct={authoring:ot,phoneScreens:!0,review:{sections:[`groups`,`rounds`]},commentActions:{pass:st(`pass`),reject:st(`reject`),choose:e=>{if(!e.group)throw new A(`comment choose needs --group <groupId>`);if(!e.clear&&!e.board)throw new A(`comment choose needs --board <boardId>, or --clear`);return{op:`choose`,group:e.group,board:e.clear?null:e.board}},submit:e=>{if(!e.round)throw new A(`comment submit needs --round <roundId>`);return{op:`submit`,round:e.round,submit:!e.withdraw}},add:e=>{if(!e.board)throw new A(`comment add on an artboard needs --board <boardId>`);let t=at(e.x,`--x`),n=at(e.y,`--y`);return{op:`add`,board:e.board,...t===void 0?{}:{x:t},...n===void 0?{}:{y:n},text:it(e)}}}},lt=/^[a-z0-9][a-z0-9-]{0,63}$/,ut=e=>e.type===`ask`;function dt(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 ft(e){let t=[],n=(e,r)=>{ut(e)&&t.push(dt(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 pt=e=>e===null||typeof e==`string`&&e.length<=2e4;function mt(e){let t={};if(e.ask!==void 0){if(typeof e.ask!=`string`||!lt.test(e.ask))return null;t.ask=e.ask}if(e.choice!==void 0){if(!pt(e.choice))return null;t.choice=e.choice}if(e.answer!==void 0){if(!pt(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 ht=(e,t)=>JSON.stringify(mt(e))===JSON.stringify(mt(t)),gt=e=>e.messages.find(e=>!e.deleted);function _t(e,t){return e.map((e,t)=>({thread:e,index:t,message:gt(e)})).filter(e=>e.message&&t(e.thread.anchor)).sort((e,t)=>e.message.at.localeCompare(t.message.at)||e.index-t.index)}function vt(e){let t=new Set(_t(e,e=>e.submit===!1&&e.of!==void 0).map(e=>e.thread.anchor.of));return _t(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 yt(e,t){let n=new Set(vt(t).filter(e=>!e.withdrawn).flatMap(e=>e.asks)),r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map;for(let{thread:e,message:n}of _t(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 _t(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 bt=e=>typeof e==`string`&&e.length>0&&e.length<=200;function xt(e){if(typeof e!=`object`||!e)return null;let t=e;return t.kind===`node`?bt(t.id)?{kind:`node`,id:t.id}:null:t.kind===`edge`&&bt(t.from)&&bt(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 St(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 Ct=e=>e.blockIds??[e.blockId],wt=e=>typeof e==`object`&&!!e,Tt={read:e=>{if(!wt(e)||typeof e.blockId!=`string`||!e.blockId)return null;let{blockIds:t,textRanges:n}=e,r=e.diagram===void 0?void 0:xt(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=mt(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)=>wt(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)=>ht(e,t)&&e.quote===t.quote&&St(e.diagram,t.diagram)&&Ct(e).length===Ct(t).length&&Ct(e).every((e,n)=>e===Ct(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 Et(e){let t=JSON.parse(e);if(!wt(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(!wt(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&&!wt(e.anchor))throw Error(`threads[${t}] needs an anchor`)}),t}const Dt=e=>!!e.id&&(e.author===`human`||e.author===`agent`)&&typeof e.text==`string`&&typeof e.at==`string`;function Ot(e,t=Tt){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(Dt),a=r.statusBy===`human`||r.statusBy===`agent`?{statusBy:r.statusBy}:{};n.push({id:r.id,anchor:e,status:r.status,statusAt:r.statusAt,...a,...typeof r.statusName==`string`&&{statusName:r.statusName},messages:i})}return{version:1,threads:n}}const kt=[`claude`,`codex`],At=e=>kt.includes(e);function jt(e){try{let t=JSON.parse(u.default.readFileSync(d.default.join(e,`prompt.json`),`utf8`));return typeof t.xml!=`string`||typeof t.markdown!=`string`||typeof t.at!=`number`||!At(t.harness)?null:{xml:t.xml,markdown:t.markdown,at:t.at,harness:t.harness}}catch{return null}}const Mt=/* @__PURE__ */ new Set([`br`,`hr`,`img`]),Nt=/<(\/?)([a-z][\w-]*)\b[^>]*?(\/?)>/gi,Pt=[[`<![CDATA[`,`]]>`],[`<!--`,`-->`]];function Ft(e){let t=``,n=0;for(;n<e.length;){let r=Pt.map(([t,r])=>({close:r,index:e.indexOf(t,n)})).filter(({index:e})=>e!==-1).sort((e,t)=>e.index-t.index)[0];if(!r)return t+e.slice(n);t+=e.slice(n,r.index);let i=e.indexOf(r.close,r.index);if(i===-1)return t;n=i+r.close.length}return t}function It(e){let t=[];for(let n of Ft(e).matchAll(Nt)){let[,e,r,i]=n,a=r.toLowerCase();if(e){let e=t.pop();if(e!==a)return e?`</${a}> closes <${e}>`:`</${a}> has no opening tag`}else!i&&!Mt.has(a)&&t.push(a)}let n=t.at(-1);return n?`<${n}> is never closed`:null}const Lt=/^assets\/[\w-][\w.-]*\.html$/;function Rt(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 zt(e){if(e|=0,e<0)throw RangeError(`Wrong ID size`);let t=Buffer.allocUnsafe(e);return Rt(t),t}function Bt(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 Vt(e,t=21){if(typeof e!=`string`||!e||e.length>256)return Bt(e,t,zt);for(let n=0;n<e.length;n++)if(e.charCodeAt(n)>255)return Bt(e,t,zt);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){Rt(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;){Rt(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)}}Vt(`57X6y3wQZNzYjJB2L_10pxbackgroundhimselfUTF-8DEMOGRAPHICSVqvt4KW9`);var Ht=null;function Ut(e){Ht=e}function Wt(e){if(!Ht)throw Error(`@haklex/rich-litexml: parseHTML implementation not registered. Import from the main entry (@haklex/rich-litexml), not a deep submodule path.`);return Ht(e)}function Gt(e){let t=e.getAttribute(`id`);return t?{$:{blockId:t}}:{}}var Kt={direction:`ltr`,format:``,indent:0,textFormat:0,textStyle:``,version:1};function qt(e){e.registerReader(`p`,(e,t)=>({type:`paragraph`,...Gt(e),children:t.parseChildren(e),...Kt}));for(let t=1;t<=6;t++)e.registerReader(`h${t}`,(e,n)=>({type:`heading`,tag:`h${t}`,...Gt(e),children:n.parseChildren(e),...Kt}));e.registerReader(`blockquote`,(e,t)=>{let n=e.getAttribute(`attribution`),r=e.getAttribute(`rich`)!==null||n!==null,i={...Gt(e),children:t.parseChildren(e),...Kt};return r?{type:`rich-quote`,attribution:n?.trim()?n:null,...i}:{type:`quote`,...i}}),e.registerReader(`hr`,e=>({type:`horizontalrule`,...Gt(e),version:1})),e.registerReader(`ul`,(e,t)=>({type:`list`,listType:e.getAttribute(`type`)===`check`?`check`:`bullet`,tag:`ul`,start:1,...Gt(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),...Gt(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`,...Gt(e),...n===null?{}:{checked:n===`true`},children:t.parseChildren(e),...Kt,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`,...Gt(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 Jt=`abcdefghijklmnopqrstuvwxyz0123456789`,Yt=Vt(Jt,10),Xt=Vt(Jt,6),Zt=Vt(Jt,6),Qt=Vt(Jt,8),$t=Vt(Jt,8);function en(e){let t=e.getAttribute(`id`);return t?{$:{blockId:t}}:{}}function tn(e,t){let n=e.getAttribute(t);return n===null?void 0:Number(n)}var nn=/* @__PURE__ */ new Set([`align-left`,`align-right`,`float-left`,`float-right`]);function rn(e){let t=tn(e,`display-width`);return t!==void 0&&Number.isFinite(t)&&t>=10&&t<=100?t:void 0}function an(e,t){let n=tn(e,t);return n!==void 0&&Number.isFinite(n)&&n>0?Math.round(n):void 0}function on(e){let t=rn(e);if(t!==void 0)return{displayWidth:t};let n=an(e,`fixed-width`);if(n!==void 0)return{fixedWidth:n};let r=an(e,`fixed-height`);return r===void 0?{}:{fixedHeight:r}}function sn(e){let t=e.getAttribute(`layout`);return t!==null&&nn.has(t)?t:void 0}var cn=/* @__PURE__ */ new Set([`auto`,`1:1`,`4:3`,`16:9`,`3:4`]),ln=/* @__PURE__ */ new Set([`cover`,`contain`]);function un(e){let t=e.getAttribute(`aspect`);return t!==null&&cn.has(t)?t:`auto`}function dn(e){let t=e.getAttribute(`fit`);return t!==null&&ln.has(t)?t:`cover`}function fn(e){let t=tn(e,`max-item-height`);return t!==void 0&&Number.isFinite(t)&&t>0?t:void 0}function pn(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 mn(e){return pn(e)??e.textContent??``}function hn(e){e.registerReader(`img`,e=>e.parentElement?.tagName.toLowerCase()!==`gallery`&&{type:`image`,...en(e),src:e.getAttribute(`src`)??``,altText:e.getAttribute(`alt`)??``,width:tn(e,`width`),height:tn(e,`height`),caption:e.getAttribute(`caption`)??void 0,thumbhash:e.getAttribute(`thumbhash`)??void 0,accent:e.getAttribute(`accent`)??void 0,...on(e),layout:sn(e),version:1}),e.registerReader(`video`,e=>({type:`video`,...en(e),src:e.getAttribute(`src`)??``,poster:e.getAttribute(`poster`)??void 0,width:tn(e,`width`),height:tn(e,`height`),version:1})),e.registerReader(`attachment`,e=>({type:`file`,...en(e),src:e.getAttribute(`src`)??``,name:e.getAttribute(`name`)??``,size:tn(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`,...en(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`,...en(e),url:e.getAttribute(`url`)??``,source:e.getAttribute(`source`)??null,version:1})),e.registerReader(`codeblock`,e=>({type:`code-block`,...en(e),code:mn(e),language:e.getAttribute(`lang`)??``,version:1})),e.registerReader(`mermaid`,e=>({type:`mermaid`,...en(e),diagram:mn(e),version:1})),e.registerReader(`math`,e=>{if(e.getAttribute(`display`)===`block`)return{type:`katex-block`,...en(e),equation:mn(e),version:1};let t=e.getAttribute(`color`);return{type:`katex-inline`,equation:mn(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`,...en(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`,...en(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`,...en(e),content:n,version:1}}),e.registerReader(`details`,(e,t)=>({type:`details`,...en(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`,...en(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`,...en(e),images:t,layout:e.getAttribute(`layout`)??`grid`,aspect:un(e),fit:dn(e),maxItemHeight:fn(e),version:1}}),e.registerReader(`excalidraw`,e=>({type:`excalidraw`,...en(e),snapshot:pn(e)||e.getAttribute(`snapshot`)||e.textContent?.trim()||``,version:1})),e.registerReader(`chart`,e=>({type:`chart`,...en(e),spec:mn(e).trim(),version:1})),e.registerReader(`dynamic`,e=>{let t={},n=(pn(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`,...en(e),url:e.getAttribute(`url`)??``,props:t,initialHeight:tn(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`,...en(e),cols:tn(e,`cols`)??2,gap:e.getAttribute(`gap`)??`16px`,cells:n,version:1}}),e.registerReader(`agent-diff`,e=>({type:`agent-diff`,...en(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:mn(n),language:n.getAttribute(`lang`)??``});return{type:`code-snippet`,...en(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_${$t()}`,title:r.getAttribute(`title`)??``,content:{root:{type:`root`,children:t.parseChildren(r),direction:`ltr`,format:``,indent:0,version:1}}});return{type:`steps`,...en(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_${Zt()}`,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_${Qt()}`,participantId:e.getAttribute(`participant`)??``,content:e.textContent??``})}return{type:`chat`,...en(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_${Xt()}`;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`,...en(e),pollId:e.getAttribute(`poll-id`)||`p_${Yt()}`,question:t,options:n,mode:r,...i?{closeAt:i}:{},...o?{showResults:o}:{},version:1}})}var gn=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 _n(e){return e.$?.blockId?{id:e.$.blockId}:{}}function vn(e){e.registerWriter(`paragraph`,(e,t)=>{let n=e;return{tag:`p`,attrs:_n(n),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`heading`,(e,t)=>{let n=e;return{tag:n.tag??`h1`,attrs:_n(n),children:t.serializeChildren(n.children??[])}});let t=(e,t)=>{let n=e,r={..._n(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:_n(e),selfClosing:!0})),e.registerWriter(`list`,(e,t)=>{let n=e,r=n.listType===`number`?`ol`:`ul`,i={..._n(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={..._n(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:_n(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 yn(e){return e.$?.blockId?{id:e.$.blockId}:{}}function j(e){let t={};for(let[n,r]of Object.entries(e))r!=null&&r!==``&&(t[n]=String(r));return t}function bn(e){e.registerWriter(`image`,e=>{let t=e;return{tag:`img`,attrs:j({...yn(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:j({...yn(t),src:t.src,poster:t.poster}),selfClosing:!0}}),e.registerWriter(`file`,e=>{let t=e;return{tag:`attachment`,attrs:j({...yn(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:j({...yn(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:j({...yn(t),url:t.url,source:t.source}),selfClosing:!0}}),e.registerWriter(`code-block`,e=>{let t=e;return{tag:`codeblock`,attrs:j({...yn(t),lang:t.language}),children:[t.code??``]}}),e.registerWriter(`mermaid`,e=>{let t=e;return{tag:`mermaid`,attrs:yn(t),children:[t.diagram??``]}}),e.registerWriter(`katex-block`,e=>{let t=e;return{tag:`math`,attrs:{...yn(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:j({...yn(n),type:n.alertType}),children:t.serializeNestedState(n.content)}}),e.registerWriter(`banner`,(e,t)=>{let n=e;return{tag:`banner`,attrs:j({...yn(n),type:n.bannerType}),children:t.serializeNestedState(n.content)}}),e.registerWriter(`nested-doc`,(e,t)=>{let n=e;return{tag:`nested-doc`,attrs:yn(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:j(yn(t)),children:[t.snapshot.trim()]}:{tag:`excalidraw`,attrs:j(yn(t)),children:[{cdata:t.snapshot}]}:{tag:`excalidraw`,attrs:j(yn(t)),selfClosing:!0}}),e.registerWriter(`chart`,e=>{let t=e,n=typeof t.spec==`string`?t.spec:``;return n?{tag:`chart`,attrs:j(yn(t)),children:[{cdata:n}]}:{tag:`chart`,attrs:j(yn(t)),selfClosing:!0}}),e.registerWriter(`dynamic`,e=>{let t=e,n=j({...yn(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:j({...yn(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:j({...yn(t),op:t.opType,entry:t.diffEntryId}),selfClosing:!0}}),e.registerWriter(`details`,(e,t)=>{let n=e;return{tag:`details`,attrs:j({...yn(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:j({rt:n.reading}),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`mention`,e=>{let t=e;return{tag:`mention`,attrs:j({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:yn(t),children:r}}),e.registerWriter(`gallery`,e=>{let t=e,n=(t.images??[]).map(e=>({tag:`img`,attrs:j({src:e.src,alt:e.alt}),selfClosing:!0}));return{tag:`gallery`,attrs:j({...yn(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:j({name:e.filename,lang:e.language}),children:[e.code??``]}));return{tag:`code-snippet`,attrs:yn(t),children:n}}),e.registerWriter(`steps`,(e,t)=>{let n=e,r=(n.steps??[]).map(e=>({tag:`step`,attrs:j({id:e.id,title:e.title}),children:t.serializeNestedState(e.content)}));return{tag:`steps`,attrs:yn(n),children:r}}),e.registerWriter(`chat`,e=>{let t=e,n={tag:`participants`,children:(t.participants??[]).map(e=>({tag:`participant`,attrs:j({id:e.id,kind:e.kind,name:e.name,avatar:e.avatar}),children:[]}))},r={tag:`messages`,children:(t.messages??[]).map(e=>({tag:`message`,attrs:j({id:e.id,participant:e.participantId}),children:[e.content??``]}))};return{tag:`chat`,attrs:j({...yn(t),variant:t.variant}),children:[n,r]}}),e.registerWriter(`poll`,e=>{let t=e,n=(t.options??[]).map(e=>({tag:`option`,attrs:j({id:e.id}),children:[e.label??``]}));return{tag:`poll`,attrs:j({...yn(t),"poll-id":t.pollId,mode:t.mode,"close-at":t.closeAt,"show-results":t.showResults}),children:[{tag:`question`,children:[t.question??``]},...n]}})}function xn(){let e=new gn;return vn(e),qt(e),bn(e),hn(e),e}var Sn={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 Cn(e){return e.toLowerCase()in Sn}function wn(e){return Sn[e.toLowerCase()]??0}var Tn=/* @__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 En(e){return Tn.has(e.toLowerCase())}var Dn=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),On=/<([\w-]+)((?:\s+[\w-]+(?:\s*=\s*(?:"[^"]*"|'[^']*'))?)*)\s*\/>/g,kn=`<![CDATA[`,An=`]]>`;function jn(e){return e.replaceAll(On,(e,t,n)=>Dn.has(t.toLowerCase())?e:`<${t}${n}></${t}>`)}function Mn(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(kn,n);if(r<0){t.push(jn(e.slice(n)));break}t.push(jn(e.slice(n,r)));let i=e.indexOf(An,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 Nn(e){return Wt(`<!DOCTYPE html><html><body>${Mn(e)}</body></html>`)}function Pn(e,t){let n=Nn(e),r=n.querySelector(`doc`)??n.body;return{root:{type:`root`,children:Ln(t).parseChildren(r),direction:`ltr`,format:``,indent:0,version:1}}}var Fn=/* @__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 In(e){return Fn.has(e.tagName.toLowerCase())}function Ln(e){let t={parseChildren(n){let r=[...n.children].some(e=>!En(e.tagName)),i=In(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(Vn(e,0)),o=``};for(let r of n.childNodes)if(r.nodeType===3)o+=r.textContent??``;else if(r.nodeType===1){s();let n=Rn(r,e,t,0);n&&(Array.isArray(n)?a.push(...n):a.push(n))}return s(),a},parseNestedState(t){return Pn(t,e)}};return t}function Rn(e,t,n,r){let i=e.tagName.toLowerCase();if(Cn(i))return zn(e,t,n,r|wn(i));if(i===`br`)return{type:`linebreak`,version:1};if(i===`node`)return Bn(e);let a=t.getReader(i);if(a){let t=a(e,n);if(t!==!1)return t}return n.parseChildren(e)}function zn(e,t,n,r){let i=[],a=``,o=()=>{a!==``&&(i.push(Vn(a,r)),a=``)};for(let s of e.childNodes)if(s.nodeType===3)a+=s.textContent??``;else if(s.nodeType===1){o();let e=Rn(s,t,n,r);e&&(Array.isArray(e)?i.push(...e):i.push(e))}return o(),i}function Bn(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 Vn(e,t){return{type:`text`,text:e,format:t,detail:0,mode:`normal`,style:``,version:1}}const Hn=Symbol(`changed`),Un=Symbol(`classList`),Wn=Symbol(`CustomElements`),Gn=Symbol(`content`),Kn=Symbol(`dataset`),qn=Symbol(`doctype`),Jn=Symbol(`DOMParser`),M=Symbol(`end`),Yn=Symbol(`EventTarget`),Xn=Symbol(`globals`),Zn=Symbol(`image`),Qn=Symbol(`mime`),$n=Symbol(`MutationObserver`),N=Symbol(`next`),er=Symbol(`ownerElement`),tr=Symbol(`prev`),nr=Symbol(`private`),rr=Symbol(`sheet`),ir=Symbol(`start`),ar=Symbol(`style`),or=Symbol(`upgrade`),sr=Symbol(`value`),cr=/* @__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]]),lr=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 ur(e){return e>=55296&&e<=57343||e>1114111?65533:cr.get(e)??e}function dr(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 fr=/* #__PURE__ */ dr(`QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPA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5hAHIAAKBfKmUAcaAnIgCgWSLlIXJwAKAYIXIAAOA12DTdcABmAADgNdho3WWgQCJhAHQA6ABqD2MAcgAA4DXYzNzjCuQRUC4AAFQuAABYLmIuAAAAAGMubS5wLnQuAAAAAIguki4AAJouJxIqEnQAcgDpAB0ScgAA4DXYNd0AAUFhWy5eLnIA8gDnAnIA8gCTB75jAAFBYWYuaS5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg`),pr=/* #__PURE__ */ dr(`AAJhZ2xxBwARABMAFQBtAg0AAAAAAA8AcAAmYG8AcwAnYHQAPmB0ADxg9SFvdCJg`);var mr;(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`})(mr||={});var hr;(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`})(hr||={});function gr(e){return e>=hr.ZERO&&e<=hr.NINE}function _r(e){return e>=hr.UPPER_A&&e<=hr.UPPER_F||e>=hr.LOWER_A&&e<=hr.LOWER_F}function vr(e){return e>=hr.UPPER_A&&e<=hr.UPPER_Z||e>=hr.LOWER_A&&e<=hr.LOWER_Z||gr(e)}function yr(e){return e===hr.EQUALS||vr(e)}var br;(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`})(br||={});var xr;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(xr||={});var Sr=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=br.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=xr.Strict,this.runConsumed=0}startEntity(e){this.decodeMode=e,this.state=br.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(e,t){switch(this.state){case br.EntityStart:return e.charCodeAt(t)===hr.NUM?(this.state=br.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=br.NamedEntity,this.stateNamedEntity(e,t));case br.NumericStart:return this.stateNumericStart(e,t);case br.NumericDecimal:return this.stateNumericDecimal(e,t);case br.NumericHex:return this.stateNumericHex(e,t);case br.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|32)===hr.LOWER_X?(this.state=br.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=br.NumericDecimal,this.stateNumericDecimal(e,t))}stateNumericHex(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(gr(n)||_r(n)){let e=n<=hr.NINE?n-hr.ZERO:(n|32)-hr.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(gr(n))this.result=this.result*10+(n-hr.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===hr.SEMI)this.consumed+=1;else if(this.decodeMode===xr.Strict)return 0;return this.emitCodePoint(ur(this.result),this.consumed),this.errors&&(e!==hr.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&mr.VALUE_LENGTH)>>14;for(;t<e.length;){if(i===0&&(r&mr.FLAG13)!==0){let a=(r&mr.BRANCH_LENGTH)>>7;if(this.runConsumed===0){let n=r&mr.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&mr.VALUE_LENGTH)>>14}if(t>=e.length)break;let a=e.charCodeAt(t);if(a===hr.SEMI&&i!==0&&(r&mr.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);if(this.treeIndex=Cr(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===xr.Attribute&&(i===0||yr(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&mr.VALUE_LENGTH)>>14,i!==0){if(a===hr.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==xr.Strict&&(r&mr.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]&mr.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]&~(mr.VALUE_LENGTH|mr.FLAG13):r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case br.NamedEntity:return this.result!==0&&(this.decodeMode!==xr.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case br.NumericDecimal:return this.emitNumericEntity(0,2);case br.NumericHex:return this.emitNumericEntity(0,3);case br.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case br.EntityStart:return 0}}};function Cr(e,t,n,r){let i=(t&mr.BRANCH_LENGTH)>>7,a=t&mr.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 P;(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`})(P||={});var F;(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`})(F||={});function wr(e){return e===P.Space||e===P.NewLine||e===P.Tab||e===P.FormFeed||e===P.CarriageReturn}function Tr(e){return e===P.Slash||e===P.Gt||wr(e)}function Er(e){return e>=P.LowerA&&e<=P.LowerZ||e>=P.UpperA&&e<=P.UpperZ}var Dr;(function(e){e[e.NoValue=0]=`NoValue`,e[e.Unquoted=1]=`Unquoted`,e[e.Single=2]=`Single`,e[e.Double=3]=`Double`})(Dr||={});const Or={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 kr=class{constructor({xmlMode:e=!1,decodeEntities:t=!0},n){this.cbs=n,this.state=F.Text,this.buffer=``,this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=F.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 Sr(e?pr:fr,(e,t)=>this.emitCodePoint(e,t))}reset(){this.state=F.Text,this.buffer=``,this.sectionStart=0,this.index=0,this.baseState=F.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===P.Lt||!this.decodeEntities&&this.fastForwardTo(P.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=F.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&e===P.Amp&&this.startEntity()}stateSpecialStartSequence(e){let t=this.sequenceIndex===this.currentSequence.length;if(!(t?Tr(e):(e|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!t){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=F.InTagName,this.stateInTagName(e)}stateInSpecialTag(e){if(this.sequenceIndex===this.currentSequence.length){if(e===P.Gt||wr(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===Or.TitleEnd?this.decodeEntities&&e===P.Amp&&this.startEntity():this.fastForwardTo(P.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=Number(e===P.Lt)}stateCDATASequence(e){e===Or.Cdata[this.sequenceIndex]?++this.sequenceIndex===Or.Cdata.length&&(this.state=F.InCommentLike,this.currentSequence=Or.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=F.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===Or.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=F.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?!Tr(e):Er(e)}startSpecial(e,t){this.isSpecial=!0,this.currentSequence=e,this.sequenceIndex=t,this.state=F.SpecialStartSequence}stateBeforeTagName(e){if(e===P.ExclamationMark)this.state=F.BeforeDeclaration,this.sectionStart=this.index+1;else if(e===P.Questionmark)this.state=F.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(e)){let t=e|32;this.sectionStart=this.index,this.state=this.xmlMode?F.InTagName:t===Or.ScriptEnd[2]?F.BeforeSpecialS:t===Or.TitleEnd[2]||t===Or.XmpEnd[2]?F.BeforeSpecialT:F.InTagName}else e===P.Slash?this.state=F.BeforeClosingTagName:(this.state=F.Text,this.stateText(e))}stateInTagName(e){Tr(e)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=F.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateBeforeClosingTagName(e){wr(e)||(e===P.Gt?this.state=F.Text:(this.state=this.isTagStartChar(e)?F.InClosingTagName:F.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(e){(e===P.Gt||wr(e))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=F.AfterClosingTagName,this.stateAfterClosingTagName(e))}stateAfterClosingTagName(e){(e===P.Gt||this.fastForwardTo(P.Gt))&&(this.state=F.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(e){e===P.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=F.InSpecialTag,this.sequenceIndex=0):this.state=F.Text,this.sectionStart=this.index+1):e===P.Slash?this.state=F.InSelfClosingTag:wr(e)||(this.state=F.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(e){e===P.Gt?(this.cbs.onselfclosingtag(this.index),this.state=F.Text,this.sectionStart=this.index+1,this.isSpecial=!1):wr(e)||(this.state=F.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateInAttributeName(e){(e===P.Eq||Tr(e))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=F.AfterAttributeName,this.stateAfterAttributeName(e))}stateAfterAttributeName(e){e===P.Eq?this.state=F.BeforeAttributeValue:e===P.Slash||e===P.Gt?(this.cbs.onattribend(Dr.NoValue,this.sectionStart),this.sectionStart=-1,this.state=F.BeforeAttributeName,this.stateBeforeAttributeName(e)):wr(e)||(this.cbs.onattribend(Dr.NoValue,this.sectionStart),this.state=F.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(e){e===P.DoubleQuote?(this.state=F.InAttributeValueDq,this.sectionStart=this.index+1):e===P.SingleQuote?(this.state=F.InAttributeValueSq,this.sectionStart=this.index+1):wr(e)||(this.sectionStart=this.index,this.state=F.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===P.DoubleQuote?Dr.Double:Dr.Single,this.index+1),this.state=F.BeforeAttributeName):this.decodeEntities&&e===P.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(e){this.handleInAttributeValue(e,P.DoubleQuote)}stateInAttributeValueSingleQuotes(e){this.handleInAttributeValue(e,P.SingleQuote)}stateInAttributeValueNoQuotes(e){wr(e)||e===P.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(Dr.Unquoted,this.index),this.state=F.BeforeAttributeName,this.stateBeforeAttributeName(e)):this.decodeEntities&&e===P.Amp&&this.startEntity()}stateBeforeDeclaration(e){e===P.OpeningSquareBracket?(this.state=F.CDATASequence,this.sequenceIndex=0):this.state=e===P.Dash?F.BeforeComment:F.InDeclaration}stateInDeclaration(e){(e===P.Gt||this.fastForwardTo(P.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=F.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(e){(e===P.Gt||this.fastForwardTo(P.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=F.Text,this.sectionStart=this.index+1)}stateBeforeComment(e){e===P.Dash?(this.state=F.InCommentLike,this.currentSequence=Or.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=F.InDeclaration}stateInSpecialComment(e){(e===P.Gt||this.fastForwardTo(P.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=F.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(e){let t=e|32;t===Or.ScriptEnd[3]?this.startSpecial(Or.ScriptEnd,4):t===Or.StyleEnd[3]?this.startSpecial(Or.StyleEnd,4):(this.state=F.InTagName,this.stateInTagName(e))}stateBeforeSpecialT(e){switch(e|32){case Or.TitleEnd[3]:this.startSpecial(Or.TitleEnd,4);break;case Or.TextareaEnd[3]:this.startSpecial(Or.TextareaEnd,4);break;case Or.XmpEnd[3]:this.startSpecial(Or.XmpEnd,4);break;default:this.state=F.InTagName,this.stateInTagName(e)}}startEntity(){this.baseState=this.state,this.state=F.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?xr.Strict:this.baseState===F.Text||this.baseState===F.InSpecialTag?xr.Legacy:xr.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)===P.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===F.Text||this.state===F.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===F.InAttributeValueDq||this.state===F.InAttributeValueSq||this.state===F.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 F.Text:this.stateText(e);break;case F.SpecialStartSequence:this.stateSpecialStartSequence(e);break;case F.InSpecialTag:this.stateInSpecialTag(e);break;case F.CDATASequence:this.stateCDATASequence(e);break;case F.InAttributeValueDq:this.stateInAttributeValueDoubleQuotes(e);break;case F.InAttributeName:this.stateInAttributeName(e);break;case F.InCommentLike:this.stateInCommentLike(e);break;case F.InSpecialComment:this.stateInSpecialComment(e);break;case F.BeforeAttributeName:this.stateBeforeAttributeName(e);break;case F.InTagName:this.stateInTagName(e);break;case F.InClosingTagName:this.stateInClosingTagName(e);break;case F.BeforeTagName:this.stateBeforeTagName(e);break;case F.AfterAttributeName:this.stateAfterAttributeName(e);break;case F.InAttributeValueSq:this.stateInAttributeValueSingleQuotes(e);break;case F.BeforeAttributeValue:this.stateBeforeAttributeValue(e);break;case F.BeforeClosingTagName:this.stateBeforeClosingTagName(e);break;case F.AfterClosingTagName:this.stateAfterClosingTagName(e);break;case F.BeforeSpecialS:this.stateBeforeSpecialS(e);break;case F.BeforeSpecialT:this.stateBeforeSpecialT(e);break;case F.InAttributeValueNq:this.stateInAttributeValueNoQuotes(e);break;case F.InSelfClosingTag:this.stateInSelfClosingTag(e);break;case F.InDeclaration:this.stateInDeclaration(e);break;case F.BeforeDeclaration:this.stateBeforeDeclaration(e);break;case F.BeforeComment:this.stateBeforeComment(e);break;case F.InProcessingInstruction:this.stateInProcessingInstruction(e);break;case F.InEntity:this.stateInEntity()}this.index++}this.cleanup()}finish(){this.state===F.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===F.InCommentLike?this.currentSequence===Or.CdataEnd?this.cbs.oncdata(this.sectionStart,e,0):this.cbs.oncomment(this.sectionStart,e,0):this.state===F.InTagName||this.state===F.BeforeAttributeName||this.state===F.BeforeAttributeValue||this.state===F.AfterAttributeName||this.state===F.InAttributeName||this.state===F.InAttributeValueSq||this.state===F.InAttributeValueDq||this.state===F.InAttributeValueNq||this.state===F.InClosingTagName||this.cbs.ontext(this.sectionStart,e))}emitCodePoint(e,t){this.baseState!==F.Text&&this.baseState!==F.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 Ar=/* @__PURE__ */ new Set([`input`,`option`,`optgroup`,`select`,`button`,`datalist`,`textarea`]),jr=/* @__PURE__ */ new Set([`p`]),Mr=/* @__PURE__ */ new Set([`thead`,`tbody`]),Nr=/* @__PURE__ */ new Set([`dd`,`dt`]),Pr=/* @__PURE__ */ new Set([`rt`,`rp`]),Fr=/* @__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`,jr],[`h1`,jr],[`h2`,jr],[`h3`,jr],[`h4`,jr],[`h5`,jr],[`h6`,jr],[`select`,Ar],[`input`,Ar],[`output`,Ar],[`button`,Ar],[`datalist`,Ar],[`textarea`,Ar],[`option`,/* @__PURE__ */ new Set([`option`])],[`optgroup`,/* @__PURE__ */ new Set([`optgroup`,`option`])],[`dd`,Nr],[`dt`,Nr],[`address`,jr],[`article`,jr],[`aside`,jr],[`blockquote`,jr],[`details`,jr],[`div`,jr],[`dl`,jr],[`fieldset`,jr],[`figcaption`,jr],[`figure`,jr],[`footer`,jr],[`form`,jr],[`header`,jr],[`hr`,jr],[`main`,jr],[`nav`,jr],[`ol`,jr],[`pre`,jr],[`section`,jr],[`table`,jr],[`ul`,jr],[`rt`,Pr],[`rp`,Pr],[`tbody`,Mr],[`tfoot`,Mr]]),Ir=/* @__PURE__ */ new Set([`area`,`base`,`basefont`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`img`,`input`,`isindex`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),Lr=/* @__PURE__ */ new Set([`math`,`svg`]),Rr=/* @__PURE__ */ new Set([`mi`,`mo`,`mn`,`ms`,`mtext`,`annotation-xml`,`foreignobject`,`desc`,`title`]),zr=/\s|\//;var Br=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??kr)(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,lr(e)),this.startIndex=t}isVoidElement(e){return this.htmlMode&&Ir.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&&Fr.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&&(Lr.has(e)?this.foreignContext.unshift(!0):Rr.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&&(Lr.has(u)||Rr.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+=lr(e)}onattribend(e,t){var n,r;this.endIndex=t,(r=(n=this.cbs).onattribute)==null||r.call(n,this.attribname,this.attribvalue,e===Dr.Double?`"`:e===Dr.Single?`'`:e===Dr.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(zr),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)}},Vr=/* @__PURE__ */ s({CDATA:()=>Xr,Comment:()=>Kr,Directive:()=>Gr,Doctype:()=>Zr,ElementType:()=>I,Root:()=>Ur,Script:()=>qr,Style:()=>Jr,Tag:()=>Yr,Text:()=>Wr,isTag:()=>Hr}),I;(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`})(I||={});function Hr(e){return e.type===I.Tag||e.type===I.Script||e.type===I.Style}const Ur=I.Root,Wr=I.Text,Gr=I.Directive,Kr=I.Comment,qr=I.Script,Jr=I.Style,Yr=I.Tag,Xr=I.CDATA,Zr=I.Doctype;var Qr=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 mi(this,e)}},$r=class extends Qr{constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},ei=class extends $r{constructor(){super(...arguments),this.type=I.Text}get nodeType(){return 3}},ti=class extends $r{constructor(){super(...arguments),this.type=I.Comment}get nodeType(){return 8}},ni=class extends $r{constructor(e,t){super(t),this.name=e,this.type=I.Directive}get nodeType(){return 1}},ri=class extends Qr{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}},ii=class extends ri{constructor(){super(...arguments),this.type=I.CDATA}get nodeType(){return 4}},ai=class extends ri{constructor(){super(...arguments),this.type=I.Root}get nodeType(){return 9}},oi=class extends ri{constructor(e,t,n=[],r=e===`script`?I.Script:e===`style`?I.Style:I.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 si(e){return Hr(e)}function ci(e){return e.type===I.CDATA}function li(e){return e.type===I.Text}function ui(e){return e.type===I.Comment}function di(e){return e.type===I.Directive}function fi(e){return e.type===I.Root}function pi(e){return Object.prototype.hasOwnProperty.call(e,`children`)}function mi(e,t=!1){let n;if(li(e))n=new ei(e.data);else if(ui(e))n=new ti(e.data);else if(si(e)){let r=t?hi(e.children):[],i=new oi(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(ci(e)){let r=t?hi(e.children):[],i=new ii(r);r.forEach(e=>e.parent=i),n=i}else if(fi(e)){let r=t?hi(e.children):[],i=new ai(r);r.forEach(e=>e.parent=i),e[`x-mode`]&&(i[`x-mode`]=e[`x-mode`]),n=i}else if(di(e)){let t=new ni(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 hi(e){let t=e.map(e=>mi(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 gi={withStartIndices:!1,withEndIndices:!1,xmlMode:!1};var _i=class{constructor(e,t,n){this.dom=[],this.root=new ai(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof t==`function`&&(n=t,t=gi),typeof e==`object`&&(t=e,e=void 0),this.callback=e??null,this.options=t??gi,this.elementCB=n??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new ai(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 oi(e,t,void 0,this.options.xmlMode?I.Tag:void 0);this.addNode(n),this.tagStack.push(n)}ontext(e){let{lastNode:t}=this;if(t&&t.type===I.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{let t=new ei(e);this.addNode(t),this.lastNode=t}}oncomment(e){if(this.lastNode&&this.lastNode.type===I.Comment){this.lastNode.data+=e;return}let t=new ti(e);this.addNode(t),this.lastNode=t}oncommentend(){this.lastNode=null}oncdatastart(){let e=new ei(``),t=new ii([e]);this.addNode(t),e.parent=t,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,t){let n=new ni(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 vi=/["&'<>$\x80-\uFFFF]/g,yi=/* @__PURE__ */ new Map([[34,`"`],[38,`&`],[39,`'`],[60,`<`],[62,`>`]]),bi=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 xi(e){let t=``,n=0,r;for(;(r=vi.exec(e))!==null;){let i=r.index,a=e.charCodeAt(i),o=yi.get(a);o===void 0?(t+=`${e.substring(n,i)}&#x${bi(e,i).toString(16)};`,n=vi.lastIndex+=Number((a&64512)==55296)):(t+=e.substring(n,i)+o,n=i+1)}return t+e.substr(n)}function Si(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 Ci=Si(/["&\u00A0]/g,/* @__PURE__ */ new Map([[34,`"`],[38,`&`],[160,` `]])),wi=Si(/[&<>\u00A0]/g,/* @__PURE__ */ new Map([[38,`&`],[60,`<`],[62,`>`],[160,` `]])),Ti=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])),Ei=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])),Di=/* @__PURE__ */ new Set([`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`]);function Oi(e){return e.replace(/"/g,`"`)}function ki(e,t){if(!e)return;let n=(t.encodeEntities??t.decodeEntities)===!1?Oi:t.xmlMode||t.encodeEntities!==`utf8`?xi:Ci;return Object.keys(e).map(r=>{let i=e[r]??``;return t.xmlMode===`foreign`&&(r=Ei.get(r)??r),!t.emptyAttrs&&!t.xmlMode&&i===``?r:`${r}="${n(i)}"`}).join(` `)}const Ai=/* @__PURE__ */ new Set([`area`,`base`,`basefont`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`img`,`input`,`isindex`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function ji(e,t={}){let n=`length`in e?e:[e],r=``;for(let e=0;e<n.length;e++)r+=Mi(n[e],t);return r}function Mi(e,t){switch(e.type){case Ur:return ji(e.children,t);case Zr:case Gr:return Ii(e);case Kr:return zi(e);case Xr:return Ri(e);case qr:case Jr:case Yr:return Fi(e,t);case Wr:return Li(e,t)}}const Ni=/* @__PURE__ */ new Set([`mi`,`mo`,`mn`,`ms`,`mtext`,`annotation-xml`,`foreignObject`,`desc`,`title`]),Pi=/* @__PURE__ */ new Set([`svg`,`math`]);function Fi(e,t){t.xmlMode===`foreign`&&(e.name=Ti.get(e.name)??e.name,e.parent&&Ni.has(e.parent.name)&&(t={...t,xmlMode:!1})),!t.xmlMode&&Pi.has(e.name)&&(t={...t,xmlMode:`foreign`});let n=`<${e.name}`,r=ki(e.attribs,t);return r&&(n+=` ${r}`),e.children.length===0&&(t.xmlMode?t.selfClosingTags!==!1:t.selfClosingTags&&Ai.has(e.name))?(t.xmlMode||(n+=` `),n+=`/>`):(n+=`>`,e.children.length>0&&(n+=ji(e.children,t)),(t.xmlMode||!Ai.has(e.name))&&(n+=`</${e.name}>`)),n}function Ii(e){return`<${e.data}>`}function Li(e,t){let n=e.data||``;return(t.encodeEntities??t.decodeEntities)!==!1&&!(!t.xmlMode&&e.parent&&Di.has(e.parent.name))&&(n=t.xmlMode||t.encodeEntities!==`utf8`?xi(n):wi(n)),n}function Ri(e){return`<![CDATA[${e.children[0].data}]]>`}function zi(e){return`<!--${e.data}-->`}function Bi(e,t){return ji(e,t)}function Vi(e,t){return pi(e)?e.children.map(e=>Bi(e,t)).join(``):``}function Hi(e){return Array.isArray(e)?e.map(Hi).join(``):si(e)?e.name===`br`?`
|
|
2
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,n)=>{let r=Object.setPrototypeOf({},null);for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n&1||t(r,Symbol.toStringTag,{value:`Module`}),n&2?r:Object.preventExtensions(r)},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));let u=require("node:fs"),d=require("node:path"),f=require("node:crypto"),p=require("node:child_process"),m=require("node:os"),h=require("node:util"),g=require("node:readline"),_=require("node:net"),v=require("node:url"),y=require("node:timers/promises"),b=require("node:process"),x=require("node:tty"),S=require("node:worker_threads");u=l(u,1),d=l(d,1),f=l(f,1),m=l(m,1),g=l(g,1),_=l(_,1),b=l(b,1);var C=`1.119.0`,w=`11cd36d53eef`;const T=e=>{let t=process.env.RYUGI_PROCESS_TAG?.trim();return`Artideck ${e} (${C}${t?` · ${t}`:``})`},ee=process.platform!==`win32`;function te(e,...t){ee&&(process.title=[T(e),...t].join(` `))}const ne=/^[a-z][a-z0-9-]{0,63}$/;function E(){let e=process.env.RYUGI_PACKAGE;if(e)return ne.test(e)?e:void 0;if(typeof __dirname==`string`)try{let{name:e}=JSON.parse(u.default.readFileSync(d.default.join(__dirname,`..`,`package.json`),`utf8`));return typeof e==`string`&&ne.test(e)?e:void 0}catch{return}}const re=E(),D={"X-Ryugi-Version":C,...re?{"X-Ryugi-Package":re}:{}};function ie(e){e&&(D[`X-Ryugi-Plugins`]=e)}const ae=`properties.json`,oe=e=>!!e&&typeof e==`object`&&!Array.isArray(e),se=e=>oe(e)&&Object.entries(e).every(([e,t])=>/^\d+$/.test(e)&&Number.isSafeInteger(t)&&t>=0),O=e=>oe(e)&&typeof e.name==`string`&&!!e.name.trim()&&e.name.length<=100&&(e.model===void 0||typeof e.model==`string`&&!!e.model&&e.model.length<=200),ce=()=>({version:1,lineage:null,baseline:null,batches:[]});function le(e){let t=JSON.parse(e);if(!oe(t)||t.version!==1||!(t.lineage===null||typeof t.lineage==`string`&&t.lineage&&t.lineage.length<=512)||!(t.baseline===null||se(t.baseline))||t.createdBy!==void 0&&!O(t.createdBy)||!Array.isArray(t.batches)||t.lineage===null!=(t.baseline===null))throw Error(`Invalid document properties`);let n=t.baseline??{};for(let e of t.batches){if(!oe(e)||!se(e.through)||!O(e.by)||Object.entries(n).some(([t,n])=>e.through[t]===void 0||e.through[t]<n))throw Error(`Invalid document attribution batch`);n=e.through}if(t.lineage===null&&t.batches.length)throw Error(`Uninitialized document has attribution batches`);return t}function ue(e){try{return le(u.default.readFileSync(d.default.join(e,ae),`utf8`))}catch(e){if(e.code===`ENOENT`)return;throw e}}function de(e){if(!u.default.existsSync(d.default.join(e,`doc.xml`))){u.default.mkdirSync(e,{recursive:!0});try{u.default.writeFileSync(d.default.join(e,ae),JSON.stringify(ce(),null,2)+`
|
|
3
|
+
`,{flag:`wx`,mode:384})}catch(e){if(e.code!==`EEXIST`)throw e}}}const fe=[`artboard`,`document`,`html`,`whiteboard`,`verify`,`slides`,`report`,`storyboard`],k={artboard:`canvas.json`,document:`doc.xml`,html:`index.html`,whiteboard:`scene.excalidraw`,verify:`verify.xml`,slides:`index.html`,report:`report.tsx`,storyboard:`storyboard.xml`};({...k});const pe=[`html`,`image`,`video`],me=e=>e.type===`image`||e.type===`video`,he=`.artideck`,ge=`.ryugi`,_e=e=>d.default.join(e,he),ve=e=>d.default.join(_e(e),`artifacts`),ye=e=>d.default.join(e,ge),be=e=>{try{return u.default.statSync(e).isDirectory()}catch{return!1}},xe=e=>{try{return u.default.lstatSync(e),!0}catch{return!1}},Se=e=>{try{return u.default.realpathSync(e)}catch{return d.default.resolve(e)}},Ce=e=>!be(_e(e))&&be(ye(e))?ye(e):_e(e),we=e=>Ce(e);function Te(e,t,n){let r;try{r=u.default.readFileSync(e,`utf8`)}catch{return}let i=r.split(t+d.default.sep).join(n+d.default.sep);i!==r&&u.default.writeFileSync(e,i)}async function Ee(e){if(e.env.RYUGI_SERVER_HOME)return{conflicts:[],status:`skipped`};let t=ye(e.home);if(!be(t))return{conflicts:[],status:`none`};let n=_e(e.home);try{await e.stopLegacyHub(d.default.join(t,`server`));let r=null;if(!xe(n))try{u.default.renameSync(t,n),r={conflicts:[],status:`moved`}}catch(e){if(!xe(n))throw e}if(!r){let e=A(t,n);r={conflicts:e.conflicts,status:`merged`,...e.errors.length?{error:e.errors.join(`; `)}:{}}}for(let e of[`dev.json`,d.default.join(`server`,`launch.json`)])Te(d.default.join(n,e),t,n);return r}catch(e){return{conflicts:[],error:e.message,status:`failed`}}}const De=e=>d.default.join(Ce(e),`artifacts`),Oe=e=>be(d.default.join(_e(e),`artifacts`))||be(d.default.join(ye(e),`artifacts`));function ke(e,t){try{let[n,r]=[u.default.lstatSync(e),u.default.lstatSync(t)];return n.isFile()&&r.isFile()&&n.size===r.size&&u.default.readFileSync(e).equals(u.default.readFileSync(t))}catch{return!1}}function A(e,t,n=``,r={conflicts:[],errors:[]}){let i;try{i=u.default.readdirSync(e)}catch(e){return e.code===`ENOENT`||(r.conflicts.push(n),r.errors.push(`${n}: ${e.message}`)),r}for(let a of i){let i=d.default.join(e,a),o=d.default.join(t,a),s=d.default.join(n,a);try{xe(o)?be(i)&&be(o)?A(i,o,s,r):ke(i,o)?u.default.rmSync(i):r.conflicts.push(s):u.default.renameSync(i,o)}catch(e){r.conflicts.push(s),r.errors.push(`${s}: ${e.message}`)}}try{u.default.readdirSync(e).length===0&&u.default.rmdirSync(e)}catch{}return r}function Ae(e){try{return(0,p.execFileSync)(`git`,[`-C`,e,`ls-files`,`-z`,`--`,ge],{stdio:[`ignore`,`pipe`,`ignore`]}).length>0}catch{return!1}}function je(e){let t;try{t=u.default.readFileSync(e,`utf8`)}catch{return!1}let n=t.split(`
|
|
4
|
+
`),r=[],i=!1;for(let[e,t]of n.entries()){if(r.push(t),t.trimStart().startsWith(`#`)||!t.includes(`.ryugi`))continue;let a=t.split(ge).join(he);n.includes(a)||n[e+1]===a||(r.push(a),i=!0)}return i&&u.default.writeFileSync(e,r.join(`
|
|
5
|
+
`)),i}function Me(e){let t=[];for(let n=e;;n=d.default.dirname(n)){t.push(d.default.join(n,`.gitignore`));let r=d.default.join(n,`.git`);if(xe(r))return be(r)&&t.push(d.default.join(r,`info`,`exclude`)),t;if(d.default.dirname(n)===n)return[d.default.join(e,`.gitignore`)]}}function Ne(e){return Me(e).map(e=>je(e)).some(Boolean)}function Pe(e,t={}){let n={status:`none`,conflicts:[],tracked:!1,gitignore:!1};if(t.home&&Se(e)===Se(t.home))return{...n,status:`skipped`};let r=ye(e);if(!be(r))return n;let i=_e(e);if(n.tracked=Ae(e),!xe(i))try{u.default.renameSync(r,i),n.status=`moved`}catch(e){if(!xe(i))return{...n,status:`failed`,error:e.message}}if(n.status===`none`){let e=A(r,i);n.conflicts=e.conflicts,n.status=`merged`,e.errors.length&&(n.error=e.errors.join(`; `))}return n.gitignore=Ne(e),n}const Fe=e=>new Promise(t=>setTimeout(t,e));function Ie(e){try{return process.kill(e,0),!0}catch(e){return e.code===`EPERM`}}function Le(e){try{return u.default.readFileSync(`/proc/${e}/cmdline`,`utf8`).split(`\0`)}catch{}let t=(0,p.spawnSync)(`ps`,[`-ww`,`-p`,String(e),`-o`,`command=`],{encoding:`utf8`});if(t.status===0&&t.stdout.trim())return t.stdout.trim().split(/\s+/);let n=(0,p.spawnSync)(`ps`,[`-f`,`-p`,String(e)],{encoding:`utf8`});if(n.status!==0)return null;let r=n.stdout.split(`
|
|
6
|
+
`).slice(1).join(` `).trim();return r?r.split(/\s+/):null}const Re=e=>/^"(?:node|(?:adeck|ryugi)-daemon(?:-[\w-]+)?)\.exe"/i.test(e.trim());function ze(e){let t=(0,p.spawnSync)(`tasklist`,[`/FI`,`PID eq ${e}`,`/FO`,`CSV`,`/NH`],{encoding:`utf8`,windowsHide:!0});return t.status===0?t.stdout:``}function Be(e,t,n={platform:process.platform,tasklist:ze}){return Ie(e)?n.platform===`win32`?Re(n.tasklist(e)):Le(e)?.includes(`--artifacts-server-id=${t}`)??!1:!1}async function Ve(e,t){for(let n=0;n<t&&Ie(e);n+=100)await Fe(100);return!Ie(e)}const He=e=>{try{return u.default.readFileSync(e,`utf8`).replace(/[\r\n]+$/,``)}catch{return null}};var j=class extends Error{fields;code;constructor(e,t={},n=1){super(e),this.fields=t,this.code=n}};function Ue(e){let t=``;try{t=u.default.realpathSync(m.default.homedir())}catch{}let n=[];for(let r=e;n.push(r),!u.default.existsSync(d.default.join(r,`.git`))||r===t&&e!==t;r=d.default.dirname(r))if(d.default.dirname(r)===r)return e;return n.find(e=>Oe(e))??n.at(-1)}const We=/* @__PURE__ */ new Map,Ge=e=>We.get(e);function Ke(e,t){if(t.status===`none`||t.status===`skipped`||We.has(e))return;We.set(e,t);let n=t.status===`failed`?[`Could not move .ryugi to .artideck in ${e} (${t.error}); using .ryugi this time.`]:[`Moved .ryugi to .artideck in ${e}.`];t.status!==`failed`&&t.error&&n.push(`Part of .ryugi could not be moved: ${t.error}`),t.conflicts.length&&n.push(`${t.conflicts.length} file(s) stay in .ryugi, because .artideck has them too or they could not be moved: ${t.conflicts.slice(0,5).join(`, `)}`),t.tracked&&t.status!==`failed`&&n.push(`Commit the rename: git add -A .ryugi .artideck .gitignore`),process.stderr.write(`${n.join(`
|
|
7
|
+
`)}\n`)}const qe=e=>process.platform===`win32`?u.default.realpathSync.native(e):u.default.realpathSync(e);function Je(e){let t;try{if(t=qe(d.default.resolve(e)),!u.default.statSync(t).isDirectory())throw Error(`Not a directory`)}catch{throw new j(`Project directory not found: ${e}`)}t=Ue(t);let n=De(t),r=d.default.join(n,`.state`);return{project:t,root:n,state:r,pid:d.default.join(r,`server.pid`),log:d.default.join(r,`server.log`),serverId:d.default.join(r,`server-instance-id`),info:d.default.join(r,`server-info`),version:d.default.join(r,`server-version`),owners:d.default.join(r,`owners`),stopped:d.default.join(r,`server-stopped`),lock:d.default.join(r,`start.lock`)}}function Ye(e=m.default.homedir()){if(u.default.existsSync(d.default.join(e,`.artideck`)))return!1;let t=d.default.join(e,ge,`server`);try{let e=Number(u.default.readFileSync(d.default.join(t,`server.pid`),`utf8`).trim()),n=u.default.readFileSync(d.default.join(t,`server-instance-id`),`utf8`).trim();return Number.isInteger(e)&&e>0&&!!n&&Be(e,n)}catch{return!1}}const Xe=/* @__PURE__ */ new Set;function Ze(e,{legacyHubLive:t=Ye,quiet:n=!1}={}){let{project:r}=Je(e);return u.default.existsSync(d.default.join(r,`.ryugi`))&&t()?(!n&&!Xe.has(r)&&process.stderr.write(`An older hub still serves ${r} from .ryugi; it moves to .artideck after ${Qe()} start replaces that hub.\n`),Xe.add(r),Je(r)):(Ke(r,Pe(r,{home:m.default.homedir()})),Je(r))}const Qe=()=>process.env.RYUGI_ARTIFACTS_COMMAND||`adeck`,$e=RegExp(`^(${fe.join(`|`)})/[a-z0-9][a-z0-9-]*$`),et=`--artifact must be <type>/<id>: type ${fe.slice(0,-1).join(`, `)} or ${fe.at(-1)}; id of lowercase letters, digits and hyphens`,tt=[`add`,`reply`,`resolve`,`choose`,`submit`,`answer`,`note`,`pass`,`reject`,`waive`];function nt(){if(process.stdin.isTTY)return``;try{return u.default.readFileSync(0,`utf8`)}catch{return``}}function rt(e){let t=(e.text??nt()).trim();if(!t)throw new j(`The message is empty: pass --text <text> or pipe it on stdin`);return t}function it(e,t){if(e===void 0)return;let n=Number(e);if(!Number.isFinite(n))throw new j(`${t} must be a number`);return n}var at='# Artboard writing\n\nWrite `canvas.json` and board HTML/media under `pages/`. The server keeps a human\'s board positions over a stale write to `canvas.json`; nothing checks board HTML under `pages/`. 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": {\n "file": "pages/settings/retry.html",\n "page": "settings",\n "w": 640,\n "h": 400,\n "title": "Fixed delay",\n "props": { "strategy": "fixed" }\n },\n "q1-b": {\n "file": "pages/settings/retry.html",\n "page": "settings",\n "w": 640,\n "h": 400,\n "title": "Exponential",\n "props": { "strategy": "exponential" }\n }\n },\n "groups": {\n "q1": { "title": "Retry strategy", "boards": ["q1-a", "q1-b"], "choose": true, "recommend": "q1-b" }\n },\n "notes": {\n "round-one": {\n "kind": "title",\n "page": "settings",\n "text": "Delivery settings · round 1",\n "description": "Pick how a failed delivery is retried. Comment on a board, or answer in the terminal."\n }\n }\n}\n```\n\n- **Title**: readable, distinct from the slug.\n- **Boards**: HTML boards require file/page/w/h; x/y, title and interactive are optional. Media boards use type:"image"|"video" and src instead of file. An image board may leave out w/h: without w it takes the image\'s own width, without h the image\'s aspect, so give w to show a 2x screenshot at 1x. A video board needs w/h.\n- **Props**: options of one choice that differ only in a few values (a token, a copy line, a state) are one file. So are options that are the same page with a part added, removed or restyled (an extra line, button or section): props switch those parts (`"recs": true`) and carry their copy. Options that arrange the page differently (navigation moved, regions reordered or regrouped) get their own files and no props, even when much of their content repeats; the parts they share (top bar, table styles, a scene script) go in one stylesheet or script under `pages/` that each file links, never into `tokens.css`. Each board passes what differs as `props`, a JSON object of at most 4096 characters, which the page reads as `window.ryugiProps` before its own scripts run. Props carry only an option\'s departures from `tokens.css` and the page\'s own defaults: CSS variables keyed by their name, other values by what they set. Values that differ per mode go one level down under `light` and `dark`, mode first, then variable: `"short": { "file": "pages/pay/button.html", "props": { "label": "Pay", "light": { "--button-bg": "#2563eb" }, "dark": { "--button-bg": "#3b82f6" } }, ... }`. A value no token holds yet goes into `tokens.css` with a default that changes nothing and still combines with other values (`0 0 0 0 transparent` for a shadow, `transparent` for a colour); props override it. New props reload that board and leave only it for Check. Comment threads and selected nodes include their board\'s props: read them with the 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 current tokens live in one `pages/tokens.css`, linked by every board; never copy token values into each board. Light values sit on `:root, [data-appearance="light"]`, dark ones under `[data-appearance="dark"]`, the attribute the mockup shell also carries, so a light half inside a dark one keeps its own values; a light-only product writes no dark block. An option that changes a token passes only the new value, as props, and its page sets each mode\'s props as CSS variables on the element carrying that mode\'s `data-appearance`; the option showing current values passes none and reads `window.ryugiProps` as `{}`.\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. A group\'s title is its short question; the round\'s title note names the round, so the two never repeat each other.\n- **Notes** require kind (title/sticky/condition), page and text. Titles may leave out x/y; a sticky without x/y needs `beside: <group or board id>`; a condition needs x/y. Sticky w defaults to 240, optional color is #RGB/#RRGGBB.\n- **Titles** name a round or area in one short line: at most 40 full-width or about 70 Latin characters, size defaults to 96. Everything that explains it (what changed, how to answer, where to start) goes in the title\'s `description`, drawn smaller under it and wrapped at 40 characters, or at the title\'s w when that is narrower. A description makes the note taller: keep boards clear of its whole rectangle.\n- **Edges** connect boards that follow one another: see Flows.\n- **Opening view**: activePage is the opening default; existing readers keep their page. Top-level `focus` `{target:<board/group/note>}` guides first ready content/phone question without resetting open camera/drafts. Share ?page=<id> for a new area.\n- **Placement**: leave out x/y and the server places what you wrote as soon as it sees `canvas.json`, so you never read `layout.json` or work out coordinates. A new title goes 120 below everything on its page. A group goes into the last round on its page, or the one `round: <title id>` names: 80 below the round\'s title, 240 below the round\'s previous group, boards left to right in `boards` order, 80 apart. `columns: <n>` wraps a group into rows of n, 160 apart; a verify group of design | actual pairs is `columns: 2`. A board added to a placed group joins its last row. A sticky with `beside` sits 80 to the right of that group or board and follows it when it grows. A rewrite of `canvas.json` that leaves out positions the server placed gets them back. Write x/y only for an arrangement of your own, measured between board rectangles: 80px horizontal board gap, 160px row gap, group frame 144px above and 48px outside its boards, 240px between groups, notes >=80px clear. Check moves apart overlaps among what you changed since the last Check and lists each move under `W_MOVED`; an overlap it cannot settle stays a warning.\n- **Sizes**: desktop1280x800, phone402x874, tablet834x1194, component640x400. A board at any other size (a component, a long page) takes the height its content needs when Check runs, growing or shrinking, and what sits below its row moves with it, so leave its h to Check; `"fit": false` keeps its h. Without agent-browser Check only grows boards. A device size keeps its h. Content taller or wider than its frame is `W_BOARD_CLIPPED`: fix the size or the content. A page whose height comes from the viewport (vh, 100%) only grows once: give it a height of its own.\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), with the board\'s own CSS/scripts inline, linking only `tokens.css`, the shared files above and CDN libraries, html/body margin0. Any npm library loads from a CDN with its version pinned; nothing is preloaded, so use one instead of hand-writing its equivalent. Missing or unfinished files stay pending. Use native, accessible labelled controls with visible state changes. Static by default, though a shared script may render the markup options share; 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. Find names with `adeck icons <english words>` (`adeck icons delete trash`); Check names unknown ones. 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, on the page with page id `verify` (name "Verify"); the viewer shows that page as its own verify entry beside the page menu, not as a design page. 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; the bare `browser_not_run` beside these only says that some board has not run, and clears with them. When the machine has agent-browser (`adeck doctor` lists it), Check loads those boards itself before it answers. Otherwise 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; editing a file several boards share sends all of them back, and a browser showing them reloads and reruns them on its own. With neither, 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- `removed`: elements the human deleted in the preview, omitted when empty; delete each from its file/path unless they say otherwise.\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, removed}\' \'.artideck/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';const ot=e=>t=>{let n=e===`pass`&&!!t.all;if(!n&&!t.group)throw new j(e===`pass`?`comment pass needs --group <groupId>, or --all`:`comment reject needs --group <groupId>`);let r=e===`reject`?rt(t):t.text?.trim();return{op:`verdict`,verdict:e,...n?{all:!0}:{group:t.group},...r?{text:r}:{}}},st={authoring:at,phoneScreens:!0,review:{sections:[`groups`,`rounds`]},commentActions:{pass:ot(`pass`),reject:ot(`reject`),choose:e=>{if(!e.group)throw new j(`comment choose needs --group <groupId>`);if(!e.clear&&!e.board)throw new j(`comment choose needs --board <boardId>, or --clear`);return{op:`choose`,group:e.group,board:e.clear?null:e.board}},submit:e=>{if(!e.round)throw new j(`comment submit needs --round <roundId>`);return{op:`submit`,round:e.round,submit:!e.withdraw}},add:e=>{if(!e.board)throw new j(`comment add on an artboard needs --board <boardId>`);let t=it(e.x,`--x`),n=it(e.y,`--y`);return{op:`add`,board:e.board,...t===void 0?{}:{x:t},...n===void 0?{}:{y:n},text:rt(e)}}}},ct=/^[a-z0-9][a-z0-9-]{0,63}$/,lt=e=>e.type===`ask`;function ut(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 dt(e){let t=[],n=(e,r)=>{lt(e)&&t.push(ut(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 ft=e=>e===null||typeof e==`string`&&e.length<=2e4;function pt(e){let t={};if(e.ask!==void 0){if(typeof e.ask!=`string`||!ct.test(e.ask))return null;t.ask=e.ask}if(e.choice!==void 0){if(!ft(e.choice))return null;t.choice=e.choice}if(e.answer!==void 0){if(!ft(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 mt=(e,t)=>JSON.stringify(pt(e))===JSON.stringify(pt(t)),ht=e=>e.messages.find(e=>!e.deleted);function gt(e,t){return e.map((e,t)=>({thread:e,index:t,message:ht(e)})).filter(e=>e.message&&t(e.thread.anchor)).sort((e,t)=>e.message.at.localeCompare(t.message.at)||e.index-t.index)}function _t(e){let t=new Set(gt(e,e=>e.submit===!1&&e.of!==void 0).map(e=>e.thread.anchor.of));return gt(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 vt(e,t){let n=new Set(_t(t).filter(e=>!e.withdrawn).flatMap(e=>e.asks)),r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map;for(let{thread:e,message:n}of gt(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 gt(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 yt=e=>typeof e==`string`&&e.length>0&&e.length<=200;function bt(e){if(typeof e!=`object`||!e)return null;let t=e;return t.kind===`node`?yt(t.id)?{kind:`node`,id:t.id}:null:t.kind===`edge`&&yt(t.from)&&yt(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 xt(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 St=e=>e.blockIds??[e.blockId],Ct=e=>typeof e==`object`&&!!e,wt={read:e=>{if(!Ct(e)||typeof e.blockId!=`string`||!e.blockId)return null;let{blockIds:t,textRanges:n}=e,r=e.diagram===void 0?void 0:bt(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=pt(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)=>Ct(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)=>mt(e,t)&&e.quote===t.quote&&xt(e.diagram,t.diagram)&&St(e).length===St(t).length&&St(e).every((e,n)=>e===St(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 Tt(e){let t=JSON.parse(e);if(!Ct(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(!Ct(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&&!Ct(e.anchor))throw Error(`threads[${t}] needs an anchor`)}),t}const Et=e=>!!e.id&&(e.author===`human`||e.author===`agent`)&&typeof e.text==`string`&&typeof e.at==`string`;function Dt(e,t=wt){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(Et),a=r.statusBy===`human`||r.statusBy===`agent`?{statusBy:r.statusBy}:{};n.push({id:r.id,anchor:e,status:r.status,statusAt:r.statusAt,...a,...typeof r.statusName==`string`&&{statusName:r.statusName},messages:i})}return{version:1,threads:n}}const Ot=[`claude`,`codex`],kt=e=>Ot.includes(e);function At(e){try{let t=JSON.parse(u.default.readFileSync(d.default.join(e,`prompt.json`),`utf8`));return typeof t.xml!=`string`||typeof t.markdown!=`string`||typeof t.at!=`number`||!kt(t.harness)?null:{xml:t.xml,markdown:t.markdown,at:t.at,harness:t.harness}}catch{return null}}const jt=/* @__PURE__ */ new Set([`br`,`hr`,`img`]),Mt=/<(\/?)([a-z][\w-]*)\b[^>]*?(\/?)>/gi,Nt=[[`<![CDATA[`,`]]>`],[`<!--`,`-->`]];function Pt(e){let t=``,n=0;for(;n<e.length;){let r=Nt.map(([t,r])=>({close:r,index:e.indexOf(t,n)})).filter(({index:e})=>e!==-1).sort((e,t)=>e.index-t.index)[0];if(!r)return t+e.slice(n);t+=e.slice(n,r.index);let i=e.indexOf(r.close,r.index);if(i===-1)return t;n=i+r.close.length}return t}function Ft(e){let t=[];for(let n of Pt(e).matchAll(Mt)){let[,e,r,i]=n,a=r.toLowerCase();if(e){let e=t.pop();if(e!==a)return e?`</${a}> closes <${e}>`:`</${a}> has no opening tag`}else!i&&!jt.has(a)&&t.push(a)}let n=t.at(-1);return n?`<${n}> is never closed`:null}const It=/^assets\/[\w-][\w.-]*\.html$/;function Lt(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 Rt(e){if(e|=0,e<0)throw RangeError(`Wrong ID size`);let t=Buffer.allocUnsafe(e);return Lt(t),t}function zt(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 Bt(e,t=21){if(typeof e!=`string`||!e||e.length>256)return zt(e,t,Rt);for(let n=0;n<e.length;n++)if(e.charCodeAt(n)>255)return zt(e,t,Rt);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){Lt(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;){Lt(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)}}Bt(`57X6y3wQZNzYjJB2L_10pxbackgroundhimselfUTF-8DEMOGRAPHICSVqvt4KW9`);var Vt=null;function Ht(e){Vt=e}function Ut(e){if(!Vt)throw Error(`@haklex/rich-litexml: parseHTML implementation not registered. Import from the main entry (@haklex/rich-litexml), not a deep submodule path.`);return Vt(e)}function Wt(e){let t=e.getAttribute(`id`);return t?{$:{blockId:t}}:{}}var Gt={direction:`ltr`,format:``,indent:0,textFormat:0,textStyle:``,version:1};function Kt(e){e.registerReader(`p`,(e,t)=>({type:`paragraph`,...Wt(e),children:t.parseChildren(e),...Gt}));for(let t=1;t<=6;t++)e.registerReader(`h${t}`,(e,n)=>({type:`heading`,tag:`h${t}`,...Wt(e),children:n.parseChildren(e),...Gt}));e.registerReader(`blockquote`,(e,t)=>{let n=e.getAttribute(`attribution`),r=e.getAttribute(`rich`)!==null||n!==null,i={...Wt(e),children:t.parseChildren(e),...Gt};return r?{type:`rich-quote`,attribution:n?.trim()?n:null,...i}:{type:`quote`,...i}}),e.registerReader(`hr`,e=>({type:`horizontalrule`,...Wt(e),version:1})),e.registerReader(`ul`,(e,t)=>({type:`list`,listType:e.getAttribute(`type`)===`check`?`check`:`bullet`,tag:`ul`,start:1,...Wt(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),...Wt(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`,...Wt(e),...n===null?{}:{checked:n===`true`},children:t.parseChildren(e),...Gt,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`,...Wt(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 qt=`abcdefghijklmnopqrstuvwxyz0123456789`,Jt=Bt(qt,10),Yt=Bt(qt,6),Xt=Bt(qt,6),Zt=Bt(qt,8),Qt=Bt(qt,8);function $t(e){let t=e.getAttribute(`id`);return t?{$:{blockId:t}}:{}}function en(e,t){let n=e.getAttribute(t);return n===null?void 0:Number(n)}var tn=/* @__PURE__ */ new Set([`align-left`,`align-right`,`float-left`,`float-right`]);function nn(e){let t=en(e,`display-width`);return t!==void 0&&Number.isFinite(t)&&t>=10&&t<=100?t:void 0}function rn(e,t){let n=en(e,t);return n!==void 0&&Number.isFinite(n)&&n>0?Math.round(n):void 0}function an(e){let t=nn(e);if(t!==void 0)return{displayWidth:t};let n=rn(e,`fixed-width`);if(n!==void 0)return{fixedWidth:n};let r=rn(e,`fixed-height`);return r===void 0?{}:{fixedHeight:r}}function on(e){let t=e.getAttribute(`layout`);return t!==null&&tn.has(t)?t:void 0}var sn=/* @__PURE__ */ new Set([`auto`,`1:1`,`4:3`,`16:9`,`3:4`]),cn=/* @__PURE__ */ new Set([`cover`,`contain`]);function ln(e){let t=e.getAttribute(`aspect`);return t!==null&&sn.has(t)?t:`auto`}function un(e){let t=e.getAttribute(`fit`);return t!==null&&cn.has(t)?t:`cover`}function dn(e){let t=en(e,`max-item-height`);return t!==void 0&&Number.isFinite(t)&&t>0?t:void 0}function fn(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 pn(e){return fn(e)??e.textContent??``}function mn(e){e.registerReader(`img`,e=>e.parentElement?.tagName.toLowerCase()!==`gallery`&&{type:`image`,...$t(e),src:e.getAttribute(`src`)??``,altText:e.getAttribute(`alt`)??``,width:en(e,`width`),height:en(e,`height`),caption:e.getAttribute(`caption`)??void 0,thumbhash:e.getAttribute(`thumbhash`)??void 0,accent:e.getAttribute(`accent`)??void 0,...an(e),layout:on(e),version:1}),e.registerReader(`video`,e=>({type:`video`,...$t(e),src:e.getAttribute(`src`)??``,poster:e.getAttribute(`poster`)??void 0,width:en(e,`width`),height:en(e,`height`),version:1})),e.registerReader(`attachment`,e=>({type:`file`,...$t(e),src:e.getAttribute(`src`)??``,name:e.getAttribute(`name`)??``,size:en(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`,...$t(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`,...$t(e),url:e.getAttribute(`url`)??``,source:e.getAttribute(`source`)??null,version:1})),e.registerReader(`codeblock`,e=>({type:`code-block`,...$t(e),code:pn(e),language:e.getAttribute(`lang`)??``,version:1})),e.registerReader(`mermaid`,e=>({type:`mermaid`,...$t(e),diagram:pn(e),version:1})),e.registerReader(`math`,e=>{if(e.getAttribute(`display`)===`block`)return{type:`katex-block`,...$t(e),equation:pn(e),version:1};let t=e.getAttribute(`color`);return{type:`katex-inline`,equation:pn(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`,...$t(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`,...$t(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`,...$t(e),content:n,version:1}}),e.registerReader(`details`,(e,t)=>({type:`details`,...$t(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`,...$t(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`,...$t(e),images:t,layout:e.getAttribute(`layout`)??`grid`,aspect:ln(e),fit:un(e),maxItemHeight:dn(e),version:1}}),e.registerReader(`excalidraw`,e=>({type:`excalidraw`,...$t(e),snapshot:fn(e)||e.getAttribute(`snapshot`)||e.textContent?.trim()||``,version:1})),e.registerReader(`chart`,e=>({type:`chart`,...$t(e),spec:pn(e).trim(),version:1})),e.registerReader(`dynamic`,e=>{let t={},n=(fn(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`,...$t(e),url:e.getAttribute(`url`)??``,props:t,initialHeight:en(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`,...$t(e),cols:en(e,`cols`)??2,gap:e.getAttribute(`gap`)??`16px`,cells:n,version:1}}),e.registerReader(`agent-diff`,e=>({type:`agent-diff`,...$t(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:pn(n),language:n.getAttribute(`lang`)??``});return{type:`code-snippet`,...$t(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_${Qt()}`,title:r.getAttribute(`title`)??``,content:{root:{type:`root`,children:t.parseChildren(r),direction:`ltr`,format:``,indent:0,version:1}}});return{type:`steps`,...$t(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_${Xt()}`,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_${Zt()}`,participantId:e.getAttribute(`participant`)??``,content:e.textContent??``})}return{type:`chat`,...$t(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_${Yt()}`;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`,...$t(e),pollId:e.getAttribute(`poll-id`)||`p_${Jt()}`,question:t,options:n,mode:r,...i?{closeAt:i}:{},...o?{showResults:o}:{},version:1}})}var hn=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 gn(e){return e.$?.blockId?{id:e.$.blockId}:{}}function _n(e){e.registerWriter(`paragraph`,(e,t)=>{let n=e;return{tag:`p`,attrs:gn(n),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`heading`,(e,t)=>{let n=e;return{tag:n.tag??`h1`,attrs:gn(n),children:t.serializeChildren(n.children??[])}});let t=(e,t)=>{let n=e,r={...gn(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:gn(e),selfClosing:!0})),e.registerWriter(`list`,(e,t)=>{let n=e,r=n.listType===`number`?`ol`:`ul`,i={...gn(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={...gn(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:gn(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 vn(e){return e.$?.blockId?{id:e.$.blockId}:{}}function yn(e){let t={};for(let[n,r]of Object.entries(e))r!=null&&r!==``&&(t[n]=String(r));return t}function bn(e){e.registerWriter(`image`,e=>{let t=e;return{tag:`img`,attrs:yn({...vn(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:yn({...vn(t),src:t.src,poster:t.poster}),selfClosing:!0}}),e.registerWriter(`file`,e=>{let t=e;return{tag:`attachment`,attrs:yn({...vn(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:yn({...vn(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:yn({...vn(t),url:t.url,source:t.source}),selfClosing:!0}}),e.registerWriter(`code-block`,e=>{let t=e;return{tag:`codeblock`,attrs:yn({...vn(t),lang:t.language}),children:[t.code??``]}}),e.registerWriter(`mermaid`,e=>{let t=e;return{tag:`mermaid`,attrs:vn(t),children:[t.diagram??``]}}),e.registerWriter(`katex-block`,e=>{let t=e;return{tag:`math`,attrs:{...vn(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:yn({...vn(n),type:n.alertType}),children:t.serializeNestedState(n.content)}}),e.registerWriter(`banner`,(e,t)=>{let n=e;return{tag:`banner`,attrs:yn({...vn(n),type:n.bannerType}),children:t.serializeNestedState(n.content)}}),e.registerWriter(`nested-doc`,(e,t)=>{let n=e;return{tag:`nested-doc`,attrs:vn(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:yn(vn(t)),children:[t.snapshot.trim()]}:{tag:`excalidraw`,attrs:yn(vn(t)),children:[{cdata:t.snapshot}]}:{tag:`excalidraw`,attrs:yn(vn(t)),selfClosing:!0}}),e.registerWriter(`chart`,e=>{let t=e,n=typeof t.spec==`string`?t.spec:``;return n?{tag:`chart`,attrs:yn(vn(t)),children:[{cdata:n}]}:{tag:`chart`,attrs:yn(vn(t)),selfClosing:!0}}),e.registerWriter(`dynamic`,e=>{let t=e,n=yn({...vn(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:yn({...vn(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:yn({...vn(t),op:t.opType,entry:t.diffEntryId}),selfClosing:!0}}),e.registerWriter(`details`,(e,t)=>{let n=e;return{tag:`details`,attrs:yn({...vn(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:yn({rt:n.reading}),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`mention`,e=>{let t=e;return{tag:`mention`,attrs:yn({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:vn(t),children:r}}),e.registerWriter(`gallery`,e=>{let t=e,n=(t.images??[]).map(e=>({tag:`img`,attrs:yn({src:e.src,alt:e.alt}),selfClosing:!0}));return{tag:`gallery`,attrs:yn({...vn(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:yn({name:e.filename,lang:e.language}),children:[e.code??``]}));return{tag:`code-snippet`,attrs:vn(t),children:n}}),e.registerWriter(`steps`,(e,t)=>{let n=e,r=(n.steps??[]).map(e=>({tag:`step`,attrs:yn({id:e.id,title:e.title}),children:t.serializeNestedState(e.content)}));return{tag:`steps`,attrs:vn(n),children:r}}),e.registerWriter(`chat`,e=>{let t=e,n={tag:`participants`,children:(t.participants??[]).map(e=>({tag:`participant`,attrs:yn({id:e.id,kind:e.kind,name:e.name,avatar:e.avatar}),children:[]}))},r={tag:`messages`,children:(t.messages??[]).map(e=>({tag:`message`,attrs:yn({id:e.id,participant:e.participantId}),children:[e.content??``]}))};return{tag:`chat`,attrs:yn({...vn(t),variant:t.variant}),children:[n,r]}}),e.registerWriter(`poll`,e=>{let t=e,n=(t.options??[]).map(e=>({tag:`option`,attrs:yn({id:e.id}),children:[e.label??``]}));return{tag:`poll`,attrs:yn({...vn(t),"poll-id":t.pollId,mode:t.mode,"close-at":t.closeAt,"show-results":t.showResults}),children:[{tag:`question`,children:[t.question??``]},...n]}})}function xn(){let e=new hn;return _n(e),Kt(e),bn(e),mn(e),e}var Sn={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 Cn(e){return e.toLowerCase()in Sn}function wn(e){return Sn[e.toLowerCase()]??0}var Tn=/* @__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 En(e){return Tn.has(e.toLowerCase())}var Dn=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),On=/<([\w-]+)((?:\s+[\w-]+(?:\s*=\s*(?:"[^"]*"|'[^']*'))?)*)\s*\/>/g,kn=`<![CDATA[`,An=`]]>`;function jn(e){return e.replaceAll(On,(e,t,n)=>Dn.has(t.toLowerCase())?e:`<${t}${n}></${t}>`)}function Mn(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(kn,n);if(r<0){t.push(jn(e.slice(n)));break}t.push(jn(e.slice(n,r)));let i=e.indexOf(An,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 Nn(e){return Ut(`<!DOCTYPE html><html><body>${Mn(e)}</body></html>`)}function Pn(e,t){let n=Nn(e),r=n.querySelector(`doc`)??n.body;return{root:{type:`root`,children:Ln(t).parseChildren(r),direction:`ltr`,format:``,indent:0,version:1}}}var Fn=/* @__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 In(e){return Fn.has(e.tagName.toLowerCase())}function Ln(e){let t={parseChildren(n){let r=[...n.children].some(e=>!En(e.tagName)),i=In(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(Vn(e,0)),o=``};for(let r of n.childNodes)if(r.nodeType===3)o+=r.textContent??``;else if(r.nodeType===1){s();let n=Rn(r,e,t,0);n&&(Array.isArray(n)?a.push(...n):a.push(n))}return s(),a},parseNestedState(t){return Pn(t,e)}};return t}function Rn(e,t,n,r){let i=e.tagName.toLowerCase();if(Cn(i))return zn(e,t,n,r|wn(i));if(i===`br`)return{type:`linebreak`,version:1};if(i===`node`)return Bn(e);let a=t.getReader(i);if(a){let t=a(e,n);if(t!==!1)return t}return n.parseChildren(e)}function zn(e,t,n,r){let i=[],a=``,o=()=>{a!==``&&(i.push(Vn(a,r)),a=``)};for(let s of e.childNodes)if(s.nodeType===3)a+=s.textContent??``;else if(s.nodeType===1){o();let e=Rn(s,t,n,r);e&&(Array.isArray(e)?i.push(...e):i.push(e))}return o(),i}function Bn(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 Vn(e,t){return{type:`text`,text:e,format:t,detail:0,mode:`normal`,style:``,version:1}}const Hn=Symbol(`changed`),Un=Symbol(`classList`),Wn=Symbol(`CustomElements`),Gn=Symbol(`content`),Kn=Symbol(`dataset`),qn=Symbol(`doctype`),Jn=Symbol(`DOMParser`),M=Symbol(`end`),Yn=Symbol(`EventTarget`),Xn=Symbol(`globals`),Zn=Symbol(`image`),Qn=Symbol(`mime`),$n=Symbol(`MutationObserver`),N=Symbol(`next`),er=Symbol(`ownerElement`),tr=Symbol(`prev`),nr=Symbol(`private`),rr=Symbol(`sheet`),ir=Symbol(`start`),ar=Symbol(`style`),or=Symbol(`upgrade`),sr=Symbol(`value`),cr=/* @__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]]),lr=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 ur(e){return e>=55296&&e<=57343||e>1114111?65533:cr.get(e)??e}function dr(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 fr=/* #__PURE__ */ dr(`QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fA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Y3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg`),pr=/* #__PURE__ */ dr(`AAJhZ2xxBwARABMAFQBtAg0AAAAAAA8AcAAmYG8AcwAnYHQAPmB0ADxg9SFvdCJg`);var mr;(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`})(mr||={});var hr;(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`})(hr||={});function gr(e){return e>=hr.ZERO&&e<=hr.NINE}function _r(e){return e>=hr.UPPER_A&&e<=hr.UPPER_F||e>=hr.LOWER_A&&e<=hr.LOWER_F}function vr(e){return e>=hr.UPPER_A&&e<=hr.UPPER_Z||e>=hr.LOWER_A&&e<=hr.LOWER_Z||gr(e)}function yr(e){return e===hr.EQUALS||vr(e)}var br;(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`})(br||={});var xr;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(xr||={});var Sr=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=br.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=xr.Strict,this.runConsumed=0}startEntity(e){this.decodeMode=e,this.state=br.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(e,t){switch(this.state){case br.EntityStart:return e.charCodeAt(t)===hr.NUM?(this.state=br.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=br.NamedEntity,this.stateNamedEntity(e,t));case br.NumericStart:return this.stateNumericStart(e,t);case br.NumericDecimal:return this.stateNumericDecimal(e,t);case br.NumericHex:return this.stateNumericHex(e,t);case br.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|32)===hr.LOWER_X?(this.state=br.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=br.NumericDecimal,this.stateNumericDecimal(e,t))}stateNumericHex(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(gr(n)||_r(n)){let e=n<=hr.NINE?n-hr.ZERO:(n|32)-hr.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(gr(n))this.result=this.result*10+(n-hr.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===hr.SEMI)this.consumed+=1;else if(this.decodeMode===xr.Strict)return 0;return this.emitCodePoint(ur(this.result),this.consumed),this.errors&&(e!==hr.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&mr.VALUE_LENGTH)>>14;for(;t<e.length;){if(i===0&&(r&mr.FLAG13)!==0){let a=(r&mr.BRANCH_LENGTH)>>7;if(this.runConsumed===0){let n=r&mr.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&mr.VALUE_LENGTH)>>14}if(t>=e.length)break;let a=e.charCodeAt(t);if(a===hr.SEMI&&i!==0&&(r&mr.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);if(this.treeIndex=Cr(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===xr.Attribute&&(i===0||yr(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&mr.VALUE_LENGTH)>>14,i!==0){if(a===hr.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==xr.Strict&&(r&mr.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]&mr.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]&~(mr.VALUE_LENGTH|mr.FLAG13):r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case br.NamedEntity:return this.result!==0&&(this.decodeMode!==xr.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case br.NumericDecimal:return this.emitNumericEntity(0,2);case br.NumericHex:return this.emitNumericEntity(0,3);case br.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case br.EntityStart:return 0}}};function Cr(e,t,n,r){let i=(t&mr.BRANCH_LENGTH)>>7,a=t&mr.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 P;(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`})(P||={});var F;(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`})(F||={});function wr(e){return e===P.Space||e===P.NewLine||e===P.Tab||e===P.FormFeed||e===P.CarriageReturn}function Tr(e){return e===P.Slash||e===P.Gt||wr(e)}function Er(e){return e>=P.LowerA&&e<=P.LowerZ||e>=P.UpperA&&e<=P.UpperZ}var Dr;(function(e){e[e.NoValue=0]=`NoValue`,e[e.Unquoted=1]=`Unquoted`,e[e.Single=2]=`Single`,e[e.Double=3]=`Double`})(Dr||={});const Or={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 kr=class{constructor({xmlMode:e=!1,decodeEntities:t=!0},n){this.cbs=n,this.state=F.Text,this.buffer=``,this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=F.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 Sr(e?pr:fr,(e,t)=>this.emitCodePoint(e,t))}reset(){this.state=F.Text,this.buffer=``,this.sectionStart=0,this.index=0,this.baseState=F.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===P.Lt||!this.decodeEntities&&this.fastForwardTo(P.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=F.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&e===P.Amp&&this.startEntity()}stateSpecialStartSequence(e){let t=this.sequenceIndex===this.currentSequence.length;if(!(t?Tr(e):(e|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!t){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=F.InTagName,this.stateInTagName(e)}stateInSpecialTag(e){if(this.sequenceIndex===this.currentSequence.length){if(e===P.Gt||wr(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===Or.TitleEnd?this.decodeEntities&&e===P.Amp&&this.startEntity():this.fastForwardTo(P.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=Number(e===P.Lt)}stateCDATASequence(e){e===Or.Cdata[this.sequenceIndex]?++this.sequenceIndex===Or.Cdata.length&&(this.state=F.InCommentLike,this.currentSequence=Or.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=F.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===Or.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=F.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?!Tr(e):Er(e)}startSpecial(e,t){this.isSpecial=!0,this.currentSequence=e,this.sequenceIndex=t,this.state=F.SpecialStartSequence}stateBeforeTagName(e){if(e===P.ExclamationMark)this.state=F.BeforeDeclaration,this.sectionStart=this.index+1;else if(e===P.Questionmark)this.state=F.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(e)){let t=e|32;this.sectionStart=this.index,this.state=this.xmlMode?F.InTagName:t===Or.ScriptEnd[2]?F.BeforeSpecialS:t===Or.TitleEnd[2]||t===Or.XmpEnd[2]?F.BeforeSpecialT:F.InTagName}else e===P.Slash?this.state=F.BeforeClosingTagName:(this.state=F.Text,this.stateText(e))}stateInTagName(e){Tr(e)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=F.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateBeforeClosingTagName(e){wr(e)||(e===P.Gt?this.state=F.Text:(this.state=this.isTagStartChar(e)?F.InClosingTagName:F.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(e){(e===P.Gt||wr(e))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=F.AfterClosingTagName,this.stateAfterClosingTagName(e))}stateAfterClosingTagName(e){(e===P.Gt||this.fastForwardTo(P.Gt))&&(this.state=F.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(e){e===P.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=F.InSpecialTag,this.sequenceIndex=0):this.state=F.Text,this.sectionStart=this.index+1):e===P.Slash?this.state=F.InSelfClosingTag:wr(e)||(this.state=F.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(e){e===P.Gt?(this.cbs.onselfclosingtag(this.index),this.state=F.Text,this.sectionStart=this.index+1,this.isSpecial=!1):wr(e)||(this.state=F.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateInAttributeName(e){(e===P.Eq||Tr(e))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=F.AfterAttributeName,this.stateAfterAttributeName(e))}stateAfterAttributeName(e){e===P.Eq?this.state=F.BeforeAttributeValue:e===P.Slash||e===P.Gt?(this.cbs.onattribend(Dr.NoValue,this.sectionStart),this.sectionStart=-1,this.state=F.BeforeAttributeName,this.stateBeforeAttributeName(e)):wr(e)||(this.cbs.onattribend(Dr.NoValue,this.sectionStart),this.state=F.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(e){e===P.DoubleQuote?(this.state=F.InAttributeValueDq,this.sectionStart=this.index+1):e===P.SingleQuote?(this.state=F.InAttributeValueSq,this.sectionStart=this.index+1):wr(e)||(this.sectionStart=this.index,this.state=F.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===P.DoubleQuote?Dr.Double:Dr.Single,this.index+1),this.state=F.BeforeAttributeName):this.decodeEntities&&e===P.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(e){this.handleInAttributeValue(e,P.DoubleQuote)}stateInAttributeValueSingleQuotes(e){this.handleInAttributeValue(e,P.SingleQuote)}stateInAttributeValueNoQuotes(e){wr(e)||e===P.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(Dr.Unquoted,this.index),this.state=F.BeforeAttributeName,this.stateBeforeAttributeName(e)):this.decodeEntities&&e===P.Amp&&this.startEntity()}stateBeforeDeclaration(e){e===P.OpeningSquareBracket?(this.state=F.CDATASequence,this.sequenceIndex=0):this.state=e===P.Dash?F.BeforeComment:F.InDeclaration}stateInDeclaration(e){(e===P.Gt||this.fastForwardTo(P.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=F.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(e){(e===P.Gt||this.fastForwardTo(P.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=F.Text,this.sectionStart=this.index+1)}stateBeforeComment(e){e===P.Dash?(this.state=F.InCommentLike,this.currentSequence=Or.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=F.InDeclaration}stateInSpecialComment(e){(e===P.Gt||this.fastForwardTo(P.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=F.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(e){let t=e|32;t===Or.ScriptEnd[3]?this.startSpecial(Or.ScriptEnd,4):t===Or.StyleEnd[3]?this.startSpecial(Or.StyleEnd,4):(this.state=F.InTagName,this.stateInTagName(e))}stateBeforeSpecialT(e){switch(e|32){case Or.TitleEnd[3]:this.startSpecial(Or.TitleEnd,4);break;case Or.TextareaEnd[3]:this.startSpecial(Or.TextareaEnd,4);break;case Or.XmpEnd[3]:this.startSpecial(Or.XmpEnd,4);break;default:this.state=F.InTagName,this.stateInTagName(e)}}startEntity(){this.baseState=this.state,this.state=F.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?xr.Strict:this.baseState===F.Text||this.baseState===F.InSpecialTag?xr.Legacy:xr.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)===P.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===F.Text||this.state===F.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===F.InAttributeValueDq||this.state===F.InAttributeValueSq||this.state===F.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 F.Text:this.stateText(e);break;case F.SpecialStartSequence:this.stateSpecialStartSequence(e);break;case F.InSpecialTag:this.stateInSpecialTag(e);break;case F.CDATASequence:this.stateCDATASequence(e);break;case F.InAttributeValueDq:this.stateInAttributeValueDoubleQuotes(e);break;case F.InAttributeName:this.stateInAttributeName(e);break;case F.InCommentLike:this.stateInCommentLike(e);break;case F.InSpecialComment:this.stateInSpecialComment(e);break;case F.BeforeAttributeName:this.stateBeforeAttributeName(e);break;case F.InTagName:this.stateInTagName(e);break;case F.InClosingTagName:this.stateInClosingTagName(e);break;case F.BeforeTagName:this.stateBeforeTagName(e);break;case F.AfterAttributeName:this.stateAfterAttributeName(e);break;case F.InAttributeValueSq:this.stateInAttributeValueSingleQuotes(e);break;case F.BeforeAttributeValue:this.stateBeforeAttributeValue(e);break;case F.BeforeClosingTagName:this.stateBeforeClosingTagName(e);break;case F.AfterClosingTagName:this.stateAfterClosingTagName(e);break;case F.BeforeSpecialS:this.stateBeforeSpecialS(e);break;case F.BeforeSpecialT:this.stateBeforeSpecialT(e);break;case F.InAttributeValueNq:this.stateInAttributeValueNoQuotes(e);break;case F.InSelfClosingTag:this.stateInSelfClosingTag(e);break;case F.InDeclaration:this.stateInDeclaration(e);break;case F.BeforeDeclaration:this.stateBeforeDeclaration(e);break;case F.BeforeComment:this.stateBeforeComment(e);break;case F.InProcessingInstruction:this.stateInProcessingInstruction(e);break;case F.InEntity:this.stateInEntity()}this.index++}this.cleanup()}finish(){this.state===F.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===F.InCommentLike?this.currentSequence===Or.CdataEnd?this.cbs.oncdata(this.sectionStart,e,0):this.cbs.oncomment(this.sectionStart,e,0):this.state===F.InTagName||this.state===F.BeforeAttributeName||this.state===F.BeforeAttributeValue||this.state===F.AfterAttributeName||this.state===F.InAttributeName||this.state===F.InAttributeValueSq||this.state===F.InAttributeValueDq||this.state===F.InAttributeValueNq||this.state===F.InClosingTagName||this.cbs.ontext(this.sectionStart,e))}emitCodePoint(e,t){this.baseState!==F.Text&&this.baseState!==F.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 Ar=/* @__PURE__ */ new Set([`input`,`option`,`optgroup`,`select`,`button`,`datalist`,`textarea`]),jr=/* @__PURE__ */ new Set([`p`]),Mr=/* @__PURE__ */ new Set([`thead`,`tbody`]),Nr=/* @__PURE__ */ new Set([`dd`,`dt`]),Pr=/* @__PURE__ */ new Set([`rt`,`rp`]),Fr=/* @__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`,jr],[`h1`,jr],[`h2`,jr],[`h3`,jr],[`h4`,jr],[`h5`,jr],[`h6`,jr],[`select`,Ar],[`input`,Ar],[`output`,Ar],[`button`,Ar],[`datalist`,Ar],[`textarea`,Ar],[`option`,/* @__PURE__ */ new Set([`option`])],[`optgroup`,/* @__PURE__ */ new Set([`optgroup`,`option`])],[`dd`,Nr],[`dt`,Nr],[`address`,jr],[`article`,jr],[`aside`,jr],[`blockquote`,jr],[`details`,jr],[`div`,jr],[`dl`,jr],[`fieldset`,jr],[`figcaption`,jr],[`figure`,jr],[`footer`,jr],[`form`,jr],[`header`,jr],[`hr`,jr],[`main`,jr],[`nav`,jr],[`ol`,jr],[`pre`,jr],[`section`,jr],[`table`,jr],[`ul`,jr],[`rt`,Pr],[`rp`,Pr],[`tbody`,Mr],[`tfoot`,Mr]]),Ir=/* @__PURE__ */ new Set([`area`,`base`,`basefont`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`img`,`input`,`isindex`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),Lr=/* @__PURE__ */ new Set([`math`,`svg`]),Rr=/* @__PURE__ */ new Set([`mi`,`mo`,`mn`,`ms`,`mtext`,`annotation-xml`,`foreignobject`,`desc`,`title`]),zr=/\s|\//;var Br=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??kr)(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,lr(e)),this.startIndex=t}isVoidElement(e){return this.htmlMode&&Ir.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&&Fr.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&&(Lr.has(e)?this.foreignContext.unshift(!0):Rr.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&&(Lr.has(u)||Rr.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+=lr(e)}onattribend(e,t){var n,r;this.endIndex=t,(r=(n=this.cbs).onattribute)==null||r.call(n,this.attribname,this.attribvalue,e===Dr.Double?`"`:e===Dr.Single?`'`:e===Dr.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(zr),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)}},Vr=/* @__PURE__ */ s({CDATA:()=>Xr,Comment:()=>Kr,Directive:()=>Gr,Doctype:()=>Zr,ElementType:()=>I,Root:()=>Ur,Script:()=>qr,Style:()=>Jr,Tag:()=>Yr,Text:()=>Wr,isTag:()=>Hr}),I;(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`})(I||={});function Hr(e){return e.type===I.Tag||e.type===I.Script||e.type===I.Style}const Ur=I.Root,Wr=I.Text,Gr=I.Directive,Kr=I.Comment,qr=I.Script,Jr=I.Style,Yr=I.Tag,Xr=I.CDATA,Zr=I.Doctype;var Qr=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 mi(this,e)}},$r=class extends Qr{constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},ei=class extends $r{constructor(){super(...arguments),this.type=I.Text}get nodeType(){return 3}},ti=class extends $r{constructor(){super(...arguments),this.type=I.Comment}get nodeType(){return 8}},ni=class extends $r{constructor(e,t){super(t),this.name=e,this.type=I.Directive}get nodeType(){return 1}},ri=class extends Qr{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}},ii=class extends ri{constructor(){super(...arguments),this.type=I.CDATA}get nodeType(){return 4}},ai=class extends ri{constructor(){super(...arguments),this.type=I.Root}get nodeType(){return 9}},oi=class extends ri{constructor(e,t,n=[],r=e===`script`?I.Script:e===`style`?I.Style:I.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 si(e){return Hr(e)}function ci(e){return e.type===I.CDATA}function li(e){return e.type===I.Text}function ui(e){return e.type===I.Comment}function di(e){return e.type===I.Directive}function fi(e){return e.type===I.Root}function pi(e){return Object.prototype.hasOwnProperty.call(e,`children`)}function mi(e,t=!1){let n;if(li(e))n=new ei(e.data);else if(ui(e))n=new ti(e.data);else if(si(e)){let r=t?hi(e.children):[],i=new oi(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(ci(e)){let r=t?hi(e.children):[],i=new ii(r);r.forEach(e=>e.parent=i),n=i}else if(fi(e)){let r=t?hi(e.children):[],i=new ai(r);r.forEach(e=>e.parent=i),e[`x-mode`]&&(i[`x-mode`]=e[`x-mode`]),n=i}else if(di(e)){let t=new ni(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 hi(e){let t=e.map(e=>mi(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 gi={withStartIndices:!1,withEndIndices:!1,xmlMode:!1};var _i=class{constructor(e,t,n){this.dom=[],this.root=new ai(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof t==`function`&&(n=t,t=gi),typeof e==`object`&&(t=e,e=void 0),this.callback=e??null,this.options=t??gi,this.elementCB=n??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new ai(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 oi(e,t,void 0,this.options.xmlMode?I.Tag:void 0);this.addNode(n),this.tagStack.push(n)}ontext(e){let{lastNode:t}=this;if(t&&t.type===I.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{let t=new ei(e);this.addNode(t),this.lastNode=t}}oncomment(e){if(this.lastNode&&this.lastNode.type===I.Comment){this.lastNode.data+=e;return}let t=new ti(e);this.addNode(t),this.lastNode=t}oncommentend(){this.lastNode=null}oncdatastart(){let e=new ei(``),t=new ii([e]);this.addNode(t),e.parent=t,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,t){let n=new ni(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 vi=/["&'<>$\x80-\uFFFF]/g,yi=/* @__PURE__ */ new Map([[34,`"`],[38,`&`],[39,`'`],[60,`<`],[62,`>`]]),bi=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 xi(e){let t=``,n=0,r;for(;(r=vi.exec(e))!==null;){let i=r.index,a=e.charCodeAt(i),o=yi.get(a);o===void 0?(t+=`${e.substring(n,i)}&#x${bi(e,i).toString(16)};`,n=vi.lastIndex+=Number((a&64512)==55296)):(t+=e.substring(n,i)+o,n=i+1)}return t+e.substr(n)}function Si(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 Ci=Si(/["&\u00A0]/g,/* @__PURE__ */ new Map([[34,`"`],[38,`&`],[160,` `]])),wi=Si(/[&<>\u00A0]/g,/* @__PURE__ */ new Map([[38,`&`],[60,`<`],[62,`>`],[160,` `]])),Ti=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])),Ei=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])),Di=/* @__PURE__ */ new Set([`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`]);function Oi(e){return e.replace(/"/g,`"`)}function ki(e,t){if(!e)return;let n=(t.encodeEntities??t.decodeEntities)===!1?Oi:t.xmlMode||t.encodeEntities!==`utf8`?xi:Ci;return Object.keys(e).map(r=>{let i=e[r]??``;return t.xmlMode===`foreign`&&(r=Ei.get(r)??r),!t.emptyAttrs&&!t.xmlMode&&i===``?r:`${r}="${n(i)}"`}).join(` `)}const Ai=/* @__PURE__ */ new Set([`area`,`base`,`basefont`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`img`,`input`,`isindex`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function ji(e,t={}){let n=`length`in e?e:[e],r=``;for(let e=0;e<n.length;e++)r+=Mi(n[e],t);return r}function Mi(e,t){switch(e.type){case Ur:return ji(e.children,t);case Zr:case Gr:return Ii(e);case Kr:return zi(e);case Xr:return Ri(e);case qr:case Jr:case Yr:return Fi(e,t);case Wr:return Li(e,t)}}const Ni=/* @__PURE__ */ new Set([`mi`,`mo`,`mn`,`ms`,`mtext`,`annotation-xml`,`foreignObject`,`desc`,`title`]),Pi=/* @__PURE__ */ new Set([`svg`,`math`]);function Fi(e,t){t.xmlMode===`foreign`&&(e.name=Ti.get(e.name)??e.name,e.parent&&Ni.has(e.parent.name)&&(t={...t,xmlMode:!1})),!t.xmlMode&&Pi.has(e.name)&&(t={...t,xmlMode:`foreign`});let n=`<${e.name}`,r=ki(e.attribs,t);return r&&(n+=` ${r}`),e.children.length===0&&(t.xmlMode?t.selfClosingTags!==!1:t.selfClosingTags&&Ai.has(e.name))?(t.xmlMode||(n+=` `),n+=`/>`):(n+=`>`,e.children.length>0&&(n+=ji(e.children,t)),(t.xmlMode||!Ai.has(e.name))&&(n+=`</${e.name}>`)),n}function Ii(e){return`<${e.data}>`}function Li(e,t){let n=e.data||``;return(t.encodeEntities??t.decodeEntities)!==!1&&!(!t.xmlMode&&e.parent&&Di.has(e.parent.name))&&(n=t.xmlMode||t.encodeEntities!==`utf8`?xi(n):wi(n)),n}function Ri(e){return`<![CDATA[${e.children[0].data}]]>`}function zi(e){return`<!--${e.data}-->`}function Bi(e,t){return ji(e,t)}function Vi(e,t){return pi(e)?e.children.map(e=>Bi(e,t)).join(``):``}function Hi(e){return Array.isArray(e)?e.map(Hi).join(``):si(e)?e.name===`br`?`
|
|
8
8
|
`:Hi(e.children):ci(e)?Hi(e.children):li(e)?e.data:``}function Ui(e){return Array.isArray(e)?e.map(Ui).join(``):pi(e)&&!ui(e)?Ui(e.children):li(e)?e.data:``}function Wi(e){return Array.isArray(e)?e.map(Wi).join(``):pi(e)&&(e.type===I.Tag||ci(e))?Wi(e.children):li(e)?e.data:``}function Gi(e){return pi(e)?e.children:[]}function Ki(e){return e.parent||null}function qi(e){let t=Ki(e);if(t!=null)return Gi(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 Ji(e,t){return e.attribs?.[t]}function Yi(e,t){return e.attribs!=null&&Object.prototype.hasOwnProperty.call(e.attribs,t)&&e.attribs[t]!=null}function Xi(e){return e.name}function Zi(e){let{next:t}=e;for(;t!==null&&!si(t);)({next:t}=t);return t}function Qi(e){let{prev:t}=e;for(;t!==null&&!si(t);)({prev:t}=t);return t}function $i(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 ea(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 ta(e,t){if($i(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 na(e,t){$i(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 ra(e,t){if($i(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 ia(e,t){$i(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 aa(e,t,n=!0,r=1/0){return oa(e,Array.isArray(t)?t:[t],n,r)}function oa(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&&pi(t)&&t.children.length>0&&(o.unshift(0),a.unshift(t.children))}}function sa(e,t){return t.find(e)}function ca(e,t,n=!0){let r=Array.isArray(t)?t:[t];for(let t=0;t<r.length;t++){let i=r[t];if(si(i)&&e(i))return i;if(n&&pi(i)&&i.children.length>0){let t=ca(e,i.children,!0);if(t)return t}}return null}function la(e,t){return(Array.isArray(t)?t:[t]).some(t=>si(t)&&e(t)||pi(t)&&la(e,t.children))}function ua(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]++];si(t)&&e(t)&&n.push(t),pi(t)&&t.children.length>0&&(i.unshift(0),r.unshift(t.children))}}const da={tag_name(e){return typeof e==`function`?t=>si(t)&&e(t.name):e===`*`?si:t=>si(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=>li(t)&&e(t.data):t=>li(t)&&t.data===e}};function fa(e,t){return typeof t==`function`?n=>si(n)&&t(n.attribs[e]):n=>si(n)&&n.attribs[e]===t}function pa(e,t){return n=>e(n)||t(n)}function ma(e){let t=Object.keys(e).map(t=>{let n=e[t];return Object.prototype.hasOwnProperty.call(da,t)?da[t](n):fa(t,n)});return t.length===0?null:t.reduce(pa)}function ha(e,t){let n=ma(e);return!n||n(t)}function ga(e,t,n,r=1/0){let i=ma(e);return i?aa(i,t,n,r):[]}function _a(e,t,n=!0){return Array.isArray(t)||(t=[t]),ca(fa(`id`,e),t,n)}function va(e,t,n=!0,r=1/0){return aa(da.tag_name(e),t,n,r)}function ya(e,t,n=!0,r=1/0){return aa(fa(`class`,e),t,n,r)}function ba(e,t,n=!0,r=1/0){return aa(da.tag_type(e),t,n,r)}function xa(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 Sa;(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`})(Sa||={});function Ca(e,t){let n=[],r=[];if(e===t)return 0;let i=pi(e)?e:e.parent;for(;i;)n.unshift(i),i=i.parent;for(i=pi(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 Sa.DISCONNECTED;let s=n[o-1],c=s.children,l=n[o],u=r[o];return c.indexOf(l)>c.indexOf(u)?s===t?Sa.FOLLOWING|Sa.CONTAINED_BY:Sa.FOLLOWING:s===e?Sa.PRECEDING|Sa.CONTAINS:Sa.PRECEDING}function wa(e){return e=e.filter((e,t,n)=>!n.includes(e,t+1)),e.sort((e,t)=>{let n=Ca(e,t);return n&Sa.PRECEDING?-1:n&Sa.FOLLOWING?1:0}),e}function Ta(e){let t=ja(Pa,e);return t?t.name===`feed`?Ea(t):Da(t):null}function Ea(e){let t=e.children,n={type:`atom`,items:va(`entry`,t).map(e=>{let{children:t}=e,n={media:Aa(t)};Na(n,`id`,`id`,t),Na(n,`title`,`title`,t);let r=ja(`link`,t)?.attribs.href;r&&(n.link=r);let i=Ma(`summary`,t)||Ma(`content`,t);i&&(n.description=i);let a=Ma(`updated`,t);return a&&(n.pubDate=new Date(a)),n})};Na(n,`id`,`id`,t),Na(n,`title`,`title`,t);let r=ja(`link`,t)?.attribs.href;r&&(n.link=r),Na(n,`description`,`subtitle`,t);let i=Ma(`updated`,t);return i&&(n.updated=new Date(i)),Na(n,`author`,`email`,t,!0),n}function Da(e){let t=ja(`channel`,e.children)?.children??[],n={type:e.name.substr(0,3),id:``,items:va(`item`,e.children).map(e=>{let{children:t}=e,n={media:Aa(t)};Na(n,`id`,`guid`,t),Na(n,`title`,`title`,t),Na(n,`link`,`link`,t),Na(n,`description`,`description`,t);let r=Ma(`pubDate`,t)||Ma(`dc:date`,t);return r&&(n.pubDate=new Date(r)),n})};Na(n,`title`,`title`,t),Na(n,`link`,`link`,t),Na(n,`description`,`description`,t);let r=Ma(`lastBuildDate`,t);return r&&(n.updated=new Date(r)),Na(n,`author`,`managingEditor`,t,!0),n}const Oa=[`url`,`type`,`lang`],ka=[`fileSize`,`bitrate`,`framerate`,`samplingrate`,`channels`,`duration`,`height`,`width`];function Aa(e){return va(`media:content`,e).map(e=>{let{attribs:t}=e,n={medium:t.medium,isDefault:!!t.isDefault};for(let e of Oa)t[e]&&(n[e]=t[e]);for(let e of ka)t[e]&&(n[e]=parseInt(t[e],10));return t.expression&&(n.expression=t.expression),n})}function ja(e,t){return va(e,t,!0,1)[0]}function Ma(e,t,n=!1){return Ui(va(e,t,n,1)).trim()}function Na(e,t,n,r,i=!1){let a=Ma(n,r,i);a&&(e[t]=a)}function Pa(e){return e===`rss`||e===`feed`||e===`rdf:RDF`}var Fa=/* @__PURE__ */ s({DocumentPosition:()=>Sa,append:()=>na,appendChild:()=>ta,compareDocumentPosition:()=>Ca,existsOne:()=>la,filter:()=>aa,find:()=>oa,findAll:()=>ua,findOne:()=>ca,findOneChild:()=>sa,getAttributeValue:()=>Ji,getChildren:()=>Gi,getElementById:()=>_a,getElements:()=>ga,getElementsByClassName:()=>ya,getElementsByTagName:()=>va,getElementsByTagType:()=>ba,getFeed:()=>Ta,getInnerHTML:()=>Vi,getName:()=>Xi,getOuterHTML:()=>Bi,getParent:()=>Ki,getSiblings:()=>qi,getText:()=>Hi,hasAttrib:()=>Yi,hasChildren:()=>pi,innerText:()=>Wi,isCDATA:()=>ci,isComment:()=>ui,isDocument:()=>fi,isTag:()=>si,isText:()=>li,nextElementSibling:()=>Zi,prepend:()=>ia,prependChild:()=>ra,prevElementSibling:()=>Qi,removeElement:()=>$i,removeSubsets:()=>xa,replaceElement:()=>ea,testElement:()=>ha,textContent:()=>Ui,uniqueSort:()=>wa}),Ia=/* @__PURE__ */ s({DefaultHandler:()=>_i,DomHandler:()=>_i,DomUtils:()=>Fa,ElementType:()=>Vr,Parser:()=>Br,QuoteType:()=>Dr,Tokenizer:()=>kr,createDocumentStream:()=>za,createDomStream:()=>Ba,getFeed:()=>Ta,parseDOM:()=>Ra,parseDocument:()=>La,parseFeed:()=>Ha});function La(e,t){let n=new _i(void 0,t);return new Br(n,t).end(e),n.root}function Ra(e,t){return La(e,t).children}function za(e,t,n){let r=new _i(t=>e(t,r.root),t,n);return new Br(r,t)}function Ba(e,t,n){return new Br(new _i(e,t,n),t)}const Va={xmlMode:!0};function Ha(e,t=Va){return Ta(Ra(e,t))}const Ua=/* @__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(`.`)),Wa=`http://www.w3.org/2000/svg`,{assign:Ga,create:Ka,defineProperties:qa,entries:Ja,getOwnPropertyDescriptors:Ya,keys:Xa,setPrototypeOf:Za}=Object,Qa=String,$a=e=>e.nodeType===1?e[M]:e,eo=({ownerDocument:e})=>e[Qn].ignoreCase,to=(e,t)=>{e[N]=t,t[tr]=e},no=(e,t,n)=>{to(e,t),to($a(t),n)},ro=(e,t,n,r)=>{to(e,t),to($a(n),r)},io=(e,t,n)=>{to(e,t),to(t,n)},ao=({localName:e,ownerDocument:t})=>t[Qn].ignoreCase?e.toUpperCase():e,oo=(e,t)=>{e&&(e[N]=t),t&&(t[tr]=e)},so=(e,t)=>{let n=e.createDocumentFragment(),r=e.createElement(``);r.innerHTML=t;let{firstChild:i,lastChild:a}=r;if(i){ro(n,i,a,n[M]);let e=i;do e.parentNode=n;while(e!==a&&(e=$a(e)[N]))}return n},co=/* @__PURE__ */ new WeakMap;let lo=!1;const uo=/* @__PURE__ */ new WeakMap,fo=/* @__PURE__ */ new WeakMap,po=(e,t,n,r)=>{lo&&fo.has(e)&&e.attributeChangedCallback&&e.constructor.observedAttributes.includes(t)&&e.attributeChangedCallback(t,n,r)},mo=(e,t)=>n=>{if(fo.has(n)){let r=fo.get(n);r.connected!==t&&n.isConnected===t&&(r.connected=t,e in n&&n[e]())}},ho=mo(`connectedCallback`,!0),go=e=>{if(lo){ho(e),co.has(e)&&(e=co.get(e).shadowRoot);let{[N]:t,[M]:n}=e;for(;t!==n;)t.nodeType===1&&ho(t),t=t[N]}},_o=mo(`disconnectedCallback`,!1),vo=e=>{if(lo){_o(e),co.has(e)&&(e=co.get(e).shadowRoot);let{[N]:t,[M]:n}=e;for(;t!==n;)t.nodeType===1&&_o(t),t=t[N]}};var yo=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(uo.has(t))throw Error(`unable to redefine the same class: `+t);this.active=lo=!0;let{extends:o}=n;uo.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(fo.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=Ja(e);for(let[t]of o)delete e[t];Za(e,i.prototype),t[or]={element:e,values:o},new i(t,r),fo.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(uo.has(e)){let{localName:t}=uo.get(e);return t}return null}};const{Parser:bo}=Ia,xo=(e,t,n)=>{let r=e[M];return t.parentNode=e,no(r[tr],t,r),n&&t.nodeType===1&&go(t),t},So=(e,t,n,r,i)=>{n[sr]=r,n.ownerElement=e,io(t[tr],n,t),n.name===`class`&&(e.className=r),i&&po(e,n.name,null,r)},Co=(e,t,n)=>{let{active:r,registry:i}=e[Wn],a=e,o=null,s=!1,c=new bo({onprocessinginstruction(t,n){t.toLowerCase()===`!doctype`&&(e.doctype=n.slice(t.length).trim())},onopentag(n,s){let c=!0;if(t){if(o)a=xo(a,e.createElementNS(Wa,n),r),a.ownerSVGElement=o,c=!1;else if(n===`svg`||n===`SVG`)o=e.createElementNS(Wa,n),a=xo(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=xo(a,new t,r),delete s.is,c=!1}}}c&&(a=xo(a,e.createElement(n),!1));let l=a[M];for(let t of Xa(s))So(a,l,e.createAttribute(t),s[t],r)},oncomment(t){xo(a,e.createComment(t),r)},ontext(t){s?xo(a,e.createCDATASection(t),r):xo(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},wo=/* @__PURE__ */ new Map,To=(e,t)=>{for(let n of[].concat(e))wo.set(n,t),wo.set(n.toUpperCase(),t)},Eo=({[N]:e,[M]:t},n)=>{for(;e!==t;){switch(e.nodeType){case 2:Do(e,n);break;case 3:case 8:case 4:Oo(e,n);break;case 1:jo(e,n),e=$a(e);break;case 10:Ao(e,n)}e=e[N]}let r=n.length-1,i=n[r];typeof i==`number`&&i<0?n[r]+=-1:n.push(-1)},Do=(e,t)=>{t.push(2,e.name);let n=e[sr].trim();n&&t.push(n)},Oo=(e,t)=>{let n=e[sr];n.trim()&&t.push(e.nodeType,n)},ko=(e,t)=>{t.push(e.nodeType),Eo(e,t)},Ao=({name:e,publicId:t,systemId:n},r)=>{r.push(10,e),t&&r.push(t),n&&r.push(n)},jo=(e,t)=>{t.push(1,e.localName),Eo(e,t)},Mo=(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}),No=(e,t,n,r,i,a)=>{if(!r||r.includes(n)){let{callback:r,records:o,scheduled:s}=e;o.push(Mo(`attributes`,t,null,[],[],n,i?a:void 0)),s||(e.scheduled=!0,Promise.resolve().then(()=>{e.scheduled=!1,r(o.splice(0),e)}))}},Po=(e,t,n)=>{let{ownerDocument:r}=e,{active:i,observers:a}=r[$n];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)){No(i,e,t,l,u,n);break}}else if(c&&a===e){No(i,e,t,l,u,n);break}}},Fo=(e,t)=>{let{ownerDocument:n}=e,{active:r,observers:i}=n[$n];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(Mo(`childList`,i,e,t?[]:[e],t?[e]:[])),o||(r.scheduled=!0,Promise.resolve().then(()=>{r.scheduled=!1,n(a.splice(0),r)}));break}}};var Io=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[$n].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[$n].active=!0}takeRecords(){return this.records.splice(0)}}}};const Lo=/* @__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(`.`)),Ro=(e,t)=>{let{[sr]:n,name:r}=t;t.ownerElement=e,io(e,t,e[N]),r===`class`&&(e.className=n),Po(e,r,null),po(e,r,null,n)},zo=(e,t)=>{let{[sr]:n,name:r}=t;to(t[tr],t[N]),t.ownerElement=t[tr]=t[N]=null,r===`class`&&(e[Un]=null),Po(e,r,n),po(e,r,n,null)},L={get(e,t){return e.hasAttribute(t)},set(e,t,n){n?e.setAttribute(t,``):e.removeAttribute(t)}},Bo={get(e,t){return parseFloat(e.getAttribute(t)||0)},set(e,t,n){e.setAttribute(t,n)}},R={get(e,t){return e.getAttribute(t)||``},set(e,t,n){e.setAttribute(t,n)}},Vo=/* @__PURE__ */ new WeakMap;function Ho(e,t){return typeof t==`function`?t.call(e.target,e):t.handleEvent(e),e._stopImmediatePropagationFlag}function Uo({currentTarget:e,target:t}){let n=Vo.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),Ho(this,e))break;return delete this.currentTarget,delete this.target,this.cancelBubble}}var Wo=class{constructor(){Vo.set(this,/* @__PURE__ */ new Map)}_getParent(){return null}addEventListener(e,t,n){let r=Vo.get(this);r.has(e)||r.set(e,/* @__PURE__ */ new Map),r.get(e).set(t,n)}removeEventListener(e,t){let n=Vo.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(Uo,e),e._path=[],e.eventPhase=e.NONE,!e.defaultPrevented}},Go=class extends Array{item(e){return e<this.length?this[e]:null}};const Ko=({parentNode:e})=>{let t=0;for(;e;)t++,e=e.parentNode;return t};var qo=class extends Wo{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[N]=null,this[tr]=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}
|
|
9
9
|
/* c8 ignore start */
|
|
10
10
|
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 Go}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``}
|
|
@@ -497,7 +497,7 @@ case`navigator`:return{userAgent:`Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/53
|
|
|
497
497
|
/* c8 ignore stop */
|
|
498
498
|
case`window`:return dv.get(this);case`customElements`:return this[Wn].registry||(this[Wn]=new yo(this)),this[Wn];case`performance`:return e.performance;case`DOMParser`:return this[Jn];case`Image`:return this[Zn]||(this[Zn]=iv(this)),this[Zn];case`MutationObserver`:return this[$n].class||(this[$n]=new Io(this)),this[$n].class}return this[Xn]&&this[Xn][t]||uv[t]||e[t]}})),dv.get(this)}get doctype(){let e=this[qn];if(e)return e;let{firstChild:t}=this;return t&&t.nodeType===10?this[qn]=t:null}set doctype(e){if(/^([a-z:]+)(\s+system|\s+public(\s+"([^"]+)")?)?(\s+"([^"]+)")?/i.test(e)){let{$1:e,$4:t,$6:n}=RegExp;this[qn]=new wu(this,e,t,n),io(this,this[qn],this[N])}}get documentElement(){return this.firstElementChild}get isConnected(){return!0}_getParent(){return this[Yn]}createAttribute(e){return new es(this,e)}createCDATASection(e){return new ps(this,e)}createComment(e){return new ms(this,e)}createDocumentFragment(){return new Cu(this)}createDocumentType(e,t,n){return new wu(this,e,t,n)}createElement(e){return new Qu(this,e)}createRange(){let e=new ov;return e.commonAncestorContainer=this,e}createTextNode(e){return new vu(this,e)}createTreeWalker(e,t=-1){return new cv(e,t)}createNodeIterator(e,t=-1){return this.createTreeWalker(e,t)}createEvent(e){let t=Ka(e===`Event`?new Ku(``):new nv(``));return t.initEvent=t.initCustomEvent=(e,n=!1,r=!1,i)=>{t.bubbles=!!n,qa(t,{type:{value:e},canBubble:{value:n},cancelable:{value:r},detail:{value:i}})},t}cloneNode(e=!1){let{constructor:t,[Wn]:n,[qn]:r}=this,i=new t;if(i[Wn]=n,e){let e=i[M],{childNodes:t}=this;for(let{length:n}=t,r=0;r<n;r++)i.insertBefore(t[r].cloneNode(!0),e);r&&(i[qn]=t[0])}return i}importNode(e){let t=1<arguments.length&&!!arguments[1],n=e.cloneNode(t),{[Wn]:r}=this,{active:i}=r,a=e=>{let{ownerDocument:t,nodeType:n}=e;e.ownerDocument=this,i&&t!==this&&n===1&&r.upgrade(e)};if(a(n),t)switch(n.nodeType){case 1:case 11:{let{[N]:e,[M]:t}=n;for(;e!==t;)e.nodeType===1&&a(e),e=e[N];break}}return n}toString(){return this.childNodes.join(``)}querySelector(e){return lv(super.querySelector,this,e)}querySelectorAll(e){return lv(super.querySelectorAll,this,e)}
|
|
499
499
|
/* c8 ignore start */
|
|
500
|
-
getElementsByTagNameNS(e,t){return this.getElementsByTagName(t)}createAttributeNS(e,t){return this.createAttribute(t)}createElementNS(e,t,n){return e===`http://www.w3.org/2000/svg`?new td(this,t,null):this.createElement(t,n)}};Za(uv.Document=function(){nd()},fv).prototype=fv.prototype;const pv=(e,t,n,r)=>{if(!t&&wo.has(n))return new(wo.get(n))(e,n);let{[Wn]:{active:i,registry:a}}=e;if(i){let i=t?r.is:n;if(a.has(i)){let{Class:t}=a.get(i),r=new t(e,n);return fo.set(r,{connected:!1}),r}}return new H(e,n)};var mv=class extends fv{constructor(){super(`text/html`)}get all(){let e=new Go,{[N]:t,[M]:n}=this;for(;t!==n;)t.nodeType===1&&e.push(t),t=t[N];return e}get head(){let{documentElement:e}=this,{firstElementChild:t}=e;return t&&t.tagName===`HEAD`||(t=this.createElement(`head`),e.prepend(t)),t}get body(){let{head:e}=this,{nextElementSibling:t}=e;return t&&t.tagName===`BODY`||(t=this.createElement(`body`),e.after(t)),t}get title(){let{head:e}=this;return e.getElementsByTagName(`title`).at(0)?.textContent||``}set title(e){let{head:t}=this,n=t.getElementsByTagName(`title`).at(0);n?n.textContent=e:t.insertBefore(this.createElement(`title`),t.firstChild).textContent=e}createElement(e,t){let n=!!(t&&t.is),r=pv(this,n,e,t);return n&&r.setAttribute(`is`,t.is),r}},hv=class extends fv{constructor(){super(`image/svg+xml`)}toString(){return this[Qn].docType+super.toString()}},gv=class extends fv{constructor(){super(`text/xml`)}toString(){return this[Qn].docType+super.toString()}},_v=class e{parseFromString(t,n,r=null){let i=!1,a;return n===`text/html`?(i=!0,a=new mv):a=n===`image/svg+xml`?new hv:new gv,a[Jn]=e,r&&(a[Xn]=r),i&&t===`...`&&(t=`<!doctype html><html><head></head><body></body></html>`),t?Co(a,i,t):a}};const{parse:vv}=JSON,yv=(e,t=null)=>new _v().parseFromString(e,`text/html`,t).defaultView;function bv(){nd()}Za(bv,fv).prototype=fv.prototype,Ut(e=>yv(e).document);const xv=`spoiler`,Sv=/<!\[CDATA\[[\s\S]*?\]\]>|<!--[\s\S]*?-->/g;RegExp(`<(/?)${xv}(?=[\\s/>])([^>]*?)(/?)>`,`gi`);function Cv(e,t){let n=``,r=0;for(let i of e.matchAll(Sv))n+=t(e.slice(r,i.index))+i[0],r=i.index+i[0].length;return n+t(e.slice(r))}function wv(e,t,n){let r=RegExp(`<(/?)${t}(?=[\\s/>])`,`gi`);return Cv(e,e=>e.replaceAll(r,(e,t)=>t?`</${xv}`:`<${xv} ${n}="1"`))}const Tv=`data-ryugi-ask`,Ev=e=>wv(e,`ask`,Tv);function Dv(e){let t=e.getReader(xv);e.registerReader(xv,(e,n)=>{if(!e.hasAttribute(Tv))return t?t(e,n):!1;let r=[...e.querySelectorAll(`option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent??``})),i=e.getAttribute(`recommend`),a=e.getAttribute(`placeholder`);return{type:`ask`,version:1,askId:e.getAttribute(`id`)??``,...i===null?{}:{recommend:i},...a?{placeholder:a}:{},options:r}}),e.registerWriter(`ask`,e=>{let t=e,n={[Tv]:`1`,id:t.askId,...t.recommend?{recommend:t.recommend}:{},...t.placeholder?{placeholder:t.placeholder}:{}};return t.options.length?{tag:xv,attrs:n,children:t.options.map(e=>({tag:`option`,attrs:{value:e.value},children:[e.label]}))}:{tag:xv,attrs:n,selfClosing:!0}})}const Ov=/<(\/?)(ask|option)\b[^>]*?(\/?)>/gi;function kv(e){let t=0;for(let n of Ft(e).matchAll(Ov)){let[,e,r,i]=n;if(r.toLowerCase()===`ask`)i||(t+=e?-1:1);else if(!e&&t===0)return`<option> belongs inside <ask>`}return null}function Av(e,t){let n=e.askId;if(!lt.test(n))return`<ask> needs an id of lowercase letters, digits and hyphens`;if(t.has(n))return`<ask id="${n}"> appears twice; every question needs its own id`;t.add(n);let r=/* @__PURE__ */ new Set;for(let t of e.options){if(!t.value)return`<ask id="${n}"> has an <option> with an empty value`;if(r.has(t.value))return`<ask id="${n}"> repeats the option value "${t.value}"`;if(r.add(t.value),!t.label.trim())return`<ask id="${n}"> has an <option> with an empty label`}return e.recommend!==void 0&&!r.has(e.recommend)?`<ask id="${n}"> recommend="${e.recommend}" is not one of its option values. Allowed values: ${[...r].join(`, `)||`(none; omit recommend)`}. Example: ${r.size?`recommend="${[...r][0]}"`:`<ask id="${n}" />`}`:null}function jv(e){let t=/* @__PURE__ */ new Set,n=(e,r)=>{if(ut(e))return r===`root`?`<ask> belongs inside a paragraph, list item or table cell`:Av(e,t);for(let t of e.children??[]){let r=n(t,e.type);if(r)return r}return null};for(let t of e.root.children){let e=n(t,`root`);if(e)return e}return null}const Mv=[{type:`document`,refAttribute:`document`,subTargets:[`block`],splitPane:!0},{type:`artboard`,refAttribute:`artboard`,subTargets:[`group`,`board`],splitPane:!0},{type:`whiteboard`,refAttribute:`whiteboard`,subTargets:[`page`,`frame`],splitPane:!0},{type:`html`,refAttribute:`html`,subTargets:[],splitPane:!0},{type:`slides`,refAttribute:`slides`,subTargets:[`slide`],splitPane:!0},{type:`report`,refAttribute:`report`,subTargets:[`block`],splitPane:!0},{type:`storyboard`,refAttribute:`storyboard`,subTargets:[`shot`],splitPane:!0},{type:`verify`,refAttribute:`verify`,subTargets:[],splitPane:!0}],Nv=Mv.map(e=>e.refAttribute),Pv=[...new Set(Mv.flatMap(e=>e.subTargets))];function Fv(e){return Mv.find(t=>t.type===e)??null}const Iv=e=>e.type===`ref`,Lv=e=>Nv.filter(t=>e[t]!==void 0),Rv=e=>{let t={};for(let n of Nv)e[n]!==void 0&&(t[n]=e[n]);e.to&&(t.to=e.to);for(let n of Pv)e[n]&&(t[n]=e[n]);return e.embed!==void 0&&(t.embed=e.embed),e.label&&(t.label=e.label),t},zv=e=>Lv(e)[0]??`artboard`,Bv=e=>e[zv(e)]??``,Vv=e=>e.frame??(e.page?`page:${e.page}`:void 0)??e.group??e.board??e.slide??e.block??e.shot??``,Hv=/* @__PURE__ */ RegExp(`^[a-z0-9][a-z0-9-]*$`),Uv=/* @__PURE__ */ RegExp(`^(?:[\\w-]{21}|[a-f0-9]{32})$`);function Wv(e){let t=``,n=new Uint8Array(e*2);for(;t.length<e;){crypto.getRandomValues(n);for(let r of n)if(!(r>=248)&&(t+=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`[r%62],t.length===e))break}return t}const Gv=()=>Wv(21),Kv=e=>Hv.test(e),qv=e=>Uv.test(e),Jv=e=>pe.includes(e),Yv=`main`,Xv=`pages.json`,Zv=`pages`,Qv=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,$v=e=>typeof e==`string`&&e.length<=64&&Qv.test(e),ey=e=>e===`main`?`scene.excalidraw`:`${Zv}/${e}.excalidraw`,ty=e=>{if(typeof e!=`object`||!e)return null;let{id:t,name:n,deleted:r}=e;return typeof t==`string`?{id:t,...typeof n==`string`&&n.trim()?{name:n.trim()}:{},...r===!0?{deleted:!0}:{}}:null};function ny(e){if(e===null)return{pages:[]};let t;try{t=JSON.parse(e)}catch{return{pages:[],error:`pages.json is not valid JSON`}}let n=t?.pages;return Array.isArray(n)?{pages:n.map(ty).filter(e=>e!==null)}:{pages:[],error:`pages.json needs a "pages" array`}}function ry(e,t){let n=[],r=/* @__PURE__ */ new Set,i=[];for(let t of e)$v(t.id)?r.has(t.id)?n.push(`pages.json: page ${t.id} is listed twice; only the first is kept`):(r.add(t.id),i.push(t)):n.push(`pages.json: page id "${t.id}" must be lowercase letters, digits and hyphens`);let a=i.findIndex(e=>e.id===Yv);i.length>0&&a!==0&&n.push(`pages.json: main is always the first page; it was moved to the top`);let o=a===-1?{id:Yv}:i.splice(a,1)[0];o.deleted&&n.push(`pages.json: main can’t be deleted; its "deleted" is ignored`);let{deleted:s,...c}=o,l=[c,...i];for(let e of t)$v(e)&&e!==`main`&&!r.has(e)&&(r.add(e),l.push({id:e}),n.push(`pages/${e}.excalidraw is not in pages.json; add it there`));return l.length>50&&n.push(`pages.json lists ${l.length} pages; only the first 50 are used`),{pages:l.slice(0,50),warnings:n}}const iy={document:`a document`,artboard:`an artboard`,whiteboard:`a whiteboard`,html:`an html page`,slides:`a deck`,report:`a report`,storyboard:`a storyboard`,verify:`a verify report`},ay=[`artboard`,`whiteboard`,`document`,`html`,`slides`,`report`,`storyboard`,`verify`],oy=e=>e.length===1?e[0]:`${e.slice(0,-1).join(`, `)} or ${e.at(-1)}`;function sy(e,t=`ref`,n=ay){let r=t===`ref`?`reference`:t,i=Lv(e);if(i.length>1)return`<${t}> names one target: either ${oy(i.map(e=>iy[e]))}, not both`;let a=i[0];if(!a)return`<${t}> needs ${oy(n.map(e=>iy[e]))}: the slug of one in this project`;let o=e[a]??``,s=`<${t} ${a}="${o}">`;if(!n.includes(a))return`${s} names ${iy[a]}: an <${t}> takes ${oy(n.map(e=>iy[e]))}`;if(e.embed!==void 0&&a!==`whiteboard`)return`<${t} ${a}="${o}" embed="${e.embed}">: only a whiteboard reference embeds; ${iy[a]} ${r} is a chip`;if(e.embed!==void 0&&e.embed!==`true`)return`<${t} ${a}="${o}" embed="${e.embed}">: write embed="true" to embed the whiteboard, or leave embed out for a chip`;if(!Kv(o))return`${s} is not ${iy[a].replace(/ page$/,``)} slug: lowercase letters, digits and hyphens`;let c=Fv(a)?.subTargets??[],l=Pv.filter(t=>e[t]!==void 0);for(let e of l){if(c.includes(e))continue;let t=Mv.filter(t=>t.subTargets.includes(e)).map(e=>e.type),n=c.length?`${iy[a]} ${r} takes ${oy(c)}`:`${iy[a]} ${r} takes no sub-target`;return`${s} has no ${e}: ${e} belongs to ${oy(t)} ${r}s; ${n}`}return l.length>1?`${s} names either a ${l[0]} or a ${l[1]}, not both`:e.page!==void 0&&!$v(e.page)?`<${t} ${a}="${o}" page="${e.page}"> is not a page id: lowercase letters, digits and hyphens`:null}const cy=`data-ryugi-ref`,ly=e=>wv(e,`ref`,cy);function uy(e){let t=e.getReader(xv);e.registerReader(xv,(e,n)=>{if(!e.hasAttribute(cy))return t?t(e,n):!1;let r={};for(let t of[...Nv,`to`,...Pv,`embed`]){let n=e.getAttribute(t);n!==null&&(r[t]=n)}return r.label=e.textContent??void 0,{type:`ref`,version:1,...Rv(r)}}),e.registerWriter(`ref`,e=>{let t=Rv(e),n={[cy]:`1`};for(let e of[...Nv,`to`,...Pv,`embed`]){let r=t[e];r!==void 0&&(n[e]=r)}return t.label?{tag:xv,attrs:n,children:[t.label]}:{tag:xv,attrs:n,selfClosing:!0}})}const dy=e=>[...e.content?.root?.children?[e.content.root.children]:[],...(e.steps??[]).flatMap(e=>e.content?.root?.children?[e.content.root.children]:[])],fy=e=>Iv(e)&&e.embed!==void 0,py=e=>{let t=e.type===`paragraph`&&e.children?.length===1?e.children[0]:null;return t&&Iv(t)&&t.embed!==void 0?t:null};function my(e){let t=e.root.children.map(e=>{let t=py(e);return t?{...t,...e.$?{$:e.$}:{}}:e});return{...e,root:{...e.root,children:t}}}const hy=e=>`<ref whiteboard="${e.whiteboard??``}" embed="${e.embed}">: an embedded whiteboard needs a paragraph of its own directly in the document, with nothing else in it`;function gy(e){let t=(e,r)=>{if(Iv(e))return sy(e)||(e.embed===void 0?r===`root`?`<ref> belongs inside a paragraph, list item or table cell`:null:r===`root`?null:hy(e));for(let n of e.children??[]){let r=t(n,e.type);if(r)return r}for(let t of dy(e)){let e=n(t);if(e)return e}return null},n=e=>{for(let t of e){if(fy(t))return hy(t);let e=n(t.children??[])??dy(t).reduce((e,t)=>e??n(t),null);if(e)return e}return null};for(let n of e.root.children){let e=t(n,`root`);if(e)return e}return null}const _y=/* @__PURE__ */ `doc.p.h1.h2.h3.h4.h5.h6.blockquote.ul.ol.li.table.tr.th.td.hr.img.codeblock.mermaid.excalidraw.chart.math.alert.details.steps.step.footnote-section.def.dynamic.pending`.split(`.`),vy=[`b`,`strong`,`i`,`em`,`u`,`s`,`del`,`strike`,`code`,`sub`,`sup`,`mark`,`a`,`br`,`footnote`,`ask`,`option`,`ref`],yy=/* @__PURE__ */ new Set([..._y,...vy]),by=/* @__PURE__ */ new Set([`agent-diff`,`attachment`,`banner`,`chat`,`code-snippet`,`comment`,`embed`,`gallery`,`grid`,`link-card`,`mention`,`nested-doc`,`poll`,`ruby`,`spoiler`,`tag`,`video`]),xy=xn();Dv(xy),uy(xy),xy.registerReader(`pending`,e=>{let t=e.getAttribute(`id`);return{type:`pending`,...t?{$:{blockId:t}}:{},intent:e.getAttribute(`intent`)??``,version:1}}),xy.registerWriter(`pending`,e=>{let{$:t,intent:n}=e;return{tag:`pending`,attrs:{...t?.blockId?{id:t.blockId}:{},intent:n??``},selfClosing:!0}});var Sy=class extends Error{};const Cy=/<dynamic\b[^>]*(?<!\/)>([\s\S]*?)<\/dynamic>/gi,wy=/<footnote-section\b[\s\S]*?<\/footnote-section>/gi,Ty=/<def[\s>/]/i,Ey=/^\s*<!\[CDATA\[([\s\S]*)\]\]>\s*$/;function Dy(e){for(let t of Ft(e).matchAll(Nt)){let e=t[2].toLowerCase();if(!yy.has(e))return by.has(e)?`<${e}> is not supported in documents`:`<${e}> is not a LiteXML tag`}return null}function Oy(e){return Ty.test(Ft(e).replaceAll(wy,``))?`<def> belongs inside <footnote-section>`:null}function ky(e){for(let t of e.matchAll(Cy)){let e=t[1],n=(Ey.exec(e)?.[1]??e).trim();if(n){try{let e=JSON.parse(n);if(e&&typeof e==`object`&&!Array.isArray(e))continue}catch{}return`<dynamic> props must be a JSON object`}}return null}function Ay(e){return Array.isArray(e)?e.some(Ay):!e||typeof e!=`object`?!1:e.type===`pending`||Object.values(e).some(Ay)}const jy=e=>e.some(e=>e.type!==`pending`&&Ay(e))?`<pending> must be a top-level block`:null;function My(e){for(let t of e){if(t.type===`dynamic`&&!Lt.test(t.url??``))return`<dynamic> url must be assets/<name>.html`;let e=My(t.children??[]);if(e)return e}return null}function Ny(e){let t=/^\s*<doc[\s>]/.test(e)?e:`<doc>${e}</doc>`,n=It(t)??Dy(t)??Oy(t)??kv(t)??ky(t);if(n)throw new Sy(n);let r;try{r=my(Pn(ly(Ev(t)),xy))}catch(e){throw new Sy(e.message)}let i=My(r.root.children)??jy(r.root.children)??jv(r)??gy(r);if(i)throw new Sy(i);return r}const Py=`任务 prompt(不是文档内容,开任务时写的):`,Fy=[`document`,`html`,`artboard`,`whiteboard`,`slides`],Iy=[`group`,`board`,`frame`,`page`,`slide`],Ly=e=>typeof e==`string`?e:``;function Ry(e){let t=Fy.find(t=>typeof e[t]==`string`);if(!t)return``;let n=Iy.find(t=>typeof e[t]==`string`);return`${t}/${Ly(e[t])}${n?`#${Ly(e[n])}`:``}`}function zy(e,t){if(t&16)return`\`${e}\``;let n=e;return t&32&&(n=`<sub>${n}</sub>`),t&64&&(n=`<sup>${n}</sup>`),t&4&&(n=`~~${n}~~`),t&2&&(n=`*${n}*`),t&1&&(n=`**${n}**`),n}function By(e,t){return e.options.find(e=>e.value===t)?.label??t??``}function Vy(e,t){let n=Ly(e.askId),r=e.options??[],i=t.get(n),a=i&&(i.state===`submitted`||i.state===`settled`);if(a&&i.staleChoice)return`[chosen (stale): ${i.staleChoice}]`;if(a&&i.text)return`[chosen: ${i.text}]`;if(a&&i.choice)return`[chosen: ${By({...i,options:r},i.choice)}]`;let o=Ly(e.recommend);return o?`[recommended: ${r.find(e=>e.value===o)?.label??o}]`:`[open]`}var Hy=class{views;constructor(e){this.views=e}inline(e=[]){return e.map(e=>this.inlineNode(e)).join(``)}inlineNode(e){switch(e.type){case`text`:return zy(Ly(e.text),Number(e.format)||0);case`linebreak`:return`
|
|
500
|
+
getElementsByTagNameNS(e,t){return this.getElementsByTagName(t)}createAttributeNS(e,t){return this.createAttribute(t)}createElementNS(e,t,n){return e===`http://www.w3.org/2000/svg`?new td(this,t,null):this.createElement(t,n)}};Za(uv.Document=function(){nd()},fv).prototype=fv.prototype;const pv=(e,t,n,r)=>{if(!t&&wo.has(n))return new(wo.get(n))(e,n);let{[Wn]:{active:i,registry:a}}=e;if(i){let i=t?r.is:n;if(a.has(i)){let{Class:t}=a.get(i),r=new t(e,n);return fo.set(r,{connected:!1}),r}}return new H(e,n)};var mv=class extends fv{constructor(){super(`text/html`)}get all(){let e=new Go,{[N]:t,[M]:n}=this;for(;t!==n;)t.nodeType===1&&e.push(t),t=t[N];return e}get head(){let{documentElement:e}=this,{firstElementChild:t}=e;return t&&t.tagName===`HEAD`||(t=this.createElement(`head`),e.prepend(t)),t}get body(){let{head:e}=this,{nextElementSibling:t}=e;return t&&t.tagName===`BODY`||(t=this.createElement(`body`),e.after(t)),t}get title(){let{head:e}=this;return e.getElementsByTagName(`title`).at(0)?.textContent||``}set title(e){let{head:t}=this,n=t.getElementsByTagName(`title`).at(0);n?n.textContent=e:t.insertBefore(this.createElement(`title`),t.firstChild).textContent=e}createElement(e,t){let n=!!(t&&t.is),r=pv(this,n,e,t);return n&&r.setAttribute(`is`,t.is),r}},hv=class extends fv{constructor(){super(`image/svg+xml`)}toString(){return this[Qn].docType+super.toString()}},gv=class extends fv{constructor(){super(`text/xml`)}toString(){return this[Qn].docType+super.toString()}},_v=class e{parseFromString(t,n,r=null){let i=!1,a;return n===`text/html`?(i=!0,a=new mv):a=n===`image/svg+xml`?new hv:new gv,a[Jn]=e,r&&(a[Xn]=r),i&&t===`...`&&(t=`<!doctype html><html><head></head><body></body></html>`),t?Co(a,i,t):a}};const{parse:vv}=JSON,yv=(e,t=null)=>new _v().parseFromString(e,`text/html`,t).defaultView;function bv(){nd()}Za(bv,fv).prototype=fv.prototype,Ht(e=>yv(e).document);const xv=`spoiler`,Sv=/<!\[CDATA\[[\s\S]*?\]\]>|<!--[\s\S]*?-->/g;RegExp(`<(/?)${xv}(?=[\\s/>])([^>]*?)(/?)>`,`gi`);function Cv(e,t){let n=``,r=0;for(let i of e.matchAll(Sv))n+=t(e.slice(r,i.index))+i[0],r=i.index+i[0].length;return n+t(e.slice(r))}function wv(e,t,n){let r=RegExp(`<(/?)${t}(?=[\\s/>])`,`gi`);return Cv(e,e=>e.replaceAll(r,(e,t)=>t?`</${xv}`:`<${xv} ${n}="1"`))}const Tv=`data-ryugi-ask`,Ev=e=>wv(e,`ask`,Tv);function Dv(e){let t=e.getReader(xv);e.registerReader(xv,(e,n)=>{if(!e.hasAttribute(Tv))return t?t(e,n):!1;let r=[...e.querySelectorAll(`option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent??``})),i=e.getAttribute(`recommend`),a=e.getAttribute(`placeholder`);return{type:`ask`,version:1,askId:e.getAttribute(`id`)??``,...i===null?{}:{recommend:i},...a?{placeholder:a}:{},options:r}}),e.registerWriter(`ask`,e=>{let t=e,n={[Tv]:`1`,id:t.askId,...t.recommend?{recommend:t.recommend}:{},...t.placeholder?{placeholder:t.placeholder}:{}};return t.options.length?{tag:xv,attrs:n,children:t.options.map(e=>({tag:`option`,attrs:{value:e.value},children:[e.label]}))}:{tag:xv,attrs:n,selfClosing:!0}})}const Ov=/<(\/?)(ask|option)\b[^>]*?(\/?)>/gi;function kv(e){let t=0;for(let n of Pt(e).matchAll(Ov)){let[,e,r,i]=n;if(r.toLowerCase()===`ask`)i||(t+=e?-1:1);else if(!e&&t===0)return`<option> belongs inside <ask>`}return null}function Av(e,t){let n=e.askId;if(!ct.test(n))return`<ask> needs an id of lowercase letters, digits and hyphens`;if(t.has(n))return`<ask id="${n}"> appears twice; every question needs its own id`;t.add(n);let r=/* @__PURE__ */ new Set;for(let t of e.options){if(!t.value)return`<ask id="${n}"> has an <option> with an empty value`;if(r.has(t.value))return`<ask id="${n}"> repeats the option value "${t.value}"`;if(r.add(t.value),!t.label.trim())return`<ask id="${n}"> has an <option> with an empty label`}return e.recommend!==void 0&&!r.has(e.recommend)?`<ask id="${n}"> recommend="${e.recommend}" is not one of its option values. Allowed values: ${[...r].join(`, `)||`(none; omit recommend)`}. Example: ${r.size?`recommend="${[...r][0]}"`:`<ask id="${n}" />`}`:null}function jv(e){let t=/* @__PURE__ */ new Set,n=(e,r)=>{if(lt(e))return r===`root`?`<ask> belongs inside a paragraph, list item or table cell`:Av(e,t);for(let t of e.children??[]){let r=n(t,e.type);if(r)return r}return null};for(let t of e.root.children){let e=n(t,`root`);if(e)return e}return null}const Mv=[{type:`document`,refAttribute:`document`,subTargets:[`block`],splitPane:!0},{type:`artboard`,refAttribute:`artboard`,subTargets:[`group`,`board`],splitPane:!0},{type:`whiteboard`,refAttribute:`whiteboard`,subTargets:[`page`,`frame`],splitPane:!0},{type:`html`,refAttribute:`html`,subTargets:[],splitPane:!0},{type:`slides`,refAttribute:`slides`,subTargets:[`slide`],splitPane:!0},{type:`report`,refAttribute:`report`,subTargets:[`block`],splitPane:!0},{type:`storyboard`,refAttribute:`storyboard`,subTargets:[`shot`],splitPane:!0},{type:`verify`,refAttribute:`verify`,subTargets:[],splitPane:!0}],Nv=Mv.map(e=>e.refAttribute),Pv=[...new Set(Mv.flatMap(e=>e.subTargets))];function Fv(e){return Mv.find(t=>t.type===e)??null}const Iv=e=>e.type===`ref`,Lv=e=>Nv.filter(t=>e[t]!==void 0),Rv=e=>{let t={};for(let n of Nv)e[n]!==void 0&&(t[n]=e[n]);e.to&&(t.to=e.to);for(let n of Pv)e[n]&&(t[n]=e[n]);return e.embed!==void 0&&(t.embed=e.embed),e.label&&(t.label=e.label),t},zv=e=>Lv(e)[0]??`artboard`,Bv=e=>e[zv(e)]??``,Vv=e=>e.frame??(e.page?`page:${e.page}`:void 0)??e.group??e.board??e.slide??e.block??e.shot??``,Hv=/* @__PURE__ */ RegExp(`^[a-z0-9][a-z0-9-]*$`),Uv=/* @__PURE__ */ RegExp(`^(?:[\\w-]{21}|[a-f0-9]{32})$`);function Wv(e){let t=``,n=new Uint8Array(e*2);for(;t.length<e;){crypto.getRandomValues(n);for(let r of n)if(!(r>=248)&&(t+=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`[r%62],t.length===e))break}return t}const Gv=()=>Wv(21),Kv=e=>Hv.test(e),qv=e=>Uv.test(e),Jv=e=>fe.includes(e),Yv=`main`,Xv=`pages.json`,Zv=`pages`,Qv=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,$v=e=>typeof e==`string`&&e.length<=64&&Qv.test(e),ey=e=>e===`main`?`scene.excalidraw`:`${Zv}/${e}.excalidraw`,ty=e=>{if(typeof e!=`object`||!e)return null;let{id:t,name:n,deleted:r}=e;return typeof t==`string`?{id:t,...typeof n==`string`&&n.trim()?{name:n.trim()}:{},...r===!0?{deleted:!0}:{}}:null};function ny(e){if(e===null)return{pages:[]};let t;try{t=JSON.parse(e)}catch{return{pages:[],error:`pages.json is not valid JSON`}}let n=t?.pages;return Array.isArray(n)?{pages:n.map(ty).filter(e=>e!==null)}:{pages:[],error:`pages.json needs a "pages" array`}}function ry(e,t){let n=[],r=/* @__PURE__ */ new Set,i=[];for(let t of e)$v(t.id)?r.has(t.id)?n.push(`pages.json: page ${t.id} is listed twice; only the first is kept`):(r.add(t.id),i.push(t)):n.push(`pages.json: page id "${t.id}" must be lowercase letters, digits and hyphens`);let a=i.findIndex(e=>e.id===Yv);i.length>0&&a!==0&&n.push(`pages.json: main is always the first page; it was moved to the top`);let o=a===-1?{id:Yv}:i.splice(a,1)[0];o.deleted&&n.push(`pages.json: main can’t be deleted; its "deleted" is ignored`);let{deleted:s,...c}=o,l=[c,...i];for(let e of t)$v(e)&&e!==`main`&&!r.has(e)&&(r.add(e),l.push({id:e}),n.push(`pages/${e}.excalidraw is not in pages.json; add it there`));return l.length>50&&n.push(`pages.json lists ${l.length} pages; only the first 50 are used`),{pages:l.slice(0,50),warnings:n}}const iy={document:`a document`,artboard:`an artboard`,whiteboard:`a whiteboard`,html:`an html page`,slides:`a deck`,report:`a report`,storyboard:`a storyboard`,verify:`a verify report`},ay=[`artboard`,`whiteboard`,`document`,`html`,`slides`,`report`,`storyboard`,`verify`],oy=e=>e.length===1?e[0]:`${e.slice(0,-1).join(`, `)} or ${e.at(-1)}`;function sy(e,t=`ref`,n=ay){let r=t===`ref`?`reference`:t,i=Lv(e);if(i.length>1)return`<${t}> names one target: either ${oy(i.map(e=>iy[e]))}, not both`;let a=i[0];if(!a)return`<${t}> needs ${oy(n.map(e=>iy[e]))}: the slug of one in this project`;let o=e[a]??``,s=`<${t} ${a}="${o}">`;if(!n.includes(a))return`${s} names ${iy[a]}: an <${t}> takes ${oy(n.map(e=>iy[e]))}`;if(e.embed!==void 0&&a!==`whiteboard`)return`<${t} ${a}="${o}" embed="${e.embed}">: only a whiteboard reference embeds; ${iy[a]} ${r} is a chip`;if(e.embed!==void 0&&e.embed!==`true`)return`<${t} ${a}="${o}" embed="${e.embed}">: write embed="true" to embed the whiteboard, or leave embed out for a chip`;if(!Kv(o))return`${s} is not ${iy[a].replace(/ page$/,``)} slug: lowercase letters, digits and hyphens`;let c=Fv(a)?.subTargets??[],l=Pv.filter(t=>e[t]!==void 0);for(let e of l){if(c.includes(e))continue;let t=Mv.filter(t=>t.subTargets.includes(e)).map(e=>e.type),n=c.length?`${iy[a]} ${r} takes ${oy(c)}`:`${iy[a]} ${r} takes no sub-target`;return`${s} has no ${e}: ${e} belongs to ${oy(t)} ${r}s; ${n}`}return l.length>1?`${s} names either a ${l[0]} or a ${l[1]}, not both`:e.page!==void 0&&!$v(e.page)?`<${t} ${a}="${o}" page="${e.page}"> is not a page id: lowercase letters, digits and hyphens`:null}const cy=`data-ryugi-ref`,ly=e=>wv(e,`ref`,cy);function uy(e){let t=e.getReader(xv);e.registerReader(xv,(e,n)=>{if(!e.hasAttribute(cy))return t?t(e,n):!1;let r={};for(let t of[...Nv,`to`,...Pv,`embed`]){let n=e.getAttribute(t);n!==null&&(r[t]=n)}return r.label=e.textContent??void 0,{type:`ref`,version:1,...Rv(r)}}),e.registerWriter(`ref`,e=>{let t=Rv(e),n={[cy]:`1`};for(let e of[...Nv,`to`,...Pv,`embed`]){let r=t[e];r!==void 0&&(n[e]=r)}return t.label?{tag:xv,attrs:n,children:[t.label]}:{tag:xv,attrs:n,selfClosing:!0}})}const dy=e=>[...e.content?.root?.children?[e.content.root.children]:[],...(e.steps??[]).flatMap(e=>e.content?.root?.children?[e.content.root.children]:[])],fy=e=>Iv(e)&&e.embed!==void 0,py=e=>{let t=e.type===`paragraph`&&e.children?.length===1?e.children[0]:null;return t&&Iv(t)&&t.embed!==void 0?t:null};function my(e){let t=e.root.children.map(e=>{let t=py(e);return t?{...t,...e.$?{$:e.$}:{}}:e});return{...e,root:{...e.root,children:t}}}const hy=e=>`<ref whiteboard="${e.whiteboard??``}" embed="${e.embed}">: an embedded whiteboard needs a paragraph of its own directly in the document, with nothing else in it`;function gy(e){let t=(e,r)=>{if(Iv(e))return sy(e)||(e.embed===void 0?r===`root`?`<ref> belongs inside a paragraph, list item or table cell`:null:r===`root`?null:hy(e));for(let n of e.children??[]){let r=t(n,e.type);if(r)return r}for(let t of dy(e)){let e=n(t);if(e)return e}return null},n=e=>{for(let t of e){if(fy(t))return hy(t);let e=n(t.children??[])??dy(t).reduce((e,t)=>e??n(t),null);if(e)return e}return null};for(let n of e.root.children){let e=t(n,`root`);if(e)return e}return null}const _y=/* @__PURE__ */ `doc.p.h1.h2.h3.h4.h5.h6.blockquote.ul.ol.li.table.tr.th.td.hr.img.codeblock.mermaid.excalidraw.chart.math.alert.details.steps.step.footnote-section.def.dynamic.pending`.split(`.`),vy=[`b`,`strong`,`i`,`em`,`u`,`s`,`del`,`strike`,`code`,`sub`,`sup`,`mark`,`a`,`br`,`footnote`,`ask`,`option`,`ref`],yy=/* @__PURE__ */ new Set([..._y,...vy]),by=/* @__PURE__ */ new Set([`agent-diff`,`attachment`,`banner`,`chat`,`code-snippet`,`comment`,`embed`,`gallery`,`grid`,`link-card`,`mention`,`nested-doc`,`poll`,`ruby`,`spoiler`,`tag`,`video`]),xy=xn();Dv(xy),uy(xy),xy.registerReader(`pending`,e=>{let t=e.getAttribute(`id`);return{type:`pending`,...t?{$:{blockId:t}}:{},intent:e.getAttribute(`intent`)??``,version:1}}),xy.registerWriter(`pending`,e=>{let{$:t,intent:n}=e;return{tag:`pending`,attrs:{...t?.blockId?{id:t.blockId}:{},intent:n??``},selfClosing:!0}});var Sy=class extends Error{};const Cy=/<dynamic\b[^>]*(?<!\/)>([\s\S]*?)<\/dynamic>/gi,wy=/<footnote-section\b[\s\S]*?<\/footnote-section>/gi,Ty=/<def[\s>/]/i,Ey=/^\s*<!\[CDATA\[([\s\S]*)\]\]>\s*$/;function Dy(e){for(let t of Pt(e).matchAll(Mt)){let e=t[2].toLowerCase();if(!yy.has(e))return by.has(e)?`<${e}> is not supported in documents`:`<${e}> is not a LiteXML tag`}return null}function Oy(e){return Ty.test(Pt(e).replaceAll(wy,``))?`<def> belongs inside <footnote-section>`:null}function ky(e){for(let t of e.matchAll(Cy)){let e=t[1],n=(Ey.exec(e)?.[1]??e).trim();if(n){try{let e=JSON.parse(n);if(e&&typeof e==`object`&&!Array.isArray(e))continue}catch{}return`<dynamic> props must be a JSON object`}}return null}function Ay(e){return Array.isArray(e)?e.some(Ay):!e||typeof e!=`object`?!1:e.type===`pending`||Object.values(e).some(Ay)}const jy=e=>e.some(e=>e.type!==`pending`&&Ay(e))?`<pending> must be a top-level block`:null;function My(e){for(let t of e){if(t.type===`dynamic`&&!It.test(t.url??``))return`<dynamic> url must be assets/<name>.html`;let e=My(t.children??[]);if(e)return e}return null}function Ny(e){let t=/^\s*<doc[\s>]/.test(e)?e:`<doc>${e}</doc>`,n=Ft(t)??Dy(t)??Oy(t)??kv(t)??ky(t);if(n)throw new Sy(n);let r;try{r=my(Pn(ly(Ev(t)),xy))}catch(e){throw new Sy(e.message)}let i=My(r.root.children)??jy(r.root.children)??jv(r)??gy(r);if(i)throw new Sy(i);return r}const Py=`任务 prompt(不是文档内容,开任务时写的):`,Fy=[`document`,`html`,`artboard`,`whiteboard`,`slides`],Iy=[`group`,`board`,`frame`,`page`,`slide`],Ly=e=>typeof e==`string`?e:``;function Ry(e){let t=Fy.find(t=>typeof e[t]==`string`);if(!t)return``;let n=Iy.find(t=>typeof e[t]==`string`);return`${t}/${Ly(e[t])}${n?`#${Ly(e[n])}`:``}`}function zy(e,t){if(t&16)return`\`${e}\``;let n=e;return t&32&&(n=`<sub>${n}</sub>`),t&64&&(n=`<sup>${n}</sup>`),t&4&&(n=`~~${n}~~`),t&2&&(n=`*${n}*`),t&1&&(n=`**${n}**`),n}function By(e,t){return e.options.find(e=>e.value===t)?.label??t??``}function Vy(e,t){let n=Ly(e.askId),r=e.options??[],i=t.get(n),a=i&&(i.state===`submitted`||i.state===`settled`);if(a&&i.staleChoice)return`[chosen (stale): ${i.staleChoice}]`;if(a&&i.text)return`[chosen: ${i.text}]`;if(a&&i.choice)return`[chosen: ${By({...i,options:r},i.choice)}]`;let o=Ly(e.recommend);return o?`[recommended: ${r.find(e=>e.value===o)?.label??o}]`:`[open]`}var Hy=class{views;constructor(e){this.views=e}inline(e=[]){return e.map(e=>this.inlineNode(e)).join(``)}inlineNode(e){switch(e.type){case`text`:return zy(Ly(e.text),Number(e.format)||0);case`linebreak`:return`
|
|
501
501
|
`;case`link`:return`[${this.inline(e.children)}](${Ly(e.url)})`;case`footnote`:return`[^${Ly(e.identifier)}]`;case`katex-inline`:return`$${Ly(e.equation)}$`;case`ref`:{let t=Ry(e);return`[${Ly(e.label)||t}](ryugi:${t})`}case`ask`:return Vy(e,this.views);default:return e.children?this.inline(e.children):``}}blocks(e=[]){return e.map(e=>this.block(e)).filter(e=>e!==``)}document(e=[]){let t=this.blocks(e);return t.length?`${t.join(`
|
|
502
502
|
|
|
503
503
|
`)}\n`:``}nested(e){let t=e?.root;return this.blocks(t?.children).join(`
|
|
@@ -518,7 +518,7 @@ getElementsByTagNameNS(e,t){return this.getElementsByTagName(t)}createAttributeN
|
|
|
518
518
|
`),Gy=(e,t)=>e.split(`
|
|
519
519
|
`).map(e=>e&&`${t}${e}`).join(`
|
|
520
520
|
`);function Ky(e){let t;try{t=JSON.parse(e)}catch{return`[chart]`}let n=t.x??``,r=t.series??[],i=e=>`| ${e.map(e=>String(e??``)).join(` | `)} |`,a=[i([n,...r.map(e=>e.label??e.key)]),i(Array.from({length:r.length+1},()=>`---`)),...(t.data??[]).map(e=>i([e[n],...r.map(t=>e[t.key])]))].join(`
|
|
521
|
-
`);return t.title?`**${t.title}**\n\n${a}`:a}const qy=e=>e.root;function Jy(e,t){return new Hy(new Map(t.map(e=>[e.id,e]))).document(qy(e).children)}const Yy=e=>[...e.replaceAll(/\s/g,``)].length;function Xy(e,t=[]){let n=new Hy(new Map(t.map(e=>[e.id,e]))),r=[];for(let t of qy(e).children??[])t.type===`heading`?r.push({id:Ly(t.$?.blockId),level:Number(Ly(t.tag).slice(1))||1,title:n.inline(t.children),chars:0}):r.length&&(r.at(-1).chars+=Yy(n.block(t)));return r}function Zy(e){try{return Ot(Et(u.default.readFileSync(d.default.join(e,`comments.json`),`utf8`))).threads}catch{return[]}}function Qy(e){let t=Ny(u.default.readFileSync(d.default.join(e,`doc.xml`),`utf8`)),n=yt(ft(t),Zy(e)),r=jt(e);return{markdown:(r?`${Py}\n\n${r.markdown}\n\n---\n\n`:``)+Jy(t,n),outline:Xy(t,n)}}function $y(e,t,n,r){if(e===`submit`)return{op:`submit`,submit:!t.withdraw};if(!t.ask)throw new A(`comment ${e} needs --ask <questionId>`);if(e===`note`)return{op:`note`,ask:t.ask,text:n()};let i=r?.trim();if(!t.clear&&!t.choice&&!i)throw new A(`comment answer needs --choice <value>, --text <answer>, or --clear`);return{op:`answer`,ask:t.ask,choice:t.clear?null:t.choice??null,answer:t.clear?null:i??null}}var eb='# Document writing\n\nEdit doc.xml directly with your filesystem tools. Put assets in assets/. 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 properties.json, comments.json or .state/; the server owns them. After each batch of edits, run the returned check command: it records the calling agent and model for the merged file changes and reports validation feedback. The server normalizes aliases and indentation after saving. 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 document="slug" block="block-id"/>` (one top-level block of a document: the `id` of its `h2`, `p`, list…; name this document\'s own slug to jump within it), `<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), `<ref verify="slug"/>` (a verify report: the chip shows whether it is done, waiting or rejected). Exactly one kind, at most one allowed subtarget, lowercase slug. Optional plain text label; server adds `to` when resolved, preserve it. Missing targets, including a block the document no longer has, 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 `check --artifact document/<id>`. It names invalid blocks, chart/math/diagram errors, unresolved refs and pending dynamic work. Read complete feedback before acting; reply to or resolve each thread once you have used it.\n';const tb=/^(.+?)->(.+?)(?:#([1-9]\d*))?$/;function nb(e){if(e.node&&e.edge)throw new A(`comment add takes --node or --edge, not both`);if(e.node)return{kind:`node`,id:e.node};if(!e.edge)return;let t=tb.exec(e.edge);if(!t)throw new A(`comment add --edge needs "<from>-><to>", with #n for the nth edge between them`);return{kind:`edge`,from:t[1],to:t[2],index:t[3]?Number(t[3])-1:0}}const rb=e=>t=>$y(e,t,()=>it(t),t.text);function ib(e,t,n){try{let e=Qy(d.default.dirname(n));return{markdown:e.markdown,rows:e.outline}}catch(e){return{warnings:[{code:`W_DOCUMENT_MARKDOWN`,message:`could not read the document as markdown, so it is shown as LiteXML: ${e.message}`}]}}}const ab={onStart:fe,authoring:eb,localGet:{key:`outline`,read:ib,columns:[{key:`id`,required:!0,positional:!0},{key:`level`,positional:!0},{key:`title`,positional:!0},{key:`chars`}]},changes:!0,review:{sections:[`asks`]},commentActions:{submit:rb(`submit`),answer:rb(`answer`),note:rb(`note`),add:e=>{if(!e.block)throw new A(`comment add needs --block <blockId>`);let t=nb(e);return{op:`add`,blockId:e.block,...t?{diagram:t}:{},...e.quote?{quote:e.quote}:{},text:it(e)}}}},ob={authoring:'# HTML writing\n\nWrite one complete `index.html` with a descriptive `<title>` and inline or relative styles, scripts and images. The page reloads on edits. Assets stay inside this artifact directory; CDN fonts/scripts work, absolute local paths do not. Any npm library loads from a CDN with its version pinned; nothing is preloaded, so use one instead of hand-writing its equivalent. The iframe is sandboxed: localStorage/sessionStorage/cookies throw, so keep state in DOM/variables. Popups, forms, downloads and clipboard work.\n\nControls and display are the bundled `ryugi-*` components below. Use them instead of native `<button>`, `<input>`, `<select>`, `<textarea>` and hand-styled tags, alerts, badges or cards; they need no imports and follow the theme. Native form elements are only for what no component covers (file pickers, dates). Layout is plain HTML/CSS. A mocked product screen follows that product\'s own design system.\n\n```html\n<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>Retry explorer</title>\n <style>\n body {\n display: grid;\n gap: 16px;\n max-width: 420px;\n padding: 24px;\n font: 14px system-ui;\n }\n </style>\n </head>\n <body>\n <ryugi-slider-input id="attempts" value="3" min="1" max="5" step="1"></ryugi-slider-input>\n <ryugi-segmented id="backoff" value="exponential">\n <ryugi-segment value="fixed">Fixed</ryugi-segment>\n <ryugi-segment value="exponential">Exponential</ryugi-segment>\n </ryugi-segmented>\n <output id="result"></output>\n <ryugi-button id="reset" icon="rotate-ccw">Reset</ryugi-button>\n <script>\n const state = { attempts: 3, backoff: \'exponential\' };\n const render = () => {\n const waits = Array.from({ length: state.attempts }, (_, i) =>\n state.backoff === \'fixed\' ? 1 : 2 ** i,\n );\n document.getElementById(\'result\').textContent = \'Waits: \' + waits.join(\'s, \') + \'s\';\n };\n document.addEventListener(\'ryugi-change\', (event) => {\n state[event.target.id] = event.detail.value;\n render();\n });\n document.addEventListener(\n \'ryugi-ui:ready\',\n () => {\n document.getElementById(\'reset\').addEventListener(\'click\', () => {\n document.getElementById(\'attempts\').value = 3;\n document.getElementById(\'backoff\').value = \'exponential\';\n Object.assign(state, { attempts: 3, backoff: \'exponential\' });\n render();\n });\n render();\n },\n { once: true },\n );\n <\/script>\n </body>\n</html>\n```\n\n## Rules\n\n- Every control has a stable `id`. Across rewrites the viewer restores control values, checks, details and scroll by `id` and fires `ryugi-change` (native inputs: `input`/`change`), so render from those events. Script-only state resets.\n- `ryugi-change` bubbles; `event.detail.value` is a string, number, boolean or `null`, and `detail.checked` is present for checkboxes and switches. Buttons and action icons use the native `click`.\n- `value`/`checked` attributes set the initial state; read the current one from the element\'s `value`/`checked` property.\n- The runtime loads automatically, with `defer`, when the page contains a `<ryugi-…>` tag. Code that touches components waits for `document`\'s `ryugi-ui:ready` event. Components created only by script need `<meta name="ryugi-ui" content="1">`.\n- `class` and `style` style the host (`style="width:100%"` works); never target the component\'s internal classes. Override Lobe tokens such as `--lobe-color-primary` on the host or page.\n- Children of Button, Card, Text, Tag, Checkbox and Badge move into the component; keep them simple. Select, Segmented, Radio group and Menu read option children.\n- `ryugi-card` paints its own surface. Either let the card paint it, or make the host the surface and use `variant="borderless"` without `glass`/`shadow`; never both.\n- Components follow `prefers-color-scheme`; `<html data-theme="light">` or `"dark"` pins the page.\n- Never invent a `ryugi-` tag. Tabs, Modal, Drawer, Table and DatePicker do not exist yet; build those with HTML/CSS.\n- One surface serves one investigation; comparison across independent screens belongs on an artboard. Never edit comments or `.state/`.\n\n## Components\n\n| Tag | Attributes | Notes |\n| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------- |\n| `ryugi-button` | `variant` (filled, outlined, borderless), `size` (small, middle, large), `block`, `loading`, `disabled`, `shape`, `type`, `icon` | children are the label |\n| `ryugi-action-icon` | `icon`, `size`, `disabled`, `title`, `aria-label` | icon-only button; always label it |\n| `ryugi-tooltip` | `content`, `placement`, `open` | native button trigger; opens on hover/focus |\n| `ryugi-popover` | `content`, `placement`, `trigger="hover"` | native button trigger; opens on click |\n| `ryugi-menu` | `label`, `icon`, `placement`, `disabled` | `ryugi-menu-item` children (`value`, `icon`, `disabled`); the chosen item\'s `value` arrives in `ryugi-change` and is not restored |\n| `ryugi-input` | `type`, `size`, `variant`, `allowClear`, `placeholder`, `value`, `disabled`, `name`, `aria-label` | |\n| `ryugi-textarea` | `rows`, `size`, `variant`, `placeholder`, `value`, `disabled`, `name` | |\n| `ryugi-input-number` | `value`, `min`, `max`, `step`, `precision`, `controls`, `size`, `variant`, `placeholder`, `disabled` | |\n| `ryugi-slider` | `value`, `min`, `max`, `step`, `disabled` | |\n| `ryugi-slider-input` | `value`, `min`, `max`, `step`, `controls`, `size`, `variant`, `disabled` | slider plus exact number; the default for tuning a value |\n| `ryugi-switch` | `checked`, `loading`, `size`, `disabled`, `name` | |\n| `ryugi-checkbox` | `checked`, `shape`, `size`, `disabled`, `name` | children are the label |\n| `ryugi-segmented` | `value`, `size`, `variant` (filled, outlined), `block`, `glass`, `shadow`, `vertical`, `disabled` | `ryugi-segment value` children |\n| `ryugi-select` | `value`, `placeholder`, `size`, `variant`, `allowClear`, `showSearch`, `loading`, `mode` (multiple, tags), `disabled` | `ryugi-option value` children |\n| `ryugi-radio-group` | `value`, `horizontal`, `gap`, `size`, `disabled` | `ryugi-radio value` children |\n| `ryugi-color-picker` | `value`, `alpha`, `defaultFormat` (hex, rgb, hsl), `trigger` (swatch, field, chip), `size`, `disabled` | |\n| `ryugi-card` | `variant` (filled, outlined, borderless), `shadow`, `glass`, `clickable` | children kept, nested components too |\n| `ryugi-text` | `type` (secondary, success, warning, danger, info), `strong`, `code`, `italic`, `underline`, `delete`, `mark`, `align`, `weight` | |\n| `ryugi-tag` | `variant` (filled, outlined, borderless, solid), `size`, `shape` (normal, round), `color`, `closable` | |\n| `ryugi-alert` | `type` (success, info, warning, error, secondary), `variant` (soft, outlined, plain), `title`, `description`, `showIcon`, `closable` | text children are the title when `title` is absent |\n| `ryugi-progress` | `percent`, `size`, `status` | |\n| `ryugi-badge` | `count`, `dot`, `status`, `text`, `showZero`, `size`, `color` | wraps an avatar or stands alone |\n| `ryugi-avatar` | `src`, `alt`, `size`, `shape` | |\n| `ryugi-divider` | `orientation`, `dashed` | |\n| `ryugi-icon` | `name`, `size`, `stroke-width` (2) | decorative Lucide icon in `currentColor` |\n\nOption children look the same for every list control:\n\n```html\n<ryugi-select id="layout" value="sidebar" placeholder="Choose layout">\n <ryugi-option value="sidebar">Sidebar</ryugi-option>\n <ryugi-option value="tabs">Top tabs</ryugi-option>\n</ryugi-select>\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\nIcons (`icon` attributes and `ryugi-icon name`) are Lucide kebab-case names; find them with `adeck icons <english words>`. Unknown names become runtime warnings. For icons created only by script add `<meta name="ryugi-icons" content="1">` and await `customElements.whenDefined(\'ryugi-icon\')`. Preview icons map to the app\'s existing business icons when implementing the design.\n\n## Toast\n\n`window.ryugiToast` is available after `ryugi-ui:ready`; a page without other components opts in with `<meta name="ryugi-ui" content="1">`.\n\n```js\ndocument.getElementById(\'save\').addEventListener(\'click\', async () => {\n try {\n await saveDraft();\n window.ryugiToast.success({ id: \'save-result\', title: \'Saved\' });\n } catch {\n window.ryugiToast.error({ id: \'save-result\', title: \'Save failed\', description: \'Try again.\' });\n }\n});\n```\n\nMethods: `success`, `error`, `info`, `warning`, `loading`, each taking a message string or `{ title, description, id, duration }` (text, not HTML). A stable `id` refreshes one toast instead of stacking copies. Duration defaults to 5000ms; `duration: 0` and `loading` stay until closed. Calls return `{ id, close() }`; `ryugiToast.dismiss(id)` closes one, `dismiss()` all. Toasts are not restored on rewrite.\n\n## Check\n\nRun Check after edits. It separates current static evidence from browser runtime. A closed or unloaded tab means runtime is 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',phoneScreens:!0};var sb='## 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. Three system controls are built in as well: `<ryugi-ios-switch>`, `<ryugi-ios-segmented>` and `<ryugi-ios-slider>` draw the iOS switch, segmented control and slider, with the frosted knob that opens into clear glass while it is pressed, dragged or travelling; use them wherever the product shows one of these controls instead of drawing your own. Everything else 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\nAll of them take `appearance="light|dark"`, otherwise follow the nearest `[data-appearance]`, then the system. Unknown attribute values raise a runtime warning.\n\n### iOS controls\n\n```html\n<div class="row">\n <span>自动暂停</span>\n <ryugi-ios-switch id="auto-pause" checked></ryugi-ios-switch>\n</div>\n<ryugi-ios-segmented id="range" value="week" block>\n <ryugi-ios-segment value="day">日</ryugi-ios-segment>\n <ryugi-ios-segment value="week">周</ryugi-ios-segment>\n <ryugi-ios-segment value="month">月</ryugi-ios-segment>\n</ryugi-ios-segmented>\n<ryugi-ios-slider\n id="volume"\n label="播报音量"\n value="65"\n start-icon="volume-1"\n end-icon="volume-2"\n></ryugi-ios-slider>\n```\n\n| Element | Attributes | Events |\n| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |\n| `ryugi-ios-switch` | `checked`, `disabled`, `size="sm md lg"` (track 22, 28, 36px; md), `color`, `label` and `description` beside it, `label-side="left"` | `change`, `detail.checked` |\n| `ryugi-ios-segmented` | `value`, `size="sm md lg"` (28, 32, 40px; md), `block` to fill the width; children are `<ryugi-ios-segment value>`, whose content (text, a `ryugi-icon`) is the label | `change`, `detail.value` |\n| `ryugi-ios-slider` | `value`, `min`, `max`, `step` (0, 100, 1), `size="sm md lg xl"` (track 8, 12, 18, 26px; md), `color`, `label` above with the value unless `hide-value`, `start-icon` and `end-icon` (Lucide names) | `input` while dragging, `change` when it lands, `detail.value` |\n\nThey are interactive: a tap flips the switch, the knob drags, the segmented lens can be held and dragged to another option, the slider follows the pointer, and the keyboard works. Their state is reflected in the `checked` and `value` attributes, and setting those from a script moves the control. The on colour of the switch and the filled part of the slider read `--color-accent` unless `color` names one (`#34c759`). The track, the segmented background and the selected pill follow the appearance; labels read `--color-text` and `--color-text-secondary`.\n\nIcons: `<ryugi-icon name>` is a Lucide icon; find names with `adeck icons <english words>`. 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, Artideck 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',cb="## 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, nor a switch, segmented control or slider: `<ryugi-ios-switch>`, `<ryugi-ios-segmented>` and `<ryugi-ios-slider>` are built in. Everything else 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",lb='# 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 `adeck 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`adeck 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: `adeck 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';function ub(e){if(!e.block)throw new A(`comment add on a report needs --block <blockId>`);if(e.point!==void 0&&e.row!==void 0)throw new A(`comment add takes --point or --row, not both`);let t;if(e.point!==void 0){let n=e.point.indexOf(`:`);if(n<=0||n===e.point.length-1)throw new A(`--point needs <series>:<x>, such as commits:Nov 2`);t={series:e.point.slice(0,n),x:e.point.slice(n+1)}}return{op:`add`,block:e.block,...t?{point:t}:{},...e.row===void 0?{}:{row:e.row},text:it(e)}}const db={authoring:lb,review:{sections:[]},commentActions:{add:ub}};var fb='# 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. 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 `<` and `&` in text; common names such as ` `, `—` and `→` 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`. When you write over one of their edits, `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 `check --artifact slides/<id>` 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';const pb=[`default`,`cover`,`section`,`statement`,`two-cols`,`image`,`quote`,`fact`,`code`,`end`,`none`],mb=/^\s*(\d+)(?:\s*-\s*(\d+))?\s*$/,hb=e=>{let t=e.trim();return t===`all`||t===`hide`?t:null};function gb(e){let t=[];for(let n of e.split(`|`)){let e=hb(n);if(e){t.push(e);continue}let r=/* @__PURE__ */ new Set;for(let e of n.split(`,`)){let t=mb.exec(e);if(!t)continue;let n=Number(t[1]),i=t[2]===void 0?n:Number(t[2]),a=Math.max(n,i);for(let e=Math.max(1,Math.min(n,i));e<=a&&!(r.size>=2e3);e++)r.add(e)}r.size&&t.push([...r].sort((e,t)=>e-t))}return t}const _b=e=>e.split(`|`).every(e=>hb(e)!==null||e.split(`,`).every(e=>{let t=mb.exec(e);return t!==null&&Number(t[1])>=1&&Number(t[2]??1)>=1})),vb=[`view`,`fade-out`,`fade`,`slide-left`,`slide-up`,`none`],yb=[`full`,`top`,`bottom`,`left`,`right`,`top-left`,`top-right`,`bottom-left`,`bottom-right`,`center`,`none`],bb=e=>vb.includes(e),xb=e=>yb.includes(e),Sb=/^(?:[a-z][a-z0-9+.-]*:|\/|#)/i;function Cb(e){let t=e?.trim();return!t||Sb.test(t)?null:t.split(/[?#]/)[0]||null}const wb=/^[a-z0-9][a-z0-9-]*$/,Tb=`((?:"[^"]*"|'[^']*'|[^'">])*)`,Eb=RegExp(`<!--[\\s\\S]*?(?:-->|$)|<(script|style|textarea|template|title)\\b${Tb}>([\\s\\S]*?)(?:<\\/\\1\\s*>|$)|<(\\/?)([a-zA-Z][a-zA-Z0-9-]*)${Tb}>`,`gi`),Db=/([^\s"'=<>/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g,Ob=/reveal(?:\.min)?(?:\.esm)?\.m?js(?:[?#]|$)/i,kb={lt:`<`,gt:`>`,quot:`"`,apos:`'`,nbsp:` `,amp:`&`};function Ab(e){let t=/* @__PURE__ */ new Map;for(let n of e.matchAll(Db)){let e=n[1].toLowerCase();t.has(e)||t.set(e,n[2]??n[3]??n[4]??``)}return t}function jb(e){return e.replaceAll(/<[^>]*>/g,``).replaceAll(/&(?:#(\d+)|#x([0-9a-f]+)|([a-z]+));/gi,(e,t,n,r)=>t?String.fromCodePoint(Number(t)):n?String.fromCodePoint(Number.parseInt(n,16)):kb[String(r).toLowerCase()]??e).replaceAll(/\s+/g,` `).trim().slice(0,200)}function Mb(e){let t=e.toLowerCase(),n=[],r=[],i=null,a=null,o=!1,s=!1,c=0,l=/* @__PURE__ */ new Set,u=e=>{let t=Cb(e);t&&l.add(t)},d=e=>{for(let t=n.length-1;t>=0;t--)if(n[t].tag===e){for(let e of n.splice(t))e.kind===`slide`&&(i=null),e.kind===`notes`&&--c;return}};Eb.lastIndex=0;for(let l=Eb.exec(e);l;l=Eb.exec(e)){let[,f,p=``,m=``,h,g,_=``]=l;if(f){let e=f.toLowerCase();e===`title`&&!i&&a===null&&(a=jb(m)||null);let t=e===`script`?Ab(p).get(`src`):void 0;u(t),e===`script`&&(Ob.test(t??``)||m.includes(`Reveal.initialize`))&&(s=!0);let r=n.at(-1);e===`template`&&i&&!c&&r?.kind===`magic`&&(r.templates=(r.templates??0)+1,r.templates>1&&(i.steps+=1));continue}if(!g)continue;let v=g.toLowerCase();if(h){(v===`div`||v===`section`||v===`aside`)&&d(v);continue}let y=Ab(_);u(y.get(`src`)),v===`link`&&u(y.get(`href`));let b=(y.get(`class`)??``).split(/\s+/).filter(Boolean),x=n.at(-1)?.kind;if(i&&!c){let n=y.get(`data-morph`)?.trim();if(n&&(i.morphs.has(n)&&!i.morphRepeats.includes(n)&&i.morphRepeats.push(n),i.morphs.add(n)),b.includes(`fragment`)){let e=y.get(`data-fragment-index`);e!==void 0&&i.positions.has(e)||(i.steps+=1),e!==void 0&&i.positions.add(e)}if(v===`code`&&(i.steps+=Math.max(0,gb(y.get(`data-lines`)??``).length-1)),!i.titled&&/^h[1-3]$/.test(v)){let n=t.indexOf(`</${v}`,Eb.lastIndex);i.title=jb(e.slice(Eb.lastIndex,n===-1?void 0:n)),i.titled=!0}}if(v===`div`){let e=`other`;!o&&x===`reveal`&&b.includes(`slides`)?(e=`slides`,o=!0):!o&&b.includes(`reveal`)?e=`reveal`:i&&b.includes(`magic-move`)&&(e=`magic`),n.push({tag:v,kind:e})}else if(v===`section`){if(x===`slides`){let e=b.find(e=>e.startsWith(`l-`)),t=e?e.slice(2):`default`;i={id:y.get(`id`)||null,layout:t,title:``,steps:0,notes:!1,nested:!1,titled:!1,unknownLayout:pb.includes(t)?null:t,transition:y.get(`data-transition`)?.trim()??null,glow:y.get(`data-glow`)?.trim()??null,morphs:/* @__PURE__ */ new Set,morphRepeats:[],positions:/* @__PURE__ */ new Set,...y.has(`data-deck-hidden`)?{hidden:!0}:{},...y.get(`data-deck-group`)?{group:y.get(`data-deck-group`)}:{}},r.push(i),n.push({tag:v,kind:`slide`})}else i&&(i.nested=!0),n.push({tag:v,kind:`other`})}else if(v===`aside`){let e=i!==null&&b.includes(`notes`);e&&(i.notes=!0,c+=1),n.push({tag:v,kind:e?`notes`:`other`})}}let f=[],p=/* @__PURE__ */ new Set,m=r.map(({nested:e,titled:t,unknownLayout:n,transition:r,glow:i,morphs:a,morphRepeats:o,positions:s,...c},l)=>{let u=c.id??void 0;c.id?wb.test(c.id)?p.has(c.id)&&f.push({code:`duplicate_id`,slide:l,id:u}):f.push({code:`invalid_id`,slide:l,id:u}):f.push({code:`missing_id`,slide:l}),c.id&&p.add(c.id),e&&f.push({code:`nested_slide`,slide:l,...u?{id:u}:{}}),n&&f.push({code:`unknown_layout`,slide:l,...u?{id:u}:{},detail:n});let d={slide:l,...u?{id:u}:{}};r!==null&&!bb(r)&&f.push({code:`unknown_transition`,...d,detail:r}),i!==null&&!xb(i)&&f.push({code:`unknown_glow`,...d,detail:i});for(let e of o)f.push({code:`duplicate_morph`,...d,detail:e});return c});return s&&f.push({code:`own_reveal`,slide:-1}),{complete:/<\/html\s*>\s*$/i.test(e),hasDeck:o,title:a,slides:m,issues:f,assets:[...l]}}function Nb(e,t,n){if(!Jv(t)||!Kv(n))return null;let r=d.default.join(e,t,n);try{return u.default.statSync(r).isDirectory()?r:null}catch{return null}}function Pb(e){let t=d.default.join(e,`.artifact-id`),n;try{n=u.default.readFileSync(t,`utf8`).trim()}catch(r){if(r.code!==`ENOENT`)throw r;n=Gv();try{u.default.writeFileSync(t,`${n}\n`,{flag:`wx`})}catch(t){if(t.code!==`EEXIST`)throw t;return Pb(e)}}if(!qv(n))throw Error(`Invalid artifact ID in ${t}`);return n}function Fb(e){try{return u.default.readdirSync(e,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name).sort()}catch{return[]}}function Ib(e){let t=[],n=[];for(let r of Fb(e))if(!r.startsWith(`.`)){if(!Jv(r))n.push(`unknown artifact type directory: ${r}/ (known: ${pe.join(`, `)})`);else for(let i of Fb(d.default.join(e,r)))Kv(i)?t.push({type:r,id:i,dir:d.default.join(e,r,i)}):n.push(`invalid artifact id: ${r}/${i} (use lowercase letters, digits and hyphens)`)}return{artifacts:t,warnings:n}}function Lb(e,t=Kv){let[n,r]=e.split(`/`);return!n||!r||!Jv(n)||!t(r)?null:{type:n,id:r}}function Rb(e,t){let n=0,r;try{r=u.default.readdirSync(e,{withFileTypes:!0})}catch{return n}for(let i of r){if(i.name.startsWith(`.`)||i.name===t)continue;let r=d.default.join(e,i.name);try{n=Math.max(n,i.isDirectory()?Rb(r):u.default.statSync(r).mtimeMs)}catch{continue}}return n}const zb=new Map(Object.entries({lt:`<`,gt:`>`,amp:`&`,quot:`"`,apos:`'`,nbsp:`\xA0`,mdash:`—`,ndash:`–`,hellip:`…`,rarr:`→`,larr:`←`,uarr:`↑`,darr:`↓`,harr:`↔`,copy:`©`,reg:`®`,trade:`™`,times:`×`,divide:`÷`,middot:`·`,bull:`•`,laquo:`«`,raquo:`»`,lsquo:`‘`,rsquo:`’`,ldquo:`“`,rdquo:`”`,deg:`°`,plusmn:`±`,le:`≤`,ge:`≥`,ne:`≠`,euro:`€`,pound:`£`,yen:`¥`})),Bb=/[A-Za-z_][\w.-]*/y,Vb=/\s*/y,Hb=e=>`name`in e;function Ub(e,t){return e.replaceAll(/&(?:#(\d{1,7})|#x([0-9a-fA-F]{1,6})|([A-Za-z][A-Za-z0-9]*));/g,(e,n,r,i,a)=>{let o=n?Number(n):r?Number.parseInt(r,16):null;if(o!==null)return o>0&&o<=1114111?String.fromCodePoint(o):e;let s=zb.get(i);return s===void 0&&t?.(i,a),s??e})}function Wb(e){return Hb(e)?e.children.map(Wb).join(``):e.text}function Gb(e){let t=[],n=null,r=t=>{if(!n){n=[];for(let t=e.indexOf(`
|
|
521
|
+
`);return t.title?`**${t.title}**\n\n${a}`:a}const qy=e=>e.root;function Jy(e,t){return new Hy(new Map(t.map(e=>[e.id,e]))).document(qy(e).children)}const Yy=e=>[...e.replaceAll(/\s/g,``)].length;function Xy(e,t=[]){let n=new Hy(new Map(t.map(e=>[e.id,e]))),r=[];for(let t of qy(e).children??[])t.type===`heading`?r.push({id:Ly(t.$?.blockId),level:Number(Ly(t.tag).slice(1))||1,title:n.inline(t.children),chars:0}):r.length&&(r.at(-1).chars+=Yy(n.block(t)));return r}function Zy(e){try{return Dt(Tt(u.default.readFileSync(d.default.join(e,`comments.json`),`utf8`))).threads}catch{return[]}}function Qy(e){let t=Ny(u.default.readFileSync(d.default.join(e,`doc.xml`),`utf8`)),n=vt(dt(t),Zy(e)),r=At(e);return{markdown:(r?`${Py}\n\n${r.markdown}\n\n---\n\n`:``)+Jy(t,n),outline:Xy(t,n)}}function $y(e,t,n,r){if(e===`submit`)return{op:`submit`,submit:!t.withdraw};if(!t.ask)throw new j(`comment ${e} needs --ask <questionId>`);if(e===`note`)return{op:`note`,ask:t.ask,text:n()};let i=r?.trim();if(!t.clear&&!t.choice&&!i)throw new j(`comment answer needs --choice <value>, --text <answer>, or --clear`);return{op:`answer`,ask:t.ask,choice:t.clear?null:t.choice??null,answer:t.clear?null:i??null}}var eb='# Document writing\n\nEdit doc.xml directly with your filesystem tools. Put assets in assets/. 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 properties.json, comments.json or .state/; the server owns them. After each batch of edits, run the returned check command: it records the calling agent and model for the merged file changes and reports validation feedback. The server normalizes aliases and indentation after saving. 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 document="slug" block="block-id"/>` (one top-level block of a document: the `id` of its `h2`, `p`, list…; name this document\'s own slug to jump within it), `<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), `<ref verify="slug"/>` (a verify report: the chip shows whether it is done, waiting or rejected). Exactly one kind, at most one allowed subtarget, lowercase slug. Optional plain text label; server adds `to` when resolved, preserve it. Missing targets, including a block the document no longer has, 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 `check --artifact document/<id>`. It names invalid blocks, chart/math/diagram errors, unresolved refs and pending dynamic work. Read complete feedback before acting; reply to or resolve each thread once you have used it.\n';const tb=/^(.+?)->(.+?)(?:#([1-9]\d*))?$/;function nb(e){if(e.node&&e.edge)throw new j(`comment add takes --node or --edge, not both`);if(e.node)return{kind:`node`,id:e.node};if(!e.edge)return;let t=tb.exec(e.edge);if(!t)throw new j(`comment add --edge needs "<from>-><to>", with #n for the nth edge between them`);return{kind:`edge`,from:t[1],to:t[2],index:t[3]?Number(t[3])-1:0}}const rb=e=>t=>$y(e,t,()=>rt(t),t.text);function ib(e,t,n){try{let e=Qy(d.default.dirname(n));return{markdown:e.markdown,rows:e.outline}}catch(e){return{warnings:[{code:`W_DOCUMENT_MARKDOWN`,message:`could not read the document as markdown, so it is shown as LiteXML: ${e.message}`}]}}}const ab={onStart:de,authoring:eb,localGet:{key:`outline`,read:ib,columns:[{key:`id`,required:!0,positional:!0},{key:`level`,positional:!0},{key:`title`,positional:!0},{key:`chars`}]},changes:!0,review:{sections:[`asks`]},commentActions:{submit:rb(`submit`),answer:rb(`answer`),note:rb(`note`),add:e=>{if(!e.block)throw new j(`comment add needs --block <blockId>`);let t=nb(e);return{op:`add`,blockId:e.block,...t?{diagram:t}:{},...e.quote?{quote:e.quote}:{},text:rt(e)}}}},ob={authoring:'# HTML writing\n\nWrite one complete `index.html` with a descriptive `<title>` and inline or relative styles, scripts and images. The page reloads on edits. Assets stay inside this artifact directory; CDN fonts/scripts work, absolute local paths do not. Any npm library loads from a CDN with its version pinned; nothing is preloaded, so use one instead of hand-writing its equivalent. The iframe is sandboxed: localStorage/sessionStorage/cookies throw, so keep state in DOM/variables. Popups, forms, downloads and clipboard work.\n\nControls and display are the bundled `ryugi-*` components below. Use them instead of native `<button>`, `<input>`, `<select>`, `<textarea>` and hand-styled tags, alerts, badges or cards; they need no imports and follow the theme. Native form elements are only for what no component covers (file pickers, dates). Layout is plain HTML/CSS. A mocked product screen follows that product\'s own design system.\n\n```html\n<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>Retry explorer</title>\n <style>\n body {\n display: grid;\n gap: 16px;\n max-width: 420px;\n padding: 24px;\n font: 14px system-ui;\n }\n </style>\n </head>\n <body>\n <ryugi-slider-input id="attempts" value="3" min="1" max="5" step="1"></ryugi-slider-input>\n <ryugi-segmented id="backoff" value="exponential">\n <ryugi-segment value="fixed">Fixed</ryugi-segment>\n <ryugi-segment value="exponential">Exponential</ryugi-segment>\n </ryugi-segmented>\n <output id="result"></output>\n <ryugi-button id="reset" icon="rotate-ccw">Reset</ryugi-button>\n <script>\n const state = { attempts: 3, backoff: \'exponential\' };\n const render = () => {\n const waits = Array.from({ length: state.attempts }, (_, i) =>\n state.backoff === \'fixed\' ? 1 : 2 ** i,\n );\n document.getElementById(\'result\').textContent = \'Waits: \' + waits.join(\'s, \') + \'s\';\n };\n document.addEventListener(\'ryugi-change\', (event) => {\n state[event.target.id] = event.detail.value;\n render();\n });\n document.addEventListener(\n \'ryugi-ui:ready\',\n () => {\n document.getElementById(\'reset\').addEventListener(\'click\', () => {\n document.getElementById(\'attempts\').value = 3;\n document.getElementById(\'backoff\').value = \'exponential\';\n Object.assign(state, { attempts: 3, backoff: \'exponential\' });\n render();\n });\n render();\n },\n { once: true },\n );\n <\/script>\n </body>\n</html>\n```\n\n## Rules\n\n- Every control has a stable `id`. Across rewrites the viewer restores control values, checks, details and scroll by `id` and fires `ryugi-change` (native inputs: `input`/`change`), so render from those events. Script-only state resets.\n- `ryugi-change` bubbles; `event.detail.value` is a string, number, boolean or `null`, and `detail.checked` is present for checkboxes and switches. Buttons and action icons use the native `click`.\n- `value`/`checked` attributes set the initial state; read the current one from the element\'s `value`/`checked` property.\n- The runtime loads automatically, with `defer`, when the page contains a `<ryugi-…>` tag. Code that touches components waits for `document`\'s `ryugi-ui:ready` event. Components created only by script need `<meta name="ryugi-ui" content="1">`.\n- `class` and `style` style the host (`style="width:100%"` works); never target the component\'s internal classes. Override Lobe tokens such as `--lobe-color-primary` on the host or page.\n- Children of Button, Card, Text, Tag, Checkbox and Badge move into the component; keep them simple. Select, Segmented, Radio group and Menu read option children.\n- `ryugi-card` paints its own surface. Either let the card paint it, or make the host the surface and use `variant="borderless"` without `glass`/`shadow`; never both.\n- Components follow `prefers-color-scheme`; `<html data-theme="light">` or `"dark"` pins the page.\n- Never invent a `ryugi-` tag. Tabs, Modal, Drawer, Table and DatePicker do not exist yet; build those with HTML/CSS.\n- One surface serves one investigation; comparison across independent screens belongs on an artboard. Never edit comments or `.state/`.\n\n## Components\n\n| Tag | Attributes | Notes |\n| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------- |\n| `ryugi-button` | `variant` (filled, outlined, borderless), `size` (small, middle, large), `block`, `loading`, `disabled`, `shape`, `type`, `icon` | children are the label |\n| `ryugi-action-icon` | `icon`, `size`, `disabled`, `title`, `aria-label` | icon-only button; always label it |\n| `ryugi-tooltip` | `content`, `placement`, `open` | native button trigger; opens on hover/focus |\n| `ryugi-popover` | `content`, `placement`, `trigger="hover"` | native button trigger; opens on click |\n| `ryugi-menu` | `label`, `icon`, `placement`, `disabled` | `ryugi-menu-item` children (`value`, `icon`, `disabled`); the chosen item\'s `value` arrives in `ryugi-change` and is not restored |\n| `ryugi-input` | `type`, `size`, `variant`, `allowClear`, `placeholder`, `value`, `disabled`, `name`, `aria-label` | |\n| `ryugi-textarea` | `rows`, `size`, `variant`, `placeholder`, `value`, `disabled`, `name` | |\n| `ryugi-input-number` | `value`, `min`, `max`, `step`, `precision`, `controls`, `size`, `variant`, `placeholder`, `disabled` | |\n| `ryugi-slider` | `value`, `min`, `max`, `step`, `disabled` | |\n| `ryugi-slider-input` | `value`, `min`, `max`, `step`, `controls`, `size`, `variant`, `disabled` | slider plus exact number; the default for tuning a value |\n| `ryugi-switch` | `checked`, `loading`, `size`, `disabled`, `name` | |\n| `ryugi-checkbox` | `checked`, `shape`, `size`, `disabled`, `name` | children are the label |\n| `ryugi-segmented` | `value`, `size`, `variant` (filled, outlined), `block`, `glass`, `shadow`, `vertical`, `disabled` | `ryugi-segment value` children |\n| `ryugi-select` | `value`, `placeholder`, `size`, `variant`, `allowClear`, `showSearch`, `loading`, `mode` (multiple, tags), `disabled` | `ryugi-option value` children |\n| `ryugi-radio-group` | `value`, `horizontal`, `gap`, `size`, `disabled` | `ryugi-radio value` children |\n| `ryugi-color-picker` | `value`, `alpha`, `defaultFormat` (hex, rgb, hsl), `trigger` (swatch, field, chip), `size`, `disabled` | |\n| `ryugi-card` | `variant` (filled, outlined, borderless), `shadow`, `glass`, `clickable` | children kept, nested components too |\n| `ryugi-text` | `type` (secondary, success, warning, danger, info), `strong`, `code`, `italic`, `underline`, `delete`, `mark`, `align`, `weight` | |\n| `ryugi-tag` | `variant` (filled, outlined, borderless, solid), `size`, `shape` (normal, round), `color`, `closable` | |\n| `ryugi-alert` | `type` (success, info, warning, error, secondary), `variant` (soft, outlined, plain), `title`, `description`, `showIcon`, `closable` | text children are the title when `title` is absent |\n| `ryugi-progress` | `percent`, `size`, `status` | |\n| `ryugi-badge` | `count`, `dot`, `status`, `text`, `showZero`, `size`, `color` | wraps an avatar or stands alone |\n| `ryugi-avatar` | `src`, `alt`, `size`, `shape` | |\n| `ryugi-divider` | `orientation`, `dashed` | |\n| `ryugi-icon` | `name`, `size`, `stroke-width` (2) | decorative Lucide icon in `currentColor` |\n\nOption children look the same for every list control:\n\n```html\n<ryugi-select id="layout" value="sidebar" placeholder="Choose layout">\n <ryugi-option value="sidebar">Sidebar</ryugi-option>\n <ryugi-option value="tabs">Top tabs</ryugi-option>\n</ryugi-select>\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\nIcons (`icon` attributes and `ryugi-icon name`) are Lucide kebab-case names; find them with `adeck icons <english words>`. Unknown names become runtime warnings. For icons created only by script add `<meta name="ryugi-icons" content="1">` and await `customElements.whenDefined(\'ryugi-icon\')`. Preview icons map to the app\'s existing business icons when implementing the design.\n\n## Toast\n\n`window.ryugiToast` is available after `ryugi-ui:ready`; a page without other components opts in with `<meta name="ryugi-ui" content="1">`.\n\n```js\ndocument.getElementById(\'save\').addEventListener(\'click\', async () => {\n try {\n await saveDraft();\n window.ryugiToast.success({ id: \'save-result\', title: \'Saved\' });\n } catch {\n window.ryugiToast.error({ id: \'save-result\', title: \'Save failed\', description: \'Try again.\' });\n }\n});\n```\n\nMethods: `success`, `error`, `info`, `warning`, `loading`, each taking a message string or `{ title, description, id, duration }` (text, not HTML). A stable `id` refreshes one toast instead of stacking copies. Duration defaults to 5000ms; `duration: 0` and `loading` stay until closed. Calls return `{ id, close() }`; `ryugiToast.dismiss(id)` closes one, `dismiss()` all. Toasts are not restored on rewrite.\n\n## Check\n\nRun Check after edits. It separates current static evidence from browser runtime. A closed or unloaded tab means runtime is 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',phoneScreens:!0};var sb='## 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. Three system controls are built in as well: `<ryugi-ios-switch>`, `<ryugi-ios-segmented>` and `<ryugi-ios-slider>` draw the iOS switch, segmented control and slider, with the frosted knob that opens into clear glass while it is pressed, dragged or travelling; use them wherever the product shows one of these controls instead of drawing your own. Everything else 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\nAll of them take `appearance="light|dark"`, otherwise follow the nearest `[data-appearance]`, then the system. Unknown attribute values raise a runtime warning.\n\n### iOS controls\n\n```html\n<div class="row">\n <span>自动暂停</span>\n <ryugi-ios-switch id="auto-pause" checked></ryugi-ios-switch>\n</div>\n<ryugi-ios-segmented id="range" value="week" block>\n <ryugi-ios-segment value="day">日</ryugi-ios-segment>\n <ryugi-ios-segment value="week">周</ryugi-ios-segment>\n <ryugi-ios-segment value="month">月</ryugi-ios-segment>\n</ryugi-ios-segmented>\n<ryugi-ios-slider\n id="volume"\n label="播报音量"\n value="65"\n start-icon="volume-1"\n end-icon="volume-2"\n></ryugi-ios-slider>\n```\n\n| Element | Attributes | Events |\n| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |\n| `ryugi-ios-switch` | `checked`, `disabled`, `size="sm md lg"` (track 22, 28, 36px; md), `color`, `label` and `description` beside it, `label-side="left"` | `change`, `detail.checked` |\n| `ryugi-ios-segmented` | `value`, `size="sm md lg"` (28, 32, 40px; md), `block` to fill the width; children are `<ryugi-ios-segment value>`, whose content (text, a `ryugi-icon`) is the label | `change`, `detail.value` |\n| `ryugi-ios-slider` | `value`, `min`, `max`, `step` (0, 100, 1), `size="sm md lg xl"` (track 8, 12, 18, 26px; md), `color`, `label` above with the value unless `hide-value`, `start-icon` and `end-icon` (Lucide names) | `input` while dragging, `change` when it lands, `detail.value` |\n\nThey are interactive: a tap flips the switch, the knob drags, the segmented lens can be held and dragged to another option, the slider follows the pointer, and the keyboard works. Their state is reflected in the `checked` and `value` attributes, and setting those from a script moves the control. The on colour of the switch and the filled part of the slider read `--color-accent` unless `color` names one (`#34c759`). The track, the segmented background and the selected pill follow the appearance; labels read `--color-text` and `--color-text-secondary`.\n\nIcons: `<ryugi-icon name>` is a Lucide icon; find names with `adeck icons <english words>`. 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, Artideck 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',cb="## 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, nor a switch, segmented control or slider: `<ryugi-ios-switch>`, `<ryugi-ios-segmented>` and `<ryugi-ios-slider>` are built in. Everything else 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",lb='# 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 `adeck 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`adeck 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: `adeck 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';function ub(e){if(!e.block)throw new j(`comment add on a report needs --block <blockId>`);if(e.point!==void 0&&e.row!==void 0)throw new j(`comment add takes --point or --row, not both`);let t;if(e.point!==void 0){let n=e.point.indexOf(`:`);if(n<=0||n===e.point.length-1)throw new j(`--point needs <series>:<x>, such as commits:Nov 2`);t={series:e.point.slice(0,n),x:e.point.slice(n+1)}}return{op:`add`,block:e.block,...t?{point:t}:{},...e.row===void 0?{}:{row:e.row},text:rt(e)}}const db={authoring:lb,review:{sections:[]},commentActions:{add:ub}};var fb='# 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. 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 `<` and `&` in text; common names such as ` `, `—` and `→` 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`. When you write over one of their edits, `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 `check --artifact slides/<id>` 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';const pb=[`default`,`cover`,`section`,`statement`,`two-cols`,`image`,`quote`,`fact`,`code`,`end`,`none`],mb=/^\s*(\d+)(?:\s*-\s*(\d+))?\s*$/,hb=e=>{let t=e.trim();return t===`all`||t===`hide`?t:null};function gb(e){let t=[];for(let n of e.split(`|`)){let e=hb(n);if(e){t.push(e);continue}let r=/* @__PURE__ */ new Set;for(let e of n.split(`,`)){let t=mb.exec(e);if(!t)continue;let n=Number(t[1]),i=t[2]===void 0?n:Number(t[2]),a=Math.max(n,i);for(let e=Math.max(1,Math.min(n,i));e<=a&&!(r.size>=2e3);e++)r.add(e)}r.size&&t.push([...r].sort((e,t)=>e-t))}return t}const _b=e=>e.split(`|`).every(e=>hb(e)!==null||e.split(`,`).every(e=>{let t=mb.exec(e);return t!==null&&Number(t[1])>=1&&Number(t[2]??1)>=1})),vb=[`view`,`fade-out`,`fade`,`slide-left`,`slide-up`,`none`],yb=[`full`,`top`,`bottom`,`left`,`right`,`top-left`,`top-right`,`bottom-left`,`bottom-right`,`center`,`none`],bb=e=>vb.includes(e),xb=e=>yb.includes(e),Sb=/^(?:[a-z][a-z0-9+.-]*:|\/|#)/i;function Cb(e){let t=e?.trim();return!t||Sb.test(t)?null:t.split(/[?#]/)[0]||null}const wb=/^[a-z0-9][a-z0-9-]*$/,Tb=`((?:"[^"]*"|'[^']*'|[^'">])*)`,Eb=RegExp(`<!--[\\s\\S]*?(?:-->|$)|<(script|style|textarea|template|title)\\b${Tb}>([\\s\\S]*?)(?:<\\/\\1\\s*>|$)|<(\\/?)([a-zA-Z][a-zA-Z0-9-]*)${Tb}>`,`gi`),Db=/([^\s"'=<>/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g,Ob=/reveal(?:\.min)?(?:\.esm)?\.m?js(?:[?#]|$)/i,kb={lt:`<`,gt:`>`,quot:`"`,apos:`'`,nbsp:` `,amp:`&`};function Ab(e){let t=/* @__PURE__ */ new Map;for(let n of e.matchAll(Db)){let e=n[1].toLowerCase();t.has(e)||t.set(e,n[2]??n[3]??n[4]??``)}return t}function jb(e){return e.replaceAll(/<[^>]*>/g,``).replaceAll(/&(?:#(\d+)|#x([0-9a-f]+)|([a-z]+));/gi,(e,t,n,r)=>t?String.fromCodePoint(Number(t)):n?String.fromCodePoint(Number.parseInt(n,16)):kb[String(r).toLowerCase()]??e).replaceAll(/\s+/g,` `).trim().slice(0,200)}function Mb(e){let t=e.toLowerCase(),n=[],r=[],i=null,a=null,o=!1,s=!1,c=0,l=/* @__PURE__ */ new Set,u=e=>{let t=Cb(e);t&&l.add(t)},d=e=>{for(let t=n.length-1;t>=0;t--)if(n[t].tag===e){for(let e of n.splice(t))e.kind===`slide`&&(i=null),e.kind===`notes`&&--c;return}};Eb.lastIndex=0;for(let l=Eb.exec(e);l;l=Eb.exec(e)){let[,f,p=``,m=``,h,g,_=``]=l;if(f){let e=f.toLowerCase();e===`title`&&!i&&a===null&&(a=jb(m)||null);let t=e===`script`?Ab(p).get(`src`):void 0;u(t),e===`script`&&(Ob.test(t??``)||m.includes(`Reveal.initialize`))&&(s=!0);let r=n.at(-1);e===`template`&&i&&!c&&r?.kind===`magic`&&(r.templates=(r.templates??0)+1,r.templates>1&&(i.steps+=1));continue}if(!g)continue;let v=g.toLowerCase();if(h){(v===`div`||v===`section`||v===`aside`)&&d(v);continue}let y=Ab(_);u(y.get(`src`)),v===`link`&&u(y.get(`href`));let b=(y.get(`class`)??``).split(/\s+/).filter(Boolean),x=n.at(-1)?.kind;if(i&&!c){let n=y.get(`data-morph`)?.trim();if(n&&(i.morphs.has(n)&&!i.morphRepeats.includes(n)&&i.morphRepeats.push(n),i.morphs.add(n)),b.includes(`fragment`)){let e=y.get(`data-fragment-index`);e!==void 0&&i.positions.has(e)||(i.steps+=1),e!==void 0&&i.positions.add(e)}if(v===`code`&&(i.steps+=Math.max(0,gb(y.get(`data-lines`)??``).length-1)),!i.titled&&/^h[1-3]$/.test(v)){let n=t.indexOf(`</${v}`,Eb.lastIndex);i.title=jb(e.slice(Eb.lastIndex,n===-1?void 0:n)),i.titled=!0}}if(v===`div`){let e=`other`;!o&&x===`reveal`&&b.includes(`slides`)?(e=`slides`,o=!0):!o&&b.includes(`reveal`)?e=`reveal`:i&&b.includes(`magic-move`)&&(e=`magic`),n.push({tag:v,kind:e})}else if(v===`section`){if(x===`slides`){let e=b.find(e=>e.startsWith(`l-`)),t=e?e.slice(2):`default`;i={id:y.get(`id`)||null,layout:t,title:``,steps:0,notes:!1,nested:!1,titled:!1,unknownLayout:pb.includes(t)?null:t,transition:y.get(`data-transition`)?.trim()??null,glow:y.get(`data-glow`)?.trim()??null,morphs:/* @__PURE__ */ new Set,morphRepeats:[],positions:/* @__PURE__ */ new Set,...y.has(`data-deck-hidden`)?{hidden:!0}:{},...y.get(`data-deck-group`)?{group:y.get(`data-deck-group`)}:{}},r.push(i),n.push({tag:v,kind:`slide`})}else i&&(i.nested=!0),n.push({tag:v,kind:`other`})}else if(v===`aside`){let e=i!==null&&b.includes(`notes`);e&&(i.notes=!0,c+=1),n.push({tag:v,kind:e?`notes`:`other`})}}let f=[],p=/* @__PURE__ */ new Set,m=r.map(({nested:e,titled:t,unknownLayout:n,transition:r,glow:i,morphs:a,morphRepeats:o,positions:s,...c},l)=>{let u=c.id??void 0;c.id?wb.test(c.id)?p.has(c.id)&&f.push({code:`duplicate_id`,slide:l,id:u}):f.push({code:`invalid_id`,slide:l,id:u}):f.push({code:`missing_id`,slide:l}),c.id&&p.add(c.id),e&&f.push({code:`nested_slide`,slide:l,...u?{id:u}:{}}),n&&f.push({code:`unknown_layout`,slide:l,...u?{id:u}:{},detail:n});let d={slide:l,...u?{id:u}:{}};r!==null&&!bb(r)&&f.push({code:`unknown_transition`,...d,detail:r}),i!==null&&!xb(i)&&f.push({code:`unknown_glow`,...d,detail:i});for(let e of o)f.push({code:`duplicate_morph`,...d,detail:e});return c});return s&&f.push({code:`own_reveal`,slide:-1}),{complete:/<\/html\s*>\s*$/i.test(e),hasDeck:o,title:a,slides:m,issues:f,assets:[...l]}}function Nb(e,t,n){if(!Jv(t)||!Kv(n))return null;let r=d.default.join(e,t,n);try{return u.default.statSync(r).isDirectory()?r:null}catch{return null}}function Pb(e){let t=d.default.join(e,`.artifact-id`),n;try{n=u.default.readFileSync(t,`utf8`).trim()}catch(r){if(r.code!==`ENOENT`)throw r;n=Gv();try{u.default.writeFileSync(t,`${n}\n`,{flag:`wx`})}catch(t){if(t.code!==`EEXIST`)throw t;return Pb(e)}}if(!qv(n))throw Error(`Invalid artifact ID in ${t}`);return n}function Fb(e){try{return u.default.readdirSync(e,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name).sort()}catch{return[]}}function Ib(e){let t=[],n=[];for(let r of Fb(e))if(!r.startsWith(`.`)){if(!Jv(r))n.push(`unknown artifact type directory: ${r}/ (known: ${fe.join(`, `)})`);else for(let i of Fb(d.default.join(e,r)))Kv(i)?t.push({type:r,id:i,dir:d.default.join(e,r,i)}):n.push(`invalid artifact id: ${r}/${i} (use lowercase letters, digits and hyphens)`)}return{artifacts:t,warnings:n}}function Lb(e,t=Kv){let[n,r]=e.split(`/`);return!n||!r||!Jv(n)||!t(r)?null:{type:n,id:r}}function Rb(e,t){let n=0,r;try{r=u.default.readdirSync(e,{withFileTypes:!0})}catch{return n}for(let i of r){if(i.name.startsWith(`.`)||i.name===t)continue;let r=d.default.join(e,i.name);try{n=Math.max(n,i.isDirectory()?Rb(r):u.default.statSync(r).mtimeMs)}catch{continue}}return n}const zb=new Map(Object.entries({lt:`<`,gt:`>`,amp:`&`,quot:`"`,apos:`'`,nbsp:`\xA0`,mdash:`—`,ndash:`–`,hellip:`…`,rarr:`→`,larr:`←`,uarr:`↑`,darr:`↓`,harr:`↔`,copy:`©`,reg:`®`,trade:`™`,times:`×`,divide:`÷`,middot:`·`,bull:`•`,laquo:`«`,raquo:`»`,lsquo:`‘`,rsquo:`’`,ldquo:`“`,rdquo:`”`,deg:`°`,plusmn:`±`,le:`≤`,ge:`≥`,ne:`≠`,euro:`€`,pound:`£`,yen:`¥`})),Bb=/[A-Za-z_][\w.-]*/y,Vb=/\s*/y,Hb=e=>`name`in e;function Ub(e,t){return e.replaceAll(/&(?:#(\d{1,7})|#x([0-9a-fA-F]{1,6})|([A-Za-z][A-Za-z0-9]*));/g,(e,n,r,i,a)=>{let o=n?Number(n):r?Number.parseInt(r,16):null;if(o!==null)return o>0&&o<=1114111?String.fromCodePoint(o):e;let s=zb.get(i);return s===void 0&&t?.(i,a),s??e})}function Wb(e){return Hb(e)?e.children.map(Wb).join(``):e.text}function Gb(e){let t=[],n=null,r=t=>{if(!n){n=[];for(let t=e.indexOf(`
|
|
522
522
|
`);t!==-1;t=e.indexOf(`
|
|
523
523
|
`,t+1))n.push(t)}let r=0,i=n.length;for(;r<i;){let e=r+i>>1;n[e]<t?r=e+1:i=e}return r+1},i=(e,n)=>t.push({line:r(e),message:n}),a=[],o=[],s=()=>o.at(-1)?.children??a,c=/* @__PURE__ */ new Set,l=e=>(t,n)=>{c.has(t)||(c.add(t),i(e+n,`&${t}; is not an entity a deck knows: write the character itself, or & for a plain &`))},u=(t,n,r)=>{if(n<=t)return;let a=e.slice(t,n),o=r?-1:a.indexOf(`]]>`);o!==-1&&i(t+o,`a ]]> outside CDATA: the section before it ended early. Split it as ]]]]><![CDATA[> or take the code from a file`),s().push({start:t,end:n,cdata:r,text:r?a:Ub(a,l(t))})},d=0;for(;d<e.length;){let n=e.indexOf(`<`,d);if(n===-1){u(d,e.length,!1);break}if(u(d,n,!1),e.startsWith(`<!--`,n)){let t=e.indexOf(`-->`,n+4);if(t===-1){i(n,`a comment is never closed with -->`);break}d=t+3;continue}if(e.startsWith(`<![CDATA[`,n)){let t=e.indexOf(`]]>`,n+9);if(t===-1){i(n,`a CDATA section is never closed with ]]>`);break}u(n+9,t,!0),d=t+3;continue}if(e.startsWith(`<?`,n)||e.startsWith(`<!`,n)){let t=e.indexOf(`>`,n);d=t===-1?e.length:t+1;continue}if(e[n+1]===`/`){Bb.lastIndex=n+2;let t=Bb.exec(e)?.[0],r=e.indexOf(`>`,n);if(!t||r===-1){i(n,`a closing tag is not finished`);break}d=r+1;let a=o.length-1;for(;a>=0&&o[a].name!==t;)--a;if(a===-1&&o.length===0){i(n,`</${t}> closes nothing that is open`);continue}a!==o.length-1&&i(n,`</${t}> closes <${o.at(-1).name}>, which is still open`);for(let e of o.splice(a===-1?o.length-1:a))e.innerEnd=n,e.end=d;continue}Bb.lastIndex=n+1;let a=Bb.exec(e)?.[0];if(!a){i(n,`a "<" that starts no tag: write < or use CDATA`),d=n+1;continue}let c=/* @__PURE__ */ new Map,f=n+1+a.length,p=!1,m=!1;for(;f<e.length;){if(Vb.lastIndex=f,f+=Vb.exec(e)[0].length,e[f]===`>`){f+=1,m=!0;break}if(e.startsWith(`/>`,f)){f+=2,p=!0,m=!0;break}Bb.lastIndex=f;let t=Bb.exec(e)?.[0],n=t?e[f+t.length+1]:void 0;if(!t||e[f+t.length]!==`=`||n!==`"`&&n!==`'`){i(f,`<${a}> has an attribute that is not name="value"`);break}let r=f+t.length+2,o=e.indexOf(n,r);if(o===-1){i(f,`<${a}> has an attribute value that is never closed`);break}c.has(t)||c.set(t,Ub(e.slice(r,o),l(r))),f=o+1}if(!m){let r=e.indexOf(`>`,f);if((t.length===0||r===-1)&&i(n,`<${a}> is not finished`),r===-1)break;f=r+1}let h={name:a,attrs:c,children:[],start:n,end:f,innerStart:f,innerEnd:f,line:r(n),selfClosing:p};if(s().push(h),d=f,!p){if(o.length>=100){i(n,`elements are nested more than 100 deep`);break}o.push(h)}}let f=t.length>0&&d<e.length;for(let t of o)f||i(t.start,`<${t.name}> is never closed`),t.innerEnd=e.length,t.end=e.length;let p=a.filter(Hb),m=a.find(e=>!Hb(e)&&e.text.trim()!==``);return p.length>1?i(p[1].start,`only one root element is allowed`):m&&i(m.start,`text outside the root element`),{root:p[0]??null,errors:t}}const Kb=/* @__PURE__ */ `h1.h2.h3.p.blockquote.ul.ol.table.img.icon.alert.hr.codeblock.code.magic.mermaid.math.chart.embed.html.kicker.subtitle.label.quote.cite.big.fact`.split(`.`),qb=[`h1`,`h2`,`h3`,`p`,`blockquote`,`ul`,`ol`,`kicker`,`subtitle`,`label`,`quote`,`cite`],Jb=[`ink`,`muted`,`faint`,`accent`,`info`],Yb=[`left`,`center`,`right`],Xb=[`x`,`y`,`w`,`h`],Zb=/^[A-Za-z0-9_-]{1,32}$/,Qb=e=>Kb.includes(e);function $b(e){let t=/* @__PURE__ */ new Map;return e.children.filter(Hb).forEach((e,n)=>{e.name===`col`?e.children.filter(Hb).forEach((e,r)=>{Qb(e.name)&&t.set(e,`${n}.${r}`)}):Qb(e.name)&&t.set(e,String(n))}),t}const ex=Jb,tx=[`surface`,`paper`,`ink`,`muted`,`faint`,`accent`,`info`],nx=[`solid`,`dashed`,`dotted`],rx=[...Yb,`justify`],ix={ink:`ink`,muted:`ink-2`,faint:`ink-3`,accent:`accent`,info:`info`,surface:`surface`,paper:`paper`},ax=e=>`var(--deck-${ix[e]??e})`,ox=[`img`,`embed`,`chart`,`mermaid`,`math`,`magic`],sx=[`table`,`codeblock`,`code`,`alert`,`big`,`fact`],cx=[`hr`,`icon`],lx=[`fill`,`opacity`,`radius`,`border`,`shadow`],ux=[`font`,`weight`,`size`,`leading`,`tracking`,`fit`];function dx(e){return qb.includes(e)?[`pad`,...ux,`align`,`color`,...lx]:ox.includes(e)?[...lx]:sx.includes(e)?[`pad`,...lx]:cx.includes(e)?[`opacity`]:[]}const fx=/^#(?:[0-9a-f]{6}|[0-9a-f]{8})$/i,px=/^[\p{L}\p{N}][\p{L}\p{N} ._-]{0,63}$/u,mx=(e,t,n)=>/^-?\d+$/.test(e)&&Number(e)>=t&&Number(e)<=n,hx=(e,t,n,r)=>RegExp(`^-?\\d+(?:\\.\\d{1,${r}})?$`).test(e)&&Number(e)>=t&&Number(e)<=n,gx=(e,t)=>t.includes(e)||fx.test(e);function _x(e){let t=e.split(` `);if(t.length!==4)return null;let[n,r,i,a]=t;return mx(n,-200,200)&&mx(r,-200,200)&&mx(i,0,200)&&gx(a,tx)?[n,r,i,a]:null}const vx={pad:[e=>mx(e,0,200),`must be whole pixels from 0 to 200`],font:[e=>e===`mono`||px.test(e),`must be mono or a font name: letters, digits, spaces, - _ . (at most 64)`],weight:[e=>mx(e,100,900)&&Number(e)%100==0,`must be 100, 200 … 900`],size:[e=>mx(e,8,400),`must be whole pixels from 8 to 400`],leading:[e=>hx(e,.8,3,2),`must be 0.8 to 3, at most two decimals`],tracking:[e=>hx(e,-20,100,1),`must be -20 to 100 pixels, at most one decimal`],fit:[e=>e===`shrink`,`must be shrink`],fill:[e=>gx(e,tx),`must be #RRGGBB, #RRGGBBAA or ${tx.join(`, `)}`],opacity:[e=>mx(e,0,100),`must be 0 to 100`],radius:[e=>mx(e,0,360),`must be whole pixels from 0 to 360`],border:[e=>nx.includes(e),`must be ${nx.join(`, `)}`],shadow:[e=>_x(e)!==null,`must be "x y blur colour": x and y -200 to 200, blur 0 to 200`],align:[e=>rx.includes(e),`must be ${rx.join(`, `)}`],color:[e=>gx(e,ex),`must be #RRGGBB, #RRGGBBAA or a theme colour: ${ex.join(`, `)}`]};function yx(e,t,n){let r=Object.hasOwn(vx,t)?vx[t]:void 0;return r?dx(e).includes(t)?r[0](n)?null:`${t}="${n}" ${r[1]}`:`<${e}> takes no ${t}`:`${t} is not a look attribute`}const bx=e=>fx.test(e)?e:ax(e);function xx(e,t){switch(e){case`pad`:return[[`padding`,`${t}px`]];case`font`:return[[`font-family`,t===`mono`?`var(--deck-font-mono)`:`"${t}", var(--deck-font)`]];case`weight`:return[[`font-weight`,t]];case`size`:return[[`font-size`,`${t}px`]];case`leading`:return[[`line-height`,t]];case`tracking`:return[[`letter-spacing`,`${t}px`]];case`fill`:return[[`background-color`,bx(t)]];case`opacity`:return[[`opacity`,String(Number(t)/100)]];case`radius`:return[[`border-radius`,`${t}px`]];case`border`:return[[`border`,`1px ${t} var(--deck-rule-strong)`]];case`shadow`:{let e=_x(t);if(!e)return[];let[n,r,i,a]=e;return[[`box-shadow`,`${n}px ${r}px ${i}px ${bx(a)}`]]}case`color`:return[[`color`,bx(t)]];case`align`:return[[`text-align`,t]];default:return[]}}const Sx={explicit:!1,from:/* @__PURE__ */ new Map,index:/* @__PURE__ */ new Map},Cx=/^[1-9]\d?$/,wx=(e,t)=>e.name===`col`||(e.name===`ul`||e.name===`ol`)&&t.name===`li`||e.name===`table`&&t.name===`tr`&&t.children.some(e=>Hb(e)&&e.name===`td`);function Tx(e){return e.name===`codeblock`?Math.max(0,gb(e.attrs.get(`lines`)??``).length-1):e.name===`magic`?Math.max(0,e.children.filter(e=>Hb(e)&&e.name===`step`).length-1):0}function Ex(e){let t=/* @__PURE__ */ new Set,n=e=>{let r=e.attrs.get(`step`)??``;Cx.test(r)&&t.add(Number(r)-1);for(let t of e.children)Hb(t)&&n(t)};return n(e),t}function Dx(e,t){let n={explicit:!1,from:/* @__PURE__ */ new Map,index:/* @__PURE__ */ new Map},r=Ex(e),i=0,a=null,o=()=>{for(;r.has(i);)i+=1;return i+=1,i-1},s=(e,r)=>{if(e.name===`notes`)return;let c=e.attrs.get(`step`)??(r?`true`:`false`),l=null;c===`true`?l=o():c===`with`?(n.explicit=!0,a===null?t.bad(e,`step`,`has no step before it to appear with`):l=a):Cx.test(c)?(n.explicit=!0,l=Number(c)-1):c!==`false`&&t.bad(e,`step`,`must be true, with, or a step number from 1`),l!==null&&(n.index.set(e,l),a=l);let u=Tx(e);if(u>0){n.from.set(e,o());for(let e=1;e<u;e+=1)o();a=i-1}if(e.name===`codeblock`||e.name===`magic`)return;let d=e.attrs.get(`steps`);d!==void 0&&d!==`true`&&d!==`false`&&t.bad(e,`steps`,`must be true or false`);for(let t of e.children)Hb(t)&&s(t,d===`true`&&wx(e,t))};for(let t of e.children)Hb(t)&&s(t,!1);return n}const Ox=/^[a-z0-9-]{1,16}$/,kx=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,Ax={readFile:(e,t)=>({error:`${t} cannot be read here`})},jx=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`);function Mx(e){let t=e.filter(([e,t])=>e===`style`&&t!==!0);if(t.length<2)return e;let n=t.map(([,e])=>e).join(`;`),r=e.findIndex(([e])=>e===`style`);return e.flatMap((e,t)=>e[0]===`style`?t===r?[[`style`,n]]:[]:[e])}function Nx(e,{classes:t,attrs:n},r){return`<${[e,...r===void 0?[]:[`id="${jx(r)}"`],...t.length?[`class="${t.join(` `)}"`]:[],...Mx(n).map(([e,t])=>t===!0?e:`${e}="${jx(t)}"`)].join(` `)}>`}const Px=/^[a-z0-9][a-z0-9-]*$/;var Fx=class{env;audience;sources;deps=[];embeds=[];issues=[];refs=[];warnings=[];id;free=!1;placed=/* @__PURE__ */ new Map;blockIds=/* @__PURE__ */ new Set;slide=-1;steps=Sx;constructor(e,t=!1,n=!1){this.env=e,this.audience=t,this.sources=n}issue(e,t,n){return{code:e,slide:this.slide,...this.id?{id:this.id}:{},...n?{tag:n}:{},detail:t}}report(e,t,n){this.issues.push(this.issue(e,t,n))}warn(e,t,n){this.warnings.push(this.issue(e,t,n))}read(e,t,n){let r=this.env.readFile(e,t);if(typeof r!=`string`)return this.report(`file`,r.error,n.name),null;let i=`${e}:${t}`;return this.deps.includes(i)||this.deps.push(i),r}bad(e,t,n){this.report(`bad_value`,`${t}="${e.attrs.get(t)??``}" ${n}`,e.name)}flag(e,t){let n=e.attrs.get(t);return n===void 0||n===`false`?!1:n===`true`||(this.bad(e,t,`must be true or false`),!1)}decor(e,t=[]){let n=this.attrs(e,[...t,`morph`,`step`,...this.blockAttrs(e)]),r=this.plain(e),i=this.steps.index.get(e);i!==void 0&&(r.classes.push(`fragment`),this.steps.explicit&&r.attrs.push([`data-fragment-index`,String(i)]));let a=e.attrs.get(`step`);this.sources&&a!==void 0&&Ox.test(a)&&r.attrs.push([`data-deck-step`,a]);let o=n.get(`morph`);return o!==void 0&&(Px.test(o)?r.attrs.push([`data-morph`,o]):this.bad(e,`morph`,`must be lowercase letters, digits and hyphens`)),r}blockAttrs(e){return this.placed.has(e)?[`id`,...Xb,...dx(e.name)]:[]}plain(e){let t={classes:[],attrs:[]},n=this.placed.get(e);if(n===void 0)return t;this.id&&this.sources&&t.attrs.push([`data-deck-src`,`${this.id}:${n}`],[`data-deck-tag`,e.name]);let r=e.attrs.get(`id`);r!==void 0&&(Zb.test(r)?this.blockIds.has(r)?this.report(`bad_value`,`id="${r}" is used by another block on this slide`,e.name):(this.blockIds.add(r),this.sources&&t.attrs.push([`data-deck-id`,r])):this.bad(e,`id`,`must be letters, digits, _ and -, at most 32`));let i=this.place(e,t),a={},o=t.attrs.some(([e])=>e===`data-deck-placed`);for(let t of[`w`,`h`]){let n=e.attrs.get(t);o&&n!==void 0&&(t===`h`||n===`fill`)&&(a[t]=n)}o&&a.h!==void 0&&qb.includes(e.name)&&i.push(`overflow:hidden`);for(let n of dx(e.name)){let r=e.attrs.get(n);if(r===void 0)continue;let o=yx(e.name,n,r);o?this.report(`bad_value`,o,e.name):n===`fit`&&!e.attrs.has(`h`)?this.report(`bad_value`,`fit="shrink" needs h on a free="true" slide`,e.name):(a[n]=r,n===`align`?t.attrs.push([`data-align`,r]):n===`color`&&Jb.includes(r)?t.attrs.push([`data-color`,r]):n===`fit`?t.attrs.push([`data-deck-fit`,r]):i.push(...xx(n,r).map(([e,t])=>`${e}:${t}`)))}return i.length&&t.attrs.push([`style`,i.join(`;`)]),this.sources&&Object.keys(a).length&&t.attrs.push([`data-deck-look`,JSON.stringify(a)]),t}place(e,t){let n=Xb.filter(t=>e.attrs.has(t));if(!this.free)return n.length&&this.report(`bad_value`,`${n.join(`, `)} only work on a slide with free="true"`,e.name),[];if(![`x`,`y`,`w`].every(t=>e.attrs.has(t)))return this.report(`misplaced`,`<${e.name}> on a free="true" slide needs x, y and w`,e.name),[];let r={},i=!0;for(let t of n){let n=e.attrs.get(t);if(t===`w`&&n===`fill`)continue;let a=Number(n),o=t===`w`||t===`h`;!/^-?\d+$/.test(n)||Math.abs(a)>4e3||o&&a<=0?(this.bad(e,t,o?`must be a whole number of pixels above 0`:`must be a whole number of pixels`),i=!1):r[t]=a}if(!i)return[];let a=r.w??Math.max(1,1184-r.x),o=[`left:${r.x}px`,`top:${r.y}px`,`width:${a}px`];return r.h!==void 0&&o.push(`height:${r.h}px`),t.attrs.push([`data-deck-placed`,!0]),o}attrs(e,t){for(let n of e.attrs.keys())t.includes(n)||this.report(`unknown_attr`,n,e.name);return e.attrs}};const Ix=/^([^#]+?)(?:#L(\d+)(?:-(\d+))?)?$/,Lx=/<\/?(?:section|html|body|head)\b|<!doctype/i,Rx=/<(\/?)div\b/gi;function zx(e,t){let n=e.attrs.get(`src`).trim(),r=Ix.exec(n);if(!r)return t.bad(e,`src`,`must be a path, optionally followed by #L10 or #L10-24`),null;let[,i,a,o]=r,s=t.read(`project`,i,e);if(s===null)return null;let c=s.replaceAll(`\r
|
|
524
524
|
`,`
|
|
@@ -543,15 +543,15 @@ ${u.join(`
|
|
|
543
543
|
</html>
|
|
544
544
|
`,issues:r.issues,warnings:r.warnings,deps:r.deps,embeds:r.embeds,origins:d,refs:r.refs,title:c,groups:h,cover:S}}function eC({maxEntries:e=512,maxBytes:t=8388608}={}){let n=[],r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set,a=()=>{let e=n.at(-1);if(!e)throw Error(`no document engine is running`);return e},o=n=>{let a=/* @__PURE__ */ new Map,o=/* @__PURE__ */ new Map,s=/* @__PURE__ */ new Map,c=0,l=e=>{a.delete(e)&&(c-=e.length)},u=(n,r)=>{for(l(n),a.set(n,r),c+=n.length;a.size>1&&(a.size>e||c>t);)l(a.keys().next().value)},d=e=>{let t=[...new Set(e)].filter(e=>!a.has(e)&&!s.has(e));if(t.length){let e=Promise.resolve().then(()=>n(t)).then(e=>{let n=/* @__PURE__ */ new Set;t.forEach((t,r)=>{u(t,e[r]);for(let e of o.get(t)??[])n.add(e);o.delete(t)}),n.size&&r.forEach(e=>e([...n]))}).finally(()=>{t.forEach(e=>s.delete(e)),i.delete(e)});i.add(e);for(let n of t)s.set(n,e)}return Promise.all(e.map(e=>s.get(e))).then(()=>void 0)};return{ensure:d,get:(e,t)=>{if(a.has(e)){let t=a.get(e);return u(e,t),t}if(t){let n=o.get(e);n||o.set(e,n=/* @__PURE__ */ new Set),n.add(t)}d([e]).catch(()=>void 0)}}},s=o(e=>a().trees(e)),c=o(e=>a().checkCharts(e));return{use:e=>(n.push(e),()=>{let t=n.lastIndexOf(e);t!==-1&&n.splice(t,1)}),tree:s.get,ensure:s.ensure,chart:c.get,ensureCharts:c.ensure,idle:()=>Promise.all([...i].map(e=>e.catch(()=>void 0))).then(()=>void 0),onReady:e=>(r.add(e),()=>r.delete(e)),taskPrompt:e=>a().taskPrompt(e),open:e=>a().open(e),read:(e,t)=>a().read(e,t)}}const tC=eC();function nC(e,t){let n=d.default.resolve(e,`.${d.default.sep}${t}`);return!n.startsWith(e+d.default.sep)||d.default.relative(e,n).split(d.default.sep).some(e=>e.startsWith(`.`))?null:n}const rC=(e,t)=>e.toLowerCase().startsWith(`${t.toLowerCase()}${d.default.sep}`);function iC(e,t,n){let r=nC(e,t);if(!r)return null;let i,a;try{i=u.default.realpathSync(r),a=u.default.realpathSync(n)}catch{return null}return rC(i,a)&&u.default.statSync(i).isFile()?i:null}const aC=(e,t)=>iC(e,t,d.default.join(e,`pages`)),oC=e=>e>=11904;function sC(e,t){let n=0;for(let r of e)n+=t*(oC(r.codePointAt(0))?1:.56);return n}function cC(e,t,n){return e.split(`
|
|
545
545
|
`).reduce((e,r)=>e+Math.max(1,Math.ceil(sC(r,t)/n)),0)}function lC(e,t){let n=e.boards.map(e=>t[e]).filter(e=>!!e),r=n[0];if(!r)return null;let i=Math.min(...n.map(e=>e.x)),a=Math.min(...n.map(e=>e.y)),o=Math.max(...n.map(e=>e.x+e.w)),s=Math.max(...n.map(e=>e.y+e.h));return{page:r.page,x:i-48,y:a-144,w:o-i+96,h:s-a+144+48}}const uC=e=>Math.ceil(sC(e,40)+80+28+16);function dC(e){if(e.kind===`condition`)return{x:e.x,y:e.y,w:uC(e.text),h:96};if(e.kind===`sticky`){let t=e.w??240,n=cC(e.text,18,Math.max(1,t-32));return{x:e.x,y:e.y,w:t,h:n*27+32}}let t=fC(e),n=pC(e);return n?{...t,w:e.w??Math.max(t.w,n.w),h:t.h+n.gap+n.h}:t}function fC(e){let t=e.size??96,n=t*1.15;return e.w===void 0?{x:e.x,y:e.y,w:sC(e.text,t),h:n}:{x:e.x,y:e.y,w:e.w,h:cC(e.text,t,e.w)*n}}function pC(e){if(e.kind!==`title`||!e.description)return null;let t=e.size??96,n=Math.max(18,Math.round(t*.4)),r=Math.min(e.w??1/0,n*40),i=Math.max(...e.description.split(`
|
|
546
|
-
`).map(e=>sC(e,n)));return{size:n,maxWidth:r,gap:t*.25,w:Math.min(r,i),h:cC(e.description,n,r)*n*1.5}}function mC(e,t){let n={minX:t.x,minY:t.y,maxX:t.x+t.w,maxY:t.y+t.h};return e?{minX:Math.min(e.minX,n.minX),minY:Math.min(e.minY,n.minY),maxX:Math.max(e.maxX,n.maxX),maxY:Math.max(e.maxY,n.maxY)}:n}function hC(e){let t={},n=e=>t[e]??={groups:{},notes:{},bounds:null};for(let t of e.pages)n(t.id);for(let t of Object.values(e.boards)){let e=n(t.page);e.bounds=mC(e.bounds,{...t,y:t.y-48,h:t.h+48})}for(let[t,r]of Object.entries(e.groups??{})){let i=lC(r,e.boards);if(!i)continue;let{page:a,...o}=i,s=n(a);s.groups[t]=o,s.bounds=mC(s.bounds,o)}for(let[t,r]of Object.entries(e.notes??{})){let e=dC(r),i=n(r.page);i.notes[t]=e,i.bounds=mC(i.bounds,e)}return{pages:t}}const gC=(e,t)=>e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h,_C=[`x`,`y`,`w`,`h`],vC=[`file`,`page`,..._C],yC=[`src`,`page`,..._C],bC=e=>he(e)?e.src??``:e.file,xC=e=>he(e)?`src`:`file`,SC=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function CC(e){if(!SC(e))return[`canvas.json must be a JSON object`];let t=[];if(Array.isArray(e.pages)||t.push(`"pages" must be an array`),SC(e.boards)||t.push(`"boards" must be an object`),e.groups!==void 0&&!SC(e.groups)&&t.push(`"groups" must be an object`),e.notes!==void 0&&!SC(e.notes)&&t.push(`"notes" must be an object`),e.edges!==void 0&&!SC(e.edges)&&t.push(`"edges" must be an object`),e.focus===void 0||SC(e.focus)&&typeof e.focus.target==`string`||t.push(`"focus" must be { "target": <id> }`),e.building!==void 0&&typeof e.building!=`boolean`&&t.push(`"building" must be a boolean`),e.writing===void 0||typeof e.writing==`string`&&e.writing||t.push(`"writing" must be a board id`),SC(e.notes))for(let[n,r]of Object.entries(e.notes))SC(r)&&r.color!==void 0&&(typeof r.color!=`string`||!/^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(r.color))&&t.push(`note "${n}" color must be #RGB or #RRGGBB`);if(SC(e.boards))for(let[n,r]of Object.entries(e.boards))SC(r)&&r.trim!==void 0&&typeof r.trim!=`boolean`&&t.push(`board "${n}" field "trim" must be a boolean`),SC(r)&&r.interactive!==void 0&&typeof r.interactive!=`boolean`&&t.push(`board "${n}" field "interactive" must be a boolean`),SC(r)&&r.fit!==void 0&&typeof r.fit!=`boolean`&&t.push(`board "${n}" field "fit" must be a boolean`),SC(r)&&r.type!==void 0&&!me.includes(r.type)&&t.push(`board "${n}" field "type" must be "html", "image" or "video"`);if(SC(e.edges))for(let[n,r]of Object.entries(e.edges))!SC(r)||typeof r.from!=`string`||typeof r.to!=`string`?t.push(`edge "${n}" needs string "from" and "to"`):r.label!==void 0&&typeof r.label!=`string`&&t.push(`edge "${n}" field "label" must be a string`);if(SC(e.groups))for(let[n,r]of Object.entries(e.groups)){SC(r)&&r.verify!==void 0&&typeof r.verify!=`boolean`&&t.push(`group "${n}" field "verify" must be a boolean`);for(let e of[`from`,`capturedAt`])SC(r)&&r[e]!==void 0&&typeof r[e]!=`string`&&t.push(`group "${n}" field "${e}" must be a string`);SC(r)&&r.choose!==void 0&&typeof r.choose!=`boolean`&&t.push(`group "${n}" field "choose" must be a boolean`)}if(t.length>0)return t;e.pages.forEach((e,n)=>{SC(e)&&typeof e.id==`string`&&typeof e.name==`string`||t.push(`pages[${n}] needs string "id" and "name"`)});for(let[n,r]of Object.entries(e.boards))if(!SC(r))t.push(`board "${n}" must be an object`);else{for(let e of he(r)?yC:vC)r[e]===void 0&&t.push(`board "${n}" is missing "${e}"`);for(let e of _C)r[e]!==void 0&&typeof r[e]!=`number`&&t.push(`board "${n}" field "${e}" must be a number`);for(let e of[`file`,`src`,`page`])r[e]!==void 0&&typeof r[e]!=`string`&&t.push(`board "${n}" field "${e}" must be a string`)}for(let[n,r]of Object.entries(e.groups??{}))!SC(r)||!Array.isArray(r.boards)||r.boards.some(e=>typeof e!=`string`)?t.push(`group "${n}" needs a "boards" array`):(r.recommend!==void 0&&!r.boards.includes(r.recommend)&&t.push(`group "${n}" recommends "${String(r.recommend)}", which is not one of its boards`),r.choose===!0&&r.verify===!0&&t.push(`group "${n}" cannot be both "choose" and "verify"`));for(let[n,r]of Object.entries(e.notes??{}))!SC(r)||r.kind!==`title`&&r.kind!==`sticky`&&r.kind!==`condition`?t.push(`note "${n}" needs "kind" "title", "sticky" or "condition"`):typeof r.x!=`number`||typeof r.y!=`number`||typeof r.text!=`string`||typeof r.page!=`string`?t.push(`note "${n}" needs numeric "x", "y" and string "text", "page"`):r.description!==void 0&&r.kind!==`title`?t.push(`note "${n}" is a ${r.kind}: only a title takes "description"`):r.description!==void 0&&typeof r.description!=`string`&&t.push(`note "${n}" needs a string "description"`);return t}function wC(e){let t=[],n=Object.entries(e.edges??{}),r=e.notes??{},i=t=>e.boards[t]?.page??r[t]?.page,a=t=>!!e.boards[t]||r[t]?.kind===`condition`,o=/* @__PURE__ */ new Map,s=/* @__PURE__ */ new Map,c=/* @__PURE__ */ new Map;for(let[l,u]of n){let n=!0;for(let i of/* @__PURE__ */ new Set([u.from,u.to]))if(e.boards[i]&&r[i])t.push(`edge "${l}" end "${i}" names both a board and a note`),n=!1;else if(a(i))continue;else r[i]||e.groups?.[i]?(t.push(`edge "${l}" end "${i}" is not a board or condition`),n=!1):(t.push(`edge "${l}" references unknown board or condition "${i}"`),n=!1);if([...u.label??``].length>32&&t.push(`edge "${l}" label is longer than 32 characters`),!n)continue;if(u.from===u.to){t.push(`edge "${l}" starts and ends at "${u.from}"`);continue}if(i(u.from)!==i(u.to)){t.push(`edge "${l}" connects different pages`);continue}let d=JSON.stringify([u.from,u.to]),f=o.get(d);f===void 0?(o.set(d,l),s.set(u.to,(s.get(u.to)??0)+1),c.set(u.from,(c.get(u.from)??0)+1),r[u.from]?.kind===`condition`&&!u.label?.trim()&&t.push(`edge "${l}" leaves condition "${u.from}" and needs a "label"`)):t.push(`edges "${f}" and "${l}" both connect "${u.from}" to "${u.to}"`)}for(let[n,i]of Object.entries(r))i.kind!==`condition`||e.boards[n]||(s.get(n)||t.push(`condition "${n}" has no incoming edge`),(c.get(n)??0)<2&&t.push(`condition "${n}" needs at least two outgoing edges`));return t}function TC(e,t,n){return!n||!t||t.toLowerCase()!==n.toLowerCase()?null:`"${e}" must not repeat the artifact slug "${n}"`}function EC(e,t,n={}){let r=CC(e);if(r.length>0)return r;let i=e,a=[],o=TC(`title`,typeof i.title==`string`?i.title.trim():``,n.artifact);o&&a.push(o);let s=new Set(i.pages.map(e=>e.id)),c=Object.entries(i.boards),l=Object.entries(i.groups??{}),u=Object.entries(i.notes??{});for(let[e,r]of c){s.has(r.page)||a.push(`board "${e}" uses unknown page "${r.page}"`);let i=bC(r);i.startsWith(`pages/`)?t(i)||(n.pending?.add(e),n.allowPending||a.push(`board "${e}" file not found: ${i}`)):a.push(`board "${e}" ${xC(r)} must start with "pages/": ${i}`);let o=r.props;o!==void 0&&(he(r)?a.push(`board "${e}" is ${r.type===`image`?`an image`:`a video`} board: only an HTML board takes "props"`):SC(o)?JSON.stringify(o).length>4096&&a.push(`board "${e}" "props" must be at most 4096 characters of JSON`):a.push(`board "${e}" field "props" must be an object`))}for(let e=0;e<c.length;e++)for(let t=e+1;t<c.length;t++){let[n,r]=c[e],[i,o]=c[t];r.page===o.page&&gC(r,o)&&a.push(`boards "${n}" and "${i}" overlap`)}let d=[];for(let[e,t]of l){for(let n of t.boards)i.boards[n]||a.push(`group "${e}" references unknown board "${n}"`);new Set(t.boards.map(e=>i.boards[e]?.page).filter(Boolean)).size>1?a.push(`group "${e}" spans several pages`):d.push([e,lC(t,i.boards)])}for(let e=0;e<d.length;e++)for(let t=e+1;t<d.length;t++){let[n,r]=d[e],[i,o]=d[t];r&&o&&r.page===o.page&&gC(r,o)&&a.push(`groups "${n}" and "${i}" overlap`)}let f=new Set(l.flatMap(([,e])=>e.boards));for(let[e,t]of u){if(!s.has(t.page)){a.push(`note "${e}" uses unknown page "${t.page}"`);continue}t.kind===`title`&&sC(t.text,1)>40&&a.push(`title "${e}" is too long: keep "text" to one short line (40 full-width or about 70 Latin characters) and move the rest to "description"`);let n=dC(t);if(t.kind===`title`)for(let[r,i]of d)i&&i.page===t.page&&gC(n,i)&&a.push(`title "${e}" overlaps group "${r}"`);for(let[r,i]of c)t.kind===`title`&&f.has(r)||i.page===t.page&&gC(n,i)&&a.push(`${t.kind} "${e}" covers board "${r}"`)}a.push(...wC(i)),i.activePage!==void 0&&!s.has(i.activePage)&&a.push(`activePage "${i.activePage}" is not a page`);let p=i.focus?.target;return i.writing!==void 0&&!i.boards[i.writing]&&a.push(`writing target "${i.writing}" is not a board`),p===void 0||i.boards[p]||i.groups?.[p]||i.notes?.[p]||a.push(`focus target "${p}" is not a board, group or note`),a}function DC(e){let t;try{t=u.default.readFileSync(d.default.join(e,O.artboard),`utf8`)}catch{return{warning:`canvas.json not found`}}try{return{raw:JSON.parse(t)}}catch(e){return{warning:`canvas.json is not valid JSON: ${e.message}`}}}function OC(e,t){let n={},r,i=-1/0;for(let[a,o]of Object.entries(t.boards)){let t=aC(e,o.file);if(!t)n[o.file]=0;else try{let e=u.default.statSync(t);if(he(o)){n[o.file]=e.size>0?e.mtimeMs:0;continue}let s=u.default.readFileSync(t,`utf8`),c=/<(?:!doctype|html)\b/i.test(s),l=s.trim().length>0&&(!c||/<\/html>\s*(?:<!--[\s\S]*?-->\s*)*$/i.test(s));n[o.file]=l?e.mtimeMs:0,!l&&e.mtimeMs>=i&&(r=a,i=e.mtimeMs)}catch{n[o.file]=0}}return{versions:n,writing:r}}function kC(e){let{raw:t,warning:n}=DC(e);if(n)return{canvas:null,warnings:[n],pending:[],layout:null,versions:{}};try{let n=CC(t);if(n.length>0)return{canvas:null,warnings:n,pending:[],layout:null,versions:{}};let r={...t};r.boards=Object.fromEntries(Object.entries(r.boards).map(([e,t])=>[e,he(t)?{...t,file:t.src??``}:t]));let{versions:i,writing:a}=OC(e,r),o=/* @__PURE__ */ new Set;for(let[e,t]of Object.entries(r.boards))i[t.file]||o.add(e);return r.building=o.size>0,delete r.writing,a&&(r.writing=a),{canvas:r,warnings:EC(r,t=>aC(e,t)!==null,{artifact:d.default.basename(e),pending:o,allowPending:!0}),pending:[...o].sort(),layout:hC(r),versions:i}}catch(e){return{canvas:null,warnings:[`canvas.json could not be checked: ${e.message}`],pending:[],layout:null,versions:{}}}}function AC(e,t){u.default.mkdirSync(d.default.dirname(e),{recursive:!0});let n=`${e}.${process.pid}.tmp`;u.default.writeFileSync(n,`${JSON.stringify(t,null,2)}\n`,{mode:384}),u.default.renameSync(n,e)}function jC(e,t){let n=Nb(e,`artboard`,t),r=n?kC(n).canvas:null;if(!r)return null;let i=r.groups??{};return{boards:Object.keys(r.boards??{}),groups:Object.keys(i),choices:Object.keys(i).filter(e=>i[e]?.choose)}}function MC(e,t,n){let r=e.artboard,i=t.canvasOf(r);return i?e.group&&!i.groups.includes(e.group)?`<${n} artboard="${r}" group="${e.group}">: the artboard has no group ${e.group}`:e.board&&!i.boards.includes(e.board)?`<${n} artboard="${r}" board="${e.board}">: the artboard has no board ${e.board}`:null:null}const NC=/^(\s*<doc) ryugi-attribution="([A-Za-z0-9_-]+)"(?=[\s>])/,PC=e=>(0,f.createHash)(`sha256`).update(e).digest(`hex`);function FC(e){let t=NC.exec(e);if(!t)return{};try{let n=JSON.parse(Buffer.from(t[2],`base64url`).toString()),r=n.digest===PC(e.replace(NC,`$1`));return{...typeof n.createdBy==`string`&&{createdBy:n.createdBy},...r&&typeof n.modifiedBy==`string`&&{modifiedBy:n.modifiedBy},...r&&typeof n.model==`string`&&{model:n.model}}}catch{return{}}}const IC=/<(\/?)([a-zA-Z][\w-]*)\b([^>]*?)(\/?)>/g,LC=/\bid="([^"]+)"/,RC=e=>e.replaceAll(/<[^>]+>/g,``).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`).replaceAll(`&`,`&`).replaceAll(/\s+/g,` `).trim();function zC(e,t){let n=RC(t);if(/^h[1-6]$/.test(e))return n;let r=Array.from(n);return r.length>30?`${r.slice(0,30).join(``)}…`:n}function BC(e){let t=e.replaceAll(/<!\[CDATA\[[\s\S]*?\]\]>/g,``).replaceAll(/<ask\b[^>]*\/>|<ask\b[\s\S]*?<\/ask>/g,``),n={},r=0,i=null;for(let e of t.matchAll(IC)){let[a,o,s,c,l]=e;if(o){--r,r===1&&i&&(n[i.id]=zC(i.tag,t.slice(i.start,e.index)),i=null);continue}let u=r===1?LC.exec(c)?.[1]:void 0;l?u&&(n[u]=``):(u&&(i={id:u,start:e.index+a.length,tag:s}),r+=1)}return n}const VC=/<h[1-6]\b[^>]*>([\s\S]*?)<\/h[1-6]>/i;function HC(e,t){let n;try{n=u.default.readFileSync(d.default.join(e,O.document),`utf8`)}catch{return{title:t,blocks:{},warnings:[`doc.xml not found`],version:Rb(e)}}let r=VC.exec(n)?.[1]?.replaceAll(/<[^>]+>/g,``).trim(),i,a=[];try{i=de(e)}catch(e){a.push(`Document properties could not be read: ${e.message}`)}return{title:r||t,...FC(n),...i?{properties:i,...i.createdBy?{createdBy:i.createdBy.name}:{}}:{},blocks:BC(n),warnings:a,version:Rb(e)}}function UC(e,t){let n=Nb(e,`document`,t);return n?HC(n,t).blocks??{}:null}function WC(e,t,n){if(!e.block)return null;let r=Bv(e),i=t.documentBlocksOf(r);return i&&!Object.hasOwn(i,e.block)?`<${n} document="${r}" block="${e.block}">: the document has no block ${e.block}`:null}var GC=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t;(function(e){e[e.NONE=0]=`NONE`,e[e._abstract=1]=`_abstract`,e[e._accessor=2]=`_accessor`,e[e._as=3]=`_as`,e[e._assert=4]=`_assert`,e[e._asserts=5]=`_asserts`,e[e._async=6]=`_async`,e[e._await=7]=`_await`,e[e._checks=8]=`_checks`,e[e._constructor=9]=`_constructor`,e[e._declare=10]=`_declare`,e[e._enum=11]=`_enum`,e[e._exports=12]=`_exports`,e[e._from=13]=`_from`,e[e._get=14]=`_get`,e[e._global=15]=`_global`,e[e._implements=16]=`_implements`,e[e._infer=17]=`_infer`,e[e._interface=18]=`_interface`,e[e._is=19]=`_is`,e[e._keyof=20]=`_keyof`,e[e._mixins=21]=`_mixins`,e[e._module=22]=`_module`,e[e._namespace=23]=`_namespace`,e[e._of=24]=`_of`,e[e._opaque=25]=`_opaque`,e[e._out=26]=`_out`,e[e._override=27]=`_override`,e[e._private=28]=`_private`,e[e._protected=29]=`_protected`,e[e._proto=30]=`_proto`,e[e._public=31]=`_public`,e[e._readonly=32]=`_readonly`,e[e._require=33]=`_require`,e[e._satisfies=34]=`_satisfies`,e[e._set=35]=`_set`,e[e._static=36]=`_static`,e[e._symbol=37]=`_symbol`,e[e._type=38]=`_type`,e[e._unique=39]=`_unique`,e[e._using=40]=`_using`})(t||(e.ContextualKeyword=t={}))})),G=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});
|
|
546
|
+
`).map(e=>sC(e,n)));return{size:n,maxWidth:r,gap:t*.25,w:Math.min(r,i),h:cC(e.description,n,r)*n*1.5}}function mC(e,t){let n={minX:t.x,minY:t.y,maxX:t.x+t.w,maxY:t.y+t.h};return e?{minX:Math.min(e.minX,n.minX),minY:Math.min(e.minY,n.minY),maxX:Math.max(e.maxX,n.maxX),maxY:Math.max(e.maxY,n.maxY)}:n}function hC(e){let t={},n=e=>t[e]??={groups:{},notes:{},bounds:null};for(let t of e.pages)n(t.id);for(let t of Object.values(e.boards)){let e=n(t.page);e.bounds=mC(e.bounds,{...t,y:t.y-48,h:t.h+48})}for(let[t,r]of Object.entries(e.groups??{})){let i=lC(r,e.boards);if(!i)continue;let{page:a,...o}=i,s=n(a);s.groups[t]=o,s.bounds=mC(s.bounds,o)}for(let[t,r]of Object.entries(e.notes??{})){let e=dC(r),i=n(r.page);i.notes[t]=e,i.bounds=mC(i.bounds,e)}return{pages:t}}const gC=(e,t)=>e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h,_C=e=>typeof e==`number`,vC=e=>_C(e.x)&&_C(e.y)&&_C(e.w)&&_C(e.h),yC=e=>_C(e.x)&&_C(e.y);function bC(e){let t=Object.entries(e.boards).filter(([,e])=>!vC(e)).map(([e])=>e),n=Object.entries(e.notes??{}).filter(([,e])=>!yC(e)).map(([e])=>e);if(t.length===0&&n.length===0)return{canvas:e,boards:t,notes:n};let r=/* @__PURE__ */ new Set([...t,...n]),i=e=>Object.fromEntries(Object.entries(e).filter(([e])=>!r.has(e))),a={...e,boards:i(e.boards)};return e.notes&&(a.notes=i(e.notes)),e.groups&&(a.groups=Object.fromEntries(Object.entries(e.groups).flatMap(([e,t])=>{let n=t.boards.filter(e=>!r.has(e));return n.length===0?[]:[[e,n.length===t.boards.length?t:{...t,boards:n}]]}))),e.edges&&(a.edges=Object.fromEntries(Object.entries(e.edges).filter(([,e])=>!r.has(e.from)&&!r.has(e.to)))),{canvas:a,boards:t,notes:n}}const xC=[`x`,`y`,`w`,`h`],SC=[`file`,`page`,`w`,`h`],CC=[`src`,`page`],wC=[`src`,`page`,`w`,`h`],TC=e=>e.x===void 0&&e.y!==void 0?`"y" without "x"`:e.x!==void 0&&e.y===void 0?`"x" without "y"`:null,EC=e=>me(e)?e.src??``:e.file,DC=e=>me(e)?`src`:`file`,OC=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function kC(e){if(!OC(e))return[`canvas.json must be a JSON object`];let t=[];if(Array.isArray(e.pages)||t.push(`"pages" must be an array`),OC(e.boards)||t.push(`"boards" must be an object`),e.groups!==void 0&&!OC(e.groups)&&t.push(`"groups" must be an object`),e.notes!==void 0&&!OC(e.notes)&&t.push(`"notes" must be an object`),e.edges!==void 0&&!OC(e.edges)&&t.push(`"edges" must be an object`),e.focus===void 0||OC(e.focus)&&typeof e.focus.target==`string`||t.push(`"focus" must be { "target": <id> }`),e.building!==void 0&&typeof e.building!=`boolean`&&t.push(`"building" must be a boolean`),e.writing===void 0||typeof e.writing==`string`&&e.writing||t.push(`"writing" must be a board id`),OC(e.notes))for(let[n,r]of Object.entries(e.notes))OC(r)&&r.color!==void 0&&(typeof r.color!=`string`||!/^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(r.color))&&t.push(`note "${n}" color must be #RGB or #RRGGBB`),OC(r)&&r.beside!==void 0&&typeof r.beside!=`string`&&t.push(`note "${n}" field "beside" must be a string`);if(OC(e.boards))for(let[n,r]of Object.entries(e.boards))OC(r)&&r.trim!==void 0&&typeof r.trim!=`boolean`&&t.push(`board "${n}" field "trim" must be a boolean`),OC(r)&&r.interactive!==void 0&&typeof r.interactive!=`boolean`&&t.push(`board "${n}" field "interactive" must be a boolean`),OC(r)&&r.fit!==void 0&&typeof r.fit!=`boolean`&&t.push(`board "${n}" field "fit" must be a boolean`),OC(r)&&r.type!==void 0&&!pe.includes(r.type)&&t.push(`board "${n}" field "type" must be "html", "image" or "video"`);if(OC(e.edges))for(let[n,r]of Object.entries(e.edges))!OC(r)||typeof r.from!=`string`||typeof r.to!=`string`?t.push(`edge "${n}" needs string "from" and "to"`):r.label!==void 0&&typeof r.label!=`string`&&t.push(`edge "${n}" field "label" must be a string`);if(OC(e.groups))for(let[n,r]of Object.entries(e.groups)){OC(r)&&r.verify!==void 0&&typeof r.verify!=`boolean`&&t.push(`group "${n}" field "verify" must be a boolean`);for(let e of[`from`,`capturedAt`])OC(r)&&r[e]!==void 0&&typeof r[e]!=`string`&&t.push(`group "${n}" field "${e}" must be a string`);OC(r)&&r.choose!==void 0&&typeof r.choose!=`boolean`&&t.push(`group "${n}" field "choose" must be a boolean`),OC(r)&&r.round!==void 0&&typeof r.round!=`string`&&t.push(`group "${n}" field "round" must be a string`),OC(r)&&r.columns!==void 0&&!(typeof r.columns==`number`&&Number.isInteger(r.columns)&&r.columns>0)&&t.push(`group "${n}" field "columns" must be a positive whole number`)}if(t.length>0)return t;e.pages.forEach((e,n)=>{OC(e)&&typeof e.id==`string`&&typeof e.name==`string`||t.push(`pages[${n}] needs string "id" and "name"`)});for(let[n,r]of Object.entries(e.boards)){if(!OC(r)){t.push(`board "${n}" must be an object`);continue}let e=r.type===`video`?wC:me(r)?CC:SC;for(let i of e)r[i]===void 0&&t.push(`board "${n}" is missing "${i}"`);let i=TC(r);i&&t.push(`board "${n}" has ${i}`);for(let e of xC)r[e]!==void 0&&typeof r[e]!=`number`&&t.push(`board "${n}" field "${e}" must be a number`);for(let e of[`file`,`src`,`page`])r[e]!==void 0&&typeof r[e]!=`string`&&t.push(`board "${n}" field "${e}" must be a string`)}for(let[n,r]of Object.entries(e.groups??{}))!OC(r)||!Array.isArray(r.boards)||r.boards.some(e=>typeof e!=`string`)?t.push(`group "${n}" needs a "boards" array`):(r.recommend!==void 0&&!r.boards.includes(r.recommend)&&t.push(`group "${n}" recommends "${String(r.recommend)}", which is not one of its boards`),r.choose===!0&&r.verify===!0&&t.push(`group "${n}" cannot be both "choose" and "verify"`));for(let[n,r]of Object.entries(e.notes??{}))!OC(r)||r.kind!==`title`&&r.kind!==`sticky`&&r.kind!==`condition`?t.push(`note "${n}" needs "kind" "title", "sticky" or "condition"`):typeof r.text!=`string`||typeof r.page!=`string`||r.kind===`condition`&&(r.x===void 0||r.y===void 0)?t.push(`note "${n}" needs numeric "x", "y" and string "text", "page"`):TC(r)?t.push(`note "${n}" has ${TC(r)}`):r.x===void 0&&r.kind===`sticky`&&r.beside===void 0?t.push(`note "${n}" needs "x" and "y", or "beside"`):r.x!==void 0&&(typeof r.x!=`number`||typeof r.y!=`number`)?t.push(`note "${n}" needs numeric "x", "y" and string "text", "page"`):r.description!==void 0&&r.kind!==`title`?t.push(`note "${n}" is a ${r.kind}: only a title takes "description"`):r.description!==void 0&&typeof r.description!=`string`&&t.push(`note "${n}" needs a string "description"`);return t}function AC(e){let t=[],n=Object.entries(e.edges??{}),r=e.notes??{},i=t=>e.boards[t]?.page??r[t]?.page,a=t=>!!e.boards[t]||r[t]?.kind===`condition`,o=/* @__PURE__ */ new Map,s=/* @__PURE__ */ new Map,c=/* @__PURE__ */ new Map;for(let[l,u]of n){let n=!0;for(let i of/* @__PURE__ */ new Set([u.from,u.to]))if(e.boards[i]&&r[i])t.push(`edge "${l}" end "${i}" names both a board and a note`),n=!1;else if(a(i))continue;else r[i]||e.groups?.[i]?(t.push(`edge "${l}" end "${i}" is not a board or condition`),n=!1):(t.push(`edge "${l}" references unknown board or condition "${i}"`),n=!1);if([...u.label??``].length>32&&t.push(`edge "${l}" label is longer than 32 characters`),!n)continue;if(u.from===u.to){t.push(`edge "${l}" starts and ends at "${u.from}"`);continue}if(i(u.from)!==i(u.to)){t.push(`edge "${l}" connects different pages`);continue}let d=JSON.stringify([u.from,u.to]),f=o.get(d);f===void 0?(o.set(d,l),s.set(u.to,(s.get(u.to)??0)+1),c.set(u.from,(c.get(u.from)??0)+1),r[u.from]?.kind===`condition`&&!u.label?.trim()&&t.push(`edge "${l}" leaves condition "${u.from}" and needs a "label"`)):t.push(`edges "${f}" and "${l}" both connect "${u.from}" to "${u.to}"`)}for(let[n,i]of Object.entries(r))i.kind!==`condition`||e.boards[n]||(s.get(n)||t.push(`condition "${n}" has no incoming edge`),(c.get(n)??0)<2&&t.push(`condition "${n}" needs at least two outgoing edges`));return t}function jC(e,t,n){return!n||!t||t.toLowerCase()!==n.toLowerCase()?null:`"${e}" must not repeat the artifact slug "${n}"`}function MC(e,t,n={}){let r=kC(e);if(r.length>0)return r;let i=e,a=[],o=jC(`title`,typeof i.title==`string`?i.title.trim():``,n.artifact);o&&a.push(o);let s=new Set(i.pages.map(e=>e.id)),c=Object.entries(i.boards),l=Object.entries(i.groups??{}),u=Object.entries(i.notes??{});for(let[e,r]of c){s.has(r.page)||a.push(`board "${e}" uses unknown page "${r.page}"`);let i=EC(r);i.startsWith(`pages/`)?t(i)||(n.pending?.add(e),n.allowPending||a.push(`board "${e}" file not found: ${i}`)):a.push(`board "${e}" ${DC(r)} must start with "pages/": ${i}`);let o=r.props;o!==void 0&&(me(r)?a.push(`board "${e}" is ${r.type===`image`?`an image`:`a video`} board: only an HTML board takes "props"`):OC(o)?JSON.stringify(o).length>4096&&a.push(`board "${e}" "props" must be at most 4096 characters of JSON`):a.push(`board "${e}" field "props" must be an object`))}let d=bC(i).canvas,f=Object.entries(d.boards);for(let e=0;e<f.length;e++)for(let t=e+1;t<f.length;t++){let[n,r]=f[e],[i,o]=f[t];r.page===o.page&&gC(r,o)&&a.push(`boards "${n}" and "${i}" overlap`)}let p=[];for(let[e,t]of l){for(let n of t.boards)i.boards[n]||a.push(`group "${e}" references unknown board "${n}"`);t.round!==void 0&&i.notes?.[t.round]?.kind!==`title`&&a.push(`group "${e}" round "${t.round}" is not a title`),new Set(t.boards.map(e=>i.boards[e]?.page).filter(Boolean)).size>1?a.push(`group "${e}" spans several pages`):p.push([e,lC(t,d.boards)])}for(let e=0;e<p.length;e++)for(let t=e+1;t<p.length;t++){let[n,r]=p[e],[i,o]=p[t];r&&o&&r.page===o.page&&gC(r,o)&&a.push(`groups "${n}" and "${i}" overlap`)}let m=new Set(l.flatMap(([,e])=>e.boards));for(let[e,t]of u){if(!s.has(t.page)){a.push(`note "${e}" uses unknown page "${t.page}"`);continue}if(t.kind===`title`&&sC(t.text,1)>40&&a.push(`title "${e}" is too long: keep "text" to one short line (40 full-width or about 70 Latin characters) and move the rest to "description"`),t.beside!==void 0&&!i.groups?.[t.beside]&&!i.boards[t.beside]&&a.push(`note "${e}" is beside "${t.beside}", which is not a group or board`),!d.notes?.[e])continue;let n=dC(t);if(t.kind===`title`)for(let[r,i]of p)i&&i.page===t.page&&gC(n,i)&&a.push(`title "${e}" overlaps group "${r}"`);for(let[r,i]of f)t.kind===`title`&&m.has(r)||i.page===t.page&&gC(n,i)&&a.push(`${t.kind} "${e}" covers board "${r}"`)}a.push(...AC(i)),i.activePage!==void 0&&!s.has(i.activePage)&&a.push(`activePage "${i.activePage}" is not a page`);let h=i.focus?.target;return i.writing!==void 0&&!i.boards[i.writing]&&a.push(`writing target "${i.writing}" is not a board`),h===void 0||i.boards[h]||i.groups?.[h]||i.notes?.[h]||a.push(`focus target "${h}" is not a board, group or note`),a}function NC(e){let t;try{t=u.default.readFileSync(d.default.join(e,k.artboard),`utf8`)}catch{return{warning:`canvas.json not found`}}try{return{raw:JSON.parse(t)}}catch(e){return{warning:`canvas.json is not valid JSON: ${e.message}`}}}function PC(e,t){let n={},r,i=-1/0;for(let[a,o]of Object.entries(t.boards)){let t=aC(e,o.file);if(!t)n[o.file]=0;else try{let e=u.default.statSync(t);if(me(o)){n[o.file]=e.size>0?e.mtimeMs:0;continue}let s=u.default.readFileSync(t,`utf8`),c=/<(?:!doctype|html)\b/i.test(s),l=s.trim().length>0&&(!c||/<\/html>\s*(?:<!--[\s\S]*?-->\s*)*$/i.test(s));n[o.file]=l?e.mtimeMs:0,!l&&e.mtimeMs>=i&&(r=a,i=e.mtimeMs)}catch{n[o.file]=0}}return{versions:n,writing:r}}function FC(e){let{raw:t,warning:n}=NC(e);if(n)return{canvas:null,warnings:[n],pending:[],layout:null,versions:{}};try{let n=kC(t);if(n.length>0)return{canvas:null,warnings:n,pending:[],layout:null,versions:{}};let r=t,i=bC(r),a={...i.canvas};a.boards=Object.fromEntries(Object.entries(a.boards).map(([e,t])=>[e,me(t)?{...t,file:t.src??``}:t]));let{versions:o,writing:s}=PC(e,a),c=/* @__PURE__ */ new Set;for(let[e,t]of Object.entries(a.boards))o[t.file]||c.add(e);for(let e of i.boards)c.add(e);return a.building=c.size>0,delete a.writing,s&&(a.writing=s),{canvas:a,warnings:MC({...r,boards:{...r.boards,...a.boards}},t=>aC(e,t)!==null,{artifact:d.default.basename(e),pending:c,allowPending:!0}),pending:[...c].sort(),layout:hC(a),versions:o}}catch(e){return{canvas:null,warnings:[`canvas.json could not be checked: ${e.message}`],pending:[],layout:null,versions:{}}}}function IC(e,t){u.default.mkdirSync(d.default.dirname(e),{recursive:!0});let n=`${e}.${process.pid}.tmp`;u.default.writeFileSync(n,`${JSON.stringify(t,null,2)}\n`,{mode:384}),u.default.renameSync(n,e)}function LC(e,t){let n=Nb(e,`artboard`,t),r=n?FC(n).canvas:null;if(!r)return null;let i=r.groups??{};return{boards:Object.keys(r.boards??{}),groups:Object.keys(i),choices:Object.keys(i).filter(e=>i[e]?.choose)}}function RC(e,t,n){let r=e.artboard,i=t.canvasOf(r);return i?e.group&&!i.groups.includes(e.group)?`<${n} artboard="${r}" group="${e.group}">: the artboard has no group ${e.group}`:e.board&&!i.boards.includes(e.board)?`<${n} artboard="${r}" board="${e.board}">: the artboard has no board ${e.board}`:null:null}const zC=/^(\s*<doc) ryugi-attribution="([A-Za-z0-9_-]+)"(?=[\s>])/,BC=e=>(0,f.createHash)(`sha256`).update(e).digest(`hex`);function VC(e){let t=zC.exec(e);if(!t)return{};try{let n=JSON.parse(Buffer.from(t[2],`base64url`).toString()),r=n.digest===BC(e.replace(zC,`$1`));return{...typeof n.createdBy==`string`&&{createdBy:n.createdBy},...r&&typeof n.modifiedBy==`string`&&{modifiedBy:n.modifiedBy},...r&&typeof n.model==`string`&&{model:n.model}}}catch{return{}}}const HC=/<(\/?)([a-zA-Z][\w-]*)\b([^>]*?)(\/?)>/g,UC=/\bid="([^"]+)"/,WC=e=>e.replaceAll(/<[^>]+>/g,``).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`).replaceAll(`&`,`&`).replaceAll(/\s+/g,` `).trim();function GC(e,t){let n=WC(t);if(/^h[1-6]$/.test(e))return n;let r=Array.from(n);return r.length>30?`${r.slice(0,30).join(``)}…`:n}function KC(e){let t=e.replaceAll(/<!\[CDATA\[[\s\S]*?\]\]>/g,``).replaceAll(/<ask\b[^>]*\/>|<ask\b[\s\S]*?<\/ask>/g,``),n={},r=0,i=null;for(let e of t.matchAll(HC)){let[a,o,s,c,l]=e;if(o){--r,r===1&&i&&(n[i.id]=GC(i.tag,t.slice(i.start,e.index)),i=null);continue}let u=r===1?UC.exec(c)?.[1]:void 0;l?u&&(n[u]=``):(u&&(i={id:u,start:e.index+a.length,tag:s}),r+=1)}return n}const qC=/<h[1-6]\b[^>]*>([\s\S]*?)<\/h[1-6]>/i;function JC(e,t){let n;try{n=u.default.readFileSync(d.default.join(e,k.document),`utf8`)}catch{return{title:t,blocks:{},warnings:[`doc.xml not found`],version:Rb(e)}}let r=qC.exec(n)?.[1]?.replaceAll(/<[^>]+>/g,``).trim(),i,a=[];try{i=ue(e)}catch(e){a.push(`Document properties could not be read: ${e.message}`)}return{title:r||t,...VC(n),...i?{properties:i,...i.createdBy?{createdBy:i.createdBy.name}:{}}:{},blocks:KC(n),warnings:a,version:Rb(e)}}function YC(e,t){let n=Nb(e,`document`,t);return n?JC(n,t).blocks??{}:null}function XC(e,t,n){if(!e.block)return null;let r=Bv(e),i=t.documentBlocksOf(r);return i&&!Object.hasOwn(i,e.block)?`<${n} document="${r}" block="${e.block}">: the document has no block ${e.block}`:null}var ZC=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t;(function(e){e[e.NONE=0]=`NONE`,e[e._abstract=1]=`_abstract`,e[e._accessor=2]=`_accessor`,e[e._as=3]=`_as`,e[e._assert=4]=`_assert`,e[e._asserts=5]=`_asserts`,e[e._async=6]=`_async`,e[e._await=7]=`_await`,e[e._checks=8]=`_checks`,e[e._constructor=9]=`_constructor`,e[e._declare=10]=`_declare`,e[e._enum=11]=`_enum`,e[e._exports=12]=`_exports`,e[e._from=13]=`_from`,e[e._get=14]=`_get`,e[e._global=15]=`_global`,e[e._implements=16]=`_implements`,e[e._infer=17]=`_infer`,e[e._interface=18]=`_interface`,e[e._is=19]=`_is`,e[e._keyof=20]=`_keyof`,e[e._mixins=21]=`_mixins`,e[e._module=22]=`_module`,e[e._namespace=23]=`_namespace`,e[e._of=24]=`_of`,e[e._opaque=25]=`_opaque`,e[e._out=26]=`_out`,e[e._override=27]=`_override`,e[e._private=28]=`_private`,e[e._protected=29]=`_protected`,e[e._proto=30]=`_proto`,e[e._public=31]=`_public`,e[e._readonly=32]=`_readonly`,e[e._require=33]=`_require`,e[e._satisfies=34]=`_satisfies`,e[e._set=35]=`_set`,e[e._static=36]=`_static`,e[e._symbol=37]=`_symbol`,e[e._type=38]=`_type`,e[e._unique=39]=`_unique`,e[e._using=40]=`_using`})(t||(e.ContextualKeyword=t={}))})),G=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});
|
|
547
547
|
/* istanbul ignore file */
|
|
548
|
-
var t;(function(e){e[e.PRECEDENCE_MASK=15]=`PRECEDENCE_MASK`,e[e.IS_KEYWORD=16]=`IS_KEYWORD`,e[e.IS_ASSIGN=32]=`IS_ASSIGN`,e[e.IS_RIGHT_ASSOCIATIVE=64]=`IS_RIGHT_ASSOCIATIVE`,e[e.IS_PREFIX=128]=`IS_PREFIX`,e[e.IS_POSTFIX=256]=`IS_POSTFIX`,e[e.IS_EXPRESSION_START=512]=`IS_EXPRESSION_START`,e[e.num=512]=`num`,e[e.bigint=1536]=`bigint`,e[e.decimal=2560]=`decimal`,e[e.regexp=3584]=`regexp`,e[e.string=4608]=`string`,e[e.name=5632]=`name`,e[e.eof=6144]=`eof`,e[e.bracketL=7680]=`bracketL`,e[e.bracketR=8192]=`bracketR`,e[e.braceL=9728]=`braceL`,e[e.braceBarL=10752]=`braceBarL`,e[e.braceR=11264]=`braceR`,e[e.braceBarR=12288]=`braceBarR`,e[e.parenL=13824]=`parenL`,e[e.parenR=14336]=`parenR`,e[e.comma=15360]=`comma`,e[e.semi=16384]=`semi`,e[e.colon=17408]=`colon`,e[e.doubleColon=18432]=`doubleColon`,e[e.dot=19456]=`dot`,e[e.question=20480]=`question`,e[e.questionDot=21504]=`questionDot`,e[e.arrow=22528]=`arrow`,e[e.template=23552]=`template`,e[e.ellipsis=24576]=`ellipsis`,e[e.backQuote=25600]=`backQuote`,e[e.dollarBraceL=27136]=`dollarBraceL`,e[e.at=27648]=`at`,e[e.hash=29184]=`hash`,e[e.eq=29728]=`eq`,e[e.assign=30752]=`assign`,e[e.preIncDec=32640]=`preIncDec`,e[e.postIncDec=33664]=`postIncDec`,e[e.bang=34432]=`bang`,e[e.tilde=35456]=`tilde`,e[e.pipeline=35841]=`pipeline`,e[e.nullishCoalescing=36866]=`nullishCoalescing`,e[e.logicalOR=37890]=`logicalOR`,e[e.logicalAND=38915]=`logicalAND`,e[e.bitwiseOR=39940]=`bitwiseOR`,e[e.bitwiseXOR=40965]=`bitwiseXOR`,e[e.bitwiseAND=41990]=`bitwiseAND`,e[e.equality=43015]=`equality`,e[e.lessThan=44040]=`lessThan`,e[e.greaterThan=45064]=`greaterThan`,e[e.relationalOrEqual=46088]=`relationalOrEqual`,e[e.bitShiftL=47113]=`bitShiftL`,e[e.bitShiftR=48137]=`bitShiftR`,e[e.plus=49802]=`plus`,e[e.minus=50826]=`minus`,e[e.modulo=51723]=`modulo`,e[e.star=52235]=`star`,e[e.slash=53259]=`slash`,e[e.exponent=54348]=`exponent`,e[e.jsxName=55296]=`jsxName`,e[e.jsxText=56320]=`jsxText`,e[e.jsxEmptyText=57344]=`jsxEmptyText`,e[e.jsxTagStart=58880]=`jsxTagStart`,e[e.jsxTagEnd=59392]=`jsxTagEnd`,e[e.typeParameterStart=60928]=`typeParameterStart`,e[e.nonNullAssertion=61440]=`nonNullAssertion`,e[e._break=62480]=`_break`,e[e._case=63504]=`_case`,e[e._catch=64528]=`_catch`,e[e._continue=65552]=`_continue`,e[e._debugger=66576]=`_debugger`,e[e._default=67600]=`_default`,e[e._do=68624]=`_do`,e[e._else=69648]=`_else`,e[e._finally=70672]=`_finally`,e[e._for=71696]=`_for`,e[e._function=73232]=`_function`,e[e._if=73744]=`_if`,e[e._return=74768]=`_return`,e[e._switch=75792]=`_switch`,e[e._throw=77456]=`_throw`,e[e._try=77840]=`_try`,e[e._var=78864]=`_var`,e[e._let=79888]=`_let`,e[e._const=80912]=`_const`,e[e._while=81936]=`_while`,e[e._with=82960]=`_with`,e[e._new=84496]=`_new`,e[e._this=85520]=`_this`,e[e._super=86544]=`_super`,e[e._class=87568]=`_class`,e[e._extends=88080]=`_extends`,e[e._export=89104]=`_export`,e[e._import=90640]=`_import`,e[e._yield=91664]=`_yield`,e[e._null=92688]=`_null`,e[e._true=93712]=`_true`,e[e._false=94736]=`_false`,e[e._in=95256]=`_in`,e[e._instanceof=96280]=`_instanceof`,e[e._typeof=97936]=`_typeof`,e[e._void=98960]=`_void`,e[e._delete=99984]=`_delete`,e[e._async=100880]=`_async`,e[e._get=101904]=`_get`,e[e._set=102928]=`_set`,e[e._declare=103952]=`_declare`,e[e._readonly=104976]=`_readonly`,e[e._abstract=106e3]=`_abstract`,e[e._static=107024]=`_static`,e[e._public=107536]=`_public`,e[e._private=108560]=`_private`,e[e._protected=109584]=`_protected`,e[e._override=110608]=`_override`,e[e._as=112144]=`_as`,e[e._enum=113168]=`_enum`,e[e._type=114192]=`_type`,e[e._implements=115216]=`_implements`})(t||(e.TokenType=t={})),e.formatTokenType=function(e){switch(e){case t.num:return`num`;case t.bigint:return`bigint`;case t.decimal:return`decimal`;case t.regexp:return`regexp`;case t.string:return`string`;case t.name:return`name`;case t.eof:return`eof`;case t.bracketL:return`[`;case t.bracketR:return`]`;case t.braceL:return`{`;case t.braceBarL:return`{|`;case t.braceR:return`}`;case t.braceBarR:return`|}`;case t.parenL:return`(`;case t.parenR:return`)`;case t.comma:return`,`;case t.semi:return`;`;case t.colon:return`:`;case t.doubleColon:return`::`;case t.dot:return`.`;case t.question:return`?`;case t.questionDot:return`?.`;case t.arrow:return`=>`;case t.template:return`template`;case t.ellipsis:return`...`;case t.backQuote:return"`";case t.dollarBraceL:return"${";case t.at:return`@`;case t.hash:return`#`;case t.eq:return`=`;case t.assign:return`_=`;case t.preIncDec:case t.postIncDec:return`++/--`;case t.bang:return`!`;case t.tilde:return`~`;case t.pipeline:return`|>`;case t.nullishCoalescing:return`??`;case t.logicalOR:return`||`;case t.logicalAND:return`&&`;case t.bitwiseOR:return`|`;case t.bitwiseXOR:return`^`;case t.bitwiseAND:return`&`;case t.equality:return`==/!=`;case t.lessThan:return`<`;case t.greaterThan:return`>`;case t.relationalOrEqual:return`<=/>=`;case t.bitShiftL:return`<<`;case t.bitShiftR:return`>>/>>>`;case t.plus:return`+`;case t.minus:return`-`;case t.modulo:return`%`;case t.star:return`*`;case t.slash:return`/`;case t.exponent:return`**`;case t.jsxName:return`jsxName`;case t.jsxText:return`jsxText`;case t.jsxEmptyText:return`jsxEmptyText`;case t.jsxTagStart:return`jsxTagStart`;case t.jsxTagEnd:return`jsxTagEnd`;case t.typeParameterStart:return`typeParameterStart`;case t.nonNullAssertion:return`nonNullAssertion`;case t._break:return`break`;case t._case:return`case`;case t._catch:return`catch`;case t._continue:return`continue`;case t._debugger:return`debugger`;case t._default:return`default`;case t._do:return`do`;case t._else:return`else`;case t._finally:return`finally`;case t._for:return`for`;case t._function:return`function`;case t._if:return`if`;case t._return:return`return`;case t._switch:return`switch`;case t._throw:return`throw`;case t._try:return`try`;case t._var:return`var`;case t._let:return`let`;case t._const:return`const`;case t._while:return`while`;case t._with:return`with`;case t._new:return`new`;case t._this:return`this`;case t._super:return`super`;case t._class:return`class`;case t._extends:return`extends`;case t._export:return`export`;case t._import:return`import`;case t._yield:return`yield`;case t._null:return`null`;case t._true:return`true`;case t._false:return`false`;case t._in:return`in`;case t._instanceof:return`instanceof`;case t._typeof:return`typeof`;case t._void:return`void`;case t._delete:return`delete`;case t._async:return`async`;case t._get:return`get`;case t._set:return`set`;case t._declare:return`declare`;case t._readonly:return`readonly`;case t._abstract:return`abstract`;case t._static:return`static`;case t._public:return`public`;case t._private:return`private`;case t._protected:return`protected`;case t._override:return`override`;case t._as:return`as`;case t._enum:return`enum`;case t._type:return`type`;case t._implements:return`implements`;default:return``}}})),KC=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=GC(),n=G();e.Scope=class{constructor(e,t,n){this.startTokenIndex=e,this.endTokenIndex=t,this.isFunctionScope=n}};var r=class{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f){this.potentialArrowAt=e,this.noAnonFunctionType=t,this.inDisallowConditionalTypesContext=n,this.tokensLength=r,this.scopesLength=i,this.pos=a,this.type=o,this.contextualKeyword=s,this.start=c,this.end=l,this.isType=u,this.scopeDepth=d,this.error=f}};e.StateSnapshot=r,e.default=class e{constructor(){e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),e.prototype.__init4.call(this),e.prototype.__init5.call(this),e.prototype.__init6.call(this),e.prototype.__init7.call(this),e.prototype.__init8.call(this),e.prototype.__init9.call(this),e.prototype.__init10.call(this),e.prototype.__init11.call(this),e.prototype.__init12.call(this),e.prototype.__init13.call(this)}__init(){this.potentialArrowAt=-1}__init2(){this.noAnonFunctionType=!1}__init3(){this.inDisallowConditionalTypesContext=!1}__init4(){this.tokens=[]}__init5(){this.scopes=[]}__init6(){this.pos=0}__init7(){this.type=n.TokenType.eof}__init8(){this.contextualKeyword=t.ContextualKeyword.NONE}__init9(){this.start=0}__init10(){this.end=0}__init11(){this.isType=!1}__init12(){this.scopeDepth=0}__init13(){this.error=null}snapshot(){return new r(this.potentialArrowAt,this.noAnonFunctionType,this.inDisallowConditionalTypesContext,this.tokens.length,this.scopes.length,this.pos,this.type,this.contextualKeyword,this.start,this.end,this.isType,this.scopeDepth,this.error)}restoreFromSnapshot(e){this.potentialArrowAt=e.potentialArrowAt,this.noAnonFunctionType=e.noAnonFunctionType,this.inDisallowConditionalTypesContext=e.inDisallowConditionalTypesContext,this.tokens.length=e.tokensLength,this.scopes.length=e.scopesLength,this.pos=e.pos,this.type=e.type,this.contextualKeyword=e.contextualKeyword,this.start=e.start,this.end=e.end,this.isType=e.isType,this.scopeDepth=e.scopeDepth,this.error=e.error}}})),qC=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t;(function(e){e[e.backSpace=8]=`backSpace`,e[e.lineFeed=10]=`lineFeed`,e[e.tab=9]=`tab`,e[e.carriageReturn=13]=`carriageReturn`,e[e.shiftOut=14]=`shiftOut`,e[e.space=32]=`space`,e[e.exclamationMark=33]=`exclamationMark`,e[e.quotationMark=34]=`quotationMark`,e[e.numberSign=35]=`numberSign`,e[e.dollarSign=36]=`dollarSign`,e[e.percentSign=37]=`percentSign`,e[e.ampersand=38]=`ampersand`,e[e.apostrophe=39]=`apostrophe`,e[e.leftParenthesis=40]=`leftParenthesis`,e[e.rightParenthesis=41]=`rightParenthesis`,e[e.asterisk=42]=`asterisk`,e[e.plusSign=43]=`plusSign`,e[e.comma=44]=`comma`,e[e.dash=45]=`dash`,e[e.dot=46]=`dot`,e[e.slash=47]=`slash`,e[e.digit0=48]=`digit0`,e[e.digit1=49]=`digit1`,e[e.digit2=50]=`digit2`,e[e.digit3=51]=`digit3`,e[e.digit4=52]=`digit4`,e[e.digit5=53]=`digit5`,e[e.digit6=54]=`digit6`,e[e.digit7=55]=`digit7`,e[e.digit8=56]=`digit8`,e[e.digit9=57]=`digit9`,e[e.colon=58]=`colon`,e[e.semicolon=59]=`semicolon`,e[e.lessThan=60]=`lessThan`,e[e.equalsTo=61]=`equalsTo`,e[e.greaterThan=62]=`greaterThan`,e[e.questionMark=63]=`questionMark`,e[e.atSign=64]=`atSign`,e[e.uppercaseA=65]=`uppercaseA`,e[e.uppercaseB=66]=`uppercaseB`,e[e.uppercaseC=67]=`uppercaseC`,e[e.uppercaseD=68]=`uppercaseD`,e[e.uppercaseE=69]=`uppercaseE`,e[e.uppercaseF=70]=`uppercaseF`,e[e.uppercaseG=71]=`uppercaseG`,e[e.uppercaseH=72]=`uppercaseH`,e[e.uppercaseI=73]=`uppercaseI`,e[e.uppercaseJ=74]=`uppercaseJ`,e[e.uppercaseK=75]=`uppercaseK`,e[e.uppercaseL=76]=`uppercaseL`,e[e.uppercaseM=77]=`uppercaseM`,e[e.uppercaseN=78]=`uppercaseN`,e[e.uppercaseO=79]=`uppercaseO`,e[e.uppercaseP=80]=`uppercaseP`,e[e.uppercaseQ=81]=`uppercaseQ`,e[e.uppercaseR=82]=`uppercaseR`,e[e.uppercaseS=83]=`uppercaseS`,e[e.uppercaseT=84]=`uppercaseT`,e[e.uppercaseU=85]=`uppercaseU`,e[e.uppercaseV=86]=`uppercaseV`,e[e.uppercaseW=87]=`uppercaseW`,e[e.uppercaseX=88]=`uppercaseX`,e[e.uppercaseY=89]=`uppercaseY`,e[e.uppercaseZ=90]=`uppercaseZ`,e[e.leftSquareBracket=91]=`leftSquareBracket`,e[e.backslash=92]=`backslash`,e[e.rightSquareBracket=93]=`rightSquareBracket`,e[e.caret=94]=`caret`,e[e.underscore=95]=`underscore`,e[e.graveAccent=96]=`graveAccent`,e[e.lowercaseA=97]=`lowercaseA`,e[e.lowercaseB=98]=`lowercaseB`,e[e.lowercaseC=99]=`lowercaseC`,e[e.lowercaseD=100]=`lowercaseD`,e[e.lowercaseE=101]=`lowercaseE`,e[e.lowercaseF=102]=`lowercaseF`,e[e.lowercaseG=103]=`lowercaseG`,e[e.lowercaseH=104]=`lowercaseH`,e[e.lowercaseI=105]=`lowercaseI`,e[e.lowercaseJ=106]=`lowercaseJ`,e[e.lowercaseK=107]=`lowercaseK`,e[e.lowercaseL=108]=`lowercaseL`,e[e.lowercaseM=109]=`lowercaseM`,e[e.lowercaseN=110]=`lowercaseN`,e[e.lowercaseO=111]=`lowercaseO`,e[e.lowercaseP=112]=`lowercaseP`,e[e.lowercaseQ=113]=`lowercaseQ`,e[e.lowercaseR=114]=`lowercaseR`,e[e.lowercaseS=115]=`lowercaseS`,e[e.lowercaseT=116]=`lowercaseT`,e[e.lowercaseU=117]=`lowercaseU`,e[e.lowercaseV=118]=`lowercaseV`,e[e.lowercaseW=119]=`lowercaseW`,e[e.lowercaseX=120]=`lowercaseX`,e[e.lowercaseY=121]=`lowercaseY`,e[e.lowercaseZ=122]=`lowercaseZ`,e[e.leftCurlyBrace=123]=`leftCurlyBrace`,e[e.verticalBar=124]=`verticalBar`,e[e.rightCurlyBrace=125]=`rightCurlyBrace`,e[e.tilde=126]=`tilde`,e[e.nonBreakingSpace=160]=`nonBreakingSpace`,e[e.oghamSpaceMark=5760]=`oghamSpaceMark`,e[e.lineSeparator=8232]=`lineSeparator`,e[e.paragraphSeparator=8233]=`paragraphSeparator`})(t||(e.charCodes=t={})),e.isDigit=function(e){return e>=t.digit0&&e<=t.digit9||e>=t.lowercaseA&&e<=t.lowercaseF||e>=t.uppercaseA&&e<=t.uppercaseF}})),JC=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=t(KC()),r=qC();e.isJSXEnabled,e.isTypeScriptEnabled,e.isFlowEnabled,e.state,e.input,e.nextContextId,e.getNextContextId=function(){return e.nextContextId++},e.augmentError=function(e){if(`pos`in e){let t=a(e.pos);e.message+=` (${t.line}:${t.column})`,e.loc=t}return e};var i=class{constructor(e,t){this.line=e,this.column=t}};e.Loc=i;function a(t){let n=1,a=1;for(let i=0;i<t;i++)e.input.charCodeAt(i)===r.charCodes.lineFeed?(n++,a=1):a++;return new i(n,a)}e.locationForIndex=a,e.initParser=function(t,r,i,a){e.input=t,e.state=new n.default,e.nextContextId=1,e.isJSXEnabled=r,e.isTypeScriptEnabled=i,e.isFlowEnabled=a}})),YC=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ew(),n=G(),r=qC(),i=JC();e.isContextual=function(e){return i.state.contextualKeyword===e},e.isLookaheadContextual=function(e){let r=t.lookaheadTypeAndKeyword.call(void 0);return r.type===n.TokenType.name&&r.contextualKeyword===e};function a(e){return i.state.contextualKeyword===e&&t.eat.call(void 0,n.TokenType.name)}e.eatContextual=a,e.expectContextual=function(e){a(e)||l()};function o(){return t.match.call(void 0,n.TokenType.eof)||t.match.call(void 0,n.TokenType.braceR)||s()}e.canInsertSemicolon=o;function s(){let e=i.state.tokens[i.state.tokens.length-1],t=e?e.end:0;for(let e=t;e<i.state.start;e++){let t=i.input.charCodeAt(e);if(t===r.charCodes.lineFeed||t===r.charCodes.carriageReturn||t===8232||t===8233)return!0}return!1}e.hasPrecedingLineBreak=s,e.hasFollowingLineBreak=function(){let e=t.nextTokenStart.call(void 0);for(let t=i.state.end;t<e;t++){let e=i.input.charCodeAt(t);if(e===r.charCodes.lineFeed||e===r.charCodes.carriageReturn||e===8232||e===8233)return!0}return!1};function c(){return t.eat.call(void 0,n.TokenType.semi)||o()}e.isLineTerminator=c,e.semicolon=function(){c()||l(`Unexpected token, expected ";"`)},e.expect=function(e){t.eat.call(void 0,e)||l(`Unexpected token, expected "${n.formatTokenType.call(void 0,e)}"`)};function l(e=`Unexpected token`,r=i.state.start){if(i.state.error)return;let a=SyntaxError(e);a.pos=r,i.state.error=a,i.state.pos=i.input.length,t.finishToken.call(void 0,n.TokenType.eof)}e.unexpected=l})),XC=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=qC();e.WHITESPACE_CHARS=[9,11,12,t.charCodes.space,t.charCodes.nonBreakingSpace,t.charCodes.oghamSpaceMark,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],e.skipWhiteSpace=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,e.IS_WHITESPACE=/* @__PURE__ */ new Uint8Array(65536);for(let t of e.WHITESPACE_CHARS)e.IS_WHITESPACE[t]=1})),ZC=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=qC(),n=XC();function r(e){if(e<48)return e===36;if(e<58)return!0;if(e<65)return!1;if(e<91)return!0;if(e<97)return e===95;if(e<123)return!0;if(e<128)return!1;throw Error(`Should not be called with non-ASCII char code.`)}e.IS_IDENTIFIER_CHAR=/* @__PURE__ */ new Uint8Array(65536);for(let t=0;t<128;t++)e.IS_IDENTIFIER_CHAR[t]=+!!r(t);for(let t=128;t<65536;t++)e.IS_IDENTIFIER_CHAR[t]=1;for(let t of n.WHITESPACE_CHARS)e.IS_IDENTIFIER_CHAR[t]=0;e.IS_IDENTIFIER_CHAR[8232]=0,e.IS_IDENTIFIER_CHAR[8233]=0,e.IS_IDENTIFIER_START=e.IS_IDENTIFIER_CHAR.slice();for(let n=t.charCodes.digit0;n<=t.charCodes.digit9;n++)e.IS_IDENTIFIER_START[n]=0})),QC=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=GC(),n=G();e.READ_WORD_TREE=new Int32Array([-1,27,783,918,1755,2376,2862,3483,-1,3699,-1,4617,4752,4833,5130,5508,5940,-1,6480,6939,7749,8181,8451,8613,-1,8829,-1,-1,-1,54,243,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,432,-1,-1,-1,675,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,108,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,135,-1,-1,-1,-1,-1,-1,-1,-1,-1,162,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,189,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,216,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._abstract<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,270,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,297,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,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,-1,-1,8856,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8883,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8910,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8937,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._yield<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])})),$C=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=JC(),n=qC(),r=ZC(),i=ew(),a=QC(),o=G();e.default=function(){let e=0,s=0,c=t.state.pos;for(;c<t.input.length&&(s=t.input.charCodeAt(c),!(s<n.charCodes.lowercaseA||s>n.charCodes.lowercaseZ));){let t=a.READ_WORD_TREE[e+(s-n.charCodes.lowercaseA)+1];if(t===-1)break;e=t,c++}let l=a.READ_WORD_TREE[e];if(l>-1&&!r.IS_IDENTIFIER_CHAR[s])t.state.pos=c,l&1?i.finishToken.call(void 0,l>>>1):i.finishToken.call(void 0,o.TokenType.name,l>>>1);else{for(;c<t.input.length;){let e=t.input.charCodeAt(c);if(r.IS_IDENTIFIER_CHAR[e])c++;else if(e===n.charCodes.backslash){if(c+=2,t.input.charCodeAt(c)===n.charCodes.leftCurlyBrace){for(;c<t.input.length&&t.input.charCodeAt(c)!==n.charCodes.rightCurlyBrace;)c++;c++}}else if(e===n.charCodes.atSign&&t.input.charCodeAt(c+1)===n.charCodes.atSign)c+=2;else break}t.state.pos=c,i.finishToken.call(void 0,o.TokenType.name)}}})),ew=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=JC(),r=YC(),i=qC(),a=ZC(),o=XC(),s=GC(),c=t($C()),l=G(),u;(function(e){e[e.Access=0]=`Access`,e[e.ExportAccess=1]=`ExportAccess`,e[e.TopLevelDeclaration=2]=`TopLevelDeclaration`,e[e.FunctionScopedDeclaration=3]=`FunctionScopedDeclaration`,e[e.BlockScopedDeclaration=4]=`BlockScopedDeclaration`,e[e.ObjectShorthandTopLevelDeclaration=5]=`ObjectShorthandTopLevelDeclaration`,e[e.ObjectShorthandFunctionScopedDeclaration=6]=`ObjectShorthandFunctionScopedDeclaration`,e[e.ObjectShorthandBlockScopedDeclaration=7]=`ObjectShorthandBlockScopedDeclaration`,e[e.ObjectShorthand=8]=`ObjectShorthand`,e[e.ImportDeclaration=9]=`ImportDeclaration`,e[e.ObjectKey=10]=`ObjectKey`,e[e.ImportAccess=11]=`ImportAccess`})(u||(e.IdentifierRole=u={}));var d;(function(e){e[e.NoChildren=0]=`NoChildren`,e[e.OneChild=1]=`OneChild`,e[e.StaticChildren=2]=`StaticChildren`,e[e.KeyAfterPropSpread=3]=`KeyAfterPropSpread`})(d||(e.JSXRole=d={})),e.isDeclaration=function(e){let t=e.identifierRole;return t===u.TopLevelDeclaration||t===u.FunctionScopedDeclaration||t===u.BlockScopedDeclaration||t===u.ObjectShorthandTopLevelDeclaration||t===u.ObjectShorthandFunctionScopedDeclaration||t===u.ObjectShorthandBlockScopedDeclaration},e.isNonTopLevelDeclaration=function(e){let t=e.identifierRole;return t===u.FunctionScopedDeclaration||t===u.BlockScopedDeclaration||t===u.ObjectShorthandFunctionScopedDeclaration||t===u.ObjectShorthandBlockScopedDeclaration},e.isTopLevelDeclaration=function(e){let t=e.identifierRole;return t===u.TopLevelDeclaration||t===u.ObjectShorthandTopLevelDeclaration||t===u.ImportDeclaration},e.isBlockScopedDeclaration=function(e){let t=e.identifierRole;return t===u.TopLevelDeclaration||t===u.BlockScopedDeclaration||t===u.ObjectShorthandTopLevelDeclaration||t===u.ObjectShorthandBlockScopedDeclaration},e.isFunctionScopedDeclaration=function(e){let t=e.identifierRole;return t===u.FunctionScopedDeclaration||t===u.ObjectShorthandFunctionScopedDeclaration},e.isObjectShorthandDeclaration=function(e){return e.identifierRole===u.ObjectShorthandTopLevelDeclaration||e.identifierRole===u.ObjectShorthandBlockScopedDeclaration||e.identifierRole===u.ObjectShorthandFunctionScopedDeclaration};var f=class{constructor(){this.type=n.state.type,this.contextualKeyword=n.state.contextualKeyword,this.start=n.state.start,this.end=n.state.end,this.scopeDepth=n.state.scopeDepth,this.isType=n.state.isType,this.identifierRole=null,this.jsxRole=null,this.shadowsGlobal=!1,this.isAsyncOperation=!1,this.contextId=null,this.rhsEndIndex=null,this.isExpression=!1,this.numNullishCoalesceStarts=0,this.numNullishCoalesceEnds=0,this.isOptionalChainStart=!1,this.isOptionalChainEnd=!1,this.subscriptStartIndex=null,this.nullishStartIndex=null}};e.Token=f;function p(){n.state.tokens.push(new f),y()}e.next=p,e.nextTemplateToken=function(){n.state.tokens.push(new f),n.state.start=n.state.pos,O()},e.retokenizeSlashAsRegex=function(){n.state.type===l.TokenType.assign&&--n.state.pos,le()},e.pushTypeContext=function(e){for(let t=n.state.tokens.length-e;t<n.state.tokens.length;t++)n.state.tokens[t].isType=!0;let t=n.state.isType;return n.state.isType=!0,t},e.popTypeContext=function(e){n.state.isType=e};function m(e){return h(e)?(p(),!0):!1}e.eat=m,e.eatTypeToken=function(e){let t=n.state.isType;n.state.isType=!0,m(e),n.state.isType=t};function h(e){return n.state.type===e}e.match=h,e.lookaheadType=function(){let e=n.state.snapshot();p();let t=n.state.type;return n.state.restoreFromSnapshot(e),t};var g=class{constructor(e,t){this.type=e,this.contextualKeyword=t}};e.TypeAndKeyword=g,e.lookaheadTypeAndKeyword=function(){let e=n.state.snapshot();p();let t=n.state.type,r=n.state.contextualKeyword;return n.state.restoreFromSnapshot(e),new g(t,r)};function _(){return v(n.state.pos)}e.nextTokenStart=_;function v(e){return o.skipWhiteSpace.lastIndex=e,e+o.skipWhiteSpace.exec(n.input)[0].length}e.nextTokenStartSince=v,e.lookaheadCharCode=function(){return n.input.charCodeAt(_())};function y(){if(C(),n.state.start=n.state.pos,n.state.pos>=n.input.length){let e=n.state.tokens;e.length>=2&&e[e.length-1].start>=n.input.length&&e[e.length-2].start>=n.input.length&&r.unexpected.call(void 0,`Unexpectedly reached the end of input.`),w(l.TokenType.eof)}else b(n.input.charCodeAt(n.state.pos))}e.nextToken=y;function b(e){a.IS_IDENTIFIER_START[e]||e===i.charCodes.backslash||e===i.charCodes.atSign&&n.input.charCodeAt(n.state.pos+1)===i.charCodes.atSign?c.default.call(void 0):ce(e)}function x(){for(;n.input.charCodeAt(n.state.pos)!==i.charCodes.asterisk||n.input.charCodeAt(n.state.pos+1)!==i.charCodes.slash;)if(n.state.pos++,n.state.pos>n.input.length){r.unexpected.call(void 0,`Unterminated comment`,n.state.pos-2);return}n.state.pos+=2}function S(e){let t=n.input.charCodeAt(n.state.pos+=e);if(n.state.pos<n.input.length)for(;t!==i.charCodes.lineFeed&&t!==i.charCodes.carriageReturn&&t!==i.charCodes.lineSeparator&&t!==i.charCodes.paragraphSeparator&&++n.state.pos<n.input.length;)t=n.input.charCodeAt(n.state.pos)}e.skipLineComment=S;function C(){for(;n.state.pos<n.input.length;){let e=n.input.charCodeAt(n.state.pos);switch(e){case i.charCodes.carriageReturn:n.input.charCodeAt(n.state.pos+1)===i.charCodes.lineFeed&&++n.state.pos;case i.charCodes.lineFeed:case i.charCodes.lineSeparator:case i.charCodes.paragraphSeparator:++n.state.pos;break;case i.charCodes.slash:switch(n.input.charCodeAt(n.state.pos+1)){case i.charCodes.asterisk:n.state.pos+=2,x();break;case i.charCodes.slash:S(2);break;default:return}break;default:if(o.IS_WHITESPACE[e])++n.state.pos;else return}}}e.skipSpace=C;function w(e,t=s.ContextualKeyword.NONE){n.state.end=n.state.pos,n.state.type=e,n.state.contextualKeyword=t}e.finishToken=w;function T(){let e=n.input.charCodeAt(n.state.pos+1);e>=i.charCodes.digit0&&e<=i.charCodes.digit9?fe(!0):e===i.charCodes.dot&&n.input.charCodeAt(n.state.pos+2)===i.charCodes.dot?(n.state.pos+=3,w(l.TokenType.ellipsis)):(++n.state.pos,w(l.TokenType.dot))}function ee(){n.input.charCodeAt(n.state.pos+1)===i.charCodes.equalsTo?D(l.TokenType.assign,2):D(l.TokenType.slash,1)}function te(e){let t=e===i.charCodes.asterisk?l.TokenType.star:l.TokenType.modulo,r=1,a=n.input.charCodeAt(n.state.pos+1);e===i.charCodes.asterisk&&a===i.charCodes.asterisk&&(r++,a=n.input.charCodeAt(n.state.pos+2),t=l.TokenType.exponent),a===i.charCodes.equalsTo&&n.input.charCodeAt(n.state.pos+2)!==i.charCodes.greaterThan&&(r++,t=l.TokenType.assign),D(t,r)}function ne(e){let t=n.input.charCodeAt(n.state.pos+1);if(t===e)n.input.charCodeAt(n.state.pos+2)===i.charCodes.equalsTo?D(l.TokenType.assign,3):D(e===i.charCodes.verticalBar?l.TokenType.logicalOR:l.TokenType.logicalAND,2);else{if(e===i.charCodes.verticalBar){if(t===i.charCodes.greaterThan){D(l.TokenType.pipeline,2);return}if(t===i.charCodes.rightCurlyBrace&&n.isFlowEnabled){D(l.TokenType.braceBarR,2);return}}t===i.charCodes.equalsTo?D(l.TokenType.assign,2):D(e===i.charCodes.verticalBar?l.TokenType.bitwiseOR:l.TokenType.bitwiseAND,1)}}function re(){n.input.charCodeAt(n.state.pos+1)===i.charCodes.equalsTo?D(l.TokenType.assign,2):D(l.TokenType.bitwiseXOR,1)}function ie(e){let t=n.input.charCodeAt(n.state.pos+1);t===e?D(l.TokenType.preIncDec,2):t===i.charCodes.equalsTo?D(l.TokenType.assign,2):e===i.charCodes.plusSign?D(l.TokenType.plus,1):D(l.TokenType.minus,1)}function E(){let e=n.input.charCodeAt(n.state.pos+1);if(e===i.charCodes.lessThan){if(n.input.charCodeAt(n.state.pos+2)===i.charCodes.equalsTo){D(l.TokenType.assign,3);return}n.state.isType?D(l.TokenType.lessThan,1):D(l.TokenType.bitShiftL,2)}else e===i.charCodes.equalsTo?D(l.TokenType.relationalOrEqual,2):D(l.TokenType.lessThan,1)}function ae(){if(n.state.isType){D(l.TokenType.greaterThan,1);return}let e=n.input.charCodeAt(n.state.pos+1);if(e===i.charCodes.greaterThan){let e=n.input.charCodeAt(n.state.pos+2)===i.charCodes.greaterThan?3:2;if(n.input.charCodeAt(n.state.pos+e)===i.charCodes.equalsTo){D(l.TokenType.assign,e+1);return}D(l.TokenType.bitShiftR,e)}else e===i.charCodes.equalsTo?D(l.TokenType.relationalOrEqual,2):D(l.TokenType.greaterThan,1)}e.rescan_gt=function(){n.state.type===l.TokenType.greaterThan&&(--n.state.pos,ae())};function oe(e){let t=n.input.charCodeAt(n.state.pos+1);t===i.charCodes.equalsTo?D(l.TokenType.equality,n.input.charCodeAt(n.state.pos+2)===i.charCodes.equalsTo?3:2):e===i.charCodes.equalsTo&&t===i.charCodes.greaterThan?(n.state.pos+=2,w(l.TokenType.arrow)):D(e===i.charCodes.equalsTo?l.TokenType.eq:l.TokenType.bang,1)}function se(){let e=n.input.charCodeAt(n.state.pos+1),t=n.input.charCodeAt(n.state.pos+2);e===i.charCodes.questionMark&&!(n.isFlowEnabled&&n.state.isType)?t===i.charCodes.equalsTo?D(l.TokenType.assign,3):D(l.TokenType.nullishCoalescing,2):e===i.charCodes.dot&&!(t>=i.charCodes.digit0&&t<=i.charCodes.digit9)?(n.state.pos+=2,w(l.TokenType.questionDot)):(++n.state.pos,w(l.TokenType.question))}function ce(e){switch(e){case i.charCodes.numberSign:++n.state.pos,w(l.TokenType.hash);return;case i.charCodes.dot:T();return;case i.charCodes.leftParenthesis:++n.state.pos,w(l.TokenType.parenL);return;case i.charCodes.rightParenthesis:++n.state.pos,w(l.TokenType.parenR);return;case i.charCodes.semicolon:++n.state.pos,w(l.TokenType.semi);return;case i.charCodes.comma:++n.state.pos,w(l.TokenType.comma);return;case i.charCodes.leftSquareBracket:++n.state.pos,w(l.TokenType.bracketL);return;case i.charCodes.rightSquareBracket:++n.state.pos,w(l.TokenType.bracketR);return;case i.charCodes.leftCurlyBrace:n.isFlowEnabled&&n.input.charCodeAt(n.state.pos+1)===i.charCodes.verticalBar?D(l.TokenType.braceBarL,2):(++n.state.pos,w(l.TokenType.braceL));return;case i.charCodes.rightCurlyBrace:++n.state.pos,w(l.TokenType.braceR);return;case i.charCodes.colon:n.input.charCodeAt(n.state.pos+1)===i.charCodes.colon?D(l.TokenType.doubleColon,2):(++n.state.pos,w(l.TokenType.colon));return;case i.charCodes.questionMark:se();return;case i.charCodes.atSign:++n.state.pos,w(l.TokenType.at);return;case i.charCodes.graveAccent:++n.state.pos,w(l.TokenType.backQuote);return;case i.charCodes.digit0:{let e=n.input.charCodeAt(n.state.pos+1);if(e===i.charCodes.lowercaseX||e===i.charCodes.uppercaseX||e===i.charCodes.lowercaseO||e===i.charCodes.uppercaseO||e===i.charCodes.lowercaseB||e===i.charCodes.uppercaseB){de();return}}case i.charCodes.digit1:case i.charCodes.digit2:case i.charCodes.digit3:case i.charCodes.digit4:case i.charCodes.digit5:case i.charCodes.digit6:case i.charCodes.digit7:case i.charCodes.digit8:case i.charCodes.digit9:fe(!1);return;case i.charCodes.quotationMark:case i.charCodes.apostrophe:pe(e);return;case i.charCodes.slash:ee();return;case i.charCodes.percentSign:case i.charCodes.asterisk:te(e);return;case i.charCodes.verticalBar:case i.charCodes.ampersand:ne(e);return;case i.charCodes.caret:re();return;case i.charCodes.plusSign:case i.charCodes.dash:ie(e);return;case i.charCodes.lessThan:E();return;case i.charCodes.greaterThan:ae();return;case i.charCodes.equalsTo:case i.charCodes.exclamationMark:oe(e);return;case i.charCodes.tilde:D(l.TokenType.tilde,1);return}r.unexpected.call(void 0,`Unexpected character '${String.fromCharCode(e)}'`,n.state.pos)}e.getTokenFromCode=ce;function D(e,t){n.state.pos+=t,w(e)}function le(){let e=n.state.pos,t=!1,a=!1;for(;;){if(n.state.pos>=n.input.length){r.unexpected.call(void 0,`Unterminated regular expression`,e);return}let o=n.input.charCodeAt(n.state.pos);if(t)t=!1;else{if(o===i.charCodes.leftSquareBracket)a=!0;else if(o===i.charCodes.rightSquareBracket&&a)a=!1;else if(o===i.charCodes.slash&&!a)break;t=o===i.charCodes.backslash}++n.state.pos}++n.state.pos,me(),w(l.TokenType.regexp)}function ue(){for(;;){let e=n.input.charCodeAt(n.state.pos);if(e>=i.charCodes.digit0&&e<=i.charCodes.digit9||e===i.charCodes.underscore)n.state.pos++;else break}}function de(){for(n.state.pos+=2;;){let e=n.input.charCodeAt(n.state.pos);if(e>=i.charCodes.digit0&&e<=i.charCodes.digit9||e>=i.charCodes.lowercaseA&&e<=i.charCodes.lowercaseF||e>=i.charCodes.uppercaseA&&e<=i.charCodes.uppercaseF||e===i.charCodes.underscore)n.state.pos++;else break}n.input.charCodeAt(n.state.pos)===i.charCodes.lowercaseN?(++n.state.pos,w(l.TokenType.bigint)):w(l.TokenType.num)}function fe(e){let t=!1,r=!1;e||ue();let a=n.input.charCodeAt(n.state.pos);a===i.charCodes.dot&&(++n.state.pos,ue(),a=n.input.charCodeAt(n.state.pos)),(a===i.charCodes.uppercaseE||a===i.charCodes.lowercaseE)&&(a=n.input.charCodeAt(++n.state.pos),(a===i.charCodes.plusSign||a===i.charCodes.dash)&&++n.state.pos,ue(),a=n.input.charCodeAt(n.state.pos)),a===i.charCodes.lowercaseN?(++n.state.pos,t=!0):a===i.charCodes.lowercaseM&&(++n.state.pos,r=!0),w(t?l.TokenType.bigint:r?l.TokenType.decimal:l.TokenType.num)}function pe(e){for(n.state.pos++;;){if(n.state.pos>=n.input.length){r.unexpected.call(void 0,`Unterminated string constant`);return}let t=n.input.charCodeAt(n.state.pos);if(t===i.charCodes.backslash)n.state.pos++;else if(t===e)break;n.state.pos++}n.state.pos++,w(l.TokenType.string)}function O(){for(;;){if(n.state.pos>=n.input.length){r.unexpected.call(void 0,`Unterminated template`);return}let e=n.input.charCodeAt(n.state.pos);if(e===i.charCodes.graveAccent||e===i.charCodes.dollarSign&&n.input.charCodeAt(n.state.pos+1)===i.charCodes.leftCurlyBrace){if(n.state.pos===n.state.start&&h(l.TokenType.template)){if(e===i.charCodes.dollarSign){n.state.pos+=2,w(l.TokenType.dollarBraceL);return}++n.state.pos,w(l.TokenType.backQuote);return}w(l.TokenType.template);return}e===i.charCodes.backslash&&n.state.pos++,n.state.pos++}}function me(){for(;n.state.pos<n.input.length;){let e=n.input.charCodeAt(n.state.pos);if(a.IS_IDENTIFIER_CHAR[e])n.state.pos++;else if(e===i.charCodes.backslash){if(n.state.pos+=2,n.input.charCodeAt(n.state.pos)===i.charCodes.leftCurlyBrace){for(;n.state.pos<n.input.length&&n.input.charCodeAt(n.state.pos)!==i.charCodes.rightCurlyBrace;)n.state.pos++;n.state.pos++}}else break}}e.skipWord=me})),tw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=G();e.default=function(e,t=e.currentIndex()){let r=t+1;if(n(e,r)){let n=e.identifierNameAtIndex(t);return{isType:!1,leftName:n,rightName:n,endIndex:r}}if(r++,n(e,r))return{isType:!0,leftName:null,rightName:null,endIndex:r};if(r++,n(e,r))return{isType:!1,leftName:e.identifierNameAtIndex(t),rightName:e.identifierNameAtIndex(t+2),endIndex:r};if(r++,n(e,r))return{isType:!0,leftName:null,rightName:null,endIndex:r};throw Error(`Unexpected import/export specifier at ${t}`)};function n(e,n){let r=e.tokens[n];return r.type===t.TokenType.braceR||r.type===t.TokenType.comma}})),nw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=/* @__PURE__ */ new Map([[`quot`,`"`],[`amp`,`&`],[`apos`,`'`],[`lt`,`<`],[`gt`,`>`],[`nbsp`,`\xA0`],[`iexcl`,`¡`],[`cent`,`¢`],[`pound`,`£`],[`curren`,`¤`],[`yen`,`¥`],[`brvbar`,`¦`],[`sect`,`§`],[`uml`,`¨`],[`copy`,`©`],[`ordf`,`ª`],[`laquo`,`«`],[`not`,`¬`],[`shy`,``],[`reg`,`®`],[`macr`,`¯`],[`deg`,`°`],[`plusmn`,`±`],[`sup2`,`²`],[`sup3`,`³`],[`acute`,`´`],[`micro`,`µ`],[`para`,`¶`],[`middot`,`·`],[`cedil`,`¸`],[`sup1`,`¹`],[`ordm`,`º`],[`raquo`,`»`],[`frac14`,`¼`],[`frac12`,`½`],[`frac34`,`¾`],[`iquest`,`¿`],[`Agrave`,`À`],[`Aacute`,`Á`],[`Acirc`,`Â`],[`Atilde`,`Ã`],[`Auml`,`Ä`],[`Aring`,`Å`],[`AElig`,`Æ`],[`Ccedil`,`Ç`],[`Egrave`,`È`],[`Eacute`,`É`],[`Ecirc`,`Ê`],[`Euml`,`Ë`],[`Igrave`,`Ì`],[`Iacute`,`Í`],[`Icirc`,`Î`],[`Iuml`,`Ï`],[`ETH`,`Ð`],[`Ntilde`,`Ñ`],[`Ograve`,`Ò`],[`Oacute`,`Ó`],[`Ocirc`,`Ô`],[`Otilde`,`Õ`],[`Ouml`,`Ö`],[`times`,`×`],[`Oslash`,`Ø`],[`Ugrave`,`Ù`],[`Uacute`,`Ú`],[`Ucirc`,`Û`],[`Uuml`,`Ü`],[`Yacute`,`Ý`],[`THORN`,`Þ`],[`szlig`,`ß`],[`agrave`,`à`],[`aacute`,`á`],[`acirc`,`â`],[`atilde`,`ã`],[`auml`,`ä`],[`aring`,`å`],[`aelig`,`æ`],[`ccedil`,`ç`],[`egrave`,`è`],[`eacute`,`é`],[`ecirc`,`ê`],[`euml`,`ë`],[`igrave`,`ì`],[`iacute`,`í`],[`icirc`,`î`],[`iuml`,`ï`],[`eth`,`ð`],[`ntilde`,`ñ`],[`ograve`,`ò`],[`oacute`,`ó`],[`ocirc`,`ô`],[`otilde`,`õ`],[`ouml`,`ö`],[`divide`,`÷`],[`oslash`,`ø`],[`ugrave`,`ù`],[`uacute`,`ú`],[`ucirc`,`û`],[`uuml`,`ü`],[`yacute`,`ý`],[`thorn`,`þ`],[`yuml`,`ÿ`],[`OElig`,`Œ`],[`oelig`,`œ`],[`Scaron`,`Š`],[`scaron`,`š`],[`Yuml`,`Ÿ`],[`fnof`,`ƒ`],[`circ`,`ˆ`],[`tilde`,`˜`],[`Alpha`,`Α`],[`Beta`,`Β`],[`Gamma`,`Γ`],[`Delta`,`Δ`],[`Epsilon`,`Ε`],[`Zeta`,`Ζ`],[`Eta`,`Η`],[`Theta`,`Θ`],[`Iota`,`Ι`],[`Kappa`,`Κ`],[`Lambda`,`Λ`],[`Mu`,`Μ`],[`Nu`,`Ν`],[`Xi`,`Ξ`],[`Omicron`,`Ο`],[`Pi`,`Π`],[`Rho`,`Ρ`],[`Sigma`,`Σ`],[`Tau`,`Τ`],[`Upsilon`,`Υ`],[`Phi`,`Φ`],[`Chi`,`Χ`],[`Psi`,`Ψ`],[`Omega`,`Ω`],[`alpha`,`α`],[`beta`,`β`],[`gamma`,`γ`],[`delta`,`δ`],[`epsilon`,`ε`],[`zeta`,`ζ`],[`eta`,`η`],[`theta`,`θ`],[`iota`,`ι`],[`kappa`,`κ`],[`lambda`,`λ`],[`mu`,`μ`],[`nu`,`ν`],[`xi`,`ξ`],[`omicron`,`ο`],[`pi`,`π`],[`rho`,`ρ`],[`sigmaf`,`ς`],[`sigma`,`σ`],[`tau`,`τ`],[`upsilon`,`υ`],[`phi`,`φ`],[`chi`,`χ`],[`psi`,`ψ`],[`omega`,`ω`],[`thetasym`,`ϑ`],[`upsih`,`ϒ`],[`piv`,`ϖ`],[`ensp`,` `],[`emsp`,` `],[`thinsp`,` `],[`zwnj`,``],[`zwj`,``],[`lrm`,``],[`rlm`,``],[`ndash`,`–`],[`mdash`,`—`],[`lsquo`,`‘`],[`rsquo`,`’`],[`sbquo`,`‚`],[`ldquo`,`“`],[`rdquo`,`”`],[`bdquo`,`„`],[`dagger`,`†`],[`Dagger`,`‡`],[`bull`,`•`],[`hellip`,`…`],[`permil`,`‰`],[`prime`,`′`],[`Prime`,`″`],[`lsaquo`,`‹`],[`rsaquo`,`›`],[`oline`,`‾`],[`frasl`,`⁄`],[`euro`,`€`],[`image`,`ℑ`],[`weierp`,`℘`],[`real`,`ℜ`],[`trade`,`™`],[`alefsym`,`ℵ`],[`larr`,`←`],[`uarr`,`↑`],[`rarr`,`→`],[`darr`,`↓`],[`harr`,`↔`],[`crarr`,`↵`],[`lArr`,`⇐`],[`uArr`,`⇑`],[`rArr`,`⇒`],[`dArr`,`⇓`],[`hArr`,`⇔`],[`forall`,`∀`],[`part`,`∂`],[`exist`,`∃`],[`empty`,`∅`],[`nabla`,`∇`],[`isin`,`∈`],[`notin`,`∉`],[`ni`,`∋`],[`prod`,`∏`],[`sum`,`∑`],[`minus`,`−`],[`lowast`,`∗`],[`radic`,`√`],[`prop`,`∝`],[`infin`,`∞`],[`ang`,`∠`],[`and`,`∧`],[`or`,`∨`],[`cap`,`∩`],[`cup`,`∪`],[`int`,`∫`],[`there4`,`∴`],[`sim`,`∼`],[`cong`,`≅`],[`asymp`,`≈`],[`ne`,`≠`],[`equiv`,`≡`],[`le`,`≤`],[`ge`,`≥`],[`sub`,`⊂`],[`sup`,`⊃`],[`nsub`,`⊄`],[`sube`,`⊆`],[`supe`,`⊇`],[`oplus`,`⊕`],[`otimes`,`⊗`],[`perp`,`⊥`],[`sdot`,`⋅`],[`lceil`,`⌈`],[`rceil`,`⌉`],[`lfloor`,`⌊`],[`rfloor`,`⌋`],[`lang`,`〈`],[`rang`,`〉`],[`loz`,`◊`],[`spades`,`♠`],[`clubs`,`♣`],[`hearts`,`♥`],[`diams`,`♦`]])})),rw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){let[n,r]=t(e.jsxPragma||`React.createElement`),[i,a]=t(e.jsxFragmentPragma||`React.Fragment`);return{base:n,suffix:r,fragmentBase:i,fragmentSuffix:a}};function t(e){let t=e.indexOf(`.`);return t===-1&&(t=e.length),[e.slice(0,t),e.slice(t)]}})),iw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{getPrefixCode(){return``}getHoistedCode(){return``}getSuffixCode(){return``}}})),aw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=t(nw()),r=ew(),i=G(),a=qC(),o=t(rw()),s=t(iw());e.default=class e extends s.default{__init(){this.lastLineNumber=1}__init2(){this.lastIndex=0}__init3(){this.filenameVarName=null}__init4(){this.esmAutomaticImportNameResolutions={}}__init5(){this.cjsAutomaticModuleNameResolutions={}}constructor(t,n,r,i,a){super(),this.rootTransformer=t,this.tokens=n,this.importProcessor=r,this.nameManager=i,this.options=a,e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),e.prototype.__init4.call(this),e.prototype.__init5.call(this),this.jsxPragmaInfo=o.default.call(void 0,a),this.isAutomaticRuntime=a.jsxRuntime===`automatic`,this.jsxImportSource=a.jsxImportSource||`react`}process(){return this.tokens.matches1(i.TokenType.jsxTagStart)?(this.processJSXTag(),!0):!1}getPrefixCode(){let e=``;if(this.filenameVarName&&(e+=`const ${this.filenameVarName} = ${JSON.stringify(this.options.filePath||``)};`),this.isAutomaticRuntime){if(this.importProcessor)for(let[t,n]of Object.entries(this.cjsAutomaticModuleNameResolutions))e+=`var ${n} = require("${t}");`;else{let{createElement:t,...n}=this.esmAutomaticImportNameResolutions;t&&(e+=`import {createElement as ${t}} from "${this.jsxImportSource}";`);let r=Object.entries(n).map(([e,t])=>`${e} as ${t}`).join(`, `);if(r){let t=this.jsxImportSource+(this.options.production?`/jsx-runtime`:`/jsx-dev-runtime`);e+=`import {${r}} from "${t}";`}}}return e}processJSXTag(){let{jsxRole:e,start:t}=this.tokens.currentToken(),n=this.options.production?null:this.getElementLocationCode(t);this.isAutomaticRuntime&&e!==r.JSXRole.KeyAfterPropSpread?this.transformTagToJSXFunc(n,e):this.transformTagToCreateElement(n)}getElementLocationCode(e){return`lineNumber: ${this.getLineNumberForIndex(e)}`}getLineNumberForIndex(e){let t=this.tokens.code;for(;this.lastIndex<e&&this.lastIndex<t.length;)t[this.lastIndex]===`
|
|
548
|
+
var t;(function(e){e[e.PRECEDENCE_MASK=15]=`PRECEDENCE_MASK`,e[e.IS_KEYWORD=16]=`IS_KEYWORD`,e[e.IS_ASSIGN=32]=`IS_ASSIGN`,e[e.IS_RIGHT_ASSOCIATIVE=64]=`IS_RIGHT_ASSOCIATIVE`,e[e.IS_PREFIX=128]=`IS_PREFIX`,e[e.IS_POSTFIX=256]=`IS_POSTFIX`,e[e.IS_EXPRESSION_START=512]=`IS_EXPRESSION_START`,e[e.num=512]=`num`,e[e.bigint=1536]=`bigint`,e[e.decimal=2560]=`decimal`,e[e.regexp=3584]=`regexp`,e[e.string=4608]=`string`,e[e.name=5632]=`name`,e[e.eof=6144]=`eof`,e[e.bracketL=7680]=`bracketL`,e[e.bracketR=8192]=`bracketR`,e[e.braceL=9728]=`braceL`,e[e.braceBarL=10752]=`braceBarL`,e[e.braceR=11264]=`braceR`,e[e.braceBarR=12288]=`braceBarR`,e[e.parenL=13824]=`parenL`,e[e.parenR=14336]=`parenR`,e[e.comma=15360]=`comma`,e[e.semi=16384]=`semi`,e[e.colon=17408]=`colon`,e[e.doubleColon=18432]=`doubleColon`,e[e.dot=19456]=`dot`,e[e.question=20480]=`question`,e[e.questionDot=21504]=`questionDot`,e[e.arrow=22528]=`arrow`,e[e.template=23552]=`template`,e[e.ellipsis=24576]=`ellipsis`,e[e.backQuote=25600]=`backQuote`,e[e.dollarBraceL=27136]=`dollarBraceL`,e[e.at=27648]=`at`,e[e.hash=29184]=`hash`,e[e.eq=29728]=`eq`,e[e.assign=30752]=`assign`,e[e.preIncDec=32640]=`preIncDec`,e[e.postIncDec=33664]=`postIncDec`,e[e.bang=34432]=`bang`,e[e.tilde=35456]=`tilde`,e[e.pipeline=35841]=`pipeline`,e[e.nullishCoalescing=36866]=`nullishCoalescing`,e[e.logicalOR=37890]=`logicalOR`,e[e.logicalAND=38915]=`logicalAND`,e[e.bitwiseOR=39940]=`bitwiseOR`,e[e.bitwiseXOR=40965]=`bitwiseXOR`,e[e.bitwiseAND=41990]=`bitwiseAND`,e[e.equality=43015]=`equality`,e[e.lessThan=44040]=`lessThan`,e[e.greaterThan=45064]=`greaterThan`,e[e.relationalOrEqual=46088]=`relationalOrEqual`,e[e.bitShiftL=47113]=`bitShiftL`,e[e.bitShiftR=48137]=`bitShiftR`,e[e.plus=49802]=`plus`,e[e.minus=50826]=`minus`,e[e.modulo=51723]=`modulo`,e[e.star=52235]=`star`,e[e.slash=53259]=`slash`,e[e.exponent=54348]=`exponent`,e[e.jsxName=55296]=`jsxName`,e[e.jsxText=56320]=`jsxText`,e[e.jsxEmptyText=57344]=`jsxEmptyText`,e[e.jsxTagStart=58880]=`jsxTagStart`,e[e.jsxTagEnd=59392]=`jsxTagEnd`,e[e.typeParameterStart=60928]=`typeParameterStart`,e[e.nonNullAssertion=61440]=`nonNullAssertion`,e[e._break=62480]=`_break`,e[e._case=63504]=`_case`,e[e._catch=64528]=`_catch`,e[e._continue=65552]=`_continue`,e[e._debugger=66576]=`_debugger`,e[e._default=67600]=`_default`,e[e._do=68624]=`_do`,e[e._else=69648]=`_else`,e[e._finally=70672]=`_finally`,e[e._for=71696]=`_for`,e[e._function=73232]=`_function`,e[e._if=73744]=`_if`,e[e._return=74768]=`_return`,e[e._switch=75792]=`_switch`,e[e._throw=77456]=`_throw`,e[e._try=77840]=`_try`,e[e._var=78864]=`_var`,e[e._let=79888]=`_let`,e[e._const=80912]=`_const`,e[e._while=81936]=`_while`,e[e._with=82960]=`_with`,e[e._new=84496]=`_new`,e[e._this=85520]=`_this`,e[e._super=86544]=`_super`,e[e._class=87568]=`_class`,e[e._extends=88080]=`_extends`,e[e._export=89104]=`_export`,e[e._import=90640]=`_import`,e[e._yield=91664]=`_yield`,e[e._null=92688]=`_null`,e[e._true=93712]=`_true`,e[e._false=94736]=`_false`,e[e._in=95256]=`_in`,e[e._instanceof=96280]=`_instanceof`,e[e._typeof=97936]=`_typeof`,e[e._void=98960]=`_void`,e[e._delete=99984]=`_delete`,e[e._async=100880]=`_async`,e[e._get=101904]=`_get`,e[e._set=102928]=`_set`,e[e._declare=103952]=`_declare`,e[e._readonly=104976]=`_readonly`,e[e._abstract=106e3]=`_abstract`,e[e._static=107024]=`_static`,e[e._public=107536]=`_public`,e[e._private=108560]=`_private`,e[e._protected=109584]=`_protected`,e[e._override=110608]=`_override`,e[e._as=112144]=`_as`,e[e._enum=113168]=`_enum`,e[e._type=114192]=`_type`,e[e._implements=115216]=`_implements`})(t||(e.TokenType=t={})),e.formatTokenType=function(e){switch(e){case t.num:return`num`;case t.bigint:return`bigint`;case t.decimal:return`decimal`;case t.regexp:return`regexp`;case t.string:return`string`;case t.name:return`name`;case t.eof:return`eof`;case t.bracketL:return`[`;case t.bracketR:return`]`;case t.braceL:return`{`;case t.braceBarL:return`{|`;case t.braceR:return`}`;case t.braceBarR:return`|}`;case t.parenL:return`(`;case t.parenR:return`)`;case t.comma:return`,`;case t.semi:return`;`;case t.colon:return`:`;case t.doubleColon:return`::`;case t.dot:return`.`;case t.question:return`?`;case t.questionDot:return`?.`;case t.arrow:return`=>`;case t.template:return`template`;case t.ellipsis:return`...`;case t.backQuote:return"`";case t.dollarBraceL:return"${";case t.at:return`@`;case t.hash:return`#`;case t.eq:return`=`;case t.assign:return`_=`;case t.preIncDec:case t.postIncDec:return`++/--`;case t.bang:return`!`;case t.tilde:return`~`;case t.pipeline:return`|>`;case t.nullishCoalescing:return`??`;case t.logicalOR:return`||`;case t.logicalAND:return`&&`;case t.bitwiseOR:return`|`;case t.bitwiseXOR:return`^`;case t.bitwiseAND:return`&`;case t.equality:return`==/!=`;case t.lessThan:return`<`;case t.greaterThan:return`>`;case t.relationalOrEqual:return`<=/>=`;case t.bitShiftL:return`<<`;case t.bitShiftR:return`>>/>>>`;case t.plus:return`+`;case t.minus:return`-`;case t.modulo:return`%`;case t.star:return`*`;case t.slash:return`/`;case t.exponent:return`**`;case t.jsxName:return`jsxName`;case t.jsxText:return`jsxText`;case t.jsxEmptyText:return`jsxEmptyText`;case t.jsxTagStart:return`jsxTagStart`;case t.jsxTagEnd:return`jsxTagEnd`;case t.typeParameterStart:return`typeParameterStart`;case t.nonNullAssertion:return`nonNullAssertion`;case t._break:return`break`;case t._case:return`case`;case t._catch:return`catch`;case t._continue:return`continue`;case t._debugger:return`debugger`;case t._default:return`default`;case t._do:return`do`;case t._else:return`else`;case t._finally:return`finally`;case t._for:return`for`;case t._function:return`function`;case t._if:return`if`;case t._return:return`return`;case t._switch:return`switch`;case t._throw:return`throw`;case t._try:return`try`;case t._var:return`var`;case t._let:return`let`;case t._const:return`const`;case t._while:return`while`;case t._with:return`with`;case t._new:return`new`;case t._this:return`this`;case t._super:return`super`;case t._class:return`class`;case t._extends:return`extends`;case t._export:return`export`;case t._import:return`import`;case t._yield:return`yield`;case t._null:return`null`;case t._true:return`true`;case t._false:return`false`;case t._in:return`in`;case t._instanceof:return`instanceof`;case t._typeof:return`typeof`;case t._void:return`void`;case t._delete:return`delete`;case t._async:return`async`;case t._get:return`get`;case t._set:return`set`;case t._declare:return`declare`;case t._readonly:return`readonly`;case t._abstract:return`abstract`;case t._static:return`static`;case t._public:return`public`;case t._private:return`private`;case t._protected:return`protected`;case t._override:return`override`;case t._as:return`as`;case t._enum:return`enum`;case t._type:return`type`;case t._implements:return`implements`;default:return``}}})),QC=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ZC(),n=G();e.Scope=class{constructor(e,t,n){this.startTokenIndex=e,this.endTokenIndex=t,this.isFunctionScope=n}};var r=class{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f){this.potentialArrowAt=e,this.noAnonFunctionType=t,this.inDisallowConditionalTypesContext=n,this.tokensLength=r,this.scopesLength=i,this.pos=a,this.type=o,this.contextualKeyword=s,this.start=c,this.end=l,this.isType=u,this.scopeDepth=d,this.error=f}};e.StateSnapshot=r,e.default=class e{constructor(){e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),e.prototype.__init4.call(this),e.prototype.__init5.call(this),e.prototype.__init6.call(this),e.prototype.__init7.call(this),e.prototype.__init8.call(this),e.prototype.__init9.call(this),e.prototype.__init10.call(this),e.prototype.__init11.call(this),e.prototype.__init12.call(this),e.prototype.__init13.call(this)}__init(){this.potentialArrowAt=-1}__init2(){this.noAnonFunctionType=!1}__init3(){this.inDisallowConditionalTypesContext=!1}__init4(){this.tokens=[]}__init5(){this.scopes=[]}__init6(){this.pos=0}__init7(){this.type=n.TokenType.eof}__init8(){this.contextualKeyword=t.ContextualKeyword.NONE}__init9(){this.start=0}__init10(){this.end=0}__init11(){this.isType=!1}__init12(){this.scopeDepth=0}__init13(){this.error=null}snapshot(){return new r(this.potentialArrowAt,this.noAnonFunctionType,this.inDisallowConditionalTypesContext,this.tokens.length,this.scopes.length,this.pos,this.type,this.contextualKeyword,this.start,this.end,this.isType,this.scopeDepth,this.error)}restoreFromSnapshot(e){this.potentialArrowAt=e.potentialArrowAt,this.noAnonFunctionType=e.noAnonFunctionType,this.inDisallowConditionalTypesContext=e.inDisallowConditionalTypesContext,this.tokens.length=e.tokensLength,this.scopes.length=e.scopesLength,this.pos=e.pos,this.type=e.type,this.contextualKeyword=e.contextualKeyword,this.start=e.start,this.end=e.end,this.isType=e.isType,this.scopeDepth=e.scopeDepth,this.error=e.error}}})),$C=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t;(function(e){e[e.backSpace=8]=`backSpace`,e[e.lineFeed=10]=`lineFeed`,e[e.tab=9]=`tab`,e[e.carriageReturn=13]=`carriageReturn`,e[e.shiftOut=14]=`shiftOut`,e[e.space=32]=`space`,e[e.exclamationMark=33]=`exclamationMark`,e[e.quotationMark=34]=`quotationMark`,e[e.numberSign=35]=`numberSign`,e[e.dollarSign=36]=`dollarSign`,e[e.percentSign=37]=`percentSign`,e[e.ampersand=38]=`ampersand`,e[e.apostrophe=39]=`apostrophe`,e[e.leftParenthesis=40]=`leftParenthesis`,e[e.rightParenthesis=41]=`rightParenthesis`,e[e.asterisk=42]=`asterisk`,e[e.plusSign=43]=`plusSign`,e[e.comma=44]=`comma`,e[e.dash=45]=`dash`,e[e.dot=46]=`dot`,e[e.slash=47]=`slash`,e[e.digit0=48]=`digit0`,e[e.digit1=49]=`digit1`,e[e.digit2=50]=`digit2`,e[e.digit3=51]=`digit3`,e[e.digit4=52]=`digit4`,e[e.digit5=53]=`digit5`,e[e.digit6=54]=`digit6`,e[e.digit7=55]=`digit7`,e[e.digit8=56]=`digit8`,e[e.digit9=57]=`digit9`,e[e.colon=58]=`colon`,e[e.semicolon=59]=`semicolon`,e[e.lessThan=60]=`lessThan`,e[e.equalsTo=61]=`equalsTo`,e[e.greaterThan=62]=`greaterThan`,e[e.questionMark=63]=`questionMark`,e[e.atSign=64]=`atSign`,e[e.uppercaseA=65]=`uppercaseA`,e[e.uppercaseB=66]=`uppercaseB`,e[e.uppercaseC=67]=`uppercaseC`,e[e.uppercaseD=68]=`uppercaseD`,e[e.uppercaseE=69]=`uppercaseE`,e[e.uppercaseF=70]=`uppercaseF`,e[e.uppercaseG=71]=`uppercaseG`,e[e.uppercaseH=72]=`uppercaseH`,e[e.uppercaseI=73]=`uppercaseI`,e[e.uppercaseJ=74]=`uppercaseJ`,e[e.uppercaseK=75]=`uppercaseK`,e[e.uppercaseL=76]=`uppercaseL`,e[e.uppercaseM=77]=`uppercaseM`,e[e.uppercaseN=78]=`uppercaseN`,e[e.uppercaseO=79]=`uppercaseO`,e[e.uppercaseP=80]=`uppercaseP`,e[e.uppercaseQ=81]=`uppercaseQ`,e[e.uppercaseR=82]=`uppercaseR`,e[e.uppercaseS=83]=`uppercaseS`,e[e.uppercaseT=84]=`uppercaseT`,e[e.uppercaseU=85]=`uppercaseU`,e[e.uppercaseV=86]=`uppercaseV`,e[e.uppercaseW=87]=`uppercaseW`,e[e.uppercaseX=88]=`uppercaseX`,e[e.uppercaseY=89]=`uppercaseY`,e[e.uppercaseZ=90]=`uppercaseZ`,e[e.leftSquareBracket=91]=`leftSquareBracket`,e[e.backslash=92]=`backslash`,e[e.rightSquareBracket=93]=`rightSquareBracket`,e[e.caret=94]=`caret`,e[e.underscore=95]=`underscore`,e[e.graveAccent=96]=`graveAccent`,e[e.lowercaseA=97]=`lowercaseA`,e[e.lowercaseB=98]=`lowercaseB`,e[e.lowercaseC=99]=`lowercaseC`,e[e.lowercaseD=100]=`lowercaseD`,e[e.lowercaseE=101]=`lowercaseE`,e[e.lowercaseF=102]=`lowercaseF`,e[e.lowercaseG=103]=`lowercaseG`,e[e.lowercaseH=104]=`lowercaseH`,e[e.lowercaseI=105]=`lowercaseI`,e[e.lowercaseJ=106]=`lowercaseJ`,e[e.lowercaseK=107]=`lowercaseK`,e[e.lowercaseL=108]=`lowercaseL`,e[e.lowercaseM=109]=`lowercaseM`,e[e.lowercaseN=110]=`lowercaseN`,e[e.lowercaseO=111]=`lowercaseO`,e[e.lowercaseP=112]=`lowercaseP`,e[e.lowercaseQ=113]=`lowercaseQ`,e[e.lowercaseR=114]=`lowercaseR`,e[e.lowercaseS=115]=`lowercaseS`,e[e.lowercaseT=116]=`lowercaseT`,e[e.lowercaseU=117]=`lowercaseU`,e[e.lowercaseV=118]=`lowercaseV`,e[e.lowercaseW=119]=`lowercaseW`,e[e.lowercaseX=120]=`lowercaseX`,e[e.lowercaseY=121]=`lowercaseY`,e[e.lowercaseZ=122]=`lowercaseZ`,e[e.leftCurlyBrace=123]=`leftCurlyBrace`,e[e.verticalBar=124]=`verticalBar`,e[e.rightCurlyBrace=125]=`rightCurlyBrace`,e[e.tilde=126]=`tilde`,e[e.nonBreakingSpace=160]=`nonBreakingSpace`,e[e.oghamSpaceMark=5760]=`oghamSpaceMark`,e[e.lineSeparator=8232]=`lineSeparator`,e[e.paragraphSeparator=8233]=`paragraphSeparator`})(t||(e.charCodes=t={})),e.isDigit=function(e){return e>=t.digit0&&e<=t.digit9||e>=t.lowercaseA&&e<=t.lowercaseF||e>=t.uppercaseA&&e<=t.uppercaseF}})),ew=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=t(QC()),r=$C();e.isJSXEnabled,e.isTypeScriptEnabled,e.isFlowEnabled,e.state,e.input,e.nextContextId,e.getNextContextId=function(){return e.nextContextId++},e.augmentError=function(e){if(`pos`in e){let t=a(e.pos);e.message+=` (${t.line}:${t.column})`,e.loc=t}return e};var i=class{constructor(e,t){this.line=e,this.column=t}};e.Loc=i;function a(t){let n=1,a=1;for(let i=0;i<t;i++)e.input.charCodeAt(i)===r.charCodes.lineFeed?(n++,a=1):a++;return new i(n,a)}e.locationForIndex=a,e.initParser=function(t,r,i,a){e.input=t,e.state=new n.default,e.nextContextId=1,e.isJSXEnabled=r,e.isTypeScriptEnabled=i,e.isFlowEnabled=a}})),tw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ow(),n=G(),r=$C(),i=ew();e.isContextual=function(e){return i.state.contextualKeyword===e},e.isLookaheadContextual=function(e){let r=t.lookaheadTypeAndKeyword.call(void 0);return r.type===n.TokenType.name&&r.contextualKeyword===e};function a(e){return i.state.contextualKeyword===e&&t.eat.call(void 0,n.TokenType.name)}e.eatContextual=a,e.expectContextual=function(e){a(e)||l()};function o(){return t.match.call(void 0,n.TokenType.eof)||t.match.call(void 0,n.TokenType.braceR)||s()}e.canInsertSemicolon=o;function s(){let e=i.state.tokens[i.state.tokens.length-1],t=e?e.end:0;for(let e=t;e<i.state.start;e++){let t=i.input.charCodeAt(e);if(t===r.charCodes.lineFeed||t===r.charCodes.carriageReturn||t===8232||t===8233)return!0}return!1}e.hasPrecedingLineBreak=s,e.hasFollowingLineBreak=function(){let e=t.nextTokenStart.call(void 0);for(let t=i.state.end;t<e;t++){let e=i.input.charCodeAt(t);if(e===r.charCodes.lineFeed||e===r.charCodes.carriageReturn||e===8232||e===8233)return!0}return!1};function c(){return t.eat.call(void 0,n.TokenType.semi)||o()}e.isLineTerminator=c,e.semicolon=function(){c()||l(`Unexpected token, expected ";"`)},e.expect=function(e){t.eat.call(void 0,e)||l(`Unexpected token, expected "${n.formatTokenType.call(void 0,e)}"`)};function l(e=`Unexpected token`,r=i.state.start){if(i.state.error)return;let a=SyntaxError(e);a.pos=r,i.state.error=a,i.state.pos=i.input.length,t.finishToken.call(void 0,n.TokenType.eof)}e.unexpected=l})),nw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=$C();e.WHITESPACE_CHARS=[9,11,12,t.charCodes.space,t.charCodes.nonBreakingSpace,t.charCodes.oghamSpaceMark,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],e.skipWhiteSpace=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,e.IS_WHITESPACE=/* @__PURE__ */ new Uint8Array(65536);for(let t of e.WHITESPACE_CHARS)e.IS_WHITESPACE[t]=1})),rw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=$C(),n=nw();function r(e){if(e<48)return e===36;if(e<58)return!0;if(e<65)return!1;if(e<91)return!0;if(e<97)return e===95;if(e<123)return!0;if(e<128)return!1;throw Error(`Should not be called with non-ASCII char code.`)}e.IS_IDENTIFIER_CHAR=/* @__PURE__ */ new Uint8Array(65536);for(let t=0;t<128;t++)e.IS_IDENTIFIER_CHAR[t]=+!!r(t);for(let t=128;t<65536;t++)e.IS_IDENTIFIER_CHAR[t]=1;for(let t of n.WHITESPACE_CHARS)e.IS_IDENTIFIER_CHAR[t]=0;e.IS_IDENTIFIER_CHAR[8232]=0,e.IS_IDENTIFIER_CHAR[8233]=0,e.IS_IDENTIFIER_START=e.IS_IDENTIFIER_CHAR.slice();for(let n=t.charCodes.digit0;n<=t.charCodes.digit9;n++)e.IS_IDENTIFIER_START[n]=0})),iw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ZC(),n=G();e.READ_WORD_TREE=new Int32Array([-1,27,783,918,1755,2376,2862,3483,-1,3699,-1,4617,4752,4833,5130,5508,5940,-1,6480,6939,7749,8181,8451,8613,-1,8829,-1,-1,-1,54,243,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,432,-1,-1,-1,675,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,108,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,135,-1,-1,-1,-1,-1,-1,-1,-1,-1,162,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,189,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,216,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._abstract<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,270,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,297,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,324,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,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1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8910,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8937,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._yield<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])})),aw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ew(),n=$C(),r=rw(),i=ow(),a=iw(),o=G();e.default=function(){let e=0,s=0,c=t.state.pos;for(;c<t.input.length&&(s=t.input.charCodeAt(c),!(s<n.charCodes.lowercaseA||s>n.charCodes.lowercaseZ));){let t=a.READ_WORD_TREE[e+(s-n.charCodes.lowercaseA)+1];if(t===-1)break;e=t,c++}let l=a.READ_WORD_TREE[e];if(l>-1&&!r.IS_IDENTIFIER_CHAR[s])t.state.pos=c,l&1?i.finishToken.call(void 0,l>>>1):i.finishToken.call(void 0,o.TokenType.name,l>>>1);else{for(;c<t.input.length;){let e=t.input.charCodeAt(c);if(r.IS_IDENTIFIER_CHAR[e])c++;else if(e===n.charCodes.backslash){if(c+=2,t.input.charCodeAt(c)===n.charCodes.leftCurlyBrace){for(;c<t.input.length&&t.input.charCodeAt(c)!==n.charCodes.rightCurlyBrace;)c++;c++}}else if(e===n.charCodes.atSign&&t.input.charCodeAt(c+1)===n.charCodes.atSign)c+=2;else break}t.state.pos=c,i.finishToken.call(void 0,o.TokenType.name)}}})),ow=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=ew(),r=tw(),i=$C(),a=rw(),o=nw(),s=ZC(),c=t(aw()),l=G(),u;(function(e){e[e.Access=0]=`Access`,e[e.ExportAccess=1]=`ExportAccess`,e[e.TopLevelDeclaration=2]=`TopLevelDeclaration`,e[e.FunctionScopedDeclaration=3]=`FunctionScopedDeclaration`,e[e.BlockScopedDeclaration=4]=`BlockScopedDeclaration`,e[e.ObjectShorthandTopLevelDeclaration=5]=`ObjectShorthandTopLevelDeclaration`,e[e.ObjectShorthandFunctionScopedDeclaration=6]=`ObjectShorthandFunctionScopedDeclaration`,e[e.ObjectShorthandBlockScopedDeclaration=7]=`ObjectShorthandBlockScopedDeclaration`,e[e.ObjectShorthand=8]=`ObjectShorthand`,e[e.ImportDeclaration=9]=`ImportDeclaration`,e[e.ObjectKey=10]=`ObjectKey`,e[e.ImportAccess=11]=`ImportAccess`})(u||(e.IdentifierRole=u={}));var d;(function(e){e[e.NoChildren=0]=`NoChildren`,e[e.OneChild=1]=`OneChild`,e[e.StaticChildren=2]=`StaticChildren`,e[e.KeyAfterPropSpread=3]=`KeyAfterPropSpread`})(d||(e.JSXRole=d={})),e.isDeclaration=function(e){let t=e.identifierRole;return t===u.TopLevelDeclaration||t===u.FunctionScopedDeclaration||t===u.BlockScopedDeclaration||t===u.ObjectShorthandTopLevelDeclaration||t===u.ObjectShorthandFunctionScopedDeclaration||t===u.ObjectShorthandBlockScopedDeclaration},e.isNonTopLevelDeclaration=function(e){let t=e.identifierRole;return t===u.FunctionScopedDeclaration||t===u.BlockScopedDeclaration||t===u.ObjectShorthandFunctionScopedDeclaration||t===u.ObjectShorthandBlockScopedDeclaration},e.isTopLevelDeclaration=function(e){let t=e.identifierRole;return t===u.TopLevelDeclaration||t===u.ObjectShorthandTopLevelDeclaration||t===u.ImportDeclaration},e.isBlockScopedDeclaration=function(e){let t=e.identifierRole;return t===u.TopLevelDeclaration||t===u.BlockScopedDeclaration||t===u.ObjectShorthandTopLevelDeclaration||t===u.ObjectShorthandBlockScopedDeclaration},e.isFunctionScopedDeclaration=function(e){let t=e.identifierRole;return t===u.FunctionScopedDeclaration||t===u.ObjectShorthandFunctionScopedDeclaration},e.isObjectShorthandDeclaration=function(e){return e.identifierRole===u.ObjectShorthandTopLevelDeclaration||e.identifierRole===u.ObjectShorthandBlockScopedDeclaration||e.identifierRole===u.ObjectShorthandFunctionScopedDeclaration};var f=class{constructor(){this.type=n.state.type,this.contextualKeyword=n.state.contextualKeyword,this.start=n.state.start,this.end=n.state.end,this.scopeDepth=n.state.scopeDepth,this.isType=n.state.isType,this.identifierRole=null,this.jsxRole=null,this.shadowsGlobal=!1,this.isAsyncOperation=!1,this.contextId=null,this.rhsEndIndex=null,this.isExpression=!1,this.numNullishCoalesceStarts=0,this.numNullishCoalesceEnds=0,this.isOptionalChainStart=!1,this.isOptionalChainEnd=!1,this.subscriptStartIndex=null,this.nullishStartIndex=null}};e.Token=f;function p(){n.state.tokens.push(new f),y()}e.next=p,e.nextTemplateToken=function(){n.state.tokens.push(new f),n.state.start=n.state.pos,k()},e.retokenizeSlashAsRegex=function(){n.state.type===l.TokenType.assign&&--n.state.pos,ce()},e.pushTypeContext=function(e){for(let t=n.state.tokens.length-e;t<n.state.tokens.length;t++)n.state.tokens[t].isType=!0;let t=n.state.isType;return n.state.isType=!0,t},e.popTypeContext=function(e){n.state.isType=e};function m(e){return h(e)?(p(),!0):!1}e.eat=m,e.eatTypeToken=function(e){let t=n.state.isType;n.state.isType=!0,m(e),n.state.isType=t};function h(e){return n.state.type===e}e.match=h,e.lookaheadType=function(){let e=n.state.snapshot();p();let t=n.state.type;return n.state.restoreFromSnapshot(e),t};var g=class{constructor(e,t){this.type=e,this.contextualKeyword=t}};e.TypeAndKeyword=g,e.lookaheadTypeAndKeyword=function(){let e=n.state.snapshot();p();let t=n.state.type,r=n.state.contextualKeyword;return n.state.restoreFromSnapshot(e),new g(t,r)};function _(){return v(n.state.pos)}e.nextTokenStart=_;function v(e){return o.skipWhiteSpace.lastIndex=e,e+o.skipWhiteSpace.exec(n.input)[0].length}e.nextTokenStartSince=v,e.lookaheadCharCode=function(){return n.input.charCodeAt(_())};function y(){if(C(),n.state.start=n.state.pos,n.state.pos>=n.input.length){let e=n.state.tokens;e.length>=2&&e[e.length-1].start>=n.input.length&&e[e.length-2].start>=n.input.length&&r.unexpected.call(void 0,`Unexpectedly reached the end of input.`),w(l.TokenType.eof)}else b(n.input.charCodeAt(n.state.pos))}e.nextToken=y;function b(e){a.IS_IDENTIFIER_START[e]||e===i.charCodes.backslash||e===i.charCodes.atSign&&n.input.charCodeAt(n.state.pos+1)===i.charCodes.atSign?c.default.call(void 0):se(e)}function x(){for(;n.input.charCodeAt(n.state.pos)!==i.charCodes.asterisk||n.input.charCodeAt(n.state.pos+1)!==i.charCodes.slash;)if(n.state.pos++,n.state.pos>n.input.length){r.unexpected.call(void 0,`Unterminated comment`,n.state.pos-2);return}n.state.pos+=2}function S(e){let t=n.input.charCodeAt(n.state.pos+=e);if(n.state.pos<n.input.length)for(;t!==i.charCodes.lineFeed&&t!==i.charCodes.carriageReturn&&t!==i.charCodes.lineSeparator&&t!==i.charCodes.paragraphSeparator&&++n.state.pos<n.input.length;)t=n.input.charCodeAt(n.state.pos)}e.skipLineComment=S;function C(){for(;n.state.pos<n.input.length;){let e=n.input.charCodeAt(n.state.pos);switch(e){case i.charCodes.carriageReturn:n.input.charCodeAt(n.state.pos+1)===i.charCodes.lineFeed&&++n.state.pos;case i.charCodes.lineFeed:case i.charCodes.lineSeparator:case i.charCodes.paragraphSeparator:++n.state.pos;break;case i.charCodes.slash:switch(n.input.charCodeAt(n.state.pos+1)){case i.charCodes.asterisk:n.state.pos+=2,x();break;case i.charCodes.slash:S(2);break;default:return}break;default:if(o.IS_WHITESPACE[e])++n.state.pos;else return}}}e.skipSpace=C;function w(e,t=s.ContextualKeyword.NONE){n.state.end=n.state.pos,n.state.type=e,n.state.contextualKeyword=t}e.finishToken=w;function T(){let e=n.input.charCodeAt(n.state.pos+1);e>=i.charCodes.digit0&&e<=i.charCodes.digit9?de(!0):e===i.charCodes.dot&&n.input.charCodeAt(n.state.pos+2)===i.charCodes.dot?(n.state.pos+=3,w(l.TokenType.ellipsis)):(++n.state.pos,w(l.TokenType.dot))}function ee(){n.input.charCodeAt(n.state.pos+1)===i.charCodes.equalsTo?O(l.TokenType.assign,2):O(l.TokenType.slash,1)}function te(e){let t=e===i.charCodes.asterisk?l.TokenType.star:l.TokenType.modulo,r=1,a=n.input.charCodeAt(n.state.pos+1);e===i.charCodes.asterisk&&a===i.charCodes.asterisk&&(r++,a=n.input.charCodeAt(n.state.pos+2),t=l.TokenType.exponent),a===i.charCodes.equalsTo&&n.input.charCodeAt(n.state.pos+2)!==i.charCodes.greaterThan&&(r++,t=l.TokenType.assign),O(t,r)}function ne(e){let t=n.input.charCodeAt(n.state.pos+1);if(t===e)n.input.charCodeAt(n.state.pos+2)===i.charCodes.equalsTo?O(l.TokenType.assign,3):O(e===i.charCodes.verticalBar?l.TokenType.logicalOR:l.TokenType.logicalAND,2);else{if(e===i.charCodes.verticalBar){if(t===i.charCodes.greaterThan){O(l.TokenType.pipeline,2);return}if(t===i.charCodes.rightCurlyBrace&&n.isFlowEnabled){O(l.TokenType.braceBarR,2);return}}t===i.charCodes.equalsTo?O(l.TokenType.assign,2):O(e===i.charCodes.verticalBar?l.TokenType.bitwiseOR:l.TokenType.bitwiseAND,1)}}function E(){n.input.charCodeAt(n.state.pos+1)===i.charCodes.equalsTo?O(l.TokenType.assign,2):O(l.TokenType.bitwiseXOR,1)}function re(e){let t=n.input.charCodeAt(n.state.pos+1);t===e?O(l.TokenType.preIncDec,2):t===i.charCodes.equalsTo?O(l.TokenType.assign,2):e===i.charCodes.plusSign?O(l.TokenType.plus,1):O(l.TokenType.minus,1)}function D(){let e=n.input.charCodeAt(n.state.pos+1);if(e===i.charCodes.lessThan){if(n.input.charCodeAt(n.state.pos+2)===i.charCodes.equalsTo){O(l.TokenType.assign,3);return}n.state.isType?O(l.TokenType.lessThan,1):O(l.TokenType.bitShiftL,2)}else e===i.charCodes.equalsTo?O(l.TokenType.relationalOrEqual,2):O(l.TokenType.lessThan,1)}function ie(){if(n.state.isType){O(l.TokenType.greaterThan,1);return}let e=n.input.charCodeAt(n.state.pos+1);if(e===i.charCodes.greaterThan){let e=n.input.charCodeAt(n.state.pos+2)===i.charCodes.greaterThan?3:2;if(n.input.charCodeAt(n.state.pos+e)===i.charCodes.equalsTo){O(l.TokenType.assign,e+1);return}O(l.TokenType.bitShiftR,e)}else e===i.charCodes.equalsTo?O(l.TokenType.relationalOrEqual,2):O(l.TokenType.greaterThan,1)}e.rescan_gt=function(){n.state.type===l.TokenType.greaterThan&&(--n.state.pos,ie())};function ae(e){let t=n.input.charCodeAt(n.state.pos+1);t===i.charCodes.equalsTo?O(l.TokenType.equality,n.input.charCodeAt(n.state.pos+2)===i.charCodes.equalsTo?3:2):e===i.charCodes.equalsTo&&t===i.charCodes.greaterThan?(n.state.pos+=2,w(l.TokenType.arrow)):O(e===i.charCodes.equalsTo?l.TokenType.eq:l.TokenType.bang,1)}function oe(){let e=n.input.charCodeAt(n.state.pos+1),t=n.input.charCodeAt(n.state.pos+2);e===i.charCodes.questionMark&&!(n.isFlowEnabled&&n.state.isType)?t===i.charCodes.equalsTo?O(l.TokenType.assign,3):O(l.TokenType.nullishCoalescing,2):e===i.charCodes.dot&&!(t>=i.charCodes.digit0&&t<=i.charCodes.digit9)?(n.state.pos+=2,w(l.TokenType.questionDot)):(++n.state.pos,w(l.TokenType.question))}function se(e){switch(e){case i.charCodes.numberSign:++n.state.pos,w(l.TokenType.hash);return;case i.charCodes.dot:T();return;case i.charCodes.leftParenthesis:++n.state.pos,w(l.TokenType.parenL);return;case i.charCodes.rightParenthesis:++n.state.pos,w(l.TokenType.parenR);return;case i.charCodes.semicolon:++n.state.pos,w(l.TokenType.semi);return;case i.charCodes.comma:++n.state.pos,w(l.TokenType.comma);return;case i.charCodes.leftSquareBracket:++n.state.pos,w(l.TokenType.bracketL);return;case i.charCodes.rightSquareBracket:++n.state.pos,w(l.TokenType.bracketR);return;case i.charCodes.leftCurlyBrace:n.isFlowEnabled&&n.input.charCodeAt(n.state.pos+1)===i.charCodes.verticalBar?O(l.TokenType.braceBarL,2):(++n.state.pos,w(l.TokenType.braceL));return;case i.charCodes.rightCurlyBrace:++n.state.pos,w(l.TokenType.braceR);return;case i.charCodes.colon:n.input.charCodeAt(n.state.pos+1)===i.charCodes.colon?O(l.TokenType.doubleColon,2):(++n.state.pos,w(l.TokenType.colon));return;case i.charCodes.questionMark:oe();return;case i.charCodes.atSign:++n.state.pos,w(l.TokenType.at);return;case i.charCodes.graveAccent:++n.state.pos,w(l.TokenType.backQuote);return;case i.charCodes.digit0:{let e=n.input.charCodeAt(n.state.pos+1);if(e===i.charCodes.lowercaseX||e===i.charCodes.uppercaseX||e===i.charCodes.lowercaseO||e===i.charCodes.uppercaseO||e===i.charCodes.lowercaseB||e===i.charCodes.uppercaseB){ue();return}}case i.charCodes.digit1:case i.charCodes.digit2:case i.charCodes.digit3:case i.charCodes.digit4:case i.charCodes.digit5:case i.charCodes.digit6:case i.charCodes.digit7:case i.charCodes.digit8:case i.charCodes.digit9:de(!1);return;case i.charCodes.quotationMark:case i.charCodes.apostrophe:fe(e);return;case i.charCodes.slash:ee();return;case i.charCodes.percentSign:case i.charCodes.asterisk:te(e);return;case i.charCodes.verticalBar:case i.charCodes.ampersand:ne(e);return;case i.charCodes.caret:E();return;case i.charCodes.plusSign:case i.charCodes.dash:re(e);return;case i.charCodes.lessThan:D();return;case i.charCodes.greaterThan:ie();return;case i.charCodes.equalsTo:case i.charCodes.exclamationMark:ae(e);return;case i.charCodes.tilde:O(l.TokenType.tilde,1);return}r.unexpected.call(void 0,`Unexpected character '${String.fromCharCode(e)}'`,n.state.pos)}e.getTokenFromCode=se;function O(e,t){n.state.pos+=t,w(e)}function ce(){let e=n.state.pos,t=!1,a=!1;for(;;){if(n.state.pos>=n.input.length){r.unexpected.call(void 0,`Unterminated regular expression`,e);return}let o=n.input.charCodeAt(n.state.pos);if(t)t=!1;else{if(o===i.charCodes.leftSquareBracket)a=!0;else if(o===i.charCodes.rightSquareBracket&&a)a=!1;else if(o===i.charCodes.slash&&!a)break;t=o===i.charCodes.backslash}++n.state.pos}++n.state.pos,pe(),w(l.TokenType.regexp)}function le(){for(;;){let e=n.input.charCodeAt(n.state.pos);if(e>=i.charCodes.digit0&&e<=i.charCodes.digit9||e===i.charCodes.underscore)n.state.pos++;else break}}function ue(){for(n.state.pos+=2;;){let e=n.input.charCodeAt(n.state.pos);if(e>=i.charCodes.digit0&&e<=i.charCodes.digit9||e>=i.charCodes.lowercaseA&&e<=i.charCodes.lowercaseF||e>=i.charCodes.uppercaseA&&e<=i.charCodes.uppercaseF||e===i.charCodes.underscore)n.state.pos++;else break}n.input.charCodeAt(n.state.pos)===i.charCodes.lowercaseN?(++n.state.pos,w(l.TokenType.bigint)):w(l.TokenType.num)}function de(e){let t=!1,r=!1;e||le();let a=n.input.charCodeAt(n.state.pos);a===i.charCodes.dot&&(++n.state.pos,le(),a=n.input.charCodeAt(n.state.pos)),(a===i.charCodes.uppercaseE||a===i.charCodes.lowercaseE)&&(a=n.input.charCodeAt(++n.state.pos),(a===i.charCodes.plusSign||a===i.charCodes.dash)&&++n.state.pos,le(),a=n.input.charCodeAt(n.state.pos)),a===i.charCodes.lowercaseN?(++n.state.pos,t=!0):a===i.charCodes.lowercaseM&&(++n.state.pos,r=!0),w(t?l.TokenType.bigint:r?l.TokenType.decimal:l.TokenType.num)}function fe(e){for(n.state.pos++;;){if(n.state.pos>=n.input.length){r.unexpected.call(void 0,`Unterminated string constant`);return}let t=n.input.charCodeAt(n.state.pos);if(t===i.charCodes.backslash)n.state.pos++;else if(t===e)break;n.state.pos++}n.state.pos++,w(l.TokenType.string)}function k(){for(;;){if(n.state.pos>=n.input.length){r.unexpected.call(void 0,`Unterminated template`);return}let e=n.input.charCodeAt(n.state.pos);if(e===i.charCodes.graveAccent||e===i.charCodes.dollarSign&&n.input.charCodeAt(n.state.pos+1)===i.charCodes.leftCurlyBrace){if(n.state.pos===n.state.start&&h(l.TokenType.template)){if(e===i.charCodes.dollarSign){n.state.pos+=2,w(l.TokenType.dollarBraceL);return}++n.state.pos,w(l.TokenType.backQuote);return}w(l.TokenType.template);return}e===i.charCodes.backslash&&n.state.pos++,n.state.pos++}}function pe(){for(;n.state.pos<n.input.length;){let e=n.input.charCodeAt(n.state.pos);if(a.IS_IDENTIFIER_CHAR[e])n.state.pos++;else if(e===i.charCodes.backslash){if(n.state.pos+=2,n.input.charCodeAt(n.state.pos)===i.charCodes.leftCurlyBrace){for(;n.state.pos<n.input.length&&n.input.charCodeAt(n.state.pos)!==i.charCodes.rightCurlyBrace;)n.state.pos++;n.state.pos++}}else break}}e.skipWord=pe})),sw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=G();e.default=function(e,t=e.currentIndex()){let r=t+1;if(n(e,r)){let n=e.identifierNameAtIndex(t);return{isType:!1,leftName:n,rightName:n,endIndex:r}}if(r++,n(e,r))return{isType:!0,leftName:null,rightName:null,endIndex:r};if(r++,n(e,r))return{isType:!1,leftName:e.identifierNameAtIndex(t),rightName:e.identifierNameAtIndex(t+2),endIndex:r};if(r++,n(e,r))return{isType:!0,leftName:null,rightName:null,endIndex:r};throw Error(`Unexpected import/export specifier at ${t}`)};function n(e,n){let r=e.tokens[n];return r.type===t.TokenType.braceR||r.type===t.TokenType.comma}})),cw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=/* @__PURE__ */ new Map([[`quot`,`"`],[`amp`,`&`],[`apos`,`'`],[`lt`,`<`],[`gt`,`>`],[`nbsp`,`\xA0`],[`iexcl`,`¡`],[`cent`,`¢`],[`pound`,`£`],[`curren`,`¤`],[`yen`,`¥`],[`brvbar`,`¦`],[`sect`,`§`],[`uml`,`¨`],[`copy`,`©`],[`ordf`,`ª`],[`laquo`,`«`],[`not`,`¬`],[`shy`,``],[`reg`,`®`],[`macr`,`¯`],[`deg`,`°`],[`plusmn`,`±`],[`sup2`,`²`],[`sup3`,`³`],[`acute`,`´`],[`micro`,`µ`],[`para`,`¶`],[`middot`,`·`],[`cedil`,`¸`],[`sup1`,`¹`],[`ordm`,`º`],[`raquo`,`»`],[`frac14`,`¼`],[`frac12`,`½`],[`frac34`,`¾`],[`iquest`,`¿`],[`Agrave`,`À`],[`Aacute`,`Á`],[`Acirc`,`Â`],[`Atilde`,`Ã`],[`Auml`,`Ä`],[`Aring`,`Å`],[`AElig`,`Æ`],[`Ccedil`,`Ç`],[`Egrave`,`È`],[`Eacute`,`É`],[`Ecirc`,`Ê`],[`Euml`,`Ë`],[`Igrave`,`Ì`],[`Iacute`,`Í`],[`Icirc`,`Î`],[`Iuml`,`Ï`],[`ETH`,`Ð`],[`Ntilde`,`Ñ`],[`Ograve`,`Ò`],[`Oacute`,`Ó`],[`Ocirc`,`Ô`],[`Otilde`,`Õ`],[`Ouml`,`Ö`],[`times`,`×`],[`Oslash`,`Ø`],[`Ugrave`,`Ù`],[`Uacute`,`Ú`],[`Ucirc`,`Û`],[`Uuml`,`Ü`],[`Yacute`,`Ý`],[`THORN`,`Þ`],[`szlig`,`ß`],[`agrave`,`à`],[`aacute`,`á`],[`acirc`,`â`],[`atilde`,`ã`],[`auml`,`ä`],[`aring`,`å`],[`aelig`,`æ`],[`ccedil`,`ç`],[`egrave`,`è`],[`eacute`,`é`],[`ecirc`,`ê`],[`euml`,`ë`],[`igrave`,`ì`],[`iacute`,`í`],[`icirc`,`î`],[`iuml`,`ï`],[`eth`,`ð`],[`ntilde`,`ñ`],[`ograve`,`ò`],[`oacute`,`ó`],[`ocirc`,`ô`],[`otilde`,`õ`],[`ouml`,`ö`],[`divide`,`÷`],[`oslash`,`ø`],[`ugrave`,`ù`],[`uacute`,`ú`],[`ucirc`,`û`],[`uuml`,`ü`],[`yacute`,`ý`],[`thorn`,`þ`],[`yuml`,`ÿ`],[`OElig`,`Œ`],[`oelig`,`œ`],[`Scaron`,`Š`],[`scaron`,`š`],[`Yuml`,`Ÿ`],[`fnof`,`ƒ`],[`circ`,`ˆ`],[`tilde`,`˜`],[`Alpha`,`Α`],[`Beta`,`Β`],[`Gamma`,`Γ`],[`Delta`,`Δ`],[`Epsilon`,`Ε`],[`Zeta`,`Ζ`],[`Eta`,`Η`],[`Theta`,`Θ`],[`Iota`,`Ι`],[`Kappa`,`Κ`],[`Lambda`,`Λ`],[`Mu`,`Μ`],[`Nu`,`Ν`],[`Xi`,`Ξ`],[`Omicron`,`Ο`],[`Pi`,`Π`],[`Rho`,`Ρ`],[`Sigma`,`Σ`],[`Tau`,`Τ`],[`Upsilon`,`Υ`],[`Phi`,`Φ`],[`Chi`,`Χ`],[`Psi`,`Ψ`],[`Omega`,`Ω`],[`alpha`,`α`],[`beta`,`β`],[`gamma`,`γ`],[`delta`,`δ`],[`epsilon`,`ε`],[`zeta`,`ζ`],[`eta`,`η`],[`theta`,`θ`],[`iota`,`ι`],[`kappa`,`κ`],[`lambda`,`λ`],[`mu`,`μ`],[`nu`,`ν`],[`xi`,`ξ`],[`omicron`,`ο`],[`pi`,`π`],[`rho`,`ρ`],[`sigmaf`,`ς`],[`sigma`,`σ`],[`tau`,`τ`],[`upsilon`,`υ`],[`phi`,`φ`],[`chi`,`χ`],[`psi`,`ψ`],[`omega`,`ω`],[`thetasym`,`ϑ`],[`upsih`,`ϒ`],[`piv`,`ϖ`],[`ensp`,` `],[`emsp`,` `],[`thinsp`,` `],[`zwnj`,``],[`zwj`,``],[`lrm`,``],[`rlm`,``],[`ndash`,`–`],[`mdash`,`—`],[`lsquo`,`‘`],[`rsquo`,`’`],[`sbquo`,`‚`],[`ldquo`,`“`],[`rdquo`,`”`],[`bdquo`,`„`],[`dagger`,`†`],[`Dagger`,`‡`],[`bull`,`•`],[`hellip`,`…`],[`permil`,`‰`],[`prime`,`′`],[`Prime`,`″`],[`lsaquo`,`‹`],[`rsaquo`,`›`],[`oline`,`‾`],[`frasl`,`⁄`],[`euro`,`€`],[`image`,`ℑ`],[`weierp`,`℘`],[`real`,`ℜ`],[`trade`,`™`],[`alefsym`,`ℵ`],[`larr`,`←`],[`uarr`,`↑`],[`rarr`,`→`],[`darr`,`↓`],[`harr`,`↔`],[`crarr`,`↵`],[`lArr`,`⇐`],[`uArr`,`⇑`],[`rArr`,`⇒`],[`dArr`,`⇓`],[`hArr`,`⇔`],[`forall`,`∀`],[`part`,`∂`],[`exist`,`∃`],[`empty`,`∅`],[`nabla`,`∇`],[`isin`,`∈`],[`notin`,`∉`],[`ni`,`∋`],[`prod`,`∏`],[`sum`,`∑`],[`minus`,`−`],[`lowast`,`∗`],[`radic`,`√`],[`prop`,`∝`],[`infin`,`∞`],[`ang`,`∠`],[`and`,`∧`],[`or`,`∨`],[`cap`,`∩`],[`cup`,`∪`],[`int`,`∫`],[`there4`,`∴`],[`sim`,`∼`],[`cong`,`≅`],[`asymp`,`≈`],[`ne`,`≠`],[`equiv`,`≡`],[`le`,`≤`],[`ge`,`≥`],[`sub`,`⊂`],[`sup`,`⊃`],[`nsub`,`⊄`],[`sube`,`⊆`],[`supe`,`⊇`],[`oplus`,`⊕`],[`otimes`,`⊗`],[`perp`,`⊥`],[`sdot`,`⋅`],[`lceil`,`⌈`],[`rceil`,`⌉`],[`lfloor`,`⌊`],[`rfloor`,`⌋`],[`lang`,`〈`],[`rang`,`〉`],[`loz`,`◊`],[`spades`,`♠`],[`clubs`,`♣`],[`hearts`,`♥`],[`diams`,`♦`]])})),lw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){let[n,r]=t(e.jsxPragma||`React.createElement`),[i,a]=t(e.jsxFragmentPragma||`React.Fragment`);return{base:n,suffix:r,fragmentBase:i,fragmentSuffix:a}};function t(e){let t=e.indexOf(`.`);return t===-1&&(t=e.length),[e.slice(0,t),e.slice(t)]}})),uw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{getPrefixCode(){return``}getHoistedCode(){return``}getSuffixCode(){return``}}})),dw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=t(cw()),r=ow(),i=G(),a=$C(),o=t(lw()),s=t(uw());e.default=class e extends s.default{__init(){this.lastLineNumber=1}__init2(){this.lastIndex=0}__init3(){this.filenameVarName=null}__init4(){this.esmAutomaticImportNameResolutions={}}__init5(){this.cjsAutomaticModuleNameResolutions={}}constructor(t,n,r,i,a){super(),this.rootTransformer=t,this.tokens=n,this.importProcessor=r,this.nameManager=i,this.options=a,e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),e.prototype.__init4.call(this),e.prototype.__init5.call(this),this.jsxPragmaInfo=o.default.call(void 0,a),this.isAutomaticRuntime=a.jsxRuntime===`automatic`,this.jsxImportSource=a.jsxImportSource||`react`}process(){return this.tokens.matches1(i.TokenType.jsxTagStart)?(this.processJSXTag(),!0):!1}getPrefixCode(){let e=``;if(this.filenameVarName&&(e+=`const ${this.filenameVarName} = ${JSON.stringify(this.options.filePath||``)};`),this.isAutomaticRuntime){if(this.importProcessor)for(let[t,n]of Object.entries(this.cjsAutomaticModuleNameResolutions))e+=`var ${n} = require("${t}");`;else{let{createElement:t,...n}=this.esmAutomaticImportNameResolutions;t&&(e+=`import {createElement as ${t}} from "${this.jsxImportSource}";`);let r=Object.entries(n).map(([e,t])=>`${e} as ${t}`).join(`, `);if(r){let t=this.jsxImportSource+(this.options.production?`/jsx-runtime`:`/jsx-dev-runtime`);e+=`import {${r}} from "${t}";`}}}return e}processJSXTag(){let{jsxRole:e,start:t}=this.tokens.currentToken(),n=this.options.production?null:this.getElementLocationCode(t);this.isAutomaticRuntime&&e!==r.JSXRole.KeyAfterPropSpread?this.transformTagToJSXFunc(n,e):this.transformTagToCreateElement(n)}getElementLocationCode(e){return`lineNumber: ${this.getLineNumberForIndex(e)}`}getLineNumberForIndex(e){let t=this.tokens.code;for(;this.lastIndex<e&&this.lastIndex<t.length;)t[this.lastIndex]===`
|
|
549
549
|
`&&this.lastLineNumber++,this.lastIndex++;return this.lastLineNumber}transformTagToJSXFunc(e,t){let n=t===r.JSXRole.StaticChildren;this.tokens.replaceToken(this.getJSXFuncInvocationCode(n));let a=null;if(this.tokens.matches1(i.TokenType.jsxTagEnd))this.tokens.replaceToken(`${this.getFragmentCode()}, {`),this.processAutomaticChildrenAndEndProps(t);else{if(this.processTagIntro(),this.tokens.appendCode(`, {`),a=this.processProps(!0),this.tokens.matches2(i.TokenType.slash,i.TokenType.jsxTagEnd))this.tokens.appendCode(`}`);else if(this.tokens.matches1(i.TokenType.jsxTagEnd))this.tokens.removeToken(),this.processAutomaticChildrenAndEndProps(t);else throw Error(`Expected either /> or > at the end of the tag.`);a&&this.tokens.appendCode(`, ${a}`)}for(this.options.production||(a===null&&this.tokens.appendCode(`, void 0`),this.tokens.appendCode(`, ${n}, ${this.getDevSource(e)}, this`)),this.tokens.removeInitialToken();!this.tokens.matches1(i.TokenType.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(`)`)}transformTagToCreateElement(e){if(this.tokens.replaceToken(this.getCreateElementInvocationCode()),this.tokens.matches1(i.TokenType.jsxTagEnd))this.tokens.replaceToken(`${this.getFragmentCode()}, null`),this.processChildren(!0);else if(this.processTagIntro(),this.processPropsObjectWithDevInfo(e),!this.tokens.matches2(i.TokenType.slash,i.TokenType.jsxTagEnd)){if(this.tokens.matches1(i.TokenType.jsxTagEnd))this.tokens.removeToken(),this.processChildren(!0);else throw Error(`Expected either /> or > at the end of the tag.`)}for(this.tokens.removeInitialToken();!this.tokens.matches1(i.TokenType.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(`)`)}getJSXFuncInvocationCode(e){return this.options.production?e?this.claimAutoImportedFuncInvocation(`jsxs`,`/jsx-runtime`):this.claimAutoImportedFuncInvocation(`jsx`,`/jsx-runtime`):this.claimAutoImportedFuncInvocation(`jsxDEV`,`/jsx-dev-runtime`)}getCreateElementInvocationCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedFuncInvocation(`createElement`,``);{let{jsxPragmaInfo:e}=this;return`${this.importProcessor&&this.importProcessor.getIdentifierReplacement(e.base)||e.base}${e.suffix}(`}}getFragmentCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedName(`Fragment`,this.options.production?`/jsx-runtime`:`/jsx-dev-runtime`);{let{jsxPragmaInfo:e}=this;return(this.importProcessor&&this.importProcessor.getIdentifierReplacement(e.fragmentBase)||e.fragmentBase)+e.fragmentSuffix}}claimAutoImportedFuncInvocation(e,t){let n=this.claimAutoImportedName(e,t);return this.importProcessor?`${n}.call(void 0, `:`${n}(`}claimAutoImportedName(e,t){if(this.importProcessor){let n=this.jsxImportSource+t;return this.cjsAutomaticModuleNameResolutions[n]||(this.cjsAutomaticModuleNameResolutions[n]=this.importProcessor.getFreeIdentifierForPath(n)),`${this.cjsAutomaticModuleNameResolutions[n]}.${e}`}return this.esmAutomaticImportNameResolutions[e]||(this.esmAutomaticImportNameResolutions[e]=this.nameManager.claimFreeName(`_${e}`)),this.esmAutomaticImportNameResolutions[e]}processTagIntro(){let e=this.tokens.currentIndex()+1;for(;this.tokens.tokens[e].isType||!this.tokens.matches2AtIndex(e-1,i.TokenType.jsxName,i.TokenType.jsxName)&&!this.tokens.matches2AtIndex(e-1,i.TokenType.greaterThan,i.TokenType.jsxName)&&!this.tokens.matches1AtIndex(e,i.TokenType.braceL)&&!this.tokens.matches1AtIndex(e,i.TokenType.jsxTagEnd)&&!this.tokens.matches2AtIndex(e,i.TokenType.slash,i.TokenType.jsxTagEnd);)e++;if(e===this.tokens.currentIndex()+1){let e=this.tokens.identifierName();c(e)&&this.tokens.replaceToken(`'${e}'`)}for(;this.tokens.currentIndex()<e;)this.rootTransformer.processToken()}processPropsObjectWithDevInfo(e){let t=this.options.production?``:`__self: this, __source: ${this.getDevSource(e)}`;!this.tokens.matches1(i.TokenType.jsxName)&&!this.tokens.matches1(i.TokenType.braceL)?t?this.tokens.appendCode(`, {${t}}`):this.tokens.appendCode(`, null`):(this.tokens.appendCode(`, {`),this.processProps(!1),t?this.tokens.appendCode(` ${t}}`):this.tokens.appendCode(`}`))}processProps(e){let t=null;for(;;){if(this.tokens.matches2(i.TokenType.jsxName,i.TokenType.eq)){let n=this.tokens.identifierName();if(e&&n===`key`){t!==null&&this.tokens.appendCode(t.replace(/[^\n]/g,``)),this.tokens.removeToken(),this.tokens.removeToken();let e=this.tokens.snapshot();this.processPropValue(),t=this.tokens.dangerouslyGetAndRemoveCodeSinceSnapshot(e);continue}this.processPropName(n),this.tokens.replaceToken(`: `),this.processPropValue()}else if(this.tokens.matches1(i.TokenType.jsxName)){let e=this.tokens.identifierName();this.processPropName(e),this.tokens.appendCode(`: true`)}else if(this.tokens.matches1(i.TokenType.braceL))this.tokens.replaceToken(``),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken(``);else break;this.tokens.appendCode(`,`)}return t}processPropName(e){e.includes(`-`)?this.tokens.replaceToken(`'${e}'`):this.tokens.copyToken()}processPropValue(){this.tokens.matches1(i.TokenType.braceL)?(this.tokens.replaceToken(``),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken(``)):this.tokens.matches1(i.TokenType.jsxTagStart)?this.processJSXTag():this.processStringPropValue()}processStringPropValue(){let e=this.tokens.currentToken(),t=this.tokens.code.slice(e.start+1,e.end-1),n=u(t),r=d(t);this.tokens.replaceToken(r+n)}processAutomaticChildrenAndEndProps(e){e===r.JSXRole.StaticChildren?(this.tokens.appendCode(` children: [`),this.processChildren(!1),this.tokens.appendCode(`]}`)):(e===r.JSXRole.OneChild&&this.tokens.appendCode(` children: `),this.processChildren(!1),this.tokens.appendCode(`}`))}processChildren(e){let t=e;for(;;){if(this.tokens.matches2(i.TokenType.jsxTagStart,i.TokenType.slash))return;let e=!1;if(this.tokens.matches1(i.TokenType.braceL))this.tokens.matches2(i.TokenType.braceL,i.TokenType.braceR)?(this.tokens.replaceToken(``),this.tokens.replaceToken(``)):(this.tokens.replaceToken(t?`, `:``),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken(``),e=!0);else if(this.tokens.matches1(i.TokenType.jsxTagStart))this.tokens.appendCode(t?`, `:``),this.processJSXTag(),e=!0;else if(this.tokens.matches1(i.TokenType.jsxText)||this.tokens.matches1(i.TokenType.jsxEmptyText))e=this.processChildTextElement(t);else throw Error(`Unexpected token when processing JSX children.`);e&&(t=!0)}}processChildTextElement(e){let t=this.tokens.currentToken(),n=this.tokens.code.slice(t.start,t.end),r=u(n),i=l(n);return i===`""`?(this.tokens.replaceToken(r),!1):(this.tokens.replaceToken(`${e?`, `:``}${i}${r}`),!0)}getDevSource(e){return`{fileName: ${this.getFilenameVarName()}, ${e}}`}getFilenameVarName(){return this.filenameVarName||=this.nameManager.claimFreeName(`_jsxFileName`),this.filenameVarName}};function c(e){let t=e.charCodeAt(0);return t>=a.charCodes.lowercaseA&&t<=a.charCodes.lowercaseZ}e.startsWithLowerCase=c;function l(e){let t=``,n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];if(o===` `||o===` `||o===`\r`)r||(n+=o);else if(o===`
|
|
550
550
|
`)n=``,r=!0;else{if(i&&r&&(t+=` `),t+=n,n=``,o===`&`){let{entity:n,newI:r}=f(e,a+1);a=r-1,t+=n}else t+=o;i=!0,r=!1}}return r||(t+=n),JSON.stringify(t)}function u(e){let t=0,n=0;for(let r of e)r===`
|
|
551
551
|
`?(t++,n=0):r===` `&&n++;return`
|
|
552
552
|
`.repeat(t)+` `.repeat(n)}function d(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`
|
|
553
553
|
`){if(/\s/.test(e[n+1]))for(t+=` `;n<e.length&&/\s/.test(e[n+1]);)n++;else t+=`
|
|
554
|
-
`}else if(r===`&`){let{entity:r,newI:i}=f(e,n+1);t+=r,n=i-1}else t+=r}return JSON.stringify(t)}function f(e,t){let r=``,i=0,a,o=t;if(e[o]===`#`){let t=10;o++;let n;if(e[o]===`x`)for(t=16,o++,n=o;o<e.length&&m(e.charCodeAt(o));)o++;else for(n=o;o<e.length&&p(e.charCodeAt(o));)o++;if(e[o]===`;`){let r=e.slice(n,o);r&&(o++,a=String.fromCodePoint(parseInt(r,t)))}}else for(;o<e.length&&i++<10;){let t=e[o];if(o++,t===`;`){a=n.default.get(r);break}r+=t}return a?{entity:a,newI:o}:{entity:`&`,newI:t}}function p(e){return e>=a.charCodes.digit0&&e<=a.charCodes.digit9}function m(e){return e>=a.charCodes.digit0&&e<=a.charCodes.digit9||e>=a.charCodes.lowercaseA&&e<=a.charCodes.lowercaseF||e>=a.charCodes.uppercaseA&&e<=a.charCodes.uppercaseF}})),ow=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=ew(),r=G(),i=aw(),a=t(rw());e.getNonTypeIdentifiers=function(e,t){let o=a.default.call(void 0,t),s=/* @__PURE__ */ new Set;for(let t=0;t<e.tokens.length;t++){let a=e.tokens[t];if(a.type!==r.TokenType.name||a.isType||a.identifierRole!==n.IdentifierRole.Access&&a.identifierRole!==n.IdentifierRole.ObjectShorthand&&a.identifierRole!==n.IdentifierRole.ExportAccess||a.shadowsGlobal||s.add(e.identifierNameForToken(a)),a.type===r.TokenType.jsxTagStart&&s.add(o.base),a.type===r.TokenType.jsxTagStart&&t+1<e.tokens.length&&e.tokens[t+1].type===r.TokenType.jsxTagEnd&&(s.add(o.base),s.add(o.fragmentBase)),a.type===r.TokenType.jsxName&&a.identifierRole===n.IdentifierRole.Access){let n=e.identifierNameForToken(a);i.startsWithLowerCase.call(void 0,n)&&e.tokens[t+1].type!==r.TokenType.dot||s.add(e.identifierNameForToken(a))}}return s}})),sw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=ew(),r=GC(),i=G(),a=t(tw()),o=ow();e.default=class e{__init(){this.nonTypeIdentifiers=/* @__PURE__ */ new Set}__init2(){this.importInfoByPath=/* @__PURE__ */ new Map}__init3(){this.importsToReplace=/* @__PURE__ */ new Map}__init4(){this.identifierReplacements=/* @__PURE__ */ new Map}__init5(){this.exportBindingsByLocalName=/* @__PURE__ */ new Map}constructor(t,n,r,i,a,o,s){this.nameManager=t,this.tokens=n,this.enableLegacyTypeScriptModuleInterop=r,this.options=i,this.isTypeScriptTransformEnabled=a,this.keepUnusedImports=o,this.helperManager=s,e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),e.prototype.__init4.call(this),e.prototype.__init5.call(this)}preprocessTokens(){for(let e=0;e<this.tokens.tokens.length;e++)this.tokens.matches1AtIndex(e,i.TokenType._import)&&!this.tokens.matches3AtIndex(e,i.TokenType._import,i.TokenType.name,i.TokenType.eq)&&this.preprocessImportAtIndex(e),this.tokens.matches1AtIndex(e,i.TokenType._export)&&!this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType.eq)&&this.preprocessExportAtIndex(e);this.generateImportReplacements()}pruneTypeOnlyImports(){this.nonTypeIdentifiers=o.getNonTypeIdentifiers.call(void 0,this.tokens,this.options);for(let[e,t]of this.importInfoByPath.entries())t.hasBareImport||t.hasStarExport||t.exportStarNames.length>0||t.namedExports.length>0||[...t.defaultNames,...t.wildcardNames,...t.namedImports.map(({localName:e})=>e)].every(e=>this.shouldAutomaticallyElideImportedName(e))&&this.importsToReplace.set(e,``)}shouldAutomaticallyElideImportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(e)}generateImportReplacements(){for(let[e,t]of this.importInfoByPath.entries()){let{defaultNames:n,wildcardNames:r,namedImports:i,namedExports:a,exportStarNames:o,hasStarExport:s}=t;if(n.length===0&&r.length===0&&i.length===0&&a.length===0&&o.length===0&&!s){this.importsToReplace.set(e,`require('${e}');`);continue}let c=this.getFreeIdentifierForPath(e),l;l=this.enableLegacyTypeScriptModuleInterop?c:r.length>0?r[0]:this.getFreeIdentifierForPath(e);let u=`var ${c} = require('${e}');`;if(r.length>0)for(let e of r){let t=this.enableLegacyTypeScriptModuleInterop?c:`${this.helperManager.getHelperName(`interopRequireWildcard`)}(${c})`;u+=` var ${e} = ${t};`}else o.length>0&&l!==c?u+=` var ${l} = ${this.helperManager.getHelperName(`interopRequireWildcard`)}(${c});`:n.length>0&&l!==c&&(u+=` var ${l} = ${this.helperManager.getHelperName(`interopRequireDefault`)}(${c});`);for(let{importedName:e,localName:t}of a)u+=` ${this.helperManager.getHelperName(`createNamedExportFrom`)}(${c}, '${t}', '${e}');`;for(let e of o)u+=` exports.${e} = ${l};`;s&&(u+=` ${this.helperManager.getHelperName(`createStarExport`)}(${c});`),this.importsToReplace.set(e,u);for(let e of n)this.identifierReplacements.set(e,`${l}.default`);for(let{importedName:e,localName:t}of i)this.identifierReplacements.set(t,`${c}.${e}`)}}getFreeIdentifierForPath(e){let t=e.split(`/`),n=t[t.length-1].replace(/\W/g,``);return this.nameManager.claimFreeName(`_${n}`)}preprocessImportAtIndex(e){let t=[],n=[],a=[];if(e++,(this.tokens.matchesContextualAtIndex(e,r.ContextualKeyword._type)||this.tokens.matches1AtIndex(e,i.TokenType._typeof))&&!this.tokens.matches1AtIndex(e+1,i.TokenType.comma)&&!this.tokens.matchesContextualAtIndex(e+1,r.ContextualKeyword._from)||this.tokens.matches1AtIndex(e,i.TokenType.parenL))return;if(this.tokens.matches1AtIndex(e,i.TokenType.name)&&(t.push(this.tokens.identifierNameAtIndex(e)),e++,this.tokens.matches1AtIndex(e,i.TokenType.comma)&&e++),this.tokens.matches1AtIndex(e,i.TokenType.star)&&(e+=2,n.push(this.tokens.identifierNameAtIndex(e)),e++),this.tokens.matches1AtIndex(e,i.TokenType.braceL)){let n=this.getNamedImports(e+1);e=n.newIndex;for(let e of n.namedImports)e.importedName==="default"?t.push(e.localName):a.push(e)}if(this.tokens.matchesContextualAtIndex(e,r.ContextualKeyword._from)&&e++,!this.tokens.matches1AtIndex(e,i.TokenType.string))throw Error(`Expected string token at the end of import statement.`);let o=this.tokens.stringValueAtIndex(e),s=this.getImportInfo(o);s.defaultNames.push(...t),s.wildcardNames.push(...n),s.namedImports.push(...a),t.length===0&&n.length===0&&a.length===0&&(s.hasBareImport=!0)}preprocessExportAtIndex(e){if(this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._var)||this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._let)||this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._const))this.preprocessVarExportAtIndex(e);else if(this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._function)||this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._class)){let t=this.tokens.identifierNameAtIndex(e+2);this.addExportBinding(t,t)}else if(this.tokens.matches3AtIndex(e,i.TokenType._export,i.TokenType.name,i.TokenType._function)){let t=this.tokens.identifierNameAtIndex(e+3);this.addExportBinding(t,t)}else this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType.braceL)?this.preprocessNamedExportAtIndex(e):this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType.star)&&this.preprocessExportStarAtIndex(e)}preprocessVarExportAtIndex(e){let t=0;for(let r=e+2;;r++)if(this.tokens.matches1AtIndex(r,i.TokenType.braceL)||this.tokens.matches1AtIndex(r,i.TokenType.dollarBraceL)||this.tokens.matches1AtIndex(r,i.TokenType.bracketL))t++;else if(this.tokens.matches1AtIndex(r,i.TokenType.braceR)||this.tokens.matches1AtIndex(r,i.TokenType.bracketR))t--;else if(t===0&&!this.tokens.matches1AtIndex(r,i.TokenType.name))break;else if(this.tokens.matches1AtIndex(1,i.TokenType.eq)){let e=this.tokens.currentToken().rhsEndIndex;if(e==null)throw Error(`Expected = token with an end index.`);r=e-1}else{let e=this.tokens.tokens[r];if(n.isDeclaration.call(void 0,e)){let e=this.tokens.identifierNameAtIndex(r);this.identifierReplacements.set(e,`exports.${e}`)}}}preprocessNamedExportAtIndex(e){e+=2;let{newIndex:t,namedImports:n}=this.getNamedImports(e);if(e=t,this.tokens.matchesContextualAtIndex(e,r.ContextualKeyword._from))e++;else{for(let{importedName:e,localName:t}of n)this.addExportBinding(e,t);return}if(!this.tokens.matches1AtIndex(e,i.TokenType.string))throw Error(`Expected string token at the end of import statement.`);let a=this.tokens.stringValueAtIndex(e);this.getImportInfo(a).namedExports.push(...n)}preprocessExportStarAtIndex(e){let t=null;if(this.tokens.matches3AtIndex(e,i.TokenType._export,i.TokenType.star,i.TokenType._as)?(e+=3,t=this.tokens.identifierNameAtIndex(e),e+=2):e+=3,!this.tokens.matches1AtIndex(e,i.TokenType.string))throw Error(`Expected string token at the end of star export statement.`);let n=this.tokens.stringValueAtIndex(e),r=this.getImportInfo(n);t===null?r.hasStarExport=!0:r.exportStarNames.push(t)}getNamedImports(e){let t=[];for(;;){if(this.tokens.matches1AtIndex(e,i.TokenType.braceR)){e++;break}let n=a.default.call(void 0,this.tokens,e);if(e=n.endIndex,n.isType||t.push({importedName:n.leftName,localName:n.rightName}),this.tokens.matches2AtIndex(e,i.TokenType.comma,i.TokenType.braceR)){e+=2;break}if(this.tokens.matches1AtIndex(e,i.TokenType.braceR)){e++;break}if(this.tokens.matches1AtIndex(e,i.TokenType.comma))e++;else throw Error(`Unexpected token: ${JSON.stringify(this.tokens.tokens[e])}`)}return{newIndex:e,namedImports:t}}getImportInfo(e){let t=this.importInfoByPath.get(e);if(t)return t;let n={defaultNames:[],wildcardNames:[],namedImports:[],namedExports:[],hasBareImport:!1,exportStarNames:[],hasStarExport:!1};return this.importInfoByPath.set(e,n),n}addExportBinding(e,t){this.exportBindingsByLocalName.has(e)||this.exportBindingsByLocalName.set(e,[]),this.exportBindingsByLocalName.get(e).push(t)}claimImportCode(e){let t=this.importsToReplace.get(e);return this.importsToReplace.set(e,``),t||``}getIdentifierReplacement(e){return this.identifierReplacements.get(e)||null}resolveExportBinding(e){let t=this.exportBindingsByLocalName.get(e);return!t||t.length===0?null:t.map(e=>`exports.${e}`).join(` = `)}getGlobalNames(){return/* @__PURE__ */ new Set([...this.identifierReplacements.keys(),...this.exportBindingsByLocalName.keys()])}}})),cw=/* @__PURE__ */ o(((e,t,n)=>{var r;(function(n,i){if(typeof e==`object`&&t!==void 0)i(t),t.exports=a(t);else if(typeof r==`function`&&r.amd)r([`module`],function(e){i.apply(this,arguments),e.exports=a(e)});else{let e={exports:{}};i(e),n=typeof globalThis<`u`?globalThis:n||self,n.sourcemapCodec=a(e)}function a(e){return`default`in e.exports?e.exports.default:e.exports}})(n,(function(e){"use strict";var t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},o=(e,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(let c of r(a))!i.call(e,c)&&c!==o&&t(e,c,{get:()=>a[c],enumerable:!(s=n(a,c))||s.enumerable});return e},s=e=>o(t({},`__esModule`,{value:!0}),e),c={};a(c,{decode:()=>oe,decodeGeneratedRanges:()=>te,decodeOriginalScopes:()=>w,decodeRangeMappings:()=>E,encode:()=>D,encodeGeneratedRanges:()=>ne,encodeOriginalScopes:()=>T,encodeRangeMappings:()=>ae}),e.exports=s(c);var l=44,u=59,d=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,f=/* @__PURE__ */ new Uint8Array(64),p=/* @__PURE__ */ new Uint8Array(128);for(let e=0;e<d.length;e++){let t=d.charCodeAt(e);f[e]=t,p[t]=e}function m(e){let t=0,n=0,r=0;do r=p[e.next()],t|=(r&31)<<n,n+=5;while(r&32);return t}function h(e){return e&1?-0x80000000|-(e>>>1):e>>>1}function g(e,t){do{let n=t&31;t>>>=5,t>0&&(n|=32),e.write(f[n])}while(t>0)}function _(e){return e<0?-e<<1|1:e<<1}function v(e,t){return e.pos>=t?!1:e.peek()!==l}var y=16384,b=typeof TextDecoder<`u`?/* @__PURE__ */ new TextDecoder:typeof Buffer<`u`?{decode(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString()}}:{decode(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}},x=class{constructor(){this.pos=0,this.out=``,this.buffer=new Uint8Array(y)}write(e){let{buffer:t}=this;t[this.pos++]=e,this.pos===y&&(this.out+=b.decode(t),this.pos=0)}flush(){let{buffer:e,out:t,pos:n}=this;return n>0?t+b.decode(e.subarray(0,n)):t}},S=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}},C=[];function w(e){let{length:t}=e,n=new S(e),r=[],i=[],a=0;for(;n.pos<t;n.pos++){a+=h(m(n));let e=h(m(n));if(!v(n,t)){let t=i.pop();t[2]=a,t[3]=e;continue}let o=h(m(n)),s=h(m(n))&1?[a,e,0,0,o,h(m(n))]:[a,e,0,0,o],c=C;if(v(n,t)){c=[];do{let e=h(m(n));c.push(e)}while(v(n,t))}s.vars=c,r.push(s),i.push(s)}return r}function T(e){let t=new x;for(let n=0;n<e.length;)n=ee(e,n,t,[0]);return t.flush()}function ee(e,t,n,r){let i=e[t],{0:a,1:o,2:s,3:c,4:u,vars:d}=i;t>0&&n.write(l),g(n,_(a-r[0])),r[0]=a,g(n,_(o)),g(n,_(u)),g(n,_(+(i.length===6))),i.length===6&&g(n,_(i[5]));for(let e of d)g(n,_(e));for(t++;t<e.length;){let{0:i,1:a}=e[t];if(i>s||i===s&&a>=c)break;t=ee(e,t,n,r)}return n.write(l),g(n,_(s-r[0])),r[0]=s,g(n,_(c)),t}function te(e){let{length:t}=e,n=new S(e),r=[],i=[],a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0;do{let e=n.indexOf(`;`),t=0;for(;n.pos<e;n.pos++){if(t+=h(m(n)),!v(n,e)){let e=i.pop();e[2]=a,e[3]=t;continue}let p=h(m(n)),g=p&1,_=p&2,y=p&4,b=null,x=C,S;if(g){let e=o+h(m(n));s=h(m(n))+(o===e?s:0),o=e,S=[a,t,0,0,e,s]}else S=[a,t,0,0];if(S.isScope=!!y,_){let e=c,t=l;c+=h(m(n));let r=e===c;l=(r?l:0)+h(m(n)),u=(r&&t===l?u:0)+h(m(n)),b=[c,l,u]}if(S.callsite=b,v(n,e)){x=[];do{d=a,f=t;let e=h(m(n)),r;if(e<-1){r=[[h(m(n))]];for(let t=-1;t>e;t--){let e=d;d+=h(m(n)),f=(d===e?f:0)+h(m(n));let t=h(m(n));r.push([t,d,f])}}else r=[[e]];x.push(r)}while(v(n,e))}S.bindings=x,r.push(S),i.push(S)}a++,n.pos=e+1}while(n.pos<t);return r}function ne(e){if(e.length===0)return``;let t=new x;for(let n=0;n<e.length;)n=re(e,n,t,[0,0,0,0,0,0,0]);return t.flush()}function re(e,t,n,r){let i=e[t],{0:a,1:o,2:s,3:c,isScope:u,callsite:d,bindings:f}=i;if(r[0]<a?(ie(n,r[0],a),r[0]=a,r[1]=0):t>0&&n.write(l),g(n,_(i[1]-r[1])),r[1]=i[1],g(n,_(i.length===6|(d?2:0)|(u?4:0))),i.length===6){let{4:e,5:t}=i;e!==r[2]&&(r[3]=0),g(n,_(e-r[2])),r[2]=e,g(n,_(t-r[3])),r[3]=t}if(d){let{0:e,1:t,2:a}=i.callsite;e===r[4]?t!==r[5]&&(r[6]=0):(r[5]=0,r[6]=0),g(n,_(e-r[4])),r[4]=e,g(n,_(t-r[5])),r[5]=t,g(n,_(a-r[6])),r[6]=a}if(f)for(let e of f){e.length>1&&g(n,_(-e.length)),g(n,_(e[0][0]));let t=a,r=o;for(let i=1;i<e.length;i++){let a=e[i];g(n,_(a[1]-t)),t=a[1],g(n,_(a[2]-r)),r=a[2],g(n,_(a[0]))}}for(t++;t<e.length;){let{0:i,1:a}=e[t];if(i>s||i===s&&a>=c)break;t=re(e,t,n,r)}return r[0]<s?(ie(n,r[0],s),r[0]=s,r[1]=0):n.write(l),g(n,_(c-r[1])),r[1]=c,t}function ie(e,t,n){do e.write(u);while(++t<n)}function E(e){let{length:t}=e,n=new S(e),r=[];do{let e=n.indexOf(`;`),t=[],i=0;for(;n.pos<e;)i+=m(n),t.push(i);r.push(t),n.pos=e+1}while(n.pos<=t);return r}function ae(e){if(e.length===0)return``;let t=new x;for(let n=0;n<e.length;n++){let r=e[n];n>0&&t.write(u);let i=0;for(let e=0;e<r.length;e++){let n=r[e];g(t,n-i),i=n}}return t.flush()}function oe(e){let{length:t}=e,n=new S(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i+=h(m(n)),i<u&&(l=!1),u=i,v(n,e)?(a+=h(m(n)),o+=h(m(n)),s+=h(m(n)),v(n,e)?(c+=h(m(n)),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||se(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function se(e){e.sort(ce)}function ce(e,t){return e[0]-t[0]}function D(e){let t=new x,n=0,r=0,i=0,a=0;for(let o=0;o<e.length;o++){let s=e[o];if(o>0&&t.write(u),s.length===0)continue;let c=0;for(let e=0;e<s.length;e++){let o=s[e];e>0&&t.write(l),g(t,_(o[0]-c)),c=o[0],o.length!==1&&(g(t,_(o[1]-n)),g(t,_(o[2]-r)),g(t,_(o[3]-i)),n=o[1],r=o[2],i=o[3],o.length!==4&&(g(t,_(o[4]-a)),a=o[4]))}}return t.flush()}}))})),lw=/* @__PURE__ */ o(((e,t,n)=>{var r;(function(n,i){typeof e==`object`&&t!==void 0?t.exports=i():typeof r==`function`&&r.amd?r(i):(n=typeof globalThis<`u`?globalThis:n||self,n.resolveURI=i())})(n,(function(){"use strict";let e=/^[\w+.-]+:\/\//,t=/^([\w+.-]+:)\/\/([^@/#?]*@)?(\[[^\]]+\]|[^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function r(t){return e.test(t)}function i(e){return e.startsWith(`//`)}function a(e){return e.startsWith(`/`)}function o(e){return e.startsWith(`file:`)}function s(e){return/^[.?#]/.test(e)}function c(e){let n=t.exec(e);return u(n[1],n[2]||``,n[3],n[4]||``,n[5]||`/`,n[6]||``,n[7]||``)}function l(e){let t=n.exec(e),r=t[2];return u(`file:`,``,t[1]||``,``,a(r)?r:`/`+r,t[3]||``,t[4]||``)}function u(e,t,n,r,i,a,o){return{scheme:e,user:t,host:n,port:r,path:i,query:a,hash:o,type:7}}function d(e){if(i(e)){let t=c(`http:`+e);return t.scheme=``,t.type=6,t}if(a(e)){let t=c(`http://foo.com`+e);return t.scheme=``,t.host=``,t.type=5,t}if(o(e))return l(e);if(r(e))return c(e);let t=c(`http://foo.com/`+e);return t.scheme=``,t.host=``,t.type=e?e.startsWith(`?`)?3:e.startsWith(`#`)?2:4:1,t}function f(e){if(e.endsWith(`/..`))return e;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function p(e,t){m(t,t.type),e.path=e.path===`/`?t.path:f(t.path)+e.path}function m(e,t){let n=t<=4,r=e.path.split(`/`),i=1,a=0,o=!1;for(let e=1;e<r.length;e++){let t=r[e];t?(o=!1,t!==`.`&&(t===`..`?a?(o=!0,a--,i--):n&&(r[i++]=t):(r[i++]=t,a++))):o=!0}let s=``;for(let e=1;e<i;e++)s+=`/`+r[e];(!s||o&&!s.endsWith(`/..`))&&(s+=`/`),e.path=s}function h(e,t){if(!e&&!t)return``;let n=d(e),r=n.type;if(t&&r!==7){let e=d(t),i=e.type;switch(r){case 1:n.hash=e.hash;case 2:n.query=e.query;case 3:case 4:p(n,e);case 5:n.user=e.user,n.host=e.host,n.port=e.port;case 6:n.scheme=e.scheme}i>r&&(r=i)}m(n,r);let i=n.query+n.hash;switch(r){case 2:case 3:return i;case 4:{let r=n.path.slice(1);return r?s(t||e)&&!s(r)?`./`+r+i:r+i:i||`.`}case 5:return n.path+i;default:return n.scheme+`//`+n.user+n.host+n.port+n.path+i}}return h}))})),uw=/* @__PURE__ */ o(((e,t,n)=>{var r;(function(n,i){if(typeof e==`object`&&t!==void 0)i(t,lw(),cw()),t.exports=a(t);else if(typeof r==`function`&&r.amd)r([`module`,`@jridgewell/resolve-uri`,`@jridgewell/sourcemap-codec`],function(e){i.apply(this,arguments),e.exports=a(e)});else{let e={exports:{}};i(e,n.resolveURI,n.sourcemapCodec),n=typeof globalThis<`u`?globalThis:n||self,n.traceMapping=a(e)}function a(e){return`default`in e.exports?e.exports.default:e.exports}})(n,(function(e,t,n){"use strict";var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>function(){return t||(0,e[o(e)[0]])((t={exports:{}}).exports,t),t.exports},u=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:r(s(e)),d(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),p=e=>d(i({},`__esModule`,{value:!0}),e),m=l({"umd:@jridgewell/sourcemap-codec"(e,t){t.exports=n}}),h=l({"umd:@jridgewell/resolve-uri"(e,n){n.exports=t}}),g={};u(g,{AnyMap:()=>pe,FlattenMap:()=>pe,GREATEST_LOWER_BOUND:()=>be,LEAST_UPPER_BOUND:()=>ye,TraceMap:()=>xe,allGeneratedPositionsFor:()=>Oe,decodedMap:()=>Ne,decodedMappings:()=>we,eachMapping:()=>ke,encodedMap:()=>Pe,encodedMappings:()=>Ce,generatedPositionFor:()=>De,isIgnored:()=>je,originalPositionFor:()=>Ee,presortedDecodedMap:()=>Me,sourceContentFor:()=>k,traceSegment:()=>Te}),e.exports=p(g);var _=f(m()),v=f(h());function y(e){if(!e)return``;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function b(e,t){let n=y(e),r=t?t+`/`:``;return e=>(0,v.default)(r+(e||``),n)}var x=0,S=1,C=2,w=3,T=4,ee=1,te=2;function ne(e,t){let n=re(e,0);if(n===e.length)return e;t||(e=e.slice());for(let r=n;r<e.length;r=re(e,r+1))e[r]=E(e[r],t);return e}function re(e,t){for(let n=t;n<e.length;n++)if(!ie(e[n]))return n;return e.length}function ie(e){for(let t=1;t<e.length;t++)if(e[t][x]<e[t-1][x])return!1;return!0}function E(e,t){return t||(e=e.slice()),e.sort(ae)}function ae(e,t){return e[x]-t[x]}function oe(e,t){let n=t.map(()=>[]);for(let t=0;t<e.length;t++){let r=e[t];for(let e=0;e<r.length;e++){let i=r[e];if(i.length===1)continue;let a=i[S],o=i[C],s=i[w],c=n[a];(c[o]||(c[o]=[])).push([s,t,i[x]])}}for(let e=0;e<n.length;e++){let t=n[e];for(let e=0;e<t.length;e++){let n=t[e];n&&n.sort(ae)}}return n}var se=!1;function ce(e,t,n,r){for(;n<=r;){let i=n+(r-n>>1),a=e[i][x]-t;if(a===0)return se=!0,i;a<0?n=i+1:r=i-1}return se=!1,n-1}function D(e,t,n){for(let r=n+1;r<e.length&&e[r][x]===t;n=r++);return n}function le(e,t,n){for(let r=n-1;r>=0&&e[r][x]===t;n=r--);return n}function ue(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function de(e,t,n,r){let{lastKey:i,lastNeedle:a,lastIndex:o}=n,s=0,c=e.length-1;if(r===i){if(t===a)return se=o!==-1&&e[o][x]===t,o;t>=a?s=o===-1?0:o:c=o}return n.lastKey=r,n.lastNeedle=t,n.lastIndex=ce(e,t,s,c)}function fe(e){return typeof e==`string`?JSON.parse(e):e}var pe=function(e,t){let n=fe(e);if(!(`sections`in n))return new xe(n,t);let r=[],i=[],a=[],o=[],s=[];return O(n,t,r,i,a,o,s,0,0,1/0,1/0),Me({version:3,file:n.file,names:o,sources:i,sourcesContent:a,mappings:r,ignoreList:s})};function O(e,t,n,r,i,a,o,s,c,l,u){let{sections:d}=e;for(let e=0;e<d.length;e++){let{map:f,offset:p}=d[e],m=l,h=u;if(e+1<d.length){let t=d[e+1].offset;m=Math.min(l,s+t.line),m===l?h=Math.min(u,c+t.column):m<l&&(h=c+t.column)}me(f,t,n,r,i,a,o,s+p.line,c+p.column,m,h)}}function me(e,t,n,r,i,a,o,s,c,l,u){let d=fe(e);if(`sections`in d)return O(...arguments);let f=new xe(d,t),p=r.length,m=a.length,h=we(f),{resolvedSources:g,sourcesContent:_,ignoreList:v}=f;if(he(r,g),he(a,f.names),_)he(i,_);else for(let e=0;e<g.length;e++)i.push(null);if(v)for(let e=0;e<v.length;e++)o.push(v[e]+p);for(let e=0;e<h.length;e++){let t=s+e;if(t>l)return;let r=ge(n,t),i=e===0?c:0,a=h[e];for(let e=0;e<a.length;e++){let n=a[e],o=i+n[x];if(t===l&&o>=u)return;if(n.length===1){r.push([o]);continue}let s=p+n[S],c=n[C],d=n[w];r.push(n.length===4?[o,s,c,d]:[o,s,c,d,m+n[T]])}}}function he(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}function ge(e,t){for(let n=e.length;n<=t;n++)e[n]=[];return e[t]}var _e="`line` must be greater than 0 (lines start at line 1)",ve="`column` must be greater than or equal to 0 (columns start at column 0)",ye=-1,be=1,xe=class{constructor(e,t){let n=typeof e==`string`;if(!n&&e._decodedMemo)return e;let r=fe(e),{version:i,file:a,names:o,sourceRoot:s,sources:c,sourcesContent:l}=r;this.version=i,this.file=a,this.names=o||[],this.sourceRoot=s,this.sources=c,this.sourcesContent=l,this.ignoreList=r.ignoreList||r.x_google_ignoreList||void 0;let u=b(t,s);this.resolvedSources=c.map(u);let{mappings:d}=r;if(typeof d==`string`)this._encoded=d,this._decoded=void 0;else if(Array.isArray(d))this._encoded=void 0,this._decoded=ne(d,n);else if(r.sections)throw Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);else throw Error(`invalid source map: ${JSON.stringify(r)}`);this._decodedMemo=ue(),this._bySources=void 0,this._bySourceMemos=void 0}};function Se(e){return e}function Ce(e){var t;return(t=Se(e))._encoded??(t._encoded=(0,_.encode)(Se(e)._decoded))}function we(e){var t;return(t=Se(e))._decoded||(t._decoded=(0,_.decode)(Se(e)._encoded))}function Te(e,t,n){let r=we(e);if(t>=r.length)return null;let i=r[t],a=Re(i,Se(e)._decodedMemo,t,n,be);return a===-1?null:i[a]}function Ee(e,t){let{line:n,column:r,bias:i}=t;if(n--,n<0)throw Error(_e);if(r<0)throw Error(ve);let a=we(e);if(n>=a.length)return Ie(null,null,null,null);let o=a[n],s=Re(o,Se(e)._decodedMemo,n,r,i||be);if(s===-1)return Ie(null,null,null,null);let c=o[s];if(c.length===1)return Ie(null,null,null,null);let{names:l,resolvedSources:u}=e;return Ie(u[c[S]],c[C]+1,c[w],c.length===5?l[c[T]]:null)}function De(e,t){let{source:n,line:r,column:i,bias:a}=t;return Be(e,n,r,i,a||be,!1)}function Oe(e,t){let{source:n,line:r,column:i,bias:a}=t;return Be(e,n,r,i,a||ye,!0)}function ke(e,t){let n=we(e),{names:r,resolvedSources:i}=e;for(let e=0;e<n.length;e++){let a=n[e];for(let n=0;n<a.length;n++){let o=a[n],s=e+1,c=o[0],l=null,u=null,d=null,f=null;o.length!==1&&(l=i[o[1]],u=o[2]+1,d=o[3]),o.length===5&&(f=r[o[4]]),t({generatedLine:s,generatedColumn:c,source:l,originalLine:u,originalColumn:d,name:f})}}}function Ae(e,t){let{sources:n,resolvedSources:r}=e,i=n.indexOf(t);return i===-1&&(i=r.indexOf(t)),i}function k(e,t){let{sourcesContent:n}=e;if(n==null)return null;let r=Ae(e,t);return r===-1?null:n[r]}function je(e,t){let{ignoreList:n}=e;if(n==null)return!1;let r=Ae(e,t);return r!==-1&&n.includes(r)}function Me(e,t){let n=new xe(Fe(e,[]),t);return Se(n)._decoded=e.mappings,n}function Ne(e){return Fe(e,we(e))}function Pe(e){return Fe(e,Ce(e))}function Fe(e,t){return{version:e.version,file:e.file,names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,mappings:t,ignoreList:e.ignoreList||e.x_google_ignoreList}}function Ie(e,t,n,r){return{source:e,line:t,column:n,name:r}}function Le(e,t){return{line:e,column:t}}function Re(e,t,n,r,i){let a=de(e,r,t,n);return se?a=(i===ye?D:le)(e,r,a):i===ye&&a++,a===-1||a===e.length?-1:a}function ze(e,t,n,r,i){let a=Re(e,t,n,r,be);if(!se&&i===ye&&a++,a===-1||a===e.length)return[];let o=se?r:e[a][x];se||(a=le(e,o,a));let s=D(e,o,a),c=[];for(;a<=s;a++){let t=e[a];c.push(Le(t[ee]+1,t[te]))}return c}function Be(e,t,n,r,i,a){var o,s;if(n--,n<0)throw Error(_e);if(r<0)throw Error(ve);let{sources:c,resolvedSources:l}=e,u=c.indexOf(t);if(u===-1&&(u=l.indexOf(t)),u===-1)return a?[]:Le(null,null);let d=(o=Se(e))._bySourceMemos||(o._bySourceMemos=c.map(ue)),f=((s=Se(e))._bySources||(s._bySources=oe(we(e),d)))[u][n];if(f==null)return a?[]:Le(null,null);let p=d[u];if(a)return ze(f,p,n,r,i);let m=Re(f,p,n,r,i);if(m===-1)return Le(null,null);let h=f[m];return Le(h[ee]+1,h[te])}}))})),dw=/* @__PURE__ */ o(((e,t,n)=>{var r;(function(n,i){if(typeof e==`object`&&t!==void 0)i(t,cw(),uw()),t.exports=a(t);else if(typeof r==`function`&&r.amd)r([`module`,`@jridgewell/sourcemap-codec`,`@jridgewell/trace-mapping`],function(e){i.apply(this,arguments),e.exports=a(e)});else{let e={exports:{}};i(e,n.sourcemapCodec,n.traceMapping),n=typeof globalThis<`u`?globalThis:n||self,n.genMapping=a(e)}function a(e){return`default`in e.exports?e.exports.default:e.exports}})(n,(function(e,t,n){"use strict";var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>function(){return t||(0,e[o(e)[0]])((t={exports:{}}).exports,t),t.exports},u=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:r(s(e)),d(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),p=e=>d(i({},`__esModule`,{value:!0}),e),m=l({"umd:@jridgewell/sourcemap-codec"(e,n){n.exports=t}}),h=l({"umd:@jridgewell/trace-mapping"(e,t){t.exports=n}}),g={};u(g,{GenMapping:()=>ie,addMapping:()=>oe,addSegment:()=>ae,allMappings:()=>pe,fromMap:()=>fe,maybeAddMapping:()=>ce,maybeAddSegment:()=>se,setIgnore:()=>le,setSourceContent:()=>D,toDecodedMap:()=>ue,toEncodedMap:()=>de}),e.exports=p(g);var _=class{constructor(){this._indexes={__proto__:null},this.array=[]}};function v(e){return e}function y(e,t){return v(e)._indexes[t]}function b(e,t){let n=y(e,t);if(n!==void 0)return n;let{array:r,_indexes:i}=v(e);return i[t]=r.push(t)-1}function x(e,t){let n=y(e,t);if(n===void 0)return;let{array:r,_indexes:i}=v(e);for(let e=n+1;e<r.length;e++){let t=r[e];r[e-1]=t,i[t]--}i[t]=void 0,r.pop()}var S=f(m()),C=f(h()),w=0,T=1,ee=2,te=3,ne=4,re=-1,ie=class{constructor({file:e,sourceRoot:t}={}){this._names=new _,this._sources=new _,this._sourcesContent=[],this._mappings=[],this.file=e,this.sourceRoot=t,this._ignoreList=new _}};function E(e){return e}function ae(e,t,n,r,i,a,o,s){return O(!1,e,t,n,r,i,a,o,s)}function oe(e,t){return xe(!1,e,t)}var se=(e,t,n,r,i,a,o,s)=>O(!0,e,t,n,r,i,a,o,s),ce=(e,t)=>xe(!0,e,t);function D(e,t,n){let{_sources:r,_sourcesContent:i}=E(e),a=b(r,t);i[a]=n}function le(e,t,n=!0){let{_sources:r,_sourcesContent:i,_ignoreList:a}=E(e),o=b(r,t);o===i.length&&(i[o]=null),n?b(a,o):x(a,o)}function ue(e){let{_mappings:t,_sources:n,_sourcesContent:r,_names:i,_ignoreList:a}=E(e);return _e(t),{version:3,file:e.file||void 0,names:i.array,sourceRoot:e.sourceRoot||void 0,sources:n.array,sourcesContent:r,mappings:t,ignoreList:a.array}}function de(e){let t=ue(e);return Object.assign({},t,{mappings:(0,S.encode)(t.mappings)})}function fe(e){let t=new C.TraceMap(e),n=new ie({file:t.file,sourceRoot:t.sourceRoot});return ve(E(n)._names,t.names),ve(E(n)._sources,t.sources),E(n)._sourcesContent=t.sourcesContent||t.sources.map(()=>null),E(n)._mappings=(0,C.decodedMappings)(t),t.ignoreList&&ve(E(n)._ignoreList,t.ignoreList),n}function pe(e){let t=[],{_mappings:n,_sources:r,_names:i}=E(e);for(let e=0;e<n.length;e++){let a=n[e];for(let n=0;n<a.length;n++){let o=a[n],s={line:e+1,column:o[w]},c,l,u;o.length!==1&&(c=r.array[o[T]],l={line:o[ee]+1,column:o[te]},o.length===5&&(u=i.array[o[ne]])),t.push({generated:s,source:c,original:l,name:u})}}return t}function O(e,t,n,r,i,a,o,s,c){let{_mappings:l,_sources:u,_sourcesContent:d,_names:f}=E(t),p=me(l,n),m=he(p,r);if(!i)return e&&ye(p,m)?void 0:ge(p,m,[r]);let h=b(u,i),g=s?b(f,s):re;if(h===d.length&&(d[h]=c??null),!(e&&be(p,m,h,a,o,g)))return ge(p,m,s?[r,h,a,o,g]:[r,h,a,o])}function me(e,t){for(let n=e.length;n<=t;n++)e[n]=[];return e[t]}function he(e,t){let n=e.length;for(let r=n-1;r>=0&&!(t>=e[r][w]);n=r--);return n}function ge(e,t,n){for(let n=e.length;n>t;n--)e[n]=e[n-1];e[t]=n}function _e(e){let{length:t}=e,n=t;for(let t=n-1;t>=0&&!(e[t].length>0);n=t,t--);n<t&&(e.length=n)}function ve(e,t){for(let n=0;n<t.length;n++)b(e,t[n])}function ye(e,t){return t===0||e[t-1].length===1}function be(e,t,n,r,i,a){if(t===0)return!1;let o=e[t-1];return o.length!==1&&n===o[T]&&r===o[ee]&&i===o[te]&&a===(o.length===5?o[ne]:re)}function xe(e,t,n){let{generated:r,source:i,original:a,name:o,content:s}=n;return i?O(e,t,r.line-1,r.column,i,a.line-1,a.column,o,s):O(e,t,r.line-1,r.column,null,null,null,null,null)}}))})),fw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=dw(),n=qC();e.default=function({code:e,mappings:i},a,o,s,c){let l=r(s,c),u=new t.GenMapping({file:o.compiledFilename}),d=0,f=i[0];for(;f===void 0&&d<i.length-1;)d++,f=i[d];let p=0,m=0;f!==m&&t.maybeAddSegment.call(void 0,u,p,0,a,p,0);for(let r=0;r<e.length;r++){if(r===f){let e=f-m,n=l[d];for(t.maybeAddSegment.call(void 0,u,p,e,a,p,n);(f===r||f===void 0)&&d<i.length-1;)d++,f=i[d]}e.charCodeAt(r)===n.charCodes.lineFeed&&(p++,m=r+1,f!==m&&t.maybeAddSegment.call(void 0,u,p,0,a,p,0))}let{sourceRoot:h,sourcesContent:g,..._}=t.toEncodedMap.call(void 0,u);return _};function r(e,t){let r=Array(t.length),i=0,a=t[i].start,o=0;for(let s=0;s<e.length;s++)s===a&&(r[i]=a-o,i++,a=t[i].start),e.charCodeAt(s)===n.charCodes.lineFeed&&(o=s+1);return r}})),pw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={require:`
|
|
554
|
+
`}else if(r===`&`){let{entity:r,newI:i}=f(e,n+1);t+=r,n=i-1}else t+=r}return JSON.stringify(t)}function f(e,t){let r=``,i=0,a,o=t;if(e[o]===`#`){let t=10;o++;let n;if(e[o]===`x`)for(t=16,o++,n=o;o<e.length&&m(e.charCodeAt(o));)o++;else for(n=o;o<e.length&&p(e.charCodeAt(o));)o++;if(e[o]===`;`){let r=e.slice(n,o);r&&(o++,a=String.fromCodePoint(parseInt(r,t)))}}else for(;o<e.length&&i++<10;){let t=e[o];if(o++,t===`;`){a=n.default.get(r);break}r+=t}return a?{entity:a,newI:o}:{entity:`&`,newI:t}}function p(e){return e>=a.charCodes.digit0&&e<=a.charCodes.digit9}function m(e){return e>=a.charCodes.digit0&&e<=a.charCodes.digit9||e>=a.charCodes.lowercaseA&&e<=a.charCodes.lowercaseF||e>=a.charCodes.uppercaseA&&e<=a.charCodes.uppercaseF}})),fw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=ow(),r=G(),i=dw(),a=t(lw());e.getNonTypeIdentifiers=function(e,t){let o=a.default.call(void 0,t),s=/* @__PURE__ */ new Set;for(let t=0;t<e.tokens.length;t++){let a=e.tokens[t];if(a.type!==r.TokenType.name||a.isType||a.identifierRole!==n.IdentifierRole.Access&&a.identifierRole!==n.IdentifierRole.ObjectShorthand&&a.identifierRole!==n.IdentifierRole.ExportAccess||a.shadowsGlobal||s.add(e.identifierNameForToken(a)),a.type===r.TokenType.jsxTagStart&&s.add(o.base),a.type===r.TokenType.jsxTagStart&&t+1<e.tokens.length&&e.tokens[t+1].type===r.TokenType.jsxTagEnd&&(s.add(o.base),s.add(o.fragmentBase)),a.type===r.TokenType.jsxName&&a.identifierRole===n.IdentifierRole.Access){let n=e.identifierNameForToken(a);i.startsWithLowerCase.call(void 0,n)&&e.tokens[t+1].type!==r.TokenType.dot||s.add(e.identifierNameForToken(a))}}return s}})),pw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=ow(),r=ZC(),i=G(),a=t(sw()),o=fw();e.default=class e{__init(){this.nonTypeIdentifiers=/* @__PURE__ */ new Set}__init2(){this.importInfoByPath=/* @__PURE__ */ new Map}__init3(){this.importsToReplace=/* @__PURE__ */ new Map}__init4(){this.identifierReplacements=/* @__PURE__ */ new Map}__init5(){this.exportBindingsByLocalName=/* @__PURE__ */ new Map}constructor(t,n,r,i,a,o,s){this.nameManager=t,this.tokens=n,this.enableLegacyTypeScriptModuleInterop=r,this.options=i,this.isTypeScriptTransformEnabled=a,this.keepUnusedImports=o,this.helperManager=s,e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),e.prototype.__init4.call(this),e.prototype.__init5.call(this)}preprocessTokens(){for(let e=0;e<this.tokens.tokens.length;e++)this.tokens.matches1AtIndex(e,i.TokenType._import)&&!this.tokens.matches3AtIndex(e,i.TokenType._import,i.TokenType.name,i.TokenType.eq)&&this.preprocessImportAtIndex(e),this.tokens.matches1AtIndex(e,i.TokenType._export)&&!this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType.eq)&&this.preprocessExportAtIndex(e);this.generateImportReplacements()}pruneTypeOnlyImports(){this.nonTypeIdentifiers=o.getNonTypeIdentifiers.call(void 0,this.tokens,this.options);for(let[e,t]of this.importInfoByPath.entries())t.hasBareImport||t.hasStarExport||t.exportStarNames.length>0||t.namedExports.length>0||[...t.defaultNames,...t.wildcardNames,...t.namedImports.map(({localName:e})=>e)].every(e=>this.shouldAutomaticallyElideImportedName(e))&&this.importsToReplace.set(e,``)}shouldAutomaticallyElideImportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(e)}generateImportReplacements(){for(let[e,t]of this.importInfoByPath.entries()){let{defaultNames:n,wildcardNames:r,namedImports:i,namedExports:a,exportStarNames:o,hasStarExport:s}=t;if(n.length===0&&r.length===0&&i.length===0&&a.length===0&&o.length===0&&!s){this.importsToReplace.set(e,`require('${e}');`);continue}let c=this.getFreeIdentifierForPath(e),l;l=this.enableLegacyTypeScriptModuleInterop?c:r.length>0?r[0]:this.getFreeIdentifierForPath(e);let u=`var ${c} = require('${e}');`;if(r.length>0)for(let e of r){let t=this.enableLegacyTypeScriptModuleInterop?c:`${this.helperManager.getHelperName(`interopRequireWildcard`)}(${c})`;u+=` var ${e} = ${t};`}else o.length>0&&l!==c?u+=` var ${l} = ${this.helperManager.getHelperName(`interopRequireWildcard`)}(${c});`:n.length>0&&l!==c&&(u+=` var ${l} = ${this.helperManager.getHelperName(`interopRequireDefault`)}(${c});`);for(let{importedName:e,localName:t}of a)u+=` ${this.helperManager.getHelperName(`createNamedExportFrom`)}(${c}, '${t}', '${e}');`;for(let e of o)u+=` exports.${e} = ${l};`;s&&(u+=` ${this.helperManager.getHelperName(`createStarExport`)}(${c});`),this.importsToReplace.set(e,u);for(let e of n)this.identifierReplacements.set(e,`${l}.default`);for(let{importedName:e,localName:t}of i)this.identifierReplacements.set(t,`${c}.${e}`)}}getFreeIdentifierForPath(e){let t=e.split(`/`),n=t[t.length-1].replace(/\W/g,``);return this.nameManager.claimFreeName(`_${n}`)}preprocessImportAtIndex(e){let t=[],n=[],a=[];if(e++,(this.tokens.matchesContextualAtIndex(e,r.ContextualKeyword._type)||this.tokens.matches1AtIndex(e,i.TokenType._typeof))&&!this.tokens.matches1AtIndex(e+1,i.TokenType.comma)&&!this.tokens.matchesContextualAtIndex(e+1,r.ContextualKeyword._from)||this.tokens.matches1AtIndex(e,i.TokenType.parenL))return;if(this.tokens.matches1AtIndex(e,i.TokenType.name)&&(t.push(this.tokens.identifierNameAtIndex(e)),e++,this.tokens.matches1AtIndex(e,i.TokenType.comma)&&e++),this.tokens.matches1AtIndex(e,i.TokenType.star)&&(e+=2,n.push(this.tokens.identifierNameAtIndex(e)),e++),this.tokens.matches1AtIndex(e,i.TokenType.braceL)){let n=this.getNamedImports(e+1);e=n.newIndex;for(let e of n.namedImports)e.importedName==="default"?t.push(e.localName):a.push(e)}if(this.tokens.matchesContextualAtIndex(e,r.ContextualKeyword._from)&&e++,!this.tokens.matches1AtIndex(e,i.TokenType.string))throw Error(`Expected string token at the end of import statement.`);let o=this.tokens.stringValueAtIndex(e),s=this.getImportInfo(o);s.defaultNames.push(...t),s.wildcardNames.push(...n),s.namedImports.push(...a),t.length===0&&n.length===0&&a.length===0&&(s.hasBareImport=!0)}preprocessExportAtIndex(e){if(this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._var)||this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._let)||this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._const))this.preprocessVarExportAtIndex(e);else if(this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._function)||this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._class)){let t=this.tokens.identifierNameAtIndex(e+2);this.addExportBinding(t,t)}else if(this.tokens.matches3AtIndex(e,i.TokenType._export,i.TokenType.name,i.TokenType._function)){let t=this.tokens.identifierNameAtIndex(e+3);this.addExportBinding(t,t)}else this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType.braceL)?this.preprocessNamedExportAtIndex(e):this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType.star)&&this.preprocessExportStarAtIndex(e)}preprocessVarExportAtIndex(e){let t=0;for(let r=e+2;;r++)if(this.tokens.matches1AtIndex(r,i.TokenType.braceL)||this.tokens.matches1AtIndex(r,i.TokenType.dollarBraceL)||this.tokens.matches1AtIndex(r,i.TokenType.bracketL))t++;else if(this.tokens.matches1AtIndex(r,i.TokenType.braceR)||this.tokens.matches1AtIndex(r,i.TokenType.bracketR))t--;else if(t===0&&!this.tokens.matches1AtIndex(r,i.TokenType.name))break;else if(this.tokens.matches1AtIndex(1,i.TokenType.eq)){let e=this.tokens.currentToken().rhsEndIndex;if(e==null)throw Error(`Expected = token with an end index.`);r=e-1}else{let e=this.tokens.tokens[r];if(n.isDeclaration.call(void 0,e)){let e=this.tokens.identifierNameAtIndex(r);this.identifierReplacements.set(e,`exports.${e}`)}}}preprocessNamedExportAtIndex(e){e+=2;let{newIndex:t,namedImports:n}=this.getNamedImports(e);if(e=t,this.tokens.matchesContextualAtIndex(e,r.ContextualKeyword._from))e++;else{for(let{importedName:e,localName:t}of n)this.addExportBinding(e,t);return}if(!this.tokens.matches1AtIndex(e,i.TokenType.string))throw Error(`Expected string token at the end of import statement.`);let a=this.tokens.stringValueAtIndex(e);this.getImportInfo(a).namedExports.push(...n)}preprocessExportStarAtIndex(e){let t=null;if(this.tokens.matches3AtIndex(e,i.TokenType._export,i.TokenType.star,i.TokenType._as)?(e+=3,t=this.tokens.identifierNameAtIndex(e),e+=2):e+=3,!this.tokens.matches1AtIndex(e,i.TokenType.string))throw Error(`Expected string token at the end of star export statement.`);let n=this.tokens.stringValueAtIndex(e),r=this.getImportInfo(n);t===null?r.hasStarExport=!0:r.exportStarNames.push(t)}getNamedImports(e){let t=[];for(;;){if(this.tokens.matches1AtIndex(e,i.TokenType.braceR)){e++;break}let n=a.default.call(void 0,this.tokens,e);if(e=n.endIndex,n.isType||t.push({importedName:n.leftName,localName:n.rightName}),this.tokens.matches2AtIndex(e,i.TokenType.comma,i.TokenType.braceR)){e+=2;break}if(this.tokens.matches1AtIndex(e,i.TokenType.braceR)){e++;break}if(this.tokens.matches1AtIndex(e,i.TokenType.comma))e++;else throw Error(`Unexpected token: ${JSON.stringify(this.tokens.tokens[e])}`)}return{newIndex:e,namedImports:t}}getImportInfo(e){let t=this.importInfoByPath.get(e);if(t)return t;let n={defaultNames:[],wildcardNames:[],namedImports:[],namedExports:[],hasBareImport:!1,exportStarNames:[],hasStarExport:!1};return this.importInfoByPath.set(e,n),n}addExportBinding(e,t){this.exportBindingsByLocalName.has(e)||this.exportBindingsByLocalName.set(e,[]),this.exportBindingsByLocalName.get(e).push(t)}claimImportCode(e){let t=this.importsToReplace.get(e);return this.importsToReplace.set(e,``),t||``}getIdentifierReplacement(e){return this.identifierReplacements.get(e)||null}resolveExportBinding(e){let t=this.exportBindingsByLocalName.get(e);return!t||t.length===0?null:t.map(e=>`exports.${e}`).join(` = `)}getGlobalNames(){return/* @__PURE__ */ new Set([...this.identifierReplacements.keys(),...this.exportBindingsByLocalName.keys()])}}})),mw=/* @__PURE__ */ o(((e,t,n)=>{var r;(function(n,i){if(typeof e==`object`&&t!==void 0)i(t),t.exports=a(t);else if(typeof r==`function`&&r.amd)r([`module`],function(e){i.apply(this,arguments),e.exports=a(e)});else{let e={exports:{}};i(e),n=typeof globalThis<`u`?globalThis:n||self,n.sourcemapCodec=a(e)}function a(e){return`default`in e.exports?e.exports.default:e.exports}})(n,(function(e){"use strict";var t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},o=(e,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(let c of r(a))!i.call(e,c)&&c!==o&&t(e,c,{get:()=>a[c],enumerable:!(s=n(a,c))||s.enumerable});return e},s=e=>o(t({},`__esModule`,{value:!0}),e),c={};a(c,{decode:()=>ae,decodeGeneratedRanges:()=>te,decodeOriginalScopes:()=>w,decodeRangeMappings:()=>D,encode:()=>O,encodeGeneratedRanges:()=>ne,encodeOriginalScopes:()=>T,encodeRangeMappings:()=>ie}),e.exports=s(c);var l=44,u=59,d=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,f=/* @__PURE__ */ new Uint8Array(64),p=/* @__PURE__ */ new Uint8Array(128);for(let e=0;e<d.length;e++){let t=d.charCodeAt(e);f[e]=t,p[t]=e}function m(e){let t=0,n=0,r=0;do r=p[e.next()],t|=(r&31)<<n,n+=5;while(r&32);return t}function h(e){return e&1?-0x80000000|-(e>>>1):e>>>1}function g(e,t){do{let n=t&31;t>>>=5,t>0&&(n|=32),e.write(f[n])}while(t>0)}function _(e){return e<0?-e<<1|1:e<<1}function v(e,t){return e.pos>=t?!1:e.peek()!==l}var y=16384,b=typeof TextDecoder<`u`?/* @__PURE__ */ new TextDecoder:typeof Buffer<`u`?{decode(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString()}}:{decode(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}},x=class{constructor(){this.pos=0,this.out=``,this.buffer=new Uint8Array(y)}write(e){let{buffer:t}=this;t[this.pos++]=e,this.pos===y&&(this.out+=b.decode(t),this.pos=0)}flush(){let{buffer:e,out:t,pos:n}=this;return n>0?t+b.decode(e.subarray(0,n)):t}},S=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}},C=[];function w(e){let{length:t}=e,n=new S(e),r=[],i=[],a=0;for(;n.pos<t;n.pos++){a+=h(m(n));let e=h(m(n));if(!v(n,t)){let t=i.pop();t[2]=a,t[3]=e;continue}let o=h(m(n)),s=h(m(n))&1?[a,e,0,0,o,h(m(n))]:[a,e,0,0,o],c=C;if(v(n,t)){c=[];do{let e=h(m(n));c.push(e)}while(v(n,t))}s.vars=c,r.push(s),i.push(s)}return r}function T(e){let t=new x;for(let n=0;n<e.length;)n=ee(e,n,t,[0]);return t.flush()}function ee(e,t,n,r){let i=e[t],{0:a,1:o,2:s,3:c,4:u,vars:d}=i;t>0&&n.write(l),g(n,_(a-r[0])),r[0]=a,g(n,_(o)),g(n,_(u)),g(n,_(+(i.length===6))),i.length===6&&g(n,_(i[5]));for(let e of d)g(n,_(e));for(t++;t<e.length;){let{0:i,1:a}=e[t];if(i>s||i===s&&a>=c)break;t=ee(e,t,n,r)}return n.write(l),g(n,_(s-r[0])),r[0]=s,g(n,_(c)),t}function te(e){let{length:t}=e,n=new S(e),r=[],i=[],a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0;do{let e=n.indexOf(`;`),t=0;for(;n.pos<e;n.pos++){if(t+=h(m(n)),!v(n,e)){let e=i.pop();e[2]=a,e[3]=t;continue}let p=h(m(n)),g=p&1,_=p&2,y=p&4,b=null,x=C,S;if(g){let e=o+h(m(n));s=h(m(n))+(o===e?s:0),o=e,S=[a,t,0,0,e,s]}else S=[a,t,0,0];if(S.isScope=!!y,_){let e=c,t=l;c+=h(m(n));let r=e===c;l=(r?l:0)+h(m(n)),u=(r&&t===l?u:0)+h(m(n)),b=[c,l,u]}if(S.callsite=b,v(n,e)){x=[];do{d=a,f=t;let e=h(m(n)),r;if(e<-1){r=[[h(m(n))]];for(let t=-1;t>e;t--){let e=d;d+=h(m(n)),f=(d===e?f:0)+h(m(n));let t=h(m(n));r.push([t,d,f])}}else r=[[e]];x.push(r)}while(v(n,e))}S.bindings=x,r.push(S),i.push(S)}a++,n.pos=e+1}while(n.pos<t);return r}function ne(e){if(e.length===0)return``;let t=new x;for(let n=0;n<e.length;)n=E(e,n,t,[0,0,0,0,0,0,0]);return t.flush()}function E(e,t,n,r){let i=e[t],{0:a,1:o,2:s,3:c,isScope:u,callsite:d,bindings:f}=i;if(r[0]<a?(re(n,r[0],a),r[0]=a,r[1]=0):t>0&&n.write(l),g(n,_(i[1]-r[1])),r[1]=i[1],g(n,_(i.length===6|(d?2:0)|(u?4:0))),i.length===6){let{4:e,5:t}=i;e!==r[2]&&(r[3]=0),g(n,_(e-r[2])),r[2]=e,g(n,_(t-r[3])),r[3]=t}if(d){let{0:e,1:t,2:a}=i.callsite;e===r[4]?t!==r[5]&&(r[6]=0):(r[5]=0,r[6]=0),g(n,_(e-r[4])),r[4]=e,g(n,_(t-r[5])),r[5]=t,g(n,_(a-r[6])),r[6]=a}if(f)for(let e of f){e.length>1&&g(n,_(-e.length)),g(n,_(e[0][0]));let t=a,r=o;for(let i=1;i<e.length;i++){let a=e[i];g(n,_(a[1]-t)),t=a[1],g(n,_(a[2]-r)),r=a[2],g(n,_(a[0]))}}for(t++;t<e.length;){let{0:i,1:a}=e[t];if(i>s||i===s&&a>=c)break;t=E(e,t,n,r)}return r[0]<s?(re(n,r[0],s),r[0]=s,r[1]=0):n.write(l),g(n,_(c-r[1])),r[1]=c,t}function re(e,t,n){do e.write(u);while(++t<n)}function D(e){let{length:t}=e,n=new S(e),r=[];do{let e=n.indexOf(`;`),t=[],i=0;for(;n.pos<e;)i+=m(n),t.push(i);r.push(t),n.pos=e+1}while(n.pos<=t);return r}function ie(e){if(e.length===0)return``;let t=new x;for(let n=0;n<e.length;n++){let r=e[n];n>0&&t.write(u);let i=0;for(let e=0;e<r.length;e++){let n=r[e];g(t,n-i),i=n}}return t.flush()}function ae(e){let{length:t}=e,n=new S(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i+=h(m(n)),i<u&&(l=!1),u=i,v(n,e)?(a+=h(m(n)),o+=h(m(n)),s+=h(m(n)),v(n,e)?(c+=h(m(n)),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||oe(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function oe(e){e.sort(se)}function se(e,t){return e[0]-t[0]}function O(e){let t=new x,n=0,r=0,i=0,a=0;for(let o=0;o<e.length;o++){let s=e[o];if(o>0&&t.write(u),s.length===0)continue;let c=0;for(let e=0;e<s.length;e++){let o=s[e];e>0&&t.write(l),g(t,_(o[0]-c)),c=o[0],o.length!==1&&(g(t,_(o[1]-n)),g(t,_(o[2]-r)),g(t,_(o[3]-i)),n=o[1],r=o[2],i=o[3],o.length!==4&&(g(t,_(o[4]-a)),a=o[4]))}}return t.flush()}}))})),hw=/* @__PURE__ */ o(((e,t,n)=>{var r;(function(n,i){typeof e==`object`&&t!==void 0?t.exports=i():typeof r==`function`&&r.amd?r(i):(n=typeof globalThis<`u`?globalThis:n||self,n.resolveURI=i())})(n,(function(){"use strict";let e=/^[\w+.-]+:\/\//,t=/^([\w+.-]+:)\/\/([^@/#?]*@)?(\[[^\]]+\]|[^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function r(t){return e.test(t)}function i(e){return e.startsWith(`//`)}function a(e){return e.startsWith(`/`)}function o(e){return e.startsWith(`file:`)}function s(e){return/^[.?#]/.test(e)}function c(e){let n=t.exec(e);return u(n[1],n[2]||``,n[3],n[4]||``,n[5]||`/`,n[6]||``,n[7]||``)}function l(e){let t=n.exec(e),r=t[2];return u(`file:`,``,t[1]||``,``,a(r)?r:`/`+r,t[3]||``,t[4]||``)}function u(e,t,n,r,i,a,o){return{scheme:e,user:t,host:n,port:r,path:i,query:a,hash:o,type:7}}function d(e){if(i(e)){let t=c(`http:`+e);return t.scheme=``,t.type=6,t}if(a(e)){let t=c(`http://foo.com`+e);return t.scheme=``,t.host=``,t.type=5,t}if(o(e))return l(e);if(r(e))return c(e);let t=c(`http://foo.com/`+e);return t.scheme=``,t.host=``,t.type=e?e.startsWith(`?`)?3:e.startsWith(`#`)?2:4:1,t}function f(e){if(e.endsWith(`/..`))return e;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function p(e,t){m(t,t.type),e.path=e.path===`/`?t.path:f(t.path)+e.path}function m(e,t){let n=t<=4,r=e.path.split(`/`),i=1,a=0,o=!1;for(let e=1;e<r.length;e++){let t=r[e];t?(o=!1,t!==`.`&&(t===`..`?a?(o=!0,a--,i--):n&&(r[i++]=t):(r[i++]=t,a++))):o=!0}let s=``;for(let e=1;e<i;e++)s+=`/`+r[e];(!s||o&&!s.endsWith(`/..`))&&(s+=`/`),e.path=s}function h(e,t){if(!e&&!t)return``;let n=d(e),r=n.type;if(t&&r!==7){let e=d(t),i=e.type;switch(r){case 1:n.hash=e.hash;case 2:n.query=e.query;case 3:case 4:p(n,e);case 5:n.user=e.user,n.host=e.host,n.port=e.port;case 6:n.scheme=e.scheme}i>r&&(r=i)}m(n,r);let i=n.query+n.hash;switch(r){case 2:case 3:return i;case 4:{let r=n.path.slice(1);return r?s(t||e)&&!s(r)?`./`+r+i:r+i:i||`.`}case 5:return n.path+i;default:return n.scheme+`//`+n.user+n.host+n.port+n.path+i}}return h}))})),gw=/* @__PURE__ */ o(((e,t,n)=>{var r;(function(n,i){if(typeof e==`object`&&t!==void 0)i(t,hw(),mw()),t.exports=a(t);else if(typeof r==`function`&&r.amd)r([`module`,`@jridgewell/resolve-uri`,`@jridgewell/sourcemap-codec`],function(e){i.apply(this,arguments),e.exports=a(e)});else{let e={exports:{}};i(e,n.resolveURI,n.sourcemapCodec),n=typeof globalThis<`u`?globalThis:n||self,n.traceMapping=a(e)}function a(e){return`default`in e.exports?e.exports.default:e.exports}})(n,(function(e,t,n){"use strict";var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>function(){return t||(0,e[o(e)[0]])((t={exports:{}}).exports,t),t.exports},u=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:r(s(e)),d(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),p=e=>d(i({},`__esModule`,{value:!0}),e),m=l({"umd:@jridgewell/sourcemap-codec"(e,t){t.exports=n}}),h=l({"umd:@jridgewell/resolve-uri"(e,n){n.exports=t}}),g={};u(g,{AnyMap:()=>fe,FlattenMap:()=>fe,GREATEST_LOWER_BOUND:()=>ye,LEAST_UPPER_BOUND:()=>ve,TraceMap:()=>be,allGeneratedPositionsFor:()=>De,decodedMap:()=>Me,decodedMappings:()=>Ce,eachMapping:()=>Oe,encodedMap:()=>Ne,encodedMappings:()=>Se,generatedPositionFor:()=>Ee,isIgnored:()=>Ae,originalPositionFor:()=>Te,presortedDecodedMap:()=>je,sourceContentFor:()=>A,traceSegment:()=>we}),e.exports=p(g);var _=f(m()),v=f(h());function y(e){if(!e)return``;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function b(e,t){let n=y(e),r=t?t+`/`:``;return e=>(0,v.default)(r+(e||``),n)}var x=0,S=1,C=2,w=3,T=4,ee=1,te=2;function ne(e,t){let n=E(e,0);if(n===e.length)return e;t||(e=e.slice());for(let r=n;r<e.length;r=E(e,r+1))e[r]=D(e[r],t);return e}function E(e,t){for(let n=t;n<e.length;n++)if(!re(e[n]))return n;return e.length}function re(e){for(let t=1;t<e.length;t++)if(e[t][x]<e[t-1][x])return!1;return!0}function D(e,t){return t||(e=e.slice()),e.sort(ie)}function ie(e,t){return e[x]-t[x]}function ae(e,t){let n=t.map(()=>[]);for(let t=0;t<e.length;t++){let r=e[t];for(let e=0;e<r.length;e++){let i=r[e];if(i.length===1)continue;let a=i[S],o=i[C],s=i[w],c=n[a];(c[o]||(c[o]=[])).push([s,t,i[x]])}}for(let e=0;e<n.length;e++){let t=n[e];for(let e=0;e<t.length;e++){let n=t[e];n&&n.sort(ie)}}return n}var oe=!1;function se(e,t,n,r){for(;n<=r;){let i=n+(r-n>>1),a=e[i][x]-t;if(a===0)return oe=!0,i;a<0?n=i+1:r=i-1}return oe=!1,n-1}function O(e,t,n){for(let r=n+1;r<e.length&&e[r][x]===t;n=r++);return n}function ce(e,t,n){for(let r=n-1;r>=0&&e[r][x]===t;n=r--);return n}function le(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function ue(e,t,n,r){let{lastKey:i,lastNeedle:a,lastIndex:o}=n,s=0,c=e.length-1;if(r===i){if(t===a)return oe=o!==-1&&e[o][x]===t,o;t>=a?s=o===-1?0:o:c=o}return n.lastKey=r,n.lastNeedle=t,n.lastIndex=se(e,t,s,c)}function de(e){return typeof e==`string`?JSON.parse(e):e}var fe=function(e,t){let n=de(e);if(!(`sections`in n))return new be(n,t);let r=[],i=[],a=[],o=[],s=[];return k(n,t,r,i,a,o,s,0,0,1/0,1/0),je({version:3,file:n.file,names:o,sources:i,sourcesContent:a,mappings:r,ignoreList:s})};function k(e,t,n,r,i,a,o,s,c,l,u){let{sections:d}=e;for(let e=0;e<d.length;e++){let{map:f,offset:p}=d[e],m=l,h=u;if(e+1<d.length){let t=d[e+1].offset;m=Math.min(l,s+t.line),m===l?h=Math.min(u,c+t.column):m<l&&(h=c+t.column)}pe(f,t,n,r,i,a,o,s+p.line,c+p.column,m,h)}}function pe(e,t,n,r,i,a,o,s,c,l,u){let d=de(e);if(`sections`in d)return k(...arguments);let f=new be(d,t),p=r.length,m=a.length,h=Ce(f),{resolvedSources:g,sourcesContent:_,ignoreList:v}=f;if(me(r,g),me(a,f.names),_)me(i,_);else for(let e=0;e<g.length;e++)i.push(null);if(v)for(let e=0;e<v.length;e++)o.push(v[e]+p);for(let e=0;e<h.length;e++){let t=s+e;if(t>l)return;let r=he(n,t),i=e===0?c:0,a=h[e];for(let e=0;e<a.length;e++){let n=a[e],o=i+n[x];if(t===l&&o>=u)return;if(n.length===1){r.push([o]);continue}let s=p+n[S],c=n[C],d=n[w];r.push(n.length===4?[o,s,c,d]:[o,s,c,d,m+n[T]])}}}function me(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}function he(e,t){for(let n=e.length;n<=t;n++)e[n]=[];return e[t]}var ge="`line` must be greater than 0 (lines start at line 1)",_e="`column` must be greater than or equal to 0 (columns start at column 0)",ve=-1,ye=1,be=class{constructor(e,t){let n=typeof e==`string`;if(!n&&e._decodedMemo)return e;let r=de(e),{version:i,file:a,names:o,sourceRoot:s,sources:c,sourcesContent:l}=r;this.version=i,this.file=a,this.names=o||[],this.sourceRoot=s,this.sources=c,this.sourcesContent=l,this.ignoreList=r.ignoreList||r.x_google_ignoreList||void 0;let u=b(t,s);this.resolvedSources=c.map(u);let{mappings:d}=r;if(typeof d==`string`)this._encoded=d,this._decoded=void 0;else if(Array.isArray(d))this._encoded=void 0,this._decoded=ne(d,n);else if(r.sections)throw Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);else throw Error(`invalid source map: ${JSON.stringify(r)}`);this._decodedMemo=le(),this._bySources=void 0,this._bySourceMemos=void 0}};function xe(e){return e}function Se(e){var t;return(t=xe(e))._encoded??(t._encoded=(0,_.encode)(xe(e)._decoded))}function Ce(e){var t;return(t=xe(e))._decoded||(t._decoded=(0,_.decode)(xe(e)._encoded))}function we(e,t,n){let r=Ce(e);if(t>=r.length)return null;let i=r[t],a=Le(i,xe(e)._decodedMemo,t,n,ye);return a===-1?null:i[a]}function Te(e,t){let{line:n,column:r,bias:i}=t;if(n--,n<0)throw Error(ge);if(r<0)throw Error(_e);let a=Ce(e);if(n>=a.length)return Fe(null,null,null,null);let o=a[n],s=Le(o,xe(e)._decodedMemo,n,r,i||ye);if(s===-1)return Fe(null,null,null,null);let c=o[s];if(c.length===1)return Fe(null,null,null,null);let{names:l,resolvedSources:u}=e;return Fe(u[c[S]],c[C]+1,c[w],c.length===5?l[c[T]]:null)}function Ee(e,t){let{source:n,line:r,column:i,bias:a}=t;return ze(e,n,r,i,a||ye,!1)}function De(e,t){let{source:n,line:r,column:i,bias:a}=t;return ze(e,n,r,i,a||ve,!0)}function Oe(e,t){let n=Ce(e),{names:r,resolvedSources:i}=e;for(let e=0;e<n.length;e++){let a=n[e];for(let n=0;n<a.length;n++){let o=a[n],s=e+1,c=o[0],l=null,u=null,d=null,f=null;o.length!==1&&(l=i[o[1]],u=o[2]+1,d=o[3]),o.length===5&&(f=r[o[4]]),t({generatedLine:s,generatedColumn:c,source:l,originalLine:u,originalColumn:d,name:f})}}}function ke(e,t){let{sources:n,resolvedSources:r}=e,i=n.indexOf(t);return i===-1&&(i=r.indexOf(t)),i}function A(e,t){let{sourcesContent:n}=e;if(n==null)return null;let r=ke(e,t);return r===-1?null:n[r]}function Ae(e,t){let{ignoreList:n}=e;if(n==null)return!1;let r=ke(e,t);return r!==-1&&n.includes(r)}function je(e,t){let n=new be(Pe(e,[]),t);return xe(n)._decoded=e.mappings,n}function Me(e){return Pe(e,Ce(e))}function Ne(e){return Pe(e,Se(e))}function Pe(e,t){return{version:e.version,file:e.file,names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,mappings:t,ignoreList:e.ignoreList||e.x_google_ignoreList}}function Fe(e,t,n,r){return{source:e,line:t,column:n,name:r}}function Ie(e,t){return{line:e,column:t}}function Le(e,t,n,r,i){let a=ue(e,r,t,n);return oe?a=(i===ve?O:ce)(e,r,a):i===ve&&a++,a===-1||a===e.length?-1:a}function Re(e,t,n,r,i){let a=Le(e,t,n,r,ye);if(!oe&&i===ve&&a++,a===-1||a===e.length)return[];let o=oe?r:e[a][x];oe||(a=ce(e,o,a));let s=O(e,o,a),c=[];for(;a<=s;a++){let t=e[a];c.push(Ie(t[ee]+1,t[te]))}return c}function ze(e,t,n,r,i,a){var o,s;if(n--,n<0)throw Error(ge);if(r<0)throw Error(_e);let{sources:c,resolvedSources:l}=e,u=c.indexOf(t);if(u===-1&&(u=l.indexOf(t)),u===-1)return a?[]:Ie(null,null);let d=(o=xe(e))._bySourceMemos||(o._bySourceMemos=c.map(le)),f=((s=xe(e))._bySources||(s._bySources=ae(Ce(e),d)))[u][n];if(f==null)return a?[]:Ie(null,null);let p=d[u];if(a)return Re(f,p,n,r,i);let m=Le(f,p,n,r,i);if(m===-1)return Ie(null,null);let h=f[m];return Ie(h[ee]+1,h[te])}}))})),_w=/* @__PURE__ */ o(((e,t,n)=>{var r;(function(n,i){if(typeof e==`object`&&t!==void 0)i(t,mw(),gw()),t.exports=a(t);else if(typeof r==`function`&&r.amd)r([`module`,`@jridgewell/sourcemap-codec`,`@jridgewell/trace-mapping`],function(e){i.apply(this,arguments),e.exports=a(e)});else{let e={exports:{}};i(e,n.sourcemapCodec,n.traceMapping),n=typeof globalThis<`u`?globalThis:n||self,n.genMapping=a(e)}function a(e){return`default`in e.exports?e.exports.default:e.exports}})(n,(function(e,t,n){"use strict";var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>function(){return t||(0,e[o(e)[0]])((t={exports:{}}).exports,t),t.exports},u=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:r(s(e)),d(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),p=e=>d(i({},`__esModule`,{value:!0}),e),m=l({"umd:@jridgewell/sourcemap-codec"(e,n){n.exports=t}}),h=l({"umd:@jridgewell/trace-mapping"(e,t){t.exports=n}}),g={};u(g,{GenMapping:()=>re,addMapping:()=>ae,addSegment:()=>ie,allMappings:()=>fe,fromMap:()=>de,maybeAddMapping:()=>se,maybeAddSegment:()=>oe,setIgnore:()=>ce,setSourceContent:()=>O,toDecodedMap:()=>le,toEncodedMap:()=>ue}),e.exports=p(g);var _=class{constructor(){this._indexes={__proto__:null},this.array=[]}};function v(e){return e}function y(e,t){return v(e)._indexes[t]}function b(e,t){let n=y(e,t);if(n!==void 0)return n;let{array:r,_indexes:i}=v(e);return i[t]=r.push(t)-1}function x(e,t){let n=y(e,t);if(n===void 0)return;let{array:r,_indexes:i}=v(e);for(let e=n+1;e<r.length;e++){let t=r[e];r[e-1]=t,i[t]--}i[t]=void 0,r.pop()}var S=f(m()),C=f(h()),w=0,T=1,ee=2,te=3,ne=4,E=-1,re=class{constructor({file:e,sourceRoot:t}={}){this._names=new _,this._sources=new _,this._sourcesContent=[],this._mappings=[],this.file=e,this.sourceRoot=t,this._ignoreList=new _}};function D(e){return e}function ie(e,t,n,r,i,a,o,s){return k(!1,e,t,n,r,i,a,o,s)}function ae(e,t){return be(!1,e,t)}var oe=(e,t,n,r,i,a,o,s)=>k(!0,e,t,n,r,i,a,o,s),se=(e,t)=>be(!0,e,t);function O(e,t,n){let{_sources:r,_sourcesContent:i}=D(e),a=b(r,t);i[a]=n}function ce(e,t,n=!0){let{_sources:r,_sourcesContent:i,_ignoreList:a}=D(e),o=b(r,t);o===i.length&&(i[o]=null),n?b(a,o):x(a,o)}function le(e){let{_mappings:t,_sources:n,_sourcesContent:r,_names:i,_ignoreList:a}=D(e);return ge(t),{version:3,file:e.file||void 0,names:i.array,sourceRoot:e.sourceRoot||void 0,sources:n.array,sourcesContent:r,mappings:t,ignoreList:a.array}}function ue(e){let t=le(e);return Object.assign({},t,{mappings:(0,S.encode)(t.mappings)})}function de(e){let t=new C.TraceMap(e),n=new re({file:t.file,sourceRoot:t.sourceRoot});return _e(D(n)._names,t.names),_e(D(n)._sources,t.sources),D(n)._sourcesContent=t.sourcesContent||t.sources.map(()=>null),D(n)._mappings=(0,C.decodedMappings)(t),t.ignoreList&&_e(D(n)._ignoreList,t.ignoreList),n}function fe(e){let t=[],{_mappings:n,_sources:r,_names:i}=D(e);for(let e=0;e<n.length;e++){let a=n[e];for(let n=0;n<a.length;n++){let o=a[n],s={line:e+1,column:o[w]},c,l,u;o.length!==1&&(c=r.array[o[T]],l={line:o[ee]+1,column:o[te]},o.length===5&&(u=i.array[o[ne]])),t.push({generated:s,source:c,original:l,name:u})}}return t}function k(e,t,n,r,i,a,o,s,c){let{_mappings:l,_sources:u,_sourcesContent:d,_names:f}=D(t),p=pe(l,n),m=me(p,r);if(!i)return e&&ve(p,m)?void 0:he(p,m,[r]);let h=b(u,i),g=s?b(f,s):E;if(h===d.length&&(d[h]=c??null),!(e&&ye(p,m,h,a,o,g)))return he(p,m,s?[r,h,a,o,g]:[r,h,a,o])}function pe(e,t){for(let n=e.length;n<=t;n++)e[n]=[];return e[t]}function me(e,t){let n=e.length;for(let r=n-1;r>=0&&!(t>=e[r][w]);n=r--);return n}function he(e,t,n){for(let n=e.length;n>t;n--)e[n]=e[n-1];e[t]=n}function ge(e){let{length:t}=e,n=t;for(let t=n-1;t>=0&&!(e[t].length>0);n=t,t--);n<t&&(e.length=n)}function _e(e,t){for(let n=0;n<t.length;n++)b(e,t[n])}function ve(e,t){return t===0||e[t-1].length===1}function ye(e,t,n,r,i,a){if(t===0)return!1;let o=e[t-1];return o.length!==1&&n===o[T]&&r===o[ee]&&i===o[te]&&a===(o.length===5?o[ne]:E)}function be(e,t,n){let{generated:r,source:i,original:a,name:o,content:s}=n;return i?k(e,t,r.line-1,r.column,i,a.line-1,a.column,o,s):k(e,t,r.line-1,r.column,null,null,null,null,null)}}))})),vw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=_w(),n=$C();e.default=function({code:e,mappings:i},a,o,s,c){let l=r(s,c),u=new t.GenMapping({file:o.compiledFilename}),d=0,f=i[0];for(;f===void 0&&d<i.length-1;)d++,f=i[d];let p=0,m=0;f!==m&&t.maybeAddSegment.call(void 0,u,p,0,a,p,0);for(let r=0;r<e.length;r++){if(r===f){let e=f-m,n=l[d];for(t.maybeAddSegment.call(void 0,u,p,e,a,p,n);(f===r||f===void 0)&&d<i.length-1;)d++,f=i[d]}e.charCodeAt(r)===n.charCodes.lineFeed&&(p++,m=r+1,f!==m&&t.maybeAddSegment.call(void 0,u,p,0,a,p,0))}let{sourceRoot:h,sourcesContent:g,..._}=t.toEncodedMap.call(void 0,u);return _};function r(e,t){let r=Array(t.length),i=0,a=t[i].start,o=0;for(let s=0;s<e.length;s++)s===a&&(r[i]=a-o,i++,a=t[i].start),e.charCodeAt(s)===n.charCodes.lineFeed&&(o=s+1);return r}})),yw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={require:`
|
|
555
555
|
import {createRequire as CREATE_REQUIRE_NAME} from "module";
|
|
556
556
|
const require = CREATE_REQUIRE_NAME(import.meta.url);
|
|
557
557
|
`,interopRequireWildcard:`
|
|
@@ -660,13 +660,13 @@ var t;(function(e){e[e.PRECEDENCE_MASK=15]=`PRECEDENCE_MASK`,e[e.IS_KEYWORD=16]=
|
|
|
660
660
|
const result = await ASYNC_OPTIONAL_CHAIN_NAME(ops);
|
|
661
661
|
return result == null ? true : result;
|
|
662
662
|
}
|
|
663
|
-
`};e.HelperManager=class e{__init(){this.helperNames={}}__init2(){this.createRequireName=null}constructor(t){this.nameManager=t,e.prototype.__init.call(this),e.prototype.__init2.call(this)}getHelperName(e){let t=this.helperNames[e];return t||(t=this.nameManager.claimFreeName(`_${e}`),this.helperNames[e]=t,t)}emitHelpers(){let e=``;this.helperNames.optionalChainDelete&&this.getHelperName(`optionalChain`),this.helperNames.asyncOptionalChainDelete&&this.getHelperName(`asyncOptionalChain`);for(let[n,r]of Object.entries(t)){let t=this.helperNames[n],i=r;n===`optionalChainDelete`?i=i.replace(`OPTIONAL_CHAIN_NAME`,this.helperNames.optionalChain):n===`asyncOptionalChainDelete`?i=i.replace(`ASYNC_OPTIONAL_CHAIN_NAME`,this.helperNames.asyncOptionalChain):n===`require`&&(this.createRequireName===null&&(this.createRequireName=this.nameManager.claimFreeName(`_createRequire`)),i=i.replace(/CREATE_REQUIRE_NAME/g,this.createRequireName)),t&&(e+=` `,e+=i.replace(n,t).replace(/\s+/g,` `).trim())}return e}}})),mw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ew(),n=G();e.default=function(e,t,n){r(e,n)&&i(e,t,n)};function r(e,r){for(let i of e.tokens)if(i.type===n.TokenType.name&&!i.isType&&t.isNonTopLevelDeclaration.call(void 0,i)&&r.has(e.identifierNameForToken(i)))return!0;return!1}e.hasShadowedGlobals=r;function i(e,r,i){let o=[],s=r.length-1;for(let c=e.tokens.length-1;;c--){for(;o.length>0&&o[o.length-1].startTokenIndex===c+1;)o.pop();for(;s>=0&&r[s].endTokenIndex===c+1;)o.push(r[s]),s--;if(c<0)break;let l=e.tokens[c],u=e.identifierNameForToken(l);if(o.length>1&&!l.isType&&l.type===n.TokenType.name&&i.has(u)){if(t.isBlockScopedDeclaration.call(void 0,l))a(o[o.length-1],e,u);else if(t.isFunctionScopedDeclaration.call(void 0,l)){let t=o.length-1;for(;t>0&&!o[t].isFunctionScope;)t--;if(t<0)throw Error(`Did not find parent function scope.`);a(o[t],e,u)}}}if(o.length>0)throw Error(`Expected empty scope stack after processing file.`)}function a(e,t,r){for(let i=e.startTokenIndex;i<e.endTokenIndex;i++){let e=t.tokens[i];(e.type===n.TokenType.name||e.type===n.TokenType.jsxName)&&t.identifierNameForToken(e)===r&&(e.shadowsGlobal=!0)}}})),hw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=G();e.default=function(e,n){let r=[];for(let i of n)i.type===t.TokenType.name&&r.push(e.slice(i.start,i.end));return r}})),gw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=t(hw());e.default=class e{__init(){this.usedNames=/* @__PURE__ */ new Set}constructor(t,r){e.prototype.__init.call(this),this.usedNames=new Set(n.default.call(void 0,t,r))}claimFreeName(e){let t=this.findFreeName(e);return this.usedNames.add(t),t}findFreeName(e){if(!this.usedNames.has(e))return e;let t=2;for(;this.usedNames.has(e+String(t));)t++;return e+String(t)}}})),_w=/* @__PURE__ */ o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.DetailContext=e.NoopContext=e.VError=void 0;var i=function(e){r(t,e);function t(n,r){var i=e.call(this,r)||this;return i.path=n,Object.setPrototypeOf(i,t.prototype),i}return t}(Error);e.VError=i,e.NoopContext=function(){function e(){}return e.prototype.fail=function(e,t,n){return!1},e.prototype.unionResolver=function(){return this},e.prototype.createContext=function(){return this},e.prototype.resolveUnion=function(e){},e}();var a=function(){function e(){this._propNames=[``],this._messages=[null],this._score=0}return e.prototype.fail=function(e,t,n){return this._propNames.push(e),this._messages.push(t),this._score+=n,!1},e.prototype.unionResolver=function(){return new o},e.prototype.resolveUnion=function(e){for(var t,n,r=e,i=null,a=0,o=r.contexts;a<o.length;a++){var s=o[a];(!i||s._score>=i._score)&&(i=s)}i&&i._score>0&&((t=this._propNames).push.apply(t,i._propNames),(n=this._messages).push.apply(n,i._messages))},e.prototype.getError=function(e){for(var t=[],n=this._propNames.length-1;n>=0;n--){var r=this._propNames[n];e+=typeof r==`number`?`[`+r+`]`:r?`.`+r:``;var a=this._messages[n];a&&t.push(e+` `+a)}return new i(e,t.join(`; `))},e.prototype.getErrorDetail=function(e){for(var t=[],n=this._propNames.length-1;n>=0;n--){var r=this._propNames[n];e+=typeof r==`number`?`[`+r+`]`:r?`.`+r:``;var i=this._messages[n];i&&t.push({path:e,message:i})}for(var a=null,n=t.length-1;n>=0;n--)a&&(t[n].nested=[a]),a=t[n];return a},e}();e.DetailContext=a;var o=function(){function e(){this.contexts=[]}return e.prototype.createContext=function(){var e=new a;return this.contexts.push(e),e},e}()})),vw=/* @__PURE__ */ o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.basicTypes=e.BasicType=e.TParamList=e.TParam=e.param=e.TFunc=e.func=e.TProp=e.TOptional=e.opt=e.TIface=e.iface=e.TEnumLiteral=e.enumlit=e.TEnumType=e.enumtype=e.TIntersection=e.intersection=e.TUnion=e.union=e.TTuple=e.tuple=e.TArray=e.array=e.TLiteral=e.lit=e.TName=e.name=e.TType=void 0;var i=_w(),a=function(){function e(){}return e}();e.TType=a;function o(e){return typeof e==`string`?c(e):e}function s(e,t){var n=e[t];if(!n)throw Error(`Unknown type `+t);return n}function c(e){return new l(e)}e.name=c;var l=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.name=t,n._failMsg=`is not a `+t,n}return t.prototype.getChecker=function(e,n,r){var i=this,a=s(e,this.name),o=a.getChecker(e,n,r);return a instanceof T||a instanceof t?o:function(e,t){return o(e,t)?!0:t.fail(null,i._failMsg,0)}},t}(a);e.TName=l,e.lit=function(e){return new u(e)};var u=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.value=t,n.name=JSON.stringify(t),n._failMsg=`is not `+n.name,n}return t.prototype.getChecker=function(e,t){var n=this;return function(e,t){return e===n.value||t.fail(null,n._failMsg,-1)}},t}(a);e.TLiteral=u,e.array=function(e){return new d(o(e))};var d=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.ttype=t,n}return t.prototype.getChecker=function(e,t){var n=this.ttype.getChecker(e,t);return function(e,t){if(!Array.isArray(e))return t.fail(null,`is not an array`,0);for(var r=0;r<e.length;r++)if(!n(e[r],t))return t.fail(r,null,1);return!0}},t}(a);e.TArray=d,e.tuple=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new f(e.map(function(e){return o(e)}))};var f=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.ttypes=t,n}return t.prototype.getChecker=function(e,t){var n=this.ttypes.map(function(n){return n.getChecker(e,t)}),r=function(e,t){if(!Array.isArray(e))return t.fail(null,`is not an array`,0);for(var r=0;r<n.length;r++)if(!n[r](e[r],t))return t.fail(r,null,1);return!0};return t?function(e,t){return r(e,t)?e.length<=n.length||t.fail(n.length,`is extraneous`,2):!1}:r},t}(a);e.TTuple=f,e.union=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new p(e.map(function(e){return o(e)}))};var p=function(e){r(t,e);function t(t){var n=e.call(this)||this;n.ttypes=t;var r=t.map(function(e){return e instanceof l||e instanceof u?e.name:null}).filter(function(e){return e}),i=t.length-r.length;return r.length?(i>0&&r.push(i+` more`),n._failMsg=`is none of `+r.join(`, `)):n._failMsg=`is none of `+i+` types`,n}return t.prototype.getChecker=function(e,t){var n=this,r=this.ttypes.map(function(n){return n.getChecker(e,t)});return function(e,t){for(var i=t.unionResolver(),a=0;a<r.length;a++)if(r[a](e,i.createContext()))return!0;return t.resolveUnion(i),t.fail(null,n._failMsg,0)}},t}(a);e.TUnion=p,e.intersection=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new m(e.map(function(e){return o(e)}))};var m=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.ttypes=t,n}return t.prototype.getChecker=function(e,t){var n=/* @__PURE__ */ new Set,r=this.ttypes.map(function(r){return r.getChecker(e,t,n)});return function(e,t){return r.every(function(n){return n(e,t)})?!0:t.fail(null,null,0)}},t}(a);e.TIntersection=m,e.enumtype=function(e){return new h(e)};var h=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.members=t,n.validValues=/* @__PURE__ */ new Set,n._failMsg=`is not a valid enum value`,n.validValues=new Set(Object.keys(t).map(function(e){return t[e]})),n}return t.prototype.getChecker=function(e,t){var n=this;return function(e,t){return n.validValues.has(e)?!0:t.fail(null,n._failMsg,0)}},t}(a);e.TEnumType=h,e.enumlit=function(e,t){return new g(e,t)};var g=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.enumName=t,r.prop=n,r._failMsg=`is not `+t+`.`+n,r}return t.prototype.getChecker=function(e,t){var n=this,r=s(e,this.enumName);if(!(r instanceof h))throw Error(`Type `+this.enumName+` used in enumlit is not an enum type`);var i=r.members[this.prop];if(!r.members.hasOwnProperty(this.prop))throw Error(`Unknown value `+this.enumName+`.`+this.prop+` used in enumlit`);return function(e,t){return e===i||t.fail(null,n._failMsg,-1)}},t}(a);e.TEnumLiteral=g;function _(e){return Object.keys(e).map(function(t){return v(t,e[t])})}function v(e,t){return t instanceof b?new x(e,t.ttype,!0):new x(e,o(t),!1)}e.iface=function(e,t){return new y(e,_(t))};var y=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.bases=t,r.props=n,r.propSet=new Set(n.map(function(e){return e.name})),r}return t.prototype.getChecker=function(e,t,n){var r=this,a=this.bases.map(function(n){return s(e,n).getChecker(e,t)}),o=this.props.map(function(n){return n.ttype.getChecker(e,t)}),c=new i.NoopContext,l=this.props.map(function(e,t){return!e.isOpt&&!o[t](void 0,c)}),u=function(e,t){if(typeof e!=`object`||!e)return t.fail(null,`is not an object`,0);for(var n=0;n<a.length;n++)if(!a[n](e,t))return!1;for(var n=0;n<o.length;n++){var i=r.props[n].name,s=e[i];if(s===void 0){if(l[n])return t.fail(i,`is missing`,1)}else if(!o[n](s,t))return t.fail(i,null,1)}return!0};if(!t)return u;var d=this.propSet;return n&&(this.propSet.forEach(function(e){return n.add(e)}),d=n),function(e,t){if(!u(e,t))return!1;for(var n in e)if(!d.has(n))return t.fail(n,`is extraneous`,2);return!0}},t}(a);e.TIface=y,e.opt=function(e){return new b(o(e))};var b=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.ttype=t,n}return t.prototype.getChecker=function(e,t){var n=this.ttype.getChecker(e,t);return function(e,t){return e===void 0||n(e,t)}},t}(a);e.TOptional=b;var x=function(){function e(e,t,n){this.name=e,this.ttype=t,this.isOpt=n}return e}();e.TProp=x,e.func=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return new S(new w(t),o(e))};var S=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.paramList=t,r.result=n,r}return t.prototype.getChecker=function(e,t){return function(e,t){return typeof e==`function`||t.fail(null,`is not a function`,0)}},t}(a);e.TFunc=S,e.param=function(e,t,n){return new C(e,o(t),!!n)};var C=function(){function e(e,t,n){this.name=e,this.ttype=t,this.isOpt=n}return e}();e.TParam=C;var w=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.params=t,n}return t.prototype.getChecker=function(e,t){var n=this,r=this.params.map(function(n){return n.ttype.getChecker(e,t)}),a=new i.NoopContext,o=this.params.map(function(e,t){return!e.isOpt&&!r[t](void 0,a)}),s=function(e,t){if(!Array.isArray(e))return t.fail(null,`is not an array`,0);for(var i=0;i<r.length;i++){var a=n.params[i];if(e[i]===void 0){if(o[i])return t.fail(a.name,`is missing`,1)}else if(!r[i](e[i],t))return t.fail(a.name,null,1)}return!0};return t?function(e,t){return s(e,t)?e.length<=r.length||t.fail(r.length,`is extraneous`,2):!1}:s},t}(a);e.TParamList=w;var T=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.validator=t,r.message=n,r}return t.prototype.getChecker=function(e,t){var n=this;return function(e,t){return n.validator(e)?!0:t.fail(null,n.message,0)}},t}(a);e.BasicType=T,e.basicTypes={any:new T(function(e){return!0},`is invalid`),number:new T(function(e){return typeof e==`number`},`is not a number`),object:new T(function(e){return typeof e==`object`&&e},`is not an object`),boolean:new T(function(e){return typeof e==`boolean`},`is not a boolean`),string:new T(function(e){return typeof e==`string`},`is not a string`),symbol:new T(function(e){return typeof e==`symbol`},`is not a symbol`),void:new T(function(e){return e==null},`is not void`),undefined:new T(function(e){return e===void 0},`is not undefined`),null:new T(function(e){return e===null},`is not null`),never:new T(function(e){return!1},`is unexpected`),Date:new T(te(`[object Date]`),`is not a Date`),RegExp:new T(te(`[object RegExp]`),`is not a RegExp`)};var ee=Object.prototype.toString;function te(e){return function(t){return typeof t==`object`&&t&&ee.call(t)===e}}typeof Buffer<`u`&&(e.basicTypes.Buffer=new T(function(e){return Buffer.isBuffer(e)},`is not a Buffer`));for(var ne=function(t){e.basicTypes[t.name]=new T(function(e){return e instanceof t},`is not a `+t.name)},re=0,ie=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];re<ie.length;re++)ne(ie[re])})),yw=/* @__PURE__ */ o(((e,t,n)=>{var r=n&&n.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r};Object.defineProperty(e,"__esModule",{value:!0}),e.Checker=e.createCheckers=void 0;var i=vw(),a=_w(),o=vw();Object.defineProperty(e,"TArray",{enumerable:!0,get:function(){return o.TArray}}),Object.defineProperty(e,"TEnumType",{enumerable:!0,get:function(){return o.TEnumType}}),Object.defineProperty(e,"TEnumLiteral",{enumerable:!0,get:function(){return o.TEnumLiteral}}),Object.defineProperty(e,"TFunc",{enumerable:!0,get:function(){return o.TFunc}}),Object.defineProperty(e,"TIface",{enumerable:!0,get:function(){return o.TIface}}),Object.defineProperty(e,"TLiteral",{enumerable:!0,get:function(){return o.TLiteral}}),Object.defineProperty(e,"TName",{enumerable:!0,get:function(){return o.TName}}),Object.defineProperty(e,"TOptional",{enumerable:!0,get:function(){return o.TOptional}}),Object.defineProperty(e,"TParam",{enumerable:!0,get:function(){return o.TParam}}),Object.defineProperty(e,"TParamList",{enumerable:!0,get:function(){return o.TParamList}}),Object.defineProperty(e,"TProp",{enumerable:!0,get:function(){return o.TProp}}),Object.defineProperty(e,"TTuple",{enumerable:!0,get:function(){return o.TTuple}}),Object.defineProperty(e,"TType",{enumerable:!0,get:function(){return o.TType}}),Object.defineProperty(e,"TUnion",{enumerable:!0,get:function(){return o.TUnion}}),Object.defineProperty(e,"TIntersection",{enumerable:!0,get:function(){return o.TIntersection}}),Object.defineProperty(e,"array",{enumerable:!0,get:function(){return o.array}}),Object.defineProperty(e,"enumlit",{enumerable:!0,get:function(){return o.enumlit}}),Object.defineProperty(e,"enumtype",{enumerable:!0,get:function(){return o.enumtype}}),Object.defineProperty(e,"func",{enumerable:!0,get:function(){return o.func}}),Object.defineProperty(e,"iface",{enumerable:!0,get:function(){return o.iface}}),Object.defineProperty(e,"lit",{enumerable:!0,get:function(){return o.lit}}),Object.defineProperty(e,"name",{enumerable:!0,get:function(){return o.name}}),Object.defineProperty(e,"opt",{enumerable:!0,get:function(){return o.opt}}),Object.defineProperty(e,"param",{enumerable:!0,get:function(){return o.param}}),Object.defineProperty(e,"tuple",{enumerable:!0,get:function(){return o.tuple}}),Object.defineProperty(e,"union",{enumerable:!0,get:function(){return o.union}}),Object.defineProperty(e,"intersection",{enumerable:!0,get:function(){return o.intersection}}),Object.defineProperty(e,"BasicType",{enumerable:!0,get:function(){return o.BasicType}});var s=_w();Object.defineProperty(e,"VError",{enumerable:!0,get:function(){return s.VError}}),e.createCheckers=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=Object.assign.apply(Object,r([{},i.basicTypes],e)),a={},o=0,s=e;o<s.length;o++)for(var l=s[o],u=0,d=Object.keys(l);u<d.length;u++){var f=d[u];a[f]=new c(n,l[f])}return a};var c=function(){function e(e,t,n){if(n===void 0&&(n=`value`),this.suite=e,this.ttype=t,this._path=n,this.props=/* @__PURE__ */ new Map,t instanceof i.TIface)for(var r=0,a=t.props;r<a.length;r++){var o=a[r];this.props.set(o.name,o.ttype)}this.checkerPlain=this.ttype.getChecker(e,!1),this.checkerStrict=this.ttype.getChecker(e,!0)}return e.prototype.setReportedPath=function(e){this._path=e},e.prototype.check=function(e){return this._doCheck(this.checkerPlain,e)},e.prototype.test=function(e){return this.checkerPlain(e,new a.NoopContext)},e.prototype.validate=function(e){return this._doValidate(this.checkerPlain,e)},e.prototype.strictCheck=function(e){return this._doCheck(this.checkerStrict,e)},e.prototype.strictTest=function(e){return this.checkerStrict(e,new a.NoopContext)},e.prototype.strictValidate=function(e){return this._doValidate(this.checkerStrict,e)},e.prototype.getProp=function(t){var n=this.props.get(t);if(!n)throw Error(`Type has no property `+t);return new e(this.suite,n,this._path+`.`+t)},e.prototype.methodArgs=function(t){var n=this._getMethod(t);return new e(this.suite,n.paramList)},e.prototype.methodResult=function(t){var n=this._getMethod(t);return new e(this.suite,n.result)},e.prototype.getArgs=function(){if(!(this.ttype instanceof i.TFunc))throw Error(`getArgs() applied to non-function`);return new e(this.suite,this.ttype.paramList)},e.prototype.getResult=function(){if(!(this.ttype instanceof i.TFunc))throw Error(`getResult() applied to non-function`);return new e(this.suite,this.ttype.result)},e.prototype.getType=function(){return this.ttype},e.prototype._doCheck=function(e,t){if(!e(t,new a.NoopContext)){var n=new a.DetailContext;throw e(t,n),n.getError(this._path)}},e.prototype._doValidate=function(e,t){if(e(t,new a.NoopContext))return null;var n=new a.DetailContext;return e(t,n),n.getErrorDetail(this._path)},e.prototype._getMethod=function(e){var t=this.props.get(e);if(!t)throw Error(`Type has no property `+e);if(!(t instanceof i.TFunc))throw Error(`Property `+e+` is not a method`);return t},e}();e.Checker=c})),bw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}var n=t(yw());e.Transform=n.union(n.lit(`jsx`),n.lit(`typescript`),n.lit(`flow`),n.lit(`imports`),n.lit(`react-hot-loader`),n.lit(`jest`)),e.SourceMapOptions=n.iface([],{compiledFilename:`string`}),e.Options=n.iface([],{transforms:n.array(`Transform`),disableESTransforms:n.opt(`boolean`),jsxRuntime:n.opt(n.union(n.lit(`classic`),n.lit(`automatic`),n.lit(`preserve`))),production:n.opt(`boolean`),jsxImportSource:n.opt(`string`),jsxPragma:n.opt(`string`),jsxFragmentPragma:n.opt(`string`),keepUnusedImports:n.opt(`boolean`),preserveDynamicImport:n.opt(`boolean`),injectCreateRequireForImportRequire:n.opt(`boolean`),enableLegacyTypeScriptModuleInterop:n.opt(`boolean`),enableLegacyBabel5ModuleInterop:n.opt(`boolean`),sourceMapOptions:n.opt(`SourceMapOptions`),filePath:n.opt(`string`)}),e.default={Transform:e.Transform,SourceMapOptions:e.SourceMapOptions,Options:e.Options}})),xw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=yw(),r=t(bw());let{Options:i}=n.createCheckers.call(void 0,r.default);e.validateOptions=function(e){i.strictCheck(e)}})),Sw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Dw(),n=Cw(),r=ew(),i=GC(),a=G(),o=JC(),s=Ew(),c=YC();e.parseSpread=function(){r.next.call(void 0),s.parseMaybeAssign.call(void 0,!1)};function l(e){r.next.call(void 0),f(e)}e.parseRest=l;function u(e){s.parseIdentifier.call(void 0),d(e)}e.parseBindingIdentifier=u,e.parseImportedIdentifier=function(){s.parseIdentifier.call(void 0),o.state.tokens[o.state.tokens.length-1].identifierRole=r.IdentifierRole.ImportDeclaration};function d(e){let t;t=o.state.scopeDepth===0?r.IdentifierRole.TopLevelDeclaration:e?r.IdentifierRole.BlockScopedDeclaration:r.IdentifierRole.FunctionScopedDeclaration,o.state.tokens[o.state.tokens.length-1].identifierRole=t}e.markPriorBindingIdentifier=d;function f(e){switch(o.state.type){case a.TokenType._this:{let e=r.pushTypeContext.call(void 0,0);r.next.call(void 0),r.popTypeContext.call(void 0,e);return}case a.TokenType._yield:case a.TokenType.name:o.state.type=a.TokenType.name,u(e);return;case a.TokenType.bracketL:r.next.call(void 0),p(a.TokenType.bracketR,e,!0);return;case a.TokenType.braceL:s.parseObj.call(void 0,!0,e);return;default:c.unexpected.call(void 0)}}e.parseBindingAtom=f;function p(e,t,n=!1,i=!1,s=0){let u=!0,d=!1,f=o.state.tokens.length;for(;!r.eat.call(void 0,e)&&!o.state.error;)if(u?u=!1:(c.expect.call(void 0,a.TokenType.comma),o.state.tokens[o.state.tokens.length-1].contextId=s,!d&&o.state.tokens[f].isType&&(o.state.tokens[o.state.tokens.length-1].isType=!0,d=!0)),!(n&&r.match.call(void 0,a.TokenType.comma))){if(r.eat.call(void 0,e))break;if(r.match.call(void 0,a.TokenType.ellipsis)){l(t),h(),r.eat.call(void 0,a.TokenType.comma),c.expect.call(void 0,e);break}m(i,t)}}e.parseBindingList=p;function m(e,t){e&&n.tsParseModifiers.call(void 0,[i.ContextualKeyword._public,i.ContextualKeyword._protected,i.ContextualKeyword._private,i.ContextualKeyword._readonly,i.ContextualKeyword._override]),g(t),h(),g(t,!0)}function h(){o.isFlowEnabled?t.flowParseAssignableListItemTypes.call(void 0):o.isTypeScriptEnabled&&n.tsParseAssignableListItemTypes.call(void 0)}function g(e,t=!1){if(t||f(e),!r.eat.call(void 0,a.TokenType.eq))return;let n=o.state.tokens.length-1;s.parseMaybeAssign.call(void 0),o.state.tokens[n].rhsEndIndex=o.state.tokens.length}e.parseMaybeDefault=g})),Cw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ew(),n=GC(),r=G(),i=JC(),a=Ew(),o=Sw(),s=Ow(),c=YC(),l=ww();function u(){return t.match.call(void 0,r.TokenType.name)}function d(){return t.match.call(void 0,r.TokenType.name)||!!(i.state.type&r.TokenType.IS_KEYWORD)||t.match.call(void 0,r.TokenType.string)||t.match.call(void 0,r.TokenType.num)||t.match.call(void 0,r.TokenType.bigint)||t.match.call(void 0,r.TokenType.decimal)}function f(){let e=i.state.snapshot();return t.next.call(void 0),(t.match.call(void 0,r.TokenType.bracketL)||t.match.call(void 0,r.TokenType.braceL)||t.match.call(void 0,r.TokenType.star)||t.match.call(void 0,r.TokenType.ellipsis)||t.match.call(void 0,r.TokenType.hash)||d())&&!c.hasPrecedingLineBreak.call(void 0)?!0:(i.state.restoreFromSnapshot(e),!1)}function p(e){for(;m(e)!==null;);}e.tsParseModifiers=p;function m(e){if(!t.match.call(void 0,r.TokenType.name))return null;let a=i.state.contextualKeyword;if(e.indexOf(a)!==-1&&f()){switch(a){case n.ContextualKeyword._readonly:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._readonly;break;case n.ContextualKeyword._abstract:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._abstract;break;case n.ContextualKeyword._static:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._static;break;case n.ContextualKeyword._public:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._public;break;case n.ContextualKeyword._private:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._private;break;case n.ContextualKeyword._protected:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._protected;break;case n.ContextualKeyword._override:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._override;break;case n.ContextualKeyword._declare:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._declare}return a}return null}e.tsParseModifier=m;function h(){for(a.parseIdentifier.call(void 0);t.eat.call(void 0,r.TokenType.dot);)a.parseIdentifier.call(void 0)}function g(){h(),!c.hasPrecedingLineBreak.call(void 0)&&t.match.call(void 0,r.TokenType.lessThan)&&Qe()}function _(){t.next.call(void 0),Ae()}function v(){t.next.call(void 0)}function y(){c.expect.call(void 0,r.TokenType._typeof),t.match.call(void 0,r.TokenType._import)?b():h(),!c.hasPrecedingLineBreak.call(void 0)&&t.match.call(void 0,r.TokenType.lessThan)&&Qe()}function b(){c.expect.call(void 0,r.TokenType._import),c.expect.call(void 0,r.TokenType.parenL),c.expect.call(void 0,r.TokenType.string),c.expect.call(void 0,r.TokenType.parenR),t.eat.call(void 0,r.TokenType.dot)&&h(),t.match.call(void 0,r.TokenType.lessThan)&&Qe()}function x(){t.eat.call(void 0,r.TokenType._const);let e=t.eat.call(void 0,r.TokenType._in),o=c.eatContextual.call(void 0,n.ContextualKeyword._out);t.eat.call(void 0,r.TokenType._const),(e||o)&&!t.match.call(void 0,r.TokenType.name)?i.state.tokens[i.state.tokens.length-1].type=r.TokenType.name:a.parseIdentifier.call(void 0),t.eat.call(void 0,r.TokenType._extends)&&k(),t.eat.call(void 0,r.TokenType.eq)&&k()}function S(){t.match.call(void 0,r.TokenType.lessThan)&&C()}e.tsTryParseTypeParameters=S;function C(){let e=t.pushTypeContext.call(void 0,0);for(t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.typeParameterStart)?t.next.call(void 0):c.unexpected.call(void 0);!t.eat.call(void 0,r.TokenType.greaterThan)&&!i.state.error;)x(),t.eat.call(void 0,r.TokenType.comma);t.popTypeContext.call(void 0,e)}function w(e){let n=e===r.TokenType.arrow;S(),c.expect.call(void 0,r.TokenType.parenL),i.state.scopeDepth++,T(!1),i.state.scopeDepth--,(n||t.match.call(void 0,e))&&Te(e)}function T(e){o.parseBindingList.call(void 0,r.TokenType.parenR,e)}function ee(){t.eat.call(void 0,r.TokenType.comma)||c.semicolon.call(void 0)}function te(){w(r.TokenType.colon),ee()}function ne(){let e=i.state.snapshot();t.next.call(void 0);let n=t.eat.call(void 0,r.TokenType.name)&&t.match.call(void 0,r.TokenType.colon);return i.state.restoreFromSnapshot(e),n}function re(){if(!(t.match.call(void 0,r.TokenType.bracketL)&&ne()))return!1;let e=t.pushTypeContext.call(void 0,0);return c.expect.call(void 0,r.TokenType.bracketL),a.parseIdentifier.call(void 0),Ae(),c.expect.call(void 0,r.TokenType.bracketR),De(),ee(),t.popTypeContext.call(void 0,e),!0}function ie(e){t.eat.call(void 0,r.TokenType.question),!e&&(t.match.call(void 0,r.TokenType.parenL)||t.match.call(void 0,r.TokenType.lessThan))?(w(r.TokenType.colon),ee()):(De(),ee())}function E(){if(t.match.call(void 0,r.TokenType.parenL)||t.match.call(void 0,r.TokenType.lessThan)){te();return}if(t.match.call(void 0,r.TokenType._new)){t.next.call(void 0),t.match.call(void 0,r.TokenType.parenL)||t.match.call(void 0,r.TokenType.lessThan)?te():ie(!1);return}let e=!!m([n.ContextualKeyword._readonly]);re()||((c.isContextual.call(void 0,n.ContextualKeyword._get)||c.isContextual.call(void 0,n.ContextualKeyword._set))&&f(),a.parsePropertyName.call(void 0,-1),ie(e))}function ae(){oe()}function oe(){for(c.expect.call(void 0,r.TokenType.braceL);!t.eat.call(void 0,r.TokenType.braceR)&&!i.state.error;)E()}function se(){let e=i.state.snapshot(),t=ce();return i.state.restoreFromSnapshot(e),t}function ce(){return t.next.call(void 0),t.eat.call(void 0,r.TokenType.plus)||t.eat.call(void 0,r.TokenType.minus)?c.isContextual.call(void 0,n.ContextualKeyword._readonly):(c.isContextual.call(void 0,n.ContextualKeyword._readonly)&&t.next.call(void 0),!t.match.call(void 0,r.TokenType.bracketL)||(t.next.call(void 0),!u())?!1:(t.next.call(void 0),t.match.call(void 0,r.TokenType._in)))}function D(){a.parseIdentifier.call(void 0),c.expect.call(void 0,r.TokenType._in),k()}function le(){c.expect.call(void 0,r.TokenType.braceL),t.match.call(void 0,r.TokenType.plus)||t.match.call(void 0,r.TokenType.minus)?(t.next.call(void 0),c.expectContextual.call(void 0,n.ContextualKeyword._readonly)):c.eatContextual.call(void 0,n.ContextualKeyword._readonly),c.expect.call(void 0,r.TokenType.bracketL),D(),c.eatContextual.call(void 0,n.ContextualKeyword._as)&&k(),c.expect.call(void 0,r.TokenType.bracketR),t.match.call(void 0,r.TokenType.plus)||t.match.call(void 0,r.TokenType.minus)?(t.next.call(void 0),c.expect.call(void 0,r.TokenType.question)):t.eat.call(void 0,r.TokenType.question),Oe(),c.semicolon.call(void 0),c.expect.call(void 0,r.TokenType.braceR)}function ue(){for(c.expect.call(void 0,r.TokenType.bracketL);!t.eat.call(void 0,r.TokenType.bracketR)&&!i.state.error;)de(),t.eat.call(void 0,r.TokenType.comma)}function de(){t.eat.call(void 0,r.TokenType.ellipsis)?k():(k(),t.eat.call(void 0,r.TokenType.question)),t.eat.call(void 0,r.TokenType.colon)&&k()}function fe(){c.expect.call(void 0,r.TokenType.parenL),k(),c.expect.call(void 0,r.TokenType.parenR)}function pe(){for(t.nextTemplateToken.call(void 0),t.nextTemplateToken.call(void 0);!t.match.call(void 0,r.TokenType.backQuote)&&!i.state.error;)c.expect.call(void 0,r.TokenType.dollarBraceL),k(),t.nextTemplateToken.call(void 0),t.nextTemplateToken.call(void 0);t.next.call(void 0)}var O;(function(e){e[e.TSFunctionType=0]=`TSFunctionType`,e[e.TSConstructorType=1]=`TSConstructorType`,e[e.TSAbstractConstructorType=2]=`TSAbstractConstructorType`})(O||={});function me(e){e===O.TSAbstractConstructorType&&c.expectContextual.call(void 0,n.ContextualKeyword._abstract),(e===O.TSConstructorType||e===O.TSAbstractConstructorType)&&c.expect.call(void 0,r.TokenType._new);let t=i.state.inDisallowConditionalTypesContext;i.state.inDisallowConditionalTypesContext=!1,w(r.TokenType.arrow),i.state.inDisallowConditionalTypesContext=t}function he(){switch(i.state.type){case r.TokenType.name:g();return;case r.TokenType._void:case r.TokenType._null:t.next.call(void 0);return;case r.TokenType.string:case r.TokenType.num:case r.TokenType.bigint:case r.TokenType.decimal:case r.TokenType._true:case r.TokenType._false:a.parseLiteral.call(void 0);return;case r.TokenType.minus:t.next.call(void 0),a.parseLiteral.call(void 0);return;case r.TokenType._this:v(),c.isContextual.call(void 0,n.ContextualKeyword._is)&&!c.hasPrecedingLineBreak.call(void 0)&&_();return;case r.TokenType._typeof:y();return;case r.TokenType._import:b();return;case r.TokenType.braceL:se()?le():ae();return;case r.TokenType.bracketL:ue();return;case r.TokenType.parenL:fe();return;case r.TokenType.backQuote:pe();return;default:if(i.state.type&r.TokenType.IS_KEYWORD){t.next.call(void 0),i.state.tokens[i.state.tokens.length-1].type=r.TokenType.name;return}}c.unexpected.call(void 0)}function ge(){for(he();!c.hasPrecedingLineBreak.call(void 0)&&t.eat.call(void 0,r.TokenType.bracketL);)t.eat.call(void 0,r.TokenType.bracketR)||(k(),c.expect.call(void 0,r.TokenType.bracketR))}function _e(){if(c.expectContextual.call(void 0,n.ContextualKeyword._infer),a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType._extends)){let e=i.state.snapshot();c.expect.call(void 0,r.TokenType._extends);let n=i.state.inDisallowConditionalTypesContext;i.state.inDisallowConditionalTypesContext=!0,k(),i.state.inDisallowConditionalTypesContext=n,(i.state.error||!i.state.inDisallowConditionalTypesContext&&t.match.call(void 0,r.TokenType.question))&&i.state.restoreFromSnapshot(e)}}function ve(){if(c.isContextual.call(void 0,n.ContextualKeyword._keyof)||c.isContextual.call(void 0,n.ContextualKeyword._unique)||c.isContextual.call(void 0,n.ContextualKeyword._readonly))t.next.call(void 0),ve();else if(c.isContextual.call(void 0,n.ContextualKeyword._infer))_e();else{let e=i.state.inDisallowConditionalTypesContext;i.state.inDisallowConditionalTypesContext=!1,ge(),i.state.inDisallowConditionalTypesContext=e}}function ye(){if(t.eat.call(void 0,r.TokenType.bitwiseAND),ve(),t.match.call(void 0,r.TokenType.bitwiseAND))for(;t.eat.call(void 0,r.TokenType.bitwiseAND);)ve()}function be(){if(t.eat.call(void 0,r.TokenType.bitwiseOR),ye(),t.match.call(void 0,r.TokenType.bitwiseOR))for(;t.eat.call(void 0,r.TokenType.bitwiseOR);)ye()}function xe(){return t.match.call(void 0,r.TokenType.lessThan)?!0:t.match.call(void 0,r.TokenType.parenL)&&Ce()}function Se(){if(t.match.call(void 0,r.TokenType.name)||t.match.call(void 0,r.TokenType._this))return t.next.call(void 0),!0;if(t.match.call(void 0,r.TokenType.braceL)||t.match.call(void 0,r.TokenType.bracketL)){let e=1;for(t.next.call(void 0);e>0&&!i.state.error;)t.match.call(void 0,r.TokenType.braceL)||t.match.call(void 0,r.TokenType.bracketL)?e++:(t.match.call(void 0,r.TokenType.braceR)||t.match.call(void 0,r.TokenType.bracketR))&&e--,t.next.call(void 0);return!0}return!1}function Ce(){let e=i.state.snapshot(),t=we();return i.state.restoreFromSnapshot(e),t}function we(){return t.next.call(void 0),!!(t.match.call(void 0,r.TokenType.parenR)||t.match.call(void 0,r.TokenType.ellipsis)||Se()&&(t.match.call(void 0,r.TokenType.colon)||t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.question)||t.match.call(void 0,r.TokenType.eq)||t.match.call(void 0,r.TokenType.parenR)&&(t.next.call(void 0),t.match.call(void 0,r.TokenType.arrow))))}function Te(e){let n=t.pushTypeContext.call(void 0,0);c.expect.call(void 0,e),ke()||k(),t.popTypeContext.call(void 0,n)}function Ee(){t.match.call(void 0,r.TokenType.colon)&&Te(r.TokenType.colon)}function De(){t.match.call(void 0,r.TokenType.colon)&&Ae()}e.tsTryParseTypeAnnotation=De;function Oe(){t.eat.call(void 0,r.TokenType.colon)&&k()}function ke(){let e=i.state.snapshot();return c.isContextual.call(void 0,n.ContextualKeyword._asserts)?(t.next.call(void 0),c.eatContextual.call(void 0,n.ContextualKeyword._is)?(k(),!0):u()||t.match.call(void 0,r.TokenType._this)?(t.next.call(void 0),c.eatContextual.call(void 0,n.ContextualKeyword._is)&&k(),!0):(i.state.restoreFromSnapshot(e),!1)):u()||t.match.call(void 0,r.TokenType._this)?(t.next.call(void 0),c.isContextual.call(void 0,n.ContextualKeyword._is)&&!c.hasPrecedingLineBreak.call(void 0)?(t.next.call(void 0),k(),!0):(i.state.restoreFromSnapshot(e),!1)):!1}function Ae(){let e=t.pushTypeContext.call(void 0,0);c.expect.call(void 0,r.TokenType.colon),k(),t.popTypeContext.call(void 0,e)}e.tsParseTypeAnnotation=Ae;function k(){if(Me(),i.state.inDisallowConditionalTypesContext||c.hasPrecedingLineBreak.call(void 0)||!t.eat.call(void 0,r.TokenType._extends))return;let e=i.state.inDisallowConditionalTypesContext;i.state.inDisallowConditionalTypesContext=!0,Me(),i.state.inDisallowConditionalTypesContext=e,c.expect.call(void 0,r.TokenType.question),k(),c.expect.call(void 0,r.TokenType.colon),k()}e.tsParseType=k;function je(){return c.isContextual.call(void 0,n.ContextualKeyword._abstract)&&t.lookaheadType.call(void 0)===r.TokenType._new}function Me(){xe()?me(O.TSFunctionType):t.match.call(void 0,r.TokenType._new)?me(O.TSConstructorType):je()?me(O.TSAbstractConstructorType):be()}e.tsParseNonConditionalType=Me,e.tsParseTypeAssertion=function(){let e=t.pushTypeContext.call(void 0,1);k(),c.expect.call(void 0,r.TokenType.greaterThan),t.popTypeContext.call(void 0,e),a.parseMaybeUnary.call(void 0)},e.tsTryParseJSXTypeArgument=function(){if(t.eat.call(void 0,r.TokenType.jsxTagStart)){i.state.tokens[i.state.tokens.length-1].type=r.TokenType.typeParameterStart;let e=t.pushTypeContext.call(void 0,1);for(;!t.match.call(void 0,r.TokenType.greaterThan)&&!i.state.error;)k(),t.eat.call(void 0,r.TokenType.comma);l.nextJSXTagToken.call(void 0),t.popTypeContext.call(void 0,e)}};function Ne(){for(;!t.match.call(void 0,r.TokenType.braceL)&&!i.state.error;)Pe(),t.eat.call(void 0,r.TokenType.comma)}function Pe(){h(),t.match.call(void 0,r.TokenType.lessThan)&&Qe()}function Fe(){o.parseBindingIdentifier.call(void 0,!1),S(),t.eat.call(void 0,r.TokenType._extends)&&Ne(),oe()}function Ie(){o.parseBindingIdentifier.call(void 0,!1),S(),c.expect.call(void 0,r.TokenType.eq),k(),c.semicolon.call(void 0)}function Le(){if(t.match.call(void 0,r.TokenType.string)?a.parseLiteral.call(void 0):a.parseIdentifier.call(void 0),t.eat.call(void 0,r.TokenType.eq)){let e=i.state.tokens.length-1;a.parseMaybeAssign.call(void 0),i.state.tokens[e].rhsEndIndex=i.state.tokens.length}}function Re(){for(o.parseBindingIdentifier.call(void 0,!1),c.expect.call(void 0,r.TokenType.braceL);!t.eat.call(void 0,r.TokenType.braceR)&&!i.state.error;)Le(),t.eat.call(void 0,r.TokenType.comma)}function ze(){c.expect.call(void 0,r.TokenType.braceL),s.parseBlockBody.call(void 0,r.TokenType.braceR)}function Be(){o.parseBindingIdentifier.call(void 0,!1),t.eat.call(void 0,r.TokenType.dot)?Be():ze()}function Ve(){c.isContextual.call(void 0,n.ContextualKeyword._global)?a.parseIdentifier.call(void 0):t.match.call(void 0,r.TokenType.string)?a.parseExprAtom.call(void 0):c.unexpected.call(void 0),t.match.call(void 0,r.TokenType.braceL)?ze():c.semicolon.call(void 0)}function He(){o.parseImportedIdentifier.call(void 0),c.expect.call(void 0,r.TokenType.eq),A(),c.semicolon.call(void 0)}e.tsParseImportEqualsDeclaration=He;function Ue(){return c.isContextual.call(void 0,n.ContextualKeyword._require)&&t.lookaheadType.call(void 0)===r.TokenType.parenL}function A(){Ue()?We():h()}function We(){c.expectContextual.call(void 0,n.ContextualKeyword._require),c.expect.call(void 0,r.TokenType.parenL),t.match.call(void 0,r.TokenType.string)||c.unexpected.call(void 0),a.parseLiteral.call(void 0),c.expect.call(void 0,r.TokenType.parenR)}function Ge(){if(c.isLineTerminator.call(void 0))return!1;switch(i.state.type){case r.TokenType._function:{let e=t.pushTypeContext.call(void 0,1);t.next.call(void 0);let n=i.state.start;return s.parseFunction.call(void 0,n,!0),t.popTypeContext.call(void 0,e),!0}case r.TokenType._class:{let e=t.pushTypeContext.call(void 0,1);return s.parseClass.call(void 0,!0,!1),t.popTypeContext.call(void 0,e),!0}case r.TokenType._const:if(t.match.call(void 0,r.TokenType._const)&&c.isLookaheadContextual.call(void 0,n.ContextualKeyword._enum)){let e=t.pushTypeContext.call(void 0,1);return c.expect.call(void 0,r.TokenType._const),c.expectContextual.call(void 0,n.ContextualKeyword._enum),i.state.tokens[i.state.tokens.length-1].type=r.TokenType._enum,Re(),t.popTypeContext.call(void 0,e),!0}case r.TokenType._var:case r.TokenType._let:{let e=t.pushTypeContext.call(void 0,1);return s.parseVarStatement.call(void 0,i.state.type!==r.TokenType._var),t.popTypeContext.call(void 0,e),!0}case r.TokenType.name:{let e=t.pushTypeContext.call(void 0,1),r=i.state.contextualKeyword,a=!1;return r===n.ContextualKeyword._global?(Ve(),a=!0):a=Je(r,!0),t.popTypeContext.call(void 0,e),a}default:return!1}}function Ke(){return Je(i.state.contextualKeyword,!0)}function qe(e){switch(e){case n.ContextualKeyword._declare:{let e=i.state.tokens.length-1;if(Ge())return i.state.tokens[e].type=r.TokenType._declare,!0;break}case n.ContextualKeyword._global:if(t.match.call(void 0,r.TokenType.braceL))return ze(),!0;break;default:return Je(e,!1)}return!1}function Je(e,a){switch(e){case n.ContextualKeyword._abstract:if(Ye(a)&&t.match.call(void 0,r.TokenType._class))return i.state.tokens[i.state.tokens.length-1].type=r.TokenType._abstract,s.parseClass.call(void 0,!0,!1),!0;break;case n.ContextualKeyword._enum:if(Ye(a)&&t.match.call(void 0,r.TokenType.name))return i.state.tokens[i.state.tokens.length-1].type=r.TokenType._enum,Re(),!0;break;case n.ContextualKeyword._interface:if(Ye(a)&&t.match.call(void 0,r.TokenType.name)){let e=t.pushTypeContext.call(void 0,a?2:1);return Fe(),t.popTypeContext.call(void 0,e),!0}break;case n.ContextualKeyword._module:if(Ye(a)){if(t.match.call(void 0,r.TokenType.string)){let e=t.pushTypeContext.call(void 0,a?2:1);return Ve(),t.popTypeContext.call(void 0,e),!0}if(t.match.call(void 0,r.TokenType.name)){let e=t.pushTypeContext.call(void 0,a?2:1);return Be(),t.popTypeContext.call(void 0,e),!0}}break;case n.ContextualKeyword._namespace:if(Ye(a)&&t.match.call(void 0,r.TokenType.name)){let e=t.pushTypeContext.call(void 0,a?2:1);return Be(),t.popTypeContext.call(void 0,e),!0}break;case n.ContextualKeyword._type:if(Ye(a)&&t.match.call(void 0,r.TokenType.name)){let e=t.pushTypeContext.call(void 0,a?2:1);return Ie(),t.popTypeContext.call(void 0,e),!0}}return!1}function Ye(e){return e?(t.next.call(void 0),!0):!c.isLineTerminator.call(void 0)}function Xe(){let e=i.state.snapshot();return C(),s.parseFunctionParams.call(void 0),Ee(),c.expect.call(void 0,r.TokenType.arrow),i.state.error?(i.state.restoreFromSnapshot(e),!1):(a.parseFunctionBody.call(void 0,!0),!0)}function Ze(){i.state.type===r.TokenType.bitShiftL&&(--i.state.pos,t.finishToken.call(void 0,r.TokenType.lessThan)),Qe()}function Qe(){let e=t.pushTypeContext.call(void 0,0);for(c.expect.call(void 0,r.TokenType.lessThan);!t.match.call(void 0,r.TokenType.greaterThan)&&!i.state.error;)k(),t.eat.call(void 0,r.TokenType.comma);e?(c.expect.call(void 0,r.TokenType.greaterThan),t.popTypeContext.call(void 0,e)):(t.popTypeContext.call(void 0,e),t.rescan_gt.call(void 0),c.expect.call(void 0,r.TokenType.greaterThan),i.state.tokens[i.state.tokens.length-1].isType=!0)}e.tsIsDeclarationStart=function(){if(t.match.call(void 0,r.TokenType.name))switch(i.state.contextualKeyword){case n.ContextualKeyword._abstract:case n.ContextualKeyword._declare:case n.ContextualKeyword._enum:case n.ContextualKeyword._interface:case n.ContextualKeyword._module:case n.ContextualKeyword._namespace:case n.ContextualKeyword._type:return!0}return!1},e.tsParseFunctionBodyAndFinish=function(e,n){if(t.match.call(void 0,r.TokenType.colon)&&Te(r.TokenType.colon),!t.match.call(void 0,r.TokenType.braceL)&&c.isLineTerminator.call(void 0)){let t=i.state.tokens.length-1;for(;t>=0&&(i.state.tokens[t].start>=e||i.state.tokens[t].type===r.TokenType._default||i.state.tokens[t].type===r.TokenType._export);)i.state.tokens[t].isType=!0,t--}else a.parseFunctionBody.call(void 0,!1,n)},e.tsParseSubscript=function(e,n,o){if(!c.hasPrecedingLineBreak.call(void 0)&&t.eat.call(void 0,r.TokenType.bang))i.state.tokens[i.state.tokens.length-1].type=r.TokenType.nonNullAssertion;else{if(t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.bitShiftL)){let o=i.state.snapshot();if(!n&&a.atPossibleAsync.call(void 0)&&Xe())return;if(Ze(),!n&&t.eat.call(void 0,r.TokenType.parenL)?(i.state.tokens[i.state.tokens.length-1].subscriptStartIndex=e,a.parseCallExpressionArguments.call(void 0)):t.match.call(void 0,r.TokenType.backQuote)?a.parseTemplate.call(void 0):(i.state.type===r.TokenType.greaterThan||i.state.type!==r.TokenType.parenL&&i.state.type&r.TokenType.IS_EXPRESSION_START&&!c.hasPrecedingLineBreak.call(void 0))&&c.unexpected.call(void 0),i.state.error)i.state.restoreFromSnapshot(o);else return}else!n&&t.match.call(void 0,r.TokenType.questionDot)&&t.lookaheadType.call(void 0)===r.TokenType.lessThan&&(t.next.call(void 0),i.state.tokens[e].isOptionalChainStart=!0,i.state.tokens[i.state.tokens.length-1].subscriptStartIndex=e,Qe(),c.expect.call(void 0,r.TokenType.parenL),a.parseCallExpressionArguments.call(void 0));a.baseParseSubscript.call(void 0,e,n,o)}},e.tsTryParseExport=function(){if(t.eat.call(void 0,r.TokenType._import))return c.isContextual.call(void 0,n.ContextualKeyword._type)&&t.lookaheadType.call(void 0)!==r.TokenType.eq&&c.expectContextual.call(void 0,n.ContextualKeyword._type),He(),!0;if(t.eat.call(void 0,r.TokenType.eq))return a.parseExpression.call(void 0),c.semicolon.call(void 0),!0;if(c.eatContextual.call(void 0,n.ContextualKeyword._as))return c.expectContextual.call(void 0,n.ContextualKeyword._namespace),a.parseIdentifier.call(void 0),c.semicolon.call(void 0),!0;if(c.isContextual.call(void 0,n.ContextualKeyword._type)){let e=t.lookaheadType.call(void 0);(e===r.TokenType.braceL||e===r.TokenType.star)&&t.next.call(void 0)}return!1},e.tsParseImportSpecifier=function(){a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ImportDeclaration:(a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?(i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ImportDeclaration,i.state.tokens[i.state.tokens.length-2].isType=!0,i.state.tokens[i.state.tokens.length-1].isType=!0):(a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?(i.state.tokens[i.state.tokens.length-3].identifierRole=t.IdentifierRole.ImportAccess,i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ImportDeclaration):(a.parseIdentifier.call(void 0),i.state.tokens[i.state.tokens.length-3].identifierRole=t.IdentifierRole.ImportAccess,i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ImportDeclaration,i.state.tokens[i.state.tokens.length-4].isType=!0,i.state.tokens[i.state.tokens.length-3].isType=!0,i.state.tokens[i.state.tokens.length-2].isType=!0,i.state.tokens[i.state.tokens.length-1].isType=!0)))},e.tsParseExportSpecifier=function(){a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ExportAccess:(a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?(i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ExportAccess,i.state.tokens[i.state.tokens.length-2].isType=!0,i.state.tokens[i.state.tokens.length-1].isType=!0):(a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?i.state.tokens[i.state.tokens.length-3].identifierRole=t.IdentifierRole.ExportAccess:(a.parseIdentifier.call(void 0),i.state.tokens[i.state.tokens.length-3].identifierRole=t.IdentifierRole.ExportAccess,i.state.tokens[i.state.tokens.length-4].isType=!0,i.state.tokens[i.state.tokens.length-3].isType=!0,i.state.tokens[i.state.tokens.length-2].isType=!0,i.state.tokens[i.state.tokens.length-1].isType=!0)))},e.tsTryParseExportDefaultExpression=function(){if(c.isContextual.call(void 0,n.ContextualKeyword._abstract)&&t.lookaheadType.call(void 0)===r.TokenType._class)return i.state.type=r.TokenType._abstract,t.next.call(void 0),s.parseClass.call(void 0,!0,!0),!0;if(c.isContextual.call(void 0,n.ContextualKeyword._interface)){let e=t.pushTypeContext.call(void 0,2);return Je(n.ContextualKeyword._interface,!0),t.popTypeContext.call(void 0,e),!0}return!1},e.tsTryParseStatementContent=function(){if(i.state.type===r.TokenType._const){let e=t.lookaheadTypeAndKeyword.call(void 0);if(e.type===r.TokenType.name&&e.contextualKeyword===n.ContextualKeyword._enum)return c.expect.call(void 0,r.TokenType._const),c.expectContextual.call(void 0,n.ContextualKeyword._enum),i.state.tokens[i.state.tokens.length-1].type=r.TokenType._enum,Re(),!0}return!1},e.tsTryParseClassMemberWithIsStatic=function(e){let t=i.state.tokens.length;p([n.ContextualKeyword._abstract,n.ContextualKeyword._readonly,n.ContextualKeyword._declare,n.ContextualKeyword._static,n.ContextualKeyword._override]);let r=i.state.tokens.length;if(re()){let n=e?t-1:t;for(let e=n;e<r;e++)i.state.tokens[e].isType=!0;return!0}return!1},e.tsParseIdentifierStatement=function(e){qe(e)||c.semicolon.call(void 0)},e.tsParseExportDeclaration=function(){let e=c.eatContextual.call(void 0,n.ContextualKeyword._declare);e&&(i.state.tokens[i.state.tokens.length-1].type=r.TokenType._declare);let a=!1;if(t.match.call(void 0,r.TokenType.name)){if(e){let e=t.pushTypeContext.call(void 0,2);a=Ke(),t.popTypeContext.call(void 0,e)}else a=Ke()}if(!a){if(e){let e=t.pushTypeContext.call(void 0,2);s.parseStatement.call(void 0,!0),t.popTypeContext.call(void 0,e)}else s.parseStatement.call(void 0,!0)}},e.tsAfterParseClassSuper=function(e){if(e&&(t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.bitShiftL))&&Ze(),c.eatContextual.call(void 0,n.ContextualKeyword._implements)){i.state.tokens[i.state.tokens.length-1].type=r.TokenType._implements;let e=t.pushTypeContext.call(void 0,1);Ne(),t.popTypeContext.call(void 0,e)}},e.tsStartParseObjPropValue=function(){S()},e.tsStartParseFunctionParams=function(){S()},e.tsAfterParseVarHead=function(){let e=t.pushTypeContext.call(void 0,0);c.hasPrecedingLineBreak.call(void 0)||t.eat.call(void 0,r.TokenType.bang),De(),t.popTypeContext.call(void 0,e)},e.tsStartParseAsyncArrowFromCallExpression=function(){t.match.call(void 0,r.TokenType.colon)&&Ae()},e.tsParseMaybeAssign=function(e,t){return i.isJSXEnabled?$e(e,t):et(e,t)};function $e(e,n){if(!t.match.call(void 0,r.TokenType.lessThan))return a.baseParseMaybeAssign.call(void 0,e,n);let o=i.state.snapshot(),s=a.baseParseMaybeAssign.call(void 0,e,n);if(i.state.error)i.state.restoreFromSnapshot(o);else return s;return i.state.type=r.TokenType.typeParameterStart,C(),s=a.baseParseMaybeAssign.call(void 0,e,n),s||c.unexpected.call(void 0),s}e.tsParseMaybeAssignWithJSX=$e;function et(e,n){if(!t.match.call(void 0,r.TokenType.lessThan))return a.baseParseMaybeAssign.call(void 0,e,n);let o=i.state.snapshot();C();let s=a.baseParseMaybeAssign.call(void 0,e,n);if(s||c.unexpected.call(void 0),i.state.error)i.state.restoreFromSnapshot(o);else return s;return a.baseParseMaybeAssign.call(void 0,e,n)}e.tsParseMaybeAssignWithoutJSX=et,e.tsParseArrow=function(){if(t.match.call(void 0,r.TokenType.colon)){let e=i.state.snapshot();Te(r.TokenType.colon),c.canInsertSemicolon.call(void 0)&&c.unexpected.call(void 0),t.match.call(void 0,r.TokenType.arrow)||c.unexpected.call(void 0),i.state.error&&i.state.restoreFromSnapshot(e)}return t.eat.call(void 0,r.TokenType.arrow)},e.tsParseAssignableListItemTypes=function(){let e=t.pushTypeContext.call(void 0,0);t.eat.call(void 0,r.TokenType.question),De(),t.popTypeContext.call(void 0,e)},e.tsParseMaybeDecoratorArguments=function(){(t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.bitShiftL))&&Ze(),s.baseParseMaybeDecoratorArguments.call(void 0)}})),ww=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ew(),n=G(),r=JC(),i=Ew(),a=YC(),o=qC(),s=ZC(),c=Cw();function l(){let e=!1,i=!1;for(;;){if(r.state.pos>=r.input.length){a.unexpected.call(void 0,`Unterminated JSX contents`);return}let s=r.input.charCodeAt(r.state.pos);if(s===o.charCodes.lessThan||s===o.charCodes.leftCurlyBrace){if(r.state.pos===r.state.start){if(s===o.charCodes.lessThan){r.state.pos++,t.finishToken.call(void 0,n.TokenType.jsxTagStart);return}t.getTokenFromCode.call(void 0,s);return}e&&!i?t.finishToken.call(void 0,n.TokenType.jsxEmptyText):t.finishToken.call(void 0,n.TokenType.jsxText);return}s===o.charCodes.lineFeed?e=!0:s!==o.charCodes.space&&s!==o.charCodes.carriageReturn&&s!==o.charCodes.tab&&(i=!0),r.state.pos++}}function u(e){for(r.state.pos++;;){if(r.state.pos>=r.input.length){a.unexpected.call(void 0,`Unterminated string constant`);return}if(r.input.charCodeAt(r.state.pos)===e){r.state.pos++;break}r.state.pos++}t.finishToken.call(void 0,n.TokenType.string)}function d(){let e;do{if(r.state.pos>r.input.length){a.unexpected.call(void 0,`Unexpectedly reached the end of input.`);return}e=r.input.charCodeAt(++r.state.pos)}while(s.IS_IDENTIFIER_CHAR[e]||e===o.charCodes.dash);t.finishToken.call(void 0,n.TokenType.jsxName)}function f(){x()}function p(e){f(),t.eat.call(void 0,n.TokenType.colon)?f():r.state.tokens[r.state.tokens.length-1].identifierRole=e}function m(){let e=r.state.tokens.length;p(t.IdentifierRole.Access);let i=!1;for(;t.match.call(void 0,n.TokenType.dot);)i=!0,x(),f();if(!i){let t=r.state.tokens[e],n=r.input.charCodeAt(t.start);n>=o.charCodes.lowercaseA&&n<=o.charCodes.lowercaseZ&&(t.identifierRole=null)}}function h(){switch(r.state.type){case n.TokenType.braceL:t.next.call(void 0),i.parseExpression.call(void 0),x();return;case n.TokenType.jsxTagStart:b(),x();return;case n.TokenType.string:x();return;default:a.unexpected.call(void 0,`JSX value should be either an expression or a quoted JSX text`)}}function g(){a.expect.call(void 0,n.TokenType.ellipsis),i.parseExpression.call(void 0)}function _(e){if(t.match.call(void 0,n.TokenType.jsxTagEnd))return!1;m(),r.isTypeScriptEnabled&&c.tsTryParseJSXTypeArgument.call(void 0);let s=!1;for(;!t.match.call(void 0,n.TokenType.slash)&&!t.match.call(void 0,n.TokenType.jsxTagEnd)&&!r.state.error;)t.eat.call(void 0,n.TokenType.braceL)?(s=!0,a.expect.call(void 0,n.TokenType.ellipsis),i.parseMaybeAssign.call(void 0),x()):(s&&r.state.end-r.state.start===3&&r.input.charCodeAt(r.state.start)===o.charCodes.lowercaseK&&r.input.charCodeAt(r.state.start+1)===o.charCodes.lowercaseE&&r.input.charCodeAt(r.state.start+2)===o.charCodes.lowercaseY&&(r.state.tokens[e].jsxRole=t.JSXRole.KeyAfterPropSpread),p(t.IdentifierRole.ObjectKey),t.match.call(void 0,n.TokenType.eq)&&(x(),h()));let l=t.match.call(void 0,n.TokenType.slash);return l&&x(),l}function v(){t.match.call(void 0,n.TokenType.jsxTagEnd)||m()}function y(){let e=r.state.tokens.length-1;r.state.tokens[e].jsxRole=t.JSXRole.NoChildren;let o=0;if(!_(e))for(S();;)switch(r.state.type){case n.TokenType.jsxTagStart:if(x(),t.match.call(void 0,n.TokenType.slash)){x(),v(),r.state.tokens[e].jsxRole!==t.JSXRole.KeyAfterPropSpread&&(o===1?r.state.tokens[e].jsxRole=t.JSXRole.OneChild:o>1&&(r.state.tokens[e].jsxRole=t.JSXRole.StaticChildren));return}o++,y(),S();break;case n.TokenType.jsxText:o++,S();break;case n.TokenType.jsxEmptyText:S();break;case n.TokenType.braceL:t.next.call(void 0),t.match.call(void 0,n.TokenType.ellipsis)?(g(),S(),o+=2):(t.match.call(void 0,n.TokenType.braceR)||(o++,i.parseExpression.call(void 0)),S());break;
|
|
663
|
+
`};e.HelperManager=class e{__init(){this.helperNames={}}__init2(){this.createRequireName=null}constructor(t){this.nameManager=t,e.prototype.__init.call(this),e.prototype.__init2.call(this)}getHelperName(e){let t=this.helperNames[e];return t||(t=this.nameManager.claimFreeName(`_${e}`),this.helperNames[e]=t,t)}emitHelpers(){let e=``;this.helperNames.optionalChainDelete&&this.getHelperName(`optionalChain`),this.helperNames.asyncOptionalChainDelete&&this.getHelperName(`asyncOptionalChain`);for(let[n,r]of Object.entries(t)){let t=this.helperNames[n],i=r;n===`optionalChainDelete`?i=i.replace(`OPTIONAL_CHAIN_NAME`,this.helperNames.optionalChain):n===`asyncOptionalChainDelete`?i=i.replace(`ASYNC_OPTIONAL_CHAIN_NAME`,this.helperNames.asyncOptionalChain):n===`require`&&(this.createRequireName===null&&(this.createRequireName=this.nameManager.claimFreeName(`_createRequire`)),i=i.replace(/CREATE_REQUIRE_NAME/g,this.createRequireName)),t&&(e+=` `,e+=i.replace(n,t).replace(/\s+/g,` `).trim())}return e}}})),bw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ow(),n=G();e.default=function(e,t,n){r(e,n)&&i(e,t,n)};function r(e,r){for(let i of e.tokens)if(i.type===n.TokenType.name&&!i.isType&&t.isNonTopLevelDeclaration.call(void 0,i)&&r.has(e.identifierNameForToken(i)))return!0;return!1}e.hasShadowedGlobals=r;function i(e,r,i){let o=[],s=r.length-1;for(let c=e.tokens.length-1;;c--){for(;o.length>0&&o[o.length-1].startTokenIndex===c+1;)o.pop();for(;s>=0&&r[s].endTokenIndex===c+1;)o.push(r[s]),s--;if(c<0)break;let l=e.tokens[c],u=e.identifierNameForToken(l);if(o.length>1&&!l.isType&&l.type===n.TokenType.name&&i.has(u)){if(t.isBlockScopedDeclaration.call(void 0,l))a(o[o.length-1],e,u);else if(t.isFunctionScopedDeclaration.call(void 0,l)){let t=o.length-1;for(;t>0&&!o[t].isFunctionScope;)t--;if(t<0)throw Error(`Did not find parent function scope.`);a(o[t],e,u)}}}if(o.length>0)throw Error(`Expected empty scope stack after processing file.`)}function a(e,t,r){for(let i=e.startTokenIndex;i<e.endTokenIndex;i++){let e=t.tokens[i];(e.type===n.TokenType.name||e.type===n.TokenType.jsxName)&&t.identifierNameForToken(e)===r&&(e.shadowsGlobal=!0)}}})),xw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=G();e.default=function(e,n){let r=[];for(let i of n)i.type===t.TokenType.name&&r.push(e.slice(i.start,i.end));return r}})),Sw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=t(xw());e.default=class e{__init(){this.usedNames=/* @__PURE__ */ new Set}constructor(t,r){e.prototype.__init.call(this),this.usedNames=new Set(n.default.call(void 0,t,r))}claimFreeName(e){let t=this.findFreeName(e);return this.usedNames.add(t),t}findFreeName(e){if(!this.usedNames.has(e))return e;let t=2;for(;this.usedNames.has(e+String(t));)t++;return e+String(t)}}})),Cw=/* @__PURE__ */ o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.DetailContext=e.NoopContext=e.VError=void 0;var i=function(e){r(t,e);function t(n,r){var i=e.call(this,r)||this;return i.path=n,Object.setPrototypeOf(i,t.prototype),i}return t}(Error);e.VError=i,e.NoopContext=function(){function e(){}return e.prototype.fail=function(e,t,n){return!1},e.prototype.unionResolver=function(){return this},e.prototype.createContext=function(){return this},e.prototype.resolveUnion=function(e){},e}();var a=function(){function e(){this._propNames=[``],this._messages=[null],this._score=0}return e.prototype.fail=function(e,t,n){return this._propNames.push(e),this._messages.push(t),this._score+=n,!1},e.prototype.unionResolver=function(){return new o},e.prototype.resolveUnion=function(e){for(var t,n,r=e,i=null,a=0,o=r.contexts;a<o.length;a++){var s=o[a];(!i||s._score>=i._score)&&(i=s)}i&&i._score>0&&((t=this._propNames).push.apply(t,i._propNames),(n=this._messages).push.apply(n,i._messages))},e.prototype.getError=function(e){for(var t=[],n=this._propNames.length-1;n>=0;n--){var r=this._propNames[n];e+=typeof r==`number`?`[`+r+`]`:r?`.`+r:``;var a=this._messages[n];a&&t.push(e+` `+a)}return new i(e,t.join(`; `))},e.prototype.getErrorDetail=function(e){for(var t=[],n=this._propNames.length-1;n>=0;n--){var r=this._propNames[n];e+=typeof r==`number`?`[`+r+`]`:r?`.`+r:``;var i=this._messages[n];i&&t.push({path:e,message:i})}for(var a=null,n=t.length-1;n>=0;n--)a&&(t[n].nested=[a]),a=t[n];return a},e}();e.DetailContext=a;var o=function(){function e(){this.contexts=[]}return e.prototype.createContext=function(){var e=new a;return this.contexts.push(e),e},e}()})),ww=/* @__PURE__ */ o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.basicTypes=e.BasicType=e.TParamList=e.TParam=e.param=e.TFunc=e.func=e.TProp=e.TOptional=e.opt=e.TIface=e.iface=e.TEnumLiteral=e.enumlit=e.TEnumType=e.enumtype=e.TIntersection=e.intersection=e.TUnion=e.union=e.TTuple=e.tuple=e.TArray=e.array=e.TLiteral=e.lit=e.TName=e.name=e.TType=void 0;var i=Cw(),a=function(){function e(){}return e}();e.TType=a;function o(e){return typeof e==`string`?c(e):e}function s(e,t){var n=e[t];if(!n)throw Error(`Unknown type `+t);return n}function c(e){return new l(e)}e.name=c;var l=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.name=t,n._failMsg=`is not a `+t,n}return t.prototype.getChecker=function(e,n,r){var i=this,a=s(e,this.name),o=a.getChecker(e,n,r);return a instanceof T||a instanceof t?o:function(e,t){return o(e,t)?!0:t.fail(null,i._failMsg,0)}},t}(a);e.TName=l,e.lit=function(e){return new u(e)};var u=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.value=t,n.name=JSON.stringify(t),n._failMsg=`is not `+n.name,n}return t.prototype.getChecker=function(e,t){var n=this;return function(e,t){return e===n.value||t.fail(null,n._failMsg,-1)}},t}(a);e.TLiteral=u,e.array=function(e){return new d(o(e))};var d=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.ttype=t,n}return t.prototype.getChecker=function(e,t){var n=this.ttype.getChecker(e,t);return function(e,t){if(!Array.isArray(e))return t.fail(null,`is not an array`,0);for(var r=0;r<e.length;r++)if(!n(e[r],t))return t.fail(r,null,1);return!0}},t}(a);e.TArray=d,e.tuple=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new f(e.map(function(e){return o(e)}))};var f=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.ttypes=t,n}return t.prototype.getChecker=function(e,t){var n=this.ttypes.map(function(n){return n.getChecker(e,t)}),r=function(e,t){if(!Array.isArray(e))return t.fail(null,`is not an array`,0);for(var r=0;r<n.length;r++)if(!n[r](e[r],t))return t.fail(r,null,1);return!0};return t?function(e,t){return r(e,t)?e.length<=n.length||t.fail(n.length,`is extraneous`,2):!1}:r},t}(a);e.TTuple=f,e.union=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new p(e.map(function(e){return o(e)}))};var p=function(e){r(t,e);function t(t){var n=e.call(this)||this;n.ttypes=t;var r=t.map(function(e){return e instanceof l||e instanceof u?e.name:null}).filter(function(e){return e}),i=t.length-r.length;return r.length?(i>0&&r.push(i+` more`),n._failMsg=`is none of `+r.join(`, `)):n._failMsg=`is none of `+i+` types`,n}return t.prototype.getChecker=function(e,t){var n=this,r=this.ttypes.map(function(n){return n.getChecker(e,t)});return function(e,t){for(var i=t.unionResolver(),a=0;a<r.length;a++)if(r[a](e,i.createContext()))return!0;return t.resolveUnion(i),t.fail(null,n._failMsg,0)}},t}(a);e.TUnion=p,e.intersection=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new m(e.map(function(e){return o(e)}))};var m=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.ttypes=t,n}return t.prototype.getChecker=function(e,t){var n=/* @__PURE__ */ new Set,r=this.ttypes.map(function(r){return r.getChecker(e,t,n)});return function(e,t){return r.every(function(n){return n(e,t)})?!0:t.fail(null,null,0)}},t}(a);e.TIntersection=m,e.enumtype=function(e){return new h(e)};var h=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.members=t,n.validValues=/* @__PURE__ */ new Set,n._failMsg=`is not a valid enum value`,n.validValues=new Set(Object.keys(t).map(function(e){return t[e]})),n}return t.prototype.getChecker=function(e,t){var n=this;return function(e,t){return n.validValues.has(e)?!0:t.fail(null,n._failMsg,0)}},t}(a);e.TEnumType=h,e.enumlit=function(e,t){return new g(e,t)};var g=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.enumName=t,r.prop=n,r._failMsg=`is not `+t+`.`+n,r}return t.prototype.getChecker=function(e,t){var n=this,r=s(e,this.enumName);if(!(r instanceof h))throw Error(`Type `+this.enumName+` used in enumlit is not an enum type`);var i=r.members[this.prop];if(!r.members.hasOwnProperty(this.prop))throw Error(`Unknown value `+this.enumName+`.`+this.prop+` used in enumlit`);return function(e,t){return e===i||t.fail(null,n._failMsg,-1)}},t}(a);e.TEnumLiteral=g;function _(e){return Object.keys(e).map(function(t){return v(t,e[t])})}function v(e,t){return t instanceof b?new x(e,t.ttype,!0):new x(e,o(t),!1)}e.iface=function(e,t){return new y(e,_(t))};var y=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.bases=t,r.props=n,r.propSet=new Set(n.map(function(e){return e.name})),r}return t.prototype.getChecker=function(e,t,n){var r=this,a=this.bases.map(function(n){return s(e,n).getChecker(e,t)}),o=this.props.map(function(n){return n.ttype.getChecker(e,t)}),c=new i.NoopContext,l=this.props.map(function(e,t){return!e.isOpt&&!o[t](void 0,c)}),u=function(e,t){if(typeof e!=`object`||!e)return t.fail(null,`is not an object`,0);for(var n=0;n<a.length;n++)if(!a[n](e,t))return!1;for(var n=0;n<o.length;n++){var i=r.props[n].name,s=e[i];if(s===void 0){if(l[n])return t.fail(i,`is missing`,1)}else if(!o[n](s,t))return t.fail(i,null,1)}return!0};if(!t)return u;var d=this.propSet;return n&&(this.propSet.forEach(function(e){return n.add(e)}),d=n),function(e,t){if(!u(e,t))return!1;for(var n in e)if(!d.has(n))return t.fail(n,`is extraneous`,2);return!0}},t}(a);e.TIface=y,e.opt=function(e){return new b(o(e))};var b=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.ttype=t,n}return t.prototype.getChecker=function(e,t){var n=this.ttype.getChecker(e,t);return function(e,t){return e===void 0||n(e,t)}},t}(a);e.TOptional=b;var x=function(){function e(e,t,n){this.name=e,this.ttype=t,this.isOpt=n}return e}();e.TProp=x,e.func=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return new S(new w(t),o(e))};var S=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.paramList=t,r.result=n,r}return t.prototype.getChecker=function(e,t){return function(e,t){return typeof e==`function`||t.fail(null,`is not a function`,0)}},t}(a);e.TFunc=S,e.param=function(e,t,n){return new C(e,o(t),!!n)};var C=function(){function e(e,t,n){this.name=e,this.ttype=t,this.isOpt=n}return e}();e.TParam=C;var w=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.params=t,n}return t.prototype.getChecker=function(e,t){var n=this,r=this.params.map(function(n){return n.ttype.getChecker(e,t)}),a=new i.NoopContext,o=this.params.map(function(e,t){return!e.isOpt&&!r[t](void 0,a)}),s=function(e,t){if(!Array.isArray(e))return t.fail(null,`is not an array`,0);for(var i=0;i<r.length;i++){var a=n.params[i];if(e[i]===void 0){if(o[i])return t.fail(a.name,`is missing`,1)}else if(!r[i](e[i],t))return t.fail(a.name,null,1)}return!0};return t?function(e,t){return s(e,t)?e.length<=r.length||t.fail(r.length,`is extraneous`,2):!1}:s},t}(a);e.TParamList=w;var T=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.validator=t,r.message=n,r}return t.prototype.getChecker=function(e,t){var n=this;return function(e,t){return n.validator(e)?!0:t.fail(null,n.message,0)}},t}(a);e.BasicType=T,e.basicTypes={any:new T(function(e){return!0},`is invalid`),number:new T(function(e){return typeof e==`number`},`is not a number`),object:new T(function(e){return typeof e==`object`&&e},`is not an object`),boolean:new T(function(e){return typeof e==`boolean`},`is not a boolean`),string:new T(function(e){return typeof e==`string`},`is not a string`),symbol:new T(function(e){return typeof e==`symbol`},`is not a symbol`),void:new T(function(e){return e==null},`is not void`),undefined:new T(function(e){return e===void 0},`is not undefined`),null:new T(function(e){return e===null},`is not null`),never:new T(function(e){return!1},`is unexpected`),Date:new T(te(`[object Date]`),`is not a Date`),RegExp:new T(te(`[object RegExp]`),`is not a RegExp`)};var ee=Object.prototype.toString;function te(e){return function(t){return typeof t==`object`&&t&&ee.call(t)===e}}typeof Buffer<`u`&&(e.basicTypes.Buffer=new T(function(e){return Buffer.isBuffer(e)},`is not a Buffer`));for(var ne=function(t){e.basicTypes[t.name]=new T(function(e){return e instanceof t},`is not a `+t.name)},E=0,re=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];E<re.length;E++)ne(re[E])})),Tw=/* @__PURE__ */ o(((e,t,n)=>{var r=n&&n.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r};Object.defineProperty(e,"__esModule",{value:!0}),e.Checker=e.createCheckers=void 0;var i=ww(),a=Cw(),o=ww();Object.defineProperty(e,"TArray",{enumerable:!0,get:function(){return o.TArray}}),Object.defineProperty(e,"TEnumType",{enumerable:!0,get:function(){return o.TEnumType}}),Object.defineProperty(e,"TEnumLiteral",{enumerable:!0,get:function(){return o.TEnumLiteral}}),Object.defineProperty(e,"TFunc",{enumerable:!0,get:function(){return o.TFunc}}),Object.defineProperty(e,"TIface",{enumerable:!0,get:function(){return o.TIface}}),Object.defineProperty(e,"TLiteral",{enumerable:!0,get:function(){return o.TLiteral}}),Object.defineProperty(e,"TName",{enumerable:!0,get:function(){return o.TName}}),Object.defineProperty(e,"TOptional",{enumerable:!0,get:function(){return o.TOptional}}),Object.defineProperty(e,"TParam",{enumerable:!0,get:function(){return o.TParam}}),Object.defineProperty(e,"TParamList",{enumerable:!0,get:function(){return o.TParamList}}),Object.defineProperty(e,"TProp",{enumerable:!0,get:function(){return o.TProp}}),Object.defineProperty(e,"TTuple",{enumerable:!0,get:function(){return o.TTuple}}),Object.defineProperty(e,"TType",{enumerable:!0,get:function(){return o.TType}}),Object.defineProperty(e,"TUnion",{enumerable:!0,get:function(){return o.TUnion}}),Object.defineProperty(e,"TIntersection",{enumerable:!0,get:function(){return o.TIntersection}}),Object.defineProperty(e,"array",{enumerable:!0,get:function(){return o.array}}),Object.defineProperty(e,"enumlit",{enumerable:!0,get:function(){return o.enumlit}}),Object.defineProperty(e,"enumtype",{enumerable:!0,get:function(){return o.enumtype}}),Object.defineProperty(e,"func",{enumerable:!0,get:function(){return o.func}}),Object.defineProperty(e,"iface",{enumerable:!0,get:function(){return o.iface}}),Object.defineProperty(e,"lit",{enumerable:!0,get:function(){return o.lit}}),Object.defineProperty(e,"name",{enumerable:!0,get:function(){return o.name}}),Object.defineProperty(e,"opt",{enumerable:!0,get:function(){return o.opt}}),Object.defineProperty(e,"param",{enumerable:!0,get:function(){return o.param}}),Object.defineProperty(e,"tuple",{enumerable:!0,get:function(){return o.tuple}}),Object.defineProperty(e,"union",{enumerable:!0,get:function(){return o.union}}),Object.defineProperty(e,"intersection",{enumerable:!0,get:function(){return o.intersection}}),Object.defineProperty(e,"BasicType",{enumerable:!0,get:function(){return o.BasicType}});var s=Cw();Object.defineProperty(e,"VError",{enumerable:!0,get:function(){return s.VError}}),e.createCheckers=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=Object.assign.apply(Object,r([{},i.basicTypes],e)),a={},o=0,s=e;o<s.length;o++)for(var l=s[o],u=0,d=Object.keys(l);u<d.length;u++){var f=d[u];a[f]=new c(n,l[f])}return a};var c=function(){function e(e,t,n){if(n===void 0&&(n=`value`),this.suite=e,this.ttype=t,this._path=n,this.props=/* @__PURE__ */ new Map,t instanceof i.TIface)for(var r=0,a=t.props;r<a.length;r++){var o=a[r];this.props.set(o.name,o.ttype)}this.checkerPlain=this.ttype.getChecker(e,!1),this.checkerStrict=this.ttype.getChecker(e,!0)}return e.prototype.setReportedPath=function(e){this._path=e},e.prototype.check=function(e){return this._doCheck(this.checkerPlain,e)},e.prototype.test=function(e){return this.checkerPlain(e,new a.NoopContext)},e.prototype.validate=function(e){return this._doValidate(this.checkerPlain,e)},e.prototype.strictCheck=function(e){return this._doCheck(this.checkerStrict,e)},e.prototype.strictTest=function(e){return this.checkerStrict(e,new a.NoopContext)},e.prototype.strictValidate=function(e){return this._doValidate(this.checkerStrict,e)},e.prototype.getProp=function(t){var n=this.props.get(t);if(!n)throw Error(`Type has no property `+t);return new e(this.suite,n,this._path+`.`+t)},e.prototype.methodArgs=function(t){var n=this._getMethod(t);return new e(this.suite,n.paramList)},e.prototype.methodResult=function(t){var n=this._getMethod(t);return new e(this.suite,n.result)},e.prototype.getArgs=function(){if(!(this.ttype instanceof i.TFunc))throw Error(`getArgs() applied to non-function`);return new e(this.suite,this.ttype.paramList)},e.prototype.getResult=function(){if(!(this.ttype instanceof i.TFunc))throw Error(`getResult() applied to non-function`);return new e(this.suite,this.ttype.result)},e.prototype.getType=function(){return this.ttype},e.prototype._doCheck=function(e,t){if(!e(t,new a.NoopContext)){var n=new a.DetailContext;throw e(t,n),n.getError(this._path)}},e.prototype._doValidate=function(e,t){if(e(t,new a.NoopContext))return null;var n=new a.DetailContext;return e(t,n),n.getErrorDetail(this._path)},e.prototype._getMethod=function(e){var t=this.props.get(e);if(!t)throw Error(`Type has no property `+e);if(!(t instanceof i.TFunc))throw Error(`Property `+e+` is not a method`);return t},e}();e.Checker=c})),Ew=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}var n=t(Tw());e.Transform=n.union(n.lit(`jsx`),n.lit(`typescript`),n.lit(`flow`),n.lit(`imports`),n.lit(`react-hot-loader`),n.lit(`jest`)),e.SourceMapOptions=n.iface([],{compiledFilename:`string`}),e.Options=n.iface([],{transforms:n.array(`Transform`),disableESTransforms:n.opt(`boolean`),jsxRuntime:n.opt(n.union(n.lit(`classic`),n.lit(`automatic`),n.lit(`preserve`))),production:n.opt(`boolean`),jsxImportSource:n.opt(`string`),jsxPragma:n.opt(`string`),jsxFragmentPragma:n.opt(`string`),keepUnusedImports:n.opt(`boolean`),preserveDynamicImport:n.opt(`boolean`),injectCreateRequireForImportRequire:n.opt(`boolean`),enableLegacyTypeScriptModuleInterop:n.opt(`boolean`),enableLegacyBabel5ModuleInterop:n.opt(`boolean`),sourceMapOptions:n.opt(`SourceMapOptions`),filePath:n.opt(`string`)}),e.default={Transform:e.Transform,SourceMapOptions:e.SourceMapOptions,Options:e.Options}})),Dw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=Tw(),r=t(Ew());let{Options:i}=n.createCheckers.call(void 0,r.default);e.validateOptions=function(e){i.strictCheck(e)}})),Ow=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Nw(),n=kw(),r=ow(),i=ZC(),a=G(),o=ew(),s=Mw(),c=tw();e.parseSpread=function(){r.next.call(void 0),s.parseMaybeAssign.call(void 0,!1)};function l(e){r.next.call(void 0),f(e)}e.parseRest=l;function u(e){s.parseIdentifier.call(void 0),d(e)}e.parseBindingIdentifier=u,e.parseImportedIdentifier=function(){s.parseIdentifier.call(void 0),o.state.tokens[o.state.tokens.length-1].identifierRole=r.IdentifierRole.ImportDeclaration};function d(e){let t;t=o.state.scopeDepth===0?r.IdentifierRole.TopLevelDeclaration:e?r.IdentifierRole.BlockScopedDeclaration:r.IdentifierRole.FunctionScopedDeclaration,o.state.tokens[o.state.tokens.length-1].identifierRole=t}e.markPriorBindingIdentifier=d;function f(e){switch(o.state.type){case a.TokenType._this:{let e=r.pushTypeContext.call(void 0,0);r.next.call(void 0),r.popTypeContext.call(void 0,e);return}case a.TokenType._yield:case a.TokenType.name:o.state.type=a.TokenType.name,u(e);return;case a.TokenType.bracketL:r.next.call(void 0),p(a.TokenType.bracketR,e,!0);return;case a.TokenType.braceL:s.parseObj.call(void 0,!0,e);return;default:c.unexpected.call(void 0)}}e.parseBindingAtom=f;function p(e,t,n=!1,i=!1,s=0){let u=!0,d=!1,f=o.state.tokens.length;for(;!r.eat.call(void 0,e)&&!o.state.error;)if(u?u=!1:(c.expect.call(void 0,a.TokenType.comma),o.state.tokens[o.state.tokens.length-1].contextId=s,!d&&o.state.tokens[f].isType&&(o.state.tokens[o.state.tokens.length-1].isType=!0,d=!0)),!(n&&r.match.call(void 0,a.TokenType.comma))){if(r.eat.call(void 0,e))break;if(r.match.call(void 0,a.TokenType.ellipsis)){l(t),h(),r.eat.call(void 0,a.TokenType.comma),c.expect.call(void 0,e);break}m(i,t)}}e.parseBindingList=p;function m(e,t){e&&n.tsParseModifiers.call(void 0,[i.ContextualKeyword._public,i.ContextualKeyword._protected,i.ContextualKeyword._private,i.ContextualKeyword._readonly,i.ContextualKeyword._override]),g(t),h(),g(t,!0)}function h(){o.isFlowEnabled?t.flowParseAssignableListItemTypes.call(void 0):o.isTypeScriptEnabled&&n.tsParseAssignableListItemTypes.call(void 0)}function g(e,t=!1){if(t||f(e),!r.eat.call(void 0,a.TokenType.eq))return;let n=o.state.tokens.length-1;s.parseMaybeAssign.call(void 0),o.state.tokens[n].rhsEndIndex=o.state.tokens.length}e.parseMaybeDefault=g})),kw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ow(),n=ZC(),r=G(),i=ew(),a=Mw(),o=Ow(),s=Pw(),c=tw(),l=Aw();function u(){return t.match.call(void 0,r.TokenType.name)}function d(){return t.match.call(void 0,r.TokenType.name)||!!(i.state.type&r.TokenType.IS_KEYWORD)||t.match.call(void 0,r.TokenType.string)||t.match.call(void 0,r.TokenType.num)||t.match.call(void 0,r.TokenType.bigint)||t.match.call(void 0,r.TokenType.decimal)}function f(){let e=i.state.snapshot();return t.next.call(void 0),(t.match.call(void 0,r.TokenType.bracketL)||t.match.call(void 0,r.TokenType.braceL)||t.match.call(void 0,r.TokenType.star)||t.match.call(void 0,r.TokenType.ellipsis)||t.match.call(void 0,r.TokenType.hash)||d())&&!c.hasPrecedingLineBreak.call(void 0)?!0:(i.state.restoreFromSnapshot(e),!1)}function p(e){for(;m(e)!==null;);}e.tsParseModifiers=p;function m(e){if(!t.match.call(void 0,r.TokenType.name))return null;let a=i.state.contextualKeyword;if(e.indexOf(a)!==-1&&f()){switch(a){case n.ContextualKeyword._readonly:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._readonly;break;case n.ContextualKeyword._abstract:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._abstract;break;case n.ContextualKeyword._static:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._static;break;case n.ContextualKeyword._public:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._public;break;case n.ContextualKeyword._private:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._private;break;case n.ContextualKeyword._protected:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._protected;break;case n.ContextualKeyword._override:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._override;break;case n.ContextualKeyword._declare:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._declare}return a}return null}e.tsParseModifier=m;function h(){for(a.parseIdentifier.call(void 0);t.eat.call(void 0,r.TokenType.dot);)a.parseIdentifier.call(void 0)}function g(){h(),!c.hasPrecedingLineBreak.call(void 0)&&t.match.call(void 0,r.TokenType.lessThan)&&Ze()}function _(){t.next.call(void 0),ke()}function v(){t.next.call(void 0)}function y(){c.expect.call(void 0,r.TokenType._typeof),t.match.call(void 0,r.TokenType._import)?b():h(),!c.hasPrecedingLineBreak.call(void 0)&&t.match.call(void 0,r.TokenType.lessThan)&&Ze()}function b(){c.expect.call(void 0,r.TokenType._import),c.expect.call(void 0,r.TokenType.parenL),c.expect.call(void 0,r.TokenType.string),c.expect.call(void 0,r.TokenType.parenR),t.eat.call(void 0,r.TokenType.dot)&&h(),t.match.call(void 0,r.TokenType.lessThan)&&Ze()}function x(){t.eat.call(void 0,r.TokenType._const);let e=t.eat.call(void 0,r.TokenType._in),o=c.eatContextual.call(void 0,n.ContextualKeyword._out);t.eat.call(void 0,r.TokenType._const),(e||o)&&!t.match.call(void 0,r.TokenType.name)?i.state.tokens[i.state.tokens.length-1].type=r.TokenType.name:a.parseIdentifier.call(void 0),t.eat.call(void 0,r.TokenType._extends)&&A(),t.eat.call(void 0,r.TokenType.eq)&&A()}function S(){t.match.call(void 0,r.TokenType.lessThan)&&C()}e.tsTryParseTypeParameters=S;function C(){let e=t.pushTypeContext.call(void 0,0);for(t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.typeParameterStart)?t.next.call(void 0):c.unexpected.call(void 0);!t.eat.call(void 0,r.TokenType.greaterThan)&&!i.state.error;)x(),t.eat.call(void 0,r.TokenType.comma);t.popTypeContext.call(void 0,e)}function w(e){let n=e===r.TokenType.arrow;S(),c.expect.call(void 0,r.TokenType.parenL),i.state.scopeDepth++,T(!1),i.state.scopeDepth--,(n||t.match.call(void 0,e))&&we(e)}function T(e){o.parseBindingList.call(void 0,r.TokenType.parenR,e)}function ee(){t.eat.call(void 0,r.TokenType.comma)||c.semicolon.call(void 0)}function te(){w(r.TokenType.colon),ee()}function ne(){let e=i.state.snapshot();t.next.call(void 0);let n=t.eat.call(void 0,r.TokenType.name)&&t.match.call(void 0,r.TokenType.colon);return i.state.restoreFromSnapshot(e),n}function E(){if(!(t.match.call(void 0,r.TokenType.bracketL)&&ne()))return!1;let e=t.pushTypeContext.call(void 0,0);return c.expect.call(void 0,r.TokenType.bracketL),a.parseIdentifier.call(void 0),ke(),c.expect.call(void 0,r.TokenType.bracketR),Ee(),ee(),t.popTypeContext.call(void 0,e),!0}function re(e){t.eat.call(void 0,r.TokenType.question),!e&&(t.match.call(void 0,r.TokenType.parenL)||t.match.call(void 0,r.TokenType.lessThan))?(w(r.TokenType.colon),ee()):(Ee(),ee())}function D(){if(t.match.call(void 0,r.TokenType.parenL)||t.match.call(void 0,r.TokenType.lessThan)){te();return}if(t.match.call(void 0,r.TokenType._new)){t.next.call(void 0),t.match.call(void 0,r.TokenType.parenL)||t.match.call(void 0,r.TokenType.lessThan)?te():re(!1);return}let e=!!m([n.ContextualKeyword._readonly]);E()||((c.isContextual.call(void 0,n.ContextualKeyword._get)||c.isContextual.call(void 0,n.ContextualKeyword._set))&&f(),a.parsePropertyName.call(void 0,-1),re(e))}function ie(){ae()}function ae(){for(c.expect.call(void 0,r.TokenType.braceL);!t.eat.call(void 0,r.TokenType.braceR)&&!i.state.error;)D()}function oe(){let e=i.state.snapshot(),t=se();return i.state.restoreFromSnapshot(e),t}function se(){return t.next.call(void 0),t.eat.call(void 0,r.TokenType.plus)||t.eat.call(void 0,r.TokenType.minus)?c.isContextual.call(void 0,n.ContextualKeyword._readonly):(c.isContextual.call(void 0,n.ContextualKeyword._readonly)&&t.next.call(void 0),!t.match.call(void 0,r.TokenType.bracketL)||(t.next.call(void 0),!u())?!1:(t.next.call(void 0),t.match.call(void 0,r.TokenType._in)))}function O(){a.parseIdentifier.call(void 0),c.expect.call(void 0,r.TokenType._in),A()}function ce(){c.expect.call(void 0,r.TokenType.braceL),t.match.call(void 0,r.TokenType.plus)||t.match.call(void 0,r.TokenType.minus)?(t.next.call(void 0),c.expectContextual.call(void 0,n.ContextualKeyword._readonly)):c.eatContextual.call(void 0,n.ContextualKeyword._readonly),c.expect.call(void 0,r.TokenType.bracketL),O(),c.eatContextual.call(void 0,n.ContextualKeyword._as)&&A(),c.expect.call(void 0,r.TokenType.bracketR),t.match.call(void 0,r.TokenType.plus)||t.match.call(void 0,r.TokenType.minus)?(t.next.call(void 0),c.expect.call(void 0,r.TokenType.question)):t.eat.call(void 0,r.TokenType.question),De(),c.semicolon.call(void 0),c.expect.call(void 0,r.TokenType.braceR)}function le(){for(c.expect.call(void 0,r.TokenType.bracketL);!t.eat.call(void 0,r.TokenType.bracketR)&&!i.state.error;)ue(),t.eat.call(void 0,r.TokenType.comma)}function ue(){t.eat.call(void 0,r.TokenType.ellipsis)?A():(A(),t.eat.call(void 0,r.TokenType.question)),t.eat.call(void 0,r.TokenType.colon)&&A()}function de(){c.expect.call(void 0,r.TokenType.parenL),A(),c.expect.call(void 0,r.TokenType.parenR)}function fe(){for(t.nextTemplateToken.call(void 0),t.nextTemplateToken.call(void 0);!t.match.call(void 0,r.TokenType.backQuote)&&!i.state.error;)c.expect.call(void 0,r.TokenType.dollarBraceL),A(),t.nextTemplateToken.call(void 0),t.nextTemplateToken.call(void 0);t.next.call(void 0)}var k;(function(e){e[e.TSFunctionType=0]=`TSFunctionType`,e[e.TSConstructorType=1]=`TSConstructorType`,e[e.TSAbstractConstructorType=2]=`TSAbstractConstructorType`})(k||={});function pe(e){e===k.TSAbstractConstructorType&&c.expectContextual.call(void 0,n.ContextualKeyword._abstract),(e===k.TSConstructorType||e===k.TSAbstractConstructorType)&&c.expect.call(void 0,r.TokenType._new);let t=i.state.inDisallowConditionalTypesContext;i.state.inDisallowConditionalTypesContext=!1,w(r.TokenType.arrow),i.state.inDisallowConditionalTypesContext=t}function me(){switch(i.state.type){case r.TokenType.name:g();return;case r.TokenType._void:case r.TokenType._null:t.next.call(void 0);return;case r.TokenType.string:case r.TokenType.num:case r.TokenType.bigint:case r.TokenType.decimal:case r.TokenType._true:case r.TokenType._false:a.parseLiteral.call(void 0);return;case r.TokenType.minus:t.next.call(void 0),a.parseLiteral.call(void 0);return;case r.TokenType._this:v(),c.isContextual.call(void 0,n.ContextualKeyword._is)&&!c.hasPrecedingLineBreak.call(void 0)&&_();return;case r.TokenType._typeof:y();return;case r.TokenType._import:b();return;case r.TokenType.braceL:oe()?ce():ie();return;case r.TokenType.bracketL:le();return;case r.TokenType.parenL:de();return;case r.TokenType.backQuote:fe();return;default:if(i.state.type&r.TokenType.IS_KEYWORD){t.next.call(void 0),i.state.tokens[i.state.tokens.length-1].type=r.TokenType.name;return}}c.unexpected.call(void 0)}function he(){for(me();!c.hasPrecedingLineBreak.call(void 0)&&t.eat.call(void 0,r.TokenType.bracketL);)t.eat.call(void 0,r.TokenType.bracketR)||(A(),c.expect.call(void 0,r.TokenType.bracketR))}function ge(){if(c.expectContextual.call(void 0,n.ContextualKeyword._infer),a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType._extends)){let e=i.state.snapshot();c.expect.call(void 0,r.TokenType._extends);let n=i.state.inDisallowConditionalTypesContext;i.state.inDisallowConditionalTypesContext=!0,A(),i.state.inDisallowConditionalTypesContext=n,(i.state.error||!i.state.inDisallowConditionalTypesContext&&t.match.call(void 0,r.TokenType.question))&&i.state.restoreFromSnapshot(e)}}function _e(){if(c.isContextual.call(void 0,n.ContextualKeyword._keyof)||c.isContextual.call(void 0,n.ContextualKeyword._unique)||c.isContextual.call(void 0,n.ContextualKeyword._readonly))t.next.call(void 0),_e();else if(c.isContextual.call(void 0,n.ContextualKeyword._infer))ge();else{let e=i.state.inDisallowConditionalTypesContext;i.state.inDisallowConditionalTypesContext=!1,he(),i.state.inDisallowConditionalTypesContext=e}}function ve(){if(t.eat.call(void 0,r.TokenType.bitwiseAND),_e(),t.match.call(void 0,r.TokenType.bitwiseAND))for(;t.eat.call(void 0,r.TokenType.bitwiseAND);)_e()}function ye(){if(t.eat.call(void 0,r.TokenType.bitwiseOR),ve(),t.match.call(void 0,r.TokenType.bitwiseOR))for(;t.eat.call(void 0,r.TokenType.bitwiseOR);)ve()}function be(){return t.match.call(void 0,r.TokenType.lessThan)?!0:t.match.call(void 0,r.TokenType.parenL)&&Se()}function xe(){if(t.match.call(void 0,r.TokenType.name)||t.match.call(void 0,r.TokenType._this))return t.next.call(void 0),!0;if(t.match.call(void 0,r.TokenType.braceL)||t.match.call(void 0,r.TokenType.bracketL)){let e=1;for(t.next.call(void 0);e>0&&!i.state.error;)t.match.call(void 0,r.TokenType.braceL)||t.match.call(void 0,r.TokenType.bracketL)?e++:(t.match.call(void 0,r.TokenType.braceR)||t.match.call(void 0,r.TokenType.bracketR))&&e--,t.next.call(void 0);return!0}return!1}function Se(){let e=i.state.snapshot(),t=Ce();return i.state.restoreFromSnapshot(e),t}function Ce(){return t.next.call(void 0),!!(t.match.call(void 0,r.TokenType.parenR)||t.match.call(void 0,r.TokenType.ellipsis)||xe()&&(t.match.call(void 0,r.TokenType.colon)||t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.question)||t.match.call(void 0,r.TokenType.eq)||t.match.call(void 0,r.TokenType.parenR)&&(t.next.call(void 0),t.match.call(void 0,r.TokenType.arrow))))}function we(e){let n=t.pushTypeContext.call(void 0,0);c.expect.call(void 0,e),Oe()||A(),t.popTypeContext.call(void 0,n)}function Te(){t.match.call(void 0,r.TokenType.colon)&&we(r.TokenType.colon)}function Ee(){t.match.call(void 0,r.TokenType.colon)&&ke()}e.tsTryParseTypeAnnotation=Ee;function De(){t.eat.call(void 0,r.TokenType.colon)&&A()}function Oe(){let e=i.state.snapshot();return c.isContextual.call(void 0,n.ContextualKeyword._asserts)?(t.next.call(void 0),c.eatContextual.call(void 0,n.ContextualKeyword._is)?(A(),!0):u()||t.match.call(void 0,r.TokenType._this)?(t.next.call(void 0),c.eatContextual.call(void 0,n.ContextualKeyword._is)&&A(),!0):(i.state.restoreFromSnapshot(e),!1)):u()||t.match.call(void 0,r.TokenType._this)?(t.next.call(void 0),c.isContextual.call(void 0,n.ContextualKeyword._is)&&!c.hasPrecedingLineBreak.call(void 0)?(t.next.call(void 0),A(),!0):(i.state.restoreFromSnapshot(e),!1)):!1}function ke(){let e=t.pushTypeContext.call(void 0,0);c.expect.call(void 0,r.TokenType.colon),A(),t.popTypeContext.call(void 0,e)}e.tsParseTypeAnnotation=ke;function A(){if(je(),i.state.inDisallowConditionalTypesContext||c.hasPrecedingLineBreak.call(void 0)||!t.eat.call(void 0,r.TokenType._extends))return;let e=i.state.inDisallowConditionalTypesContext;i.state.inDisallowConditionalTypesContext=!0,je(),i.state.inDisallowConditionalTypesContext=e,c.expect.call(void 0,r.TokenType.question),A(),c.expect.call(void 0,r.TokenType.colon),A()}e.tsParseType=A;function Ae(){return c.isContextual.call(void 0,n.ContextualKeyword._abstract)&&t.lookaheadType.call(void 0)===r.TokenType._new}function je(){be()?pe(k.TSFunctionType):t.match.call(void 0,r.TokenType._new)?pe(k.TSConstructorType):Ae()?pe(k.TSAbstractConstructorType):ye()}e.tsParseNonConditionalType=je,e.tsParseTypeAssertion=function(){let e=t.pushTypeContext.call(void 0,1);A(),c.expect.call(void 0,r.TokenType.greaterThan),t.popTypeContext.call(void 0,e),a.parseMaybeUnary.call(void 0)},e.tsTryParseJSXTypeArgument=function(){if(t.eat.call(void 0,r.TokenType.jsxTagStart)){i.state.tokens[i.state.tokens.length-1].type=r.TokenType.typeParameterStart;let e=t.pushTypeContext.call(void 0,1);for(;!t.match.call(void 0,r.TokenType.greaterThan)&&!i.state.error;)A(),t.eat.call(void 0,r.TokenType.comma);l.nextJSXTagToken.call(void 0),t.popTypeContext.call(void 0,e)}};function Me(){for(;!t.match.call(void 0,r.TokenType.braceL)&&!i.state.error;)Ne(),t.eat.call(void 0,r.TokenType.comma)}function Ne(){h(),t.match.call(void 0,r.TokenType.lessThan)&&Ze()}function Pe(){o.parseBindingIdentifier.call(void 0,!1),S(),t.eat.call(void 0,r.TokenType._extends)&&Me(),ae()}function Fe(){o.parseBindingIdentifier.call(void 0,!1),S(),c.expect.call(void 0,r.TokenType.eq),A(),c.semicolon.call(void 0)}function Ie(){if(t.match.call(void 0,r.TokenType.string)?a.parseLiteral.call(void 0):a.parseIdentifier.call(void 0),t.eat.call(void 0,r.TokenType.eq)){let e=i.state.tokens.length-1;a.parseMaybeAssign.call(void 0),i.state.tokens[e].rhsEndIndex=i.state.tokens.length}}function Le(){for(o.parseBindingIdentifier.call(void 0,!1),c.expect.call(void 0,r.TokenType.braceL);!t.eat.call(void 0,r.TokenType.braceR)&&!i.state.error;)Ie(),t.eat.call(void 0,r.TokenType.comma)}function Re(){c.expect.call(void 0,r.TokenType.braceL),s.parseBlockBody.call(void 0,r.TokenType.braceR)}function ze(){o.parseBindingIdentifier.call(void 0,!1),t.eat.call(void 0,r.TokenType.dot)?ze():Re()}function Be(){c.isContextual.call(void 0,n.ContextualKeyword._global)?a.parseIdentifier.call(void 0):t.match.call(void 0,r.TokenType.string)?a.parseExprAtom.call(void 0):c.unexpected.call(void 0),t.match.call(void 0,r.TokenType.braceL)?Re():c.semicolon.call(void 0)}function Ve(){o.parseImportedIdentifier.call(void 0),c.expect.call(void 0,r.TokenType.eq),j(),c.semicolon.call(void 0)}e.tsParseImportEqualsDeclaration=Ve;function He(){return c.isContextual.call(void 0,n.ContextualKeyword._require)&&t.lookaheadType.call(void 0)===r.TokenType.parenL}function j(){He()?Ue():h()}function Ue(){c.expectContextual.call(void 0,n.ContextualKeyword._require),c.expect.call(void 0,r.TokenType.parenL),t.match.call(void 0,r.TokenType.string)||c.unexpected.call(void 0),a.parseLiteral.call(void 0),c.expect.call(void 0,r.TokenType.parenR)}function We(){if(c.isLineTerminator.call(void 0))return!1;switch(i.state.type){case r.TokenType._function:{let e=t.pushTypeContext.call(void 0,1);t.next.call(void 0);let n=i.state.start;return s.parseFunction.call(void 0,n,!0),t.popTypeContext.call(void 0,e),!0}case r.TokenType._class:{let e=t.pushTypeContext.call(void 0,1);return s.parseClass.call(void 0,!0,!1),t.popTypeContext.call(void 0,e),!0}case r.TokenType._const:if(t.match.call(void 0,r.TokenType._const)&&c.isLookaheadContextual.call(void 0,n.ContextualKeyword._enum)){let e=t.pushTypeContext.call(void 0,1);return c.expect.call(void 0,r.TokenType._const),c.expectContextual.call(void 0,n.ContextualKeyword._enum),i.state.tokens[i.state.tokens.length-1].type=r.TokenType._enum,Le(),t.popTypeContext.call(void 0,e),!0}case r.TokenType._var:case r.TokenType._let:{let e=t.pushTypeContext.call(void 0,1);return s.parseVarStatement.call(void 0,i.state.type!==r.TokenType._var),t.popTypeContext.call(void 0,e),!0}case r.TokenType.name:{let e=t.pushTypeContext.call(void 0,1),r=i.state.contextualKeyword,a=!1;return r===n.ContextualKeyword._global?(Be(),a=!0):a=qe(r,!0),t.popTypeContext.call(void 0,e),a}default:return!1}}function Ge(){return qe(i.state.contextualKeyword,!0)}function Ke(e){switch(e){case n.ContextualKeyword._declare:{let e=i.state.tokens.length-1;if(We())return i.state.tokens[e].type=r.TokenType._declare,!0;break}case n.ContextualKeyword._global:if(t.match.call(void 0,r.TokenType.braceL))return Re(),!0;break;default:return qe(e,!1)}return!1}function qe(e,a){switch(e){case n.ContextualKeyword._abstract:if(Je(a)&&t.match.call(void 0,r.TokenType._class))return i.state.tokens[i.state.tokens.length-1].type=r.TokenType._abstract,s.parseClass.call(void 0,!0,!1),!0;break;case n.ContextualKeyword._enum:if(Je(a)&&t.match.call(void 0,r.TokenType.name))return i.state.tokens[i.state.tokens.length-1].type=r.TokenType._enum,Le(),!0;break;case n.ContextualKeyword._interface:if(Je(a)&&t.match.call(void 0,r.TokenType.name)){let e=t.pushTypeContext.call(void 0,a?2:1);return Pe(),t.popTypeContext.call(void 0,e),!0}break;case n.ContextualKeyword._module:if(Je(a)){if(t.match.call(void 0,r.TokenType.string)){let e=t.pushTypeContext.call(void 0,a?2:1);return Be(),t.popTypeContext.call(void 0,e),!0}if(t.match.call(void 0,r.TokenType.name)){let e=t.pushTypeContext.call(void 0,a?2:1);return ze(),t.popTypeContext.call(void 0,e),!0}}break;case n.ContextualKeyword._namespace:if(Je(a)&&t.match.call(void 0,r.TokenType.name)){let e=t.pushTypeContext.call(void 0,a?2:1);return ze(),t.popTypeContext.call(void 0,e),!0}break;case n.ContextualKeyword._type:if(Je(a)&&t.match.call(void 0,r.TokenType.name)){let e=t.pushTypeContext.call(void 0,a?2:1);return Fe(),t.popTypeContext.call(void 0,e),!0}}return!1}function Je(e){return e?(t.next.call(void 0),!0):!c.isLineTerminator.call(void 0)}function Ye(){let e=i.state.snapshot();return C(),s.parseFunctionParams.call(void 0),Te(),c.expect.call(void 0,r.TokenType.arrow),i.state.error?(i.state.restoreFromSnapshot(e),!1):(a.parseFunctionBody.call(void 0,!0),!0)}function Xe(){i.state.type===r.TokenType.bitShiftL&&(--i.state.pos,t.finishToken.call(void 0,r.TokenType.lessThan)),Ze()}function Ze(){let e=t.pushTypeContext.call(void 0,0);for(c.expect.call(void 0,r.TokenType.lessThan);!t.match.call(void 0,r.TokenType.greaterThan)&&!i.state.error;)A(),t.eat.call(void 0,r.TokenType.comma);e?(c.expect.call(void 0,r.TokenType.greaterThan),t.popTypeContext.call(void 0,e)):(t.popTypeContext.call(void 0,e),t.rescan_gt.call(void 0),c.expect.call(void 0,r.TokenType.greaterThan),i.state.tokens[i.state.tokens.length-1].isType=!0)}e.tsIsDeclarationStart=function(){if(t.match.call(void 0,r.TokenType.name))switch(i.state.contextualKeyword){case n.ContextualKeyword._abstract:case n.ContextualKeyword._declare:case n.ContextualKeyword._enum:case n.ContextualKeyword._interface:case n.ContextualKeyword._module:case n.ContextualKeyword._namespace:case n.ContextualKeyword._type:return!0}return!1},e.tsParseFunctionBodyAndFinish=function(e,n){if(t.match.call(void 0,r.TokenType.colon)&&we(r.TokenType.colon),!t.match.call(void 0,r.TokenType.braceL)&&c.isLineTerminator.call(void 0)){let t=i.state.tokens.length-1;for(;t>=0&&(i.state.tokens[t].start>=e||i.state.tokens[t].type===r.TokenType._default||i.state.tokens[t].type===r.TokenType._export);)i.state.tokens[t].isType=!0,t--}else a.parseFunctionBody.call(void 0,!1,n)},e.tsParseSubscript=function(e,n,o){if(!c.hasPrecedingLineBreak.call(void 0)&&t.eat.call(void 0,r.TokenType.bang))i.state.tokens[i.state.tokens.length-1].type=r.TokenType.nonNullAssertion;else{if(t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.bitShiftL)){let o=i.state.snapshot();if(!n&&a.atPossibleAsync.call(void 0)&&Ye())return;if(Xe(),!n&&t.eat.call(void 0,r.TokenType.parenL)?(i.state.tokens[i.state.tokens.length-1].subscriptStartIndex=e,a.parseCallExpressionArguments.call(void 0)):t.match.call(void 0,r.TokenType.backQuote)?a.parseTemplate.call(void 0):(i.state.type===r.TokenType.greaterThan||i.state.type!==r.TokenType.parenL&&i.state.type&r.TokenType.IS_EXPRESSION_START&&!c.hasPrecedingLineBreak.call(void 0))&&c.unexpected.call(void 0),i.state.error)i.state.restoreFromSnapshot(o);else return}else!n&&t.match.call(void 0,r.TokenType.questionDot)&&t.lookaheadType.call(void 0)===r.TokenType.lessThan&&(t.next.call(void 0),i.state.tokens[e].isOptionalChainStart=!0,i.state.tokens[i.state.tokens.length-1].subscriptStartIndex=e,Ze(),c.expect.call(void 0,r.TokenType.parenL),a.parseCallExpressionArguments.call(void 0));a.baseParseSubscript.call(void 0,e,n,o)}},e.tsTryParseExport=function(){if(t.eat.call(void 0,r.TokenType._import))return c.isContextual.call(void 0,n.ContextualKeyword._type)&&t.lookaheadType.call(void 0)!==r.TokenType.eq&&c.expectContextual.call(void 0,n.ContextualKeyword._type),Ve(),!0;if(t.eat.call(void 0,r.TokenType.eq))return a.parseExpression.call(void 0),c.semicolon.call(void 0),!0;if(c.eatContextual.call(void 0,n.ContextualKeyword._as))return c.expectContextual.call(void 0,n.ContextualKeyword._namespace),a.parseIdentifier.call(void 0),c.semicolon.call(void 0),!0;if(c.isContextual.call(void 0,n.ContextualKeyword._type)){let e=t.lookaheadType.call(void 0);(e===r.TokenType.braceL||e===r.TokenType.star)&&t.next.call(void 0)}return!1},e.tsParseImportSpecifier=function(){a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ImportDeclaration:(a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?(i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ImportDeclaration,i.state.tokens[i.state.tokens.length-2].isType=!0,i.state.tokens[i.state.tokens.length-1].isType=!0):(a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?(i.state.tokens[i.state.tokens.length-3].identifierRole=t.IdentifierRole.ImportAccess,i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ImportDeclaration):(a.parseIdentifier.call(void 0),i.state.tokens[i.state.tokens.length-3].identifierRole=t.IdentifierRole.ImportAccess,i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ImportDeclaration,i.state.tokens[i.state.tokens.length-4].isType=!0,i.state.tokens[i.state.tokens.length-3].isType=!0,i.state.tokens[i.state.tokens.length-2].isType=!0,i.state.tokens[i.state.tokens.length-1].isType=!0)))},e.tsParseExportSpecifier=function(){a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ExportAccess:(a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?(i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ExportAccess,i.state.tokens[i.state.tokens.length-2].isType=!0,i.state.tokens[i.state.tokens.length-1].isType=!0):(a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?i.state.tokens[i.state.tokens.length-3].identifierRole=t.IdentifierRole.ExportAccess:(a.parseIdentifier.call(void 0),i.state.tokens[i.state.tokens.length-3].identifierRole=t.IdentifierRole.ExportAccess,i.state.tokens[i.state.tokens.length-4].isType=!0,i.state.tokens[i.state.tokens.length-3].isType=!0,i.state.tokens[i.state.tokens.length-2].isType=!0,i.state.tokens[i.state.tokens.length-1].isType=!0)))},e.tsTryParseExportDefaultExpression=function(){if(c.isContextual.call(void 0,n.ContextualKeyword._abstract)&&t.lookaheadType.call(void 0)===r.TokenType._class)return i.state.type=r.TokenType._abstract,t.next.call(void 0),s.parseClass.call(void 0,!0,!0),!0;if(c.isContextual.call(void 0,n.ContextualKeyword._interface)){let e=t.pushTypeContext.call(void 0,2);return qe(n.ContextualKeyword._interface,!0),t.popTypeContext.call(void 0,e),!0}return!1},e.tsTryParseStatementContent=function(){if(i.state.type===r.TokenType._const){let e=t.lookaheadTypeAndKeyword.call(void 0);if(e.type===r.TokenType.name&&e.contextualKeyword===n.ContextualKeyword._enum)return c.expect.call(void 0,r.TokenType._const),c.expectContextual.call(void 0,n.ContextualKeyword._enum),i.state.tokens[i.state.tokens.length-1].type=r.TokenType._enum,Le(),!0}return!1},e.tsTryParseClassMemberWithIsStatic=function(e){let t=i.state.tokens.length;p([n.ContextualKeyword._abstract,n.ContextualKeyword._readonly,n.ContextualKeyword._declare,n.ContextualKeyword._static,n.ContextualKeyword._override]);let r=i.state.tokens.length;if(E()){let n=e?t-1:t;for(let e=n;e<r;e++)i.state.tokens[e].isType=!0;return!0}return!1},e.tsParseIdentifierStatement=function(e){Ke(e)||c.semicolon.call(void 0)},e.tsParseExportDeclaration=function(){let e=c.eatContextual.call(void 0,n.ContextualKeyword._declare);e&&(i.state.tokens[i.state.tokens.length-1].type=r.TokenType._declare);let a=!1;if(t.match.call(void 0,r.TokenType.name)){if(e){let e=t.pushTypeContext.call(void 0,2);a=Ge(),t.popTypeContext.call(void 0,e)}else a=Ge()}if(!a){if(e){let e=t.pushTypeContext.call(void 0,2);s.parseStatement.call(void 0,!0),t.popTypeContext.call(void 0,e)}else s.parseStatement.call(void 0,!0)}},e.tsAfterParseClassSuper=function(e){if(e&&(t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.bitShiftL))&&Xe(),c.eatContextual.call(void 0,n.ContextualKeyword._implements)){i.state.tokens[i.state.tokens.length-1].type=r.TokenType._implements;let e=t.pushTypeContext.call(void 0,1);Me(),t.popTypeContext.call(void 0,e)}},e.tsStartParseObjPropValue=function(){S()},e.tsStartParseFunctionParams=function(){S()},e.tsAfterParseVarHead=function(){let e=t.pushTypeContext.call(void 0,0);c.hasPrecedingLineBreak.call(void 0)||t.eat.call(void 0,r.TokenType.bang),Ee(),t.popTypeContext.call(void 0,e)},e.tsStartParseAsyncArrowFromCallExpression=function(){t.match.call(void 0,r.TokenType.colon)&&ke()},e.tsParseMaybeAssign=function(e,t){return i.isJSXEnabled?Qe(e,t):$e(e,t)};function Qe(e,n){if(!t.match.call(void 0,r.TokenType.lessThan))return a.baseParseMaybeAssign.call(void 0,e,n);let o=i.state.snapshot(),s=a.baseParseMaybeAssign.call(void 0,e,n);if(i.state.error)i.state.restoreFromSnapshot(o);else return s;return i.state.type=r.TokenType.typeParameterStart,C(),s=a.baseParseMaybeAssign.call(void 0,e,n),s||c.unexpected.call(void 0),s}e.tsParseMaybeAssignWithJSX=Qe;function $e(e,n){if(!t.match.call(void 0,r.TokenType.lessThan))return a.baseParseMaybeAssign.call(void 0,e,n);let o=i.state.snapshot();C();let s=a.baseParseMaybeAssign.call(void 0,e,n);if(s||c.unexpected.call(void 0),i.state.error)i.state.restoreFromSnapshot(o);else return s;return a.baseParseMaybeAssign.call(void 0,e,n)}e.tsParseMaybeAssignWithoutJSX=$e,e.tsParseArrow=function(){if(t.match.call(void 0,r.TokenType.colon)){let e=i.state.snapshot();we(r.TokenType.colon),c.canInsertSemicolon.call(void 0)&&c.unexpected.call(void 0),t.match.call(void 0,r.TokenType.arrow)||c.unexpected.call(void 0),i.state.error&&i.state.restoreFromSnapshot(e)}return t.eat.call(void 0,r.TokenType.arrow)},e.tsParseAssignableListItemTypes=function(){let e=t.pushTypeContext.call(void 0,0);t.eat.call(void 0,r.TokenType.question),Ee(),t.popTypeContext.call(void 0,e)},e.tsParseMaybeDecoratorArguments=function(){(t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.bitShiftL))&&Xe(),s.baseParseMaybeDecoratorArguments.call(void 0)}})),Aw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ow(),n=G(),r=ew(),i=Mw(),a=tw(),o=$C(),s=rw(),c=kw();function l(){let e=!1,i=!1;for(;;){if(r.state.pos>=r.input.length){a.unexpected.call(void 0,`Unterminated JSX contents`);return}let s=r.input.charCodeAt(r.state.pos);if(s===o.charCodes.lessThan||s===o.charCodes.leftCurlyBrace){if(r.state.pos===r.state.start){if(s===o.charCodes.lessThan){r.state.pos++,t.finishToken.call(void 0,n.TokenType.jsxTagStart);return}t.getTokenFromCode.call(void 0,s);return}e&&!i?t.finishToken.call(void 0,n.TokenType.jsxEmptyText):t.finishToken.call(void 0,n.TokenType.jsxText);return}s===o.charCodes.lineFeed?e=!0:s!==o.charCodes.space&&s!==o.charCodes.carriageReturn&&s!==o.charCodes.tab&&(i=!0),r.state.pos++}}function u(e){for(r.state.pos++;;){if(r.state.pos>=r.input.length){a.unexpected.call(void 0,`Unterminated string constant`);return}if(r.input.charCodeAt(r.state.pos)===e){r.state.pos++;break}r.state.pos++}t.finishToken.call(void 0,n.TokenType.string)}function d(){let e;do{if(r.state.pos>r.input.length){a.unexpected.call(void 0,`Unexpectedly reached the end of input.`);return}e=r.input.charCodeAt(++r.state.pos)}while(s.IS_IDENTIFIER_CHAR[e]||e===o.charCodes.dash);t.finishToken.call(void 0,n.TokenType.jsxName)}function f(){x()}function p(e){f(),t.eat.call(void 0,n.TokenType.colon)?f():r.state.tokens[r.state.tokens.length-1].identifierRole=e}function m(){let e=r.state.tokens.length;p(t.IdentifierRole.Access);let i=!1;for(;t.match.call(void 0,n.TokenType.dot);)i=!0,x(),f();if(!i){let t=r.state.tokens[e],n=r.input.charCodeAt(t.start);n>=o.charCodes.lowercaseA&&n<=o.charCodes.lowercaseZ&&(t.identifierRole=null)}}function h(){switch(r.state.type){case n.TokenType.braceL:t.next.call(void 0),i.parseExpression.call(void 0),x();return;case n.TokenType.jsxTagStart:b(),x();return;case n.TokenType.string:x();return;default:a.unexpected.call(void 0,`JSX value should be either an expression or a quoted JSX text`)}}function g(){a.expect.call(void 0,n.TokenType.ellipsis),i.parseExpression.call(void 0)}function _(e){if(t.match.call(void 0,n.TokenType.jsxTagEnd))return!1;m(),r.isTypeScriptEnabled&&c.tsTryParseJSXTypeArgument.call(void 0);let s=!1;for(;!t.match.call(void 0,n.TokenType.slash)&&!t.match.call(void 0,n.TokenType.jsxTagEnd)&&!r.state.error;)t.eat.call(void 0,n.TokenType.braceL)?(s=!0,a.expect.call(void 0,n.TokenType.ellipsis),i.parseMaybeAssign.call(void 0),x()):(s&&r.state.end-r.state.start===3&&r.input.charCodeAt(r.state.start)===o.charCodes.lowercaseK&&r.input.charCodeAt(r.state.start+1)===o.charCodes.lowercaseE&&r.input.charCodeAt(r.state.start+2)===o.charCodes.lowercaseY&&(r.state.tokens[e].jsxRole=t.JSXRole.KeyAfterPropSpread),p(t.IdentifierRole.ObjectKey),t.match.call(void 0,n.TokenType.eq)&&(x(),h()));let l=t.match.call(void 0,n.TokenType.slash);return l&&x(),l}function v(){t.match.call(void 0,n.TokenType.jsxTagEnd)||m()}function y(){let e=r.state.tokens.length-1;r.state.tokens[e].jsxRole=t.JSXRole.NoChildren;let o=0;if(!_(e))for(S();;)switch(r.state.type){case n.TokenType.jsxTagStart:if(x(),t.match.call(void 0,n.TokenType.slash)){x(),v(),r.state.tokens[e].jsxRole!==t.JSXRole.KeyAfterPropSpread&&(o===1?r.state.tokens[e].jsxRole=t.JSXRole.OneChild:o>1&&(r.state.tokens[e].jsxRole=t.JSXRole.StaticChildren));return}o++,y(),S();break;case n.TokenType.jsxText:o++,S();break;case n.TokenType.jsxEmptyText:S();break;case n.TokenType.braceL:t.next.call(void 0),t.match.call(void 0,n.TokenType.ellipsis)?(g(),S(),o+=2):(t.match.call(void 0,n.TokenType.braceR)||(o++,i.parseExpression.call(void 0)),S());break;
|
|
664
664
|
// istanbul ignore next - should never happen
|
|
665
|
-
default:a.unexpected.call(void 0);return}}function b(){x(),y()}e.jsxParseElement=b;function x(){r.state.tokens.push(new t.Token),t.skipSpace.call(void 0),r.state.start=r.state.pos;let e=r.input.charCodeAt(r.state.pos);if(s.IS_IDENTIFIER_START[e])d();else if(e===o.charCodes.quotationMark||e===o.charCodes.apostrophe)u(e);else switch(++r.state.pos,e){case o.charCodes.greaterThan:t.finishToken.call(void 0,n.TokenType.jsxTagEnd);break;case o.charCodes.lessThan:t.finishToken.call(void 0,n.TokenType.jsxTagStart);break;case o.charCodes.slash:t.finishToken.call(void 0,n.TokenType.slash);break;case o.charCodes.equalsTo:t.finishToken.call(void 0,n.TokenType.eq);break;case o.charCodes.leftCurlyBrace:t.finishToken.call(void 0,n.TokenType.braceL);break;case o.charCodes.dot:t.finishToken.call(void 0,n.TokenType.dot);break;case o.charCodes.colon:t.finishToken.call(void 0,n.TokenType.colon);break;default:a.unexpected.call(void 0)}}e.nextJSXTagToken=x;function S(){r.state.tokens.push(new t.Token),r.state.start=r.state.pos,l()}})),Tw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ew(),n=G(),r=JC(),i=Ew(),a=Dw(),o=Cw();e.typedParseConditional=function(e){if(t.match.call(void 0,n.TokenType.question)){let e=t.lookaheadType.call(void 0);if(e===n.TokenType.colon||e===n.TokenType.comma||e===n.TokenType.parenR)return}i.baseParseConditional.call(void 0,e)},e.typedParseParenItem=function(){t.eatTypeToken.call(void 0,n.TokenType.question),t.match.call(void 0,n.TokenType.colon)&&(r.isTypeScriptEnabled?o.tsParseTypeAnnotation.call(void 0):r.isFlowEnabled&&a.flowParseTypeAnnotation.call(void 0))}})),Ew=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Dw(),n=ww(),r=Tw(),i=Cw(),a=ew(),o=GC(),s=KC(),c=G(),l=qC(),u=ZC(),d=JC(),f=Sw(),p=Ow(),m=YC(),h=class{constructor(e){this.stop=e}};e.StopState=h;function g(e=!1){if(_(e),a.match.call(void 0,c.TokenType.comma))for(;a.eat.call(void 0,c.TokenType.comma);)_(e)}e.parseExpression=g;function _(e=!1,n=!1){return d.isTypeScriptEnabled?i.tsParseMaybeAssign.call(void 0,e,n):d.isFlowEnabled?t.flowParseMaybeAssign.call(void 0,e,n):v(e,n)}e.parseMaybeAssign=_;function v(e,t){if(a.match.call(void 0,c.TokenType._yield))return k(),!1;(a.match.call(void 0,c.TokenType.parenL)||a.match.call(void 0,c.TokenType.name)||a.match.call(void 0,c.TokenType._yield))&&(d.state.potentialArrowAt=d.state.start);let n=y(e);return t&&O(),d.state.type&c.TokenType.IS_ASSIGN?(a.next.call(void 0),_(e),!1):n}e.baseParseMaybeAssign=v;function y(e){return S(e)?!0:(b(e),!1)}function b(e){d.isTypeScriptEnabled||d.isFlowEnabled?r.typedParseConditional.call(void 0,e):x(e)}function x(e){a.eat.call(void 0,c.TokenType.question)&&(_(),m.expect.call(void 0,c.TokenType.colon),_(e))}e.baseParseConditional=x;function S(e){let t=d.state.tokens.length;return w()?!0:(C(t,-1,e),!1)}function C(e,t,n){if(d.isTypeScriptEnabled&&(c.TokenType._in&c.TokenType.PRECEDENCE_MASK)>t&&!m.hasPrecedingLineBreak.call(void 0)&&(m.eatContextual.call(void 0,o.ContextualKeyword._as)||m.eatContextual.call(void 0,o.ContextualKeyword._satisfies))){let r=a.pushTypeContext.call(void 0,1);i.tsParseType.call(void 0),a.popTypeContext.call(void 0,r),a.rescan_gt.call(void 0),C(e,t,n);return}let r=d.state.type&c.TokenType.PRECEDENCE_MASK;if(r>0&&(!n||!a.match.call(void 0,c.TokenType._in))&&r>t){let i=d.state.type;a.next.call(void 0),i===c.TokenType.nullishCoalescing&&(d.state.tokens[d.state.tokens.length-1].nullishStartIndex=e);let o=d.state.tokens.length;w(),C(o,i&c.TokenType.IS_RIGHT_ASSOCIATIVE?r-1:r,n),i===c.TokenType.nullishCoalescing&&(d.state.tokens[e].numNullishCoalesceStarts++,d.state.tokens[d.state.tokens.length-1].numNullishCoalesceEnds++),C(e,t,n)}}function w(){if(d.isTypeScriptEnabled&&!d.isJSXEnabled&&a.eat.call(void 0,c.TokenType.lessThan))return i.tsParseTypeAssertion.call(void 0),!1;if(m.isContextual.call(void 0,o.ContextualKeyword._module)&&a.lookaheadCharCode.call(void 0)===l.charCodes.leftCurlyBrace&&!m.hasFollowingLineBreak.call(void 0))return je(),!1;if(d.state.type&c.TokenType.IS_PREFIX)return a.next.call(void 0),w(),!1;if(T())return!0;for(;d.state.type&c.TokenType.IS_POSTFIX&&!m.canInsertSemicolon.call(void 0);)d.state.type===c.TokenType.preIncDec&&(d.state.type=c.TokenType.postIncDec),a.next.call(void 0);return!1}e.parseMaybeUnary=w;function T(){let e=d.state.tokens.length;return ce()?!0:(ee(e),d.state.tokens.length>e&&d.state.tokens[e].isOptionalChainStart&&(d.state.tokens[d.state.tokens.length-1].isOptionalChainEnd=!0),!1)}e.parseExprSubscripts=T;function ee(e,n=!1){d.isFlowEnabled?t.flowParseSubscripts.call(void 0,e,n):te(e,n)}function te(e,t=!1){let n=new h(!1);do ne(e,t,n);while(!n.stop&&!d.state.error)}e.baseParseSubscripts=te;function ne(e,n,r){d.isTypeScriptEnabled?i.tsParseSubscript.call(void 0,e,n,r):d.isFlowEnabled?t.flowParseSubscript.call(void 0,e,n,r):re(e,n,r)}function re(e,t,n){if(!t&&a.eat.call(void 0,c.TokenType.doubleColon))se(),n.stop=!0,ee(e,t);else if(a.match.call(void 0,c.TokenType.questionDot)){if(d.state.tokens[e].isOptionalChainStart=!0,t&&a.lookaheadType.call(void 0)===c.TokenType.parenL){n.stop=!0;return}a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e,a.eat.call(void 0,c.TokenType.bracketL)?(g(),m.expect.call(void 0,c.TokenType.bracketR)):a.eat.call(void 0,c.TokenType.parenL)?E():D()}else if(a.eat.call(void 0,c.TokenType.dot))d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e,D();else if(a.eat.call(void 0,c.TokenType.bracketL))d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e,g(),m.expect.call(void 0,c.TokenType.bracketR);else if(!t&&a.match.call(void 0,c.TokenType.parenL)){if(ie()){let t=d.state.snapshot(),r=d.state.tokens.length;a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e;let i=d.getNextContextId.call(void 0);d.state.tokens[d.state.tokens.length-1].contextId=i,E(),d.state.tokens[d.state.tokens.length-1].contextId=i,ae()&&(d.state.restoreFromSnapshot(t),n.stop=!0,d.state.scopeDepth++,p.parseFunctionParams.call(void 0),oe(r))}else{a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e;let t=d.getNextContextId.call(void 0);d.state.tokens[d.state.tokens.length-1].contextId=t,E(),d.state.tokens[d.state.tokens.length-1].contextId=t}}else a.match.call(void 0,c.TokenType.backQuote)?ge():n.stop=!0}e.baseParseSubscript=re;function ie(){return d.state.tokens[d.state.tokens.length-1].contextualKeyword===o.ContextualKeyword._async&&!m.canInsertSemicolon.call(void 0)}e.atPossibleAsync=ie;function E(){let e=!0;for(;!a.eat.call(void 0,c.TokenType.parenR)&&!d.state.error;){if(e)e=!1;else if(m.expect.call(void 0,c.TokenType.comma),a.eat.call(void 0,c.TokenType.parenR))break;Oe(!1)}}e.parseCallExpressionArguments=E;function ae(){return a.match.call(void 0,c.TokenType.colon)||a.match.call(void 0,c.TokenType.arrow)}function oe(e){d.isTypeScriptEnabled?i.tsStartParseAsyncArrowFromCallExpression.call(void 0):d.isFlowEnabled&&t.flowStartParseAsyncArrowFromCallExpression.call(void 0),m.expect.call(void 0,c.TokenType.arrow),we(e)}function se(){let e=d.state.tokens.length;ce(),ee(e,!0)}function ce(){if(a.eat.call(void 0,c.TokenType.modulo))return ke(),!1;if(a.match.call(void 0,c.TokenType.jsxText)||a.match.call(void 0,c.TokenType.jsxEmptyText))return ue(),!1;if(a.match.call(void 0,c.TokenType.lessThan)&&d.isJSXEnabled)return d.state.type=c.TokenType.jsxTagStart,n.jsxParseElement.call(void 0),a.next.call(void 0),!1;let e=d.state.potentialArrowAt===d.state.start;switch(d.state.type){case c.TokenType.slash:case c.TokenType.assign:a.retokenizeSlashAsRegex.call(void 0);case c.TokenType._super:case c.TokenType._this:case c.TokenType.regexp:case c.TokenType.num:case c.TokenType.bigint:case c.TokenType.decimal:case c.TokenType.string:case c.TokenType._null:case c.TokenType._true:case c.TokenType._false:return a.next.call(void 0),!1;case c.TokenType._import:return a.next.call(void 0),a.match.call(void 0,c.TokenType.dot)&&(d.state.tokens[d.state.tokens.length-1].type=c.TokenType.name,a.next.call(void 0),ke()),!1;case c.TokenType.name:{let t=d.state.tokens.length,n=d.state.start,r=d.state.contextualKeyword;return ke(),r===o.ContextualKeyword._await?(Ae(),!1):r===o.ContextualKeyword._async&&a.match.call(void 0,c.TokenType._function)&&!m.canInsertSemicolon.call(void 0)?(a.next.call(void 0),p.parseFunction.call(void 0,n,!1),!1):e&&r===o.ContextualKeyword._async&&!m.canInsertSemicolon.call(void 0)&&a.match.call(void 0,c.TokenType.name)?(d.state.scopeDepth++,f.parseBindingIdentifier.call(void 0,!1),m.expect.call(void 0,c.TokenType.arrow),we(t),!0):a.match.call(void 0,c.TokenType._do)&&!m.canInsertSemicolon.call(void 0)?(a.next.call(void 0),p.parseBlock.call(void 0),!1):e&&!m.canInsertSemicolon.call(void 0)&&a.match.call(void 0,c.TokenType.arrow)?(d.state.scopeDepth++,f.markPriorBindingIdentifier.call(void 0,!1),m.expect.call(void 0,c.TokenType.arrow),we(t),!0):(d.state.tokens[d.state.tokens.length-1].identifierRole=a.IdentifierRole.Access,!1)}case c.TokenType._do:return a.next.call(void 0),p.parseBlock.call(void 0),!1;case c.TokenType.parenL:return de(e);case c.TokenType.bracketL:return a.next.call(void 0),De(c.TokenType.bracketR,!0),!1;case c.TokenType.braceL:return _e(!1,!1),!1;case c.TokenType._function:return le(),!1;case c.TokenType.at:p.parseDecorators.call(void 0);case c.TokenType._class:return p.parseClass.call(void 0,!1),!1;case c.TokenType._new:return me(),!1;case c.TokenType.backQuote:return ge(),!1;case c.TokenType.doubleColon:return a.next.call(void 0),se(),!1;case c.TokenType.hash:{let e=a.lookaheadCharCode.call(void 0);return u.IS_IDENTIFIER_START[e]||e===l.charCodes.backslash?D():a.next.call(void 0),!1}default:return m.unexpected.call(void 0),!1}}e.parseExprAtom=ce;function D(){a.eat.call(void 0,c.TokenType.hash),ke()}function le(){let e=d.state.start;ke(),a.eat.call(void 0,c.TokenType.dot)&&ke(),p.parseFunction.call(void 0,e,!1)}function ue(){a.next.call(void 0)}e.parseLiteral=ue,e.parseParenExpression=function(){m.expect.call(void 0,c.TokenType.parenL),g(),m.expect.call(void 0,c.TokenType.parenR)};function de(e){let t=d.state.snapshot(),n=d.state.tokens.length;m.expect.call(void 0,c.TokenType.parenL);let r=!0;for(;!a.match.call(void 0,c.TokenType.parenR)&&!d.state.error;){if(r)r=!1;else if(m.expect.call(void 0,c.TokenType.comma),a.match.call(void 0,c.TokenType.parenR))break;if(a.match.call(void 0,c.TokenType.ellipsis)){f.parseRest.call(void 0,!1),O();break}_(!1,!0)}return m.expect.call(void 0,c.TokenType.parenR),e&&fe()&&pe()?(d.state.restoreFromSnapshot(t),d.state.scopeDepth++,p.parseFunctionParams.call(void 0),pe(),we(n),!d.state.error||(d.state.restoreFromSnapshot(t),de(!1),!1)):!1}function fe(){return a.match.call(void 0,c.TokenType.colon)||!m.canInsertSemicolon.call(void 0)}function pe(){return d.isTypeScriptEnabled?i.tsParseArrow.call(void 0):d.isFlowEnabled?t.flowParseArrow.call(void 0):a.eat.call(void 0,c.TokenType.arrow)}e.parseArrow=pe;function O(){(d.isTypeScriptEnabled||d.isFlowEnabled)&&r.typedParseParenItem.call(void 0)}function me(){m.expect.call(void 0,c.TokenType._new),a.eat.call(void 0,c.TokenType.dot)?ke():(he(),d.isFlowEnabled&&t.flowStartParseNewArguments.call(void 0),a.eat.call(void 0,c.TokenType.parenL)&&De(c.TokenType.parenR))}function he(){se(),a.eat.call(void 0,c.TokenType.questionDot)}function ge(){for(a.nextTemplateToken.call(void 0),a.nextTemplateToken.call(void 0);!a.match.call(void 0,c.TokenType.backQuote)&&!d.state.error;)m.expect.call(void 0,c.TokenType.dollarBraceL),g(),a.nextTemplateToken.call(void 0),a.nextTemplateToken.call(void 0);a.next.call(void 0)}e.parseTemplate=ge;function _e(e,t){let n=d.getNextContextId.call(void 0),r=!0;for(a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].contextId=n;!a.eat.call(void 0,c.TokenType.braceR)&&!d.state.error;){if(r)r=!1;else if(m.expect.call(void 0,c.TokenType.comma),a.eat.call(void 0,c.TokenType.braceR))break;let i=!1;if(a.match.call(void 0,c.TokenType.ellipsis)){let n=d.state.tokens.length;if(f.parseSpread.call(void 0),e&&(d.state.tokens.length===n+2&&f.markPriorBindingIdentifier.call(void 0,t),a.eat.call(void 0,c.TokenType.braceR)))break}else e||(i=a.eat.call(void 0,c.TokenType.star)),!e&&m.isContextual.call(void 0,o.ContextualKeyword._async)?(i&&m.unexpected.call(void 0),ke(),a.match.call(void 0,c.TokenType.colon)||a.match.call(void 0,c.TokenType.parenL)||a.match.call(void 0,c.TokenType.braceR)||a.match.call(void 0,c.TokenType.eq)||a.match.call(void 0,c.TokenType.comma)||(a.match.call(void 0,c.TokenType.star)&&(a.next.call(void 0),i=!0),Se(n))):Se(n),xe(e,t,n)}d.state.tokens[d.state.tokens.length-1].contextId=n}e.parseObj=_e;function ve(e){return!e&&(a.match.call(void 0,c.TokenType.string)||a.match.call(void 0,c.TokenType.num)||a.match.call(void 0,c.TokenType.bracketL)||a.match.call(void 0,c.TokenType.name)||!!(d.state.type&c.TokenType.IS_KEYWORD))}function ye(e,t){let n=d.state.start;return a.match.call(void 0,c.TokenType.parenL)?(e&&m.unexpected.call(void 0),Ce(n,!1),!0):ve(e)?(Se(t),Ce(n,!1),!0):!1}function be(e,t){if(a.eat.call(void 0,c.TokenType.colon)){e?f.parseMaybeDefault.call(void 0,t):_(!1);return}let n;n=e?d.state.scopeDepth===0?a.IdentifierRole.ObjectShorthandTopLevelDeclaration:t?a.IdentifierRole.ObjectShorthandBlockScopedDeclaration:a.IdentifierRole.ObjectShorthandFunctionScopedDeclaration:a.IdentifierRole.ObjectShorthand,d.state.tokens[d.state.tokens.length-1].identifierRole=n,f.parseMaybeDefault.call(void 0,t,!0)}function xe(e,n,r){d.isTypeScriptEnabled?i.tsStartParseObjPropValue.call(void 0):d.isFlowEnabled&&t.flowStartParseObjPropValue.call(void 0),ye(e,r)||be(e,n)}function Se(e){d.isFlowEnabled&&t.flowParseVariance.call(void 0),a.eat.call(void 0,c.TokenType.bracketL)?(d.state.tokens[d.state.tokens.length-1].contextId=e,_(),m.expect.call(void 0,c.TokenType.bracketR),d.state.tokens[d.state.tokens.length-1].contextId=e):(a.match.call(void 0,c.TokenType.num)||a.match.call(void 0,c.TokenType.string)||a.match.call(void 0,c.TokenType.bigint)||a.match.call(void 0,c.TokenType.decimal)?ce():D(),d.state.tokens[d.state.tokens.length-1].identifierRole=a.IdentifierRole.ObjectKey,d.state.tokens[d.state.tokens.length-1].contextId=e)}e.parsePropertyName=Se;function Ce(e,t){let n=d.getNextContextId.call(void 0);d.state.scopeDepth++;let r=d.state.tokens.length,i=t;p.parseFunctionParams.call(void 0,i,n),Te(e,n);let a=d.state.tokens.length;d.state.scopes.push(new s.Scope(r,a,!0)),d.state.scopeDepth--}e.parseMethod=Ce;function we(e){Ee(!0);let t=d.state.tokens.length;d.state.scopes.push(new s.Scope(e,t,!0)),d.state.scopeDepth--}e.parseArrowExpression=we;function Te(e,n=0){d.isTypeScriptEnabled?i.tsParseFunctionBodyAndFinish.call(void 0,e,n):d.isFlowEnabled?t.flowParseFunctionBodyAndFinish.call(void 0,n):Ee(!1,n)}e.parseFunctionBodyAndFinish=Te;function Ee(e,t=0){e&&!a.match.call(void 0,c.TokenType.braceL)?_():p.parseBlock.call(void 0,!0,t)}e.parseFunctionBody=Ee;function De(e,t=!1){let n=!0;for(;!a.eat.call(void 0,e)&&!d.state.error;){if(n)n=!1;else if(m.expect.call(void 0,c.TokenType.comma),a.eat.call(void 0,e))break;Oe(t)}}function Oe(e){e&&a.match.call(void 0,c.TokenType.comma)||(a.match.call(void 0,c.TokenType.ellipsis)?(f.parseSpread.call(void 0),O()):a.match.call(void 0,c.TokenType.question)?a.next.call(void 0):_(!1,!0))}function ke(){a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].type=c.TokenType.name}e.parseIdentifier=ke;function Ae(){w()}function k(){a.next.call(void 0),!a.match.call(void 0,c.TokenType.semi)&&!m.canInsertSemicolon.call(void 0)&&(a.eat.call(void 0,c.TokenType.star),_())}function je(){m.expectContextual.call(void 0,o.ContextualKeyword._module),m.expect.call(void 0,c.TokenType.braceL),p.parseBlockBody.call(void 0,c.TokenType.braceR)}})),Dw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ew(),n=GC(),r=G(),i=JC(),a=Ew(),o=Ow(),s=YC();function c(e){return(e.type===r.TokenType.name||!!(e.type&r.TokenType.IS_KEYWORD))&&e.contextualKeyword!==n.ContextualKeyword._from}function l(e){let n=t.pushTypeContext.call(void 0,0);s.expect.call(void 0,e||r.TokenType.colon),Ce(),t.popTypeContext.call(void 0,n)}function u(){s.expect.call(void 0,r.TokenType.modulo),s.expectContextual.call(void 0,n.ContextualKeyword._checks),t.eat.call(void 0,r.TokenType.parenL)&&(a.parseExpression.call(void 0),s.expect.call(void 0,r.TokenType.parenR))}function d(){let e=t.pushTypeContext.call(void 0,0);s.expect.call(void 0,r.TokenType.colon),t.match.call(void 0,r.TokenType.modulo)?u():(Ce(),t.match.call(void 0,r.TokenType.modulo)&&u()),t.popTypeContext.call(void 0,e)}function f(){t.next.call(void 0),S(!0)}function p(){t.next.call(void 0),a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.lessThan)&&re(),s.expect.call(void 0,r.TokenType.parenL),ge(),s.expect.call(void 0,r.TokenType.parenR),d(),s.semicolon.call(void 0)}function m(){t.match.call(void 0,r.TokenType._class)?f():t.match.call(void 0,r.TokenType._function)?p():t.match.call(void 0,r.TokenType._var)?h():s.eatContextual.call(void 0,n.ContextualKeyword._module)?t.eat.call(void 0,r.TokenType.dot)?v():g():s.isContextual.call(void 0,n.ContextualKeyword._type)?y():s.isContextual.call(void 0,n.ContextualKeyword._opaque)?b():s.isContextual.call(void 0,n.ContextualKeyword._interface)?x():t.match.call(void 0,r.TokenType._export)?_():s.unexpected.call(void 0)}function h(){t.next.call(void 0),Te(),s.semicolon.call(void 0)}function g(){for(t.match.call(void 0,r.TokenType.string)?a.parseExprAtom.call(void 0):a.parseIdentifier.call(void 0),s.expect.call(void 0,r.TokenType.braceL);!t.match.call(void 0,r.TokenType.braceR)&&!i.state.error;)t.match.call(void 0,r.TokenType._import)?(t.next.call(void 0),o.parseImport.call(void 0)):s.unexpected.call(void 0);s.expect.call(void 0,r.TokenType.braceR)}function _(){s.expect.call(void 0,r.TokenType._export),t.eat.call(void 0,r.TokenType._default)?t.match.call(void 0,r.TokenType._function)||t.match.call(void 0,r.TokenType._class)?m():(Ce(),s.semicolon.call(void 0)):t.match.call(void 0,r.TokenType._var)||t.match.call(void 0,r.TokenType._function)||t.match.call(void 0,r.TokenType._class)||s.isContextual.call(void 0,n.ContextualKeyword._opaque)?m():t.match.call(void 0,r.TokenType.star)||t.match.call(void 0,r.TokenType.braceL)||s.isContextual.call(void 0,n.ContextualKeyword._interface)||s.isContextual.call(void 0,n.ContextualKeyword._type)||s.isContextual.call(void 0,n.ContextualKeyword._opaque)?o.parseExport.call(void 0):s.unexpected.call(void 0)}function v(){s.expectContextual.call(void 0,n.ContextualKeyword._exports),we(),s.semicolon.call(void 0)}function y(){t.next.call(void 0),ee()}function b(){t.next.call(void 0),te(!0)}function x(){t.next.call(void 0),S()}function S(e=!1){if(T(),t.match.call(void 0,r.TokenType.lessThan)&&re(),t.eat.call(void 0,r.TokenType._extends))do C();while(!e&&t.eat.call(void 0,r.TokenType.comma));if(s.isContextual.call(void 0,n.ContextualKeyword._mixins)){t.next.call(void 0);do C();while(t.eat.call(void 0,r.TokenType.comma))}if(s.isContextual.call(void 0,n.ContextualKeyword._implements)){t.next.call(void 0);do C();while(t.eat.call(void 0,r.TokenType.comma))}le(e,!1,e)}function C(){fe(!1),t.match.call(void 0,r.TokenType.lessThan)&&ie()}function w(){S()}function T(){a.parseIdentifier.call(void 0)}function ee(){T(),t.match.call(void 0,r.TokenType.lessThan)&&re(),l(r.TokenType.eq),s.semicolon.call(void 0)}function te(e){s.expectContextual.call(void 0,n.ContextualKeyword._type),T(),t.match.call(void 0,r.TokenType.lessThan)&&re(),t.match.call(void 0,r.TokenType.colon)&&l(r.TokenType.colon),e||l(r.TokenType.eq),s.semicolon.call(void 0)}function ne(){Ee(),Te(),t.eat.call(void 0,r.TokenType.eq)&&Ce()}function re(){let e=t.pushTypeContext.call(void 0,0);
|
|
665
|
+
default:a.unexpected.call(void 0);return}}function b(){x(),y()}e.jsxParseElement=b;function x(){r.state.tokens.push(new t.Token),t.skipSpace.call(void 0),r.state.start=r.state.pos;let e=r.input.charCodeAt(r.state.pos);if(s.IS_IDENTIFIER_START[e])d();else if(e===o.charCodes.quotationMark||e===o.charCodes.apostrophe)u(e);else switch(++r.state.pos,e){case o.charCodes.greaterThan:t.finishToken.call(void 0,n.TokenType.jsxTagEnd);break;case o.charCodes.lessThan:t.finishToken.call(void 0,n.TokenType.jsxTagStart);break;case o.charCodes.slash:t.finishToken.call(void 0,n.TokenType.slash);break;case o.charCodes.equalsTo:t.finishToken.call(void 0,n.TokenType.eq);break;case o.charCodes.leftCurlyBrace:t.finishToken.call(void 0,n.TokenType.braceL);break;case o.charCodes.dot:t.finishToken.call(void 0,n.TokenType.dot);break;case o.charCodes.colon:t.finishToken.call(void 0,n.TokenType.colon);break;default:a.unexpected.call(void 0)}}e.nextJSXTagToken=x;function S(){r.state.tokens.push(new t.Token),r.state.start=r.state.pos,l()}})),jw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ow(),n=G(),r=ew(),i=Mw(),a=Nw(),o=kw();e.typedParseConditional=function(e){if(t.match.call(void 0,n.TokenType.question)){let e=t.lookaheadType.call(void 0);if(e===n.TokenType.colon||e===n.TokenType.comma||e===n.TokenType.parenR)return}i.baseParseConditional.call(void 0,e)},e.typedParseParenItem=function(){t.eatTypeToken.call(void 0,n.TokenType.question),t.match.call(void 0,n.TokenType.colon)&&(r.isTypeScriptEnabled?o.tsParseTypeAnnotation.call(void 0):r.isFlowEnabled&&a.flowParseTypeAnnotation.call(void 0))}})),Mw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Nw(),n=Aw(),r=jw(),i=kw(),a=ow(),o=ZC(),s=QC(),c=G(),l=$C(),u=rw(),d=ew(),f=Ow(),p=Pw(),m=tw(),h=class{constructor(e){this.stop=e}};e.StopState=h;function g(e=!1){if(_(e),a.match.call(void 0,c.TokenType.comma))for(;a.eat.call(void 0,c.TokenType.comma);)_(e)}e.parseExpression=g;function _(e=!1,n=!1){return d.isTypeScriptEnabled?i.tsParseMaybeAssign.call(void 0,e,n):d.isFlowEnabled?t.flowParseMaybeAssign.call(void 0,e,n):v(e,n)}e.parseMaybeAssign=_;function v(e,t){if(a.match.call(void 0,c.TokenType._yield))return A(),!1;(a.match.call(void 0,c.TokenType.parenL)||a.match.call(void 0,c.TokenType.name)||a.match.call(void 0,c.TokenType._yield))&&(d.state.potentialArrowAt=d.state.start);let n=y(e);return t&&k(),d.state.type&c.TokenType.IS_ASSIGN?(a.next.call(void 0),_(e),!1):n}e.baseParseMaybeAssign=v;function y(e){return S(e)?!0:(b(e),!1)}function b(e){d.isTypeScriptEnabled||d.isFlowEnabled?r.typedParseConditional.call(void 0,e):x(e)}function x(e){a.eat.call(void 0,c.TokenType.question)&&(_(),m.expect.call(void 0,c.TokenType.colon),_(e))}e.baseParseConditional=x;function S(e){let t=d.state.tokens.length;return w()?!0:(C(t,-1,e),!1)}function C(e,t,n){if(d.isTypeScriptEnabled&&(c.TokenType._in&c.TokenType.PRECEDENCE_MASK)>t&&!m.hasPrecedingLineBreak.call(void 0)&&(m.eatContextual.call(void 0,o.ContextualKeyword._as)||m.eatContextual.call(void 0,o.ContextualKeyword._satisfies))){let r=a.pushTypeContext.call(void 0,1);i.tsParseType.call(void 0),a.popTypeContext.call(void 0,r),a.rescan_gt.call(void 0),C(e,t,n);return}let r=d.state.type&c.TokenType.PRECEDENCE_MASK;if(r>0&&(!n||!a.match.call(void 0,c.TokenType._in))&&r>t){let i=d.state.type;a.next.call(void 0),i===c.TokenType.nullishCoalescing&&(d.state.tokens[d.state.tokens.length-1].nullishStartIndex=e);let o=d.state.tokens.length;w(),C(o,i&c.TokenType.IS_RIGHT_ASSOCIATIVE?r-1:r,n),i===c.TokenType.nullishCoalescing&&(d.state.tokens[e].numNullishCoalesceStarts++,d.state.tokens[d.state.tokens.length-1].numNullishCoalesceEnds++),C(e,t,n)}}function w(){if(d.isTypeScriptEnabled&&!d.isJSXEnabled&&a.eat.call(void 0,c.TokenType.lessThan))return i.tsParseTypeAssertion.call(void 0),!1;if(m.isContextual.call(void 0,o.ContextualKeyword._module)&&a.lookaheadCharCode.call(void 0)===l.charCodes.leftCurlyBrace&&!m.hasFollowingLineBreak.call(void 0))return Ae(),!1;if(d.state.type&c.TokenType.IS_PREFIX)return a.next.call(void 0),w(),!1;if(T())return!0;for(;d.state.type&c.TokenType.IS_POSTFIX&&!m.canInsertSemicolon.call(void 0);)d.state.type===c.TokenType.preIncDec&&(d.state.type=c.TokenType.postIncDec),a.next.call(void 0);return!1}e.parseMaybeUnary=w;function T(){let e=d.state.tokens.length;return se()?!0:(ee(e),d.state.tokens.length>e&&d.state.tokens[e].isOptionalChainStart&&(d.state.tokens[d.state.tokens.length-1].isOptionalChainEnd=!0),!1)}e.parseExprSubscripts=T;function ee(e,n=!1){d.isFlowEnabled?t.flowParseSubscripts.call(void 0,e,n):te(e,n)}function te(e,t=!1){let n=new h(!1);do ne(e,t,n);while(!n.stop&&!d.state.error)}e.baseParseSubscripts=te;function ne(e,n,r){d.isTypeScriptEnabled?i.tsParseSubscript.call(void 0,e,n,r):d.isFlowEnabled?t.flowParseSubscript.call(void 0,e,n,r):E(e,n,r)}function E(e,t,n){if(!t&&a.eat.call(void 0,c.TokenType.doubleColon))oe(),n.stop=!0,ee(e,t);else if(a.match.call(void 0,c.TokenType.questionDot)){if(d.state.tokens[e].isOptionalChainStart=!0,t&&a.lookaheadType.call(void 0)===c.TokenType.parenL){n.stop=!0;return}a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e,a.eat.call(void 0,c.TokenType.bracketL)?(g(),m.expect.call(void 0,c.TokenType.bracketR)):a.eat.call(void 0,c.TokenType.parenL)?D():O()}else if(a.eat.call(void 0,c.TokenType.dot))d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e,O();else if(a.eat.call(void 0,c.TokenType.bracketL))d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e,g(),m.expect.call(void 0,c.TokenType.bracketR);else if(!t&&a.match.call(void 0,c.TokenType.parenL)){if(re()){let t=d.state.snapshot(),r=d.state.tokens.length;a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e;let i=d.getNextContextId.call(void 0);d.state.tokens[d.state.tokens.length-1].contextId=i,D(),d.state.tokens[d.state.tokens.length-1].contextId=i,ie()&&(d.state.restoreFromSnapshot(t),n.stop=!0,d.state.scopeDepth++,p.parseFunctionParams.call(void 0),ae(r))}else{a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e;let t=d.getNextContextId.call(void 0);d.state.tokens[d.state.tokens.length-1].contextId=t,D(),d.state.tokens[d.state.tokens.length-1].contextId=t}}else a.match.call(void 0,c.TokenType.backQuote)?he():n.stop=!0}e.baseParseSubscript=E;function re(){return d.state.tokens[d.state.tokens.length-1].contextualKeyword===o.ContextualKeyword._async&&!m.canInsertSemicolon.call(void 0)}e.atPossibleAsync=re;function D(){let e=!0;for(;!a.eat.call(void 0,c.TokenType.parenR)&&!d.state.error;){if(e)e=!1;else if(m.expect.call(void 0,c.TokenType.comma),a.eat.call(void 0,c.TokenType.parenR))break;De(!1)}}e.parseCallExpressionArguments=D;function ie(){return a.match.call(void 0,c.TokenType.colon)||a.match.call(void 0,c.TokenType.arrow)}function ae(e){d.isTypeScriptEnabled?i.tsStartParseAsyncArrowFromCallExpression.call(void 0):d.isFlowEnabled&&t.flowStartParseAsyncArrowFromCallExpression.call(void 0),m.expect.call(void 0,c.TokenType.arrow),Ce(e)}function oe(){let e=d.state.tokens.length;se(),ee(e,!0)}function se(){if(a.eat.call(void 0,c.TokenType.modulo))return Oe(),!1;if(a.match.call(void 0,c.TokenType.jsxText)||a.match.call(void 0,c.TokenType.jsxEmptyText))return le(),!1;if(a.match.call(void 0,c.TokenType.lessThan)&&d.isJSXEnabled)return d.state.type=c.TokenType.jsxTagStart,n.jsxParseElement.call(void 0),a.next.call(void 0),!1;let e=d.state.potentialArrowAt===d.state.start;switch(d.state.type){case c.TokenType.slash:case c.TokenType.assign:a.retokenizeSlashAsRegex.call(void 0);case c.TokenType._super:case c.TokenType._this:case c.TokenType.regexp:case c.TokenType.num:case c.TokenType.bigint:case c.TokenType.decimal:case c.TokenType.string:case c.TokenType._null:case c.TokenType._true:case c.TokenType._false:return a.next.call(void 0),!1;case c.TokenType._import:return a.next.call(void 0),a.match.call(void 0,c.TokenType.dot)&&(d.state.tokens[d.state.tokens.length-1].type=c.TokenType.name,a.next.call(void 0),Oe()),!1;case c.TokenType.name:{let t=d.state.tokens.length,n=d.state.start,r=d.state.contextualKeyword;return Oe(),r===o.ContextualKeyword._await?(ke(),!1):r===o.ContextualKeyword._async&&a.match.call(void 0,c.TokenType._function)&&!m.canInsertSemicolon.call(void 0)?(a.next.call(void 0),p.parseFunction.call(void 0,n,!1),!1):e&&r===o.ContextualKeyword._async&&!m.canInsertSemicolon.call(void 0)&&a.match.call(void 0,c.TokenType.name)?(d.state.scopeDepth++,f.parseBindingIdentifier.call(void 0,!1),m.expect.call(void 0,c.TokenType.arrow),Ce(t),!0):a.match.call(void 0,c.TokenType._do)&&!m.canInsertSemicolon.call(void 0)?(a.next.call(void 0),p.parseBlock.call(void 0),!1):e&&!m.canInsertSemicolon.call(void 0)&&a.match.call(void 0,c.TokenType.arrow)?(d.state.scopeDepth++,f.markPriorBindingIdentifier.call(void 0,!1),m.expect.call(void 0,c.TokenType.arrow),Ce(t),!0):(d.state.tokens[d.state.tokens.length-1].identifierRole=a.IdentifierRole.Access,!1)}case c.TokenType._do:return a.next.call(void 0),p.parseBlock.call(void 0),!1;case c.TokenType.parenL:return ue(e);case c.TokenType.bracketL:return a.next.call(void 0),Ee(c.TokenType.bracketR,!0),!1;case c.TokenType.braceL:return ge(!1,!1),!1;case c.TokenType._function:return ce(),!1;case c.TokenType.at:p.parseDecorators.call(void 0);case c.TokenType._class:return p.parseClass.call(void 0,!1),!1;case c.TokenType._new:return pe(),!1;case c.TokenType.backQuote:return he(),!1;case c.TokenType.doubleColon:return a.next.call(void 0),oe(),!1;case c.TokenType.hash:{let e=a.lookaheadCharCode.call(void 0);return u.IS_IDENTIFIER_START[e]||e===l.charCodes.backslash?O():a.next.call(void 0),!1}default:return m.unexpected.call(void 0),!1}}e.parseExprAtom=se;function O(){a.eat.call(void 0,c.TokenType.hash),Oe()}function ce(){let e=d.state.start;Oe(),a.eat.call(void 0,c.TokenType.dot)&&Oe(),p.parseFunction.call(void 0,e,!1)}function le(){a.next.call(void 0)}e.parseLiteral=le,e.parseParenExpression=function(){m.expect.call(void 0,c.TokenType.parenL),g(),m.expect.call(void 0,c.TokenType.parenR)};function ue(e){let t=d.state.snapshot(),n=d.state.tokens.length;m.expect.call(void 0,c.TokenType.parenL);let r=!0;for(;!a.match.call(void 0,c.TokenType.parenR)&&!d.state.error;){if(r)r=!1;else if(m.expect.call(void 0,c.TokenType.comma),a.match.call(void 0,c.TokenType.parenR))break;if(a.match.call(void 0,c.TokenType.ellipsis)){f.parseRest.call(void 0,!1),k();break}_(!1,!0)}return m.expect.call(void 0,c.TokenType.parenR),e&&de()&&fe()?(d.state.restoreFromSnapshot(t),d.state.scopeDepth++,p.parseFunctionParams.call(void 0),fe(),Ce(n),!d.state.error||(d.state.restoreFromSnapshot(t),ue(!1),!1)):!1}function de(){return a.match.call(void 0,c.TokenType.colon)||!m.canInsertSemicolon.call(void 0)}function fe(){return d.isTypeScriptEnabled?i.tsParseArrow.call(void 0):d.isFlowEnabled?t.flowParseArrow.call(void 0):a.eat.call(void 0,c.TokenType.arrow)}e.parseArrow=fe;function k(){(d.isTypeScriptEnabled||d.isFlowEnabled)&&r.typedParseParenItem.call(void 0)}function pe(){m.expect.call(void 0,c.TokenType._new),a.eat.call(void 0,c.TokenType.dot)?Oe():(me(),d.isFlowEnabled&&t.flowStartParseNewArguments.call(void 0),a.eat.call(void 0,c.TokenType.parenL)&&Ee(c.TokenType.parenR))}function me(){oe(),a.eat.call(void 0,c.TokenType.questionDot)}function he(){for(a.nextTemplateToken.call(void 0),a.nextTemplateToken.call(void 0);!a.match.call(void 0,c.TokenType.backQuote)&&!d.state.error;)m.expect.call(void 0,c.TokenType.dollarBraceL),g(),a.nextTemplateToken.call(void 0),a.nextTemplateToken.call(void 0);a.next.call(void 0)}e.parseTemplate=he;function ge(e,t){let n=d.getNextContextId.call(void 0),r=!0;for(a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].contextId=n;!a.eat.call(void 0,c.TokenType.braceR)&&!d.state.error;){if(r)r=!1;else if(m.expect.call(void 0,c.TokenType.comma),a.eat.call(void 0,c.TokenType.braceR))break;let i=!1;if(a.match.call(void 0,c.TokenType.ellipsis)){let n=d.state.tokens.length;if(f.parseSpread.call(void 0),e&&(d.state.tokens.length===n+2&&f.markPriorBindingIdentifier.call(void 0,t),a.eat.call(void 0,c.TokenType.braceR)))break}else e||(i=a.eat.call(void 0,c.TokenType.star)),!e&&m.isContextual.call(void 0,o.ContextualKeyword._async)?(i&&m.unexpected.call(void 0),Oe(),a.match.call(void 0,c.TokenType.colon)||a.match.call(void 0,c.TokenType.parenL)||a.match.call(void 0,c.TokenType.braceR)||a.match.call(void 0,c.TokenType.eq)||a.match.call(void 0,c.TokenType.comma)||(a.match.call(void 0,c.TokenType.star)&&(a.next.call(void 0),i=!0),xe(n))):xe(n),be(e,t,n)}d.state.tokens[d.state.tokens.length-1].contextId=n}e.parseObj=ge;function _e(e){return!e&&(a.match.call(void 0,c.TokenType.string)||a.match.call(void 0,c.TokenType.num)||a.match.call(void 0,c.TokenType.bracketL)||a.match.call(void 0,c.TokenType.name)||!!(d.state.type&c.TokenType.IS_KEYWORD))}function ve(e,t){let n=d.state.start;return a.match.call(void 0,c.TokenType.parenL)?(e&&m.unexpected.call(void 0),Se(n,!1),!0):_e(e)?(xe(t),Se(n,!1),!0):!1}function ye(e,t){if(a.eat.call(void 0,c.TokenType.colon)){e?f.parseMaybeDefault.call(void 0,t):_(!1);return}let n;n=e?d.state.scopeDepth===0?a.IdentifierRole.ObjectShorthandTopLevelDeclaration:t?a.IdentifierRole.ObjectShorthandBlockScopedDeclaration:a.IdentifierRole.ObjectShorthandFunctionScopedDeclaration:a.IdentifierRole.ObjectShorthand,d.state.tokens[d.state.tokens.length-1].identifierRole=n,f.parseMaybeDefault.call(void 0,t,!0)}function be(e,n,r){d.isTypeScriptEnabled?i.tsStartParseObjPropValue.call(void 0):d.isFlowEnabled&&t.flowStartParseObjPropValue.call(void 0),ve(e,r)||ye(e,n)}function xe(e){d.isFlowEnabled&&t.flowParseVariance.call(void 0),a.eat.call(void 0,c.TokenType.bracketL)?(d.state.tokens[d.state.tokens.length-1].contextId=e,_(),m.expect.call(void 0,c.TokenType.bracketR),d.state.tokens[d.state.tokens.length-1].contextId=e):(a.match.call(void 0,c.TokenType.num)||a.match.call(void 0,c.TokenType.string)||a.match.call(void 0,c.TokenType.bigint)||a.match.call(void 0,c.TokenType.decimal)?se():O(),d.state.tokens[d.state.tokens.length-1].identifierRole=a.IdentifierRole.ObjectKey,d.state.tokens[d.state.tokens.length-1].contextId=e)}e.parsePropertyName=xe;function Se(e,t){let n=d.getNextContextId.call(void 0);d.state.scopeDepth++;let r=d.state.tokens.length,i=t;p.parseFunctionParams.call(void 0,i,n),we(e,n);let a=d.state.tokens.length;d.state.scopes.push(new s.Scope(r,a,!0)),d.state.scopeDepth--}e.parseMethod=Se;function Ce(e){Te(!0);let t=d.state.tokens.length;d.state.scopes.push(new s.Scope(e,t,!0)),d.state.scopeDepth--}e.parseArrowExpression=Ce;function we(e,n=0){d.isTypeScriptEnabled?i.tsParseFunctionBodyAndFinish.call(void 0,e,n):d.isFlowEnabled?t.flowParseFunctionBodyAndFinish.call(void 0,n):Te(!1,n)}e.parseFunctionBodyAndFinish=we;function Te(e,t=0){e&&!a.match.call(void 0,c.TokenType.braceL)?_():p.parseBlock.call(void 0,!0,t)}e.parseFunctionBody=Te;function Ee(e,t=!1){let n=!0;for(;!a.eat.call(void 0,e)&&!d.state.error;){if(n)n=!1;else if(m.expect.call(void 0,c.TokenType.comma),a.eat.call(void 0,e))break;De(t)}}function De(e){e&&a.match.call(void 0,c.TokenType.comma)||(a.match.call(void 0,c.TokenType.ellipsis)?(f.parseSpread.call(void 0),k()):a.match.call(void 0,c.TokenType.question)?a.next.call(void 0):_(!1,!0))}function Oe(){a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].type=c.TokenType.name}e.parseIdentifier=Oe;function ke(){w()}function A(){a.next.call(void 0),!a.match.call(void 0,c.TokenType.semi)&&!m.canInsertSemicolon.call(void 0)&&(a.eat.call(void 0,c.TokenType.star),_())}function Ae(){m.expectContextual.call(void 0,o.ContextualKeyword._module),m.expect.call(void 0,c.TokenType.braceL),p.parseBlockBody.call(void 0,c.TokenType.braceR)}})),Nw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ow(),n=ZC(),r=G(),i=ew(),a=Mw(),o=Pw(),s=tw();function c(e){return(e.type===r.TokenType.name||!!(e.type&r.TokenType.IS_KEYWORD))&&e.contextualKeyword!==n.ContextualKeyword._from}function l(e){let n=t.pushTypeContext.call(void 0,0);s.expect.call(void 0,e||r.TokenType.colon),Se(),t.popTypeContext.call(void 0,n)}function u(){s.expect.call(void 0,r.TokenType.modulo),s.expectContextual.call(void 0,n.ContextualKeyword._checks),t.eat.call(void 0,r.TokenType.parenL)&&(a.parseExpression.call(void 0),s.expect.call(void 0,r.TokenType.parenR))}function d(){let e=t.pushTypeContext.call(void 0,0);s.expect.call(void 0,r.TokenType.colon),t.match.call(void 0,r.TokenType.modulo)?u():(Se(),t.match.call(void 0,r.TokenType.modulo)&&u()),t.popTypeContext.call(void 0,e)}function f(){t.next.call(void 0),S(!0)}function p(){t.next.call(void 0),a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.lessThan)&&E(),s.expect.call(void 0,r.TokenType.parenL),he(),s.expect.call(void 0,r.TokenType.parenR),d(),s.semicolon.call(void 0)}function m(){t.match.call(void 0,r.TokenType._class)?f():t.match.call(void 0,r.TokenType._function)?p():t.match.call(void 0,r.TokenType._var)?h():s.eatContextual.call(void 0,n.ContextualKeyword._module)?t.eat.call(void 0,r.TokenType.dot)?v():g():s.isContextual.call(void 0,n.ContextualKeyword._type)?y():s.isContextual.call(void 0,n.ContextualKeyword._opaque)?b():s.isContextual.call(void 0,n.ContextualKeyword._interface)?x():t.match.call(void 0,r.TokenType._export)?_():s.unexpected.call(void 0)}function h(){t.next.call(void 0),we(),s.semicolon.call(void 0)}function g(){for(t.match.call(void 0,r.TokenType.string)?a.parseExprAtom.call(void 0):a.parseIdentifier.call(void 0),s.expect.call(void 0,r.TokenType.braceL);!t.match.call(void 0,r.TokenType.braceR)&&!i.state.error;)t.match.call(void 0,r.TokenType._import)?(t.next.call(void 0),o.parseImport.call(void 0)):s.unexpected.call(void 0);s.expect.call(void 0,r.TokenType.braceR)}function _(){s.expect.call(void 0,r.TokenType._export),t.eat.call(void 0,r.TokenType._default)?t.match.call(void 0,r.TokenType._function)||t.match.call(void 0,r.TokenType._class)?m():(Se(),s.semicolon.call(void 0)):t.match.call(void 0,r.TokenType._var)||t.match.call(void 0,r.TokenType._function)||t.match.call(void 0,r.TokenType._class)||s.isContextual.call(void 0,n.ContextualKeyword._opaque)?m():t.match.call(void 0,r.TokenType.star)||t.match.call(void 0,r.TokenType.braceL)||s.isContextual.call(void 0,n.ContextualKeyword._interface)||s.isContextual.call(void 0,n.ContextualKeyword._type)||s.isContextual.call(void 0,n.ContextualKeyword._opaque)?o.parseExport.call(void 0):s.unexpected.call(void 0)}function v(){s.expectContextual.call(void 0,n.ContextualKeyword._exports),Ce(),s.semicolon.call(void 0)}function y(){t.next.call(void 0),ee()}function b(){t.next.call(void 0),te(!0)}function x(){t.next.call(void 0),S()}function S(e=!1){if(T(),t.match.call(void 0,r.TokenType.lessThan)&&E(),t.eat.call(void 0,r.TokenType._extends))do C();while(!e&&t.eat.call(void 0,r.TokenType.comma));if(s.isContextual.call(void 0,n.ContextualKeyword._mixins)){t.next.call(void 0);do C();while(t.eat.call(void 0,r.TokenType.comma))}if(s.isContextual.call(void 0,n.ContextualKeyword._implements)){t.next.call(void 0);do C();while(t.eat.call(void 0,r.TokenType.comma))}ce(e,!1,e)}function C(){de(!1),t.match.call(void 0,r.TokenType.lessThan)&&re()}function w(){S()}function T(){a.parseIdentifier.call(void 0)}function ee(){T(),t.match.call(void 0,r.TokenType.lessThan)&&E(),l(r.TokenType.eq),s.semicolon.call(void 0)}function te(e){s.expectContextual.call(void 0,n.ContextualKeyword._type),T(),t.match.call(void 0,r.TokenType.lessThan)&&E(),t.match.call(void 0,r.TokenType.colon)&&l(r.TokenType.colon),e||l(r.TokenType.eq),s.semicolon.call(void 0)}function ne(){Te(),we(),t.eat.call(void 0,r.TokenType.eq)&&Se()}function E(){let e=t.pushTypeContext.call(void 0,0);
|
|
666
666
|
// istanbul ignore else: this condition is already checked at all call sites
|
|
667
|
-
t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.typeParameterStart)?t.next.call(void 0):s.unexpected.call(void 0);do ne(),t.match.call(void 0,r.TokenType.greaterThan)||s.expect.call(void 0,r.TokenType.comma);while(!t.match.call(void 0,r.TokenType.greaterThan)&&!i.state.error);s.expect.call(void 0,r.TokenType.greaterThan),t.popTypeContext.call(void 0,e)}e.flowParseTypeParameterDeclaration=re;function ie(){let e=t.pushTypeContext.call(void 0,0);for(s.expect.call(void 0,r.TokenType.lessThan);!t.match.call(void 0,r.TokenType.greaterThan)&&!i.state.error;)Ce(),t.match.call(void 0,r.TokenType.greaterThan)||s.expect.call(void 0,r.TokenType.comma);s.expect.call(void 0,r.TokenType.greaterThan),t.popTypeContext.call(void 0,e)}function E(){if(s.expectContextual.call(void 0,n.ContextualKeyword._interface),t.eat.call(void 0,r.TokenType._extends))do C();while(t.eat.call(void 0,r.TokenType.comma));le(!1,!1,!1)}function ae(){t.match.call(void 0,r.TokenType.num)||t.match.call(void 0,r.TokenType.string)?a.parseExprAtom.call(void 0):a.parseIdentifier.call(void 0)}function oe(){t.lookaheadType.call(void 0)===r.TokenType.colon?(ae(),l()):Ce(),s.expect.call(void 0,r.TokenType.bracketR),l()}function se(){ae(),s.expect.call(void 0,r.TokenType.bracketR),s.expect.call(void 0,r.TokenType.bracketR),t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.parenL)?ce():(t.eat.call(void 0,r.TokenType.question),l())}function ce(){for(t.match.call(void 0,r.TokenType.lessThan)&&re(),s.expect.call(void 0,r.TokenType.parenL);!t.match.call(void 0,r.TokenType.parenR)&&!t.match.call(void 0,r.TokenType.ellipsis)&&!i.state.error;)he(),t.match.call(void 0,r.TokenType.parenR)||s.expect.call(void 0,r.TokenType.comma);t.eat.call(void 0,r.TokenType.ellipsis)&&he(),s.expect.call(void 0,r.TokenType.parenR),l()}function D(){ce()}function le(e,a,o){let c;for(a&&t.match.call(void 0,r.TokenType.braceBarL)?(s.expect.call(void 0,r.TokenType.braceBarL),c=r.TokenType.braceBarR):(s.expect.call(void 0,r.TokenType.braceL),c=r.TokenType.braceR);!t.match.call(void 0,c)&&!i.state.error;){if(o&&s.isContextual.call(void 0,n.ContextualKeyword._proto)){let n=t.lookaheadType.call(void 0);n!==r.TokenType.colon&&n!==r.TokenType.question&&(t.next.call(void 0),e=!1)}if(e&&s.isContextual.call(void 0,n.ContextualKeyword._static)){let e=t.lookaheadType.call(void 0);e!==r.TokenType.colon&&e!==r.TokenType.question&&t.next.call(void 0)}if(Ee(),t.eat.call(void 0,r.TokenType.bracketL))t.eat.call(void 0,r.TokenType.bracketL)?se():oe();else if(t.match.call(void 0,r.TokenType.parenL)||t.match.call(void 0,r.TokenType.lessThan))D();else{if(s.isContextual.call(void 0,n.ContextualKeyword._get)||s.isContextual.call(void 0,n.ContextualKeyword._set)){let e=t.lookaheadType.call(void 0);(e===r.TokenType.name||e===r.TokenType.string||e===r.TokenType.num)&&t.next.call(void 0)}ue()}de()}s.expect.call(void 0,c)}function ue(){if(t.match.call(void 0,r.TokenType.ellipsis)){if(s.expect.call(void 0,r.TokenType.ellipsis),t.eat.call(void 0,r.TokenType.comma)||t.eat.call(void 0,r.TokenType.semi),t.match.call(void 0,r.TokenType.braceR))return;Ce()}else ae(),t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.parenL)?ce():(t.eat.call(void 0,r.TokenType.question),l())}function de(){t.eat.call(void 0,r.TokenType.semi)||t.eat.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)||t.match.call(void 0,r.TokenType.braceBarR)||s.unexpected.call(void 0)}function fe(e){for(e||a.parseIdentifier.call(void 0);t.eat.call(void 0,r.TokenType.dot);)a.parseIdentifier.call(void 0)}function pe(){fe(!0),t.match.call(void 0,r.TokenType.lessThan)&&ie()}function O(){s.expect.call(void 0,r.TokenType._typeof),_e()}function me(){for(s.expect.call(void 0,r.TokenType.bracketL);i.state.pos<i.input.length&&!t.match.call(void 0,r.TokenType.bracketR)&&(Ce(),!t.match.call(void 0,r.TokenType.bracketR));)s.expect.call(void 0,r.TokenType.comma);s.expect.call(void 0,r.TokenType.bracketR)}function he(){let e=t.lookaheadType.call(void 0);e===r.TokenType.colon||e===r.TokenType.question?(a.parseIdentifier.call(void 0),t.eat.call(void 0,r.TokenType.question),l()):Ce()}function ge(){for(;!t.match.call(void 0,r.TokenType.parenR)&&!t.match.call(void 0,r.TokenType.ellipsis)&&!i.state.error;)he(),t.match.call(void 0,r.TokenType.parenR)||s.expect.call(void 0,r.TokenType.comma);t.eat.call(void 0,r.TokenType.ellipsis)&&he()}function _e(){let e=!1,o=i.state.noAnonFunctionType;switch(i.state.type){case r.TokenType.name:if(s.isContextual.call(void 0,n.ContextualKeyword._interface)){E();return}a.parseIdentifier.call(void 0),pe();return;case r.TokenType.braceL:le(!1,!1,!1);return;case r.TokenType.braceBarL:le(!1,!0,!1);return;case r.TokenType.bracketL:me();return;case r.TokenType.lessThan:re(),s.expect.call(void 0,r.TokenType.parenL),ge(),s.expect.call(void 0,r.TokenType.parenR),s.expect.call(void 0,r.TokenType.arrow),Ce();return;case r.TokenType.parenL:if(t.next.call(void 0),!t.match.call(void 0,r.TokenType.parenR)&&!t.match.call(void 0,r.TokenType.ellipsis)){if(t.match.call(void 0,r.TokenType.name)){let n=t.lookaheadType.call(void 0);e=n!==r.TokenType.question&&n!==r.TokenType.colon}else e=!0}if(e){if(i.state.noAnonFunctionType=!1,Ce(),i.state.noAnonFunctionType=o,i.state.noAnonFunctionType||!(t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.parenR)&&t.lookaheadType.call(void 0)===r.TokenType.arrow)){s.expect.call(void 0,r.TokenType.parenR);return}t.eat.call(void 0,r.TokenType.comma)}ge(),s.expect.call(void 0,r.TokenType.parenR),s.expect.call(void 0,r.TokenType.arrow),Ce();return;case r.TokenType.minus:t.next.call(void 0),a.parseLiteral.call(void 0);return;case r.TokenType.string:case r.TokenType.num:case r.TokenType._true:case r.TokenType._false:case r.TokenType._null:case r.TokenType._this:case r.TokenType._void:case r.TokenType.star:t.next.call(void 0);return;default:if(i.state.type===r.TokenType._typeof){O();return}if(i.state.type&r.TokenType.IS_KEYWORD){t.next.call(void 0),i.state.tokens[i.state.tokens.length-1].type=r.TokenType.name;return}}s.unexpected.call(void 0)}function ve(){for(_e();!s.canInsertSemicolon.call(void 0)&&(t.match.call(void 0,r.TokenType.bracketL)||t.match.call(void 0,r.TokenType.questionDot));)t.eat.call(void 0,r.TokenType.questionDot),s.expect.call(void 0,r.TokenType.bracketL),t.eat.call(void 0,r.TokenType.bracketR)||(Ce(),s.expect.call(void 0,r.TokenType.bracketR))}function ye(){t.eat.call(void 0,r.TokenType.question)?ye():ve()}function be(){ye(),!i.state.noAnonFunctionType&&t.eat.call(void 0,r.TokenType.arrow)&&Ce()}function xe(){for(t.eat.call(void 0,r.TokenType.bitwiseAND),be();t.eat.call(void 0,r.TokenType.bitwiseAND);)be()}function Se(){for(t.eat.call(void 0,r.TokenType.bitwiseOR),xe();t.eat.call(void 0,r.TokenType.bitwiseOR);)xe()}function Ce(){Se()}function we(){l()}e.flowParseTypeAnnotation=we;function Te(){a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.colon)&&we()}function Ee(){(t.match.call(void 0,r.TokenType.plus)||t.match.call(void 0,r.TokenType.minus))&&(t.next.call(void 0),i.state.tokens[i.state.tokens.length-1].isType=!0)}e.flowParseVariance=Ee,e.flowParseFunctionBodyAndFinish=function(e){t.match.call(void 0,r.TokenType.colon)&&d(),a.parseFunctionBody.call(void 0,!1,e)},e.flowParseSubscript=function(e,n,o){if(t.match.call(void 0,r.TokenType.questionDot)&&t.lookaheadType.call(void 0)===r.TokenType.lessThan){if(n){o.stop=!0;return}t.next.call(void 0),ie(),s.expect.call(void 0,r.TokenType.parenL),a.parseCallExpressionArguments.call(void 0)}else{if(!n&&t.match.call(void 0,r.TokenType.lessThan)){let e=i.state.snapshot();if(ie(),s.expect.call(void 0,r.TokenType.parenL),a.parseCallExpressionArguments.call(void 0),i.state.error)i.state.restoreFromSnapshot(e);else return}a.baseParseSubscript.call(void 0,e,n,o)}},e.flowStartParseNewArguments=function(){if(t.match.call(void 0,r.TokenType.lessThan)){let e=i.state.snapshot();ie(),i.state.error&&i.state.restoreFromSnapshot(e)}},e.flowTryParseStatement=function(){if(t.match.call(void 0,r.TokenType.name)&&i.state.contextualKeyword===n.ContextualKeyword._interface){let e=t.pushTypeContext.call(void 0,0);return t.next.call(void 0),w(),t.popTypeContext.call(void 0,e),!0}return s.isContextual.call(void 0,n.ContextualKeyword._enum)?(Oe(),!0):!1},e.flowTryParseExportDefaultExpression=function(){return s.isContextual.call(void 0,n.ContextualKeyword._enum)?(Oe(),!0):!1},e.flowParseIdentifierStatement=function(e){if(e===n.ContextualKeyword._declare){if(t.match.call(void 0,r.TokenType._class)||t.match.call(void 0,r.TokenType.name)||t.match.call(void 0,r.TokenType._function)||t.match.call(void 0,r.TokenType._var)||t.match.call(void 0,r.TokenType._export)){let e=t.pushTypeContext.call(void 0,1);m(),t.popTypeContext.call(void 0,e)}}else if(t.match.call(void 0,r.TokenType.name)){if(e===n.ContextualKeyword._interface){let e=t.pushTypeContext.call(void 0,1);w(),t.popTypeContext.call(void 0,e)}else if(e===n.ContextualKeyword._type){let e=t.pushTypeContext.call(void 0,1);ee(),t.popTypeContext.call(void 0,e)}else if(e===n.ContextualKeyword._opaque){let e=t.pushTypeContext.call(void 0,1);te(!1),t.popTypeContext.call(void 0,e)}}s.semicolon.call(void 0)},e.flowShouldParseExportDeclaration=function(){return s.isContextual.call(void 0,n.ContextualKeyword._type)||s.isContextual.call(void 0,n.ContextualKeyword._interface)||s.isContextual.call(void 0,n.ContextualKeyword._opaque)||s.isContextual.call(void 0,n.ContextualKeyword._enum)},e.flowShouldDisallowExportDefaultSpecifier=function(){return t.match.call(void 0,r.TokenType.name)&&(i.state.contextualKeyword===n.ContextualKeyword._type||i.state.contextualKeyword===n.ContextualKeyword._interface||i.state.contextualKeyword===n.ContextualKeyword._opaque||i.state.contextualKeyword===n.ContextualKeyword._enum)},e.flowParseExportDeclaration=function(){if(s.isContextual.call(void 0,n.ContextualKeyword._type)){let e=t.pushTypeContext.call(void 0,1);t.next.call(void 0),t.match.call(void 0,r.TokenType.braceL)?(o.parseExportSpecifiers.call(void 0),o.parseExportFrom.call(void 0)):ee(),t.popTypeContext.call(void 0,e)}else if(s.isContextual.call(void 0,n.ContextualKeyword._opaque)){let e=t.pushTypeContext.call(void 0,1);t.next.call(void 0),te(!1),t.popTypeContext.call(void 0,e)}else if(s.isContextual.call(void 0,n.ContextualKeyword._interface)){let e=t.pushTypeContext.call(void 0,1);t.next.call(void 0),w(),t.popTypeContext.call(void 0,e)}else o.parseStatement.call(void 0,!0)},e.flowShouldParseExportStar=function(){return t.match.call(void 0,r.TokenType.star)||s.isContextual.call(void 0,n.ContextualKeyword._type)&&t.lookaheadType.call(void 0)===r.TokenType.star},e.flowParseExportStar=function(){if(s.eatContextual.call(void 0,n.ContextualKeyword._type)){let e=t.pushTypeContext.call(void 0,2);o.baseParseExportStar.call(void 0),t.popTypeContext.call(void 0,e)}else o.baseParseExportStar.call(void 0)},e.flowAfterParseClassSuper=function(e){if(e&&t.match.call(void 0,r.TokenType.lessThan)&&ie(),s.isContextual.call(void 0,n.ContextualKeyword._implements)){let e=t.pushTypeContext.call(void 0,0);t.next.call(void 0),i.state.tokens[i.state.tokens.length-1].type=r.TokenType._implements;do T(),t.match.call(void 0,r.TokenType.lessThan)&&ie();while(t.eat.call(void 0,r.TokenType.comma));t.popTypeContext.call(void 0,e)}},e.flowStartParseObjPropValue=function(){t.match.call(void 0,r.TokenType.lessThan)&&(re(),t.match.call(void 0,r.TokenType.parenL)||s.unexpected.call(void 0))},e.flowParseAssignableListItemTypes=function(){let e=t.pushTypeContext.call(void 0,0);t.eat.call(void 0,r.TokenType.question),t.match.call(void 0,r.TokenType.colon)&&we(),t.popTypeContext.call(void 0,e)},e.flowStartParseImportSpecifiers=function(){if(t.match.call(void 0,r.TokenType._typeof)||s.isContextual.call(void 0,n.ContextualKeyword._type)){let e=t.lookaheadTypeAndKeyword.call(void 0);(c(e)||e.type===r.TokenType.braceL||e.type===r.TokenType.star)&&t.next.call(void 0)}},e.flowParseImportSpecifier=function(){let e=i.state.contextualKeyword===n.ContextualKeyword._type||i.state.type===r.TokenType._typeof;e?t.next.call(void 0):a.parseIdentifier.call(void 0),s.isContextual.call(void 0,n.ContextualKeyword._as)&&!s.isLookaheadContextual.call(void 0,n.ContextualKeyword._as)?(a.parseIdentifier.call(void 0),e&&!t.match.call(void 0,r.TokenType.name)&&!(i.state.type&r.TokenType.IS_KEYWORD)||a.parseIdentifier.call(void 0)):(e&&(t.match.call(void 0,r.TokenType.name)||i.state.type&r.TokenType.IS_KEYWORD)&&a.parseIdentifier.call(void 0),s.eatContextual.call(void 0,n.ContextualKeyword._as)&&a.parseIdentifier.call(void 0))},e.flowStartParseFunctionParams=function(){if(t.match.call(void 0,r.TokenType.lessThan)){let e=t.pushTypeContext.call(void 0,0);re(),t.popTypeContext.call(void 0,e)}},e.flowAfterParseVarHead=function(){t.match.call(void 0,r.TokenType.colon)&&we()},e.flowStartParseAsyncArrowFromCallExpression=function(){if(t.match.call(void 0,r.TokenType.colon)){let e=i.state.noAnonFunctionType;i.state.noAnonFunctionType=!0,we(),i.state.noAnonFunctionType=e}},e.flowParseMaybeAssign=function(e,n){if(t.match.call(void 0,r.TokenType.lessThan)){let o=i.state.snapshot(),c=a.baseParseMaybeAssign.call(void 0,e,n);if(i.state.error)i.state.restoreFromSnapshot(o),i.state.type=r.TokenType.typeParameterStart;else return c;let l=t.pushTypeContext.call(void 0,0);if(re(),t.popTypeContext.call(void 0,l),c=a.baseParseMaybeAssign.call(void 0,e,n),c)return!0;s.unexpected.call(void 0)}return a.baseParseMaybeAssign.call(void 0,e,n)},e.flowParseArrow=function(){if(t.match.call(void 0,r.TokenType.colon)){let e=t.pushTypeContext.call(void 0,0),n=i.state.snapshot(),a=i.state.noAnonFunctionType;i.state.noAnonFunctionType=!0,d(),i.state.noAnonFunctionType=a,s.canInsertSemicolon.call(void 0)&&s.unexpected.call(void 0),t.match.call(void 0,r.TokenType.arrow)||s.unexpected.call(void 0),i.state.error&&i.state.restoreFromSnapshot(n),t.popTypeContext.call(void 0,e)}return t.eat.call(void 0,r.TokenType.arrow)},e.flowParseSubscripts=function(e,o=!1){if(i.state.tokens[i.state.tokens.length-1].contextualKeyword===n.ContextualKeyword._async&&t.match.call(void 0,r.TokenType.lessThan)){let e=i.state.snapshot();if(De()&&!i.state.error)return;i.state.restoreFromSnapshot(e)}a.baseParseSubscripts.call(void 0,e,o)};function De(){i.state.scopeDepth++;let e=i.state.tokens.length;return o.parseFunctionParams.call(void 0),a.parseArrow.call(void 0)?(a.parseArrowExpression.call(void 0,e),!0):!1}function Oe(){s.expectContextual.call(void 0,n.ContextualKeyword._enum),i.state.tokens[i.state.tokens.length-1].type=r.TokenType._enum,a.parseIdentifier.call(void 0),ke()}function ke(){s.eatContextual.call(void 0,n.ContextualKeyword._of)&&t.next.call(void 0),s.expect.call(void 0,r.TokenType.braceL),Ae(),s.expect.call(void 0,r.TokenType.braceR)}function Ae(){for(;!t.match.call(void 0,r.TokenType.braceR)&&!i.state.error&&!t.eat.call(void 0,r.TokenType.ellipsis);)k(),t.match.call(void 0,r.TokenType.braceR)||s.expect.call(void 0,r.TokenType.comma)}function k(){a.parseIdentifier.call(void 0),t.eat.call(void 0,r.TokenType.eq)&&t.next.call(void 0)}})),Ow=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Aw(),n=Dw(),r=Cw(),i=ew(),a=GC(),o=KC(),s=G(),c=qC(),l=JC(),u=Ew(),d=Sw(),f=YC();e.parseTopLevel=function(){if(de(s.TokenType.eof),l.state.scopes.push(new o.Scope(0,l.state.tokens.length,!0)),l.state.scopeDepth!==0)throw Error(`Invalid scope depth at end of file: ${l.state.scopeDepth}`);return new t.File(l.state.tokens,l.state.scopes)};function p(e){l.isFlowEnabled&&n.flowTryParseStatement.call(void 0)||(i.match.call(void 0,s.TokenType.at)&&g(),m(e))}e.parseStatement=p;function m(e){if(l.isTypeScriptEnabled&&r.tsTryParseStatementContent.call(void 0))return;let t=l.state.type;switch(t){case s.TokenType._break:case s.TokenType._continue:b();return;case s.TokenType._debugger:x();return;case s.TokenType._do:S();return;case s.TokenType._for:C();return;case s.TokenType._function:if(i.lookaheadType.call(void 0)===s.TokenType.dot)break;e||f.unexpected.call(void 0),ee();return;case s.TokenType._class:e||f.unexpected.call(void 0),_e(!0);return;case s.TokenType._if:te();return;case s.TokenType._return:ne();return;case s.TokenType._switch:re();return;case s.TokenType._throw:ie();return;case s.TokenType._try:ae();return;case s.TokenType._let:case s.TokenType._const:e||f.unexpected.call(void 0);case s.TokenType._var:oe(t!==s.TokenType._var);return;case s.TokenType._while:se();return;case s.TokenType.braceL:ue();return;case s.TokenType.semi:ce();return;case s.TokenType._export:case s.TokenType._import:{let e=i.lookaheadType.call(void 0);if(e===s.TokenType.parenL||e===s.TokenType.dot)break;i.next.call(void 0),t===s.TokenType._import?Ue():ke();return}case s.TokenType.name:if(l.state.contextualKeyword===a.ContextualKeyword._async){let e=l.state.start,t=l.state.snapshot();if(i.next.call(void 0),i.match.call(void 0,s.TokenType._function)&&!f.canInsertSemicolon.call(void 0)){f.expect.call(void 0,s.TokenType._function),he(e,!0);return}l.state.restoreFromSnapshot(t)}else if(l.state.contextualKeyword===a.ContextualKeyword._using&&!f.hasFollowingLineBreak.call(void 0)&&i.lookaheadType.call(void 0)===s.TokenType.name){oe(!0);return}else if(h()){f.expectContextual.call(void 0,a.ContextualKeyword._await),oe(!0);return}}let n=l.state.tokens.length;u.parseExpression.call(void 0);let o=null;if(l.state.tokens.length===n+1){let e=l.state.tokens[l.state.tokens.length-1];e.type===s.TokenType.name&&(o=e.contextualKeyword)}o==null?f.semicolon.call(void 0):i.eat.call(void 0,s.TokenType.colon)?D():le(o)}function h(){if(!f.isContextual.call(void 0,a.ContextualKeyword._await))return!1;let e=l.state.snapshot();return i.next.call(void 0),!f.isContextual.call(void 0,a.ContextualKeyword._using)||f.hasPrecedingLineBreak.call(void 0)||(i.next.call(void 0),!i.match.call(void 0,s.TokenType.name)||f.hasPrecedingLineBreak.call(void 0))?(l.state.restoreFromSnapshot(e),!1):(l.state.restoreFromSnapshot(e),!0)}function g(){for(;i.match.call(void 0,s.TokenType.at);)_()}e.parseDecorators=g;function _(){if(i.next.call(void 0),i.eat.call(void 0,s.TokenType.parenL))u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.parenR);else{for(u.parseIdentifier.call(void 0);i.eat.call(void 0,s.TokenType.dot);)u.parseIdentifier.call(void 0);v()}}function v(){l.isTypeScriptEnabled?r.tsParseMaybeDecoratorArguments.call(void 0):y()}function y(){i.eat.call(void 0,s.TokenType.parenL)&&u.parseCallExpressionArguments.call(void 0)}e.baseParseMaybeDecoratorArguments=y;function b(){i.next.call(void 0),f.isLineTerminator.call(void 0)||(u.parseIdentifier.call(void 0),f.semicolon.call(void 0))}function x(){i.next.call(void 0),f.semicolon.call(void 0)}function S(){i.next.call(void 0),p(!1),f.expect.call(void 0,s.TokenType._while),u.parseParenExpression.call(void 0),i.eat.call(void 0,s.TokenType.semi)}function C(){l.state.scopeDepth++;let e=l.state.tokens.length;T();let t=l.state.tokens.length;l.state.scopes.push(new o.Scope(e,t,!1)),l.state.scopeDepth--}function w(){return!(!f.isContextual.call(void 0,a.ContextualKeyword._using)||f.isLookaheadContextual.call(void 0,a.ContextualKeyword._of))}function T(){i.next.call(void 0);let e=!1;if(f.isContextual.call(void 0,a.ContextualKeyword._await)&&(e=!0,i.next.call(void 0)),f.expect.call(void 0,s.TokenType.parenL),i.match.call(void 0,s.TokenType.semi)){e&&f.unexpected.call(void 0),fe();return}let t=h();if(t||i.match.call(void 0,s.TokenType._var)||i.match.call(void 0,s.TokenType._let)||i.match.call(void 0,s.TokenType._const)||w()){if(t&&f.expectContextual.call(void 0,a.ContextualKeyword._await),i.next.call(void 0),O(!0,l.state.type!==s.TokenType._var),i.match.call(void 0,s.TokenType._in)||f.isContextual.call(void 0,a.ContextualKeyword._of)){pe(e);return}fe()}else u.parseExpression.call(void 0,!0),i.match.call(void 0,s.TokenType._in)||f.isContextual.call(void 0,a.ContextualKeyword._of)?pe(e):(e&&f.unexpected.call(void 0),fe())}function ee(){let e=l.state.start;i.next.call(void 0),he(e,!0)}function te(){i.next.call(void 0),u.parseParenExpression.call(void 0),p(!1),i.eat.call(void 0,s.TokenType._else)&&p(!1)}function ne(){i.next.call(void 0),f.isLineTerminator.call(void 0)||(u.parseExpression.call(void 0),f.semicolon.call(void 0))}function re(){i.next.call(void 0),u.parseParenExpression.call(void 0),l.state.scopeDepth++;let e=l.state.tokens.length;for(f.expect.call(void 0,s.TokenType.braceL);!i.match.call(void 0,s.TokenType.braceR)&&!l.state.error;)if(i.match.call(void 0,s.TokenType._case)||i.match.call(void 0,s.TokenType._default)){let e=i.match.call(void 0,s.TokenType._case);i.next.call(void 0),e&&u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.colon)}else p(!0);i.next.call(void 0);let t=l.state.tokens.length;l.state.scopes.push(new o.Scope(e,t,!1)),l.state.scopeDepth--}function ie(){i.next.call(void 0),u.parseExpression.call(void 0),f.semicolon.call(void 0)}function E(){d.parseBindingAtom.call(void 0,!0),l.isTypeScriptEnabled&&r.tsTryParseTypeAnnotation.call(void 0)}function ae(){if(i.next.call(void 0),ue(),i.match.call(void 0,s.TokenType._catch)){i.next.call(void 0);let e=null;if(i.match.call(void 0,s.TokenType.parenL)&&(l.state.scopeDepth++,e=l.state.tokens.length,f.expect.call(void 0,s.TokenType.parenL),E(),f.expect.call(void 0,s.TokenType.parenR)),ue(),e!=null){let t=l.state.tokens.length;l.state.scopes.push(new o.Scope(e,t,!1)),l.state.scopeDepth--}}i.eat.call(void 0,s.TokenType._finally)&&ue()}function oe(e){i.next.call(void 0),O(!1,e),f.semicolon.call(void 0)}e.parseVarStatement=oe;function se(){i.next.call(void 0),u.parseParenExpression.call(void 0),p(!1)}function ce(){i.next.call(void 0)}function D(){p(!0)}function le(e){l.isTypeScriptEnabled?r.tsParseIdentifierStatement.call(void 0,e):l.isFlowEnabled?n.flowParseIdentifierStatement.call(void 0,e):f.semicolon.call(void 0)}function ue(e=!1,t=0){let n=l.state.tokens.length;l.state.scopeDepth++,f.expect.call(void 0,s.TokenType.braceL),t&&(l.state.tokens[l.state.tokens.length-1].contextId=t),de(s.TokenType.braceR),t&&(l.state.tokens[l.state.tokens.length-1].contextId=t);let r=l.state.tokens.length;l.state.scopes.push(new o.Scope(n,r,e)),l.state.scopeDepth--}e.parseBlock=ue;function de(e){for(;!i.eat.call(void 0,e)&&!l.state.error;)p(!0)}e.parseBlockBody=de;function fe(){f.expect.call(void 0,s.TokenType.semi),i.match.call(void 0,s.TokenType.semi)||u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.semi),i.match.call(void 0,s.TokenType.parenR)||u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.parenR),p(!1)}function pe(e){e?f.eatContextual.call(void 0,a.ContextualKeyword._of):i.next.call(void 0),u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.parenR),p(!1)}function O(e,t){for(;;){if(me(t),i.eat.call(void 0,s.TokenType.eq)){let t=l.state.tokens.length-1;u.parseMaybeAssign.call(void 0,e),l.state.tokens[t].rhsEndIndex=l.state.tokens.length}if(!i.eat.call(void 0,s.TokenType.comma))break}}function me(e){d.parseBindingAtom.call(void 0,e),l.isTypeScriptEnabled?r.tsAfterParseVarHead.call(void 0):l.isFlowEnabled&&n.flowAfterParseVarHead.call(void 0)}function he(e,t,n=!1){i.match.call(void 0,s.TokenType.star)&&i.next.call(void 0),t&&!n&&!i.match.call(void 0,s.TokenType.name)&&!i.match.call(void 0,s.TokenType._yield)&&f.unexpected.call(void 0);let r=null;i.match.call(void 0,s.TokenType.name)&&(t||(r=l.state.tokens.length,l.state.scopeDepth++),d.parseBindingIdentifier.call(void 0,!1));let a=l.state.tokens.length;l.state.scopeDepth++,ge(),u.parseFunctionBodyAndFinish.call(void 0,e);let c=l.state.tokens.length;l.state.scopes.push(new o.Scope(a,c,!0)),l.state.scopeDepth--,r!==null&&(l.state.scopes.push(new o.Scope(r,c,!0)),l.state.scopeDepth--)}e.parseFunction=he;function ge(e=!1,t=0){l.isTypeScriptEnabled?r.tsStartParseFunctionParams.call(void 0):l.isFlowEnabled&&n.flowStartParseFunctionParams.call(void 0),f.expect.call(void 0,s.TokenType.parenL),t&&(l.state.tokens[l.state.tokens.length-1].contextId=t),d.parseBindingList.call(void 0,s.TokenType.parenR,!1,!1,e,t),t&&(l.state.tokens[l.state.tokens.length-1].contextId=t)}e.parseFunctionParams=ge;function _e(e,t=!1){let n=l.getNextContextId.call(void 0);i.next.call(void 0),l.state.tokens[l.state.tokens.length-1].contextId=n,l.state.tokens[l.state.tokens.length-1].isExpression=!e;let r=null;e||(r=l.state.tokens.length,l.state.scopeDepth++),De(e,t),Oe();let a=l.state.tokens.length;if(be(n),!l.state.error&&(l.state.tokens[a].contextId=n,l.state.tokens[l.state.tokens.length-1].contextId=n,r!==null)){let e=l.state.tokens.length;l.state.scopes.push(new o.Scope(r,e,!1)),l.state.scopeDepth--}}e.parseClass=_e;function ve(){return i.match.call(void 0,s.TokenType.eq)||i.match.call(void 0,s.TokenType.semi)||i.match.call(void 0,s.TokenType.braceR)||i.match.call(void 0,s.TokenType.bang)||i.match.call(void 0,s.TokenType.colon)}function ye(){return i.match.call(void 0,s.TokenType.parenL)||i.match.call(void 0,s.TokenType.lessThan)}function be(e){for(f.expect.call(void 0,s.TokenType.braceL);!i.eat.call(void 0,s.TokenType.braceR)&&!l.state.error;)i.eat.call(void 0,s.TokenType.semi)||(i.match.call(void 0,s.TokenType.at)?_():xe(l.state.start,e))}function xe(e,t){l.isTypeScriptEnabled&&r.tsParseModifiers.call(void 0,[a.ContextualKeyword._declare,a.ContextualKeyword._public,a.ContextualKeyword._protected,a.ContextualKeyword._private,a.ContextualKeyword._override]);let n=!1;if(i.match.call(void 0,s.TokenType.name)&&l.state.contextualKeyword===a.ContextualKeyword._static){if(u.parseIdentifier.call(void 0),ye()){Ce(e,!1);return}if(ve()){Ee();return}if(l.state.tokens[l.state.tokens.length-1].type=s.TokenType._static,n=!0,i.match.call(void 0,s.TokenType.braceL)){l.state.tokens[l.state.tokens.length-1].contextId=t,ue();return}}Se(e,n,t)}function Se(e,t,n){if(l.isTypeScriptEnabled&&r.tsTryParseClassMemberWithIsStatic.call(void 0,t))return;if(i.eat.call(void 0,s.TokenType.star)){we(n),Ce(e,!1);return}we(n);let o=!1,c=l.state.tokens[l.state.tokens.length-1];c.contextualKeyword===a.ContextualKeyword._constructor&&(o=!0),Te(),ye()?Ce(e,o):ve()?Ee():c.contextualKeyword===a.ContextualKeyword._async&&!f.isLineTerminator.call(void 0)?(l.state.tokens[l.state.tokens.length-1].type=s.TokenType._async,i.match.call(void 0,s.TokenType.star)&&i.next.call(void 0),we(n),Te(),Ce(e,!1)):(c.contextualKeyword===a.ContextualKeyword._get||c.contextualKeyword===a.ContextualKeyword._set)&&!(f.isLineTerminator.call(void 0)&&i.match.call(void 0,s.TokenType.star))?(c.contextualKeyword===a.ContextualKeyword._get?l.state.tokens[l.state.tokens.length-1].type=s.TokenType._get:l.state.tokens[l.state.tokens.length-1].type=s.TokenType._set,we(n),Ce(e,!1)):c.contextualKeyword===a.ContextualKeyword._accessor&&!f.isLineTerminator.call(void 0)?(we(n),Ee()):f.isLineTerminator.call(void 0)?Ee():f.unexpected.call(void 0)}function Ce(e,t){l.isTypeScriptEnabled?r.tsTryParseTypeParameters.call(void 0):l.isFlowEnabled&&i.match.call(void 0,s.TokenType.lessThan)&&n.flowParseTypeParameterDeclaration.call(void 0),u.parseMethod.call(void 0,e,t)}function we(e){u.parsePropertyName.call(void 0,e)}e.parseClassPropertyName=we;function Te(){if(l.isTypeScriptEnabled){let e=i.pushTypeContext.call(void 0,0);i.eat.call(void 0,s.TokenType.question),i.popTypeContext.call(void 0,e)}}e.parsePostMemberNameModifiers=Te;function Ee(){if(l.isTypeScriptEnabled?(i.eatTypeToken.call(void 0,s.TokenType.bang),r.tsTryParseTypeAnnotation.call(void 0)):l.isFlowEnabled&&i.match.call(void 0,s.TokenType.colon)&&n.flowParseTypeAnnotation.call(void 0),i.match.call(void 0,s.TokenType.eq)){let e=l.state.tokens.length;i.next.call(void 0),u.parseMaybeAssign.call(void 0),l.state.tokens[e].rhsEndIndex=l.state.tokens.length}f.semicolon.call(void 0)}e.parseClassProperty=Ee;function De(e,t=!1){(!l.isTypeScriptEnabled||e&&!t||!f.isContextual.call(void 0,a.ContextualKeyword._implements))&&(i.match.call(void 0,s.TokenType.name)&&d.parseBindingIdentifier.call(void 0,!0),l.isTypeScriptEnabled?r.tsTryParseTypeParameters.call(void 0):l.isFlowEnabled&&i.match.call(void 0,s.TokenType.lessThan)&&n.flowParseTypeParameterDeclaration.call(void 0))}function Oe(){let e=!1;i.eat.call(void 0,s.TokenType._extends)?(u.parseExprSubscripts.call(void 0),e=!0):e=!1,l.isTypeScriptEnabled?r.tsAfterParseClassSuper.call(void 0,e):l.isFlowEnabled&&n.flowAfterParseClassSuper.call(void 0,e)}function ke(){let e=l.state.tokens.length-1;l.isTypeScriptEnabled&&r.tsTryParseExport.call(void 0)||(Pe()?Fe():je()?(u.parseIdentifier.call(void 0),i.match.call(void 0,s.TokenType.comma)&&i.lookaheadType.call(void 0)===s.TokenType.star?(f.expect.call(void 0,s.TokenType.comma),f.expect.call(void 0,s.TokenType.star),f.expectContextual.call(void 0,a.ContextualKeyword._as),u.parseIdentifier.call(void 0)):Me(),Ne()):i.eat.call(void 0,s.TokenType._default)?Ae():Re()?k():(ze(),Ne()),l.state.tokens[e].rhsEndIndex=l.state.tokens.length)}e.parseExport=ke;function Ae(){if(l.isTypeScriptEnabled&&r.tsTryParseExportDefaultExpression.call(void 0)||l.isFlowEnabled&&n.flowTryParseExportDefaultExpression.call(void 0))return;let e=l.state.start;i.eat.call(void 0,s.TokenType._function)?he(e,!0,!0):f.isContextual.call(void 0,a.ContextualKeyword._async)&&i.lookaheadType.call(void 0)===s.TokenType._function?(f.eatContextual.call(void 0,a.ContextualKeyword._async),i.eat.call(void 0,s.TokenType._function),he(e,!0,!0)):i.match.call(void 0,s.TokenType._class)?_e(!0,!0):i.match.call(void 0,s.TokenType.at)?(g(),_e(!0,!0)):(u.parseMaybeAssign.call(void 0),f.semicolon.call(void 0))}function k(){l.isTypeScriptEnabled?r.tsParseExportDeclaration.call(void 0):l.isFlowEnabled?n.flowParseExportDeclaration.call(void 0):p(!0)}function je(){if(l.isTypeScriptEnabled&&r.tsIsDeclarationStart.call(void 0)||l.isFlowEnabled&&n.flowShouldDisallowExportDefaultSpecifier.call(void 0))return!1;if(i.match.call(void 0,s.TokenType.name))return l.state.contextualKeyword!==a.ContextualKeyword._async;if(!i.match.call(void 0,s.TokenType._default))return!1;let e=i.nextTokenStart.call(void 0),t=i.lookaheadTypeAndKeyword.call(void 0),o=t.type===s.TokenType.name&&t.contextualKeyword===a.ContextualKeyword._from;if(t.type===s.TokenType.comma)return!0;if(o){let t=l.input.charCodeAt(i.nextTokenStartSince.call(void 0,e+4));return t===c.charCodes.quotationMark||t===c.charCodes.apostrophe}return!1}function Me(){i.eat.call(void 0,s.TokenType.comma)&&ze()}function Ne(){f.eatContextual.call(void 0,a.ContextualKeyword._from)&&(u.parseExprAtom.call(void 0),qe()),f.semicolon.call(void 0)}e.parseExportFrom=Ne;function Pe(){return l.isFlowEnabled?n.flowShouldParseExportStar.call(void 0):i.match.call(void 0,s.TokenType.star)}function Fe(){l.isFlowEnabled?n.flowParseExportStar.call(void 0):Ie()}function Ie(){f.expect.call(void 0,s.TokenType.star),f.isContextual.call(void 0,a.ContextualKeyword._as)?Le():Ne()}e.baseParseExportStar=Ie;function Le(){i.next.call(void 0),l.state.tokens[l.state.tokens.length-1].type=s.TokenType._as,u.parseIdentifier.call(void 0),Me(),Ne()}function Re(){return l.isTypeScriptEnabled&&r.tsIsDeclarationStart.call(void 0)||l.isFlowEnabled&&n.flowShouldParseExportDeclaration.call(void 0)||l.state.type===s.TokenType._var||l.state.type===s.TokenType._const||l.state.type===s.TokenType._let||l.state.type===s.TokenType._function||l.state.type===s.TokenType._class||f.isContextual.call(void 0,a.ContextualKeyword._async)||i.match.call(void 0,s.TokenType.at)}function ze(){let e=!0;for(f.expect.call(void 0,s.TokenType.braceL);!i.eat.call(void 0,s.TokenType.braceR)&&!l.state.error;){if(e)e=!1;else if(f.expect.call(void 0,s.TokenType.comma),i.eat.call(void 0,s.TokenType.braceR))break;Be()}}e.parseExportSpecifiers=ze;function Be(){l.isTypeScriptEnabled?r.tsParseExportSpecifier.call(void 0):(u.parseIdentifier.call(void 0),l.state.tokens[l.state.tokens.length-1].identifierRole=i.IdentifierRole.ExportAccess,f.eatContextual.call(void 0,a.ContextualKeyword._as)&&u.parseIdentifier.call(void 0))}function Ve(){let e=l.state.snapshot();return f.expectContextual.call(void 0,a.ContextualKeyword._module),f.eatContextual.call(void 0,a.ContextualKeyword._from)?f.isContextual.call(void 0,a.ContextualKeyword._from)?(l.state.restoreFromSnapshot(e),!0):(l.state.restoreFromSnapshot(e),!1):i.match.call(void 0,s.TokenType.comma)?(l.state.restoreFromSnapshot(e),!1):(l.state.restoreFromSnapshot(e),!0)}function He(){f.isContextual.call(void 0,a.ContextualKeyword._module)&&Ve()&&i.next.call(void 0)}function Ue(){if(l.isTypeScriptEnabled&&i.match.call(void 0,s.TokenType.name)&&i.lookaheadType.call(void 0)===s.TokenType.eq)r.tsParseImportEqualsDeclaration.call(void 0);else{if(l.isTypeScriptEnabled&&f.isContextual.call(void 0,a.ContextualKeyword._type)){let e=i.lookaheadTypeAndKeyword.call(void 0);if(e.type===s.TokenType.name&&e.contextualKeyword!==a.ContextualKeyword._from){if(f.expectContextual.call(void 0,a.ContextualKeyword._type),i.lookaheadType.call(void 0)===s.TokenType.eq){r.tsParseImportEqualsDeclaration.call(void 0);return}}else(e.type===s.TokenType.star||e.type===s.TokenType.braceL)&&f.expectContextual.call(void 0,a.ContextualKeyword._type)}i.match.call(void 0,s.TokenType.string)||(He(),Ge(),f.expectContextual.call(void 0,a.ContextualKeyword._from)),u.parseExprAtom.call(void 0),qe(),f.semicolon.call(void 0)}}e.parseImport=Ue;function A(){return i.match.call(void 0,s.TokenType.name)}function We(){d.parseImportedIdentifier.call(void 0)}function Ge(){l.isFlowEnabled&&n.flowStartParseImportSpecifiers.call(void 0);let e=!0;if(!(A()&&(We(),!i.eat.call(void 0,s.TokenType.comma)))){if(i.match.call(void 0,s.TokenType.star))i.next.call(void 0),f.expectContextual.call(void 0,a.ContextualKeyword._as),We();else for(f.expect.call(void 0,s.TokenType.braceL);!i.eat.call(void 0,s.TokenType.braceR)&&!l.state.error;){if(e)e=!1;else if(i.eat.call(void 0,s.TokenType.colon)&&f.unexpected.call(void 0,`ES2015 named imports do not destructure. Use another statement for destructuring after the import.`),f.expect.call(void 0,s.TokenType.comma),i.eat.call(void 0,s.TokenType.braceR))break;Ke()}}}function Ke(){l.isTypeScriptEnabled?r.tsParseImportSpecifier.call(void 0):l.isFlowEnabled?n.flowParseImportSpecifier.call(void 0):(d.parseImportedIdentifier.call(void 0),f.isContextual.call(void 0,a.ContextualKeyword._as)&&(l.state.tokens[l.state.tokens.length-1].identifierRole=i.IdentifierRole.ImportAccess,i.next.call(void 0),d.parseImportedIdentifier.call(void 0)))}function qe(){(i.match.call(void 0,s.TokenType._with)||f.isContextual.call(void 0,a.ContextualKeyword._assert)&&!f.hasPrecedingLineBreak.call(void 0))&&(i.next.call(void 0),u.parseObj.call(void 0,!1,!1))}})),kw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ew(),n=qC(),r=JC(),i=Ow();e.parseFile=function(){return r.state.pos===0&&r.input.charCodeAt(0)===n.charCodes.numberSign&&r.input.charCodeAt(1)===n.charCodes.exclamationMark&&t.skipLineComment.call(void 0,2),t.nextToken.call(void 0),i.parseTopLevel.call(void 0)}})),Aw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=JC(),n=kw();e.File=class{constructor(e,t){this.tokens=e,this.scopes=t}},e.parse=function(e,r,i,a){if(a&&i)throw Error(`Cannot combine flow and typescript plugins.`);t.initParser.call(void 0,e,r,i,a);let o=n.parseFile.call(void 0);if(t.state.error)throw t.augmentError.call(void 0,t.state.error);return o}})),jw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=GC();e.default=function(e){let n=e.currentIndex(),r=0,i=e.currentToken();do{let a=e.tokens[n];if(a.isOptionalChainStart&&r++,a.isOptionalChainEnd&&r--,r+=a.numNullishCoalesceStarts,r-=a.numNullishCoalesceEnds,a.contextualKeyword===t.ContextualKeyword._await&&a.identifierRole==null&&a.scopeDepth===i.scopeDepth)return!0;n+=1}while(r>0&&n<e.tokens.length);return!1}})),Mw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=G(),r=t(jw());e.default=class e{__init(){this.resultCode=``}__init2(){this.resultMappings=Array(this.tokens.length)}__init3(){this.tokenIndex=0}constructor(t,n,r,i,a){this.code=t,this.tokens=n,this.isFlowEnabled=r,this.disableESTransforms=i,this.helperManager=a,e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this)}snapshot(){return{resultCode:this.resultCode,tokenIndex:this.tokenIndex}}restoreToSnapshot(e){this.resultCode=e.resultCode,this.tokenIndex=e.tokenIndex}dangerouslyGetAndRemoveCodeSinceSnapshot(e){let t=this.resultCode.slice(e.resultCode.length);return this.resultCode=e.resultCode,t}reset(){this.resultCode=``,this.resultMappings=Array(this.tokens.length),this.tokenIndex=0}matchesContextualAtIndex(e,t){return this.matches1AtIndex(e,n.TokenType.name)&&this.tokens[e].contextualKeyword===t}identifierNameAtIndex(e){return this.identifierNameForToken(this.tokens[e])}identifierNameAtRelativeIndex(e){return this.identifierNameForToken(this.tokenAtRelativeIndex(e))}identifierName(){return this.identifierNameForToken(this.currentToken())}identifierNameForToken(e){return this.code.slice(e.start,e.end)}rawCodeForToken(e){return this.code.slice(e.start,e.end)}stringValueAtIndex(e){return this.stringValueForToken(this.tokens[e])}stringValue(){return this.stringValueForToken(this.currentToken())}stringValueForToken(e){return this.code.slice(e.start+1,e.end-1)}matches1AtIndex(e,t){return this.tokens[e].type===t}matches2AtIndex(e,t,n){return this.tokens[e].type===t&&this.tokens[e+1].type===n}matches3AtIndex(e,t,n,r){return this.tokens[e].type===t&&this.tokens[e+1].type===n&&this.tokens[e+2].type===r}matches1(e){return this.tokens[this.tokenIndex].type===e}matches2(e,t){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===t}matches3(e,t,n){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===t&&this.tokens[this.tokenIndex+2].type===n}matches4(e,t,n,r){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===t&&this.tokens[this.tokenIndex+2].type===n&&this.tokens[this.tokenIndex+3].type===r}matches5(e,t,n,r,i){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===t&&this.tokens[this.tokenIndex+2].type===n&&this.tokens[this.tokenIndex+3].type===r&&this.tokens[this.tokenIndex+4].type===i}matchesContextual(e){return this.matchesContextualAtIndex(this.tokenIndex,e)}matchesContextIdAndLabel(e,t){return this.matches1(e)&&this.currentToken().contextId===t}previousWhitespaceAndComments(){let e=this.code.slice(this.tokenIndex>0?this.tokens[this.tokenIndex-1].end:0,this.tokenIndex<this.tokens.length?this.tokens[this.tokenIndex].start:this.code.length);return this.isFlowEnabled&&(e=e.replace(/@flow/g,``)),e}replaceToken(e){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=e,this.appendTokenSuffix(),this.tokenIndex++}replaceTokenTrimmingLeftWhitespace(e){this.resultCode+=this.previousWhitespaceAndComments().replace(/[^\r\n]/g,``),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=e,this.appendTokenSuffix(),this.tokenIndex++}removeInitialToken(){this.replaceToken(``)}removeToken(){this.replaceTokenTrimmingLeftWhitespace(``)}removeBalancedCode(){let e=0;for(;!this.isAtEnd();){if(this.matches1(n.TokenType.braceL))e++;else if(this.matches1(n.TokenType.braceR)){if(e===0)return;e--}this.removeToken()}}copyExpectedToken(e){if(this.tokens[this.tokenIndex].type!==e)throw Error(`Expected token ${e}`);this.copyToken()}copyToken(){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}copyTokenWithPrefix(e){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultCode+=e,this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}appendTokenPrefix(){let e=this.currentToken();if((e.numNullishCoalesceStarts||e.isOptionalChainStart)&&(e.isAsyncOperation=r.default.call(void 0,this)),!this.disableESTransforms){if(e.numNullishCoalesceStarts)for(let t=0;t<e.numNullishCoalesceStarts;t++)e.isAsyncOperation?(this.resultCode+=`await `,this.resultCode+=this.helperManager.getHelperName(`asyncNullishCoalesce`)):this.resultCode+=this.helperManager.getHelperName(`nullishCoalesce`),this.resultCode+=`(`;e.isOptionalChainStart&&(e.isAsyncOperation&&(this.resultCode+=`await `),this.tokenIndex>0&&this.tokenAtRelativeIndex(-1).type===n.TokenType._delete?e.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName(`asyncOptionalChainDelete`):this.resultCode+=this.helperManager.getHelperName(`optionalChainDelete`):e.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName(`asyncOptionalChain`):this.resultCode+=this.helperManager.getHelperName(`optionalChain`),this.resultCode+=`([`)}}appendTokenSuffix(){let e=this.currentToken();if(e.isOptionalChainEnd&&!this.disableESTransforms&&(this.resultCode+=`])`),e.numNullishCoalesceEnds&&!this.disableESTransforms)for(let t=0;t<e.numNullishCoalesceEnds;t++)this.resultCode+=`))`}appendCode(e){this.resultCode+=e}currentToken(){return this.tokens[this.tokenIndex]}currentTokenCode(){let e=this.currentToken();return this.code.slice(e.start,e.end)}tokenAtRelativeIndex(e){return this.tokens[this.tokenIndex+e]}currentIndex(){return this.tokenIndex}nextToken(){if(this.tokenIndex===this.tokens.length)throw Error(`Unexpectedly reached end of input.`);this.tokenIndex++}previousToken(){this.tokenIndex--}finish(){if(this.tokenIndex!==this.tokens.length)throw Error(`Tried to finish processing tokens before reaching the end.`);return this.resultCode+=this.previousWhitespaceAndComments(),{code:this.resultCode,mappings:this.resultMappings}}isAtEnd(){return this.tokenIndex===this.tokens.length}}})),Nw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=GC(),n=G();e.default=function(e,c,l,u){let d=c.snapshot(),f=i(c),p=[],m=[],h=[],g=null,_=[],v=[],y=c.currentToken().contextId;if(y==null)throw Error(`Expected non-null class context ID on class open-brace.`);for(c.nextToken();!c.matchesContextIdAndLabel(n.TokenType.braceR,y);)if(c.matchesContextual(t.ContextualKeyword._constructor)&&!c.currentToken().isType)({constructorInitializerStatements:p,constructorInsertPos:g}=a(c));else if(c.matches1(n.TokenType.semi))u||v.push({start:c.currentIndex(),end:c.currentIndex()+1}),c.nextToken();else if(c.currentToken().isType)c.nextToken();else{let i=c.currentIndex(),d=!1,f=!1,b=!1;for(;o(c.currentToken());)c.matches1(n.TokenType._static)&&(d=!0),c.matches1(n.TokenType.hash)&&(f=!0),(c.matches1(n.TokenType._declare)||c.matches1(n.TokenType._abstract))&&(b=!0),c.nextToken();if(d&&c.matches1(n.TokenType.braceL)||f){r(c,y);continue}if(c.matchesContextual(t.ContextualKeyword._constructor)&&!c.currentToken().isType){({constructorInitializerStatements:p,constructorInsertPos:g}=a(c));continue}let x=c.currentIndex();if(s(c),c.matches1(n.TokenType.lessThan)||c.matches1(n.TokenType.parenL)){r(c,y);continue}for(;c.currentToken().isType;)c.nextToken();if(c.matches1(n.TokenType.eq)){let t=c.currentIndex(),n=c.currentToken().rhsEndIndex;if(n==null)throw Error(`Expected rhsEndIndex on class field assignment.`);for(c.nextToken();c.currentIndex()<n;)e.processToken();let r;d?(r=l.claimFreeName(`__initStatic`),h.push(r)):(r=l.claimFreeName(`__init`),m.push(r)),_.push({initializerName:r,equalsIndex:t,start:x,end:c.currentIndex()})}else(!u||b)&&v.push({start:i,end:c.currentIndex()})}return c.restoreToSnapshot(d),u?{headerInfo:f,constructorInitializerStatements:p,instanceInitializerNames:[],staticInitializerNames:[],constructorInsertPos:g,fields:[],rangesToRemove:v}:{headerInfo:f,constructorInitializerStatements:p,instanceInitializerNames:m,staticInitializerNames:h,constructorInsertPos:g,fields:_,rangesToRemove:v}};function r(e,t){for(e.nextToken();e.currentToken().contextId!==t;)e.nextToken();for(;o(e.tokenAtRelativeIndex(-1));)e.previousToken()}function i(e){let t=e.currentToken(),r=t.contextId;if(r==null)throw Error(`Expected context ID on class token.`);let i=t.isExpression;if(i==null)throw Error(`Expected isExpression on class token.`);let a=null,o=!1;for(e.nextToken(),e.matches1(n.TokenType.name)&&(a=e.identifierName());!e.matchesContextIdAndLabel(n.TokenType.braceL,r);)e.matches1(n.TokenType._extends)&&!e.currentToken().isType&&(o=!0),e.nextToken();return{isExpression:i,className:a,hasSuperclass:o}}function a(e){let t=[];e.nextToken();let r=e.currentToken().contextId;if(r==null)throw Error(`Expected context ID on open-paren starting constructor params.`);for(;!e.matchesContextIdAndLabel(n.TokenType.parenR,r);)if(e.currentToken().contextId===r){if(e.nextToken(),o(e.currentToken())){for(e.nextToken();o(e.currentToken());)e.nextToken();let r=e.currentToken();if(r.type!==n.TokenType.name)throw Error(`Expected identifier after access modifiers in constructor arg.`);let i=e.identifierNameForToken(r);t.push(`this.${i} = ${i}`)}}else e.nextToken();for(e.nextToken();e.currentToken().isType;)e.nextToken();let i=e.currentIndex(),a=!1;for(;!e.matchesContextIdAndLabel(n.TokenType.braceR,r);){if(!a&&e.matches2(n.TokenType._super,n.TokenType.parenL)){e.nextToken();let t=e.currentToken().contextId;if(t==null)throw Error(`Expected a context ID on the super call`);for(;!e.matchesContextIdAndLabel(n.TokenType.parenR,t);)e.nextToken();i=e.currentIndex(),a=!0}e.nextToken()}return e.nextToken(),{constructorInitializerStatements:t,constructorInsertPos:i}}function o(e){return[n.TokenType._async,n.TokenType._get,n.TokenType._set,n.TokenType.plus,n.TokenType.minus,n.TokenType._readonly,n.TokenType._static,n.TokenType._public,n.TokenType._private,n.TokenType._protected,n.TokenType._override,n.TokenType._abstract,n.TokenType.star,n.TokenType._declare,n.TokenType.hash].includes(e.type)}function s(e){if(e.matches1(n.TokenType.bracketL)){let t=e.currentToken().contextId;if(t==null)throw Error(`Expected class context ID on computed name open bracket.`);for(;!e.matchesContextIdAndLabel(n.TokenType.bracketR,t);)e.nextToken();e.nextToken()}else e.nextToken()}})),Pw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=G();e.default=function(e){if(e.removeInitialToken(),e.removeToken(),e.removeToken(),e.removeToken(),e.matches1(t.TokenType.parenL))e.removeToken(),e.removeToken(),e.removeToken();else for(;e.matches1(t.TokenType.dot);)e.removeToken(),e.removeToken()}})),Fw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ew(),n=G();e.EMPTY_DECLARATION_INFO={typeDeclarations:/* @__PURE__ */ new Set,valueDeclarations:/* @__PURE__ */ new Set},e.default=function(e){let r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set;for(let a=0;a<e.tokens.length;a++){let o=e.tokens[a];o.type===n.TokenType.name&&t.isTopLevelDeclaration.call(void 0,o)&&(o.isType?r.add(e.identifierNameForToken(o)):i.add(e.identifierNameForToken(o)))}return{typeDeclarations:r,valueDeclarations:i}}})),Iw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=GC(),n=G();e.default=function(e){let r=e.currentIndex();for(;!e.matches1AtIndex(r,n.TokenType.braceR);)r++;return e.matchesContextualAtIndex(r+1,t.ContextualKeyword._from)&&e.matches1AtIndex(r+2,n.TokenType.string)}})),Lw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=GC(),n=G();e.removeMaybeImportAttributes=function(e){(e.matches2(n.TokenType._with,n.TokenType.braceL)||e.matches2(n.TokenType.name,n.TokenType.braceL)&&e.matchesContextual(t.ContextualKeyword._assert))&&(e.removeToken(),e.removeToken(),e.removeBalancedCode(),e.removeToken())}})),Rw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=G();e.default=function(e,n,r,i){if(!e||n)return!1;let a=r.currentToken();if(a.rhsEndIndex==null)throw Error(`Expected non-null rhsEndIndex on export token.`);let o=a.rhsEndIndex-r.currentIndex();if(o!==3&&!(o===4&&r.matches1AtIndex(a.rhsEndIndex-1,t.TokenType.semi)))return!1;let s=r.tokenAtRelativeIndex(2);if(s.type!==t.TokenType.name)return!1;let c=r.identifierNameForToken(s);return i.typeDeclarations.has(c)&&!i.valueDeclarations.has(c)}})),zw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=ew(),r=GC(),i=G(),a=t(Pw()),o=Fw(),s=t(o),c=t(tw()),l=t(Iw()),u=Lw(),d=t(Rw()),f=t(iw());e.default=class e extends f.default{__init(){this.hadExport=!1}__init2(){this.hadNamedExport=!1}__init3(){this.hadDefaultExport=!1}constructor(t,n,r,i,a,c,l,u,d,f,p,m){super(),this.rootTransformer=t,this.tokens=n,this.importProcessor=r,this.nameManager=i,this.helperManager=a,this.reactHotLoaderTransformer=c,this.enableLegacyBabel5ModuleInterop=l,this.enableLegacyTypeScriptModuleInterop=u,this.isTypeScriptTransformEnabled=d,this.isFlowTransformEnabled=f,this.preserveDynamicImport=p,this.keepUnusedImports=m,e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),this.declarationInfo=d?s.default.call(void 0,n):o.EMPTY_DECLARATION_INFO}getPrefixCode(){let e=``;return this.hadExport&&(e+=`Object.defineProperty(exports, "__esModule", {value: true});`),e}getSuffixCode(){return this.enableLegacyBabel5ModuleInterop&&this.hadDefaultExport&&!this.hadNamedExport?`
|
|
667
|
+
t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.typeParameterStart)?t.next.call(void 0):s.unexpected.call(void 0);do ne(),t.match.call(void 0,r.TokenType.greaterThan)||s.expect.call(void 0,r.TokenType.comma);while(!t.match.call(void 0,r.TokenType.greaterThan)&&!i.state.error);s.expect.call(void 0,r.TokenType.greaterThan),t.popTypeContext.call(void 0,e)}e.flowParseTypeParameterDeclaration=E;function re(){let e=t.pushTypeContext.call(void 0,0);for(s.expect.call(void 0,r.TokenType.lessThan);!t.match.call(void 0,r.TokenType.greaterThan)&&!i.state.error;)Se(),t.match.call(void 0,r.TokenType.greaterThan)||s.expect.call(void 0,r.TokenType.comma);s.expect.call(void 0,r.TokenType.greaterThan),t.popTypeContext.call(void 0,e)}function D(){if(s.expectContextual.call(void 0,n.ContextualKeyword._interface),t.eat.call(void 0,r.TokenType._extends))do C();while(t.eat.call(void 0,r.TokenType.comma));ce(!1,!1,!1)}function ie(){t.match.call(void 0,r.TokenType.num)||t.match.call(void 0,r.TokenType.string)?a.parseExprAtom.call(void 0):a.parseIdentifier.call(void 0)}function ae(){t.lookaheadType.call(void 0)===r.TokenType.colon?(ie(),l()):Se(),s.expect.call(void 0,r.TokenType.bracketR),l()}function oe(){ie(),s.expect.call(void 0,r.TokenType.bracketR),s.expect.call(void 0,r.TokenType.bracketR),t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.parenL)?se():(t.eat.call(void 0,r.TokenType.question),l())}function se(){for(t.match.call(void 0,r.TokenType.lessThan)&&E(),s.expect.call(void 0,r.TokenType.parenL);!t.match.call(void 0,r.TokenType.parenR)&&!t.match.call(void 0,r.TokenType.ellipsis)&&!i.state.error;)me(),t.match.call(void 0,r.TokenType.parenR)||s.expect.call(void 0,r.TokenType.comma);t.eat.call(void 0,r.TokenType.ellipsis)&&me(),s.expect.call(void 0,r.TokenType.parenR),l()}function O(){se()}function ce(e,a,o){let c;for(a&&t.match.call(void 0,r.TokenType.braceBarL)?(s.expect.call(void 0,r.TokenType.braceBarL),c=r.TokenType.braceBarR):(s.expect.call(void 0,r.TokenType.braceL),c=r.TokenType.braceR);!t.match.call(void 0,c)&&!i.state.error;){if(o&&s.isContextual.call(void 0,n.ContextualKeyword._proto)){let n=t.lookaheadType.call(void 0);n!==r.TokenType.colon&&n!==r.TokenType.question&&(t.next.call(void 0),e=!1)}if(e&&s.isContextual.call(void 0,n.ContextualKeyword._static)){let e=t.lookaheadType.call(void 0);e!==r.TokenType.colon&&e!==r.TokenType.question&&t.next.call(void 0)}if(Te(),t.eat.call(void 0,r.TokenType.bracketL))t.eat.call(void 0,r.TokenType.bracketL)?oe():ae();else if(t.match.call(void 0,r.TokenType.parenL)||t.match.call(void 0,r.TokenType.lessThan))O();else{if(s.isContextual.call(void 0,n.ContextualKeyword._get)||s.isContextual.call(void 0,n.ContextualKeyword._set)){let e=t.lookaheadType.call(void 0);(e===r.TokenType.name||e===r.TokenType.string||e===r.TokenType.num)&&t.next.call(void 0)}le()}ue()}s.expect.call(void 0,c)}function le(){if(t.match.call(void 0,r.TokenType.ellipsis)){if(s.expect.call(void 0,r.TokenType.ellipsis),t.eat.call(void 0,r.TokenType.comma)||t.eat.call(void 0,r.TokenType.semi),t.match.call(void 0,r.TokenType.braceR))return;Se()}else ie(),t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.parenL)?se():(t.eat.call(void 0,r.TokenType.question),l())}function ue(){t.eat.call(void 0,r.TokenType.semi)||t.eat.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)||t.match.call(void 0,r.TokenType.braceBarR)||s.unexpected.call(void 0)}function de(e){for(e||a.parseIdentifier.call(void 0);t.eat.call(void 0,r.TokenType.dot);)a.parseIdentifier.call(void 0)}function fe(){de(!0),t.match.call(void 0,r.TokenType.lessThan)&&re()}function k(){s.expect.call(void 0,r.TokenType._typeof),ge()}function pe(){for(s.expect.call(void 0,r.TokenType.bracketL);i.state.pos<i.input.length&&!t.match.call(void 0,r.TokenType.bracketR)&&(Se(),!t.match.call(void 0,r.TokenType.bracketR));)s.expect.call(void 0,r.TokenType.comma);s.expect.call(void 0,r.TokenType.bracketR)}function me(){let e=t.lookaheadType.call(void 0);e===r.TokenType.colon||e===r.TokenType.question?(a.parseIdentifier.call(void 0),t.eat.call(void 0,r.TokenType.question),l()):Se()}function he(){for(;!t.match.call(void 0,r.TokenType.parenR)&&!t.match.call(void 0,r.TokenType.ellipsis)&&!i.state.error;)me(),t.match.call(void 0,r.TokenType.parenR)||s.expect.call(void 0,r.TokenType.comma);t.eat.call(void 0,r.TokenType.ellipsis)&&me()}function ge(){let e=!1,o=i.state.noAnonFunctionType;switch(i.state.type){case r.TokenType.name:if(s.isContextual.call(void 0,n.ContextualKeyword._interface)){D();return}a.parseIdentifier.call(void 0),fe();return;case r.TokenType.braceL:ce(!1,!1,!1);return;case r.TokenType.braceBarL:ce(!1,!0,!1);return;case r.TokenType.bracketL:pe();return;case r.TokenType.lessThan:E(),s.expect.call(void 0,r.TokenType.parenL),he(),s.expect.call(void 0,r.TokenType.parenR),s.expect.call(void 0,r.TokenType.arrow),Se();return;case r.TokenType.parenL:if(t.next.call(void 0),!t.match.call(void 0,r.TokenType.parenR)&&!t.match.call(void 0,r.TokenType.ellipsis)){if(t.match.call(void 0,r.TokenType.name)){let n=t.lookaheadType.call(void 0);e=n!==r.TokenType.question&&n!==r.TokenType.colon}else e=!0}if(e){if(i.state.noAnonFunctionType=!1,Se(),i.state.noAnonFunctionType=o,i.state.noAnonFunctionType||!(t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.parenR)&&t.lookaheadType.call(void 0)===r.TokenType.arrow)){s.expect.call(void 0,r.TokenType.parenR);return}t.eat.call(void 0,r.TokenType.comma)}he(),s.expect.call(void 0,r.TokenType.parenR),s.expect.call(void 0,r.TokenType.arrow),Se();return;case r.TokenType.minus:t.next.call(void 0),a.parseLiteral.call(void 0);return;case r.TokenType.string:case r.TokenType.num:case r.TokenType._true:case r.TokenType._false:case r.TokenType._null:case r.TokenType._this:case r.TokenType._void:case r.TokenType.star:t.next.call(void 0);return;default:if(i.state.type===r.TokenType._typeof){k();return}if(i.state.type&r.TokenType.IS_KEYWORD){t.next.call(void 0),i.state.tokens[i.state.tokens.length-1].type=r.TokenType.name;return}}s.unexpected.call(void 0)}function _e(){for(ge();!s.canInsertSemicolon.call(void 0)&&(t.match.call(void 0,r.TokenType.bracketL)||t.match.call(void 0,r.TokenType.questionDot));)t.eat.call(void 0,r.TokenType.questionDot),s.expect.call(void 0,r.TokenType.bracketL),t.eat.call(void 0,r.TokenType.bracketR)||(Se(),s.expect.call(void 0,r.TokenType.bracketR))}function ve(){t.eat.call(void 0,r.TokenType.question)?ve():_e()}function ye(){ve(),!i.state.noAnonFunctionType&&t.eat.call(void 0,r.TokenType.arrow)&&Se()}function be(){for(t.eat.call(void 0,r.TokenType.bitwiseAND),ye();t.eat.call(void 0,r.TokenType.bitwiseAND);)ye()}function xe(){for(t.eat.call(void 0,r.TokenType.bitwiseOR),be();t.eat.call(void 0,r.TokenType.bitwiseOR);)be()}function Se(){xe()}function Ce(){l()}e.flowParseTypeAnnotation=Ce;function we(){a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.colon)&&Ce()}function Te(){(t.match.call(void 0,r.TokenType.plus)||t.match.call(void 0,r.TokenType.minus))&&(t.next.call(void 0),i.state.tokens[i.state.tokens.length-1].isType=!0)}e.flowParseVariance=Te,e.flowParseFunctionBodyAndFinish=function(e){t.match.call(void 0,r.TokenType.colon)&&d(),a.parseFunctionBody.call(void 0,!1,e)},e.flowParseSubscript=function(e,n,o){if(t.match.call(void 0,r.TokenType.questionDot)&&t.lookaheadType.call(void 0)===r.TokenType.lessThan){if(n){o.stop=!0;return}t.next.call(void 0),re(),s.expect.call(void 0,r.TokenType.parenL),a.parseCallExpressionArguments.call(void 0)}else{if(!n&&t.match.call(void 0,r.TokenType.lessThan)){let e=i.state.snapshot();if(re(),s.expect.call(void 0,r.TokenType.parenL),a.parseCallExpressionArguments.call(void 0),i.state.error)i.state.restoreFromSnapshot(e);else return}a.baseParseSubscript.call(void 0,e,n,o)}},e.flowStartParseNewArguments=function(){if(t.match.call(void 0,r.TokenType.lessThan)){let e=i.state.snapshot();re(),i.state.error&&i.state.restoreFromSnapshot(e)}},e.flowTryParseStatement=function(){if(t.match.call(void 0,r.TokenType.name)&&i.state.contextualKeyword===n.ContextualKeyword._interface){let e=t.pushTypeContext.call(void 0,0);return t.next.call(void 0),w(),t.popTypeContext.call(void 0,e),!0}return s.isContextual.call(void 0,n.ContextualKeyword._enum)?(De(),!0):!1},e.flowTryParseExportDefaultExpression=function(){return s.isContextual.call(void 0,n.ContextualKeyword._enum)?(De(),!0):!1},e.flowParseIdentifierStatement=function(e){if(e===n.ContextualKeyword._declare){if(t.match.call(void 0,r.TokenType._class)||t.match.call(void 0,r.TokenType.name)||t.match.call(void 0,r.TokenType._function)||t.match.call(void 0,r.TokenType._var)||t.match.call(void 0,r.TokenType._export)){let e=t.pushTypeContext.call(void 0,1);m(),t.popTypeContext.call(void 0,e)}}else if(t.match.call(void 0,r.TokenType.name)){if(e===n.ContextualKeyword._interface){let e=t.pushTypeContext.call(void 0,1);w(),t.popTypeContext.call(void 0,e)}else if(e===n.ContextualKeyword._type){let e=t.pushTypeContext.call(void 0,1);ee(),t.popTypeContext.call(void 0,e)}else if(e===n.ContextualKeyword._opaque){let e=t.pushTypeContext.call(void 0,1);te(!1),t.popTypeContext.call(void 0,e)}}s.semicolon.call(void 0)},e.flowShouldParseExportDeclaration=function(){return s.isContextual.call(void 0,n.ContextualKeyword._type)||s.isContextual.call(void 0,n.ContextualKeyword._interface)||s.isContextual.call(void 0,n.ContextualKeyword._opaque)||s.isContextual.call(void 0,n.ContextualKeyword._enum)},e.flowShouldDisallowExportDefaultSpecifier=function(){return t.match.call(void 0,r.TokenType.name)&&(i.state.contextualKeyword===n.ContextualKeyword._type||i.state.contextualKeyword===n.ContextualKeyword._interface||i.state.contextualKeyword===n.ContextualKeyword._opaque||i.state.contextualKeyword===n.ContextualKeyword._enum)},e.flowParseExportDeclaration=function(){if(s.isContextual.call(void 0,n.ContextualKeyword._type)){let e=t.pushTypeContext.call(void 0,1);t.next.call(void 0),t.match.call(void 0,r.TokenType.braceL)?(o.parseExportSpecifiers.call(void 0),o.parseExportFrom.call(void 0)):ee(),t.popTypeContext.call(void 0,e)}else if(s.isContextual.call(void 0,n.ContextualKeyword._opaque)){let e=t.pushTypeContext.call(void 0,1);t.next.call(void 0),te(!1),t.popTypeContext.call(void 0,e)}else if(s.isContextual.call(void 0,n.ContextualKeyword._interface)){let e=t.pushTypeContext.call(void 0,1);t.next.call(void 0),w(),t.popTypeContext.call(void 0,e)}else o.parseStatement.call(void 0,!0)},e.flowShouldParseExportStar=function(){return t.match.call(void 0,r.TokenType.star)||s.isContextual.call(void 0,n.ContextualKeyword._type)&&t.lookaheadType.call(void 0)===r.TokenType.star},e.flowParseExportStar=function(){if(s.eatContextual.call(void 0,n.ContextualKeyword._type)){let e=t.pushTypeContext.call(void 0,2);o.baseParseExportStar.call(void 0),t.popTypeContext.call(void 0,e)}else o.baseParseExportStar.call(void 0)},e.flowAfterParseClassSuper=function(e){if(e&&t.match.call(void 0,r.TokenType.lessThan)&&re(),s.isContextual.call(void 0,n.ContextualKeyword._implements)){let e=t.pushTypeContext.call(void 0,0);t.next.call(void 0),i.state.tokens[i.state.tokens.length-1].type=r.TokenType._implements;do T(),t.match.call(void 0,r.TokenType.lessThan)&&re();while(t.eat.call(void 0,r.TokenType.comma));t.popTypeContext.call(void 0,e)}},e.flowStartParseObjPropValue=function(){t.match.call(void 0,r.TokenType.lessThan)&&(E(),t.match.call(void 0,r.TokenType.parenL)||s.unexpected.call(void 0))},e.flowParseAssignableListItemTypes=function(){let e=t.pushTypeContext.call(void 0,0);t.eat.call(void 0,r.TokenType.question),t.match.call(void 0,r.TokenType.colon)&&Ce(),t.popTypeContext.call(void 0,e)},e.flowStartParseImportSpecifiers=function(){if(t.match.call(void 0,r.TokenType._typeof)||s.isContextual.call(void 0,n.ContextualKeyword._type)){let e=t.lookaheadTypeAndKeyword.call(void 0);(c(e)||e.type===r.TokenType.braceL||e.type===r.TokenType.star)&&t.next.call(void 0)}},e.flowParseImportSpecifier=function(){let e=i.state.contextualKeyword===n.ContextualKeyword._type||i.state.type===r.TokenType._typeof;e?t.next.call(void 0):a.parseIdentifier.call(void 0),s.isContextual.call(void 0,n.ContextualKeyword._as)&&!s.isLookaheadContextual.call(void 0,n.ContextualKeyword._as)?(a.parseIdentifier.call(void 0),e&&!t.match.call(void 0,r.TokenType.name)&&!(i.state.type&r.TokenType.IS_KEYWORD)||a.parseIdentifier.call(void 0)):(e&&(t.match.call(void 0,r.TokenType.name)||i.state.type&r.TokenType.IS_KEYWORD)&&a.parseIdentifier.call(void 0),s.eatContextual.call(void 0,n.ContextualKeyword._as)&&a.parseIdentifier.call(void 0))},e.flowStartParseFunctionParams=function(){if(t.match.call(void 0,r.TokenType.lessThan)){let e=t.pushTypeContext.call(void 0,0);E(),t.popTypeContext.call(void 0,e)}},e.flowAfterParseVarHead=function(){t.match.call(void 0,r.TokenType.colon)&&Ce()},e.flowStartParseAsyncArrowFromCallExpression=function(){if(t.match.call(void 0,r.TokenType.colon)){let e=i.state.noAnonFunctionType;i.state.noAnonFunctionType=!0,Ce(),i.state.noAnonFunctionType=e}},e.flowParseMaybeAssign=function(e,n){if(t.match.call(void 0,r.TokenType.lessThan)){let o=i.state.snapshot(),c=a.baseParseMaybeAssign.call(void 0,e,n);if(i.state.error)i.state.restoreFromSnapshot(o),i.state.type=r.TokenType.typeParameterStart;else return c;let l=t.pushTypeContext.call(void 0,0);if(E(),t.popTypeContext.call(void 0,l),c=a.baseParseMaybeAssign.call(void 0,e,n),c)return!0;s.unexpected.call(void 0)}return a.baseParseMaybeAssign.call(void 0,e,n)},e.flowParseArrow=function(){if(t.match.call(void 0,r.TokenType.colon)){let e=t.pushTypeContext.call(void 0,0),n=i.state.snapshot(),a=i.state.noAnonFunctionType;i.state.noAnonFunctionType=!0,d(),i.state.noAnonFunctionType=a,s.canInsertSemicolon.call(void 0)&&s.unexpected.call(void 0),t.match.call(void 0,r.TokenType.arrow)||s.unexpected.call(void 0),i.state.error&&i.state.restoreFromSnapshot(n),t.popTypeContext.call(void 0,e)}return t.eat.call(void 0,r.TokenType.arrow)},e.flowParseSubscripts=function(e,o=!1){if(i.state.tokens[i.state.tokens.length-1].contextualKeyword===n.ContextualKeyword._async&&t.match.call(void 0,r.TokenType.lessThan)){let e=i.state.snapshot();if(Ee()&&!i.state.error)return;i.state.restoreFromSnapshot(e)}a.baseParseSubscripts.call(void 0,e,o)};function Ee(){i.state.scopeDepth++;let e=i.state.tokens.length;return o.parseFunctionParams.call(void 0),a.parseArrow.call(void 0)?(a.parseArrowExpression.call(void 0,e),!0):!1}function De(){s.expectContextual.call(void 0,n.ContextualKeyword._enum),i.state.tokens[i.state.tokens.length-1].type=r.TokenType._enum,a.parseIdentifier.call(void 0),Oe()}function Oe(){s.eatContextual.call(void 0,n.ContextualKeyword._of)&&t.next.call(void 0),s.expect.call(void 0,r.TokenType.braceL),ke(),s.expect.call(void 0,r.TokenType.braceR)}function ke(){for(;!t.match.call(void 0,r.TokenType.braceR)&&!i.state.error&&!t.eat.call(void 0,r.TokenType.ellipsis);)A(),t.match.call(void 0,r.TokenType.braceR)||s.expect.call(void 0,r.TokenType.comma)}function A(){a.parseIdentifier.call(void 0),t.eat.call(void 0,r.TokenType.eq)&&t.next.call(void 0)}})),Pw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Iw(),n=Nw(),r=kw(),i=ow(),a=ZC(),o=QC(),s=G(),c=$C(),l=ew(),u=Mw(),d=Ow(),f=tw();e.parseTopLevel=function(){if(ue(s.TokenType.eof),l.state.scopes.push(new o.Scope(0,l.state.tokens.length,!0)),l.state.scopeDepth!==0)throw Error(`Invalid scope depth at end of file: ${l.state.scopeDepth}`);return new t.File(l.state.tokens,l.state.scopes)};function p(e){l.isFlowEnabled&&n.flowTryParseStatement.call(void 0)||(i.match.call(void 0,s.TokenType.at)&&g(),m(e))}e.parseStatement=p;function m(e){if(l.isTypeScriptEnabled&&r.tsTryParseStatementContent.call(void 0))return;let t=l.state.type;switch(t){case s.TokenType._break:case s.TokenType._continue:b();return;case s.TokenType._debugger:x();return;case s.TokenType._do:S();return;case s.TokenType._for:C();return;case s.TokenType._function:if(i.lookaheadType.call(void 0)===s.TokenType.dot)break;e||f.unexpected.call(void 0),ee();return;case s.TokenType._class:e||f.unexpected.call(void 0),ge(!0);return;case s.TokenType._if:te();return;case s.TokenType._return:ne();return;case s.TokenType._switch:E();return;case s.TokenType._throw:re();return;case s.TokenType._try:ie();return;case s.TokenType._let:case s.TokenType._const:e||f.unexpected.call(void 0);case s.TokenType._var:ae(t!==s.TokenType._var);return;case s.TokenType._while:oe();return;case s.TokenType.braceL:le();return;case s.TokenType.semi:se();return;case s.TokenType._export:case s.TokenType._import:{let e=i.lookaheadType.call(void 0);if(e===s.TokenType.parenL||e===s.TokenType.dot)break;i.next.call(void 0),t===s.TokenType._import?He():Oe();return}case s.TokenType.name:if(l.state.contextualKeyword===a.ContextualKeyword._async){let e=l.state.start,t=l.state.snapshot();if(i.next.call(void 0),i.match.call(void 0,s.TokenType._function)&&!f.canInsertSemicolon.call(void 0)){f.expect.call(void 0,s.TokenType._function),me(e,!0);return}l.state.restoreFromSnapshot(t)}else if(l.state.contextualKeyword===a.ContextualKeyword._using&&!f.hasFollowingLineBreak.call(void 0)&&i.lookaheadType.call(void 0)===s.TokenType.name){ae(!0);return}else if(h()){f.expectContextual.call(void 0,a.ContextualKeyword._await),ae(!0);return}}let n=l.state.tokens.length;u.parseExpression.call(void 0);let o=null;if(l.state.tokens.length===n+1){let e=l.state.tokens[l.state.tokens.length-1];e.type===s.TokenType.name&&(o=e.contextualKeyword)}o==null?f.semicolon.call(void 0):i.eat.call(void 0,s.TokenType.colon)?O():ce(o)}function h(){if(!f.isContextual.call(void 0,a.ContextualKeyword._await))return!1;let e=l.state.snapshot();return i.next.call(void 0),!f.isContextual.call(void 0,a.ContextualKeyword._using)||f.hasPrecedingLineBreak.call(void 0)||(i.next.call(void 0),!i.match.call(void 0,s.TokenType.name)||f.hasPrecedingLineBreak.call(void 0))?(l.state.restoreFromSnapshot(e),!1):(l.state.restoreFromSnapshot(e),!0)}function g(){for(;i.match.call(void 0,s.TokenType.at);)_()}e.parseDecorators=g;function _(){if(i.next.call(void 0),i.eat.call(void 0,s.TokenType.parenL))u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.parenR);else{for(u.parseIdentifier.call(void 0);i.eat.call(void 0,s.TokenType.dot);)u.parseIdentifier.call(void 0);v()}}function v(){l.isTypeScriptEnabled?r.tsParseMaybeDecoratorArguments.call(void 0):y()}function y(){i.eat.call(void 0,s.TokenType.parenL)&&u.parseCallExpressionArguments.call(void 0)}e.baseParseMaybeDecoratorArguments=y;function b(){i.next.call(void 0),f.isLineTerminator.call(void 0)||(u.parseIdentifier.call(void 0),f.semicolon.call(void 0))}function x(){i.next.call(void 0),f.semicolon.call(void 0)}function S(){i.next.call(void 0),p(!1),f.expect.call(void 0,s.TokenType._while),u.parseParenExpression.call(void 0),i.eat.call(void 0,s.TokenType.semi)}function C(){l.state.scopeDepth++;let e=l.state.tokens.length;T();let t=l.state.tokens.length;l.state.scopes.push(new o.Scope(e,t,!1)),l.state.scopeDepth--}function w(){return!(!f.isContextual.call(void 0,a.ContextualKeyword._using)||f.isLookaheadContextual.call(void 0,a.ContextualKeyword._of))}function T(){i.next.call(void 0);let e=!1;if(f.isContextual.call(void 0,a.ContextualKeyword._await)&&(e=!0,i.next.call(void 0)),f.expect.call(void 0,s.TokenType.parenL),i.match.call(void 0,s.TokenType.semi)){e&&f.unexpected.call(void 0),de();return}let t=h();if(t||i.match.call(void 0,s.TokenType._var)||i.match.call(void 0,s.TokenType._let)||i.match.call(void 0,s.TokenType._const)||w()){if(t&&f.expectContextual.call(void 0,a.ContextualKeyword._await),i.next.call(void 0),k(!0,l.state.type!==s.TokenType._var),i.match.call(void 0,s.TokenType._in)||f.isContextual.call(void 0,a.ContextualKeyword._of)){fe(e);return}de()}else u.parseExpression.call(void 0,!0),i.match.call(void 0,s.TokenType._in)||f.isContextual.call(void 0,a.ContextualKeyword._of)?fe(e):(e&&f.unexpected.call(void 0),de())}function ee(){let e=l.state.start;i.next.call(void 0),me(e,!0)}function te(){i.next.call(void 0),u.parseParenExpression.call(void 0),p(!1),i.eat.call(void 0,s.TokenType._else)&&p(!1)}function ne(){i.next.call(void 0),f.isLineTerminator.call(void 0)||(u.parseExpression.call(void 0),f.semicolon.call(void 0))}function E(){i.next.call(void 0),u.parseParenExpression.call(void 0),l.state.scopeDepth++;let e=l.state.tokens.length;for(f.expect.call(void 0,s.TokenType.braceL);!i.match.call(void 0,s.TokenType.braceR)&&!l.state.error;)if(i.match.call(void 0,s.TokenType._case)||i.match.call(void 0,s.TokenType._default)){let e=i.match.call(void 0,s.TokenType._case);i.next.call(void 0),e&&u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.colon)}else p(!0);i.next.call(void 0);let t=l.state.tokens.length;l.state.scopes.push(new o.Scope(e,t,!1)),l.state.scopeDepth--}function re(){i.next.call(void 0),u.parseExpression.call(void 0),f.semicolon.call(void 0)}function D(){d.parseBindingAtom.call(void 0,!0),l.isTypeScriptEnabled&&r.tsTryParseTypeAnnotation.call(void 0)}function ie(){if(i.next.call(void 0),le(),i.match.call(void 0,s.TokenType._catch)){i.next.call(void 0);let e=null;if(i.match.call(void 0,s.TokenType.parenL)&&(l.state.scopeDepth++,e=l.state.tokens.length,f.expect.call(void 0,s.TokenType.parenL),D(),f.expect.call(void 0,s.TokenType.parenR)),le(),e!=null){let t=l.state.tokens.length;l.state.scopes.push(new o.Scope(e,t,!1)),l.state.scopeDepth--}}i.eat.call(void 0,s.TokenType._finally)&&le()}function ae(e){i.next.call(void 0),k(!1,e),f.semicolon.call(void 0)}e.parseVarStatement=ae;function oe(){i.next.call(void 0),u.parseParenExpression.call(void 0),p(!1)}function se(){i.next.call(void 0)}function O(){p(!0)}function ce(e){l.isTypeScriptEnabled?r.tsParseIdentifierStatement.call(void 0,e):l.isFlowEnabled?n.flowParseIdentifierStatement.call(void 0,e):f.semicolon.call(void 0)}function le(e=!1,t=0){let n=l.state.tokens.length;l.state.scopeDepth++,f.expect.call(void 0,s.TokenType.braceL),t&&(l.state.tokens[l.state.tokens.length-1].contextId=t),ue(s.TokenType.braceR),t&&(l.state.tokens[l.state.tokens.length-1].contextId=t);let r=l.state.tokens.length;l.state.scopes.push(new o.Scope(n,r,e)),l.state.scopeDepth--}e.parseBlock=le;function ue(e){for(;!i.eat.call(void 0,e)&&!l.state.error;)p(!0)}e.parseBlockBody=ue;function de(){f.expect.call(void 0,s.TokenType.semi),i.match.call(void 0,s.TokenType.semi)||u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.semi),i.match.call(void 0,s.TokenType.parenR)||u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.parenR),p(!1)}function fe(e){e?f.eatContextual.call(void 0,a.ContextualKeyword._of):i.next.call(void 0),u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.parenR),p(!1)}function k(e,t){for(;;){if(pe(t),i.eat.call(void 0,s.TokenType.eq)){let t=l.state.tokens.length-1;u.parseMaybeAssign.call(void 0,e),l.state.tokens[t].rhsEndIndex=l.state.tokens.length}if(!i.eat.call(void 0,s.TokenType.comma))break}}function pe(e){d.parseBindingAtom.call(void 0,e),l.isTypeScriptEnabled?r.tsAfterParseVarHead.call(void 0):l.isFlowEnabled&&n.flowAfterParseVarHead.call(void 0)}function me(e,t,n=!1){i.match.call(void 0,s.TokenType.star)&&i.next.call(void 0),t&&!n&&!i.match.call(void 0,s.TokenType.name)&&!i.match.call(void 0,s.TokenType._yield)&&f.unexpected.call(void 0);let r=null;i.match.call(void 0,s.TokenType.name)&&(t||(r=l.state.tokens.length,l.state.scopeDepth++),d.parseBindingIdentifier.call(void 0,!1));let a=l.state.tokens.length;l.state.scopeDepth++,he(),u.parseFunctionBodyAndFinish.call(void 0,e);let c=l.state.tokens.length;l.state.scopes.push(new o.Scope(a,c,!0)),l.state.scopeDepth--,r!==null&&(l.state.scopes.push(new o.Scope(r,c,!0)),l.state.scopeDepth--)}e.parseFunction=me;function he(e=!1,t=0){l.isTypeScriptEnabled?r.tsStartParseFunctionParams.call(void 0):l.isFlowEnabled&&n.flowStartParseFunctionParams.call(void 0),f.expect.call(void 0,s.TokenType.parenL),t&&(l.state.tokens[l.state.tokens.length-1].contextId=t),d.parseBindingList.call(void 0,s.TokenType.parenR,!1,!1,e,t),t&&(l.state.tokens[l.state.tokens.length-1].contextId=t)}e.parseFunctionParams=he;function ge(e,t=!1){let n=l.getNextContextId.call(void 0);i.next.call(void 0),l.state.tokens[l.state.tokens.length-1].contextId=n,l.state.tokens[l.state.tokens.length-1].isExpression=!e;let r=null;e||(r=l.state.tokens.length,l.state.scopeDepth++),Ee(e,t),De();let a=l.state.tokens.length;if(ye(n),!l.state.error&&(l.state.tokens[a].contextId=n,l.state.tokens[l.state.tokens.length-1].contextId=n,r!==null)){let e=l.state.tokens.length;l.state.scopes.push(new o.Scope(r,e,!1)),l.state.scopeDepth--}}e.parseClass=ge;function _e(){return i.match.call(void 0,s.TokenType.eq)||i.match.call(void 0,s.TokenType.semi)||i.match.call(void 0,s.TokenType.braceR)||i.match.call(void 0,s.TokenType.bang)||i.match.call(void 0,s.TokenType.colon)}function ve(){return i.match.call(void 0,s.TokenType.parenL)||i.match.call(void 0,s.TokenType.lessThan)}function ye(e){for(f.expect.call(void 0,s.TokenType.braceL);!i.eat.call(void 0,s.TokenType.braceR)&&!l.state.error;)i.eat.call(void 0,s.TokenType.semi)||(i.match.call(void 0,s.TokenType.at)?_():be(l.state.start,e))}function be(e,t){l.isTypeScriptEnabled&&r.tsParseModifiers.call(void 0,[a.ContextualKeyword._declare,a.ContextualKeyword._public,a.ContextualKeyword._protected,a.ContextualKeyword._private,a.ContextualKeyword._override]);let n=!1;if(i.match.call(void 0,s.TokenType.name)&&l.state.contextualKeyword===a.ContextualKeyword._static){if(u.parseIdentifier.call(void 0),ve()){Se(e,!1);return}if(_e()){Te();return}if(l.state.tokens[l.state.tokens.length-1].type=s.TokenType._static,n=!0,i.match.call(void 0,s.TokenType.braceL)){l.state.tokens[l.state.tokens.length-1].contextId=t,le();return}}xe(e,n,t)}function xe(e,t,n){if(l.isTypeScriptEnabled&&r.tsTryParseClassMemberWithIsStatic.call(void 0,t))return;if(i.eat.call(void 0,s.TokenType.star)){Ce(n),Se(e,!1);return}Ce(n);let o=!1,c=l.state.tokens[l.state.tokens.length-1];c.contextualKeyword===a.ContextualKeyword._constructor&&(o=!0),we(),ve()?Se(e,o):_e()?Te():c.contextualKeyword===a.ContextualKeyword._async&&!f.isLineTerminator.call(void 0)?(l.state.tokens[l.state.tokens.length-1].type=s.TokenType._async,i.match.call(void 0,s.TokenType.star)&&i.next.call(void 0),Ce(n),we(),Se(e,!1)):(c.contextualKeyword===a.ContextualKeyword._get||c.contextualKeyword===a.ContextualKeyword._set)&&!(f.isLineTerminator.call(void 0)&&i.match.call(void 0,s.TokenType.star))?(c.contextualKeyword===a.ContextualKeyword._get?l.state.tokens[l.state.tokens.length-1].type=s.TokenType._get:l.state.tokens[l.state.tokens.length-1].type=s.TokenType._set,Ce(n),Se(e,!1)):c.contextualKeyword===a.ContextualKeyword._accessor&&!f.isLineTerminator.call(void 0)?(Ce(n),Te()):f.isLineTerminator.call(void 0)?Te():f.unexpected.call(void 0)}function Se(e,t){l.isTypeScriptEnabled?r.tsTryParseTypeParameters.call(void 0):l.isFlowEnabled&&i.match.call(void 0,s.TokenType.lessThan)&&n.flowParseTypeParameterDeclaration.call(void 0),u.parseMethod.call(void 0,e,t)}function Ce(e){u.parsePropertyName.call(void 0,e)}e.parseClassPropertyName=Ce;function we(){if(l.isTypeScriptEnabled){let e=i.pushTypeContext.call(void 0,0);i.eat.call(void 0,s.TokenType.question),i.popTypeContext.call(void 0,e)}}e.parsePostMemberNameModifiers=we;function Te(){if(l.isTypeScriptEnabled?(i.eatTypeToken.call(void 0,s.TokenType.bang),r.tsTryParseTypeAnnotation.call(void 0)):l.isFlowEnabled&&i.match.call(void 0,s.TokenType.colon)&&n.flowParseTypeAnnotation.call(void 0),i.match.call(void 0,s.TokenType.eq)){let e=l.state.tokens.length;i.next.call(void 0),u.parseMaybeAssign.call(void 0),l.state.tokens[e].rhsEndIndex=l.state.tokens.length}f.semicolon.call(void 0)}e.parseClassProperty=Te;function Ee(e,t=!1){(!l.isTypeScriptEnabled||e&&!t||!f.isContextual.call(void 0,a.ContextualKeyword._implements))&&(i.match.call(void 0,s.TokenType.name)&&d.parseBindingIdentifier.call(void 0,!0),l.isTypeScriptEnabled?r.tsTryParseTypeParameters.call(void 0):l.isFlowEnabled&&i.match.call(void 0,s.TokenType.lessThan)&&n.flowParseTypeParameterDeclaration.call(void 0))}function De(){let e=!1;i.eat.call(void 0,s.TokenType._extends)?(u.parseExprSubscripts.call(void 0),e=!0):e=!1,l.isTypeScriptEnabled?r.tsAfterParseClassSuper.call(void 0,e):l.isFlowEnabled&&n.flowAfterParseClassSuper.call(void 0,e)}function Oe(){let e=l.state.tokens.length-1;l.isTypeScriptEnabled&&r.tsTryParseExport.call(void 0)||(Ne()?Pe():Ae()?(u.parseIdentifier.call(void 0),i.match.call(void 0,s.TokenType.comma)&&i.lookaheadType.call(void 0)===s.TokenType.star?(f.expect.call(void 0,s.TokenType.comma),f.expect.call(void 0,s.TokenType.star),f.expectContextual.call(void 0,a.ContextualKeyword._as),u.parseIdentifier.call(void 0)):je(),Me()):i.eat.call(void 0,s.TokenType._default)?ke():Le()?A():(Re(),Me()),l.state.tokens[e].rhsEndIndex=l.state.tokens.length)}e.parseExport=Oe;function ke(){if(l.isTypeScriptEnabled&&r.tsTryParseExportDefaultExpression.call(void 0)||l.isFlowEnabled&&n.flowTryParseExportDefaultExpression.call(void 0))return;let e=l.state.start;i.eat.call(void 0,s.TokenType._function)?me(e,!0,!0):f.isContextual.call(void 0,a.ContextualKeyword._async)&&i.lookaheadType.call(void 0)===s.TokenType._function?(f.eatContextual.call(void 0,a.ContextualKeyword._async),i.eat.call(void 0,s.TokenType._function),me(e,!0,!0)):i.match.call(void 0,s.TokenType._class)?ge(!0,!0):i.match.call(void 0,s.TokenType.at)?(g(),ge(!0,!0)):(u.parseMaybeAssign.call(void 0),f.semicolon.call(void 0))}function A(){l.isTypeScriptEnabled?r.tsParseExportDeclaration.call(void 0):l.isFlowEnabled?n.flowParseExportDeclaration.call(void 0):p(!0)}function Ae(){if(l.isTypeScriptEnabled&&r.tsIsDeclarationStart.call(void 0)||l.isFlowEnabled&&n.flowShouldDisallowExportDefaultSpecifier.call(void 0))return!1;if(i.match.call(void 0,s.TokenType.name))return l.state.contextualKeyword!==a.ContextualKeyword._async;if(!i.match.call(void 0,s.TokenType._default))return!1;let e=i.nextTokenStart.call(void 0),t=i.lookaheadTypeAndKeyword.call(void 0),o=t.type===s.TokenType.name&&t.contextualKeyword===a.ContextualKeyword._from;if(t.type===s.TokenType.comma)return!0;if(o){let t=l.input.charCodeAt(i.nextTokenStartSince.call(void 0,e+4));return t===c.charCodes.quotationMark||t===c.charCodes.apostrophe}return!1}function je(){i.eat.call(void 0,s.TokenType.comma)&&Re()}function Me(){f.eatContextual.call(void 0,a.ContextualKeyword._from)&&(u.parseExprAtom.call(void 0),Ke()),f.semicolon.call(void 0)}e.parseExportFrom=Me;function Ne(){return l.isFlowEnabled?n.flowShouldParseExportStar.call(void 0):i.match.call(void 0,s.TokenType.star)}function Pe(){l.isFlowEnabled?n.flowParseExportStar.call(void 0):Fe()}function Fe(){f.expect.call(void 0,s.TokenType.star),f.isContextual.call(void 0,a.ContextualKeyword._as)?Ie():Me()}e.baseParseExportStar=Fe;function Ie(){i.next.call(void 0),l.state.tokens[l.state.tokens.length-1].type=s.TokenType._as,u.parseIdentifier.call(void 0),je(),Me()}function Le(){return l.isTypeScriptEnabled&&r.tsIsDeclarationStart.call(void 0)||l.isFlowEnabled&&n.flowShouldParseExportDeclaration.call(void 0)||l.state.type===s.TokenType._var||l.state.type===s.TokenType._const||l.state.type===s.TokenType._let||l.state.type===s.TokenType._function||l.state.type===s.TokenType._class||f.isContextual.call(void 0,a.ContextualKeyword._async)||i.match.call(void 0,s.TokenType.at)}function Re(){let e=!0;for(f.expect.call(void 0,s.TokenType.braceL);!i.eat.call(void 0,s.TokenType.braceR)&&!l.state.error;){if(e)e=!1;else if(f.expect.call(void 0,s.TokenType.comma),i.eat.call(void 0,s.TokenType.braceR))break;ze()}}e.parseExportSpecifiers=Re;function ze(){l.isTypeScriptEnabled?r.tsParseExportSpecifier.call(void 0):(u.parseIdentifier.call(void 0),l.state.tokens[l.state.tokens.length-1].identifierRole=i.IdentifierRole.ExportAccess,f.eatContextual.call(void 0,a.ContextualKeyword._as)&&u.parseIdentifier.call(void 0))}function Be(){let e=l.state.snapshot();return f.expectContextual.call(void 0,a.ContextualKeyword._module),f.eatContextual.call(void 0,a.ContextualKeyword._from)?f.isContextual.call(void 0,a.ContextualKeyword._from)?(l.state.restoreFromSnapshot(e),!0):(l.state.restoreFromSnapshot(e),!1):i.match.call(void 0,s.TokenType.comma)?(l.state.restoreFromSnapshot(e),!1):(l.state.restoreFromSnapshot(e),!0)}function Ve(){f.isContextual.call(void 0,a.ContextualKeyword._module)&&Be()&&i.next.call(void 0)}function He(){if(l.isTypeScriptEnabled&&i.match.call(void 0,s.TokenType.name)&&i.lookaheadType.call(void 0)===s.TokenType.eq)r.tsParseImportEqualsDeclaration.call(void 0);else{if(l.isTypeScriptEnabled&&f.isContextual.call(void 0,a.ContextualKeyword._type)){let e=i.lookaheadTypeAndKeyword.call(void 0);if(e.type===s.TokenType.name&&e.contextualKeyword!==a.ContextualKeyword._from){if(f.expectContextual.call(void 0,a.ContextualKeyword._type),i.lookaheadType.call(void 0)===s.TokenType.eq){r.tsParseImportEqualsDeclaration.call(void 0);return}}else(e.type===s.TokenType.star||e.type===s.TokenType.braceL)&&f.expectContextual.call(void 0,a.ContextualKeyword._type)}i.match.call(void 0,s.TokenType.string)||(Ve(),We(),f.expectContextual.call(void 0,a.ContextualKeyword._from)),u.parseExprAtom.call(void 0),Ke(),f.semicolon.call(void 0)}}e.parseImport=He;function j(){return i.match.call(void 0,s.TokenType.name)}function Ue(){d.parseImportedIdentifier.call(void 0)}function We(){l.isFlowEnabled&&n.flowStartParseImportSpecifiers.call(void 0);let e=!0;if(!(j()&&(Ue(),!i.eat.call(void 0,s.TokenType.comma)))){if(i.match.call(void 0,s.TokenType.star))i.next.call(void 0),f.expectContextual.call(void 0,a.ContextualKeyword._as),Ue();else for(f.expect.call(void 0,s.TokenType.braceL);!i.eat.call(void 0,s.TokenType.braceR)&&!l.state.error;){if(e)e=!1;else if(i.eat.call(void 0,s.TokenType.colon)&&f.unexpected.call(void 0,`ES2015 named imports do not destructure. Use another statement for destructuring after the import.`),f.expect.call(void 0,s.TokenType.comma),i.eat.call(void 0,s.TokenType.braceR))break;Ge()}}}function Ge(){l.isTypeScriptEnabled?r.tsParseImportSpecifier.call(void 0):l.isFlowEnabled?n.flowParseImportSpecifier.call(void 0):(d.parseImportedIdentifier.call(void 0),f.isContextual.call(void 0,a.ContextualKeyword._as)&&(l.state.tokens[l.state.tokens.length-1].identifierRole=i.IdentifierRole.ImportAccess,i.next.call(void 0),d.parseImportedIdentifier.call(void 0)))}function Ke(){(i.match.call(void 0,s.TokenType._with)||f.isContextual.call(void 0,a.ContextualKeyword._assert)&&!f.hasPrecedingLineBreak.call(void 0))&&(i.next.call(void 0),u.parseObj.call(void 0,!1,!1))}})),Fw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ow(),n=$C(),r=ew(),i=Pw();e.parseFile=function(){return r.state.pos===0&&r.input.charCodeAt(0)===n.charCodes.numberSign&&r.input.charCodeAt(1)===n.charCodes.exclamationMark&&t.skipLineComment.call(void 0,2),t.nextToken.call(void 0),i.parseTopLevel.call(void 0)}})),Iw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ew(),n=Fw();e.File=class{constructor(e,t){this.tokens=e,this.scopes=t}},e.parse=function(e,r,i,a){if(a&&i)throw Error(`Cannot combine flow and typescript plugins.`);t.initParser.call(void 0,e,r,i,a);let o=n.parseFile.call(void 0);if(t.state.error)throw t.augmentError.call(void 0,t.state.error);return o}})),Lw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ZC();e.default=function(e){let n=e.currentIndex(),r=0,i=e.currentToken();do{let a=e.tokens[n];if(a.isOptionalChainStart&&r++,a.isOptionalChainEnd&&r--,r+=a.numNullishCoalesceStarts,r-=a.numNullishCoalesceEnds,a.contextualKeyword===t.ContextualKeyword._await&&a.identifierRole==null&&a.scopeDepth===i.scopeDepth)return!0;n+=1}while(r>0&&n<e.tokens.length);return!1}})),Rw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=G(),r=t(Lw());e.default=class e{__init(){this.resultCode=``}__init2(){this.resultMappings=Array(this.tokens.length)}__init3(){this.tokenIndex=0}constructor(t,n,r,i,a){this.code=t,this.tokens=n,this.isFlowEnabled=r,this.disableESTransforms=i,this.helperManager=a,e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this)}snapshot(){return{resultCode:this.resultCode,tokenIndex:this.tokenIndex}}restoreToSnapshot(e){this.resultCode=e.resultCode,this.tokenIndex=e.tokenIndex}dangerouslyGetAndRemoveCodeSinceSnapshot(e){let t=this.resultCode.slice(e.resultCode.length);return this.resultCode=e.resultCode,t}reset(){this.resultCode=``,this.resultMappings=Array(this.tokens.length),this.tokenIndex=0}matchesContextualAtIndex(e,t){return this.matches1AtIndex(e,n.TokenType.name)&&this.tokens[e].contextualKeyword===t}identifierNameAtIndex(e){return this.identifierNameForToken(this.tokens[e])}identifierNameAtRelativeIndex(e){return this.identifierNameForToken(this.tokenAtRelativeIndex(e))}identifierName(){return this.identifierNameForToken(this.currentToken())}identifierNameForToken(e){return this.code.slice(e.start,e.end)}rawCodeForToken(e){return this.code.slice(e.start,e.end)}stringValueAtIndex(e){return this.stringValueForToken(this.tokens[e])}stringValue(){return this.stringValueForToken(this.currentToken())}stringValueForToken(e){return this.code.slice(e.start+1,e.end-1)}matches1AtIndex(e,t){return this.tokens[e].type===t}matches2AtIndex(e,t,n){return this.tokens[e].type===t&&this.tokens[e+1].type===n}matches3AtIndex(e,t,n,r){return this.tokens[e].type===t&&this.tokens[e+1].type===n&&this.tokens[e+2].type===r}matches1(e){return this.tokens[this.tokenIndex].type===e}matches2(e,t){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===t}matches3(e,t,n){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===t&&this.tokens[this.tokenIndex+2].type===n}matches4(e,t,n,r){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===t&&this.tokens[this.tokenIndex+2].type===n&&this.tokens[this.tokenIndex+3].type===r}matches5(e,t,n,r,i){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===t&&this.tokens[this.tokenIndex+2].type===n&&this.tokens[this.tokenIndex+3].type===r&&this.tokens[this.tokenIndex+4].type===i}matchesContextual(e){return this.matchesContextualAtIndex(this.tokenIndex,e)}matchesContextIdAndLabel(e,t){return this.matches1(e)&&this.currentToken().contextId===t}previousWhitespaceAndComments(){let e=this.code.slice(this.tokenIndex>0?this.tokens[this.tokenIndex-1].end:0,this.tokenIndex<this.tokens.length?this.tokens[this.tokenIndex].start:this.code.length);return this.isFlowEnabled&&(e=e.replace(/@flow/g,``)),e}replaceToken(e){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=e,this.appendTokenSuffix(),this.tokenIndex++}replaceTokenTrimmingLeftWhitespace(e){this.resultCode+=this.previousWhitespaceAndComments().replace(/[^\r\n]/g,``),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=e,this.appendTokenSuffix(),this.tokenIndex++}removeInitialToken(){this.replaceToken(``)}removeToken(){this.replaceTokenTrimmingLeftWhitespace(``)}removeBalancedCode(){let e=0;for(;!this.isAtEnd();){if(this.matches1(n.TokenType.braceL))e++;else if(this.matches1(n.TokenType.braceR)){if(e===0)return;e--}this.removeToken()}}copyExpectedToken(e){if(this.tokens[this.tokenIndex].type!==e)throw Error(`Expected token ${e}`);this.copyToken()}copyToken(){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}copyTokenWithPrefix(e){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultCode+=e,this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}appendTokenPrefix(){let e=this.currentToken();if((e.numNullishCoalesceStarts||e.isOptionalChainStart)&&(e.isAsyncOperation=r.default.call(void 0,this)),!this.disableESTransforms){if(e.numNullishCoalesceStarts)for(let t=0;t<e.numNullishCoalesceStarts;t++)e.isAsyncOperation?(this.resultCode+=`await `,this.resultCode+=this.helperManager.getHelperName(`asyncNullishCoalesce`)):this.resultCode+=this.helperManager.getHelperName(`nullishCoalesce`),this.resultCode+=`(`;e.isOptionalChainStart&&(e.isAsyncOperation&&(this.resultCode+=`await `),this.tokenIndex>0&&this.tokenAtRelativeIndex(-1).type===n.TokenType._delete?e.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName(`asyncOptionalChainDelete`):this.resultCode+=this.helperManager.getHelperName(`optionalChainDelete`):e.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName(`asyncOptionalChain`):this.resultCode+=this.helperManager.getHelperName(`optionalChain`),this.resultCode+=`([`)}}appendTokenSuffix(){let e=this.currentToken();if(e.isOptionalChainEnd&&!this.disableESTransforms&&(this.resultCode+=`])`),e.numNullishCoalesceEnds&&!this.disableESTransforms)for(let t=0;t<e.numNullishCoalesceEnds;t++)this.resultCode+=`))`}appendCode(e){this.resultCode+=e}currentToken(){return this.tokens[this.tokenIndex]}currentTokenCode(){let e=this.currentToken();return this.code.slice(e.start,e.end)}tokenAtRelativeIndex(e){return this.tokens[this.tokenIndex+e]}currentIndex(){return this.tokenIndex}nextToken(){if(this.tokenIndex===this.tokens.length)throw Error(`Unexpectedly reached end of input.`);this.tokenIndex++}previousToken(){this.tokenIndex--}finish(){if(this.tokenIndex!==this.tokens.length)throw Error(`Tried to finish processing tokens before reaching the end.`);return this.resultCode+=this.previousWhitespaceAndComments(),{code:this.resultCode,mappings:this.resultMappings}}isAtEnd(){return this.tokenIndex===this.tokens.length}}})),zw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ZC(),n=G();e.default=function(e,c,l,u){let d=c.snapshot(),f=i(c),p=[],m=[],h=[],g=null,_=[],v=[],y=c.currentToken().contextId;if(y==null)throw Error(`Expected non-null class context ID on class open-brace.`);for(c.nextToken();!c.matchesContextIdAndLabel(n.TokenType.braceR,y);)if(c.matchesContextual(t.ContextualKeyword._constructor)&&!c.currentToken().isType)({constructorInitializerStatements:p,constructorInsertPos:g}=a(c));else if(c.matches1(n.TokenType.semi))u||v.push({start:c.currentIndex(),end:c.currentIndex()+1}),c.nextToken();else if(c.currentToken().isType)c.nextToken();else{let i=c.currentIndex(),d=!1,f=!1,b=!1;for(;o(c.currentToken());)c.matches1(n.TokenType._static)&&(d=!0),c.matches1(n.TokenType.hash)&&(f=!0),(c.matches1(n.TokenType._declare)||c.matches1(n.TokenType._abstract))&&(b=!0),c.nextToken();if(d&&c.matches1(n.TokenType.braceL)||f){r(c,y);continue}if(c.matchesContextual(t.ContextualKeyword._constructor)&&!c.currentToken().isType){({constructorInitializerStatements:p,constructorInsertPos:g}=a(c));continue}let x=c.currentIndex();if(s(c),c.matches1(n.TokenType.lessThan)||c.matches1(n.TokenType.parenL)){r(c,y);continue}for(;c.currentToken().isType;)c.nextToken();if(c.matches1(n.TokenType.eq)){let t=c.currentIndex(),n=c.currentToken().rhsEndIndex;if(n==null)throw Error(`Expected rhsEndIndex on class field assignment.`);for(c.nextToken();c.currentIndex()<n;)e.processToken();let r;d?(r=l.claimFreeName(`__initStatic`),h.push(r)):(r=l.claimFreeName(`__init`),m.push(r)),_.push({initializerName:r,equalsIndex:t,start:x,end:c.currentIndex()})}else(!u||b)&&v.push({start:i,end:c.currentIndex()})}return c.restoreToSnapshot(d),u?{headerInfo:f,constructorInitializerStatements:p,instanceInitializerNames:[],staticInitializerNames:[],constructorInsertPos:g,fields:[],rangesToRemove:v}:{headerInfo:f,constructorInitializerStatements:p,instanceInitializerNames:m,staticInitializerNames:h,constructorInsertPos:g,fields:_,rangesToRemove:v}};function r(e,t){for(e.nextToken();e.currentToken().contextId!==t;)e.nextToken();for(;o(e.tokenAtRelativeIndex(-1));)e.previousToken()}function i(e){let t=e.currentToken(),r=t.contextId;if(r==null)throw Error(`Expected context ID on class token.`);let i=t.isExpression;if(i==null)throw Error(`Expected isExpression on class token.`);let a=null,o=!1;for(e.nextToken(),e.matches1(n.TokenType.name)&&(a=e.identifierName());!e.matchesContextIdAndLabel(n.TokenType.braceL,r);)e.matches1(n.TokenType._extends)&&!e.currentToken().isType&&(o=!0),e.nextToken();return{isExpression:i,className:a,hasSuperclass:o}}function a(e){let t=[];e.nextToken();let r=e.currentToken().contextId;if(r==null)throw Error(`Expected context ID on open-paren starting constructor params.`);for(;!e.matchesContextIdAndLabel(n.TokenType.parenR,r);)if(e.currentToken().contextId===r){if(e.nextToken(),o(e.currentToken())){for(e.nextToken();o(e.currentToken());)e.nextToken();let r=e.currentToken();if(r.type!==n.TokenType.name)throw Error(`Expected identifier after access modifiers in constructor arg.`);let i=e.identifierNameForToken(r);t.push(`this.${i} = ${i}`)}}else e.nextToken();for(e.nextToken();e.currentToken().isType;)e.nextToken();let i=e.currentIndex(),a=!1;for(;!e.matchesContextIdAndLabel(n.TokenType.braceR,r);){if(!a&&e.matches2(n.TokenType._super,n.TokenType.parenL)){e.nextToken();let t=e.currentToken().contextId;if(t==null)throw Error(`Expected a context ID on the super call`);for(;!e.matchesContextIdAndLabel(n.TokenType.parenR,t);)e.nextToken();i=e.currentIndex(),a=!0}e.nextToken()}return e.nextToken(),{constructorInitializerStatements:t,constructorInsertPos:i}}function o(e){return[n.TokenType._async,n.TokenType._get,n.TokenType._set,n.TokenType.plus,n.TokenType.minus,n.TokenType._readonly,n.TokenType._static,n.TokenType._public,n.TokenType._private,n.TokenType._protected,n.TokenType._override,n.TokenType._abstract,n.TokenType.star,n.TokenType._declare,n.TokenType.hash].includes(e.type)}function s(e){if(e.matches1(n.TokenType.bracketL)){let t=e.currentToken().contextId;if(t==null)throw Error(`Expected class context ID on computed name open bracket.`);for(;!e.matchesContextIdAndLabel(n.TokenType.bracketR,t);)e.nextToken();e.nextToken()}else e.nextToken()}})),Bw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=G();e.default=function(e){if(e.removeInitialToken(),e.removeToken(),e.removeToken(),e.removeToken(),e.matches1(t.TokenType.parenL))e.removeToken(),e.removeToken(),e.removeToken();else for(;e.matches1(t.TokenType.dot);)e.removeToken(),e.removeToken()}})),Vw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ow(),n=G();e.EMPTY_DECLARATION_INFO={typeDeclarations:/* @__PURE__ */ new Set,valueDeclarations:/* @__PURE__ */ new Set},e.default=function(e){let r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set;for(let a=0;a<e.tokens.length;a++){let o=e.tokens[a];o.type===n.TokenType.name&&t.isTopLevelDeclaration.call(void 0,o)&&(o.isType?r.add(e.identifierNameForToken(o)):i.add(e.identifierNameForToken(o)))}return{typeDeclarations:r,valueDeclarations:i}}})),Hw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ZC(),n=G();e.default=function(e){let r=e.currentIndex();for(;!e.matches1AtIndex(r,n.TokenType.braceR);)r++;return e.matchesContextualAtIndex(r+1,t.ContextualKeyword._from)&&e.matches1AtIndex(r+2,n.TokenType.string)}})),Uw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ZC(),n=G();e.removeMaybeImportAttributes=function(e){(e.matches2(n.TokenType._with,n.TokenType.braceL)||e.matches2(n.TokenType.name,n.TokenType.braceL)&&e.matchesContextual(t.ContextualKeyword._assert))&&(e.removeToken(),e.removeToken(),e.removeBalancedCode(),e.removeToken())}})),Ww=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=G();e.default=function(e,n,r,i){if(!e||n)return!1;let a=r.currentToken();if(a.rhsEndIndex==null)throw Error(`Expected non-null rhsEndIndex on export token.`);let o=a.rhsEndIndex-r.currentIndex();if(o!==3&&!(o===4&&r.matches1AtIndex(a.rhsEndIndex-1,t.TokenType.semi)))return!1;let s=r.tokenAtRelativeIndex(2);if(s.type!==t.TokenType.name)return!1;let c=r.identifierNameForToken(s);return i.typeDeclarations.has(c)&&!i.valueDeclarations.has(c)}})),Gw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=ow(),r=ZC(),i=G(),a=t(Bw()),o=Vw(),s=t(o),c=t(sw()),l=t(Hw()),u=Uw(),d=t(Ww()),f=t(uw());e.default=class e extends f.default{__init(){this.hadExport=!1}__init2(){this.hadNamedExport=!1}__init3(){this.hadDefaultExport=!1}constructor(t,n,r,i,a,c,l,u,d,f,p,m){super(),this.rootTransformer=t,this.tokens=n,this.importProcessor=r,this.nameManager=i,this.helperManager=a,this.reactHotLoaderTransformer=c,this.enableLegacyBabel5ModuleInterop=l,this.enableLegacyTypeScriptModuleInterop=u,this.isTypeScriptTransformEnabled=d,this.isFlowTransformEnabled=f,this.preserveDynamicImport=p,this.keepUnusedImports=m,e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),this.declarationInfo=d?s.default.call(void 0,n):o.EMPTY_DECLARATION_INFO}getPrefixCode(){let e=``;return this.hadExport&&(e+=`Object.defineProperty(exports, "__esModule", {value: true});`),e}getSuffixCode(){return this.enableLegacyBabel5ModuleInterop&&this.hadDefaultExport&&!this.hadNamedExport?`
|
|
668
668
|
module.exports = exports.default;
|
|
669
|
-
`:``}process(){return this.tokens.matches3(i.TokenType._import,i.TokenType.name,i.TokenType.eq)?this.processImportEquals():this.tokens.matches1(i.TokenType._import)?(this.processImport(),!0):this.tokens.matches2(i.TokenType._export,i.TokenType.eq)?(this.tokens.replaceToken(`module.exports`),!0):this.tokens.matches1(i.TokenType._export)&&!this.tokens.currentToken().isType?(this.hadExport=!0,this.processExport()):this.tokens.matches2(i.TokenType.name,i.TokenType.postIncDec)&&this.processPostIncDec()?!0:this.tokens.matches1(i.TokenType.name)||this.tokens.matches1(i.TokenType.jsxName)?this.processIdentifier():this.tokens.matches1(i.TokenType.eq)?this.processAssignment():this.tokens.matches1(i.TokenType.assign)?this.processComplexAssignment():this.tokens.matches1(i.TokenType.preIncDec)?this.processPreIncDec():!1}processImportEquals(){let e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.importProcessor.shouldAutomaticallyElideImportedName(e)?a.default.call(void 0,this.tokens):this.tokens.replaceToken(`const`),!0}processImport(){if(this.tokens.matches2(i.TokenType._import,i.TokenType.parenL)){if(this.preserveDynamicImport){this.tokens.copyToken();return}let e=this.enableLegacyTypeScriptModuleInterop?``:`${this.helperManager.getHelperName(`interopRequireWildcard`)}(`;this.tokens.replaceToken(`Promise.resolve().then(() => ${e}require`);let t=this.tokens.currentToken().contextId;if(t==null)throw Error(`Expected context ID on dynamic import invocation.`);for(this.tokens.copyToken();!this.tokens.matchesContextIdAndLabel(i.TokenType.parenR,t);)this.rootTransformer.processToken();this.tokens.replaceToken(e?`)))`:`))`)}else{if(this.removeImportAndDetectIfShouldElide())this.tokens.removeToken();else{let e=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(e)),this.tokens.appendCode(this.importProcessor.claimImportCode(e))}u.removeMaybeImportAttributes.call(void 0,this.tokens),this.tokens.matches1(i.TokenType.semi)&&this.tokens.removeToken()}}removeImportAndDetectIfShouldElide(){if(this.tokens.removeInitialToken(),this.tokens.matchesContextual(r.ContextualKeyword._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,i.TokenType.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,r.ContextualKeyword._from))return this.removeRemainingImport(),!0;if(this.tokens.matches1(i.TokenType.name)||this.tokens.matches1(i.TokenType.star))return this.removeRemainingImport(),!1;if(this.tokens.matches1(i.TokenType.string))return!1;let e=!1,t=!1;for(;!this.tokens.matches1(i.TokenType.string);)(!e&&this.tokens.matches1(i.TokenType.braceL)||this.tokens.matches1(i.TokenType.comma))&&(this.tokens.removeToken(),this.tokens.matches1(i.TokenType.braceR)||(t=!0),(this.tokens.matches2(i.TokenType.name,i.TokenType.comma)||this.tokens.matches2(i.TokenType.name,i.TokenType.braceR)||this.tokens.matches4(i.TokenType.name,i.TokenType.name,i.TokenType.name,i.TokenType.comma)||this.tokens.matches4(i.TokenType.name,i.TokenType.name,i.TokenType.name,i.TokenType.braceR))&&(e=!0)),this.tokens.removeToken();return this.keepUnusedImports?!1:this.isTypeScriptTransformEnabled?!e:this.isFlowTransformEnabled?t&&!e:!1}removeRemainingImport(){for(;!this.tokens.matches1(i.TokenType.string);)this.tokens.removeToken()}processIdentifier(){let e=this.tokens.currentToken();if(e.shadowsGlobal)return!1;if(e.identifierRole===n.IdentifierRole.ObjectShorthand)return this.processObjectShorthand();if(e.identifierRole!==n.IdentifierRole.Access)return!1;let t=this.importProcessor.getIdentifierReplacement(this.tokens.identifierNameForToken(e));if(!t)return!1;let r=this.tokens.currentIndex()+1;for(;r<this.tokens.tokens.length&&this.tokens.tokens[r].type===i.TokenType.parenR;)r++;return this.tokens.tokens[r].type===i.TokenType.parenL?this.tokens.tokenAtRelativeIndex(1).type===i.TokenType.parenL&&this.tokens.tokenAtRelativeIndex(-1).type!==i.TokenType._new?(this.tokens.replaceToken(`${t}.call(void 0, `),this.tokens.removeToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.parenR)):this.tokens.replaceToken(`(0, ${t})`):this.tokens.replaceToken(t),!0}processObjectShorthand(){let e=this.tokens.identifierName(),t=this.importProcessor.getIdentifierReplacement(e);return t?(this.tokens.replaceToken(`${e}: ${t}`),!0):!1}processExport(){if(this.tokens.matches2(i.TokenType._export,i.TokenType._enum)||this.tokens.matches3(i.TokenType._export,i.TokenType._const,i.TokenType._enum))return this.hadNamedExport=!0,!1;if(this.tokens.matches2(i.TokenType._export,i.TokenType._default))return this.tokens.matches3(i.TokenType._export,i.TokenType._default,i.TokenType._enum)?(this.hadDefaultExport=!0,!1):(this.processExportDefault(),!0);if(this.tokens.matches2(i.TokenType._export,i.TokenType.braceL))return this.processExportBindings(),!0;if(this.tokens.matches2(i.TokenType._export,i.TokenType.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,r.ContextualKeyword._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(i.TokenType.braceL)){for(;!this.tokens.matches1(i.TokenType.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(i.TokenType._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(r.ContextualKeyword._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,i.TokenType.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),u.removeMaybeImportAttributes.call(void 0,this.tokens)),!0}if(this.hadNamedExport=!0,this.tokens.matches2(i.TokenType._export,i.TokenType._var)||this.tokens.matches2(i.TokenType._export,i.TokenType._let)||this.tokens.matches2(i.TokenType._export,i.TokenType._const))return this.processExportVar(),!0;if(this.tokens.matches2(i.TokenType._export,i.TokenType._function)||this.tokens.matches3(i.TokenType._export,i.TokenType.name,i.TokenType._function))return this.processExportFunction(),!0;if(this.tokens.matches2(i.TokenType._export,i.TokenType._class)||this.tokens.matches3(i.TokenType._export,i.TokenType._abstract,i.TokenType._class)||this.tokens.matches2(i.TokenType._export,i.TokenType.at))return this.processExportClass(),!0;if(this.tokens.matches2(i.TokenType._export,i.TokenType.star))return this.processExportStar(),!0;throw Error(`Unrecognized export syntax.`)}processAssignment(){let e=this.tokens.currentIndex(),t=this.tokens.tokens[e-1];if(t.isType||t.type!==i.TokenType.name||t.shadowsGlobal||e>=2&&this.tokens.matches1AtIndex(e-2,i.TokenType.dot)||e>=2&&[i.TokenType._var,i.TokenType._let,i.TokenType._const].includes(this.tokens.tokens[e-2].type))return!1;let n=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(t));return n?(this.tokens.copyToken(),this.tokens.appendCode(` ${n} =`),!0):!1}processComplexAssignment(){let e=this.tokens.currentIndex(),t=this.tokens.tokens[e-1];if(t.type!==i.TokenType.name||t.shadowsGlobal||e>=2&&this.tokens.matches1AtIndex(e-2,i.TokenType.dot))return!1;let n=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(t));return n?(this.tokens.appendCode(` = ${n}`),this.tokens.copyToken(),!0):!1}processPreIncDec(){let e=this.tokens.currentIndex(),t=this.tokens.tokens[e+1];if(t.type!==i.TokenType.name||t.shadowsGlobal||e+2<this.tokens.tokens.length&&(this.tokens.matches1AtIndex(e+2,i.TokenType.dot)||this.tokens.matches1AtIndex(e+2,i.TokenType.bracketL)||this.tokens.matches1AtIndex(e+2,i.TokenType.parenL)))return!1;let n=this.tokens.identifierNameForToken(t),r=this.importProcessor.resolveExportBinding(n);return r?(this.tokens.appendCode(`${r} = `),this.tokens.copyToken(),!0):!1}processPostIncDec(){let e=this.tokens.currentIndex(),t=this.tokens.tokens[e],n=this.tokens.tokens[e+1];if(t.type!==i.TokenType.name||t.shadowsGlobal||e>=1&&this.tokens.matches1AtIndex(e-1,i.TokenType.dot))return!1;let r=this.tokens.identifierNameForToken(t),a=this.importProcessor.resolveExportBinding(r);if(!a)return!1;let o=this.tokens.rawCodeForToken(n),s=this.importProcessor.getIdentifierReplacement(r)||r;if(o===`++`)this.tokens.replaceToken(`(${s} = ${a} = ${s} + 1, ${s} - 1)`);else if(o===`--`)this.tokens.replaceToken(`(${s} = ${a} = ${s} - 1, ${s} + 1)`);else throw Error(`Unexpected operator: ${o}`);return this.tokens.removeToken(),!0}processExportDefault(){let e=!0;if(this.tokens.matches4(i.TokenType._export,i.TokenType._default,i.TokenType._function,i.TokenType.name)||this.tokens.matches5(i.TokenType._export,i.TokenType._default,i.TokenType.name,i.TokenType._function,i.TokenType.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,r.ContextualKeyword._async)){this.tokens.removeInitialToken(),this.tokens.removeToken();let e=this.processNamedFunction();this.tokens.appendCode(` exports.default = ${e};`)}else if(this.tokens.matches4(i.TokenType._export,i.TokenType._default,i.TokenType._class,i.TokenType.name)||this.tokens.matches5(i.TokenType._export,i.TokenType._default,i.TokenType._abstract,i.TokenType._class,i.TokenType.name)||this.tokens.matches3(i.TokenType._export,i.TokenType._default,i.TokenType.at)){this.tokens.removeInitialToken(),this.tokens.removeToken(),this.copyDecorators(),this.tokens.matches1(i.TokenType._abstract)&&this.tokens.removeToken();let e=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.default = ${e};`)}else if(d.default.call(void 0,this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))e=!1,this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken();else if(this.reactHotLoaderTransformer){let e=this.nameManager.claimFreeName(`_default`);this.tokens.replaceToken(`let ${e}; exports.`),this.tokens.copyToken(),this.tokens.appendCode(` = ${e} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(e)}else this.tokens.replaceToken(`exports.`),this.tokens.copyToken(),this.tokens.appendCode(` =`);e&&(this.hadDefaultExport=!0)}copyDecorators(){for(;this.tokens.matches1(i.TokenType.at);)if(this.tokens.copyToken(),this.tokens.matches1(i.TokenType.parenL))this.tokens.copyExpectedToken(i.TokenType.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.parenR);else{for(this.tokens.copyExpectedToken(i.TokenType.name);this.tokens.matches1(i.TokenType.dot);)this.tokens.copyExpectedToken(i.TokenType.dot),this.tokens.copyExpectedToken(i.TokenType.name);this.tokens.matches1(i.TokenType.parenL)&&(this.tokens.copyExpectedToken(i.TokenType.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.parenR))}}processExportVar(){this.isSimpleExportVar()?this.processSimpleExportVar():this.processComplexExportVar()}isSimpleExportVar(){let e=this.tokens.currentIndex();if(e++,e++,!this.tokens.matches1AtIndex(e,i.TokenType.name))return!1;for(e++;e<this.tokens.tokens.length&&this.tokens.tokens[e].isType;)e++;return!!this.tokens.matches1AtIndex(e,i.TokenType.eq)}processSimpleExportVar(){this.tokens.removeInitialToken(),this.tokens.copyToken();let e=this.tokens.identifierName();for(;!this.tokens.matches1(i.TokenType.eq);)this.rootTransformer.processToken();let t=this.tokens.currentToken().rhsEndIndex;if(t==null)throw Error(`Expected = token with an end index.`);for(;this.tokens.currentIndex()<t;)this.rootTransformer.processToken();this.tokens.appendCode(`; exports.${e} = ${e}`)}processComplexExportVar(){this.tokens.removeInitialToken(),this.tokens.removeToken();let e=this.tokens.matches1(i.TokenType.braceL);e&&this.tokens.appendCode(`(`);let t=0;for(;;)if(this.tokens.matches1(i.TokenType.braceL)||this.tokens.matches1(i.TokenType.dollarBraceL)||this.tokens.matches1(i.TokenType.bracketL))t++,this.tokens.copyToken();else if(this.tokens.matches1(i.TokenType.braceR)||this.tokens.matches1(i.TokenType.bracketR))t--,this.tokens.copyToken();else if(t===0&&!this.tokens.matches1(i.TokenType.name)&&!this.tokens.currentToken().isType)break;else if(this.tokens.matches1(i.TokenType.eq)){let e=this.tokens.currentToken().rhsEndIndex;if(e==null)throw Error(`Expected = token with an end index.`);for(;this.tokens.currentIndex()<e;)this.rootTransformer.processToken()}else{let e=this.tokens.currentToken();if(n.isDeclaration.call(void 0,e)){let t=this.tokens.identifierName(),r=this.importProcessor.getIdentifierReplacement(t);if(r===null)throw Error(`Expected a replacement for ${t} in \`export var\` syntax.`);n.isObjectShorthandDeclaration.call(void 0,e)&&(r=`${t}: ${r}`),this.tokens.replaceToken(r)}else this.rootTransformer.processToken()}if(e){let e=this.tokens.currentToken().rhsEndIndex;if(e==null)throw Error(`Expected = token with an end index.`);for(;this.tokens.currentIndex()<e;)this.rootTransformer.processToken();this.tokens.appendCode(`)`)}}processExportFunction(){this.tokens.replaceToken(``);let e=this.processNamedFunction();this.tokens.appendCode(` exports.${e} = ${e};`)}processNamedFunction(){if(this.tokens.matches1(i.TokenType._function))this.tokens.copyToken();else if(this.tokens.matches2(i.TokenType.name,i.TokenType._function)){if(!this.tokens.matchesContextual(r.ContextualKeyword._async))throw Error(`Expected async keyword in function export.`);this.tokens.copyToken(),this.tokens.copyToken()}if(this.tokens.matches1(i.TokenType.star)&&this.tokens.copyToken(),!this.tokens.matches1(i.TokenType.name))throw Error(`Expected identifier for exported function name.`);let e=this.tokens.identifierName();if(this.tokens.copyToken(),this.tokens.currentToken().isType)for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return this.tokens.copyExpectedToken(i.TokenType.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.parenR),this.rootTransformer.processPossibleTypeRange(),this.tokens.copyExpectedToken(i.TokenType.braceL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.braceR),e}processExportClass(){this.tokens.removeInitialToken(),this.copyDecorators(),this.tokens.matches1(i.TokenType._abstract)&&this.tokens.removeToken();let e=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.${e} = ${e};`)}processExportBindings(){this.tokens.removeInitialToken(),this.tokens.removeToken();let e=l.default.call(void 0,this.tokens),t=[];for(;;){if(this.tokens.matches1(i.TokenType.braceR)){this.tokens.removeToken();break}let n=c.default.call(void 0,this.tokens);for(;this.tokens.currentIndex()<n.endIndex;)this.tokens.removeToken();if(!(n.isType||!e&&this.shouldElideExportedIdentifier(n.leftName))){let e=n.rightName;e==="default"?this.hadDefaultExport=!0:this.hadNamedExport=!0;let r=n.leftName,i=this.importProcessor.getIdentifierReplacement(r);t.push(`exports.${e} = ${i||r};`)}if(this.tokens.matches1(i.TokenType.braceR)){this.tokens.removeToken();break}if(this.tokens.matches2(i.TokenType.comma,i.TokenType.braceR)){this.tokens.removeToken(),this.tokens.removeToken();break}if(this.tokens.matches1(i.TokenType.comma))this.tokens.removeToken();else throw Error(`Unexpected token: ${JSON.stringify(this.tokens.currentToken())}`)}if(this.tokens.matchesContextual(r.ContextualKeyword._from)){this.tokens.removeToken();let e=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(e)),u.removeMaybeImportAttributes.call(void 0,this.tokens)}else this.tokens.appendCode(t.join(` `));this.tokens.matches1(i.TokenType.semi)&&this.tokens.removeToken()}processExportStar(){for(this.tokens.removeInitialToken();!this.tokens.matches1(i.TokenType.string);)this.tokens.removeToken();let e=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(e)),u.removeMaybeImportAttributes.call(void 0,this.tokens),this.tokens.matches1(i.TokenType.semi)&&this.tokens.removeToken()}shouldElideExportedIdentifier(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.declarationInfo.valueDeclarations.has(e)}}})),Bw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=GC(),r=G(),i=t(Pw()),a=Fw(),o=t(a),s=t(tw()),c=ow(),l=t(Iw()),u=Lw(),d=t(Rw()),f=t(iw());e.default=class extends f.default{constructor(e,t,n,r,i,s,l,u){super(),this.tokens=e,this.nameManager=t,this.helperManager=n,this.reactHotLoaderTransformer=r,this.isTypeScriptTransformEnabled=i,this.isFlowTransformEnabled=s,this.keepUnusedImports=l,this.nonTypeIdentifiers=i&&!l?c.getNonTypeIdentifiers.call(void 0,e,u):/* @__PURE__ */ new Set,this.declarationInfo=i&&!l?o.default.call(void 0,e):a.EMPTY_DECLARATION_INFO,this.injectCreateRequireForImportRequire=!!u.injectCreateRequireForImportRequire}process(){if(this.tokens.matches3(r.TokenType._import,r.TokenType.name,r.TokenType.eq))return this.processImportEquals();if(this.tokens.matches4(r.TokenType._import,r.TokenType.name,r.TokenType.name,r.TokenType.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,n.ContextualKeyword._type)){this.tokens.removeInitialToken();for(let e=0;e<7;e++)this.tokens.removeToken();return!0}if(this.tokens.matches2(r.TokenType._export,r.TokenType.eq))return this.tokens.replaceToken(`module.exports`),!0;if(this.tokens.matches5(r.TokenType._export,r.TokenType._import,r.TokenType.name,r.TokenType.name,r.TokenType.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,n.ContextualKeyword._type)){this.tokens.removeInitialToken();for(let e=0;e<8;e++)this.tokens.removeToken();return!0}if(this.tokens.matches1(r.TokenType._import))return this.processImport();if(this.tokens.matches2(r.TokenType._export,r.TokenType._default))return this.processExportDefault();if(this.tokens.matches2(r.TokenType._export,r.TokenType.braceL))return this.processNamedExports();if(this.tokens.matches2(r.TokenType._export,r.TokenType.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,n.ContextualKeyword._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(r.TokenType.braceL)){for(;!this.tokens.matches1(r.TokenType.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(r.TokenType._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(n.ContextualKeyword._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.TokenType.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),u.removeMaybeImportAttributes.call(void 0,this.tokens)),!0}return!1}processImportEquals(){let e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.shouldAutomaticallyElideImportedName(e)?i.default.call(void 0,this.tokens):this.injectCreateRequireForImportRequire?(this.tokens.replaceToken(`const`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.replaceToken(this.helperManager.getHelperName(`require`))):this.tokens.replaceToken(`const`),!0}processImport(){if(this.tokens.matches2(r.TokenType._import,r.TokenType.parenL))return!1;let e=this.tokens.snapshot();if(this.removeImportTypeBindings()){for(this.tokens.restoreToSnapshot(e);!this.tokens.matches1(r.TokenType.string);)this.tokens.removeToken();this.tokens.removeToken(),u.removeMaybeImportAttributes.call(void 0,this.tokens),this.tokens.matches1(r.TokenType.semi)&&this.tokens.removeToken()}return!0}removeImportTypeBindings(){if(this.tokens.copyExpectedToken(r.TokenType._import),this.tokens.matchesContextual(n.ContextualKeyword._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.TokenType.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,n.ContextualKeyword._from))return!0;if(this.tokens.matches1(r.TokenType.string))return this.tokens.copyToken(),!1;this.tokens.matchesContextual(n.ContextualKeyword._module)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,n.ContextualKeyword._from)&&this.tokens.copyToken();let e=!1,t=!1,i=!1;if(this.tokens.matches1(r.TokenType.name)&&(this.shouldAutomaticallyElideImportedName(this.tokens.identifierName())?(this.tokens.removeToken(),this.tokens.matches1(r.TokenType.comma)&&this.tokens.removeToken()):(e=!0,this.tokens.copyToken(),this.tokens.matches1(r.TokenType.comma)&&(i=!0,this.tokens.removeToken()))),this.tokens.matches1(r.TokenType.star))this.shouldAutomaticallyElideImportedName(this.tokens.identifierNameAtRelativeIndex(2))?(this.tokens.removeToken(),this.tokens.removeToken(),this.tokens.removeToken()):(i&&this.tokens.appendCode(`,`),e=!0,this.tokens.copyExpectedToken(r.TokenType.star),this.tokens.copyExpectedToken(r.TokenType.name),this.tokens.copyExpectedToken(r.TokenType.name));else if(this.tokens.matches1(r.TokenType.braceL)){for(i&&this.tokens.appendCode(`,`),this.tokens.copyToken();!this.tokens.matches1(r.TokenType.braceR);){t=!0;let n=s.default.call(void 0,this.tokens);if(n.isType||this.shouldAutomaticallyElideImportedName(n.rightName)){for(;this.tokens.currentIndex()<n.endIndex;)this.tokens.removeToken();this.tokens.matches1(r.TokenType.comma)&&this.tokens.removeToken()}else{for(e=!0;this.tokens.currentIndex()<n.endIndex;)this.tokens.copyToken();this.tokens.matches1(r.TokenType.comma)&&this.tokens.copyToken()}}this.tokens.copyExpectedToken(r.TokenType.braceR)}return this.keepUnusedImports?!1:this.isTypeScriptTransformEnabled?!e:this.isFlowTransformEnabled?t&&!e:!1}shouldAutomaticallyElideImportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(e)}processExportDefault(){if(d.default.call(void 0,this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))return this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken(),!0;if(!(this.tokens.matches4(r.TokenType._export,r.TokenType._default,r.TokenType._function,r.TokenType.name)||this.tokens.matches5(r.TokenType._export,r.TokenType._default,r.TokenType.name,r.TokenType._function,r.TokenType.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,n.ContextualKeyword._async)||this.tokens.matches4(r.TokenType._export,r.TokenType._default,r.TokenType._class,r.TokenType.name)||this.tokens.matches5(r.TokenType._export,r.TokenType._default,r.TokenType._abstract,r.TokenType._class,r.TokenType.name))&&this.reactHotLoaderTransformer){let e=this.nameManager.claimFreeName(`_default`);return this.tokens.replaceToken(`let ${e}; export`),this.tokens.copyToken(),this.tokens.appendCode(` ${e} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(e),!0}return!1}processNamedExports(){if(!this.isTypeScriptTransformEnabled)return!1;this.tokens.copyExpectedToken(r.TokenType._export),this.tokens.copyExpectedToken(r.TokenType.braceL);let e=l.default.call(void 0,this.tokens),t=!1;for(;!this.tokens.matches1(r.TokenType.braceR);){let n=s.default.call(void 0,this.tokens);if(n.isType||!e&&this.shouldElideExportedName(n.leftName)){for(;this.tokens.currentIndex()<n.endIndex;)this.tokens.removeToken();this.tokens.matches1(r.TokenType.comma)&&this.tokens.removeToken()}else{for(t=!0;this.tokens.currentIndex()<n.endIndex;)this.tokens.copyToken();this.tokens.matches1(r.TokenType.comma)&&this.tokens.copyToken()}}return this.tokens.copyExpectedToken(r.TokenType.braceR),!this.keepUnusedImports&&e&&!t&&(this.tokens.removeToken(),this.tokens.removeToken(),u.removeMaybeImportAttributes.call(void 0,this.tokens)),!0}shouldElideExportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&this.declarationInfo.typeDeclarations.has(e)&&!this.declarationInfo.valueDeclarations.has(e)}}})),Vw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=GC(),r=G(),i=t(iw());e.default=class extends i.default{constructor(e,t,n){super(),this.rootTransformer=e,this.tokens=t,this.isImportsTransformEnabled=n}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?!0:this.tokens.matches1(r.TokenType._enum)?(this.processEnum(),!0):this.tokens.matches2(r.TokenType._export,r.TokenType._enum)?(this.processNamedExportEnum(),!0):this.tokens.matches3(r.TokenType._export,r.TokenType._default,r.TokenType._enum)?(this.processDefaultExportEnum(),!0):!1}processNamedExportEnum(){if(this.isImportsTransformEnabled){this.tokens.removeInitialToken();let e=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.tokens.appendCode(` exports.${e} = ${e};`)}else this.tokens.copyToken(),this.processEnum()}processDefaultExportEnum(){this.tokens.removeInitialToken(),this.tokens.removeToken();let e=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.isImportsTransformEnabled?this.tokens.appendCode(` exports.default = ${e};`):this.tokens.appendCode(` export default ${e};`)}processEnum(){this.tokens.replaceToken(`const`),this.tokens.copyExpectedToken(r.TokenType.name);let e=!1;this.tokens.matchesContextual(n.ContextualKeyword._of)&&(this.tokens.removeToken(),e=this.tokens.matchesContextual(n.ContextualKeyword._symbol),this.tokens.removeToken());let t=this.tokens.matches3(r.TokenType.braceL,r.TokenType.name,r.TokenType.eq);this.tokens.appendCode(` = require("flow-enums-runtime")`);let i=!e&&!t;for(this.tokens.replaceTokenTrimmingLeftWhitespace(i?`.Mirrored([`:`({`);!this.tokens.matches1(r.TokenType.braceR);){if(this.tokens.matches1(r.TokenType.ellipsis)){this.tokens.removeToken();break}this.processEnumElement(e,t),this.tokens.matches1(r.TokenType.comma)&&this.tokens.copyToken()}this.tokens.replaceToken(i?`]);`:`});`)}processEnumElement(e,t){if(e){let e=this.tokens.identifierName();this.tokens.copyToken(),this.tokens.appendCode(`: Symbol("${e}")`)}else t?(this.tokens.copyToken(),this.tokens.replaceTokenTrimmingLeftWhitespace(`:`),this.tokens.copyToken()):this.tokens.replaceToken(`"${this.tokens.identifierName()}"`)}}})),Hw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}function n(e){let t,n=e[0],r=1;for(;r<e.length;){let i=e[r],a=e[r+1];if(r+=2,(i===`optionalAccess`||i===`optionalCall`)&&n==null)return;i===`access`||i===`optionalAccess`?(t=n,n=a(n)):(i===`call`||i===`optionalCall`)&&(n=a((...e)=>n.call(t,...e)),t=void 0)}return n}var r=G(),i=t(iw());let a=`jest`,o=[`mock`,`unmock`,`enableAutomock`,`disableAutomock`];e.default=class e extends i.default{__init(){this.hoistedFunctionNames=[]}constructor(t,n,r,i){super(),this.rootTransformer=t,this.tokens=n,this.nameManager=r,this.importProcessor=i,e.prototype.__init.call(this)}process(){return this.tokens.currentToken().scopeDepth===0&&this.tokens.matches4(r.TokenType.name,r.TokenType.dot,r.TokenType.name,r.TokenType.parenL)&&this.tokens.identifierName()===a?!n([this,`access`,e=>e.importProcessor,`optionalAccess`,e=>e.getGlobalNames,`call`,e=>e(),`optionalAccess`,e=>e.has,`call`,e=>e(a)])&&this.extractHoistedCalls():!1}getHoistedCode(){return this.hoistedFunctionNames.length>0?this.hoistedFunctionNames.map(e=>`${e}();`).join(``):``}extractHoistedCalls(){this.tokens.removeToken();let e=!1;for(;this.tokens.matches3(r.TokenType.dot,r.TokenType.name,r.TokenType.parenL);){let t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);if(o.includes(t)){let t=this.nameManager.claimFreeName(`__jestHoist`);this.hoistedFunctionNames.push(t),this.tokens.replaceToken(`function ${t}(){${a}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.TokenType.parenR),this.tokens.appendCode(`;}`),e=!1}else e?this.tokens.copyToken():this.tokens.replaceToken(`${a}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.TokenType.parenR),e=!0}return!0}}})),Uw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=G(),r=t(iw());e.default=class extends r.default{constructor(e){super(),this.tokens=e}process(){if(this.tokens.matches1(n.TokenType.num)){let e=this.tokens.currentTokenCode();if(e.includes(`_`))return this.tokens.replaceToken(e.replace(/_/g,``)),!0}return!1}}})),Ww=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=G(),r=t(iw());e.default=class extends r.default{constructor(e,t){super(),this.tokens=e,this.nameManager=t}process(){return this.tokens.matches2(n.TokenType._catch,n.TokenType.braceL)?(this.tokens.copyToken(),this.tokens.appendCode(` (${this.nameManager.claimFreeName(`e`)})`),!0):!1}}})),Gw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=G(),r=t(iw());e.default=class extends r.default{constructor(e,t){super(),this.tokens=e,this.nameManager=t}process(){if(this.tokens.matches1(n.TokenType.nullishCoalescing)){let e=this.tokens.currentToken();return this.tokens.tokens[e.nullishStartIndex].isAsyncOperation?this.tokens.replaceTokenTrimmingLeftWhitespace(`, async () => (`):this.tokens.replaceTokenTrimmingLeftWhitespace(`, () => (`),!0}if(this.tokens.matches1(n.TokenType._delete)&&this.tokens.tokenAtRelativeIndex(1).isOptionalChainStart)return this.tokens.removeInitialToken(),!0;let e=this.tokens.currentToken().subscriptStartIndex;if(e!=null&&this.tokens.tokens[e].isOptionalChainStart&&this.tokens.tokenAtRelativeIndex(-1).type!==n.TokenType._super){let t=this.nameManager.claimFreeName(`_`),r;if(r=e>0&&this.tokens.matches1AtIndex(e-1,n.TokenType._delete)&&this.isLastSubscriptInChain()?`${t} => delete ${t}`:`${t} => ${t}`,this.tokens.tokens[e].isAsyncOperation&&(r=`async ${r}`),this.tokens.matches2(n.TokenType.questionDot,n.TokenType.parenL)||this.tokens.matches2(n.TokenType.questionDot,n.TokenType.lessThan))this.justSkippedSuper()&&this.tokens.appendCode(`.bind(this)`),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalCall', ${r}`);else if(this.tokens.matches2(n.TokenType.questionDot,n.TokenType.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${r}`);else if(this.tokens.matches1(n.TokenType.questionDot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${r}.`);else if(this.tokens.matches1(n.TokenType.dot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${r}.`);else if(this.tokens.matches1(n.TokenType.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${r}[`);else if(this.tokens.matches1(n.TokenType.parenL))this.justSkippedSuper()&&this.tokens.appendCode(`.bind(this)`),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'call', ${r}(`);else throw Error(`Unexpected subscript operator in optional chain.`);return!0}return!1}isLastSubscriptInChain(){let e=0;for(let t=this.tokens.currentIndex()+1;;t++){if(t>=this.tokens.tokens.length)throw Error(`Reached the end of the code while finding the end of the access chain.`);if(this.tokens.tokens[t].isOptionalChainStart?e++:this.tokens.tokens[t].isOptionalChainEnd&&e--,e<0)return!0;if(e===0&&this.tokens.tokens[t].subscriptStartIndex!=null)return!1}}justSkippedSuper(){let e=0,t=this.tokens.currentIndex()-1;for(;;){if(t<0)throw Error(`Reached the start of the code while finding the start of the access chain.`);if(this.tokens.tokens[t].isOptionalChainStart?e--:this.tokens.tokens[t].isOptionalChainEnd&&e++,e<0)return!1;if(e===0&&this.tokens.tokens[t].subscriptStartIndex!=null)return this.tokens.tokens[t-1].type===n.TokenType._super;t--}}}})),Kw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=ew(),r=G(),i=t(iw());e.default=class extends i.default{constructor(e,t,n,r){super(),this.rootTransformer=e,this.tokens=t,this.importProcessor=n,this.options=r}process(){let e=this.tokens.currentIndex();if(this.tokens.identifierName()===`createReactClass`){let t=this.importProcessor&&this.importProcessor.getIdentifierReplacement(`createReactClass`);return t?this.tokens.replaceToken(`(0, ${t})`):this.tokens.copyToken(),this.tryProcessCreateClassCall(e),!0}if(this.tokens.matches3(r.TokenType.name,r.TokenType.dot,r.TokenType.name)&&this.tokens.identifierName()===`React`&&this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+2)===`createClass`){let t=this.importProcessor&&this.importProcessor.getIdentifierReplacement(`React`)||`React`;return t?(this.tokens.replaceToken(t),this.tokens.copyToken(),this.tokens.copyToken()):(this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.copyToken()),this.tryProcessCreateClassCall(e),!0}return!1}tryProcessCreateClassCall(e){let t=this.findDisplayName(e);t&&this.classNeedsDisplayName()&&(this.tokens.copyExpectedToken(r.TokenType.parenL),this.tokens.copyExpectedToken(r.TokenType.braceL),this.tokens.appendCode(`displayName: '${t}',`),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.TokenType.braceR),this.tokens.copyExpectedToken(r.TokenType.parenR))}findDisplayName(e){return e<2?null:this.tokens.matches2AtIndex(e-2,r.TokenType.name,r.TokenType.eq)||e>=2&&this.tokens.tokens[e-2].identifierRole===n.IdentifierRole.ObjectKey?this.tokens.identifierNameAtIndex(e-2):this.tokens.matches2AtIndex(e-2,r.TokenType._export,r.TokenType._default)?this.getDisplayNameFromFilename():null}getDisplayNameFromFilename(){let e=(this.options.filePath||`unknown`).split(`/`),t=e[e.length-1],n=t.lastIndexOf(`.`),r=n===-1?t:t.slice(0,n);return r===`index`&&e[e.length-2]?e[e.length-2]:r}classNeedsDisplayName(){let e=this.tokens.currentIndex();if(!this.tokens.matches2(r.TokenType.parenL,r.TokenType.braceL))return!1;let t=e+1,i=this.tokens.tokens[t].contextId;if(i==null)throw Error(`Expected non-null context ID on object open-brace.`);for(;e<this.tokens.tokens.length;e++){let t=this.tokens.tokens[e];if(t.type===r.TokenType.braceR&&t.contextId===i){e++;break}if(this.tokens.identifierNameAtIndex(e)===`displayName`&&this.tokens.tokens[e].identifierRole===n.IdentifierRole.ObjectKey&&t.contextId===i)return!1}if(e===this.tokens.tokens.length)throw Error(`Unexpected end of input when processing React class.`);return this.tokens.matches1AtIndex(e,r.TokenType.parenR)||this.tokens.matches2AtIndex(e,r.TokenType.comma,r.TokenType.parenR)}}})),qw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=ew(),r=t(iw());e.default=class e extends r.default{__init(){this.extractedDefaultExportName=null}constructor(t,n){super(),this.tokens=t,this.filePath=n,e.prototype.__init.call(this)}setExtractedDefaultExportName(e){this.extractedDefaultExportName=e}getPrefixCode(){return`
|
|
669
|
+
`:``}process(){return this.tokens.matches3(i.TokenType._import,i.TokenType.name,i.TokenType.eq)?this.processImportEquals():this.tokens.matches1(i.TokenType._import)?(this.processImport(),!0):this.tokens.matches2(i.TokenType._export,i.TokenType.eq)?(this.tokens.replaceToken(`module.exports`),!0):this.tokens.matches1(i.TokenType._export)&&!this.tokens.currentToken().isType?(this.hadExport=!0,this.processExport()):this.tokens.matches2(i.TokenType.name,i.TokenType.postIncDec)&&this.processPostIncDec()?!0:this.tokens.matches1(i.TokenType.name)||this.tokens.matches1(i.TokenType.jsxName)?this.processIdentifier():this.tokens.matches1(i.TokenType.eq)?this.processAssignment():this.tokens.matches1(i.TokenType.assign)?this.processComplexAssignment():this.tokens.matches1(i.TokenType.preIncDec)?this.processPreIncDec():!1}processImportEquals(){let e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.importProcessor.shouldAutomaticallyElideImportedName(e)?a.default.call(void 0,this.tokens):this.tokens.replaceToken(`const`),!0}processImport(){if(this.tokens.matches2(i.TokenType._import,i.TokenType.parenL)){if(this.preserveDynamicImport){this.tokens.copyToken();return}let e=this.enableLegacyTypeScriptModuleInterop?``:`${this.helperManager.getHelperName(`interopRequireWildcard`)}(`;this.tokens.replaceToken(`Promise.resolve().then(() => ${e}require`);let t=this.tokens.currentToken().contextId;if(t==null)throw Error(`Expected context ID on dynamic import invocation.`);for(this.tokens.copyToken();!this.tokens.matchesContextIdAndLabel(i.TokenType.parenR,t);)this.rootTransformer.processToken();this.tokens.replaceToken(e?`)))`:`))`)}else{if(this.removeImportAndDetectIfShouldElide())this.tokens.removeToken();else{let e=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(e)),this.tokens.appendCode(this.importProcessor.claimImportCode(e))}u.removeMaybeImportAttributes.call(void 0,this.tokens),this.tokens.matches1(i.TokenType.semi)&&this.tokens.removeToken()}}removeImportAndDetectIfShouldElide(){if(this.tokens.removeInitialToken(),this.tokens.matchesContextual(r.ContextualKeyword._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,i.TokenType.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,r.ContextualKeyword._from))return this.removeRemainingImport(),!0;if(this.tokens.matches1(i.TokenType.name)||this.tokens.matches1(i.TokenType.star))return this.removeRemainingImport(),!1;if(this.tokens.matches1(i.TokenType.string))return!1;let e=!1,t=!1;for(;!this.tokens.matches1(i.TokenType.string);)(!e&&this.tokens.matches1(i.TokenType.braceL)||this.tokens.matches1(i.TokenType.comma))&&(this.tokens.removeToken(),this.tokens.matches1(i.TokenType.braceR)||(t=!0),(this.tokens.matches2(i.TokenType.name,i.TokenType.comma)||this.tokens.matches2(i.TokenType.name,i.TokenType.braceR)||this.tokens.matches4(i.TokenType.name,i.TokenType.name,i.TokenType.name,i.TokenType.comma)||this.tokens.matches4(i.TokenType.name,i.TokenType.name,i.TokenType.name,i.TokenType.braceR))&&(e=!0)),this.tokens.removeToken();return this.keepUnusedImports?!1:this.isTypeScriptTransformEnabled?!e:this.isFlowTransformEnabled?t&&!e:!1}removeRemainingImport(){for(;!this.tokens.matches1(i.TokenType.string);)this.tokens.removeToken()}processIdentifier(){let e=this.tokens.currentToken();if(e.shadowsGlobal)return!1;if(e.identifierRole===n.IdentifierRole.ObjectShorthand)return this.processObjectShorthand();if(e.identifierRole!==n.IdentifierRole.Access)return!1;let t=this.importProcessor.getIdentifierReplacement(this.tokens.identifierNameForToken(e));if(!t)return!1;let r=this.tokens.currentIndex()+1;for(;r<this.tokens.tokens.length&&this.tokens.tokens[r].type===i.TokenType.parenR;)r++;return this.tokens.tokens[r].type===i.TokenType.parenL?this.tokens.tokenAtRelativeIndex(1).type===i.TokenType.parenL&&this.tokens.tokenAtRelativeIndex(-1).type!==i.TokenType._new?(this.tokens.replaceToken(`${t}.call(void 0, `),this.tokens.removeToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.parenR)):this.tokens.replaceToken(`(0, ${t})`):this.tokens.replaceToken(t),!0}processObjectShorthand(){let e=this.tokens.identifierName(),t=this.importProcessor.getIdentifierReplacement(e);return t?(this.tokens.replaceToken(`${e}: ${t}`),!0):!1}processExport(){if(this.tokens.matches2(i.TokenType._export,i.TokenType._enum)||this.tokens.matches3(i.TokenType._export,i.TokenType._const,i.TokenType._enum))return this.hadNamedExport=!0,!1;if(this.tokens.matches2(i.TokenType._export,i.TokenType._default))return this.tokens.matches3(i.TokenType._export,i.TokenType._default,i.TokenType._enum)?(this.hadDefaultExport=!0,!1):(this.processExportDefault(),!0);if(this.tokens.matches2(i.TokenType._export,i.TokenType.braceL))return this.processExportBindings(),!0;if(this.tokens.matches2(i.TokenType._export,i.TokenType.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,r.ContextualKeyword._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(i.TokenType.braceL)){for(;!this.tokens.matches1(i.TokenType.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(i.TokenType._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(r.ContextualKeyword._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,i.TokenType.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),u.removeMaybeImportAttributes.call(void 0,this.tokens)),!0}if(this.hadNamedExport=!0,this.tokens.matches2(i.TokenType._export,i.TokenType._var)||this.tokens.matches2(i.TokenType._export,i.TokenType._let)||this.tokens.matches2(i.TokenType._export,i.TokenType._const))return this.processExportVar(),!0;if(this.tokens.matches2(i.TokenType._export,i.TokenType._function)||this.tokens.matches3(i.TokenType._export,i.TokenType.name,i.TokenType._function))return this.processExportFunction(),!0;if(this.tokens.matches2(i.TokenType._export,i.TokenType._class)||this.tokens.matches3(i.TokenType._export,i.TokenType._abstract,i.TokenType._class)||this.tokens.matches2(i.TokenType._export,i.TokenType.at))return this.processExportClass(),!0;if(this.tokens.matches2(i.TokenType._export,i.TokenType.star))return this.processExportStar(),!0;throw Error(`Unrecognized export syntax.`)}processAssignment(){let e=this.tokens.currentIndex(),t=this.tokens.tokens[e-1];if(t.isType||t.type!==i.TokenType.name||t.shadowsGlobal||e>=2&&this.tokens.matches1AtIndex(e-2,i.TokenType.dot)||e>=2&&[i.TokenType._var,i.TokenType._let,i.TokenType._const].includes(this.tokens.tokens[e-2].type))return!1;let n=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(t));return n?(this.tokens.copyToken(),this.tokens.appendCode(` ${n} =`),!0):!1}processComplexAssignment(){let e=this.tokens.currentIndex(),t=this.tokens.tokens[e-1];if(t.type!==i.TokenType.name||t.shadowsGlobal||e>=2&&this.tokens.matches1AtIndex(e-2,i.TokenType.dot))return!1;let n=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(t));return n?(this.tokens.appendCode(` = ${n}`),this.tokens.copyToken(),!0):!1}processPreIncDec(){let e=this.tokens.currentIndex(),t=this.tokens.tokens[e+1];if(t.type!==i.TokenType.name||t.shadowsGlobal||e+2<this.tokens.tokens.length&&(this.tokens.matches1AtIndex(e+2,i.TokenType.dot)||this.tokens.matches1AtIndex(e+2,i.TokenType.bracketL)||this.tokens.matches1AtIndex(e+2,i.TokenType.parenL)))return!1;let n=this.tokens.identifierNameForToken(t),r=this.importProcessor.resolveExportBinding(n);return r?(this.tokens.appendCode(`${r} = `),this.tokens.copyToken(),!0):!1}processPostIncDec(){let e=this.tokens.currentIndex(),t=this.tokens.tokens[e],n=this.tokens.tokens[e+1];if(t.type!==i.TokenType.name||t.shadowsGlobal||e>=1&&this.tokens.matches1AtIndex(e-1,i.TokenType.dot))return!1;let r=this.tokens.identifierNameForToken(t),a=this.importProcessor.resolveExportBinding(r);if(!a)return!1;let o=this.tokens.rawCodeForToken(n),s=this.importProcessor.getIdentifierReplacement(r)||r;if(o===`++`)this.tokens.replaceToken(`(${s} = ${a} = ${s} + 1, ${s} - 1)`);else if(o===`--`)this.tokens.replaceToken(`(${s} = ${a} = ${s} - 1, ${s} + 1)`);else throw Error(`Unexpected operator: ${o}`);return this.tokens.removeToken(),!0}processExportDefault(){let e=!0;if(this.tokens.matches4(i.TokenType._export,i.TokenType._default,i.TokenType._function,i.TokenType.name)||this.tokens.matches5(i.TokenType._export,i.TokenType._default,i.TokenType.name,i.TokenType._function,i.TokenType.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,r.ContextualKeyword._async)){this.tokens.removeInitialToken(),this.tokens.removeToken();let e=this.processNamedFunction();this.tokens.appendCode(` exports.default = ${e};`)}else if(this.tokens.matches4(i.TokenType._export,i.TokenType._default,i.TokenType._class,i.TokenType.name)||this.tokens.matches5(i.TokenType._export,i.TokenType._default,i.TokenType._abstract,i.TokenType._class,i.TokenType.name)||this.tokens.matches3(i.TokenType._export,i.TokenType._default,i.TokenType.at)){this.tokens.removeInitialToken(),this.tokens.removeToken(),this.copyDecorators(),this.tokens.matches1(i.TokenType._abstract)&&this.tokens.removeToken();let e=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.default = ${e};`)}else if(d.default.call(void 0,this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))e=!1,this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken();else if(this.reactHotLoaderTransformer){let e=this.nameManager.claimFreeName(`_default`);this.tokens.replaceToken(`let ${e}; exports.`),this.tokens.copyToken(),this.tokens.appendCode(` = ${e} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(e)}else this.tokens.replaceToken(`exports.`),this.tokens.copyToken(),this.tokens.appendCode(` =`);e&&(this.hadDefaultExport=!0)}copyDecorators(){for(;this.tokens.matches1(i.TokenType.at);)if(this.tokens.copyToken(),this.tokens.matches1(i.TokenType.parenL))this.tokens.copyExpectedToken(i.TokenType.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.parenR);else{for(this.tokens.copyExpectedToken(i.TokenType.name);this.tokens.matches1(i.TokenType.dot);)this.tokens.copyExpectedToken(i.TokenType.dot),this.tokens.copyExpectedToken(i.TokenType.name);this.tokens.matches1(i.TokenType.parenL)&&(this.tokens.copyExpectedToken(i.TokenType.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.parenR))}}processExportVar(){this.isSimpleExportVar()?this.processSimpleExportVar():this.processComplexExportVar()}isSimpleExportVar(){let e=this.tokens.currentIndex();if(e++,e++,!this.tokens.matches1AtIndex(e,i.TokenType.name))return!1;for(e++;e<this.tokens.tokens.length&&this.tokens.tokens[e].isType;)e++;return!!this.tokens.matches1AtIndex(e,i.TokenType.eq)}processSimpleExportVar(){this.tokens.removeInitialToken(),this.tokens.copyToken();let e=this.tokens.identifierName();for(;!this.tokens.matches1(i.TokenType.eq);)this.rootTransformer.processToken();let t=this.tokens.currentToken().rhsEndIndex;if(t==null)throw Error(`Expected = token with an end index.`);for(;this.tokens.currentIndex()<t;)this.rootTransformer.processToken();this.tokens.appendCode(`; exports.${e} = ${e}`)}processComplexExportVar(){this.tokens.removeInitialToken(),this.tokens.removeToken();let e=this.tokens.matches1(i.TokenType.braceL);e&&this.tokens.appendCode(`(`);let t=0;for(;;)if(this.tokens.matches1(i.TokenType.braceL)||this.tokens.matches1(i.TokenType.dollarBraceL)||this.tokens.matches1(i.TokenType.bracketL))t++,this.tokens.copyToken();else if(this.tokens.matches1(i.TokenType.braceR)||this.tokens.matches1(i.TokenType.bracketR))t--,this.tokens.copyToken();else if(t===0&&!this.tokens.matches1(i.TokenType.name)&&!this.tokens.currentToken().isType)break;else if(this.tokens.matches1(i.TokenType.eq)){let e=this.tokens.currentToken().rhsEndIndex;if(e==null)throw Error(`Expected = token with an end index.`);for(;this.tokens.currentIndex()<e;)this.rootTransformer.processToken()}else{let e=this.tokens.currentToken();if(n.isDeclaration.call(void 0,e)){let t=this.tokens.identifierName(),r=this.importProcessor.getIdentifierReplacement(t);if(r===null)throw Error(`Expected a replacement for ${t} in \`export var\` syntax.`);n.isObjectShorthandDeclaration.call(void 0,e)&&(r=`${t}: ${r}`),this.tokens.replaceToken(r)}else this.rootTransformer.processToken()}if(e){let e=this.tokens.currentToken().rhsEndIndex;if(e==null)throw Error(`Expected = token with an end index.`);for(;this.tokens.currentIndex()<e;)this.rootTransformer.processToken();this.tokens.appendCode(`)`)}}processExportFunction(){this.tokens.replaceToken(``);let e=this.processNamedFunction();this.tokens.appendCode(` exports.${e} = ${e};`)}processNamedFunction(){if(this.tokens.matches1(i.TokenType._function))this.tokens.copyToken();else if(this.tokens.matches2(i.TokenType.name,i.TokenType._function)){if(!this.tokens.matchesContextual(r.ContextualKeyword._async))throw Error(`Expected async keyword in function export.`);this.tokens.copyToken(),this.tokens.copyToken()}if(this.tokens.matches1(i.TokenType.star)&&this.tokens.copyToken(),!this.tokens.matches1(i.TokenType.name))throw Error(`Expected identifier for exported function name.`);let e=this.tokens.identifierName();if(this.tokens.copyToken(),this.tokens.currentToken().isType)for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return this.tokens.copyExpectedToken(i.TokenType.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.parenR),this.rootTransformer.processPossibleTypeRange(),this.tokens.copyExpectedToken(i.TokenType.braceL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.braceR),e}processExportClass(){this.tokens.removeInitialToken(),this.copyDecorators(),this.tokens.matches1(i.TokenType._abstract)&&this.tokens.removeToken();let e=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.${e} = ${e};`)}processExportBindings(){this.tokens.removeInitialToken(),this.tokens.removeToken();let e=l.default.call(void 0,this.tokens),t=[];for(;;){if(this.tokens.matches1(i.TokenType.braceR)){this.tokens.removeToken();break}let n=c.default.call(void 0,this.tokens);for(;this.tokens.currentIndex()<n.endIndex;)this.tokens.removeToken();if(!(n.isType||!e&&this.shouldElideExportedIdentifier(n.leftName))){let e=n.rightName;e==="default"?this.hadDefaultExport=!0:this.hadNamedExport=!0;let r=n.leftName,i=this.importProcessor.getIdentifierReplacement(r);t.push(`exports.${e} = ${i||r};`)}if(this.tokens.matches1(i.TokenType.braceR)){this.tokens.removeToken();break}if(this.tokens.matches2(i.TokenType.comma,i.TokenType.braceR)){this.tokens.removeToken(),this.tokens.removeToken();break}if(this.tokens.matches1(i.TokenType.comma))this.tokens.removeToken();else throw Error(`Unexpected token: ${JSON.stringify(this.tokens.currentToken())}`)}if(this.tokens.matchesContextual(r.ContextualKeyword._from)){this.tokens.removeToken();let e=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(e)),u.removeMaybeImportAttributes.call(void 0,this.tokens)}else this.tokens.appendCode(t.join(` `));this.tokens.matches1(i.TokenType.semi)&&this.tokens.removeToken()}processExportStar(){for(this.tokens.removeInitialToken();!this.tokens.matches1(i.TokenType.string);)this.tokens.removeToken();let e=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(e)),u.removeMaybeImportAttributes.call(void 0,this.tokens),this.tokens.matches1(i.TokenType.semi)&&this.tokens.removeToken()}shouldElideExportedIdentifier(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.declarationInfo.valueDeclarations.has(e)}}})),Kw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=ZC(),r=G(),i=t(Bw()),a=Vw(),o=t(a),s=t(sw()),c=fw(),l=t(Hw()),u=Uw(),d=t(Ww()),f=t(uw());e.default=class extends f.default{constructor(e,t,n,r,i,s,l,u){super(),this.tokens=e,this.nameManager=t,this.helperManager=n,this.reactHotLoaderTransformer=r,this.isTypeScriptTransformEnabled=i,this.isFlowTransformEnabled=s,this.keepUnusedImports=l,this.nonTypeIdentifiers=i&&!l?c.getNonTypeIdentifiers.call(void 0,e,u):/* @__PURE__ */ new Set,this.declarationInfo=i&&!l?o.default.call(void 0,e):a.EMPTY_DECLARATION_INFO,this.injectCreateRequireForImportRequire=!!u.injectCreateRequireForImportRequire}process(){if(this.tokens.matches3(r.TokenType._import,r.TokenType.name,r.TokenType.eq))return this.processImportEquals();if(this.tokens.matches4(r.TokenType._import,r.TokenType.name,r.TokenType.name,r.TokenType.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,n.ContextualKeyword._type)){this.tokens.removeInitialToken();for(let e=0;e<7;e++)this.tokens.removeToken();return!0}if(this.tokens.matches2(r.TokenType._export,r.TokenType.eq))return this.tokens.replaceToken(`module.exports`),!0;if(this.tokens.matches5(r.TokenType._export,r.TokenType._import,r.TokenType.name,r.TokenType.name,r.TokenType.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,n.ContextualKeyword._type)){this.tokens.removeInitialToken();for(let e=0;e<8;e++)this.tokens.removeToken();return!0}if(this.tokens.matches1(r.TokenType._import))return this.processImport();if(this.tokens.matches2(r.TokenType._export,r.TokenType._default))return this.processExportDefault();if(this.tokens.matches2(r.TokenType._export,r.TokenType.braceL))return this.processNamedExports();if(this.tokens.matches2(r.TokenType._export,r.TokenType.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,n.ContextualKeyword._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(r.TokenType.braceL)){for(;!this.tokens.matches1(r.TokenType.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(r.TokenType._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(n.ContextualKeyword._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.TokenType.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),u.removeMaybeImportAttributes.call(void 0,this.tokens)),!0}return!1}processImportEquals(){let e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.shouldAutomaticallyElideImportedName(e)?i.default.call(void 0,this.tokens):this.injectCreateRequireForImportRequire?(this.tokens.replaceToken(`const`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.replaceToken(this.helperManager.getHelperName(`require`))):this.tokens.replaceToken(`const`),!0}processImport(){if(this.tokens.matches2(r.TokenType._import,r.TokenType.parenL))return!1;let e=this.tokens.snapshot();if(this.removeImportTypeBindings()){for(this.tokens.restoreToSnapshot(e);!this.tokens.matches1(r.TokenType.string);)this.tokens.removeToken();this.tokens.removeToken(),u.removeMaybeImportAttributes.call(void 0,this.tokens),this.tokens.matches1(r.TokenType.semi)&&this.tokens.removeToken()}return!0}removeImportTypeBindings(){if(this.tokens.copyExpectedToken(r.TokenType._import),this.tokens.matchesContextual(n.ContextualKeyword._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.TokenType.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,n.ContextualKeyword._from))return!0;if(this.tokens.matches1(r.TokenType.string))return this.tokens.copyToken(),!1;this.tokens.matchesContextual(n.ContextualKeyword._module)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,n.ContextualKeyword._from)&&this.tokens.copyToken();let e=!1,t=!1,i=!1;if(this.tokens.matches1(r.TokenType.name)&&(this.shouldAutomaticallyElideImportedName(this.tokens.identifierName())?(this.tokens.removeToken(),this.tokens.matches1(r.TokenType.comma)&&this.tokens.removeToken()):(e=!0,this.tokens.copyToken(),this.tokens.matches1(r.TokenType.comma)&&(i=!0,this.tokens.removeToken()))),this.tokens.matches1(r.TokenType.star))this.shouldAutomaticallyElideImportedName(this.tokens.identifierNameAtRelativeIndex(2))?(this.tokens.removeToken(),this.tokens.removeToken(),this.tokens.removeToken()):(i&&this.tokens.appendCode(`,`),e=!0,this.tokens.copyExpectedToken(r.TokenType.star),this.tokens.copyExpectedToken(r.TokenType.name),this.tokens.copyExpectedToken(r.TokenType.name));else if(this.tokens.matches1(r.TokenType.braceL)){for(i&&this.tokens.appendCode(`,`),this.tokens.copyToken();!this.tokens.matches1(r.TokenType.braceR);){t=!0;let n=s.default.call(void 0,this.tokens);if(n.isType||this.shouldAutomaticallyElideImportedName(n.rightName)){for(;this.tokens.currentIndex()<n.endIndex;)this.tokens.removeToken();this.tokens.matches1(r.TokenType.comma)&&this.tokens.removeToken()}else{for(e=!0;this.tokens.currentIndex()<n.endIndex;)this.tokens.copyToken();this.tokens.matches1(r.TokenType.comma)&&this.tokens.copyToken()}}this.tokens.copyExpectedToken(r.TokenType.braceR)}return this.keepUnusedImports?!1:this.isTypeScriptTransformEnabled?!e:this.isFlowTransformEnabled?t&&!e:!1}shouldAutomaticallyElideImportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(e)}processExportDefault(){if(d.default.call(void 0,this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))return this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken(),!0;if(!(this.tokens.matches4(r.TokenType._export,r.TokenType._default,r.TokenType._function,r.TokenType.name)||this.tokens.matches5(r.TokenType._export,r.TokenType._default,r.TokenType.name,r.TokenType._function,r.TokenType.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,n.ContextualKeyword._async)||this.tokens.matches4(r.TokenType._export,r.TokenType._default,r.TokenType._class,r.TokenType.name)||this.tokens.matches5(r.TokenType._export,r.TokenType._default,r.TokenType._abstract,r.TokenType._class,r.TokenType.name))&&this.reactHotLoaderTransformer){let e=this.nameManager.claimFreeName(`_default`);return this.tokens.replaceToken(`let ${e}; export`),this.tokens.copyToken(),this.tokens.appendCode(` ${e} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(e),!0}return!1}processNamedExports(){if(!this.isTypeScriptTransformEnabled)return!1;this.tokens.copyExpectedToken(r.TokenType._export),this.tokens.copyExpectedToken(r.TokenType.braceL);let e=l.default.call(void 0,this.tokens),t=!1;for(;!this.tokens.matches1(r.TokenType.braceR);){let n=s.default.call(void 0,this.tokens);if(n.isType||!e&&this.shouldElideExportedName(n.leftName)){for(;this.tokens.currentIndex()<n.endIndex;)this.tokens.removeToken();this.tokens.matches1(r.TokenType.comma)&&this.tokens.removeToken()}else{for(t=!0;this.tokens.currentIndex()<n.endIndex;)this.tokens.copyToken();this.tokens.matches1(r.TokenType.comma)&&this.tokens.copyToken()}}return this.tokens.copyExpectedToken(r.TokenType.braceR),!this.keepUnusedImports&&e&&!t&&(this.tokens.removeToken(),this.tokens.removeToken(),u.removeMaybeImportAttributes.call(void 0,this.tokens)),!0}shouldElideExportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&this.declarationInfo.typeDeclarations.has(e)&&!this.declarationInfo.valueDeclarations.has(e)}}})),qw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=ZC(),r=G(),i=t(uw());e.default=class extends i.default{constructor(e,t,n){super(),this.rootTransformer=e,this.tokens=t,this.isImportsTransformEnabled=n}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?!0:this.tokens.matches1(r.TokenType._enum)?(this.processEnum(),!0):this.tokens.matches2(r.TokenType._export,r.TokenType._enum)?(this.processNamedExportEnum(),!0):this.tokens.matches3(r.TokenType._export,r.TokenType._default,r.TokenType._enum)?(this.processDefaultExportEnum(),!0):!1}processNamedExportEnum(){if(this.isImportsTransformEnabled){this.tokens.removeInitialToken();let e=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.tokens.appendCode(` exports.${e} = ${e};`)}else this.tokens.copyToken(),this.processEnum()}processDefaultExportEnum(){this.tokens.removeInitialToken(),this.tokens.removeToken();let e=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.isImportsTransformEnabled?this.tokens.appendCode(` exports.default = ${e};`):this.tokens.appendCode(` export default ${e};`)}processEnum(){this.tokens.replaceToken(`const`),this.tokens.copyExpectedToken(r.TokenType.name);let e=!1;this.tokens.matchesContextual(n.ContextualKeyword._of)&&(this.tokens.removeToken(),e=this.tokens.matchesContextual(n.ContextualKeyword._symbol),this.tokens.removeToken());let t=this.tokens.matches3(r.TokenType.braceL,r.TokenType.name,r.TokenType.eq);this.tokens.appendCode(` = require("flow-enums-runtime")`);let i=!e&&!t;for(this.tokens.replaceTokenTrimmingLeftWhitespace(i?`.Mirrored([`:`({`);!this.tokens.matches1(r.TokenType.braceR);){if(this.tokens.matches1(r.TokenType.ellipsis)){this.tokens.removeToken();break}this.processEnumElement(e,t),this.tokens.matches1(r.TokenType.comma)&&this.tokens.copyToken()}this.tokens.replaceToken(i?`]);`:`});`)}processEnumElement(e,t){if(e){let e=this.tokens.identifierName();this.tokens.copyToken(),this.tokens.appendCode(`: Symbol("${e}")`)}else t?(this.tokens.copyToken(),this.tokens.replaceTokenTrimmingLeftWhitespace(`:`),this.tokens.copyToken()):this.tokens.replaceToken(`"${this.tokens.identifierName()}"`)}}})),Jw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}function n(e){let t,n=e[0],r=1;for(;r<e.length;){let i=e[r],a=e[r+1];if(r+=2,(i===`optionalAccess`||i===`optionalCall`)&&n==null)return;i===`access`||i===`optionalAccess`?(t=n,n=a(n)):(i===`call`||i===`optionalCall`)&&(n=a((...e)=>n.call(t,...e)),t=void 0)}return n}var r=G(),i=t(uw());let a=`jest`,o=[`mock`,`unmock`,`enableAutomock`,`disableAutomock`];e.default=class e extends i.default{__init(){this.hoistedFunctionNames=[]}constructor(t,n,r,i){super(),this.rootTransformer=t,this.tokens=n,this.nameManager=r,this.importProcessor=i,e.prototype.__init.call(this)}process(){return this.tokens.currentToken().scopeDepth===0&&this.tokens.matches4(r.TokenType.name,r.TokenType.dot,r.TokenType.name,r.TokenType.parenL)&&this.tokens.identifierName()===a?!n([this,`access`,e=>e.importProcessor,`optionalAccess`,e=>e.getGlobalNames,`call`,e=>e(),`optionalAccess`,e=>e.has,`call`,e=>e(a)])&&this.extractHoistedCalls():!1}getHoistedCode(){return this.hoistedFunctionNames.length>0?this.hoistedFunctionNames.map(e=>`${e}();`).join(``):``}extractHoistedCalls(){this.tokens.removeToken();let e=!1;for(;this.tokens.matches3(r.TokenType.dot,r.TokenType.name,r.TokenType.parenL);){let t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);if(o.includes(t)){let t=this.nameManager.claimFreeName(`__jestHoist`);this.hoistedFunctionNames.push(t),this.tokens.replaceToken(`function ${t}(){${a}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.TokenType.parenR),this.tokens.appendCode(`;}`),e=!1}else e?this.tokens.copyToken():this.tokens.replaceToken(`${a}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.TokenType.parenR),e=!0}return!0}}})),Yw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=G(),r=t(uw());e.default=class extends r.default{constructor(e){super(),this.tokens=e}process(){if(this.tokens.matches1(n.TokenType.num)){let e=this.tokens.currentTokenCode();if(e.includes(`_`))return this.tokens.replaceToken(e.replace(/_/g,``)),!0}return!1}}})),Xw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=G(),r=t(uw());e.default=class extends r.default{constructor(e,t){super(),this.tokens=e,this.nameManager=t}process(){return this.tokens.matches2(n.TokenType._catch,n.TokenType.braceL)?(this.tokens.copyToken(),this.tokens.appendCode(` (${this.nameManager.claimFreeName(`e`)})`),!0):!1}}})),Zw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=G(),r=t(uw());e.default=class extends r.default{constructor(e,t){super(),this.tokens=e,this.nameManager=t}process(){if(this.tokens.matches1(n.TokenType.nullishCoalescing)){let e=this.tokens.currentToken();return this.tokens.tokens[e.nullishStartIndex].isAsyncOperation?this.tokens.replaceTokenTrimmingLeftWhitespace(`, async () => (`):this.tokens.replaceTokenTrimmingLeftWhitespace(`, () => (`),!0}if(this.tokens.matches1(n.TokenType._delete)&&this.tokens.tokenAtRelativeIndex(1).isOptionalChainStart)return this.tokens.removeInitialToken(),!0;let e=this.tokens.currentToken().subscriptStartIndex;if(e!=null&&this.tokens.tokens[e].isOptionalChainStart&&this.tokens.tokenAtRelativeIndex(-1).type!==n.TokenType._super){let t=this.nameManager.claimFreeName(`_`),r;if(r=e>0&&this.tokens.matches1AtIndex(e-1,n.TokenType._delete)&&this.isLastSubscriptInChain()?`${t} => delete ${t}`:`${t} => ${t}`,this.tokens.tokens[e].isAsyncOperation&&(r=`async ${r}`),this.tokens.matches2(n.TokenType.questionDot,n.TokenType.parenL)||this.tokens.matches2(n.TokenType.questionDot,n.TokenType.lessThan))this.justSkippedSuper()&&this.tokens.appendCode(`.bind(this)`),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalCall', ${r}`);else if(this.tokens.matches2(n.TokenType.questionDot,n.TokenType.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${r}`);else if(this.tokens.matches1(n.TokenType.questionDot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${r}.`);else if(this.tokens.matches1(n.TokenType.dot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${r}.`);else if(this.tokens.matches1(n.TokenType.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${r}[`);else if(this.tokens.matches1(n.TokenType.parenL))this.justSkippedSuper()&&this.tokens.appendCode(`.bind(this)`),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'call', ${r}(`);else throw Error(`Unexpected subscript operator in optional chain.`);return!0}return!1}isLastSubscriptInChain(){let e=0;for(let t=this.tokens.currentIndex()+1;;t++){if(t>=this.tokens.tokens.length)throw Error(`Reached the end of the code while finding the end of the access chain.`);if(this.tokens.tokens[t].isOptionalChainStart?e++:this.tokens.tokens[t].isOptionalChainEnd&&e--,e<0)return!0;if(e===0&&this.tokens.tokens[t].subscriptStartIndex!=null)return!1}}justSkippedSuper(){let e=0,t=this.tokens.currentIndex()-1;for(;;){if(t<0)throw Error(`Reached the start of the code while finding the start of the access chain.`);if(this.tokens.tokens[t].isOptionalChainStart?e--:this.tokens.tokens[t].isOptionalChainEnd&&e++,e<0)return!1;if(e===0&&this.tokens.tokens[t].subscriptStartIndex!=null)return this.tokens.tokens[t-1].type===n.TokenType._super;t--}}}})),Qw=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=ow(),r=G(),i=t(uw());e.default=class extends i.default{constructor(e,t,n,r){super(),this.rootTransformer=e,this.tokens=t,this.importProcessor=n,this.options=r}process(){let e=this.tokens.currentIndex();if(this.tokens.identifierName()===`createReactClass`){let t=this.importProcessor&&this.importProcessor.getIdentifierReplacement(`createReactClass`);return t?this.tokens.replaceToken(`(0, ${t})`):this.tokens.copyToken(),this.tryProcessCreateClassCall(e),!0}if(this.tokens.matches3(r.TokenType.name,r.TokenType.dot,r.TokenType.name)&&this.tokens.identifierName()===`React`&&this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+2)===`createClass`){let t=this.importProcessor&&this.importProcessor.getIdentifierReplacement(`React`)||`React`;return t?(this.tokens.replaceToken(t),this.tokens.copyToken(),this.tokens.copyToken()):(this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.copyToken()),this.tryProcessCreateClassCall(e),!0}return!1}tryProcessCreateClassCall(e){let t=this.findDisplayName(e);t&&this.classNeedsDisplayName()&&(this.tokens.copyExpectedToken(r.TokenType.parenL),this.tokens.copyExpectedToken(r.TokenType.braceL),this.tokens.appendCode(`displayName: '${t}',`),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.TokenType.braceR),this.tokens.copyExpectedToken(r.TokenType.parenR))}findDisplayName(e){return e<2?null:this.tokens.matches2AtIndex(e-2,r.TokenType.name,r.TokenType.eq)||e>=2&&this.tokens.tokens[e-2].identifierRole===n.IdentifierRole.ObjectKey?this.tokens.identifierNameAtIndex(e-2):this.tokens.matches2AtIndex(e-2,r.TokenType._export,r.TokenType._default)?this.getDisplayNameFromFilename():null}getDisplayNameFromFilename(){let e=(this.options.filePath||`unknown`).split(`/`),t=e[e.length-1],n=t.lastIndexOf(`.`),r=n===-1?t:t.slice(0,n);return r===`index`&&e[e.length-2]?e[e.length-2]:r}classNeedsDisplayName(){let e=this.tokens.currentIndex();if(!this.tokens.matches2(r.TokenType.parenL,r.TokenType.braceL))return!1;let t=e+1,i=this.tokens.tokens[t].contextId;if(i==null)throw Error(`Expected non-null context ID on object open-brace.`);for(;e<this.tokens.tokens.length;e++){let t=this.tokens.tokens[e];if(t.type===r.TokenType.braceR&&t.contextId===i){e++;break}if(this.tokens.identifierNameAtIndex(e)===`displayName`&&this.tokens.tokens[e].identifierRole===n.IdentifierRole.ObjectKey&&t.contextId===i)return!1}if(e===this.tokens.tokens.length)throw Error(`Unexpected end of input when processing React class.`);return this.tokens.matches1AtIndex(e,r.TokenType.parenR)||this.tokens.matches2AtIndex(e,r.TokenType.comma,r.TokenType.parenR)}}})),$w=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=ow(),r=t(uw());e.default=class e extends r.default{__init(){this.extractedDefaultExportName=null}constructor(t,n){super(),this.tokens=t,this.filePath=n,e.prototype.__init.call(this)}setExtractedDefaultExportName(e){this.extractedDefaultExportName=e}getPrefixCode(){return`
|
|
670
670
|
(function () {
|
|
671
671
|
var enterModule = require('react-hot-loader').enterModule;
|
|
672
672
|
enterModule && enterModule(module);
|
|
@@ -680,11 +680,11 @@ module.exports = exports.default;
|
|
|
680
680
|
${t.map(({variableName:e,uniqueLocalName:t})=>` reactHotLoader.register(${e}, "${t}", ${JSON.stringify(this.filePath||``)});`).join(`
|
|
681
681
|
`)}
|
|
682
682
|
leaveModule(module);
|
|
683
|
-
})();`}process(){return!1}}})),
|
|
683
|
+
})();`}process(){return!1}}})),eT=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=rw();let n=/* @__PURE__ */ new Set(/* @__PURE__ */ `break.case.catch.class.const.continue.debugger.default.delete.do.else.export.extends.finally.for.function.if.import.in.instanceof.new.return.super.switch.this.throw.try.typeof.var.void.while.with.yield.enum.implements.interface.let.package.private.protected.public.static.await.false.null.true`.split(`.`));e.default=function(e){if(e.length===0||!t.IS_IDENTIFIER_START[e.charCodeAt(0)])return!1;for(let n=1;n<e.length;n++)if(!t.IS_IDENTIFIER_CHAR[e.charCodeAt(n)])return!1;return!n.has(e)}})),tT=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=G(),r=t(eT()),i=t(uw());e.default=class extends i.default{constructor(e,t,n){super(),this.rootTransformer=e,this.tokens=t,this.isImportsTransformEnabled=n}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?!0:this.tokens.matches1(n.TokenType._public)||this.tokens.matches1(n.TokenType._protected)||this.tokens.matches1(n.TokenType._private)||this.tokens.matches1(n.TokenType._abstract)||this.tokens.matches1(n.TokenType._readonly)||this.tokens.matches1(n.TokenType._override)||this.tokens.matches1(n.TokenType.nonNullAssertion)?(this.tokens.removeInitialToken(),!0):this.tokens.matches1(n.TokenType._enum)||this.tokens.matches2(n.TokenType._const,n.TokenType._enum)?(this.processEnum(),!0):this.tokens.matches2(n.TokenType._export,n.TokenType._enum)||this.tokens.matches3(n.TokenType._export,n.TokenType._const,n.TokenType._enum)?(this.processEnum(!0),!0):!1}processEnum(e=!1){for(this.tokens.removeInitialToken();this.tokens.matches1(n.TokenType._const)||this.tokens.matches1(n.TokenType._enum);)this.tokens.removeToken();let t=this.tokens.identifierName();this.tokens.removeToken(),e&&!this.isImportsTransformEnabled&&this.tokens.appendCode(`export `),this.tokens.appendCode(`var ${t}; (function (${t})`),this.tokens.copyExpectedToken(n.TokenType.braceL),this.processEnumBody(t),this.tokens.copyExpectedToken(n.TokenType.braceR),e&&this.isImportsTransformEnabled?this.tokens.appendCode(`)(${t} || (exports.${t} = ${t} = {}));`):this.tokens.appendCode(`)(${t} || (${t} = {}));`)}processEnumBody(e){let t=null;for(;!this.tokens.matches1(n.TokenType.braceR);){let{nameStringCode:r,variableName:i}=this.extractEnumKeyInfo(this.tokens.currentToken());this.tokens.removeInitialToken(),this.tokens.matches3(n.TokenType.eq,n.TokenType.string,n.TokenType.comma)||this.tokens.matches3(n.TokenType.eq,n.TokenType.string,n.TokenType.braceR)?this.processStringLiteralEnumMember(e,r,i):this.tokens.matches1(n.TokenType.eq)?this.processExplicitValueEnumMember(e,r,i):this.processImplicitValueEnumMember(e,r,i,t),this.tokens.matches1(n.TokenType.comma)&&this.tokens.removeToken(),t=i??`${e}[${r}]`}}extractEnumKeyInfo(e){if(e.type===n.TokenType.name){let t=this.tokens.identifierNameForToken(e);return{nameStringCode:`"${t}"`,variableName:r.default.call(void 0,t)?t:null}}if(e.type===n.TokenType.string){let t=this.tokens.stringValueForToken(e);return{nameStringCode:this.tokens.code.slice(e.start,e.end),variableName:r.default.call(void 0,t)?t:null}}throw Error(`Expected name or string at beginning of enum element.`)}processStringLiteralEnumMember(e,t,n){n==null?(this.tokens.appendCode(`${e}[${t}]`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.appendCode(`;`)):(this.tokens.appendCode(`const ${n}`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.appendCode(`; ${e}[${t}] = ${n};`))}processExplicitValueEnumMember(e,t,n){let r=this.tokens.currentToken().rhsEndIndex;if(r==null)throw Error(`Expected rhsEndIndex on enum assign.`);if(n!=null){for(this.tokens.appendCode(`const ${n}`),this.tokens.copyToken();this.tokens.currentIndex()<r;)this.rootTransformer.processToken();this.tokens.appendCode(`; ${e}[${e}[${t}] = ${n}] = ${t};`)}else{for(this.tokens.appendCode(`${e}[${e}[${t}]`),this.tokens.copyToken();this.tokens.currentIndex()<r;)this.rootTransformer.processToken();this.tokens.appendCode(`] = ${t};`)}}processImplicitValueEnumMember(e,t,n,r){let i=r==null?`0`:`${r} + 1`;n!=null&&(this.tokens.appendCode(`const ${n} = ${i}; `),i=n),this.tokens.appendCode(`${e}[${e}[${t}] = ${i}] = ${t};`)}}})),nT=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=ZC(),r=G(),i=t(zw()),a=t(Gw()),o=t(Kw()),s=t(qw()),c=t(Jw()),l=t(dw()),u=t(Yw()),d=t(Xw()),f=t(Zw()),p=t(Qw()),m=t($w()),h=t(tT());e.default=class e{__init(){this.transformers=[]}__init2(){this.generatedVariables=[]}constructor(t,n,r,i){e.prototype.__init.call(this),e.prototype.__init2.call(this),this.nameManager=t.nameManager,this.helperManager=t.helperManager;let{tokenProcessor:g,importProcessor:_}=t;this.tokens=g,this.isImportsTransformEnabled=n.includes(`imports`),this.isReactHotLoaderTransformEnabled=n.includes(`react-hot-loader`),this.disableESTransforms=!!i.disableESTransforms,i.disableESTransforms||(this.transformers.push(new f.default(g,this.nameManager)),this.transformers.push(new u.default(g)),this.transformers.push(new d.default(g,this.nameManager))),n.includes(`jsx`)&&(i.jsxRuntime!==`preserve`&&this.transformers.push(new l.default(this,g,_,this.nameManager,i)),this.transformers.push(new p.default(this,g,_,i)));let v=null;if(n.includes(`react-hot-loader`)){if(!i.filePath)throw Error(`filePath is required when using the react-hot-loader transform.`);v=new m.default(g,i.filePath),this.transformers.push(v)}if(n.includes(`imports`)){if(_===null)throw Error(`Expected non-null importProcessor with imports transform enabled.`);this.transformers.push(new a.default(this,g,_,this.nameManager,this.helperManager,v,r,!!i.enableLegacyTypeScriptModuleInterop,n.includes(`typescript`),n.includes(`flow`),!!i.preserveDynamicImport,!!i.keepUnusedImports))}else this.transformers.push(new o.default(g,this.nameManager,this.helperManager,v,n.includes(`typescript`),n.includes(`flow`),!!i.keepUnusedImports,i));n.includes(`flow`)&&this.transformers.push(new s.default(this,g,n.includes(`imports`))),n.includes(`typescript`)&&this.transformers.push(new h.default(this,g,n.includes(`imports`))),n.includes(`jest`)&&this.transformers.push(new c.default(this,g,this.nameManager,_))}transform(){this.tokens.reset(),this.processBalancedCode();let e=this.isImportsTransformEnabled?`"use strict";`:``;for(let t of this.transformers)e+=t.getPrefixCode();e+=this.helperManager.emitHelpers(),e+=this.generatedVariables.map(e=>` var ${e};`).join(``);for(let t of this.transformers)e+=t.getHoistedCode();let t=``;for(let e of this.transformers)t+=e.getSuffixCode();let n=this.tokens.finish(),{code:r}=n;if(r.startsWith(`#!`)){let i=r.indexOf(`
|
|
684
684
|
`);return i===-1&&(i=r.length,r+=`
|
|
685
|
-
`),{code:r.slice(0,i+1)+e+r.slice(i+1)+t,mappings:this.shiftMappings(n.mappings,e.length)}}return{code:e+r+t,mappings:this.shiftMappings(n.mappings,e.length)}}processBalancedCode(){let e=0,t=0;for(;!this.tokens.isAtEnd();){if(this.tokens.matches1(r.TokenType.braceL)||this.tokens.matches1(r.TokenType.dollarBraceL))e++;else if(this.tokens.matches1(r.TokenType.braceR)){if(e===0)return;e--}if(this.tokens.matches1(r.TokenType.parenL))t++;else if(this.tokens.matches1(r.TokenType.parenR)){if(t===0)return;t--}this.processToken()}}processToken(){if(this.tokens.matches1(r.TokenType._class))this.processClass();else{for(let e of this.transformers)if(e.process())return;this.tokens.copyToken()}}processNamedClass(){if(!this.tokens.matches2(r.TokenType._class,r.TokenType.name))throw Error(`Expected identifier for exported class name.`);let e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.processClass(),e}processClass(){let e=i.default.call(void 0,this,this.tokens,this.nameManager,this.disableESTransforms),t=(e.headerInfo.isExpression||!e.headerInfo.className)&&e.staticInitializerNames.length+e.instanceInitializerNames.length>0,n=e.headerInfo.className;t&&(n=this.nameManager.claimFreeName(`_class`),this.generatedVariables.push(n),this.tokens.appendCode(` (${n} =`));let a=this.tokens.currentToken().contextId;if(a==null)throw Error(`Expected class to have a context ID.`);for(this.tokens.copyExpectedToken(r.TokenType._class);!this.tokens.matchesContextIdAndLabel(r.TokenType.braceL,a);)this.processToken();this.processClassBody(e,n);let o=e.staticInitializerNames.map(e=>`${n}.${e}()`);t?this.tokens.appendCode(`, ${o.map(e=>`${e}, `).join(``)}${n})`):e.staticInitializerNames.length>0&&this.tokens.appendCode(` ${o.map(e=>`${e};`).join(` `)}`)}processClassBody(e,t){let{headerInfo:n,constructorInsertPos:i,constructorInitializerStatements:a,fields:o,instanceInitializerNames:s,rangesToRemove:c}=e,l=0,u=0,d=this.tokens.currentToken().contextId;if(d==null)throw Error(`Expected non-null context ID on class.`);this.tokens.copyExpectedToken(r.TokenType.braceL),this.isReactHotLoaderTransformEnabled&&this.tokens.appendCode(`__reactstandin__regenerateByEval(key, code) {this[key] = eval(code);}`);let f=a.length+s.length>0;if(i===null&&f){let e=this.makeConstructorInitCode(a,s,t);if(n.hasSuperclass){let t=this.nameManager.claimFreeName(`args`);this.tokens.appendCode(`constructor(...${t}) { super(...${t}); ${e}; }`)}else this.tokens.appendCode(`constructor() { ${e}; }`)}for(;!this.tokens.matchesContextIdAndLabel(r.TokenType.braceR,d);)if(l<o.length&&this.tokens.currentIndex()===o[l].start){let e=!1;for(this.tokens.matches1(r.TokenType.bracketL)?this.tokens.copyTokenWithPrefix(`${o[l].initializerName}() {this`):this.tokens.matches1(r.TokenType.string)||this.tokens.matches1(r.TokenType.num)?(this.tokens.copyTokenWithPrefix(`${o[l].initializerName}() {this[`),e=!0):this.tokens.copyTokenWithPrefix(`${o[l].initializerName}() {this.`);this.tokens.currentIndex()<o[l].end;)e&&this.tokens.currentIndex()===o[l].equalsIndex&&this.tokens.appendCode(`]`),this.processToken();this.tokens.appendCode(`}`),l++}else if(u<c.length&&this.tokens.currentIndex()>=c[u].start){for(this.tokens.currentIndex()<c[u].end&&this.tokens.removeInitialToken();this.tokens.currentIndex()<c[u].end;)this.tokens.removeToken();u++}else this.tokens.currentIndex()===i&&(this.tokens.copyToken(),f&&this.tokens.appendCode(`;${this.makeConstructorInitCode(a,s,t)};`)),this.processToken();this.tokens.copyExpectedToken(r.TokenType.braceR)}makeConstructorInitCode(e,t,n){return[...e,...t.map(e=>`${n}.prototype.${e}.call(this)`)].join(`;`)}processPossibleArrowParamEnd(){if(this.tokens.matches2(r.TokenType.parenR,r.TokenType.colon)&&this.tokens.tokenAtRelativeIndex(1).isType){let e=this.tokens.currentIndex()+1;for(;this.tokens.tokens[e].isType;)e++;if(this.tokens.matches1AtIndex(e,r.TokenType.arrow)){for(this.tokens.removeInitialToken();this.tokens.currentIndex()<e;)this.tokens.removeToken();return this.tokens.replaceTokenTrimmingLeftWhitespace(`) =>`),!0}}return!1}processPossibleAsyncArrowWithTypeParams(){if(!this.tokens.matchesContextual(n.ContextualKeyword._async)&&!this.tokens.matches1(r.TokenType._async))return!1;let e=this.tokens.tokenAtRelativeIndex(1);if(e.type!==r.TokenType.lessThan||!e.isType)return!1;let t=this.tokens.currentIndex()+1;for(;this.tokens.tokens[t].isType;)t++;if(this.tokens.matches1AtIndex(t,r.TokenType.parenL)){for(this.tokens.replaceToken(`async (`),this.tokens.removeInitialToken();this.tokens.currentIndex()<t;)this.tokens.removeToken();return this.tokens.removeToken(),this.processBalancedCode(),this.processToken(),!0}return!1}processPossibleTypeRange(){if(this.tokens.currentToken().isType){for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return!0}return!1}shiftMappings(e,t){for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(e[n]=r+t)}return e}}})),
|
|
686
|
-
`,n=`\r`,r=function(){function e(e){this.string=e;for(var r=[0],i=0;i<e.length;)switch(e[i]){case t:i+=t.length,r.push(i);break;case n:i+=n.length,e[i]===t&&(i+=t.length),r.push(i);break;default:i++}this.offsets=r}return e.prototype.locationForIndex=function(e){if(e<0||e>this.string.length)return null;for(var t=0,n=this.offsets;n[t+1]<=e;)t++;var r=e-n[t];return{line:t,column:r}},e.prototype.indexForLocation=function(e){var t=e.line,n=e.column;return t<0||t>=this.offsets.length||n<0||n>this.lengthOfLine(t)?null:this.offsets[t]+n},e.prototype.lengthOfLine=function(e){var t=this.offsets[e];return(e===this.offsets.length-1?this.string.length:this.offsets[e+1])-t},e}();e.LinesAndColumns=r,e.default=r})),
|
|
687
|
-
`);function d(t){let n=e.slice(t.start,t.end);return[p(t.start,t.end),r.formatTokenType.call(void 0,t.type),i(String(n),14),...a.map(e=>f(t[e],e)),...o.map(e=>f(t.type[e],e))]}function f(e,t){return e===!0?t:e===!1||e===null?``:String(e)}function p(e,t){return`${m(e)}-${m(t)}`}function m(e){let t=c.locationForIndex(e);return t?`${t.line+1}:${t.column+1}`:`Unknown`}};function i(e,t){return e.length>t?`${e.slice(0,t-3)}...`:e}})),$w=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=G(),r=t(tw());e.default=function(e){let t=/* @__PURE__ */ new Set;for(let r=0;r<e.tokens.length;r++)e.matches1AtIndex(r,n.TokenType._import)&&!e.matches3AtIndex(r,n.TokenType._import,n.TokenType.name,n.TokenType.eq)&&i(e,r,t);return t};function i(e,t,r){t++,e.matches1AtIndex(t,n.TokenType.parenL)||(e.matches1AtIndex(t,n.TokenType.name)&&(r.add(e.identifierNameAtIndex(t)),t++,e.matches1AtIndex(t,n.TokenType.comma)&&t++),e.matches1AtIndex(t,n.TokenType.star)&&(t+=2,r.add(e.identifierNameAtIndex(t)),t++),e.matches1AtIndex(t,n.TokenType.braceL)&&(t++,a(e,t,r)))}function a(e,t,i){for(;;){if(e.matches1AtIndex(t,n.TokenType.braceR))return;let a=r.default.call(void 0,e,t);if(t=a.endIndex,a.isType||i.add(a.rightName),e.matches2AtIndex(t,n.TokenType.comma,n.TokenType.braceR)||e.matches1AtIndex(t,n.TokenType.braceR))return;if(e.matches1AtIndex(t,n.TokenType.comma))t++;else throw Error(`Unexpected token: ${JSON.stringify(e.tokens[t])}`)}}})),eT=(/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=t(sw()),r=t(fw()),i=pw(),a=t(mw()),o=t(gw()),s=xw(),c=Aw(),l=t(Mw()),u=t(Xw());t(Qw());var d=t($w());e.transform=function(e,t){s.validateOptions.call(void 0,t);try{let n=f(e,t),i=new u.default(n,t.transforms,!!t.enableLegacyBabel5ModuleInterop,t).transform(),a={code:i.code};if(t.sourceMapOptions){if(!t.filePath)throw Error(`filePath must be specified when generating a source map.`);a={...a,sourceMap:r.default.call(void 0,i,t.filePath,t.sourceMapOptions,e,n.tokenProcessor.tokens)}}return a}catch(e){throw t.filePath&&(e.message=`Error transforming ${t.filePath}: ${e.message}`),e}};function f(e,t){let r=t.transforms.includes(`jsx`),s=t.transforms.includes(`typescript`),u=t.transforms.includes(`flow`),f=t.disableESTransforms===!0,p=c.parse.call(void 0,e,r,s,u),m=p.tokens,h=p.scopes,g=new o.default(e,m),_=new i.HelperManager(g),v=new l.default(e,m,u,f,_),y=!!t.enableLegacyTypeScriptModuleInterop,b=null;return t.transforms.includes(`imports`)?(b=new n.default(g,v,y,t,t.transforms.includes(`typescript`),!!t.keepUnusedImports,_),b.preprocessTokens(),a.default.call(void 0,v,h,b.getGlobalNames()),t.transforms.includes(`typescript`)&&!t.keepUnusedImports&&b.pruneTypeOnlyImports()):t.transforms.includes(`typescript`)&&!t.keepUnusedImports&&a.default.call(void 0,v,h,d.default.call(void 0,v)),{tokenProcessor:v,scopes:h,nameManager:g,importProcessor:b,helperManager:_}}})))();const tT=`__ryugi_h`;function nT(e){let t=e.message,n=/\((\d+):(\d+)\)/.exec(t);return n?`report.tsx:${n[1]}:${Number(n[2])+1} ${t.replace(/\s*\(\d+:\d+\)/,``)}`:`report.tsx: ${t}`}const rT=/* @__PURE__ */ new Set([`Stat`,`LineChart`,`BarChart`,`AreaChart`,`PieChart`,`ScatterChart`,`Table`]),iT=/* @__PURE__ */ new Set([...rT,`Callout`,`Section`,`Image`]),aT=[`fetch`,`XMLHttpRequest`,`WebSocket`,`EventSource`,`require`,`setInterval`,`setTimeout`,`document`,`window`,`localStorage`,`sessionStorage`,`globalThis`,`eval`,`Function`,`location`,`navigator`],oT=[`createElement`,`constructor`,`__proto__`];[...aT.map(e=>({name:e,pattern:RegExp(`(?<![.\\w$])${e}(?![\\w$])`)})),...oT.map(e=>({name:e,pattern:RegExp(`(?<![\\w$])${e}(?![\\w$])`)}))];const sT=RegExp(`${tT}\\(\\s*(?:'([^']*)'|"([^"]*)"|([A-Za-z_$][\\w$.]*))\\s*,\\s*`,`g`),cT=/^(?:"([^"]*)"|'([^']*)')$/;function lT(e){try{let{code:t}=(0,eT.transform)(e,{transforms:[`typescript`,`jsx`],jsxPragma:tT,jsxFragmentPragma:`__ryugi_fragment`,production:!0});return{code:t}}catch(e){return{error:nT(e)}}}function uT(e,t){let n=/* @__PURE__ */ new Map;if(e[t]!==`{`)return n;let r=0,i=null,a=null,o=-1,s=t+1;for(let c=t;c<e.length;c++){let t=e[c];if(i)t===`\\`?c++:t===i&&(i=null);else if(t===`"`||t===`'`||t==="`")i=t;else if(t===`{`||t===`[`||t===`(`)r++;else if(t===`}`||t===`]`||t===`)`){if(r--,r===0)return a!==null&&n.set(a,e.slice(o,c).trim().replace(/,$/,``).trim()),n}else r===1&&(t===`:`&&a===null?(a=e.slice(s,c).trim(),o=c+1):t===`,`&&(a!==null&&n.set(a,e.slice(o,c).trim()),a=null,s=c+1))}return n}function dT(e){let t=[];for(let n of e.matchAll(sT)){let r=n[1]??n[2],i=r??n[3];t.push({tag:r===void 0?i:`<${r}>`,props:r===void 0?uT(e,n.index+n[0].length):/* @__PURE__ */ new Map})}return t}const fT=e=>{let t=e===void 0?null:cT.exec(e);return t?t[1]??t[2]:void 0};function pT(e){if(e===void 0)return null;let t=fT(e);if(t!==void 0)return[t];if(!e.startsWith(`[`)||!e.endsWith(`]`))return null;let n=e.slice(1,-1).split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>fT(e));return n.every(e=>e!==void 0)?[...new Set(n)]:null}function mT(e){let t=[];for(let n of e){if(!iT.has(n.tag))continue;let e=fT(n.props.get(`id`));if(e===void 0)continue;let r=fT(n.props.get(n.tag===`Image`?`caption`:`title`)),i=fT(n.props.get(n.tag===`Table`?`rowKey`:`x`));t.push({id:e,tag:n.tag,...r===void 0?{}:{title:r},...i!==void 0&&rT.has(n.tag)?{key:i}:{},sources:pT(n.props.get(`source`))??[]})}return t}function hT(e){let t=lT(e);return`code`in t?mT(dT(t.code)):[]}function gT(e,t){let n=Nb(e,`report`,t);if(!n)return null;try{return hT(u.default.readFileSync(d.default.join(n,O.report),`utf8`)).map(e=>e.id)}catch{return null}}function _T(e,t,n){if(!e.block)return null;let r=Bv(e),i=t.blocksOf(r);return i&&!i.includes(e.block)?`<${n} report="${r}" block="${e.block}">: the report has no block ${e.block}; its blocks are: ${i.join(`, `)}`:null}function vT(e,t,n){if(!e.slide)return null;let r=Bv(e),i=t.slidesOf(r);return i&&!i.includes(e.slide)?`<${n} slides="${r}" slide="${e.slide}">: the deck has no slide ${e.slide}; its slides are: ${i.join(`, `)}`:null}const yT=e=>{try{return u.default.readFileSync(e,`utf8`)}catch{return null}},bT=e=>({readFile:(t,n)=>{let r=t===`artifact`?nC(e,n):null;return(r&&yT(r))??{error:`${n} cannot be read here`}}});function xT(e){let t=yT(d.default.join(e,sE)),n=t===null?yT(d.default.join(e,cE)):$S(t,bT(e)).html;if(n===null)return null;let r=Mb(n);return{title:r.title||null,slides:r.slides.flatMap(({id:e})=>e?[e]:[])}}const ST=/^(\s*(?:<\?xml[^>]*\?>\s*)?(?:<!--[\s\S]*?-->\s*)*)<report(?=[\s/>])/;function CT(e){let t=d.default.join(e,O.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=ST.test(r)&&i!==-1?`${r.slice(0,i).replace(ST,`$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})}`${`0`.repeat(26)}`;const wT=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{};function TT(e,t=`scene.excalidraw`){let n;try{n=JSON.parse(e)}catch{return{error:`${t} is not valid JSON`}}let r=wT(n),i=r.elements??[];if(!Array.isArray(i))return{error:`${t}: elements must be an array`};for(let[e,n]of i.entries()){let r=wT(n);if(typeof r.id!=`string`||typeof r.type!=`string`)return{error:`${t}: element ${e} needs a string id and type`}}return{scene:{type:`excalidraw`,version:2,source:typeof r.source==`string`?r.source:`ryugi`,elements:i,appState:wT(r.appState),files:wT(r.files)}}}const ET=e=>{try{return u.default.readFileSync(e,`utf8`)}catch{return null}};function DT(e){try{return u.default.readdirSync(d.default.join(e,Zv)).filter(e=>e.endsWith(`.excalidraw`)).map(e=>e.slice(0,-11)).sort()}catch{return[]}}function OT(e){let{pages:t}=ry(ny(ET(d.default.join(e,Xv))).pages,DT(e)),n={},r={};for(let i of t){let t=ET(d.default.join(e,ey(i.id))),a=t===null?null:TT(t);if(!(!a||`error`in a)){r[i.id]=a.scene;for(let e of a.scene.elements)e.type===`frame`&&!e.isDeleted&&!(e.id in n)&&(n[e.id]=i.id)}}return{pages:t,frames:n,scenes:r}}function kT(e,t){let n=Nb(e,`whiteboard`,t);return n?OT(n):null}function AT(e,t,n){let r=e.whiteboard,i=t.framesOf(r);if(!i)return null;if(e.page){let t=i.pages.find(t=>t.id===e.page);if(!t)return`<${n} whiteboard="${r}" page="${e.page}">: the whiteboard has no page ${e.page}`;if(t.deleted)return`<${n} whiteboard="${r}" page="${e.page}">: page ${e.page} is deleted; restore it or point the reference elsewhere`}if(!e.frame)return null;let a=i.frames[e.frame];return a===void 0?`<${n} whiteboard="${r}" frame="${e.frame}">: the whiteboard has no frame ${e.frame}`:i.pages.find(e=>e.id===a)?.deleted?`<${n} whiteboard="${r}" frame="${e.frame}">: frame ${e.frame} is on deleted page ${a}`:null}function jT(e,t,n){if(!Jv(t)||!Kv(n))throw Error(`Invalid artifact locator`);let r=d.default.join(e,t,n);return u.default.mkdirSync(r,{recursive:!0}),`/${t}/${Pb(r)}`}const MT={document:WC,artboard:MC,whiteboard:AT,html:null,slides:vT,report:_T,storyboard:null,verify:null};function NT(e){return{idOf:(t,n=`artboard`)=>Nb(e,n,t)?jT(e,n,t).slice(`/${n}/`.length):null,blocksOf:t=>gT(e,t),documentBlocksOf:t=>UC(e,t),framesOf:t=>kT(e,t),canvasOf:t=>jC(e,t)}}RegExp(`<ref\\b[^>]*?\\b(${Mv.map(e=>e.refAttribute).join(`|`)})="([^"]+)"`,`g`),new Map(Mv.map(e=>[e.refAttribute,e.type]));function PT(e,t,n=`ref`){let r=zv(e),i=Bv(e),a=t.idOf(i,r);return a?e.to&&e.to!==a?`<${n} ${r}="${i}"> points at ${e.to}, but ${i} is now ${a}; delete to= to point the reference at it`:MT[r]?.(e,t,n)??null:`<${n} ${r}="${i}"> names ${iy[r]} that is not in this project`}const FT=/<title[^>]*>([\s\S]*?)<\/title>/i;function IT(e,t){let n;try{n=u.default.readFileSync(d.default.join(e,O.html),`utf8`)}catch{return{title:t,warnings:[`index.html not found`],version:Rb(e)}}return{title:FT.exec(n)?.[1]?.trim()||t,warnings:[],version:Rb(e)}}const LT=`data`,RT=/<Report\b[^>]*?\btitle=(?:"([^"]*)"|'([^']*)'|\{\s*(?:"([^"]*)"|'([^']*)')\s*\})/;function zT(e){let t=RT.exec(e);return(t?.[1]??t?.[2]??t?.[3]??t?.[4])?.trim()||void 0}const BT=e=>e.elements.reduce((e,t)=>e+(t.version??0),0);function VT(e,t){let n=Rb(e),r;try{r=u.default.readFileSync(d.default.join(e,O.whiteboard),`utf8`)}catch{return{title:t,warnings:[`${O.whiteboard} not found`],version:n,sceneVersion:0}}let i=TT(r);if(`error`in i)return{title:t,warnings:[i.error],version:n,sceneVersion:0};let a=typeof i.scene.appState.name==`string`?i.scene.appState.name.trim():``,o=a?TC(`appState.name`,a,t):`"appState.name" is missing; give the whiteboard a title`;return{title:a||t,warnings:o?[o]:[],version:n,sceneVersion:BT(i.scene)}}function HT(e){return{...NT(e),slidesOf:t=>{let n=Nb(e,`slides`,t);return n?xT(n)?.slides??null:null}}}function UT(e,t,n){if(e===`document`)return HC(t,n).title;if(e===`artboard`)return kC(t).canvas?.title;if(e===`whiteboard`)return VT(t,n).title;if(e===`html`)return IT(t,n).title;if(e===`slides`)return xT(t)?.title;try{return zT(u.default.readFileSync(d.default.join(t,O.report),`utf8`))}catch{return null}}function WT(e){let t=HT(e);return n=>{let r=zv(n),i=Bv(n),a=Nb(e,r,i),o=PT(n,t);if(o)return{missing:o};let s=t.idOf(i,r);return!a||!s?{missing:`<ref ${r}="${i}"> cannot be read`}:{title:UT(r,a,i)||i,to:s}}}const GT={w:1280,h:720},KT=e=>{try{return u.default.statSync(e).mtimeMs}catch{return 0}};function qT(e){let t=e.x??0,n=e.y??0,r=e.width??0,i=e.height??0,a=Array.isArray(e.points)?e.points:null,o=a?.length?a.map(([e,r])=>[t+e,n+r]):[[t,n],[t+r,n],[t,n+i],[t+r,n+i]],s=typeof e.angle==`number`?e.angle:0;if(!s)return o;let c=t+r/2,l=n+i/2,u=Math.cos(s),d=Math.sin(s);return o.map(([e,t])=>[c+(e-c)*u-(t-l)*d,l+(e-c)*d+(t-l)*u])}function JT(e,t,n,r,i,a,o){let s=n.frame?r.frames[n.frame]:n.page,c=d.default.join(e,ey(s));o(c);let l=(r.scenes[s]?.elements??[]).filter(e=>!e.isDeleted),u=n.frame?l.find(e=>e.id===n.frame):void 0,f=u?{w:u.width??0,h:u.height??0}:YT(l);return!f||!(f.w>0&&f.h>0)?{missing:`${i}: ${n.frame?`frame ${n.frame}`:`page ${s}`} has nothing drawn on it yet`}:{kind:`frame`,src:`../../whiteboard/${t}/embed.html?${new URLSearchParams({...n.frame?{frame:n.frame}:{},page:s,v:String(Math.round(KT(c)))})}`,w:Math.round(f.w),h:Math.round(f.h),title:u?.name||VT(e,t).title,to:a}}function YT(e){let t=e.flatMap(qT);if(!t.length)return null;let n=t.map(([e])=>e),r=t.map(([,e])=>e);return{w:Math.max(...n)-Math.min(...n),h:Math.max(...r)-Math.min(...r)}}function XT(e,t,n,r,i,a){a(d.default.join(e,`canvas.json`));let o=kC(e),s=o.canvas?.boards[n];if(!s)return{missing:`${r}: the artboard has no board ${n}`};if(he(s))return{missing:`${r}: board ${n} is ${s.type===`image`?`an image`:`a video`}, not a page`};let c=aC(e,s.file);a(c??d.default.join(e,s.file));let l=o.versions[s.file];return!c||!l?{missing:`${r}: board ${n} is still being written`}:{kind:`frame`,src:`../../artboard/${t}/${encodeURI(s.file)}?v=${Math.round(l)}`,w:s.w,h:s.h,title:s.title||n,to:i}}function ZT(e,t,n,r,i){let a=d.default.join(e,O.html);return i(a),u.default.existsSync(a)?{kind:`frame`,src:`../../html/${t}/${O.html}?v=${Math.round(Rb(e))}`,...GT,title:IT(e,t).title,to:r}:{missing:`${n}: the page has no ${O.html} yet`}}function QT(e,t,n,r,i){let a=d.default.join(e,O.report);i(a);for(let t of u.default.existsSync(d.default.join(e,`data`))?u.default.readdirSync(d.default.join(e,LT)):[])i(d.default.join(e,LT,t));let o=``;try{o=u.default.readFileSync(a,`utf8`)}catch{o=``}return{kind:`flow`,src:`../../report/${t}/index.html?block=${encodeURIComponent(n)}&embed&v=${Math.round(Rb(e))}`,title:zT(o)||t,to:r}}function $T(e,t,n,r,i){return i(d.default.join(e,sE)),{kind:`frame`,src:`../../slides/${t}/index.html?embed=${encodeURIComponent(n)}&v=${Math.round(Rb(e))}`,...GT,title:xT(e)?.title||t,to:r}}function eE(e,t,n,r){if(!Kv(n))return;let i=d.default.join(e,t,n);if(t===`html`&&r(d.default.join(i,O.html)),t===`artboard`&&r(d.default.join(i,O.artboard)),t===`report`&&r(d.default.join(i,O.report)),t===`slides`&&r(d.default.join(i,sE)),t===`whiteboard`){r(d.default.join(i,Xv)),r(d.default.join(i,Zv));for(let e of[Yv,...DT(i)])r(d.default.join(i,ey(e)))}}function tE(e,t){let n=HT(e);return r=>{let i=zv(r),a=Bv(r),o=PT(r,n,`embed`);if(o)return eE(e,i,a,t),{missing:o};let s=Nb(e,i,a),c=n.idOf(a,i),l=r.board??r.frame,u=`<embed ${i}="${a}"${l?` ${r.board?`board`:`frame`}="${l}"`:``}>`;if(!s||!c)return{missing:`${u} cannot be read`};if(i===`report`&&r.block)return QT(s,a,r.block,c,t);if(i===`slides`&&r.slide)return $T(s,a,r.slide,c,t);if(i===`html`)return ZT(s,a,u,c,t);if(i===`artboard`&&r.board)return XT(s,a,r.board,u,c,t);let d=i===`whiteboard`?n.framesOf(a):null;return d&&(r.frame||r.page)?JT(s,a,r,d,u,c,t):{missing:`${u} cannot be read`}}}const nE=/^(?:id_(?:rsa|dsa|ecdsa|ed25519)\b.*|(?:secrets?|credentials?)(?:\..*)?|.*\.(?:pem|key|p12|pfx|jks|keystore|tfstate|tfvars)(?:\..*)?)$/i,rE=(e,t)=>e.toLowerCase().startsWith(`${t.toLowerCase()}${d.default.sep}`);function iE(e,t){let n={error:`${t} is outside what a deck may read`};if(d.default.isAbsolute(t))return n;let r=nC(e,t);if(!r)return n;let i;try{if(i=u.default.realpathSync(r),!rE(i,u.default.realpathSync(e)))return n;let a=u.default.statSync(i);if(!a.isFile())return{error:`${t} is not a file`};if(a.size>524288)return{error:`${t} is too large to put on a slide`}}catch{return{error:`${t} was not found`}}return i}function aE(e,t){try{return(0,p.execFileSync)(`git`,[`check-ignore`,`-q`,`--`,t],{cwd:e,stdio:`ignore`,timeout:2e3}),!0}catch{return!1}}function oE(e,t){let n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Map;return{deps:()=>[...n],embed:tE(d.default.resolve(e,`../..`),e=>n.add(e)),ref:WT(d.default.resolve(e,`../..`)),checkChart:t=>tC.chart(t,e)??null,readFile(i,a){let o=iE(i===`project`?t:e,a);if(typeof o!=`string`)return o;if(nE.test(d.default.basename(o))||nE.test(d.default.basename(a)))return{error:`${a} is named like a secret, and a deck does not show those`};if(i===`project`&&(r.has(o)||r.set(o,aE(t,o)),r.get(o)))return{error:`git ignores ${a}, and a deck does not show ignored files`};if(i===`artifact`&&d.default.basename(o).toLowerCase()===`comments.json`)return{error:`${a} is not part of the deck`};try{let e=u.default.readFileSync(o,`utf8`);return n.add(o),e}catch{return{error:`${a} could not be read`}}}}}const sE=`deck.xml`,cE=`index.html`,lE=e=>d.default.resolve(e,`../../../..`);function uE(e){try{return u.default.readFileSync(e,`utf8`)}catch{return null}}function dE(e,t=lE(e),n={}){let r=uE(d.default.join(e,sE));if(r===null){let t=uE(d.default.join(e,cE));return t===null?null:{html:t,source:`html`,issues:[],warnings:[],deps:[],embeds:[],refs:[],both:!1,complete:null,origins:/* @__PURE__ */ new Map,title:null,groups:[],cover:null}}let i=oE(e,t),a;try{a=$S(r,i,n)}catch(e){a={html:``,title:null,deps:[],embeds:[],refs:[],warnings:[],origins:/* @__PURE__ */ new Map,groups:[],cover:null,issues:[{code:`xml`,slide:-1,detail:`the deck could not be read: ${e instanceof Error?e.message:String(e)}`}]}}return{html:a.html,source:`xml`,issues:a.issues,warnings:a.warnings,deps:i.deps(),embeds:a.embeds,refs:a.refs,both:u.default.existsSync(d.default.join(e,cE)),complete:/<\/deck\s*>\s*$/.test(r),origins:a.origins,title:a.title,groups:a.groups,cover:a.cover}}function fE(e,t){let n=d.default.resolve(e,t);return n.startsWith(`${e}${d.default.sep}`)&&u.default.existsSync(n)}function pE(e){try{return u.default.statSync(e).mtimeMs}catch{return 0}}function mE(e,t,n=lE(e)){let r=dE(e,n),i=Math.max(Rb(e,`comments.json`),...(r?.deps??[]).map(pE));if(!r)return{title:t,version:i,complete:!1,outline:[],issues:[],warnings:[`${sE} not found`]};let a=Mb(r.html),o=r.source===`xml`,s=new Set(r.embeds.flatMap(({frame:e})=>e?[e]:[]));return{title:r.title||a.title||t,version:i,complete:r.complete??a.complete,outline:a.slides,issues:[...r.both?[{code:`two_entries`,slide:-1}]:[],...a.issues,...a.assets.filter(t=>!s.has(t)&&!fE(e,t)).map(e=>({code:`missing_asset`,slide:-1,detail:e}))],...o?{sourceIssues:r.issues,sourceWarnings:r.warnings}:{},...o?{groups:r.groups,origins:Object.fromEntries(r.origins),...r.cover?{cover:r.cover}:{}}:{},warnings:o||a.hasDeck?[]:[`index.html has no <div class="reveal"><div class="slides">`]}}function hE(e){try{return JSON.parse(u.default.readFileSync(e,`utf8`))}catch{return null}}function gE(e,t){let n=/* @__PURE__ */ new Map,r=hE(e);if(!wt(r)||r.version!==t||!Array.isArray(r.slides))return n;for(let e of r.slides)wt(e)&&typeof e.id==`string`&&typeof e.overflow==`boolean`&&n.set(e.id,e.overflow);return n}function _E(e){let t=/* @__PURE__ */ new Map,n=hE(e);if(!wt(n)||!Array.isArray(n.threads))return t;for(let e of n.threads){if(!wt(e)||e.status!==`open`||!wt(e.anchor))continue;let{slide:n}=e.anchor;typeof n==`string`&&t.set(n,(t.get(n)??0)+1)}return t}function vE(e,t){let n=d.default.join(e,`slides`,t),r=mE(n,t),i=gE(d.default.join(e,`.state`,`slides`,t,`outline.json`),r.version),a=_E(d.default.join(n,`comments.json`));return r.outline.map((e,t)=>{let n=e.id===null?void 0:i.get(e.id);return{number:t+1,id:e.id??``,layout:e.layout,title:e.title,steps:e.steps,overflow:n===void 0?`unknown`:n?`yes`:`no`,comments:e.id!==null&&a.get(e.id)||0}})}const yE={authoring:fb,source:`deck.xml`,changes:!0,review:{sections:[]},localGet:{key:`slides`,read:(e,t)=>{let n=vE(e,t);return n?{rows:n}:{}},columns:[{key:`number`,required:!0,positional:!0},{key:`id`,required:!0,positional:!0},{key:`layout`,positional:!0},{key:`title`,positional:!0},{key:`steps`},{key:`overflow`},{key:`comments`}]},outlineView:{rows:e=>e.map(e=>({...e,overflow:e.overflow===!0?`yes`:e.overflow===!1?`no`:`unknown`})),columns:[{key:`id`,positional:!0,required:!0},{key:`layout`,positional:!0},{key:`title`,positional:!0},{key:`steps`},{key:`overflow`}]},commentActions:{add:e=>{if(!e.slide)throw new A(`comment add on a deck needs --slide <slideId>`);return{op:`add`,slide:e.slide,text:it(e)}}}},bE=String.raw`import { spawn, spawnSync } from 'node:child_process';
|
|
685
|
+
`),{code:r.slice(0,i+1)+e+r.slice(i+1)+t,mappings:this.shiftMappings(n.mappings,e.length)}}return{code:e+r+t,mappings:this.shiftMappings(n.mappings,e.length)}}processBalancedCode(){let e=0,t=0;for(;!this.tokens.isAtEnd();){if(this.tokens.matches1(r.TokenType.braceL)||this.tokens.matches1(r.TokenType.dollarBraceL))e++;else if(this.tokens.matches1(r.TokenType.braceR)){if(e===0)return;e--}if(this.tokens.matches1(r.TokenType.parenL))t++;else if(this.tokens.matches1(r.TokenType.parenR)){if(t===0)return;t--}this.processToken()}}processToken(){if(this.tokens.matches1(r.TokenType._class))this.processClass();else{for(let e of this.transformers)if(e.process())return;this.tokens.copyToken()}}processNamedClass(){if(!this.tokens.matches2(r.TokenType._class,r.TokenType.name))throw Error(`Expected identifier for exported class name.`);let e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.processClass(),e}processClass(){let e=i.default.call(void 0,this,this.tokens,this.nameManager,this.disableESTransforms),t=(e.headerInfo.isExpression||!e.headerInfo.className)&&e.staticInitializerNames.length+e.instanceInitializerNames.length>0,n=e.headerInfo.className;t&&(n=this.nameManager.claimFreeName(`_class`),this.generatedVariables.push(n),this.tokens.appendCode(` (${n} =`));let a=this.tokens.currentToken().contextId;if(a==null)throw Error(`Expected class to have a context ID.`);for(this.tokens.copyExpectedToken(r.TokenType._class);!this.tokens.matchesContextIdAndLabel(r.TokenType.braceL,a);)this.processToken();this.processClassBody(e,n);let o=e.staticInitializerNames.map(e=>`${n}.${e}()`);t?this.tokens.appendCode(`, ${o.map(e=>`${e}, `).join(``)}${n})`):e.staticInitializerNames.length>0&&this.tokens.appendCode(` ${o.map(e=>`${e};`).join(` `)}`)}processClassBody(e,t){let{headerInfo:n,constructorInsertPos:i,constructorInitializerStatements:a,fields:o,instanceInitializerNames:s,rangesToRemove:c}=e,l=0,u=0,d=this.tokens.currentToken().contextId;if(d==null)throw Error(`Expected non-null context ID on class.`);this.tokens.copyExpectedToken(r.TokenType.braceL),this.isReactHotLoaderTransformEnabled&&this.tokens.appendCode(`__reactstandin__regenerateByEval(key, code) {this[key] = eval(code);}`);let f=a.length+s.length>0;if(i===null&&f){let e=this.makeConstructorInitCode(a,s,t);if(n.hasSuperclass){let t=this.nameManager.claimFreeName(`args`);this.tokens.appendCode(`constructor(...${t}) { super(...${t}); ${e}; }`)}else this.tokens.appendCode(`constructor() { ${e}; }`)}for(;!this.tokens.matchesContextIdAndLabel(r.TokenType.braceR,d);)if(l<o.length&&this.tokens.currentIndex()===o[l].start){let e=!1;for(this.tokens.matches1(r.TokenType.bracketL)?this.tokens.copyTokenWithPrefix(`${o[l].initializerName}() {this`):this.tokens.matches1(r.TokenType.string)||this.tokens.matches1(r.TokenType.num)?(this.tokens.copyTokenWithPrefix(`${o[l].initializerName}() {this[`),e=!0):this.tokens.copyTokenWithPrefix(`${o[l].initializerName}() {this.`);this.tokens.currentIndex()<o[l].end;)e&&this.tokens.currentIndex()===o[l].equalsIndex&&this.tokens.appendCode(`]`),this.processToken();this.tokens.appendCode(`}`),l++}else if(u<c.length&&this.tokens.currentIndex()>=c[u].start){for(this.tokens.currentIndex()<c[u].end&&this.tokens.removeInitialToken();this.tokens.currentIndex()<c[u].end;)this.tokens.removeToken();u++}else this.tokens.currentIndex()===i&&(this.tokens.copyToken(),f&&this.tokens.appendCode(`;${this.makeConstructorInitCode(a,s,t)};`)),this.processToken();this.tokens.copyExpectedToken(r.TokenType.braceR)}makeConstructorInitCode(e,t,n){return[...e,...t.map(e=>`${n}.prototype.${e}.call(this)`)].join(`;`)}processPossibleArrowParamEnd(){if(this.tokens.matches2(r.TokenType.parenR,r.TokenType.colon)&&this.tokens.tokenAtRelativeIndex(1).isType){let e=this.tokens.currentIndex()+1;for(;this.tokens.tokens[e].isType;)e++;if(this.tokens.matches1AtIndex(e,r.TokenType.arrow)){for(this.tokens.removeInitialToken();this.tokens.currentIndex()<e;)this.tokens.removeToken();return this.tokens.replaceTokenTrimmingLeftWhitespace(`) =>`),!0}}return!1}processPossibleAsyncArrowWithTypeParams(){if(!this.tokens.matchesContextual(n.ContextualKeyword._async)&&!this.tokens.matches1(r.TokenType._async))return!1;let e=this.tokens.tokenAtRelativeIndex(1);if(e.type!==r.TokenType.lessThan||!e.isType)return!1;let t=this.tokens.currentIndex()+1;for(;this.tokens.tokens[t].isType;)t++;if(this.tokens.matches1AtIndex(t,r.TokenType.parenL)){for(this.tokens.replaceToken(`async (`),this.tokens.removeInitialToken();this.tokens.currentIndex()<t;)this.tokens.removeToken();return this.tokens.removeToken(),this.processBalancedCode(),this.processToken(),!0}return!1}processPossibleTypeRange(){if(this.tokens.currentToken().isType){for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return!0}return!1}shiftMappings(e,t){for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(e[n]=r+t)}return e}}})),rT=/* @__PURE__ */ o((e=>{e.__esModule=!0,e.LinesAndColumns=void 0;var t=`
|
|
686
|
+
`,n=`\r`,r=function(){function e(e){this.string=e;for(var r=[0],i=0;i<e.length;)switch(e[i]){case t:i+=t.length,r.push(i);break;case n:i+=n.length,e[i]===t&&(i+=t.length),r.push(i);break;default:i++}this.offsets=r}return e.prototype.locationForIndex=function(e){if(e<0||e>this.string.length)return null;for(var t=0,n=this.offsets;n[t+1]<=e;)t++;var r=e-n[t];return{line:t,column:r}},e.prototype.indexForLocation=function(e){var t=e.line,n=e.column;return t<0||t>=this.offsets.length||n<0||n>this.lengthOfLine(t)?null:this.offsets[t]+n},e.prototype.lengthOfLine=function(e){var t=this.offsets[e];return(e===this.offsets.length-1?this.string.length:this.offsets[e+1])-t},e}();e.LinesAndColumns=r,e.default=r})),iT=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=t(rT()),r=G();e.default=function(e,t){if(t.length===0)return``;let a=Object.keys(t[0]).filter(e=>e!==`type`&&e!==`value`&&e!==`start`&&e!==`end`&&e!==`loc`),o=Object.keys(t[0].type).filter(e=>e!==`label`&&e!==`keyword`),s=[`Location`,`Label`,`Raw`,...a,...o],c=new n.default(e),l=[s,...t.map(d)],u=s.map(()=>0);for(let e of l)for(let t=0;t<e.length;t++)u[t]=Math.max(u[t],e[t].length);return l.map(e=>e.map((e,t)=>e.padEnd(u[t])).join(` `)).join(`
|
|
687
|
+
`);function d(t){let n=e.slice(t.start,t.end);return[p(t.start,t.end),r.formatTokenType.call(void 0,t.type),i(String(n),14),...a.map(e=>f(t[e],e)),...o.map(e=>f(t.type[e],e))]}function f(e,t){return e===!0?t:e===!1||e===null?``:String(e)}function p(e,t){return`${m(e)}-${m(t)}`}function m(e){let t=c.locationForIndex(e);return t?`${t.line+1}:${t.column+1}`:`Unknown`}};function i(e,t){return e.length>t?`${e.slice(0,t-3)}...`:e}})),aT=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=G(),r=t(sw());e.default=function(e){let t=/* @__PURE__ */ new Set;for(let r=0;r<e.tokens.length;r++)e.matches1AtIndex(r,n.TokenType._import)&&!e.matches3AtIndex(r,n.TokenType._import,n.TokenType.name,n.TokenType.eq)&&i(e,r,t);return t};function i(e,t,r){t++,e.matches1AtIndex(t,n.TokenType.parenL)||(e.matches1AtIndex(t,n.TokenType.name)&&(r.add(e.identifierNameAtIndex(t)),t++,e.matches1AtIndex(t,n.TokenType.comma)&&t++),e.matches1AtIndex(t,n.TokenType.star)&&(t+=2,r.add(e.identifierNameAtIndex(t)),t++),e.matches1AtIndex(t,n.TokenType.braceL)&&(t++,a(e,t,r)))}function a(e,t,i){for(;;){if(e.matches1AtIndex(t,n.TokenType.braceR))return;let a=r.default.call(void 0,e,t);if(t=a.endIndex,a.isType||i.add(a.rightName),e.matches2AtIndex(t,n.TokenType.comma,n.TokenType.braceR)||e.matches1AtIndex(t,n.TokenType.braceR))return;if(e.matches1AtIndex(t,n.TokenType.comma))t++;else throw Error(`Unexpected token: ${JSON.stringify(e.tokens[t])}`)}}})),oT=(/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=t(pw()),r=t(vw()),i=yw(),a=t(bw()),o=t(Sw()),s=Dw(),c=Iw(),l=t(Rw()),u=t(nT());t(iT());var d=t(aT());e.transform=function(e,t){s.validateOptions.call(void 0,t);try{let n=f(e,t),i=new u.default(n,t.transforms,!!t.enableLegacyBabel5ModuleInterop,t).transform(),a={code:i.code};if(t.sourceMapOptions){if(!t.filePath)throw Error(`filePath must be specified when generating a source map.`);a={...a,sourceMap:r.default.call(void 0,i,t.filePath,t.sourceMapOptions,e,n.tokenProcessor.tokens)}}return a}catch(e){throw t.filePath&&(e.message=`Error transforming ${t.filePath}: ${e.message}`),e}};function f(e,t){let r=t.transforms.includes(`jsx`),s=t.transforms.includes(`typescript`),u=t.transforms.includes(`flow`),f=t.disableESTransforms===!0,p=c.parse.call(void 0,e,r,s,u),m=p.tokens,h=p.scopes,g=new o.default(e,m),_=new i.HelperManager(g),v=new l.default(e,m,u,f,_),y=!!t.enableLegacyTypeScriptModuleInterop,b=null;return t.transforms.includes(`imports`)?(b=new n.default(g,v,y,t,t.transforms.includes(`typescript`),!!t.keepUnusedImports,_),b.preprocessTokens(),a.default.call(void 0,v,h,b.getGlobalNames()),t.transforms.includes(`typescript`)&&!t.keepUnusedImports&&b.pruneTypeOnlyImports()):t.transforms.includes(`typescript`)&&!t.keepUnusedImports&&a.default.call(void 0,v,h,d.default.call(void 0,v)),{tokenProcessor:v,scopes:h,nameManager:g,importProcessor:b,helperManager:_}}})))();const sT=`__ryugi_h`;function cT(e){let t=e.message,n=/\((\d+):(\d+)\)/.exec(t);return n?`report.tsx:${n[1]}:${Number(n[2])+1} ${t.replace(/\s*\(\d+:\d+\)/,``)}`:`report.tsx: ${t}`}const lT=/* @__PURE__ */ new Set([`Stat`,`LineChart`,`BarChart`,`AreaChart`,`PieChart`,`ScatterChart`,`Table`]),uT=/* @__PURE__ */ new Set([...lT,`Callout`,`Section`,`Image`]),dT=[`fetch`,`XMLHttpRequest`,`WebSocket`,`EventSource`,`require`,`setInterval`,`setTimeout`,`document`,`window`,`localStorage`,`sessionStorage`,`globalThis`,`eval`,`Function`,`location`,`navigator`],fT=[`createElement`,`constructor`,`__proto__`];[...dT.map(e=>({name:e,pattern:RegExp(`(?<![.\\w$])${e}(?![\\w$])`)})),...fT.map(e=>({name:e,pattern:RegExp(`(?<![\\w$])${e}(?![\\w$])`)}))];const pT=RegExp(`${sT}\\(\\s*(?:'([^']*)'|"([^"]*)"|([A-Za-z_$][\\w$.]*))\\s*,\\s*`,`g`),mT=/^(?:"([^"]*)"|'([^']*)')$/;function hT(e){try{let{code:t}=(0,oT.transform)(e,{transforms:[`typescript`,`jsx`],jsxPragma:sT,jsxFragmentPragma:`__ryugi_fragment`,production:!0});return{code:t}}catch(e){return{error:cT(e)}}}function gT(e,t){let n=/* @__PURE__ */ new Map;if(e[t]!==`{`)return n;let r=0,i=null,a=null,o=-1,s=t+1;for(let c=t;c<e.length;c++){let t=e[c];if(i)t===`\\`?c++:t===i&&(i=null);else if(t===`"`||t===`'`||t==="`")i=t;else if(t===`{`||t===`[`||t===`(`)r++;else if(t===`}`||t===`]`||t===`)`){if(r--,r===0)return a!==null&&n.set(a,e.slice(o,c).trim().replace(/,$/,``).trim()),n}else r===1&&(t===`:`&&a===null?(a=e.slice(s,c).trim(),o=c+1):t===`,`&&(a!==null&&n.set(a,e.slice(o,c).trim()),a=null,s=c+1))}return n}function _T(e){let t=[];for(let n of e.matchAll(pT)){let r=n[1]??n[2],i=r??n[3];t.push({tag:r===void 0?i:`<${r}>`,props:r===void 0?gT(e,n.index+n[0].length):/* @__PURE__ */ new Map})}return t}const vT=e=>{let t=e===void 0?null:mT.exec(e);return t?t[1]??t[2]:void 0};function yT(e){if(e===void 0)return null;let t=vT(e);if(t!==void 0)return[t];if(!e.startsWith(`[`)||!e.endsWith(`]`))return null;let n=e.slice(1,-1).split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>vT(e));return n.every(e=>e!==void 0)?[...new Set(n)]:null}function bT(e){let t=[];for(let n of e){if(!uT.has(n.tag))continue;let e=vT(n.props.get(`id`));if(e===void 0)continue;let r=vT(n.props.get(n.tag===`Image`?`caption`:`title`)),i=vT(n.props.get(n.tag===`Table`?`rowKey`:`x`));t.push({id:e,tag:n.tag,...r===void 0?{}:{title:r},...i!==void 0&&lT.has(n.tag)?{key:i}:{},sources:yT(n.props.get(`source`))??[]})}return t}function xT(e){let t=hT(e);return`code`in t?bT(_T(t.code)):[]}function ST(e,t){let n=Nb(e,`report`,t);if(!n)return null;try{return xT(u.default.readFileSync(d.default.join(n,k.report),`utf8`)).map(e=>e.id)}catch{return null}}function CT(e,t,n){if(!e.block)return null;let r=Bv(e),i=t.blocksOf(r);return i&&!i.includes(e.block)?`<${n} report="${r}" block="${e.block}">: the report has no block ${e.block}; its blocks are: ${i.join(`, `)}`:null}function wT(e,t,n){if(!e.slide)return null;let r=Bv(e),i=t.slidesOf(r);return i&&!i.includes(e.slide)?`<${n} slides="${r}" slide="${e.slide}">: the deck has no slide ${e.slide}; its slides are: ${i.join(`, `)}`:null}const TT=e=>{try{return u.default.readFileSync(e,`utf8`)}catch{return null}},ET=e=>({readFile:(t,n)=>{let r=t===`artifact`?nC(e,n):null;return(r&&TT(r))??{error:`${n} cannot be read here`}}});function DT(e){let t=TT(d.default.join(e,pE)),n=t===null?TT(d.default.join(e,mE)):$S(t,ET(e)).html;if(n===null)return null;let r=Mb(n);return{title:r.title||null,slides:r.slides.flatMap(({id:e})=>e?[e]:[])}}const OT=/^(\s*(?:<\?xml[^>]*\?>\s*)?(?:<!--[\s\S]*?-->\s*)*)<report(?=[\s/>])/;function kT(e){let t=d.default.join(e,k.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=OT.test(r)&&i!==-1?`${r.slice(0,i).replace(OT,`$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})}`${`0`.repeat(26)}`;const AT=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{};function jT(e,t=`scene.excalidraw`){let n;try{n=JSON.parse(e)}catch{return{error:`${t} is not valid JSON`}}let r=AT(n),i=r.elements??[];if(!Array.isArray(i))return{error:`${t}: elements must be an array`};for(let[e,n]of i.entries()){let r=AT(n);if(typeof r.id!=`string`||typeof r.type!=`string`)return{error:`${t}: element ${e} needs a string id and type`}}return{scene:{type:`excalidraw`,version:2,source:typeof r.source==`string`?r.source:`ryugi`,elements:i,appState:AT(r.appState),files:AT(r.files)}}}const MT=e=>{try{return u.default.readFileSync(e,`utf8`)}catch{return null}};function NT(e){try{return u.default.readdirSync(d.default.join(e,Zv)).filter(e=>e.endsWith(`.excalidraw`)).map(e=>e.slice(0,-11)).sort()}catch{return[]}}function PT(e){let{pages:t}=ry(ny(MT(d.default.join(e,Xv))).pages,NT(e)),n={},r={};for(let i of t){let t=MT(d.default.join(e,ey(i.id))),a=t===null?null:jT(t);if(!(!a||`error`in a)){r[i.id]=a.scene;for(let e of a.scene.elements)e.type===`frame`&&!e.isDeleted&&!(e.id in n)&&(n[e.id]=i.id)}}return{pages:t,frames:n,scenes:r}}function FT(e,t){let n=Nb(e,`whiteboard`,t);return n?PT(n):null}function IT(e,t,n){let r=e.whiteboard,i=t.framesOf(r);if(!i)return null;if(e.page){let t=i.pages.find(t=>t.id===e.page);if(!t)return`<${n} whiteboard="${r}" page="${e.page}">: the whiteboard has no page ${e.page}`;if(t.deleted)return`<${n} whiteboard="${r}" page="${e.page}">: page ${e.page} is deleted; restore it or point the reference elsewhere`}if(!e.frame)return null;let a=i.frames[e.frame];return a===void 0?`<${n} whiteboard="${r}" frame="${e.frame}">: the whiteboard has no frame ${e.frame}`:i.pages.find(e=>e.id===a)?.deleted?`<${n} whiteboard="${r}" frame="${e.frame}">: frame ${e.frame} is on deleted page ${a}`:null}function LT(e,t,n){if(!Jv(t)||!Kv(n))throw Error(`Invalid artifact locator`);let r=d.default.join(e,t,n);return u.default.mkdirSync(r,{recursive:!0}),`/${t}/${Pb(r)}`}const RT={document:XC,artboard:RC,whiteboard:IT,html:null,slides:wT,report:CT,storyboard:null,verify:null};function zT(e){return{idOf:(t,n=`artboard`)=>Nb(e,n,t)?LT(e,n,t).slice(`/${n}/`.length):null,blocksOf:t=>ST(e,t),documentBlocksOf:t=>YC(e,t),framesOf:t=>FT(e,t),canvasOf:t=>LC(e,t)}}RegExp(`<ref\\b[^>]*?\\b(${Mv.map(e=>e.refAttribute).join(`|`)})="([^"]+)"`,`g`),new Map(Mv.map(e=>[e.refAttribute,e.type]));function BT(e,t,n=`ref`){let r=zv(e),i=Bv(e),a=t.idOf(i,r);return a?e.to&&e.to!==a?`<${n} ${r}="${i}"> points at ${e.to}, but ${i} is now ${a}; delete to= to point the reference at it`:RT[r]?.(e,t,n)??null:`<${n} ${r}="${i}"> names ${iy[r]} that is not in this project`}const VT=/<title[^>]*>([\s\S]*?)<\/title>/i;function HT(e,t){let n;try{n=u.default.readFileSync(d.default.join(e,k.html),`utf8`)}catch{return{title:t,warnings:[`index.html not found`],version:Rb(e)}}return{title:VT.exec(n)?.[1]?.trim()||t,warnings:[],version:Rb(e)}}const UT=`data`,WT=/<Report\b[^>]*?\btitle=(?:"([^"]*)"|'([^']*)'|\{\s*(?:"([^"]*)"|'([^']*)')\s*\})/;function GT(e){let t=WT.exec(e);return(t?.[1]??t?.[2]??t?.[3]??t?.[4])?.trim()||void 0}const KT=e=>e.elements.reduce((e,t)=>e+(t.version??0),0);function qT(e,t){let n=Rb(e),r;try{r=u.default.readFileSync(d.default.join(e,k.whiteboard),`utf8`)}catch{return{title:t,warnings:[`${k.whiteboard} not found`],version:n,sceneVersion:0}}let i=jT(r);if(`error`in i)return{title:t,warnings:[i.error],version:n,sceneVersion:0};let a=typeof i.scene.appState.name==`string`?i.scene.appState.name.trim():``,o=a?jC(`appState.name`,a,t):`"appState.name" is missing; give the whiteboard a title`;return{title:a||t,warnings:o?[o]:[],version:n,sceneVersion:KT(i.scene)}}function JT(e){return{...zT(e),slidesOf:t=>{let n=Nb(e,`slides`,t);return n?DT(n)?.slides??null:null}}}function YT(e,t,n){if(e===`document`)return JC(t,n).title;if(e===`artboard`)return FC(t).canvas?.title;if(e===`whiteboard`)return qT(t,n).title;if(e===`html`)return HT(t,n).title;if(e===`slides`)return DT(t)?.title;try{return GT(u.default.readFileSync(d.default.join(t,k.report),`utf8`))}catch{return null}}function XT(e){let t=JT(e);return n=>{let r=zv(n),i=Bv(n),a=Nb(e,r,i),o=BT(n,t);if(o)return{missing:o};let s=t.idOf(i,r);return!a||!s?{missing:`<ref ${r}="${i}"> cannot be read`}:{title:YT(r,a,i)||i,to:s}}}const ZT={w:1280,h:720},QT=e=>{try{return u.default.statSync(e).mtimeMs}catch{return 0}};function $T(e){let t=e.x??0,n=e.y??0,r=e.width??0,i=e.height??0,a=Array.isArray(e.points)?e.points:null,o=a?.length?a.map(([e,r])=>[t+e,n+r]):[[t,n],[t+r,n],[t,n+i],[t+r,n+i]],s=typeof e.angle==`number`?e.angle:0;if(!s)return o;let c=t+r/2,l=n+i/2,u=Math.cos(s),d=Math.sin(s);return o.map(([e,t])=>[c+(e-c)*u-(t-l)*d,l+(e-c)*d+(t-l)*u])}function eE(e,t,n,r,i,a,o){let s=n.frame?r.frames[n.frame]:n.page,c=d.default.join(e,ey(s));o(c);let l=(r.scenes[s]?.elements??[]).filter(e=>!e.isDeleted),u=n.frame?l.find(e=>e.id===n.frame):void 0,f=u?{w:u.width??0,h:u.height??0}:tE(l);return!f||!(f.w>0&&f.h>0)?{missing:`${i}: ${n.frame?`frame ${n.frame}`:`page ${s}`} has nothing drawn on it yet`}:{kind:`frame`,src:`../../whiteboard/${t}/embed.html?${new URLSearchParams({...n.frame?{frame:n.frame}:{},page:s,v:String(Math.round(QT(c)))})}`,w:Math.round(f.w),h:Math.round(f.h),title:u?.name||qT(e,t).title,to:a}}function tE(e){let t=e.flatMap($T);if(!t.length)return null;let n=t.map(([e])=>e),r=t.map(([,e])=>e);return{w:Math.max(...n)-Math.min(...n),h:Math.max(...r)-Math.min(...r)}}function nE(e,t,n,r,i,a){a(d.default.join(e,`canvas.json`));let o=FC(e),s=o.canvas?.boards[n];if(!s)return{missing:`${r}: the artboard has no board ${n}`};if(me(s))return{missing:`${r}: board ${n} is ${s.type===`image`?`an image`:`a video`}, not a page`};let c=aC(e,s.file);a(c??d.default.join(e,s.file));let l=o.versions[s.file];return!c||!l?{missing:`${r}: board ${n} is still being written`}:{kind:`frame`,src:`../../artboard/${t}/${encodeURI(s.file)}?v=${Math.round(l)}`,w:s.w,h:s.h,title:s.title||n,to:i}}function rE(e,t,n,r,i){let a=d.default.join(e,k.html);return i(a),u.default.existsSync(a)?{kind:`frame`,src:`../../html/${t}/${k.html}?v=${Math.round(Rb(e))}`,...ZT,title:HT(e,t).title,to:r}:{missing:`${n}: the page has no ${k.html} yet`}}function iE(e,t,n,r,i){let a=d.default.join(e,k.report);i(a);for(let t of u.default.existsSync(d.default.join(e,`data`))?u.default.readdirSync(d.default.join(e,UT)):[])i(d.default.join(e,UT,t));let o=``;try{o=u.default.readFileSync(a,`utf8`)}catch{o=``}return{kind:`flow`,src:`../../report/${t}/index.html?block=${encodeURIComponent(n)}&embed&v=${Math.round(Rb(e))}`,title:GT(o)||t,to:r}}function aE(e,t,n,r,i){return i(d.default.join(e,pE)),{kind:`frame`,src:`../../slides/${t}/index.html?embed=${encodeURIComponent(n)}&v=${Math.round(Rb(e))}`,...ZT,title:DT(e)?.title||t,to:r}}function oE(e,t,n,r){if(!Kv(n))return;let i=d.default.join(e,t,n);if(t===`html`&&r(d.default.join(i,k.html)),t===`artboard`&&r(d.default.join(i,k.artboard)),t===`report`&&r(d.default.join(i,k.report)),t===`slides`&&r(d.default.join(i,pE)),t===`whiteboard`){r(d.default.join(i,Xv)),r(d.default.join(i,Zv));for(let e of[Yv,...NT(i)])r(d.default.join(i,ey(e)))}}function sE(e,t){let n=JT(e);return r=>{let i=zv(r),a=Bv(r),o=BT(r,n,`embed`);if(o)return oE(e,i,a,t),{missing:o};let s=Nb(e,i,a),c=n.idOf(a,i),l=r.board??r.frame,u=`<embed ${i}="${a}"${l?` ${r.board?`board`:`frame`}="${l}"`:``}>`;if(!s||!c)return{missing:`${u} cannot be read`};if(i===`report`&&r.block)return iE(s,a,r.block,c,t);if(i===`slides`&&r.slide)return aE(s,a,r.slide,c,t);if(i===`html`)return rE(s,a,u,c,t);if(i===`artboard`&&r.board)return nE(s,a,r.board,u,c,t);let d=i===`whiteboard`?n.framesOf(a):null;return d&&(r.frame||r.page)?eE(s,a,r,d,u,c,t):{missing:`${u} cannot be read`}}}const cE=/^(?:id_(?:rsa|dsa|ecdsa|ed25519)\b.*|(?:secrets?|credentials?)(?:\..*)?|.*\.(?:pem|key|p12|pfx|jks|keystore|tfstate|tfvars)(?:\..*)?)$/i,lE=(e,t)=>e.toLowerCase().startsWith(`${t.toLowerCase()}${d.default.sep}`);function uE(e,t){let n={error:`${t} is outside what a deck may read`};if(d.default.isAbsolute(t))return n;let r=nC(e,t);if(!r)return n;let i;try{if(i=u.default.realpathSync(r),!lE(i,u.default.realpathSync(e)))return n;let a=u.default.statSync(i);if(!a.isFile())return{error:`${t} is not a file`};if(a.size>524288)return{error:`${t} is too large to put on a slide`}}catch{return{error:`${t} was not found`}}return i}function dE(e,t){try{return(0,p.execFileSync)(`git`,[`check-ignore`,`-q`,`--`,t],{cwd:e,stdio:`ignore`,timeout:2e3}),!0}catch{return!1}}function fE(e,t){let n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Map;return{deps:()=>[...n],embed:sE(d.default.resolve(e,`../..`),e=>n.add(e)),ref:XT(d.default.resolve(e,`../..`)),checkChart:t=>tC.chart(t,e)??null,readFile(i,a){let o=uE(i===`project`?t:e,a);if(typeof o!=`string`)return o;if(cE.test(d.default.basename(o))||cE.test(d.default.basename(a)))return{error:`${a} is named like a secret, and a deck does not show those`};if(i===`project`&&(r.has(o)||r.set(o,dE(t,o)),r.get(o)))return{error:`git ignores ${a}, and a deck does not show ignored files`};if(i===`artifact`&&d.default.basename(o).toLowerCase()===`comments.json`)return{error:`${a} is not part of the deck`};try{let e=u.default.readFileSync(o,`utf8`);return n.add(o),e}catch{return{error:`${a} could not be read`}}}}}const pE=`deck.xml`,mE=`index.html`,hE=e=>d.default.resolve(e,`../../../..`);function gE(e){try{return u.default.readFileSync(e,`utf8`)}catch{return null}}function _E(e,t=hE(e),n={}){let r=gE(d.default.join(e,pE));if(r===null){let t=gE(d.default.join(e,mE));return t===null?null:{html:t,source:`html`,issues:[],warnings:[],deps:[],embeds:[],refs:[],both:!1,complete:null,origins:/* @__PURE__ */ new Map,title:null,groups:[],cover:null}}let i=fE(e,t),a;try{a=$S(r,i,n)}catch(e){a={html:``,title:null,deps:[],embeds:[],refs:[],warnings:[],origins:/* @__PURE__ */ new Map,groups:[],cover:null,issues:[{code:`xml`,slide:-1,detail:`the deck could not be read: ${e instanceof Error?e.message:String(e)}`}]}}return{html:a.html,source:`xml`,issues:a.issues,warnings:a.warnings,deps:i.deps(),embeds:a.embeds,refs:a.refs,both:u.default.existsSync(d.default.join(e,mE)),complete:/<\/deck\s*>\s*$/.test(r),origins:a.origins,title:a.title,groups:a.groups,cover:a.cover}}function vE(e,t){let n=d.default.resolve(e,t);return n.startsWith(`${e}${d.default.sep}`)&&u.default.existsSync(n)}function yE(e){try{return u.default.statSync(e).mtimeMs}catch{return 0}}function bE(e,t,n=hE(e)){let r=_E(e,n),i=Math.max(Rb(e,`comments.json`),...(r?.deps??[]).map(yE));if(!r)return{title:t,version:i,complete:!1,outline:[],issues:[],warnings:[`${pE} not found`]};let a=Mb(r.html),o=r.source===`xml`,s=new Set(r.embeds.flatMap(({frame:e})=>e?[e]:[]));return{title:r.title||a.title||t,version:i,complete:r.complete??a.complete,outline:a.slides,issues:[...r.both?[{code:`two_entries`,slide:-1}]:[],...a.issues,...a.assets.filter(t=>!s.has(t)&&!vE(e,t)).map(e=>({code:`missing_asset`,slide:-1,detail:e}))],...o?{sourceIssues:r.issues,sourceWarnings:r.warnings}:{},...o?{groups:r.groups,origins:Object.fromEntries(r.origins),...r.cover?{cover:r.cover}:{}}:{},warnings:o||a.hasDeck?[]:[`index.html has no <div class="reveal"><div class="slides">`]}}function xE(e){try{return JSON.parse(u.default.readFileSync(e,`utf8`))}catch{return null}}function SE(e,t){let n=/* @__PURE__ */ new Map,r=xE(e);if(!Ct(r)||r.version!==t||!Array.isArray(r.slides))return n;for(let e of r.slides)Ct(e)&&typeof e.id==`string`&&typeof e.overflow==`boolean`&&n.set(e.id,e.overflow);return n}function CE(e){let t=/* @__PURE__ */ new Map,n=xE(e);if(!Ct(n)||!Array.isArray(n.threads))return t;for(let e of n.threads){if(!Ct(e)||e.status!==`open`||!Ct(e.anchor))continue;let{slide:n}=e.anchor;typeof n==`string`&&t.set(n,(t.get(n)??0)+1)}return t}function wE(e,t){let n=d.default.join(e,`slides`,t),r=bE(n,t),i=SE(d.default.join(e,`.state`,`slides`,t,`outline.json`),r.version),a=CE(d.default.join(n,`comments.json`));return r.outline.map((e,t)=>{let n=e.id===null?void 0:i.get(e.id);return{number:t+1,id:e.id??``,layout:e.layout,title:e.title,steps:e.steps,overflow:n===void 0?`unknown`:n?`yes`:`no`,comments:e.id!==null&&a.get(e.id)||0}})}const TE={authoring:fb,source:`deck.xml`,changes:!0,review:{sections:[]},localGet:{key:`slides`,read:(e,t)=>{let n=wE(e,t);return n?{rows:n}:{}},columns:[{key:`number`,required:!0,positional:!0},{key:`id`,required:!0,positional:!0},{key:`layout`,positional:!0},{key:`title`,positional:!0},{key:`steps`},{key:`overflow`},{key:`comments`}]},outlineView:{rows:e=>e.map(e=>({...e,overflow:e.overflow===!0?`yes`:e.overflow===!1?`no`:`unknown`})),columns:[{key:`id`,positional:!0,required:!0},{key:`layout`,positional:!0},{key:`title`,positional:!0},{key:`steps`},{key:`overflow`}]},commentActions:{add:e=>{if(!e.slide)throw new j(`comment add on a deck needs --slide <slideId>`);return{op:`add`,slide:e.slide,text:rt(e)}}}},EE=String.raw`import { spawn, spawnSync } from 'node:child_process';
|
|
688
688
|
import fs from 'node:fs';
|
|
689
689
|
import os from 'node:os';
|
|
690
690
|
import path from 'node:path';
|
|
@@ -985,7 +985,7 @@ await exec([
|
|
|
985
985
|
]);
|
|
986
986
|
fs.rmSync(work, { recursive: true, force: true });
|
|
987
987
|
say(1, 'done');
|
|
988
|
-
`,
|
|
988
|
+
`,DE=`render/render.mjs`;function OE(e,t=!1){let n=d.default.join(e,DE);return!t&&u.default.existsSync(n)?!1:(u.default.mkdirSync(d.default.dirname(n),{recursive:!0}),u.default.writeFileSync(n,EE,{flag:t?`w`:`wx`}),!0)}const kE=`import { spawnSync } from 'node:child_process';
|
|
989
989
|
import { unlinkSync, writeFileSync } from 'node:fs';
|
|
990
990
|
|
|
991
991
|
const MODEL = 'google/gemini-3.8-flash-tts';
|
|
@@ -1028,7 +1028,7 @@ if (ffmpeg.status !== 0) {
|
|
|
1028
1028
|
process.exit(1);
|
|
1029
1029
|
}
|
|
1030
1030
|
console.log(JSON.stringify({ duration: pcm.length / 2 / RATE }));
|
|
1031
|
-
`,
|
|
1031
|
+
`,AE=[`import { spawnSync } from 'node:child_process';
|
|
1032
1032
|
import { unlinkSync, writeFileSync } from 'node:fs';
|
|
1033
1033
|
|
|
1034
1034
|
const MODEL = 'google/gemini-3.8-flash-tts';
|
|
@@ -1065,7 +1065,7 @@ if (ffmpeg.status !== 0) {
|
|
|
1065
1065
|
process.exit(1);
|
|
1066
1066
|
}
|
|
1067
1067
|
console.log(JSON.stringify({ duration: pcm.length / 2 / RATE }));
|
|
1068
|
-
`];function TE(e){let t=d.default.join(e,`voice/voice.mjs`);return u.default.existsSync(t)?(wE.includes(u.default.readFileSync(t,`utf8`))&&u.default.writeFileSync(t,CE),!1):(u.default.mkdirSync(d.default.dirname(t),{recursive:!0}),u.default.writeFileSync(t,CE,{flag:`wx`}),!0)}var EE='# 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\nThe page opens on a board before the editor: one column per shot, and in each column one frame per voice line, drawn at the middle of the line and kept clear of transitions; a shot without lines gets one frame. Reviewers read the story there and comment on single frames. When the picture changes a lot inside one shot, give that moment its own line so it gets its own frame.\n\nYour human partner edits the timeline and the server writes those edits into `storyboard.xml`; moving an overlay rewrites the times of `sb-cursor`, `sb-type` or `sb-clip` in the shot page. Nothing checks for these changes before you write. 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" hint="lyu as in the Chinese name Liu, never an English r; hard g"/>\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="…" hint="…"/>`: pronunciations. Before synthesis every whole-word `word` is replaced by `as`; captions keep the original words. A respelling alone is often read wrong, so a line holding the word also tells the speech model that `as` is how `word` is said, followed by `hint` (optional: how it sounds, in plain words). Give every made-up or borrowed name a `hint`.\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 and keeps up to date while it is unedited (OpenRouter text-to-speech; it reads `OPENROUTER_API_KEY` from the project\'s `.env` and needs ffmpeg). It reads `{text, voice, lang, out, direction?}` on stdin; `direction` carries the lexicon\'s pronunciations for that line. The hub runs it a second after `storyboard.xml` changes, only for lines whose words, voice or lexicon changed. Run `adeck 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 `adeck storyboard export --artifact storyboard/<id> [--wait]` to export from the command line; lines not yet voiced are voiced first. `adeck 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 `adeck 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';function DE(e){if(!e.shot&&!e.cut)throw new A(`comment add on a storyboard needs --shot <shotId>, or --cut <n> --at <seconds>`);if(e.line&&e.at!==void 0)throw new A(`comment add takes --line or --at, not both`);let t=at(e.at,`--at`);if(t!==void 0&&t<0)throw new A(`--at must be seconds from 0`);let n;if(e.cut!==void 0){if(n=Number(e.cut),!Number.isInteger(n)||n<1)throw new A(`--cut must be a cut number from 1`);if(t===void 0)throw new A(`a comment on a cut needs --at <seconds>`);if(e.line)throw new A(`comment add takes --line or --cut, not both`)}return{op:`add`,...e.shot?{shot:e.shot}:{},...e.line?{line:e.line}:{},...n===void 0?{}:{cut:n},...t===void 0?{}:{at:t},text:it(e)}}const OE={authoring:EE,changes:!0,review:{sections:[]},commentActions:{add:DE},onStart:e=>{TE(e),SE(e)}};var kE='# 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. A top-level ref is `<ref artboard="slug" group="v2"/>` or `<ref verify="slug"/>`; any other kind there counts toward nothing and Check notes it. 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); why and needs may hold inline marks and refs.\n\nReferences: inside a claim\'s p, li or td, the intro and a gap\'s why or needs, write the same inline `<ref>` a document does (`<ref document="spec" block="retry"/>`, `<ref whiteboard="flow" frame="f1"/>`, `<ref verify="login"/>`…) to link the discussion or artifact a claim rests on; it opens beside the report and counts toward nothing. Never inside <result>, and never standing alone in a claim. Missing targets are Check warnings. `<ref verify="slug"/>` at the top level makes another report a part of this one: it counts as one item that passes when that report is done, waits while it waits, and is rejected while it has a rejection; the status line gives each one a sentence with a link. Split a large piece of work into reports this way; reports that wait on each other in a loop are a Check warning. `<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 `check --artifact verify/<id>` before sharing.\n';function AE(e,t){if(t===`pass`||t===`reject`){let n=t===`pass`&&!!e.all;if(!n&&!e.claim)throw new A(t===`pass`?`comment pass on a report needs --claim <claimId>, or --all`:`comment reject on a report needs --claim <claimId>`);let r=t===`reject`?it(e):e.text?.trim();return{op:`verdict`,verdict:t,...n?{all:!0}:{claim:e.claim},...r?{text:r}:{}}}if(t===`waive`){if(!e.gap)throw new A(`comment waive needs --gap <gapId>`);return{op:`waive`,gap:e.gap}}if(t===`reply`){if(!e.thread)throw new A(`comment reply needs --thread <threadId>`);return{op:`reply`,threadId:e.thread,text:it(e)}}throw new A(`comment ${t} does not work on verify reports: use list, pass, reject, waive or reply`)}const jE={artboard:ct,document:ab,html:ob,whiteboard:{authoring:`# Whiteboard writing
|
|
1068
|
+
`];function jE(e){let t=d.default.join(e,`voice/voice.mjs`);return u.default.existsSync(t)?(AE.includes(u.default.readFileSync(t,`utf8`))&&u.default.writeFileSync(t,kE),!1):(u.default.mkdirSync(d.default.dirname(t),{recursive:!0}),u.default.writeFileSync(t,kE,{flag:`wx`}),!0)}var ME='# 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\nThe page opens on a board before the editor: one column per shot, and in each column one frame per voice line, drawn at the middle of the line and kept clear of transitions; a shot without lines gets one frame. Reviewers read the story there and comment on single frames. When the picture changes a lot inside one shot, give that moment its own line so it gets its own frame.\n\nYour human partner edits the timeline and the server writes those edits into `storyboard.xml`; moving an overlay rewrites the times of `sb-cursor`, `sb-type` or `sb-clip` in the shot page. Nothing checks for these changes before you write. 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" hint="lyu as in the Chinese name Liu, never an English r; hard g"/>\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="…" hint="…"/>`: pronunciations. Before synthesis every whole-word `word` is replaced by `as`; captions keep the original words. A respelling alone is often read wrong, so a line holding the word also tells the speech model that `as` is how `word` is said, followed by `hint` (optional: how it sounds, in plain words). Give every made-up or borrowed name a `hint`.\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 and keeps up to date while it is unedited (OpenRouter text-to-speech; it reads `OPENROUTER_API_KEY` from the project\'s `.env` and needs ffmpeg). It reads `{text, voice, lang, out, direction?}` on stdin; `direction` carries the lexicon\'s pronunciations for that line. The hub runs it a second after `storyboard.xml` changes, only for lines whose words, voice or lexicon changed. Run `adeck 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 `adeck storyboard export --artifact storyboard/<id> [--wait]` to export from the command line; lines not yet voiced are voiced first. `adeck 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 `adeck 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';function NE(e){if(!e.shot&&!e.cut)throw new j(`comment add on a storyboard needs --shot <shotId>, or --cut <n> --at <seconds>`);if(e.line&&e.at!==void 0)throw new j(`comment add takes --line or --at, not both`);let t=it(e.at,`--at`);if(t!==void 0&&t<0)throw new j(`--at must be seconds from 0`);let n;if(e.cut!==void 0){if(n=Number(e.cut),!Number.isInteger(n)||n<1)throw new j(`--cut must be a cut number from 1`);if(t===void 0)throw new j(`a comment on a cut needs --at <seconds>`);if(e.line)throw new j(`comment add takes --line or --cut, not both`)}return{op:`add`,...e.shot?{shot:e.shot}:{},...e.line?{line:e.line}:{},...n===void 0?{}:{cut:n},...t===void 0?{}:{at:t},text:rt(e)}}const PE={authoring:ME,changes:!0,review:{sections:[]},commentActions:{add:NE},onStart:e=>{jE(e),OE(e)}};var FE='# 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. A top-level ref is `<ref artboard="slug" group="v2"/>` or `<ref verify="slug"/>`; any other kind there counts toward nothing and Check notes it. 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); why and needs may hold inline marks and refs.\n\nReferences: inside a claim\'s p, li or td, the intro and a gap\'s why or needs, write the same inline `<ref>` a document does (`<ref document="spec" block="retry"/>`, `<ref whiteboard="flow" frame="f1"/>`, `<ref verify="login"/>`…) to link the discussion or artifact a claim rests on; it opens beside the report and counts toward nothing. Never inside <result>, and never standing alone in a claim. Missing targets are Check warnings. `<ref verify="slug"/>` at the top level makes another report a part of this one: it counts as one item that passes when that report is done, waits while it waits, and is rejected while it has a rejection; the status line gives each one a sentence with a link. Split a large piece of work into reports this way; reports that wait on each other in a loop are a Check warning. `<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 `check --artifact verify/<id>` before sharing.\n';function IE(e,t){if(t===`pass`||t===`reject`){let n=t===`pass`&&!!e.all;if(!n&&!e.claim)throw new j(t===`pass`?`comment pass on a report needs --claim <claimId>, or --all`:`comment reject on a report needs --claim <claimId>`);let r=t===`reject`?rt(e):e.text?.trim();return{op:`verdict`,verdict:t,...n?{all:!0}:{claim:e.claim},...r?{text:r}:{}}}if(t===`waive`){if(!e.gap)throw new j(`comment waive needs --gap <gapId>`);return{op:`waive`,gap:e.gap}}if(t===`reply`){if(!e.thread)throw new j(`comment reply needs --thread <threadId>`);return{op:`reply`,threadId:e.thread,text:rt(e)}}throw new j(`comment ${t} does not work on verify reports: use list, pass, reject, waive or reply`)}const LE={artboard:st,document:ab,html:ob,whiteboard:{authoring:`# Whiteboard writing
|
|
1069
1069
|
|
|
1070
1070
|
Write \`scene.excalidraw\` (main page); optional \`pages.json\` and \`pages/<id>.excalidraw\`. The browser and agent collaborate live. Preserve IDs and all customData (\`ryugiAuthor\`, \`ryugiRev\`, \`ryugiLastBy\`). Never manufacture revision fields or force over a conflict; the server merges by \`ryugiRev\` and keeps the human version of a conflicting element. Missing elements are not deletion; retain the element and set \`isDeleted:true\`. Bound labels are separate text elements: edit text and originalText.
|
|
1071
1071
|
|
|
@@ -1129,24 +1129,24 @@ Elements: rectangle, ellipse, diamond, line, arrow, text, freedraw, image, frame
|
|
|
1129
1129
|
For pages write \`{"pages":[{"id":"main","name":"Overview"},{"id":"p-detail","name":"Detail"}]}\`. main is first and undeletable; extra IDs lowercase letters/digits/hyphens, filenames pages/<id>.excalidraw. Missing page file means empty. Names/order live in pages.json; appState.name remains board title. Preserve human pages. Delete with deleted:true, retain file; deleted pages are excluded from check/render/publish and their comments become orphans. Arrows cannot cross pages. Move by copying the full element including customData to the new page and tombstoning it on the old one; comments/refs follow.
|
|
1130
1130
|
|
|
1131
1131
|
Run Check after edits; skeleton_not_completed/browser_not_run needs the board open in a browser. Check covers every page; --page narrows it. Fix duplicate IDs, conflicts, missing arrow targets, overflow/overlap and clipping. \`scene --artifact whiteboard/<id>\` returns page/frame structure and render paths; inspect a current render as well as validation. Never edit comments.json or \`.state/\`; the state directory contains render.png, geometry, selection, backlinks and warnings maintained by the server.
|
|
1132
|
-
`,review:{sections:[]},commentActions:{add:e=>{let t=
|
|
1132
|
+
`,review:{sections:[]},commentActions:{add:e=>{let t=it(e.x,`--x`),n=it(e.y,`--y`);if(e.element)return{op:`add`,element:e.element,text:rt(e)};if(t===void 0||n===void 0)throw new j(`comment add on a whiteboard needs --element <id>, or --x and --y`);return{op:`add`,x:t,y:n,...e.page?{page:e.page}:{},text:rt(e)}}}},verify:{authoring:FE,locate:kT,commentRequest:IE},slides:TE,report:db,storyboard:PE},RE={authoring:sb,pointer:cb},zE=e=>fe.filter(t=>e(LE[t])),BE=zE(e=>e.review),VE=zE(e=>e.changes),HE=zE(e=>e.review||e.commentRequest),UE=e=>RegExp(`^(?:${e.join(`|`)})/[a-z0-9][a-z0-9-]*$`);function WE(e){let t=e.map(e=>`${e}/<id>`);return t.length>1?`${t.slice(0,-1).join(`, `)} or ${t.at(-1)}`:t[0]}const GE=e=>e.length>1?`<${e.join(`|`)}>/<id>`:`${e[0]}/<id>`;function KE(e,t={}){if(!$e.test(e))throw new j(et);let n=LE[e.split(`/`)[0]],r=n.authoring.trim();return t.mockup?`${r}\n\n${RE.authoring.trim()}`:n.phoneScreens?`${r}\n\n${RE.pointer.replace(`<artifact>`,e).trim()}`:r}function qE(){return RE.authoring.trim()}function JE(e,t){if(!$e.test(t))throw new j(et);let n=t.split(`/`)[0],r=LE[n],i=d.default.join(De(e),t);r.locate?.(i);let a=d.default.join(i,r.source??k[n]);if(u.default.existsSync(a))return{write:a,content:`existing`};let o=d.default.join(i,k[n]);return r.source&&u.default.existsSync(o)?{write:o,content:`existing`}:{write:a,content:`missing`}}const YE=[`https://ryugi.innei.dev`];function XE(e){let t=e.replace(/\/+$/,``);return YE.includes(t)?`https://artideck.dev`:t}const ZE=e=>XE(e.RYUGI_CLOUD_ORIGIN||`https://artideck.dev`);function QE(e=process.env){return e.RYUGI_TOKEN?.trim()||null}function $E(e,t,n=process.env,r){let i=r?.trim()||QE(n);if(i)return{origin:t,token:i,login:null,source:`env`};let a=tD(e,t);return a?{...a,source:`store`}:null}function eD(e,t,n){return t===`win32`&&e.APPDATA?d.default.join(e.APPDATA,`ryugi`,`credentials.json`):d.default.join(e.XDG_CONFIG_HOME||d.default.join(n,`.config`),`ryugi`,`credentials.json`)}function tD(e,t){let n;try{n=JSON.parse(u.default.readFileSync(e,`utf8`))}catch{return null}if(typeof n!=`object`||!n)return null;let{origin:r,token:i,login:a}=n;return typeof r!=`string`||typeof i!=`string`||typeof a!=`string`||XE(r)!==XE(t)?null:{origin:t,token:i,login:a}}function nD(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.phase!=`string`||![`waiting`,`preparing`,`uploading`,`publishing`,`not-ready`,`failed`,`published`].includes(t.phase)||t.publishedAt!==null&&(typeof t.publishedAt!=`string`||!Number.isFinite(Date.parse(t.publishedAt)))||typeof t.autoPublish!=`boolean`||t.message!==void 0&&typeof t.message!=`string`||t.reasons!==void 0&&(!Array.isArray(t.reasons)||!t.reasons.every(e=>typeof e==`string`))?null:t}const rD=[`1d`,`7d`,`30d`,`never`],iD=e=>rD.includes(e),aD=e=>e===`private`||e===`public`,oD=()=>({version:1,artifacts:{}});function sD(e){try{let t=JSON.parse(u.default.readFileSync(e,`utf8`));if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Expected a config object`);return t}catch(e){if(e.code===`ENOENT`)return oD();throw e}}const cD=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`);function lD(e){if(typeof e!=`object`||!e)return!1;let{id:t,url:n,publishedAt:r,visibility:i}=e;return typeof t==`string`&&typeof n==`string`&&(typeof r==`string`||r===null)&&aD(i)}function uD({id:e,url:t,publishedAt:n,visibility:r,fingerprint:i,onProfile:a,keyed:o,modulesSynced:s,sourceHash:c,localSourceHash:l,identitySynced:u}){return{id:e,url:t,publishedAt:n,visibility:r,...typeof i==`string`?{fingerprint:i}:{},...typeof a==`boolean`?{onProfile:a}:{},...o===!0?{keyed:o}:{},...cD(s)?{modulesSynced:s}:{},...typeof c==`string`?{sourceHash:c}:{},...typeof l==`string`?{localSourceHash:l}:{},...u===!0?{identitySynced:u}:{}}}function dD(e){let t=oD();if(typeof e!=`object`||!e)return t;let n=e.output;n&&typeof n==`object`&&`format`in n&&[`brief`,`json`,`jsonl`].includes(String(n.format))&&(t.output={format:n.format});let{autoPublish:r,modulesSynced:i,space:a}=e;typeof r==`boolean`&&(t.autoPublish=r),typeof a==`string`&&a&&(t.space=a),typeof i==`string`&&(t.modulesSynced=i);let o=e.artifacts;if(typeof o!=`object`||!o)return t;for(let[e,n]of Object.entries(o)){if(typeof n!=`object`||!n)continue;let{visibility:r,cloud:i,autoPublish:a,modules:o,project:s}=n;if(r!==void 0&&!aD(r))continue;let c={};r&&(c.visibility=r),lD(i)&&(c.cloud=uD(i)),a===!1&&(c.autoPublish=!1),cD(o)&&(c.modules=o),typeof s==`string`&&s&&(c.project=s),t.artifacts[e]=c}return t}function fD(e){let t;try{t=u.default.readFileSync(e,`utf8`)}catch{return{config:oD()}}try{return{config:dD(JSON.parse(t))}}catch(e){return{config:oD(),warning:`config.json is not valid JSON: ${e.message}`}}}const pD=[`config.json`,`artifacts/*`,`!artifacts/document/`,`artifacts/document/*/.artifact-id`];function mD(e){let t=d.default.join(e,`.gitignore`),n=``;try{n=u.default.readFileSync(t,`utf8`)}catch{}let r=new Set(n.split(/\r?\n/).map(e=>e.trim())),i=pD.filter(e=>!r.has(e));i.length!==0&&u.default.writeFileSync(t,`${n}${n===``||n.endsWith(`
|
|
1133
1133
|
`)?``:`
|
|
1134
1134
|
`}${i.join(`
|
|
1135
|
-
`)}\n`)}function
|
|
1135
|
+
`)}\n`)}function hD(e){u.default.mkdirSync(d.default.dirname(e),{recursive:!0}),mD(d.default.dirname(e)),u.default.existsSync(e)||IC(e,oD())}function gD(e,t,n){let{config:r,warning:i}=fD(e);if(i)throw Error(i);let a={...r.artifacts[t]};if(n.visibility&&(a.visibility=n.visibility),n.cloud===null)delete a.cloud;else if(n.cloud){let e=a.cloud?.id===n.cloud.id?a.cloud:void 0;a.cloud={...e?.modulesSynced?{modulesSynced:e.modulesSynced}:{},...e?.identitySynced?{identitySynced:e.identitySynced}:{},...n.cloud}}n.autoPublish===null?delete a.autoPublish:n.autoPublish===!1&&(a.autoPublish=!1),n.modules===null?delete a.modules:n.modules&&(a.modules=n.modules),n.project===null?delete a.project:n.project&&(a.project=n.project);let o=sD(e);o.artifacts??={};let s={...o.artifacts[t]};if(n.visibility&&(s.visibility=a.visibility),n.cloud){let e={...s.cloud?.id===n.cloud.id?s.cloud:{}};for(let t of Object.keys(uD(e)))delete e[t];s.cloud={...e,...a.cloud}}return n.autoPublish===!1&&(s.autoPublish=!1),n.modules&&(s.modules=n.modules),n.project&&(s.project=n.project),n.project===null&&delete s.project,n.cloud===null&&delete s.cloud,n.autoPublish===null&&delete s.autoPublish,n.modules===null&&delete s.modules,o.artifacts[t]=s,IC(e,o),a}function _D(e,t){let n=sD(e);t===null?delete n.autoPublish:n.autoPublish=t,u.default.mkdirSync(d.default.dirname(e),{recursive:!0}),IC(e,n)}function vD(e,t){let n=sD(e);n.space=t,u.default.mkdirSync(d.default.dirname(e),{recursive:!0}),IC(e,n)}const yD=e=>d.default.join(d.default.dirname(e),`config.json`);function bD(e,t=!1){try{let n=JSON.parse(u.default.readFileSync(e,`utf8`));if(typeof n==`object`&&n&&!Array.isArray(n))return n;if(t)throw Error(`Expected a configuration object: ${e}`);return{}}catch(e){if(t&&e.code!==`ENOENT`)throw e;return{}}}function xD(e){let t=bD(e).autoPublish;return typeof t==`boolean`?t:void 0}function SD(e,t,n=()=>{}){let r=bD(e,!0);n(),u.default.mkdirSync(d.default.dirname(e),{recursive:!0,mode:448}),IC(e,{...r,autoPublish:t})}var K=class extends Error{error;kind;raw;constructor(e,t=`failed`,n){super(e.message),this.error=e,this.kind=t,this.raw=n}};function CD(e){if(e instanceof K)return e.error;let t=e,n=t?.fields;return{code:typeof n?.code==`string`?`E_${n.code.toUpperCase().replace(/^E_/,``)}`:`E_COMMAND_FAILED`,message:typeof t?.message==`string`&&t.message?t.message:typeof n?.message==`string`?n.message:String(e),...typeof n?.status==`number`?{httpStatus:n.status}:{},...n&&Object.keys(n).length?{details:n}:{}}}function wD(e,t=!1){switch(e.kind){case`succeeded`:return{outcome:t?`attention`:`success`,code:0};case`validation_failed`:return{outcome:`attention`,code:3};case`pending`:return{outcome:`pending`,code:4};case`action_required`:return{outcome:`attention`,code:2};case`partial`:return{outcome:`partial`,code:5};case`failed`:return{outcome:`error`,code:1};case`interrupted`:return{outcome:`error`,code:e.signal===`SIGINT`?130:143}}}function TD(e,t,n,r){return!e||typeof e!=`object`||Array.isArray(e)?e:Object.fromEntries(Object.entries(e).filter(([e])=>t.includes(e)?!0:(r.push({path:`${n}.${e}`,reason:`fields`}),!1)))}function ED(e,t,n,r){let i=[...t.coverage.omitted??[]],a=t.data;if(n.fields){let e=[.../* @__PURE__ */ new Set([...n.fields,...r.requiredFields??[]])];if(r.collection&&a&&typeof a==`object`){let t=a,n=t[r.collection];a={...t,[r.collection]:Array.isArray(n)?n.map((t,n)=>TD(t,e,`data.${r.collection}.${n}`,i)):n}}else a=TD(a,e,`data`,i)}return{schema:`ryugi.cli/v1`,command:e,outcome:wD(t.completion,t.warnings.length>0).outcome,data:a,...t.coverage.page?{page:t.coverage.page}:{},...i.length?{omitted:i}:{},...t.effects.length?{effects:t.effects}:{},...t.warnings.length?{warnings:t.warnings}:{},...t.actions.length?{next:t.actions}:{},...t.completion.kind===`failed`?{error:t.completion.error}:t.completion.kind===`interrupted`?{error:{code:`E_INTERRUPTED`,message:`Command interrupted by ${t.completion.signal}.`,details:{signal:t.completion.signal}}}:{}}}const DD={format:{type:`string`,value:`<brief|table|json|jsonl|raw>`,help:`Output format (default: brief)`},json:{type:`boolean`,help:`Shorthand for --format json`},detail:{type:`boolean`,help:`Read complete evidence for the selected object or page`},fields:{type:`string`,value:`<fields>`,help:`Select public output fields, separated by commas`},quiet:{type:`boolean`,help:`Print the command's declared scalar only`},verbose:{type:`boolean`,help:`Include diagnostic details on stderr`}};function OD(e,t){let n={};for(let r=0;r<e.length;r++){let i=e[r];if(i===`--`)break;if(!i.startsWith(`--`))continue;let a=i.indexOf(`=`),o=i.slice(2,a<0?void 0:a),s=o===`source`?`boolean`:t[o]?.type;s===`string`?n[o]=a<0?e[++r]??``:i.slice(a+1):s===`boolean`&&(n[o]=!0)}return n}function kD(e,t,n=process.env){let r=OD(e,t),i=[`format`,`json`,`quiet`,`source`].filter(e=>r[e]!==void 0),a=n.RYUGI_ARTIFACTS_FORMAT??`brief`,o=r.format??(r.json?`json`:r.quiet?`quiet`:r.source?`source`:a),s=[`brief`,`table`,`json`,`jsonl`,`raw`,`source`,`quiet`].includes(o),c={format:s?o:`brief`,detail:!!r.detail||!!r.source,verbose:!!r.verbose},l;return i.length>1?l=new K({code:`E_OPTION_CONFLICT`,message:`Choose one of --format, --json, --quiet or --source.`}):s&&(i.length||[`brief`,`json`,`jsonl`].includes(a))||(l=new K({code:`E_FORMAT_UNSUPPORTED`,message:`Unknown output format: ${String(o)}`})),typeof r.fields==`string`&&(c.fields=r.fields.split(`,`).map(e=>e.trim()),c.fields.some(e=>!e)&&(l=new K({code:`E_ARGUMENT_INVALID`,message:`--fields requires comma-separated field names.`}))),{options:c,...l?{error:l}:{}}}const AD=[`brief`,`json`,`jsonl`];function jD(e){return{global:yD(eD(process.env,process.platform,m.default.homedir())),project:d.default.join(d.default.dirname(Je(e).root),`config.json`)}}function MD(e){try{let t=JSON.parse(u.default.readFileSync(e,`utf8`));if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Expected an object`);return t}catch(t){if(t.code===`ENOENT`)return{};throw new K({code:`E_CONFIG_INVALID`,message:`Cannot read ${e}: ${t.message}`})}}function ND(e){let t=jD(e),n=e=>{let t=MD(e).output;if(t?.format!==void 0&&!AD.includes(t.format))throw new K({code:`E_FORMAT_UNSUPPORTED`,message:`Unsupported output format in ${e}: ${String(t.format)}`});return t&&AD.includes(t.format)?t.format:null},r=n(t.global),i=n(t.project);return{global:r,project:i,effective:i??r??`brief`,source:i?`project`:r?`global`:`default`}}function PD(e,t,n,r=()=>{}){if(n===`inherit`&&!t||n!==`inherit`&&!AD.includes(n))throw new K({code:`E_ARGUMENT_INVALID`,message:`--output-format takes brief, json, jsonl, or inherit with --project.`});let i=jD(e),a=t?i.project:i.global,o=MD(a);if(o.output!==void 0&&(!o.output||typeof o.output!=`object`||Array.isArray(o.output)))throw new K({code:`E_CONFIG_INVALID`,message:`Expected an output configuration object in ${a}.`});let s={...o.output};n===`inherit`?delete s.format:s.format=n,Object.keys(s).length?o.output=s:delete o.output,r(),t?hD(a):u.default.mkdirSync(d.default.dirname(a),{recursive:!0,mode:448}),IC(a,o)}function FD(e,t,n=process.env){if(n.RYUGI_ARTIFACTS_FORMAT!==void 0)return n;let r=OD(e,t);if([`format`,`json`,`quiet`,`source`].some(e=>r[e]!==void 0))return n;let i=typeof r[`project-dir`]==`string`?r[`project-dir`]:process.cwd();if(!r[`project-dir`]&&e[0]&&!e[0].startsWith(`-`))try{u.default.statSync(e[0]).isDirectory()&&(i=e[0])}catch{}let a=ND(i);return{...n,RYUGI_ARTIFACTS_FORMAT:a.effective}}const ID=`adeck`,LD={...DD,"project-dir":{type:`string`,value:`<path>`,help:`Project directory (default: current directory)`}},RD={help:{type:`boolean`,short:`h`,help:`Show this help`}};function zD(e,t,n=0){let r={...LD,...t},i=Object.fromEntries(Object.entries({...LD,...t}).map(([e,{type:t,short:n}])=>[e,n?{type:t,short:n}:{type:t}]));try{let t=[];for(let n=0;n<e.length;n++){let i=e[n];if(i===`--`){t.push(...e.slice(n));break}let a=e[n+1],o=a===`-h`||Object.values(r).some(e=>e.short&&a===`-${e.short}`);i.startsWith(`--`)&&r[i.slice(2)]?.type===`string`&&a?.startsWith(`-`)&&!a.startsWith(`--`)&&!o?(t.push(`${i}=${a}`),n++):t.push(i)}let a=(0,h.parseArgs)({args:t,options:i,allowPositionals:n>0,strict:!0});if(a.positionals.length>n)throw new j(`Unknown argument: ${a.positionals[n]}`);return{values:a.values,positionals:a.positionals,projectDir:a.values[`project-dir`]??process.cwd()}}catch(e){if(e instanceof j)throw e;if(e.code===`ERR_PARSE_ARGS_UNKNOWN_OPTION`){let t=/'([^']+)'/.exec(e.message)?.[1];if(t)throw new j(`Unknown argument: ${t}`)}throw new j(e.message)}}function BD(e){let t=e.indexOf(`--`);return(t===-1?e:e.slice(0,t)).some(e=>e===`--help`||e===`-h`)}function VD(e){let t=Math.max(...e.map(([e])=>e.length))+2;return e.map(([e,n])=>` ${e.padEnd(t)}${n.replaceAll(`
|
|
1136
1136
|
`,`\n ${` `.repeat(t)}`)}`.trimEnd()).join(`
|
|
1137
|
-
`)}function
|
|
1138
|
-
`),``,e.summary,...e.details?[``,e.details]:[],``,`Options:`,
|
|
1139
|
-
`)}function
|
|
1140
|
-
`),``,n,``,`Options:`,
|
|
1141
|
-
`)}function
|
|
1142
|
-
`)}const
|
|
1143
|
-
`).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?`${
|
|
1137
|
+
`)}function HD(e){return Object.entries(e).filter(([,e])=>e.help!==void 0).map(([e,t])=>[`${t.short?`-${t.short}, `:``}--${e}${t.value?` ${t.value}`:``}`,t.help])}function UD(e,t){if(!t)return e.options;let n=e.usage?.filter(e=>e.split(/\s/)[0]===t)??[];if(!n.length)throw new j(`Unknown ${e.name} action: ${t}`);let r=/* @__PURE__ */ new Set([...n.flatMap(e=>[...e.matchAll(/--([\w-]+)/g)].map(e=>e[1])),...e.actionOptions?.[t]??[]]);return Object.fromEntries(Object.entries(e.options).filter(([e])=>r.has(e)))}function WD(e,t){let n=UD(e,t),r=t?e.actionDetails?.[t]:void 0;return r?GD(e,t,r,n):[(e.usage??[`[options]`]).filter(e=>!t||e.split(/\s/)[0]===t).map((t,n)=>`${n?` `:`Usage: `}${ID} ${e.name} ${t}`).join(`
|
|
1138
|
+
`),``,e.summary,...e.details?[``,e.details]:[],``,`Options:`,VD(HD({...n,...LD,...RD}))].join(`
|
|
1139
|
+
`)}function GD(e,t,n,r){let i=(e.usage??[]).filter(e=>e.split(/\s/)[0]===t).map((t,n)=>`${n?` `:`Usage: `}${ID} ${e.name} ${t}`),{"project-dir":a,...o}=LD;return[i.join(`
|
|
1140
|
+
`),``,n,``,`Options:`,VD(HD({...r,"project-dir":a,...RD})),``,`Output: ${Object.entries(o).map(([e,t])=>`--${e}${t.value?` ${t.value}`:``}`).join(`, `)}`].join(`
|
|
1141
|
+
`)}function KD(e,t={}){return[`Usage: ${ID} [project-directory] [--no-open]`,` ${ID} <command> [options]`,``,`Without a command, opens the project's artifacts in your browser and keeps the server`,`running until Ctrl+C.`,``,`Commands:`,VD(e.filter(e=>!e.hidden).map(e=>[e.name,e.summary])),``,`Tasks:`,` Write or edit: start --background --no-open --artifact <type>/<id>, edit the returned file, then check.`,` Find or read: get --project-dir <path> (local); get <link-or-id> (cloud); scene for a whiteboard.`,` Apply feedback: comment list --artifact <type>/<id> --sections all --detail; changes for document edits.`,` Organize and share: modules, config, publish. Prepare the environment: install, update, start, stop.`,` Automation: start is finite by default; use --foreground for a live process. JSON uses ryugi.cli/v1.`,``,`Run \`${ID} <command> --help\` for a command's options.`,``,`Options:`,VD(HD({...LD,...t,version:{type:`boolean`,short:`v`,help:`Print the version`},...RD}))].join(`
|
|
1142
|
+
`)}const qD=e=>[...e.matchAll(/"([^"]*)"|'([^']*)'|(\S+)/g)].map(e=>e[1]??e[2]??e[3]);function JD(){let e=process.env.RYUGI_ARTIFACTS_COMMAND?.trim();return e?qD(e):[process.execPath,process.argv[1]]}function YD(e){if(process.env.RYUGI_ARTIFACTS_FORMAT)return process.env.RYUGI_ARTIFACTS_FORMAT;let t=e.indexOf(`--project-dir`);try{return ND(t>=0&&e[t+1]?e[t+1]:process.cwd()).effective}catch{return`brief`}}function q(e,t=`Details`){let n=e.indexOf(`--`),r=n<0?e:e.slice(0,n),i=n<0?[]:e.slice(n),a={...LD,...OB.find(t=>t.name===e[0])?.options},o=[],s=!1;for(let e=0;e<r.length;e++){let t=r[e];if([`--format`,`--source`,`--quiet`].includes(t.split(`=`)[0])&&(s=!0),t.startsWith(`--`)&&!t.includes(`=`)&&a[t.slice(2)]?.type===`string`&&r[e+1]!==void 0){let n=r[++e];o.push(n.startsWith(`-`)?`${t}=${n}`:t,...n.startsWith(`-`)?[]:[n])}else o.push(t)}let c=s||YD(r)===`brief`?[]:[`--format`,`brief`];return{kind:`command`,argv:[...JD(),...o,...c,...i],label:t}}function XD(e=process.env,t=m.default.homedir()){let n=e.RYUGI_SERVER_HOME||d.default.join(we(t),`server`);return{home:n,events:d.default.join(n,`hub-events.log`),pid:d.default.join(n,`server.pid`),serverId:d.default.join(n,`server-instance-id`),info:d.default.join(n,`server-info`),log:d.default.join(n,`server.log`),version:d.default.join(n,`server-version`),lock:d.default.join(n,`start.lock`),key:d.default.join(n,`key`),projects:d.default.join(n,`projects.json`),settings:d.default.join(n,`settings.json`),stopped:d.default.join(n,`server-stopped`)}}function ZD(e){u.default.mkdirSync(e,{recursive:!0,mode:448}),u.default.chmodSync(e,448)}const QD=e=>{let t=e;return!!t&&typeof t.dir==`string`&&d.default.isAbsolute(t.dir)&&Number.isFinite(t.registeredAt)&&Number.isFinite(t.lastUsedAt)};function $D(e){try{let t=JSON.parse(u.default.readFileSync(e,`utf8`));return Array.isArray(t.projects)?t.projects.filter(QD):[]}catch{return[]}}const eO=e=>`No artifacts server is running for this project. Start it with \`${Qe()} start --project-dir ${e}\`, then run this again.`,tO=e=>{try{let{url:t}=JSON.parse(He(e)??``);return typeof t==`string`?t:null}catch{return null}};function nO(e,t){let n=XD(),r=tO(n.info);return r?$D(n.projects).some(t=>t.dir===e)?r:null:tO(t)}function rO(e){let t=Je(e),n=nO(t.project,t.info);if(!n)throw new K({code:`E_SERVER_NOT_RUNNING`,message:eO(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=QE(process.env);s=await fetch(c,{method:e,signal:o,headers:{"X-Ryugi-Client":`cli`,"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:eO(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 iO(){let e=XD(),t=tO(e.info),n={scope:`machine`,version:He(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`}}}function J(e,t={kind:`succeeded`},n={}){return{data:e,completion:t,coverage:{},effects:[],warnings:[],actions:[],...n}}var aO=class{entries=[];begin(e,t){return this.entries.push({operation:e,target:t,state:`unknown`}),this.entries.length-1}confirm(e,t){this.set(e,`confirmed`,t)}set(e,t,n){let r=this.entries[e];if(!r)throw Error(`Unknown effect`);this.entries[e]={...r,state:t,...n===void 0?{}:{details:n}}}snapshot(){return this.entries.map(e=>({...e}))}};const oO=/^\d{4}-\d\d-\d\dT\d\d:\d\d(?::\d\d(?:\.\d+)?)?(?:Z|[+-]\d\d:?\d\d)$/,sO=e=>String(e).padStart(2,`0`),cO=e=>typeof e==`string`&&oO.test(e)&&!Number.isNaN(Date.parse(e));function lO(e,t=/* @__PURE__ */ new Date){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;let r=`${sO(n.getHours())}:${sO(n.getMinutes())}`;return n.getFullYear()===t.getFullYear()?n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?r:`${sO(n.getMonth()+1)}-${sO(n.getDate())} ${r}`:`${n.getFullYear()}-${sO(n.getMonth()+1)}-${sO(n.getDate())}`}function uO(e,t){let n=e.details;return!n||typeof n!=`object`||Array.isArray(n)?[]:Object.entries(n).flatMap(([e,n])=>typeof n==`string`&&/^https?:\/\/\S+$/i.test(n)?[{kind:`url`,label:t?`${t} ${e}`:e,url:n}]:[])}const Y=(e,t)=>({key:t,value:e[t]}),X=(e,t,n=!1)=>({label:e,binding:t,required:n}),dO=e=>e.replaceAll(/\p{Cc}/gu,` `);function fO(e,t=!1){if(e==null)return``;if(Array.isArray(e))return e.map(e=>fO(e,!0)).join(`, `);if(typeof e==`object`){let n=Object.entries(e).filter(([,e])=>!mO(e)).map(([e,t])=>`${e} ${fO(t,!0)}`).join(t?`, `:` · `);return t?`(${n})`:n}return cO(e)?lO(e):String(e)}const pO=(e,t,n)=>{if(typeof e==`object`&&e){if(!n)throw Error(`Brief cannot print the object at ${t}; flatten it in the view.`);return fO(e)}return fO(e)},mO=(e,t)=>e==null||e===``||e===!1||t!==void 0&&e===t,hO={1:`FAILED`,2:`NEEDS YOU`,3:`ISSUES`,4:`INCOMPLETE`,5:`PARTIAL`,130:`INTERRUPTED`,143:`INTERRUPTED`},gO=(e,t)=>t?hO[t]??`FAILED`:dO(e).replaceAll(`_`,` `).toUpperCase(),_O=e=>{let t=e.replaceAll(/[._]/g,` `).trim();return t?t[0].toUpperCase()+t.slice(1):`Command`};function vO(e){let t=e.offset??0;if(!e.hasMore&&t===0)return null;let n=e.total===null?``:` of ${e.total}`,r=e.hasMore&&e.nextCursor?` · cursor ${e.nextCursor}`:``;return e.offset===void 0?`${e.returned}${n} shown${e.total===null&&e.hasMore?` · more available`:``}${r}`:`${e.returned?`${t+1}–${t+e.returned}`:`none`}${n}${r}`}const yO=e=>/^[\w./:@=+-]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`;function bO(e){return e.kind===`command`?e.argv.map(yO).join(` `):e.url}const xO=e=>e.map(e=>`Effect: ${dO(e.operation)} ${dO(e.target)} · ${e.state}`),SO=e=>e.split(`.`).filter(Boolean).at(-1)??e;function CO(e,t,n,r,i=[],a=0){let o=[gO(e.status,a),e.subject&&dO(e.subject),e.summary&&dO(e.summary)].filter(Boolean),s=[o.length?`${dO(e.heading)}: ${o.join(` · `)}`:dO(e.heading)],c=[...t.omitted??[]],l=(e,t=!1)=>t||i.includes(e)||!n.fields||n.fields.includes(e),u=(e,t,n=!1)=>dO(pO(e,t,n)),d=(e,t,n,r,i,a,o=!1)=>{if(mO(n,a))return null;let s=dO(e??t);if(n===!0)return s;let c=u(n,r,o);return i?c:`${s} ${c}`},f=(e,t=!1)=>{for(let n of e){if(!r&&!l(n.binding.key,n.required)||mO(n.binding.value))continue;let e=n.binding.value===!0?`yes`:u(n.binding.value,`data.${n.binding.key}`,t);s.push(`${dO(n.label)}: ${e}`)}},p=(e,t)=>e.map(e=>d(e.label,e.binding.key,e.binding.value,`${t}.${e.binding.key}`,e.positional)).filter(e=>e!==null).join(` · `),m=(e,t)=>{e&&s.push(t?`${dO(e)} · ${dO(t)}`:dO(e))},h=e=>{let t=e&&vO(e);t&&s.push(t)};f(e.facts);let g=t.error?uO(t.error):[];if(t.error){s.push(`${dO(t.error.code)}: ${dO(t.error.message)}`),t.error.httpStatus!==void 0&&t.error.httpStatus>=500&&s.push(`HTTP: ${t.error.httpStatus}`);let e=t.error.details;if(e&&typeof e==`object`&&!Array.isArray(e))for(let[t,n]of Object.entries(e))g.some(e=>e.label===t)||f([{label:t,binding:{key:t,value:n},required:!0}],!0);else e!==void 0&&f([{label:`Details`,binding:{key:`details`,value:e},required:!0}],!0)}if(!r&&n.fields&&t.data&&typeof t.data==`object`){let r=/* @__PURE__ */ new Set([...e.facts.map(e=>e.binding.key),...e.sections.flatMap(e=>e.kind===`fields`?e.facts.map(e=>e.binding.key):[e.key])]),a=t.data;f([.../* @__PURE__ */ new Set([...n.fields,...i])].filter(e=>!r.has(e)&&Object.hasOwn(a,e)).map(e=>({label:e,binding:{key:e,value:a[e]}})),!0)}for(let t of e.sections){if(t.kind===`fields`){f(t.facts);continue}if(!r&&!l(t.key))continue;let e=`title`in t&&t.title?t.title:void 0;if(t.kind===`records`){m(e??(t.page?t.key:void 0),t.summary);let a=new Set(t.columns.map(e=>e.key)),o=t.key===r?[.../* @__PURE__ */ new Set([...n.fields??[],...n.fields?i:[]])].filter(e=>!a.has(e)).map(e=>({key:e,label:e})):[],c=new Set(o.map(e=>e.key)),f=[...t.columns,...o].filter(e=>t.key!==r||l(e.key,e.required));if(n.format===`table`){let e=f.map(e=>e.label??e.key),n=t.rows.map((e,n)=>f.map(r=>mO(e[r.key],r.default)?``:u(e[r.key],`data.${t.key}.${n}.${r.key}`,c.has(r.key)))),r=e.map((e,t)=>Math.max(e.length,...n.map(e=>e[t]?.length??0)));s.push(...[e,...n].map(e=>e.map((e,t)=>e.padEnd(r[t]??e.length)).join(` `).trimEnd()))}else for(let[e,n]of t.rows.entries())s.push(` ${f.map(r=>d(r.label,r.key,n[r.key],`data.${t.key}.${e}.${r.key}`,r.positional,r.default,c.has(r.key))).filter(e=>e!==null).join(` · `)}`);t.rows.length||e||t.page||s.push(`No records.`),h(t.page)}else if(t.kind===`messages`){m(e,t.summary);for(let[e,n]of t.groups.entries()){s.push(` ${p(n.facts,`data.${t.key}.${e}`)}`);for(let[r,i]of n.messages.entries())s.push(` ${p(i.facts,`data.${t.key}.${e}.messages.${r}`)}`),s.push(...i.text.split(`
|
|
1143
|
+
`).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?`${dO(n.location)} `:``}${dO(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(`
|
|
1144
1144
|
`).map(e=>` ${e.replaceAll(/\p{Cc}/gu,e=>e===` `||e===`
|
|
1145
|
-
`?e:``)}`))}t.page&&h(t.page),(a||(t.effects??[]).some(e=>e.state!==`confirmed`))&&s.push(...
|
|
1146
|
-
`)}\n`}function
|
|
1147
|
-
`).reverse()}catch{return[]}finally{n!==void 0&&u.default.closeSync(n)}}function
|
|
1145
|
+
`?e:``)}`))}t.page&&h(t.page),(a||(t.effects??[]).some(e=>e.state!==`confirmed`))&&s.push(...xO(t.effects??[]));for(let e of t.warnings??[])s.push(`Warning: ${dO(e.message)}`);let _=e.actions??t.next??[],v=[..._,...g.filter(e=>!_.some(t=>bO(t)===bO(e)))];for(let e of c)e.count!==void 0&&s.push(`${e.count} more ${SO(e.path)}`);for(let e of v)e.kind===`url`&&s.push(`${dO(e.label??`Link`)}: ${e.url}`);return`${s.join(`
|
|
1146
|
+
`)}\n`}function wO(e,t,n=1){return CO({heading:_O(e.command),status:``,facts:[],sections:[]},e,{...t,fields:void 0},void 0,[],n)}function Z(e,t){return{run:(n,r,i,a)=>TO(e,t,n,r,i,a)}}async function TO(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 aO,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=ED(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`,CO(e.present(i),o,n,e.output.collection,e.output.requiredFields,wD(i.completion).code));return wD(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}}:CD(t),s=t instanceof K?t.kind===`action_required`:t?.code===2,c=p.effects.snapshot(),f=J(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={...ED(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`,wO(h,n,wD(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 wD(f.completion).code}finally{i?.removeEventListener(`abort`,f)}}const EO={claude:`Claude Code`,"claude-code":`Claude Code`,cowork:`Claude Cowork`,codex:`Codex`,cursor:`Cursor`,"cursor-cli":`Cursor`,gemini:`Gemini CLI`,"gemini-cli":`Gemini CLI`,grok:`Grok`,"grok-cli":`Grok`,"github-copilot":`GitHub Copilot`,"github-copilot-cli":`GitHub Copilot`,kilo:`Kilo Code`,omp:`OMP`,"oh-my-pi":`OMP`,pi:`Pi`,dsh:`DeepSeek Harness`,opencode:`OpenCode`,"qwen-code":`Qwen Code`,antigravity:`Antigravity`,augment:`Augment`,"augment-cli":`Augment`,goose:`Goose`,amp:`Amp`,cline:`Cline`,roo:`Roo Code`,devin:`Devin`,replit:`Replit`,v0:`v0`};[...new Set(Object.values(EO))];const DO=[[`omp`,e=>!!e.OMPCODE],[`grok`,e=>!!(e.GROK_AGENT||e.GROK_SESSION_ID)],[`cowork`,e=>!!e.CLAUDE_CODE_IS_COWORK],[`kilo`,e=>!!e.KILO],[`codex`,e=>!!(e.CODEX_THREAD_ID||e.CODEX_SANDBOX||e.CODEX_CI)],[`cursor`,e=>!!(e.CURSOR_AGENT||e.CURSOR_TRACE_ID)],[`gemini`,e=>!!e.GEMINI_CLI],[`github-copilot`,e=>!!e.COPILOT_CLI],[`opencode`,e=>e.OPENCODE===`1`||!!e.OPENCODE_CLIENT],[`qwen-code`,e=>!!e.QWEN_CODE],[`antigravity`,e=>!!e.ANTIGRAVITY_AGENT],[`augment`,e=>!!e.AUGMENT_AGENT],[`cline`,e=>!!e.CLINE_ACTIVE],[`roo`,e=>!!e.ROO_ACTIVE],[`claude`,e=>!!(e.CLAUDECODE||e.CLAUDE_CODE)]],OO=[`RYUGI_WRITER_AGENT`,`AI_AGENT`,`AGENT`,`OMPCODE`,`GROK_AGENT`,`GROK_SESSION_ID`,`CLAUDE_CODE_IS_COWORK`,`KILO`,`CODEX_THREAD_ID`,`CODEX_SANDBOX`,`CODEX_CI`,`CURSOR_AGENT`,`CURSOR_TRACE_ID`,`GEMINI_CLI`,`COPILOT_CLI`,`OPENCODE`,`OPENCODE_CLIENT`,`QWEN_CODE`,`ANTIGRAVITY_AGENT`,`AUGMENT_AGENT`,`CLINE_ACTIVE`,`ROO_ACTIVE`,`CLAUDECODE`,`CLAUDE_CODE`],kO=e=>e?.trim().split(/[@_]/)[0]?.toLowerCase()||void 0,AO=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function jO(e){let t=NO(e),n=t===EO.claude?`claude`:t===EO.codex?`codex`:t===EO.antigravity?`antigravity`:null;if(!n)return null;let r=n===`claude`?e.CLAUDE_CODE_SESSION_ID:n===`codex`?e.CODEX_THREAD_ID||e.CODEX_SESSION_ID:e.ANTIGRAVITY_CONVERSATION_ID;return!r||!AO.test(r)?null:{host:n,id:r}}function MO(e,t){if(e!==`pi`)return EO[e]??e;let n=kO(t.AI_AGENT);return n===`dsh`?EO.dsh:n===`omp`||n===`oh-my-pi`||t.OMPCODE?EO.omp:EO.pi}function NO(e){if(e.RYUGI_WRITER_AGENT)return e.RYUGI_WRITER_AGENT;if(e.RYUGI_WRITER_HOST)return MO(e.RYUGI_WRITER_HOST,e);let t=e.RYUGI_ARTIFACTS_COMMAND?.match(/ --ryugi-session ([0-9a-f-]{36}):[0-9a-f-]{36}(?: |$)/i)?.[1];if(t&&t===e.CODEX_THREAD_ID)return EO.codex;if(e.CLAUDE_CODE_IS_COWORK)return EO.cowork;let n=kO(e.AI_AGENT);if(n)return EO[n]??n;let r=DO.find(([,t])=>t(e))?.[0];if(r)return EO[r];let i=kO(e.AGENT);if(i&&!/^(?:1|true|yes)$/.test(i))return EO[i]??i}const PO=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function FO(e,t){let n;try{n=u.default.openSync(e,`r`);let r=u.default.fstatSync(n).size,i=Math.min(r,t),a=Buffer.alloc(i);return u.default.readSync(n,a,0,i,r-i),a.toString(`utf8`).split(`
|
|
1147
|
+
`).reverse()}catch{return[]}finally{n!==void 0&&u.default.closeSync(n)}}function IO(e,t){if(e)return LO(FO(e,2097152),t)??LO(FO(e,67108864),t)}function LO(e,t){for(let n of e)if(n.startsWith(`{`))try{let e=t(JSON.parse(n));if(typeof e==`string`&&e&&!e.startsWith(`<`))return e}catch{}}function RO(e,t,n){let r=d.default.join(t.CLAUDE_CONFIG_DIR||d.default.join(n,`.claude`),`projects`);try{for(let t of u.default.readdirSync(r)){let n=d.default.join(r,t,e+`.jsonl`);if(u.default.existsSync(n))return n}}catch{return}}function zO(e,t,n){let r=d.default.join(t.CODEX_HOME||d.default.join(n,`.codex`),`sessions`),i=e=>{try{return u.default.readdirSync(e).sort().reverse()}catch{return[]}};for(let t of i(r))for(let n of i(d.default.join(r,t)))for(let a of i(d.default.join(r,t,n))){let o=d.default.join(r,t,n,a),s=i(o).find(t=>t.endsWith(`-`+e+`.jsonl`));if(s)return d.default.join(o,s)}}function BO(e,t,n=m.default.homedir()){if(e===`Claude Code`||e===`Claude Cowork`){let e=t.CLAUDE_CODE_SESSION_ID;return!e||!PO.test(e)?void 0:IO(RO(e,t,n),e=>e.type===`assistant`?e.message?.model:void 0)}if(e===`Codex`){let e=t.CODEX_THREAD_ID;return!e||!PO.test(e)?void 0:IO(zO(e,t,n),e=>e.type===`turn_context`?e.payload?.model:void 0)}}function VO(e){let t=e=>!!e&&typeof e==`object`&&!Array.isArray(e),n=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`);if(!t(e)||!n(e.warnings)||!t(e.evidence)||typeof e.evidence.required!=`boolean`||typeof e.evidence.fresh!=`boolean`||e.evidence.observed!==void 0&&typeof e.evidence.observed!=`boolean`||e.pending!==void 0&&!n(e.pending)||e.provenance!==void 0&&!n(e.provenance)||e.modules!==void 0&&!n(e.modules)||e.moved!==void 0&&!n(e.moved)||e.checkedAt!==void 0&&typeof e.checkedAt!=`string`||e.structure!==void 0&&typeof e.structure!=`number`||e.unvisited!==void 0&&!(Array.isArray(e.unvisited)&&e.unvisited.every(e=>t(e)&&typeof e.page==`string`&&n(e.boards)))||e.sheet!==void 0&&e.sheet!==null&&(!t(e.sheet)||typeof e.sheet.version!=`number`||!n(e.sheet.files)||e.sheet.unavailable!==void 0&&typeof e.sheet.unavailable!=`string`)||e.diagnostics!==void 0&&!(Array.isArray(e.diagnostics)&&e.diagnostics.every(e=>t(e)&&typeof e.code==`string`&&typeof e.message==`string`&&(e.location===void 0||typeof e.location==`string`)&&(e.severity===`error`||e.severity===`warning`))))return!1;for(let t of[`ran`,`merging`])if(e[t]!==void 0&&typeof e[t]!=`boolean`)return!1;return!(e.dynamic!==void 0&&(!t(e.dynamic)||Object.values(e.dynamic).some(e=>!t(e)||e.ran!==void 0&&typeof e.ran!=`boolean`))||e.recordings!==void 0&&(!t(e.recordings)||Object.values(e.recordings).some(e=>!t(e)||[`status`,`warning`].some(t=>e[t]!==void 0&&typeof e[t]!=`string`))))}const HO=/* @__PURE__ */ new Set([`W_PROVENANCE`,`W_MODULES`,`W_HUMAN_EDIT_OVERWRITTEN`,`W_BOARD_CLIPPED`,`W_MOVED`]);function UO(e,t){let n=(t.warnings??[]).map(e=>({code:`W_ARTIFACT`,severity:`warning`,message:e}));n.push(...t.diagnostics??[]);for(let e of t.provenance??[])n.push({code:`W_PROVENANCE`,severity:`warning`,message:e});for(let e of t.modules??[])n.push({code:`W_MODULES`,severity:`warning`,message:e});for(let e of t.moved??[])n.push({code:`W_MOVED`,severity:`warning`,message:e});let r=[...t.pending??[]];t.merging&&r.push(`merging`);for(let[e,i]of Object.entries(t.recordings??{}))i.warning&&n.push({code:`W_RECORDING`,severity:`warning`,message:i.warning,location:e}),i.status===`processing`&&r.push(`recording:${e}`);let i=Object.entries(t.dynamic??{}),a=t.evidence?.required??(e.startsWith(`html/`)||e.startsWith(`artboard/`)||i.length>0),o=t.evidence?.observed===!1||t.ran===!1||i.some(([,e])=>e.ran===!1);a&&o&&r.push(`browser_not_run`);let s=t.evidence?.observed??(t.ran===!0||i.length>0&&i.every(([,e])=>e.ran===!0)),c=a?o?`not_run`:s&&t.evidence?.fresh===!0?`clean`:`unknown`:`not_required`,l=n.filter(e=>!HO.has(e.code)),u=l.length?`issues`:r.length?`pending`:c===`unknown`||t.evidence?.fresh===!1?`unknown`:`clean`;return J({...t.attribution?{attribution:t.attribution}:{},artifact:e,status:u,static:l.length?`issues`:`clean`,runtime:c,issues:n,pending:r,...t.sheet?.unavailable?{sheetUnavailable:t.sheet.unavailable}:t.sheet?{sheet:t.sheet.files}:{},...t.structure?{structure:t.structure}:{},...t.unvisited?.length?{unvisited:t.unvisited}:{},evidence:t},u===`issues`?{kind:`validation_failed`}:u===`pending`||u===`unknown`?{kind:`pending`,reasons:r.length?r:[`evidence_unknown`]}:{kind:`succeeded`})}async function WO(e,t,n){if(!e.artifact||!$e.test(e.artifact))throw new j(et);let r=rO(e.projectDir),i=NO(process.env),a=i?{name:i,model:BO(i,process.env)}:void 0,o=await r.call(`POST`,`/api/agent/${e.artifact}/check${e.page?`?page=${encodeURIComponent(e.page)}`:``}`,e.artifact.startsWith(`document/`)?{writer:a}:void 0,t);n?.(o.raw);let{status:s,json:c}=o;if(s<200||s>=300)throw new j(c?.error||`HTTP ${s}`);if(!VO(c))throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned invalid check evidence; validation could not be established.`});return e.artifact.startsWith(`document/`)&&!c.attribution&&(c.attribution={status:`unavailable`,message:`This hub does not support document attribution; update the hub.`}),{...o,json:c}}function GO(e,t,n){return rO(e).call(`POST`,`/api/cloud/checked/${t}`,void 0,n).catch(()=>null)}const KO={name:`check`,summary:`Wait until the server has checked the latest write, then print its warnings (needs a running server)`,usage:[`--artifact <type>/<id> [options]`],options:{artifact:{type:`string`,value:`<type>/<id>`,help:`The artifact to check`},page:{type:`string`,value:`<page-id>`,help:`Whiteboards: check only this page and the board-wide warnings`}},semantic:e=>Z({id:`check`,mode:`finite`,output:{detail:!0,formats:[`brief`,`table`,`json`,`jsonl`,`raw`,`quiet`],fields:[`attribution`,`artifact`,`file`,`status`,`static`,`runtime`,`issues`,`pending`,`sheet`,`sheetUnavailable`,`structure`,`unvisited`,`evidence`],scalar:e=>e.status},async run(t,n){let r=await WO({projectDir:e.projectDir,artifact:e.values.artifact,page:e.values.page},n.signal,e=>{n.payloads.raw=e});n.payloads.raw=r.raw;let i=UO(e.values.artifact,r.json);return i.data.status===`clean`&&await GO(e.projectDir,i.data.artifact,n.signal),i.data.file=JE(e.projectDir,i.data.artifact).write,i.actions=[q([`check`,`--artifact`,i.data.artifact,...e.values.page?[`--page`,e.values.page]:[],`--project-dir`,e.projectDir,`--detail`])],i},present:qO},e)};function qO({data:e}){let t=e.issues.length;return{heading:`Check`,status:e.status,subject:e.artifact,summary:t?`${t} issue${t===1?``:`s`}`:``,facts:[...e.attribution?[X(`Attribution`,{key:`attribution`,value:e.attribution.message??e.attribution.status})]:[],...t&&e.file?[X(`File`,{key:`file`,value:e.file})]:[],...e.runtime===`not_run`||e.runtime===`unknown`?[X(`Browser`,{key:`runtime`,value:e.runtime.replaceAll(`_`,` `)})]:[],...e.pending.length?[X(`Pending`,{key:`pending`,value:e.pending.join(`, `)})]:[],...e.unvisited?.length?[X(`Show`,{key:`unvisited`,value:`${e.unvisited.map(({page:e,boards:t})=>`page ${e}: ${t.join(`, `)}`).join(` · `)}. Open the artboard in a browser, bring these boards into view, then check again; with agent-browser installed (see adeck doctor) Check loads them itself`})]:[],...e.sheet?.length?[X(`Sheet`,{key:`sheet`,value:e.sheet.join(`, `)})]:e.sheetUnavailable?[X(`Sheet`,{key:`sheetUnavailable`,value:`unavailable (${e.sheetUnavailable})`})]:[],...e.structure?[X(`Structure`,{key:`structure`,value:`${e.structure} change${e.structure===1?``:`s`} by your human partner since you last read — run changes --artifact ${e.artifact}`})]:[]],sections:[{kind:`diagnostics`,key:`issues`,items:e.issues,preview:3}]}}function JO(){return process.platform===`win32`?``:((0,p.spawnSync)(`ps`,[`-o`,`command=`,`-p`,String(process.ppid)],{encoding:`utf8`}).stdout??``).trim()}function YO(e,t){try{let n=JSON.stringify({at:(/* @__PURE__ */ new Date()).toISOString(),...t,by:{pid:process.pid,ppid:process.ppid,parent:JO(),cwd:process.cwd(),argv:process.argv.slice(2)}});if(u.default.mkdirSync(e.home,{recursive:!0,mode:448}),u.default.appendFileSync(e.events,`${n}\n`),u.default.statSync(e.events).size>524288){let t=u.default.readFileSync(e.events,`utf8`).trim().split(`
|
|
1148
1148
|
`).slice(-1e3);u.default.writeFileSync(e.events,`${t.join(`
|
|
1149
|
-
`)}\n`)}}catch{}}const
|
|
1149
|
+
`)}\n`)}}catch{}}const XO=(0,h.promisify)(p.execFile);function ZO(e,t){return e===`darwin`?{bin:`open`,args:[t]}:e===`win32`?{bin:`cmd`,args:[`/c`,`start`,`""`,t]}:e===`linux`||e===`freebsd`||e===`openbsd`?{bin:`xdg-open`,args:[t]}:null}const QO=String.raw`
|
|
1150
1150
|
function run(urls) {
|
|
1151
1151
|
function key(url) {
|
|
1152
1152
|
return String(url).split(/[?#]/)[0].replace(/^(https?:\/\/)127\.0\.0\.1:/, '$1localhost:').replace(/\/$/, '');
|
|
@@ -1178,17 +1178,17 @@ function run(urls) {
|
|
|
1178
1178
|
} catch (e) { unknown = true; }
|
|
1179
1179
|
}
|
|
1180
1180
|
return unknown ? 'unknown' : 'missing';
|
|
1181
|
-
}`;async function
|
|
1181
|
+
}`;async function $O(e,t=[]){if(process.platform===`darwin`){let{stdout:n,stderr:r}=await XO(`osascript`,[`-l`,`JavaScript`,`-e`,QO,e,...t],{timeout:5e3});if(r.trim()&&console.error(r.trim()),n.trim()===`found`)return;if(n.trim()!==`missing`)throw Error(`Could not inspect existing browser tabs; open the artifact link manually.`)}let n=ZO(process.platform,e);n&&await XO(n.bin,n.args)}const ek=`dev.ryugi.daemon`,tk=`ryugi-daemon.service`,nk=`--launch=`,rk=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`);function ik(e){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
1182
1182
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
1183
1183
|
<plist version="1.0">
|
|
1184
1184
|
<dict>
|
|
1185
1185
|
<key>Label</key>
|
|
1186
|
-
<string>${
|
|
1186
|
+
<string>${ek}</string>
|
|
1187
1187
|
<key>ProgramArguments</key>
|
|
1188
1188
|
<array>
|
|
1189
|
-
<string>${
|
|
1189
|
+
<string>${rk(e.binary)}</string>
|
|
1190
1190
|
<string>hub</string>
|
|
1191
|
-
<string>${
|
|
1191
|
+
<string>${rk(`${nk}${e.launch}`)}</string>
|
|
1192
1192
|
</array>
|
|
1193
1193
|
<key>KeepAlive</key>
|
|
1194
1194
|
<dict>
|
|
@@ -1206,41 +1206,41 @@ function run(urls) {
|
|
|
1206
1206
|
<key>EnvironmentVariables</key>
|
|
1207
1207
|
<dict>
|
|
1208
1208
|
<key>PATH</key>
|
|
1209
|
-
<string>${
|
|
1209
|
+
<string>${rk(e.path)}</string>
|
|
1210
1210
|
</dict>
|
|
1211
1211
|
<key>StandardErrorPath</key>
|
|
1212
|
-
<string>${
|
|
1212
|
+
<string>${rk(e.log)}</string>
|
|
1213
1213
|
<key>StandardOutPath</key>
|
|
1214
|
-
<string>${
|
|
1214
|
+
<string>${rk(e.log)}</string>
|
|
1215
1215
|
</dict>
|
|
1216
1216
|
</plist>
|
|
1217
|
-
`}const
|
|
1217
|
+
`}const ak=e=>`"${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`).replaceAll(`%`,`%%`)}"`;function ok(e){let t=e.log.replaceAll(`%`,`%%`);return`[Unit]
|
|
1218
1218
|
Description=Artideck hub
|
|
1219
1219
|
|
|
1220
1220
|
[Service]
|
|
1221
|
-
ExecStart=${
|
|
1221
|
+
ExecStart=${ak(e.binary)} hub ${ak(`${nk}${e.launch}`)}
|
|
1222
1222
|
Restart=on-failure
|
|
1223
1223
|
RestartSec=5
|
|
1224
1224
|
KillMode=process
|
|
1225
|
-
Environment=${
|
|
1225
|
+
Environment=${ak(`PATH=${e.path}`)}
|
|
1226
1226
|
StandardOutput=append:${t}
|
|
1227
1227
|
StandardError=append:${t}
|
|
1228
1228
|
|
|
1229
1229
|
[Install]
|
|
1230
1230
|
WantedBy=default.target
|
|
1231
|
-
`}const tk=(e,t)=>{if(e.status!==0)throw Error(`${t} failed: ${e.stderr.trim()}`)},nk=e=>{try{return u.default.readFileSync(e,`utf8`)}catch{return null}},rk=e=>{let t=nk(e);return t!==null&&!t.includes(XO)},ik=(e,t)=>{u.default.mkdirSync(d.default.dirname(e),{recursive:!0}),u.default.writeFileSync(e,t)};function ak(e){let t=`gui/${e.uid}/${JO}`,n=d.default.join(e.home,`Library`,`LaunchAgents`,`${JO}.plist`),r=d.default.join(e.serverHome,`${JO}.plist`),i=e=>e?n:r;return{file:i,kind:`agent`,check:()=>null,disable:()=>{},legacy:()=>rk(n),render:QO,write:e=>(ik(i(e.autostart),QO(e)),u.default.rmSync(i(!e.autostart),{force:!0}),i(e.autostart)),load:n=>{e.run(`launchctl`,[`bootout`,t]),tk(e.run(`launchctl`,[`bootstrap`,`gui/${e.uid}`,i(n)]),`launchctl bootstrap`)},unload:()=>{e.run(`launchctl`,[`bootout`,t])},linger:()=>void 0}}function ok(e){let t=(...t)=>e.run(`systemctl`,[`--user`,...t]),n,r=()=>n??=t(`show-environment`),i=()=>{let t=r();return t.status===0?/^XDG_CONFIG_HOME=(.+)$/m.exec(t.stdout??``)?.[1]??d.default.join(e.home,`.config`):e.configHome??d.default.join(e.home,`.config`)},a=()=>d.default.join(i(),`systemd`,`user`,YO);return{file:a,kind:`service`,check:()=>{let e=r();return e.status===0?null:`systemd user services are not available here (systemctl --user: ${e.stderr.trim()||`failed`})`},disable:()=>{t(`disable`,YO)},legacy:()=>rk(a()),render:ek,write:e=>(ik(a(),ek(e)),a()),load:e=>{tk(t(`daemon-reload`),`systemctl --user daemon-reload`),e?tk(t(`enable`,YO),`systemctl --user enable ${YO}`):t(`disable`,YO),tk(t(`restart`,YO),`systemctl --user restart ${YO}`)},unload:()=>{t(`stop`,YO)},linger:()=>{let t=e.run(`loginctl`,[`enable-linger`]);return t.status===0?{enabled:!0}:{enabled:!1,error:t.stderr.trim()||`exit ${t.status}`}}}}function sk(e){return e.platform===`darwin`?ak(e):e.platform===`linux`?ok(e):null}const ck={darwin:[`arm64`],linux:[`x64`,`arm64`]};function lk(e=process.env,t=process.platform,n=process.getuid?.()??-1,r=m.default.tmpdir()){return e.RYUGI_RUNTIME_DIR?d.default.join(e.RYUGI_RUNTIME_DIR,`servers`):t===`win32`?d.default.join(r,`ryugi`,`servers`):`/tmp/ryugi-${n}/servers`}const uk=(e,t)=>d.default.join(e,`${f.default.createHash(`sha256`).update(t).digest(`hex`).slice(0,16)}.json`);function dk(e){if(process.platform!==`win32`)for(let t of[d.default.dirname(e),e]){let e=u.default.lstatSync(t);if(!e.isDirectory()||e.uid!==process.getuid()||e.mode&18)throw Error(`Unsafe registry directory: ${t}`)}}function fk(e){try{let t=JSON.parse(u.default.readFileSync(e,`utf8`));return typeof t.project!=`string`||typeof t.root!=`string`||typeof t.serverId!=`string`||!Number.isInteger(t.pid)||!Number.isFinite(t.startedAt)||![`.artideck`,`.ryugi`].some(e=>t.root===d.default.join(t.project,e,`artifacts`))?null:t}catch{return null}}function pk(e){let t;try{dk(e),t=u.default.readdirSync(e)}catch{return[]}return t.filter(e=>e.endsWith(`.json`)).flatMap(t=>fk(d.default.join(e,t))??[])}function mk(e,t){let n=uk(e,t.project);fk(n)?.serverId===t.serverId&&u.default.rmSync(n,{force:!0})}const hk=/* @__PURE__ */ new Set([`darwin-arm64`,`linux-x64`,`linux-arm64`]),gk=/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/,_k=e=>gk.test(e);async function vk(e,t,n,r,i,a){let o=`${n.replace(/\/+$/,``)}/v${t}/${e}`,s=await r(o,{signal:i});if(!s.ok)throw Object.assign(/* @__PURE__ */ Error(`could not download ${e} ${t}: HTTP ${s.status}`),{status:s.status});let c=Number(s.headers.get(`content-length`))||void 0;a?.(0,c);let l=[],u=0,d=s.body?.getReader();for(let e=await d?.read();e&&!e.done;e=await d?.read())l.push(Buffer.from(e.value)),u+=e.value.length,a?.(u,c);let p=Buffer.concat(l),m=await r(`${o}.sha256`,{signal:i});if(!m.ok)throw Object.assign(/* @__PURE__ */ Error(`could not download the sha256 for ${e}: HTTP ${m.status}`),{status:m.status});if((await m.text()).trim().split(/\s+/)[0]?.toLowerCase()!==f.default.createHash(`sha256`).update(p).digest(`hex`))throw Error(`${e} failed its sha256 check; nothing was installed`);return p}function yk(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)}const bk=e=>d.default.join(Te(e),`hook`),xk=(e,t)=>d.default.join(bk(e),t),Sk=[1,116,0];function Ck(e){let t=e.split(/[-+]/)[0].split(`.`).map(Number),n=Sk.findIndex((e,n)=>t[n]!==e);return n!==-1&&t[n]>Sk[n]?`adeck-hook`:`ryugi-hook`}const wk=(e,t,n)=>hk.has(`${e}-${t}`)?`${Ck(n)}-${e}-${t}`:null;function Tk(e){try{return u.default.statSync(e).isFile()&&!!(u.default.statSync(e).mode&73)}catch{return!1}}function Ek(e,t){try{let n=JSON.parse(u.default.readFileSync(e,`utf8`));return t-n.at<(n.status===404?5:60)*6e4}catch{return!1}}function Dk(e,t){try{return u.default.writeFileSync(e,String(process.pid),{flag:`wx`}),!0}catch{}try{return t-u.default.statSync(e).mtimeMs<3e5?!1:(u.default.rmSync(e,{force:!0}),u.default.writeFileSync(e,String(process.pid),{flag:`wx`}),!0)}catch{return!1}}async function Ok(e){let t=wk(e.platform,e.arch,e.version);if(!t||!_k(e.version))return{status:`skipped`};let n=e.now??Date.now(),r=xk(e.home,e.version),i=d.default.join(r,Ck(e.version));if(Tk(i))return{status:`present`};u.default.mkdirSync(r,{recursive:!0,mode:448});let a=d.default.join(r,`.failed`);if(!e.retry&&Ek(a,n))return{status:`skipped`,error:`the last download failed; it is retried later`};let o=d.default.join(r,`.lock`);if(!Dk(o,n))return{status:`skipped`,error:`another download is in progress`};let s=AbortSignal.timeout(e.timeoutMs??6e4);try{let n=process.env.RYUGI_HOOK_RELEASE_BASE||`https://github.com/Innei/ryugi/releases/download`;return yk(i,await vk(t,e.version,n,e.fetch,s,e.onProgress)),u.default.rmSync(a,{force:!0}),{status:`installed`}}catch(t){let r=t.status??null;return u.default.writeFileSync(a,JSON.stringify({at:n,status:r})),{status:`failed`,error:s.aborted?`the download of ${Ck(e.version)} ${e.version} timed out`:t.message}}finally{u.default.rmSync(o,{force:!0})}}const kk=(e,t)=>d.default.resolve(e)===d.default.join(Te(t),`server`),Ak=e=>e===`win32`?`adeck-daemon.exe`:`adeck-daemon`,jk=(e,t)=>`adeck-daemon-${e}-${t}${e===`win32`?`.exe`:``}`,Mk=e=>d.default.join(d.default.dirname(e),d.default.basename(e).replace(/^adeck-daemon/,`ryugi-daemon`));function Nk(e,t){yk(e,t),u.default.rmSync(Mk(e),{force:!0})}function Pk(e){return kk(e.serverHome,e.home)?d.default.join(Te(e.home),`bin`,Ak(e.platform)):d.default.join(e.serverHome,`bin`,Ak(e.platform))}function Fk(e){let t=(0,p.spawnSync)(e,[`--version`],{encoding:`utf8`,timeout:5e3}),n=/^(?:adeck|ryugi)-daemon (\S+)(?: \(src ([^)]+)\))?/.exec(t.stdout??``);return t.status!==0||!n?null:{version:n[1],...n[2]?{source:n[2]}:{}}}const Ik=(e,t)=>!!e&&(t.daemonSource?e.source===t.daemonSource:e.version===t.version);async function Lk(e){let t=e.timeoutMs??18e4,n=AbortSignal.timeout(t);try{return await vk(jk(e.platform,e.arch),e.version,e.env.RYUGI_DAEMON_RELEASE_BASE||`https://github.com/Innei/ryugi/releases/download`,e.fetch,n)}catch(e){throw n.aborted?Error(`the download timed out after ${t/1e3} s`,{cause:e}):e}}var Rk=class extends Error{};async function zk(e,t){let n=e.env.RYUGI_DAEMON_BIN;if(n){if(!u.default.existsSync(n))throw new Rk(`RYUGI_DAEMON_BIN names ${n}, which does not exist`);return n}let r=Pk(e);if(!_k(e.version)){let t=[d.default.join(e.cliDir,Ak(e.platform)),r].find(e=>u.default.existsSync(e));if(t)return t;throw new Rk(`This adeck is a local build (${e.version||`no version`}), so there is no adeck-daemon release to download for it. Build one with \`cargo build --manifest-path daemon/Cargo.toml\` and set RYUGI_DAEMON_BIN to it.`)}return u.default.existsSync(r)&&Ik(Fk(r),e)||(t?.(),Nk(r,await Lk(e).catch(t=>{throw new Rk(`Could not download adeck-daemon ${e.version} for ${e.platform}-${e.arch}: ${t.message}. The hub runs from that binary and there is no other way to start it; check the network, or set RYUGI_DAEMON_BIN to a adeck-daemon build.`)}))),r}const Bk=e=>d.default.join(e,`settings.json`);function Vk(e){try{let t=JSON.parse(u.default.readFileSync(Bk(e),`utf8`));return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}const Hk=e=>Vk(e).sessionControl===!0;function Uk(e,t){u.default.mkdirSync(e,{recursive:!0,mode:448}),AC(Bk(e),{...Vk(e),sessionControl:t})}const Wk=/^(RYUGI_|ARTIFACTS_|XDG_|LC_)|^(HOME|USER|LOGNAME|SHELL|LANG|TMPDIR|PATH|NODE_EXTRA_CA_CERTS|SSL_CERT_FILE|SSL_CERT_DIR)$|_proxy$|_PROXY$/,Gk=e=>d.default.join(e.home,`launch.json`),Kk=(e,t)=>[`hub`,`--artifacts-server-id=${e}`,...t?[`--port=${t}`]:[]];function qk(e,t){let n={...process.env,ARTIFACTS_HOST:e,ARTIFACTS_URL_HOST:t,RYUGI_NODE:process.execPath,RYUGI_DOCUMENT_ENGINE:d.default.join(__dirname,`document-engine.cjs`),RYUGI_VIEWER_DIR:d.default.join(__dirname,`viewer`),RYUGI_RUNTIME_ASSETS_DIR:d.default.join(__dirname,`runtime`),...ie?{RYUGI_PACKAGE:ie}:{}};process.env.RYUGI_ARTIFACTS_COMMAND&&(n.RYUGI_ARTIFACTS_LAUNCHER=process.env.RYUGI_ARTIFACTS_COMMAND);for(let e of[`RYUGI_WRITER_HOST`,`RYUGI_WRITER_AGENT`,`RYUGI_ARTIFACTS_OWNER`,`RYUGI_ARTIFACTS_VERSION`,`RYUGI_ARTIFACTS_COMMAND`,`ARTIFACTS_OPEN_CMD`,`ARTIFACTS_ROOT`])delete n[e];return n}function Jk(e,t){let n=Object.fromEntries(Object.entries(t.env).filter(e=>Wk.test(e[0])&&e[1]!==void 0)),r=Gk(e),i=`${r}.${process.pid}.tmp`;u.default.writeFileSync(i,`${JSON.stringify({args:t.args,env:n},null,2)}\n`,{mode:384}),u.default.renameSync(i,r),u.default.rmSync(d.default.join(e.home,`hub-start-failures`),{force:!0})}function Yk(e){try{let t=JSON.parse(u.default.readFileSync(Gk(e),`utf8`));return Array.isArray(t.args)&&t.env&&typeof t.env==`object`?{args:t.args,env:t.env}:null}catch{return null}}const Xk=[`RYUGI_NODE`,`RYUGI_DOCUMENT_ENGINE`,`RYUGI_VIEWER_DIR`,`RYUGI_RUNTIME_ASSETS_DIR`];function Zk(e,t){let n=Yk(e);return!n||Xk.some(e=>n.env[e]!==t[e])}function Qk(e,t){let n=e.args.filter(e=>!e.startsWith(`--artifacts-server-id=`));return{...e,args:[n[0]??`hub`,`--artifacts-server-id=${t}`,...n.slice(1)]}}const $k=(e,t)=>{let n=(0,p.spawnSync)(e,t,{encoding:`utf8`});return{status:n.status,stderr:n.stderr||(n.error?.message??``),stdout:n.stdout??``}},eA=(e,t=$k)=>({configHome:process.env.XDG_CONFIG_HOME||void 0,home:m.default.homedir(),platform:process.platform,run:t,serverHome:e.home,uid:process.getuid?.()??0});function tA(e){if(!kk(e.home,m.default.homedir()))return null;let t=sk(eA(e));return t&&!t.check()?t:null}const nA=e=>{let t=e?Number(e):NaN;return Number.isFinite(t)&&t>0?t:void 0};async function rA(e,t){try{return await zk({arch:process.arch,cliDir:__dirname,daemonSource:w||void 0,env:process.env,fetch,home:m.default.homedir(),platform:process.platform,serverHome:e.home,timeoutMs:nA(process.env.RYUGI_DAEMON_DOWNLOAD_TIMEOUT_MS),version:t})}catch(e){throw e instanceof Rk?new A(e.message):e}}function iA(e,t){let n=tA(e);if(!n)return!1;let r=n.legacy();r&&Uk(e.home,!0);let i=r||Hk(e.home);try{return n.write({autostart:i,binary:t,launch:Gk(e),log:e.log,path:process.env.PATH??`/usr/bin:/bin`}),n.load(i),!0}catch{return!1}}const aA=1e4,oA=((e,t)=>{let n=process.env[e]?Number(process.env[e]):NaN;return Number.isFinite(n)&&n>=0?n:t})(`RYUGI_START_ALIVE_MS`,1e3),sA=(e,t)=>e.split(`
|
|
1232
|
-
`).find(e=>e.includes(`"${t}"`));async function
|
|
1233
|
-
`,{flag:`wx`,mode:384})}catch(e){if(e.code===`EEXIST`)return}return{message:`Recommended: sign in to Artideck Cloud to share artifacts and review them from other devices. Sign-in is optional; local work can continue.`,command:`${process.env.RYUGI_ARTIFACTS_COMMAND||`npx artideck`} publish --login --from hint`,projectDir:e,agentInstruction:`Briefly pass this recommendation to your human partner and offer to run command in projectDir. It prints a code and an address; they confirm the code on any device signed in to Artideck Cloud, such as their phone. Continue the current task without waiting for sign-in.`}}function
|
|
1234
|
-
`);let i=process.env.RYUGI_ARTIFACTS_VERSION||`1.118.4`,a=qD(r.projects).some(e=>e.dir===n.project),o=async(r,i)=>{PA(n,e.artifact);let o=e.open&&!e.library&&(!i||!a);await FA(r,n,o?e.artifact??!0:void 0);let s=EA(r,n,e.artifact);i&&(s.reused=!0);let c=await DA(s,r,n,e.artifact),l=lA(n.project);if(t.signal?.throwIfAborted(),e.library&&e.open&&(process.env.ARTIFACTS_OPEN_CMD?await new Promise(e=>(0,p.execFile)(process.env.ARTIFACTS_OPEN_CMD,[r.url],()=>e())):await qO(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 qO(typeof c.cloudLink==`string`?c.cloudLink:e,[e]).catch(e=>t.log(e.message,`stderr`))}};if(!await OA(r.lock))throw new A(`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=kA(r),s=AA(r),l=null;if(a&&!s){for(let e=0;e<xA&&Le(a)&&!s;e+=100)await Ie(100),s=AA(r);!s&&Le(a)&&(l={label:`stopping artifacts server`,pid:a,reasons:[`no-info`],running:Ue(r.version)??``})}if(a&&s){let t=Ue(r.version)??``,n=yA(t,i),u=[...n===`keep`?[]:[`version`],...(s.host??`127.0.0.1`)===e.host?[]:[`host`],...(s.urlHost??`localhost`)===e.urlHost?[]:[`urlHost`],...(s.cloudOrigin??`https://artideck.dev`)===CA(process.env)?[]:[`cloudOrigin`],...e.port!==void 0&&String(s.port)!==e.port?[`port`]:[],...Zk(r,qk(e.host,e.urlHost))?[`launch`]:[]],d={pid:a,running:t,cli:i},f=n===`protected`||u.length===0;if(f&&await jA(s))return u.length&&UO(r,{...d,action:`kept`,reasons:u}),c(),await o(s,!0),0;l={label:`running artifacts server`,pid:a,reasons:f?[...u,`unanswered`]:u,running:t}}let d=await rA(r,i);l&&(UO(r,{action:`replaced`,cli:i,pid:l.pid,reasons:l.reasons,running:l.running}),await MA(l.pid,l.label)),await NA(),u.default.rmSync(r.info,{force:!0});let m=f.default.randomBytes(24).toString(`hex`);u.default.writeFileSync(r.serverId,`${m}\n`),u.default.writeFileSync(r.version,`${i}\n`);let h={args:Kk(m,e.port),env:qk(e.host,e.urlHost)};if(e.foreground){Jk(r,h);let e=(0,p.spawn)(d,h.args,{env:h.env,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);g.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;g.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)}}let _=await cA(r,d,h,`${$e()} start --project-dir ${n.project}${e.artifact?` --artifact ${e.artifact}`:``} --host ${e.host} --url-host ${e.urlHost} --foreground`);return`failed`in _?(t.failure(_.failed),1):(c(),await o(_.info,!1),0)}finally{c()}}const BA={semantic:hA,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`}}};async function VA(e,t,n,r,i){u.default.mkdirSync(d.default.dirname(e),{recursive:!0});let a=d.default.join(d.default.dirname(e),`.`+d.default.basename(e)),o=a+`.`+(0,f.randomUUID)()+`.tmp`,s=a+`.write-lock`;if(!await OA(s))throw new A(`Another document save is in progress. Retry after it finishes.`);try{let r=null;try{r=u.default.readFileSync(e,`utf8`)}catch(e){if(e.code!==`ENOENT`)throw e}if(r?.trimEnd()!==t?.trimEnd())throw new A(`Document changed since the base; nothing was saved.`);if(n===r)return;r===null&&fe(d.default.dirname(e));let i=r?.match(/^\s*<doc (ryugi-attribution="[A-Za-z0-9_-]+")(?=[\s>])/),a=n.replace(/^(\s*<doc) ryugi-attribution="[A-Za-z0-9_-]+"(?=[\s>])/,`$1`);u.default.writeFileSync(o,i?a.replace(/^(\s*<doc)/,`$1 ${i[1]}`):a,{mode:r===null?384:u.default.statSync(e).mode&511}),u.default.renameSync(o,e)}finally{u.default.rmSync(o,{force:!0}),u.default.rmdirSync(s)}}const HA={hidden:!0,name:`write-document`,summary:`Save a document revision with the calling agent’s attribution`,usage:[`--artifact document/<id> --input <edited.xml> [--base <original.xml>]`],options:{artifact:{type:`string`,help:`Document to create or edit`},base:{type:`string`,help:`Unedited copy from before the edit (omit for creation)`},input:{type:`string`,help:`Edited copy of the LiteXML file`}},semantic:e=>Z({id:`write-document`,mode:`finite`,output:{formats:[`brief`,`json`],fields:[`artifact`,`author`]},run:async()=>{let{artifact:t,base:n,input:r}=e.values;if(typeof t!=`string`||!t.startsWith(`document/`)||!et.test(t)||typeof r!=`string`)throw new A(`Supply --artifact document/<id> and --input <file>.`);let i=DO(process.env);if(!i)throw new A(`No agent identity in the writing process environment.`);await VA(d.default.join(Ye(e.projectDir).root,t,`doc.xml`),typeof n==`string`?u.default.readFileSync(n,`utf8`):null,u.default.readFileSync(r,`utf8`),i,PO(i,process.env));let a;try{a=(await RO({artifact:t,projectDir:e.projectDir})).json.attribution}catch(e){a={status:`unavailable`,message:e.message}}return J({artifact:t,author:i},void 0,{warnings:a?.status===`unavailable`?[{code:`W_ATTRIBUTION`,message:a.message??`Attribution was not recorded`}]:[]})},present:({data:e})=>({heading:`Document`,status:`SAVED`,subject:e.artifact,summary:e.author,facts:[],sections:[]})},e)},UA=[`desktop`,`laptop`,`tablet`,`mobile`],WA=/* @__PURE__ */ new Set([`localhost`,`127.0.0.1`,`[::1]`,`::1`]),GA=4096;function KA(e){if(typeof e!=`string`)return null;let t=e.trim();if(!t||t.length>256)return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol!==`http:`||n.username||n.password||n.search||n.hash||n.pathname!==`/`&&n.pathname!==``)return null;let r=n.hostname.toLowerCase();if(!WA.has(r))return null;let i=n.port?Number(n.port):80;return!Number.isInteger(i)||i<1||i>65535?null:{origin:n.origin,host:n.host,hostname:r===`[::1]`?`::1`:r,port:i}}function qA(e){let t=e.trim();if(!t||t.length>1024)return null;let n=/^https?:\/\//i.test(t)?t:`http://${t}`,r;try{r=new URL(n)}catch{return null}let i=KA(r.origin);if(!i)return null;let a=`${r.pathname||`/`}${r.search}${r.hash}`;return{url:i.origin,path:a}}function JA(e){if(typeof e==`string`)return UA.includes(e)?e:null;if(typeof e==`object`&&e&&!Array.isArray(e)){let{w:t,h:n}=e;if(typeof t==`number`&&typeof n==`number`&&Number.isInteger(t)&&Number.isInteger(n)&&t>=240&&t<=GA&&n>=240&&n<=GA)return{w:t,h:n}}return null}function YA(e){if(typeof e!=`string`)return null;let t=e.trim();return!t||t.length>2e3||!t.startsWith(`/`)||t.startsWith(`//`)?null:t}function XA(e){let t;try{t=JSON.parse(e)}catch(e){return{config:null,issues:[`preview.json is not valid JSON: ${e.message}`]}}if(typeof t!=`object`||!t||Array.isArray(t))return{config:null,issues:[`preview.json must be a JSON object`]};let n=t,r=[];n.version!==1&&r.push(`preview.json requires version: 1`);let i=KA(n.url);i||r.push(`preview.json url must be a local loopback http origin (e.g. http://localhost:5173 or http://127.0.0.1:3000)`);let a;n.title!==void 0&&(typeof n.title!=`string`||!n.title.trim()||n.title.length>200?r.push(`preview.json title must be a non-empty string (<= 200 chars)`):a=n.title.trim());let o;if(n.path!==void 0){let e=YA(n.path);e?o=e:r.push(`preview.json path must start with "/" (and not "//")`)}let s;if(n.viewport!==void 0){let e=JA(n.viewport);e?s=e:r.push(`preview.json viewport must be one of ${UA.join(`, `)} or { w, h } (240..${GA})`)}return r.length>0||!i?{config:null,issues:r}:{config:{version:1,url:i.origin,...a?{title:a}:{},...o?{path:o}:{},...s?{viewport:s}:{}},issues:[]}}const ZA=`preview.json`,QA=/^[a-z0-9][a-z0-9-]{0,63}$/;function $A(e){return d.default.join(d.default.dirname(e),`preview`)}function ej(e,t){return QA.test(t)?d.default.join($A(e),t):null}function tj(e){let t=$A(e),n;try{n=u.default.readdirSync(t)}catch{return[]}let r=[];for(let e of n){if(!QA.test(e))continue;let n=d.default.join(t,e);u.default.existsSync(d.default.join(n,ZA))&&r.push({id:e,payload:nj(n,e)})}return r}function nj(e,t,n){let r=d.default.join(e,ZA),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}=XA(i);return{title:o?.title||t,version:a,config:o,issues:s,warnings:s,proxyUrl:n??null}}function rj(e,t){u.default.mkdirSync(e,{recursive:!0}),AC(d.default.join(e,ZA),t)}function ij(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 aj(e,t=800){let n=KA(e);if(!n)return!1;if(n.hostname!==`localhost`)return ij(n.hostname,n.port,t);let r=await Promise.all([ij(`127.0.0.1`,n.port,t),ij(`::1`,n.port,t)]);return r[0]||r[1]}function oj(e){let t=typeof e==`string`&&e.trim()?e.trim():`dev`;if(!QA.test(t))throw new A(`Preview --id must use lowercase letters, digits, and hyphens.`);return t}function sj(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 cj({data:e}){return{heading:`Preview ${e.action}`,status:e.action===`open`?`ready`:`ok`,subject:e.id?`preview/${e.id}`:void 0,facts:[...e.url?[X(`Target`,{key:`url`,value:e.url})]:[],...e.upstreamAlive===void 0?[]:[X(`Upstream`,{key:`upstreamAlive`,value:e.upstreamAlive?`online`:`offline`})],...e.open?[X(`Open`,{key:`open`,value:e.open},!0)]:[],...e.receipt?[X(`Receipt`,{key:`receipt`,value:e.receipt})]:[]],sections:e.lines.length?[{kind:`content`,key:`lines`,text:e.lines.join(`
|
|
1235
|
-
`)}]:[]}}const
|
|
1231
|
+
`}const sk=(e,t)=>{if(e.status!==0)throw Error(`${t} failed: ${e.stderr.trim()}`)},ck=e=>{try{return u.default.readFileSync(e,`utf8`)}catch{return null}},lk=e=>{let t=ck(e);return t!==null&&!t.includes(nk)},uk=(e,t)=>{u.default.mkdirSync(d.default.dirname(e),{recursive:!0}),u.default.writeFileSync(e,t)};function dk(e){let t=`gui/${e.uid}/${ek}`,n=d.default.join(e.home,`Library`,`LaunchAgents`,`${ek}.plist`),r=d.default.join(e.serverHome,`${ek}.plist`),i=e=>e?n:r;return{file:i,kind:`agent`,check:()=>null,disable:()=>{},legacy:()=>lk(n),render:ik,write:e=>(uk(i(e.autostart),ik(e)),u.default.rmSync(i(!e.autostart),{force:!0}),i(e.autostart)),load:n=>{e.run(`launchctl`,[`bootout`,t]),sk(e.run(`launchctl`,[`bootstrap`,`gui/${e.uid}`,i(n)]),`launchctl bootstrap`)},unload:()=>{e.run(`launchctl`,[`bootout`,t])},linger:()=>void 0}}function fk(e){let t=(...t)=>e.run(`systemctl`,[`--user`,...t]),n,r=()=>n??=t(`show-environment`),i=()=>{let t=r();return t.status===0?/^XDG_CONFIG_HOME=(.+)$/m.exec(t.stdout??``)?.[1]??d.default.join(e.home,`.config`):e.configHome??d.default.join(e.home,`.config`)},a=()=>d.default.join(i(),`systemd`,`user`,tk);return{file:a,kind:`service`,check:()=>{let e=r();return e.status===0?null:`systemd user services are not available here (systemctl --user: ${e.stderr.trim()||`failed`})`},disable:()=>{t(`disable`,tk)},legacy:()=>lk(a()),render:ok,write:e=>(uk(a(),ok(e)),a()),load:e=>{sk(t(`daemon-reload`),`systemctl --user daemon-reload`),e?sk(t(`enable`,tk),`systemctl --user enable ${tk}`):t(`disable`,tk),sk(t(`restart`,tk),`systemctl --user restart ${tk}`)},unload:()=>{t(`stop`,tk)},linger:()=>{let t=e.run(`loginctl`,[`enable-linger`]);return t.status===0?{enabled:!0}:{enabled:!1,error:t.stderr.trim()||`exit ${t.status}`}}}}function pk(e){return e.platform===`darwin`?dk(e):e.platform===`linux`?fk(e):null}const mk={darwin:[`arm64`],linux:[`x64`,`arm64`]};function hk(e=process.env,t=process.platform,n=process.getuid?.()??-1,r=m.default.tmpdir()){return e.RYUGI_RUNTIME_DIR?d.default.join(e.RYUGI_RUNTIME_DIR,`servers`):t===`win32`?d.default.join(r,`ryugi`,`servers`):`/tmp/ryugi-${n}/servers`}const gk=(e,t)=>d.default.join(e,`${f.default.createHash(`sha256`).update(t).digest(`hex`).slice(0,16)}.json`);function _k(e){if(process.platform!==`win32`)for(let t of[d.default.dirname(e),e]){let e=u.default.lstatSync(t);if(!e.isDirectory()||e.uid!==process.getuid()||e.mode&18)throw Error(`Unsafe registry directory: ${t}`)}}function vk(e){try{let t=JSON.parse(u.default.readFileSync(e,`utf8`));return typeof t.project!=`string`||typeof t.root!=`string`||typeof t.serverId!=`string`||!Number.isInteger(t.pid)||!Number.isFinite(t.startedAt)||![`.artideck`,`.ryugi`].some(e=>t.root===d.default.join(t.project,e,`artifacts`))?null:t}catch{return null}}function yk(e){let t;try{_k(e),t=u.default.readdirSync(e)}catch{return[]}return t.filter(e=>e.endsWith(`.json`)).flatMap(t=>vk(d.default.join(e,t))??[])}function bk(e,t){let n=gk(e,t.project);vk(n)?.serverId===t.serverId&&u.default.rmSync(n,{force:!0})}const xk=/* @__PURE__ */ new Set([`darwin-arm64`,`linux-x64`,`linux-arm64`]),Sk=/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/,Ck=e=>Sk.test(e);async function wk(e,t,n,r,i,a){let o=`${n.replace(/\/+$/,``)}/v${t}/${e}`,s=await r(o,{signal:i});if(!s.ok)throw Object.assign(/* @__PURE__ */ Error(`could not download ${e} ${t}: HTTP ${s.status}`),{status:s.status});let c=Number(s.headers.get(`content-length`))||void 0;a?.(0,c);let l=[],u=0,d=s.body?.getReader();for(let e=await d?.read();e&&!e.done;e=await d?.read())l.push(Buffer.from(e.value)),u+=e.value.length,a?.(u,c);let p=Buffer.concat(l),m=await r(`${o}.sha256`,{signal:i});if(!m.ok)throw Object.assign(/* @__PURE__ */ Error(`could not download the sha256 for ${e}: HTTP ${m.status}`),{status:m.status});if((await m.text()).trim().split(/\s+/)[0]?.toLowerCase()!==f.default.createHash(`sha256`).update(p).digest(`hex`))throw Error(`${e} failed its sha256 check; nothing was installed`);return p}function Tk(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)}const Ek=e=>d.default.join(we(e),`hook`),Dk=(e,t)=>d.default.join(Ek(e),t),Ok=[1,116,0];function kk(e){let t=e.split(/[-+]/)[0].split(`.`).map(Number),n=Ok.findIndex((e,n)=>t[n]!==e);return n!==-1&&t[n]>Ok[n]?`adeck-hook`:`ryugi-hook`}const Ak=(e,t,n)=>xk.has(`${e}-${t}`)?`${kk(n)}-${e}-${t}`:null;function jk(e){try{return u.default.statSync(e).isFile()&&!!(u.default.statSync(e).mode&73)}catch{return!1}}function Mk(e,t){try{let n=JSON.parse(u.default.readFileSync(e,`utf8`));return t-n.at<(n.status===404?5:60)*6e4}catch{return!1}}function Nk(e,t){try{return u.default.writeFileSync(e,String(process.pid),{flag:`wx`}),!0}catch{}try{return t-u.default.statSync(e).mtimeMs<3e5?!1:(u.default.rmSync(e,{force:!0}),u.default.writeFileSync(e,String(process.pid),{flag:`wx`}),!0)}catch{return!1}}async function Pk(e){let t=Ak(e.platform,e.arch,e.version);if(!t||!Ck(e.version))return{status:`skipped`};let n=e.now??Date.now(),r=Dk(e.home,e.version),i=d.default.join(r,kk(e.version));if(jk(i))return{status:`present`};u.default.mkdirSync(r,{recursive:!0,mode:448});let a=d.default.join(r,`.failed`);if(!e.retry&&Mk(a,n))return{status:`skipped`,error:`the last download failed; it is retried later`};let o=d.default.join(r,`.lock`);if(!Nk(o,n))return{status:`skipped`,error:`another download is in progress`};let s=AbortSignal.timeout(e.timeoutMs??6e4);try{let n=process.env.RYUGI_HOOK_RELEASE_BASE||`https://github.com/Innei/ryugi/releases/download`;return Tk(i,await wk(t,e.version,n,e.fetch,s,e.onProgress)),u.default.rmSync(a,{force:!0}),{status:`installed`}}catch(t){let r=t.status??null;return u.default.writeFileSync(a,JSON.stringify({at:n,status:r})),{status:`failed`,error:s.aborted?`the download of ${kk(e.version)} ${e.version} timed out`:t.message}}finally{u.default.rmSync(o,{force:!0})}}const Fk=(e,t)=>d.default.resolve(e)===d.default.join(we(t),`server`),Ik=e=>e===`win32`?`adeck-daemon.exe`:`adeck-daemon`,Lk=(e,t)=>`adeck-daemon-${e}-${t}${e===`win32`?`.exe`:``}`,Rk=e=>d.default.join(d.default.dirname(e),d.default.basename(e).replace(/^adeck-daemon/,`ryugi-daemon`));function zk(e,t){Tk(e,t),u.default.rmSync(Rk(e),{force:!0})}function Bk(e){return Fk(e.serverHome,e.home)?d.default.join(we(e.home),`bin`,Ik(e.platform)):d.default.join(e.serverHome,`bin`,Ik(e.platform))}function Vk(e){let t=(0,p.spawnSync)(e,[`--version`],{encoding:`utf8`,timeout:5e3}),n=/^(?:adeck|ryugi)-daemon (\S+)(?: \(src ([^)]+)\))?/.exec(t.stdout??``);return t.status!==0||!n?null:{version:n[1],...n[2]?{source:n[2]}:{}}}const Hk=(e,t)=>!!e&&(t.daemonSource?e.source===t.daemonSource:e.version===t.version);async function Uk(e){let t=e.timeoutMs??18e4,n=AbortSignal.timeout(t);try{return await wk(Lk(e.platform,e.arch),e.version,e.env.RYUGI_DAEMON_RELEASE_BASE||`https://github.com/Innei/ryugi/releases/download`,e.fetch,n)}catch(e){throw n.aborted?Error(`the download timed out after ${t/1e3} s`,{cause:e}):e}}var Wk=class extends Error{};async function Gk(e,t){let n=e.env.RYUGI_DAEMON_BIN;if(n){if(!u.default.existsSync(n))throw new Wk(`RYUGI_DAEMON_BIN names ${n}, which does not exist`);return n}let r=Bk(e);if(!Ck(e.version)){let t=[d.default.join(e.cliDir,Ik(e.platform)),r].find(e=>u.default.existsSync(e));if(t)return t;throw new Wk(`This adeck is a local build (${e.version||`no version`}), so there is no adeck-daemon release to download for it. Build one with \`cargo build --manifest-path daemon/Cargo.toml\` and set RYUGI_DAEMON_BIN to it.`)}return u.default.existsSync(r)&&Hk(Vk(r),e)||(t?.(),zk(r,await Uk(e).catch(t=>{throw new Wk(`Could not download adeck-daemon ${e.version} for ${e.platform}-${e.arch}: ${t.message}. The hub runs from that binary and there is no other way to start it; check the network, or set RYUGI_DAEMON_BIN to a adeck-daemon build.`)}))),r}const Kk=e=>d.default.join(e,`settings.json`);function qk(e){try{let t=JSON.parse(u.default.readFileSync(Kk(e),`utf8`));return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}const Jk=e=>qk(e).sessionControl===!0;function Yk(e,t){u.default.mkdirSync(e,{recursive:!0,mode:448}),IC(Kk(e),{...qk(e),sessionControl:t})}const Xk=/^(RYUGI_|ARTIFACTS_|XDG_|LC_)|^(HOME|USER|LOGNAME|SHELL|LANG|TMPDIR|PATH|NODE_EXTRA_CA_CERTS|SSL_CERT_FILE|SSL_CERT_DIR)$|_proxy$|_PROXY$/,Zk=e=>d.default.join(e.home,`launch.json`),Qk=(e,t)=>[`hub`,`--artifacts-server-id=${e}`,...t?[`--port=${t}`]:[]];function $k(e,t){let n={...process.env,ARTIFACTS_HOST:e,ARTIFACTS_URL_HOST:t,RYUGI_NODE:process.execPath,RYUGI_DOCUMENT_ENGINE:d.default.join(__dirname,`document-engine.cjs`),RYUGI_VIEWER_DIR:d.default.join(__dirname,`viewer`),RYUGI_RUNTIME_ASSETS_DIR:d.default.join(__dirname,`runtime`),...re?{RYUGI_PACKAGE:re}:{}};process.env.RYUGI_ARTIFACTS_COMMAND&&(n.RYUGI_ARTIFACTS_LAUNCHER=process.env.RYUGI_ARTIFACTS_COMMAND);for(let e of[`RYUGI_WRITER_HOST`,`RYUGI_WRITER_AGENT`,`RYUGI_ARTIFACTS_OWNER`,`RYUGI_ARTIFACTS_VERSION`,`RYUGI_ARTIFACTS_COMMAND`,`ARTIFACTS_OPEN_CMD`,`ARTIFACTS_ROOT`])delete n[e];return n}function eA(e,t){let n=Object.fromEntries(Object.entries(t.env).filter(e=>Xk.test(e[0])&&e[1]!==void 0)),r=Zk(e),i=`${r}.${process.pid}.tmp`;u.default.writeFileSync(i,`${JSON.stringify({args:t.args,env:n},null,2)}\n`,{mode:384}),u.default.renameSync(i,r),u.default.rmSync(d.default.join(e.home,`hub-start-failures`),{force:!0})}function tA(e){try{let t=JSON.parse(u.default.readFileSync(Zk(e),`utf8`));return Array.isArray(t.args)&&t.env&&typeof t.env==`object`?{args:t.args,env:t.env}:null}catch{return null}}const nA=[`RYUGI_NODE`,`RYUGI_DOCUMENT_ENGINE`,`RYUGI_VIEWER_DIR`,`RYUGI_RUNTIME_ASSETS_DIR`];function rA(e,t){let n=tA(e);return!n||nA.some(e=>n.env[e]!==t[e])}function iA(e,t){let n=e.args.filter(e=>!e.startsWith(`--artifacts-server-id=`));return{...e,args:[n[0]??`hub`,`--artifacts-server-id=${t}`,...n.slice(1)]}}const aA=(e,t)=>{let n=(0,p.spawnSync)(e,t,{encoding:`utf8`});return{status:n.status,stderr:n.stderr||(n.error?.message??``),stdout:n.stdout??``}},oA=(e,t=aA)=>({configHome:process.env.XDG_CONFIG_HOME||void 0,home:m.default.homedir(),platform:process.platform,run:t,serverHome:e.home,uid:process.getuid?.()??0});function sA(e){if(!Fk(e.home,m.default.homedir()))return null;let t=pk(oA(e));return t&&!t.check()?t:null}const cA=e=>{let t=e?Number(e):NaN;return Number.isFinite(t)&&t>0?t:void 0};async function lA(e,t){try{return await Gk({arch:process.arch,cliDir:__dirname,daemonSource:w||void 0,env:process.env,fetch,home:m.default.homedir(),platform:process.platform,serverHome:e.home,timeoutMs:cA(process.env.RYUGI_DAEMON_DOWNLOAD_TIMEOUT_MS),version:t})}catch(e){throw e instanceof Wk?new j(e.message):e}}function uA(e,t){let n=sA(e);if(!n)return!1;let r=n.legacy();r&&Yk(e.home,!0);let i=r||Jk(e.home);try{return n.write({autostart:i,binary:t,launch:Zk(e),log:e.log,path:process.env.PATH??`/usr/bin:/bin`}),n.load(i),!0}catch{return!1}}const dA=1e4,fA=((e,t)=>{let n=process.env[e]?Number(process.env[e]):NaN;return Number.isFinite(n)&&n>=0?n:t})(`RYUGI_START_ALIVE_MS`,1e3),pA=(e,t)=>e.split(`
|
|
1232
|
+
`).find(e=>e.includes(`"${t}"`));async function mA(e,t,n,r){eA(e,n);try{u.default.renameSync(e.log,`${e.log}.1`)}catch{}let i;if(!uA(e,t)){let r=u.default.openSync(e.log,`w`),a=(0,p.spawn)(t,n.args,{env:n.env,detached:!0,windowsHide:!0,stdio:[`ignore`,r,r]});u.default.closeSync(r),a.unref(),i=a.pid,u.default.writeFileSync(e.pid,`${a.pid}\n`)}for(let t=0;t<dA;t+=100){let t=He(e.log)??``,n=pA(t,`server-started`);if(n){let t=JSON.parse(n),a=i??t.pid;a&&u.default.writeFileSync(e.pid,`${a}\n`);for(let e=0;e<fA;e+=100){if(a&&!Ie(a))throw new j(`Server started but was killed. Retry in a persistent terminal with: ${r}`);await Fe(100)}return{info:t}}let a=pA(t,`server-error`);if(a)return{failed:JSON.parse(a)};let o=pA(t,`server-standing-down`);if(o){let e=JSON.parse(o);return{failed:{type:`server-error`,error:`Another hub (pid ${e.pid}, port ${e.port}) already serves this machine; stop it and retry`}}}await Fe(100)}throw new j(`Server failed to start within ${dA/1e3} seconds`)}function hA(e){let t=eD(process.env,process.platform,m.default.homedir());if($E(t,ZE(process.env)))return;let n=d.default.join(d.default.dirname(t),`login-hint-shown`);try{u.default.mkdirSync(d.default.dirname(n),{recursive:!0,mode:448}),u.default.writeFileSync(n,`1
|
|
1233
|
+
`,{flag:`wx`,mode:384})}catch(e){if(e.code===`EEXIST`)return}return{message:`Recommended: sign in to Artideck Cloud to share artifacts and review them from other devices. Sign-in is optional; local work can continue.`,command:`${process.env.RYUGI_ARTIFACTS_COMMAND||`npx artideck`} publish --login --from hint`,projectDir:e,agentInstruction:`Briefly pass this recommendation to your human partner and offer to run command in projectDir. It prints a code and an address; they confirm the code on any device signed in to Artideck Cloud, such as their phone. Continue the current task without waiting for sign-in.`}}function gA(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 _A(e,t){let n=t?d.default.dirname(d.default.dirname(t.root)):e.projectDir,r=e.artifact?JE(n,e.artifact):void 0;return{cliVersion:`1.119.0`,serverVersion:He(XD().version),status:t?`running`:`stopped`,scope:`machine`,project:n,...r,...r?.content===`missing`?{writing:KE(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 vA({data:e}){return{heading:`Server`,status:e.status,subject:e.reused?`reused`:void 0,facts:[X(`Scope`,Y(e,`scope`)),X(`CLI version`,Y(e,`cliVersion`)),X(`Server version`,Y(e,`serverVersion`)),X(`Project`,Y(e,`project`),!0),...e.artifact?[X(`Artifact`,Y(e,`artifact`),!0)]:[],...e.write?[X(e.artifact?.startsWith(`document/`)?`Source`:`Write`,Y(e,`write`),!0),X(`Content`,Y(e,`content`),!0)]:[],...e.url?[X(`Open`,Y(e,`url`),!0)]:[],...e.localUrl&&e.localUrl!==e.url?[X(`Local`,Y(e,`localUrl`),!0)]:[],X(`Cloud`,Y(e,`cloud`))],sections:e.writing?[{kind:`content`,key:`writing`,title:`Writing`,text:e.writing}]:[]}}function yA(e,t){let n=e.artifact?.includes(`/`)?e.artifact.split(`/`)[0]:void 0,r=n&&Jv(n)?LE[n].onStart:void 0;r&&r(d.default.join(ve(d.default.dirname(d.default.dirname(t.root))),e.artifact));let i=t.cloudLimit?.upgradeUrl?[{kind:`url`,url:t.cloudLimit.upgradeUrl,label:`Upgrade`}]:[],a=_A(e,t);return e.artifact&&i.push(q([`check`,`--project-dir`,d.default.dirname(d.default.dirname(t.root)),`--artifact`,e.artifact],`Check`)),t.loginHint&&i.push(q([`publish`,`--login`,`--from`,`hint`,`--project-dir`,e.projectDir],`Sign in`)),J(a,void 0,{actions:i,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*bA(e,t){let n=[],r,i=!1,a,o,s,c=t.effects.begin(`start`,e.projectDir),l=e=>{n.push(e),r?.()},u=GA(e,{signal:t.signal,ready(n){o=n,t.effects.confirm(c,{reused:!!n.reused}),l({kind:`ready`,result:yA(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:J({..._A(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:J({..._A(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 xA(e,t=`start`){let n=gA(e);return n.library=t===`browse`,n.foreground?Z({id:t,mode:`live`,output:{formats:[`brief`,`jsonl`]},run:(e,t)=>bA(n,t),present:vA},e):Z({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 GA(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 yA(n,r)},present:vA},e)}const SA=e=>e.startsWith(`local-`),CA=e=>/^\d+\.\d+\.\d+$/.test(e)?e.split(`.`).map(Number):null;function wA(e,t){let n=CA(e),r=CA(t);if(!n||!r)return!1;for(let e=0;e<3;e++)if(n[e]!==r[e])return n[e]<r[e];return!1}function TA(e,t){return e&&t&&e===t?`keep`:SA(e)&&t&&!SA(t)||wA(t,e)?`protected`:`replace`}const EA=(e,t)=>{let n=process.env[e]?Number(process.env[e]):NaN;return Number.isFinite(n)&&n>=0?n:t},DA=EA(`RYUGI_START_SETTLE_MS`,6e3),OA=EA(`RYUGI_STOP_GRACE_MS`,7e3),kA=e=>ZE(e),AA=e=>{let t=new URL(e);return t.hostname===`localhost`&&(t.hostname=`127.0.0.1`),t},jA=(e,t)=>{let n=AA(e.url),r=new URL(t,n.origin),i=n.searchParams.get(`key`);return i&&r.searchParams.set(`key`,i),r.toString()};function MA(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=Lb(n),o=i.searchParams.get(`key`);r.link=`${i.origin}${LT(t.root,a.type,a.id)}${o?`?key=${o}`:``}`}return r}async function NA(e,t,n,r){if(!r)return e;try{let{url:i,limit:a}=await(await fetch(jA(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 PA(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 Fe(100)}return!1}function FA(e){let t=Number(He(e.pid)),n=He(e.serverId);return!Number.isInteger(t)||t<=0||!n?null:Be(t,n)?t:null}function IA(e){try{let t=JSON.parse(He(e.info)??``);return typeof t.url==`string`&&Number.isInteger(t.port)?t:null}catch{return null}}async function LA(e){try{return(await fetch(jA(e,`/api/status`),{signal:AbortSignal.timeout(5e3)})).ok}catch{return!1}}async function RA(e,t){try{process.kill(e,`SIGTERM`)}catch{}if(!await Ve(e,OA)){try{process.kill(e,`SIGKILL`)}catch{}if(!await Ve(e,2e3))throw new j(`The ${t} (pid ${e}) did not stop; stop it with \`${Qe()} stop\` and retry`)}}async function zA(){let e=hk();for(let t of yk(e)){if(Be(t.pid,t.serverId)){try{process.kill(t.pid,`SIGTERM`)}catch{}await Ve(t.pid,5e3)}try{bk(e,t)}catch{}}}function BA(e,t){if(!t||t.startsWith(`document/`))return;let n=Object.fromEntries(OO.flatMap(e=>process.env[e]?[[e,process.env[e]]]:[]));if(!Object.keys(n).length)return;let r=d.default.join(e.state,t);u.default.mkdirSync(r,{recursive:!0}),u.default.writeFileSync(d.default.join(r,`agent`),`${JSON.stringify(n)}\n`)}async function VA(e,t,n){let r=await fetch(jA(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 j(`The artifacts server refused this project: ${await r.text()}`)}async function HA(e,t){let n=XD({RYUGI_SERVER_HOME:e}),r=pk(t??oA(n)),i=[!0,!1].find(t=>{try{return u.default.readFileSync(r.file(t),`utf8`).includes(e)}catch{return!1}});r&&i!==void 0&&r.unload();let a=FA(n);return a&&await RA(a,`artifacts server`),i}async function UA(e,{env:t=process.env,home:n=m.default.homedir(),host:r}={}){let i=!1,a=await Ee({env:t,home:n,stopLegacyHub:async e=>{i=await HA(e,r??oA(XD({RYUGI_SERVER_HOME:e})))!==void 0}});return(a.status===`moved`||a.status===`merged`)&&e(a.conflicts.length?`Moved ~/.ryugi to ~/.artideck; ${a.conflicts.length} file(s) exist in both and stay in ~/.ryugi.`:`Moved ~/.ryugi to ~/.artideck.`),a.status===`failed`&&e(`Could not move ~/.ryugi to ~/.artideck: ${a.error}`),{...a,serviceStopped:i}}async function WA(){let e=XD();return uA(e,await lA(e,process.env.RYUGI_ARTIFACTS_VERSION||`1.119.0`))}async function GA(e,t){if(t.signal?.throwIfAborted(),e.artifact!==void 0&&!$e.test(e.artifact))throw new j(et);if(e.port!==void 0&&(!/^\d+$/.test(e.port)||Number(e.port)<1||Number(e.port)>65535))throw new j(`--port must be a port number`);e.urlHost||=e.host===`127.0.0.1`||e.host===`localhost`?`localhost`:e.host,process.umask(63),await UA(e=>t.log(e,`stderr`));let n=Ze(e.projectDir),r=XD();ZD(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`),`*
|
|
1234
|
+
`);let i=process.env.RYUGI_ARTIFACTS_VERSION||`1.119.0`,a=$D(r.projects).some(e=>e.dir===n.project),o=async(r,i)=>{BA(n,e.artifact);let o=e.open&&!e.library&&(!i||!a);await VA(r,n,o?e.artifact??!0:void 0);let s=MA(r,n,e.artifact);i&&(s.reused=!0);let c=await NA(s,r,n,e.artifact),l=hA(n.project);if(t.signal?.throwIfAborted(),e.library&&e.open&&(process.env.ARTIFACTS_OPEN_CMD?await new Promise(e=>(0,p.execFile)(process.env.ARTIFACTS_OPEN_CMD,[r.url],()=>e())):await $O(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 $O(typeof c.cloudLink==`string`?c.cloudLink:e,[e]).catch(e=>t.log(e.message,`stderr`))}};if(!await PA(r.lock))throw new j(`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=FA(r),s=IA(r),l=null;if(a&&!s){for(let e=0;e<DA&&Ie(a)&&!s;e+=100)await Fe(100),s=IA(r);!s&&Ie(a)&&(l={label:`stopping artifacts server`,pid:a,reasons:[`no-info`],running:He(r.version)??``})}if(a&&s){let t=He(r.version)??``,n=TA(t,i),u=[...n===`keep`?[]:[`version`],...(s.host??`127.0.0.1`)===e.host?[]:[`host`],...(s.urlHost??`localhost`)===e.urlHost?[]:[`urlHost`],...(s.cloudOrigin??`https://artideck.dev`)===kA(process.env)?[]:[`cloudOrigin`],...e.port!==void 0&&String(s.port)!==e.port?[`port`]:[],...rA(r,$k(e.host,e.urlHost))?[`launch`]:[]],d={pid:a,running:t,cli:i},f=n===`protected`||u.length===0;if(f&&await LA(s))return u.length&&YO(r,{...d,action:`kept`,reasons:u}),c(),await o(s,!0),0;l={label:`running artifacts server`,pid:a,reasons:f?[...u,`unanswered`]:u,running:t}}let d=await lA(r,i);l&&(YO(r,{action:`replaced`,cli:i,pid:l.pid,reasons:l.reasons,running:l.running}),await RA(l.pid,l.label)),await zA(),u.default.rmSync(r.info,{force:!0});let m=f.default.randomBytes(24).toString(`hex`);u.default.writeFileSync(r.serverId,`${m}\n`),u.default.writeFileSync(r.version,`${i}\n`);let h={args:Qk(m,e.port),env:$k(e.host,e.urlHost)};if(e.foreground){eA(r,h);let e=(0,p.spawn)(d,h.args,{env:h.env,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);g.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;g.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)}}let _=await mA(r,d,h,`${Qe()} start --project-dir ${n.project}${e.artifact?` --artifact ${e.artifact}`:``} --host ${e.host} --url-host ${e.urlHost} --foreground`);return`failed`in _?(t.failure(_.failed),1):(c(),await o(_.info,!1),0)}finally{c()}}const KA={semantic:xA,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`}}};async function qA(e,t,n,r,i){u.default.mkdirSync(d.default.dirname(e),{recursive:!0});let a=d.default.join(d.default.dirname(e),`.`+d.default.basename(e)),o=a+`.`+(0,f.randomUUID)()+`.tmp`,s=a+`.write-lock`;if(!await PA(s))throw new j(`Another document save is in progress. Retry after it finishes.`);try{let r=null;try{r=u.default.readFileSync(e,`utf8`)}catch(e){if(e.code!==`ENOENT`)throw e}if(r?.trimEnd()!==t?.trimEnd())throw new j(`Document changed since the base; nothing was saved.`);if(n===r)return;r===null&&de(d.default.dirname(e));let i=r?.match(/^\s*<doc (ryugi-attribution="[A-Za-z0-9_-]+")(?=[\s>])/),a=n.replace(/^(\s*<doc) ryugi-attribution="[A-Za-z0-9_-]+"(?=[\s>])/,`$1`);u.default.writeFileSync(o,i?a.replace(/^(\s*<doc)/,`$1 ${i[1]}`):a,{mode:r===null?384:u.default.statSync(e).mode&511}),u.default.renameSync(o,e)}finally{u.default.rmSync(o,{force:!0}),u.default.rmdirSync(s)}}const JA={hidden:!0,name:`write-document`,summary:`Save a document revision with the calling agent’s attribution`,usage:[`--artifact document/<id> --input <edited.xml> [--base <original.xml>]`],options:{artifact:{type:`string`,help:`Document to create or edit`},base:{type:`string`,help:`Unedited copy from before the edit (omit for creation)`},input:{type:`string`,help:`Edited copy of the LiteXML file`}},semantic:e=>Z({id:`write-document`,mode:`finite`,output:{formats:[`brief`,`json`],fields:[`artifact`,`author`]},run:async()=>{let{artifact:t,base:n,input:r}=e.values;if(typeof t!=`string`||!t.startsWith(`document/`)||!$e.test(t)||typeof r!=`string`)throw new j(`Supply --artifact document/<id> and --input <file>.`);let i=NO(process.env);if(!i)throw new j(`No agent identity in the writing process environment.`);await qA(d.default.join(Je(e.projectDir).root,t,`doc.xml`),typeof n==`string`?u.default.readFileSync(n,`utf8`):null,u.default.readFileSync(r,`utf8`),i,BO(i,process.env));let a;try{a=(await WO({artifact:t,projectDir:e.projectDir})).json.attribution}catch(e){a={status:`unavailable`,message:e.message}}return J({artifact:t,author:i},void 0,{warnings:a?.status===`unavailable`?[{code:`W_ATTRIBUTION`,message:a.message??`Attribution was not recorded`}]:[]})},present:({data:e})=>({heading:`Document`,status:`SAVED`,subject:e.artifact,summary:e.author,facts:[],sections:[]})},e)},YA=[`desktop`,`laptop`,`tablet`,`mobile`],XA=/* @__PURE__ */ new Set([`localhost`,`127.0.0.1`,`[::1]`,`::1`]),ZA=4096;function QA(e){if(typeof e!=`string`)return null;let t=e.trim();if(!t||t.length>256)return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol!==`http:`||n.username||n.password||n.search||n.hash||n.pathname!==`/`&&n.pathname!==``)return null;let r=n.hostname.toLowerCase();if(!XA.has(r))return null;let i=n.port?Number(n.port):80;return!Number.isInteger(i)||i<1||i>65535?null:{origin:n.origin,host:n.host,hostname:r===`[::1]`?`::1`:r,port:i}}function $A(e){let t=e.trim();if(!t||t.length>1024)return null;let n=/^https?:\/\//i.test(t)?t:`http://${t}`,r;try{r=new URL(n)}catch{return null}let i=QA(r.origin);if(!i)return null;let a=`${r.pathname||`/`}${r.search}${r.hash}`;return{url:i.origin,path:a}}function ej(e){if(typeof e==`string`)return YA.includes(e)?e:null;if(typeof e==`object`&&e&&!Array.isArray(e)){let{w:t,h:n}=e;if(typeof t==`number`&&typeof n==`number`&&Number.isInteger(t)&&Number.isInteger(n)&&t>=240&&t<=ZA&&n>=240&&n<=ZA)return{w:t,h:n}}return null}function tj(e){if(typeof e!=`string`)return null;let t=e.trim();return!t||t.length>2e3||!t.startsWith(`/`)||t.startsWith(`//`)?null:t}function nj(e){let t;try{t=JSON.parse(e)}catch(e){return{config:null,issues:[`preview.json is not valid JSON: ${e.message}`]}}if(typeof t!=`object`||!t||Array.isArray(t))return{config:null,issues:[`preview.json must be a JSON object`]};let n=t,r=[];n.version!==1&&r.push(`preview.json requires version: 1`);let i=QA(n.url);i||r.push(`preview.json url must be a local loopback http origin (e.g. http://localhost:5173 or http://127.0.0.1:3000)`);let a;n.title!==void 0&&(typeof n.title!=`string`||!n.title.trim()||n.title.length>200?r.push(`preview.json title must be a non-empty string (<= 200 chars)`):a=n.title.trim());let o;if(n.path!==void 0){let e=tj(n.path);e?o=e:r.push(`preview.json path must start with "/" (and not "//")`)}let s;if(n.viewport!==void 0){let e=ej(n.viewport);e?s=e:r.push(`preview.json viewport must be one of ${YA.join(`, `)} or { w, h } (240..${ZA})`)}return r.length>0||!i?{config:null,issues:r}:{config:{version:1,url:i.origin,...a?{title:a}:{},...o?{path:o}:{},...s?{viewport:s}:{}},issues:[]}}const rj=`preview.json`,ij=/^[a-z0-9][a-z0-9-]{0,63}$/;function aj(e){return d.default.join(d.default.dirname(e),`preview`)}function oj(e,t){return ij.test(t)?d.default.join(aj(e),t):null}function sj(e){let t=aj(e),n;try{n=u.default.readdirSync(t)}catch{return[]}let r=[];for(let e of n){if(!ij.test(e))continue;let n=d.default.join(t,e);u.default.existsSync(d.default.join(n,rj))&&r.push({id:e,payload:cj(n,e)})}return r}function cj(e,t,n){let r=d.default.join(e,rj),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}=nj(i);return{title:o?.title||t,version:a,config:o,issues:s,warnings:s,proxyUrl:n??null}}function lj(e,t){u.default.mkdirSync(e,{recursive:!0}),IC(d.default.join(e,rj),t)}function uj(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 dj(e,t=800){let n=QA(e);if(!n)return!1;if(n.hostname!==`localhost`)return uj(n.hostname,n.port,t);let r=await Promise.all([uj(`127.0.0.1`,n.port,t),uj(`::1`,n.port,t)]);return r[0]||r[1]}function fj(e){let t=typeof e==`string`&&e.trim()?e.trim():`dev`;if(!ij.test(t))throw new j(`Preview --id must use lowercase letters, digits, and hyphens.`);return t}function pj(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 mj({data:e}){return{heading:`Preview ${e.action}`,status:e.action===`open`?`ready`:`ok`,subject:e.id?`preview/${e.id}`:void 0,facts:[...e.url?[X(`Target`,{key:`url`,value:e.url})]:[],...e.upstreamAlive===void 0?[]:[X(`Upstream`,{key:`upstreamAlive`,value:e.upstreamAlive?`online`:`offline`})],...e.open?[X(`Open`,{key:`open`,value:e.open},!0)]:[],...e.receipt?[X(`Receipt`,{key:`receipt`,value:e.receipt})]:[]],sections:e.lines.length?[{kind:`content`,key:`lines`,text:e.lines.join(`
|
|
1235
|
+
`)}]:[]}}const hj={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] [--agent <name>]`,`reply --thread <id> --text <message> [--id dev] [--agent <name>]`,`resolve --thread <id> [--id dev] [--agent <name>]`,`ack --receipt <id> [--id dev] [--agent <name>]`],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=>Z({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=Je(e.projectDir);if(r===`list`){let e=sj(i.root);return J({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=fj(e.values.id),r=e.values.url;if(!r)throw new j(`Pass --url http://localhost:<port>`);let a=$A(r);if(!a)throw new j(`--url must be a local loopback http URL (e.g. http://localhost:5182)`);let o=oj(i.root,t),s=null;try{s=nj(u.default.readFileSync(d.default.join(o,`preview.json`),`utf8`)).config}catch{}lj(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 GA({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 j(String(e.error??`Failed to start Hub`))},log(e){n.diagnostic(e)}})!==0||!c)throw new j(`Hub did not start.`);let l=`${new URL(c).origin}/preview/${encodeURIComponent(t)}?project=${encodeURIComponent(i.project)}`,f=await dj(a.url);return J({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=fj(e.values.id),o=rO(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,all:!!e.values.all,agent:s},n.signal);if(t.status<200||t.status>=300)throw new j(t.json?.error||`HTTP ${t.status}`);let r=Array.isArray(t.json?.items)?t.json.items:[];return J({action:`comments`,id:a,lines:r.length?r.flatMap(pj):[`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 j(`Pass --thread <id> for preview ${r}`);let i=e.values.text;if(r===`reply`&&!i?.trim())throw new j(`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 j(c.json?.error||`HTTP ${c.status}`);return J({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 j(`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 j(r.json?.error||`HTTP ${r.status}`);return J({action:`ack`,id:a,receipt:t,lines:[`Acknowledged receipt ${t}`]})}throw new j(`Unknown preview action "${r}". Use open, list, comments, reply, resolve, or ack.`)},present:mj},e)},gj=/^report\/[a-z0-9][a-z0-9-]*$/,_j=e=>typeof e==`object`&&!!e&&Array.isArray(e.sources),vj=({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`}`),yj={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=>Z({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 j(`usage: ryugi report refresh --artifact report/<id>`);let r=e.values.artifact;if(!r||!gj.test(r))throw new j(`--artifact must be report/<id>`);let i=e.values.only,a=await rO(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 j(a.json?.error||`HTTP ${a.status}`);if(!_j(a.json))throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an invalid refresh report.`});let o={...a.json,artifact:r,lines:vj(a.json)},s=o.sources.filter(e=>!e.ok);return J(o,s.length?s.length===o.sources.length?{kind:`failed`,error:{code:`E_REPORT_SOURCE_FAILED`,message:vj({sources:s}).join(`; `)}}:{kind:`partial`}:{kind:`succeeded`})},present:bj},e)};function bj({data:e}){return{heading:`Refresh`,status:e.sources.every(e=>e.ok)?``:`failed`,subject:e.artifact??``,facts:[X(`Sources`,{key:`sources`,value:String(e.sources.length)})],sections:[{kind:`content`,key:`lines`,text:(e.lines??vj(e)).join(`
|
|
1236
1236
|
`)},...e.issues?.length?[{kind:`content`,key:`issues`,text:e.issues.join(`
|
|
1237
|
-
`)}]:[]]}}const
|
|
1238
|
-
`)}]}}const
|
|
1239
|
-
`)}]}}const Nj={threads:[`id`,`status`,`waitingOn`,`anchor`,`stale`,`changes`,`messages`,`preview`,`messageCount`,`omittedMessages`],asks:[`id`,`state`,`choice`,`text`,`byRecommendation`,`staleChoice`,`note`],groups:[`id`,`kind`,`verdict`,`choice`,`by`,`byRecommendation`,`round`,`threads`,`evidenceUpdated`,`rejectThreads`,`title`,`from`,`capturedAt`],rounds:[`id`,`state`,`title`,`groups`,`submitted`]},Pj={threads:[`id`,`status`,`waitingOn`],asks:[`id`,`state`],groups:[`id`,`kind`,`verdict`,`choice`],rounds:[`id`,`state`]},Fj=e=>e.startsWith(`document/`)?[`threads`,`asks`]:[`threads`,`groups`,`rounds`];function Ij(e,t){return e.section?`Choose section or sections, not both.`:!e.sections.length||new Set(e.sections).size!==e.sections.length||e.sections.some(e=>!Fj(t).includes(e))?`Choose distinct review sections supported by this artifact.`:e.fields||e.cursor||e.snapshot||e.thread||e.filters&&Object.values(e.filters).some(e=>e!==void 0)?`Fields, filters, thread, cursor and snapshot require a single --section. Follow each collection continuation separately.`:null}function Lj(e){let{section:t,filters:n}=e;if(!t&&(e.detail||e.cursor||e.fields||n&&Object.values(n).some(Boolean)))return`Choose a section before requesting detail, fields, filters or a cursor.`;if(t&&!(t in Nj))return`Unknown review section.`;if(n&&Object.keys(n).some(e=>![`status`,`waitingOn`,`kind`,`choiceState`].includes(e)))return`Unknown review filter.`;if(n?.waitingOn&&(t!==`threads`||![`agent`,`human`,`any`].includes(n.waitingOn)))return`waitingOn applies to threads and must be agent, human or any.`;let r=t===`threads`?[`open`,`resolved`]:t===`asks`?[`draft`,`submitted`,`settled`,`orphan`]:t===`groups`?[`pending`,`pass`,`reject`]:[`open`,`submitted`,`closed`];return n?.status&&!r.includes(n.status)?`Invalid status for this section.`:n?.kind&&(t!==`groups`||![`choose`,`verify`].includes(n.kind))?`kind applies to groups.`:t===`groups`&&n?.status&&n.kind!==`verify`?`Verify status requires kind=verify.`:n?.choiceState&&(t!==`groups`||n.kind!==`choose`||![`chosen`,`empty`].includes(n.choiceState))?`choiceState requires a choice group.`:t&&e.fields?.some(e=>!Nj[t].includes(e))?`Unknown field for this section.`:null}function Rj(e,t,n){let r=d.default.resolve(e),i=n?.begin(`save`,r),a;try{a=u.default.openSync(r,`wx`,384)}catch(e){throw i!==void 0&&n.set(i,`failed`),new K({code:e.code===`EEXIST`?`E_FILE_EXISTS`:`E_FILE_WRITE_FAILED`,message:`Could not create ${r}: ${e.message}`})}try{u.default.writeFileSync(a,t)}catch(e){throw u.default.closeSync(a),u.default.unlinkSync(r),i!==void 0&&n.set(i,`failed`),new K({code:`E_FILE_WRITE_FAILED`,message:`Could not save ${r}: ${e.message}`})}return u.default.closeSync(a),i!==void 0&&n.confirm(i,{bytes:typeof t==`string`?Buffer.byteLength(t):t.byteLength}),{file:r,bytes:typeof t==`string`?Buffer.byteLength(t):t.byteLength}}function zj(e,t,n,r,i){let a=[`--artifact`,t,`--project-dir`,e.projectDir];if(n.evidence===`preview`&&n.items.length&&n.snapshot){let t=i.findIndex(e=>e.label===`Read`),o=[`status`,`waiting-on`,`kind`,`choice-state`].flatMap(t=>typeof e.values[t]==`string`?[`--${t}`,String(e.values[t])]:[]),s={...q([`comment`,`list`,...a,`--section`,`threads`,`--detail`,`--snapshot`,n.snapshot,`--limit`,String(r?.returned??n.items.length),...typeof e.values.cursor==`string`?[`--cursor`,e.values.cursor]:[],...o,...e.values.all?[`--all`]:[]],`Read`),reason:`Read the complete captured page before acting. Previews mark nothing read.`};t<0?i.push(s):i.splice(t,1,s)}let o=i.findIndex(e=>e.label===`Acknowledge`);o>=0&&i.splice(o,1)}const Q=e=>typeof e==`string`?e:``,Bj=e=>e.replaceAll(/\s*\n\s*/g,` / `).trim(),Vj=(e,t)=>`${e} ${t}${e===1?``:`s`}`,Hj=e=>e[0].toUpperCase()+e.slice(1),Uj=(e,t=[])=>Object.entries(e??{}).filter(([e,n])=>e!==`waitingOnAgent`&&!t.includes(e)&&typeof n==`number`&&n>0).map(([e,t])=>`${t} ${e}`).join(`, `),Wj=e=>e?` (${e})`:``,Gj={asks:{word:`to apply`,none:`nothing to apply`,listed:[`submitted`]},groups:{word:`to act on`,none:`nothing to act on`,listed:[]},rounds:{word:`open or submitted`,none:`nothing open`,listed:[`open`,`submitted`]}};function Kj(e,t,n,r=!1){let i=n?.total??t.items.length,a=t.summary;if(r){let e=`${i} matched`;return{head:e,full:`${e}${Wj(Uj(a))}`,count:i}}if(e===`threads`){let e=Number(a?.waitingOnAgent??0),t=i?`${i} unread${e?`, ${e} waiting on you`:``}`:`nothing unread`,n=Number(a?.resolved??0);return{head:t,full:`${t}${n?` (${n} resolved)`:``}`,count:i}}let o=Gj[e],s=i?`${i} ${o.word}`:o.none,c=e===`groups`?Object.entries(a??{}).reduce((e,[t,n])=>t===`waitingOnAgent`||typeof n!=`number`?e:e+n,0)-i:0,l=e===`groups`?c>0?Vj(c,`other`):``:Uj(a,o.listed);return{head:s,full:`${s}${Wj(l)}`,count:i}}function qj(e){if(!e||typeof e!=`object`)return``;let t=e;if(t.kind===`node`)return` node ${Q(t.id)}`;if(t.kind!==`edge`)return``;let n=typeof t.index==`number`&&t.index>0?` #${t.index+1}`:``;return` edge ${Q(t.from)} → ${Q(t.to)}${n}`}function Jj(e){let t=e.snapshot&&typeof e.snapshot==`object`?e.snapshot:{},n=Q(t.tag),r=Q(t.title),i=e.point&&typeof e.point==`object`?e.point:null,a=t.value===void 0?``:` = ${Bj(JSON.stringify(t.value))}`,o=i?` · point ${Q(i.series)} @ ${String(i.x)}${a}`:typeof e.row==`string`?` · row ${e.row}${typeof t.value==`object`?``:a}`:``;return`${n?`${n} `:``}${String(e.block)}${r?` "${Bj(r)}"`:``}${o}${e.dataChanged?` · data changed`:``}`}const Yj=e=>{let t=Math.round(e*10),n=Math.floor(t/10);return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}.${t%10}`};function Xj(e){let t=Q(e.title);return`${e.deleted?`shot ${String(e.shot)} (shot deleted)`:`shot ${typeof e.number==`number`?`${e.number} `:``}${String(e.shot)}${t?` "${Bj(t)}"`:``}`}${typeof e.t==`number`?` · ${typeof e.cut==`number`?`cut ${e.cut} `:``}at ${Yj(e.t)}`:``}${typeof e.line==`string`?` · line ${e.line}${Q(e.lineText)?` "${Bj(Q(e.lineText))}"`:``}`:``}${e.mark?` · marked`:``}${Q(e.cropPath)?` · crop ${Q(e.cropPath)}`:``}`}function Zj(e){if(!e||typeof e!=`object`)return``;let t=e;if(typeof t.blockId==`string`){let e=Array.isArray(t.blockIds)&&t.blockIds.length>1?t.blockIds:[t.blockId];return`${e.length>1?`blocks`:`block`} ${e.join(`, `)}${qj(t.diagram)}${Q(t.quote)?` "${Bj(Q(t.quote))}"`:``}`}if(Array.isArray(t.elements)&&t.elements.length)return`element ${t.elements.join(`, `)}`;if(typeof t.block==`string`)return Jj(t);if(typeof t.shot==`string`)return Xj(t);if(typeof t.slide==`string`){let e=Q(t.title),n=Q(t.text),r=Array.isArray(t.nodes)?t.nodes:[],i=r.length?` · ${r.length} node${r.length===1?``:`s`}: ${r.map(e=>`${Q(e.tag)} ${Q(e.block)} "${Bj(Q(e.text))}"`).join(`, `)}`:``;return`slide ${t.slide}${e?` "${Bj(e)}"`:``}${i||(n?` · on "${Bj(n)}"`:``)}`}let n=Q(t.page);if(typeof t.board==`string`)return`${n?`page ${n} `:``}board ${t.board}`;let r=typeof t.x==`number`&&typeof t.y==`number`?` ${Math.round(t.x)},${Math.round(t.y)}`:``;return`page ${n||`main`}${r}`}const Qj={key:`id`,positional:!0,required:!0},$j={key:`line`,positional:!0,required:!0},eM={key:`tail`,positional:!0,required:!0},tM=e=>e.choice?` → ${e.choice}${e.byRecommendation?` (recommended)`:``}`:``;function nM(e,t){return e===`asks`?{columns:[Qj,$j,{key:`note`,label:`note`},{key:`staleChoice`,label:`stale choice`}],rows:t.map(e=>({...e,line:`${Q(e.state)}${e.choice?tM(e):Q(e.text)?` · "${Bj(Q(e.text))}"`:`choice`in e||`text`in e?` · no answer`:``}`,note:Q(e.note)&&`"${Bj(Q(e.note))}"`}))}:e===`threads`?{columns:[Qj,{key:`status`,positional:!0,required:!0},{key:`waiting`,positional:!0},{key:`where`,positional:!0},{key:`marked`,label:`marked`},{key:`stale`,label:`stale`},{key:`orphan`,label:`orphan`},{key:`messageCount`,positional:!0},{key:`preview`,positional:!0}],rows:t.map(e=>({...rM(e),messageCount:typeof e.messageCount==`number`&&e.messageCount?Vj(e.messageCount,`message`):``,preview:Q(e.preview)&&`"${Bj(Q(e.preview))}"`}))}:e===`groups`?{columns:[Qj,{key:`kind`,positional:!0,required:!0},$j,{key:`origin`,positional:!0},{key:`evidenceUpdated`,label:`evidence updated`},{key:`rejects`,positional:!0},{key:`threadCount`,positional:!0},eM],rows:t.map(e=>({...e,line:e.kind===`verify`?Q(e.verdict):`${e.round?`round ${e.round}`:``}${e.choice?tM(e):` · no pick`}`.replace(/^ · /,``),origin:typeof e.from==`string`&&e.from?`from ${e.from}`:``,rejects:typeof e.rejectThreads==`number`&&e.rejectThreads?Vj(e.rejectThreads,`reject thread`):``,threadCount:typeof e.threads==`number`&&e.threads?Vj(e.threads,`thread`):``,tail:Q(e.title)}))}:{columns:[Qj,{key:`state`,positional:!0,required:!0},{key:`groupList`,positional:!0},eM],rows:t.map(e=>({...e,groupList:Array.isArray(e.groups)&&e.groups.length?`groups ${e.groups.join(`, `)}`:``,tail:Q(e.title)}))}}function rM(e){return{id:e.id,status:e.status,waiting:e.waitingOn?`waiting on ${e.waitingOn}`:``,where:Zj(e.anchor&&typeof e.anchor==`object`&&typeof e.page==`string`?{page:e.page,...e.anchor}:e.anchor),marked:Array.isArray(e.marked)?e.marked.map(Q).filter(Boolean).join(`; `):``,reject:e.anchor?.verdict===`reject`,stale:e.stale===!0,orphan:e.orphan===!0}}const iM=e=>e.status===`open`?[`reply --thread ${String(e.id)} --text <message>`,...e.reject?[]:[`resolve --thread ${String(e.id)}`]].join(`, `):``,aM=(e,t)=>({label:e,binding:{key:e,value:t},positional:!0});function oM(e,t=`items`,n=!0){return{kind:`messages`,key:t,groups:e.map(e=>{let t=rM(e);return{facts:[aM(`id`,t.id),aM(`status`,t.status),aM(`waiting`,t.waiting),aM(`where`,t.where),{label:`marked`,binding:{key:`marked`,value:t.marked}},{label:`reject`,binding:{key:`reject`,value:t.reject}},{label:`stale`,binding:{key:`stale`,value:t.stale}},{label:`orphan`,binding:{key:`orphan`,value:t.orphan}},aM(`spentBy`,n?iM(t):``)],messages:(Array.isArray(e.messages)?e.messages:[]).map(e=>({facts:[aM(`message`,[e.id,`${Q(e.name)||Q(e.author)}${e.author===`agent`?` (agent)`:``}`,Q(e.at)&&rO(Q(e.at)),e.deleted?`(deleted)`:``,Q(e.editedAt)&&`edited ${rO(Q(e.editedAt))}`].filter(Boolean).join(` `))],text:typeof e.text==`string`?e.text:``}))}})}}function sM(e,t,n,r,i){let a=Kj(e,t,n,i),o={key:r?e:`items`,title:Hj(e),summary:a.full};return e===`threads`&&t.evidence===`complete`?{...oM(t.items),...o,...r?{page:n}:{}}:{kind:`records`,...nM(e,t.items),...o,...r?{page:n}:{}}}const cM=[`threads`,`asks`,`groups`,`rounds`];function lM(e,t){let n=e.summary??{},r=e=>t.find(t=>t.label===Hj(e)),i=cM.filter(e=>r(e));return{heading:`Comment list`,status:``,subject:e.artifact,facts:[],sections:i.map(e=>{let t=n[e],r=e===`threads`?Kj(`threads`,{items:[],summary:{waitingOnAgent:n.waitingOnAgent}},{total:Number(t??0)}).head:Uj(t)||`none`;return{kind:`records`,key:e,title:Hj(e),summary:r,columns:[],rows:[]}}),actions:t.filter(e=>!i.some(t=>Hj(t)===e.label))}}function uM({data:e,actions:t,coverage:n},r=`Comment list`,i=!1){if(e.section===`summary`)return lM(e,t);let a=n.page;return{heading:r,status:``,subject:e.artifact,summary:Kj(e.section,e,a,i).head,facts:[...e.evidence===`preview`&&e.snapshot&&e.items.length?[X(`Snapshot`,Y(e,`snapshot`))]:[],...e.delivery?[X(`Delivery`,Y(e,`delivery`))]:[],...e.receipt&&!e.delivery?[X(`Receipt`,Y(e,`receipt`))]:[]],sections:[sM(e.section,e,a,!1,i)]}}function dM({data:e},t=!1){let n=Object.entries(e.sections),r=n.map(([e,n])=>Kj(e,n,n.page,t)).filter(e=>e.count>0).map(e=>e.head);return{heading:`Comment list`,status:``,subject:e.artifact,summary:r.join(` · `)||`nothing new`,facts:[],sections:n.map(([e,n])=>sM(e,n,n.page,!0,t))}}const $=(e,t)=>typeof e.values[t]==`string`?e.values[t]:void 0,fM=[`brief`,`table`,`json`,`jsonl`,`raw`];function pM(e,t=!1){let n=$(e,`artifact`),r=t?FE:PE;if(!n||!LE(r).test(n))throw new K({code:`E_ARGUMENT_INVALID`,message:`--artifact must be ${RE(r)}.`});return n}function mM(e){let t=$(e,`limit`);if(t!==void 0&&(!/^\d+$/.test(t)||Number(t)<1||Number(t)>100))throw new K({code:`E_ARGUMENT_INVALID`,message:`--limit must be between 1 and 100.`});return{...t===void 0?{}:{limit:Number(t)},...$(e,`cursor`)?{cursor:$(e,`cursor`)}:{},...$(e,`snapshot`)?{snapshot:$(e,`snapshot`)}:{},all:!!e.values.all,detail:!!e.values.detail||!!e.values.save,...e.values.hold?{hold:!0}:{},...$(e,`fields`)?{fields:$(e,`fields`).split(`,`).map(e=>e.trim())}:{}}}function hM(e,t){let n=TO(t);return{...e,agent:DO(t)??`Agent`,...n?{session:n}:{}}}async function gM(e,t,n,r,i){let a=await ZD(e.projectDir).call(`POST`,`/api/agent/v1/${n}/${r}`,hM(i,process.env),t.signal);if(t.payloads.raw=a.raw,a.json.schema!==`ryugi.review/v1`)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported review response.`});if(a.status<200||a.status>=300)throw new K({code:typeof a.json.code==`string`?a.json.code:`E_REVIEW_FAILED`,message:a.json.error||`HTTP ${a.status}`,httpStatus:a.status});return a.json}const _M=/* @__PURE__ */ new Set([`artboard`,`document`,`preview`,`report`,`slides`,`storyboard`,`whiteboard`]);async function vM(e,t,n,r,i){if(!_M.has(t.split(`/`)[0]??``))return null;let a=await ZD(e).call(`POST`,`/api/agent/v1/${t}/review`,hM({op:`consume`,thread:n,resolve:r},process.env),i);if(a.json.code===`E_UNDELIVERED`||a.json.code===`E_REJECT_OPEN`)throw new K({code:a.json.code,message:String(a.json.error),httpStatus:a.status});return a.status<200||a.status>=300?{failed:String(a.json.error||`HTTP ${a.status}`)}:typeof a.json.unread==`number`?{consumed:Number(a.json.consumed),unread:a.json.unread}:null}function yM(e,t){return[`--artifact`,t,`--project-dir`,e.projectDir]}function bM(e,t,n){let r=/* @__PURE__ */ new Set([...Object.keys(jD),`artifact`,`receipt`]),i=Object.keys(e.values).find(e=>!r.has(e));if(i)throw new K({code:`E_ARGUMENT_INVALID`,message:`--${i} is not supported for ack.`});let a=$(e,`receipt`);if(!a)throw new K({code:`E_ARGUMENT_INVALID`,message:`ack requires --receipt.`});return Z({id:n===`review`?`comment.ack`:`changes.ack`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.receipt},async run(r,i){ZD(e.projectDir);let o=i.effects.begin(n===`review`?`comment.ack`:`changes.ack`,a),s=await gM(e,i,t,n,{op:`ack`,receipt:a});if(![`acknowledged`,`unchanged`].includes(s.status))throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported acknowledgement result; inspect unread state before retrying.`});return i.effects.set(o,s.status===`unchanged`?`none`:`confirmed`,{artifact:t}),J({artifact:t,receipt:a,status:s.status})},present:CM(n===`review`?`comment`:`changes`)},e)}function xM(e,t){let n=$(e,`receipt`);if(!n)throw new K({code:`E_ARGUMENT_INVALID`,message:`deliver requires --receipt.`});return Z({id:`comment.deliver`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.receipt},async run(r,i){ZD(e.projectDir);let a=i.effects.begin(`comment.deliver`,n);if((await gM(e,i,t,`review`,{op:`deliver`,receipt:n})).status!==`delivered`)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported delivery result.`});return i.effects.confirm(a,{artifact:t}),J({artifact:t,receipt:n,status:`delivered`})},present:CM(`comment`)},e)}function SM(e,t,n){if(n!==`list`)throw new K({code:`E_ARGUMENT_INVALID`,message:`--sections applies to comment list.`});let r=mM(e),i=$(e,`sections`)?.trim(),a=i===`all`?Fj(t):(i??``).split(`,`).map(e=>e.trim()),o=Object.fromEntries([`status`,`waiting-on`,`kind`,`choice-state`].map(t=>[t,$(e,t)])),s=Ij({...r,sections:a,section:$(e,`section`),thread:$(e,`thread`),filters:o},t);if(s)throw new K({code:`E_ARGUMENT_INVALID`,message:s});return Z({id:`comment.list`,mode:`finite`,output:{formats:fM,detail:!0},async run(n,i){let o=await gM(e,i,t,`review`,{op:`list`,sections:a,...r});for(let e of a){let t=o.sections?.[e];if(!t||!Array.isArray(t.items)||typeof t.snapshot!=`string`||!t.page||typeof t.page.scope!=`string`||typeof t.page.hasMore!=`boolean`||!Number.isInteger(t.page.returned)||!(t.page.total===null||Number.isInteger(t.page.total)))throw new K({code:`E_SERVER_UPGRADE_REQUIRED`,message:`The server does not provide combined review pages. Run start --background for this project to rebuild/restart it.`});if(t.page.returned!==t.items.length||t.page.returned<0||t.page.total!==null&&t.page.total<t.page.returned||t.page.snapshot!==t.snapshot||t.page.nextCursor!==null&&typeof t.page.nextCursor!=`string`||t.page.hasMore!==(typeof t.page.nextCursor==`string`&&t.page.nextCursor.length>0))throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned inconsistent combined review coverage.`})}return TM(e,t,a,o,r)},present:e=>dM(e,r.all)},e)}const CM=e=>({data:t})=>({heading:e===`comment`?`Comment ack`:`Changes ack`,status:t.status,subject:t.artifact,facts:[],sections:[]});function wM({data:e}){let t=e.blocks.length;return{heading:`Changes`,status:e.saved?`saved`:``,subject:e.artifact,summary:e.empty?`no human edits`:e.diff===void 0?`${t} block${t===1?``:`s`} changed`:`complete diff`,facts:e.saved?[X(`File`,Y(e,`saved`),!0)]:[...e.receipt?[X(`Receipt`,{key:`receipt`,value:`${e.receipt} · changes ack --receipt ${e.receipt}`})]:[],...e.diff===void 0&&!e.empty&&e.snapshot?[X(`Snapshot`,Y(e,`snapshot`))]:[]],sections:e.empty||e.saved?[]:e.diff===void 0?[{kind:`records`,key:`blocks`,rows:e.blocks.map(e=>({id:e.id,size:[e.additions&&`+${e.additions}`,e.deletions&&`-${e.deletions}`].filter(Boolean).join(` `),preview:e.preview&&`"${e.preview.replaceAll(/\s*\n\s*/g,` / `)}"`})),columns:[{key:`id`,positional:!0,required:!0},{key:`size`,positional:!0},{key:`preview`,positional:!0}]}]:[{kind:`diff`,key:`diff`,text:e.diff}]}}function TM(e,t,n,r,i){let a={},o=[],s=[];for(let c of n){let n=r.sections[c],l=EM(e,t,c,n,i),{artifact:u,section:d,...f}=l.data;a[c]={...f,page:n.page},o.push(...l.actions.map(e=>e.label===`More`?{...e,label:`More (${c})`}:e)),f.evidence===`preview`&&c===`threads`&&s.push({path:`data.sections.threads.items.messages`,reason:`summary`})}return J({artifact:t,sections:a},void 0,{actions:o,coverage:{omitted:s}})}function EM(e,t,n,r,i,a){let o=r.page,s={artifact:t,section:n??`summary`,items:r.items??[],evidence:i.fields?`projected`:n&&n!==`threads`?`state`:i.detail||a?`complete`:`preview`,...r.snapshot?{snapshot:r.snapshot}:{},...r.receipt?{receipt:r.receipt}:{},...r.receipt&&e.values.hold?{delivery:r.receipt}:{},...r.summary?{summary:r.summary}:{}},c=[],l=yM(e,t);if(r.receipt&&c.push(q([`comment`,`ack`,...l,`--receipt`,r.receipt],`Acknowledge`)),o?.nextCursor&&c.push(q([`comment`,`list`,...l,`--section`,n,...i.detail?[`--detail`]:[],...Object.entries({status:$(e,`status`),"waiting-on":$(e,`waiting-on`),kind:$(e,`kind`),"choice-state":$(e,`choice-state`),fields:$(e,`fields`),limit:$(e,`limit`)}).flatMap(([e,t])=>t?[`--${e}`,t]:[]),...i.all?[`--all`]:[],`--cursor`,o.nextCursor],`More`)),n)n===`threads`&&s.evidence===`preview`&&s.items[0]&&c.push(q([`comment`,`read`,...l,`--thread`,String(s.items[0].id),`--snapshot`,r.snapshot,`--detail`],`Read`));else{c.push(q([`comment`,`list`,...l,`--sections`,`all`,`--detail`,...i.all?[`--all`]:[],...$(e,`limit`)?[`--limit`,$(e,`limit`)]:[]],`Review all`));let n=[`threads`,...jE[t.split(`/`)[0]].review?.sections??[]];c.unshift(...n.map(e=>q([`comment`,`list`,...l,`--section`,e,...e===`asks`?[`--detail`]:[]],e[0].toUpperCase()+e.slice(1))))}if(n===`asks`)for(let e of s.items.filter(e=>e.state===`submitted`))c.push({...q([`comment`,`note`,...l,`--ask`,String(e.id),`--text`,`<what changed>`],`Settle (${e.id})`),reason:`Apply this submitted human answer, then replace the note argument with what changed. Never invent an answer.`});return n===`threads`&&zj(e,t,s,o,c),J(s,void 0,{actions:c,coverage:{...o?{page:o}:{},...s.evidence===`preview`&&n===`threads`?{omitted:[{path:`data.items.messages`,reason:`summary`}]}:{}}})}function DM(e){let t=pM(e),n=e.positionals[0];if(n===`ack`)return bM(e,t,`review`);if(n===`deliver`)return xM(e,t);if(e.values.sections!==void 0)return SM(e,t,n);if(n!==`list`&&n!==`read`)throw new K({code:`E_ARGUMENT_INVALID`,message:`Expected list, read or ack.`});let r=mM(e),i=n===`read`?`threads`:$(e,`section`),a=$(e,`thread`);if(n===`read`&&!a)throw new K({code:`E_ARGUMENT_INVALID`,message:`read requires --thread.`});if(i&&![`threads`,`asks`,`groups`,`rounds`].includes(i))throw new K({code:`E_ARGUMENT_INVALID`,message:`Unknown review section.`});if(!i&&(r.detail||r.cursor||r.fields||[`status`,`waiting-on`,`kind`,`choice-state`].some(t=>e.values[t])))throw new K({code:`E_ARGUMENT_INVALID`,message:`Select --section before detail, fields, cursor or filters.`});let o=Object.fromEntries([[`status`,$(e,`status`)],[`waitingOn`,$(e,`waiting-on`)],[`kind`,$(e,`kind`)],[`choiceState`,$(e,`choice-state`)]].filter(([,e])=>e!==void 0)),s=Lj({...r,section:i,filters:o});if(s)throw new K({code:`E_ARGUMENT_INVALID`,message:s});return Z({id:`comment.${n}`,mode:`finite`,output:{detail:!0,formats:fM,collection:`items`,requiredFields:i?Pj[i]:[],fields:i?[...Nj[i]]:[]},async run(s,c){let l=await gM(e,c,t,`review`,{op:n,...r,...i?{section:i}:{},...a?{thread:a,detail:!0}:{},...Object.keys(o).length?{filters:o}:{}});return EM(e,t,i,l,r,a)},present:t=>uM(t,n===`read`?`Comment read`:`Comment list`,r.all||!!$(e,`status`)&&(i!==`asks`||$(e,`status`)!==`submitted`)||!!$(e,`choice-state`))},e)}function OM(e){let t=pM(e,!0),n=e.positionals[0];if(n===`ack`)return bM(e,t,`changes`);if(n)throw new K({code:`E_ARGUMENT_INVALID`,message:`Expected changes or changes ack.`});let r=mM(e),i=$(e,`save`);if(i!==void 0&&!i.trim())throw new K({code:`E_ARGUMENT_INVALID`,message:`--save requires a nonempty file path.`});if(r.detail&&(r.fields||r.cursor||r.limit!==void 0))throw new K({code:`E_OPTION_CONFLICT`,message:`A complete diff cannot use --limit, --cursor or --fields.`});return Z({id:`changes`,mode:`finite`,output:{detail:!0,formats:i?[`brief`,`json`,`jsonl`]:fM,fields:[`artifact`,`snapshot`,`blocks`,`diff`,`empty`]},async run(n,a){let{page:o,schema:s,...c}=await gM(e,a,t,`changes`,{op:`read`,...r}),l=c;if(i&&l.empty!==!0&&typeof l.diff!=`string`)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server did not return complete diff evidence; no export was written.`});if(i){let e=Rj(i,l.diff??``,a.effects);l.saved=e.file,l.bytes=e.bytes,delete l.diff}let u=yM(e,t),d=l.receipt?[q([`changes`,`ack`,...u,`--receipt`,l.receipt],`Acknowledge`)]:l.empty?[]:[q([`changes`,...u,`--snapshot`,l.snapshot,...r.all?[`--all`]:[],`--detail`],`Read`)];return o?.nextCursor&&d.push(q([`changes`,...u,...r.all?[`--all`]:[],...Object.entries({fields:$(e,`fields`),limit:$(e,`limit`)}).flatMap(([e,t])=>t?[`--${e}`,t]:[]),`--cursor`,o.nextCursor],`More`)),J(l,void 0,{actions:d,coverage:{...o?{page:o}:{},...!r.detail&&!l.empty?{omitted:[{path:`data.diff`,reason:`summary`}]}:{}}})},present:wM},e)}const kM={semantic:OM,positionals:1,name:`changes`,summary:`Show what your human partner changed in a document or a deck (needs a running server)`,usage:[`--artifact document/<id>|slides/<id> [--all] [--detail | --save <file>]`,`ack --artifact document/<id>|slides/<id> --receipt <receipt>`],details:`Previews unread document edits without marking them read. Use --detail for complete evidence, then changes ack --receipt after using it.`,options:{limit:{type:`string`,value:`<n>`,help:`Summary records per page (1–100, default 10)`},cursor:{type:`string`,value:`<cursor>`,help:`Continue a change summary snapshot`},snapshot:{type:`string`,value:`<snapshot>`,help:`Read a captured change snapshot`},receipt:{type:`string`,value:`<receipt>`,help:`ack: acknowledge the complete captured diff`},save:{type:`string`,value:`<file>`,help:`Save the complete diff without overwriting an existing file`},artifact:{type:`string`,value:`document/<id>|slides/<id>`,help:`The document or deck`},all:{type:`boolean`,help:`Show historical changes without a receipt`}}},AM={reject:0,pending:1,pass:2,checked:3},jM={reject:`rejected`,pending:`pending`,pass:`passed`,checked:`checked by agent`},MM=(e,t)=>e?`${e} ${t}`:``,NM=e=>e.filter(Boolean).join(` · `),PM=(e,t=!1)=>({key:e,positional:!0,required:t});function FM({data:e}){let{tally:t}=e,n=t=>e.claims.filter(e=>e.state===t).length,r=e.threads.filter(e=>e.status===`open`),i=NM([MM(t.needYou,`on your human partner`),MM(t.notVerified,`not verified`),MM(t.orphaned,`open reject on a claim that is gone`)]);return{heading:`Comment list`,status:``,subject:e.artifact,summary:t.done?`done`:t.rejected?`${t.rejected} to act on`:`nothing to act on`,facts:i?[X(`Waiting`,{key:`waiting`,value:i})]:[],sections:[{kind:`records`,key:`claims`,title:`Claims`,summary:NM([MM(n(`reject`),`rejected`),MM(n(`pending`),`pending`),MM(n(`pass`),`passed`),MM(n(`checked`),`checked by agent`)]),columns:[PM(`id`,!0),PM(`line`,!0),PM(`rejects`),{key:`evidenceUpdated`,label:`evidence updated`},PM(`origin`),PM(`tail`)],rows:[...e.claims].sort((e,t)=>AM[e.state]-AM[t.state]).map(e=>({...e,line:jM[e.state],rejects:e.state===`reject`&&e.rejectThreads?`${e.rejectThreads} reject thread${e.rejectThreads===1?``:`s`}`:``,evidenceUpdated:e.evidenceUpdated||void 0,origin:e.from?`from ${e.from}`:``,tail:e.title}))},...e.rows.length?[{kind:`records`,key:`rows`,title:`Artboard rows`,summary:String(e.rows.length),columns:[PM(`id`,!0),PM(`state`,!0)],rows:e.rows.map(e=>({...e,id:`${e.artboard}/${e.group}`}))}]:[],...e.reports?.length?[{kind:`records`,key:`reports`,title:`Child reports`,summary:String(e.reports.length),columns:[PM(`id`,!0),PM(`state`,!0),PM(`tail`)],rows:e.reports.map(e=>({id:`verify/${e.verify}`,state:e.state===`reject`?`rejected (${e.rejected})`:e.state===`pending`?`pending (${e.needYou})`:e.state===`pass`?`passed`:`not found`,tail:e.title}))}]:[],...e.gaps.length?[{kind:`records`,key:`gaps`,title:`Not verified`,summary:NM([MM(e.gaps.filter(e=>!e.waived).length,`open`),MM(e.gaps.filter(e=>e.waived).length,`waived`)]),columns:[PM(`id`,!0),PM(`line`,!0),PM(`tail`)],rows:e.gaps.map(e=>({...e,line:e.waived?`waived`:`not verified`,tail:e.title}))}]:[],...e.threads.length?[{kind:`messages`,key:`threads`,title:`Threads`,summary:NM([MM(r.length,`open`),MM(e.threads.length-r.length,`resolved`)]),groups:e.threads.map(e=>({facts:[{...X(`Thread`,{key:`id`,value:e.id},!0),positional:!0},X(`On`,{key:`anchor`,value:e.anchor.claim?`claim ${e.anchor.claim}`:`gap ${e.anchor.gap}`},!0),X(`Verdict`,{key:`verdict`,value:e.anchor.verdict??(e.anchor.waive?`waived`:``)}),X(`Status`,{key:`status`,value:e.status},!0),...e.stale?[X(`Stale`,{key:`stale`,value:!0})]:[]],messages:e.messages.map(e=>({facts:[{...X(`Author`,{key:`author`,value:e.author},!0),positional:!0},X(`At`,{key:`at`,value:e.at})],text:e.text}))}))}]:[]]}}function IM(e){let t=e.values.artifact,n=HE(e.projectDir,t);return Z({id:`comment.list`,mode:`finite`,output:{detail:!0,formats:[`brief`,`json`,`jsonl`],fields:[`id`,`state`,`title`,`from`],scalar:e=>e.tally.done?`done`:`open`},async run(r,i){let a=DO(process.env),o=await ZD(e.projectDir).call(`POST`,`/api/agent/${t}/comments`,{op:`list`,...a?{agent:a}:{}},i.signal);if(o.status<200||o.status>=300)throw new K({code:o.status===404?`E_ARTIFACT_NOT_FOUND`:`E_COMMENT_FAILED`,message:o.json?.error||`HTTP ${o.status}`,httpStatus:o.status});let s=o.json,c=[`--artifact`,t,`--project-dir`,e.projectDir],l=s.threads.filter(e=>e.status===`open`);return J({...s,artifact:t,projectDir:e.projectDir},void 0,{actions:l.length?[{...q([`check`,...c],`Check`),reason:`After repairing the rejected claim and updating ${n.write} with real evidence. Preserve existing IDs and human edits; a human pass closes the rejection.`},...l.map(e=>({...q([`comment`,`reply`,...c,`--thread`,e.id,`--text`,`<what changed and the replacement evidence>`],`Reply (${e.id})`),reason:`Reply after the repair; leave rejected claims open for the human verdict.`}))]:[]})},present:FM},e)}function LM({data:e}){let t=e.threadId?`thread ${e.threadId}`:e.ask?`ask ${e.ask}`:e.group?`group ${e.group}${e.board?` → ${e.board}`:``}`:e.round?`round ${e.round}`:``;return{heading:`Comment ${e.operation}`,status:e.status,subject:e.artifact,summary:`${t}${e.operation===`answer`&&e.choice?` → ${e.choice}`:``}`,facts:[...e.messageId?[X(`Message`,Y(e,`messageId`))]:[],...e.unread?[X(`Unread`,Y(e,`unread`))]:[],...e.consumeFailed?[X(`Consume failed`,Y(e,`consumeFailed`))]:[],...e.groups?.length?[X(`Groups`,{key:`groups`,value:e.groups.join(`, `)})]:[]],sections:[]}}function RM(e){let t={action:e.positionals[0],artifact:e.values.artifact,projectDir:e.projectDir};for(let n of[`ask`,`at`,`block`,`board`,`choice`,`claim`,`cut`,`edge`,`element`,`gap`,`group`,`line`,`node`,`page`,`quote`,`round`,`shot`,`slide`,`text`,`thread`,`x`,`y`])t[n]=e.values[n];for(let n of[`all`,`clear`,`withdraw`])t[n]=!!e.values[n];return t}function zM(e){let t=RM(e),n=t.action;if(t.artifact?.startsWith(`verify/`)&&[`list`,`read`,`ack`,`deliver`].includes(n??``)){if(n!==`list`)throw new K({code:`E_OPTION_UNSUPPORTED`,message:`A verify report has no thread receipts: comment list shows every thread.`});return IM(e)}if([`list`,`read`,`ack`,`deliver`].includes(n??``))return DM(e);if([`section`,`sections`,`limit`,`cursor`,`snapshot`,`receipt`,`status`,`waiting-on`,`kind`,`choice-state`,`hold`].some(t=>e.values[t]!==void 0))throw new K({code:`E_OPTION_UNSUPPORTED`,message:`Review query options apply only to list, read and ack.`});return Z({id:`comment.${n??`unknown`}`,mode:`finite`,output:{formats:n===`pass`&&t.all?[`brief`,`json`,`jsonl`]:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.ask??e.group??e.round??e.threadId??e.artifact},async run(e,n){let r=UM(t);ZD(t.projectDir);let i=n.effects.begin(`comment.${r.action}`,t.thread??t.ask??t.group??t.artifact);r.action===`resolve`&&t.thread&&await vM(t.projectDir,t.artifact,t.thread,!0,n.signal);let a=await WM(t,r,n.signal);if(a.status>=400&&a.status<500&&n.effects.set(i,`failed`),a.status<200||a.status>=300)throw new K({code:a.status===404&&!a.json.error?`E_SERVER_UPGRADE_REQUIRED`:`E_COMMENT_FAILED`,message:a.json.error||`HTTP ${a.status}`,httpStatus:a.status});let o=a.json;n.effects.confirm(i);let s=null,c;if(r.action===`reply`&&t.thread)try{let e=await vM(t.projectDir,t.artifact,t.thread,!1,n.signal);e&&`failed`in e?c=e.failed:s=e}catch(e){c=e instanceof Error?e.message:String(e)}let{action:l,request:u}=r,d={add:`added`,reply:`replied`,resolve:`resolved`,answer:t.clear?`cleared`:`answered`,note:`settled`,choose:t.clear?`cleared`:`recorded`,pass:`recorded`,reject:`recorded`,waive:`recorded`,submit:t.withdraw?`withdrawn`:`submitted`},f=l===`pass`&&[o.groups,o.claims].some(e=>Array.isArray(e)&&e.length===0);return f&&n.effects.set(i,`none`),J({artifact:t.artifact,operation:l,status:f?`unchanged`:d[l],by:`agent`,...typeof o.threadId==`string`?{threadId:o.threadId}:{},...typeof o.messageId==`string`?{messageId:o.messageId}:{},...t.ask?{ask:t.ask}:{},...t.group?{group:t.group}:{},...Array.isArray(o.groups)?{groups:o.groups}:{},...Array.isArray(o.claims)?{groups:o.claims}:{},...t.claim?{group:t.claim}:{},...t.gap?{group:t.gap}:{},...t.round?{round:t.round}:{},...l===`choose`?{board:u.board}:{},...l===`submit`?{submitted:!t.withdraw}:{},...l===`answer`?{choice:u.choice}:{},...s?{unread:s.unread}:{},...c?{consumeFailed:c}:{}},void 0,{effects:n.effects.snapshot()})},present:LM},e)}const BM=LE(IE),VM=/* @__PURE__ */ new Set([`pass`,`reject`]);function HM(e,t,n){let r=jE[n];if(r.commentRequest)return r.commentRequest(e,t);if(t===`waive`)throw new A(`comment waive works on verify reports only`);let i=r.commentActions?.[t];if(i)return i(e);if(t===`answer`||t===`note`)throw new A(`comment ${t} works on documents only`);if(t===`choose`||t===`submit`||VM.has(t))throw new A(`comment ${t} works on artboards only`);if(t===`add`)throw new A(`comment add does not work on ${n}`);if(!e.thread)throw new A(`comment ${t} needs --thread <threadId>`);return t===`reply`?{op:`reply`,threadId:e.thread,text:it(e)}:{op:`resolve`,threadId:e.thread}}function UM(e){let t=nt.find(t=>t===e.action);if(!t)throw new A(`comment needs an action: list, add, reply, resolve, choose, submit, answer, note, pass, reject or waive`);if(!e.artifact||!BM.test(e.artifact))throw new A(`--artifact must be ${RE(IE)}`);let[n,r]=e.artifact.split(`/`);return{action:t,type:n,id:r,request:HM(e,t,n),artifact:e.artifact}}async function WM(e,t,n){let{type:r,id:i,request:a}=t,o=ZD(e.projectDir),s=DO(process.env);return o.call(`POST`,`/api/agent/${r}/${i}/comments`,{...a,agent:s??`Agent`},n)}const GM={actionOptions:{list:[`limit`,`cursor`,`snapshot`,`status`,`waiting-on`,`kind`,`choice-state`,`thread`,`hold`],read:[`limit`,`cursor`,`all`,`save`]},actionDetails:{reply:`Adds a message to the thread and marks the messages of it delivered to you as read. Without --text, reads the message from stdin.`,resolve:`Closes the thread and marks the messages of it delivered to you as read. Refused while the thread holds a message you never received, and on a reject, which only your human partner passes.`},semantic:zM,name:`comment`,summary:`Read and answer feedback on a document, artboard, whiteboard, deck, data report or verify report (needs a running server)`,usage:[`list --artifact ${zE(PE)} --sections all|<names> [--detail] [--all]`,`list --artifact ${zE(PE)} [--section threads|asks|groups|rounds] [--all]`,`read --artifact ${zE(PE)} --thread <threadId> [--snapshot <token>]`,`ack --artifact ${zE(PE)} --receipt <receipt>`,`deliver --artifact ${zE(PE)} --receipt <delivery>`,`add --artifact document/<id> --block <blockId> [--quote <text>] [--text <text>]`,`add --artifact document/<id> --block <blockId> (--node <id> | --edge "<from>-><to>[#n]") [--text <text>]`,`add --artifact artboard/<id> --board <boardId> [--x <px> --y <px>] [--text <text>]`,`add --artifact whiteboard/<id> (--element <elementId> | --x <px> --y <px> [--page <pageId>]) [--text <text>]`,`add --artifact slides/<id> --slide <slideId> [--text <text>]`,`add --artifact storyboard/<id> (--shot <shotId> [--line <lineId> | --at <seconds>] | --cut <n> --at <seconds>) [--text <text>]`,`add --artifact report/<id> --block <blockId> [--point <series>:<x> | --row <rowKey>] [--text <text>]`,`reply --artifact ${zE(IE)} --thread <threadId> [--text <text>]`,`resolve --artifact ${zE(PE)} --thread <threadId>`,`choose --artifact artboard/<id> --group <groupId> (--board <boardId> | --clear)`,`submit --artifact artboard/<id> --round <roundId> [--withdraw]`,`submit --artifact document/<id> [--withdraw]`,`answer --artifact document/<id> --ask <questionId> (--choice <value> | --text <answer> | --clear)`,`note --artifact document/<id> --ask <questionId> [--text <note>]`,`pass --artifact artboard/<id> (--group <groupId> | --all) [--text <text>]`,`reject --artifact artboard/<id> --group <groupId> [--text <text>]`,`list --artifact verify/<id>`,`pass --artifact verify/<id> (--claim <claimId> | --all)`,`reject --artifact verify/<id> --claim <claimId> [--text <text>]`,`waive --artifact verify/<id> --gap <gapId>`],details:`list returns a summary; select threads, asks, groups or rounds to read one collection. Previews deliver nothing. A complete read delivers its threads to you; reply and resolve spend what was delivered, and resolve refuses while a thread holds a message you never received. A page that continues names its cursor, a preview names its snapshot. list --hold delivers only once deliver confirms its Delivery handle. asks, groups and rounds are independent state reads. Without --text, add, reply, note and reject read the message from stdin. answer records what your human partner said in the terminal; note settles a question once its answer is applied. pass and reject record a verdict on a verify group only when your human partner asks for it; the board shows the agent recorded it.`,options:{sections:{type:`string`,value:`<all|threads,asks|threads,groups,rounds>`,help:`Read multiple bounded review collections in one request`},section:{type:`string`,value:`<threads|asks|groups|rounds>`,help:`Semantic list: select one review collection`},limit:{type:`string`,value:`<n>`,help:`Semantic reads: records per page (1–100, default 10)`},cursor:{type:`string`,value:`<cursor>`,help:`Continue a semantic snapshot page`},snapshot:{type:`string`,value:`<snapshot>`,help:`Read an existing semantic snapshot`},receipt:{type:`string`,value:`<receipt>`,help:`ack: confirm exactly the complete evidence delivered`},hold:{type:`boolean`,help:`list: record the threads as delivered only once deliver confirms the Delivery handle`},status:{type:`string`,value:`<status>`,help:`Filter the selected semantic review collection`},"waiting-on":{type:`string`,value:`<agent|human|any>`,help:`Filter unread threads by who should reply`},kind:{type:`string`,value:`<verify|choose>`,help:`Filter review groups by kind`},claim:{type:`string`,value:`<claimId>`,help:`Verify reports: the claim to pass or reject`},gap:{type:`string`,value:`<gapId>`,help:`Verify reports: the not-verified item to waive`},"choice-state":{type:`string`,value:`<chosen|empty>`,help:`Filter choice groups`},artifact:{type:`string`,value:`<type>/<id>`,help:`The artifact whose feedback to read or answer`},all:{type:`boolean`,help:`list: every thread, not only what changed; pass: every verify group not yet passed`},block:{type:`string`,value:`<blockId>`,help:`add: the document block to comment on`},quote:{type:`string`,value:`<text>`,help:`add: the text in the block the comment is about`},node:{type:`string`,value:`<nodeId>`,help:`add: the node of the diagram in --block, by its id in the mermaid source`},edge:{type:`string`,value:`<from>-><to>[#n]`,help:`add: the edge of the diagram in --block between two node ids; #2 is the second edge between them`},board:{type:`string`,value:`<boardId>`,help:`add: the artboard board to comment on`},element:{type:`string`,value:`<elementId>`,help:`add: the whiteboard element to comment on`},page:{type:`string`,value:`<pageId>`,help:`add: the whiteboard page --x and --y are on (default main)`},slide:{type:`string`,value:`<slideId>`,help:`add: the slide of a deck to comment on`},shot:{type:`string`,value:`<shotId>`,help:`add: the shot of a storyboard to comment on`},line:{type:`string`,value:`<lineId>`,help:`add: the voice line of --shot the comment is about`},at:{type:`string`,value:`<seconds>`,help:`add: the moment of --shot, or of --cut, the comment is about`},cut:{type:`string`,value:`<n>`,help:`add: the registered cut --at is a moment of`},point:{type:`string`,value:`<series>:<x>`,help:`add: the point of a report chart in --block, by its series and x value`},row:{type:`string`,value:`<rowKey>`,help:`add: the row of a report table in --block`},x:{type:`string`,value:`<px>`,help:`add: horizontal position on the board`},y:{type:`string`,value:`<px>`,help:`add: vertical position on the board`},thread:{type:`string`,value:`<threadId>`,help:`reply, resolve: the thread`},text:{type:`string`,value:`<text>`,help:`add, reply, note: the message; answer: a written answer; reject: the reason; pass: an optional note`},group:{type:`string`,value:`<groupId>`,help:`choose: the choice group; pass, reject: the verify group`},clear:{type:`boolean`,help:`choose, answer: clear the choice or answer`},ask:{type:`string`,value:`<questionId>`,help:`answer, note: the question id`},choice:{type:`string`,value:`<value>`,help:`answer: the option value`},round:{type:`string`,value:`<roundId>`,help:`submit: the round`},withdraw:{type:`boolean`,help:`submit: withdraw the submission`}},positionals:1},KM={on:!0,off:!1,inherit:null};function qM(e,t=()=>{}){let n=pD(JE(process.env,process.platform,m.default.homedir())),r=d.default.join(d.default.dirname(Ye(e.projectDir).root),`config.json`);if(e.autoPublish!==void 0){let i=KM[e.autoPublish];if(i===void 0)throw new A(`--auto-publish takes on, off, or (with --project) inherit`);if(e.project){let e=oD(r);if(e.warning)throw new A(e.warning);t(),lD(r),dD(r,i)}else if(i===null)throw new A(`inherit only applies with --project`);else gD(n,i,t)}return{global:hD(n)??null,project:oD(r).config.autoPublish??null}}const JM={name:`config`,summary:`Auto-publish changed artifacts as private cloud copies when the agent's turn ends`,usage:[`[--auto-publish on|off] [options]`,`--auto-publish on|off|inherit --project [options]`],details:`Without --auto-publish, prints the current values.`,options:{"output-format":{type:`string`,value:`<brief|json|jsonl|inherit>`,help:`Set the output protocol (inherit for project only)`},"auto-publish":{type:`string`,value:`on|off|inherit`,help:`Turn auto-publish on or off; inherit (with --project) drops the override`},project:{type:`boolean`,help:`Set it for this project only instead of every project`}},semantic:e=>Z({id:`config`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`],fields:e.values[`auto-publish`]!==void 0||e.values[`output-format`]!==void 0?[]:[`global`,`project`,`effective`,`source`,`applies`,`output`]},run(t,n){if(e.values[`auto-publish`]!==void 0&&e.values[`output-format`]!==void 0)throw new A(`Choose auto-publish or output-format.`);let r=e.values.project?`project`:`global`,i=TD(e.projectDir)[r],a,o=()=>{a=n.effects.begin(`config`,i)};typeof e.values[`output-format`]==`string`&&OD(e.projectDir,!!e.values.project,e.values[`output-format`],o);let s=qM({projectDir:e.projectDir,autoPublish:e.values[`auto-publish`],project:!!e.values.project},o);return a!==void 0&&n.effects.confirm(a),J({scope:r,projectDir:e.projectDir,file:i,...s,output:DD(e.projectDir),effective:s.project??s.global,source:s.project===null?s.global===null?`undecided`:`global`:`project`,applies:`supported_turn_end_hook`})},present:YM},e)};function YM({data:e}){let t=e.effective===null?`undecided`:e.effective?`on`:`off`;return{heading:`Config`,status:``,facts:[X(`Scope`,{key:`scope`,value:e.scope}),X(`File`,{key:`file`,value:e.file}),X(`Auto-publish`,{key:`autoPublish`,value:e.source===`undecided`?t:`${t} (${e.source})`}),X(`Output format`,{key:`output`,value:`${e.output.effective} (${e.output.source})`})],sections:[]}}function XM(e=process.env,t=m.default.homedir()){if(e.RYUGI_DAEMON_SOCKET)return e.RYUGI_DAEMON_SOCKET;let n=d.default.dirname(lk(e)),{home:r}=WD(e,t);if(kk(r,t))return d.default.join(n,`daemon.sock`);let i=d.default.join(r,`daemon.sock`);if(Buffer.byteLength(i)<=103)return i;let a=f.default.createHash(`sha256`).update(r).digest(`hex`).slice(0,16);return d.default.join(n,`daemon-${a}.sock`)}function ZM(e,{timeoutMs:t=5e3}={}){let n=(n,r)=>new Promise((i,a)=>{let o=_.default.connect(e),s=``,c=e=>{o.destroy(),a(e)},l=setTimeout(()=>c(/* @__PURE__ */ Error(`daemon ${n} timed out`)),t);o.on(`error`,e=>{clearTimeout(l),c(e)}),o.on(`connect`,()=>o.write(`${JSON.stringify({op:n,...r})}\n`)),o.on(`data`,e=>{if(s+=e.toString(`utf8`),s.length>4194304)return c(/* @__PURE__ */ Error(`daemon reply too large`));let t=s.indexOf(`
|
|
1240
|
-
`);if(!(t<0)){clearTimeout(l),o.end();try{let e=JSON.parse(s.slice(0,t));e.ok?i(e.data??null):a(Error(e.error||`daemon ${n} failed`))}catch{a(/* @__PURE__ */ Error(`daemon reply is not JSON`))}}})});return{call:n,available:()=>n(`status`,{}).then(()=>!0,()=>!1)}}const
|
|
1241
|
-
`)}`);return[r,`attach`,a.attach]}const
|
|
1242
|
-
`),i((0,p.spawnSync)(e,t,{stdio:`inherit`}).status===0?`detached`:`failed`,[])}}}function
|
|
1243
|
-
`)}]:[]}}const
|
|
1237
|
+
`)}]:[]]}}const xj=/^storyboard\/[a-z0-9][a-z0-9-]*$/,Sj=e=>typeof e==`object`&&!!e&&Array.isArray(e.lines),Cj=e=>typeof e==`object`&&!!e&&typeof e.n==`number`&&Array.isArray(e.shots),wj=({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`}`),Tj=e=>{let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},Ej=e=>[`cut ${e.n}: ${e.file} · ${e.shots.length} shot${e.shots.length===1?``:`s`}, ${Tj(e.shots.at(-1)?.end??0)} · timing from the ${e.mapped===`map`?`map`:`storyboard's durations`}`],Dj=(e,t)=>d.default.resolve(e,t),Oj=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 kj(e,t,n){let r=d.default.join(ve(e),...t.split(`/`));if(!u.default.existsSync(r))throw new j(`${t} not found in ${e}`);return OE(r,n)?[`wrote ${DE}`]:[`${DE} is already there; pass --force to replace it with the latest template`]}const Aj=e=>typeof e==`object`&&!!e&&typeof e.state==`string`,jj=(e,t)=>new Promise(n=>{let r=setTimeout(n,e);t?.addEventListener(`abort`,()=>{clearTimeout(r),n()})});function Mj(e,t){if(t!==void 0)try{return JSON.parse(u.default.readFileSync(Dj(e,t),`utf8`))}catch(e){throw new j(`--map ${t} is not readable JSON: ${e.message}`)}}const Nj={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=>Z({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 j(`usage: ryugi storyboard voice|cut|export|template --artifact storyboard/<id>`);let i=e.values.artifact;if(!i||!xj.test(i))throw new j(`--artifact must be storyboard/<id>`);if(r===`template`)return J({action:r,artifact:i,lines:[],summary:kj(e.projectDir,i,!!e.values.force)},{kind:`succeeded`});let a=rO(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||!Aj(t.json))throw new j(t.json?.error||`HTTP ${t.status}`);let o=t.json,s=[];for(;e.values.wait&&o.state===`running`&&!n.signal?.aborted;){let e=Oj(o)[0];s.at(-1)!==e&&s.push(e),await jj(1e3,n.signal);let t=await a.call(`GET`,`/api/${i}/export`,void 0,n.signal);Aj(t.json)&&(o=t.json)}return J({action:r,artifact:i,export:o,lines:[],summary:[...s,...Oj(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 j(`storyboard cut needs --file <1080p.mp4>`);let o=Mj(e.projectDir,e.values.map),s=e.values.master,c=await a.call(`POST`,`/api/${i}/cut`,{file:Dj(e.projectDir,t),...o===void 0?{}:{map:o},...s?{master:Dj(e.projectDir,s)}:{}},n.signal);if(n.payloads.raw=c.raw,c.status<200||c.status>=300)throw new j(c.json?.error||`HTTP ${c.status}`);if(!Cj(c.json))throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an invalid cut.`});let l=c.json;return J({action:r,artifact:i,cut:l,lines:[],summary:Ej(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,!Sj(s.json))throw s.status<200||s.status>=300?new j(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:wj(s.json)};if(c.error)return J(c,{kind:`failed`,error:{code:`E_STORYBOARD_VOICE`,message:c.error}});let l=c.lines.filter(e=>!e.ok);return J(c,l.length?l.length===c.lines.length?{kind:`failed`,error:{code:`E_STORYBOARD_VOICE`,message:wj({lines:l}).join(`; `)}}:{kind:`partial`}:{kind:`succeeded`})},present:Pj},e)};function Pj({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?[X(`Version`,{key:`cut`,value:String(e.cut?.n??``)})]:e.action===`export`?[X(`Version`,{key:`export`,value:String(e.export?.n??``)})]:e.action===`voice`?[X(`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(`
|
|
1238
|
+
`)}]}}const Fj=/^whiteboard\/[a-z0-9][a-z0-9-]*$/,Ij=e=>{let t=e;return typeof e==`object`&&!!e&&typeof t.artifact==`string`&&typeof t.sceneVersion==`number`&&Array.isArray(t.lines)&&[`none`,`current`,`stale`].includes(t.render)},Lj={name:`scene`,summary:`Read a whiteboard: its render and a structure summary (needs a running server)`,usage:[`--artifact whiteboard/<id> [--page <pageId>] [--frame <frameId>]`],details:`Prints the scene version, where the latest browser render is and whether it shows the current scene, then one line per frame, element and arrow, with who drew each. On a whiteboard with several pages it lists the pages; --page or --frame reads one.`,options:{artifact:{type:`string`,value:`whiteboard/<id>`,help:`The whiteboard`},page:{type:`string`,value:`<pageId>`,help:`Read this page of a whiteboard with several pages`},frame:{type:`string`,value:`<frameId>`,help:`Only this frame and the arrows touching it, on whichever page holds it`}},semantic:e=>Z({id:`scene`,mode:`finite`,output:{detail:!1,formats:[`brief`,`json`,`jsonl`,`raw`],fields:[`artifact`,`page`,`pages`,`sceneVersion`,`render`,`renderPath`,`lines`,`conflicts`],scalar:e=>e.render},async run(t,n){let r=e.values.artifact;if(!r||!Fj.test(r))throw new j(`--artifact must be whiteboard/<id>`);let i=e.values.frame,a=e.values.page,o=await rO(e.projectDir).call(`POST`,`/api/agent/${r}/scene`,{...i?{frame:i}:{},...a?{page:a}:{}},n.signal);if(n.payloads.raw=o.raw,o.status<200||o.status>=300)throw new j(o.json?.error||`HTTP ${o.status}`);if(!Ij(o.json))throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an invalid scene report.`});let s=o.json;return J(s,{kind:`succeeded`},{actions:(s.pages??[]).map(t=>q([`scene`,`--artifact`,r,`--page`,t.id,`--project-dir`,e.projectDir],`Read ${t.id}`))})},present:Rj},e)};function Rj({data:e}){return{heading:`Scene`,status:e.problem?`invalid`:``,subject:e.artifact,facts:[...e.page?[X(`Page`,Y(e,`page`))]:[],X(`Version`,Y(e,`sceneVersion`)),X(`Render`,Y(e,`render`)),...e.renderPath?[X(`Image`,Y(e,`renderPath`))]:[],...e.problem?[X(`Problem`,Y(e,`problem`))]:[],X(`Conflicts`,{key:`conflicts`,value:e.conflicts.join(`, `)})],sections:[{kind:`content`,key:`lines`,text:e.lines.join(`
|
|
1239
|
+
`)}]}}const zj={threads:[`id`,`status`,`waitingOn`,`anchor`,`stale`,`changes`,`messages`,`preview`,`messageCount`,`omittedMessages`],asks:[`id`,`state`,`choice`,`text`,`byRecommendation`,`staleChoice`,`note`],groups:[`id`,`kind`,`verdict`,`choice`,`by`,`byRecommendation`,`round`,`threads`,`evidenceUpdated`,`rejectThreads`,`title`,`from`,`capturedAt`],rounds:[`id`,`state`,`title`,`groups`,`submitted`]},Bj={threads:[`id`,`status`,`waitingOn`],asks:[`id`,`state`],groups:[`id`,`kind`,`verdict`,`choice`],rounds:[`id`,`state`]},Vj=e=>e.startsWith(`document/`)?[`threads`,`asks`]:[`threads`,`groups`,`rounds`];function Hj(e,t){return e.section?`Choose section or sections, not both.`:!e.sections.length||new Set(e.sections).size!==e.sections.length||e.sections.some(e=>!Vj(t).includes(e))?`Choose distinct review sections supported by this artifact.`:e.fields||e.cursor||e.snapshot||e.thread||e.filters&&Object.values(e.filters).some(e=>e!==void 0)?`Fields, filters, thread, cursor and snapshot require a single --section. Follow each collection continuation separately.`:null}function Uj(e){let{section:t,filters:n}=e;if(!t&&(e.detail||e.cursor||e.fields||n&&Object.values(n).some(Boolean)))return`Choose a section before requesting detail, fields, filters or a cursor.`;if(t&&!(t in zj))return`Unknown review section.`;if(n&&Object.keys(n).some(e=>![`status`,`waitingOn`,`kind`,`choiceState`].includes(e)))return`Unknown review filter.`;if(n?.waitingOn&&(t!==`threads`||![`agent`,`human`,`any`].includes(n.waitingOn)))return`waitingOn applies to threads and must be agent, human or any.`;let r=t===`threads`?[`open`,`resolved`]:t===`asks`?[`draft`,`submitted`,`settled`,`orphan`]:t===`groups`?[`pending`,`pass`,`reject`]:[`open`,`submitted`,`closed`];return n?.status&&!r.includes(n.status)?`Invalid status for this section.`:n?.kind&&(t!==`groups`||![`choose`,`verify`].includes(n.kind))?`kind applies to groups.`:t===`groups`&&n?.status&&n.kind!==`verify`?`Verify status requires kind=verify.`:n?.choiceState&&(t!==`groups`||n.kind!==`choose`||![`chosen`,`empty`].includes(n.choiceState))?`choiceState requires a choice group.`:t&&e.fields?.some(e=>!zj[t].includes(e))?`Unknown field for this section.`:null}function Wj(e,t,n){let r=d.default.resolve(e),i=n?.begin(`save`,r),a;try{a=u.default.openSync(r,`wx`,384)}catch(e){throw i!==void 0&&n.set(i,`failed`),new K({code:e.code===`EEXIST`?`E_FILE_EXISTS`:`E_FILE_WRITE_FAILED`,message:`Could not create ${r}: ${e.message}`})}try{u.default.writeFileSync(a,t)}catch(e){throw u.default.closeSync(a),u.default.unlinkSync(r),i!==void 0&&n.set(i,`failed`),new K({code:`E_FILE_WRITE_FAILED`,message:`Could not save ${r}: ${e.message}`})}return u.default.closeSync(a),i!==void 0&&n.confirm(i,{bytes:typeof t==`string`?Buffer.byteLength(t):t.byteLength}),{file:r,bytes:typeof t==`string`?Buffer.byteLength(t):t.byteLength}}function Gj(e,t,n,r,i){let a=[`--artifact`,t,`--project-dir`,e.projectDir];if(n.evidence===`preview`&&n.items.length&&n.snapshot){let t=i.findIndex(e=>e.label===`Read`),o=[`status`,`waiting-on`,`kind`,`choice-state`].flatMap(t=>typeof e.values[t]==`string`?[`--${t}`,String(e.values[t])]:[]),s={...q([`comment`,`list`,...a,`--section`,`threads`,`--detail`,`--snapshot`,n.snapshot,`--limit`,String(r?.returned??n.items.length),...typeof e.values.cursor==`string`?[`--cursor`,e.values.cursor]:[],...o,...e.values.all?[`--all`]:[]],`Read`),reason:`Read the complete captured page before acting. Previews mark nothing read.`};t<0?i.push(s):i.splice(t,1,s)}let o=i.findIndex(e=>e.label===`Acknowledge`);o>=0&&i.splice(o,1)}const Q=e=>typeof e==`string`?e:``,Kj=e=>e.replaceAll(/\s*\n\s*/g,` / `).trim(),qj=(e,t)=>`${e} ${t}${e===1?``:`s`}`,Jj=e=>e[0].toUpperCase()+e.slice(1),Yj=(e,t=[])=>Object.entries(e??{}).filter(([e,n])=>e!==`waitingOnAgent`&&!t.includes(e)&&typeof n==`number`&&n>0).map(([e,t])=>`${t} ${e}`).join(`, `),Xj=e=>e?` (${e})`:``,Zj={asks:{word:`to apply`,none:`nothing to apply`,listed:[`submitted`]},groups:{word:`to act on`,none:`nothing to act on`,listed:[]},rounds:{word:`open or submitted`,none:`nothing open`,listed:[`open`,`submitted`]}};function Qj(e,t,n,r=!1){let i=n?.total??t.items.length,a=t.summary;if(r){let e=`${i} matched`;return{head:e,full:`${e}${Xj(Yj(a))}`,count:i}}if(e===`threads`){let e=Number(a?.waitingOnAgent??0),t=i?`${i} unread${e?`, ${e} waiting on you`:``}`:`nothing unread`,n=Number(a?.resolved??0);return{head:t,full:`${t}${n?` (${n} resolved)`:``}`,count:i}}let o=Zj[e],s=i?`${i} ${o.word}`:o.none,c=e===`groups`?Object.entries(a??{}).reduce((e,[t,n])=>t===`waitingOnAgent`||typeof n!=`number`?e:e+n,0)-i:0,l=e===`groups`?c>0?qj(c,`other`):``:Yj(a,o.listed);return{head:s,full:`${s}${Xj(l)}`,count:i}}function $j(e){if(!e||typeof e!=`object`)return``;let t=e;if(t.kind===`node`)return` node ${Q(t.id)}`;if(t.kind!==`edge`)return``;let n=typeof t.index==`number`&&t.index>0?` #${t.index+1}`:``;return` edge ${Q(t.from)} → ${Q(t.to)}${n}`}function eM(e){let t=e.snapshot&&typeof e.snapshot==`object`?e.snapshot:{},n=Q(t.tag),r=Q(t.title),i=e.point&&typeof e.point==`object`?e.point:null,a=t.value===void 0?``:` = ${Kj(JSON.stringify(t.value))}`,o=i?` · point ${Q(i.series)} @ ${String(i.x)}${a}`:typeof e.row==`string`?` · row ${e.row}${typeof t.value==`object`?``:a}`:``;return`${n?`${n} `:``}${String(e.block)}${r?` "${Kj(r)}"`:``}${o}${e.dataChanged?` · data changed`:``}`}const tM=e=>{let t=Math.round(e*10),n=Math.floor(t/10);return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}.${t%10}`};function nM(e){let t=Q(e.title);return`${e.deleted?`shot ${String(e.shot)} (shot deleted)`:`shot ${typeof e.number==`number`?`${e.number} `:``}${String(e.shot)}${t?` "${Kj(t)}"`:``}`}${typeof e.t==`number`?` · ${typeof e.cut==`number`?`cut ${e.cut} `:``}at ${tM(e.t)}`:``}${typeof e.line==`string`?` · line ${e.line}${Q(e.lineText)?` "${Kj(Q(e.lineText))}"`:``}`:``}${e.mark?` · marked`:``}${Q(e.cropPath)?` · crop ${Q(e.cropPath)}`:``}`}function rM(e){if(!e||typeof e!=`object`)return``;let t=e;if(typeof t.blockId==`string`){let e=Array.isArray(t.blockIds)&&t.blockIds.length>1?t.blockIds:[t.blockId];return`${e.length>1?`blocks`:`block`} ${e.join(`, `)}${$j(t.diagram)}${Q(t.quote)?` "${Kj(Q(t.quote))}"`:``}`}if(Array.isArray(t.elements)&&t.elements.length)return`element ${t.elements.join(`, `)}`;if(typeof t.block==`string`)return eM(t);if(typeof t.shot==`string`)return nM(t);if(typeof t.slide==`string`){let e=Q(t.title),n=Q(t.text),r=Array.isArray(t.nodes)?t.nodes:[],i=r.length?` · ${r.length} node${r.length===1?``:`s`}: ${r.map(e=>`${Q(e.tag)} ${Q(e.block)} "${Kj(Q(e.text))}"`).join(`, `)}`:``;return`slide ${t.slide}${e?` "${Kj(e)}"`:``}${i||(n?` · on "${Kj(n)}"`:``)}`}let n=Q(t.page);if(typeof t.board==`string`)return`${n?`page ${n} `:``}board ${t.board}`;let r=typeof t.x==`number`&&typeof t.y==`number`?` ${Math.round(t.x)},${Math.round(t.y)}`:``;return`page ${n||`main`}${r}`}const iM={key:`id`,positional:!0,required:!0},aM={key:`line`,positional:!0,required:!0},oM={key:`tail`,positional:!0,required:!0},sM=e=>e.choice?` → ${e.choice}${e.byRecommendation?` (recommended)`:``}`:``;function cM(e,t){return e===`asks`?{columns:[iM,aM,{key:`note`,label:`note`},{key:`staleChoice`,label:`stale choice`}],rows:t.map(e=>({...e,line:`${Q(e.state)}${e.choice?sM(e):Q(e.text)?` · "${Kj(Q(e.text))}"`:`choice`in e||`text`in e?` · no answer`:``}`,note:Q(e.note)&&`"${Kj(Q(e.note))}"`}))}:e===`threads`?{columns:[iM,{key:`status`,positional:!0,required:!0},{key:`waiting`,positional:!0},{key:`where`,positional:!0},{key:`marked`,label:`marked`},{key:`stale`,label:`stale`},{key:`orphan`,label:`orphan`},{key:`messageCount`,positional:!0},{key:`preview`,positional:!0}],rows:t.map(e=>({...lM(e),messageCount:typeof e.messageCount==`number`&&e.messageCount?qj(e.messageCount,`message`):``,preview:Q(e.preview)&&`"${Kj(Q(e.preview))}"`}))}:e===`groups`?{columns:[iM,{key:`kind`,positional:!0,required:!0},aM,{key:`origin`,positional:!0},{key:`evidenceUpdated`,label:`evidence updated`},{key:`rejects`,positional:!0},{key:`threadCount`,positional:!0},oM],rows:t.map(e=>({...e,line:e.kind===`verify`?Q(e.verdict):`${e.round?`round ${e.round}`:``}${e.choice?sM(e):` · no pick`}`.replace(/^ · /,``),origin:typeof e.from==`string`&&e.from?`from ${e.from}`:``,rejects:typeof e.rejectThreads==`number`&&e.rejectThreads?qj(e.rejectThreads,`reject thread`):``,threadCount:typeof e.threads==`number`&&e.threads?qj(e.threads,`thread`):``,tail:Q(e.title)}))}:{columns:[iM,{key:`state`,positional:!0,required:!0},{key:`groupList`,positional:!0},oM],rows:t.map(e=>({...e,groupList:Array.isArray(e.groups)&&e.groups.length?`groups ${e.groups.join(`, `)}`:``,tail:Q(e.title)}))}}function lM(e){return{id:e.id,status:e.status,waiting:e.waitingOn?`waiting on ${e.waitingOn}`:``,where:rM(e.anchor&&typeof e.anchor==`object`&&typeof e.page==`string`?{page:e.page,...e.anchor}:e.anchor),marked:Array.isArray(e.marked)?e.marked.map(Q).filter(Boolean).join(`; `):``,reject:e.anchor?.verdict===`reject`,stale:e.stale===!0,orphan:e.orphan===!0}}const uM=e=>e.status===`open`?[`reply --thread ${String(e.id)} --text <message>`,...e.reject?[]:[`resolve --thread ${String(e.id)}`]].join(`, `):``,dM=(e,t)=>({label:e,binding:{key:e,value:t},positional:!0});function fM(e,t=`items`,n=!0){return{kind:`messages`,key:t,groups:e.map(e=>{let t=lM(e);return{facts:[dM(`id`,t.id),dM(`status`,t.status),dM(`waiting`,t.waiting),dM(`where`,t.where),{label:`marked`,binding:{key:`marked`,value:t.marked}},{label:`reject`,binding:{key:`reject`,value:t.reject}},{label:`stale`,binding:{key:`stale`,value:t.stale}},{label:`orphan`,binding:{key:`orphan`,value:t.orphan}},dM(`spentBy`,n?uM(t):``)],messages:(Array.isArray(e.messages)?e.messages:[]).map(e=>({facts:[dM(`message`,[e.id,`${Q(e.name)||Q(e.author)}${e.author===`agent`?` (agent)`:``}`,Q(e.at)&&lO(Q(e.at)),e.deleted?`(deleted)`:``,Q(e.editedAt)&&`edited ${lO(Q(e.editedAt))}`].filter(Boolean).join(` `))],text:typeof e.text==`string`?e.text:``}))}})}}function pM(e,t,n,r,i){let a=Qj(e,t,n,i),o={key:r?e:`items`,title:Jj(e),summary:a.full};return e===`threads`&&t.evidence===`complete`?{...fM(t.items),...o,...r?{page:n}:{}}:{kind:`records`,...cM(e,t.items),...o,...r?{page:n}:{}}}const mM=[`threads`,`asks`,`groups`,`rounds`];function hM(e,t){let n=e.summary??{},r=e=>t.find(t=>t.label===Jj(e)),i=mM.filter(e=>r(e));return{heading:`Comment list`,status:``,subject:e.artifact,facts:[],sections:i.map(e=>{let t=n[e],r=e===`threads`?Qj(`threads`,{items:[],summary:{waitingOnAgent:n.waitingOnAgent}},{total:Number(t??0)}).head:Yj(t)||`none`;return{kind:`records`,key:e,title:Jj(e),summary:r,columns:[],rows:[]}}),actions:t.filter(e=>!i.some(t=>Jj(t)===e.label))}}function gM({data:e,actions:t,coverage:n},r=`Comment list`,i=!1){if(e.section===`summary`)return hM(e,t);let a=n.page;return{heading:r,status:``,subject:e.artifact,summary:Qj(e.section,e,a,i).head,facts:[...e.evidence===`preview`&&e.snapshot&&e.items.length?[X(`Snapshot`,Y(e,`snapshot`))]:[],...e.delivery?[X(`Delivery`,Y(e,`delivery`))]:[],...e.receipt&&!e.delivery?[X(`Receipt`,Y(e,`receipt`))]:[]],sections:[pM(e.section,e,a,!1,i)]}}function _M({data:e},t=!1){let n=Object.entries(e.sections),r=n.map(([e,n])=>Qj(e,n,n.page,t)).filter(e=>e.count>0).map(e=>e.head);return{heading:`Comment list`,status:``,subject:e.artifact,summary:r.join(` · `)||`nothing new`,facts:[],sections:n.map(([e,n])=>pM(e,n,n.page,!0,t))}}const $=(e,t)=>typeof e.values[t]==`string`?e.values[t]:void 0,vM=[`brief`,`table`,`json`,`jsonl`,`raw`];function yM(e,t=!1){let n=$(e,`artifact`),r=t?VE:BE;if(!n||!UE(r).test(n))throw new K({code:`E_ARGUMENT_INVALID`,message:`--artifact must be ${WE(r)}.`});return n}function bM(e){let t=$(e,`limit`);if(t!==void 0&&(!/^\d+$/.test(t)||Number(t)<1||Number(t)>100))throw new K({code:`E_ARGUMENT_INVALID`,message:`--limit must be between 1 and 100.`});return{...t===void 0?{}:{limit:Number(t)},...$(e,`cursor`)?{cursor:$(e,`cursor`)}:{},...$(e,`snapshot`)?{snapshot:$(e,`snapshot`)}:{},all:!!e.values.all,detail:!!e.values.detail||!!e.values.save,...e.values.hold?{hold:!0}:{},...$(e,`fields`)?{fields:$(e,`fields`).split(`,`).map(e=>e.trim())}:{}}}function xM(e,t){let n=jO(t);return{...e,agent:NO(t)??`Agent`,...n?{session:n}:{}}}async function SM(e,t,n,r,i){let a=await rO(e.projectDir).call(`POST`,`/api/agent/v1/${n}/${r}`,xM(i,process.env),t.signal);if(t.payloads.raw=a.raw,a.json.schema!==`ryugi.review/v1`)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported review response.`});if(a.status<200||a.status>=300)throw new K({code:typeof a.json.code==`string`?a.json.code:`E_REVIEW_FAILED`,message:a.json.error||`HTTP ${a.status}`,httpStatus:a.status});return a.json}const CM=/* @__PURE__ */ new Set([`artboard`,`document`,`preview`,`report`,`slides`,`storyboard`,`whiteboard`]);async function wM(e,t,n,r,i){if(!CM.has(t.split(`/`)[0]??``))return null;let a=await rO(e).call(`POST`,`/api/agent/v1/${t}/review`,xM({op:`consume`,thread:n,resolve:r},process.env),i);if(a.json.code===`E_UNDELIVERED`||a.json.code===`E_REJECT_OPEN`)throw new K({code:a.json.code,message:String(a.json.error),httpStatus:a.status});return a.status<200||a.status>=300?{failed:String(a.json.error||`HTTP ${a.status}`)}:typeof a.json.unread==`number`?{consumed:Number(a.json.consumed),unread:a.json.unread}:null}function TM(e,t){return[`--artifact`,t,`--project-dir`,e.projectDir]}function EM(e,t,n){let r=/* @__PURE__ */ new Set([...Object.keys(LD),`artifact`,`receipt`]),i=Object.keys(e.values).find(e=>!r.has(e));if(i)throw new K({code:`E_ARGUMENT_INVALID`,message:`--${i} is not supported for ack.`});let a=$(e,`receipt`);if(!a)throw new K({code:`E_ARGUMENT_INVALID`,message:`ack requires --receipt.`});return Z({id:n===`review`?`comment.ack`:`changes.ack`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.receipt},async run(r,i){rO(e.projectDir);let o=i.effects.begin(n===`review`?`comment.ack`:`changes.ack`,a),s=await SM(e,i,t,n,{op:`ack`,receipt:a});if(![`acknowledged`,`unchanged`].includes(s.status))throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported acknowledgement result; inspect unread state before retrying.`});return i.effects.set(o,s.status===`unchanged`?`none`:`confirmed`,{artifact:t}),J({artifact:t,receipt:a,status:s.status})},present:kM(n===`review`?`comment`:`changes`)},e)}function DM(e,t){let n=$(e,`receipt`);if(!n)throw new K({code:`E_ARGUMENT_INVALID`,message:`deliver requires --receipt.`});return Z({id:`comment.deliver`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.receipt},async run(r,i){rO(e.projectDir);let a=i.effects.begin(`comment.deliver`,n);if((await SM(e,i,t,`review`,{op:`deliver`,receipt:n})).status!==`delivered`)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported delivery result.`});return i.effects.confirm(a,{artifact:t}),J({artifact:t,receipt:n,status:`delivered`})},present:kM(`comment`)},e)}function OM(e,t,n){if(n!==`list`)throw new K({code:`E_ARGUMENT_INVALID`,message:`--sections applies to comment list.`});let r=bM(e),i=$(e,`sections`)?.trim(),a=i===`all`?Vj(t):(i??``).split(`,`).map(e=>e.trim()),o=Object.fromEntries([`status`,`waiting-on`,`kind`,`choice-state`].map(t=>[t,$(e,t)])),s=Hj({...r,sections:a,section:$(e,`section`),thread:$(e,`thread`),filters:o},t);if(s)throw new K({code:`E_ARGUMENT_INVALID`,message:s});return Z({id:`comment.list`,mode:`finite`,output:{formats:vM,detail:!0},async run(n,i){let o=await SM(e,i,t,`review`,{op:`list`,sections:a,...r});for(let e of a){let t=o.sections?.[e];if(!t||!Array.isArray(t.items)||typeof t.snapshot!=`string`||!t.page||typeof t.page.scope!=`string`||typeof t.page.hasMore!=`boolean`||!Number.isInteger(t.page.returned)||!(t.page.total===null||Number.isInteger(t.page.total)))throw new K({code:`E_SERVER_UPGRADE_REQUIRED`,message:`The server does not provide combined review pages. Run start --background for this project to rebuild/restart it.`});if(t.page.returned!==t.items.length||t.page.returned<0||t.page.total!==null&&t.page.total<t.page.returned||t.page.snapshot!==t.snapshot||t.page.nextCursor!==null&&typeof t.page.nextCursor!=`string`||t.page.hasMore!==(typeof t.page.nextCursor==`string`&&t.page.nextCursor.length>0))throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned inconsistent combined review coverage.`})}return jM(e,t,a,o,r)},present:e=>_M(e,r.all)},e)}const kM=e=>({data:t})=>({heading:e===`comment`?`Comment ack`:`Changes ack`,status:t.status,subject:t.artifact,facts:[],sections:[]});function AM({data:e}){let t=e.blocks.length;return{heading:`Changes`,status:e.saved?`saved`:``,subject:e.artifact,summary:e.empty?`no human edits`:e.diff===void 0?`${t} block${t===1?``:`s`} changed`:`complete diff`,facts:e.saved?[X(`File`,Y(e,`saved`),!0)]:[...e.receipt?[X(`Receipt`,{key:`receipt`,value:`${e.receipt} · changes ack --receipt ${e.receipt}`})]:[],...e.diff===void 0&&!e.empty&&e.snapshot?[X(`Snapshot`,Y(e,`snapshot`))]:[]],sections:e.empty||e.saved?[]:e.diff===void 0?[{kind:`records`,key:`blocks`,rows:e.blocks.map(e=>({id:e.id,size:[e.additions&&`+${e.additions}`,e.deletions&&`-${e.deletions}`].filter(Boolean).join(` `),preview:e.preview&&`"${e.preview.replaceAll(/\s*\n\s*/g,` / `)}"`})),columns:[{key:`id`,positional:!0,required:!0},{key:`size`,positional:!0},{key:`preview`,positional:!0}]}]:[{kind:`diff`,key:`diff`,text:e.diff}]}}function jM(e,t,n,r,i){let a={},o=[],s=[];for(let c of n){let n=r.sections[c],l=MM(e,t,c,n,i),{artifact:u,section:d,...f}=l.data;a[c]={...f,page:n.page},o.push(...l.actions.map(e=>e.label===`More`?{...e,label:`More (${c})`}:e)),f.evidence===`preview`&&c===`threads`&&s.push({path:`data.sections.threads.items.messages`,reason:`summary`})}return J({artifact:t,sections:a},void 0,{actions:o,coverage:{omitted:s}})}function MM(e,t,n,r,i,a){let o=r.page,s={artifact:t,section:n??`summary`,items:r.items??[],evidence:i.fields?`projected`:n&&n!==`threads`?`state`:i.detail||a?`complete`:`preview`,...r.snapshot?{snapshot:r.snapshot}:{},...r.receipt?{receipt:r.receipt}:{},...r.receipt&&e.values.hold?{delivery:r.receipt}:{},...r.summary?{summary:r.summary}:{}},c=[],l=TM(e,t);if(r.receipt&&c.push(q([`comment`,`ack`,...l,`--receipt`,r.receipt],`Acknowledge`)),o?.nextCursor&&c.push(q([`comment`,`list`,...l,`--section`,n,...i.detail?[`--detail`]:[],...Object.entries({status:$(e,`status`),"waiting-on":$(e,`waiting-on`),kind:$(e,`kind`),"choice-state":$(e,`choice-state`),fields:$(e,`fields`),limit:$(e,`limit`)}).flatMap(([e,t])=>t?[`--${e}`,t]:[]),...i.all?[`--all`]:[],`--cursor`,o.nextCursor],`More`)),n)n===`threads`&&s.evidence===`preview`&&s.items[0]&&c.push(q([`comment`,`read`,...l,`--thread`,String(s.items[0].id),`--snapshot`,r.snapshot,`--detail`],`Read`));else{c.push(q([`comment`,`list`,...l,`--sections`,`all`,`--detail`,...i.all?[`--all`]:[],...$(e,`limit`)?[`--limit`,$(e,`limit`)]:[]],`Review all`));let n=[`threads`,...LE[t.split(`/`)[0]].review?.sections??[]];c.unshift(...n.map(e=>q([`comment`,`list`,...l,`--section`,e,...e===`asks`?[`--detail`]:[]],e[0].toUpperCase()+e.slice(1))))}if(n===`asks`)for(let e of s.items.filter(e=>e.state===`submitted`))c.push({...q([`comment`,`note`,...l,`--ask`,String(e.id),`--text`,`<what changed>`],`Settle (${e.id})`),reason:`Apply this submitted human answer, then replace the note argument with what changed. Never invent an answer.`});return n===`threads`&&Gj(e,t,s,o,c),J(s,void 0,{actions:c,coverage:{...o?{page:o}:{},...s.evidence===`preview`&&n===`threads`?{omitted:[{path:`data.items.messages`,reason:`summary`}]}:{}}})}function NM(e){let t=yM(e),n=e.positionals[0];if(n===`ack`)return EM(e,t,`review`);if(n===`deliver`)return DM(e,t);if(e.values.sections!==void 0)return OM(e,t,n);if(n!==`list`&&n!==`read`)throw new K({code:`E_ARGUMENT_INVALID`,message:`Expected list, read or ack.`});let r=bM(e),i=n===`read`?`threads`:$(e,`section`),a=$(e,`thread`);if(n===`read`&&!a)throw new K({code:`E_ARGUMENT_INVALID`,message:`read requires --thread.`});if(i&&![`threads`,`asks`,`groups`,`rounds`].includes(i))throw new K({code:`E_ARGUMENT_INVALID`,message:`Unknown review section.`});if(!i&&(r.detail||r.cursor||r.fields||[`status`,`waiting-on`,`kind`,`choice-state`].some(t=>e.values[t])))throw new K({code:`E_ARGUMENT_INVALID`,message:`Select --section before detail, fields, cursor or filters.`});let o=Object.fromEntries([[`status`,$(e,`status`)],[`waitingOn`,$(e,`waiting-on`)],[`kind`,$(e,`kind`)],[`choiceState`,$(e,`choice-state`)]].filter(([,e])=>e!==void 0)),s=Uj({...r,section:i,filters:o});if(s)throw new K({code:`E_ARGUMENT_INVALID`,message:s});return Z({id:`comment.${n}`,mode:`finite`,output:{detail:!0,formats:vM,collection:`items`,requiredFields:i?Bj[i]:[],fields:i?[...zj[i]]:[]},async run(s,c){let l=await SM(e,c,t,`review`,{op:n,...r,...i?{section:i}:{},...a?{thread:a,detail:!0}:{},...Object.keys(o).length?{filters:o}:{}});return MM(e,t,i,l,r,a)},present:t=>gM(t,n===`read`?`Comment read`:`Comment list`,r.all||!!$(e,`status`)&&(i!==`asks`||$(e,`status`)!==`submitted`)||!!$(e,`choice-state`))},e)}function PM(e){let t=yM(e,!0),n=e.positionals[0];if(n===`ack`)return EM(e,t,`changes`);if(n)throw new K({code:`E_ARGUMENT_INVALID`,message:`Expected changes or changes ack.`});let r=bM(e),i=$(e,`save`);if(i!==void 0&&!i.trim())throw new K({code:`E_ARGUMENT_INVALID`,message:`--save requires a nonempty file path.`});if(r.detail&&(r.fields||r.cursor||r.limit!==void 0))throw new K({code:`E_OPTION_CONFLICT`,message:`A complete diff cannot use --limit, --cursor or --fields.`});return Z({id:`changes`,mode:`finite`,output:{detail:!0,formats:i?[`brief`,`json`,`jsonl`]:vM,fields:[`artifact`,`snapshot`,`blocks`,`diff`,`empty`]},async run(n,a){let{page:o,schema:s,...c}=await SM(e,a,t,`changes`,{op:`read`,...r}),l=c;if(i&&l.empty!==!0&&typeof l.diff!=`string`)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server did not return complete diff evidence; no export was written.`});if(i){let e=Wj(i,l.diff??``,a.effects);l.saved=e.file,l.bytes=e.bytes,delete l.diff}let u=TM(e,t),d=l.receipt?[q([`changes`,`ack`,...u,`--receipt`,l.receipt],`Acknowledge`)]:l.empty?[]:[q([`changes`,...u,`--snapshot`,l.snapshot,...r.all?[`--all`]:[],`--detail`],`Read`)];return o?.nextCursor&&d.push(q([`changes`,...u,...r.all?[`--all`]:[],...Object.entries({fields:$(e,`fields`),limit:$(e,`limit`)}).flatMap(([e,t])=>t?[`--${e}`,t]:[]),`--cursor`,o.nextCursor],`More`)),J(l,void 0,{actions:d,coverage:{...o?{page:o}:{},...!r.detail&&!l.empty?{omitted:[{path:`data.diff`,reason:`summary`}]}:{}}})},present:AM},e)}const FM={semantic:PM,positionals:1,name:`changes`,summary:`Show what your human partner changed in a document or a deck (needs a running server)`,usage:[`--artifact document/<id>|slides/<id> [--all] [--detail | --save <file>]`,`ack --artifact document/<id>|slides/<id> --receipt <receipt>`],details:`Previews unread document edits without marking them read. Use --detail for complete evidence, then changes ack --receipt after using it.`,options:{limit:{type:`string`,value:`<n>`,help:`Summary records per page (1–100, default 10)`},cursor:{type:`string`,value:`<cursor>`,help:`Continue a change summary snapshot`},snapshot:{type:`string`,value:`<snapshot>`,help:`Read a captured change snapshot`},receipt:{type:`string`,value:`<receipt>`,help:`ack: acknowledge the complete captured diff`},save:{type:`string`,value:`<file>`,help:`Save the complete diff without overwriting an existing file`},artifact:{type:`string`,value:`document/<id>|slides/<id>`,help:`The document or deck`},all:{type:`boolean`,help:`Show historical changes without a receipt`}}},IM={reject:0,pending:1,pass:2,checked:3},LM={reject:`rejected`,pending:`pending`,pass:`passed`,checked:`checked by agent`},RM=(e,t)=>e?`${e} ${t}`:``,zM=e=>e.filter(Boolean).join(` · `),BM=(e,t=!1)=>({key:e,positional:!0,required:t});function VM({data:e}){let{tally:t}=e,n=t=>e.claims.filter(e=>e.state===t).length,r=e.threads.filter(e=>e.status===`open`),i=zM([RM(t.needYou,`on your human partner`),RM(t.notVerified,`not verified`),RM(t.orphaned,`open reject on a claim that is gone`)]);return{heading:`Comment list`,status:``,subject:e.artifact,summary:t.done?`done`:t.rejected?`${t.rejected} to act on`:`nothing to act on`,facts:i?[X(`Waiting`,{key:`waiting`,value:i})]:[],sections:[{kind:`records`,key:`claims`,title:`Claims`,summary:zM([RM(n(`reject`),`rejected`),RM(n(`pending`),`pending`),RM(n(`pass`),`passed`),RM(n(`checked`),`checked by agent`)]),columns:[BM(`id`,!0),BM(`line`,!0),BM(`rejects`),{key:`evidenceUpdated`,label:`evidence updated`},BM(`origin`),BM(`tail`)],rows:[...e.claims].sort((e,t)=>IM[e.state]-IM[t.state]).map(e=>({...e,line:LM[e.state],rejects:e.state===`reject`&&e.rejectThreads?`${e.rejectThreads} reject thread${e.rejectThreads===1?``:`s`}`:``,evidenceUpdated:e.evidenceUpdated||void 0,origin:e.from?`from ${e.from}`:``,tail:e.title}))},...e.rows.length?[{kind:`records`,key:`rows`,title:`Artboard rows`,summary:String(e.rows.length),columns:[BM(`id`,!0),BM(`state`,!0)],rows:e.rows.map(e=>({...e,id:`${e.artboard}/${e.group}`}))}]:[],...e.reports?.length?[{kind:`records`,key:`reports`,title:`Child reports`,summary:String(e.reports.length),columns:[BM(`id`,!0),BM(`state`,!0),BM(`tail`)],rows:e.reports.map(e=>({id:`verify/${e.verify}`,state:e.state===`reject`?`rejected (${e.rejected})`:e.state===`pending`?`pending (${e.needYou})`:e.state===`pass`?`passed`:`not found`,tail:e.title}))}]:[],...e.gaps.length?[{kind:`records`,key:`gaps`,title:`Not verified`,summary:zM([RM(e.gaps.filter(e=>!e.waived).length,`open`),RM(e.gaps.filter(e=>e.waived).length,`waived`)]),columns:[BM(`id`,!0),BM(`line`,!0),BM(`tail`)],rows:e.gaps.map(e=>({...e,line:e.waived?`waived`:`not verified`,tail:e.title}))}]:[],...e.threads.length?[{kind:`messages`,key:`threads`,title:`Threads`,summary:zM([RM(r.length,`open`),RM(e.threads.length-r.length,`resolved`)]),groups:e.threads.map(e=>({facts:[{...X(`Thread`,{key:`id`,value:e.id},!0),positional:!0},X(`On`,{key:`anchor`,value:e.anchor.claim?`claim ${e.anchor.claim}`:`gap ${e.anchor.gap}`},!0),X(`Verdict`,{key:`verdict`,value:e.anchor.verdict??(e.anchor.waive?`waived`:``)}),X(`Status`,{key:`status`,value:e.status},!0),...e.stale?[X(`Stale`,{key:`stale`,value:!0})]:[]],messages:e.messages.map(e=>({facts:[{...X(`Author`,{key:`author`,value:e.author},!0),positional:!0},X(`At`,{key:`at`,value:e.at})],text:e.text}))}))}]:[]]}}function HM(e){let t=e.values.artifact,n=JE(e.projectDir,t);return Z({id:`comment.list`,mode:`finite`,output:{detail:!0,formats:[`brief`,`json`,`jsonl`],fields:[`id`,`state`,`title`,`from`],scalar:e=>e.tally.done?`done`:`open`},async run(r,i){let a=NO(process.env),o=await rO(e.projectDir).call(`POST`,`/api/agent/${t}/comments`,{op:`list`,...a?{agent:a}:{}},i.signal);if(o.status<200||o.status>=300)throw new K({code:o.status===404?`E_ARTIFACT_NOT_FOUND`:`E_COMMENT_FAILED`,message:o.json?.error||`HTTP ${o.status}`,httpStatus:o.status});let s=o.json,c=[`--artifact`,t,`--project-dir`,e.projectDir],l=s.threads.filter(e=>e.status===`open`);return J({...s,artifact:t,projectDir:e.projectDir},void 0,{actions:l.length?[{...q([`check`,...c],`Check`),reason:`After repairing the rejected claim and updating ${n.write} with real evidence. Preserve existing IDs and human edits; a human pass closes the rejection.`},...l.map(e=>({...q([`comment`,`reply`,...c,`--thread`,e.id,`--text`,`<what changed and the replacement evidence>`],`Reply (${e.id})`),reason:`Reply after the repair; leave rejected claims open for the human verdict.`}))]:[]})},present:VM},e)}function UM({data:e}){let t=e.threadId?`thread ${e.threadId}`:e.ask?`ask ${e.ask}`:e.group?`group ${e.group}${e.board?` → ${e.board}`:``}`:e.round?`round ${e.round}`:``;return{heading:`Comment ${e.operation}`,status:e.status,subject:e.artifact,summary:`${t}${e.operation===`answer`&&e.choice?` → ${e.choice}`:``}`,facts:[...e.messageId?[X(`Message`,Y(e,`messageId`))]:[],...e.unread?[X(`Unread`,Y(e,`unread`))]:[],...e.consumeFailed?[X(`Consume failed`,Y(e,`consumeFailed`))]:[],...e.groups?.length?[X(`Groups`,{key:`groups`,value:e.groups.join(`, `)})]:[]],sections:[]}}function WM(e){let t={action:e.positionals[0],artifact:e.values.artifact,projectDir:e.projectDir};for(let n of[`ask`,`at`,`block`,`board`,`choice`,`claim`,`cut`,`edge`,`element`,`gap`,`group`,`line`,`node`,`page`,`quote`,`round`,`shot`,`slide`,`text`,`thread`,`x`,`y`])t[n]=e.values[n];for(let n of[`all`,`clear`,`withdraw`])t[n]=!!e.values[n];return t}function GM(e){let t=WM(e),n=t.action;if(t.artifact?.startsWith(`verify/`)&&[`list`,`read`,`ack`,`deliver`].includes(n??``)){if(n!==`list`)throw new K({code:`E_OPTION_UNSUPPORTED`,message:`A verify report has no thread receipts: comment list shows every thread.`});return HM(e)}if([`list`,`read`,`ack`,`deliver`].includes(n??``))return NM(e);if([`section`,`sections`,`limit`,`cursor`,`snapshot`,`receipt`,`status`,`waiting-on`,`kind`,`choice-state`,`hold`].some(t=>e.values[t]!==void 0))throw new K({code:`E_OPTION_UNSUPPORTED`,message:`Review query options apply only to list, read and ack.`});return Z({id:`comment.${n??`unknown`}`,mode:`finite`,output:{formats:n===`pass`&&t.all?[`brief`,`json`,`jsonl`]:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.ask??e.group??e.round??e.threadId??e.artifact},async run(e,n){let r=YM(t);rO(t.projectDir);let i=n.effects.begin(`comment.${r.action}`,t.thread??t.ask??t.group??t.artifact);r.action===`resolve`&&t.thread&&await wM(t.projectDir,t.artifact,t.thread,!0,n.signal);let a=await XM(t,r,n.signal);if(a.status>=400&&a.status<500&&n.effects.set(i,`failed`),a.status<200||a.status>=300)throw new K({code:a.status===404&&!a.json.error?`E_SERVER_UPGRADE_REQUIRED`:`E_COMMENT_FAILED`,message:a.json.error||`HTTP ${a.status}`,httpStatus:a.status});let o=a.json;n.effects.confirm(i);let s=null,c;if(r.action===`reply`&&t.thread)try{let e=await wM(t.projectDir,t.artifact,t.thread,!1,n.signal);e&&`failed`in e?c=e.failed:s=e}catch(e){c=e instanceof Error?e.message:String(e)}let{action:l,request:u}=r,d={add:`added`,reply:`replied`,resolve:`resolved`,answer:t.clear?`cleared`:`answered`,note:`settled`,choose:t.clear?`cleared`:`recorded`,pass:`recorded`,reject:`recorded`,waive:`recorded`,submit:t.withdraw?`withdrawn`:`submitted`},f=l===`pass`&&[o.groups,o.claims].some(e=>Array.isArray(e)&&e.length===0);return f&&n.effects.set(i,`none`),J({artifact:t.artifact,operation:l,status:f?`unchanged`:d[l],by:`agent`,...typeof o.threadId==`string`?{threadId:o.threadId}:{},...typeof o.messageId==`string`?{messageId:o.messageId}:{},...t.ask?{ask:t.ask}:{},...t.group?{group:t.group}:{},...Array.isArray(o.groups)?{groups:o.groups}:{},...Array.isArray(o.claims)?{groups:o.claims}:{},...t.claim?{group:t.claim}:{},...t.gap?{group:t.gap}:{},...t.round?{round:t.round}:{},...l===`choose`?{board:u.board}:{},...l===`submit`?{submitted:!t.withdraw}:{},...l===`answer`?{choice:u.choice}:{},...s?{unread:s.unread}:{},...c?{consumeFailed:c}:{}},void 0,{effects:n.effects.snapshot()})},present:UM},e)}const KM=UE(HE),qM=/* @__PURE__ */ new Set([`pass`,`reject`]);function JM(e,t,n){let r=LE[n];if(r.commentRequest)return r.commentRequest(e,t);if(t===`waive`)throw new j(`comment waive works on verify reports only`);let i=r.commentActions?.[t];if(i)return i(e);if(t===`answer`||t===`note`)throw new j(`comment ${t} works on documents only`);if(t===`choose`||t===`submit`||qM.has(t))throw new j(`comment ${t} works on artboards only`);if(t===`add`)throw new j(`comment add does not work on ${n}`);if(!e.thread)throw new j(`comment ${t} needs --thread <threadId>`);return t===`reply`?{op:`reply`,threadId:e.thread,text:rt(e)}:{op:`resolve`,threadId:e.thread}}function YM(e){let t=tt.find(t=>t===e.action);if(!t)throw new j(`comment needs an action: list, add, reply, resolve, choose, submit, answer, note, pass, reject or waive`);if(!e.artifact||!KM.test(e.artifact))throw new j(`--artifact must be ${WE(HE)}`);let[n,r]=e.artifact.split(`/`);return{action:t,type:n,id:r,request:JM(e,t,n),artifact:e.artifact}}async function XM(e,t,n){let{type:r,id:i,request:a}=t,o=rO(e.projectDir),s=NO(process.env);return o.call(`POST`,`/api/agent/${r}/${i}/comments`,{...a,agent:s??`Agent`},n)}const ZM={actionOptions:{list:[`limit`,`cursor`,`snapshot`,`status`,`waiting-on`,`kind`,`choice-state`,`thread`,`hold`],read:[`limit`,`cursor`,`all`,`save`]},actionDetails:{reply:`Adds a message to the thread and marks the messages of it delivered to you as read. Without --text, reads the message from stdin.`,resolve:`Closes the thread and marks the messages of it delivered to you as read. Refused while the thread holds a message you never received, and on a reject, which only your human partner passes.`},semantic:GM,name:`comment`,summary:`Read and answer feedback on a document, artboard, whiteboard, deck, data report or verify report (needs a running server)`,usage:[`list --artifact ${GE(BE)} --sections all|<names> [--detail] [--all]`,`list --artifact ${GE(BE)} [--section threads|asks|groups|rounds] [--all]`,`read --artifact ${GE(BE)} --thread <threadId> [--snapshot <token>]`,`ack --artifact ${GE(BE)} --receipt <receipt>`,`deliver --artifact ${GE(BE)} --receipt <delivery>`,`add --artifact document/<id> --block <blockId> [--quote <text>] [--text <text>]`,`add --artifact document/<id> --block <blockId> (--node <id> | --edge "<from>-><to>[#n]") [--text <text>]`,`add --artifact artboard/<id> --board <boardId> [--x <px> --y <px>] [--text <text>]`,`add --artifact whiteboard/<id> (--element <elementId> | --x <px> --y <px> [--page <pageId>]) [--text <text>]`,`add --artifact slides/<id> --slide <slideId> [--text <text>]`,`add --artifact storyboard/<id> (--shot <shotId> [--line <lineId> | --at <seconds>] | --cut <n> --at <seconds>) [--text <text>]`,`add --artifact report/<id> --block <blockId> [--point <series>:<x> | --row <rowKey>] [--text <text>]`,`reply --artifact ${GE(HE)} --thread <threadId> [--text <text>]`,`resolve --artifact ${GE(BE)} --thread <threadId>`,`choose --artifact artboard/<id> --group <groupId> (--board <boardId> | --clear)`,`submit --artifact artboard/<id> --round <roundId> [--withdraw]`,`submit --artifact document/<id> [--withdraw]`,`answer --artifact document/<id> --ask <questionId> (--choice <value> | --text <answer> | --clear)`,`note --artifact document/<id> --ask <questionId> [--text <note>]`,`pass --artifact artboard/<id> (--group <groupId> | --all) [--text <text>]`,`reject --artifact artboard/<id> --group <groupId> [--text <text>]`,`list --artifact verify/<id>`,`pass --artifact verify/<id> (--claim <claimId> | --all)`,`reject --artifact verify/<id> --claim <claimId> [--text <text>]`,`waive --artifact verify/<id> --gap <gapId>`],details:`list returns a summary; select threads, asks, groups or rounds to read one collection. Previews deliver nothing. A complete read delivers its threads to you; reply and resolve spend what was delivered, and resolve refuses while a thread holds a message you never received. A page that continues names its cursor, a preview names its snapshot. list --hold delivers only once deliver confirms its Delivery handle. asks, groups and rounds are independent state reads. Without --text, add, reply, note and reject read the message from stdin. answer records what your human partner said in the terminal; note settles a question once its answer is applied. pass and reject record a verdict on a verify group only when your human partner asks for it; the board shows the agent recorded it.`,options:{sections:{type:`string`,value:`<all|threads,asks|threads,groups,rounds>`,help:`Read multiple bounded review collections in one request`},section:{type:`string`,value:`<threads|asks|groups|rounds>`,help:`Semantic list: select one review collection`},limit:{type:`string`,value:`<n>`,help:`Semantic reads: records per page (1–100, default 10)`},cursor:{type:`string`,value:`<cursor>`,help:`Continue a semantic snapshot page`},snapshot:{type:`string`,value:`<snapshot>`,help:`Read an existing semantic snapshot`},receipt:{type:`string`,value:`<receipt>`,help:`ack: confirm exactly the complete evidence delivered`},hold:{type:`boolean`,help:`list: record the threads as delivered only once deliver confirms the Delivery handle`},status:{type:`string`,value:`<status>`,help:`Filter the selected semantic review collection`},"waiting-on":{type:`string`,value:`<agent|human|any>`,help:`Filter unread threads by who should reply`},kind:{type:`string`,value:`<verify|choose>`,help:`Filter review groups by kind`},claim:{type:`string`,value:`<claimId>`,help:`Verify reports: the claim to pass or reject`},gap:{type:`string`,value:`<gapId>`,help:`Verify reports: the not-verified item to waive`},"choice-state":{type:`string`,value:`<chosen|empty>`,help:`Filter choice groups`},artifact:{type:`string`,value:`<type>/<id>`,help:`The artifact whose feedback to read or answer`},all:{type:`boolean`,help:`list: every thread, not only what changed; pass: every verify group not yet passed`},block:{type:`string`,value:`<blockId>`,help:`add: the document block to comment on`},quote:{type:`string`,value:`<text>`,help:`add: the text in the block the comment is about`},node:{type:`string`,value:`<nodeId>`,help:`add: the node of the diagram in --block, by its id in the mermaid source`},edge:{type:`string`,value:`<from>-><to>[#n]`,help:`add: the edge of the diagram in --block between two node ids; #2 is the second edge between them`},board:{type:`string`,value:`<boardId>`,help:`add: the artboard board to comment on`},element:{type:`string`,value:`<elementId>`,help:`add: the whiteboard element to comment on`},page:{type:`string`,value:`<pageId>`,help:`add: the whiteboard page --x and --y are on (default main)`},slide:{type:`string`,value:`<slideId>`,help:`add: the slide of a deck to comment on`},shot:{type:`string`,value:`<shotId>`,help:`add: the shot of a storyboard to comment on`},line:{type:`string`,value:`<lineId>`,help:`add: the voice line of --shot the comment is about`},at:{type:`string`,value:`<seconds>`,help:`add: the moment of --shot, or of --cut, the comment is about`},cut:{type:`string`,value:`<n>`,help:`add: the registered cut --at is a moment of`},point:{type:`string`,value:`<series>:<x>`,help:`add: the point of a report chart in --block, by its series and x value`},row:{type:`string`,value:`<rowKey>`,help:`add: the row of a report table in --block`},x:{type:`string`,value:`<px>`,help:`add: horizontal position on the board`},y:{type:`string`,value:`<px>`,help:`add: vertical position on the board`},thread:{type:`string`,value:`<threadId>`,help:`reply, resolve: the thread`},text:{type:`string`,value:`<text>`,help:`add, reply, note: the message; answer: a written answer; reject: the reason; pass: an optional note`},group:{type:`string`,value:`<groupId>`,help:`choose: the choice group; pass, reject: the verify group`},clear:{type:`boolean`,help:`choose, answer: clear the choice or answer`},ask:{type:`string`,value:`<questionId>`,help:`answer, note: the question id`},choice:{type:`string`,value:`<value>`,help:`answer: the option value`},round:{type:`string`,value:`<roundId>`,help:`submit: the round`},withdraw:{type:`boolean`,help:`submit: withdraw the submission`}},positionals:1},QM={on:!0,off:!1,inherit:null};function $M(e,t=()=>{}){let n=yD(eD(process.env,process.platform,m.default.homedir())),r=d.default.join(d.default.dirname(Je(e.projectDir).root),`config.json`);if(e.autoPublish!==void 0){let i=QM[e.autoPublish];if(i===void 0)throw new j(`--auto-publish takes on, off, or (with --project) inherit`);if(e.project){let e=fD(r);if(e.warning)throw new j(e.warning);t(),hD(r),_D(r,i)}else if(i===null)throw new j(`inherit only applies with --project`);else SD(n,i,t)}return{global:xD(n)??null,project:fD(r).config.autoPublish??null}}const eN={name:`config`,summary:`Auto-publish changed artifacts as private cloud copies when the agent's turn ends`,usage:[`[--auto-publish on|off] [options]`,`--auto-publish on|off|inherit --project [options]`],details:`Without --auto-publish, prints the current values.`,options:{"output-format":{type:`string`,value:`<brief|json|jsonl|inherit>`,help:`Set the output protocol (inherit for project only)`},"auto-publish":{type:`string`,value:`on|off|inherit`,help:`Turn auto-publish on or off; inherit (with --project) drops the override`},project:{type:`boolean`,help:`Set it for this project only instead of every project`}},semantic:e=>Z({id:`config`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`],fields:e.values[`auto-publish`]!==void 0||e.values[`output-format`]!==void 0?[]:[`global`,`project`,`effective`,`source`,`applies`,`output`]},run(t,n){if(e.values[`auto-publish`]!==void 0&&e.values[`output-format`]!==void 0)throw new j(`Choose auto-publish or output-format.`);let r=e.values.project?`project`:`global`,i=jD(e.projectDir)[r],a,o=()=>{a=n.effects.begin(`config`,i)};typeof e.values[`output-format`]==`string`&&PD(e.projectDir,!!e.values.project,e.values[`output-format`],o);let s=$M({projectDir:e.projectDir,autoPublish:e.values[`auto-publish`],project:!!e.values.project},o);return a!==void 0&&n.effects.confirm(a),J({scope:r,projectDir:e.projectDir,file:i,...s,output:ND(e.projectDir),effective:s.project??s.global,source:s.project===null?s.global===null?`undecided`:`global`:`project`,applies:`supported_turn_end_hook`})},present:tN},e)};function tN({data:e}){let t=e.effective===null?`undecided`:e.effective?`on`:`off`;return{heading:`Config`,status:``,facts:[X(`Scope`,{key:`scope`,value:e.scope}),X(`File`,{key:`file`,value:e.file}),X(`Auto-publish`,{key:`autoPublish`,value:e.source===`undecided`?t:`${t} (${e.source})`}),X(`Output format`,{key:`output`,value:`${e.output.effective} (${e.output.source})`})],sections:[]}}function nN(e=process.env,t=m.default.homedir()){if(e.RYUGI_DAEMON_SOCKET)return e.RYUGI_DAEMON_SOCKET;let n=d.default.dirname(hk(e)),{home:r}=XD(e,t);if(Fk(r,t))return d.default.join(n,`daemon.sock`);let i=d.default.join(r,`daemon.sock`);if(Buffer.byteLength(i)<=103)return i;let a=f.default.createHash(`sha256`).update(r).digest(`hex`).slice(0,16);return d.default.join(n,`daemon-${a}.sock`)}function rN(e,{timeoutMs:t=5e3}={}){let n=(n,r)=>new Promise((i,a)=>{let o=_.default.connect(e),s=``,c=e=>{o.destroy(),a(e)},l=setTimeout(()=>c(/* @__PURE__ */ Error(`daemon ${n} timed out`)),t);o.on(`error`,e=>{clearTimeout(l),c(e)}),o.on(`connect`,()=>o.write(`${JSON.stringify({op:n,...r})}\n`)),o.on(`data`,e=>{if(s+=e.toString(`utf8`),s.length>4194304)return c(/* @__PURE__ */ Error(`daemon reply too large`));let t=s.indexOf(`
|
|
1240
|
+
`);if(!(t<0)){clearTimeout(l),o.end();try{let e=JSON.parse(s.slice(0,t));e.ok?i(e.data??null):a(Error(e.error||`daemon ${n} failed`))}catch{a(/* @__PURE__ */ Error(`daemon reply is not JSON`))}}})});return{call:n,available:()=>n(`status`,{}).then(()=>!0,()=>!1)}}const iN=()=>f.default.randomBytes(24).toString(`base64url`);function aN(e){try{return u.default.readFileSync(e,`utf8`).trim()}catch{return``}}function oN(e){let t=d.default.join(d.default.dirname(e),`host-id`),n=aN(t);if(/^[\w-]{16,64}$/.test(n))return n;let r=iN();return u.default.mkdirSync(d.default.dirname(t),{recursive:!0,mode:448}),u.default.writeFileSync(t,`${r}\n`,{mode:384}),r}async function sN(e,t){let n=XD();if(ZD(n.home),!await PA(n.lock))throw new j(`Another start is still starting the artifacts server; retry in a moment`);try{let r=FA(n);if(!r&&!t.startStopped)return`not-running`;let i=await lA(n,e);r&&(YO(n,{action:`replaced`,pid:r,running:He(n.version)??``,cli:e,reasons:[t.reason]}),await RA(r,`running artifacts server`)),u.default.rmSync(n.info,{force:!0});let a=f.default.randomBytes(24).toString(`hex`);u.default.writeFileSync(n.serverId,`${a}\n`),u.default.writeFileSync(n.version,`${e}\n`);let o=tA(n),s=o?.env.ARTIFACTS_HOST||`127.0.0.1`,c=o?.env.ARTIFACTS_URL_HOST||`localhost`,l=await mA(n,i,{args:o?iA(o,a).args:Qk(a),env:$k(s,c)},`${Qe()} start --host ${s} --url-host ${c} --foreground`);if(`failed`in l)throw new j(String(l.failed.error??`Server failed`));return r?`restarted`:`started`}finally{try{u.default.rmdirSync(n.lock)}catch{}}}const cN=e=>({binary:d.default.join(we(e),`bin`,`adeck-daemon`)});async function lN(e,t){if(!Fk(e.serverHome,e.home))return{status:`other-hub`};let n=Bk(e),r=[n,Rk(n)].find(e=>u.default.existsSync(e));if(!r)return{status:`not-installed`};let i=Vk(r);if(r===n&&Hk(i,e))return{status:`current`};let a=await Uk(e);return t?.(),zk(n,a),{status:`updated`,from:i?.version??`unknown`,to:e.version}}const uN=`session control runs on macOS and Linux`,dN=(e,t)=>e.enabled?`linger on: the hub keeps running after you log out`:`linger off (${e.error}): the hub stops when you log out; to keep it running, an admin can run: sudo loginctl enable-linger ${t}`;function fN(e){if(e.platform!==`darwin`&&e.platform!==`linux`)throw new j(uN);if(!Fk(e.serverHome,e.home))return null;let t=pk(e);if(!t)throw new j(uN);let n=t.check();if(n)throw new j(`${n}; session control needs systemd on Linux`);return t}const pN=(e,t,n)=>({autostart:n,binary:t,launch:e.launch,log:e.log,path:e.path});async function mN(e,t){let n=fN(e),r;t.binary?(r=Bk(e),zk(r,u.default.readFileSync(t.binary))):r=await e.ensureBinary().catch(e=>{throw new j(e.message)}),Yk(e.serverHome,!0);let i=n?.write(pN(e,r,!0))??null;await e.restartHub(!0);let a=n?.linger();return{binary:r,kind:n?.kind??`process`,service:i,...a?{linger:a}:{}}}async function hN(e){let t=fN(e);Yk(e.serverHome,!1);let n=Bk(e),r=null;return t&&u.default.existsSync(t.file(!0))&&(r=t.write(pN(e,n,!1)),t.disable()),await e.restartHub(!1),{service:r}}async function gN(e){let{cloud:t}=e;try{await e.daemon.call(`status`,{})}catch{throw new j(`the daemon is not running; start it with: adeck 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 j(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 _N(e,t,n,r=cN(e).binary){let i=t.filter(e=>e.state===`running`&&e.attach),a=n?i.find(e=>e.taskId===n||e.artifact===n):i.length===1?i[0]:void 0;if(!a)throw i.length===0?new j(`no daemon session is running`):n?new j(`no running daemon session ${n}`):new j(`several daemon sessions are running; name one:\n${i.map(e=>` ${e.taskId} ${e.artifact}`).join(`
|
|
1241
|
+
`)}`);return[r,`attach`,a.attach]}const vN=[`install`,`uninstall`,`status`,`trust`,`devices`,`remote`,`sessions`,`attach`],yN=()=>ZE(process.env),bN=()=>process.env.RYUGI_ARTIFACTS_VERSION||`1.119.0`;function xN(){let e=XD();return{configHome:process.env.XDG_CONFIG_HOME||void 0,ensureBinary:()=>lA(e,bN()),home:m.default.homedir(),launch:Zk(e),log:e.log,path:process.env.PATH??`/usr/bin:/bin`,platform:process.platform,restartHub:e=>sN(bN(),{reason:`session-control`,startStopped:e}),run:aA,serverHome:e.home,uid:process.getuid?.()??0}}function SN(){let e=eD(process.env,process.platform,m.default.homedir()),t=yN(),n=$E(e,t);if(!n)throw new j(`sign in to Artideck Cloud (${t}) on this computer first`);return{origin:t,token:n.token,hostId:oN(e)}}const CN=()=>rN(nN());async function wN(e){try{return await e()}catch(e){let t=e.code;throw t===`ENOENT`||t===`ECONNREFUSED`?new j(`the daemon is not running; install it with: adeck daemon install`):new j(e.message)}}async function TN(){return(await wN(()=>CN().call(`sessions.local`,{}))).sessions}async function EN(e){let[t,n,r]=e.positionals;if(!t||!vN.includes(t))throw new j(`usage: adeck daemon ${vN.join(`|`)}`);let i=(e,n)=>({action:t,status:e,lines:n});switch(t){case`install`:{let t=await mN(xN(),{binary:e.values.binary});return i(`installed`,[`session control on`,`binary ${t.binary}`,...t.service?[`${t.kind.padEnd(8)}${t.service}`]:[],...t.linger?[dN(t.linger,m.default.userInfo().username)]:[]])}case`uninstall`:{let e=await hN(xN());return i(`removed`,[`session control off`,...e.service?[`service ${e.service}`]:[]])}case`status`:{let e=await wN(()=>CN().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 j(`usage: adeck daemon trust <code>`);let t=await gN({code:n,cloud:SN(),daemon:CN(),fetch,label:e.values.label});return i(`trusted`,[`${t.deviceId} ${t.label}`])}case`devices`:{if(n===`revoke`){if(!r)throw new j(`usage: adeck daemon devices revoke <device-id>`);let e=SN(),t=await fetch(`${e.origin}/api/devices/${encodeURIComponent(r)}`,{method:`DELETE`,headers:{Authorization:`Bearer ${e.token}`}});if(!t.ok&&t.status!==404)throw new j(`Cloud refused the revoke: HTTP ${t.status}`);return await wN(()=>CN().call(`trust.remove`,{deviceId:r})),i(`revoked`,[r])}let e=await wN(()=>CN().call(`trust.list`,{}));return i(`listed`,e.devices.length?e.devices.map(e=>`${e.id} ${e.label}`):[`no trusted devices; pair one from Artideck Cloud on the phone`])}case`remote`:if(n!==`on`&&n!==`off`)throw new j(`usage: adeck daemon remote on|off`);return await wN(()=>CN().call(`remote.set`,{on:n===`on`})),i(n,[`remote mode ${n}`]);case`sessions`:{let e=await TN();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,...t]=_N(m.default.homedir(),await TN(),n,process.env.RYUGI_DAEMON_BIN||void 0);return process.stderr.write(`This is a daemon session: it runs with permission checks bypassed.
|
|
1242
|
+
`),i((0,p.spawnSync)(e,t,{stdio:`inherit`}).status===0?`detached`:`failed`,[])}}}function DN({data:e}){return{heading:`Daemon`,status:e.status,summary:``,facts:[],sections:e.lines.length?[{kind:`content`,key:`lines`,text:e.lines.join(`
|
|
1243
|
+
`)}]:[]}}const ON={machine:!0,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 turns on session control: the hub (adeck-daemon, downloaded for this version and checked against its sha256, or --binary for a local build) then runs agent sessions itself, starts at login as a launchd agent on macOS or an enabled systemd user service on Linux, and turns on linger there so it keeps running after you log out. uninstall turns session control off; the hub keeps running without it. trust confirms the code shown on the phone with Artideck 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 adeck-daemon build instead of downloading one`},label:{type:`string`,value:`<name>`,help:`Name for the trusted device`}},semantic:e=>Z({id:`daemon`,mode:`finite`,output:{formats:[`brief`,`json`,`quiet`],scalar:e=>e.status},async run(){let t=await EN(e);return J(t,t.status===`failed`?{kind:`failed`,error:{code:`E_DAEMON`,message:`daemon ${t.action} failed`}}:{kind:`succeeded`})},present:DN},e)},kN=`artideck`,AN=`ryugi-artifacts`,jN=[kN,AN],MN=[`npm`,`pnpm`,`yarn`,`bun`],NN=[[`npx`,[`/_npx/`]],[`pnpm dlx`,[`/pnpm/dlx/`,`/.pnpm-store/dlx/`]],[`bunx`,[`/bunx-`,`/.bun/install/cache/`]]],PN=[[`pnpm`,[`/pnpm/global/`]],[`yarn`,[`/yarn/global/`]],[`bun`,[`/.bun/install/global/`]],[`npm`,jN.flatMap(e=>[`/lib/node_modules/${e}/`,`/npm/node_modules/${e}/`])]];function FN(e){let t=e.replaceAll(`\\`,`/`).toLowerCase();return t.includes(`/node_modules/ryugi-artifacts/`)||t.includes(`/ryugi-artifacts@`)?AN:kN}function IN(e,t){if(t.RYUGI_MANAGED_RUNTIME===`1`&&t.RYUGI_INSTALL_ROOT){let n=d.default.relative(d.default.join(t.RYUGI_INSTALL_ROOT,`versions`),e);if(n&&!n.startsWith(`..`)&&!d.default.isAbsolute(n))return{kind:`managed`}}if(t.RYUGI_ARTIFACTS_COMMAND)return{kind:`launcher`};let n=e;try{n=u.default.realpathSync(e)}catch{}let r=n.replaceAll(`\\`,`/`).toLowerCase(),i=e=>e.some(e=>r.includes(e));for(let[e,t]of NN)if(i(t))return{kind:`transient`,runner:e};for(let[e,t]of PN)if(i(t))return{kind:`global`,pm:e};return r.includes(`/node_modules/`)?{kind:`unknown`}:{kind:`local`}}const LN=(e=process.env)=>e.RYUGI_INSTALL_ROOT||d.default.join(e.XDG_DATA_HOME||d.default.join(m.default.homedir(),`.local/share`),`ryugi`,`install`),RN=(e=process.env)=>e.RYUGI_BIN_DIR||d.default.join(m.default.homedir(),`.local/bin`);function zN(e,t){u.default.mkdirSync(d.default.dirname(e),{recursive:!0});let n=`${e}.${(0,f.randomUUID)()}.tmp`;try{u.default.writeFileSync(n,`${JSON.stringify(t,null,2)}\n`,{flag:`wx`}),u.default.renameSync(n,e)}finally{u.default.rmSync(n,{force:!0})}}const BN=[`bin/ryugi.cjs`,`dist/cli.cjs`,`dist/document-engine.cjs`,`dist/loro_wasm_bg.wasm`,`dist/output-bootstrap.cjs`,`dist/viewer/index.html`,`dist/runtime/ryugi-ui.js`,`dist/runtime/ryugi-icons.js`,`dist/runtime/ryugi-mockup.js`],VN=e=>(0,f.createHash)(`sha256`).update(e).digest(`hex`);function HN(e){let t=(0,f.createHash)(`sha256`);function n(r){let i=d.default.join(e,r);if(t.update(r).update(`\0`),u.default.statSync(i).isDirectory())for(let e of u.default.readdirSync(i).sort())n(d.default.join(r,e));else t.update(u.default.readFileSync(i))}for(let e of[`bin`,`dist`,`package.json`])n(e);return t.digest(`hex`)}var UN=class{root;binDir;constructor(e=LN(),t=RN()){this.root=d.default.resolve(e),this.binDir=d.default.resolve(t)}get launcher(){return d.default.join(this.root,`launcher.cjs`)}get bin(){return d.default.join(this.binDir,process.platform===`win32`?`ryugi.cmd`:`ryugi`)}get aliasBin(){return d.default.join(this.binDir,process.platform===`win32`?`adeck.cmd`:`adeck`)}launcherSource(){return`#!/usr/bin/env node
|
|
1244
1244
|
// Ryugi managed runtime launcher v1
|
|
1245
1245
|
const fs = require('node:fs');
|
|
1246
1246
|
const path = require('node:path');
|
|
@@ -1253,90 +1253,90 @@ if (!relative || relative.startsWith('..') || path.isAbsolute(relative)) throw E
|
|
|
1253
1253
|
process.env.RYUGI_INSTALL_ROOT = root;
|
|
1254
1254
|
process.env.RYUGI_MANAGED_RUNTIME = '1';
|
|
1255
1255
|
require(path.join(current.packageRoot, 'dist/cli.cjs'));
|
|
1256
|
-
`}shimSource(){return`@echo off\r\nnode "${this.launcher}" %*\r\n`}owns(e){try{return process.platform===`win32`?u.default.readFileSync(e,`utf8`)===this.shimSource():u.default.lstatSync(e).isSymbolicLink()&&u.default.realpathSync(e)===u.default.realpathSync(this.launcher)}catch{return!1}}ownsBin(){return this.owns(this.bin)}ownsAlias(){return this.owns(this.aliasBin)}linkAlias(){if(!this.ownsAlias())try{process.platform===`win32`?u.default.writeFileSync(this.aliasBin,this.shimSource(),{flag:`wx`}):u.default.symlinkSync(this.launcher,this.aliasBin)}catch{}}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()&&
|
|
1256
|
+
`}shimSource(){return`@echo off\r\nnode "${this.launcher}" %*\r\n`}owns(e){try{return process.platform===`win32`?u.default.readFileSync(e,`utf8`)===this.shimSource():u.default.lstatSync(e).isSymbolicLink()&&u.default.realpathSync(e)===u.default.realpathSync(this.launcher)}catch{return!1}}ownsBin(){return this.owns(this.bin)}ownsAlias(){return this.owns(this.aliasBin)}linkAlias(){if(!this.ownsAlias())try{process.platform===`win32`?u.default.writeFileSync(this.aliasBin,this.shimSource(),{flag:`wx`}):u.default.symlinkSync(this.launcher,this.aliasBin)}catch{}}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()&&VN(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(!jN.includes(t.name)||!/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/.test(t.version))throw Error(`Invalid Artideck runtime package`);for(let t of BN)if(!u.default.existsSync(d.default.join(e,t)))throw Error(`Incomplete Artideck runtime: missing ${t}. Build or reinstall the complete package.`);let n=HN(e),r=this.current();if(r&&r.version===t.version&&r.digest===n&&this.ownsBin())try{if(HN(r.packageRoot)===n)return this.linkAlias(),r}catch{}let i=d.default.join(this.root,`versions`,`${t.version}-${(0,f.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,p.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,`artideck ${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)),this.linkAlias();let a={version:t.version,digest:n,launcherDigest:VN(this.launcherSource()),packageRoot:i,launcher:this.launcher,bin:this.bin};return zN(d.default.join(this.root,`current.json`),a),a}catch(e){throw u.default.rmSync(i,{recursive:!0,force:!0}),e}}};function WN(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 GN=`ryugi-dev`,KN=`Innei/artideck`,qN={full:`adeck@ryugi-dev`,artifacts:`adeck-lite@ryugi-dev`},JN={full:`ryugi@ryugi-dev`,artifacts:`ryugi-artifacts@ryugi-dev`},YN={marketplace:`adeck-managed`,plugin:`adeck`,id:`adeck@adeck-managed`},XN={marketplace:`ryugi-managed`,plugin:`ryugi`,id:`ryugi@ryugi-managed`},ZN=`using-adeck`,QN=[YN.plugin,XN.plugin],$N=[`full`,`artifacts`],eP=()=>[...Object.values(qN),...Object.values(JN)];function tP(e){for(let t of[qN,JN])for(let n of $N)if(e[t[n]]===!0)return n;return null}function nP(e){return e.harness===`cursor`?d.default.basename(e.path)===XN.plugin&&d.default.basename(d.default.dirname(e.path))===`local`:e.harness===`gemini`||e.harness===`agy`?(e.registration||XN.plugin)===XN.plugin:e.registration===XN.id}const rP=e=>{try{return JSON.parse(u.default.readFileSync(e,`utf8`))}catch{return null}};function iP(e=process.env,t=m.default.homedir()){let n=/* @__PURE__ */ new Set,r=e.CLAUDE_CONFIG_DIR||d.default.join(t,`.claude`),i=rP(d.default.join(r,`plugins`,`installed_plugins.json`))?.plugins;if(i&&typeof i==`object`)for(let e of Object.keys(i))eP().includes(e)&&n.add(e);let a=rP(d.default.join(LN(e),`installation.json`))?.harnesses;if(a&&typeof a==`object`)for(let e of Object.values(a))e?.harness&&e.harness!==`claude-code`&&n.add(`${nP(e)?XN.plugin:YN.plugin}@${e.harness}`);return[...n].sort().join(`,`)}function aP(e,t){try{return u.default.realpathSync(e)===u.default.realpathSync(t)}catch{return d.default.resolve(e)===d.default.resolve(t)}}function oP(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`);return!r||typeof r.installPath!=`string`?null:{path:r.installPath,source:typeof r.readFromFolder==`string`?r.readFromFolder:r.installPath,version:String(r.version||`unknown`)}}function sP(e,t){let n=oP(e,t);if(!n)throw Error(`Native Claude plugin not found: ${e}`);return n}function cP(e,t){if(!e.nativeSource||!e.registration)return`foreign`;let n=oP(e.registration,t);if(!n)return`missing`;if(aP(n.source,e.nativeSource))return`owned`;let[r,i]=e.registration.split(`@`),a=d.default.dirname(n.path);return n.source===n.path&&d.default.basename(a)===r&&d.default.basename(d.default.dirname(a))===i&&aP(a,d.default.dirname(e.nativeSource))?`owned`:`foreign`}function lP(e,t){let n=e.path;if(e.harness===`claude-code`){let n=cP(e,t);if(n===`missing`)throw Error(`Native Claude plugin not found: ${e.registration}`);return n===`owned`}if(e.harness===`codex`){let r=JSON.parse(t(`codex`,[`plugin`,`list`,`--json`]));return Array.isArray(r.installed)&&r.installed.some(t=>t.pluginId===(e.registration||XN.id)&&typeof t.source?.path==`string`&&aP(t.source.path,n))}if(e.harness===`pi`)return t(`pi`,[`list`]).split(/\r?\n/).some(e=>d.default.isAbsolute(e.trim())&&aP(e.trim(),n));if(e.harness===`gemini`){let r=JSON.parse(t(`gemini`,[`extensions`,`list`,`--output-format`,`json`]));return Array.isArray(r)&&r.some(t=>t.name===(e.registration||`ryugi`)&&t.installMetadata?.type===`link`&&typeof t.installMetadata.source==`string`&&aP(t.installMetadata.source,n)&&typeof t.path==`string`&&aP(t.path,n))}if(e.harness===`copilot`){let r=JSON.parse(t(`copilot`,[`plugin`,`list`,`--json`]));return Array.isArray(r)&&r.some(t=>`${t.name}@${t.marketplace}`===(e.registration||XN.id)&&typeof t.installedFrom==`string`&&aP(t.installedFrom,d.default.dirname(n)))}if(e.harness===`agy`){let r=JSON.parse(t(`agy`,[`plugin`,`list`,`--json`])),i=JSON.parse(u.default.readFileSync(d.default.join(n,`.antigravity-plugin/plugin.json`),`utf8`)).version;return Array.isArray(r)&&r.some(t=>t.name===(e.registration||`ryugi`)&&t.enabled!==!1&&t.version===i)}return!0}function uP(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===YN.marketplace&&(e===`codex`?typeof n.root==`string`&&aP(n.root,t):typeof n.source==`string`&&aP(n.source.replace(/^Local:\s*/i,``),t)))}function dP(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===YN.marketplace)}function fP(e){let t=(0,f.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 pP(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`,`sidecars`,`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|document-engine\.cjs|document-host\.cjs|loro_wasm_bg\.wasm|adeck-daemon(\.exe)?|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`?[ZN]:[]])if(!u.default.existsSync(d.default.join(t,`skills`,e,`SKILL.md`)))throw Error(`Incomplete Artideck 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`),`# Artideck
|
|
1257
1257
|
Use the artifacts and interface-craft skills when requested.
|
|
1258
1258
|
`);let e=d.default.join(t,`hooks/session-start`);u.default.existsSync(e)&&(u.default.renameSync(e,`${e}-implementation`),u.default.writeFileSync(e,`#!/usr/bin/env bash
|
|
1259
1259
|
exec bash "\${0%/*}/session-start-implementation" "$@" > /dev/null
|
|
1260
|
-
`,{mode:493}))}let r=d.default.join(t,`package.json`),i=JSON.parse(u.default.readFileSync(r,`utf8`));if(!
|
|
1260
|
+
`,{mode:493}))}let r=d.default.join(t,`package.json`),i=JSON.parse(u.default.readFileSync(r,`utf8`));if(!QN.includes(i.name)||typeof i.version!=`string`)throw Error(`Not an Artideck plugin package`);delete i.scripts,delete i.devDependencies,delete i[`simple-git-hooks`],delete i[`lint-staged`],u.default.writeFileSync(r,JSON.stringify(i,null,2));let a=fP(t).slice(0,12);for(let e of[`.codex-plugin/plugin.json`,`.cursor-plugin/plugin.json`,`.antigravity-plugin/plugin.json`,`.claude-plugin/plugin.json`,`gemini-extension.json`]){let r=d.default.join(t,e);if(!u.default.existsSync(r))continue;let o=JSON.parse(u.default.readFileSync(r,`utf8`));o.version=`${i.version}-${n}.${a}`,u.default.writeFileSync(r,JSON.stringify(o,null,2))}return{root:t,mode:n,version:i.version,digest:fP(t)}}catch(e){throw u.default.rmSync(t,{recursive:!0,force:!0}),e}}function mP(e,t,n=process.env.RYUGI_PLUGIN_REPO||`https://github.com/Innei/ryugi.git`){let r=d.default.join(e,`downloads`,(0,f.randomUUID)());u.default.mkdirSync(d.default.dirname(r),{recursive:!0});let i=`v${t}`,a=(0,p.spawnSync)(`git`,[`clone`,`--depth`,`1`,`--branch`,i,`--config`,`advice.detachedHead=false`,n,r],{encoding:`utf8`,timeout:12e4});if(a.error||a.status!==0)throw u.default.rmSync(r,{recursive:!0,force:!0}),Error(`Could not download the Artideck plugin release ${i} that matches this CLI (Git required): ${a.stderr||a.error?.message}`);return r}function hP(e,t,n){let r=/* @__PURE__ */ new Set,i=(n,a=!0)=>{let o=d.default.resolve(e,n),s=d.default.relative(e,o);if(!s||s.startsWith(`..`)||d.default.isAbsolute(s)||!u.default.existsSync(o))throw Error(`Incomplete ${t} plugin: missing or invalid ${n}`);if(r.has(o))return o;if(r.add(o),a&&u.default.statSync(o).isFile()&&/\.(?:[cm]?js|ts)$/.test(o)){let r=u.default.readFileSync(o,`utf8`);for(let a of r.matchAll(/(?:require\(\s*|from\s*)['"](\.{1,2}\/[^'"]+)['"]/g)){let r=d.default.resolve(d.default.dirname(o),a[1]),s=[r,`${r}.cjs`,`${r}.js`,`${r}.json`].find(e=>u.default.existsSync(e)&&u.default.statSync(e).isFile());if(!s)throw Error(`Incomplete ${t} plugin: missing dependency ${a[1]} from ${n}`);i(d.default.relative(e,s))}}return o},a=e=>JSON.parse(u.default.readFileSync(i(e,!1),`utf8`));for(let e of[`artifacts`,`interface-craft`,...n===`full`?[ZN,`brainstorming`,`executing-specs`,`systematic-debugging`,`test-driven-development`,`using-git-worktrees`,`verifying`]:[]])i(`skills/${e}/SKILL.md`,!1);if(i(`skills/artifacts/app/ryugi.cjs`),i(`skills/artifacts/app/output-bootstrap.cjs`),t===`pi`){let e=a(`package.json`);if(!Array.isArray(e.pi?.extensions)||!e.pi.extensions.length)throw Error(`Incomplete pi plugin: missing native extension declaration`);for(let t of e.pi.extensions)i(t);i(`.pi/extensions/ryugi.ts`)}if((t===`codex`||t===`agy`)&&i(`skills/artifacts/app/hook-bin.sh`,!1),t===`codex`||t===`cursor`){let e=a(`.${t}-plugin/plugin.json`);if(typeof e.hooks!=`string`)throw Error(`Incomplete ${t} plugin: missing native hooks declaration`);let n=a(e.hooks),r=e=>{if(Array.isArray(e))e.forEach(r);else if(e&&typeof e==`object`)Object.values(e).forEach(r);else if(typeof e==`string`){for(let t of e.matchAll(/\$\{(?:PLUGIN_ROOT|CLAUDE_PLUGIN_ROOT|CURSOR_PLUGIN_ROOT)\}\/([^\s"']+)/g))i(t[1]);e.startsWith(`./hooks/`)&&i(e.split(/\s/)[0])}};r(n),t===`cursor`&&(i(`hooks/run-hook.cmd`,!1),i(`hooks/session-start`,!1))}if(t===`gemini`&&i(a(`gemini-extension.json`).contextFileName||`GEMINI.md`,!1),t===`opencode`&&i(`.opencode/plugins/ryugi.js`),t===`copilot`&&a(`.claude-plugin/plugin.json`),t===`agy`){a(`.antigravity-plugin/plugin.json`),a(`hooks/hooks-antigravity.json`);for(let e of[`run-hook.cmd`,`session-start`,`user-prompt-submit`,`stop`,`agent-event`,`project-root.sh`])i(`hooks/${e}`,!1)}}const gP=[{id:`claude-code`,command:`claude`,label:`Claude Code`,comments:`native monitor`},{id:`codex`,command:`codex`,label:`Codex`,comments:`native hooks; trust them in Codex Settings → Hooks`},{id:`cursor`,command:`cursor`,label:`Cursor`,comments:`read comments on request`},{id:`gemini`,command:`gemini`,label:`Gemini CLI`,comments:`read comments on request`},{id:`opencode`,command:`opencode`,label:`OpenCode`,comments:`read comments on request`},{id:`pi`,command:`pi`,label:`Pi`,comments:`native extension`},{id:`copilot`,command:`copilot`,label:`GitHub Copilot CLI`,comments:`read comments on request`},{id:`agy`,command:`agy`,label:`Antigravity`,comments:`native hooks + LS watch`}],_P=(e,t,n=9e4)=>{if(process.platform===`win32`&&[e,...t].some(e=>/["%\r\n&|<>^]/.test(e)))throw Error(`Unsupported character in Windows native command argument`);let r=process.platform===`win32`?(0,p.spawnSync)([e,...t].map(e=>`"${e}"`).join(` `),{shell:!0,encoding:`utf8`,timeout:n,stdio:[`ignore`,`pipe`,`pipe`]}):(0,p.spawnSync)(e,t,{encoding:`utf8`,timeout:n,stdio:[`ignore`,`pipe`,`pipe`]});if(r.error||r.status!==0)throw Error(`${e} ${t.join(` `)} failed: ${(r.stderr||r.stdout||r.error?.message||``).trim()}`);return r.stdout};function vP(e=m.default.homedir(),t=_P){return gP.map(n=>{let r=!1;try{t(n.command,[`--version`],2e3),r=!0}catch{}return n.id===`cursor`&&u.default.existsSync(d.default.join(e,`.cursor`))&&(r=!0),{...n,detected:r,reason:r?null:`${n.command} not found on PATH`}})}const yP=e=>{try{return u.default.lstatSync(e),!0}catch{return!1}},bP=(e,t)=>JSON.parse(u.default.readFileSync(d.default.join(e,t),`utf8`)).name;function xP(e,t){return e===`cursor`?d.default.join(t.home||m.default.homedir(),`.cursor/plugins/local`,YN.plugin):d.default.join(t.root,`plugins`,e,`plugin`)}const SP=d.default.join(`.cursor`,`plugins`,`local`,XN.plugin),CP=nP;function wP(e,t){return e.harness===`cursor`&&CP(e)?d.default.join(t.home||m.default.homedir(),SP):xP(e.harness,t)}function TP(e,t){if(d.default.resolve(e.path)!==d.default.resolve(t))throw Error(`Installation path no longer matches owned ${e.harness} path`);if(!u.default.existsSync(e.path)||fP(e.path)!==e.digest)throw Error(`Installed ${e.harness} files changed; preserving user edits at ${e.path}`)}function EP(e,t,n){u.default.mkdirSync(d.default.dirname(t),{recursive:!0}),u.default.writeFileSync(t,JSON.stringify({name:n.marketplace,owner:{name:`Innei`},plugins:[{name:n.plugin,source:e===`codex`?{source:`local`,path:`./plugin`}:`./plugin`,policy:{installation:`AVAILABLE`,authentication:`ON_INSTALL`}}]}))}function DP(e,t,n){let r=e===`codex`?`.agents/plugins/marketplace.json`:`.claude-plugin/marketplace.json`;EP(e,d.default.join(t,r),XN),n(e,[`plugin`,`marketplace`,`add`,t]),n(e,[`plugin`,e===`codex`?`add`:`install`,XN.id])}function OP(e,t,n){hP(t.root,e,t.mode);let r=xP(e,n),i=n.previous,a=n.run||_P,o=n.env||process.env,s=n.home||m.default.homedir(),c=i&&d.default.resolve(i.path)!==d.default.resolve(r)?i.path:null;if(c&&TP(i,c),yP(r)){if(!i||c)throw Error(`Plugin already exists and is not owned by this installer: ${r}`);TP(i,r)}else if(i&&!c)throw Error(`Owned plugin is missing at ${r}; run doctor before reinstalling`);if(!i&&[`codex`,`gemini`,`pi`,`copilot`,`agy`].includes(e)){let t=e===`codex`?[`plugin`,`list`,`--json`]:e===`gemini`?[`extensions`,`list`]:e===`pi`?[`list`]:e===`agy`?[`plugin`,`list`,`--json`]:[`plugin`,`list`];if(/\b(ryugi|adeck)\b/i.test(a(gP.find(t=>t.id===e).command,t)))throw Error(`An existing Artideck ${e} install is managed elsewhere. Remove it with that harness before installing here.`)}if(i&&!lP(i,a))throw Error(`Native ${e} source changed or is no longer registered; preserving it`);let l=i?.registration===XN.id;if((!i||l)&&(e===`codex`||e===`copilot`)&&dP(e,a))throw Error(`Native ${e} marketplace ${YN.marketplace} is owned elsewhere`);let p=d.default.dirname(r);u.default.mkdirSync(p,{recursive:!0});let h=d.default.join(p,`.candidate-${(0,f.randomUUID)()}`),g=d.default.join(p,`.previous-${(0,f.randomUUID)()}`);u.default.cpSync(t.root,h,{recursive:!0});let _=i?.registration,y=!1,b=!1,x,S,C=(e,t,r,i)=>{let o=n.effects?.begin(e,i),s=a(t,r);return o!==void 0&&n.effects.confirm(o),s};try{if(yP(r)&&(u.default.renameSync(r,g),y=!0),u.default.renameSync(h,r),e===`copilot`){u.default.mkdirSync(d.default.join(r,`hooks`),{recursive:!0});let e=d.default.join(r,`hooks/managed-bootstrap.cjs`);u.default.writeFileSync(e,`const fs = require('node:fs');
|
|
1261
1261
|
const path = require('node:path');
|
|
1262
|
-
const skill = path.join(__dirname, '../skills/${
|
|
1262
|
+
const skill = path.join(__dirname, '../skills/${ZN}/SKILL.md');
|
|
1263
1263
|
console.log(JSON.stringify(fs.existsSync(skill) ? { additionalContext: fs.readFileSync(skill, 'utf8') } : {}));
|
|
1264
|
-
`),u.default.writeFileSync(d.default.join(r,`hooks/hooks.json`),JSON.stringify({version:1,hooks:{sessionStart:[{type:`command`,exec:`node`,args:[e]}]}}))}if(e===`codex`||e===`copilot`){let t=d.default.dirname(r),n=e===`codex`?`.agents/plugins/marketplace.json`:`.claude-plugin/marketplace.json`;
|
|
1264
|
+
`),u.default.writeFileSync(d.default.join(r,`hooks/hooks.json`),JSON.stringify({version:1,hooks:{sessionStart:[{type:`command`,exec:`node`,args:[e]}]}}))}if(e===`codex`||e===`copilot`){let t=d.default.dirname(r),n=e===`codex`?`.agents/plugins/marketplace.json`:`.claude-plugin/marketplace.json`;EP(e,d.default.join(t,n),YN),l&&(x=()=>DP(e,t,a),C(`install.native-legacy-remove`,e,[`plugin`,e===`codex`?`remove`:`uninstall`,XN.id],XN.id),C(`install.native-legacy-marketplace-remove`,e,[`plugin`,`marketplace`,`remove`,XN.marketplace],XN.marketplace)),(!i||l)&&(C(`install.native-marketplace`,e,[`plugin`,`marketplace`,`add`,t],t),b=!0),C(`install.native-plugin`,e,[`plugin`,e===`codex`?`add`:`install`,YN.id],YN.id),_=YN.id}else if(e===`pi`)i||C(`install.native-package`,`pi`,[`install`,r],r),_=r;else if(e===`gemini`){let e=bP(r,`gemini-extension.json`);i&&i.registration!==e&&(C(`install.native-legacy-remove`,`gemini`,[`extensions`,`uninstall`,i.registration||`ryugi`],i.registration||`ryugi`),x=()=>a(`gemini`,[`extensions`,`link`,r,`--consent`])),i&&i.registration===e||(C(`install.native-extension`,`gemini`,[`extensions`,`link`,r,`--consent`],r),S=()=>a(`gemini`,[`extensions`,`uninstall`,e])),_=e}else if(e===`agy`){u.default.copyFileSync(d.default.join(r,`hooks/hooks-antigravity.json`),d.default.join(r,`hooks.json`)),t.mode===`artifacts`&&yP(d.default.join(r,`hooks/session-start-implementation`))&&u.default.writeFileSync(d.default.join(r,`hooks/session-start`),`#!/usr/bin/env bash
|
|
1265
1265
|
bash "\${0%/*}/session-start-implementation" "$@" > /dev/null
|
|
1266
1266
|
printf "{}\\n"
|
|
1267
|
-
`,{mode:493});for(let e of[`hooks/hooks.json`,`hooks/hooks-cursor.json`,`hooks/hooks-antigravity.json`,`GEMINI.md`,`gemini-extension.json`,`AGENTS.md`])u.default.rmSync(d.default.join(r,e),{recursive:!0,force:!0});let e=
|
|
1268
|
-
`)}]:[]}}const
|
|
1269
|
-
`),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===``){
|
|
1270
|
-
`){a&&(r+=
|
|
1271
|
-
`&&(i&&
|
|
1272
|
-
`)}const
|
|
1267
|
+
`,{mode:493});for(let e of[`hooks/hooks.json`,`hooks/hooks-cursor.json`,`hooks/hooks-antigravity.json`,`GEMINI.md`,`gemini-extension.json`,`AGENTS.md`])u.default.rmSync(d.default.join(r,e),{recursive:!0,force:!0});let e=bP(r,`.antigravity-plugin/plugin.json`);i&&(i.registration||`ryugi`)!==e?(C(`install.native-legacy-remove`,`agy`,[`plugin`,`uninstall`,i.registration||`ryugi`],i.registration||`ryugi`),x=()=>a(`agy`,[`plugin`,`install`,r]),C(`install.native-plugin`,`agy`,[`plugin`,`install`,r],r),S=()=>a(`agy`,[`plugin`,`uninstall`,e])):C(`install.native-plugin`,`agy`,[`plugin`,`install`,r],r),_=e}else if(e===`opencode`){let e=d.default.join(o.XDG_CONFIG_HOME||d.default.join(s,`.config`),`opencode/plugins/ryugi.js`),t=`export { default, RyugiPlugin } from ${JSON.stringify((0,v.pathToFileURL)(d.default.join(r,`.opencode/plugins/ryugi.js`)).href)};\n`;if(yP(e)&&(!i||u.default.readFileSync(e,`utf8`)!==t))throw Error(`OpenCode plugin entry is not owned: ${e}`);u.default.mkdirSync(d.default.dirname(e),{recursive:!0}),u.default.writeFileSync(e,t),_=e}let n={harness:e,mode:t.mode,path:r,digest:fP(r),version:t.version,registration:_};if(!lP(n,a))throw Error(`Native ${e} did not recognize the installed source`);return c&&u.default.rmSync(c,{recursive:!0,force:!0}),n}catch(t){if(b&&(e===`codex`||e===`copilot`))try{if(!uP(e,p,a))throw Error(`Marketplace source no longer matches`,{cause:t});C(`install.native-marketplace-remove`,e,[`plugin`,`marketplace`,`remove`,YN.marketplace],p)}catch(e){throw Error(`${t.message}; marketplace registration remains and its candidate is retained at ${r}: ${e.message}`,{cause:e})}if(u.default.rmSync(r,{recursive:!0,force:!0}),y&&u.default.renameSync(g,r),x)try{S?.(),x()}catch(e){throw Error(`${t.message}; the ryugi plugin could not be registered again: ${e.message}`,{cause:e})}throw t}finally{u.default.rmSync(h,{recursive:!0,force:!0}),yP(r)&&u.default.rmSync(g,{recursive:!0,force:!0})}}const kP=e=>e===`antigravity`?`agy`:e;function AP(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 jP(e,t){zN(d.default.join(e,`installation.json`),t)}function MP(e,t,n={}){let r=AP(e),i=[];for(let a of Object.values(r.harnesses)){if(!a||a.harness===`claude-code`)continue;let o=d.default.join(e,`candidates`,(0,f.randomUUID)());try{let s=pP(t,o,a.mode);if(s.digest===(a.sealed??a.digest)){i.push({harness:a.harness,status:`current`});continue}let c=OP(a.harness,s,{...n,root:e,previous:a});r.harnesses[a.harness]={...c,sealed:s.digest},jP(e,r),i.push({harness:a.harness,status:`refreshed`})}catch(e){i.push({harness:a.harness,status:`failed`,error:e.message})}finally{u.default.rmSync(o,{recursive:!0,force:!0})}}return i}const NP=e=>[`cli.cjs`,`document-engine.cjs`,`loro_wasm_bg.wasm`,e===`win32`?`adeck-daemon.exe`:`adeck-daemon`,`output-bootstrap.cjs`],PP=[`viewer`,`runtime`],FP=e=>d.default.join(we(e),`dev.json`),IP=e=>d.default.join(we(e),`dev`,`builds`),LP=e=>d.default.join(we(e),`dev`,`bin`,`adeck-daemon`);function RP(e,t=FP(e)){try{let e=JSON.parse(u.default.readFileSync(t,`utf8`)),n=[`build`,`plugin`,`version`,`linkedAt`];return n.every(t=>typeof e?.[t]==`string`)?Object.fromEntries(n.map(t=>[t,e[t]])):null}catch{return null}}function zP(e,t){let n=[...NP(t),...PP].filter(t=>!u.default.existsSync(d.default.join(e,t)));if(n.length)throw Error(`${e} is not a complete build: it has no ${n.join(`, `)}`);let r=[...NP(t)];for(let t of PP)for(let n of u.default.readdirSync(d.default.join(e,t),{recursive:!0}).map(String))u.default.statSync(d.default.join(e,t,n)).isFile()&&r.push(d.default.join(t,n));return r.sort()}function BP(e,t){let n=(0,f.createHash)(`sha256`);for(let r of t)n.update(`${r.split(d.default.sep).join(`/`)}\0`),n.update(u.default.readFileSync(d.default.join(e,r)));return n.digest(`hex`).slice(0,12)}function VP(e,t,n){if(u.default.existsSync(n)){let e=/* @__PURE__ */ new Date;u.default.utimesSync(n,e,e);return}let r=d.default.join(d.default.dirname(n),`.staging-${(0,f.randomUUID)()}`);try{for(let n of t)u.default.mkdirSync(d.default.dirname(d.default.join(r,n)),{recursive:!0}),u.default.copyFileSync(d.default.join(e,n),d.default.join(r,n)),u.default.chmodSync(d.default.join(r,n),u.default.statSync(d.default.join(e,n)).mode);u.default.renameSync(r,n)}catch(e){if(u.default.rmSync(r,{recursive:!0,force:!0}),!u.default.existsSync(n))throw e}}function HP(e,t,n){let r=LP(t),i=u.default.readFileSync(e),a=(0,f.createHash)(`sha256`).update(i).digest(`hex`),o=`${r}.source`;if(u.default.existsSync(r)&&u.default.existsSync(o)&&u.default.readFileSync(o,`utf8`).trim()===a)return r;u.default.mkdirSync(d.default.dirname(r),{recursive:!0});let s=`${r}.${(0,f.randomUUID)()}`;try{u.default.writeFileSync(s,i),u.default.chmodSync(s,493),n?.(s),u.default.renameSync(s,r)}catch(e){throw u.default.rmSync(s,{force:!0}),e}u.default.writeFileSync(o,`${a}\n`);let c=d.default.join(d.default.dirname(r),`ryugi-daemon`);for(let e of[c,`${c}.source`])u.default.rmSync(e,{force:!0});return r}function UP(e){try{return u.default.readlinkSync(e)}catch{return null}}function WP(e,t){let n=d.default.join(e,`adeck-daemon`);if(UP(n)===t)return;let r=`${n}.${(0,f.randomUUID)()}`;u.default.symlinkSync(t,r),u.default.renameSync(r,n)}function GP(e){try{let t=JSON.parse(u.default.readFileSync(d.default.join(e,`launch.json`),`utf8`))?.env?.RYUGI_DOCUMENT_ENGINE;return typeof t==`string`?d.default.basename(d.default.dirname(t)):null}catch{return null}}function KP(e,t){let n=IP(e),r=u.default.readdirSync(n).filter(e=>!e.startsWith(`.`)).map(e=>({name:e,at:u.default.statSync(d.default.join(n,e)).mtimeMs})).sort((e,t)=>t.at-e.at),i=/* @__PURE__ */ new Set([...t,...r.slice(0,3).map(e=>e.name)]);for(let{name:e}of r)i.has(e)||u.default.rmSync(d.default.join(n,e),{recursive:!0,force:!0})}function qP(e,t){let n=FP(e);u.default.mkdirSync(d.default.dirname(n),{recursive:!0,mode:448});let r=`${n}.${process.pid}.${(0,f.randomUUID)()}`;u.default.writeFileSync(r,`${JSON.stringify(t,null,2)}\n`),u.default.renameSync(r,n)}function JP(e){let t=d.default.resolve(e.source),n=zP(t,e.platform),r=BP(t,n);u.default.mkdirSync(IP(e.home),{recursive:!0});let i=d.default.join(IP(e.home),r);VP(t,n,i),e.platform===`darwin`&&WP(i,HP(d.default.join(t,`adeck-daemon`),e.home,e.sign));let a={build:i,plugin:d.default.resolve(e.plugin),version:`local-${r}`,linkedAt:(/* @__PURE__ */ new Date()).toISOString()};return qP(e.home,a),KP(e.home,[r,GP(e.serverHome),GP(d.default.join(we(e.home),`server`))]),a}function YP(e){try{return u.default.unlinkSync(FP(e)),!0}catch{return!1}}function XP(){let e=(0,p.spawnSync)(`security`,[`find-identity`,`-v`,`-p`,`codesigning`],{encoding:`utf8`});return/"(Developer ID Application: [^"]+)"/.exec(e.stdout??``)?.[1]}function ZP(e,t){if(t!==`darwin`)return;let n=e.RYUGI_DEV_SIGN_IDENTITY??XP();if(n)return e=>{let t=(0,p.spawnSync)(`codesign`,[`--force`,`--sign`,n,`--identifier`,`dev.ryugi.daemon`,`--timestamp=none`,e],{encoding:`utf8`});if(t.status!==0)throw Error(`codesign could not sign the daemon with "${n}": ${(t.stderr||t.error?.message||``).trim()}. Set RYUGI_DEV_SIGN_IDENTITY to another identity, or to an empty value to link it unsigned.`)}}function QP(e){let t=m.default.homedir(),n=e.values.plugin??RP(t)?.plugin??void 0;if(!n)throw new j(`name the Artideck plugin checkout: adeck dev link --plugin <dir>`);if(!u.default.existsSync(d.default.join(n,`skills/artifacts/app/ryugi.cjs`)))throw new j(`${n} is not an Artideck plugin checkout: it has no skills/artifacts/app/ryugi.cjs`);try{return JP({source:e.positionals[1]??__dirname,plugin:n,home:t,platform:process.platform,serverHome:XD().home,sign:ZP(process.env,process.platform)})}catch(e){throw new j(e.message)}}function $P(e){let t=e.positionals[0]??`status`;if(t===`link`){let n=QP(e);return{action:t,status:`linked`,link:n,refreshed:MP(LN(),n.plugin,{run:_P})}}if(t===`unlink`)return{action:t,status:YP(m.default.homedir())?`unlinked`:`none`,link:null,refreshed:[]};if(t===`status`){let e=RP(m.default.homedir());return{action:t,status:e?`linked`:`none`,link:e,refreshed:[]}}throw new j(`usage: adeck dev link|unlink|status`)}function eF({data:e}){return{heading:`Dev link`,status:e.status,summary:e.link?e.link.version:`every agent runs its own CLI or an npm release`,facts:[],sections:e.link?[{kind:`content`,key:`link`,text:[`build ${e.link.build}`,`plugin ${e.link.plugin}`,...e.refreshed.map(e=>`copy ${e.harness} ${e.status}${e.error?`: ${e.error}`:``}`)].join(`
|
|
1268
|
+
`)}]:[]}}const tF={machine:!0,name:`dev`,summary:`Point every agent on this machine at a local development build`,usage:[`link [<build dir>] [--plugin <checkout>]`,`unlink`,`status`],details:`link freezes a complete build (the directory of this CLI by default) under ~/.artideck/dev/builds/<fingerprint> and records it in ~/.artideck/dev.json with the plugin checkout; every Ryugi launcher then runs that CLI and hub, and the plugin checkout's adeck-hook build. unlink removes the record; launchers go back to their own CLI or npm releases.`,positionals:2,options:{plugin:{type:`string`,value:`<checkout>`,help:`Artideck plugin checkout to link`}},semantic:e=>Z({id:`dev`,mode:`finite`,output:{formats:[`brief`,`json`,`quiet`],scalar:e=>e.status},run:()=>J($P(e)),present:eF},e)},nF=[`/opt/homebrew/bin`,`/usr/local/bin`],rF=process.platform===`win32`?[`agent-browser.cmd`,`agent-browser.exe`]:[`agent-browser`],iF=e=>{try{return u.default.accessSync(e,u.default.constants.X_OK),u.default.statSync(e).isFile()}catch{return!1}},aF=e=>{let t=d.default.join(e,`.nvm`,`versions`,`node`);try{return u.default.readdirSync(t).sort().reverse().map(e=>d.default.join(t,e,`bin`))}catch{return[]}};function oF(e,t,n,r){return[...(e.PATH??``).split(d.default.delimiter),r,e.PNPM_HOME??``,d.default.join(t,`Library`,`pnpm`,`bin`),d.default.join(t,`.local`,`share`,`pnpm`),d.default.join(t,`.local`,`bin`),d.default.join(t,`.bun`,`bin`),d.default.join(t,`.npm-global`,`bin`),d.default.join(t,`.volta`,`bin`),d.default.join(t,`.asdf`,`shims`),d.default.join(t,`.local`,`share`,`mise`,`shims`),...aF(t),...n].filter(Boolean)}function sF({env:e=process.env,home:t=m.default.homedir(),extraDirs:n=nF,nodeDir:r=d.default.dirname(process.execPath)}={}){let i=e.RYUGI_AGENT_BROWSER;if(i)return iF(i)?i:null;for(let i of oF(e,t,n,r))for(let e of rF){let t=d.default.join(i,e);if(iF(t))return t}return null}const cF=(e=process.env)=>({...e,PATH:[d.default.dirname(process.execPath),e.PATH??``].filter(Boolean).join(d.default.delimiter)});function lF(e){let t=(0,p.spawnSync)(e,[`--version`],{encoding:`utf8`,timeout:5e3,env:cF()});return/(\d+\.\d+\.\d+\S*)/.exec(t.stdout??``)?.[1]??null}const uF=e=>{let t=Buffer.alloc(8);return t.writeBigUInt64LE(BigInt(e)),t};function dF(e){let t=(0,f.createHash)(`sha256`).update(`codex-plugin-bundle-v1`),n=[e];for(;n.length;){let r=n.pop(),i=d.default.relative(e,r),a=i?d.default.basename(i):``;if(a&&(a===`__pycache__`||a===`.venv`||a.endsWith(`.pyc`)||a.endsWith(`.egg-info`)))continue;let o=Buffer.from(i);t.update(uF(o.length)).update(o);let s=u.default.lstatSync(r);if(s.isDirectory()){t.update(`directory`);let e=u.default.readdirSync(r).sort((e,t)=>Buffer.compare(Buffer.from(e),Buffer.from(t)));for(let t=e.length-1;t>=0;t--)n.push(d.default.join(r,e[t]))}else if(s.isFile())t.update(`file`).update(uF(s.size)).update(u.default.readFileSync(r));else throw Error(`Unsupported Codex plugin entry: ${r}`)}return`sha256:${t.digest(`hex`)}`}const fF=e=>e.replaceAll(/(?<=[a-z\d])([A-Z])/g,`_$1`).toLowerCase();function pF(e,t){let n=JSON.parse(u.default.readFileSync(d.default.join(e,`.codex-plugin/plugin.json`),`utf8`));if(typeof n.hooks!=`string`)return[];let r=d.default.posix.normalize(n.hooks.replaceAll(`\\`,`/`)),i=JSON.parse(u.default.readFileSync(d.default.join(e,r),`utf8`)).hooks??{},a=[];for(let[e,n]of Object.entries(i))n.forEach((n,i)=>(n.hooks??[]).forEach((n,o)=>a.push(`${t}:${r}:${fF(e)}:${i}:${o}`)));return a}function mF(e){let t=/* @__PURE__ */ new Map,n;for(let r of e.split(/\r?\n/)){let e=r.match(/^\s*\[\s*hooks\.state\."((?:[^"\\]|\\.)*)"\s*\]\s*$/);if(e){n={},t.set(JSON.parse(`"${e[1]}"`),n);continue}if(/^\s*\[/.test(r)){n=void 0;continue}let i=r.match(/^\s*([\w-]+)\s*=\s*(.+?)\s*$/);n&&i&&(n[i[1]]=i[2].replace(/^"(.*)"$/,`$1`))}return t}function hF(e,t,n,r=m.default.homedir()){let i=pF(e,t),a=d.default.join(n.CODEX_HOME||d.default.join(r,`.codex`),`config.toml`),o=mF(u.default.existsSync(a)?u.default.readFileSync(a,`utf8`):``),s=dF(e),c=i.filter(e=>{let t=o.get(e);return t?.trusted_content_hash!==s||t.enabled===`false`});return{declared:i.length,blocked:c.length}}const gF=12096e5,_F=e=>d.default.join(Ek(e),`plugins.json`);function vF(e,t){u.default.mkdirSync(Ek(e),{recursive:!0,mode:448});let n=`${_F(e)}.${process.pid}.tmp`;u.default.writeFileSync(n,JSON.stringify(t)),u.default.renameSync(n,_F(e))}function yF(e){try{let t=JSON.parse(u.default.readFileSync(_F(e),`utf8`));return Array.isArray(t?.plugins)?{complete:t.complete===!0,plugins:t.plugins.filter(e=>typeof e?.version==`string`&&Ck(e.version))}:null}catch{return null}}const bF=e=>{try{return u.default.statSync(e).mtimeMs}catch{return null}};function xF(e){let t=Ek(e.home),n=[],r=[];try{r=u.default.readdirSync(t)}catch{}for(let i of r){if(!Ck(i)||e.keep.has(i))continue;let r=d.default.join(t,i),a=bF(d.default.join(r,`last-used`)),o=bF(r),s=bF(d.default.join(r,`.lock`)),c=(t,n)=>t!==null&&e.now-t<n;c(a,gF)||a===null&&c(o,gF)||c(s,3e5)||(u.default.rmSync(r,{recursive:!0,force:!0}),n.push(i))}let i=d.default.join(t,`.legacy-removed`);if(!e.legacyInUse&&!u.default.existsSync(i)){let n=e.env.XDG_CACHE_HOME||d.default.join(e.home,`.cache`);u.default.rmSync(d.default.join(n,`ryugi`,`hook`),{recursive:!0,force:!0}),u.default.mkdirSync(t,{recursive:!0,mode:448}),u.default.writeFileSync(i,``)}return n}async function SF(e){if(d.default.resolve(e.serverHome)!==d.default.join(we(e.home),`server`))return{status:`other-hub`};let t=e.now??Date.now(),n=e.installed??yF(e.home),r=n?.plugins??[],i=/* @__PURE__ */ new Set([e.version,...r.filter(e=>!e.legacy).map(e=>e.version)]),a=[],o=[],{progress:s}=e,c=await Promise.all([...i].map(n=>Pk({...e,version:n,now:t,onProgress:s&&((e,t)=>s(n,e,t))})));return[...i].forEach((e,t)=>{let n=c[t];n.status===`installed`&&a.push(e),(n.status===`failed`||n.status===`skipped`&&n.error)&&o.push({version:e,error:n.error??`failed`})}),{status:`done`,prefetched:a,failed:o,removed:e.cleanup?xF({env:e.env,home:e.home,keep:i,legacyInUse:!n?.complete||r.some(e=>e.legacy),now:t}):[]}}const CF=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),wF=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,TF=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,EF=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,DF=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,OF=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,kF=/\t{1,1000}/y,AF=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,jF=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,MF=/\p{M}+/gu,NF={limit:1/0,ellipsis:``},PF=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?PF(i,NF,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[jF,l],[EF,0],[DF,o],[kF,s],[AF,c],[OF,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;e:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(MF,``)){let t=e.codePointAt(0)||0;if(S=wF(t)?2:TF(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break e}h+=e.length,x+=S}y=b=0}if(p>=m)break;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===OF?CF(e.slice(p,n.lastIndex)):n===AF?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break e}x+=S,y=f,b=p,p=f=n.lastIndex;continue e}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},FF={limit:1/0,ellipsis:``,ellipsisWidth:0},IF=(e,t={})=>PF(e,FF,t).width,LF=`]8;;`,RF=RegExp(`(?:\\[(?<code>\\d+)m|\\${LF}(?<uri>.*))`,`y`),zF=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},BF=e=>`[${e}m`,VF=e=>`${LF}${e}`,HF=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:IF(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=IF(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(LF,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},UF=e=>{let t=e.split(` `),n=t.length;for(;n&&!IF(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},WF=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=IF(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=IF(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),HF(s,r,t),c=IF(s.at(-1)??``)}else{if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){HF(s,r,t),c=IF(s.at(-1)??``);continue}s.push(``),c=0}c+i>t&&n.wordWrap===!1?(HF(s,r,t),c=IF(s.at(-1)??``)):(s[s.length-1]+=r,c+=i)}}n.trim!==!1&&(s=s.map(e=>UF(e)));let l=s.join(`
|
|
1269
|
+
`),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===``){RF.lastIndex=e+1;let t=RF.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
|
|
1270
|
+
`){a&&(r+=VF(``));let e=i?zF(i):void 0;i&&e&&(r+=BF(e))}else t===`
|
|
1271
|
+
`&&(i&&zF(i)&&(r+=BF(i)),a&&(r+=VF(a)))}return r},GF=/\r?\n/;function KF(e,t,n){return String(e).normalize().split(GF).map(e=>WF(e,t,n)).join(`
|
|
1272
|
+
`)}const qF={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`},JF={screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let n=0;n<e;n++)t+=this.line+(n<e-1?qF.up():``);return e&&(t+=qF.left),t}};function YF(e,t,n){if(!n.some(e=>!e.disabled))return e;let r=e+t,i=Math.max(n.length-1,0),a=r<0?i:r>i?0:r;return n[a]?.disabled?YF(a,t<0?-1:1,n):a}const XF={actions:/* @__PURE__ */ new Set([`up`,`down`,`left`,`right`,`space`,`enter`,`cancel`]),aliases:/* @__PURE__ */ new Map([[`k`,`up`],[`j`,`down`],[`h`,`left`],[`l`,`right`],[``,`cancel`],[`escape`,`cancel`]]),messages:{cancel:`Canceled`,error:`Something went wrong`},withGuide:!0,accessible:void 0,date:{monthNames:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],messages:{required:`Please enter a valid date`,invalidMonth:`There are only 12 months in a year`,invalidDay:(e,t)=>`There are only ${e} days in ${t}`,afterMin:e=>`Date must be on or after ${e.toISOString().slice(0,10)}`,beforeMax:e=>`Date must be on or before ${e.toISOString().slice(0,10)}`}}};function ZF(e){if(e!==void 0)return e;if(XF.accessible!==void 0)return XF.accessible;let t=process.env.ACCESSIBLE;return t!==void 0&&t!==``&&t!==`0`&&t!==`false`}function QF(e,t){if(typeof e==`string`)return XF.aliases.get(e)===t;for(let n of e)if(n!==void 0&&QF(n,t))return!0;return!1}function $F(e,t){if(e===t)return;let n=e.split(`
|
|
1273
1273
|
`),r=t.split(`
|
|
1274
|
-
`),i=Math.max(n.length,r.length),a=[];for(let e=0;e<i;e++)n[e]!==r[e]&&a.push(e);return{lines:a,numLinesBefore:n.length,numLinesAfter:r.length,numLines:i}}const
|
|
1274
|
+
`),i=Math.max(n.length,r.length),a=[];for(let e=0;e<i;e++)n[e]!==r[e]&&a.push(e);return{lines:a,numLinesBefore:n.length,numLinesAfter:r.length,numLines:i}}const eI=globalThis.process.platform.startsWith(`win`),tI=Symbol(`clack:cancel`);function nI(e){return e===tI}function rI(e,t){let n=e;n.isTTY&&n.setRawMode(t)}function iI({input:e=b.stdin,output:t=b.stdout,overwrite:n=!0,hideCursor:r=!0}={}){let i=g.createInterface({input:e,output:t,prompt:``,tabSize:1});g.emitKeypressEvents(e,i),e instanceof x.ReadStream&&e.isTTY&&e.setRawMode(!0);let a=(i,{name:o,sequence:s})=>{if(QF([String(i),o,s],`cancel`)){r&&t.write(qF.show),process.exit(0);return}if(!n)return;let c=o===`return`?0:-1,l=o===`return`?-1:0;g.moveCursor(t,c,l,()=>{g.clearLine(t,1,()=>{e.once(`keypress`,a)})})};return r&&t.write(qF.hide),e.once(`keypress`,a),()=>{e.off(`keypress`,a),r&&t.write(qF.show),e instanceof x.ReadStream&&e.isTTY&&!eI&&e.setRawMode(!1),i.terminal=!1,i.close()}}const aI=e=>`columns`in e&&typeof e.columns==`number`?e.columns:80,oI=e=>`rows`in e&&typeof e.rows==`number`?e.rows:20;function sI(e,t,n,r=n,i=n,a){return KF(t,aI(e??b.stdout)-IF(n),{hard:!0,trim:!1}).split(`
|
|
1275
1275
|
`).map((e,t,o)=>{let s=a?a(e,t):e;return t===0?`${r}${s}`:t===o.length-1?`${i}${s}`:`${n}${s}`}).join(`
|
|
1276
|
-
`)}function
|
|
1277
|
-
`),
|
|
1278
|
-
`).length-1;this.output.write(
|
|
1279
|
-
`);this.output.write(t[a]),this._prevFrame=e,this.output.write(
|
|
1276
|
+
`)}function cI(e,t){if(`~standard`in e){let n=e[`~standard`].validate(t);return n instanceof Promise?n.then(e=>e.issues?.at(0)?.message):n.issues?.at(0)?.message}return e(t)}let lI=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame=``;_subscribers=/* @__PURE__ */ new Map;_cursor=0;state=`initial`;error=``;value;userInput=``;get accessible(){return ZF(this.opts.accessible)}constructor(e,t=!0){let{input:n=b.stdin,output:r=b.stdout,render:i,signal:a,...o}=e;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=t,this._abortSignal=a,this.input=n,this.output=r}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],r=[];for(let e of n)e.cb(...t),e.once&&r.push(()=>n.splice(n.indexOf(e),1));for(let e of r)e()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state=`cancel`,this.close(),e(tI);this._abortSignal.addEventListener(`abort`,()=>{this.state=`cancel`,this.close()},{once:!0})}this.rl=g.default.createInterface({input:this.input,tabSize:2,prompt:``,escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on(`keypress`,this.onKeypress),rI(this.input,!0),this.output.on(`resize`,this.render),this.render(),this.once(`submit`,()=>{this.output.write(qF.show),this.output.off(`resize`,this.render),rI(this.input,!1),e(this.value)}),this.once(`cancel`,()=>{this.output.write(qF.show),this.output.off(`resize`,this.render),rI(this.input,!1),e(tI)})})}_isActionKey(e,t){return e===` `}_shouldSubmit(e,t){return!0}_setValue(e){this.value=e,this.emit(`value`,this.value)}_setUserInput(e,t){this.userInput=e??``,this.emit(`userInput`,this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:`u`}),this._setUserInput(``)}async onKeypress(e,t){if(this.state!==`validating`){if(this._track&&t.name!==`return`&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:`h`}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state===`error`&&(this.state=`active`),t?.name&&(!this._track&&XF.aliases.has(t.name)&&this.emit(`cursor`,XF.aliases.get(t.name)),XF.actions.has(t.name)&&this.emit(`cursor`,t.name)),e&&(e.toLowerCase()===`y`||e.toLowerCase()===`n`)&&this.emit(`confirm`,e.toLowerCase()===`y`),this.emit(`key`,e,t),t?.name===`return`&&this._shouldSubmit(e,t)){if(this.opts.validate){let e=cI(this.opts.validate,this.value),t;e instanceof Promise?(this.state=`validating`,this.render(),t=await e):t=e,t&&(this.error=t instanceof Error?t.message:t,this.state=`error`,this.rl?.write(this.userInput))}this.state!==`error`&&(this.state=`submit`)}QF([e,t?.name,t?.sequence],`cancel`)&&(this.state=`cancel`),(this.state===`submit`||this.state===`cancel`)&&this.emit(`finalize`),this.render(),(this.state===`submit`||this.state===`cancel`)&&this.close()}}close(){this.input.unpipe(),this.input.removeListener(`keypress`,this.onKeypress),this.output.write(`
|
|
1277
|
+
`),rI(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=KF(this._prevFrame,aI(this.output),{hard:!0,trim:!1}).split(`
|
|
1278
|
+
`).length-1;this.output.write(qF.move(-999,e*-1))}render(){let e=KF(this._render(this)??``,aI(this.output),{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state===`initial`)this.output.write(qF.hide);else{let t=$F(this._prevFrame,e),n=oI(this.output);if(this.restoreCursor(),t){let r=Math.max(0,t.numLinesAfter-n),i=Math.max(0,t.numLinesBefore-n),a=t.lines.find(e=>e>=r);if(a===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(qF.move(0,a-i)),this.output.write(JF.lines(1));let t=e.split(`
|
|
1279
|
+
`);this.output.write(t[a]),this._prevFrame=e,this.output.write(qF.move(0,t.length-a-1));return}if(t.lines.length>1){if(r<i)a=r;else{let e=a-i;e>0&&this.output.write(qF.move(0,e))}this.output.write(JF.down());let t=e.split(`
|
|
1280
1280
|
`).slice(a);this.output.write(t.join(`
|
|
1281
|
-
`)),this._prevFrame=e;return}}this.output.write(
|
|
1282
|
-
`);return n&&i.push((0,h.styleText)(`cyan`,
|
|
1283
|
-
`);_.push(a),v+=a.length}if(v>u){let t=0,n=0,r=v,i=e-y,a=u,o=()=>
|
|
1281
|
+
`)),this._prevFrame=e;return}}this.output.write(JF.down())}this.output.write(e),this.state===`initial`&&(this.state=`active`),this._prevFrame=e}}};var uI=class extends lI{options;cursor=0;get _value(){return this.options[this.cursor]?.value}get _enabledOptions(){return this.options.filter(e=>e.disabled!==!0)}toggleAll(){let e=this._enabledOptions,t=this.value!==void 0&&this.value.length===e.length;this.value=t?[]:e.map(e=>e.value)}toggleInvert(){let e=this.value;if(!e)return;let t=this._enabledOptions.filter(t=>!e.includes(t.value));this.value=t.map(e=>e.value)}toggleValue(){this.value===void 0&&(this.value=[]);let e=this.value.includes(this._value);this.value=e?this.value.filter(e=>e!==this._value):[...this.value,this._value]}constructor(e){super(e,!1),this.options=e.options,this.value=[...e.initialValues??[]];let t=Math.max(this.options.findIndex(({value:t})=>t===e.cursorAt),0);this.cursor=this.options[t]?.disabled?YF(t,1,this.options):t,this.on(`key`,(e,t)=>{t.name===`a`&&this.toggleAll(),t.name===`i`&&this.toggleInvert(),t.name===void 0&&e===` `&&this.toggleValue()}),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=YF(this.cursor,-1,this.options);break;case`down`:case`right`:this.cursor=YF(this.cursor,1,this.options);break;case`space`:this.toggleValue()}})}};let dI=class extends lI{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){let e=this._selectedValue;this.value=e===void 0?void 0:e.value}constructor(e){super(e,!1),this.options=e.options;let t=this.options.findIndex(({value:t})=>t===e.initialValue),n=t===-1?0:t;this.cursor=this.options[n]?.disabled?YF(n,1,this.options):n,this.changeValue(),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=YF(this.cursor,-1,this.options);break;case`down`:case`right`:this.cursor=YF(this.cursor,1,this.options)}this.changeValue()})}};function fI(){return b.default.platform===`win32`?!!b.default.env.CI||!!b.default.env.WT_SESSION||!!b.default.env.TERMINUS_SUBLIME||b.default.env.ConEmuTask===`{cmd::Cmder}`||b.default.env.TERM_PROGRAM===`Terminus-Sublime`||b.default.env.TERM_PROGRAM===`vscode`||b.default.env.TERM===`xterm-256color`||b.default.env.TERM===`alacritty`||b.default.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:b.default.env.TERM!==`linux`}const pI=fI(),mI=()=>process.env.CI===`true`,hI=(e,t)=>pI?e:t,gI=hI(`◆`,`*`),_I=hI(`■`,`x`),vI=hI(`▲`,`x`),yI=hI(`◇`,`o`),bI=hI(`┌`,`T`),xI=hI(`│`,`|`),SI=hI(`└`,`—`),CI=hI(`●`,`>`),wI=hI(`○`,` `),TI=hI(`◻`,`[•]`),EI=hI(`◼`,`[+]`),DI=hI(`◻`,`[ ]`),OI=hI(`─`,`-`),kI=hI(`╮`,`+`),AI=hI(`├`,`+`),jI=hI(`╯`,`+`),MI=hI(`╰`,`+`),NI=e=>{switch(e){case`initial`:case`active`:return(0,h.styleText)(`cyan`,gI);case`cancel`:return(0,h.styleText)(`red`,_I);case`error`:return(0,h.styleText)(`yellow`,vI);case`submit`:return(0,h.styleText)(`green`,yI);case`validating`:return(0,h.styleText)(`dim`,gI)}},PI=e=>{switch(e){case`initial`:case`active`:return(0,h.styleText)(`cyan`,xI);case`cancel`:return(0,h.styleText)(`red`,xI);case`error`:return(0,h.styleText)(`yellow`,xI);case`submit`:return(0,h.styleText)(`green`,xI)}};function FI(e,t,n){let r=n?`${(0,h.styleText)(`cyan`,xI)} `:``,i=sI(e,t.join(` • `),r).split(`
|
|
1282
|
+
`);return n&&i.push((0,h.styleText)(`cyan`,SI)),i}const II=(e,t,n,r,i,a=!1)=>{let o=t,s=0;if(a)for(let t=r-1;t>=n;t--){let n=e[t];if(n&&(o-=n.length),s++,o<=i)break}else for(let t=n;t<r;t++){let n=e[t];if(n&&(o-=n.length),s++,o<=i)break}return{lineCount:o,removals:s}},LI=({cursor:e,options:t,style:n,output:r=process.stdout,maxItems:i=1/0,columnPadding:a=0,rowPadding:o=4})=>{let s=aI(r)-a,c=oI(r),l=(0,h.styleText)(`dim`,`...`),u=Math.max(c-o,0),d=Math.max(Math.min(i,u),5),f=0;e>=d-3&&(f=Math.max(Math.min(e-d+3,t.length-d),0));let p=d<t.length&&f>0,m=d<t.length&&f+d<t.length,g=Math.min(f+d,t.length),_=[],v=0;p&&v++,m&&v++;let y=f+ +!!p,b=g-+!!m;for(let r=y;r<b;r++){let i=t[r],a=KF(i===void 0?``:n(i,r===e),s,{hard:!0,trim:!1}).split(`
|
|
1283
|
+
`);_.push(a),v+=a.length}if(v>u){let t=0,n=0,r=v,i=e-y,a=u,o=()=>II(_,r,0,i,a),s=()=>II(_,r,i+1,_.length,a,!0);p?({lineCount:r,removals:t}=o(),r>a&&(m||--a,{lineCount:r,removals:n}=s())):(m||--a,{lineCount:r,removals:n}=s(),r>a&&(--a,{lineCount:r,removals:t}=o())),t>0&&(p=!0,_.splice(0,t)),n>0&&(m=!0,_.splice(_.length-n,n))}let x=[];p&&x.push(l);for(let e of _)for(let t of e)x.push(t);return m&&x.push(l),x},RI=[`${(0,h.styleText)(`dim`,`↑/↓`)} to navigate`,`${(0,h.styleText)(`dim`,`Space:`)} select`,`${(0,h.styleText)(`dim`,`Enter:`)} confirm`],zI=(e,t)=>e.split(`
|
|
1284
1284
|
`).map(e=>t(e)).join(`
|
|
1285
|
-
`),
|
|
1286
|
-
${(0,h.styleText)(`reset`,(0,h.styleText)(`dim`,`Press ${(0,h.styleText)([`gray`,`bgWhite`,`inverse`],` space `)} to select, ${(0,h.styleText)(`gray`,(0,h.styleText)(`bgWhite`,(0,h.styleText)(`inverse`,` enter `)))} to submit`))}`},render(){let n=e.withGuide??
|
|
1285
|
+
`),BI=e=>{let t=(e,t)=>{let n=e.label??String(e.value);return t===`disabled`?`${(0,h.styleText)(`gray`,DI)} ${zI(n,e=>(0,h.styleText)([`strikethrough`,`gray`],e))}${e.hint?` ${(0,h.styleText)(`dim`,`(${e.hint??`disabled`})`)}`:``}`:t===`active`?`${(0,h.styleText)(`cyan`,TI)} ${n}${e.hint?` ${(0,h.styleText)(`dim`,`(${e.hint})`)}`:``}`:t===`selected`?`${(0,h.styleText)(`green`,EI)} ${zI(n,e=>(0,h.styleText)(`dim`,e))}${e.hint?` ${(0,h.styleText)(`dim`,`(${e.hint})`)}`:``}`:t===`cancelled`?`${zI(n,e=>(0,h.styleText)([`strikethrough`,`dim`],e))}`:t===`active-selected`?`${(0,h.styleText)(`green`,EI)} ${n}${e.hint?` ${(0,h.styleText)(`dim`,`(${e.hint})`)}`:``}`:t===`submitted`?`${zI(n,e=>(0,h.styleText)(`dim`,e))}`:`${(0,h.styleText)(`dim`,DI)} ${zI(n,e=>(0,h.styleText)(`dim`,e))}`},n=e.required??!0,r=e.showInstructions??!0;return new uI({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValues:e.initialValues,required:n,cursorAt:e.cursorAt,validate(e){if(n&&(e===void 0||e.length===0))return`Please select at least one option.
|
|
1286
|
+
${(0,h.styleText)(`reset`,(0,h.styleText)(`dim`,`Press ${(0,h.styleText)([`gray`,`bgWhite`,`inverse`],` space `)} to select, ${(0,h.styleText)(`gray`,(0,h.styleText)(`bgWhite`,(0,h.styleText)(`inverse`,` enter `)))} to submit`))}`},render(){let n=e.withGuide??XF.withGuide,i=sI(e.output,e.message,n?`${PI(this.state)} `:``,`${NI(this.state)} `),a=`${n?`${(0,h.styleText)(`gray`,xI)}
|
|
1287
1287
|
`:``}${i}
|
|
1288
|
-
`,o=this.value??[],s=(e,n)=>{if(e.disabled)return t(e,`disabled`);let r=o.includes(e.value);return n&&r?t(e,`active-selected`):r?t(e,`selected`):t(e,n?`active`:`inactive`)};switch(this.state){case`submit`:{let r=this.options.filter(({value:e})=>o.includes(e)).map(e=>t(e,`submitted`)).join((0,h.styleText)(`dim`,`, `))||(0,h.styleText)(`dim`,`none`);return`${a}${
|
|
1289
|
-
${(0,h.styleText)(`gray`,
|
|
1290
|
-
`).map((e,t)=>t===0?`${n?`${(0,h.styleText)(`yellow`,
|
|
1288
|
+
`,o=this.value??[],s=(e,n)=>{if(e.disabled)return t(e,`disabled`);let r=o.includes(e.value);return n&&r?t(e,`active-selected`):r?t(e,`selected`):t(e,n?`active`:`inactive`)};switch(this.state){case`submit`:{let r=this.options.filter(({value:e})=>o.includes(e)).map(e=>t(e,`submitted`)).join((0,h.styleText)(`dim`,`, `))||(0,h.styleText)(`dim`,`none`);return`${a}${sI(e.output,r,n?`${(0,h.styleText)(`gray`,xI)} `:``)}`}case`cancel`:{let r=this.options.filter(({value:e})=>o.includes(e)).map(e=>t(e,`cancelled`)).join((0,h.styleText)(`dim`,`, `));return r.trim()===``?`${a}${(0,h.styleText)(`gray`,xI)}`:`${a}${sI(e.output,r,n?`${(0,h.styleText)(`gray`,xI)} `:``)}${n?`
|
|
1289
|
+
${(0,h.styleText)(`gray`,xI)}`:``}`}case`error`:{let t=n?`${(0,h.styleText)(`yellow`,xI)} `:``,r=this.error.split(`
|
|
1290
|
+
`).map((e,t)=>t===0?`${n?`${(0,h.styleText)(`yellow`,SI)} `:``}${(0,h.styleText)(`yellow`,e)}`:` ${e}`).join(`
|
|
1291
1291
|
`),i=a.split(`
|
|
1292
1292
|
`).length,o=r.split(`
|
|
1293
|
-
`).length+1;return`${a}${t}${
|
|
1293
|
+
`).length+1;return`${a}${t}${LI({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:t.length,rowPadding:i+o,style:s}).join(`
|
|
1294
1294
|
${t}`)}
|
|
1295
1295
|
${r}
|
|
1296
|
-
`}default:{let t=n?`${(0,h.styleText)(`cyan`,
|
|
1297
|
-
`).length,o=r?
|
|
1298
|
-
`),l=o.length+1;return`${a}${t}${
|
|
1296
|
+
`}default:{let t=n?`${(0,h.styleText)(`cyan`,xI)} `:``,i=a.split(`
|
|
1297
|
+
`).length,o=r?FI(e.output,RI,n):n?[(0,h.styleText)(`cyan`,SI)]:[],c=o.join(`
|
|
1298
|
+
`),l=o.length+1;return`${a}${t}${LI({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:t.length,rowPadding:i+l,style:s}).join(`
|
|
1299
1299
|
${t}`)}
|
|
1300
1300
|
${c}
|
|
1301
|
-
`}}}}).prompt()},
|
|
1301
|
+
`}}}}).prompt()},VI=(e=``,t)=>{let n=t?.output??process.stdout,r=t?.withGuide??XF.withGuide?`${(0,h.styleText)(`gray`,SI)} `:``;n.write(`${r}${(0,h.styleText)(`red`,e)}
|
|
1302
1302
|
|
|
1303
|
-
`)},
|
|
1304
|
-
`)},
|
|
1305
|
-
`),a=i.reduce((e,t)=>Math.max(
|
|
1306
|
-
`).map(a),``],s=
|
|
1307
|
-
`),u=i?`${(0,h.styleText)(`gray`,
|
|
1308
|
-
`:``,d=i?
|
|
1303
|
+
`)},HI=(e=``,t)=>{let n=t?.output??process.stdout,r=t?.withGuide??XF.withGuide?`${(0,h.styleText)(`gray`,bI)} `:``;n.write(`${r}${e}
|
|
1304
|
+
`)},UI=e=>e,WI=(e,t,n)=>{let r={hard:!0,trim:!1},i=KF(e,t,r).split(`
|
|
1305
|
+
`),a=i.reduce((e,t)=>Math.max(IF(t),e),0);return KF(e,t-(i.map(n).reduce((e,t)=>Math.max(IF(t),e),0)-a),r)},GI=(e=``,t=``,n)=>{let r=n?.output??b.default.stdout,i=n?.withGuide??XF.withGuide,a=n?.format??UI,o=[``,...WI(e,aI(r)-6,a).split(`
|
|
1306
|
+
`).map(a),``],s=IF(t),c=Math.max(o.reduce((e,t)=>{let n=IF(t);return n>e?n:e},0),s)+2,l=o.map(e=>`${(0,h.styleText)(`gray`,xI)} ${e}${` `.repeat(c-IF(e))}${(0,h.styleText)(`gray`,xI)}`).join(`
|
|
1307
|
+
`),u=i?`${(0,h.styleText)(`gray`,xI)}
|
|
1308
|
+
`:``,d=i?AI:MI;r.write(`${u}${(0,h.styleText)(`green`,yI)} ${(0,h.styleText)(`reset`,t)} ${(0,h.styleText)(`gray`,OI.repeat(Math.max(c-s-1,1))+kI)}
|
|
1309
1309
|
${l}
|
|
1310
|
-
${(0,h.styleText)(`gray`,d+
|
|
1311
|
-
`)},
|
|
1312
|
-
`);let e=
|
|
1313
|
-
`);e.length>1&&n.write(
|
|
1310
|
+
${(0,h.styleText)(`gray`,d+OI.repeat(c+2)+jI)}
|
|
1311
|
+
`)},KI=e=>(0,h.styleText)(`magenta`,e),qI=({indicator:e=`dots`,onCancel:t,output:n=process.stdout,cancelMessage:r,errorMessage:i,frames:a=pI?[`◒`,`◐`,`◓`,`◑`]:[`•`,`o`,`O`,`0`],delay:o=pI?80:120,signal:s,...c}={})=>{let l=mI(),u=ZF(c.accessible),d,f,p=!1,m=!1,g=``,_,v=performance.now(),y=aI(n),b=c?.styleFrame??KI,x=e=>{let n=e>1?i??XF.messages.error:r??XF.messages.cancel;m=e===1,p&&(D(n,e),m&&typeof t==`function`&&t())},S=()=>x(2),C=()=>x(1),w=()=>{process.on(`uncaughtExceptionMonitor`,S),process.on(`unhandledRejection`,S),process.on(`SIGINT`,C),process.on(`SIGTERM`,C),process.on(`exit`,x),s&&s.addEventListener(`abort`,C)},T=()=>{process.removeListener(`uncaughtExceptionMonitor`,S),process.removeListener(`unhandledRejection`,S),process.removeListener(`SIGINT`,C),process.removeListener(`SIGTERM`,C),process.removeListener(`exit`,x),s&&s.removeEventListener(`abort`,C)},ee=()=>{if(_===void 0)return;l&&n.write(`
|
|
1312
|
+
`);let e=KF(_,y,{hard:!0,trim:!1}).split(`
|
|
1313
|
+
`);e.length>1&&n.write(qF.up(e.length-1)),n.write(qF.to(0)),n.write(JF.down())},te=e=>e.replace(/\.+$/,``),ne=e=>{let t=(performance.now()-e)/1e3,n=Math.floor(t/60),r=Math.floor(t%60);return n>0?`[${n}m ${r}s]`:`[${r}s]`},E=c.withGuide??XF.withGuide,re=(t=``)=>{if(p=!0,m=!1,g=te(t),v=performance.now(),w(),u){g!==``&&n.write(`${g}
|
|
1314
1314
|
`),f=setInterval(()=>{n.write(g===``?`still working
|
|
1315
1315
|
`:`still working: ${g}
|
|
1316
|
-
`)},3e4);return}d=
|
|
1317
|
-
`);let r=0,i=0;f=setInterval(()=>{if(l&&g===_)return;ee(),_=g;let t=b(a[r]),o;if(l)o=`${t} ${g}...`;else if(e===`timer`)o=`${t} ${g} ${ne(v)}`;else{let e=`.`.repeat(Math.floor(i)).slice(0,3);o=`${t} ${g}${e}`}let s=
|
|
1316
|
+
`)},3e4);return}d=iI({output:n}),E&&n.write(`${(0,h.styleText)(`gray`,xI)}
|
|
1317
|
+
`);let r=0,i=0;f=setInterval(()=>{if(l&&g===_)return;ee(),_=g;let t=b(a[r]),o;if(l)o=`${t} ${g}...`;else if(e===`timer`)o=`${t} ${g} ${ne(v)}`;else{let e=`.`.repeat(Math.floor(i)).slice(0,3);o=`${t} ${g}${e}`}let s=KF(o,y,{hard:!0,trim:!1});n.write(s),r=r+1<a.length?r+1:0,i=i<4?i+.125:0},o)},D=(t=``,a=0,o=!1)=>{if(p){if(p=!1,m=a===1,clearInterval(f),u||ee(),g=t??g,!o){if(u){let t=a===1?r??XF.messages.cancel:a===2?i??XF.messages.error:`Done`,o=g||t;e===`timer`?n.write(`${o} ${ne(v)}
|
|
1318
1318
|
`):n.write(`${o}
|
|
1319
|
-
`)}else{let t=a===0?(0,h.styleText)(`green`,
|
|
1319
|
+
`)}else{let t=a===0?(0,h.styleText)(`green`,yI):a===1?(0,h.styleText)(`red`,_I):(0,h.styleText)(`red`,vI);e===`timer`?n.write(`${t} ${g} ${ne(v)}
|
|
1320
1320
|
`):n.write(`${t} ${g}
|
|
1321
|
-
`)}}T(),d?.()}};return{start:
|
|
1321
|
+
`)}}T(),d?.()}};return{start:re,stop:(e=``)=>D(e,0),message:(e=``)=>{g=te(e??g)},cancel:(e=``)=>D(e,1),error:(e=``)=>D(e,2),clear:()=>D(``,0,!0),get isCancelled(){return m}}},JI=[`${(0,h.styleText)(`dim`,`↑/↓`)} to navigate`,`${(0,h.styleText)(`dim`,`Enter:`)} confirm`],YI=(e,t)=>e.includes(`
|
|
1322
1322
|
`)?e.split(`
|
|
1323
1323
|
`).map(e=>t(e)).join(`
|
|
1324
|
-
`):t(e),
|
|
1324
|
+
`):t(e),XI=e=>{let t=(e,t)=>{if(e===void 0)return``;let n=e.label??String(e.value);switch(t){case`disabled`:return`${(0,h.styleText)(`gray`,wI)} ${YI(n,e=>(0,h.styleText)(`gray`,e))}${e.hint?` ${(0,h.styleText)(`dim`,`(${e.hint??`disabled`})`)}`:``}`;case`selected`:return`${YI(n,e=>(0,h.styleText)(`dim`,e))}`;case`active`:return`${(0,h.styleText)(`green`,CI)} ${n}${e.hint?` ${(0,h.styleText)(`dim`,`(${e.hint})`)}`:``}`;case`cancelled`:return`${YI(n,e=>(0,h.styleText)([`strikethrough`,`dim`],e))}`;default:return`${(0,h.styleText)(`dim`,wI)} ${YI(n,e=>(0,h.styleText)(`dim`,e))}`}},n=e.showInstructions??!0;return new dI({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let r=e.withGuide??XF.withGuide,i=`${NI(this.state)} `,a=`${PI(this.state)} `,o=sI(e.output,e.message,a,i),s=`${r?`${(0,h.styleText)(`gray`,xI)}
|
|
1325
1325
|
`:``}${o}
|
|
1326
|
-
`;switch(this.state){case`submit`:{let n=r?`${(0,h.styleText)(`gray`,
|
|
1327
|
-
${(0,h.styleText)(`gray`,
|
|
1328
|
-
`).length,o=n?
|
|
1329
|
-
`),l=o.length+1;return`${s}${i}${
|
|
1326
|
+
`;switch(this.state){case`submit`:{let n=r?`${(0,h.styleText)(`gray`,xI)} `:``;return`${s}${sI(e.output,t(this.options[this.cursor],`selected`),n)}`}case`cancel`:{let n=r?`${(0,h.styleText)(`gray`,xI)} `:``;return`${s}${sI(e.output,t(this.options[this.cursor],`cancelled`),n)}${r?`
|
|
1327
|
+
${(0,h.styleText)(`gray`,xI)}`:``}`}default:{let i=r?`${(0,h.styleText)(`cyan`,xI)} `:``,a=s.split(`
|
|
1328
|
+
`).length,o=n?FI(e.output,JI,r):r?[(0,h.styleText)(`cyan`,SI)]:[],c=o.join(`
|
|
1329
|
+
`),l=o.length+1;return`${s}${i}${LI({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:i.length,rowPadding:a+l,style:(e,n)=>t(e,e.disabled?`disabled`:n?`active`:`inactive`)}).join(`
|
|
1330
1330
|
${i}`)}
|
|
1331
1331
|
${c}
|
|
1332
|
-
`}}}}).prompt()};`${(0,h.styleText)(`gray`,
|
|
1332
|
+
`}}}}).prompt()};`${(0,h.styleText)(`gray`,xI)}`;function ZI(e,t){let n=e.harness===void 0?t.selection?.targets||Object.keys(t.previous):e.harness===`none`?[]:e.harness.split(`,`).map(kP);if(e.harness===void 0&&!t.selection&&!n.length)throw Error(`--harness <claude-code,codex,cursor,gemini,opencode,pi,copilot,agy|none> is required. Use --harness none for CLI only.`);for(let e of n){if(!gP.some(t=>t.id===e))throw Error(`Unknown harness: ${e}`);if(!t.detected.includes(e))throw Error(`${e} not detected; install its CLI first or use --harness none.`)}let r=new Set(n.map(e=>t.previous[e]?.mode).filter(Boolean)),i=e.mode||(e.harness===void 0?t.selection?.mode:void 0)||(r.size===1?[...r][0]:void 0);if(i!==`artifacts`&&i!==`full`)throw Error(`--mode artifacts|full is required without an interactive terminal.`);return{root:t.root,binDir:t.binDir,mode:i,targets:[...new Set(n)]}}async function QI(e,t,n){let r=n?.mode||e.selection?.mode||Object.values(e.previous)[0]?.mode||`artifacts`,i=n?.targets||e.selection?.targets||Object.keys(e.previous),a=!!n,o=n?`review`:`mode`;for(;;){if(o===`mode`){let e=await t.mode(r);if(e===null)return null;r=e,o=a?`review`:`targets`}if(o===`targets`){let e=await t.targets(i);if(e===null)return null;i=e,a=!0,o=`review`}let n=ZI({mode:r,harness:i.join(`,`)||`none`},e),s=await t.review(n);if(s===`cancel`)return null;if(s===`apply`)return n;o=s}}async function $I(e,t){let n=process.stderr;HI(`Artideck · Install`,{output:n});let r=await QI(e,{async mode(e){GI(`Artifacts: the artifacts and interface-craft skills. Documents, artboards,
|
|
1333
1333
|
whiteboards and HTML pages with comments. Your agent sessions start as before.
|
|
1334
1334
|
|
|
1335
1335
|
Full workflow: Artifacts plus brainstorming, specs, TDD, debugging, git
|
|
1336
1336
|
worktrees and verification skills. Injects the Artideck workflow into every
|
|
1337
|
-
new session. Rerun install to switch.`,`Content`,{output:n});let t=await
|
|
1338
|
-
`),`Unavailable`,{output:n}),!e.detected.length)return[];let i=await
|
|
1339
|
-
`),`Installation plan`,{output:n});let r=await
|
|
1337
|
+
new session. Rerun install to switch.`,`Content`,{output:n});let t=await XI({output:n,message:`What would you like to install?`,initialValue:e,options:[{value:`artifacts`,label:`Artifacts`,hint:`visual pages only; sessions unchanged`},{value:`full`,label:`Full workflow`,hint:`Artifacts + workflow skills; changes every session`}]});return nI(t)?null:t},async targets(t){let r=gP.filter(t=>!e.detected.includes(t.id));if(r.length&&GI(r.map(e=>`${e.label}: ${e.command} not found`).join(`
|
|
1338
|
+
`),`Unavailable`,{output:n}),!e.detected.length)return[];let i=await BI({output:n,message:`Install into which harnesses? (empty = CLI only)`,required:!1,initialValues:t,options:gP.filter(t=>e.detected.includes(t.id)).map(t=>({value:t.id,label:t.label,hint:`${e.previous[t.id]?.mode||`new`} · ${t.comments}`}))});return nI(i)?null:i},async review(t){GI([`CLI: ${t.root}`,`Command: ${t.binDir}`,`Content: ${t.mode}`,...t.targets.map(n=>`${n}: ${e.previous[n]?.mode||`new`} → ${t.mode}; ${gP.find(e=>e.id===n).comments}`),...t.targets.length?[`Start a new harness session after installation.`]:[`CLI only; no harness plugins.`]].join(`
|
|
1339
|
+
`),`Installation plan`,{output:n});let r=await XI({output:n,message:`Continue?`,options:[{value:`apply`,label:`Install`},{value:`mode`,label:`Change content`},{value:`targets`,label:`Change targets`},{value:`cancel`,label:`Cancel`}]});return nI(r)?`cancel`:r}},t);return r||VI(`Cancelled. No installation changes made.`,{output:n}),r}function eL(){return qI({output:process.stderr,onCancel:()=>{}})}function tL(e){for(let t of[`package.json`,`.codex-plugin/plugin.json`])try{let n=JSON.parse(u.default.readFileSync(d.default.join(e,t),`utf8`)),r=String(n.version??``).replace(/-(?:full|artifacts)\.[\da-f]+$/,``);if(/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(r))return r}catch{}return null}function nL(e){let t=/* @__PURE__ */ new Map;return(n,r)=>{let i=JSON.stringify([n,r]);return t.has(i)||t.set(i,e(n,r)),t.get(i)}}function rL(e,t){let n=nL(t),r=[],i;try{i=Object.values(AP(e).harnesses)}catch{return{plugins:r,complete:!1}}let a=!0;for(let e of i)try{if(e.harness===`claude-code`&&cP(e,n)!==`owned`)continue;let t=e.harness===`claude-code`?e.registration&&sP(e.registration,n).path:e.path;if(!t)continue;let i=d.default.join(t,`skills/artifacts/app/hook-bin.sh`);if(!u.default.existsSync(i))continue;let a=tL(t);if(!a)continue;r.push({harness:e.harness,version:a,legacy:!/(?:\.(?:ryugi|artideck)|\$\(ryugi_user_store\))\/hook/.test(u.default.readFileSync(i,`utf8`))})}catch{a=!1}return{plugins:r,complete:a}}function iL(e,t){return rL(e,t.run).plugins}function aL(e,t,n){let r=rL(e,t);return vF(n,r),r}function oL(e){let t=[],n=[];if(e.status!==`done`)return{warnings:t,actions:n};for(let r of e.failed)t.push({code:`W_HOOK_BINARY`,severity:`warning`,message:`The hook binary for ${r.version} was not downloaded (${r.error}); plugin hooks skip until it is.`}),r.version!==`unknown`&&n.push({kind:`command`,argv:[`adeck`,`hook`,`install`,r.version],label:`Download the hook binary`});return{warnings:t,actions:n}}function sL(e,t){let n=/* @__PURE__ */ new Map,r=t?1:25,i=null;return{report(a,o,s){let c=s?` ${Math.floor(Math.floor(o/s*100)/r)*r}%`:t?` ${(o/1048576).toFixed(1)} MB`:``;if(n.get(a)===c)return;n.set(a,c);let l=`Downloading the hook binary for ${[...n].map(([e,t])=>e+t).join(` · `)}`;if(!t)return e.progress({phase:l});i?i.message(l):(i=eL()).start(l)},finish(){i?.stop(`Downloaded the hook binary for ${[...n.keys()].join(`, `)}`)}}}async function cL(e,t,n){let r=sL(t,n);try{return await lL({...e,progress:r.report})}finally{r.finish()}}function lL(e){return uL(e).catch(e=>({status:`done`,failed:[{version:`unknown`,error:e.message}],prefetched:[],removed:[]}))}async function uL(e){let t=m.default.homedir(),n=XD().home;if(d.default.resolve(n)!==d.default.join(we(t),`server`))return{status:`other-hub`};let r=aL(e.root??LN(),e.run??_P,t);return SF({arch:process.arch,cleanup:e.cleanup,env:process.env,fetch,home:t,installed:r,platform:process.platform,progress:e.progress,retry:!0,serverHome:n,version:`1.119.0`})}const dL=e=>`export { default, RyugiPlugin } from ${JSON.stringify((0,v.pathToFileURL)(d.default.join(e,`.opencode/plugins/ryugi.js`)).href)};\n`;async function fL(e,t={}){let n=[],r=new UN(e).current();if(r){let i=new UN(e,t.binDir||d.default.dirname(r.bin));n.push({component:`CLI command`,status:i.ownsBin()?`ok`:`attention`,message:i.bin});let a=WN(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/document-engine.cjs`,`dist/loro_wasm_bg.wasm`,`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(AP(e).harnesses)){await t.onStep?.(`Checking ${r.harness}`);try{if(r.harness===`claude-code`){let e=d.default.join((t.env||process.env).CLAUDE_CONFIG_DIR||d.default.join(t.home||m.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(!lP(r,t.run||_P))throw Error(`Native Claude source no longer matches the record`)}else if(TP(r,wP(r,{root:e,home:t.home})),!lP(r,t.run||_P))throw Error(`Native registration does not match the owned source`);let i=`${r.mode} · ${r.version}`;if(r.harness===`codex`){let e=hF(r.path,r.registration||`ryugi@ryugi-managed`,t.env||process.env,t.home);n.push(e.blocked?{component:r.harness,status:`attention`,message:`${i}; ${e.blocked} of ${e.declared} Codex hooks are not approved for this version, so comments will not arrive. Open Codex Settings → Hooks, choose Ryugi, press Trust all, then start a new chat.`}:{component:r.harness,status:`ok`,message:`${i}; hooks trusted; new session required`});continue}n.push({component:r.harness,status:`ok`,message:`${i}; restart/new session required; delivery unverified`})}catch(e){n.push({component:r.harness,status:`attention`,message:e.message})}}let i=t.home||m.default.homedir();await t.onStep?.(`Checking hook binaries`);for(let r of iL(e,{run:t.run||_P})){let e=`${r.harness} hook`;if(r.legacy){n.push({component:e,status:`attention`,message:`plugin ${r.version} predates ~/.artideck/hook; run adeck update to refresh it`});continue}if(!Ak(process.platform,process.arch,r.version))continue;let t=kk(r.version),a=d.default.join(Dk(i,r.version),t);n.push(u.default.existsSync(a)?{component:e,status:`ok`,message:a}:{component:e,status:`attention`,message:`no ${t} ${r.version}, so this plugin's hooks skip; run adeck hook install ${r.version}`})}return await t.onStep?.(`Checking agent-browser`),n.push(mL(t)),n.push(...pL(t.home||m.default.homedir(),t.project)),n}function pL(e,t){let n=(e,t,n)=>u.default.existsSync(d.default.join(e,`.ryugi`))?[{component:t,status:`attention`,message:u.default.existsSync(d.default.join(e,`.artideck`))?`${n}/.ryugi is left in ${e} after the move: it holds files .artideck already has; compare them, then remove .ryugi`:`${n}/.ryugi has not moved to .artideck yet; run adeck migrate`}]:[];return[...n(e,`Home store`,`~`),...t&&d.default.resolve(t)!==d.default.resolve(e)?n(t,`Project store`,t):[]]}function mL(e){let t=`agent-browser`,n=sF({env:e.env||process.env,...e.home?{home:e.home}:{},...e.agentBrowserDirs?{extraDirs:e.agentBrowserDirs}:{}});if(!n)return{component:t,status:`optional`,message:`not found: install it (npm i -g agent-browser, then agent-browser install) so artboard Check loads its boards without a browser window`};let r=lF(n);return{component:t,status:`ok`,message:r?`${n} (${r})`:n}}function hL(e,t={}){let n=AP(e),r={removed:[],failures:[],preserved:[`Project artifacts, comments, harness plugin data and runtime caches are retained.`]},i=t.run||_P;for(let a of t.targets||Object.keys(n.harnesses)){let o=n.harnesses[a];if(o)try{if(a===`claude-code`){if(!eP().includes(o.registration||``))throw Error(`Unknown native Claude plugin identity`);let e=cP(o,i);if(e===`foreign`)throw Error(`Native Claude source changed; preserving it`);e===`owned`&&i(`claude`,[`plugin`,`uninstall`,o.registration,`--scope`,`user`])}else{if(TP(o,wP(o,{root:e,home:t.home})),!lP(o,i))throw Error(`Native plugin source changed; preserving it`);if(a===`codex`&&i(`codex`,[`plugin`,`remove`,o.registration||XN.id]),a===`copilot`&&i(`copilot`,[`plugin`,`uninstall`,o.registration||XN.id]),a===`pi`&&i(`pi`,[`remove`,o.path]),a===`gemini`&&i(`gemini`,[`extensions`,`uninstall`,o.registration||`ryugi`]),a===`agy`&&i(`agy`,[`plugin`,`uninstall`,o.registration||`ryugi`]),a===`opencode`){let e=t.env||process.env,n=d.default.join(e.XDG_CONFIG_HOME||d.default.join(t.home||m.default.homedir(),`.config`),`opencode/plugins/ryugi.js`);if(!u.default.existsSync(n)||u.default.readFileSync(n,`utf8`)!==dL(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],jP(e,n),r.removed.push(a)}catch(e){r.failures.push({component:a,message:e.message})}}if(!t.targets){let n=new UN(e).current();if(n){let i=new UN(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}`}),i.ownsAlias()&&u.default.unlinkSync(i.aliasBin)}}return r}function gL(e){let t=new Int32Array(new SharedArrayBuffer(4)),n=new S.Worker(`
|
|
1340
1340
|
const fs = require('node:fs');
|
|
1341
1341
|
const { parentPort, workerData } = require('node:worker_threads');
|
|
1342
1342
|
const state = new Int32Array(workerData.state);
|
|
@@ -1367,8 +1367,8 @@ if (Atomics.compareExchange(state, 0, 0, 1) === 0) {
|
|
|
1367
1367
|
timer = setInterval(tick, 80);
|
|
1368
1368
|
tick();
|
|
1369
1369
|
} else parentPort.close();
|
|
1370
|
-
`,{eval:!0,workerData:{state:t.buffer,label:e,columns:process.stderr.columns||80}});n.unref();let r=!1;return{message(e){r||n.postMessage(e)},stop(){r||(r=!0,Atomics.compareExchange(t,0,0,3)!==0&&(Atomics.store(t,0,2),Atomics.wait(t,0,2,1e3)),n.terminate())}}}const dL={machine:!0,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){return{run(t,n,r,i){let a=t.format===`brief`&&!!process.stderr.isTTY&&!process.env.CI;return Z({id:`doctor`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`]},async run(t,n){let r=a?uL(`Checking installation`):null,i=`Checking installation`;try{let t=await oL(d.default.resolve(e.values[`install-dir`]||jN()),{project:e.projectDir,async onStep(e){i=e,r?r.message(e):n.progress({phase:e}),await(0,y.setImmediate)(),n.signal.throwIfAborted()},run(e,t,n){return r?.message(`${i} · waiting for ${e} ${t.join(` `)}`),dP(e,t,n)}});return J({checks:t},t.some(e=>e.status===`attention`)?{kind:`action_required`,reason:`Some installation components need attention`}:{kind:`succeeded`})}finally{r?.stop()}},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).run(t,n,r,i)}}}},fL=/<head(\s[^>]*)?>/i,pL=/^\s*(<!doctype[^>]*>)?\s*(<html(\s[^>]*)?>)?/i,mL=/^<script>([\s\S]*?)<\/script>/,hL=/^(?:<script (?:defer|type="module") src="[^"]*\/_ryugi\/runtime\/ryugi-(?:icons|ui|deck|storyboard)\.js"><\/script>|<style data-ryugi-deck>[^<]*<\/style>)+/;function gL(e){let t=fL.exec(e);return t?t.index+t[0].length:pL.exec(e)?.[0].length??0}function _L(e){let t=gL(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=mL.exec(n);return!r||!r[1].includes(`ryugi:`)?e:e.slice(0,t)+n.slice(r[0].length).replace(hL,``)}function vL(e,t=4){let n=0,r;try{r=u.default.readdirSync(e,{withFileTypes:!0})}catch{return n}for(let i of r){if(i.name.startsWith(`.`)||i.isSymbolicLink())continue;let r=d.default.join(e,i.name);i.isDirectory()?t>0&&(n=Math.max(n,vL(r,t-1))):i.isFile()&&(n=Math.max(n,u.default.statSync(r).mtimeMs))}return n}const yL=e=>{let t=vL(e);return t?{updatedAt:new Date(t).toISOString()}:{}};function bL(e){let t=/* @__PURE__ */ new Set([...Object.keys(jD),`artifact`,`source`]),n=Object.keys(e.values).find(e=>!t.has(e));if(n)throw new K({code:`E_ARGUMENT_INVALID`,message:`--${n} applies to Cloud reads only. Local reads accept --artifact, --detail or --source.`});let r=e.values.artifact;r&&HE(e.projectDir,r);let i=!!e.values.source||e.values.format===`source`;if(i&&!r)throw new K({code:`E_ARGUMENT_INVALID`,message:`Local --source requires --artifact <type>/<id>.`});let{project:a,root:o}=Ye(e.projectDir);return Z({id:`get`,mode:`finite`,output:{formats:[`brief`,`table`,`json`,`jsonl`,...r?[`source`]:[]],detail:!0},async run(t,n){let s=r?{artifacts:[{type:r.split(`/`)[0],id:r.split(`/`)[1],dir:``}],warnings:[]}:Ib(o),c=s.artifacts.map(({type:e,id:t,dir:n})=>{let r=`${e}/${t}`,i=HE(a,r);if(i.content===`existing`){let e=u.default.realpathSync(i.write);if(!e.startsWith(`${o}${d.default.sep}`))throw new K({code:`E_FILE_PATH_UNSAFE`,message:`Artifact source escapes its project: ${i.write}`});let t=u.default.statSync(e);if(!t.isFile())throw new K({code:`E_FILE_PATH_UNSAFE`,message:`Artifact source is not a regular file: ${i.write}`});return{artifact:r,...i,bytes:t.size,modifiedAt:t.mtime.toISOString(),...n?yL(n):{}}}return{artifact:r,...i,...n?yL(n):{}}});c.sort((e,t)=>(t.updatedAt??``).localeCompare(e.updatedAt??``));let l,p;if(r&&(i||e.values.detail)){if(c[0]?.content!==`existing`)throw new K({code:`E_ARTIFACT_NOT_FOUND`,message:`Content not written yet: ${c[0]?.write}`});let e=u.default.readFileSync(c[0].write);l=e.toString(`utf8`),p=f.default.createHash(`sha256`).update(e).digest(`hex`),n.payloads.source=l}let[m,h]=r?.split(`/`)??[],g=s.warnings.map(e=>({code:`W_ARTIFACT_DISCOVERY`,message:e})),_=m&&Jv(m)&&h&&c[0]?.content===`existing`?jE[m].localGet:void 0,v=_?.read(o,h,c[0].write);g.push(...v?.warnings??[]);let y=l!==void 0&&!i?v?.markdown:void 0,b=y??l;return J({origin:`local`,project:a,complete:!0,...r?{}:{server:await QD()},items:c,..._&&v?.rows?{[_.key]:v.rows}:{},...b===void 0?{}:{content:b,contentFormat:y===void 0?void 0:`markdown`,sha256:p}},void 0,{warnings:g,actions:r?[q([`check`,`--project-dir`,a,`--artifact`,r],`Check`)]:[],coverage:r&&l===void 0?{omitted:[{path:`data.content`,reason:`summary`}]}:{}})},present({data:e}){return{heading:`Local artifacts`,status:`complete`,subject:e.project,facts:e.server?[{label:`Server`,binding:{key:`server`,value:`${e.server.status}${e.server.version?` · ${e.server.version}`:``}`}}]:[],sections:[{kind:`records`,key:`items`,rows:e.items,columns:[{key:`artifact`,required:!0,positional:!0},{key:`content`,positional:!0},{key:`updatedAt`,label:`Updated`,positional:!0},{key:`write`,label:`Edit`,required:!0},{key:`bytes`}]},...pe.flatMap(t=>{let n=jE[t].localGet,r=n&&e[n.key];return n&&Array.isArray(r)?[{kind:`records`,key:n.key,rows:r,columns:n.columns}]:[]}),...e.content===void 0?[]:[{kind:`content`,key:`content`,text:e.content,title:e.contentFormat===`markdown`?`Markdown`:`Complete source`}]]}}},e)}function xL({data:e}){let t=Jv(e.type)?jE[e.type].outlineView:void 0;return{heading:`Cloud artifact`,status:e.status===`downloaded`||e.status===`partial`?e.status:``,subject:e.id,summary:[e.type,`v${e.version}`,e.visibility].join(` · `),facts:[X(`Title`,Y(e,`title`)),...e.saved?[X(`Saved`,Y(e,`saved`),!0),X(`Bytes`,Y(e,`bytes`))]:[],...e.dir?[X(`Downloaded`,Y(e,`dir`),!0)]:e.files?[X(`Files available`,{key:`files`,value:e.files.join(`, `)})]:[]],sections:[...e.outline?[{kind:`records`,key:`outline`,...t?{rows:t.rows(e.outline),columns:t.columns}:{rows:e.outline,columns:[{key:`id`,positional:!0,required:!0},{key:`type`,positional:!0},{key:`preview`,positional:!0}]}}]:[],...e.prompt===void 0?[]:[{kind:`content`,key:`prompt`,title:Py.replace(/[::]$/,``),text:e.prompt}],...e.content===void 0?[]:[{kind:`content`,key:`content`,title:`LiteXML`,text:e.content}],...e.comments?[{...oM(e.comments.threads,`comments`,!1),title:`Published snapshot comments`,...e.comments.threads.length?{}:{summary:`none`}}]:[]]}}const SL=(e,t)=>typeof e.values[t]==`string`?e.values[t]:void 0,CL=e=>!!e&&!e.includes(`\\`)&&!e.includes(`\0`)&&!d.default.posix.isAbsolute(e)&&e.split(`/`).every(e=>!!e&&e!==`.`&&e!==`..`);async function wL(e,t,n){if(!e.contentBase||!Array.isArray(e.files))throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server did not return a complete download manifest.`});if(e.files.some(e=>!CL(e)))throw new K({code:`E_FILE_PATH_UNSAFE`,message:`The manifest contains an unsafe file path.`});if(u.default.existsSync(t))throw new K({code:`E_FILE_EXISTS`,message:`Download directory already exists: ${t}`});u.default.mkdirSync(d.default.dirname(t),{recursive:!0}),u.default.mkdirSync(t,{mode:448});for(let r of e.files){let i=d.default.join(t,...r.split(`/`)),a=n.effects.begin(`download`,i);try{let t=await fetch(`${e.contentBase}${r.split(`/`).map(encodeURIComponent).join(`/`)}`,{headers:E,signal:n.signal});if(!t.ok)throw Error(`HTTP ${t.status}`);u.default.mkdirSync(d.default.dirname(i),{recursive:!0});let o=Buffer.from(await t.arrayBuffer()),s=Rj(i,r.endsWith(`.html`)?_L(o.toString(`utf8`)):o);n.effects.confirm(a,{bytes:s.bytes})}catch(e){throw n.effects.set(a,`failed`,{message:e.message}),new K({code:`E_DOWNLOAD_FAILED`,message:`Could not download ${r}: ${e.message}`})}}}function TL(e){let t=e.positionals[0];if(!t)return bL(e);if(e.values.artifact)throw new K({code:`E_OPTION_CONFLICT`,message:`Choose a local --artifact or a Cloud link/id, not both.`});let{origin:n,id:r,grant:i}=kL(t,GE(process.env)),a=SL(e,`save`);if(a!==void 0&&!a.trim())throw new K({code:`E_ARGUMENT_INVALID`,message:`--save requires a nonempty file path.`});let o=!!e.values.source||e.values.format===`source`||a!==void 0,s=SL(e,`block`),c=SL(e,`out`),l=!!e.values.download||!!c,u=!!e.values.detail||o;if(o&&(s||l||SL(e,`fields`)||SL(e,`cursor`)||SL(e,`limit`)))throw new K({code:`E_OPTION_CONFLICT`,message:`Source must be a complete document; use --snapshot to pin its version.`});if(s&&(l||u||SL(e,`cursor`)))throw new K({code:`E_OPTION_CONFLICT`,message:`--block reads one complete block and cannot combine with detail, cursor or download.`});let f=SL(e,`limit`);if(f&&(!/^\d+$/.test(f)||+f<1||+f>100))throw new K({code:`E_ARGUMENT_INVALID`,message:`--limit must be between 1 and 100.`});let p=new URLSearchParams({semantic:`1`});for(let t of[`snapshot`,`cursor`,`fields`,`limit`,`section`,`page`]){let n=SL(e,t);n&&p.set(t,n)}return u&&p.set(`detail`,`1`),s&&p.set(`block`,s),l&&p.set(`download`,`1`),(e.values[`no-comments`]||o)&&p.set(`no-comments`,`1`),Z({id:`get`,mode:`finite`,output:{detail:!0,formats:[`brief`,`table`,`json`,`jsonl`,`source`,`quiet`],requiredFields:[`id`,`type`,`visibility`,`version`,`status`,...l?[`dir`]:[],...a?[`saved`,`bytes`]:[]],fields:[`id`,`type`,`title`,`visibility`,`version`,`updatedAt`,`outline`,`files`,`content`,`comments`,`saved`,`bytes`],scalar:e=>e.saved??e.id},async run(f,h){let g=qE(JE(process.env,process.platform,m.default.homedir()),n),_=await fetch(`${n}/api/a/${r}?${new URLSearchParams([...p,...Object.entries(i??{})])}`,{headers:g?{...E,Authorization:`Bearer ${g.token}`}:E,signal:h.signal}),v=await _.text();h.payloads.raw=v;let y;try{y=JSON.parse(v)}catch{throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The Cloud server returned an unsupported read response.`})}if(!_.ok)throw new K({code:_.status===404?`E_NOT_FOUND`:`E_CLOUD_FAILED`,httpStatus:_.status,message:y.error||`HTTP ${_.status}`});if(y.schema!==`ryugi.cloud-read/v1`)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The Cloud server returned an unsupported read response.`});let b;if(o){if(y.type!==`document`||typeof y.content!=`string`)throw new K({code:`E_FORMAT_UNSUPPORTED`,message:`Source is available for documents only.`});h.payloads.source=y.content,a&&(b=Rj(a,y.content,h.effects),h.payloads.source=``,(e.values.source||e.values.format===`source`)&&h.diagnostic(`Saved ${b.file} (${b.bytes} bytes)`))}let{schema:x,page:S,contentBase:C,...w}=y,T={...w,...b?{saved:b.file,bytes:b.bytes}:{},status:l?`downloaded`:u||s?`read`:`available`};b&&delete T.content;let ee=u&&typeof y.content==`string`;if(ee&&delete T.outline,l){T.dir=d.default.resolve(c??d.default.join(process.env.XDG_CACHE_HOME||d.default.join(m.default.homedir(),`.cache`),`ryugi`,`get`,r,`v${y.version}`));try{await wL(y,T.dir,h)}catch(e){if(!h.effects.snapshot().some(e=>e.state===`confirmed`))throw e;return T.status=`partial`,T.downloads=h.effects.snapshot(),J(T,{kind:`partial`},{warnings:[{code:`W_DOWNLOAD_PARTIAL`,message:e.message}]})}T.downloads=h.effects.snapshot()}let te=[...p.entries()].filter(([e])=>![`semantic`,`cursor`,`snapshot`,`detail`,`download`].includes(e)).flatMap(([e,t])=>e===`no-comments`?[`--${e}`]:[`--${e}`,t]),ne=[`get`,...te,`--snapshot`,y.snapshot],re=[`get`,...te,...u?[`--detail`]:[],`--cursor`,y.page?.nextCursor??``,`--`,t];return J(T,void 0,{coverage:{...ee?{}:{page:S},...!u&&!s?{omitted:[{path:`data.content`,reason:`summary`}]}:{}},actions:[...!u&&!s?[q([...ne,`--detail`,`--`,t],`Details`)]:[],...!ee&&!s&&!o&&!l&&y.page?.nextCursor?[q(re,`More`)]:[]]})},present:xL},e)}const EL=/^[\w-]{1,64}$/,DL=/^\/a\/([\w-]{1,64})(?:\/(?:view|preview))?\/?$/,OL=`Expected an Artideck Cloud link (https://<host>/a/<id>) or an artifact id.`;function kL(e,t){if(EL.test(e))return{origin:t,id:e};let n;try{n=new URL(e)}catch{throw new A(OL)}let r=DL.exec(n.pathname)?.[1];if(!r||n.protocol!==`https:`&&n.protocol!==`http:`)throw new A(OL);let i=n.searchParams.get(`key`),a=n.searchParams.get(`via`);return{origin:WE(n.origin),id:r,...i?{grant:{key:i,...a?{via:a}:{}}}:{}}}const AL={name:`get`,summary:`Discover local artifacts, read native source, or read a published Cloud link/id`,usage:[`[--artifact <type>/<id> [--detail|--source]]`,`<link-or-id> [--out <dir>] [--no-comments] [options]`],details:`Without a link, lists local artifacts without a server or sign-in. --artifact selects local content; --detail or --source reads its complete native file, except that a document shows its heading outline and --detail reads it as markdown (--source keeps LiteXML). Cloud reads show a published outline/manifest; use --detail, --source or --download for more. Local reads never consume feedback.`,semantic:TL,options:{artifact:{type:`string`,value:`<type>/<id>`,help:`Read this local artifact; omit to discover local artifacts`},section:{type:`string`,value:`<outline|files>`,help:`Choose the independently paginated collection`},source:{type:`boolean`,help:`Print complete native source locally, or complete LiteXML from Cloud`},download:{type:`boolean`,help:`Download the complete published manifest`},save:{type:`string`,value:`<file>`,help:`Save complete Cloud document source to a new file; supports structured output`},block:{type:`string`,value:`<id>`,help:`Read one published document block`},page:{type:`string`,value:`<pageId>`,help:`Read one page of a published whiteboard`},snapshot:{type:`string`,value:`<token>`,help:`Pin a published version`},cursor:{type:`string`,value:`<token>`,help:`Continue a manifest or outline page`},limit:{type:`string`,value:`<1-100>`,help:`Maximum outline or manifest rows`},out:{type:`string`,value:`<dir>`,help:`Download files here instead of ~/.cache/ryugi/get/<id>/`},"no-comments":{type:`boolean`,help:`Leave a document's comments out`}},positionals:1};function jL({data:e}){return{heading:`Hook`,status:e.status,summary:e.error??``,facts:[X(`Version`,Y(e,`version`))],sections:[]}}const ML={machine:!0,name:`hook`,summary:`Download the hook binary a plugin version runs its hooks with`,usage:[`install <version> [--background]`],details:`install downloads the hook binary of the plugin release <version> for this platform (adeck-hook; ryugi-hook up to 1.116.0), checks its sha256 and keeps it in ~/.artideck/hook/<version>. The plugin launcher runs it with --background when a hook finds no binary; that waits out the retry delay after a failed download, which a person running it skips.`,positionals:2,options:{background:{type:`boolean`,help:`Wait out the retry delay after a failed download`}},semantic:e=>Z({id:`hook`,mode:`finite`,output:{formats:[`brief`,`json`,`quiet`],scalar:e=>e.status},async run(){let[t,n]=e.positionals;if(t!==`install`)throw new A(`Usage: adeck hook install <version>`);if(!n||!_k(n))throw new A(`hook install needs a release version, not ${n??`nothing`}`);let r=await Ok({arch:process.arch,fetch,home:m.default.homedir(),platform:process.platform,retry:!e.values.background,version:n}),i=r.status===`present`||r.status===`installed`,a={action:t,version:n,status:r.status};return r.error&&(a.error=r.error),J(a,i?{kind:`succeeded`}:{kind:`failed`,error:{code:`E_HOOK_INSTALL`,message:r.error??`${Ck(n)} ${n} is not available here (${r.status})`}})},present:jL},e)},NL=`icons/index.json`,PL=/* @__PURE__ */ new Map;function FL(e){let t=PL.get(e);if(t===void 0){try{t=JSON.parse(u.default.readFileSync(d.default.join(e,NL),`utf8`))}catch{t=null}PL.set(e,t??null)}return t??null}const IL=e=>e.toLowerCase().match(/[a-z0-9]+/g)??[];function LL(e,t,n,r){if(t===e)return 8;if(t.split(`-`).includes(e))return 5;let i=r.indexOf(e);return i===-1?n.some(t=>t===e||t.split(`-`).includes(e))?3:t.includes(e)?2:+!!r.some(t=>IL(t).some(t=>t.startsWith(e))):i<3?4:i<8?3:2}function RL(e,t,n=10){let r=IL(t),i=t.trim().toLowerCase(),a=/* @__PURE__ */ new Map;for(let[t,n]of Object.entries(e.aliases))a.set(n,[...a.get(n)??[],t]);let o=[];for(let[t,n]of Object.entries(e.icons)){let e=a.get(t)??[],s=0,c=0;for(let i of r){let r=LL(i,t,e,n);r>0&&s++,c+=r}(t===i||e.includes(i))&&(s+=r.length),s&&o.push({icon:{name:t,aliases:e,tags:n},matched:s,score:c})}return o.sort((e,t)=>t.matched-e.matched||t.score-e.score||e.icon.name.length-t.icon.name.length||e.icon.name.localeCompare(t.icon.name)).slice(0,n).map(({icon:e})=>e)}function zL({data:e}){return{heading:`Icons`,status:e.icons.length?``:`none`,subject:e.query,summary:e.icons.length?`${e.icons.length} Lucide icons · use the first column as <ryugi-icon name>`:`no Lucide icon fits; try other English words`,facts:[],sections:[{kind:`records`,key:`icons`,rows:e.icons.map(e=>({name:e.name,aliases:e.aliases.join(` `),tags:e.tags.slice(0,8).join(`, `)})),columns:[{key:`name`,positional:!0,required:!0},{key:`tags`,positional:!0},{key:`aliases`,label:`also`}]}]}}const BL={machine:!0,name:`icons`,summary:`Find Lucide icon names for <ryugi-icon> by what the icon should show`,usage:[`<words> [--limit <1-50>] [options]`],details:"Searches the Lucide icons ryugi-icon draws by their names, earlier names and Lucide tags, in English: `adeck icons delete trash`. Icons fitting every word come first. Runs offline, without a server.",options:{limit:{type:`string`,value:`<1-50>`,help:`Maximum icons to list (default 10)`}},positionals:16,semantic:e=>{let t=e.positionals.join(` `).trim();if(!t)throw new A(`Name what the icon should show, in English: adeck icons <words> (e.g. adeck icons delete trash)`);let n=e.values.limit,r=n===void 0?10:Number(n);if(!Number.isInteger(r)||r<1||r>50)throw new A(`--limit must be a whole number from 1 to 50`);return Z({id:`icons`,mode:`finite`,output:{formats:[`brief`,`table`,`json`,`jsonl`],fields:[`name`,`tags`,`aliases`],collection:`icons`,requiredFields:[`name`]},run:()=>{let e=d.default.join(__dirname,`runtime`),n=FL(e);if(!n)throw new A(`This install has no icon index: ${d.default.join(e,NL)}`);return J({query:t,icons:RL(n,t,r)})},present:zL},e)}},VL=VN;function HL(e,t=process.platform){return t===`win32`?{command:[`claude`,...e].join(` `),args:[],shell:!0}:{command:`claude`,args:e,shell:!1}}function UL(e){let{command:t,args:n,shell:r}=HL(e);return(0,p.spawnSync)(t,n,{encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`],shell:r})}function WL(e){let t=UL(e);if(t.error||t.status!==0)throw Error(`claude ${e.join(` `)} failed: ${(t.stderr||t.stdout||t.error?.message||``).trim()}`);return t.stdout}function GL(){let e=UL([`--version`]);return!e.error&&e.status===0}function KL(e){if(!u.default.existsSync(e))return{};let t=JSON.parse(u.default.readFileSync(e,`utf8`)).enabledPlugins;return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}function qL(){let e=JSON.parse(WL([`plugin`,`marketplace`,`list`,`--json`]));if(!Array.isArray(e))throw Error(`claude plugin marketplace list returned no list`);return e.some(e=>e?.name===zN)}function JL(e){let t=JSON.parse(WL([`plugin`,`list`,`--json`]));if(!Array.isArray(t))throw Error(`claude plugin list returned no list`);return t.some(t=>t?.id===e&&t?.scope===`user`)}const YL=e=>e===`artifacts`||e===`full`;async function XL(e,t,n){let r=e=>J({mode:null,harness:`claude-code`,installed:null,disabled:[]},{kind:`validation_failed`},{warnings:[{code:`W_INSTALL_MODE`,message:e,severity:`error`}]});if(e!==void 0&&!YL(e))return r(`--mode takes artifacts or full`);if(!GL())return J({mode:YL(e)?e:null,harness:`none`,installed:null,disabled:[]},{kind:`succeeded`},{warnings:[{code:`W_NO_CLAUDE_CODE`,message:`Claude Code was not found; artifacts only is Claude Code only. Install the full plugin by hand on other harnesses.`,severity:`warning`}],actions:[{kind:`url`,label:`Install guide`,url:`https://github.com/Innei/artideck/blob/main/docs/install.md#artifacts-only`}]});let i=process.env.CLAUDE_CONFIG_DIR||d.default.join(m.default.homedir(),`.claude`),a=KL(d.default.join(i,`settings.json`));if(!YL(e))return r(`--mode artifacts|full is required`);let o=e,s=VL[o],c=[VL[o===`artifacts`?`full`:`artifacts`],...Object.values(HN)],l=(e,t,r)=>{let i=n?.begin(e,t);WL(r),i!==void 0&&n.confirm(i)};qL()||l(`install.marketplace`,BN,[`plugin`,`marketplace`,`add`,BN,`--scope`,`user`]),l(`install.refresh`,zN,[`plugin`,`marketplace`,`update`,zN]),JL(s)?l(`install.update`,s,[`plugin`,`update`,s,`--scope`,`user`]):l(`install.plugin`,s,[`plugin`,`install`,s,`--scope`,`user`]);let u=[];for(let e of c)a[e]===!0&&(l(`install.disable`,e,[`plugin`,`disable`,e,`--scope`,`user`]),u.push(e));let f=[],p=[];for(let[e,n]of[[`project`,`settings.json`],[`local`,`settings.local.json`]]){let r=KL(d.default.join(t,`.claude`,n));for(let t of c)r[t]===!0&&(f.push({code:`W_OTHER_VARIANT_ENABLED`,message:`${t} is still enabled at ${e} scope; enable only one Artideck entry`,severity:`warning`}),p.push({kind:`command`,argv:[`claude`,`plugin`,`disable`,t,`--scope`,e],label:`Disable at ${e} scope`}))}return J({mode:o,harness:`claude-code`,installed:s,disabled:u},{kind:`succeeded`},{warnings:f,actions:p})}async function ZL(e,t,n=!1,r=!1){let i={bin:null,mode:null,owner:null,targets:[]},a=e=>J(i,{kind:`validation_failed`},{warnings:[{code:`E_INSTALL_PLAN`,message:e,severity:`error`}]}),o=d.default.resolve(e.values[`install-dir`]||jN()),s=new LN(o).current(),c=d.default.resolve(e.values[`bin-dir`]||(s?d.default.dirname(s.bin):MN())),l=wP(o);if(e.values.mode!==void 0&&![`artifacts`,`full`].includes(String(e.values.mode)))return a(`--mode takes artifacts or full`);let p=(e.values.harness===`none`?[]:fP()).filter(e=>e.detected).map(e=>e.id),h={...l.harnesses},g=d.default.join(process.env.CLAUDE_CONFIG_DIR||d.default.join(m.default.homedir(),`.claude`),`settings.json`);if(!h[`claude-code`]&&p.includes(`claude-code`)&&u.default.existsSync(g)){let e=YN(JSON.parse(u.default.readFileSync(g,`utf8`)).enabledPlugins||{});e&&(h[`claude-code`]={harness:`claude-code`,mode:e,digest:``,path:``,version:`native-marketplace`})}let _={root:o,binDir:c,detected:p,previous:h,selection:l.selection},v;try{if(n&&!e.values.yes){let t;e.values.mode&&e.values.harness&&(t=GI({mode:String(e.values.mode),harness:String(e.values.harness)},_)),v=await qI(_,t)}else v=GI({mode:e.values.mode,harness:e.values.harness},_)}catch(e){return a(e.message)}if(!v)return J(i,{kind:`interrupted`,signal:`SIGINT`});i.mode=v.mode;let y=[],b=[],x=n?JI():null,S,C=!1,w=e=>{x?x.start(e):t.progress({phase:e})};try{if(!e.values[`no-cli`]){t.signal.throwIfAborted();let e=AN(__filename,process.env);if(e.kind===`global`||e.kind===`unknown`){if(e.kind===`unknown`)return a(`Cannot identify CLI ownership; use --no-cli to install plugins while retaining this CLI.`);i.owner=e.pm,i.bin=process.argv[1]||__filename}else{w(`Installing persistent CLI`);let e=new LN(o,c);e.preflight();let n=t.effects.begin(`install.runtime`,o),r=e.install(d.default.resolve(__dirname,`..`));t.effects.confirm(n,r),i.bin=r.bin,i.owner=`ryugi`,x?.stop(`Persistent CLI installed`);let a=RN(c);a&&y.push({code:`W_PATH`,severity:`warning`,message:a})}}for(let n of v.targets){if(await new Promise(e=>setImmediate(e)),t.signal.aborted){i.targets.push({harness:n,mode:v.mode,status:`not_attempted`});continue}w(`Installing ${v.mode} into ${n}`);let r=t.effects.begin(`install.harness`,n);try{if(n===`claude-code`){let r=l.harnesses[n];if(r&&nP(r,dP)===`foreign`)throw Error(`Native Claude source changed; preserving it`);let a=await XL(v.mode,e.projectDir,t.effects);if(!a.data.installed)throw Error(`Claude Code plugin was not installed`);let o=tP(a.data.installed,dP);l.harnesses[n]={harness:n,mode:v.mode,version:o.version,path:o.path,nativeSource:o.source,digest:``,registration:a.data.installed},y.push(...a.warnings),b.push(...a.actions),i.targets.push({harness:n,mode:v.mode,status:`installed`,installed:a.data.installed,disabled:a.data.disabled})}else{S||(S=e.values[`plugin-source`],S||(S=cP(o,e.values[`plugin-version`]||`1.118.4`),C=!0));let r=d.default.join(o,`candidates`,(0,f.randomUUID)());try{let e=sP(S,r,v.mode);l.harnesses[n]=SP(n,e,{root:o,previous:l.harnesses[n],effects:t.effects})}finally{u.default.rmSync(r,{recursive:!0,force:!0})}i.targets.push({harness:n,mode:v.mode,status:`installed`,installed:l.harnesses[n].path})}TP(o,l),t.effects.confirm(r),x?.stop(`${n} installed; start a new session`),y.push({code:`W_NEW_SESSION`,severity:`warning`,message:`${n}: start a new session. ${uP.find(e=>e.id===n).comments}. Comment delivery has not been verified by this installer.`})}catch(e){i.targets.push({harness:n,mode:v.mode,status:`failed`,error:e.message}),x?.stop(`${n} failed`)}}}finally{x?.stop(),C&&S&&u.default.rmSync(S,{recursive:!0,force:!0})}r||(l.selection={mode:v.mode,targets:v.targets});let T=t.effects.begin(`install.selection`,o);TP(o,l),t.effects.confirm(T);let ee=eL(await nL({cleanup:!1,root:o},t,n));y.push(...ee.warnings);let te=i.targets.filter(e=>e.status===`failed`),ne=te.length?[{kind:`command`,argv:[`adeck`,`install`,`--mode`,v.mode,`--harness`,te.map(e=>e.harness).join(`,`),`--install-dir`,o,...e.values[`no-cli`]?[`--no-cli`]:[],...e.values[`bin-dir`]?[`--bin-dir`,c]:[],...e.values[`plugin-source`]?[`--plugin-source`,String(e.values[`plugin-source`])]:[]],label:`Retry failed targets`}]:[];return ne.push(...b,...ee.actions),t.signal.aborted?J(i,{kind:`interrupted`,signal:`SIGINT`},{warnings:y,actions:ne}):J(i,te.length?i.bin||i.targets.some(e=>e.status===`installed`)?{kind:`partial`}:{kind:`failed`,error:{code:`E_HARNESS_INSTALL`,message:te.map(e=>`${e.harness}: ${e.error}`).join(`
|
|
1371
|
-
`)}}:{kind:`succeeded`},{warnings:y,actions:ne})}function
|
|
1370
|
+
`,{eval:!0,workerData:{state:t.buffer,label:e,columns:process.stderr.columns||80}});n.unref();let r=!1;return{message(e){r||n.postMessage(e)},stop(){r||(r=!0,Atomics.compareExchange(t,0,0,3)!==0&&(Atomics.store(t,0,2),Atomics.wait(t,0,2,1e3)),n.terminate())}}}const _L={machine:!0,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){return{run(t,n,r,i){let a=t.format===`brief`&&!!process.stderr.isTTY&&!process.env.CI;return Z({id:`doctor`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`]},async run(t,n){let r=a?gL(`Checking installation`):null,i=`Checking installation`;try{let t=await fL(d.default.resolve(e.values[`install-dir`]||LN()),{project:e.projectDir,async onStep(e){i=e,r?r.message(e):n.progress({phase:e}),await(0,y.setImmediate)(),n.signal.throwIfAborted()},run(e,t,n){return r?.message(`${i} · waiting for ${e} ${t.join(` `)}`),_P(e,t,n)}});return J({checks:t},t.some(e=>e.status===`attention`)?{kind:`action_required`,reason:`Some installation components need attention`}:{kind:`succeeded`})}finally{r?.stop()}},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).run(t,n,r,i)}}}},vL=/<head(\s[^>]*)?>/i,yL=/^\s*(<!doctype[^>]*>)?\s*(<html(\s[^>]*)?>)?/i,bL=/^<script>([\s\S]*?)<\/script>/,xL=/^(?:<script (?:defer|type="module") src="[^"]*\/_ryugi\/runtime\/ryugi-(?:icons|ui|deck|storyboard)\.js"><\/script>|<style data-ryugi-deck>[^<]*<\/style>)+/;function SL(e){let t=vL.exec(e);return t?t.index+t[0].length:yL.exec(e)?.[0].length??0}function CL(e){let t=SL(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=bL.exec(n);return!r||!r[1].includes(`ryugi:`)?e:e.slice(0,t)+n.slice(r[0].length).replace(xL,``)}function wL(e,t=4){let n=0,r;try{r=u.default.readdirSync(e,{withFileTypes:!0})}catch{return n}for(let i of r){if(i.name.startsWith(`.`)||i.isSymbolicLink())continue;let r=d.default.join(e,i.name);i.isDirectory()?t>0&&(n=Math.max(n,wL(r,t-1))):i.isFile()&&(n=Math.max(n,u.default.statSync(r).mtimeMs))}return n}const TL=e=>{let t=wL(e);return t?{updatedAt:new Date(t).toISOString()}:{}};function EL(e){let t=/* @__PURE__ */ new Set([...Object.keys(LD),`artifact`,`source`]),n=Object.keys(e.values).find(e=>!t.has(e));if(n)throw new K({code:`E_ARGUMENT_INVALID`,message:`--${n} applies to Cloud reads only. Local reads accept --artifact, --detail or --source.`});let r=e.values.artifact;r&&JE(e.projectDir,r);let i=!!e.values.source||e.values.format===`source`;if(i&&!r)throw new K({code:`E_ARGUMENT_INVALID`,message:`Local --source requires --artifact <type>/<id>.`});let{project:a,root:o}=Je(e.projectDir);return Z({id:`get`,mode:`finite`,output:{formats:[`brief`,`table`,`json`,`jsonl`,...r?[`source`]:[]],detail:!0},async run(t,n){let s=r?{artifacts:[{type:r.split(`/`)[0],id:r.split(`/`)[1],dir:``}],warnings:[]}:Ib(o),c=s.artifacts.map(({type:e,id:t,dir:n})=>{let r=`${e}/${t}`,i=JE(a,r);if(i.content===`existing`){let e=u.default.realpathSync(i.write);if(!e.startsWith(`${o}${d.default.sep}`))throw new K({code:`E_FILE_PATH_UNSAFE`,message:`Artifact source escapes its project: ${i.write}`});let t=u.default.statSync(e);if(!t.isFile())throw new K({code:`E_FILE_PATH_UNSAFE`,message:`Artifact source is not a regular file: ${i.write}`});return{artifact:r,...i,bytes:t.size,modifiedAt:t.mtime.toISOString(),...n?TL(n):{}}}return{artifact:r,...i,...n?TL(n):{}}});c.sort((e,t)=>(t.updatedAt??``).localeCompare(e.updatedAt??``));let l,p;if(r&&(i||e.values.detail)){if(c[0]?.content!==`existing`)throw new K({code:`E_ARTIFACT_NOT_FOUND`,message:`Content not written yet: ${c[0]?.write}`});let e=u.default.readFileSync(c[0].write);l=e.toString(`utf8`),p=f.default.createHash(`sha256`).update(e).digest(`hex`),n.payloads.source=l}let[m,h]=r?.split(`/`)??[],g=s.warnings.map(e=>({code:`W_ARTIFACT_DISCOVERY`,message:e})),_=m&&Jv(m)&&h&&c[0]?.content===`existing`?LE[m].localGet:void 0,v=_?.read(o,h,c[0].write);g.push(...v?.warnings??[]);let y=l!==void 0&&!i?v?.markdown:void 0,b=y??l;return J({origin:`local`,project:a,complete:!0,...r?{}:{server:await iO()},items:c,..._&&v?.rows?{[_.key]:v.rows}:{},...b===void 0?{}:{content:b,contentFormat:y===void 0?void 0:`markdown`,sha256:p}},void 0,{warnings:g,actions:r?[q([`check`,`--project-dir`,a,`--artifact`,r],`Check`)]:[],coverage:r&&l===void 0?{omitted:[{path:`data.content`,reason:`summary`}]}:{}})},present({data:e}){return{heading:`Local artifacts`,status:`complete`,subject:e.project,facts:e.server?[{label:`Server`,binding:{key:`server`,value:`${e.server.status}${e.server.version?` · ${e.server.version}`:``}`}}]:[],sections:[{kind:`records`,key:`items`,rows:e.items,columns:[{key:`artifact`,required:!0,positional:!0},{key:`content`,positional:!0},{key:`updatedAt`,label:`Updated`,positional:!0},{key:`write`,label:`Edit`,required:!0},{key:`bytes`}]},...fe.flatMap(t=>{let n=LE[t].localGet,r=n&&e[n.key];return n&&Array.isArray(r)?[{kind:`records`,key:n.key,rows:r,columns:n.columns}]:[]}),...e.content===void 0?[]:[{kind:`content`,key:`content`,text:e.content,title:e.contentFormat===`markdown`?`Markdown`:`Complete source`}]]}}},e)}function DL({data:e}){let t=Jv(e.type)?LE[e.type].outlineView:void 0;return{heading:`Cloud artifact`,status:e.status===`downloaded`||e.status===`partial`?e.status:``,subject:e.id,summary:[e.type,`v${e.version}`,e.visibility].join(` · `),facts:[X(`Title`,Y(e,`title`)),...e.saved?[X(`Saved`,Y(e,`saved`),!0),X(`Bytes`,Y(e,`bytes`))]:[],...e.dir?[X(`Downloaded`,Y(e,`dir`),!0)]:e.files?[X(`Files available`,{key:`files`,value:e.files.join(`, `)})]:[]],sections:[...e.outline?[{kind:`records`,key:`outline`,...t?{rows:t.rows(e.outline),columns:t.columns}:{rows:e.outline,columns:[{key:`id`,positional:!0,required:!0},{key:`type`,positional:!0},{key:`preview`,positional:!0}]}}]:[],...e.prompt===void 0?[]:[{kind:`content`,key:`prompt`,title:Py.replace(/[::]$/,``),text:e.prompt}],...e.content===void 0?[]:[{kind:`content`,key:`content`,title:`LiteXML`,text:e.content}],...e.comments?[{...fM(e.comments.threads,`comments`,!1),title:`Published snapshot comments`,...e.comments.threads.length?{}:{summary:`none`}}]:[]]}}const OL=(e,t)=>typeof e.values[t]==`string`?e.values[t]:void 0,kL=e=>!!e&&!e.includes(`\\`)&&!e.includes(`\0`)&&!d.default.posix.isAbsolute(e)&&e.split(`/`).every(e=>!!e&&e!==`.`&&e!==`..`);async function AL(e,t,n){if(!e.contentBase||!Array.isArray(e.files))throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server did not return a complete download manifest.`});if(e.files.some(e=>!kL(e)))throw new K({code:`E_FILE_PATH_UNSAFE`,message:`The manifest contains an unsafe file path.`});if(u.default.existsSync(t))throw new K({code:`E_FILE_EXISTS`,message:`Download directory already exists: ${t}`});u.default.mkdirSync(d.default.dirname(t),{recursive:!0}),u.default.mkdirSync(t,{mode:448});for(let r of e.files){let i=d.default.join(t,...r.split(`/`)),a=n.effects.begin(`download`,i);try{let t=await fetch(`${e.contentBase}${r.split(`/`).map(encodeURIComponent).join(`/`)}`,{headers:D,signal:n.signal});if(!t.ok)throw Error(`HTTP ${t.status}`);u.default.mkdirSync(d.default.dirname(i),{recursive:!0});let o=Buffer.from(await t.arrayBuffer()),s=Wj(i,r.endsWith(`.html`)?CL(o.toString(`utf8`)):o);n.effects.confirm(a,{bytes:s.bytes})}catch(e){throw n.effects.set(a,`failed`,{message:e.message}),new K({code:`E_DOWNLOAD_FAILED`,message:`Could not download ${r}: ${e.message}`})}}}function jL(e){let t=e.positionals[0];if(!t)return EL(e);if(e.values.artifact)throw new K({code:`E_OPTION_CONFLICT`,message:`Choose a local --artifact or a Cloud link/id, not both.`});let{origin:n,id:r,grant:i}=FL(t,ZE(process.env)),a=OL(e,`save`);if(a!==void 0&&!a.trim())throw new K({code:`E_ARGUMENT_INVALID`,message:`--save requires a nonempty file path.`});let o=!!e.values.source||e.values.format===`source`||a!==void 0,s=OL(e,`block`),c=OL(e,`out`),l=!!e.values.download||!!c,u=!!e.values.detail||o;if(o&&(s||l||OL(e,`fields`)||OL(e,`cursor`)||OL(e,`limit`)))throw new K({code:`E_OPTION_CONFLICT`,message:`Source must be a complete document; use --snapshot to pin its version.`});if(s&&(l||u||OL(e,`cursor`)))throw new K({code:`E_OPTION_CONFLICT`,message:`--block reads one complete block and cannot combine with detail, cursor or download.`});let f=OL(e,`limit`);if(f&&(!/^\d+$/.test(f)||+f<1||+f>100))throw new K({code:`E_ARGUMENT_INVALID`,message:`--limit must be between 1 and 100.`});let p=new URLSearchParams({semantic:`1`});for(let t of[`snapshot`,`cursor`,`fields`,`limit`,`section`,`page`]){let n=OL(e,t);n&&p.set(t,n)}return u&&p.set(`detail`,`1`),s&&p.set(`block`,s),l&&p.set(`download`,`1`),(e.values[`no-comments`]||o)&&p.set(`no-comments`,`1`),Z({id:`get`,mode:`finite`,output:{detail:!0,formats:[`brief`,`table`,`json`,`jsonl`,`source`,`quiet`],requiredFields:[`id`,`type`,`visibility`,`version`,`status`,...l?[`dir`]:[],...a?[`saved`,`bytes`]:[]],fields:[`id`,`type`,`title`,`visibility`,`version`,`updatedAt`,`outline`,`files`,`content`,`comments`,`saved`,`bytes`],scalar:e=>e.saved??e.id},async run(f,h){let g=$E(eD(process.env,process.platform,m.default.homedir()),n),_=await fetch(`${n}/api/a/${r}?${new URLSearchParams([...p,...Object.entries(i??{})])}`,{headers:g?{...D,Authorization:`Bearer ${g.token}`}:D,signal:h.signal}),v=await _.text();h.payloads.raw=v;let y;try{y=JSON.parse(v)}catch{throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The Cloud server returned an unsupported read response.`})}if(!_.ok)throw new K({code:_.status===404?`E_NOT_FOUND`:`E_CLOUD_FAILED`,httpStatus:_.status,message:y.error||`HTTP ${_.status}`});if(y.schema!==`ryugi.cloud-read/v1`)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The Cloud server returned an unsupported read response.`});let b;if(o){if(y.type!==`document`||typeof y.content!=`string`)throw new K({code:`E_FORMAT_UNSUPPORTED`,message:`Source is available for documents only.`});h.payloads.source=y.content,a&&(b=Wj(a,y.content,h.effects),h.payloads.source=``,(e.values.source||e.values.format===`source`)&&h.diagnostic(`Saved ${b.file} (${b.bytes} bytes)`))}let{schema:x,page:S,contentBase:C,...w}=y,T={...w,...b?{saved:b.file,bytes:b.bytes}:{},status:l?`downloaded`:u||s?`read`:`available`};b&&delete T.content;let ee=u&&typeof y.content==`string`;if(ee&&delete T.outline,l){T.dir=d.default.resolve(c??d.default.join(process.env.XDG_CACHE_HOME||d.default.join(m.default.homedir(),`.cache`),`ryugi`,`get`,r,`v${y.version}`));try{await AL(y,T.dir,h)}catch(e){if(!h.effects.snapshot().some(e=>e.state===`confirmed`))throw e;return T.status=`partial`,T.downloads=h.effects.snapshot(),J(T,{kind:`partial`},{warnings:[{code:`W_DOWNLOAD_PARTIAL`,message:e.message}]})}T.downloads=h.effects.snapshot()}let te=[...p.entries()].filter(([e])=>![`semantic`,`cursor`,`snapshot`,`detail`,`download`].includes(e)).flatMap(([e,t])=>e===`no-comments`?[`--${e}`]:[`--${e}`,t]),ne=[`get`,...te,`--snapshot`,y.snapshot],E=[`get`,...te,...u?[`--detail`]:[],`--cursor`,y.page?.nextCursor??``,`--`,t];return J(T,void 0,{coverage:{...ee?{}:{page:S},...!u&&!s?{omitted:[{path:`data.content`,reason:`summary`}]}:{}},actions:[...!u&&!s?[q([...ne,`--detail`,`--`,t],`Details`)]:[],...!ee&&!s&&!o&&!l&&y.page?.nextCursor?[q(E,`More`)]:[]]})},present:DL},e)}const ML=/^[\w-]{1,64}$/,NL=/^\/a\/([\w-]{1,64})(?:\/(?:view|preview))?\/?$/,PL=`Expected an Artideck Cloud link (https://<host>/a/<id>) or an artifact id.`;function FL(e,t){if(ML.test(e))return{origin:t,id:e};let n;try{n=new URL(e)}catch{throw new j(PL)}let r=NL.exec(n.pathname)?.[1];if(!r||n.protocol!==`https:`&&n.protocol!==`http:`)throw new j(PL);let i=n.searchParams.get(`key`),a=n.searchParams.get(`via`);return{origin:XE(n.origin),id:r,...i?{grant:{key:i,...a?{via:a}:{}}}:{}}}const IL={name:`get`,summary:`Discover local artifacts, read native source, or read a published Cloud link/id`,usage:[`[--artifact <type>/<id> [--detail|--source]]`,`<link-or-id> [--out <dir>] [--no-comments] [options]`],details:`Without a link, lists local artifacts without a server or sign-in. --artifact selects local content; --detail or --source reads its complete native file, except that a document shows its heading outline and --detail reads it as markdown (--source keeps LiteXML). Cloud reads show a published outline/manifest; use --detail, --source or --download for more. Local reads never consume feedback.`,semantic:jL,options:{artifact:{type:`string`,value:`<type>/<id>`,help:`Read this local artifact; omit to discover local artifacts`},section:{type:`string`,value:`<outline|files>`,help:`Choose the independently paginated collection`},source:{type:`boolean`,help:`Print complete native source locally, or complete LiteXML from Cloud`},download:{type:`boolean`,help:`Download the complete published manifest`},save:{type:`string`,value:`<file>`,help:`Save complete Cloud document source to a new file; supports structured output`},block:{type:`string`,value:`<id>`,help:`Read one published document block`},page:{type:`string`,value:`<pageId>`,help:`Read one page of a published whiteboard`},snapshot:{type:`string`,value:`<token>`,help:`Pin a published version`},cursor:{type:`string`,value:`<token>`,help:`Continue a manifest or outline page`},limit:{type:`string`,value:`<1-100>`,help:`Maximum outline or manifest rows`},out:{type:`string`,value:`<dir>`,help:`Download files here instead of ~/.cache/ryugi/get/<id>/`},"no-comments":{type:`boolean`,help:`Leave a document's comments out`}},positionals:1};function LL({data:e}){return{heading:`Hook`,status:e.status,summary:e.error??``,facts:[X(`Version`,Y(e,`version`))],sections:[]}}const RL={machine:!0,name:`hook`,summary:`Download the hook binary a plugin version runs its hooks with`,usage:[`install <version> [--background]`],details:`install downloads the hook binary of the plugin release <version> for this platform (adeck-hook; ryugi-hook up to 1.116.0), checks its sha256 and keeps it in ~/.artideck/hook/<version>. The plugin launcher runs it with --background when a hook finds no binary; that waits out the retry delay after a failed download, which a person running it skips.`,positionals:2,options:{background:{type:`boolean`,help:`Wait out the retry delay after a failed download`}},semantic:e=>Z({id:`hook`,mode:`finite`,output:{formats:[`brief`,`json`,`quiet`],scalar:e=>e.status},async run(){let[t,n]=e.positionals;if(t!==`install`)throw new j(`Usage: adeck hook install <version>`);if(!n||!Ck(n))throw new j(`hook install needs a release version, not ${n??`nothing`}`);let r=await Pk({arch:process.arch,fetch,home:m.default.homedir(),platform:process.platform,retry:!e.values.background,version:n}),i=r.status===`present`||r.status===`installed`,a={action:t,version:n,status:r.status};return r.error&&(a.error=r.error),J(a,i?{kind:`succeeded`}:{kind:`failed`,error:{code:`E_HOOK_INSTALL`,message:r.error??`${kk(n)} ${n} is not available here (${r.status})`}})},present:LL},e)},zL=`icons/index.json`,BL=/* @__PURE__ */ new Map;function VL(e){let t=BL.get(e);if(t===void 0){try{t=JSON.parse(u.default.readFileSync(d.default.join(e,zL),`utf8`))}catch{t=null}BL.set(e,t??null)}return t??null}const HL=e=>e.toLowerCase().match(/[a-z0-9]+/g)??[];function UL(e,t,n,r){if(t===e)return 8;if(t.split(`-`).includes(e))return 5;let i=r.indexOf(e);return i===-1?n.some(t=>t===e||t.split(`-`).includes(e))?3:t.includes(e)?2:+!!r.some(t=>HL(t).some(t=>t.startsWith(e))):i<3?4:i<8?3:2}function WL(e,t,n=10){let r=HL(t),i=t.trim().toLowerCase(),a=/* @__PURE__ */ new Map;for(let[t,n]of Object.entries(e.aliases))a.set(n,[...a.get(n)??[],t]);let o=[];for(let[t,n]of Object.entries(e.icons)){let e=a.get(t)??[],s=0,c=0;for(let i of r){let r=UL(i,t,e,n);r>0&&s++,c+=r}(t===i||e.includes(i))&&(s+=r.length),s&&o.push({icon:{name:t,aliases:e,tags:n},matched:s,score:c})}return o.sort((e,t)=>t.matched-e.matched||t.score-e.score||e.icon.name.length-t.icon.name.length||e.icon.name.localeCompare(t.icon.name)).slice(0,n).map(({icon:e})=>e)}function GL({data:e}){return{heading:`Icons`,status:e.icons.length?``:`none`,subject:e.query,summary:e.icons.length?`${e.icons.length} Lucide icons · use the first column as <ryugi-icon name>`:`no Lucide icon fits; try other English words`,facts:[],sections:[{kind:`records`,key:`icons`,rows:e.icons.map(e=>({name:e.name,aliases:e.aliases.join(` `),tags:e.tags.slice(0,8).join(`, `)})),columns:[{key:`name`,positional:!0,required:!0},{key:`tags`,positional:!0},{key:`aliases`,label:`also`}]}]}}const KL={machine:!0,name:`icons`,summary:`Find Lucide icon names for <ryugi-icon> by what the icon should show`,usage:[`<words> [--limit <1-50>] [options]`],details:"Searches the Lucide icons ryugi-icon draws by their names, earlier names and Lucide tags, in English: `adeck icons delete trash`. Icons fitting every word come first. Runs offline, without a server.",options:{limit:{type:`string`,value:`<1-50>`,help:`Maximum icons to list (default 10)`}},positionals:16,semantic:e=>{let t=e.positionals.join(` `).trim();if(!t)throw new j(`Name what the icon should show, in English: adeck icons <words> (e.g. adeck icons delete trash)`);let n=e.values.limit,r=n===void 0?10:Number(n);if(!Number.isInteger(r)||r<1||r>50)throw new j(`--limit must be a whole number from 1 to 50`);return Z({id:`icons`,mode:`finite`,output:{formats:[`brief`,`table`,`json`,`jsonl`],fields:[`name`,`tags`,`aliases`],collection:`icons`,requiredFields:[`name`]},run:()=>{let e=d.default.join(__dirname,`runtime`),n=VL(e);if(!n)throw new j(`This install has no icon index: ${d.default.join(e,zL)}`);return J({query:t,icons:WL(n,t,r)})},present:GL},e)}},qL=qN;function JL(e,t=process.platform){return t===`win32`?{command:[`claude`,...e].join(` `),args:[],shell:!0}:{command:`claude`,args:e,shell:!1}}function YL(e){let{command:t,args:n,shell:r}=JL(e);return(0,p.spawnSync)(t,n,{encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`],shell:r})}function XL(e){let t=YL(e);if(t.error||t.status!==0)throw Error(`claude ${e.join(` `)} failed: ${(t.stderr||t.stdout||t.error?.message||``).trim()}`);return t.stdout}function ZL(){let e=YL([`--version`]);return!e.error&&e.status===0}function QL(e){if(!u.default.existsSync(e))return{};let t=JSON.parse(u.default.readFileSync(e,`utf8`)).enabledPlugins;return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}function $L(){let e=JSON.parse(XL([`plugin`,`marketplace`,`list`,`--json`]));if(!Array.isArray(e))throw Error(`claude plugin marketplace list returned no list`);return e.some(e=>e?.name===GN)}function eR(e){let t=JSON.parse(XL([`plugin`,`list`,`--json`]));if(!Array.isArray(t))throw Error(`claude plugin list returned no list`);return t.some(t=>t?.id===e&&t?.scope===`user`)}const tR=e=>e===`artifacts`||e===`full`;async function nR(e,t,n){let r=e=>J({mode:null,harness:`claude-code`,installed:null,disabled:[]},{kind:`validation_failed`},{warnings:[{code:`W_INSTALL_MODE`,message:e,severity:`error`}]});if(e!==void 0&&!tR(e))return r(`--mode takes artifacts or full`);if(!ZL())return J({mode:tR(e)?e:null,harness:`none`,installed:null,disabled:[]},{kind:`succeeded`},{warnings:[{code:`W_NO_CLAUDE_CODE`,message:`Claude Code was not found; artifacts only is Claude Code only. Install the full plugin by hand on other harnesses.`,severity:`warning`}],actions:[{kind:`url`,label:`Install guide`,url:`https://github.com/Innei/artideck/blob/main/docs/install.md#artifacts-only`}]});let i=process.env.CLAUDE_CONFIG_DIR||d.default.join(m.default.homedir(),`.claude`),a=QL(d.default.join(i,`settings.json`));if(!tR(e))return r(`--mode artifacts|full is required`);let o=e,s=qL[o],c=[qL[o===`artifacts`?`full`:`artifacts`],...Object.values(JN)],l=(e,t,r)=>{let i=n?.begin(e,t);XL(r),i!==void 0&&n.confirm(i)};$L()||l(`install.marketplace`,KN,[`plugin`,`marketplace`,`add`,KN,`--scope`,`user`]),l(`install.refresh`,GN,[`plugin`,`marketplace`,`update`,GN]),eR(s)?l(`install.update`,s,[`plugin`,`update`,s,`--scope`,`user`]):l(`install.plugin`,s,[`plugin`,`install`,s,`--scope`,`user`]);let u=[];for(let e of c)a[e]===!0&&(l(`install.disable`,e,[`plugin`,`disable`,e,`--scope`,`user`]),u.push(e));let f=[],p=[];for(let[e,n]of[[`project`,`settings.json`],[`local`,`settings.local.json`]]){let r=QL(d.default.join(t,`.claude`,n));for(let t of c)r[t]===!0&&(f.push({code:`W_OTHER_VARIANT_ENABLED`,message:`${t} is still enabled at ${e} scope; enable only one Artideck entry`,severity:`warning`}),p.push({kind:`command`,argv:[`claude`,`plugin`,`disable`,t,`--scope`,e],label:`Disable at ${e} scope`}))}return J({mode:o,harness:`claude-code`,installed:s,disabled:u},{kind:`succeeded`},{warnings:f,actions:p})}async function rR(e,t,n=!1,r=!1){let i={bin:null,mode:null,owner:null,targets:[]},a=e=>J(i,{kind:`validation_failed`},{warnings:[{code:`E_INSTALL_PLAN`,message:e,severity:`error`}]}),o=d.default.resolve(e.values[`install-dir`]||LN()),s=new UN(o).current(),c=d.default.resolve(e.values[`bin-dir`]||(s?d.default.dirname(s.bin):RN())),l=AP(o);if(e.values.mode!==void 0&&![`artifacts`,`full`].includes(String(e.values.mode)))return a(`--mode takes artifacts or full`);let p=(e.values.harness===`none`?[]:vP()).filter(e=>e.detected).map(e=>e.id),h={...l.harnesses},g=d.default.join(process.env.CLAUDE_CONFIG_DIR||d.default.join(m.default.homedir(),`.claude`),`settings.json`);if(!h[`claude-code`]&&p.includes(`claude-code`)&&u.default.existsSync(g)){let e=tP(JSON.parse(u.default.readFileSync(g,`utf8`)).enabledPlugins||{});e&&(h[`claude-code`]={harness:`claude-code`,mode:e,digest:``,path:``,version:`native-marketplace`})}let _={root:o,binDir:c,detected:p,previous:h,selection:l.selection},v;try{if(n&&!e.values.yes){let t;e.values.mode&&e.values.harness&&(t=ZI({mode:String(e.values.mode),harness:String(e.values.harness)},_)),v=await $I(_,t)}else v=ZI({mode:e.values.mode,harness:e.values.harness},_)}catch(e){return a(e.message)}if(!v)return J(i,{kind:`interrupted`,signal:`SIGINT`});i.mode=v.mode;let y=[],b=[],x=n?eL():null,S,C=!1,w=e=>{x?x.start(e):t.progress({phase:e})};try{if(!e.values[`no-cli`]){t.signal.throwIfAborted();let e=IN(__filename,process.env);if(e.kind===`global`||e.kind===`unknown`){if(e.kind===`unknown`)return a(`Cannot identify CLI ownership; use --no-cli to install plugins while retaining this CLI.`);i.owner=e.pm,i.bin=process.argv[1]||__filename}else{w(`Installing persistent CLI`);let e=new UN(o,c);e.preflight();let n=t.effects.begin(`install.runtime`,o),r=e.install(d.default.resolve(__dirname,`..`));t.effects.confirm(n,r),i.bin=r.bin,i.owner=`ryugi`,x?.stop(`Persistent CLI installed`);let a=WN(c);a&&y.push({code:`W_PATH`,severity:`warning`,message:a})}}for(let n of v.targets){if(await new Promise(e=>setImmediate(e)),t.signal.aborted){i.targets.push({harness:n,mode:v.mode,status:`not_attempted`});continue}w(`Installing ${v.mode} into ${n}`);let r=t.effects.begin(`install.harness`,n);try{if(n===`claude-code`){let r=l.harnesses[n];if(r&&cP(r,_P)===`foreign`)throw Error(`Native Claude source changed; preserving it`);let a=await nR(v.mode,e.projectDir,t.effects);if(!a.data.installed)throw Error(`Claude Code plugin was not installed`);let o=sP(a.data.installed,_P);l.harnesses[n]={harness:n,mode:v.mode,version:o.version,path:o.path,nativeSource:o.source,digest:``,registration:a.data.installed},y.push(...a.warnings),b.push(...a.actions),i.targets.push({harness:n,mode:v.mode,status:`installed`,installed:a.data.installed,disabled:a.data.disabled})}else{S||(S=e.values[`plugin-source`],S||(S=mP(o,e.values[`plugin-version`]||`1.119.0`),C=!0));let r=d.default.join(o,`candidates`,(0,f.randomUUID)());try{let e=pP(S,r,v.mode);l.harnesses[n]=OP(n,e,{root:o,previous:l.harnesses[n],effects:t.effects})}finally{u.default.rmSync(r,{recursive:!0,force:!0})}i.targets.push({harness:n,mode:v.mode,status:`installed`,installed:l.harnesses[n].path})}jP(o,l),t.effects.confirm(r),x?.stop(`${n} installed; start a new session`),y.push({code:`W_NEW_SESSION`,severity:`warning`,message:`${n}: start a new session. ${gP.find(e=>e.id===n).comments}. Comment delivery has not been verified by this installer.`})}catch(e){i.targets.push({harness:n,mode:v.mode,status:`failed`,error:e.message}),x?.stop(`${n} failed`)}}}finally{x?.stop(),C&&S&&u.default.rmSync(S,{recursive:!0,force:!0})}r||(l.selection={mode:v.mode,targets:v.targets});let T=t.effects.begin(`install.selection`,o);jP(o,l),t.effects.confirm(T);let ee=oL(await cL({cleanup:!1,root:o},t,n));y.push(...ee.warnings);let te=i.targets.filter(e=>e.status===`failed`),ne=te.length?[{kind:`command`,argv:[`adeck`,`install`,`--mode`,v.mode,`--harness`,te.map(e=>e.harness).join(`,`),`--install-dir`,o,...e.values[`no-cli`]?[`--no-cli`]:[],...e.values[`bin-dir`]?[`--bin-dir`,c]:[],...e.values[`plugin-source`]?[`--plugin-source`,String(e.values[`plugin-source`])]:[]],label:`Retry failed targets`}]:[];return ne.push(...b,...ee.actions),t.signal.aborted?J(i,{kind:`interrupted`,signal:`SIGINT`},{warnings:y,actions:ne}):J(i,te.length?i.bin||i.targets.some(e=>e.status===`installed`)?{kind:`partial`}:{kind:`failed`,error:{code:`E_HARNESS_INSTALL`,message:te.map(e=>`${e.harness}: ${e.error}`).join(`
|
|
1371
|
+
`)}}:{kind:`succeeded`},{warnings:y,actions:ne})}function iR({data:e}){return{heading:`Install`,status:e.targets.some(e=>e.status===`failed`)?`partial`:`installed`,summary:e.mode||``,facts:[X(`Command`,Y(e,`bin`)),X(`Owner`,Y(e,`owner`))],sections:[{kind:`records`,key:`targets`,title:`Harnesses`,rows:e.targets.map(e=>({...e})),columns:[{key:`harness`,required:!0},{key:`status`,required:!0},{key:`installed`},{key:`error`}]}]}}const aR={machine:!0,name:`install`,summary:`Install persistent CLI and Artifacts or full Artideck into selected harnesses`,usage:[`[--mode artifacts|full] [--harness <targets|none>] [options]`],details:`Interactive terminal wizard; automation requires explicit mode and targets (or reuses recorded selections). --harness none installs only the CLI.`,options:{mode:{type:`string`,value:`artifacts|full`,help:`Content mode`},harness:{type:`string`,value:`<targets|none>`,help:`Comma-separated claude-code,codex,cursor,gemini,opencode,pi,copilot,agy; none for CLI only`},yes:{type:`boolean`,help:`Apply an explicit or recorded plan without terminal confirmation`},"no-cli":{type:`boolean`,help:`Keep the current CLI; install only harness plugins`},"install-dir":{type:`string`,value:`<path>`,help:`Managed runtime and installation state directory`},"bin-dir":{type:`string`,value:`<path>`,help:`Command directory (default ~/.local/bin)`},"plugin-source":{type:`string`,value:`<path>`,help:`Use an existing Artideck plugin checkout (offline or development)`}},semantic(e){return{run(t,n,r,i){return Z({id:`install`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.bin},run:(n,r)=>rR(e,r,t.format===`brief`&&!!process.stdin.isTTY&&!!process.stderr.isTTY&&!process.env.CI),present:iR},e).run(t,n,r,i)}}}},oR=(e,t,n)=>[e,t.length?`${t.length} file(s) in both stay in .ryugi`:``,n??``].filter(Boolean).join(` · `);function sR({data:e}){return{heading:`Migrate`,status:e.project.status===`failed`||e.home.status===`failed`?`failed`:`done`,summary:e.commit?`Commit the rename: ${e.commit}`:``,facts:[X(`Project`,Y({value:e.project.dir},`value`)),X(`.ryugi → .artideck`,Y({value:oR(e.project.status,e.project.conflicts,e.project.error)},`value`)),X(`~/.ryugi → ~/.artideck`,Y({value:oR(e.home.status,e.home.conflicts,e.home.error)},`value`))],sections:[],...e.hub===`stopped`?{actions:[],summary:`The hub stopped for the move and did not come back; run adeck start`}:{}}}const cR={name:`migrate`,summary:`Move this project from .ryugi to .artideck and the user home from ~/.ryugi to ~/.artideck`,usage:[`[--project-dir <dir>]`],details:`Opening a project with a newer CLI already moves it; migrate does it on request and reports what moved. Files that exist in both places keep the .artideck copy and stay listed under .ryugi. Running it again is safe.`,options:{},semantic:e=>Z({id:`migrate`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.project.status},async run(t,n){let r=n.effects.begin(`migrate`,`machine`),i=await UA(()=>{}),a=i.serviceStopped?await WA().catch(()=>!1)?`restarted`:`stopped`:`unchanged`,o=Ge(e.projectDir)??Pe(e.projectDir,{home:m.default.homedir()}),s=[i.status,o.status].some(e=>e===`moved`||e===`merged`);return n.effects.set(r,s?`confirmed`:`none`),J({commit:o.tracked&&o.status!==`failed`&&o.status!==`none`?`git add -A .ryugi .artideck .gitignore`:``,home:{conflicts:i.conflicts,error:i.error,status:i.status},hub:a,project:{...o,dir:e.projectDir}},o.status===`failed`||i.status===`failed`?{kind:`failed`,error:{code:`E_MIGRATE_FAILED`,message:o.error??i.error??`failed`}}:{kind:`succeeded`})},present:sR},e)},lR=/^(?:[^@/]+@)?[^:/]+:(?!\/)(.+)$/;function uR(e){if(/^[a-z][a-z0-9+.-]*:\/\//i.test(e))try{let t=new URL(e);return t.protocol===`file:`?null:t.pathname}catch{return null}return lR.exec(e)?.[1]??null}function dR(e){let t=uR(e.trim());if(!t)return null;let n=t.replace(/\.git\/?$/,``).split(`/`).filter(Boolean);return n.length<2?null:n.join(`/`).toLowerCase()}function fR(e){try{return dR((0,p.execFileSync)(`git`,[`-C`,e,`remote`,`get-url`,`origin`],{encoding:`utf8`,timeout:2e3,stdio:[`ignore`,`pipe`,`ignore`],env:{...process.env,GIT_TERMINAL_PROMPT:`0`}}))??d.default.basename(e)}catch{return d.default.basename(e)}}var pR=`# Module vocabulary
|
|
1372
1372
|
|
|
1373
1373
|
Edit \`<project>/.artideck/modules.json\`. A module is a lasting business area, such as billing or sharing, not a file, flag, task or ticket. Your human partner and other agents edit it too; preserve unrelated modules and stable IDs.
|
|
1374
1374
|
|
|
@@ -1394,8 +1394,8 @@ Use readable lowercase IDs. Give modules descriptions and repository path globs
|
|
|
1394
1394
|
Before adding a module, read counts and hints. Add only when no description fits and the area will outlive the task. Rename by changing name while keeping id. Merge B into A by removing B and adding B's ID to A.aliases. Split A into A1/A2 by adding A's old ID to both new aliases. Removing without an alias leaves a retired label on old artifacts. Never reuse or change an ID. Fix clear maintenance hints, leave business judgments to the human, and report edits to this vocabulary explicitly.
|
|
1395
1395
|
|
|
1396
1396
|
The CLI writes artifact tags to project configuration and preserves other settings. Do not edit server state or Cloud metadata to assign tags.
|
|
1397
|
-
`;const cR=`modules.json`,lR=/^[a-z0-9-]{1,40}$/,uR=`1 to 40 lowercase letters, digits and dashes`,dR=e=>e===void 0?[]:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:null;function fR(e,t){if(typeof e!=`object`||!e)return`module ${t+1} must be an object`;let{id:n,name:r,description:i=``,paths:a,aliases:o}=e;if(typeof n!=`string`||!lR.test(n))return`module id ${JSON.stringify(n)} must be ${uR}`;if(typeof r!=`string`||r.trim()===``)return`${n} needs a name`;if(r.length>60)return`${n}: a name is at most 60 characters`;if(typeof i!=`string`)return`${n}: description must be text`;if(i.length>200)return`${n}: a description is at most 200 characters`;let s=dR(a);if(!s)return`${n}: paths must be a list of globs`;let c=dR(o);if(!c)return`${n}: aliases must be a list of retired ids`;if(c.length>20)return`${n} has more than 20 aliases`;let l=c.find(e=>!lR.test(e));return l===void 0?{id:n,name:r,description:i,paths:s,aliases:c}:`alias ${JSON.stringify(l)} of ${n} must be ${uR}`}function pR(e){let t;try{t=JSON.parse(e)}catch(e){return{state:`invalid`,reason:`modules.json is not valid JSON: ${e.message}`}}let n=t?.modules;if(!Array.isArray(n))return{state:`invalid`,reason:`"modules" must be a list`};if(n.length>100)return{state:`invalid`,reason:`a vocabulary has at most 100 modules`};let r=[],i=/* @__PURE__ */ new Set;for(let[e,t]of n.entries()){let n=fR(t,e);if(typeof n==`string`)return{state:`invalid`,reason:n};if(i.has(n.id))return{state:`invalid`,reason:`duplicate module id: ${n.id}`};i.add(n.id),r.push(n)}for(let{id:e,aliases:t}of r){let n=t.find(e=>i.has(e));if(n!==void 0)return{state:`invalid`,reason:`alias ${JSON.stringify(n)} of ${e} is a live module id`}}return{state:`ok`,modules:r}}function mR(e){let t;try{t=u.default.readFileSync(d.default.join(e,cR),`utf8`)}catch{return{state:`missing`}}return pR(t)}function hR(e,t){let n=/* @__PURE__ */ new Set,r=[];for(let i of t){let t=e.some(e=>e.id===i)?[i]:e.filter(e=>e.aliases.includes(i)).map(e=>e.id);t.length===0&&r.push(i);for(let e of t)n.add(e)}return r.length?{unknown:r}:{ids:[...n].sort()}}const gR=`${ge}/${cR}`,_R=e=>d.default.dirname(Ye(e).root),vR=e=>d.default.join(_R(e),`config.json`);function yR(e,t){if(!et.test(t))throw new A(tt);if(!u.default.existsSync(d.default.join(Ye(e).root,t)))throw new A(`No such artifact: ${t}`)}function bR(e){let t=mR(_R(e));if(t.state===`missing`)throw new A(`This project has no vocabulary. Create ${gR} first.`);if(t.state===`invalid`)throw new A(`${gR} is invalid: ${t.reason}`);return t.modules}function xR(e,t,n,r=()=>{}){yR(e,t);let i=bR(e),a=hR(i,n.split(`,`).map(e=>e.trim()).filter(Boolean));if(`unknown`in a)throw new A(`Unknown module: ${a.unknown.join(`, `)}. Choose from: ${i.map(({id:e})=>e).join(`, `)}.`);if(a.ids.length>3)throw new A(`An artifact has at most 3 modules; pick the ones it is mainly about.`);let o=vR(e);return r(),lD(o),uD(o,t,{modules:a.ids}),{artifact:t,modules:a.ids}}function SR(e){let t=/* @__PURE__ */ new Map,n=0;for(let{modules:r}of Object.values(oD(vR(e)).config.artifacts))if(r?.length){n+=1;for(let e of r)t.set(e,(t.get(e)??0)+1)}return{counts:t,tagged:n}}const CR=e=>e.replace(/\/?\*+$/,``).replace(/\/$/,``),wR=(e,t)=>e===t||e.startsWith(`${t}/`);function TR(e){let t=[];for(let[n,r]of e.entries())for(let i of e.slice(n+1)){let e=r.paths.flatMap(e=>i.paths.map(t=>[e,t])).find(([e,t])=>wR(CR(e),CR(t))||wR(CR(t),CR(e)));e&&t.push(`paths overlap: ${r.id} and ${i.id} (${e[0]} and ${e[1]})`)}return t}function ER(e,t,n){let r=e.filter(({id:e})=>!t.get(e)).map(({id:e})=>e);return[...e.length>20?[`${e.length} modules, more than 20: merge the ones that are always chosen together`]:[],...n>=20&&r.length?[`no artifacts: ${r.join(`, `)} — merge them into a neighbour or remove them`]:[],...TR(e)]}function DR(e,{cloud:t,artifact:n}={}){n&&yR(e,n);let r=n?{current:oD(vR(e)).config.artifacts[n]?.modules??null}:{},i=mR(_R(e)),a=t?`cloud`:`local`;if(i.state!==`ok`)return{file:gR,state:i.state,...i.state===`invalid`?{reason:i.reason}:{},modules:[],counts:a,hints:[],...n?{artifact:n}:{},...r};let o=SR(e),s=t?new Map(t.modules.map(({id:e,count:t})=>[e,t])):o.counts,c=t?t.tagged:o.tagged;return{file:gR,state:`ok`,modules:i.modules.map(e=>({...e,count:s.get(e.id)??0})),counts:a,hints:ER(i.modules,s,c),...n?{artifact:n}:{},...r}}async function OR(e,t){try{let{status:n,json:r}=await ZD(e).call(`GET`,`/api/cloud/artifacts`,void 0,t);if(n!==200)return;let i=oR(Ye(e).project);return r.vocabularies?.[i]}catch{return}}function kR({data:e}){let t=e.state===`missing`?`no vocabulary: create ${e.file}`:e.state===`invalid`?`invalid: ${e.reason}`:``;return{heading:`Modules`,status:e.state===`ok`?``:e.state,subject:e.artifact,summary:t||`${e.modules.length} · ${e.file} · counts from ${e.counts===`cloud`?`Cloud`:`this checkout only`}`,facts:e.current===void 0?[]:[X(`Current`,{key:`current`,value:e.current===null?`never tagged`:e.current.length?e.current.join(`, `):`cleared`})],sections:[...e.writing?[{kind:`content`,key:`writing`,title:`Writing`,text:e.writing}]:[],{kind:`records`,key:`modules`,rows:e.modules.map(e=>({...e,paths:e.paths.join(` `)})),columns:[{key:`id`,positional:!0,required:!0},{key:`count`,positional:!0,required:!0},{key:`name`,positional:!0},{key:`description`,positional:!0},{key:`paths`,positional:!0}]},{kind:`diagnostics`,key:`hints`,items:e.hints.map(e=>({code:`W_MODULES_MAINTENANCE`,message:e,severity:`warning`}))}]}}function AR({data:e}){return{heading:`Modules`,status:`SET`,subject:e.artifact,summary:e.modules.length?e.modules.join(`, `):`cleared`,facts:[],sections:[]}}const jR={name:`modules`,summary:`List the project's business modules, or set the modules an artifact serves`,usage:[`[--artifact <type>/<id>] [options]`,`--artifact <type>/<id> --set <id>[,<id>...]`],details:sR.trim(),options:{artifact:{type:`string`,value:`<type>/<id>`,help:`The artifact to show or tag`},set:{type:`string`,value:`<id>[,<id>...]`,help:`Replace the artifact’s modules with these ids`}},semantic:e=>{let t=e.values.artifact,n=e.values.set;if(n!==void 0){if(!t)throw new A(`--set needs --artifact <type>/<id>`);return Z({id:`modules.set`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.modules.join(`,`)},run:(r,i)=>{let a,o=xR(e.projectDir,t,n,()=>{a=i.effects.begin(`modules.set`,t)});return a!==void 0&&i.effects.confirm(a),J(o)},present:AR},e)}return Z({id:`modules`,mode:`finite`,output:{formats:[`brief`,`table`,`json`,`jsonl`],fields:[`id`,`count`,`name`,`description`,`paths`,`aliases`],collection:`modules`,requiredFields:[`id`,`count`]},async run(n,r){let i=await OR(e.projectDir,r.signal),a=DR(e.projectDir,{cloud:i,artifact:t});return J({...a,project:e.projectDir,write:d.default.join(e.projectDir,a.file),...a.state===`ok`?{}:{writing:sR.trim()}})},present:kR},e)}},MR=864e5,NR=e=>{try{return JSON.parse(u.default.readFileSync(e,`utf8`))}catch{return null}};function PR(e){let t=NR(e);return t&&typeof t==`object`?{failures:0,...t}:{failures:0}}function FR(e){let t=NR(d.default.join(e,`plugins`,`installed_plugins.json`))?.plugins,n=/* @__PURE__ */ new Set;if(!t||typeof t!=`object`)return n;for(let[e,r]of Object.entries(t))Array.isArray(r)&&r.some(e=>e?.scope===`user`)&&n.add(e);return n}function IR(e){let t=NR(d.default.join(e,`settings.json`))?.enabledPlugins;return t&&typeof t==`object`?t:{}}const LR=e=>{let t=FR(e);return Object.keys(HN).filter(e=>t.has(HN[e])).map(e=>({legacy:HN[e],target:VN[e]}))},RR=(e,t)=>e?t.getTime()-Date.parse(e):1/0;function zR({configDir:e,stateFile:t,now:n}){if(!LR(e).length)return!1;let r=PR(t);return!r.notice&&RR(r.attemptedAt,n)>=MR}function BR(e){let t=`${e}.lock`;try{u.default.mkdirSync(d.default.dirname(e),{recursive:!0}),u.default.existsSync(t)&&Date.now()-u.default.statSync(t).mtimeMs>6e5&&u.default.rmSync(t,{force:!0}),u.default.writeFileSync(t,String(process.pid),{flag:`wx`})}catch{return null}return()=>u.default.rmSync(t,{force:!0})}function VR(e){if(!LR(e.configDir).length)return{status:`idle`};let t=BR(e.stateFile);if(!t)return{status:`waiting`};try{return HR(e)}finally{t()}}function HR({configDir:e,stateFile:t,now:n,run:r}){let i=LR(e),a=PR(t);if(a.notice||RR(a.attemptedAt,n)<MR)return{status:`waiting`};a.attemptedAt=n.toISOString();try{NN(t,a)}catch(e){return{status:`failed`,error:e.message}}let o=e=>(a.failures+=1,a.lastError=e,a.failures>=3&&(a.notice=!0),NN(t,a),{status:`failed`,error:e}),s=e=>{let t=r(e);if(t.status!==0)throw Error(`claude ${e.join(` `)}: ${(t.stderr||t.stdout).trim()}`)},c=IR(e),l=FR(e),u=[],d=[];try{if(i.some(({target:e})=>!l.has(e))){s([`plugin`,`marketplace`,`update`,zN]);for(let{legacy:e,target:t}of i)l.has(t)||(u.push(t),s([`plugin`,`install`,t,`--scope`,`user`]),c[e]===!1&&s([`plugin`,`disable`,t,`--scope`,`user`]))}for(let{legacy:e,target:t}of i)c[e]!==!1&&(l.has(t)&&c[t]===!1&&(u.push(t),s([`plugin`,`enable`,t,`--scope`,`user`])),s([`plugin`,`disable`,e,`--scope`,`user`]),d.push(e))}catch(t){for(let e of d)r([`plugin`,`enable`,e,`--scope`,`user`]);let n=FR(e);for(let e of u)n.has(e)&&r([`plugin`,`disable`,e,`--scope`,`user`]);return o(t.message)}if(!a.disabledAt)return a.disabledAt=n.toISOString(),a.failures=0,NN(t,a),{status:`moved`};if(RR(a.disabledAt,n)<MR)return NN(t,a),{status:`waiting`};try{for(let{legacy:e}of i)s([`plugin`,`uninstall`,e,`--scope`,`user`])}catch(e){return o(e.message)}return a.failures=0,NN(t,a),{status:`done`}}function UR(e,t){let n=wP(e),r=n.harnesses[`claude-code`],i=Object.keys(HN).find(e=>HN[e]===r?.registration);if(!r||!i)return;let a=t(VN[i]);n.harnesses[`claude-code`]={...r,registration:VN[i],version:a.version,path:a.path,nativeSource:a.source},TP(e,n)}const WR=/* @__PURE__ */ new Set([`dev`,`install`,`plugin-migrate`,`uninstall`,`update`]),GR=(e=m.default.homedir())=>d.default.join(Te(e),`plugin-migration.json`),KR=(e,t=m.default.homedir())=>e.CLAUDE_CONFIG_DIR||d.default.join(t,`.claude`),qR=e=>{try{return JSON.parse(u.default.readFileSync(e,`utf8`))}catch{return{}}};function JR(e){try{return Object.values(wP(jN(e)).harnesses).filter(e=>!!e&&e.harness!==`claude-code`&&_P(e))}catch{return[]}}function YR(e,t,n=m.default.homedir()){if(!JR(e).length)return!1;let r=qR(GR(n)).managedAttemptedAt;return typeof r!=`string`||t.getTime()-Date.parse(r)>=864e5}function XR(e,t=m.default.homedir()){let n=GR(t);NN(n,{failures:0,...qR(n),managedAttemptedAt:e.toISOString()})}function ZR(e,t,n=m.default.homedir()){try{return zR({configDir:KR(e,n),stateFile:GR(n),now:t})||YR(e,t,n)}catch{return!1}}function QR(e){try{let t=d.default.dirname(GR(e));return u.default.mkdirSync(t,{recursive:!0}),u.default.accessSync(t,u.default.constants.W_OK),!0}catch{return!1}}function $R(e,t,n,r=m.default.homedir()){return WR.has(e[0]??``)||t.RYUGI_NO_PLUGIN_MIGRATE||t.CI?!1:ZR(t,n,r)&&QR(r)}function ez(e,t=process.env,{execPath:n=process.execPath,home:r=m.default.homedir()}={}){let i=process.argv[1];if(i)try{if(!$R(e,t,/* @__PURE__ */ new Date,r))return;(0,p.spawn)(n,[i,`plugin-migrate`,`--format`,`quiet`],{detached:!0,stdio:`ignore`,env:{...t,RYUGI_NO_PLUGIN_MIGRATE:`1`}}).on(`error`,()=>{}).unref()}catch{return}}const tz=e=>{let{command:t,args:n,shell:r}=HL(e),i=(0,p.spawnSync)(t,n,{encoding:`utf8`,shell:r,stdio:[`ignore`,`pipe`,`pipe`]});return{status:i.error?1:i.status,stdout:i.stdout??``,stderr:i.stderr||i.error?.message||``}};function nz({data:e}){return{heading:`Plugin migration`,status:e.claude.status,summary:e.claude.error??``,facts:[X(`Claude Code`,Y(e.claude,`status`)),...e.managed.map(e=>X(e.harness,Y(e,e.error?`error`:`status`)))],sections:[]}}const rz={name:`plugin-migrate`,summary:`Move plugin installs still named ryugi to adeck`,usage:[``],details:`Claude Code: installs adeck@ryugi-dev (or adeck-lite) at user scope and disables the ryugi entry, then uninstalls it a day later. Managed Codex, Copilot, Cursor, Gemini and Antigravity installs are reinstalled under their adeck names. Each runs at most once a day; every CLI command starts this in the background when it is due.`,positionals:0,options:{},semantic:e=>Z({id:`plugin-migrate`,mode:`finite`,output:{formats:[`brief`,`json`,`quiet`],scalar:e=>e.claude.status},async run(t,n){let r=m.default.homedir(),i=/* @__PURE__ */ new Date,a=VR({configDir:KR(process.env,r),stateFile:GR(r),now:i,run:tz});if(a.status===`moved`||a.status===`done`)try{UR(jN(),e=>tP(e,dP))}catch{}let o=[];if(YR(process.env,i,r)){XR(i,r);for(let t of JR(process.env)){let r=(await ZL({projectDir:e.projectDir,positionals:[],values:{mode:t.mode,harness:t.harness,"no-cli":!0,"install-dir":jN()}},n,!1,!0)).data.targets.find(e=>e.harness===t.harness);o.push({harness:t.harness,status:r?.status||`failed`,...r?.error?{error:r.error}:{}})}}let s=a.status===`failed`||o.some(e=>e.status!==`installed`);return J({claude:a,managed:o},s?{kind:`partial`}:void 0)},present:nz},e)};var iz=/* @__PURE__ */ (e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(iz||{});const az=[0,1],oz=[1,0],sz=[2,3],cz=[3,2],lz={L:az,M:oz,Q:sz,H:cz},uz=/^\d*$/,dz=/^[A-Z0-9 $%*+./:-]*$/,fz=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,pz=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],mz=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];var hz=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<1||e>40)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,iz.Timing),this.setFunctionModule(e,6,e%2==0,iz.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,_z(r,e));this.setFunctionModule(8,7,_z(r,6)),this.setFunctionModule(8,8,_z(r,7)),this.setFunctionModule(7,8,_z(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,_z(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,_z(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,_z(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=_z(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,iz.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,iz.Alignment)}setFunctionModule(e,t,n,r=iz.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==Mz(t,n))throw RangeError(`Invalid argument`);let r=mz[n[0]][t],i=pz[n[0]][t],a=Math.floor(jz(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=Nz(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=Pz(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(jz(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=_z(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=3:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*40),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*40}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=3:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*40),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*40}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=3)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*10,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function gz(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function _z(e,t){return!!(e>>>t&1)}var vz=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}};const yz=[1,10,12,14],bz=[2,9,11,13],xz=[4,8,16,16];function Sz(e,t){return e[Math.floor((t+7)/17)+1]}function Cz(e){let t=[];for(let n of e)gz(n,8,t);return new vz(xz,e.length,t)}function wz(e){if(!Dz(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);gz(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new vz(yz,e.length,t)}function Tz(e){if(!Oz(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=fz.indexOf(e.charAt(n))*45;r+=fz.indexOf(e.charAt(n+1)),gz(r,11,t)}return n<e.length&&gz(fz.indexOf(e.charAt(n)),6,t),new vz(bz,e.length,t)}function Ez(e){return e===``?[]:Dz(e)?[wz(e)]:Oz(e)?[Tz(e)]:[Cz(Az(e))]}function Dz(e){return uz.test(e)}function Oz(e){return dz.test(e)}function kz(e,t){let n=0;for(let r of e){let e=Sz(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function Az(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function jz(e){if(e<1||e>40)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function Mz(e,t){return Math.floor(jz(e)/8)-pz[t[0]][e]*mz[t[0]][e]}function Nz(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=Fz(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=Fz(n,2)}return t}function Pz(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=Fz(t,e))}return n}function Fz(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function Iz(e,t,n=1,r=40,i=-1,a=!0){if(!(1<=n&&n<=r&&r<=40)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=Mz(o,t)*8,i=kz(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[oz,sz,cz])a&&s<=Mz(o,e)*8&&(t=e);let c=[];for(let t of e){gz(t.mode[0],4,c),gz(t.numChars,Sz(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=Mz(o,t)*8;gz(0,Math.min(4,l-c.length),c),gz(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)gz(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new hz(o,t,u,i)}function Lz(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?Ez(e):Array.isArray(e)?[Cz(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=Iz(c,lz[n],i,a,o,r),u=Rz({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function Rz(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=iz.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function zz(e,t,n,r=!1){return t<0||n<0||t>=e.length||n>=e.length?r:e[n][t]}function Bz(e,t={}){let n={WHITE_ALL:`█`,WHITE_BLACK:`▀`,BLACK_WHITE:`▄`,BLACK_ALL:` `},r=Lz(e,t),i=(e,t)=>zz(r.data,e,t,!0),a=[],o=``;for(let e=0;e<r.size;e+=2){for(let t=0;t<r.size;t++)i(t,e)===!1&&i(t,e+1)===!1?o+=n.WHITE_ALL:i(t,e)===!1&&i(t,e+1)===!0?o+=n.WHITE_BLACK:i(t,e)===!0&&i(t,e+1)===!1?o+=n.BLACK_WHITE:o+=n.BLACK_ALL;a.push(o),o=``}return a.join(`
|
|
1398
|
-
`)}const Vz=e=>typeof e==`object`&&!!e&&typeof e.code==`string`&&typeof e.url==`string`;function Hz(e){if(e.status>=200&&e.status<300)return e.json;let t=e.json;throw new K({code:e.status===401?`E_LOGIN_REQUIRED`:typeof t.code==`string`?`E_${t.code.toUpperCase()}`:`E_HTTP_${e.status}`,message:typeof t.error==`string`?t.error:`Cloud request failed: HTTP ${e.status}`,httpStatus:e.status,details:{...t.loginUrl?{loginUrl:t.loginUrl}:{},...Vz(t.login)?{loginUrl:t.login.url,signInCode:t.login.code}:{},...t.upgradeUrl?{upgradeUrl:t.upgradeUrl}:{},...t.limit?{limit:t.limit}:{},...t.plan?{plan:t.plan}:{},...t.reasons?{reasons:t.reasons}:{}}},e.status===401||e.status===402&&(t.code===`plan_limit`||t.code===`plan_required`)?`action_required`:`failed`)}const Uz=[`brief`,`json`,`jsonl`,`quiet`],Wz=/^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$/i;function Gz(e){let{values:t}=e,n=[`unpublish`,`revoke-key`,`list`,`delete`,`login`,`logout`,`move-to`].filter(e=>t[e]),r=!!(t.key||t[`new-key`]);if(n.length>1||t.public&&t.private||t.public&&r||t.profile&&t[`no-profile`]||r&&t[`revoke-key`])throw new K({code:`E_OPTION_CONFLICT`,message:`Choose one publish action and one visibility.`});let i=n[0]??`publish`;if(i!==`publish`&&r||t.key&&t[`new-key`]||t.artifact!==void 0&&![`publish`,`unpublish`,`revoke-key`,`list`].includes(i)||t.from!==void 0&&i!==`login`||t[`with-token`]&&i!==`login`)throw new K({code:`E_OPTION_UNSUPPORTED`,message:`Key creation applies only to publishing; artifact targets apply to publishing, key revocation or targeted --list; --from and --with-token apply only to --login. Choose either --key or --new-key.`});if(i!==`list`&&[`visibility`,`type`,`project`,`module`,`limit`,`cursor`].some(e=>t[e]!==void 0))throw new K({code:`E_OPTION_UNSUPPORTED`,message:`List filters and paging apply only to --list.`});let a=t.artifact;if(([`publish`,`unpublish`,`revoke-key`].includes(i)||i===`list`&&a!==void 0)&&(!a||!et.test(a)))throw new K({code:`E_ARGUMENT_INVALID`,message:`--artifact must be <type>/<id>.`});if(i===`list`&&a&&[`visibility`,`type`,`project`,`module`,`limit`,`cursor`,`fields`].some(e=>t[e]!==void 0))throw new K({code:`E_OPTION_UNSUPPORTED`,message:`Targeted --list --artifact reads publication and key state; collection filters and paging apply only without --artifact.`});if(i===`delete`&&!/^[\w-]{1,64}$/.test(String(t.delete??``)))throw new K({code:`E_ARGUMENT_INVALID`,message:`--delete requires a Cloud artifact ID.`});if(i!==`publish`&&(t.public||t.private||t[`no-refs`]||t.profile||t[`no-profile`]))throw new K({code:`E_OPTION_UNSUPPORTED`,message:`Visibility, profile listing and --no-refs apply only to publishing.`});if(t.expires!==void 0&&!r)throw new K({code:`E_OPTION_UNSUPPORTED`,message:`--expires applies only with --key or --new-key.`});if(i===`move-to`&&(!Wz.test(String(t[`move-to`]))||String(t[`move-to`]).toLowerCase()===`personal`))throw new K({code:`E_ARGUMENT_INVALID`,message:`--move-to requires the slug of a team you belong to.`});let o=t.space;if(o!==void 0&&i!==`publish`)throw new K({code:`E_OPTION_UNSUPPORTED`,message:`--space applies only to publishing.`});if(o!==void 0&&!Wz.test(o))throw new K({code:`E_ARGUMENT_INVALID`,message:`--space must be a team slug or "personal".`});if(t.expires!==void 0&&!QE(t.expires))throw new K({code:`E_ARGUMENT_INVALID`,message:`--expires must be 1d, 7d, 30d or never.`});let s=r?{...t.expires?{expires:t.expires}:{},...t[`new-key`]?{regenerate:!0}:{}}:void 0;return{action:i,artifact:a,key:s,space:o?.toLowerCase(),onProfile:t.profile?!0:!t[`no-profile`]&&void 0,visibility:t.public?`public`:t.private||s?`private`:void 0}}function Kz(e,t,n){return Z({id:`publish.${t}`,mode:`finite`,output:{formats:t===`login`?[`brief`,`json`,`jsonl`]:Uz,scalar:e=>e.id},async run(r,i){let a=t===`delete`?String(e.values.delete):n,o=[`login`,`logout`,`move-to`].includes(t)?`POST`:`DELETE`,s=t===`delete`?`/api/cloud/artifacts/${a}`:t===`unpublish`?`/api/cloud/publish/${a}`:t===`revoke-key`?`/api/cloud/share-key/${a}`:t===`move-to`?`/api/cloud/transfer`:`/api/cloud/${t}`,c=t===`login`?void 0:i.effects.begin(t,a??`cloud-account`),l=typeof e.values.from==`string`?e.values.from:`cli`,u;if(t===`login`){if(e.values[`with-token`]){let e=[];for await(let t of process.stdin)e.push(Buffer.from(t));let t=Buffer.concat(e).toString(`utf8`).trim();if(!t)throw new K({code:`E_ARGUMENT_INVALID`,message:`Pass an access token on stdin when using --login --with-token.`});u={token:t}}else u={source:l}}let d=await ZD(e.projectDir).call(o,s,t===`move-to`?{space:String(e.values[`move-to`]).toLowerCase()}:u,i.signal);c!==void 0&&d.status>=400&&d.status<500&&i.effects.set(c,`failed`);let f=Hz(d);c!==void 0&&i.effects.confirm(c);let p=t===`login`&&Vz(f.pending)?f.pending:null,m=t===`login`&&!f.signedIn?{kind:`pending`,reasons:[`sign_in_code_unconfirmed`]}:t===`logout`&&f.remoteRevoked!==!0?{kind:`partial`}:{kind:`succeeded`};return J({id:t===`logout`?`signed-out`:f.id??a??`cloud-account`,artifact:a,status:t===`login`?f.signedIn?`signed_in`:`pending`:t===`logout`?`signed_out`:t===`move-to`?`moved`:t===`delete`?`deleted`:t===`revoke-key`?`key_removed`:`unpublished`,...f.url?{url:f.url}:{},...p?{code:p.code,url:p.url,expiresAt:p.expiresAt,autoPublish:f.autoPublish===!0?`on`:`off until you turn it on: ${process.env.RYUGI_ARTIFACTS_COMMAND||`npx artideck`} config --auto-publish on`}:{},...t===`logout`?{localCredentials:`cleared`,remoteSession:f.remoteRevoked===!0?`revoked`:`unknown`}:{}},m,{effects:i.effects.snapshot(),actions:p?[{kind:`url`,url:p.url,label:`Confirm the code`}]:f.url?[{kind:`url`,url:f.url,label:`Open`}]:[]})},present({data:e}){return{heading:t===`login`?`Login`:t===`logout`?`Logout`:`Cloud artifact`,status:e.status,subject:e.id,facts:[...e.artifact?[X(`Artifact`,Y(e,`artifact`))]:[],...e.code?[X(`Code`,Y(e,`code`))]:[],...e.url?[X(`URL`,Y(e,`url`))]:[],...e.expiresAt?[X(`Expires`,Y(e,`expiresAt`))]:[],...e.autoPublish?[X(`Auto-publish`,Y(e,`autoPublish`))]:[],...e.remoteSession?[X(`Remote session`,Y(e,`remoteSession`))]:[]],sections:e.url&&e.code?[{kind:`content`,key:`qr`,text:Bz(e.url)}]:[]}}},e)}async function qz(e,t,n,r,i,a){let o=ZD(e.projectDir),s=await(async(e,n)=>{let r=t.effects.begin(`publish`,e),a={...n?{visibility:n}:{},...i===void 0?{}:{onProfile:i}},s=await o.call(`POST`,`/api/cloud/publish/${e}`,Object.keys(a).length?a:void 0,t.signal);s.status>=400&&s.status<500&&t.effects.set(r,`failed`,s.json);let c=Hz(s);return t.effects.confirm(r,{url:c.url,visibility:c.visibility,version:c.version}),c})(n,r),c;if(a||s.keyed){let e=a?t.effects.begin(`share-key`,n):void 0,r=await o.call(a?`PUT`:`GET`,`/api/cloud/share-key/${n}`,a,t.signal);e!==void 0&&r.status>=400&&r.status<500&&t.effects.set(e,`failed`);let i=Hz(r);if(i.shareKey===void 0||a&&!i.shareKey)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server did not confirm the share-key state.`});c=i.shareKey??void 0,e!==void 0&&t.effects.confirm(e,{expiresAt:c?.expiresAt})}let l=Hz(await o.call(`GET`,`/api/cloud/refs/${n}?visibility=${s.visibility}&referrers=0`,void 0,t.signal)),u=e.values[`no-refs`]?[]:l.items.filter(e=>e.checked&&e.state!==`private`),d=/* @__PURE__ */ new Map;if(u.length){let e=new Map(u.map(e=>[e.artifact,t.effects.begin(`publish`,e.artifact)])),r=Hz(await o.call(`POST`,`/api/cloud/publish-refs/${n}`,{visibility:s.visibility,refs:u.map(e=>e.artifact),makePublic:[]},t.signal));for(let n of r.results){d.set(n.artifact,n);let r=e.get(n.artifact);r!==void 0&&(n.status===`published`?t.effects.confirm(r,{}):n.status===`failed`?t.effects.set(r,`failed`,n.error):n.status===`not_attempted`&&t.effects.set(r,`not_attempted`))}}let f=e=>{try{Hz({status:e.error?.httpStatus??500,json:e.error??{}})}catch(e){return _D(e)}},p={publish:`published`,update:`updated`,"make-public":`made_public`},m=l.items.map(e=>{let t={artifact:e.artifact,state:e.state,via:e.via},n=d.get(e.artifact);if(n){let e=n.status===`published`?void 0:f(n);return{...t,status:n.status===`published`?p[n.action]:n.status,...e?{error:e}:{}}}return e.reason===`upstream`?{...t,status:`unreachable`}:e.state===`unpublished`||e.state===`stale`?{...t,status:`skipped`}:{...t,status:e.state}}),h=m.some(e=>[`failed`,`unknown`,`not_attempted`].includes(e.status)),g={status:h?`partial`:`published`,artifact:n,id:s.id??new URL(s.url).pathname.split(`/`).filter(Boolean).at(-1),url:c?.url??s.url,visibility:s.visibility,...s.version===void 0?{}:{version:s.version},visibilitySource:r?`requested`:`preserved`,onProfile:s.onProfile===!0,onProfileSource:i===void 0?`preserved`:`requested`,...c?{shareKey:{key:c.key,expiresAt:c.expiresAt}}:{},references:m},_=m.filter(e=>e.status===`private`),v=m.filter(e=>e.status===`skipped`);return J(g,h?{kind:`partial`}:{kind:`succeeded`},{effects:t.effects.snapshot(),warnings:[...(Array.isArray(s.notes)?s.notes:[]).filter(e=>typeof e==`string`).map(e=>({code:`W_CUT_NOT_PUBLISHED`,message:e})),...i&&s.visibility!==`public`?[{code:`W_PROFILE_NEEDS_PUBLIC`,message:`It will show on your profile once it is public.`}]:[],..._.length?[{code:`W_REFERENCES_PRIVATE`,message:`${_.length} referenced artifacts are private; visitors see a locked label.`}]:[],...v.length?[{code:`W_REFERENCES_UNPUBLISHED`,message:`${v.length} referenced artifacts were left as they are (--no-refs).`}]:[]],actions:[...m.flatMap(e=>e.error?iO(e.error,e.artifact):[]),..._.map(t=>q([`publish`,`--artifact`,t.artifact,`--project-dir`,e.projectDir,`--public`],`Next`)),...v.length&&!h?[q([`publish`,`--artifact`,n,`--project-dir`,e.projectDir],`Next`)]:[]]})}function Jz({data:e}){return{heading:`Publish`,status:e.status,subject:e.artifact,facts:[X(`ID`,Y(e,`id`),!0),X(`URL`,Y(e,`url`),!0),X(`Visibility`,{key:`visibility`,value:`${e.visibility} (${e.visibilitySource})`},!0),...e.visibility===`public`?[X(`Profile`,{key:`onProfile`,value:e.onProfile?`listed`:`not listed`},!0)]:[],...e.shareKey?[X(`Key`,{key:`shareKey.key`,value:e.shareKey.key},!0),X(`Expires`,{key:`shareKey.expiresAt`,value:e.shareKey.expiresAt??`never`},!0)]:[],...e.version===void 0?[]:[X(`Version`,Y(e,`version`))]],sections:e.references.length?[{kind:`records`,key:`references`,title:`Referenced artifacts`,rows:e.references.map(e=>({artifact:e.artifact,status:e.status,via:e.via?`via ${e.via}`:``,error:e.error?`${e.error.code}: ${e.error.message}`:``,recovery:e.status===`unknown`?`inspect the remote artifact before retrying`:``})),columns:[{key:`artifact`,positional:!0,required:!0},{key:`status`,positional:!0,required:!0},{key:`via`,positional:!0},{key:`error`,positional:!0},{key:`recovery`,positional:!0}]}]:[]}}function Yz({data:e,coverage:t}){return{heading:`Cloud artifacts`,status:``,summary:`${t.page?.total??e.artifacts.length} on account`,facts:[],sections:[{kind:`records`,key:`artifacts`,rows:e.artifacts.map(e=>({...e,version:e.version===void 0?``:`v${e.version}`})),columns:[{key:`id`,positional:!0,required:!0},{key:`type`,positional:!0},{key:`visibility`,positional:!0,required:!0},{key:`version`,positional:!0},{key:`updatedAt`,positional:!0},{key:`title`,positional:!0}]}]}}function Xz(e){let{action:t,artifact:n,visibility:r,onProfile:i,key:a,space:o}=Gz(e);if(t===`list`&&n)return Z({id:`publish.list`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`]},async run(t,r){let i=ZD(e.projectDir),a=XE(Hz(await i.call(`GET`,`/api/cloud/publication/${n}`,void 0,r.signal)));if(!a)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported publication state.`});let{shareKey:o}=Hz(await i.call(`GET`,`/api/cloud/share-key/${n}`,void 0,r.signal));if(o===void 0)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server did not return the current share-key state.`});return J({artifact:n,publication:a,shareKey:o})},present({data:e}){return{heading:`Cloud artifact`,status:e.publication.phase,subject:n,facts:[X(`Published at`,{key:`publication.publishedAt`,value:e.publication.publishedAt}),X(`Key`,{key:`shareKey.key`,value:e.shareKey?.key??`none`},!0),...e.shareKey?[X(`URL`,{key:`shareKey.url`,value:e.shareKey.url},!0),X(`Expires`,{key:`shareKey.expiresAt`,value:e.shareKey.expiresAt??`never`},!0)]:[]],sections:[]}}},e);if(t===`publish`)return Z({id:`publish.publish`,mode:`finite`,output:{formats:Uz,scalar:e=>e.id},run:(t,s)=>(o&&fD(d.default.join(d.default.dirname(Ye(e.projectDir).root),`config.json`),o),qz(e,s,n,r,i,a)),present:Jz},e);if(t===`list`){let t=new URLSearchParams({semantic:`1`});for(let n of[`visibility`,`type`,`project`,`limit`,`cursor`,`fields`]){let r=e.values[n];typeof r==`string`&&t.set(n,r)}if(typeof e.values.module==`string`){t.has(`project`)||t.set(`project`,oR(Ye(e.projectDir).project));let n=e.values.module.split(`,`).map(e=>e.trim());for(let e of new Set(n))t.append(`module`,e)}if(t.has(`limit`)&&(!/^\d+$/.test(t.get(`limit`))||+t.get(`limit`)<1||+t.get(`limit`)>100))throw new K({code:`E_ARGUMENT_INVALID`,message:`--limit must be between 1 and 100.`});if(t.has(`visibility`)&&![`public`,`private`].includes(t.get(`visibility`))||t.has(`type`)&&!Jv(t.get(`type`)))throw new K({code:`E_ARGUMENT_INVALID`,message:`Invalid Cloud list filter.`});return Z({id:`publish.list`,mode:`finite`,output:{detail:!0,formats:[`brief`,`table`,`json`,`jsonl`,`raw`],fields:[`id`,`type`,`title`,`project`,`modules`,`visibility`,`url`,`updatedAt`,`version`],collection:`artifacts`,requiredFields:[`id`,`type`,`visibility`,`version`]},async run(n,r){let i=await ZD(e.projectDir).call(`GET`,`/api/cloud/artifacts?${t}`,void 0,r.signal);r.payloads.raw=i.raw;let a=Hz(i);if(a.schema!==`ryugi.cloud-list/v1`)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported Cloud list response.`});return J({artifacts:a.artifacts},void 0,{coverage:{page:a.page},actions:a.page?.nextCursor?[q([`publish`,`--list`,`--project-dir`,e.projectDir,...[...new Set(t.keys())].filter(e=>![`semantic`,`cursor`].includes(e)).flatMap(e=>[`--${e}`,t.getAll(e).join(`,`)]),`--cursor`,a.page.nextCursor],`More`)]:[]})},present:Yz},e)}return Kz(e,t,n)}const Zz={semantic:Xz,name:`publish`,summary:`Publish an artifact to the Artideck Cloud (needs a running server)`,usage:[`--artifact <type>/<id> [--public | --private | --key] [--profile | --no-profile] [options]`,`--artifact <type>/<id> --unpublish | --revoke-key [options]`,`--list | --delete <cloud-id> | --login | --logout [options]`,`--move-to <team-slug> (move this project into a team)`,`--list --artifact <type>/<id> (read publication and current key state without changing either)`],options:{visibility:{type:`string`,value:`<public|private>`,help:`Filter published list visibility`},type:{type:`string`,value:`<${pe.join(`|`)}>`,help:`Filter published list type`},project:{type:`string`,value:`<project>`,help:`Filter published list project`},module:{type:`string`,value:`<id>[,<id>...]`,help:`Filter published list by module ("" for untagged); the project defaults to this one`},limit:{type:`string`,value:`<1-100>`,help:`Maximum list rows`},cursor:{type:`string`,value:`<token>`,help:`Continue a stable list snapshot`},artifact:{type:`string`,value:`<type>/<id>`,help:`The artifact to publish, unpublish, revoke a key, or inspect with --list`},public:{type:`boolean`,help:`Anyone with the link can open it`},private:{type:`boolean`,help:`Only you can open it`},key:{type:`boolean`,help:`Only people with the key can open it; prints a link that carries the key`},expires:{type:`string`,value:`<1d|7d|30d|never>`,help:`With --key or --new-key: when the key stops working (7d for a new key)`},"new-key":{type:`boolean`,help:`Replace the key; links with the old key stop opening`},"revoke-key":{type:`boolean`,help:`Remove the key; only you can open it`},profile:{type:`boolean`,help:`Show it on your public profile once it is public`},"no-profile":{type:`boolean`,help:`Take it off your public profile`},unpublish:{type:`boolean`,help:`Remove the artifact's cloud copy`},list:{type:`boolean`,help:`List your cloud artifacts; with --artifact, read its publication and current key state`},delete:{type:`string`,value:`<cloud-id>`,help:`Delete a cloud artifact by its id from --list`},space:{type:`string`,value:`<team-slug|personal>`,help:`Where this project's new artifacts publish; already published ones stay where they are`},"move-to":{type:`string`,value:`<team-slug>`,help:`Move every artifact of this project from your personal space into a team; links stay the same`},"no-refs":{type:`boolean`,help:`Publish only this artifact; leave the artifacts it references as they are`},login:{type:`boolean`,help:`Sign in to the Artideck Cloud`},"with-token":{type:`boolean`,help:`With --login: read an access token from stdin instead of opening a browser`},from:{type:`string`,value:`<tag>`,help:`With --login: where this sign-in started, recorded by Artideck Cloud`},logout:{type:`boolean`,help:`Sign out of the Artideck Cloud`}}},Qz=/* @__PURE__ */ new Set([`created`,`updated`,`bound`]),$z=/* @__PURE__ */ new Set([`conflict`,`name_clash`]);function eB({data:e}){let t=/* @__PURE__ */ new Map;for(let n of e.results)t.set(n.outcome,(t.get(n.outcome)??0)+1);return{heading:`Pull`,status:``,subject:e.project,summary:e.results.length?[...t].map(([e,t])=>`${t} ${e}`).join(` · `):`no Cloud artifacts in this project`,facts:[X(`Project`,Y(e,`project`))],sections:[{kind:`records`,key:`results`,rows:e.results.map(e=>({...e,note:e.message??e.notes?.join(`; `)??``})),columns:[{key:`key`,positional:!0,required:!0},{key:`outcome`,positional:!0,required:!0},{key:`url`,positional:!0},{key:`note`,positional:!0}]}]}}function tB(e){let t=e.values.artifact,n=e.positionals[0];if(t&&n)throw new K({code:`E_OPTION_CONFLICT`,message:`Give --artifact or a Cloud link, not both.`});let r=t??n,i=e.values.as;if(i&&!r)throw new K({code:`E_ARGUMENT_INVALID`,message:`--as needs one target: --artifact <type>/<id> or a Cloud link.`});let a=e.values[`dry-run`]===!0,o=e.values.force===!0,s=e.values.project;return Z({id:`pull`,mode:`finite`,output:{formats:[`brief`,`table`,`json`,`jsonl`],collection:`results`,fields:[`key`,`outcome`,`cloudId`,`url`,`dir`,`message`,`notes`],requiredFields:[`key`,`outcome`]},async run(t,n){let c=Hz(await ZD(e.projectDir).call(`POST`,`/api/cloud/pull`,{target:r,project:s,as:i,dryRun:a,force:o},n.signal));if(!Array.isArray(c.results))throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported pull response.`});if(!a)for(let e of c.results){if(!Qz.has(e.outcome)&&e.outcome!==`failed`)continue;let t=n.effects.begin(`pull.${e.outcome}`,e.key);e.outcome===`failed`?n.effects.set(t,`failed`,{message:e.message}):n.effects.confirm(t)}let l=c.results.some(e=>e.outcome===`failed`)?{kind:`partial`}:c.results.some(e=>$z.has(e.outcome))?{kind:`validation_failed`}:{kind:`succeeded`},u=[`--project-dir`,e.projectDir];return J(c,l,{effects:n.effects.snapshot(),actions:c.results.flatMap(e=>e.outcome===`conflict`?[q([`get`,e.url],`Compare`),q([`pull`,e.cloudId,`--force`,...u],`Take Cloud`)]:e.outcome===`name_clash`?[q([`pull`,e.cloudId,`--as`,`${e.key.split(`/`)[1]}-cloud`,...u],`Pull as`)]:[])})},present:eB},e)}const nB={semantic:tB,name:`pull`,summary:`Pull this project's Cloud artifacts into the local artifacts folder (needs a running server)`,usage:[`[--project <owner/repo>] [--dry-run] [--force] [options]`,`--artifact <type>/<id> | <link-or-cloud-id> [--as <id>] [--dry-run] [--force] [options]`],positionals:1,details:`Each Cloud artifact of the project lands in .artideck/artifacts/<type>/<slug> and stays bound to its Cloud link, so publish updates it instead of creating a new one.
|
|
1397
|
+
`;const mR=`modules.json`,hR=/^[a-z0-9-]{1,40}$/,gR=`1 to 40 lowercase letters, digits and dashes`,_R=e=>e===void 0?[]:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:null;function vR(e,t){if(typeof e!=`object`||!e)return`module ${t+1} must be an object`;let{id:n,name:r,description:i=``,paths:a,aliases:o}=e;if(typeof n!=`string`||!hR.test(n))return`module id ${JSON.stringify(n)} must be ${gR}`;if(typeof r!=`string`||r.trim()===``)return`${n} needs a name`;if(r.length>60)return`${n}: a name is at most 60 characters`;if(typeof i!=`string`)return`${n}: description must be text`;if(i.length>200)return`${n}: a description is at most 200 characters`;let s=_R(a);if(!s)return`${n}: paths must be a list of globs`;let c=_R(o);if(!c)return`${n}: aliases must be a list of retired ids`;if(c.length>20)return`${n} has more than 20 aliases`;let l=c.find(e=>!hR.test(e));return l===void 0?{id:n,name:r,description:i,paths:s,aliases:c}:`alias ${JSON.stringify(l)} of ${n} must be ${gR}`}function yR(e){let t;try{t=JSON.parse(e)}catch(e){return{state:`invalid`,reason:`modules.json is not valid JSON: ${e.message}`}}let n=t?.modules;if(!Array.isArray(n))return{state:`invalid`,reason:`"modules" must be a list`};if(n.length>100)return{state:`invalid`,reason:`a vocabulary has at most 100 modules`};let r=[],i=/* @__PURE__ */ new Set;for(let[e,t]of n.entries()){let n=vR(t,e);if(typeof n==`string`)return{state:`invalid`,reason:n};if(i.has(n.id))return{state:`invalid`,reason:`duplicate module id: ${n.id}`};i.add(n.id),r.push(n)}for(let{id:e,aliases:t}of r){let n=t.find(e=>i.has(e));if(n!==void 0)return{state:`invalid`,reason:`alias ${JSON.stringify(n)} of ${e} is a live module id`}}return{state:`ok`,modules:r}}function bR(e){let t;try{t=u.default.readFileSync(d.default.join(e,mR),`utf8`)}catch{return{state:`missing`}}return yR(t)}function xR(e,t){let n=/* @__PURE__ */ new Set,r=[];for(let i of t){let t=e.some(e=>e.id===i)?[i]:e.filter(e=>e.aliases.includes(i)).map(e=>e.id);t.length===0&&r.push(i);for(let e of t)n.add(e)}return r.length?{unknown:r}:{ids:[...n].sort()}}const SR=`${he}/${mR}`,CR=e=>d.default.dirname(Je(e).root),wR=e=>d.default.join(CR(e),`config.json`);function TR(e,t){if(!$e.test(t))throw new j(et);if(!u.default.existsSync(d.default.join(Je(e).root,t)))throw new j(`No such artifact: ${t}`)}function ER(e){let t=bR(CR(e));if(t.state===`missing`)throw new j(`This project has no vocabulary. Create ${SR} first.`);if(t.state===`invalid`)throw new j(`${SR} is invalid: ${t.reason}`);return t.modules}function DR(e,t,n,r=()=>{}){TR(e,t);let i=ER(e),a=xR(i,n.split(`,`).map(e=>e.trim()).filter(Boolean));if(`unknown`in a)throw new j(`Unknown module: ${a.unknown.join(`, `)}. Choose from: ${i.map(({id:e})=>e).join(`, `)}.`);if(a.ids.length>3)throw new j(`An artifact has at most 3 modules; pick the ones it is mainly about.`);let o=wR(e);return r(),hD(o),gD(o,t,{modules:a.ids}),{artifact:t,modules:a.ids}}function OR(e){let t=/* @__PURE__ */ new Map,n=0;for(let{modules:r}of Object.values(fD(wR(e)).config.artifacts))if(r?.length){n+=1;for(let e of r)t.set(e,(t.get(e)??0)+1)}return{counts:t,tagged:n}}const kR=e=>e.replace(/\/?\*+$/,``).replace(/\/$/,``),AR=(e,t)=>e===t||e.startsWith(`${t}/`);function jR(e){let t=[];for(let[n,r]of e.entries())for(let i of e.slice(n+1)){let e=r.paths.flatMap(e=>i.paths.map(t=>[e,t])).find(([e,t])=>AR(kR(e),kR(t))||AR(kR(t),kR(e)));e&&t.push(`paths overlap: ${r.id} and ${i.id} (${e[0]} and ${e[1]})`)}return t}function MR(e,t,n){let r=e.filter(({id:e})=>!t.get(e)).map(({id:e})=>e);return[...e.length>20?[`${e.length} modules, more than 20: merge the ones that are always chosen together`]:[],...n>=20&&r.length?[`no artifacts: ${r.join(`, `)} — merge them into a neighbour or remove them`]:[],...jR(e)]}function NR(e,{cloud:t,artifact:n}={}){n&&TR(e,n);let r=n?{current:fD(wR(e)).config.artifacts[n]?.modules??null}:{},i=bR(CR(e)),a=t?`cloud`:`local`;if(i.state!==`ok`)return{file:SR,state:i.state,...i.state===`invalid`?{reason:i.reason}:{},modules:[],counts:a,hints:[],...n?{artifact:n}:{},...r};let o=OR(e),s=t?new Map(t.modules.map(({id:e,count:t})=>[e,t])):o.counts,c=t?t.tagged:o.tagged;return{file:SR,state:`ok`,modules:i.modules.map(e=>({...e,count:s.get(e.id)??0})),counts:a,hints:MR(i.modules,s,c),...n?{artifact:n}:{},...r}}async function PR(e,t){try{let{status:n,json:r}=await rO(e).call(`GET`,`/api/cloud/artifacts`,void 0,t);if(n!==200)return;let i=fR(Je(e).project);return r.vocabularies?.[i]}catch{return}}function FR({data:e}){let t=e.state===`missing`?`no vocabulary: create ${e.file}`:e.state===`invalid`?`invalid: ${e.reason}`:``;return{heading:`Modules`,status:e.state===`ok`?``:e.state,subject:e.artifact,summary:t||`${e.modules.length} · ${e.file} · counts from ${e.counts===`cloud`?`Cloud`:`this checkout only`}`,facts:e.current===void 0?[]:[X(`Current`,{key:`current`,value:e.current===null?`never tagged`:e.current.length?e.current.join(`, `):`cleared`})],sections:[...e.writing?[{kind:`content`,key:`writing`,title:`Writing`,text:e.writing}]:[],{kind:`records`,key:`modules`,rows:e.modules.map(e=>({...e,paths:e.paths.join(` `)})),columns:[{key:`id`,positional:!0,required:!0},{key:`count`,positional:!0,required:!0},{key:`name`,positional:!0},{key:`description`,positional:!0},{key:`paths`,positional:!0}]},{kind:`diagnostics`,key:`hints`,items:e.hints.map(e=>({code:`W_MODULES_MAINTENANCE`,message:e,severity:`warning`}))}]}}function IR({data:e}){return{heading:`Modules`,status:`SET`,subject:e.artifact,summary:e.modules.length?e.modules.join(`, `):`cleared`,facts:[],sections:[]}}const LR={name:`modules`,summary:`List the project's business modules, or set the modules an artifact serves`,usage:[`[--artifact <type>/<id>] [options]`,`--artifact <type>/<id> --set <id>[,<id>...]`],details:pR.trim(),options:{artifact:{type:`string`,value:`<type>/<id>`,help:`The artifact to show or tag`},set:{type:`string`,value:`<id>[,<id>...]`,help:`Replace the artifact’s modules with these ids`}},semantic:e=>{let t=e.values.artifact,n=e.values.set;if(n!==void 0){if(!t)throw new j(`--set needs --artifact <type>/<id>`);return Z({id:`modules.set`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.modules.join(`,`)},run:(r,i)=>{let a,o=DR(e.projectDir,t,n,()=>{a=i.effects.begin(`modules.set`,t)});return a!==void 0&&i.effects.confirm(a),J(o)},present:IR},e)}return Z({id:`modules`,mode:`finite`,output:{formats:[`brief`,`table`,`json`,`jsonl`],fields:[`id`,`count`,`name`,`description`,`paths`,`aliases`],collection:`modules`,requiredFields:[`id`,`count`]},async run(n,r){let i=await PR(e.projectDir,r.signal),a=NR(e.projectDir,{cloud:i,artifact:t});return J({...a,project:e.projectDir,write:d.default.join(e.projectDir,a.file),...a.state===`ok`?{}:{writing:pR.trim()}})},present:FR},e)}},RR=864e5,zR=e=>{try{return JSON.parse(u.default.readFileSync(e,`utf8`))}catch{return null}};function BR(e){let t=zR(e);return t&&typeof t==`object`?{failures:0,...t}:{failures:0}}function VR(e){let t=zR(d.default.join(e,`plugins`,`installed_plugins.json`))?.plugins,n=/* @__PURE__ */ new Set;if(!t||typeof t!=`object`)return n;for(let[e,r]of Object.entries(t))Array.isArray(r)&&r.some(e=>e?.scope===`user`)&&n.add(e);return n}function HR(e){let t=zR(d.default.join(e,`settings.json`))?.enabledPlugins;return t&&typeof t==`object`?t:{}}const UR=e=>{let t=VR(e);return Object.keys(JN).filter(e=>t.has(JN[e])).map(e=>({legacy:JN[e],target:qN[e]}))},WR=(e,t)=>e?t.getTime()-Date.parse(e):1/0;function GR({configDir:e,stateFile:t,now:n}){if(!UR(e).length)return!1;let r=BR(t);return!r.notice&&WR(r.attemptedAt,n)>=RR}function KR(e){let t=`${e}.lock`;try{u.default.mkdirSync(d.default.dirname(e),{recursive:!0}),u.default.existsSync(t)&&Date.now()-u.default.statSync(t).mtimeMs>6e5&&u.default.rmSync(t,{force:!0}),u.default.writeFileSync(t,String(process.pid),{flag:`wx`})}catch{return null}return()=>u.default.rmSync(t,{force:!0})}function qR(e){if(!UR(e.configDir).length)return{status:`idle`};let t=KR(e.stateFile);if(!t)return{status:`waiting`};try{return JR(e)}finally{t()}}function JR({configDir:e,stateFile:t,now:n,run:r}){let i=UR(e),a=BR(t);if(a.notice||WR(a.attemptedAt,n)<RR)return{status:`waiting`};a.attemptedAt=n.toISOString();try{zN(t,a)}catch(e){return{status:`failed`,error:e.message}}let o=e=>(a.failures+=1,a.lastError=e,a.failures>=3&&(a.notice=!0),zN(t,a),{status:`failed`,error:e}),s=e=>{let t=r(e);if(t.status!==0)throw Error(`claude ${e.join(` `)}: ${(t.stderr||t.stdout).trim()}`)},c=HR(e),l=VR(e),u=[],d=[];try{if(i.some(({target:e})=>!l.has(e))){s([`plugin`,`marketplace`,`update`,GN]);for(let{legacy:e,target:t}of i)l.has(t)||(u.push(t),s([`plugin`,`install`,t,`--scope`,`user`]),c[e]===!1&&s([`plugin`,`disable`,t,`--scope`,`user`]))}for(let{legacy:e,target:t}of i)c[e]!==!1&&(l.has(t)&&c[t]===!1&&(u.push(t),s([`plugin`,`enable`,t,`--scope`,`user`])),s([`plugin`,`disable`,e,`--scope`,`user`]),d.push(e))}catch(t){for(let e of d)r([`plugin`,`enable`,e,`--scope`,`user`]);let n=VR(e);for(let e of u)n.has(e)&&r([`plugin`,`disable`,e,`--scope`,`user`]);return o(t.message)}if(!a.disabledAt)return a.disabledAt=n.toISOString(),a.failures=0,zN(t,a),{status:`moved`};if(WR(a.disabledAt,n)<RR)return zN(t,a),{status:`waiting`};try{for(let{legacy:e}of i)s([`plugin`,`uninstall`,e,`--scope`,`user`])}catch(e){return o(e.message)}return a.failures=0,zN(t,a),{status:`done`}}function YR(e,t){let n=AP(e),r=n.harnesses[`claude-code`],i=Object.keys(JN).find(e=>JN[e]===r?.registration);if(!r||!i)return;let a=t(qN[i]);n.harnesses[`claude-code`]={...r,registration:qN[i],version:a.version,path:a.path,nativeSource:a.source},jP(e,n)}const XR=/* @__PURE__ */ new Set([`dev`,`install`,`plugin-migrate`,`uninstall`,`update`]),ZR=(e=m.default.homedir())=>d.default.join(we(e),`plugin-migration.json`),QR=(e,t=m.default.homedir())=>e.CLAUDE_CONFIG_DIR||d.default.join(t,`.claude`),$R=e=>{try{return JSON.parse(u.default.readFileSync(e,`utf8`))}catch{return{}}};function ez(e){try{return Object.values(AP(LN(e)).harnesses).filter(e=>!!e&&e.harness!==`claude-code`&&CP(e))}catch{return[]}}function tz(e,t,n=m.default.homedir()){if(!ez(e).length)return!1;let r=$R(ZR(n)).managedAttemptedAt;return typeof r!=`string`||t.getTime()-Date.parse(r)>=864e5}function nz(e,t=m.default.homedir()){let n=ZR(t);zN(n,{failures:0,...$R(n),managedAttemptedAt:e.toISOString()})}function rz(e,t,n=m.default.homedir()){try{return GR({configDir:QR(e,n),stateFile:ZR(n),now:t})||tz(e,t,n)}catch{return!1}}function iz(e){try{let t=d.default.dirname(ZR(e));return u.default.mkdirSync(t,{recursive:!0}),u.default.accessSync(t,u.default.constants.W_OK),!0}catch{return!1}}function az(e,t,n,r=m.default.homedir()){return XR.has(e[0]??``)||t.RYUGI_NO_PLUGIN_MIGRATE||t.CI?!1:rz(t,n,r)&&iz(r)}function oz(e,t=process.env,{execPath:n=process.execPath,home:r=m.default.homedir()}={}){let i=process.argv[1];if(i)try{if(!az(e,t,/* @__PURE__ */ new Date,r))return;(0,p.spawn)(n,[i,`plugin-migrate`,`--format`,`quiet`],{detached:!0,stdio:`ignore`,env:{...t,RYUGI_NO_PLUGIN_MIGRATE:`1`}}).on(`error`,()=>{}).unref()}catch{return}}const sz=e=>{let{command:t,args:n,shell:r}=JL(e),i=(0,p.spawnSync)(t,n,{encoding:`utf8`,shell:r,stdio:[`ignore`,`pipe`,`pipe`]});return{status:i.error?1:i.status,stdout:i.stdout??``,stderr:i.stderr||i.error?.message||``}};function cz({data:e}){return{heading:`Plugin migration`,status:e.claude.status,summary:e.claude.error??``,facts:[X(`Claude Code`,Y(e.claude,`status`)),...e.managed.map(e=>X(e.harness,Y(e,e.error?`error`:`status`)))],sections:[]}}const lz={name:`plugin-migrate`,summary:`Move plugin installs still named ryugi to adeck`,usage:[``],details:`Claude Code: installs adeck@ryugi-dev (or adeck-lite) at user scope and disables the ryugi entry, then uninstalls it a day later. Managed Codex, Copilot, Cursor, Gemini and Antigravity installs are reinstalled under their adeck names. Each runs at most once a day; every CLI command starts this in the background when it is due.`,positionals:0,options:{},semantic:e=>Z({id:`plugin-migrate`,mode:`finite`,output:{formats:[`brief`,`json`,`quiet`],scalar:e=>e.claude.status},async run(t,n){let r=m.default.homedir(),i=/* @__PURE__ */ new Date,a=qR({configDir:QR(process.env,r),stateFile:ZR(r),now:i,run:sz});if(a.status===`moved`||a.status===`done`)try{YR(LN(),e=>sP(e,_P))}catch{}let o=[];if(tz(process.env,i,r)){nz(i,r);for(let t of ez(process.env)){let r=(await rR({projectDir:e.projectDir,positionals:[],values:{mode:t.mode,harness:t.harness,"no-cli":!0,"install-dir":LN()}},n,!1,!0)).data.targets.find(e=>e.harness===t.harness);o.push({harness:t.harness,status:r?.status||`failed`,...r?.error?{error:r.error}:{}})}}let s=a.status===`failed`||o.some(e=>e.status!==`installed`);return J({claude:a,managed:o},s?{kind:`partial`}:void 0)},present:cz},e)};var uz=/* @__PURE__ */ (e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(uz||{});const dz=[0,1],fz=[1,0],pz=[2,3],mz=[3,2],hz={L:dz,M:fz,Q:pz,H:mz},gz=/^\d*$/,_z=/^[A-Z0-9 $%*+./:-]*$/,vz=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,yz=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],bz=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];var xz=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<1||e>40)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,uz.Timing),this.setFunctionModule(e,6,e%2==0,uz.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,Cz(r,e));this.setFunctionModule(8,7,Cz(r,6)),this.setFunctionModule(8,8,Cz(r,7)),this.setFunctionModule(7,8,Cz(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,Cz(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,Cz(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,Cz(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=Cz(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,uz.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,uz.Alignment)}setFunctionModule(e,t,n,r=uz.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==Rz(t,n))throw RangeError(`Invalid argument`);let r=bz[n[0]][t],i=yz[n[0]][t],a=Math.floor(Lz(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=zz(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=Bz(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(Lz(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=Cz(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=3:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*40),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*40}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=3:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*40),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*40}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=3)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*10,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function Sz(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function Cz(e,t){return!!(e>>>t&1)}var wz=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}};const Tz=[1,10,12,14],Ez=[2,9,11,13],Dz=[4,8,16,16];function Oz(e,t){return e[Math.floor((t+7)/17)+1]}function kz(e){let t=[];for(let n of e)Sz(n,8,t);return new wz(Dz,e.length,t)}function Az(e){if(!Nz(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);Sz(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new wz(Tz,e.length,t)}function jz(e){if(!Pz(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=vz.indexOf(e.charAt(n))*45;r+=vz.indexOf(e.charAt(n+1)),Sz(r,11,t)}return n<e.length&&Sz(vz.indexOf(e.charAt(n)),6,t),new wz(Ez,e.length,t)}function Mz(e){return e===``?[]:Nz(e)?[Az(e)]:Pz(e)?[jz(e)]:[kz(Iz(e))]}function Nz(e){return gz.test(e)}function Pz(e){return _z.test(e)}function Fz(e,t){let n=0;for(let r of e){let e=Oz(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function Iz(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function Lz(e){if(e<1||e>40)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function Rz(e,t){return Math.floor(Lz(e)/8)-yz[t[0]][e]*bz[t[0]][e]}function zz(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=Vz(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=Vz(n,2)}return t}function Bz(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=Vz(t,e))}return n}function Vz(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function Hz(e,t,n=1,r=40,i=-1,a=!0){if(!(1<=n&&n<=r&&r<=40)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=Rz(o,t)*8,i=Fz(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[fz,pz,mz])a&&s<=Rz(o,e)*8&&(t=e);let c=[];for(let t of e){Sz(t.mode[0],4,c),Sz(t.numChars,Oz(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=Rz(o,t)*8;Sz(0,Math.min(4,l-c.length),c),Sz(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)Sz(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new xz(o,t,u,i)}function Uz(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?Mz(e):Array.isArray(e)?[kz(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=Hz(c,hz[n],i,a,o,r),u=Wz({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function Wz(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=uz.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function Gz(e,t,n,r=!1){return t<0||n<0||t>=e.length||n>=e.length?r:e[n][t]}function Kz(e,t={}){let n={WHITE_ALL:`█`,WHITE_BLACK:`▀`,BLACK_WHITE:`▄`,BLACK_ALL:` `},r=Uz(e,t),i=(e,t)=>Gz(r.data,e,t,!0),a=[],o=``;for(let e=0;e<r.size;e+=2){for(let t=0;t<r.size;t++)i(t,e)===!1&&i(t,e+1)===!1?o+=n.WHITE_ALL:i(t,e)===!1&&i(t,e+1)===!0?o+=n.WHITE_BLACK:i(t,e)===!0&&i(t,e+1)===!1?o+=n.BLACK_WHITE:o+=n.BLACK_ALL;a.push(o),o=``}return a.join(`
|
|
1398
|
+
`)}const qz=e=>typeof e==`object`&&!!e&&typeof e.code==`string`&&typeof e.url==`string`;function Jz(e){if(e.status>=200&&e.status<300)return e.json;let t=e.json;throw new K({code:e.status===401?`E_LOGIN_REQUIRED`:typeof t.code==`string`?`E_${t.code.toUpperCase()}`:`E_HTTP_${e.status}`,message:typeof t.error==`string`?t.error:`Cloud request failed: HTTP ${e.status}`,httpStatus:e.status,details:{...t.loginUrl?{loginUrl:t.loginUrl}:{},...qz(t.login)?{loginUrl:t.login.url,signInCode:t.login.code}:{},...t.upgradeUrl?{upgradeUrl:t.upgradeUrl}:{},...t.limit?{limit:t.limit}:{},...t.plan?{plan:t.plan}:{},...t.reasons?{reasons:t.reasons}:{}}},e.status===401||e.status===402&&(t.code===`plan_limit`||t.code===`plan_required`)?`action_required`:`failed`)}const Yz=[`brief`,`json`,`jsonl`,`quiet`],Xz=/^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$/i;function Zz(e){let{values:t}=e,n=[`unpublish`,`revoke-key`,`list`,`delete`,`login`,`logout`,`move-to`].filter(e=>t[e]),r=!!(t.key||t[`new-key`]);if(n.length>1||t.public&&t.private||t.public&&r||t.profile&&t[`no-profile`]||r&&t[`revoke-key`])throw new K({code:`E_OPTION_CONFLICT`,message:`Choose one publish action and one visibility.`});let i=n[0]??`publish`;if(i!==`publish`&&r||t.key&&t[`new-key`]||t.artifact!==void 0&&![`publish`,`unpublish`,`revoke-key`,`list`].includes(i)||t.from!==void 0&&i!==`login`||t[`with-token`]&&i!==`login`)throw new K({code:`E_OPTION_UNSUPPORTED`,message:`Key creation applies only to publishing; artifact targets apply to publishing, key revocation or targeted --list; --from and --with-token apply only to --login. Choose either --key or --new-key.`});if(i!==`list`&&[`visibility`,`type`,`project`,`module`,`limit`,`cursor`].some(e=>t[e]!==void 0))throw new K({code:`E_OPTION_UNSUPPORTED`,message:`List filters and paging apply only to --list.`});let a=t.artifact;if(([`publish`,`unpublish`,`revoke-key`].includes(i)||i===`list`&&a!==void 0)&&(!a||!$e.test(a)))throw new K({code:`E_ARGUMENT_INVALID`,message:`--artifact must be <type>/<id>.`});if(i===`list`&&a&&[`visibility`,`type`,`project`,`module`,`limit`,`cursor`,`fields`].some(e=>t[e]!==void 0))throw new K({code:`E_OPTION_UNSUPPORTED`,message:`Targeted --list --artifact reads publication and key state; collection filters and paging apply only without --artifact.`});if(i===`delete`&&!/^[\w-]{1,64}$/.test(String(t.delete??``)))throw new K({code:`E_ARGUMENT_INVALID`,message:`--delete requires a Cloud artifact ID.`});if(i!==`publish`&&(t.public||t.private||t[`no-refs`]||t.profile||t[`no-profile`]))throw new K({code:`E_OPTION_UNSUPPORTED`,message:`Visibility, profile listing and --no-refs apply only to publishing.`});if(t.expires!==void 0&&!r)throw new K({code:`E_OPTION_UNSUPPORTED`,message:`--expires applies only with --key or --new-key.`});if(i===`move-to`&&(!Xz.test(String(t[`move-to`]))||String(t[`move-to`]).toLowerCase()===`personal`))throw new K({code:`E_ARGUMENT_INVALID`,message:`--move-to requires the slug of a team you belong to.`});let o=t.space;if(o!==void 0&&i!==`publish`)throw new K({code:`E_OPTION_UNSUPPORTED`,message:`--space applies only to publishing.`});if(o!==void 0&&!Xz.test(o))throw new K({code:`E_ARGUMENT_INVALID`,message:`--space must be a team slug or "personal".`});if(t.expires!==void 0&&!iD(t.expires))throw new K({code:`E_ARGUMENT_INVALID`,message:`--expires must be 1d, 7d, 30d or never.`});let s=r?{...t.expires?{expires:t.expires}:{},...t[`new-key`]?{regenerate:!0}:{}}:void 0;return{action:i,artifact:a,key:s,space:o?.toLowerCase(),onProfile:t.profile?!0:!t[`no-profile`]&&void 0,visibility:t.public?`public`:t.private||s?`private`:void 0}}function Qz(e,t,n){return Z({id:`publish.${t}`,mode:`finite`,output:{formats:t===`login`?[`brief`,`json`,`jsonl`]:Yz,scalar:e=>e.id},async run(r,i){let a=t===`delete`?String(e.values.delete):n,o=[`login`,`logout`,`move-to`].includes(t)?`POST`:`DELETE`,s=t===`delete`?`/api/cloud/artifacts/${a}`:t===`unpublish`?`/api/cloud/publish/${a}`:t===`revoke-key`?`/api/cloud/share-key/${a}`:t===`move-to`?`/api/cloud/transfer`:`/api/cloud/${t}`,c=t===`login`?void 0:i.effects.begin(t,a??`cloud-account`),l=typeof e.values.from==`string`?e.values.from:`cli`,u;if(t===`login`){if(e.values[`with-token`]){let e=[];for await(let t of process.stdin)e.push(Buffer.from(t));let t=Buffer.concat(e).toString(`utf8`).trim();if(!t)throw new K({code:`E_ARGUMENT_INVALID`,message:`Pass an access token on stdin when using --login --with-token.`});u={token:t}}else u={source:l}}let d=await rO(e.projectDir).call(o,s,t===`move-to`?{space:String(e.values[`move-to`]).toLowerCase()}:u,i.signal);c!==void 0&&d.status>=400&&d.status<500&&i.effects.set(c,`failed`);let f=Jz(d);c!==void 0&&i.effects.confirm(c);let p=t===`login`&&qz(f.pending)?f.pending:null,m=t===`login`&&!f.signedIn?{kind:`pending`,reasons:[`sign_in_code_unconfirmed`]}:t===`logout`&&f.remoteRevoked!==!0?{kind:`partial`}:{kind:`succeeded`};return J({id:t===`logout`?`signed-out`:f.id??a??`cloud-account`,artifact:a,status:t===`login`?f.signedIn?`signed_in`:`pending`:t===`logout`?`signed_out`:t===`move-to`?`moved`:t===`delete`?`deleted`:t===`revoke-key`?`key_removed`:`unpublished`,...f.url?{url:f.url}:{},...p?{code:p.code,url:p.url,expiresAt:p.expiresAt,autoPublish:f.autoPublish===!0?`on`:`off until you turn it on: ${process.env.RYUGI_ARTIFACTS_COMMAND||`npx artideck`} config --auto-publish on`}:{},...t===`logout`?{localCredentials:`cleared`,remoteSession:f.remoteRevoked===!0?`revoked`:`unknown`}:{}},m,{effects:i.effects.snapshot(),actions:p?[{kind:`url`,url:p.url,label:`Confirm the code`}]:f.url?[{kind:`url`,url:f.url,label:`Open`}]:[]})},present({data:e}){return{heading:t===`login`?`Login`:t===`logout`?`Logout`:`Cloud artifact`,status:e.status,subject:e.id,facts:[...e.artifact?[X(`Artifact`,Y(e,`artifact`))]:[],...e.code?[X(`Code`,Y(e,`code`))]:[],...e.url?[X(`URL`,Y(e,`url`))]:[],...e.expiresAt?[X(`Expires`,Y(e,`expiresAt`))]:[],...e.autoPublish?[X(`Auto-publish`,Y(e,`autoPublish`))]:[],...e.remoteSession?[X(`Remote session`,Y(e,`remoteSession`))]:[]],sections:e.url&&e.code?[{kind:`content`,key:`qr`,text:Kz(e.url)}]:[]}}},e)}async function $z(e,t,n,r,i,a){let o=rO(e.projectDir),s=await(async(e,n)=>{let r=t.effects.begin(`publish`,e),a={...n?{visibility:n}:{},...i===void 0?{}:{onProfile:i}},s=await o.call(`POST`,`/api/cloud/publish/${e}`,Object.keys(a).length?a:void 0,t.signal);s.status>=400&&s.status<500&&t.effects.set(r,`failed`,s.json);let c=Jz(s);return t.effects.confirm(r,{url:c.url,visibility:c.visibility,version:c.version}),c})(n,r),c;if(a||s.keyed){let e=a?t.effects.begin(`share-key`,n):void 0,r=await o.call(a?`PUT`:`GET`,`/api/cloud/share-key/${n}`,a,t.signal);e!==void 0&&r.status>=400&&r.status<500&&t.effects.set(e,`failed`);let i=Jz(r);if(i.shareKey===void 0||a&&!i.shareKey)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server did not confirm the share-key state.`});c=i.shareKey??void 0,e!==void 0&&t.effects.confirm(e,{expiresAt:c?.expiresAt})}let l=Jz(await o.call(`GET`,`/api/cloud/refs/${n}?visibility=${s.visibility}&referrers=0`,void 0,t.signal)),u=e.values[`no-refs`]?[]:l.items.filter(e=>e.checked&&e.state!==`private`),d=/* @__PURE__ */ new Map;if(u.length){let e=new Map(u.map(e=>[e.artifact,t.effects.begin(`publish`,e.artifact)])),r=Jz(await o.call(`POST`,`/api/cloud/publish-refs/${n}`,{visibility:s.visibility,refs:u.map(e=>e.artifact),makePublic:[]},t.signal));for(let n of r.results){d.set(n.artifact,n);let r=e.get(n.artifact);r!==void 0&&(n.status===`published`?t.effects.confirm(r,{}):n.status===`failed`?t.effects.set(r,`failed`,n.error):n.status===`not_attempted`&&t.effects.set(r,`not_attempted`))}}let f=e=>{try{Jz({status:e.error?.httpStatus??500,json:e.error??{}})}catch(e){return CD(e)}},p={publish:`published`,update:`updated`,"make-public":`made_public`},m=l.items.map(e=>{let t={artifact:e.artifact,state:e.state,via:e.via},n=d.get(e.artifact);if(n){let e=n.status===`published`?void 0:f(n);return{...t,status:n.status===`published`?p[n.action]:n.status,...e?{error:e}:{}}}return e.reason===`upstream`?{...t,status:`unreachable`}:e.state===`unpublished`||e.state===`stale`?{...t,status:`skipped`}:{...t,status:e.state}}),h=m.some(e=>[`failed`,`unknown`,`not_attempted`].includes(e.status)),g={status:h?`partial`:`published`,artifact:n,id:s.id??new URL(s.url).pathname.split(`/`).filter(Boolean).at(-1),url:c?.url??s.url,visibility:s.visibility,...s.version===void 0?{}:{version:s.version},visibilitySource:r?`requested`:`preserved`,onProfile:s.onProfile===!0,onProfileSource:i===void 0?`preserved`:`requested`,...c?{shareKey:{key:c.key,expiresAt:c.expiresAt}}:{},references:m},_=m.filter(e=>e.status===`private`),v=m.filter(e=>e.status===`skipped`);return J(g,h?{kind:`partial`}:{kind:`succeeded`},{effects:t.effects.snapshot(),warnings:[...(Array.isArray(s.notes)?s.notes:[]).filter(e=>typeof e==`string`).map(e=>({code:`W_CUT_NOT_PUBLISHED`,message:e})),...i&&s.visibility!==`public`?[{code:`W_PROFILE_NEEDS_PUBLIC`,message:`It will show on your profile once it is public.`}]:[],..._.length?[{code:`W_REFERENCES_PRIVATE`,message:`${_.length} referenced artifacts are private; visitors see a locked label.`}]:[],...v.length?[{code:`W_REFERENCES_UNPUBLISHED`,message:`${v.length} referenced artifacts were left as they are (--no-refs).`}]:[]],actions:[...m.flatMap(e=>e.error?uO(e.error,e.artifact):[]),..._.map(t=>q([`publish`,`--artifact`,t.artifact,`--project-dir`,e.projectDir,`--public`],`Next`)),...v.length&&!h?[q([`publish`,`--artifact`,n,`--project-dir`,e.projectDir],`Next`)]:[]]})}function eB({data:e}){return{heading:`Publish`,status:e.status,subject:e.artifact,facts:[X(`ID`,Y(e,`id`),!0),X(`URL`,Y(e,`url`),!0),X(`Visibility`,{key:`visibility`,value:`${e.visibility} (${e.visibilitySource})`},!0),...e.visibility===`public`?[X(`Profile`,{key:`onProfile`,value:e.onProfile?`listed`:`not listed`},!0)]:[],...e.shareKey?[X(`Key`,{key:`shareKey.key`,value:e.shareKey.key},!0),X(`Expires`,{key:`shareKey.expiresAt`,value:e.shareKey.expiresAt??`never`},!0)]:[],...e.version===void 0?[]:[X(`Version`,Y(e,`version`))]],sections:e.references.length?[{kind:`records`,key:`references`,title:`Referenced artifacts`,rows:e.references.map(e=>({artifact:e.artifact,status:e.status,via:e.via?`via ${e.via}`:``,error:e.error?`${e.error.code}: ${e.error.message}`:``,recovery:e.status===`unknown`?`inspect the remote artifact before retrying`:``})),columns:[{key:`artifact`,positional:!0,required:!0},{key:`status`,positional:!0,required:!0},{key:`via`,positional:!0},{key:`error`,positional:!0},{key:`recovery`,positional:!0}]}]:[]}}function tB({data:e,coverage:t}){return{heading:`Cloud artifacts`,status:``,summary:`${t.page?.total??e.artifacts.length} on account`,facts:[],sections:[{kind:`records`,key:`artifacts`,rows:e.artifacts.map(e=>({...e,version:e.version===void 0?``:`v${e.version}`})),columns:[{key:`id`,positional:!0,required:!0},{key:`type`,positional:!0},{key:`visibility`,positional:!0,required:!0},{key:`version`,positional:!0},{key:`updatedAt`,positional:!0},{key:`title`,positional:!0}]}]}}function nB(e){let{action:t,artifact:n,visibility:r,onProfile:i,key:a,space:o}=Zz(e);if(t===`list`&&n)return Z({id:`publish.list`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`]},async run(t,r){let i=rO(e.projectDir),a=nD(Jz(await i.call(`GET`,`/api/cloud/publication/${n}`,void 0,r.signal)));if(!a)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported publication state.`});let{shareKey:o}=Jz(await i.call(`GET`,`/api/cloud/share-key/${n}`,void 0,r.signal));if(o===void 0)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server did not return the current share-key state.`});return J({artifact:n,publication:a,shareKey:o})},present({data:e}){return{heading:`Cloud artifact`,status:e.publication.phase,subject:n,facts:[X(`Published at`,{key:`publication.publishedAt`,value:e.publication.publishedAt}),X(`Key`,{key:`shareKey.key`,value:e.shareKey?.key??`none`},!0),...e.shareKey?[X(`URL`,{key:`shareKey.url`,value:e.shareKey.url},!0),X(`Expires`,{key:`shareKey.expiresAt`,value:e.shareKey.expiresAt??`never`},!0)]:[]],sections:[]}}},e);if(t===`publish`)return Z({id:`publish.publish`,mode:`finite`,output:{formats:Yz,scalar:e=>e.id},run:(t,s)=>(o&&vD(d.default.join(d.default.dirname(Je(e.projectDir).root),`config.json`),o),$z(e,s,n,r,i,a)),present:eB},e);if(t===`list`){let t=new URLSearchParams({semantic:`1`});for(let n of[`visibility`,`type`,`project`,`limit`,`cursor`,`fields`]){let r=e.values[n];typeof r==`string`&&t.set(n,r)}if(typeof e.values.module==`string`){t.has(`project`)||t.set(`project`,fR(Je(e.projectDir).project));let n=e.values.module.split(`,`).map(e=>e.trim());for(let e of new Set(n))t.append(`module`,e)}if(t.has(`limit`)&&(!/^\d+$/.test(t.get(`limit`))||+t.get(`limit`)<1||+t.get(`limit`)>100))throw new K({code:`E_ARGUMENT_INVALID`,message:`--limit must be between 1 and 100.`});if(t.has(`visibility`)&&![`public`,`private`].includes(t.get(`visibility`))||t.has(`type`)&&!Jv(t.get(`type`)))throw new K({code:`E_ARGUMENT_INVALID`,message:`Invalid Cloud list filter.`});return Z({id:`publish.list`,mode:`finite`,output:{detail:!0,formats:[`brief`,`table`,`json`,`jsonl`,`raw`],fields:[`id`,`type`,`title`,`project`,`modules`,`visibility`,`url`,`updatedAt`,`version`],collection:`artifacts`,requiredFields:[`id`,`type`,`visibility`,`version`]},async run(n,r){let i=await rO(e.projectDir).call(`GET`,`/api/cloud/artifacts?${t}`,void 0,r.signal);r.payloads.raw=i.raw;let a=Jz(i);if(a.schema!==`ryugi.cloud-list/v1`)throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported Cloud list response.`});return J({artifacts:a.artifacts},void 0,{coverage:{page:a.page},actions:a.page?.nextCursor?[q([`publish`,`--list`,`--project-dir`,e.projectDir,...[...new Set(t.keys())].filter(e=>![`semantic`,`cursor`].includes(e)).flatMap(e=>[`--${e}`,t.getAll(e).join(`,`)]),`--cursor`,a.page.nextCursor],`More`)]:[]})},present:tB},e)}return Qz(e,t,n)}const rB={semantic:nB,name:`publish`,summary:`Publish an artifact to the Artideck Cloud (needs a running server)`,usage:[`--artifact <type>/<id> [--public | --private | --key] [--profile | --no-profile] [options]`,`--artifact <type>/<id> --unpublish | --revoke-key [options]`,`--list | --delete <cloud-id> | --login | --logout [options]`,`--move-to <team-slug> (move this project into a team)`,`--list --artifact <type>/<id> (read publication and current key state without changing either)`],options:{visibility:{type:`string`,value:`<public|private>`,help:`Filter published list visibility`},type:{type:`string`,value:`<${fe.join(`|`)}>`,help:`Filter published list type`},project:{type:`string`,value:`<project>`,help:`Filter published list project`},module:{type:`string`,value:`<id>[,<id>...]`,help:`Filter published list by module ("" for untagged); the project defaults to this one`},limit:{type:`string`,value:`<1-100>`,help:`Maximum list rows`},cursor:{type:`string`,value:`<token>`,help:`Continue a stable list snapshot`},artifact:{type:`string`,value:`<type>/<id>`,help:`The artifact to publish, unpublish, revoke a key, or inspect with --list`},public:{type:`boolean`,help:`Anyone with the link can open it`},private:{type:`boolean`,help:`Only you can open it`},key:{type:`boolean`,help:`Only people with the key can open it; prints a link that carries the key`},expires:{type:`string`,value:`<1d|7d|30d|never>`,help:`With --key or --new-key: when the key stops working (7d for a new key)`},"new-key":{type:`boolean`,help:`Replace the key; links with the old key stop opening`},"revoke-key":{type:`boolean`,help:`Remove the key; only you can open it`},profile:{type:`boolean`,help:`Show it on your public profile once it is public`},"no-profile":{type:`boolean`,help:`Take it off your public profile`},unpublish:{type:`boolean`,help:`Remove the artifact's cloud copy`},list:{type:`boolean`,help:`List your cloud artifacts; with --artifact, read its publication and current key state`},delete:{type:`string`,value:`<cloud-id>`,help:`Delete a cloud artifact by its id from --list`},space:{type:`string`,value:`<team-slug|personal>`,help:`Where this project's new artifacts publish; already published ones stay where they are`},"move-to":{type:`string`,value:`<team-slug>`,help:`Move every artifact of this project from your personal space into a team; links stay the same`},"no-refs":{type:`boolean`,help:`Publish only this artifact; leave the artifacts it references as they are`},login:{type:`boolean`,help:`Sign in to the Artideck Cloud`},"with-token":{type:`boolean`,help:`With --login: read an access token from stdin instead of opening a browser`},from:{type:`string`,value:`<tag>`,help:`With --login: where this sign-in started, recorded by Artideck Cloud`},logout:{type:`boolean`,help:`Sign out of the Artideck Cloud`}}},iB=/* @__PURE__ */ new Set([`created`,`updated`,`bound`]),aB=/* @__PURE__ */ new Set([`conflict`,`name_clash`]);function oB({data:e}){let t=/* @__PURE__ */ new Map;for(let n of e.results)t.set(n.outcome,(t.get(n.outcome)??0)+1);return{heading:`Pull`,status:``,subject:e.project,summary:e.results.length?[...t].map(([e,t])=>`${t} ${e}`).join(` · `):`no Cloud artifacts in this project`,facts:[X(`Project`,Y(e,`project`))],sections:[{kind:`records`,key:`results`,rows:e.results.map(e=>({...e,note:e.message??e.notes?.join(`; `)??``})),columns:[{key:`key`,positional:!0,required:!0},{key:`outcome`,positional:!0,required:!0},{key:`url`,positional:!0},{key:`note`,positional:!0}]}]}}function sB(e){let t=e.values.artifact,n=e.positionals[0];if(t&&n)throw new K({code:`E_OPTION_CONFLICT`,message:`Give --artifact or a Cloud link, not both.`});let r=t??n,i=e.values.as;if(i&&!r)throw new K({code:`E_ARGUMENT_INVALID`,message:`--as needs one target: --artifact <type>/<id> or a Cloud link.`});let a=e.values[`dry-run`]===!0,o=e.values.force===!0,s=e.values.project;return Z({id:`pull`,mode:`finite`,output:{formats:[`brief`,`table`,`json`,`jsonl`],collection:`results`,fields:[`key`,`outcome`,`cloudId`,`url`,`dir`,`message`,`notes`],requiredFields:[`key`,`outcome`]},async run(t,n){let c=Jz(await rO(e.projectDir).call(`POST`,`/api/cloud/pull`,{target:r,project:s,as:i,dryRun:a,force:o},n.signal));if(!Array.isArray(c.results))throw new K({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported pull response.`});if(!a)for(let e of c.results){if(!iB.has(e.outcome)&&e.outcome!==`failed`)continue;let t=n.effects.begin(`pull.${e.outcome}`,e.key);e.outcome===`failed`?n.effects.set(t,`failed`,{message:e.message}):n.effects.confirm(t)}let l=c.results.some(e=>e.outcome===`failed`)?{kind:`partial`}:c.results.some(e=>aB.has(e.outcome))?{kind:`validation_failed`}:{kind:`succeeded`},u=[`--project-dir`,e.projectDir];return J(c,l,{effects:n.effects.snapshot(),actions:c.results.flatMap(e=>e.outcome===`conflict`?[q([`get`,e.url],`Compare`),q([`pull`,e.cloudId,`--force`,...u],`Take Cloud`)]:e.outcome===`name_clash`?[q([`pull`,e.cloudId,`--as`,`${e.key.split(`/`)[1]}-cloud`,...u],`Pull as`)]:[])})},present:oB},e)}const cB={semantic:sB,name:`pull`,summary:`Pull this project's Cloud artifacts into the local artifacts folder (needs a running server)`,usage:[`[--project <owner/repo>] [--dry-run] [--force] [options]`,`--artifact <type>/<id> | <link-or-cloud-id> [--as <id>] [--dry-run] [--force] [options]`],positionals:1,details:`Each Cloud artifact of the project lands in .artideck/artifacts/<type>/<slug> and stays bound to its Cloud link, so publish updates it instead of creating a new one.
|
|
1399
1399
|
|
|
1400
1400
|
Results:
|
|
1401
1401
|
created no local copy; downloaded and bound
|
|
@@ -1407,5 +1407,5 @@ Results:
|
|
|
1407
1407
|
name_clash the directory holds something else; nothing written. Pull it under another name with --as
|
|
1408
1408
|
failed a download or write failed; the local copy is as it was
|
|
1409
1409
|
|
|
1410
|
-
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
|
|
1411
|
-
`);throw new yB(`Could not tell how ${CN} was installed (${e.file}). Install ${i} with one of:\n${t}\nor run \`${CN} update --pm <${EN.join(`|`)}>\`.`)}if(n.kind===`managed`){if(e.check)return{...a,upToDate:!1,command:`adeck update`};let n=jN(e.env),r=new LN(n).current();if(!r)throw new A(`Managed runtime state is missing; run adeck doctor.`);let o=new LN(n,d.default.dirname(r.bin)),s=d.default.join(n,`downloads`,`runtime-${(0,f.randomUUID)()}`);try{t.beforeInstall?.();let n;return t.downloadRuntime?n=await t.downloadRuntime(i):(u.default.mkdirSync(s,{recursive:!0}),t.log?.(`Downloading ${CN}@${i}`),dP(`npm`,[`install`,`--prefix`,s,`--ignore-scripts`,`--no-audit`,`--no-fund`,`--omit=dev`,`--legacy-peer-deps`,`--registry`,e.registry,`${CN}@${i}`]),n=d.default.join(s,`node_modules`,CN)),o.install(n),{type:`updated`,from:e.current,to:i,pm:`ryugi`,command:`adeck update`}}finally{u.default.rmSync(s,{recursive:!0,force:!0})}}if(n.kind!==`global`)return{...a,upToDate:!1,command:null,message:vB(n,i)};let o=hB(n.pm,i,r);if(e.check)return{...a,upToDate:!1,command:gB(o)};let s=process.platform===`win32`;t.beforeInstall?.();let c=t.log?[`inherit`,`pipe`,`pipe`]:[`inherit`,2,2],l=s?(0,p.spawnSync)(gB(o),{stdio:[...c],env:e.env,shell:!0}):(0,p.spawnSync)(o.cmd,o.args,{stdio:[...c],env:e.env});if(l.stdout?.length&&t.log?.(l.stdout.toString()),l.stderr?.length&&t.log?.(l.stderr.toString()),l.error)throw new A(`Could not run ${gB(o)}: ${l.error.message}`);if(l.status!==0)throw new A(`${gB(o)} exited with ${l.status??l.signal}`);return{type:`updated`,from:e.current,to:i,pm:n.pm,command:gB(o)}}const SB=[BA,HA,oB,BO,Zz,nB,pj,Dj,lj,jR,GM,kM,jj,AL,BL,JM,{machine:!0,name:`update`,summary:`Update the CLI through its original owner, then refresh recorded harness integrations and the daemon`,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 or daemon`},"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=>Z({id:`update`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`],fields:[`current`,`latest`,`install`,`status`,`installed`,`message`,`command`,`plugins`,`daemon`,`hub`]},async run(t,n){if(e.values[`cli-only`]&&e.values[`plugins-only`])throw new A(`Choose --cli-only or --plugins-only`);let r=e.values.check?null:MP(m.default.homedir(),process.env.RYUGI_DEV_LINK||void 0);if(r)throw new K({code:`E_DEV_LINKED`,message:`This machine runs the local build ${r.version} through a dev link, and an update would put released copies over it. Refresh the local build with \`pnpm dev:link\` in the ryugi-cloud checkout, or run \`adeck dev unlink\` first to go back to releases.`},`action_required`);let i,a,o;try{o=e.values[`plugins-only`]?{type:`update-check`,current:`1.118.4`,latest:`1.118.4`,install:AN(__filename,process.env).kind,upToDate:!0,command:null,message:`CLI unchanged; refreshing recorded plugins.`}:await xB({current:`1.118.4`,file:__filename,env:process.env,registry:process.env.npm_config_registry||`https://registry.npmjs.org/`,check:!!e.values.check,pm:e.values.pm},{beforeCache(){a=n.effects.begin(`release-cache`,uB(process.env))},cacheRefreshed(){a!==void 0&&n.effects.confirm(a)},beforeInstall(){i=n.effects.begin(`install`,CN)},log:n.diagnostic})}catch(e){throw e instanceof yB?new K({code:`E_INSTALL_UNKNOWN`,message:e.message},`action_required`):e}o.type===`updated`&&i!==void 0&&n.effects.confirm(i,{from:o.from,to:o.to});let s=o.type===`updated`?{current:o.to,latest:o.to,install:o.pm===`ryugi`?`managed`:`global`,status:`updated`,installed:!0,command:o.command}:{current:o.current,latest:o.latest,install:o.install,status:o.upToDate?`up_to_date`:`available`,installed:!1,command:o.command,...o.message?{message:o.message}:{}},c=d.default.resolve(e.values[`install-dir`]||jN());if(!e.values.check&&!e.values[`cli-only`]){s.plugins=[];for(let t of Object.values(wP(c).harnesses)){let r=await ZL({projectDir:e.projectDir,positionals:[],values:{mode:t.mode,harness:t.harness,"no-cli":!0,"install-dir":c,"plugin-source":e.values[`plugin-source`],"plugin-version":s.current}},n,!1,!0),i=r.data.targets.find(e=>e.harness===t.harness);s.plugins.push({harness:t.harness,mode:t.mode,status:i?.status||`failed`,error:i?.error||(r.completion.kind===`succeeded`?void 0:r.warnings.map(e=>e.message).join(`; `))})}}if(!e.values.check&&!e.values[`plugins-only`]&&s.status!==`available`){let t=await bB(s.current,n);t&&(s.daemon=t),s.hub=await pB({cli:s.status===`updated`?`updated`:`current`,daemon:t?.status===`updated`?`updated`:`current`,from:`1.118.4`,to:s.current,newCli:s.install===`managed`?new LN(jN(process.env)).bin:s.install===`global`?`ryugi`:null,projectDir:e.projectDir},mB)}let l=e.values.check?{warnings:[],actions:[]}:eL(await nL({cleanup:!0,root:c},n,!!process.stdin.isTTY&&!!process.stderr.isTTY));return J(s,s.plugins?.some(e=>e.status!==`installed`)||s.daemon?.status===`failed`||s.hub?.status===`failed`?{kind:`partial`}:void 0,{effects:n.effects.snapshot(),warnings:l.warnings,actions:[...s.install===`launcher`&&s.status===`available`?[q([`start`,`--background`,`--no-open`,`--project-dir`,e.projectDir],`Restart server`)]:[],...l.actions]})},present:fB},e)},$L,dL,nR,SN,YP,ML,cB,rz];function CB(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[{...q(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`?[q([`start`,`--background`,`--no-open`,...o],`Start server`)]:n?.code===`E_ARGUMENT_INVALID`||n?.code===`E_OPTION_CONFLICT`?[q([t.split(`.`)[0],...e.positionals[0]&&t.startsWith(`comment`)?[e.positionals[0]]:[],`--help`],`Help`)]:n?iO(n):[]}}async function wB(e,t,n,r){return yO({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 TB(e,t){return{id:e,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`],fields:[`text`,`version`,`capabilities`,`commands`]},run(){return J(t)},present({data:e}){return e.version?{heading:`artideck ${e.version}`,status:``,facts:[],sections:[]}:{heading:`Help`,status:``,facts:[],sections:[{kind:`content`,key:`text`,text:e.text}]}}}}async function EB(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=ND(c.filter(e=>e!==`--help`&&e!==`-h`),l.options,l.positionals).positionals[0]),s===`--version`||s===`-v`)return ND(c,{},0),await Z(TB(`version`,{text:r,version:r,capabilities:[`reviewBundlesV1`]}),void 0).run(i,a);if(s===`--help`||s===`-h`||l&&PD(c)){l||ND(c,{},0);let e=l?RD(l,d):BD(t,n);if(l&&[`start`,`check`].includes(l.name)){let t=ND(c.filter(e=>e!==`--help`&&e!==`-h`),l.options,l.positionals);t.values.mockup?e=VE():typeof t.values.artifact==`string`&&(e+=`\n\n${BE(t.values.artifact)}`)}return await Z(TB(`help`,{text:e,commands:t.filter(e=>!e.hidden).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=ND(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.projectDir=Qe(t.projectDir).project,t.values.foreground=!0,t.values.open=!t.values[`no-open`],await hA(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=ND(c,LD(l,d),l.positionals)}catch(e){throw new K({code:`E_ARGUMENT_INVALID`,message:e.message})}return f.projectDir=l.machine?Ye(f.projectDir).project:Qe(f.projectDir,{quiet:l.name===`start`||l.name===`migrate`}).project,await l.semantic(f).run(i,a,o,CB(f))}catch(e){let t=e instanceof A?new K({code:`E_ARGUMENT_INVALID`,message:e.message}):e;return t instanceof Error&&Object.assign(t,{actions:[q([...l?[l.name,...d&&l.usage?.some(e=>e.startsWith(`${d} `))?[d]:[]]:[],`--help`],`Help`)]}),wB(l?.name??s??`browse`,t,i,a)}}function DB(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 OB(e){process.exitCode=e}const kB={"no-open":{type:`boolean`,help:`Print the URL without opening a browser`}};async function AB(e){te(`cli`),ez(e),ae(QN());let t=Object.assign({},jD,...SB.map(e=>e.options)),n=DB(),r;try{r=CD(e,t,kD(e,t))}catch(r){return wB(e[0]??`browse`,r,CD(e,t).options,n)}if(r.error)return wB(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 EB(e,SB,kB,`1.118.4`,r.options,n,i.signal)}finally{process.removeListener(`SIGINT`,a),process.removeListener(`SIGTERM`,o)}}AB(process.argv.slice(2)).then(OB,e=>wB(process.argv[2]??`browse`,e,{format:`brief`},DB()).then(OB));
|
|
1410
|
+
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 lB(e){for(let t of $D(e))u.default.rmSync(d.default.join(ve(t.dir),`.state`,`server-info`),{force:!0})}function uB({data:e}){return{heading:`Server`,status:e.status,summary:e.status===e.reason?``:e.reason.replaceAll(`_`,` `),facts:[X(`Scope`,Y(e,`scope`)),X(`Artifacts`,Y(e,`artifacts`))],sections:[]}}async function dB(){let e=XD(),t=t=>{u.default.rmSync(e.info,{force:!0}),lB(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(He(e.pid)===null)return{status:`not_running`};let n=Number(He(e.pid)),r=He(e.serverId)??``;if(!Number.isInteger(n)||n<=0||!/^[\w-]{32,64}$/.test(r)||!Be(n,r))return u.default.rmSync(e.pid,{force:!0}),u.default.rmSync(e.serverId,{force:!0}),t(`stale_pid`),{status:`stale_pid`};t(`stop`),YO(e,{action:`stopped`,pid:n,running:He(e.version)??``,cli:process.env.RYUGI_ARTIFACTS_VERSION||`1.119.0`});try{process.kill(n,`SIGTERM`)}catch{}if(!await Ve(n,7e3)){sA(e)?.unload();try{process.kill(n,`SIGKILL`)}catch{}await Ve(n,1e3)}if(Ie(n))return u.default.rmSync(e.stopped,{force:!0}),{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 fB={machine:!0,name:`stop`,summary:`Stop this machine's artifacts server; the artifacts are kept`,usage:[`[options]`],options:{},semantic:e=>Z({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 dB();return r.status!==`failed`&&t.effects.set(n,r.status===`not_running`?`none`:`confirmed`),J({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:uB},e)};function pB({data:e}){return{heading:`Uninstall`,status:e.failures.length?`partial`:`removed`,facts:[X(`Removed`,{key:`removed`,value:e.removed.join(`, `)}),X(`Preserved`,{key:`preserved`,value:e.preserved.join(` `)})],sections:[{kind:`records`,key:`failures`,rows:e.failures,columns:[{key:`component`,required:!0},{key:`message`,required:!0}]}]}}const mB={machine:!0,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=>Z({id:`uninstall`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`]},run(t,n){let r=typeof e.values.harness==`string`?e.values.harness.split(`,`).map(kP):void 0;if(r?.some(e=>!gP.some(t=>t.id===e)))return J({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`]||LN()),a=n.effects.begin(`uninstall`,i),o=hL(i,{targets:r});return o.failures.length||n.effects.confirm(a,o.removed),J(o,o.failures.length?{kind:`partial`}:{kind:`succeeded`})},present:pB},e)};function hB(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 gB=e=>d.default.join(e.XDG_CACHE_HOME||d.default.join(m.default.homedir(),`.cache`),`ryugi`,`artifacts`,`latest.json`);function _B(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{}}function vB({data:e}){return{heading:`Update`,status:e.status,facts:[X(`Current`,Y(e,`current`),!0),X(`Latest`,Y(e,`latest`)),X(`Install`,Y(e,`install`)),...e.message?[X(`Advice`,Y(e,`message`))]:[],...e.daemon?[X(`Daemon`,{key:`daemon`,value:e.daemon.status===`updated`?`updated ${e.daemon.from} → ${e.daemon.to}`:e.daemon.status===`failed`?`failed: ${e.daemon.error}`:e.daemon.status===`not-running`?`not running; start it to update it`:`current`})]:[],...e.hub&&e.hub.status!==`unchanged`?[X(`Hub`,{key:`hub`,value:e.hub.status===`failed`?`restart failed: ${e.hub.error}`:e.hub.status===`kept-local`?`runs a local build; left as it is`:e.hub.status===`not-running`?`not running`:`restarted on the new version`})]:[]],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`}]}]:[]}}async function yB(e,t){if(e.cli===`current`&&e.daemon===`current`)return{status:`unchanged`};let n=t.running();if(!n)return{status:`not-running`};if(TA(n.version,e.to)===`protected`)return{status:`kept-local`};try{if(e.cli===`updated`&&e.newCli){let n=t.runCli(e.newCli,[`start`,`--background`,`--no-open`,`--project-dir`,e.projectDir]);return n.ok?{status:`restarted`}:{status:`failed`,error:n.output||`start failed`}}return await t.restartHub(e.to),{status:`restarted`}}catch(e){return{status:`failed`,error:e.message}}}const bB={running(){let e=XD(),t=FA(e);return t?{pid:t,version:He(e.version)?.trim()??``}:null},runCli(e,t){let n=(0,p.spawnSync)(e,t,{encoding:`utf8`,shell:process.platform===`win32`,timeout:12e4});return{ok:n.status===0,output:`${n.stderr??``}${n.stdout??``}`.trim()}},async restartHub(e){await sN(e,{reason:`update`,startStopped:!1})}};function xB(e,t,n=kN){let r=`${n}@${t}`;return{cmd:e,args:e===`npm`?[`install`,`-g`,r]:e===`yarn`?[`global`,`add`,r]:[`add`,`-g`,r]}}const SB=({cmd:e,args:t})=>[e,...t].join(` `);async function CB(e,t){let n=e.endsWith(`/`)?e:`${e}/`;try{let e=await fetch(new URL(`${t}/latest`,n),{signal:AbortSignal.timeout(1e4)}),{version:r}=await e.json();if(e.ok&&typeof r==`string`&&/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/.test(r))return r;throw Error(`registry returned ${e.status}`)}catch(e){throw new j(`Could not get the latest ${t} version from ${n}: ${e.message}`)}}function wB(e,t){return e.kind===`transient`?`You ran ${kN} through ${e.runner}, which keeps no install to update. Run \`${e.runner} ${kN}@latest\` to get ${t}.`:e.kind===`local`?"This is a local build from an Artideck 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 TB=class extends j{};async function EB(e,t){if(!mk[process.platform]?.includes(process.arch))return;let n=m.default.homedir(),r,i=await lN({arch:process.arch,cliDir:__dirname,env:process.env,fetch,home:n,platform:process.platform,serverHome:XD().home,version:e},()=>{r=t.effects.begin(`update.daemon`,cN(n).binary)}).catch(e=>({status:`failed`,error:e.message}));if(i.status!==`not-installed`&&i.status!==`other-hub`)return i.status===`updated`&&r!==void 0&&t.effects.confirm(r,{from:i.from,to:i.to}),i}async function DB(e,t={}){if(e.pm!==void 0&&!MN.includes(e.pm))throw new j(`--pm must be one of ${MN.join(`, `)}`);let n=e.pm?{kind:`global`,pm:e.pm}:IN(e.file,e.env),r=n.kind===`global`||n.kind===`unknown`?FN(e.file):kN,i=await CB(e.registry,r);t.beforeCache?.(),_B(gB(e.env),i,Date.now()),t.cacheRefreshed?.();let a={type:`update-check`,current:e.current,latest:i,install:n.kind};if(!hB(i,e.current))return{...a,upToDate:!0,command:null};if(n.kind===`unknown`){let t=MN.map(e=>` ${SB(xB(e,i,r))}`).join(`
|
|
1411
|
+
`);throw new TB(`Could not tell how ${kN} was installed (${e.file}). Install ${i} with one of:\n${t}\nor run \`${kN} update --pm <${MN.join(`|`)}>\`.`)}if(n.kind===`managed`){if(e.check)return{...a,upToDate:!1,command:`adeck update`};let n=LN(e.env),r=new UN(n).current();if(!r)throw new j(`Managed runtime state is missing; run adeck doctor.`);let o=new UN(n,d.default.dirname(r.bin)),s=d.default.join(n,`downloads`,`runtime-${(0,f.randomUUID)()}`);try{t.beforeInstall?.();let n;return t.downloadRuntime?n=await t.downloadRuntime(i):(u.default.mkdirSync(s,{recursive:!0}),t.log?.(`Downloading ${kN}@${i}`),_P(`npm`,[`install`,`--prefix`,s,`--ignore-scripts`,`--no-audit`,`--no-fund`,`--omit=dev`,`--legacy-peer-deps`,`--registry`,e.registry,`${kN}@${i}`]),n=d.default.join(s,`node_modules`,kN)),o.install(n),{type:`updated`,from:e.current,to:i,pm:`ryugi`,command:`adeck update`}}finally{u.default.rmSync(s,{recursive:!0,force:!0})}}if(n.kind!==`global`)return{...a,upToDate:!1,command:null,message:wB(n,i)};let o=xB(n.pm,i,r);if(e.check)return{...a,upToDate:!1,command:SB(o)};let s=process.platform===`win32`;t.beforeInstall?.();let c=t.log?[`inherit`,`pipe`,`pipe`]:[`inherit`,2,2],l=s?(0,p.spawnSync)(SB(o),{stdio:[...c],env:e.env,shell:!0}):(0,p.spawnSync)(o.cmd,o.args,{stdio:[...c],env:e.env});if(l.stdout?.length&&t.log?.(l.stdout.toString()),l.stderr?.length&&t.log?.(l.stderr.toString()),l.error)throw new j(`Could not run ${SB(o)}: ${l.error.message}`);if(l.status!==0)throw new j(`${SB(o)} exited with ${l.status??l.signal}`);return{type:`updated`,from:e.current,to:i,pm:n.pm,command:SB(o)}}const OB=[KA,JA,fB,KO,rB,cB,yj,Nj,hj,LR,ZM,FM,Lj,IL,KL,eN,{machine:!0,name:`update`,summary:`Update the CLI through its original owner, then refresh recorded harness integrations and the daemon`,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 or daemon`},"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=>Z({id:`update`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`],fields:[`current`,`latest`,`install`,`status`,`installed`,`message`,`command`,`plugins`,`daemon`,`hub`]},async run(t,n){if(e.values[`cli-only`]&&e.values[`plugins-only`])throw new j(`Choose --cli-only or --plugins-only`);let r=e.values.check?null:RP(m.default.homedir(),process.env.RYUGI_DEV_LINK||void 0);if(r)throw new K({code:`E_DEV_LINKED`,message:`This machine runs the local build ${r.version} through a dev link, and an update would put released copies over it. Refresh the local build with \`pnpm dev:link\` in the ryugi-cloud checkout, or run \`adeck dev unlink\` first to go back to releases.`},`action_required`);let i,a,o;try{o=e.values[`plugins-only`]?{type:`update-check`,current:`1.119.0`,latest:`1.119.0`,install:IN(__filename,process.env).kind,upToDate:!0,command:null,message:`CLI unchanged; refreshing recorded plugins.`}:await DB({current:`1.119.0`,file:__filename,env:process.env,registry:process.env.npm_config_registry||`https://registry.npmjs.org/`,check:!!e.values.check,pm:e.values.pm},{beforeCache(){a=n.effects.begin(`release-cache`,gB(process.env))},cacheRefreshed(){a!==void 0&&n.effects.confirm(a)},beforeInstall(){i=n.effects.begin(`install`,kN)},log:n.diagnostic})}catch(e){throw e instanceof TB?new K({code:`E_INSTALL_UNKNOWN`,message:e.message},`action_required`):e}o.type===`updated`&&i!==void 0&&n.effects.confirm(i,{from:o.from,to:o.to});let s=o.type===`updated`?{current:o.to,latest:o.to,install:o.pm===`ryugi`?`managed`:`global`,status:`updated`,installed:!0,command:o.command}:{current:o.current,latest:o.latest,install:o.install,status:o.upToDate?`up_to_date`:`available`,installed:!1,command:o.command,...o.message?{message:o.message}:{}},c=d.default.resolve(e.values[`install-dir`]||LN());if(!e.values.check&&!e.values[`cli-only`]){s.plugins=[];for(let t of Object.values(AP(c).harnesses)){let r=await rR({projectDir:e.projectDir,positionals:[],values:{mode:t.mode,harness:t.harness,"no-cli":!0,"install-dir":c,"plugin-source":e.values[`plugin-source`],"plugin-version":s.current}},n,!1,!0),i=r.data.targets.find(e=>e.harness===t.harness);s.plugins.push({harness:t.harness,mode:t.mode,status:i?.status||`failed`,error:i?.error||(r.completion.kind===`succeeded`?void 0:r.warnings.map(e=>e.message).join(`; `))})}}if(!e.values.check&&!e.values[`plugins-only`]&&s.status!==`available`){let t=await EB(s.current,n);t&&(s.daemon=t),s.hub=await yB({cli:s.status===`updated`?`updated`:`current`,daemon:t?.status===`updated`?`updated`:`current`,from:`1.119.0`,to:s.current,newCli:s.install===`managed`?new UN(LN(process.env)).bin:s.install===`global`?`ryugi`:null,projectDir:e.projectDir},bB)}let l=e.values.check?{warnings:[],actions:[]}:oL(await cL({cleanup:!0,root:c},n,!!process.stdin.isTTY&&!!process.stderr.isTTY));return J(s,s.plugins?.some(e=>e.status!==`installed`)||s.daemon?.status===`failed`||s.hub?.status===`failed`?{kind:`partial`}:void 0,{effects:n.effects.snapshot(),warnings:l.warnings,actions:[...s.install===`launcher`&&s.status===`available`?[q([`start`,`--background`,`--no-open`,`--project-dir`,e.projectDir],`Restart server`)]:[],...l.actions]})},present:vB},e)},aR,_L,cR,ON,tF,RL,mB,lz];function kB(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[{...q(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`?[q([`start`,`--background`,`--no-open`,...o],`Start server`)]:n?.code===`E_ARGUMENT_INVALID`||n?.code===`E_OPTION_CONFLICT`?[q([t.split(`.`)[0],...e.positionals[0]&&t.startsWith(`comment`)?[e.positionals[0]]:[],`--help`],`Help`)]:n?uO(n):[]}}async function AB(e,t,n,r){return TO({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 jB(e,t){return{id:e,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`],fields:[`text`,`version`,`capabilities`,`commands`]},run(){return J(t)},present({data:e}){return e.version?{heading:`artideck ${e.version}`,status:``,facts:[],sections:[]}:{heading:`Help`,status:``,facts:[],sections:[{kind:`content`,key:`text`,text:e.text}]}}}}async function MB(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=zD(c.filter(e=>e!==`--help`&&e!==`-h`),l.options,l.positionals).positionals[0]),s===`--version`||s===`-v`)return zD(c,{},0),await Z(jB(`version`,{text:r,version:r,capabilities:[`reviewBundlesV1`]}),void 0).run(i,a);if(s===`--help`||s===`-h`||l&&BD(c)){l||zD(c,{},0);let e=l?WD(l,d):KD(t,n);if(l&&[`start`,`check`].includes(l.name)){let t=zD(c.filter(e=>e!==`--help`&&e!==`-h`),l.options,l.positionals);t.values.mockup?e=qE():typeof t.values.artifact==`string`&&(e+=`\n\n${KE(t.values.artifact)}`)}return await Z(jB(`help`,{text:e,commands:t.filter(e=>!e.hidden).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=zD(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.projectDir=Ze(t.projectDir).project,t.values.foreground=!0,t.values.open=!t.values[`no-open`],await xA(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=zD(c,UD(l,d),l.positionals)}catch(e){throw new K({code:`E_ARGUMENT_INVALID`,message:e.message})}return f.projectDir=l.machine?Je(f.projectDir).project:Ze(f.projectDir,{quiet:l.name===`start`||l.name===`migrate`}).project,await l.semantic(f).run(i,a,o,kB(f))}catch(e){let t=e instanceof j?new K({code:`E_ARGUMENT_INVALID`,message:e.message}):e;return t instanceof Error&&Object.assign(t,{actions:[q([...l?[l.name,...d&&l.usage?.some(e=>e.startsWith(`${d} `))?[d]:[]]:[],`--help`],`Help`)]}),AB(l?.name??s??`browse`,t,i,a)}}function NB(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 PB(e){process.exitCode=e}const FB={"no-open":{type:`boolean`,help:`Print the URL without opening a browser`}};async function IB(e){te(`cli`),oz(e),ie(iP());let t=Object.assign({},LD,...OB.map(e=>e.options)),n=NB(),r;try{r=kD(e,t,FD(e,t))}catch(r){return AB(e[0]??`browse`,r,kD(e,t).options,n)}if(r.error)return AB(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 MB(e,OB,FB,`1.119.0`,r.options,n,i.signal)}finally{process.removeListener(`SIGINT`,a),process.removeListener(`SIGTERM`,o)}}IB(process.argv.slice(2)).then(PB,e=>AB(process.argv[2]??`browse`,e,{format:`brief`},NB()).then(PB));
|